@@ -128,6 +128,9 @@ extern char *yystatement_listtext;
128128%token TOK_ACCU_DINT_GTE " >=D"
129129%token TOK_ACCU_DINT_LTE " <=D"
130130%token TOK_ASSIGNMENT " :="
131+ %token TOK_JUMP_UNCONDITIONAL " JU"
132+ %token TOK_JUMP_CONDITIONAL " JC"
133+ %token TOK_JUMP_CONDITIONAL_NOT " JCN"
131134
132135/* ** Value tokens ***/
133136%token TOK_INT_LITERAL
@@ -668,7 +671,7 @@ Opt_Instruction_List:
668671 }
669672 ;
670673
671- // Structured Text grammar
674+ // Statement List grammar
672675Instruction_List :
673676 Oom_IL_Instruction
674677 ;
@@ -688,7 +691,7 @@ Oom_IL_Instruction:
688691 ;
689692
690693IL_Instruction :
691- Opt_Label Opt_Instruction ' ;'
694+ Opt_Label Instruction ' ;'
692695 {
693696 $$ = $2 ;
694697 parser_stack ($$).add_to_operands(std::move(parser_stack($1 )));
@@ -708,14 +711,9 @@ IL_Label:
708711 TOK_LABEL
709712 ;
710713
711- Opt_Instruction :
714+ Instruction :
712715 IL_Simple_Operation
713716 | IL_Invocation
714- | /* nothing */
715- {
716- newstack ($$);
717- parser_stack ($$).id(ID_statement_list_instruction);
718- }
719717 ;
720718
721719IL_Simple_Operation :
@@ -932,12 +930,12 @@ IL_Simple_Operator:
932930 {
933931 $$ = $1 ;
934932 parser_stack ($$).id(ID_statement_list_xor);
935- }
933+ }
936934 | TOK_XOR_NOT
937935 {
938936 $$ = $1 ;
939937 parser_stack ($$).id(ID_statement_list_xor_not);
940- }
938+ }
941939 | TOK_AND_NESTED
942940 {
943941 $$ = $1 ;
@@ -947,22 +945,22 @@ IL_Simple_Operator:
947945 {
948946 $$ = $1 ;
949947 parser_stack ($$).id(ID_statement_list_and_not_nested);
950- }
948+ }
951949 | TOK_OR_NESTED
952950 {
953951 $$ = $1 ;
954952 parser_stack ($$).id(ID_statement_list_or_nested);
955- }
953+ }
956954 | TOK_OR_NOT_NESTED
957955 {
958956 $$ = $1 ;
959957 parser_stack ($$).id(ID_statement_list_or_not_nested);
960- }
958+ }
961959 | TOK_XOR_NESTED
962960 {
963961 $$ = $1 ;
964962 parser_stack ($$).id(ID_statement_list_xor_nested);
965- }
963+ }
966964 | TOK_XOR_NOT_NESTED
967965 {
968966 $$ = $1 ;
@@ -972,7 +970,7 @@ IL_Simple_Operator:
972970 {
973971 $$ = $1 ;
974972 parser_stack ($$).id(ID_statement_list_nesting_closed);
975- }
973+ }
976974 | TOK_ASSIGN
977975 {
978976 $$ = $1 ;
@@ -987,7 +985,7 @@ IL_Simple_Operator:
987985 {
988986 $$ = $1 ;
989987 parser_stack ($$).id(ID_statement_list_clr_rlo);
990- }
988+ }
991989 | TOK_SET
992990 {
993991 $$ = $1 ;
@@ -997,12 +995,27 @@ IL_Simple_Operator:
997995 {
998996 $$ = $1 ;
999997 parser_stack ($$).id(ID_statement_list_reset);
1000- }
998+ }
1001999 | TOK_NOT
10021000 {
10031001 $$ = $1 ;
10041002 parser_stack ($$).id(ID_statement_list_not);
1005- }
1003+ }
1004+ | TOK_JUMP_UNCONDITIONAL
1005+ {
1006+ $$ = $1 ;
1007+ parser_stack ($$).id(ID_statement_list_jump_unconditional);
1008+ }
1009+ | TOK_JUMP_CONDITIONAL
1010+ {
1011+ $$ = $1 ;
1012+ parser_stack ($$).id(ID_statement_list_jump_conditional);
1013+ }
1014+ | TOK_JUMP_CONDITIONAL_NOT
1015+ {
1016+ $$ = $1 ;
1017+ parser_stack ($$).id(ID_statement_list_jump_conditional_not);
1018+ }
10061019 ;
10071020
10081021IL_Operand :
0 commit comments