equal
deleted
inserted
replaced
370 |
370 |
371 /* we are parsing sfc code, and expecting an action qualifier. */ |
371 /* we are parsing sfc code, and expecting an action qualifier. */ |
372 %s sfc_qualifier_state |
372 %s sfc_qualifier_state |
373 |
373 |
374 |
374 |
|
375 |
|
376 |
|
377 |
375 /*******************/ |
378 /*******************/ |
376 /* File #include's */ |
379 /* File #include's */ |
377 /*******************/ |
380 /*******************/ |
378 |
381 |
379 /* We extend the IEC 61131-3 standard syntax to allow inclusion |
382 /* We extend the IEC 61131-3 standard syntax to allow inclusion |
929 /***************************************/ |
932 /***************************************/ |
930 /* Next is to to remove all whitespace */ |
933 /* Next is to to remove all whitespace */ |
931 /***************************************/ |
934 /***************************************/ |
932 /* NOTE: pragmas are handled right at the beginning... */ |
935 /* NOTE: pragmas are handled right at the beginning... */ |
933 |
936 |
934 <INITIAL,config_state,decl_state,st_state,sfc_state>{st_whitespace_no_pragma} /* Eat any whitespace */ |
937 <INITIAL,config_state,decl_state,st_state,sfc_state,task_init_state,sfc_qualifier_state>{st_whitespace_no_pragma} /* Eat any whitespace */ |
935 <il_state>{il_whitespace_no_pragma} /* Eat any whitespace */ |
938 <il_state>{il_whitespace_no_pragma} /* Eat any whitespace */ |
936 |
939 |
937 |
940 |
938 /*****************************************/ |
941 /*****************************************/ |
939 /* B.1.1 Letters, digits and identifiers */ |
942 /* B.1.1 Letters, digits and identifiers */ |
961 * as a funtion as in 'X := MOD(Y, Z);' |
964 * as a funtion as in 'X := MOD(Y, Z);' |
962 * We solve this by NOT testing for function names here, and |
965 * We solve this by NOT testing for function names here, and |
963 * handling this function and keyword clash in bison! |
966 * handling this function and keyword clash in bison! |
964 */ |
967 */ |
965 {identifier} {int token = get_identifier_token(yytext); |
968 {identifier} {int token = get_identifier_token(yytext); |
|
969 // printf("flex: analysing identifier '%s'...", yytext); |
966 if ((token == prev_declared_variable_name_token) || |
970 if ((token == prev_declared_variable_name_token) || |
967 // (token == prev_declared_derived_function_name_token) || // DO NOT add this condition! |
971 // (token == prev_declared_derived_function_name_token) || // DO NOT add this condition! |
968 (token == prev_declared_fb_name_token)) { |
972 (token == prev_declared_fb_name_token)) { |
969 /* |
973 /* |
970 if (token != identifier_token) |
974 if (token != identifier_token) |
973 * the simple test of (token != identifier_token), then |
977 * the simple test of (token != identifier_token), then |
974 * 'MOD' et al must be removed from the |
978 * 'MOD' et al must be removed from the |
975 * library_symbol_table as a default function name! |
979 * library_symbol_table as a default function name! |
976 */ |
980 */ |
977 yylval.ID=strdup(yytext); |
981 yylval.ID=strdup(yytext); |
|
982 // printf("returning token %d\n", token); |
978 return token; |
983 return token; |
979 } |
984 } |
980 /* otherwise, leave it for the other lexical parser rules... */ |
985 /* otherwise, leave it for the other lexical parser rules... */ |
|
986 // printf("rejecting\n"); |
981 REJECT; |
987 REJECT; |
982 } |
988 } |
983 |
989 |
984 |
990 |
985 /******************************************************/ |
991 /******************************************************/ |
1424 /* B.1.1 Letters, digits and identifiers */ |
1430 /* B.1.1 Letters, digits and identifiers */ |
1425 /*****************************************/ |
1431 /*****************************************/ |
1426 <st_state>{identifier}/({st_whitespace})"=>" {yylval.ID=strdup(yytext); return sendto_identifier_token;} |
1432 <st_state>{identifier}/({st_whitespace})"=>" {yylval.ID=strdup(yytext); return sendto_identifier_token;} |
1427 <il_state>{identifier}/({il_whitespace})"=>" {yylval.ID=strdup(yytext); return sendto_identifier_token;} |
1433 <il_state>{identifier}/({il_whitespace})"=>" {yylval.ID=strdup(yytext); return sendto_identifier_token;} |
1428 {identifier} {yylval.ID=strdup(yytext); |
1434 {identifier} {yylval.ID=strdup(yytext); |
1429 /*printf("returning identifier...: %s, %d\n", yytext, get_identifier_token(yytext));*/ |
1435 // printf("returning identifier...: %s, %d\n", yytext, get_identifier_token(yytext)); |
1430 return get_identifier_token(yytext);} |
1436 return get_identifier_token(yytext);} |
1431 |
1437 |
1432 |
1438 |
1433 |
1439 |
1434 |
1440 |