stage1_2/iec.flex
changeset 74 85af9521bf63
parent 73 0e623bbdee95
child 75 0e381bdb8888
equal deleted inserted replaced
73:0e623bbdee95 74:85af9521bf63
   333  *                     (when parsing an action. This transition is requested by bison)
   333  *                     (when parsing an action. This transition is requested by bison)
   334  *   sfc_state     -> push(sfc_state); goto(sfc_qualifier_state)
   334  *   sfc_state     -> push(sfc_state); goto(sfc_qualifier_state)
   335  *                     (when expecting an action qualifier. This transition is requested by bison)
   335  *                     (when expecting an action qualifier. This transition is requested by bison)
   336  *   sfc_qualifier_state -> pop()
   336  *   sfc_qualifier_state -> pop()
   337  *                     (when no longer expecting an action qualifier. This transition is requested by bison)
   337  *                     (when no longer expecting an action qualifier. This transition is requested by bison)
   338  *
   338  *   config_state  -> push(config_state); goto(task_init_state)
   339  */
   339  *                     (when parsing a task initialisation. This transition is requested by bison)
   340 
   340  *   task_init_state -> pop()
       
   341  *                     (when no longer parsing task initialisation parameters. This transition is requested by bison)
       
   342  *
       
   343  */
   341 
   344 
   342 
   345 
   343 /* we are parsing a configuration. */
   346 /* we are parsing a configuration. */
   344 %s config_state
   347 %s config_state
       
   348 
       
   349 /* Inside a configuration, we are parsing a task initialisation parameters */
       
   350 /* This means that PRIORITY, SINGLE and INTERVAL must be handled as
       
   351  * tokens, and not as possible identifiers. Note that the above words
       
   352  * are not keywords.
       
   353  */
       
   354 %s task_init_state
   345 
   355 
   346 /* we are parsing a function, program or function block declaration */
   356 /* we are parsing a function, program or function block declaration */
   347 %s decl_state
   357 %s decl_state
   348 
   358 
   349 /* we will be parsing a function body. Whether il/st is remains unknown */
   359 /* we will be parsing a function body. Whether il/st is remains unknown */
   676 	}
   686 	}
   677 
   687 
   678 	if (get_goto_sfc_qualifier_state()) {
   688 	if (get_goto_sfc_qualifier_state()) {
   679 	  yy_push_state(sfc_qualifier_state);
   689 	  yy_push_state(sfc_qualifier_state);
   680 	  rst_goto_sfc_qualifier_state();
   690 	  rst_goto_sfc_qualifier_state();
       
   691 	}
       
   692 
       
   693 	if (get_goto_task_init_state()) {
       
   694 	  yy_push_state(task_init_state);
       
   695 	  rst_goto_task_init_state();
   681 	}
   696 	}
   682 
   697 
   683 	if (get_pop_state()) {
   698 	if (get_pop_state()) {
   684 	  yy_pop_state();
   699 	  yy_pop_state();
   685 	  rst_pop_state();
   700 	  rst_pop_state();
  1142 
  1157 
  1143 TRANSITION	return TRANSITION;
  1158 TRANSITION	return TRANSITION;
  1144 END_TRANSITION	return END_TRANSITION;
  1159 END_TRANSITION	return END_TRANSITION;
  1145 FROM		return FROM;
  1160 FROM		return FROM;
  1146 TO		return TO;
  1161 TO		return TO;
  1147 PRIORITY	return PRIORITY;
       
  1148 
  1162 
  1149 INITIAL_STEP	return INITIAL_STEP;
  1163 INITIAL_STEP	return INITIAL_STEP;
  1150 STEP		return STEP;
  1164 STEP		return STEP;
  1151 END_STEP	return END_STEP;
  1165 END_STEP	return END_STEP;
       
  1166 
       
  1167 	/* PRIORITY is not a keyword, so we only return it when 
       
  1168 	 * it is explicitly required and we are not expecting any identifiers
       
  1169 	 * that could also use the same letter sequence (i.e. an identifier: piority)
       
  1170 	 */
       
  1171 <sfc_state>PRIORITY	return PRIORITY;
  1152 
  1172 
  1153 <sfc_qualifier_state>{
  1173 <sfc_qualifier_state>{
  1154 L		return L;
  1174 L		return L;
  1155 D		return D;
  1175 D		return D;
  1156 SD		return SD;
  1176 SD		return SD;
  1177 END_VAR			return END_VAR;
  1197 END_VAR			return END_VAR;
  1178 WITH			return WITH;
  1198 WITH			return WITH;
  1179 PROGRAM			return PROGRAM;
  1199 PROGRAM			return PROGRAM;
  1180 RETAIN			return RETAIN;
  1200 RETAIN			return RETAIN;
  1181 NON_RETAIN		return NON_RETAIN;
  1201 NON_RETAIN		return NON_RETAIN;
       
  1202 READ_WRITE		return READ_WRITE;
       
  1203 READ_ONLY		return READ_ONLY;
       
  1204 
       
  1205 	/* PRIORITY, SINGLE and INTERVAL are not a keywords, so we only return them when 
       
  1206 	 * it is explicitly required and we are not expecting any identifiers
       
  1207 	 * that could also use the same letter sequence (i.e. an identifier: piority, ...)
       
  1208 	 */
       
  1209 <task_init_state>{
  1182 PRIORITY		return PRIORITY;
  1210 PRIORITY		return PRIORITY;
  1183 SINGLE			return SINGLE;
  1211 SINGLE			return SINGLE;
  1184 INTERVAL		return INTERVAL;
  1212 INTERVAL		return INTERVAL;
  1185 READ_WRITE		return READ_WRITE;
  1213 }
  1186 READ_ONLY		return READ_ONLY;
       
  1187 
       
  1188 
  1214 
  1189 	/***********************************/
  1215 	/***********************************/
  1190 	/* B 2.1 Instructions and Operands */
  1216 	/* B 2.1 Instructions and Operands */
  1191 	/***********************************/
  1217 	/***********************************/
  1192 <il_state>\n		return EOL;
  1218 <il_state>\n		return EOL;