diff options
Diffstat (limited to 'src/gamebuilder.cpp')
-rw-r--r-- | src/gamebuilder.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/gamebuilder.cpp b/src/gamebuilder.cpp index 3cf2e1f..83cbe79 100644 --- a/src/gamebuilder.cpp +++ b/src/gamebuilder.cpp | |||
@@ -8,6 +8,7 @@ | |||
8 | #include "astfunction.h" | 8 | #include "astfunction.h" |
9 | #include "command.h" | 9 | #include "command.h" |
10 | #include "situation.h" | 10 | #include "situation.h" |
11 | #include "parser.tab.h" | ||
11 | 12 | ||
12 | using namespace Bu; | 13 | using namespace Bu; |
13 | 14 | ||
@@ -27,6 +28,27 @@ GameBuilder::~GameBuilder() | |||
27 | { | 28 | { |
28 | } | 29 | } |
29 | 30 | ||
31 | typedef void *yyscan_t; | ||
32 | void yylex_init( yyscan_t * ); | ||
33 | void yylex_destroy( yyscan_t ); | ||
34 | void yyparse( yyscan_t, GameBuilder &bld ); | ||
35 | void yyset_in( FILE *, yyscan_t ); | ||
36 | |||
37 | void GameBuilder::parse( const Bu::String &sFile ) | ||
38 | { | ||
39 | yyscan_t scanner; | ||
40 | |||
41 | yylex_init( &scanner ); | ||
42 | |||
43 | FILE *in = fopen( sFile.getStr(), "rb" ); | ||
44 | yyset_in( in, scanner ); | ||
45 | |||
46 | yyparse( scanner, *this ); | ||
47 | yylex_destroy( scanner ); | ||
48 | |||
49 | fclose( in ); | ||
50 | } | ||
51 | |||
30 | void GameBuilder::setLiteral( const Variable &v ) | 52 | void GameBuilder::setLiteral( const Variable &v ) |
31 | { | 53 | { |
32 | vLiteral = v; | 54 | vLiteral = v; |