Fixing handling of task initialisation.
--- 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... */
-<INITIAL,config_state,decl_state,st_state,sfc_state>{st_whitespace_no_pragma} /* Eat any whitespace */
+<INITIAL,config_state,decl_state,st_state,sfc_state,task_init_state,sfc_qualifier_state>{st_whitespace_no_pragma} /* Eat any whitespace */
<il_state>{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 @@
<st_state>{identifier}/({st_whitespace})"=>" {yylval.ID=strdup(yytext); return sendto_identifier_token;}
<il_state>{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);}
--- 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 <leaf> task_name
%type <leaf> task_initialization
// 3 helper symbols for task_initialization
-%type <leaf> task_initialization_single
-%type <leaf> task_initialization_interval
-%type <leaf> task_initialization_priority
+%type <leaf> task_initialization_single
+%type <leaf> task_initialization_interval
+%type <leaf> task_initialization_priority
%type <leaf> data_source
%type <leaf> 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: