summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/datamodel
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-12-01 11:02:40 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-12-01 11:02:40 (GMT)
commitaf6609592298c5e047e37e5ae2b47e6a8edbb677 (patch)
treee6e7da1cd34dccf3fb4f389e684b7c899b12987a /src/uscxml/plugins/datamodel
parentd2e90c02e5ad19a5857e7c7fb87f248182fdb32d (diff)
downloaduscxml-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')
-rw-r--r--src/uscxml/plugins/datamodel/promela/PromelaParser.cpp30
-rw-r--r--src/uscxml/plugins/datamodel/promela/PromelaParser.h20
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.l17
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp199
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp422
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp15
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.ypp37
7 files changed, 507 insertions, 233 deletions
diff --git a/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp b/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp
index 9fed02c..ada2c48 100644
--- a/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp
+++ b/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp
@@ -30,11 +30,12 @@ void promela__delete_buffer(YY_BUFFER_STATE, void*);
YY_BUFFER_STATE promela__scan_string (const char * yystr , void*);
-extern int promela_lex (PROMELA_STYPE* yylval_param, void* yyscanner);
+extern int promela_lex (PROMELA_STYPE* yylval_param, PROMELA_LTYPE* yylloc_param, void* yyscanner);
int promela_lex_init (void**);
int promela_lex_destroy (void*);
-void promela_error (uscxml::PromelaParser* ctx, void* yyscanner, const char* err) {
+void promela_error (void* yylloc_param, uscxml::PromelaParser* ctx, void* yyscanner, const char* err) {
+ PROMELA_LTYPE* yylloc = (PROMELA_LTYPE*)yylloc_param;
// mark as pending exception as we cannot throw from constructor and have the destructor called
ERROR_EXECUTION(excEvent, err);
ctx->pendingException = excEvent;
@@ -120,26 +121,41 @@ PromelaParserNode::~PromelaParserNode() {
delete operands.front();
operands.pop_front();
}
+ if (loc)
+ free(loc);
}
PromelaParserNode* PromelaParser::node(int type, int nrArgs, ...) {
PromelaParserNode* newNode = new PromelaParserNode();
+
newNode->type = type;
va_list ap;
va_start(ap, nrArgs);
for(int i = 1; i <= nrArgs; i++) {
newNode->operands.push_back(va_arg(ap, PromelaParserNode*));
+ newNode->operands.back()->parent = newNode;
}
return newNode;
}
-PromelaParserNode* PromelaParser::value(int type, const char* value) {
+PromelaParserNode* PromelaParser::value(int type, void* location, const char* value) {
PromelaParserNode* newNode = new PromelaParserNode();
+
+ if (location) {
+ PROMELA_LTYPE* location_param = (PROMELA_LTYPE*)location;
+ newNode->loc = (PromelaParserNode::Location*)malloc(sizeof(PromelaParserNode::Location));
+ newNode->loc->firstCol = location_param->first_column;
+ newNode->loc->firstLine = location_param->first_line;
+ newNode->loc->lastCol = location_param->last_column;
+ newNode->loc->lastLine = location_param->last_line;
+ }
+
newNode->value = value;
newNode->type = type;
return newNode;
}
+
void PromelaParser::dump() {
switch (type) {
case PROMELA_EXPR:
@@ -160,11 +176,13 @@ void PromelaParserNode::merge(PromelaParserNode* node) {
for (std::list<PromelaParserNode*>::iterator iter = node->operands.begin();
iter != node->operands.end(); iter++) {
operands.push_back(*iter);
+ (*iter)->parent = this;
}
node->operands.clear();
}
void PromelaParserNode::push(PromelaParserNode* node) {
+ node->parent = this;
operands.push_back(node);
}
@@ -173,7 +191,11 @@ void PromelaParserNode::dump(int indent) {
for (int i = 0; i < indent; i++) {
padding += " ";
}
- std::cout << padding << typeToDesc(type) << ": " << value << std::endl;
+ std::cout << padding << typeToDesc(type) << ": " << value;
+ if (loc != NULL) {
+ std::cout << " (" << loc->firstLine << ":" << loc->firstCol << ")-(" << loc->lastLine << ":" << loc->lastCol << ")";
+ }
+ std::cout << std::endl;
for (std::list<PromelaParserNode*>::iterator iter = operands.begin();
iter != operands.end(); iter++) {
(*iter)->dump(indent + 1);
diff --git a/src/uscxml/plugins/datamodel/promela/PromelaParser.h b/src/uscxml/plugins/datamodel/promela/PromelaParser.h
index 6cf9a81..303b9be 100644
--- a/src/uscxml/plugins/datamodel/promela/PromelaParser.h
+++ b/src/uscxml/plugins/datamodel/promela/PromelaParser.h
@@ -32,8 +32,16 @@ namespace uscxml {
class PromelaParser;
-struct PromelaParserNode {
- PromelaParserNode() : type(0) {}
+class PromelaParserNode {
+public:
+ struct Location {
+ int firstLine;
+ int firstCol;
+ int lastLine;
+ int lastCol;
+ };
+
+ PromelaParserNode() : type(0), parent(NULL), loc(NULL) {}
virtual ~PromelaParserNode();
void merge(PromelaParserNode* node);
@@ -45,7 +53,8 @@ struct PromelaParserNode {
int type;
std::string value;
std::list<PromelaParserNode*> operands;
-
+ PromelaParserNode* parent;
+ Location* loc;
};
class PromelaParser {
@@ -58,12 +67,13 @@ public:
static std::string typeToDesc(int type);
+ PromelaParser() : ast(NULL) {}
PromelaParser(const std::string& expr);
PromelaParser(const std::string& expr, int nrArgs, ...);
virtual ~PromelaParser();
virtual PromelaParserNode* node(int type, int nrArgs, ...);
- virtual PromelaParserNode* value(int type, const char* value);
+ virtual PromelaParserNode* value(int type, void* location, const char* value);
void dump();
int parseInCompound;
@@ -86,6 +96,6 @@ protected:
}
-void promela_error (uscxml::PromelaParser* ctx, void* yyscanner, const char* err);
+void promela_error (void* yylloc_param, uscxml::PromelaParser* ctx, void* yyscanner, const char* err);
#endif /* end of include guard: PROMELA_H_9AB78YB1 */
diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.l b/src/uscxml/plugins/datamodel/promela/parser/promela.l
index dc4b66c..d247d74 100644
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.l
+++ b/src/uscxml/plugins/datamodel/promela/parser/promela.l
@@ -2,6 +2,7 @@
/* see: http://spinroot.com/spin/Man/operators.html */
+%option yylineno
%option reentrant
%option bison-bridge
%option prefix="promela_"
@@ -9,12 +10,28 @@
%option noyywrap
%option debug
%option never-interactive nounistd
+%option bison-locations
%{
#include "../PromelaParser.h"
#include "promela.tab.hpp"
#define YYSTYPE PROMELA_STYPE
+#define YYLTYPE PROMELA_LTYPE
+#define YY_USER_INIT \
+ yycolumn = yylloc->first_line = yylloc->first_column = 0; \
+ yylineno = yylloc->last_line = yylloc->last_column = 0; \
+
+//int yycolumn = 1;
+
+#define YY_USER_ACTION \
+{ \
+ yylloc->first_line = yylineno; \
+ yylloc->first_column = yycolumn; \
+ yylloc->last_column = yycolumn + yyleng; \
+ yylloc->last_line = yylineno; \
+ yycolumn = yycolumn + yyleng; \
+}
%}
diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp b/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp
index c6e4573..842efe6 100644
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp
+++ b/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp
@@ -230,7 +230,20 @@ typedef size_t yy_size_t;
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
- #define YY_LESS_LINENO(n)
+ /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
+ * access to the local variable yy_act. Since yyless() is a macro, it would break
+ * existing scanners that call yyless() from OUTSIDE promela_lex.
+ * One obvious solution it to make yy_act a global. I tried that, and saw
+ * a 5% performance hit in a non-yylineno scanner, because yy_act is
+ * normally declared as a register variable-- so it is not worth it.
+ */
+ #define YY_LESS_LINENO(n) \
+ do { \
+ yy_size_t yyl;\
+ for ( yyl = n; yyl < yyleng; ++yyl )\
+ if ( yytext[yyl] == '\n' )\
+ --yylineno;\
+ }while(0)
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
@@ -594,13 +607,20 @@ static yyconst flex_int16_t yy_chk[221] =
123, 123, 123, 123, 123, 123, 123, 123, 123, 123
} ;
+/* Table of booleans, true if rule could match eol. */
+static yyconst flex_int32_t yy_rule_can_match_eol[47] =
+ { 0,
+1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 1, 1, 0, 0, 1, 0, 0, };
+
static yyconst flex_int16_t yy_rule_linenum[46] =
{ 0,
- 27, 29, 34, 35, 36, 37, 38, 40, 41, 42,
- 43, 45, 46, 47, 49, 50, 52, 53, 55, 56,
- 57, 58, 60, 61, 63, 64, 65, 68, 69, 71,
- 72, 73, 75, 76, 78, 79, 81, 82, 84, 86,
- 89, 94, 95, 97, 100
+ 44, 46, 51, 52, 53, 54, 55, 57, 58, 59,
+ 60, 62, 63, 64, 66, 67, 69, 70, 72, 73,
+ 74, 75, 77, 78, 80, 81, 82, 85, 86, 88,
+ 89, 90, 92, 93, 95, 96, 98, 99, 101, 103,
+ 106, 111, 112, 114, 117
} ;
/* The intent behind this definition is that it'll catch
@@ -614,13 +634,28 @@ static yyconst flex_int16_t yy_rule_linenum[46] =
/* see: http://www.phpcompiler.org/articles/reentrantparser.html */
/* see: http://spinroot.com/spin/Man/operators.html */
#define YY_NO_UNISTD_H 1
-#line 14 "promela.l"
+#line 16 "promela.l"
#include "../PromelaParser.h"
#include "promela.tab.hpp"
#define YYSTYPE PROMELA_STYPE
+#define YYLTYPE PROMELA_LTYPE
+#define YY_USER_INIT \
+ yycolumn = yylloc->first_line = yylloc->first_column = 0; \
+ yylineno = yylloc->last_line = yylloc->last_column = 0; \
+
+//int yycolumn = 1;
+
+#define YY_USER_ACTION \
+{ \
+ yylloc->first_line = yylineno; \
+ yylloc->first_column = yycolumn; \
+ yylloc->last_column = yycolumn + yyleng; \
+ yylloc->last_line = yylineno; \
+ yycolumn = yycolumn + yyleng; \
+}
-#line 624 "promela.lex.yy.cpp"
+#line 659 "promela.lex.yy.cpp"
#define INITIAL 0
@@ -677,6 +712,8 @@ struct yyguts_t
YYSTYPE * yylval_r;
+ YYLTYPE * yylloc_r;
+
}; /* end struct yyguts_t */
/* %if-c-only */
@@ -691,6 +728,8 @@ static int yy_init_globals (yyscan_t yyscanner );
* from bison output in section 1.*/
# define yylval yyg->yylval_r
+ # define yylloc yyg->yylloc_r
+
int promela_lex_init (yyscan_t* scanner);
int promela_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
@@ -734,6 +773,10 @@ YYSTYPE * promela_get_lval (yyscan_t yyscanner );
void promela_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
+ YYLTYPE *promela_get_lloc (yyscan_t yyscanner );
+
+ void promela_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
+
/* %endif */
/* Macros after this point can all be overridden by user definitions in
@@ -881,10 +924,10 @@ static int input (yyscan_t yyscanner );
/* %if-c-only Standard (non-C++) definition */
extern int promela_lex \
- (YYSTYPE * yylval_param ,yyscan_t yyscanner);
+ (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
#define YY_DECL int promela_lex \
- (YYSTYPE * yylval_param , yyscan_t yyscanner)
+ (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
/* %endif */
/* %if-c++-only C++ definition */
/* %endif */
@@ -918,13 +961,15 @@ YY_DECL
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* %% [7.0] user's declarations go here */
-#line 25 "promela.l"
+#line 42 "promela.l"
-#line 925 "promela.lex.yy.cpp"
+#line 968 "promela.lex.yy.cpp"
yylval = yylval_param;
+ yylloc = yylloc_param;
+
if ( !yyg->yy_init )
{
yyg->yy_init = 1;
@@ -1004,6 +1049,18 @@ yy_find_action:
/* %% [11.0] code for yylineno update goes here */
+ if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
+ {
+ yy_size_t yyl;
+ for ( yyl = 0; yyl < yyleng; ++yyl )
+ if ( yytext[yyl] == '\n' )
+
+ do{ yylineno++;
+ yycolumn=0;
+ }while(0)
+;
+ }
+
do_action: /* This label is used only to access EOF actions. */
/* %% [12.0] debug code goes here */
@@ -1036,12 +1093,12 @@ do_action: /* This label is used only to access EOF actions. */
case 1:
/* rule 1 can match eol */
YY_RULE_SETUP
-#line 27 "promela.l"
+#line 44 "promela.l"
/* multiline comments */
YY_BREAK
case 2:
YY_RULE_SETUP
-#line 29 "promela.l"
+#line 46 "promela.l"
{
yylval->value = strdup(yytext);
return PML_TYPE;
@@ -1049,199 +1106,199 @@ YY_RULE_SETUP
YY_BREAK
case 3:
YY_RULE_SETUP
-#line 34 "promela.l"
+#line 51 "promela.l"
{ return PML_LEN; }
YY_BREAK
case 4:
YY_RULE_SETUP
-#line 35 "promela.l"
+#line 52 "promela.l"
{ yylval->value = strdup(yytext); return PML_CONST; }
YY_BREAK
case 5:
YY_RULE_SETUP
-#line 36 "promela.l"
+#line 53 "promela.l"
{ return PML_PRINT; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 37 "promela.l"
+#line 54 "promela.l"
{ return PML_TYPEDEF; }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 38 "promela.l"
+#line 55 "promela.l"
{ return PML_ASSERT; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 40 "promela.l"
+#line 57 "promela.l"
{ return PML_NEG; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 41 "promela.l"
+#line 58 "promela.l"
{ return PML_COMPL; }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 42 "promela.l"
+#line 59 "promela.l"
{ return PML_INCR; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 43 "promela.l"
+#line 60 "promela.l"
{ return PML_DECR; }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 45 "promela.l"
+#line 62 "promela.l"
{ return PML_TIMES; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 46 "promela.l"
+#line 63 "promela.l"
{ return PML_DIVIDE; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 47 "promela.l"
+#line 64 "promela.l"
{ return PML_MODULO; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 49 "promela.l"
+#line 66 "promela.l"
{ return PML_PLUS; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 50 "promela.l"
+#line 67 "promela.l"
{ return PML_MINUS; }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 52 "promela.l"
+#line 69 "promela.l"
{ return PML_LSHIFT; }
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 53 "promela.l"
+#line 70 "promela.l"
{ return PML_RSHIFT; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 55 "promela.l"
+#line 72 "promela.l"
{ return PML_LE; }
YY_BREAK
case 20:
YY_RULE_SETUP
-#line 56 "promela.l"
+#line 73 "promela.l"
{ return PML_GE; }
YY_BREAK
case 21:
YY_RULE_SETUP
-#line 57 "promela.l"
+#line 74 "promela.l"
{ return PML_LT; }
YY_BREAK
case 22:
YY_RULE_SETUP
-#line 58 "promela.l"
+#line 75 "promela.l"
{ return PML_GT; }
YY_BREAK
case 23:
YY_RULE_SETUP
-#line 60 "promela.l"
+#line 77 "promela.l"
{ return PML_NE; }
YY_BREAK
case 24:
YY_RULE_SETUP
-#line 61 "promela.l"
+#line 78 "promela.l"
{ return PML_EQ; }
YY_BREAK
case 25:
YY_RULE_SETUP
-#line 63 "promela.l"
+#line 80 "promela.l"
{ return PML_BITAND; }
YY_BREAK
case 26:
YY_RULE_SETUP
-#line 64 "promela.l"
+#line 81 "promela.l"
{ return PML_BITXOR; }
YY_BREAK
case 27:
YY_RULE_SETUP
-#line 65 "promela.l"
+#line 82 "promela.l"
{ return PML_BITOR; }
YY_BREAK
case 28:
YY_RULE_SETUP
-#line 68 "promela.l"
+#line 85 "promela.l"
{ return PML_AND; }
YY_BREAK
case 29:
YY_RULE_SETUP
-#line 69 "promela.l"
+#line 86 "promela.l"
{ return PML_OR; }
YY_BREAK
case 30:
YY_RULE_SETUP
-#line 71 "promela.l"
+#line 88 "promela.l"
{ return PML_DOT; }
YY_BREAK
case 31:
YY_RULE_SETUP
-#line 72 "promela.l"
+#line 89 "promela.l"
{ return PML_COMMA; }
YY_BREAK
case 32:
YY_RULE_SETUP
-#line 73 "promela.l"
+#line 90 "promela.l"
{ return PML_SEMI; }
YY_BREAK
case 33:
YY_RULE_SETUP
-#line 75 "promela.l"
+#line 92 "promela.l"
{ return '('; }
YY_BREAK
case 34:
YY_RULE_SETUP
-#line 76 "promela.l"
+#line 93 "promela.l"
{ return ')'; }
YY_BREAK
case 35:
YY_RULE_SETUP
-#line 78 "promela.l"
+#line 95 "promela.l"
{ return '['; }
YY_BREAK
case 36:
YY_RULE_SETUP
-#line 79 "promela.l"
+#line 96 "promela.l"
{ return ']'; }
YY_BREAK
case 37:
YY_RULE_SETUP
-#line 81 "promela.l"
+#line 98 "promela.l"
{ return '{'; }
YY_BREAK
case 38:
YY_RULE_SETUP
-#line 82 "promela.l"
+#line 99 "promela.l"
{ return '}'; }
YY_BREAK
case 39:
YY_RULE_SETUP
-#line 84 "promela.l"
+#line 101 "promela.l"
{ return PML_ASGN; }
YY_BREAK
case 40:
/* rule 40 can match eol */
YY_RULE_SETUP
-#line 86 "promela.l"
+#line 103 "promela.l"
{ yylval->value = strdup(yytext); return(PML_STRING); }
YY_BREAK
case 41:
/* rule 41 can match eol */
YY_RULE_SETUP
-#line 89 "promela.l"
+#line 106 "promela.l"
{
/* Non PROMELA extension for single quoted string literals */
yylval->value = strdup(yytext); return(PML_STRING);
@@ -1249,31 +1306,31 @@ YY_RULE_SETUP
YY_BREAK
case 42:
YY_RULE_SETUP
-#line 94 "promela.l"
+#line 111 "promela.l"
{ yylval->value = strdup(yytext); return PML_CONST; }
YY_BREAK
case 43:
YY_RULE_SETUP
-#line 95 "promela.l"
+#line 112 "promela.l"
{ yylval->value = strdup(yytext); return PML_NAME; }
YY_BREAK
case 44:
/* rule 44 can match eol */
YY_RULE_SETUP
-#line 97 "promela.l"
+#line 114 "promela.l"
/* eat up whitespace */
YY_BREAK
case 45:
YY_RULE_SETUP
-#line 100 "promela.l"
+#line 117 "promela.l"
{ /*printf( "Unrecognized character: %s\n", yytext ); */ }
YY_BREAK
case 46:
YY_RULE_SETUP
-#line 101 "promela.l"
+#line 118 "promela.l"
ECHO;
YY_BREAK
-#line 1277 "promela.lex.yy.cpp"
+#line 1334 "promela.lex.yy.cpp"
case YY_STATE_EOF(INITIAL):
yyterminate();
@@ -1672,6 +1729,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
/* %% [18.0] update yylineno here */
+ if ( c == '\n' ){
+ --yylineno;
+ }
+
yyg->yytext_ptr = yy_bp;
yyg->yy_hold_char = *yy_cp;
yyg->yy_c_buf_p = yy_cp;
@@ -1756,6 +1817,12 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
yyg->yy_hold_char = *++yyg->yy_c_buf_p;
/* %% [19.0] update BOL and yylineno */
+ if ( c == '\n' )
+
+ do{ yylineno++;
+ yycolumn=0;
+ }while(0)
+;
return c;
}
@@ -2387,6 +2454,18 @@ void promela_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
yylval = yylval_param;
}
+YYLTYPE *promela_get_lloc (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yylloc;
+}
+
+void promela_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yylloc = yylloc_param;
+}
+
/* %endif */
/* User-visible API */
@@ -2577,4 +2656,4 @@ void promela_free (void * ptr , yyscan_t yyscanner)
/* %ok-for-header */
-#line 101 "promela.l"
+#line 118 "promela.l"
diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp b/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp
index 3e9e92c..9d957e7 100644
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp
+++ b/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp
@@ -60,6 +60,7 @@
/* Substitute the type names. */
#define YYSTYPE PROMELA_STYPE
+#define YYLTYPE PROMELA_LTYPE
/* Substitute the variable and function names. */
#define yyparse promela_parse
#define yylex promela_lex
@@ -68,6 +69,7 @@
#define yychar promela_char
#define yydebug promela_debug
#define yynerrs promela_nerrs
+#define yylloc promela_lloc
/* Copy the first part of user declarations. */
/* Line 371 of yacc.c */
@@ -82,12 +84,12 @@
#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;
/* Line 371 of yacc.c */
-#line 91 "promela.tab.cpp"
+#line 93 "promela.tab.cpp"
# ifndef YY_NULL
# if defined __cplusplus && 201103L <= __cplusplus
@@ -212,20 +214,33 @@ extern int promela_debug;
typedef union PROMELA_STYPE
{
/* Line 387 of yacc.c */
-#line 38 "promela.ypp"
+#line 39 "promela.ypp"
uscxml::PromelaParserNode* node;
char* value;
/* Line 387 of yacc.c */
-#line 223 "promela.tab.cpp"
+#line 225 "promela.tab.cpp"
} PROMELA_STYPE;
# define PROMELA_STYPE_IS_TRIVIAL 1
# define promela_stype PROMELA_STYPE /* obsolescent; will be withdrawn */
# define PROMELA_STYPE_IS_DECLARED 1
#endif
+#if ! defined PROMELA_LTYPE && ! defined PROMELA_LTYPE_IS_DECLARED
+typedef struct PROMELA_LTYPE
+{
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+} PROMELA_LTYPE;
+# define promela_ltype PROMELA_LTYPE /* obsolescent; will be withdrawn */
+# define PROMELA_LTYPE_IS_DECLARED 1
+# define PROMELA_LTYPE_IS_TRIVIAL 1
+#endif
+
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
@@ -246,7 +261,7 @@ int promela_parse ();
/* Copy the second part of user declarations. */
/* Line 390 of yacc.c */
-#line 250 "promela.tab.cpp"
+#line 265 "promela.tab.cpp"
#ifdef short
# undef short
@@ -414,13 +429,15 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined PROMELA_STYPE_IS_TRIVIAL && PROMELA_STYPE_IS_TRIVIAL)))
+ || (defined PROMELA_LTYPE_IS_TRIVIAL && PROMELA_LTYPE_IS_TRIVIAL \
+ && defined PROMELA_STYPE_IS_TRIVIAL && PROMELA_STYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
yytype_int16 yyss_alloc;
YYSTYPE yyvs_alloc;
+ YYLTYPE yyls_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
@@ -429,8 +446,8 @@ union yyalloc
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
+ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ + 2 * YYSTACK_GAP_MAXIMUM)
# define YYCOPY_NEEDED 1
@@ -583,15 +600,15 @@ static const yytype_int8 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint8 yyrline[] =
{
- 0, 84, 84, 88, 92, 98, 101, 102, 105, 120,
- 121, 131, 132, 133, 134, 135, 136, 137, 138, 139,
- 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
- 150, 151, 153, 154, 155, 156, 162, 163, 164, 165,
- 168, 169, 170, 171, 174, 177, 178, 179, 189, 190,
- 193, 194, 197, 198, 199, 202, 203, 204, 205, 206,
- 207, 208, 209, 212, 213, 222, 225, 226, 227, 230,
- 233, 234, 235, 236, 237, 238, 239, 240, 243, 244,
- 247, 248
+ 0, 85, 85, 89, 93, 99, 102, 103, 106, 121,
+ 122, 132, 133, 134, 135, 136, 137, 138, 139, 140,
+ 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
+ 151, 152, 154, 155, 156, 157, 163, 164, 165, 166,
+ 169, 170, 171, 172, 175, 178, 179, 180, 190, 191,
+ 194, 195, 198, 199, 200, 203, 204, 205, 206, 207,
+ 208, 209, 210, 213, 214, 223, 226, 227, 228, 231,
+ 234, 235, 236, 237, 238, 239, 240, 241, 244, 245,
+ 248, 249
};
#endif
@@ -862,7 +879,7 @@ do \
} \
else \
{ \
- yyerror (ctx, scanner, YY_("syntax error: cannot back up")); \
+ yyerror (&yylloc, ctx, scanner, YY_("syntax error: cannot back up")); \
YYERROR; \
} \
while (YYID (0))
@@ -872,17 +889,90 @@ while (YYID (0))
#define YYERRCODE 256
-/* This macro is provided for backward compatibility. */
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+ If N is 0, then set CURRENT to the empty location which ends
+ the previous symbol: RHS[0] (always defined). */
+
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ do \
+ if (YYID (N)) \
+ { \
+ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
+ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
+ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
+ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
+ } \
+ else \
+ { \
+ (Current).first_line = (Current).last_line = \
+ YYRHSLOC (Rhs, 0).last_line; \
+ (Current).first_column = (Current).last_column = \
+ YYRHSLOC (Rhs, 0).last_column; \
+ } \
+ while (YYID (0))
+#endif
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+
+
+/* YY_LOCATION_PRINT -- Print the location on the stream.
+ This macro was not mandated originally: define only if we know
+ we won't break user code: when these are the locations we know. */
+
#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# if defined PROMELA_LTYPE_IS_TRIVIAL && PROMELA_LTYPE_IS_TRIVIAL
+
+/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
+
+__attribute__((__unused__))
+#if (defined __STDC__ || defined __C99__FUNC__ \
+ || defined __cplusplus || defined _MSC_VER)
+static unsigned
+yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
+#else
+static unsigned
+yy_location_print_ (yyo, yylocp)
+ FILE *yyo;
+ YYLTYPE const * const yylocp;
+#endif
+{
+ unsigned res = 0;
+ int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
+ if (0 <= yylocp->first_line)
+ {
+ res += fprintf (yyo, "%d", yylocp->first_line);
+ if (0 <= yylocp->first_column)
+ res += fprintf (yyo, ".%d", yylocp->first_column);
+ }
+ if (0 <= yylocp->last_line)
+ {
+ if (yylocp->first_line < yylocp->last_line)
+ {
+ res += fprintf (yyo, "-%d", yylocp->last_line);
+ if (0 <= end_col)
+ res += fprintf (yyo, ".%d", end_col);
+ }
+ else if (0 <= end_col && yylocp->first_column < end_col)
+ res += fprintf (yyo, "-%d", end_col);
+ }
+ return res;
+ }
+
+# define YY_LOCATION_PRINT(File, Loc) \
+ yy_location_print_ (File, &(Loc))
+
+# else
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+# endif
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
#ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
+# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
#else
-# define YYLEX yylex (&yylval, scanner)
+# define YYLEX yylex (&yylval, &yylloc, scanner)
#endif
/* Enable debugging if requested. */
@@ -905,7 +995,7 @@ do { \
{ \
YYFPRINTF (stderr, "%s ", Title); \
yy_symbol_print (stderr, \
- Type, Value, ctx, scanner); \
+ Type, Value, Location, ctx, scanner); \
YYFPRINTF (stderr, "\n"); \
} \
} while (YYID (0))
@@ -919,13 +1009,14 @@ do { \
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, uscxml::PromelaParser* ctx, void * scanner)
+yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, uscxml::PromelaParser* ctx, void * scanner)
#else
static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx, scanner)
+yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, ctx, scanner)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
+ YYLTYPE const * const yylocationp;
uscxml::PromelaParser* ctx;
void * scanner;
#endif
@@ -934,6 +1025,7 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx, scanner)
YYUSE (yyo);
if (!yyvaluep)
return;
+ YYUSE (yylocationp);
YYUSE (ctx);
YYUSE (scanner);
# ifdef YYPRINT
@@ -953,13 +1045,14 @@ yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx, scanner)
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, uscxml::PromelaParser* ctx, void * scanner)
+yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, uscxml::PromelaParser* ctx, void * scanner)
#else
static void
-yy_symbol_print (yyoutput, yytype, yyvaluep, ctx, scanner)
+yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, ctx, scanner)
FILE *yyoutput;
int yytype;
YYSTYPE const * const yyvaluep;
+ YYLTYPE const * const yylocationp;
uscxml::PromelaParser* ctx;
void * scanner;
#endif
@@ -969,7 +1062,9 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, ctx, scanner)
else
YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx, scanner);
+ YY_LOCATION_PRINT (yyoutput, *yylocationp);
+ YYFPRINTF (yyoutput, ": ");
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, ctx, scanner);
YYFPRINTF (yyoutput, ")");
}
@@ -1012,11 +1107,12 @@ do { \
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule, uscxml::PromelaParser* ctx, void * scanner)
+yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, uscxml::PromelaParser* ctx, void * scanner)
#else
static void
-yy_reduce_print (yyvsp, yyrule, ctx, scanner)
+yy_reduce_print (yyvsp, yylsp, yyrule, ctx, scanner)
YYSTYPE *yyvsp;
+ YYLTYPE *yylsp;
int yyrule;
uscxml::PromelaParser* ctx;
void * scanner;
@@ -1033,7 +1129,7 @@ yy_reduce_print (yyvsp, yyrule, ctx, scanner)
YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
- , ctx, scanner);
+ , &(yylsp[(yyi + 1) - (yynrhs)]) , ctx, scanner);
YYFPRINTF (stderr, "\n");
}
}
@@ -1041,7 +1137,7 @@ yy_reduce_print (yyvsp, yyrule, ctx, scanner)
# define YY_REDUCE_PRINT(Rule) \
do { \
if (yydebug) \
- yy_reduce_print (yyvsp, Rule, ctx, scanner); \
+ yy_reduce_print (yyvsp, yylsp, Rule, ctx, scanner); \
} while (YYID (0))
/* Nonzero means print parse trace. It is left uninitialized so that
@@ -1321,18 +1417,20 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, uscxml::PromelaParser* ctx, void * scanner)
+yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, uscxml::PromelaParser* ctx, void * scanner)
#else
static void
-yydestruct (yymsg, yytype, yyvaluep, ctx, scanner)
+yydestruct (yymsg, yytype, yyvaluep, yylocationp, ctx, scanner)
const char *yymsg;
int yytype;
YYSTYPE *yyvaluep;
+ YYLTYPE *yylocationp;
uscxml::PromelaParser* ctx;
void * scanner;
#endif
{
YYUSE (yyvaluep);
+ YYUSE (yylocationp);
YYUSE (ctx);
YYUSE (scanner);
@@ -1391,6 +1489,11 @@ int yychar;
static YYSTYPE yyval_default;
# define YY_INITIAL_VALUE(Value) = Value
#endif
+static YYLTYPE yyloc_default
+# if defined PROMELA_LTYPE_IS_TRIVIAL && PROMELA_LTYPE_IS_TRIVIAL
+ = { 1, 1, 1, 1 }
+# endif
+;
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
# define YY_IGNORE_MAYBE_UNINITIALIZED_END
@@ -1402,6 +1505,10 @@ static YYSTYPE yyval_default;
/* The semantic value of the lookahead symbol. */
YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
+/* Location data for the lookahead symbol. */
+YYLTYPE yylloc = yyloc_default;
+
+
/* Number of syntax errors so far. */
int yynerrs;
@@ -1412,6 +1519,7 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
/* The stacks and their tools:
`yyss': related to states.
`yyvs': related to semantic values.
+ `yyls': related to locations.
Refer to the stacks through separate pointers, to allow yyoverflow
to reallocate them elsewhere. */
@@ -1426,6 +1534,14 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
YYSTYPE *yyvs;
YYSTYPE *yyvsp;
+ /* The location stack. */
+ YYLTYPE yylsa[YYINITDEPTH];
+ YYLTYPE *yyls;
+ YYLTYPE *yylsp;
+
+ /* The locations where the error started and ended. */
+ YYLTYPE yyerror_range[3];
+
YYSIZE_T yystacksize;
int yyn;
@@ -1435,6 +1551,7 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
+ YYLTYPE yyloc;
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
@@ -1443,7 +1560,7 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
@@ -1451,6 +1568,7 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
yyssp = yyss = yyssa;
yyvsp = yyvs = yyvsa;
+ yylsp = yyls = yylsa;
yystacksize = YYINITDEPTH;
YYDPRINTF ((stderr, "Starting parse\n"));
@@ -1459,6 +1577,7 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
+ yylsp[0] = yylloc;
goto yysetstate;
/*------------------------------------------------------------.
@@ -1484,6 +1603,7 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
memory. */
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
+ YYLTYPE *yyls1 = yyls;
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
@@ -1492,8 +1612,10 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
+ &yyls1, yysize * sizeof (*yylsp),
&yystacksize);
+ yyls = yyls1;
yyss = yyss1;
yyvs = yyvs1;
}
@@ -1516,6 +1638,7 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
goto yyexhaustedlab;
YYSTACK_RELOCATE (yyss_alloc, yyss);
YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ YYSTACK_RELOCATE (yyls_alloc, yyls);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
@@ -1525,6 +1648,7 @@ YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
+ yylsp = yyls + yysize - 1;
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
@@ -1602,7 +1726,7 @@ yybackup:
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
-
+ *++yylsp = yylloc;
goto yynewstate;
@@ -1633,13 +1757,14 @@ yyreduce:
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
-
+ /* Default location. */
+ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
case 2:
/* Line 1787 of yacc.c */
-#line 84 "promela.ypp"
+#line 85 "promela.ypp"
{
ctx->ast = (yyvsp[(1) - (1)].node);
ctx->type = PromelaParser::PROMELA_DECL;
@@ -1648,7 +1773,7 @@ yyreduce:
case 3:
/* Line 1787 of yacc.c */
-#line 88 "promela.ypp"
+#line 89 "promela.ypp"
{
ctx->ast = (yyvsp[(1) - (1)].node);
ctx->type = PromelaParser::PROMELA_EXPR;
@@ -1657,7 +1782,7 @@ yyreduce:
case 4:
/* Line 1787 of yacc.c */
-#line 92 "promela.ypp"
+#line 93 "promela.ypp"
{
ctx->ast = (yyvsp[(1) - (1)].node);
ctx->type = PromelaParser::PROMELA_STMNT;
@@ -1666,25 +1791,25 @@ yyreduce:
case 5:
/* Line 1787 of yacc.c */
-#line 98 "promela.ypp"
+#line 99 "promela.ypp"
{ (yyval.node) = (yyvsp[(1) - (1)].node); }
break;
case 6:
/* Line 1787 of yacc.c */
-#line 101 "promela.ypp"
- { (yyval.node) = ctx->value(PML_NAME, (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
+#line 102 "promela.ypp"
+ { (yyval.node) = ctx->value(PML_NAME, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
break;
case 7:
/* Line 1787 of yacc.c */
-#line 102 "promela.ypp"
- { (yyval.node) = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (yyvsp[(1) - (4)].value)), (yyvsp[(3) - (4)].node)); free((yyvsp[(1) - (4)].value)); }
+#line 103 "promela.ypp"
+ { (yyval.node) = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (void*)&((yylsp[(1) - (4)])), (yyvsp[(1) - (4)].value)), (yyvsp[(3) - (4)].node)); free((yyvsp[(1) - (4)].value)); }
break;
case 8:
/* Line 1787 of yacc.c */
-#line 106 "promela.ypp"
+#line 107 "promela.ypp"
{
if ((yyvsp[(2) - (2)].node) != NULL) {
if ((yyvsp[(2) - (2)].node)->type == PML_CMPND) {
@@ -1701,237 +1826,237 @@ yyreduce:
case 9:
/* Line 1787 of yacc.c */
-#line 120 "promela.ypp"
+#line 121 "promela.ypp"
{ (yyval.node) = NULL; }
break;
case 10:
/* Line 1787 of yacc.c */
-#line 121 "promela.ypp"
+#line 122 "promela.ypp"
{ (yyval.node) = (yyvsp[(2) - (2)].node); }
break;
case 11:
/* Line 1787 of yacc.c */
-#line 131 "promela.ypp"
+#line 132 "promela.ypp"
{ (yyval.node) = (yyvsp[(2) - (3)].node); }
break;
case 12:
/* Line 1787 of yacc.c */
-#line 132 "promela.ypp"
+#line 133 "promela.ypp"
{ (yyval.node) = ctx->node(PML_PLUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 13:
/* Line 1787 of yacc.c */
-#line 133 "promela.ypp"
+#line 134 "promela.ypp"
{ (yyval.node) = ctx->node(PML_MINUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 14:
/* Line 1787 of yacc.c */
-#line 134 "promela.ypp"
+#line 135 "promela.ypp"
{ (yyval.node) = ctx->node(PML_TIMES, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 15:
/* Line 1787 of yacc.c */
-#line 135 "promela.ypp"
+#line 136 "promela.ypp"
{ (yyval.node) = ctx->node(PML_DIVIDE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 16:
/* Line 1787 of yacc.c */
-#line 136 "promela.ypp"
+#line 137 "promela.ypp"
{ (yyval.node) = ctx->node(PML_MODULO, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 17:
/* Line 1787 of yacc.c */
-#line 137 "promela.ypp"
+#line 138 "promela.ypp"
{ (yyval.node) = ctx->node(PML_BITAND, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 18:
/* Line 1787 of yacc.c */
-#line 138 "promela.ypp"
+#line 139 "promela.ypp"
{ (yyval.node) = ctx->node(PML_BITXOR, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 19:
/* Line 1787 of yacc.c */
-#line 139 "promela.ypp"
+#line 140 "promela.ypp"
{ (yyval.node) = ctx->node(PML_BITOR, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 20:
/* Line 1787 of yacc.c */
-#line 140 "promela.ypp"
+#line 141 "promela.ypp"
{ (yyval.node) = ctx->node(PML_GT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 21:
/* Line 1787 of yacc.c */
-#line 141 "promela.ypp"
+#line 142 "promela.ypp"
{ (yyval.node) = ctx->node(PML_LT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 22:
/* Line 1787 of yacc.c */
-#line 142 "promela.ypp"
+#line 143 "promela.ypp"
{ (yyval.node) = ctx->node(PML_GE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 23:
/* Line 1787 of yacc.c */
-#line 143 "promela.ypp"
+#line 144 "promela.ypp"
{ (yyval.node) = ctx->node(PML_LE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 24:
/* Line 1787 of yacc.c */
-#line 144 "promela.ypp"
+#line 145 "promela.ypp"
{ (yyval.node) = ctx->node(PML_EQ, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 25:
/* Line 1787 of yacc.c */
-#line 145 "promela.ypp"
+#line 146 "promela.ypp"
{ (yyval.node) = ctx->node(PML_NE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 26:
/* Line 1787 of yacc.c */
-#line 146 "promela.ypp"
+#line 147 "promela.ypp"
{ (yyval.node) = ctx->node(PML_AND, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 27:
/* Line 1787 of yacc.c */
-#line 147 "promela.ypp"
+#line 148 "promela.ypp"
{ (yyval.node) = ctx->node(PML_OR, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 28:
/* Line 1787 of yacc.c */
-#line 148 "promela.ypp"
+#line 149 "promela.ypp"
{ (yyval.node) = ctx->node(PML_LSHIFT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 29:
/* Line 1787 of yacc.c */
-#line 149 "promela.ypp"
+#line 150 "promela.ypp"
{ (yyval.node) = ctx->node(PML_RSHIFT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 30:
/* Line 1787 of yacc.c */
-#line 150 "promela.ypp"
+#line 151 "promela.ypp"
{ (yyval.node) = ctx->node(PML_NEG, 1, (yyvsp[(2) - (2)].node)); }
break;
case 31:
/* Line 1787 of yacc.c */
-#line 151 "promela.ypp"
+#line 152 "promela.ypp"
{ (yyval.node) = ctx->node(PML_MINUS, 1, (yyvsp[(2) - (2)].node)); }
break;
case 32:
/* Line 1787 of yacc.c */
-#line 153 "promela.ypp"
+#line 154 "promela.ypp"
{ (yyval.node) = ctx->node(PML_LEN, 1, (yyvsp[(3) - (4)].node)); }
break;
case 33:
/* Line 1787 of yacc.c */
-#line 154 "promela.ypp"
+#line 155 "promela.ypp"
{ (yyval.node) = (yyvsp[(1) - (1)].node); }
break;
case 34:
/* Line 1787 of yacc.c */
-#line 155 "promela.ypp"
- { (yyval.node) = ctx->value(PML_CONST, (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
+#line 156 "promela.ypp"
+ { (yyval.node) = ctx->value(PML_CONST, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
break;
case 35:
/* Line 1787 of yacc.c */
-#line 156 "promela.ypp"
+#line 157 "promela.ypp"
{
/* Non standard promela for string literals */
- (yyval.node) = ctx->value(PML_STRING, (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
+ (yyval.node) = ctx->value(PML_STRING, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
break;
case 36:
/* Line 1787 of yacc.c */
-#line 162 "promela.ypp"
+#line 163 "promela.ypp"
{ (yyval.node) = ctx->node(PML_SHOW, 0); }
break;
case 37:
/* Line 1787 of yacc.c */
-#line 163 "promela.ypp"
+#line 164 "promela.ypp"
{ (yyval.node) = ctx->node(PML_HIDDEN, 0); }
break;
case 38:
/* Line 1787 of yacc.c */
-#line 164 "promela.ypp"
+#line 165 "promela.ypp"
{ (yyval.node) = ctx->node(PML_SHOW, 0); }
break;
case 39:
/* Line 1787 of yacc.c */
-#line 165 "promela.ypp"
+#line 166 "promela.ypp"
{ (yyval.node) = ctx->node(PML_ISLOCAL, 0); }
break;
case 40:
/* Line 1787 of yacc.c */
-#line 168 "promela.ypp"
- { (yyval.node) = ctx->node(PML_DECL, 3, (yyvsp[(1) - (3)].node), ctx->value(PML_TYPE, (yyvsp[(2) - (3)].value)), (yyvsp[(3) - (3)].node)); free((yyvsp[(2) - (3)].value)); }
+#line 169 "promela.ypp"
+ { (yyval.node) = ctx->node(PML_DECL, 3, (yyvsp[(1) - (3)].node), ctx->value(PML_TYPE, (void*)&((yylsp[(2) - (3)])), (yyvsp[(2) - (3)].value)), (yyvsp[(3) - (3)].node)); free((yyvsp[(2) - (3)].value)); }
break;
case 41:
/* Line 1787 of yacc.c */
-#line 169 "promela.ypp"
+#line 170 "promela.ypp"
{ (yyval.node) = ctx->node(PML_UNAME, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 42:
/* Line 1787 of yacc.c */
-#line 170 "promela.ypp"
- { (yyval.node) = ctx->node(PML_DECL, 3, (yyvsp[(1) - (6)].node), ctx->value(PML_TYPE, (yyvsp[(2) - (6)].value)), (yyvsp[(5) - (6)].node)); free((yyvsp[(2) - (6)].value)); }
+#line 171 "promela.ypp"
+ { (yyval.node) = ctx->node(PML_DECL, 3, (yyvsp[(1) - (6)].node), ctx->value(PML_TYPE, (void*)&((yylsp[(2) - (6)])), (yyvsp[(2) - (6)].value)), (yyvsp[(5) - (6)].node)); free((yyvsp[(2) - (6)].value)); }
break;
case 43:
/* Line 1787 of yacc.c */
-#line 171 "promela.ypp"
+#line 172 "promela.ypp"
{ (yyval.node) = (yyvsp[(2) - (2)].node); }
break;
case 44:
/* Line 1787 of yacc.c */
-#line 174 "promela.ypp"
- { (yyval.node) = ctx->node(PML_TYPEDEF, 2, ctx->value(PML_NAME, (yyvsp[(2) - (5)].value)), (yyvsp[(4) - (5)].node)); }
+#line 175 "promela.ypp"
+ { (yyval.node) = ctx->node(PML_TYPEDEF, 2, ctx->value(PML_NAME, (void*)&((yylsp[(2) - (5)])), (yyvsp[(2) - (5)].value)), (yyvsp[(4) - (5)].node)); }
break;
case 45:
/* Line 1787 of yacc.c */
-#line 177 "promela.ypp"
+#line 178 "promela.ypp"
{ (yyval.node) = (yyvsp[(1) - (1)].node); }
break;
case 46:
/* Line 1787 of yacc.c */
-#line 178 "promela.ypp"
+#line 179 "promela.ypp"
{ (yyval.node) = (yyvsp[(1) - (2)].node); }
break;
case 47:
/* Line 1787 of yacc.c */
-#line 179 "promela.ypp"
+#line 180 "promela.ypp"
{
(yyval.node) = ctx->node(PML_DECLLIST, 1, (yyvsp[(1) - (3)].node));
if((yyvsp[(3) - (3)].node)->type == PML_DECLLIST) {
@@ -1944,109 +2069,109 @@ yyreduce:
case 48:
/* Line 1787 of yacc.c */
-#line 189 "promela.ypp"
+#line 190 "promela.ypp"
{ (yyval.node) = ctx->node(PML_VARLIST, 1, (yyvsp[(1) - (1)].node)); }
break;
case 49:
/* Line 1787 of yacc.c */
-#line 190 "promela.ypp"
+#line 191 "promela.ypp"
{ (yyval.node) = ctx->node(PML_VARLIST, 1, (yyvsp[(1) - (3)].node)); (yyval.node)->merge((yyvsp[(3) - (3)].node)); delete (yyvsp[(3) - (3)].node); }
break;
case 50:
/* Line 1787 of yacc.c */
-#line 193 "promela.ypp"
+#line 194 "promela.ypp"
{ (yyval.node) = (yyvsp[(1) - (1)].node); }
break;
case 51:
/* Line 1787 of yacc.c */
-#line 194 "promela.ypp"
+#line 195 "promela.ypp"
{ (yyval.node) = ctx->node(PML_ASGN, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 52:
/* Line 1787 of yacc.c */
-#line 197 "promela.ypp"
- { (yyval.node) = ctx->value(PML_NAME, (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
+#line 198 "promela.ypp"
+ { (yyval.node) = ctx->value(PML_NAME, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
break;
case 53:
/* Line 1787 of yacc.c */
-#line 198 "promela.ypp"
- { (yyval.node) = ctx->node(PML_COLON, 2, ctx->value(PML_NAME, (yyvsp[(1) - (3)].value)), ctx->value(PML_CONST, (yyvsp[(3) - (3)].value))); free((yyvsp[(1) - (3)].value)); free((yyvsp[(3) - (3)].value)); }
+#line 199 "promela.ypp"
+ { (yyval.node) = ctx->node(PML_COLON, 2, ctx->value(PML_NAME, (void*)&((yylsp[(1) - (3)])), (yyvsp[(1) - (3)].value)), ctx->value(PML_CONST, (void*)&((yylsp[(3) - (3)])), (yyvsp[(3) - (3)].value))); free((yyvsp[(1) - (3)].value)); free((yyvsp[(3) - (3)].value)); }
break;
case 54:
/* Line 1787 of yacc.c */
-#line 199 "promela.ypp"
- { (yyval.node) = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (yyvsp[(1) - (4)].value)), (yyvsp[(3) - (4)].node)); free((yyvsp[(1) - (4)].value)); }
+#line 200 "promela.ypp"
+ { (yyval.node) = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (void*)&((yylsp[(1) - (4)])), (yyvsp[(1) - (4)].value)), (yyvsp[(3) - (4)].node)); free((yyvsp[(1) - (4)].value)); }
break;
case 55:
/* Line 1787 of yacc.c */
-#line 202 "promela.ypp"
- { (yyval.node) = ctx->value(PML_CONST, (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
+#line 203 "promela.ypp"
+ { (yyval.node) = ctx->value(PML_CONST, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
break;
case 56:
/* Line 1787 of yacc.c */
-#line 203 "promela.ypp"
+#line 204 "promela.ypp"
{ (yyval.node) = ctx->node(PML_MINUS, 1, (yyvsp[(2) - (2)].node)); }
break;
case 57:
/* Line 1787 of yacc.c */
-#line 204 "promela.ypp"
+#line 205 "promela.ypp"
{ (yyval.node) = (yyvsp[(2) - (3)].node); }
break;
case 58:
/* Line 1787 of yacc.c */
-#line 205 "promela.ypp"
+#line 206 "promela.ypp"
{ (yyval.node) = ctx->node(PML_PLUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 59:
/* Line 1787 of yacc.c */
-#line 206 "promela.ypp"
+#line 207 "promela.ypp"
{ (yyval.node) = ctx->node(PML_MINUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 60:
/* Line 1787 of yacc.c */
-#line 207 "promela.ypp"
+#line 208 "promela.ypp"
{ (yyval.node) = ctx->node(PML_TIMES, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 61:
/* Line 1787 of yacc.c */
-#line 208 "promela.ypp"
+#line 209 "promela.ypp"
{ (yyval.node) = ctx->node(PML_DIVIDE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 62:
/* Line 1787 of yacc.c */
-#line 209 "promela.ypp"
+#line 210 "promela.ypp"
{ (yyval.node) = ctx->node(PML_MODULO, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 63:
/* Line 1787 of yacc.c */
-#line 212 "promela.ypp"
- { (yyval.node) = ctx->value(PML_NAME, (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
+#line 213 "promela.ypp"
+ { (yyval.node) = ctx->value(PML_NAME, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
break;
case 64:
/* Line 1787 of yacc.c */
-#line 213 "promela.ypp"
+#line 214 "promela.ypp"
{
if ((yyvsp[(1) - (2)].node)->type == PML_NAME) {
(yyval.node) = ctx->node(PML_NAMELIST, 1, (yyvsp[(1) - (2)].node));
- (yyval.node)->push(ctx->value(PML_NAME, (yyvsp[(2) - (2)].value)));
+ (yyval.node)->push(ctx->value(PML_NAME, (void*)&((yylsp[(2) - (2)])), (yyvsp[(2) - (2)].value)));
} else {
- (yyvsp[(1) - (2)].node)->push(ctx->value(PML_NAME, (yyvsp[(2) - (2)].value)));
+ (yyvsp[(1) - (2)].node)->push(ctx->value(PML_NAME, (void*)&((yylsp[(2) - (2)])), (yyvsp[(2) - (2)].value)));
}
free((yyvsp[(2) - (2)].value));
}
@@ -2054,109 +2179,109 @@ yyreduce:
case 65:
/* Line 1787 of yacc.c */
-#line 222 "promela.ypp"
+#line 223 "promela.ypp"
{ (yyval.node) = (yyvsp[(1) - (2)].node); }
break;
case 66:
/* Line 1787 of yacc.c */
-#line 225 "promela.ypp"
+#line 226 "promela.ypp"
{ (yyval.node) = (yyvsp[(1) - (1)].node); }
break;
case 67:
/* Line 1787 of yacc.c */
-#line 226 "promela.ypp"
+#line 227 "promela.ypp"
{ (yyval.node) = (yyvsp[(1) - (2)].node); }
break;
case 68:
/* Line 1787 of yacc.c */
-#line 227 "promela.ypp"
+#line 228 "promela.ypp"
{ (yyval.node) = ctx->node(PML_STMNT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 69:
/* Line 1787 of yacc.c */
-#line 230 "promela.ypp"
+#line 231 "promela.ypp"
{ (yyval.node) = (yyvsp[(1) - (1)].node); }
break;
case 70:
/* Line 1787 of yacc.c */
-#line 233 "promela.ypp"
+#line 234 "promela.ypp"
{ (yyval.node) = ctx->node(PML_ASGN, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
case 71:
/* Line 1787 of yacc.c */
-#line 234 "promela.ypp"
+#line 235 "promela.ypp"
{ (yyval.node) = ctx->node(PML_INCR, 1, (yyvsp[(1) - (2)].node)); }
break;
case 72:
/* Line 1787 of yacc.c */
-#line 235 "promela.ypp"
+#line 236 "promela.ypp"
{ (yyval.node) = ctx->node(PML_DECR, 1, (yyvsp[(1) - (2)].node)); }
break;
case 73:
/* Line 1787 of yacc.c */
-#line 236 "promela.ypp"
- { (yyval.node) = ctx->node(PML_PRINT, 2, ctx->value(PML_STRING, (yyvsp[(3) - (5)].value)), (yyvsp[(4) - (5)].node)); free((yyvsp[(3) - (5)].value)); }
+#line 237 "promela.ypp"
+ { (yyval.node) = ctx->node(PML_PRINT, 2, ctx->value(PML_STRING, (void*)&((yylsp[(3) - (5)])), (yyvsp[(3) - (5)].value)), (yyvsp[(4) - (5)].node)); free((yyvsp[(3) - (5)].value)); }
break;
case 74:
/* Line 1787 of yacc.c */
-#line 237 "promela.ypp"
+#line 238 "promela.ypp"
{ (yyval.node) = ctx->node(PML_PRINT, 1, (yyvsp[(3) - (4)].node)); }
break;
case 75:
/* Line 1787 of yacc.c */
-#line 238 "promela.ypp"
- { (yyval.node) = ctx->node(PML_PRINT, 1, ctx->value(PML_CONST, (yyvsp[(3) - (4)].value))); free((yyvsp[(3) - (4)].value)); }
+#line 239 "promela.ypp"
+ { (yyval.node) = ctx->node(PML_PRINT, 1, ctx->value(PML_CONST, (void*)&((yylsp[(3) - (4)])), (yyvsp[(3) - (4)].value))); free((yyvsp[(3) - (4)].value)); }
break;
case 76:
/* Line 1787 of yacc.c */
-#line 239 "promela.ypp"
+#line 240 "promela.ypp"
{ (yyval.node) = ctx->node(PML_ASSERT, 1, (yyvsp[(2) - (2)].node)); }
break;
case 77:
/* Line 1787 of yacc.c */
-#line 240 "promela.ypp"
+#line 241 "promela.ypp"
{ (yyval.node) = (yyvsp[(1) - (1)].node); }
break;
case 78:
/* Line 1787 of yacc.c */
-#line 243 "promela.ypp"
- { (yyval.node) = ctx->value(0, ""); }
+#line 244 "promela.ypp"
+ { (yyval.node) = ctx->value(0, NULL, ""); }
break;
case 79:
/* Line 1787 of yacc.c */
-#line 244 "promela.ypp"
+#line 245 "promela.ypp"
{ (yyval.node) = (yyvsp[(2) - (2)].node); }
break;
case 80:
/* Line 1787 of yacc.c */
-#line 247 "promela.ypp"
+#line 248 "promela.ypp"
{ (yyval.node) = (yyvsp[(1) - (1)].node); }
break;
case 81:
/* Line 1787 of yacc.c */
-#line 248 "promela.ypp"
+#line 249 "promela.ypp"
{ (yyval.node) = ctx->node(0, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
break;
/* Line 1787 of yacc.c */
-#line 2160 "promela.tab.cpp"
+#line 2285 "promela.tab.cpp"
default: break;
}
/* User semantic actions sometimes alter yychar, and that requires
@@ -2177,6 +2302,7 @@ yyreduce:
YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
+ *++yylsp = yyloc;
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
@@ -2206,7 +2332,7 @@ yyerrlab:
{
++yynerrs;
#if ! YYERROR_VERBOSE
- yyerror (ctx, scanner, YY_("syntax error"));
+ yyerror (&yylloc, ctx, scanner, YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)
@@ -2233,7 +2359,7 @@ yyerrlab:
yymsgp = yymsg;
}
}
- yyerror (ctx, scanner, yymsgp);
+ yyerror (&yylloc, ctx, scanner, yymsgp);
if (yysyntax_error_status == 2)
goto yyexhaustedlab;
}
@@ -2241,7 +2367,7 @@ yyerrlab:
#endif
}
-
+ yyerror_range[1] = yylloc;
if (yyerrstatus == 3)
{
@@ -2257,7 +2383,7 @@ yyerrlab:
else
{
yydestruct ("Error: discarding",
- yytoken, &yylval, ctx, scanner);
+ yytoken, &yylval, &yylloc, ctx, scanner);
yychar = YYEMPTY;
}
}
@@ -2278,6 +2404,7 @@ yyerrorlab:
if (/*CONSTCOND*/ 0)
goto yyerrorlab;
+ yyerror_range[1] = yylsp[1-yylen];
/* Do not reclaim the symbols of the rule which action triggered
this YYERROR. */
YYPOPSTACK (yylen);
@@ -2311,9 +2438,9 @@ yyerrlab1:
if (yyssp == yyss)
YYABORT;
-
+ yyerror_range[1] = *yylsp;
yydestruct ("Error: popping",
- yystos[yystate], yyvsp, ctx, scanner);
+ yystos[yystate], yyvsp, yylsp, ctx, scanner);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
@@ -2323,6 +2450,11 @@ yyerrlab1:
*++yyvsp = yylval;
YY_IGNORE_MAYBE_UNINITIALIZED_END
+ yyerror_range[2] = yylloc;
+ /* Using YYLLOC is tempting, but would change the location of
+ the lookahead. YYLOC is available though. */
+ YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
+ *++yylsp = yyloc;
/* Shift the error token. */
YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
@@ -2350,7 +2482,7 @@ yyabortlab:
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
yyexhaustedlab:
- yyerror (ctx, scanner, YY_("memory exhausted"));
+ yyerror (&yylloc, ctx, scanner, YY_("memory exhausted"));
yyresult = 2;
/* Fall through. */
#endif
@@ -2362,7 +2494,7 @@ yyreturn:
user semantic actions for why this is necessary. */
yytoken = YYTRANSLATE (yychar);
yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, ctx, scanner);
+ yytoken, &yylval, &yylloc, ctx, scanner);
}
/* Do not reclaim the symbols of the rule which action triggered
this YYABORT or YYACCEPT. */
@@ -2371,7 +2503,7 @@ yyreturn:
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, ctx, scanner);
+ yystos[*yyssp], yyvsp, yylsp, ctx, scanner);
YYPOPSTACK (1);
}
#ifndef yyoverflow
@@ -2388,6 +2520,6 @@ yyreturn:
/* Line 2050 of yacc.c */
-#line 252 "promela.ypp"
+#line 253 "promela.ypp"
diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp b/src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp
index e6eb572..a48031a 100644
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp
+++ b/src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp
@@ -135,7 +135,7 @@ extern int promela_debug;
typedef union PROMELA_STYPE
{
/* Line 2053 of yacc.c */
-#line 38 "promela.ypp"
+#line 39 "promela.ypp"
uscxml::PromelaParserNode* node;
char* value;
@@ -149,6 +149,19 @@ typedef union PROMELA_STYPE
# define PROMELA_STYPE_IS_DECLARED 1
#endif
+#if ! defined PROMELA_LTYPE && ! defined PROMELA_LTYPE_IS_DECLARED
+typedef struct PROMELA_LTYPE
+{
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+} PROMELA_LTYPE;
+# define promela_ltype PROMELA_LTYPE /* obsolescent; will be withdrawn */
+# define PROMELA_LTYPE_IS_DECLARED 1
+# define PROMELA_LTYPE_IS_TRIVIAL 1
+#endif
+
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
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; }
;