Adding support for use of PRIORITY as identifier inside SFC.
authormario
Wed, 14 Nov 2007 18:59:47 +0100
changeset 86 1988bf1634da
parent 85 a6e651ba55c2
child 87 b97f9ad7b2c6
Adding support for use of PRIORITY as identifier inside SFC.
stage1_2/iec.flex
stage1_2/iec.y
stage1_2/stage1_2.cc
stage1_2/stage1_2_priv.hh
--- 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)
 	 */
-<sfc_state>PRIORITY	return PRIORITY;
+<sfc_priority_state>PRIORITY	return PRIORITY;
 
 <sfc_qualifier_state>{
 L		return L;
--- 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(@$));}
 ;
 
 
--- 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;
--- 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. */
 /*********************************************************/