# HG changeset patch # User mario # Date 1170324296 -3600 # Node ID 94741aa26423996385808b284c169f74eea5cc4b # Parent 8860f9917bbc9dec70df77d44b58490df1ccbdeb Changing from decl_state directly to sfc_state Calling cmd_goto_body_state() instead of yy_push_state() diff -r 8860f9917bbc -r 94741aa26423 stage1_2/iec.flex --- a/stage1_2/iec.flex Thu Feb 01 10:59:57 2007 +0100 +++ b/stage1_2/iec.flex Thu Feb 01 11:04:56 2007 +0100 @@ -633,10 +633,10 @@ /*****************************************************/ /*****************************************************/ - if (goto_body_state__) { - yy_push_state(il_st_state); - goto_body_state__ = 0; - } + if (goto_body_state__) { + yy_push_state(il_st_state); + goto_body_state__ = 0; + } /*********************************/ /* Handle the pragmas! */ @@ -755,21 +755,35 @@ /* INITIAL -> il_st_state */ /* required if the function, program, etc.. has no VAR block! */ + /* We comment it out since the standard does not allow this. */ + /* NOTE: Even if we were to include the following code, it */ + /* would have no effect whatsoever since the above */ + /* rules will take precendence! */ + /* { FUNCTION BEGIN(il_st_state); return FUNCTION; FUNCTION_BLOCK BEGIN(il_st_state); return FUNCTION_BLOCK; PROGRAM BEGIN(il_st_state); return PROGRAM; } - - /* decl_state -> il_st_state */ + */ + + /* decl_state -> (il_st_state | sfc_state) */ { -END_VAR{st_whitespace}VAR unput_text(strlen("END_VAR")); return END_VAR; -END_VAR{st_whitespace} unput_text(strlen("END_VAR")); yy_push_state(il_st_state); return END_VAR; +END_VAR{st_whitespace}VAR {unput_text(strlen("END_VAR")); + return END_VAR; + } +END_VAR{st_whitespace}INITIAL_STEP {unput_text(strlen("END_VAR")); + BEGIN(sfc_state); + return END_VAR; + } +END_VAR{st_whitespace} {unput_text(strlen("END_VAR")); + cmd_goto_body_state(); + return END_VAR; + } } - /* il_st_state -> (il_state | st_state | sfc_state) */ + /* il_st_state -> (il_state | st_state) */ { -INITIAL_STEP unput_text(0); yy_push_state(sfc_state); {qualified_identifier}{st_whitespace}":=" unput_text(0); BEGIN(st_state); {qualified_identifier}"[" unput_text(0); BEGIN(st_state); @@ -780,8 +794,8 @@ WHILE unput_text(0); BEGIN(st_state); REPEAT unput_text(0); BEGIN(st_state); EXIT unput_text(0); BEGIN(st_state); -:= unput_text(0); BEGIN(st_state); /* occurs only in transitions, and not FB bodies! */ - + /* ':=' occurs only in transitions, and not Function or FB bodies! */ +:= unput_text(0); BEGIN(st_state); {identifier} {int token = get_identifier_token(yytext); @@ -803,7 +817,7 @@ END_FUNCTION_BLOCK yy_pop_state(); unput_text(0); END_PROGRAM yy_pop_state(); unput_text(0); END_TRANSITION yy_pop_state(); unput_text(0); -END_ACTION yy_pop_state(); unput_text(0); +END_ACTION yy_pop_state(); unput_text(0); } /* sfc_state -> INITIAL */