src/Parser.h

changeset 101
9ffae10ef76f
parent 98
ea02b78a737a
child 105
6dbac3305614
equal deleted inserted replaced
100:e0392814ee31 101:9ffae10ef76f
114 List<CaseInfo> cases; 114 List<CaseInfo> cases;
115 }; 115 };
116 116
117 // ============================================================================ 117 // ============================================================================
118 // 118 //
119 struct ConstantInfo
120 {
121 String name;
122 EType type;
123 String val;
124 };
125
126 // ============================================================================
127 //
128 class BotscriptParser 119 class BotscriptParser
129 { 120 {
130 PROPERTY (public, bool, ReadOnly, BOOL_OPS, STOCK_WRITE) 121 PROPERTY (public, bool, ReadOnly, BOOL_OPS, STOCK_WRITE)
131 122
132 public: 123 public:
136 eResetScope, 127 eResetScope,
137 }; 128 };
138 129
139 BotscriptParser(); 130 BotscriptParser();
140 ~BotscriptParser(); 131 ~BotscriptParser();
141 ConstantInfo* FindConstant (const String& tok);
142 void ParseBotscript (String fileName); 132 void ParseBotscript (String fileName);
143 DataBuffer* ParseCommand (CommandInfo* comm); 133 DataBuffer* ParseCommand (CommandInfo* comm);
144 DataBuffer* ParseAssignment (ScriptVariable* var); 134 DataBuffer* ParseAssignment (ScriptVariable* var);
145 EAssignmentOperator ParseAssignmentOperator (); 135 EAssignmentOperator ParseAssignmentOperator ();
146 String ParseFloat(); 136 String ParseFloat();
190 bool mGotMainLoop; 180 bool mGotMainLoop;
191 int mScopeCursor; 181 int mScopeCursor;
192 DataBuffer* mIfExpression; 182 DataBuffer* mIfExpression;
193 bool mCanElse; 183 bool mCanElse;
194 List<UndefinedLabel> mUndefinedLabels; 184 List<UndefinedLabel> mUndefinedLabels;
195 List<ConstantInfo> mConstants;
196 185
197 // How many bytes have we written to file? 186 // How many bytes have we written to file?
198 int mNumWrittenBytes; 187 int mNumWrittenBytes;
199 188
200 // Scope data 189 // Scope data
203 DataBuffer* buffer(); 192 DataBuffer* buffer();
204 void ParseStateBlock(); 193 void ParseStateBlock();
205 void ParseEventBlock(); 194 void ParseEventBlock();
206 void ParseMainloop(); 195 void ParseMainloop();
207 void ParseOnEnterExit(); 196 void ParseOnEnterExit();
208 void ParseVariableDeclaration(); 197 void ParseVar();
209 void ParseGoto(); 198 void ParseGoto();
210 void ParseIf(); 199 void ParseIf();
211 void ParseElse(); 200 void ParseElse();
212 void ParseWhileBlock(); 201 void ParseWhileBlock();
213 void ParseForBlock(); 202 void ParseForBlock();
216 void ParseSwitchCase(); 205 void ParseSwitchCase();
217 void ParseSwitchDefault(); 206 void ParseSwitchDefault();
218 void ParseBreak(); 207 void ParseBreak();
219 void ParseContinue(); 208 void ParseContinue();
220 void ParseBlockEnd(); 209 void ParseBlockEnd();
221 void ParseConst();
222 void ParseLabel(); 210 void ParseLabel();
223 void ParseEventdef(); 211 void ParseEventdef();
224 void ParseFuncdef(); 212 void ParseFuncdef();
225 void writeMemberBuffers(); 213 void writeMemberBuffers();
226 void WriteStringTable(); 214 void WriteStringTable();

mercurial