55 * file being parsed. |
55 * file being parsed. |
56 */ |
56 */ |
57 const char *current_filename = NULL; |
57 const char *current_filename = NULL; |
58 |
58 |
59 |
59 |
60 |
60 /******************************************************/ |
|
61 /* whether we are suporting safe extensions */ |
|
62 /* as defined in PLCopen - Technical Committee 5 */ |
|
63 /* Safety Software Technical Specification, */ |
|
64 /* Part 1: Concepts and Function Blocks, */ |
|
65 /* Version 1.0 – Official Release */ |
|
66 /******************************************************/ |
|
67 bool safe_extensions_ = false; |
|
68 bool get_opt_safe_extensions() {return safe_extensions_;} |
61 |
69 |
62 /****************************************************/ |
70 /****************************************************/ |
63 /* Controlling the entry to the body_state in flex. */ |
71 /* Controlling the entry to the body_state in flex. */ |
64 /****************************************************/ |
72 /****************************************************/ |
65 static int goto_body_state__ = 0; |
73 static int goto_body_state__ = 0; |
261 /***********************************************************************/ |
269 /***********************************************************************/ |
262 /***********************************************************************/ |
270 /***********************************************************************/ |
263 /***********************************************************************/ |
271 /***********************************************************************/ |
264 |
272 |
265 |
273 |
266 int stage1_2__(const char *filename, const char *includedir, symbol_c **tree_root_ref, bool full); |
274 int stage2__(const char *filename, |
267 |
275 const char *includedir, /* Include directory, where included files will be searched for... */ |
268 |
276 symbol_c **tree_root_ref, |
269 int stage1_2(const char *filename, const char *includedir, symbol_c **tree_root_ref, bool full) { |
277 bool full_token_loc /* error messages specify full token location */ |
270 return stage1_2__(filename, includedir, tree_root_ref, full); |
278 ); |
271 } |
279 |
272 |
280 |
|
281 int stage1_2(const char *filename, symbol_c **tree_root_ref, stage1_2_options_t options) { |
|
282 /* NOTE: we only call stage2 (bison - syntax analysis) directly, as stage 2 will itself call stage1 (flex - lexical analysis) |
|
283 * automatically as needed |
|
284 */ |
|
285 |
|
286 /* NOTE: Since we do not call stage1__ (flex) directly, we cannot directly pass any parameters to that function either. |
|
287 * In this case, we use callback functions, i.e. stage1__ (i.e. flex) will call functions defined in this file |
|
288 * whenever it needs info/parameters coming from stage1_2(). |
|
289 * These callback functions will get their data from local (to this file) global variables... |
|
290 * We now set those variables... |
|
291 */ |
|
292 safe_extensions_ = options.safe_extensions; |
|
293 |
|
294 return stage2__(filename, options.includedir, tree_root_ref, options.full_token_loc); |
|
295 } |
|
296 |