# HG changeset patch # User mario # Date 1195063187 -3600 # Node ID 1988bf1634daa81dec286c9409c43d8d0ba00bf9 # Parent a6e651ba55c2d6f108dba4659b2312dfeec5a0a8 Adding support for use of PRIORITY as identifier inside SFC. diff -r a6e651ba55c2 -r 1988bf1634da stage1_2/iec.flex --- a/stage1_2/iec.flex Wed Nov 14 08:54:25 2007 +0100 +++ b/stage1_2/iec.flex Wed Nov 14 18:59:47 2007 +0100 @@ -371,6 +371,8 @@ /* we are parsing sfc code, and expecting an action qualifier. */ %s sfc_qualifier_state +/* we are parsing sfc code, and expecting the priority token. */ +%s sfc_priority_state @@ -693,6 +695,11 @@ rst_goto_sfc_qualifier_state(); } + if (get_goto_sfc_priority_state()) { + yy_push_state(sfc_priority_state); + rst_goto_sfc_priority_state(); + } + if (get_goto_task_init_state()) { yy_push_state(task_init_state); rst_goto_task_init_state(); @@ -1181,7 +1188,7 @@ * it is explicitly required and we are not expecting any identifiers * that could also use the same letter sequence (i.e. an identifier: piority) */ -PRIORITY return PRIORITY; +PRIORITY return PRIORITY; { L return L; diff -r a6e651ba55c2 -r 1988bf1634da stage1_2/iec.y --- a/stage1_2/iec.y Wed Nov 14 08:54:25 2007 +0100 +++ b/stage1_2/iec.y Wed Nov 14 18:59:47 2007 +0100 @@ -3789,17 +3789,17 @@ {cmd_goto_body_state();} transition_condition END_TRANSITION {$$ = new transition_c($2, NULL, $4, $6, $8, NULL, locloc(@$));} -| TRANSITION '(' PRIORITY ASSIGN integer ')' +| TRANSITION '(' {cmd_goto_sfc_priority_state();} PRIORITY {cmd_pop_state();} ASSIGN integer ')' FROM steps TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION - {$$ = new transition_c(NULL, $5, $8, $10, $12, NULL, locloc(@$));} + {$$ = new transition_c(NULL, $7, $10, $12, $14, NULL, locloc(@$));} //| TRANSITION identifier '(' PRIORITY ASSIGN integer ')' FROM steps TO steps ... -| TRANSITION transition_name '(' PRIORITY ASSIGN integer ')' +| TRANSITION transition_name '(' {cmd_goto_sfc_priority_state();} PRIORITY {cmd_pop_state();} ASSIGN integer ')' FROM steps TO steps {cmd_goto_body_state();} transition_condition END_TRANSITION - {$$ = new transition_c($2, $6, $9, $11, $13, NULL, locloc(@$));} + {$$ = new transition_c($2, $8, $11, $13, $15, NULL, locloc(@$));} ; diff -r a6e651ba55c2 -r 1988bf1634da stage1_2/stage1_2.cc --- a/stage1_2/stage1_2.cc Wed Nov 14 08:54:25 2007 +0100 +++ b/stage1_2/stage1_2.cc Wed Nov 14 18:59:47 2007 +0100 @@ -76,6 +76,15 @@ void rst_goto_sfc_qualifier_state(void) {goto_sfc_qualifier_state__ = 0;} /*************************************************************/ +/* Controlling the entry to the sfc_priority_state in flex. */ +/*************************************************************/ +static int goto_sfc_priority_state__ = 0; + +void cmd_goto_sfc_priority_state(void) {goto_sfc_priority_state__ = 1;} +int get_goto_sfc_priority_state(void) {return goto_sfc_priority_state__;} +void rst_goto_sfc_priority_state(void) {goto_sfc_priority_state__ = 0;} + +/*************************************************************/ /* Controlling the entry to the sfc_qualifier_state in flex. */ /*************************************************************/ static int goto_task_init_state__ = 0; diff -r a6e651ba55c2 -r 1988bf1634da stage1_2/stage1_2_priv.hh --- a/stage1_2/stage1_2_priv.hh Wed Nov 14 08:54:25 2007 +0100 +++ b/stage1_2/stage1_2_priv.hh Wed Nov 14 18:59:47 2007 +0100 @@ -99,6 +99,14 @@ void rst_goto_sfc_qualifier_state(void); +/*************************************************************/ +/* Controlling the entry to the sfc_priority_state in flex. */ +/*************************************************************/ +void cmd_goto_sfc_priority_state(void); +int get_goto_sfc_priority_state(void); +void rst_goto_sfc_priority_state(void); + + /*********************************************************/ /* Controlling the entry to the task_init_state in flex. */ /*********************************************************/