src/parser.h

changeset 75
bf8c57437231
parent 74
007fbadfa7f9
child 77
ad17801b1a36
equal deleted inserted replaced
74:007fbadfa7f9 75:bf8c57437231
1 /* 1 /*
2 Copyright (c) 2013-2014, Santeri Piippo 2 Copyright (c) 2012-2014, Santeri Piippo
3 All rights reserved. 3 All rights reserved.
4 4
5 Redistribution and use in source and binary forms, with or without 5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met: 6 modification, are permitted provided that the following conditions are met:
7 7
79 }; 79 };
80 80
81 struct operator_info 81 struct operator_info
82 { 82 {
83 operator_e opercode; 83 operator_e opercode;
84 DATAHEADERS_e dataheader; 84 e_data_header dataheader;
85 e_token token; 85 e_token token;
86 }; 86 };
87 87
88 // Mark types 88 // Mark types
89 enum marktype_e 89 enum marktype_e
163 // ==================================================================== 163 // ====================================================================
164 // METHODS 164 // METHODS
165 botscript_parser(); 165 botscript_parser();
166 ~botscript_parser(); 166 ~botscript_parser();
167 void parse_botscript (string file_name, object_writer* w); 167 void parse_botscript (string file_name, object_writer* w);
168 data_buffer* ParseCommand (CommandDef* comm); 168 data_buffer* ParseCommand (command_info* comm);
169 data_buffer* parse_expression (type_e reqtype); 169 data_buffer* parse_expression (type_e reqtype);
170 data_buffer* ParseAssignment (script_variable* var); 170 data_buffer* ParseAssignment (script_variable* var);
171 int parse_operator (bool peek = false); 171 int parse_operator (bool peek = false);
172 data_buffer* parse_expr_value (type_e reqtype); 172 data_buffer* parse_expr_value (type_e reqtype);
173 string parse_float (); 173 string parse_float ();
179 bool token_is (e_token a); 179 bool token_is (e_token a);
180 string token_string(); 180 string token_string();
181 string describe_position() const; 181 string describe_position() const;
182 182
183 private: 183 private:
184 lexer* m_lx; 184 lexer* m_lx;
185 }; 185 object_writer* m_writer;
186 186 void parse_state_block();
187 constant_info* find_constant_by_name (string token); 187 void parse_event_block();
188 void parse_mainloop();
189 void parse_on_enter_exit();
190 void parse_variable_declaration();
191 void parse_goto();
192 void parse_if();
193 void parse_else();
194 void parse_while_block();
195 void parse_for_block();
196 void parse_do_block();
197 void parse_switch_block();
198 void parse_switch_case();
199 void parse_switch_default();
200 void parse_break();
201 void parse_continue();
202 void parse_continue();
203 void parse_block_end();
204 void parse_const();
205 void parse_label();
206 };
207
208 constant_info* find_constant (const string& tok);
188 209
189 #endif // BOTC_PARSER_H 210 #endif // BOTC_PARSER_H

mercurial