# HG changeset patch # User mario # Date 1193906553 -3600 # Node ID 0e381bdb8888948a933e76e13545e6226e793cac # Parent 85af9521bf63de55d872fa171c7e90c3066d24d3 Fixing handling of task initialisation. diff -r 85af9521bf63 -r 0e381bdb8888 stage1_2/iec.flex --- a/stage1_2/iec.flex Sun Oct 28 22:44:20 2007 +0100 +++ b/stage1_2/iec.flex Thu Nov 01 09:42:33 2007 +0100 @@ -372,6 +372,9 @@ %s sfc_qualifier_state + + + /*******************/ /* File #include's */ /*******************/ @@ -931,7 +934,7 @@ /***************************************/ /* NOTE: pragmas are handled right at the beginning... */ -{st_whitespace_no_pragma} /* Eat any whitespace */ +{st_whitespace_no_pragma} /* Eat any whitespace */ {il_whitespace_no_pragma} /* Eat any whitespace */ @@ -963,6 +966,7 @@ * handling this function and keyword clash in bison! */ {identifier} {int token = get_identifier_token(yytext); + // printf("flex: analysing identifier '%s'...", yytext); if ((token == prev_declared_variable_name_token) || // (token == prev_declared_derived_function_name_token) || // DO NOT add this condition! (token == prev_declared_fb_name_token)) { @@ -975,9 +979,11 @@ * library_symbol_table as a default function name! */ yylval.ID=strdup(yytext); + // printf("returning token %d\n", token); return token; } /* otherwise, leave it for the other lexical parser rules... */ + // printf("rejecting\n"); REJECT; } @@ -1426,7 +1432,7 @@ {identifier}/({st_whitespace})"=>" {yylval.ID=strdup(yytext); return sendto_identifier_token;} {identifier}/({il_whitespace})"=>" {yylval.ID=strdup(yytext); return sendto_identifier_token;} {identifier} {yylval.ID=strdup(yytext); - /*printf("returning identifier...: %s, %d\n", yytext, get_identifier_token(yytext));*/ + // printf("returning identifier...: %s, %d\n", yytext, get_identifier_token(yytext)); return get_identifier_token(yytext);} diff -r 85af9521bf63 -r 0e381bdb8888 stage1_2/iec.y --- a/stage1_2/iec.y Sun Oct 28 22:44:20 2007 +0100 +++ b/stage1_2/iec.y Thu Nov 01 09:42:33 2007 +0100 @@ -914,9 +914,9 @@ %type task_name %type task_initialization // 3 helper symbols for task_initialization -%type task_initialization_single -%type task_initialization_interval -%type task_initialization_priority +%type task_initialization_single +%type task_initialization_interval +%type task_initialization_priority %type data_source %type program_configuration @@ -4137,7 +4137,7 @@ {$$ = new task_configuration_c($2, $3, locloc(@$));} ; -/* NOTE: The specification does nopt mention the namespace to which task names +/* NOTE: The specification does not mention the namespace to which task names * should belong to. Unlike resource and program names, for the moment we * let the task names belong to their own private namespace, as they do not * produce any conflicts in the syntax parser. @@ -4149,8 +4149,8 @@ task_initialization: // '(' [SINGLE ASSIGN data_source ','] [INTERVAL ASSIGN data_source ','] PRIORITY ASSIGN integer ')' // - '(' task_initialization_single task_initialization_interval task_initialization_priority ')' - {$$ = new task_initialization_c($2, $3, $4, locloc(@$));} + '(' {cmd_goto_task_init_state();} task_initialization_single task_initialization_interval task_initialization_priority ')' + {$$ = new task_initialization_c($3, $4, $5, locloc(@$));} ; @@ -4158,8 +4158,8 @@ // [SINGLE ASSIGN data_source ','] /* empty */ {$$ = NULL;} -| {cmd_goto_task_init_state();} SINGLE ASSIGN {cmd_pop_state();} data_source ',' - {$$ = $5;} +| SINGLE ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} + {$$ = $4;} ; @@ -4167,32 +4167,18 @@ // [INTERVAL ASSIGN data_source ','] /* empty */ {$$ = NULL;} -| {cmd_goto_task_init_state();} INTERVAL ASSIGN {cmd_pop_state();} data_source ',' - {$$ = $5;} -; +| INTERVAL ASSIGN {cmd_pop_state();} data_source ',' {cmd_goto_task_init_state();} + {$$ = $4;} +; + task_initialization_priority: // PRIORITY ASSIGN integer -{cmd_goto_task_init_state();} PRIORITY ASSIGN {cmd_pop_state();} integer - {$$ = $5;} -; - - -/* -task_initialization: -// '(' [SINGLE ASSIGN data_source ','] [INTERVAL ASSIGN data_source ','] PRIORITY ASSIGN integer ')' // - '(' {cmd_goto_task_init_state();} PRIORITY ASSIGN {cmd_pop_state();} integer ')' - {$$ = new task_initialization_c(NULL, NULL, $6, locloc(@$));} -| '(' {cmd_goto_task_init_state();} SINGLE ASSIGN {cmd_pop_state();} data_source ',' - PRIORITY ASSIGN integer ')' - {$$ = new task_initialization_c($6, NULL, $10, locloc(@$));} -| '(' {cmd_goto_task_init_state();} INTERVAL ASSIGN {cmd_pop_state();} data_source ',' PRIORITY ASSIGN integer ')' - {$$ = new task_initialization_c(NULL, $6, $10, locloc(@$));} -| '(' {cmd_goto_task_init_state();} SINGLE ASSIGN {cmd_pop_state();} data_source ',' INTERVAL ASSIGN data_source ',' PRIORITY ASSIGN integer ')' - {$$ = new task_initialization_c($6, $10, $14, locloc(@$));} -; -*/ + PRIORITY ASSIGN {cmd_pop_state();} integer + {$$ = $4;} +; + data_source: