blob: 58afaf5e05a1ca1920e042f47e7576051769a8ff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#ifndef BUILDER_H
#define BUILDER_H
#include <string>
#include <list>
#include <map>
#include "build.tab.h"
#include "exceptionbase.h"
subExceptionDecl( BuildException )
class Builder;
class Action;
class Command;
#define YY_DECL int yylex( YYSTYPE *yylval_param, YYLTYPE *yylloc_param, Builder &bld )
YY_DECL;
class Builder
{
struct ltstr
{
bool operator()(const char* s1, const char* s2) const
{
return strcmp(s1, s2) < 0;
}
};
public:
Builder();
virtual ~Builder();
void load( const char *sFN );
//void error( const yy::location &l, const std::string &m );
//void error( const std::string &m );
std::string file;
void add( Action *pAct );
void add( Command *pCmd );
bool hasDefaultAction()
{
return pDefaultAction != NULL;
}
void debug();
private:
void scanBegin();
void scanEnd();
Action *pDefaultAction;
Action *pLastAddedAction;
std::map<const char *, Action *, ltstr> mAction;
};
#endif
|