diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-12-01 11:02:40 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-12-01 11:02:40 (GMT) |
commit | af6609592298c5e047e37e5ae2b47e6a8edbb677 (patch) | |
tree | e6e7da1cd34dccf3fb4f389e684b7c899b12987a /src/uscxml/plugins/datamodel/promela/parser/promela.ypp | |
parent | d2e90c02e5ad19a5857e7c7fb87f248182fdb32d (diff) | |
download | uscxml-af6609592298c5e047e37e5ae2b47e6a8edbb677.zip uscxml-af6609592298c5e047e37e5ae2b47e6a8edbb677.tar.gz uscxml-af6609592298c5e047e37e5ae2b47e6a8edbb677.tar.bz2 |
Nested invokers and delayed events for PROMELA model checking
Diffstat (limited to 'src/uscxml/plugins/datamodel/promela/parser/promela.ypp')
-rw-r--r-- | src/uscxml/plugins/datamodel/promela/parser/promela.ypp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.ypp b/src/uscxml/plugins/datamodel/promela/parser/promela.ypp index 8e87c75..d76b24a 100644 --- a/src/uscxml/plugins/datamodel/promela/parser/promela.ypp +++ b/src/uscxml/plugins/datamodel/promela/parser/promela.ypp @@ -21,13 +21,14 @@ #define YYDEBUG 1 #define YYERROR_VERBOSE 1 -extern int promela_lex (PROMELA_STYPE* yylval_param, void* yyscanner); +extern int promela_lex (PROMELA_STYPE* yylval_param, PROMELA_LTYPE* yylloc_param, void* yyscanner); using namespace uscxml; %} %pure-parser %debug +%locations %file-prefix "promela" %parse-param { uscxml::PromelaParser* ctx } %lex-param {void * scanner} @@ -98,8 +99,8 @@ program : varref : cmpnd { $$ = $1; } ; -pfld : PML_NAME { $$ = ctx->value(PML_NAME, $1); free($1); } - | PML_NAME '[' expr ']' { $$ = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, $1), $3); free($1); } +pfld : PML_NAME { $$ = ctx->value(PML_NAME, (void*)&(@1), $1); free($1); } + | PML_NAME '[' expr ']' { $$ = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (void*)&(@1), $1), $3); free($1); } ; cmpnd : pfld @@ -152,10 +153,10 @@ expr : '(' expr ')' { $$ = $2; } | PML_LEN '(' varref ')' { $$ = ctx->node(PML_LEN, 1, $3); } | varref { $$ = $1; } - | PML_CONST { $$ = ctx->value(PML_CONST, $1); free($1); } + | PML_CONST { $$ = ctx->value(PML_CONST, (void*)&(@1), $1); free($1); } | PML_STRING { /* Non standard promela for string literals */ - $$ = ctx->value(PML_STRING, $1); free($1); } + $$ = ctx->value(PML_STRING, (void*)&(@1), $1); free($1); } ; @@ -165,13 +166,13 @@ vis : /* empty */ { $$ = ctx->node(PML_SHOW, 0); } | PML_ISLOCAL { $$ = ctx->node(PML_ISLOCAL, 0); } ; -one_decl: vis PML_TYPE var_list { $$ = ctx->node(PML_DECL, 3, $1, ctx->value(PML_TYPE, $2), $3); free($2); } +one_decl: vis PML_TYPE var_list { $$ = ctx->node(PML_DECL, 3, $1, ctx->value(PML_TYPE, (void*)&(@2), $2), $3); free($2); } | vis PML_UNAME var_list { $$ = ctx->node(PML_UNAME, 2, $1, $3); } - | vis PML_TYPE PML_ASGN '{' nlst '}' { $$ = ctx->node(PML_DECL, 3, $1, ctx->value(PML_TYPE, $2), $5); free($2); } + | vis PML_TYPE PML_ASGN '{' nlst '}' { $$ = ctx->node(PML_DECL, 3, $1, ctx->value(PML_TYPE, (void*)&(@2), $2), $5); free($2); } | vis utype { $$ = $2; } ; -utype : PML_TYPEDEF PML_NAME '{' decl_lst '}' { $$ = ctx->node(PML_TYPEDEF, 2, ctx->value(PML_NAME, $2), $4); } +utype : PML_TYPEDEF PML_NAME '{' decl_lst '}' { $$ = ctx->node(PML_TYPEDEF, 2, ctx->value(PML_NAME, (void*)&(@2), $2), $4); } ; decl_lst: one_decl { $$ = $1; } @@ -194,12 +195,12 @@ ivar : vardcl { $$ = $1; } | vardcl PML_ASGN expr { $$ = ctx->node(PML_ASGN, 2, $1, $3); } ; -vardcl : PML_NAME { $$ = ctx->value(PML_NAME, $1); free($1); } - | PML_NAME PML_COLON PML_CONST { $$ = ctx->node(PML_COLON, 2, ctx->value(PML_NAME, $1), ctx->value(PML_CONST, $3)); free($1); free($3); } - | PML_NAME '[' const_expr ']' { $$ = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, $1), $3); free($1); } +vardcl : PML_NAME { $$ = ctx->value(PML_NAME, (void*)&(@1), $1); free($1); } + | PML_NAME PML_COLON PML_CONST { $$ = ctx->node(PML_COLON, 2, ctx->value(PML_NAME, (void*)&(@1), $1), ctx->value(PML_CONST, (void*)&(@3), $3)); free($1); free($3); } + | PML_NAME '[' const_expr ']' { $$ = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (void*)&(@1), $1), $3); free($1); } ; -const_expr: PML_CONST { $$ = ctx->value(PML_CONST, $1); free($1); } +const_expr: PML_CONST { $$ = ctx->value(PML_CONST, (void*)&(@1), $1); free($1); } | PML_MINUS const_expr %prec PML_MINUS { $$ = ctx->node(PML_MINUS, 1, $2); } | '(' const_expr ')' { $$ = $2; } | const_expr PML_PLUS const_expr { $$ = ctx->node(PML_PLUS, 2, $1, $3); } @@ -209,13 +210,13 @@ const_expr: PML_CONST { $$ = ctx->value(PML_CONST, $1); free($1); } | const_expr PML_MODULO const_expr { $$ = ctx->node(PML_MODULO, 2, $1, $3); } ; -nlst : PML_NAME { $$ = ctx->value(PML_NAME, $1); free($1); } +nlst : PML_NAME { $$ = ctx->value(PML_NAME, (void*)&(@1), $1); free($1); } | nlst PML_NAME { if ($1->type == PML_NAME) { $$ = ctx->node(PML_NAMELIST, 1, $1); - $$->push(ctx->value(PML_NAME, $2)); + $$->push(ctx->value(PML_NAME, (void*)&(@2), $2)); } else { - $1->push(ctx->value(PML_NAME, $2)); + $1->push(ctx->value(PML_NAME, (void*)&(@2), $2)); } free($2); } @@ -233,14 +234,14 @@ stmnt : Stmnt { $$ = $1; } Stmnt : varref PML_ASGN expr { $$ = ctx->node(PML_ASGN, 2, $1, $3); } | varref PML_INCR { $$ = ctx->node(PML_INCR, 1, $1); } | varref PML_DECR { $$ = ctx->node(PML_DECR, 1, $1); } - | PML_PRINT '(' PML_STRING prargs ')' { $$ = ctx->node(PML_PRINT, 2, ctx->value(PML_STRING, $3), $4); free($3); } + | PML_PRINT '(' PML_STRING prargs ')' { $$ = ctx->node(PML_PRINT, 2, ctx->value(PML_STRING, (void*)&(@3), $3), $4); free($3); } | PML_PRINT '(' varref ')' { $$ = ctx->node(PML_PRINT, 1, $3); } - | PML_PRINT '(' PML_CONST ')' { $$ = ctx->node(PML_PRINT, 1, ctx->value(PML_CONST, $3)); free($3); } + | PML_PRINT '(' PML_CONST ')' { $$ = ctx->node(PML_PRINT, 1, ctx->value(PML_CONST, (void*)&(@3), $3)); free($3); } | PML_ASSERT expr { $$ = ctx->node(PML_ASSERT, 1, $2); } | expr { $$ = $1; } ; -prargs : /* empty */ { $$ = ctx->value(0, ""); } +prargs : /* empty */ { $$ = ctx->value(0, NULL, ""); } | PML_COMMA arg { $$ = $2; } ; |