summaryrefslogtreecommitdiff
path: root/src/gamebuilder.h
blob: 80df1bc50aec63b9c7c0116790cf0e9b33c20eee (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
60
61
62
63
#ifndef GAME_BUILDER_H
#define GAME_BUILDER_H

#include <bu/string.h>

#include "variable.h"
#include "astnode.h"
#include "situation.h"

class GameBuilder
{
public:
	GameBuilder();
	virtual ~GameBuilder();

	void parse( const Bu::String &sFile );

	class Game *getGame() { return pGame; }

	void setLiteral( const Variable &v );
	void setGameParam( const Bu::String &sName );

	void beginFunction( const Bu::String &sName );
	void addFunctionParam( const Bu::String &sName );
	void endFunctionParams();
	void endFunction();

	void beginSituation( const Bu::String &sName, Situation::InputType tInput );
	void beginSituationMode( Situation::Mode m );
	void closeSituationMode();
	void endSituation();

	void addNode( AstNode::Type iType );
	void closeNode();
	void addLiteral( const Variable &v );
	void addVarRef( const Bu::String &sName, ScopeId sid );
	void addFuncCall( const Bu::String &sName );

	void beginGlobal();
	void closeGlobal();

	void beginCommand( const Bu::String &sValue );
	void addCommandLiteral( const Bu::String &sValue );
	void addCommandParam( const Bu::String &sValue );
	void endCommandParams();
	void closeCommand();
	
	void beginOption( const Bu::String &sValue );
	void closeOption();

private:
	class Game *pGame;
	bool bGlobal;
	Variable vLiteral;
	class AstBranch *pCurNode;
	class AstBranch *pCurRoot;
	class Command *pCurCmd;
	class AstFunction *pCurFnc;
	class Situation *pCurSit;
	Situation::Mode eCurSitMode;
};

#endif