130 SYM_TOKEN(signed_real_c) |
136 SYM_TOKEN(signed_real_c) |
131 */ |
137 */ |
132 |
138 |
133 SYM_REF1(neg_literal_c, exp) |
139 SYM_REF1(neg_literal_c, exp) |
134 |
140 |
|
141 /* Not required: |
135 SYM_REF2(numeric_literal_c, type, value) |
142 SYM_REF2(numeric_literal_c, type, value) |
|
143 */ |
136 SYM_REF2(integer_literal_c, type, value) |
144 SYM_REF2(integer_literal_c, type, value) |
137 SYM_REF2(real_literal_c, type, value) |
145 SYM_REF2(real_literal_c, type, value) |
138 SYM_REF2(bit_string_literal_c, type, value) |
146 SYM_REF2(bit_string_literal_c, type, value) |
139 SYM_REF2(boolean_literal_c, type, value) |
147 SYM_REF2(boolean_literal_c, type, value) |
140 |
148 |
204 SYM_REF0(word_type_name_c) |
212 SYM_REF0(word_type_name_c) |
205 SYM_REF0(dword_type_name_c) |
213 SYM_REF0(dword_type_name_c) |
206 SYM_REF0(lword_type_name_c) |
214 SYM_REF0(lword_type_name_c) |
207 SYM_REF0(string_type_name_c) |
215 SYM_REF0(string_type_name_c) |
208 SYM_REF0(wstring_type_name_c) |
216 SYM_REF0(wstring_type_name_c) |
|
217 |
|
218 /* |
209 SYM_REF0(constant_int_type_name_c) |
219 SYM_REF0(constant_int_type_name_c) |
210 SYM_REF0(constant_real_type_name_c) |
220 SYM_REF0(constant_real_type_name_c) |
|
221 */ |
211 |
222 |
212 |
223 |
213 /********************************/ |
224 /********************************/ |
214 /* B.1.3.2 - Generic data types */ |
225 /* B.1.3.2 - Generic data types */ |
215 /********************************/ |
226 /********************************/ |
401 SYM_REF0(constant_option_c) |
412 SYM_REF0(constant_option_c) |
402 SYM_REF0(retain_option_c) |
413 SYM_REF0(retain_option_c) |
403 SYM_REF0(non_retain_option_c) |
414 SYM_REF0(non_retain_option_c) |
404 |
415 |
405 /* option -> the RETAIN/NON_RETAIN/<NULL> directive... */ |
416 /* option -> the RETAIN/NON_RETAIN/<NULL> directive... */ |
406 SYM_REF2(input_declarations_c, option, input_declaration_list) |
417 /* NOTE: We need to implicitly define the EN and ENO function and FB parameters when the user |
|
418 * does not do it explicitly in the IEC 61131-3 source code. |
|
419 * To be able to distinguish later on between implictly and explicitly defined |
|
420 * variables, we use the 'method' flag that allows us to remember |
|
421 * whether this declaration was in the original source code (method -> implicit_definition_c) |
|
422 * or not (method -> explicit_definition_c). |
|
423 */ |
|
424 SYM_REF3(input_declarations_c, option, input_declaration_list, method) |
407 |
425 |
408 /* helper symbol for input_declarations */ |
426 /* helper symbol for input_declarations */ |
409 SYM_LIST(input_declaration_list_c) |
427 SYM_LIST(input_declaration_list_c) |
410 |
428 |
|
429 /* NOTE: The formal definition of the standard is erroneous, as it simply does not |
|
430 * consider the EN and ENO keywords! |
|
431 * The semantic description of the languages clearly states that these may be |
|
432 * used in several ways. One of them is to declare an EN input parameter, or |
|
433 * an ENO output parameter. |
|
434 * We have added the 'en_param_declaration_c' and 'eno_param_declaration_c' |
|
435 * to cover for this. |
|
436 * |
|
437 * We could have re-used the standard class used for all other input variables (with |
|
438 * an identifier set to 'EN' or 'ENO') however we may sometimes need to add this |
|
439 * declaration implicitly (if the user does not include it in the source |
|
440 * code himself), and it is good to know whether it was added implicitly or not. |
|
441 * So we create a new class that has a 'method' flag that allows us to remember |
|
442 * whether this declaration was in the original source code (method -> implicit_definition_c) |
|
443 * or not (method -> explicit_definition_c). |
|
444 */ |
|
445 SYM_REF0(implicit_definition_c) |
|
446 SYM_REF0(explicit_definition_c) |
|
447 SYM_REF4(en_param_declaration_c, name, type, value, method) |
|
448 SYM_REF3(eno_param_declaration_c, name, type, method) |
|
449 |
411 /* edge -> The F_EDGE or R_EDGE directive */ |
450 /* edge -> The F_EDGE or R_EDGE directive */ |
412 SYM_REF2(edge_declaration_c, edge, var1_list) |
451 SYM_REF2(edge_declaration_c, edge, var1_list) |
413 |
|
414 SYM_REF0(en_param_declaration_c) |
|
415 |
452 |
416 SYM_REF0(raising_edge_option_c) |
453 SYM_REF0(raising_edge_option_c) |
417 SYM_REF0(falling_edge_option_c) |
454 SYM_REF0(falling_edge_option_c) |
418 |
455 |
419 /* spec_init is one of the following... |
456 /* spec_init is one of the following... |
439 /* fb_name_list ',' fb_name */ |
476 /* fb_name_list ',' fb_name */ |
440 SYM_LIST(fb_name_list_c) |
477 SYM_LIST(fb_name_list_c) |
441 |
478 |
442 /* VAR_OUTPUT [RETAIN | NON_RETAIN] var_init_decl_list END_VAR */ |
479 /* VAR_OUTPUT [RETAIN | NON_RETAIN] var_init_decl_list END_VAR */ |
443 /* option -> may be NULL ! */ |
480 /* option -> may be NULL ! */ |
444 SYM_REF2(output_declarations_c, option, var_init_decl_list) |
481 /* NOTE: We need to implicitly define the EN and ENO function and FB parameters when the user |
445 |
482 * does not do it explicitly in the IEC 61131-3 source code. |
446 SYM_REF0(eno_param_declaration_c) |
483 * To be able to distinguish later on between implictly and explicitly defined |
|
484 * variables, we use the 'method' flag that allows us to remember |
|
485 * whether this declaration was in the original source code (method -> implicit_definition_c) |
|
486 * or not (method -> explicit_definition_c). |
|
487 */ |
|
488 SYM_REF3(output_declarations_c, option, var_init_decl_list, method) |
447 |
489 |
448 /* VAR_IN_OUT var_declaration_list END_VAR */ |
490 /* VAR_IN_OUT var_declaration_list END_VAR */ |
449 SYM_REF1(input_output_declarations_c, var_declaration_list) |
491 SYM_REF1(input_output_declarations_c, var_declaration_list) |
450 |
492 |
451 /* helper symbol for input_output_declarations */ |
493 /* helper symbol for input_output_declarations */ |
883 SYM_REF2(mod_expression_c, l_exp, r_exp) |
925 SYM_REF2(mod_expression_c, l_exp, r_exp) |
884 SYM_REF2(power_expression_c, l_exp, r_exp) |
926 SYM_REF2(power_expression_c, l_exp, r_exp) |
885 SYM_REF1(neg_expression_c, exp) |
927 SYM_REF1(neg_expression_c, exp) |
886 SYM_REF1(not_expression_c, exp) |
928 SYM_REF1(not_expression_c, exp) |
887 |
929 |
888 SYM_REF2(function_invocation_c, function_name, parameter_assignment_list) |
930 /* formal_param_list -> may be NULL ! */ |
|
931 /* nonformal_param_list -> may be NULL ! */ |
|
932 SYM_REF3(function_invocation_c, function_name, formal_param_list, nonformal_param_list) |
889 |
933 |
890 |
934 |
891 /********************/ |
935 /********************/ |
892 /* B 3.2 Statements */ |
936 /* B 3.2 Statements */ |
893 /********************/ |
937 /********************/ |
906 |
950 |
907 /* RETURN */ |
951 /* RETURN */ |
908 SYM_REF0(return_statement_c) |
952 SYM_REF0(return_statement_c) |
909 |
953 |
910 /* fb_name '(' [param_assignment_list] ')' */ |
954 /* fb_name '(' [param_assignment_list] ')' */ |
911 /* param_assignment_list -> may be NULL ! */ |
955 /* formal_param_list -> may be NULL ! */ |
912 SYM_REF2(fb_invocation_c, fb_name, param_assignment_list) |
956 /* nonformal_param_list -> may be NULL ! */ |
|
957 SYM_REF3(fb_invocation_c, fb_name, formal_param_list, nonformal_param_list) |
913 |
958 |
914 /* helper symbol for fb_invocation */ |
959 /* helper symbol for fb_invocation */ |
915 /* param_assignment_list ',' param_assignment */ |
960 /* param_assignment_list ',' param_assignment */ |
916 SYM_LIST(param_assignment_list_c) |
961 SYM_LIST(param_assignment_list_c) |
917 |
962 |