aboutsummaryrefslogtreecommitdiff
path: root/src/builder.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-07-30 09:07:20 +0000
committerMike Buland <eichlan@xagasoft.com>2006-07-30 09:07:20 +0000
commit113fc467a7170a8a564049c64d1036dd10e6abac (patch)
treee4719817a3e0175a9f7cbd4e07fc994ff41f8ef6 /src/builder.h
parent900976d2d74e0de57858b265c2ef0d17a29e921a (diff)
downloadbuild-113fc467a7170a8a564049c64d1036dd10e6abac.tar.gz
build-113fc467a7170a8a564049c64d1036dd10e6abac.tar.bz2
build-113fc467a7170a8a564049c64d1036dd10e6abac.tar.xz
build-113fc467a7170a8a564049c64d1036dd10e6abac.zip
It's starting to look pretty good, just trying to figure out how to get through
everything that needs to be made modular and general.
Diffstat (limited to '')
-rw-r--r--src/builder.h41
1 files changed, 32 insertions, 9 deletions
diff --git a/src/builder.h b/src/builder.h
index e379608..58afaf5 100644
--- a/src/builder.h
+++ b/src/builder.h
@@ -2,35 +2,58 @@
2#define BUILDER_H 2#define BUILDER_H
3 3
4#include <string> 4#include <string>
5#include <list>
6#include <map>
7#include "build.tab.h"
8#include "exceptionbase.h"
5 9
6union YYSTYPE; 10subExceptionDecl( BuildException )
7 11
8namespace yy
9{
10 class location;
11 class BuildParser;
12}
13class Builder; 12class Builder;
13class Action;
14class Command;
14 15
15#define YY_DECL int yylex( YYSTYPE *yylval_param, yy::location *yylloc, Builder &bld ) 16#define YY_DECL int yylex( YYSTYPE *yylval_param, YYLTYPE *yylloc_param, Builder &bld )
16YY_DECL; 17YY_DECL;
17 18
18class Builder 19class Builder
19{ 20{
21 struct ltstr
22 {
23 bool operator()(const char* s1, const char* s2) const
24 {
25 return strcmp(s1, s2) < 0;
26 }
27 };
28
20public: 29public:
21 Builder(); 30 Builder();
22 virtual ~Builder(); 31 virtual ~Builder();
23 32
24 void load( const char *sFN ); 33 void load( const char *sFN );
25 34
26 void error( const yy::location &l, const std::string &m ); 35 //void error( const yy::location &l, const std::string &m );
27 void error( const std::string &m ); 36 //void error( const std::string &m );
28 37
29 std::string file; 38 std::string file;
30 39
40 void add( Action *pAct );
41 void add( Command *pCmd );
42
43 bool hasDefaultAction()
44 {
45 return pDefaultAction != NULL;
46 }
47
48 void debug();
49
31private: 50private:
32 void scanBegin(); 51 void scanBegin();
33 void scanEnd(); 52 void scanEnd();
53
54 Action *pDefaultAction;
55 Action *pLastAddedAction;
56 std::map<const char *, Action *, ltstr> mAction;
34}; 57};
35 58
36#endif 59#endif