stage1_2/iec.flex
changeset 74 85af9521bf63
parent 73 0e623bbdee95
child 75 0e381bdb8888
--- a/stage1_2/iec.flex	Sun Oct 28 22:03:27 2007 +0100
+++ b/stage1_2/iec.flex	Sun Oct 28 22:44:20 2007 +0100
@@ -335,14 +335,24 @@
  *                     (when expecting an action qualifier. This transition is requested by bison)
  *   sfc_qualifier_state -> pop()
  *                     (when no longer expecting an action qualifier. This transition is requested by bison)
- *
- */
-
+ *   config_state  -> push(config_state); goto(task_init_state)
+ *                     (when parsing a task initialisation. This transition is requested by bison)
+ *   task_init_state -> pop()
+ *                     (when no longer parsing task initialisation parameters. This transition is requested by bison)
+ *
+ */
 
 
 /* we are parsing a configuration. */
 %s config_state
 
+/* Inside a configuration, we are parsing a task initialisation parameters */
+/* This means that PRIORITY, SINGLE and INTERVAL must be handled as
+ * tokens, and not as possible identifiers. Note that the above words
+ * are not keywords.
+ */
+%s task_init_state
+
 /* we are parsing a function, program or function block declaration */
 %s decl_state
 
@@ -680,6 +690,11 @@
 	  rst_goto_sfc_qualifier_state();
 	}
 
+	if (get_goto_task_init_state()) {
+	  yy_push_state(task_init_state);
+	  rst_goto_task_init_state();
+	}
+
 	if (get_pop_state()) {
 	  yy_pop_state();
 	  rst_pop_state();
@@ -1144,12 +1159,17 @@
 END_TRANSITION	return END_TRANSITION;
 FROM		return FROM;
 TO		return TO;
-PRIORITY	return PRIORITY;
 
 INITIAL_STEP	return INITIAL_STEP;
 STEP		return STEP;
 END_STEP	return END_STEP;
 
+	/* PRIORITY is not a keyword, so we only return it when 
+	 * 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_qualifier_state>{
 L		return L;
 D		return D;
@@ -1179,12 +1199,18 @@
 PROGRAM			return PROGRAM;
 RETAIN			return RETAIN;
 NON_RETAIN		return NON_RETAIN;
+READ_WRITE		return READ_WRITE;
+READ_ONLY		return READ_ONLY;
+
+	/* PRIORITY, SINGLE and INTERVAL are not a keywords, so we only return them when 
+	 * it is explicitly required and we are not expecting any identifiers
+	 * that could also use the same letter sequence (i.e. an identifier: piority, ...)
+	 */
+<task_init_state>{
 PRIORITY		return PRIORITY;
 SINGLE			return SINGLE;
 INTERVAL		return INTERVAL;
-READ_WRITE		return READ_WRITE;
-READ_ONLY		return READ_ONLY;
-
+}
 
 	/***********************************/
 	/* B 2.1 Instructions and Operands */