stage1_2/iec.flex
changeset 73 0e623bbdee95
parent 72 328b794f8922
child 74 85af9521bf63
equal deleted inserted replaced
72:328b794f8922 73:0e623bbdee95
   751 			}
   751 			}
   752 
   752 
   753 
   753 
   754 <<EOF>>			{
   754 <<EOF>>			{
   755 			  if (--include_stack_ptr < 0) {
   755 			  if (--include_stack_ptr < 0) {
       
   756 			      /* yyterminate() terminates the scanner and returns a 0 to the 
       
   757 			       * scanner's  caller, indicating "all done".
       
   758 			       *	
       
   759 			       * Our syntax parser (written with bison) has the token	
       
   760 			       * END_OF_INPUT associated to the value 0, so even though
       
   761 			       * we don't explicitly return the token END_OF_INPUT
       
   762 			       * calling yyterminate() is equivalent to doing that. 
       
   763 			       */ 	
   756 			    yyterminate();
   764 			    yyterminate();
   757 			  } else {
   765 			  }      
       
   766  else {
   758 			    yy_delete_buffer(YY_CURRENT_BUFFER);
   767 			    yy_delete_buffer(YY_CURRENT_BUFFER);
   759 			    yy_switch_to_buffer((include_stack[include_stack_ptr]).buffer_state);
   768 			    yy_switch_to_buffer((include_stack[include_stack_ptr]).buffer_state);
   760 			    yylineno = include_stack[include_stack_ptr].lineno;
   769 			    yylineno = include_stack[include_stack_ptr].lineno;
   761 			      /* removing constness of char *. This is safe actually,
   770 			      /* removing constness of char *. This is safe actually,
   762 			       * since the only real const char * that is stored on the stack is
   771 			       * since the only real const char * that is stored on the stack is
  1201 	 *       merely contained the character &, so we use two
  1210 	 *       merely contained the character &, so we use two
  1202 	 *       different tokens for & and AND (and similarly
  1211 	 *       different tokens for & and AND (and similarly
  1203 	 *       ANDN and &N)!
  1212 	 *       ANDN and &N)!
  1204 	 */
  1213 	 */
  1205  /* The following tokens clash with ST expression operators and Standard Functions */
  1214  /* The following tokens clash with ST expression operators and Standard Functions */
       
  1215  /* They are also keywords! */
  1206 AND		return AND;
  1216 AND		return AND;
  1207 MOD		return MOD;
  1217 MOD		return MOD;
  1208 OR		return OR;
  1218 OR		return OR;
  1209 XOR		return XOR;
  1219 XOR		return XOR;
  1210 NOT		return NOT;
  1220 NOT		return NOT;
  1211 
  1221 
  1212  /* The following tokens clash with Standard Functions */
  1222  /* The following tokens clash with Standard Functions */
       
  1223 <il_state>{
  1213 ADD		return ADD;
  1224 ADD		return ADD;
  1214 DIV		return DIV;
  1225 DIV		return DIV;
  1215 EQ		return EQ;
  1226 EQ		return EQ;
  1216 GE		return GE;
  1227 GE		return GE;
  1217 GT		return GT;
  1228 GT		return GT;
  1218 LE		return LE;
  1229 LE		return LE;
  1219 LT		return LT;
  1230 LT		return LT;
  1220 MUL		return MUL;
  1231 MUL		return MUL;
  1221 NE		return NE;
  1232 NE		return NE;
  1222 SUB		return SUB;
  1233 SUB		return SUB;
       
  1234 }
  1223 
  1235 
  1224  /* The following tokens clash with SFC action qualifiers */
  1236  /* The following tokens clash with SFC action qualifiers */
       
  1237 <il_state>{
  1225 S		return S;
  1238 S		return S;
  1226 R		return R;
  1239 R		return R;
       
  1240 }
  1227 
  1241 
  1228  /* The following tokens clash with ST expression operators */
  1242  /* The following tokens clash with ST expression operators */
  1229 &		return AND2;
  1243 &		return AND2;
  1230 
  1244 
  1231  /* The following tokens have no clashes */
  1245  /* The following tokens have no clashes */
       
  1246 <il_state>{
  1232 LD		return LD;
  1247 LD		return LD;
  1233 LDN		return LDN;
  1248 LDN		return LDN;
  1234 ST		return ST;
  1249 ST		return ST;
  1235 STN		return STN;
  1250 STN		return STN;
  1236 S1		return S1;
  1251 S1		return S1;
  1252 RETC		return RETC;
  1267 RETC		return RETC;
  1253 RETCN		return RETCN;
  1268 RETCN		return RETCN;
  1254 JMP		return JMP;
  1269 JMP		return JMP;
  1255 JMPC		return JMPC;
  1270 JMPC		return JMPC;
  1256 JMPCN		return JMPCN;
  1271 JMPCN		return JMPCN;
  1257 
  1272 }
  1258 
  1273 
  1259 	/***********************/
  1274 	/***********************/
  1260 	/* B 3.1 - Expressions */
  1275 	/* B 3.1 - Expressions */
  1261 	/***********************/
  1276 	/***********************/
  1262 "**"		return OPER_EXP;
  1277 "**"		return OPER_EXP;