631 /***** *****/ |
631 /***** *****/ |
632 /*****************************************************/ |
632 /*****************************************************/ |
633 /*****************************************************/ |
633 /*****************************************************/ |
634 /*****************************************************/ |
634 /*****************************************************/ |
635 |
635 |
636 if (goto_body_state__) { |
636 if (goto_body_state__) { |
637 yy_push_state(il_st_state); |
637 yy_push_state(il_st_state); |
638 goto_body_state__ = 0; |
638 goto_body_state__ = 0; |
639 } |
639 } |
640 |
640 |
641 /*********************************/ |
641 /*********************************/ |
642 /* Handle the pragmas! */ |
642 /* Handle the pragmas! */ |
643 /*********************************/ |
643 /*********************************/ |
644 |
644 |
753 CONFIGURATION BEGIN(config_state); return CONFIGURATION; |
753 CONFIGURATION BEGIN(config_state); return CONFIGURATION; |
754 } |
754 } |
755 |
755 |
756 /* INITIAL -> il_st_state */ |
756 /* INITIAL -> il_st_state */ |
757 /* required if the function, program, etc.. has no VAR block! */ |
757 /* required if the function, program, etc.. has no VAR block! */ |
|
758 /* We comment it out since the standard does not allow this. */ |
|
759 /* NOTE: Even if we were to include the following code, it */ |
|
760 /* would have no effect whatsoever since the above */ |
|
761 /* rules will take precendence! */ |
|
762 /* |
758 <INITIAL>{ |
763 <INITIAL>{ |
759 FUNCTION BEGIN(il_st_state); return FUNCTION; |
764 FUNCTION BEGIN(il_st_state); return FUNCTION; |
760 FUNCTION_BLOCK BEGIN(il_st_state); return FUNCTION_BLOCK; |
765 FUNCTION_BLOCK BEGIN(il_st_state); return FUNCTION_BLOCK; |
761 PROGRAM BEGIN(il_st_state); return PROGRAM; |
766 PROGRAM BEGIN(il_st_state); return PROGRAM; |
762 } |
767 } |
763 |
768 */ |
764 /* decl_state -> il_st_state */ |
769 |
|
770 /* decl_state -> (il_st_state | sfc_state) */ |
765 <decl_state>{ |
771 <decl_state>{ |
766 END_VAR{st_whitespace}VAR unput_text(strlen("END_VAR")); return END_VAR; |
772 END_VAR{st_whitespace}VAR {unput_text(strlen("END_VAR")); |
767 END_VAR{st_whitespace} unput_text(strlen("END_VAR")); yy_push_state(il_st_state); return END_VAR; |
773 return END_VAR; |
|
774 } |
|
775 END_VAR{st_whitespace}INITIAL_STEP {unput_text(strlen("END_VAR")); |
|
776 BEGIN(sfc_state); |
|
777 return END_VAR; |
|
778 } |
|
779 END_VAR{st_whitespace} {unput_text(strlen("END_VAR")); |
|
780 cmd_goto_body_state(); |
|
781 return END_VAR; |
|
782 } |
768 } |
783 } |
769 |
784 |
770 /* il_st_state -> (il_state | st_state | sfc_state) */ |
785 /* il_st_state -> (il_state | st_state) */ |
771 <il_st_state>{ |
786 <il_st_state>{ |
772 INITIAL_STEP unput_text(0); yy_push_state(sfc_state); |
|
773 {qualified_identifier}{st_whitespace}":=" unput_text(0); BEGIN(st_state); |
787 {qualified_identifier}{st_whitespace}":=" unput_text(0); BEGIN(st_state); |
774 {qualified_identifier}"[" unput_text(0); BEGIN(st_state); |
788 {qualified_identifier}"[" unput_text(0); BEGIN(st_state); |
775 |
789 |
776 RETURN unput_text(0); BEGIN(st_state); |
790 RETURN unput_text(0); BEGIN(st_state); |
777 IF unput_text(0); BEGIN(st_state); |
791 IF unput_text(0); BEGIN(st_state); |
778 CASE unput_text(0); BEGIN(st_state); |
792 CASE unput_text(0); BEGIN(st_state); |
779 FOR unput_text(0); BEGIN(st_state); |
793 FOR unput_text(0); BEGIN(st_state); |
780 WHILE unput_text(0); BEGIN(st_state); |
794 WHILE unput_text(0); BEGIN(st_state); |
781 REPEAT unput_text(0); BEGIN(st_state); |
795 REPEAT unput_text(0); BEGIN(st_state); |
782 EXIT unput_text(0); BEGIN(st_state); |
796 EXIT unput_text(0); BEGIN(st_state); |
783 := unput_text(0); BEGIN(st_state); /* occurs only in transitions, and not FB bodies! */ |
797 /* ':=' occurs only in transitions, and not Function or FB bodies! */ |
784 |
798 := unput_text(0); BEGIN(st_state); |
785 |
799 |
786 |
800 |
787 {identifier} {int token = get_identifier_token(yytext); |
801 {identifier} {int token = get_identifier_token(yytext); |
788 if (token == prev_declared_fb_name_token) { |
802 if (token == prev_declared_fb_name_token) { |
789 /* the code has a call to a function block */ |
803 /* the code has a call to a function block */ |
801 <il_state,st_state>{ |
815 <il_state,st_state>{ |
802 END_FUNCTION yy_pop_state(); unput_text(0); |
816 END_FUNCTION yy_pop_state(); unput_text(0); |
803 END_FUNCTION_BLOCK yy_pop_state(); unput_text(0); |
817 END_FUNCTION_BLOCK yy_pop_state(); unput_text(0); |
804 END_PROGRAM yy_pop_state(); unput_text(0); |
818 END_PROGRAM yy_pop_state(); unput_text(0); |
805 END_TRANSITION yy_pop_state(); unput_text(0); |
819 END_TRANSITION yy_pop_state(); unput_text(0); |
806 END_ACTION yy_pop_state(); unput_text(0); |
820 END_ACTION yy_pop_state(); unput_text(0); |
807 } |
821 } |
808 |
822 |
809 /* sfc_state -> INITIAL */ |
823 /* sfc_state -> INITIAL */ |
810 <sfc_state>{ |
824 <sfc_state>{ |
811 END_FUNCTION yy_pop_state(); unput_text(0); |
825 END_FUNCTION yy_pop_state(); unput_text(0); |