summaryrefslogtreecommitdiff
path: root/src/gamebuilder.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gamebuilder.cpp')
-rw-r--r--src/gamebuilder.cpp22
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
12using namespace Bu; 13using namespace Bu;
13 14
@@ -27,6 +28,27 @@ GameBuilder::~GameBuilder()
27{ 28{
28} 29}
29 30
31typedef void *yyscan_t;
32void yylex_init( yyscan_t * );
33void yylex_destroy( yyscan_t );
34void yyparse( yyscan_t, GameBuilder &bld );
35void yyset_in( FILE *, yyscan_t );
36
37void 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
30void GameBuilder::setLiteral( const Variable &v ) 52void GameBuilder::setLiteral( const Variable &v )
31{ 53{
32 vLiteral = v; 54 vLiteral = v;