41 |
41 |
42 /* file with declaration of absyntax classes... */ |
42 /* file with declaration of absyntax classes... */ |
43 #include "../absyntax/absyntax.hh" |
43 #include "../absyntax/absyntax.hh" |
44 |
44 |
45 |
45 |
|
46 #include "../main.hh" |
46 #include "stage1_2.hh" |
47 #include "stage1_2.hh" |
47 #include "iec_bison.hh" |
48 #include "iec_bison.hh" |
48 #include "stage1_2_priv.hh" |
49 #include "stage1_2_priv.hh" |
49 #include "create_enumtype_conversion_functions.hh" |
50 #include "create_enumtype_conversion_functions.hh" |
50 |
51 |
51 |
52 |
52 |
53 |
53 |
54 |
54 static stage1_2_options_t options_; |
|
55 |
55 |
56 /******************************************************/ |
56 /******************************************************/ |
57 /* whether we are supporting safe extensions */ |
57 /* whether we are supporting safe extensions */ |
58 /* as defined in PLCopen - Technical Committee 5 */ |
58 /* as defined in PLCopen - Technical Committee 5 */ |
59 /* Safety Software Technical Specification, */ |
59 /* Safety Software Technical Specification, */ |
60 /* Part 1: Concepts and Function Blocks, */ |
60 /* Part 1: Concepts and Function Blocks, */ |
61 /* Version 1.0 – Official Release */ |
61 /* Version 1.0 – Official Release */ |
62 /******************************************************/ |
62 /******************************************************/ |
63 bool get_opt_safe_extensions() {return options_.safe_extensions;} |
63 bool get_opt_safe_extensions() {return runtime_options.safe_extensions;} |
64 |
64 |
65 /************************************/ |
65 /************************************/ |
66 /* whether to allow nested comments */ |
66 /* whether to allow nested comments */ |
67 /************************************/ |
67 /************************************/ |
68 bool get_opt_nested_comments() {return options_.nested_comments;} |
68 bool get_opt_nested_comments() {return runtime_options.nested_comments;} |
69 |
69 |
70 /**************************************************************************/ |
70 /**************************************************************************/ |
71 /* whether to allow REF(), DREF(), REF_TO, NULL and ^ operators/keywords */ |
71 /* whether to allow REF(), DREF(), REF_TO, NULL and ^ operators/keywords */ |
72 /**************************************************************************/ |
72 /**************************************************************************/ |
73 bool get_opt_ref_standard_extensions() {return options_.ref_standard_extensions;} |
73 bool get_opt_ref_standard_extensions() {return runtime_options.ref_standard_extensions;} |
74 |
74 |
75 |
75 |
76 |
76 |
77 /****************************************************/ |
77 /****************************************************/ |
78 /* Controlling the entry to the body_state in flex. */ |
78 /* Controlling the entry to the body_state in flex. */ |
224 /***********************************************************************/ |
224 /***********************************************************************/ |
225 /***********************************************************************/ |
225 /***********************************************************************/ |
226 /***********************************************************************/ |
226 /***********************************************************************/ |
227 |
227 |
228 int stage2__(const char *filename, |
228 int stage2__(const char *filename, |
229 symbol_c **tree_root_ref, |
229 symbol_c **tree_root_ref |
230 stage1_2_options_t options |
|
231 ); |
230 ); |
232 |
231 |
233 |
232 |
234 int stage1_2(const char *filename, symbol_c **tree_root_ref, stage1_2_options_t options) { |
233 int stage1_2(const char *filename, symbol_c **tree_root_ref) { |
235 /* NOTE: we only call stage2 (bison - syntax analysis) directly, as stage 2 will itself call stage1 (flex - lexical analysis) |
234 /* NOTE: we only call stage2 (bison - syntax analysis) directly, as stage 2 will itself call stage1 (flex - lexical analysis) |
236 * automatically as needed |
235 * automatically as needed |
237 */ |
236 */ |
238 |
237 |
239 /* NOTE: Since we do not call stage1__ (flex) directly, we cannot directly pass any parameters to that function either. |
238 /* NOTE: Since we do not call stage1__ (flex) directly, we cannot directly pass any parameters to that function either. |
240 * In this case, we use callback functions, i.e. stage1__ (i.e. flex) will call functions defined in this file |
239 * In this case, we use callback functions, i.e. stage1__ (i.e. flex) will call functions defined in this file |
241 * whenever it needs info/parameters coming from stage1_2(). |
240 * whenever it needs info/parameters coming from stage1_2(). |
242 * These callback functions will get their data from local (to this file) global variables... |
241 * These callback functions will get their data from local (to this file) global variables... |
243 * We now set those variables... |
242 * We now set those variables... |
244 */ |
243 */ |
245 options_ = options; |
244 return stage2__(filename, tree_root_ref); |
246 return stage2__(filename, tree_root_ref, options); |
245 } |
247 } |
246 |
248 |
|