stage1_2/iec.flex
changeset 83 aeb7e0e53855
parent 82 2b6e9eeeff2c
child 84 a74c279f0a2e
equal deleted inserted replaced
82:2b6e9eeeff2c 83:aeb7e0e53855
   971 	 *       If we don't, then even it will not be possible to use 'MOD'
   971 	 *       If we don't, then even it will not be possible to use 'MOD'
   972 	 *       as a funtion as in 'X := MOD(Y, Z);'
   972 	 *       as a funtion as in 'X := MOD(Y, Z);'
   973 	 *       We solve this by NOT testing for function names here, and
   973 	 *       We solve this by NOT testing for function names here, and
   974 	 *       handling this function and keyword clash in bison!
   974 	 *       handling this function and keyword clash in bison!
   975 	 */
   975 	 */
       
   976  /*
   976 {identifier} 	{int token = get_identifier_token(yytext);
   977 {identifier} 	{int token = get_identifier_token(yytext);
   977 		 // fprintf(stderr, "flex: analysing identifier '%s'...", yytext); 
   978 		 // fprintf(stderr, "flex: analysing identifier '%s'...", yytext); 
   978 		 if ((token == prev_declared_variable_name_token) ||
   979 		 if ((token == prev_declared_variable_name_token) ||
   979 //		     (token == prev_declared_derived_function_name_token) || // DO NOT add this condition!
   980 //		     (token == prev_declared_derived_function_name_token) || // DO NOT add this condition!
   980 		     (token == prev_declared_fb_name_token)) {
   981 		     (token == prev_declared_fb_name_token)) {
   981 		 /*
   982 		 // if (token != identifier_token)
   982 		 if (token != identifier_token)
   983 		 // * NOTE: if we replace the above uncommented conditions with
   983 		 */
       
   984 		 /* NOTE: if we replace the above uncommented conditions with
       
   985                   *       the simple test of (token != identifier_token), then 
   984                   *       the simple test of (token != identifier_token), then 
   986                   *       'MOD' et al must be removed from the 
   985                   *       'MOD' et al must be removed from the 
   987                   *       library_symbol_table as a default function name!
   986                   *       library_symbol_table as a default function name!
   988 		  */
   987 		  * //
   989 		   yylval.ID=strdup(yytext);
   988 		   yylval.ID=strdup(yytext);
   990 		   // fprintf(stderr, "returning token %d\n", token); 
   989 		   // fprintf(stderr, "returning token %d\n", token); 
   991 		   return token;
   990 		   return token;
   992 		 }
   991 		 }
   993 		 /* otherwise, leave it for the other lexical parser rules... */
   992 		 // otherwise, leave it for the other lexical parser rules... 
   994 		 // fprintf(stderr, "rejecting\n"); 
   993 		 // fprintf(stderr, "rejecting\n"); 
   995 		 REJECT;
   994 		 REJECT;
   996 		}
   995 		}
   997 
   996  */
   998 
   997 
   999 	/******************************************************/
   998 	/******************************************************/
  1000 	/******************************************************/
   999 	/******************************************************/
  1001 	/******************************************************/
  1000 	/******************************************************/
  1002 	/*****                                            *****/
  1001 	/*****                                            *****/