summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-11-12 12:36:27 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-11-12 12:36:27 (GMT)
commit8202b54c5d3ce1fbc4f079918551f2f076a221cb (patch)
tree20ba167c6d87e66e2e2b13e62bde1c92a9925175 /src
parentc66fa34eb48f81da05966b947a2e37067318a09f (diff)
downloaduscxml-8202b54c5d3ce1fbc4f079918551f2f076a221cb.zip
uscxml-8202b54c5d3ce1fbc4f079918551f2f076a221cb.tar.gz
uscxml-8202b54c5d3ce1fbc4f079918551f2f076a221cb.tar.bz2
More work on PROMELA transformation
Diffstat (limited to 'src')
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.l1
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp1862
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp3056
-rw-r--r--src/uscxml/plugins/datamodel/promela/parser/promela.ypp9
-rw-r--r--src/uscxml/transform/ChartToFSM.cpp92
-rw-r--r--src/uscxml/transform/ChartToFSM.h56
-rw-r--r--src/uscxml/transform/ChartToPromela.cpp1625
-rw-r--r--src/uscxml/transform/ChartToPromela.h140
-rw-r--r--src/uscxml/transform/FlatStateIdentifier.h23
9 files changed, 3564 insertions, 3300 deletions
diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.l b/src/uscxml/plugins/datamodel/promela/parser/promela.l
index faa134c..dc4b66c 100644
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.l
+++ b/src/uscxml/plugins/datamodel/promela/parser/promela.l
@@ -34,7 +34,6 @@ bit|bool|byte|int|mtype|short|unsigned|string {
len { return PML_LEN; }
false|skip|true { yylval->value = strdup(yytext); return PML_CONST; }
printf { return PML_PRINT; }
-printm { return PML_PRINTM; }
typedef { return PML_TYPEDEF; }
assert { return PML_ASSERT; }
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 13085dc..c6e4573 100644
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp
+++ b/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp
@@ -26,7 +26,7 @@
/* %endif */
/* %if-c-only */
-
+
/* %endif */
/* %if-c-only */
@@ -58,7 +58,7 @@
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
+ * if you want the limit (max/min) macros for int types.
*/
#ifndef __STDC_LIMIT_MACROS
#define __STDC_LIMIT_MACROS 1
@@ -76,7 +76,7 @@ typedef uint64_t flex_uint64_t;
typedef signed char flex_int8_t;
typedef short int flex_int16_t;
typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
+typedef unsigned char flex_uint8_t;
typedef unsigned short int flex_uint16_t;
typedef unsigned int flex_uint32_t;
#endif /* ! C99 */
@@ -230,8 +230,8 @@ typedef size_t yy_size_t;
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
-#define YY_LESS_LINENO(n)
-
+ #define YY_LESS_LINENO(n)
+
/* Return all but the first "n" matched characters back to the input stream. */
#define yyless(n) \
do \
@@ -250,13 +250,14 @@ typedef size_t yy_size_t;
#ifndef YY_STRUCT_YY_BUFFER_STATE
#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state {
- /* %if-c-only */
+struct yy_buffer_state
+ {
+/* %if-c-only */
FILE *yy_input_file;
- /* %endif */
+/* %endif */
- /* %if-c++-only */
- /* %endif */
+/* %if-c++-only */
+/* %endif */
char *yy_ch_buf; /* input buffer */
char *yy_buf_pos; /* current position in input buffer */
@@ -290,9 +291,9 @@ struct yy_buffer_state {
*/
int yy_at_bol;
- int yy_bs_lineno; /**< The line count. */
- int yy_bs_column; /**< The column count. */
-
+ int yy_bs_lineno; /**< The line count. */
+ int yy_bs_column; /**< The column count. */
+
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
@@ -314,7 +315,7 @@ struct yy_buffer_state {
*/
#define YY_BUFFER_EOF_PENDING 2
-};
+ };
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
/* %if-c-only Standard (non-C++) definition */
@@ -433,175 +434,174 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
yyg->yy_c_buf_p = yy_cp;
/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
-#define YY_NUM_RULES 47
-#define YY_END_OF_BUFFER 48
+#define YY_NUM_RULES 46
+#define YY_END_OF_BUFFER 47
/* This struct is not used in this scanner,
but its presence is necessary. */
-struct yy_trans_info {
+struct yy_trans_info
+ {
flex_int32_t yy_verify;
flex_int32_t yy_nxt;
-};
-static yyconst flex_int16_t yy_accept[125] = {
- 0,
- 0, 0, 48, 46, 45, 45, 9, 46, 15, 26,
- 46, 34, 35, 13, 16, 32, 17, 31, 14, 43,
- 33, 22, 40, 23, 44, 44, 36, 37, 27, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 38,
- 28, 39, 10, 45, 24, 0, 41, 0, 29, 0,
- 42, 0, 11, 12, 0, 43, 18, 20, 25, 21,
- 19, 44, 0, 0, 44, 44, 44, 44, 44, 44,
- 44, 44, 44, 44, 44, 44, 44, 44, 44, 30,
- 0, 42, 0, 0, 0, 44, 2, 44, 44, 44,
- 3, 44, 44, 44, 44, 44, 44, 44, 44, 0,
-
- 1, 44, 44, 44, 44, 44, 4, 44, 44, 44,
- 1, 44, 44, 44, 44, 44, 8, 5, 6, 44,
- 44, 7, 44, 0
-} ;
-
-static yyconst flex_int32_t yy_ec[256] = {
- 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 4, 5, 1, 1, 6, 7, 8, 9,
- 10, 11, 12, 13, 14, 15, 16, 17, 17, 17,
- 17, 17, 17, 17, 17, 17, 17, 1, 18, 19,
- 20, 21, 1, 1, 22, 22, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 23, 22, 22, 22, 22,
- 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
- 24, 25, 26, 27, 22, 1, 28, 29, 22, 30,
-
- 31, 32, 33, 34, 35, 22, 36, 37, 38, 39,
- 40, 41, 22, 42, 43, 44, 45, 22, 22, 22,
- 46, 22, 47, 48, 49, 50, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
-} ;
-
-static yyconst flex_int32_t yy_meta[51] = {
- 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 2, 1, 1, 1,
- 1, 2, 2, 1, 1, 1, 1, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 1, 1, 1
-} ;
-
-static yyconst flex_int16_t yy_base[130] = {
- 0,
- 0, 0, 170, 171, 49, 51, 149, 50, 171, 161,
- 48, 171, 171, 171, 155, 171, 152, 171, 154, 147,
- 171, 38, 143, 39, 0, 56, 171, 171, 171, 119,
- 28, 133, 121, 128, 114, 115, 33, 20, 117, 171,
- 107, 171, 171, 68, 171, 60, 171, 151, 171, 64,
- 171, 73, 171, 171, 142, 135, 171, 171, 171, 171,
- 171, 0, 74, 70, 108, 106, 109, 104, 110, 102,
- 106, 98, 108, 102, 106, 98, 94, 97, 94, 171,
- 72, 75, 79, 125, 75, 104, 0, 97, 102, 89,
- 0, 90, 91, 87, 87, 92, 95, 94, 89, 77,
-
- 171, 81, 91, 90, 76, 75, 0, 79, 87, 83,
- 104, 70, 52, 80, 72, 63, 0, 0, 0, 69,
- 65, 0, 64, 171, 104, 106, 90, 108, 110
-} ;
-
-static yyconst flex_int16_t yy_def[130] = {
- 0,
- 124, 1, 124, 124, 124, 124, 124, 125, 124, 124,
- 126, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 127, 127, 124, 124, 124, 127,
- 127, 127, 127, 127, 127, 127, 127, 127, 127, 124,
- 124, 124, 124, 124, 124, 125, 124, 125, 124, 126,
- 124, 128, 124, 124, 129, 124, 124, 124, 124, 124,
- 124, 127, 125, 126, 127, 127, 127, 127, 127, 127,
- 127, 127, 127, 127, 127, 127, 127, 127, 127, 124,
- 126, 126, 128, 129, 129, 127, 127, 127, 127, 127,
- 127, 127, 127, 127, 127, 127, 127, 127, 127, 129,
-
- 124, 127, 127, 127, 127, 127, 127, 127, 127, 127,
- 129, 127, 127, 127, 127, 127, 127, 127, 127, 127,
- 127, 127, 127, 0, 124, 124, 124, 124, 124
-} ;
-
-static yyconst flex_int16_t yy_nxt[222] = {
- 0,
- 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 4, 28, 29, 30, 31, 25,
- 25, 32, 25, 25, 33, 25, 34, 35, 25, 25,
- 36, 25, 37, 38, 39, 25, 40, 41, 42, 43,
- 44, 44, 44, 44, 47, 51, 57, 58, 60, 61,
- 63, 77, 66, 64, 47, 78, 74, 67, 75, 44,
- 44, 51, 52, 68, 48, 50, 76, 51, 47, 51,
- 82, 50, 51, 118, 48, 100, 82, 85, 52, 119,
- 101, 62, 111, 87, 52, 123, 52, 83, 48, 52,
-
- 122, 121, 120, 83, 46, 46, 50, 50, 81, 81,
- 84, 84, 87, 117, 85, 116, 115, 114, 87, 113,
- 87, 107, 112, 110, 109, 107, 108, 107, 106, 105,
- 104, 103, 87, 87, 102, 85, 99, 98, 97, 96,
- 95, 94, 93, 92, 91, 87, 90, 89, 88, 87,
- 86, 56, 85, 124, 80, 79, 73, 72, 71, 70,
- 69, 65, 59, 56, 55, 54, 53, 49, 45, 124,
- 3, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124
-} ;
-
-static yyconst flex_int16_t yy_chk[222] = {
- 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 5, 5, 6, 6, 8, 11, 22, 22, 24, 24,
- 26, 38, 31, 26, 46, 38, 37, 31, 37, 44,
- 44, 50, 11, 31, 8, 52, 37, 64, 63, 81,
- 52, 83, 82, 113, 46, 85, 83, 100, 50, 113,
- 85, 127, 100, 123, 64, 121, 81, 52, 63, 82,
-
- 120, 116, 115, 83, 125, 125, 126, 126, 128, 128,
- 129, 129, 114, 112, 111, 110, 109, 108, 106, 105,
- 104, 103, 102, 99, 98, 97, 96, 95, 94, 93,
- 92, 90, 89, 88, 86, 84, 79, 78, 77, 76,
- 75, 74, 73, 72, 71, 70, 69, 68, 67, 66,
- 65, 56, 55, 48, 41, 39, 36, 35, 34, 33,
- 32, 30, 23, 20, 19, 17, 15, 10, 7, 3,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
-
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- 124
-} ;
-
-static yyconst flex_int16_t yy_rule_linenum[47] = {
- 0,
- 27, 29, 34, 35, 36, 37, 38, 39, 41, 42,
- 43, 44, 46, 47, 48, 50, 51, 53, 54, 56,
- 57, 58, 59, 61, 62, 64, 65, 66, 69, 70,
- 72, 73, 74, 76, 77, 79, 80, 82, 83, 85,
- 87, 90, 95, 96, 98, 101
-} ;
+ };
+static yyconst flex_int16_t yy_accept[124] =
+ { 0,
+ 0, 0, 47, 45, 44, 44, 8, 45, 14, 25,
+ 45, 33, 34, 12, 15, 31, 16, 30, 13, 42,
+ 32, 21, 39, 22, 43, 43, 35, 36, 26, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 37,
+ 27, 38, 9, 44, 23, 0, 40, 0, 28, 0,
+ 41, 0, 10, 11, 0, 42, 17, 19, 24, 20,
+ 18, 43, 0, 0, 43, 43, 43, 43, 43, 43,
+ 43, 43, 43, 43, 43, 43, 43, 43, 43, 29,
+ 0, 41, 0, 0, 0, 43, 2, 43, 43, 43,
+ 3, 43, 43, 43, 43, 43, 43, 43, 43, 0,
+
+ 1, 43, 43, 43, 43, 43, 4, 43, 43, 43,
+ 1, 43, 43, 43, 43, 43, 7, 5, 43, 43,
+ 6, 43, 0
+ } ;
+
+static yyconst flex_int32_t yy_ec[256] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 2, 4, 5, 1, 1, 6, 7, 8, 9,
+ 10, 11, 12, 13, 14, 15, 16, 17, 17, 17,
+ 17, 17, 17, 17, 17, 17, 17, 1, 18, 19,
+ 20, 21, 1, 1, 22, 22, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 23, 22, 22, 22, 22,
+ 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+ 24, 25, 26, 27, 22, 1, 28, 29, 22, 30,
+
+ 31, 32, 33, 34, 35, 22, 36, 37, 38, 39,
+ 40, 41, 22, 42, 43, 44, 45, 22, 22, 22,
+ 46, 22, 47, 48, 49, 50, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1
+ } ;
+
+static yyconst flex_int32_t yy_meta[51] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 2, 1, 1, 1,
+ 1, 2, 2, 1, 1, 1, 1, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 1, 1, 1
+ } ;
+
+static yyconst flex_int16_t yy_base[129] =
+ { 0,
+ 0, 0, 169, 170, 49, 51, 148, 50, 170, 160,
+ 48, 170, 170, 170, 154, 170, 151, 170, 153, 146,
+ 170, 38, 142, 39, 0, 56, 170, 170, 170, 118,
+ 28, 132, 120, 127, 113, 114, 33, 20, 116, 170,
+ 106, 170, 170, 68, 170, 60, 170, 150, 170, 64,
+ 170, 73, 170, 170, 141, 134, 170, 170, 170, 170,
+ 170, 0, 74, 70, 107, 105, 108, 103, 109, 101,
+ 105, 97, 107, 101, 105, 97, 93, 96, 93, 170,
+ 72, 75, 79, 124, 75, 103, 0, 96, 101, 88,
+ 0, 89, 90, 86, 86, 91, 94, 93, 88, 77,
+
+ 170, 80, 90, 89, 75, 74, 0, 78, 86, 82,
+ 103, 69, 71, 69, 70, 57, 0, 0, 62, 61,
+ 0, 60, 170, 104, 106, 82, 108, 110
+ } ;
+
+static yyconst flex_int16_t yy_def[129] =
+ { 0,
+ 123, 1, 123, 123, 123, 123, 123, 124, 123, 123,
+ 125, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 126, 126, 123, 123, 123, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 123,
+ 123, 123, 123, 123, 123, 124, 123, 124, 123, 125,
+ 123, 127, 123, 123, 128, 123, 123, 123, 123, 123,
+ 123, 126, 124, 125, 126, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 123,
+ 125, 125, 127, 128, 128, 126, 126, 126, 126, 126,
+ 126, 126, 126, 126, 126, 126, 126, 126, 126, 128,
+
+ 123, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 128, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+ 126, 126, 0, 123, 123, 123, 123, 123
+ } ;
+
+static yyconst flex_int16_t yy_nxt[221] =
+ { 0,
+ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 4, 28, 29, 30, 31, 25,
+ 25, 32, 25, 25, 33, 25, 34, 35, 25, 25,
+ 36, 25, 37, 38, 39, 25, 40, 41, 42, 43,
+ 44, 44, 44, 44, 47, 51, 57, 58, 60, 61,
+ 63, 77, 66, 64, 47, 78, 74, 67, 75, 44,
+ 44, 51, 52, 68, 48, 50, 76, 51, 47, 51,
+ 82, 50, 51, 62, 48, 100, 82, 85, 52, 87,
+ 101, 122, 111, 121, 52, 120, 52, 83, 48, 52,
+
+ 119, 87, 118, 83, 46, 46, 50, 50, 81, 81,
+ 84, 84, 117, 85, 116, 115, 114, 87, 113, 87,
+ 107, 112, 110, 109, 107, 108, 107, 106, 105, 104,
+ 103, 87, 87, 102, 85, 99, 98, 97, 96, 95,
+ 94, 93, 92, 91, 87, 90, 89, 88, 87, 86,
+ 56, 85, 123, 80, 79, 73, 72, 71, 70, 69,
+ 65, 59, 56, 55, 54, 53, 49, 45, 123, 3,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123
+ } ;
+
+static yyconst flex_int16_t yy_chk[221] =
+ { 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 5, 5, 6, 6, 8, 11, 22, 22, 24, 24,
+ 26, 38, 31, 26, 46, 38, 37, 31, 37, 44,
+ 44, 50, 11, 31, 8, 52, 37, 64, 63, 81,
+ 52, 83, 82, 126, 46, 85, 83, 100, 50, 122,
+ 85, 120, 100, 119, 64, 116, 81, 52, 63, 82,
+
+ 115, 114, 113, 83, 124, 124, 125, 125, 127, 127,
+ 128, 128, 112, 111, 110, 109, 108, 106, 105, 104,
+ 103, 102, 99, 98, 97, 96, 95, 94, 93, 92,
+ 90, 89, 88, 86, 84, 79, 78, 77, 76, 75,
+ 74, 73, 72, 71, 70, 69, 68, 67, 66, 65,
+ 56, 55, 48, 41, 39, 36, 35, 34, 33, 32,
+ 30, 23, 20, 19, 17, 15, 10, 7, 3, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
+ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123
+ } ;
+
+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
+ } ;
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
@@ -615,12 +615,12 @@ static yyconst flex_int16_t yy_rule_linenum[47] = {
/* see: http://spinroot.com/spin/Man/operators.html */
#define YY_NO_UNISTD_H 1
#line 14 "promela.l"
-
+
#include "../PromelaParser.h"
#include "promela.tab.hpp"
#define YYSTYPE PROMELA_STYPE
-#line 626 "promela.lex.yy.cpp"
+#line 624 "promela.lex.yy.cpp"
#define INITIAL 0
@@ -644,39 +644,40 @@ static yyconst flex_int16_t yy_rule_linenum[47] = {
/* %if-reentrant */
/* Holds the entire state of the reentrant scanner. */
-struct yyguts_t {
-
- /* User-defined. Not touched by flex. */
- YY_EXTRA_TYPE yyextra_r;
-
- /* The rest are the same as the globals declared in the non-reentrant scanner. */
- FILE *yyin_r, *yyout_r;
- size_t yy_buffer_stack_top; /**< index of top of stack. */
- size_t yy_buffer_stack_max; /**< capacity of stack. */
- YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
- char yy_hold_char;
- yy_size_t yy_n_chars;
- yy_size_t yyleng_r;
- char *yy_c_buf_p;
- int yy_init;
- int yy_start;
- int yy_did_buffer_switch_on_eof;
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int *yy_start_stack;
- yy_state_type yy_last_accepting_state;
- char* yy_last_accepting_cpos;
-
- int yylineno_r;
- int yy_flex_debug_r;
-
- char *yytext_r;
- int yy_more_flag;
- int yy_more_len;
-
- YYSTYPE * yylval_r;
-
-}; /* end struct yyguts_t */
+struct yyguts_t
+ {
+
+ /* User-defined. Not touched by flex. */
+ YY_EXTRA_TYPE yyextra_r;
+
+ /* The rest are the same as the globals declared in the non-reentrant scanner. */
+ FILE *yyin_r, *yyout_r;
+ size_t yy_buffer_stack_top; /**< index of top of stack. */
+ size_t yy_buffer_stack_max; /**< capacity of stack. */
+ YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
+ char yy_hold_char;
+ yy_size_t yy_n_chars;
+ yy_size_t yyleng_r;
+ char *yy_c_buf_p;
+ int yy_init;
+ int yy_start;
+ int yy_did_buffer_switch_on_eof;
+ int yy_start_stack_ptr;
+ int yy_start_stack_depth;
+ int *yy_start_stack;
+ yy_state_type yy_last_accepting_state;
+ char* yy_last_accepting_cpos;
+
+ int yylineno_r;
+ int yy_flex_debug_r;
+
+ char *yytext_r;
+ int yy_more_flag;
+ int yy_more_len;
+
+ YYSTYPE * yylval_r;
+
+ }; /* end struct yyguts_t */
/* %if-c-only */
@@ -686,10 +687,10 @@ static int yy_init_globals (yyscan_t yyscanner );
/* %if-reentrant */
-/* This must go here because YYSTYPE and YYLTYPE are included
- * from bison output in section 1.*/
-# define yylval yyg->yylval_r
-
+ /* This must go here because YYSTYPE and YYLTYPE are included
+ * from bison output in section 1.*/
+ # define yylval yyg->yylval_r
+
int promela_lex_init (yyscan_t* scanner);
int promela_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
@@ -749,8 +750,8 @@ extern int promela_wrap (yyscan_t yyscanner );
/* %not-for-header */
-static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
-
+ static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
+
/* %ok-for-header */
/* %endif */
@@ -880,7 +881,7 @@ 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 ,yyscan_t yyscanner);
#define YY_DECL int promela_lex \
(YYSTYPE * yylval_param , yyscan_t yyscanner)
@@ -909,21 +910,23 @@ extern int promela_lex \
/** The main scanner function which does all the work.
*/
-YY_DECL {
+YY_DECL
+{
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- /* %% [7.0] user's declarations go here */
+/* %% [7.0] user's declarations go here */
#line 25 "promela.l"
-#line 927 "promela.lex.yy.cpp"
+#line 925 "promela.lex.yy.cpp"
- yylval = yylval_param;
+ yylval = yylval_param;
- if ( !yyg->yy_init ) {
+ if ( !yyg->yy_init )
+ {
yyg->yy_init = 1;
#ifdef YY_USER_INIT
@@ -934,30 +937,31 @@ YY_DECL {
yyg->yy_start = 1; /* first start state */
if ( ! yyin )
- /* %if-c-only */
+/* %if-c-only */
yyin = stdin;
- /* %endif */
- /* %if-c++-only */
- /* %endif */
+/* %endif */
+/* %if-c++-only */
+/* %endif */
if ( ! yyout )
- /* %if-c-only */
+/* %if-c-only */
yyout = stdout;
- /* %endif */
- /* %if-c++-only */
- /* %endif */
+/* %endif */
+/* %if-c++-only */
+/* %endif */
if ( ! YY_CURRENT_BUFFER ) {
promela_ensure_buffer_stack (yyscanner);
YY_CURRENT_BUFFER_LVALUE =
- promela__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+ promela__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
}
promela__load_buffer_state(yyscanner );
- }
+ }
- while ( 1 ) { /* loops until end-of-file is reached */
- /* %% [8.0] yymore()-related code goes here */
+ while ( 1 ) /* loops until end-of-file is reached */
+ {
+/* %% [8.0] yymore()-related code goes here */
yy_cp = yyg->yy_c_buf_p;
/* Support of yytext. */
@@ -968,433 +972,440 @@ YY_DECL {
*/
yy_bp = yy_cp;
- /* %% [9.0] code to set up and find next match goes here */
+/* %% [9.0] code to set up and find next match goes here */
yy_current_state = yyg->yy_start;
yy_match:
- do {
+ do
+ {
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
- if ( yy_accept[yy_current_state] ) {
+ if ( yy_accept[yy_current_state] )
+ {
yyg->yy_last_accepting_state = yy_current_state;
yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) {
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 125 )
+ if ( yy_current_state >= 124 )
yy_c = yy_meta[(unsigned int) yy_c];
- }
+ }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
++yy_cp;
- } while ( yy_current_state != 124 );
+ }
+ while ( yy_current_state != 123 );
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
yy_find_action:
- /* %% [10.0] code to find the action number goes here */
+/* %% [10.0] code to find the action number goes here */
yy_act = yy_accept[yy_current_state];
YY_DO_BEFORE_ACTION;
- /* %% [11.0] code for yylineno update goes here */
+/* %% [11.0] code for yylineno update goes here */
do_action: /* This label is used only to access EOF actions. */
- /* %% [12.0] debug code goes here */
- if ( yy_flex_debug ) {
+/* %% [12.0] debug code goes here */
+ if ( yy_flex_debug )
+ {
if ( yy_act == 0 )
fprintf( stderr, "--scanner backing up\n" );
- else if ( yy_act < 47 )
+ else if ( yy_act < 46 )
fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n",
(long)yy_rule_linenum[yy_act], yytext );
- else if ( yy_act == 47 )
+ else if ( yy_act == 46 )
fprintf( stderr, "--accepting default rule (\"%s\")\n",
yytext );
- else if ( yy_act == 48 )
+ else if ( yy_act == 47 )
fprintf( stderr, "--(end of buffer or a NUL)\n" );
else
fprintf( stderr, "--EOF (start condition %d)\n", YY_START );
- }
+ }
- switch ( yy_act ) {
- /* beginning of action switch */
- /* %% [13.0] actions go here */
- case 0: /* must back up */
+ switch ( yy_act )
+ { /* beginning of action switch */
+/* %% [13.0] actions go here */
+ case 0: /* must back up */
/* undo the effects of YY_DO_BEFORE_ACTION */
*yy_cp = yyg->yy_hold_char;
yy_cp = yyg->yy_last_accepting_cpos;
yy_current_state = yyg->yy_last_accepting_state;
goto yy_find_action;
- case 1:
- /* rule 1 can match eol */
- YY_RULE_SETUP
+case 1:
+/* rule 1 can match eol */
+YY_RULE_SETUP
#line 27 "promela.l"
- /* multiline comments */
- YY_BREAK
- case 2:
- YY_RULE_SETUP
+/* multiline comments */
+ YY_BREAK
+case 2:
+YY_RULE_SETUP
#line 29 "promela.l"
+{
+ yylval->value = strdup(yytext);
+ return PML_TYPE;
+}
+ YY_BREAK
+case 3:
+YY_RULE_SETUP
+#line 34 "promela.l"
+{ return PML_LEN; }
+ YY_BREAK
+case 4:
+YY_RULE_SETUP
+#line 35 "promela.l"
+{ yylval->value = strdup(yytext); return PML_CONST; }
+ YY_BREAK
+case 5:
+YY_RULE_SETUP
+#line 36 "promela.l"
+{ return PML_PRINT; }
+ YY_BREAK
+case 6:
+YY_RULE_SETUP
+#line 37 "promela.l"
+{ return PML_TYPEDEF; }
+ YY_BREAK
+case 7:
+YY_RULE_SETUP
+#line 38 "promela.l"
+{ return PML_ASSERT; }
+ YY_BREAK
+case 8:
+YY_RULE_SETUP
+#line 40 "promela.l"
+{ return PML_NEG; }
+ YY_BREAK
+case 9:
+YY_RULE_SETUP
+#line 41 "promela.l"
+{ return PML_COMPL; }
+ YY_BREAK
+case 10:
+YY_RULE_SETUP
+#line 42 "promela.l"
+{ return PML_INCR; }
+ YY_BREAK
+case 11:
+YY_RULE_SETUP
+#line 43 "promela.l"
+{ return PML_DECR; }
+ YY_BREAK
+case 12:
+YY_RULE_SETUP
+#line 45 "promela.l"
+{ return PML_TIMES; }
+ YY_BREAK
+case 13:
+YY_RULE_SETUP
+#line 46 "promela.l"
+{ return PML_DIVIDE; }
+ YY_BREAK
+case 14:
+YY_RULE_SETUP
+#line 47 "promela.l"
+{ return PML_MODULO; }
+ YY_BREAK
+case 15:
+YY_RULE_SETUP
+#line 49 "promela.l"
+{ return PML_PLUS; }
+ YY_BREAK
+case 16:
+YY_RULE_SETUP
+#line 50 "promela.l"
+{ return PML_MINUS; }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 52 "promela.l"
+{ return PML_LSHIFT; }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 53 "promela.l"
+{ return PML_RSHIFT; }
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
+#line 55 "promela.l"
+{ return PML_LE; }
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 56 "promela.l"
+{ return PML_GE; }
+ YY_BREAK
+case 21:
+YY_RULE_SETUP
+#line 57 "promela.l"
+{ return PML_LT; }
+ YY_BREAK
+case 22:
+YY_RULE_SETUP
+#line 58 "promela.l"
+{ return PML_GT; }
+ YY_BREAK
+case 23:
+YY_RULE_SETUP
+#line 60 "promela.l"
+{ return PML_NE; }
+ YY_BREAK
+case 24:
+YY_RULE_SETUP
+#line 61 "promela.l"
+{ return PML_EQ; }
+ YY_BREAK
+case 25:
+YY_RULE_SETUP
+#line 63 "promela.l"
+{ return PML_BITAND; }
+ YY_BREAK
+case 26:
+YY_RULE_SETUP
+#line 64 "promela.l"
+{ return PML_BITXOR; }
+ YY_BREAK
+case 27:
+YY_RULE_SETUP
+#line 65 "promela.l"
+{ return PML_BITOR; }
+ YY_BREAK
+case 28:
+YY_RULE_SETUP
+#line 68 "promela.l"
+{ return PML_AND; }
+ YY_BREAK
+case 29:
+YY_RULE_SETUP
+#line 69 "promela.l"
+{ return PML_OR; }
+ YY_BREAK
+case 30:
+YY_RULE_SETUP
+#line 71 "promela.l"
+{ return PML_DOT; }
+ YY_BREAK
+case 31:
+YY_RULE_SETUP
+#line 72 "promela.l"
+{ return PML_COMMA; }
+ YY_BREAK
+case 32:
+YY_RULE_SETUP
+#line 73 "promela.l"
+{ return PML_SEMI; }
+ YY_BREAK
+case 33:
+YY_RULE_SETUP
+#line 75 "promela.l"
+{ return '('; }
+ YY_BREAK
+case 34:
+YY_RULE_SETUP
+#line 76 "promela.l"
+{ return ')'; }
+ YY_BREAK
+case 35:
+YY_RULE_SETUP
+#line 78 "promela.l"
+{ return '['; }
+ YY_BREAK
+case 36:
+YY_RULE_SETUP
+#line 79 "promela.l"
+{ return ']'; }
+ YY_BREAK
+case 37:
+YY_RULE_SETUP
+#line 81 "promela.l"
+{ return '{'; }
+ YY_BREAK
+case 38:
+YY_RULE_SETUP
+#line 82 "promela.l"
+{ return '}'; }
+ YY_BREAK
+case 39:
+YY_RULE_SETUP
+#line 84 "promela.l"
+{ return PML_ASGN; }
+ YY_BREAK
+case 40:
+/* rule 40 can match eol */
+YY_RULE_SETUP
+#line 86 "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"
+{
+ /* Non PROMELA extension for single quoted string literals */
+ yylval->value = strdup(yytext); return(PML_STRING);
+}
+ YY_BREAK
+case 42:
+YY_RULE_SETUP
+#line 94 "promela.l"
+{ yylval->value = strdup(yytext); return PML_CONST; }
+ YY_BREAK
+case 43:
+YY_RULE_SETUP
+#line 95 "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"
+/* eat up whitespace */
+ YY_BREAK
+case 45:
+YY_RULE_SETUP
+#line 100 "promela.l"
+{ /*printf( "Unrecognized character: %s\n", yytext ); */ }
+ YY_BREAK
+case 46:
+YY_RULE_SETUP
+#line 101 "promela.l"
+ECHO;
+ YY_BREAK
+#line 1277 "promela.lex.yy.cpp"
+case YY_STATE_EOF(INITIAL):
+ yyterminate();
+
+ case YY_END_OF_BUFFER:
+ {
+ /* Amount of text matched not including the EOB char. */
+ int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
+
+ /* Undo the effects of YY_DO_BEFORE_ACTION. */
+ *yy_cp = yyg->yy_hold_char;
+ YY_RESTORE_YY_MORE_OFFSET
+
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
{
- yylval->value = strdup(yytext);
- return PML_TYPE;
- }
- YY_BREAK
- case 3:
- YY_RULE_SETUP
-#line 34 "promela.l"
- { return PML_LEN; }
- YY_BREAK
- case 4:
- YY_RULE_SETUP
-#line 35 "promela.l"
- { yylval->value = strdup(yytext); return PML_CONST; }
- YY_BREAK
- case 5:
- YY_RULE_SETUP
-#line 36 "promela.l"
- { return PML_PRINT; }
- YY_BREAK
- case 6:
- YY_RULE_SETUP
-#line 37 "promela.l"
- { return PML_PRINTM; }
- YY_BREAK
- case 7:
- YY_RULE_SETUP
-#line 38 "promela.l"
- { return PML_TYPEDEF; }
- YY_BREAK
- case 8:
- YY_RULE_SETUP
-#line 39 "promela.l"
- { return PML_ASSERT; }
- YY_BREAK
- case 9:
- YY_RULE_SETUP
-#line 41 "promela.l"
- { return PML_NEG; }
- YY_BREAK
- case 10:
- YY_RULE_SETUP
-#line 42 "promela.l"
- { return PML_COMPL; }
- YY_BREAK
- case 11:
- YY_RULE_SETUP
-#line 43 "promela.l"
- { return PML_INCR; }
- YY_BREAK
- case 12:
- YY_RULE_SETUP
-#line 44 "promela.l"
- { return PML_DECR; }
- YY_BREAK
- case 13:
- YY_RULE_SETUP
-#line 46 "promela.l"
- { return PML_TIMES; }
- YY_BREAK
- case 14:
- YY_RULE_SETUP
-#line 47 "promela.l"
- { return PML_DIVIDE; }
- YY_BREAK
- case 15:
- YY_RULE_SETUP
-#line 48 "promela.l"
- { return PML_MODULO; }
- YY_BREAK
- case 16:
- YY_RULE_SETUP
-#line 50 "promela.l"
- { return PML_PLUS; }
- YY_BREAK
- case 17:
- YY_RULE_SETUP
-#line 51 "promela.l"
- { return PML_MINUS; }
- YY_BREAK
- case 18:
- YY_RULE_SETUP
-#line 53 "promela.l"
- { return PML_LSHIFT; }
- YY_BREAK
- case 19:
- YY_RULE_SETUP
-#line 54 "promela.l"
- { return PML_RSHIFT; }
- YY_BREAK
- case 20:
- YY_RULE_SETUP
-#line 56 "promela.l"
- { return PML_LE; }
- YY_BREAK
- case 21:
- YY_RULE_SETUP
-#line 57 "promela.l"
- { return PML_GE; }
- YY_BREAK
- case 22:
- YY_RULE_SETUP
-#line 58 "promela.l"
- { return PML_LT; }
- YY_BREAK
- case 23:
- YY_RULE_SETUP
-#line 59 "promela.l"
- { return PML_GT; }
- YY_BREAK
- case 24:
- YY_RULE_SETUP
-#line 61 "promela.l"
- { return PML_NE; }
- YY_BREAK
- case 25:
- YY_RULE_SETUP
-#line 62 "promela.l"
- { return PML_EQ; }
- YY_BREAK
- case 26:
- YY_RULE_SETUP
-#line 64 "promela.l"
- { return PML_BITAND; }
- YY_BREAK
- case 27:
- YY_RULE_SETUP
-#line 65 "promela.l"
- { return PML_BITXOR; }
- YY_BREAK
- case 28:
- YY_RULE_SETUP
-#line 66 "promela.l"
- { return PML_BITOR; }
- YY_BREAK
- case 29:
- YY_RULE_SETUP
-#line 69 "promela.l"
- { return PML_AND; }
- YY_BREAK
- case 30:
- YY_RULE_SETUP
-#line 70 "promela.l"
- { return PML_OR; }
- YY_BREAK
- case 31:
- YY_RULE_SETUP
-#line 72 "promela.l"
- { return PML_DOT; }
- YY_BREAK
- case 32:
- YY_RULE_SETUP
-#line 73 "promela.l"
- { return PML_COMMA; }
- YY_BREAK
- case 33:
- YY_RULE_SETUP
-#line 74 "promela.l"
- { return PML_SEMI; }
- YY_BREAK
- case 34:
- YY_RULE_SETUP
-#line 76 "promela.l"
- { return '('; }
- YY_BREAK
- case 35:
- YY_RULE_SETUP
-#line 77 "promela.l"
- { return ')'; }
- YY_BREAK
- case 36:
- YY_RULE_SETUP
-#line 79 "promela.l"
- { return '['; }
- YY_BREAK
- case 37:
- YY_RULE_SETUP
-#line 80 "promela.l"
- { return ']'; }
- YY_BREAK
- case 38:
- YY_RULE_SETUP
-#line 82 "promela.l"
- { return '{'; }
- YY_BREAK
- case 39:
- YY_RULE_SETUP
-#line 83 "promela.l"
- { return '}'; }
- YY_BREAK
- case 40:
- YY_RULE_SETUP
-#line 85 "promela.l"
- { return PML_ASGN; }
- YY_BREAK
- case 41:
- /* rule 41 can match eol */
- YY_RULE_SETUP
-#line 87 "promela.l"
- { yylval->value = strdup(yytext); return(PML_STRING); }
- YY_BREAK
- case 42:
- /* rule 42 can match eol */
- YY_RULE_SETUP
-#line 90 "promela.l"
- {
- /* Non PROMELA extension for single quoted string literals */
- yylval->value = strdup(yytext);
- return(PML_STRING);
- }
- YY_BREAK
- case 43:
- YY_RULE_SETUP
-#line 95 "promela.l"
- { yylval->value = strdup(yytext); return PML_CONST; }
- YY_BREAK
- case 44:
- YY_RULE_SETUP
-#line 96 "promela.l"
- { yylval->value = strdup(yytext); return PML_NAME; }
- YY_BREAK
- case 45:
- /* rule 45 can match eol */
- YY_RULE_SETUP
-#line 98 "promela.l"
- /* eat up whitespace */
- YY_BREAK
- case 46:
- YY_RULE_SETUP
-#line 101 "promela.l"
- { /*printf( "Unrecognized character: %s\n", yytext ); */ }
- YY_BREAK
- case 47:
- YY_RULE_SETUP
-#line 102 "promela.l"
- ECHO;
- YY_BREAK
-#line 1284 "promela.lex.yy.cpp"
- case YY_STATE_EOF(INITIAL):
- yyterminate();
-
- case YY_END_OF_BUFFER: {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yyg->yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * promela_lex(). If so, then we have to assure
- * consistency between YY_CURRENT_BUFFER and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ /* We're scanning a new file or input source. It's
+ * possible that this happened because the user
+ * just pointed yyin at a new source and called
+ * promela_lex(). If so, then we have to assure
+ * consistency between YY_CURRENT_BUFFER and our
+ * globals. Here is the right place to do so, because
+ * this is the first action (other than possibly a
+ * back-up) that will match for the new input source.
+ */
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
+ YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
+ YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
}
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) {
- /* This was really a NUL. */
- yy_state_type yy_next_state;
+ /* Note that here we test for yy_c_buf_p "<=" to the position
+ * of the first EOB in the buffer, since yy_c_buf_p will
+ * already have been incremented past the NUL character
+ * (since all states make transitions on EOB to the
+ * end-of-buffer state). Contrast this with the test
+ * in input().
+ */
+ if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
+ { /* This was really a NUL. */
+ yy_state_type yy_next_state;
- yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
+ yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
- yy_current_state = yy_get_previous_state( yyscanner );
+ yy_current_state = yy_get_previous_state( yyscanner );
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
+ /* Okay, we're now positioned to make the NUL
+ * transition. We couldn't have
+ * yy_get_previous_state() go ahead and do it
+ * for us because it doesn't know how to deal
+ * with the possibility of jamming (and we don't
+ * want to build jamming into it because then it
+ * will run more slowly).
+ */
- yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
+ yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- if ( yy_next_state ) {
- /* Consume the NUL. */
- yy_cp = ++yyg->yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
+ if ( yy_next_state )
+ {
+ /* Consume the NUL. */
+ yy_cp = ++yyg->yy_c_buf_p;
+ yy_current_state = yy_next_state;
+ goto yy_match;
}
- else {
- /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
+ else
+ {
+/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
+ yy_cp = yyg->yy_last_accepting_cpos;
+ yy_current_state = yyg->yy_last_accepting_state;
+ goto yy_find_action;
}
}
- else switch ( yy_get_next_buffer( yyscanner ) ) {
- case EOB_ACT_END_OF_FILE: {
- yyg->yy_did_buffer_switch_on_eof = 0;
-
- if ( promela_wrap(yyscanner ) ) {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
+ else switch ( yy_get_next_buffer( yyscanner ) )
+ {
+ case EOB_ACT_END_OF_FILE:
+ {
+ yyg->yy_did_buffer_switch_on_eof = 0;
+
+ if ( promela_wrap(yyscanner ) )
+ {
+ /* Note: because we've taken care in
+ * yy_get_next_buffer() to have set up
+ * yytext, we can now set up
+ * yy_c_buf_p so that if some total
+ * hoser (like flex itself) wants to
+ * call the scanner after we return the
+ * YY_NULL, it'll still work - another
+ * YY_NULL will get returned.
+ */
+ yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
+
+ yy_act = YY_STATE_EOF(YY_START);
+ goto do_action;
}
- else {
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
+ else
+ {
+ if ( ! yyg->yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
}
- break;
+ break;
}
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p =
- yyg->yytext_ptr + yy_amount_of_matched_text;
+ case EOB_ACT_CONTINUE_SCAN:
+ yyg->yy_c_buf_p =
+ yyg->yytext_ptr + yy_amount_of_matched_text;
- yy_current_state = yy_get_previous_state( yyscanner );
+ yy_current_state = yy_get_previous_state( yyscanner );
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
+ yy_cp = yyg->yy_c_buf_p;
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+ goto yy_match;
- case EOB_ACT_LAST_MATCH:
- yyg->yy_c_buf_p =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
+ case EOB_ACT_LAST_MATCH:
+ yyg->yy_c_buf_p =
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
- yy_current_state = yy_get_previous_state( yyscanner );
+ yy_current_state = yy_get_previous_state( yyscanner );
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
+ yy_cp = yyg->yy_c_buf_p;
+ yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
+ goto yy_find_action;
+ }
+ break;
}
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
+ default:
+ YY_FATAL_ERROR(
+ "fatal flex scanner internal error--no action found" );
+ } /* end of action switch */
+ } /* end of scanning one token */
} /* end of promela_lex */
/* %ok-for-header */
@@ -1418,7 +1429,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
/* %if-c++-only */
/* %endif */
{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
register char *source = yyg->yytext_ptr;
register int number_to_move, i;
@@ -1426,24 +1437,26 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
+ "fatal flex scanner internal error--end of buffer missed" );
- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) {
- /* Don't try to fill the buffer, so this is an EOF. */
- if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) {
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ { /* Don't try to fill the buffer, so this is an EOF. */
+ if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
+ {
/* We matched a single character, the EOB, so
* treat this as a final EOF.
*/
return EOB_ACT_END_OF_FILE;
- }
+ }
- else {
+ else
+ {
/* We matched some text prior to the EOB, first
* process it.
*/
return EOB_ACT_LAST_MATCH;
+ }
}
- }
/* Try to read more data. */
@@ -1459,20 +1472,22 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
*/
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
- else {
- yy_size_t num_to_read =
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+ else
+ {
+ yy_size_t num_to_read =
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
- while ( num_to_read <= 0 ) {
- /* Not enough room in the buffer - grow it. */
+ while ( num_to_read <= 0 )
+ { /* Not enough room in the buffer - grow it. */
/* just a shorter name for the current buffer */
YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
int yy_c_buf_p_offset =
- (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
+ (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
- if ( b->yy_is_our_buffer ) {
+ if ( b->yy_is_our_buffer )
+ {
yy_size_t new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
@@ -1481,45 +1496,49 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
b->yy_buf_size *= 2;
b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- promela_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
- } else
+ /* Include room in for 2 EOB chars. */
+ promela_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner );
+ }
+ else
/* Can't grow it, we don't own it. */
b->yy_ch_buf = 0;
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
+ "fatal error - scanner input buffer overflow" );
yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
- number_to_move - 1;
+ number_to_move - 1;
- }
+ }
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, num_to_read );
+ yyg->yy_n_chars, num_to_read );
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
+ }
- if ( yyg->yy_n_chars == 0 ) {
- if ( number_to_move == YY_MORE_ADJ ) {
+ if ( yyg->yy_n_chars == 0 )
+ {
+ if ( number_to_move == YY_MORE_ADJ )
+ {
ret_val = EOB_ACT_END_OF_FILE;
promela_restart(yyin ,yyscanner);
- }
+ }
- else {
+ else
+ {
ret_val = EOB_ACT_LAST_MATCH;
YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
+ YY_BUFFER_EOF_PENDING;
+ }
}
- }
else
ret_val = EOB_ACT_CONTINUE_SCAN;
@@ -1546,32 +1565,35 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
/* %if-c-only */
/* %not-for-header */
-static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
+ static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
/* %endif */
/* %if-c++-only */
/* %endif */
{
register yy_state_type yy_current_state;
register char *yy_cp;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- /* %% [15.0] code to get the start state into yy_current_state goes here */
+/* %% [15.0] code to get the start state into yy_current_state goes here */
yy_current_state = yyg->yy_start;
- for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) {
- /* %% [16.0] code to find the next state goes here */
+ for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
+ {
+/* %% [16.0] code to find the next state goes here */
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] ) {
+ if ( yy_accept[yy_current_state] )
+ {
yyg->yy_last_accepting_state = yy_current_state;
yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) {
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 125 )
+ if ( yy_current_state >= 124 )
yy_c = yy_meta[(unsigned int) yy_c];
- }
+ }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- }
+ }
return yy_current_state;
}
@@ -1582,55 +1604,57 @@ static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
* next_state = yy_try_NUL_trans( current_state );
*/
/* %if-c-only */
-static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
+ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
/* %endif */
/* %if-c++-only */
/* %endif */
{
register int yy_is_jam;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
- /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
+/* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
register char *yy_cp = yyg->yy_c_buf_p;
register YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] ) {
+ if ( yy_accept[yy_current_state] )
+ {
yyg->yy_last_accepting_state = yy_current_state;
yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) {
+ }
+ while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
+ {
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 125 )
+ if ( yy_current_state >= 124 )
yy_c = yy_meta[(unsigned int) yy_c];
- }
+ }
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 124);
+ yy_is_jam = (yy_current_state == 123);
return yy_is_jam ? 0 : yy_current_state;
}
/* %if-c-only */
-static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
+ static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
/* %endif */
/* %if-c++-only */
/* %endif */
{
register char *yy_cp;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yy_cp = yyg->yy_c_buf_p;
+ yy_cp = yyg->yy_c_buf_p;
/* undo effects of setting up yytext */
*yy_cp = yyg->yy_hold_char;
- if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) {
- /* need to shift things up to make room */
+ if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ { /* need to shift things up to make room */
/* +2 for EOB chars. */
register yy_size_t number_to_move = yyg->yy_n_chars + 2;
register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
register char *source =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+ &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
*--dest = *--source;
@@ -1638,15 +1662,15 @@ static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
yy_cp += (int) (dest - source);
yy_bp += (int) (dest - source);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+ yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
+ }
*--yy_cp = (char) c;
- /* %% [18.0] update yylineno here */
+/* %% [18.0] update yylineno here */
yyg->yytext_ptr = yy_bp;
yyg->yy_hold_char = *yy_cp;
@@ -1659,9 +1683,9 @@ static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
/* %if-c-only */
#ifndef YY_NO_INPUT
#ifdef __cplusplus
-static int yyinput (yyscan_t yyscanner)
+ static int yyinput (yyscan_t yyscanner)
#else
-static int input (yyscan_t yyscanner)
+ static int input (yyscan_t yyscanner)
#endif
/* %endif */
@@ -1669,11 +1693,12 @@ static int input (yyscan_t yyscanner)
/* %endif */
{
int c;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
*yyg->yy_c_buf_p = yyg->yy_hold_char;
- if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) {
+ if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+ {
/* yy_c_buf_p now points to the character we want to return.
* If this occurs *before* the EOB characters, then it's a
* valid NUL; if not, then we've hit the end of the buffer.
@@ -1682,53 +1707,55 @@ static int input (yyscan_t yyscanner)
/* This was really a NUL. */
*yyg->yy_c_buf_p = '\0';
- else {
- /* need more input */
+ else
+ { /* need more input */
yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
++yyg->yy_c_buf_p;
- switch ( yy_get_next_buffer( yyscanner ) ) {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- promela_restart(yyin ,yyscanner);
-
- /*FALLTHROUGH*/
-
- case EOB_ACT_END_OF_FILE: {
- if ( promela_wrap(yyscanner ) )
- return 0;
-
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
+ switch ( yy_get_next_buffer( yyscanner ) )
+ {
+ case EOB_ACT_LAST_MATCH:
+ /* This happens because yy_g_n_b()
+ * sees that we've accumulated a
+ * token and flags that we need to
+ * try matching the token before
+ * proceeding. But for input(),
+ * there's no matching to consider.
+ * So convert the EOB_ACT_LAST_MATCH
+ * to EOB_ACT_END_OF_FILE.
+ */
+
+ /* Reset buffer status. */
+ promela_restart(yyin ,yyscanner);
+
+ /*FALLTHROUGH*/
+
+ case EOB_ACT_END_OF_FILE:
+ {
+ if ( promela_wrap(yyscanner ) )
+ return 0;
+
+ if ( ! yyg->yy_did_buffer_switch_on_eof )
+ YY_NEW_FILE;
#ifdef __cplusplus
- return yyinput(yyscanner);
+ return yyinput(yyscanner);
#else
- return input(yyscanner);
+ return input(yyscanner);
#endif
- }
+ }
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
- break;
+ case EOB_ACT_CONTINUE_SCAN:
+ yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
+ break;
+ }
}
}
- }
c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
*yyg->yy_c_buf_p = '\0'; /* preserve yytext */
yyg->yy_hold_char = *++yyg->yy_c_buf_p;
- /* %% [19.0] update BOL and yylineno */
+/* %% [19.0] update BOL and yylineno */
return c;
}
@@ -1742,17 +1769,17 @@ static int input (yyscan_t yyscanner)
* @note This function does not reset the start condition to @c INITIAL .
*/
/* %if-c-only */
-void promela_restart (FILE * input_file , yyscan_t yyscanner)
+ void promela_restart (FILE * input_file , yyscan_t yyscanner)
/* %endif */
/* %if-c++-only */
/* %endif */
{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if ( ! YY_CURRENT_BUFFER ) {
- promela_ensure_buffer_stack (yyscanner);
+ if ( ! YY_CURRENT_BUFFER ){
+ promela_ensure_buffer_stack (yyscanner);
YY_CURRENT_BUFFER_LVALUE =
- promela__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
+ promela__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
}
promela__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
@@ -1764,28 +1791,29 @@ void promela_restart (FILE * input_file , yyscan_t yyscanner)
* @param yyscanner The scanner object.
*/
/* %if-c-only */
-void promela__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
+ void promela__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
/* %endif */
/* %if-c++-only */
/* %endif */
{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
/* TODO. We should be able to replace this entire function body
* with
* promela_pop_buffer_state();
* promela_push_buffer_state(new_buffer);
- */
+ */
promela_ensure_buffer_stack (yyscanner);
if ( YY_CURRENT_BUFFER == new_buffer )
return;
- if ( YY_CURRENT_BUFFER ) {
+ if ( YY_CURRENT_BUFFER )
+ {
/* Flush out information for old buffer. */
*yyg->yy_c_buf_p = yyg->yy_hold_char;
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
+ }
YY_CURRENT_BUFFER_LVALUE = new_buffer;
promela__load_buffer_state(yyscanner );
@@ -1804,7 +1832,7 @@ static void promela__load_buffer_state (yyscan_t yyscanner)
/* %if-c++-only */
/* %endif */
{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
@@ -1818,13 +1846,13 @@ static void promela__load_buffer_state (yyscan_t yyscanner)
* @return the allocated buffer state.
*/
/* %if-c-only */
-YY_BUFFER_STATE promela__create_buffer (FILE * file, int size , yyscan_t yyscanner)
+ YY_BUFFER_STATE promela__create_buffer (FILE * file, int size , yyscan_t yyscanner)
/* %endif */
/* %if-c++-only */
/* %endif */
{
YY_BUFFER_STATE b;
-
+
b = (YY_BUFFER_STATE) promela_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in promela__create_buffer()" );
@@ -1850,12 +1878,12 @@ YY_BUFFER_STATE promela__create_buffer (FILE * file, int size , yyscan_t yysca
* @param yyscanner The scanner object.
*/
/* %if-c-only */
-void promela__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
+ void promela__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
/* %endif */
/* %if-c++-only */
/* %endif */
{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if ( ! b )
return;
@@ -1881,36 +1909,36 @@ void promela__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
* such as during a promela_restart() or at EOF.
*/
/* %if-c-only */
-static void promela__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
+ static void promela__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
/* %endif */
/* %if-c++-only */
/* %endif */
{
int oerrno = errno;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
promela__flush_buffer(b ,yyscanner);
b->yy_input_file = file;
b->yy_fill_buffer = 1;
- /* If b is the current buffer, then promela__init_buffer was _probably_
- * called from promela_restart() or through yy_get_next_buffer.
- * In that case, we don't want to reset the lineno or column.
- */
- if (b != YY_CURRENT_BUFFER) {
- b->yy_bs_lineno = 1;
- b->yy_bs_column = 0;
- }
-
- /* %if-c-only */
+ /* If b is the current buffer, then promela__init_buffer was _probably_
+ * called from promela_restart() or through yy_get_next_buffer.
+ * In that case, we don't want to reset the lineno or column.
+ */
+ if (b != YY_CURRENT_BUFFER){
+ b->yy_bs_lineno = 1;
+ b->yy_bs_column = 0;
+ }
- b->yy_is_interactive = 0;
+/* %if-c-only */
- /* %endif */
- /* %if-c++-only */
- /* %endif */
+ b->yy_is_interactive = 0;
+
+/* %endif */
+/* %if-c++-only */
+/* %endif */
errno = oerrno;
}
@@ -1919,12 +1947,12 @@ static void promela__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yy
* @param yyscanner The scanner object.
*/
/* %if-c-only */
-void promela__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
+ void promela__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
/* %endif */
/* %if-c++-only */
/* %endif */
{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if ( ! b )
return;
@@ -1959,19 +1987,20 @@ void promela_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
/* %if-c++-only */
/* %endif */
{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (new_buffer == NULL)
return;
promela_ensure_buffer_stack(yyscanner);
/* This block is copied from promela__switch_to_buffer. */
- if ( YY_CURRENT_BUFFER ) {
+ if ( YY_CURRENT_BUFFER )
+ {
/* Flush out information for old buffer. */
*yyg->yy_c_buf_p = yyg->yy_hold_char;
YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
+ }
/* Only push if top exists. Otherwise, replace top. */
if (YY_CURRENT_BUFFER)
@@ -1995,7 +2024,7 @@ void promela_pop_buffer_state (yyscan_t yyscanner)
/* %if-c++-only */
/* %endif */
{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (!YY_CURRENT_BUFFER)
return;
@@ -2022,38 +2051,38 @@ static void promela_ensure_buffer_stack (yyscan_t yyscanner)
/* %endif */
{
yy_size_t num_to_alloc;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
if (!yyg->yy_buffer_stack) {
/* First allocation is just for 2 elements, since we don't know if this
* scanner will even need a stack. We use 2 instead of 1 to avoid an
* immediate realloc on the next call.
- */
+ */
num_to_alloc = 1;
yyg->yy_buffer_stack = (struct yy_buffer_state**)promela_alloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
+ (num_to_alloc * sizeof(struct yy_buffer_state*)
+ , yyscanner);
if ( ! yyg->yy_buffer_stack )
YY_FATAL_ERROR( "out of dynamic memory in promela_ensure_buffer_stack()" );
-
+
memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
+
yyg->yy_buffer_stack_max = num_to_alloc;
yyg->yy_buffer_stack_top = 0;
return;
}
- if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1) {
+ if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
/* Increase the buffer to prepare for a possible push. */
int grow_size = 8 /* arbitrary grow size */;
num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
yyg->yy_buffer_stack = (struct yy_buffer_state**)promela_realloc
- (yyg->yy_buffer_stack,
- num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
+ (yyg->yy_buffer_stack,
+ num_to_alloc * sizeof(struct yy_buffer_state*)
+ , yyscanner);
if ( ! yyg->yy_buffer_stack )
YY_FATAL_ERROR( "out of dynamic memory in promela_ensure_buffer_stack()" );
@@ -2069,14 +2098,15 @@ static void promela_ensure_buffer_stack (yyscan_t yyscanner)
* @param base the character buffer
* @param size the size in bytes of the character buffer
* @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
+ * @return the newly allocated buffer state object.
*/
-YY_BUFFER_STATE promela__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner) {
+YY_BUFFER_STATE promela__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
+{
YY_BUFFER_STATE b;
-
+
if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
+ base[size-2] != YY_END_OF_BUFFER_CHAR ||
+ base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
return 0;
@@ -2109,8 +2139,9 @@ YY_BUFFER_STATE promela__scan_buffer (char * base, yy_size_t size , yyscan_t y
* @note If you want to scan bytes that may contain NUL values, then use
* promela__scan_bytes() instead.
*/
-YY_BUFFER_STATE promela__scan_string (yyconst char * yystr , yyscan_t yyscanner) {
-
+YY_BUFFER_STATE promela__scan_string (yyconst char * yystr , yyscan_t yyscanner)
+{
+
return promela__scan_bytes(yystr,strlen(yystr) ,yyscanner);
}
/* %endif */
@@ -2123,11 +2154,12 @@ YY_BUFFER_STATE promela__scan_string (yyconst char * yystr , yyscan_t yyscanner)
* @param yyscanner The scanner object.
* @return the newly allocated buffer state object.
*/
-YY_BUFFER_STATE promela__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) {
+YY_BUFFER_STATE promela__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner)
+{
YY_BUFFER_STATE b;
char *buf;
yy_size_t n, i;
-
+
/* Get memory for full buffer, including space for trailing EOB's. */
n = _yybytes_len + 2;
buf = (char *) promela_alloc(n ,yyscanner );
@@ -2157,8 +2189,9 @@ YY_BUFFER_STATE promela__scan_bytes (yyconst char * yybytes, yy_size_t _yybyte
#endif
/* %if-c-only */
-static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) {
- (void) fprintf( stderr, "%s\n", msg );
+static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
+{
+ (void) fprintf( stderr, "%s\n", msg );
exit( YY_EXIT_FAILURE );
}
/* %endif */
@@ -2190,9 +2223,10 @@ static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) {
/** Get the user-defined data for this scanner.
* @param yyscanner The scanner object.
*/
-YY_EXTRA_TYPE promela_get_extra (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyextra;
+YY_EXTRA_TYPE promela_get_extra (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyextra;
}
/* %endif */
@@ -2200,58 +2234,64 @@ YY_EXTRA_TYPE promela_get_extra (yyscan_t yyscanner) {
/** Get the current line number.
* @param yyscanner The scanner object.
*/
-int promela_get_lineno (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yylineno;
+int promela_get_lineno (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ if (! YY_CURRENT_BUFFER)
+ return 0;
+
+ return yylineno;
}
/** Get the current column number.
* @param yyscanner The scanner object.
*/
-int promela_get_column (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yycolumn;
+int promela_get_column (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+
+ if (! YY_CURRENT_BUFFER)
+ return 0;
+
+ return yycolumn;
}
/** Get the input stream.
* @param yyscanner The scanner object.
*/
-FILE *promela_get_in (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyin;
+FILE *promela_get_in (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyin;
}
/** Get the output stream.
* @param yyscanner The scanner object.
*/
-FILE *promela_get_out (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyout;
+FILE *promela_get_out (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyout;
}
/** Get the length of the current token.
* @param yyscanner The scanner object.
*/
-yy_size_t promela_get_leng (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyleng;
+yy_size_t promela_get_leng (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yyleng;
}
/** Get the current token.
* @param yyscanner The scanner object.
*/
-char *promela_get_text (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yytext;
+char *promela_get_text (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yytext;
}
/* %if-reentrant */
@@ -2260,9 +2300,10 @@ char *promela_get_text (yyscan_t yyscanner) {
* @param user_defined The data to be associated with this scanner.
* @param yyscanner The scanner object.
*/
-void promela_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyextra = user_defined ;
+void promela_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yyextra = user_defined ;
}
/* %endif */
@@ -2271,28 +2312,30 @@ void promela_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) {
* @param line_number
* @param yyscanner The scanner object.
*/
-void promela_set_lineno (int line_number , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* lineno is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "promela_set_lineno called with no buffer" , yyscanner);
+void promela_set_lineno (int line_number , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yylineno = line_number;
+ /* lineno is only valid if an input buffer exists. */
+ if (! YY_CURRENT_BUFFER )
+ yy_fatal_error( "promela_set_lineno called with no buffer" , yyscanner);
+
+ yylineno = line_number;
}
/** Set the current column.
* @param line_number
* @param yyscanner The scanner object.
*/
-void promela_set_column (int column_no , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* column is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- yy_fatal_error( "promela_set_column called with no buffer" , yyscanner);
+void promela_set_column (int column_no , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yycolumn = column_no;
+ /* column is only valid if an input buffer exists. */
+ if (! YY_CURRENT_BUFFER )
+ yy_fatal_error( "promela_set_column called with no buffer" , yyscanner);
+
+ yycolumn = column_no;
}
/** Set the input stream. This does not discard the current
@@ -2301,24 +2344,28 @@ void promela_set_column (int column_no , yyscan_t yyscanner) {
* @param yyscanner The scanner object.
* @see promela__switch_to_buffer
*/
-void promela_set_in (FILE * in_str , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyin = in_str ;
+void promela_set_in (FILE * in_str , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yyin = in_str ;
}
-void promela_set_out (FILE * out_str , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyout = out_str ;
+void promela_set_out (FILE * out_str , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yyout = out_str ;
}
-int promela_get_debug (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yy_flex_debug;
+int promela_get_debug (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yy_flex_debug;
}
-void promela_set_debug (int bdebug , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yy_flex_debug = bdebug ;
+void promela_set_debug (int bdebug , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yy_flex_debug = bdebug ;
}
/* %endif */
@@ -2328,14 +2375,16 @@ void promela_set_debug (int bdebug , yyscan_t yyscanner) {
/* %if-bison-bridge */
-YYSTYPE * promela_get_lval (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yylval;
+YYSTYPE * promela_get_lval (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ return yylval;
}
-void promela_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yylval = yylval_param;
+void promela_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ yylval = yylval_param;
}
/* %endif */
@@ -2350,22 +2399,22 @@ void promela_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) {
int promela_lex_init(yyscan_t* ptr_yy_globals)
{
- if (ptr_yy_globals == NULL) {
- errno = EINVAL;
- return 1;
- }
+ if (ptr_yy_globals == NULL){
+ errno = EINVAL;
+ return 1;
+ }
- *ptr_yy_globals = (yyscan_t) promela_alloc ( sizeof( struct yyguts_t ), NULL );
+ *ptr_yy_globals = (yyscan_t) promela_alloc ( sizeof( struct yyguts_t ), NULL );
- if (*ptr_yy_globals == NULL) {
- errno = ENOMEM;
- return 1;
- }
+ if (*ptr_yy_globals == NULL){
+ errno = ENOMEM;
+ return 1;
+ }
- /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+ /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
- return yy_init_globals ( *ptr_yy_globals );
+ return yy_init_globals ( *ptr_yy_globals );
}
/* promela_lex_init_extra has the same functionality as promela_lex_init, but follows the
@@ -2379,74 +2428,76 @@ int promela_lex_init(yyscan_t* ptr_yy_globals)
int promela_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
{
- struct yyguts_t dummy_yyguts;
-
- promela_set_extra (yy_user_defined, &dummy_yyguts);
-
- if (ptr_yy_globals == NULL) {
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) promela_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-
- if (*ptr_yy_globals == NULL) {
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in
- yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- promela_set_extra (yy_user_defined, *ptr_yy_globals);
-
- return yy_init_globals ( *ptr_yy_globals );
+ struct yyguts_t dummy_yyguts;
+
+ promela_set_extra (yy_user_defined, &dummy_yyguts);
+
+ if (ptr_yy_globals == NULL){
+ errno = EINVAL;
+ return 1;
+ }
+
+ *ptr_yy_globals = (yyscan_t) promela_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
+
+ if (*ptr_yy_globals == NULL){
+ errno = ENOMEM;
+ return 1;
+ }
+
+ /* By setting to 0xAA, we expose bugs in
+ yy_init_globals. Leave at 0x00 for releases. */
+ memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
+
+ promela_set_extra (yy_user_defined, *ptr_yy_globals);
+
+ return yy_init_globals ( *ptr_yy_globals );
}
/* %endif if-c-only */
/* %if-c-only */
-static int yy_init_globals (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- /* Initialization is the same as for the non-reentrant scanner.
- * This function is called from promela_lex_destroy(), so don't allocate here.
- */
-
- yyg->yy_buffer_stack = 0;
- yyg->yy_buffer_stack_top = 0;
- yyg->yy_buffer_stack_max = 0;
- yyg->yy_c_buf_p = (char *) 0;
- yyg->yy_init = 0;
- yyg->yy_start = 0;
-
- yyg->yy_start_stack_ptr = 0;
- yyg->yy_start_stack_depth = 0;
- yyg->yy_start_stack = NULL;
-
- /* Defined in main.c */
+static int yy_init_globals (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+ /* Initialization is the same as for the non-reentrant scanner.
+ * This function is called from promela_lex_destroy(), so don't allocate here.
+ */
+
+ yyg->yy_buffer_stack = 0;
+ yyg->yy_buffer_stack_top = 0;
+ yyg->yy_buffer_stack_max = 0;
+ yyg->yy_c_buf_p = (char *) 0;
+ yyg->yy_init = 0;
+ yyg->yy_start = 0;
+
+ yyg->yy_start_stack_ptr = 0;
+ yyg->yy_start_stack_depth = 0;
+ yyg->yy_start_stack = NULL;
+
+/* Defined in main.c */
#ifdef YY_STDINIT
- yyin = stdin;
- yyout = stdout;
+ yyin = stdin;
+ yyout = stdout;
#else
- yyin = (FILE *) 0;
- yyout = (FILE *) 0;
+ yyin = (FILE *) 0;
+ yyout = (FILE *) 0;
#endif
- /* For future reference: Set errno on error, since we are called by
- * promela_lex_init()
- */
- return 0;
+ /* For future reference: Set errno on error, since we are called by
+ * promela_lex_init()
+ */
+ return 0;
}
/* %endif */
/* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
/* promela_lex_destroy is for both reentrant and non-reentrant scanners. */
-int promela_lex_destroy (yyscan_t yyscanner) {
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
+int promela_lex_destroy (yyscan_t yyscanner)
+{
+ struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- /* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER) {
+ /* Pop the buffer stack, destroying each element. */
+ while(YY_CURRENT_BUFFER){
promela__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
YY_CURRENT_BUFFER_LVALUE = NULL;
promela_pop_buffer_state(yyscanner);
@@ -2456,20 +2507,20 @@ int promela_lex_destroy (yyscan_t yyscanner) {
promela_free(yyg->yy_buffer_stack ,yyscanner);
yyg->yy_buffer_stack = NULL;
- /* Destroy the start condition stack. */
- promela_free(yyg->yy_start_stack ,yyscanner );
- yyg->yy_start_stack = NULL;
+ /* Destroy the start condition stack. */
+ promela_free(yyg->yy_start_stack ,yyscanner );
+ yyg->yy_start_stack = NULL;
- /* Reset the globals. This is important in a non-reentrant scanner so the next time
- * promela_lex() is called, initialization will occur. */
- yy_init_globals( yyscanner);
+ /* Reset the globals. This is important in a non-reentrant scanner so the next time
+ * promela_lex() is called, initialization will occur. */
+ yy_init_globals( yyscanner);
- /* %if-reentrant */
- /* Destroy the main struct (reentrant only). */
- promela_free ( yyscanner , yyscanner );
- yyscanner = NULL;
- /* %endif */
- return 0;
+/* %if-reentrant */
+ /* Destroy the main struct (reentrant only). */
+ promela_free ( yyscanner , yyscanner );
+ yyscanner = NULL;
+/* %endif */
+ return 0;
}
/* %endif */
@@ -2478,7 +2529,8 @@ int promela_lex_destroy (yyscan_t yyscanner) {
*/
#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) {
+static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
+{
register int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
@@ -2486,7 +2538,8 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca
#endif
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) {
+static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
+{
register int n;
for ( n = 0; s[n]; ++n )
;
@@ -2495,11 +2548,13 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) {
}
#endif
-void *promela_alloc (yy_size_t size , yyscan_t yyscanner) {
+void *promela_alloc (yy_size_t size , yyscan_t yyscanner)
+{
return (void *) malloc( size );
}
-void *promela_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) {
+void *promela_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
+{
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
@@ -2510,7 +2565,8 @@ void *promela_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) {
return (void *) realloc( (char *) ptr, size );
}
-void promela_free (void * ptr , yyscan_t yyscanner) {
+void promela_free (void * ptr , yyscan_t yyscanner)
+{
free( (char *) ptr ); /* see promela_realloc() for (char *) cast */
}
@@ -2521,4 +2577,4 @@ void promela_free (void * ptr , yyscan_t yyscanner) {
/* %ok-for-header */
-#line 102 "promela.l"
+#line 101 "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 67501fa..3e9e92c 100644
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp
+++ b/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp
@@ -1,19 +1,19 @@
/* A Bison parser, made by GNU Bison 2.7.12-4996. */
/* Bison implementation for Yacc-like parsers in C
-
+
Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-
+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
-
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
@@ -26,7 +26,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -128,96 +128,97 @@ extern int promela_debug;
/* Tokens. */
#ifndef PROMELA_TOKENTYPE
# define PROMELA_TOKENTYPE
-/* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
-enum promela_tokentype {
- PML_VAR_ARRAY = 258,
- PML_VARLIST = 259,
- PML_DECL = 260,
- PML_DECLLIST = 261,
- PML_STMNT = 262,
- PML_COLON = 263,
- PML_EXPR = 264,
- PML_NAMELIST = 265,
- PML_ASSERT = 266,
- PML_PRINT = 267,
- PML_PRINTM = 268,
- PML_LEN = 269,
- PML_STRING = 270,
- PML_TYPEDEF = 271,
- PML_MTYPE = 272,
- PML_INLINE = 273,
- PML_RETURN = 274,
- PML_LABEL = 275,
- PML_OF = 276,
- PML_GOTO = 277,
- PML_BREAK = 278,
- PML_ELSE = 279,
- PML_SEMI = 280,
- PML_ARROW = 281,
- PML_IF = 282,
- PML_FI = 283,
- PML_DO = 284,
- PML_OD = 285,
- PML_FOR = 286,
- PML_SELECT = 287,
- PML_IN = 288,
- PML_SEP = 289,
- PML_DOTDOT = 290,
- PML_HIDDEN = 291,
- PML_SHOW = 292,
- PML_ISLOCAL = 293,
- PML_CONST = 294,
- PML_TYPE = 295,
- PML_XU = 296,
- PML_NAME = 297,
- PML_UNAME = 298,
- PML_PNAME = 299,
- PML_INAME = 300,
- PML_CLAIM = 301,
- PML_TRACE = 302,
- PML_INIT = 303,
- PML_LTL = 304,
- PML_COMMA = 305,
- PML_ASGN = 306,
- PML_AND = 307,
- PML_OR = 308,
- PML_BITAND = 309,
- PML_BITXOR = 310,
- PML_BITOR = 311,
- PML_NE = 312,
- PML_EQ = 313,
- PML_LE = 314,
- PML_GE = 315,
- PML_LT = 316,
- PML_GT = 317,
- PML_RSHIFT = 318,
- PML_LSHIFT = 319,
- PML_MINUS = 320,
- PML_PLUS = 321,
- PML_MODULO = 322,
- PML_DIVIDE = 323,
- PML_TIMES = 324,
- PML_DECR = 325,
- PML_INCR = 326,
- PML_COMPL = 327,
- PML_NEG = 328,
- PML_CMPND = 329,
- PML_DOT = 330
-};
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum promela_tokentype {
+ PML_VAR_ARRAY = 258,
+ PML_VARLIST = 259,
+ PML_DECL = 260,
+ PML_DECLLIST = 261,
+ PML_STMNT = 262,
+ PML_COLON = 263,
+ PML_EXPR = 264,
+ PML_NAMELIST = 265,
+ PML_ASSERT = 266,
+ PML_PRINT = 267,
+ PML_PRINTM = 268,
+ PML_LEN = 269,
+ PML_STRING = 270,
+ PML_TYPEDEF = 271,
+ PML_MTYPE = 272,
+ PML_INLINE = 273,
+ PML_RETURN = 274,
+ PML_LABEL = 275,
+ PML_OF = 276,
+ PML_GOTO = 277,
+ PML_BREAK = 278,
+ PML_ELSE = 279,
+ PML_SEMI = 280,
+ PML_ARROW = 281,
+ PML_IF = 282,
+ PML_FI = 283,
+ PML_DO = 284,
+ PML_OD = 285,
+ PML_FOR = 286,
+ PML_SELECT = 287,
+ PML_IN = 288,
+ PML_SEP = 289,
+ PML_DOTDOT = 290,
+ PML_HIDDEN = 291,
+ PML_SHOW = 292,
+ PML_ISLOCAL = 293,
+ PML_CONST = 294,
+ PML_TYPE = 295,
+ PML_XU = 296,
+ PML_NAME = 297,
+ PML_UNAME = 298,
+ PML_PNAME = 299,
+ PML_INAME = 300,
+ PML_CLAIM = 301,
+ PML_TRACE = 302,
+ PML_INIT = 303,
+ PML_LTL = 304,
+ PML_COMMA = 305,
+ PML_ASGN = 306,
+ PML_AND = 307,
+ PML_OR = 308,
+ PML_BITAND = 309,
+ PML_BITXOR = 310,
+ PML_BITOR = 311,
+ PML_NE = 312,
+ PML_EQ = 313,
+ PML_LE = 314,
+ PML_GE = 315,
+ PML_LT = 316,
+ PML_GT = 317,
+ PML_RSHIFT = 318,
+ PML_LSHIFT = 319,
+ PML_MINUS = 320,
+ PML_PLUS = 321,
+ PML_MODULO = 322,
+ PML_DIVIDE = 323,
+ PML_TIMES = 324,
+ PML_DECR = 325,
+ PML_INCR = 326,
+ PML_COMPL = 327,
+ PML_NEG = 328,
+ PML_CMPND = 329,
+ PML_DOT = 330
+ };
#endif
#if ! defined PROMELA_STYPE && ! defined PROMELA_STYPE_IS_DECLARED
-typedef union PROMELA_STYPE {
- /* Line 387 of yacc.c */
+typedef union PROMELA_STYPE
+{
+/* Line 387 of yacc.c */
#line 38 "promela.ypp"
- uscxml::PromelaParserNode* node;
+ uscxml::PromelaParserNode* node;
char* value;
- /* Line 387 of yacc.c */
+/* Line 387 of yacc.c */
#line 223 "promela.tab.cpp"
} PROMELA_STYPE;
# define PROMELA_STYPE_IS_TRIVIAL 1
@@ -333,10 +334,10 @@ YYID (int yyi)
#else
static int
YYID (yyi)
-int yyi;
+ int yyi;
#endif
{
- return yyi;
+ return yyi;
}
#endif
@@ -360,7 +361,7 @@ int yyi;
# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-/* Use EXIT_SUCCESS as a witness for stdlib.h. */
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
# ifndef EXIT_SUCCESS
# define EXIT_SUCCESS 0
# endif
@@ -370,13 +371,13 @@ int yyi;
# endif
# ifdef YYSTACK_ALLOC
-/* Pacify GCC's `empty if-body' warning. */
+ /* Pacify GCC's `empty if-body' warning. */
# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
# ifndef YYSTACK_ALLOC_MAXIMUM
-/* The OS might guarantee only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
- to allow for a few compiler-allocated temporary stack slots. */
+ /* The OS might guarantee only one guard page at the bottom of the stack,
+ and a page size can be as small as 4096 bytes. So we cannot safely
+ invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
+ to allow for a few compiler-allocated temporary stack slots. */
# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
# endif
# else
@@ -416,9 +417,10 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
|| (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;
+union yyalloc
+{
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
};
/* The size of the maximum gap between one aligned stack and the next. */
@@ -471,18 +473,18 @@ union yyalloc {
#endif /* !YYCOPY_NEEDED */
/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 34
+#define YYFINAL 32
/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 311
+#define YYLAST 285
/* YYNTOKENS -- Number of terminals. */
#define YYNTOKENS 82
/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 23
+#define YYNNTS 21
/* YYNRULES -- Number of rules. */
-#define YYNRULES 85
+#define YYNRULES 81
/* YYNRULES -- Number of states. */
-#define YYNSTATES 152
+#define YYNSTATES 143
/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
#define YYUNDEFTOK 2
@@ -492,267 +494,273 @@ union yyalloc {
((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const yytype_uint8 yytranslate[] = {
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 11, 12, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 13, 2, 14, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 15, 2, 16, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
- 81
+static const yytype_uint8 yytranslate[] =
+{
+ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 11, 12, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 13, 2, 14, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 15, 2, 16, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
+ 5, 6, 7, 8, 9, 10, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
+ 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
+ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+ 81
};
#if PROMELA_DEBUG
/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
YYRHS. */
-static const yytype_uint16 yyprhs[] = {
- 0, 0, 3, 5, 7, 9, 11, 13, 18, 21,
- 22, 25, 29, 33, 37, 41, 45, 49, 53, 57,
- 61, 65, 69, 73, 77, 81, 85, 89, 93, 97,
- 101, 104, 107, 112, 114, 116, 118, 119, 121, 123,
- 125, 129, 133, 140, 143, 149, 151, 154, 158, 160,
- 164, 166, 170, 172, 176, 181, 183, 186, 190, 194,
- 198, 202, 206, 210, 212, 215, 218, 220, 223, 227,
- 229, 233, 236, 239, 245, 250, 255, 258, 260, 261,
- 270, 271, 273, 274, 277, 279
+static const yytype_uint16 yyprhs[] =
+{
+ 0, 0, 3, 5, 7, 9, 11, 13, 18, 21,
+ 22, 25, 29, 33, 37, 41, 45, 49, 53, 57,
+ 61, 65, 69, 73, 77, 81, 85, 89, 93, 97,
+ 101, 104, 107, 112, 114, 116, 118, 119, 121, 123,
+ 125, 129, 133, 140, 143, 149, 151, 154, 158, 160,
+ 164, 166, 170, 172, 176, 181, 183, 186, 190, 194,
+ 198, 202, 206, 210, 212, 215, 218, 220, 223, 227,
+ 229, 233, 236, 239, 245, 250, 255, 258, 260, 261,
+ 264, 266
};
/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int8 yyrhs[] = {
- 83, 0, -1, 92, -1, 88, -1, 98, -1, 86,
- -1, 48, -1, 48, 13, 88, 14, -1, 85, 87,
- -1, -1, 81, 86, -1, 11, 88, 12, -1, 88,
- 72, 88, -1, 88, 71, 88, -1, 88, 75, 88,
- -1, 88, 74, 88, -1, 88, 73, 88, -1, 88,
- 60, 88, -1, 88, 61, 88, -1, 88, 62, 88,
- -1, 88, 68, 88, -1, 88, 67, 88, -1, 88,
- 66, 88, -1, 88, 65, 88, -1, 88, 64, 88,
- -1, 88, 63, 88, -1, 88, 58, 88, -1, 88,
- 59, 88, -1, 88, 70, 88, -1, 88, 69, 88,
- -1, 79, 88, -1, 71, 88, -1, 20, 11, 84,
- 12, -1, 84, -1, 45, -1, 21, -1, -1, 42,
- -1, 43, -1, 44, -1, 89, 46, 93, -1, 89,
- 49, 93, -1, 89, 46, 57, 15, 97, 16, -1,
- 89, 91, -1, 22, 48, 15, 92, 16, -1, 90,
- -1, 90, 31, -1, 90, 31, 92, -1, 94, -1,
- 94, 56, 93, -1, 95, -1, 95, 57, 88, -1,
- 48, -1, 48, 8, 45, -1, 48, 13, 96, 14,
- -1, 45, -1, 71, 96, -1, 11, 96, 12, -1,
- 96, 72, 96, -1, 96, 71, 96, -1, 96, 75,
- 96, -1, 96, 74, 96, -1, 96, 73, 96, -1,
- 48, -1, 97, 48, -1, 97, 56, -1, 99, -1,
- 99, 31, -1, 99, 31, 98, -1, 100, -1, 84,
- 57, 88, -1, 84, 77, -1, 84, 76, -1, 18,
- 11, 21, 103, 12, -1, 19, 11, 84, 12, -1,
- 19, 11, 45, 12, -1, 17, 88, -1, 88, -1,
- -1, 84, 57, 51, 101, 11, 102, 12, 100, -1,
- -1, 104, -1, -1, 56, 104, -1, 88, -1, 88,
- 56, 104, -1
+static const yytype_int8 yyrhs[] =
+{
+ 83, 0, -1, 92, -1, 88, -1, 98, -1, 86,
+ -1, 48, -1, 48, 13, 88, 14, -1, 85, 87,
+ -1, -1, 81, 86, -1, 11, 88, 12, -1, 88,
+ 72, 88, -1, 88, 71, 88, -1, 88, 75, 88,
+ -1, 88, 74, 88, -1, 88, 73, 88, -1, 88,
+ 60, 88, -1, 88, 61, 88, -1, 88, 62, 88,
+ -1, 88, 68, 88, -1, 88, 67, 88, -1, 88,
+ 66, 88, -1, 88, 65, 88, -1, 88, 64, 88,
+ -1, 88, 63, 88, -1, 88, 58, 88, -1, 88,
+ 59, 88, -1, 88, 70, 88, -1, 88, 69, 88,
+ -1, 79, 88, -1, 71, 88, -1, 20, 11, 84,
+ 12, -1, 84, -1, 45, -1, 21, -1, -1, 42,
+ -1, 43, -1, 44, -1, 89, 46, 93, -1, 89,
+ 49, 93, -1, 89, 46, 57, 15, 97, 16, -1,
+ 89, 91, -1, 22, 48, 15, 92, 16, -1, 90,
+ -1, 90, 31, -1, 90, 31, 92, -1, 94, -1,
+ 94, 56, 93, -1, 95, -1, 95, 57, 88, -1,
+ 48, -1, 48, 8, 45, -1, 48, 13, 96, 14,
+ -1, 45, -1, 71, 96, -1, 11, 96, 12, -1,
+ 96, 72, 96, -1, 96, 71, 96, -1, 96, 75,
+ 96, -1, 96, 74, 96, -1, 96, 73, 96, -1,
+ 48, -1, 97, 48, -1, 97, 56, -1, 99, -1,
+ 99, 31, -1, 99, 31, 98, -1, 100, -1, 84,
+ 57, 88, -1, 84, 77, -1, 84, 76, -1, 18,
+ 11, 21, 101, 12, -1, 18, 11, 84, 12, -1,
+ 18, 11, 45, 12, -1, 17, 88, -1, 88, -1,
+ -1, 56, 102, -1, 88, -1, 88, 56, 102, -1
};
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] = {
- 0, 84, 84, 88, 92, 98, 101, 102, 105, 132,
- 133, 143, 144, 145, 146, 147, 148, 149, 150, 151,
- 152, 153, 154, 155, 156, 157, 158, 159, 160, 161,
- 162, 163, 165, 166, 167, 168, 174, 175, 176, 177,
- 180, 181, 182, 183, 186, 189, 190, 191, 201, 202,
- 205, 206, 209, 210, 211, 214, 215, 216, 217, 218,
- 219, 220, 221, 224, 225, 234, 237, 238, 239, 242,
- 245, 246, 247, 248, 249, 250, 251, 252, 253, 253,
- 256, 257, 260, 261, 264, 265
+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
};
#endif
#if PROMELA_DEBUG || YYERROR_VERBOSE || 1
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] = {
- "$end", "error", "$undefined", "PML_VAR_ARRAY", "PML_VARLIST",
- "PML_DECL", "PML_DECLLIST", "PML_STMNT", "PML_COLON", "PML_EXPR",
- "PML_NAMELIST", "'('", "')'", "'['", "']'", "'{'", "'}'", "PML_ASSERT",
- "PML_PRINT", "PML_PRINTM", "PML_LEN", "PML_STRING", "PML_TYPEDEF",
- "PML_MTYPE", "PML_INLINE", "PML_RETURN", "PML_LABEL", "PML_OF",
- "PML_GOTO", "PML_BREAK", "PML_ELSE", "PML_SEMI", "PML_ARROW", "PML_IF",
- "PML_FI", "PML_DO", "PML_OD", "PML_FOR", "PML_SELECT", "PML_IN",
- "PML_SEP", "PML_DOTDOT", "PML_HIDDEN", "PML_SHOW", "PML_ISLOCAL",
- "PML_CONST", "PML_TYPE", "PML_XU", "PML_NAME", "PML_UNAME", "PML_PNAME",
- "PML_INAME", "PML_CLAIM", "PML_TRACE", "PML_INIT", "PML_LTL",
- "PML_COMMA", "PML_ASGN", "PML_AND", "PML_OR", "PML_BITAND", "PML_BITXOR",
- "PML_BITOR", "PML_NE", "PML_EQ", "PML_LE", "PML_GE", "PML_LT", "PML_GT",
- "PML_RSHIFT", "PML_LSHIFT", "PML_MINUS", "PML_PLUS", "PML_MODULO",
- "PML_DIVIDE", "PML_TIMES", "PML_DECR", "PML_INCR", "PML_COMPL",
- "PML_NEG", "PML_CMPND", "PML_DOT", "$accept", "program", "varref",
- "pfld", "cmpnd", "sfld", "expr", "vis", "one_decl", "utype", "decl_lst",
- "var_list", "ivar", "vardcl", "const_expr", "nlst", "stmnt_lst", "stmnt",
- "Stmnt", "$@1", "args", "prargs", "arg", YY_NULL
+static const char *const yytname[] =
+{
+ "$end", "error", "$undefined", "PML_VAR_ARRAY", "PML_VARLIST",
+ "PML_DECL", "PML_DECLLIST", "PML_STMNT", "PML_COLON", "PML_EXPR",
+ "PML_NAMELIST", "'('", "')'", "'['", "']'", "'{'", "'}'", "PML_ASSERT",
+ "PML_PRINT", "PML_PRINTM", "PML_LEN", "PML_STRING", "PML_TYPEDEF",
+ "PML_MTYPE", "PML_INLINE", "PML_RETURN", "PML_LABEL", "PML_OF",
+ "PML_GOTO", "PML_BREAK", "PML_ELSE", "PML_SEMI", "PML_ARROW", "PML_IF",
+ "PML_FI", "PML_DO", "PML_OD", "PML_FOR", "PML_SELECT", "PML_IN",
+ "PML_SEP", "PML_DOTDOT", "PML_HIDDEN", "PML_SHOW", "PML_ISLOCAL",
+ "PML_CONST", "PML_TYPE", "PML_XU", "PML_NAME", "PML_UNAME", "PML_PNAME",
+ "PML_INAME", "PML_CLAIM", "PML_TRACE", "PML_INIT", "PML_LTL",
+ "PML_COMMA", "PML_ASGN", "PML_AND", "PML_OR", "PML_BITAND", "PML_BITXOR",
+ "PML_BITOR", "PML_NE", "PML_EQ", "PML_LE", "PML_GE", "PML_LT", "PML_GT",
+ "PML_RSHIFT", "PML_LSHIFT", "PML_MINUS", "PML_PLUS", "PML_MODULO",
+ "PML_DIVIDE", "PML_TIMES", "PML_DECR", "PML_INCR", "PML_COMPL",
+ "PML_NEG", "PML_CMPND", "PML_DOT", "$accept", "program", "varref",
+ "pfld", "cmpnd", "sfld", "expr", "vis", "one_decl", "utype", "decl_lst",
+ "var_list", "ivar", "vardcl", "const_expr", "nlst", "stmnt_lst", "stmnt",
+ "Stmnt", "prargs", "arg", YY_NULL
};
#endif
# ifdef YYPRINT
/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
token YYLEX-NUM. */
-static const yytype_uint16 yytoknum[] = {
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 40, 41, 91, 93, 123, 125, 266, 267, 268,
- 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
- 279, 280, 281, 282, 283, 284, 285, 286, 287, 288,
- 289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
- 299, 300, 301, 302, 303, 304, 305, 306, 307, 308,
- 309, 310, 311, 312, 313, 314, 315, 316, 317, 318,
- 319, 320, 321, 322, 323, 324, 325, 326, 327, 328,
- 329, 330
+static const yytype_uint16 yytoknum[] =
+{
+ 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
+ 265, 40, 41, 91, 93, 123, 125, 266, 267, 268,
+ 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
+ 279, 280, 281, 282, 283, 284, 285, 286, 287, 288,
+ 289, 290, 291, 292, 293, 294, 295, 296, 297, 298,
+ 299, 300, 301, 302, 303, 304, 305, 306, 307, 308,
+ 309, 310, 311, 312, 313, 314, 315, 316, 317, 318,
+ 319, 320, 321, 322, 323, 324, 325, 326, 327, 328,
+ 329, 330
};
# endif
/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] = {
- 0, 82, 83, 83, 83, 84, 85, 85, 86, 87,
- 87, 88, 88, 88, 88, 88, 88, 88, 88, 88,
- 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
- 88, 88, 88, 88, 88, 88, 89, 89, 89, 89,
- 90, 90, 90, 90, 91, 92, 92, 92, 93, 93,
- 94, 94, 95, 95, 95, 96, 96, 96, 96, 96,
- 96, 96, 96, 97, 97, 97, 98, 98, 98, 99,
- 100, 100, 100, 100, 100, 100, 100, 100, 101, 100,
- 102, 102, 103, 103, 104, 104
+static const yytype_uint8 yyr1[] =
+{
+ 0, 82, 83, 83, 83, 84, 85, 85, 86, 87,
+ 87, 88, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 89, 89, 89, 89,
+ 90, 90, 90, 90, 91, 92, 92, 92, 93, 93,
+ 94, 94, 95, 95, 95, 96, 96, 96, 96, 96,
+ 96, 96, 96, 97, 97, 97, 98, 98, 98, 99,
+ 100, 100, 100, 100, 100, 100, 100, 100, 101, 101,
+ 102, 102
};
/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] = {
- 0, 2, 1, 1, 1, 1, 1, 4, 2, 0,
- 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 2, 2, 4, 1, 1, 1, 0, 1, 1, 1,
- 3, 3, 6, 2, 5, 1, 2, 3, 1, 3,
- 1, 3, 1, 3, 4, 1, 2, 3, 3, 3,
- 3, 3, 3, 1, 2, 2, 1, 2, 3, 1,
- 3, 2, 2, 5, 4, 4, 2, 1, 0, 8,
- 0, 1, 0, 2, 1, 3
+static const yytype_uint8 yyr2[] =
+{
+ 0, 2, 1, 1, 1, 1, 1, 4, 2, 0,
+ 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 2, 4, 1, 1, 1, 0, 1, 1, 1,
+ 3, 3, 6, 2, 5, 1, 2, 3, 1, 3,
+ 1, 3, 1, 3, 4, 1, 2, 3, 3, 3,
+ 3, 3, 3, 1, 2, 2, 1, 2, 3, 1,
+ 3, 2, 2, 5, 4, 4, 2, 1, 0, 2,
+ 1, 3
};
/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
Performed when YYTABLE doesn't specify something else to do. Zero
means the default is an error. */
-static const yytype_uint8 yydefact[] = {
- 36, 0, 0, 0, 0, 0, 35, 37, 38, 39,
- 34, 6, 0, 0, 0, 33, 9, 5, 3, 0,
- 45, 2, 4, 66, 69, 33, 0, 76, 0, 0,
- 0, 0, 31, 30, 1, 0, 72, 71, 0, 8,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 43, 36, 67, 11, 82, 0, 0, 0, 0,
- 78, 70, 10, 26, 27, 17, 18, 19, 25, 24,
- 23, 22, 21, 20, 29, 28, 13, 12, 16, 15,
- 14, 0, 52, 0, 40, 48, 50, 41, 47, 77,
- 68, 0, 0, 75, 74, 32, 7, 0, 36, 0,
- 0, 0, 0, 0, 84, 83, 73, 80, 0, 53,
- 0, 55, 0, 0, 63, 0, 49, 51, 0, 0,
- 81, 44, 0, 56, 54, 0, 0, 0, 0, 0,
- 42, 64, 65, 85, 0, 57, 59, 58, 62, 61,
- 60, 79
+static const yytype_uint8 yydefact[] =
+{
+ 36, 0, 0, 0, 0, 35, 37, 38, 39, 34,
+ 6, 0, 0, 0, 33, 9, 5, 3, 0, 45,
+ 2, 4, 66, 69, 33, 0, 76, 0, 0, 0,
+ 31, 30, 1, 0, 72, 71, 0, 8, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 43,
+ 36, 67, 11, 78, 0, 0, 0, 0, 70, 10,
+ 26, 27, 17, 18, 19, 25, 24, 23, 22, 21,
+ 20, 29, 28, 13, 12, 16, 15, 14, 0, 52,
+ 0, 40, 48, 50, 41, 47, 77, 68, 0, 0,
+ 75, 74, 32, 7, 36, 0, 0, 0, 0, 0,
+ 80, 79, 73, 0, 53, 0, 55, 0, 0, 63,
+ 0, 49, 51, 0, 44, 0, 56, 54, 0, 0,
+ 0, 0, 0, 42, 64, 65, 81, 57, 59, 58,
+ 62, 61, 60
};
/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int16 yydefgoto[] = {
- -1, 14, 25, 16, 17, 39, 114, 19, 20, 61,
- 21, 94, 95, 96, 123, 125, 22, 23, 24, 107,
- 129, 102, 115
+static const yytype_int8 yydefgoto[] =
+{
+ -1, 13, 24, 15, 16, 37, 110, 18, 19, 59,
+ 20, 91, 92, 93, 118, 120, 21, 22, 23, 99,
+ 111
};
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
#define YYPACT_NINF -112
-static const yytype_int16 yypact[] = {
- 50, 66, 66, 5, 8, 25, -112, -112, -112, -112,
- -112, 26, 66, 66, 62, -52, -8, -112, 159, -12,
- 45, -112, -112, 57, -112, -112, 91, 200, 70, -37,
- 41, 66, 10, -112, -112, 54, -112, -112, 41, -112,
- 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
- 66, 66, 66, 66, 66, 66, 66, 66, 48, -39,
- 49, -112, 193, 61, -112, 51, 88, 89, 92, 114,
- -112, 200, -112, 216, 216, 229, 229, 229, 133, 133,
- 236, 236, 236, 236, -45, -45, 10, 10, -112, -112,
- -112, 95, 7, 97, -112, 64, 67, -112, -112, 200,
- -112, 66, 111, -112, -112, -112, -112, 115, -21, 82,
- -7, 83, 49, 66, 182, -112, -112, 66, 118, -112,
- -7, -112, -7, 44, -112, 74, -112, 200, 66, 123,
- -112, -112, 96, 68, -112, -7, -7, -7, -7, -7,
- -112, -112, -112, -112, 61, -112, 68, 68, -112, -112,
- -112, -112
+static const yytype_int16 yypact[] =
+{
+ 14, 53, 53, 3, 13, -112, -112, -112, -112, -112,
+ 15, 53, 53, 26, 34, -51, -112, 138, 81, 5,
+ -112, -112, 58, -112, -112, 75, 160, 169, 42, 53,
+ -66, -112, -112, 53, -112, -112, 42, -112, 53, 53,
+ 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
+ 53, 53, 53, 53, 53, 53, 44, -35, 51, -112,
+ 72, 49, -112, 46, 88, 96, 100, 93, 160, -112,
+ 176, 176, 189, 189, 189, 200, 200, 207, 207, 207,
+ 207, 120, 120, -66, -66, -112, -112, -112, 98, -3,
+ 102, -112, 63, 74, -112, -112, 160, -112, 53, 113,
+ -112, -112, -112, -112, 62, 126, -8, 167, 51, 53,
+ 114, -112, -112, 267, -112, -8, -112, -8, 9, -112,
+ 70, -112, 160, 53, -112, 4, 48, -112, -8, -8,
+ -8, -8, -8, -112, -112, -112, -112, -112, 48, 48,
+ -112, -112, -112
};
/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] = {
- -112, -112, 3, -112, 98, -112, 0, -112, -112, -112,
- -48, -53, -112, -112, 75, -112, 76, -112, -6, -112,
- -112, -112, -111
+static const yytype_int16 yypgoto[] =
+{
+ -112, -112, 68, -112, 180, -112, 0, -112, -112, -112,
+ -33, -43, -112, -112, -111, -112, 223, -112, -112, -112,
+ 162
};
/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
positive, shift that token. If negative, reduce the rule which
number is the opposite. If YYTABLE_NINF, syntax error. */
#define YYTABLE_NINF -78
-static const yytype_int16 yytable[] = {
- 18, 26, 27, 15, 120, 35, 130, 97, 66, 92,
- 58, 11, 32, 33, 98, 109, 28, 143, 93, 29,
- 110, 7, 8, 9, 36, 37, 53, 54, 55, 56,
- 57, 69, 67, 68, 59, 71, 30, 60, 121, 31,
- 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
- 83, 84, 85, 86, 87, 88, 89, 90, 134, 126,
- 118, 1, 34, 99, 122, 1, 15, 2, 3, 4,
- 5, 6, 1, 38, 5, 6, 62, 1, 2, 3,
- 4, 5, 6, 55, 56, 57, 5, 6, 63, 11,
- 140, 65, 7, 8, 9, 10, 91, 92, 11, 10,
- 103, 104, 11, 64, 105, 70, 10, 101, 145, 11,
- 108, 10, 111, 127, 11, 135, 136, 137, 138, 139,
- 112, 12, 141, 116, 113, 12, 117, 119, 106, 13,
- 142, 124, 12, 13, 131, 144, 72, 12, 151, 100,
- 13, 137, 138, 139, 99, 13, 0, 15, 0, 40,
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- 51, 52, 53, 54, 55, 56, 57, 135, 136, 137,
- 138, 139, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- -77, 0, 0, -46, 0, 132, 0, 133, 47, 48,
- 49, 50, 51, 52, 53, 54, 55, 56, 57, -46,
- 146, 147, 148, 149, 150, 0, 0, 40, 41, 42,
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 56, 57, 7, 8, 9, 128, 0,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 40, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 56, 57, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 56, 57, 51, 52, 53, 54, 55,
- 56, 57
+static const yytype_int16 yytable[] =
+{
+ 17, 25, 26, 115, 125, 105, 126, 53, 54, 55,
+ 106, 30, 31, 89, 27, 94, 137, 138, 139, 140,
+ 141, 142, 90, 127, 28, 1, 32, 95, 29, 67,
+ 36, 2, 3, 68, 4, 5, 60, 116, 70, 71,
+ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81,
+ 82, 83, 84, 85, 86, 87, 6, 7, 8, 9,
+ 1, 96, 10, 117, 1, 121, 2, 3, 14, 4,
+ 5, 113, -46, 4, 5, 128, 129, 130, 131, 132,
+ 128, 129, 130, 131, 132, 11, 133, 62, -46, 61,
+ 10, 33, 88, 12, 9, 65, 66, 10, 9, 89,
+ 100, 10, 98, 56, 6, 7, 8, 103, 101, 122,
+ 34, 35, 102, 104, 6, 7, 8, 107, 134, 108,
+ 11, 130, 131, 132, 11, 112, 135, 57, 12, 14,
+ 58, 109, 12, 38, 39, 40, 41, 42, 43, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 38, 39, 40, 41, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54, 55, -77,
+ 123, 114, 38, 39, 40, 41, 42, 43, 44, 45,
+ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ 63, 51, 52, 53, 54, 55, 38, 39, 40, 41,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 64, 119, 69, 10, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 40, 41, 42, 43,
+ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ 54, 55, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 49, 50, 51, 52,
+ 53, 54, 55, 124, 97, 136
};
#define yypact_value_is_default(Yystate) \
@@ -761,60 +769,58 @@ static const yytype_int16 yytable[] = {
#define yytable_value_is_error(Yytable_value) \
YYID (0)
-static const yytype_int16 yycheck[] = {
- 0, 1, 2, 0, 11, 57, 117, 60, 45, 48,
- 22, 48, 12, 13, 62, 8, 11, 128, 57, 11,
- 13, 42, 43, 44, 76, 77, 71, 72, 73, 74,
- 75, 31, 29, 30, 46, 35, 11, 49, 45, 13,
- 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 14, 112,
- 108, 11, 0, 63, 71, 11, 63, 17, 18, 19,
- 20, 21, 11, 81, 20, 21, 31, 11, 17, 18,
- 19, 20, 21, 73, 74, 75, 20, 21, 31, 48,
- 16, 21, 42, 43, 44, 45, 48, 48, 48, 45,
- 12, 12, 48, 12, 12, 51, 45, 56, 12, 48,
- 15, 45, 15, 113, 48, 71, 72, 73, 74, 75,
- 56, 71, 48, 12, 57, 71, 11, 45, 14, 79,
- 56, 48, 71, 79, 16, 12, 38, 71, 144, 63,
- 79, 73, 74, 75, 144, 79, -1, 144, -1, 58,
- 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
- 69, 70, 71, 72, 73, 74, 75, 71, 72, 73,
- 74, 75, 58, 59, 60, 61, 62, 63, 64, 65,
- 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
- 31, -1, -1, 0, -1, 120, -1, 122, 65, 66,
- 67, 68, 69, 70, 71, 72, 73, 74, 75, 16,
- 135, 136, 137, 138, 139, -1, -1, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 73, 74, 75, 42, 43, 44, 56, -1,
- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- 68, 69, 70, 71, 72, 73, 74, 75, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
- 70, 71, 72, 73, 74, 75, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
- 74, 75, 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 73, 74, 75, 69, 70, 71, 72, 73,
- 74, 75
+static const yytype_uint8 yycheck[] =
+{
+ 0, 1, 2, 11, 115, 8, 117, 73, 74, 75,
+ 13, 11, 12, 48, 11, 58, 12, 128, 129, 130,
+ 131, 132, 57, 14, 11, 11, 0, 60, 13, 29,
+ 81, 17, 18, 33, 20, 21, 31, 45, 38, 39,
+ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 42, 43, 44, 45,
+ 11, 61, 48, 71, 11, 108, 17, 18, 0, 20,
+ 21, 104, 0, 20, 21, 71, 72, 73, 74, 75,
+ 71, 72, 73, 74, 75, 71, 16, 12, 16, 31,
+ 48, 57, 48, 79, 45, 27, 28, 48, 45, 48,
+ 12, 48, 56, 22, 42, 43, 44, 14, 12, 109,
+ 76, 77, 12, 15, 42, 43, 44, 15, 48, 56,
+ 71, 73, 74, 75, 71, 12, 56, 46, 79, 61,
+ 49, 57, 79, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
+ 75, 58, 59, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 31,
+ 56, 45, 58, 59, 60, 61, 62, 63, 64, 65,
+ 66, 67, 68, 69, 70, 71, 72, 73, 74, 75,
+ 21, 71, 72, 73, 74, 75, 58, 59, 60, 61,
+ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
+ 72, 73, 74, 75, 45, 48, 36, 48, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ 70, 71, 72, 73, 74, 75, 60, 61, 62, 63,
+ 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
+ 74, 75, 63, 64, 65, 66, 67, 68, 69, 70,
+ 71, 72, 73, 74, 75, 65, 66, 67, 68, 69,
+ 70, 71, 72, 73, 74, 75, 69, 70, 71, 72,
+ 73, 74, 75, 16, 61, 123
};
/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
symbol of state STATE-NUM. */
-static const yytype_uint8 yystos[] = {
- 0, 11, 17, 18, 19, 20, 21, 42, 43, 44,
- 45, 48, 71, 79, 83, 84, 85, 86, 88, 89,
- 90, 92, 98, 99, 100, 84, 88, 88, 11, 11,
- 11, 13, 88, 88, 0, 57, 76, 77, 81, 87,
- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- 68, 69, 70, 71, 72, 73, 74, 75, 22, 46,
- 49, 91, 31, 31, 12, 21, 45, 84, 84, 88,
- 51, 88, 86, 88, 88, 88, 88, 88, 88, 88,
- 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
- 88, 48, 48, 57, 93, 94, 95, 93, 92, 88,
- 98, 56, 103, 12, 12, 12, 14, 101, 15, 8,
- 13, 15, 56, 57, 88, 104, 12, 11, 92, 45,
- 11, 45, 71, 96, 48, 97, 93, 88, 56, 102,
- 104, 16, 96, 96, 14, 71, 72, 73, 74, 75,
- 16, 48, 56, 104, 12, 12, 96, 96, 96, 96,
- 96, 100
+static const yytype_uint8 yystos[] =
+{
+ 0, 11, 17, 18, 20, 21, 42, 43, 44, 45,
+ 48, 71, 79, 83, 84, 85, 86, 88, 89, 90,
+ 92, 98, 99, 100, 84, 88, 88, 11, 11, 13,
+ 88, 88, 0, 57, 76, 77, 81, 87, 58, 59,
+ 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+ 70, 71, 72, 73, 74, 75, 22, 46, 49, 91,
+ 31, 31, 12, 21, 45, 84, 84, 88, 88, 86,
+ 88, 88, 88, 88, 88, 88, 88, 88, 88, 88,
+ 88, 88, 88, 88, 88, 88, 88, 88, 48, 48,
+ 57, 93, 94, 95, 93, 92, 88, 98, 56, 101,
+ 12, 12, 12, 14, 15, 8, 13, 15, 56, 57,
+ 88, 102, 12, 92, 45, 11, 45, 71, 96, 48,
+ 97, 93, 88, 56, 16, 96, 96, 14, 71, 72,
+ 73, 74, 75, 16, 48, 56, 102, 12, 96, 96,
+ 96, 96, 96
};
#define yyerrok (yyerrstatus = 0)
@@ -836,10 +842,10 @@ static const yytype_uint8 yystos[] = {
#define YYFAIL goto yyerrlab
#if defined YYFAIL
-/* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
+ /* This is here to suppress warnings from the GCC cpp's
+ -Wunused-macros. Normally we don't worry about that warning, but
+ some users do, and we want to make it easy for users to remove
+ YYFAIL uses, which will produce warnings from Bison 2.5. */
#endif
#define YYRECOVERING() (!!yyerrstatus)
@@ -917,26 +923,26 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue
#else
static void
yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx, scanner)
-FILE *yyoutput;
-int yytype;
-YYSTYPE const * const yyvaluep;
-uscxml::PromelaParser* ctx;
-void * scanner;
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+ uscxml::PromelaParser* ctx;
+ void * scanner;
#endif
{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
- if (!yyvaluep)
- return;
- YYUSE (ctx);
- YYUSE (scanner);
+ FILE *yyo = yyoutput;
+ YYUSE (yyo);
+ if (!yyvaluep)
+ return;
+ YYUSE (ctx);
+ YYUSE (scanner);
# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+ if (yytype < YYNTOKENS)
+ YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
# else
- YYUSE (yyoutput);
+ YYUSE (yyoutput);
# endif
- YYUSE (yytype);
+ YYUSE (yytype);
}
@@ -951,20 +957,20 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, usc
#else
static void
yy_symbol_print (yyoutput, yytype, yyvaluep, ctx, scanner)
-FILE *yyoutput;
-int yytype;
-YYSTYPE const * const yyvaluep;
-uscxml::PromelaParser* ctx;
-void * scanner;
+ FILE *yyoutput;
+ int yytype;
+ YYSTYPE const * const yyvaluep;
+ uscxml::PromelaParser* ctx;
+ void * scanner;
#endif
{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+ if (yytype < YYNTOKENS)
+ YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+ else
+ YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx, scanner);
- YYFPRINTF (yyoutput, ")");
+ yy_symbol_value_print (yyoutput, yytype, yyvaluep, ctx, scanner);
+ YYFPRINTF (yyoutput, ")");
}
/*------------------------------------------------------------------.
@@ -979,16 +985,17 @@ yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
static void
yy_stack_print (yybottom, yytop)
-yytype_int16 *yybottom;
-yytype_int16 *yytop;
+ yytype_int16 *yybottom;
+ yytype_int16 *yytop;
#endif
{
- YYFPRINTF (stderr, "Stack now");
- for (; yybottom <= yytop; yybottom++) {
- int yybot = *yybottom;
- YYFPRINTF (stderr, " %d", yybot);
- }
- YYFPRINTF (stderr, "\n");
+ YYFPRINTF (stderr, "Stack now");
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
+ YYFPRINTF (stderr, "\n");
}
# define YY_STACK_PRINT(Bottom, Top) \
@@ -1009,25 +1016,26 @@ yy_reduce_print (YYSTYPE *yyvsp, int yyrule, uscxml::PromelaParser* ctx, void *
#else
static void
yy_reduce_print (yyvsp, yyrule, ctx, scanner)
-YYSTYPE *yyvsp;
-int yyrule;
-uscxml::PromelaParser* ctx;
-void * scanner;
+ YYSTYPE *yyvsp;
+ int yyrule;
+ uscxml::PromelaParser* ctx;
+ void * scanner;
#endif
{
- int yynrhs = yyr2[yyrule];
- int yyi;
- unsigned long int yylno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
- /* The symbols being reduced. */
- for (yyi = 0; yyi < yynrhs; yyi++) {
- YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , ctx, scanner);
- YYFPRINTF (stderr, "\n");
- }
+ int yynrhs = yyr2[yyrule];
+ int yyi;
+ unsigned long int yylno = yyrline[yyrule];
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
+ yyrule - 1, yylno);
+ /* The symbols being reduced. */
+ for (yyi = 0; yyi < yynrhs; yyi++)
+ {
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+ &(yyvsp[(yyi + 1) - (yynrhs)])
+ , ctx, scanner);
+ YYFPRINTF (stderr, "\n");
+ }
}
# define YY_REDUCE_PRINT(Rule) \
@@ -1078,13 +1086,13 @@ yystrlen (const char *yystr)
#else
static YYSIZE_T
yystrlen (yystr)
-const char *yystr;
+ const char *yystr;
#endif
{
- YYSIZE_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
+ YYSIZE_T yylen;
+ for (yylen = 0; yystr[yylen]; yylen++)
+ continue;
+ return yylen;
}
# endif
# endif
@@ -1102,17 +1110,17 @@ yystpcpy (char *yydest, const char *yysrc)
#else
static char *
yystpcpy (yydest, yysrc)
-char *yydest;
-const char *yysrc;
+ char *yydest;
+ const char *yysrc;
#endif
{
- char *yyd = yydest;
- const char *yys = yysrc;
+ char *yyd = yydest;
+ const char *yys = yysrc;
- while ((*yyd++ = *yys++) != '\0')
- continue;
+ while ((*yyd++ = *yys++) != '\0')
+ continue;
- return yyd - 1;
+ return yyd - 1;
}
# endif
# endif
@@ -1126,40 +1134,42 @@ const char *yysrc;
null, do not copy; instead, return the length of what the result
would have been. */
static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr) {
- if (*yystr == '"') {
- YYSIZE_T yyn = 0;
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp) {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
-do_not_strip_quotes:
- ;
- }
-
- if (! yyres)
- return yystrlen (yystr);
-
- return yystpcpy (yyres, yystr) - yyres;
+yytnamerr (char *yyres, const char *yystr)
+{
+ if (*yystr == '"')
+ {
+ YYSIZE_T yyn = 0;
+ char const *yyp = yystr;
+
+ for (;;)
+ switch (*++yyp)
+ {
+ case '\'':
+ case ',':
+ goto do_not_strip_quotes;
+
+ case '\\':
+ if (*++yyp != '\\')
+ goto do_not_strip_quotes;
+ /* Fall through. */
+ default:
+ if (yyres)
+ yyres[yyn] = *yyp;
+ yyn++;
+ break;
+
+ case '"':
+ if (yyres)
+ yyres[yyn] = '\0';
+ return yyn;
+ }
+ do_not_strip_quotes: ;
+ }
+
+ if (! yyres)
+ return yystrlen (yystr);
+
+ return yystpcpy (yyres, yystr) - yyres;
}
# endif
@@ -1173,123 +1183,133 @@ do_not_strip_quotes:
required number of bytes is too large to store. */
static int
yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
- yytype_int16 *yyssp, int yytoken) {
- YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
- YYSIZE_T yysize = yysize0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- /* Internationalized format string. */
- const char *yyformat = YY_NULL;
- /* Arguments of yyformat. */
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- /* Number of reported tokens (one for the "unexpected", one per
- "expected"). */
- int yycount = 0;
-
- /* There are many possibilities here to consider:
- - Assume YYFAIL is not used. It's too flawed to consider. See
- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
- for details. YYERROR is fine as it does not invoke this
- function.
- - If this state is a consistent state with a default action, then
- the only way this function was invoked is if the default action
- is an error action. In that case, don't check for expected
- tokens because there are none.
- - The only way there can be no lookahead present (in yychar) is if
- this state is a consistent state with a default action. Thus,
- detecting the absence of a lookahead is sufficient to determine
- that there is no unexpected or expected token to report. In that
- case, just report a simple "syntax error".
- - Don't assume there isn't a lookahead just because this state is a
- consistent state with a default action. There might have been a
- previous inconsistent state, consistent state with a non-default
- action, or user semantic action that manipulated yychar.
- - Of course, the expected token list depends on states to have
- correct lookahead information, and it depends on the parser not
- to perform extra reductions after fetching a lookahead from the
- scanner and before detecting a syntax error. Thus, state merging
- (from LALR or IELR) and default reductions corrupt the expected
- token list. However, the list is correct for canonical LR with
- one exception: it will still contain any token that will not be
- accepted due to an error action in a later state.
- */
- if (yytoken != YYEMPTY) {
- int yyn = yypact[*yyssp];
- yyarg[yycount++] = yytname[yytoken];
- if (!yypact_value_is_default (yyn)) {
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. In other words, skip the first -YYN actions for
- this state because they are default actions. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yyx;
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
- && !yytable_value_is_error (yytable[yyx + yyn])) {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) {
- yycount = 1;
- yysize = yysize0;
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- {
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
- }
- }
- }
-
- switch (yycount) {
+ yytype_int16 *yyssp, int yytoken)
+{
+ YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
+ YYSIZE_T yysize = yysize0;
+ enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
+ /* Internationalized format string. */
+ const char *yyformat = YY_NULL;
+ /* Arguments of yyformat. */
+ char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
+ /* Number of reported tokens (one for the "unexpected", one per
+ "expected"). */
+ int yycount = 0;
+
+ /* There are many possibilities here to consider:
+ - Assume YYFAIL is not used. It's too flawed to consider. See
+ <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+ for details. YYERROR is fine as it does not invoke this
+ function.
+ - If this state is a consistent state with a default action, then
+ the only way this function was invoked is if the default action
+ is an error action. In that case, don't check for expected
+ tokens because there are none.
+ - The only way there can be no lookahead present (in yychar) is if
+ this state is a consistent state with a default action. Thus,
+ detecting the absence of a lookahead is sufficient to determine
+ that there is no unexpected or expected token to report. In that
+ case, just report a simple "syntax error".
+ - Don't assume there isn't a lookahead just because this state is a
+ consistent state with a default action. There might have been a
+ previous inconsistent state, consistent state with a non-default
+ action, or user semantic action that manipulated yychar.
+ - Of course, the expected token list depends on states to have
+ correct lookahead information, and it depends on the parser not
+ to perform extra reductions after fetching a lookahead from the
+ scanner and before detecting a syntax error. Thus, state merging
+ (from LALR or IELR) and default reductions corrupt the expected
+ token list. However, the list is correct for canonical LR with
+ one exception: it will still contain any token that will not be
+ accepted due to an error action in a later state.
+ */
+ if (yytoken != YYEMPTY)
+ {
+ int yyn = yypact[*yyssp];
+ yyarg[yycount++] = yytname[yytoken];
+ if (!yypact_value_is_default (yyn))
+ {
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. In other words, skip the first -YYN actions for
+ this state because they are default actions. */
+ int yyxbegin = yyn < 0 ? -yyn : 0;
+ /* Stay within bounds of both yycheck and yytname. */
+ int yychecklim = YYLAST - yyn + 1;
+ int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
+ int yyx;
+
+ for (yyx = yyxbegin; yyx < yyxend; ++yyx)
+ if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
+ && !yytable_value_is_error (yytable[yyx + yyn]))
+ {
+ if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
+ {
+ yycount = 1;
+ yysize = yysize0;
+ break;
+ }
+ yyarg[yycount++] = yytname[yyx];
+ {
+ YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
+ if (! (yysize <= yysize1
+ && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+ }
+ }
+ }
+
+ switch (yycount)
+ {
# define YYCASE_(N, S) \
case N: \
yyformat = S; \
break
- YYCASE_(0, YY_("syntax error"));
- YYCASE_(1, YY_("syntax error, unexpected %s"));
- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
+ YYCASE_(0, YY_("syntax error"));
+ YYCASE_(1, YY_("syntax error, unexpected %s"));
+ YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
+ YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
+ YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
+ YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
# undef YYCASE_
- }
-
- {
- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
-
- if (*yymsg_alloc < yysize) {
- *yymsg_alloc = 2 * yysize;
- if (! (yysize <= *yymsg_alloc
- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
- return 1;
- }
-
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- {
- char *yyp = *yymsg;
- int yyi = 0;
- while ((*yyp = *yyformat) != '\0')
- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyformat += 2;
- } else {
- yyp++;
- yyformat++;
- }
- }
- return 0;
+ }
+
+ {
+ YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
+ if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+ return 2;
+ yysize = yysize1;
+ }
+
+ if (*yymsg_alloc < yysize)
+ {
+ *yymsg_alloc = 2 * yysize;
+ if (! (yysize <= *yymsg_alloc
+ && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
+ *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
+ return 1;
+ }
+
+ /* Avoid sprintf, as that infringes on the user's name space.
+ Don't have undefined behavior even if the translation
+ produced a string with the wrong number of "%s"s. */
+ {
+ char *yyp = *yymsg;
+ int yyi = 0;
+ while ((*yyp = *yyformat) != '\0')
+ if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
+ {
+ yyp += yytnamerr (yyp, yyarg[yyi++]);
+ yyformat += 2;
+ }
+ else
+ {
+ yyp++;
+ yyformat++;
+ }
+ }
+ return 0;
}
#endif /* YYERROR_VERBOSE */
@@ -1305,22 +1325,22 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, uscxml::PromelaPar
#else
static void
yydestruct (yymsg, yytype, yyvaluep, ctx, scanner)
-const char *yymsg;
-int yytype;
-YYSTYPE *yyvaluep;
-uscxml::PromelaParser* ctx;
-void * scanner;
+ const char *yymsg;
+ int yytype;
+ YYSTYPE *yyvaluep;
+ uscxml::PromelaParser* ctx;
+ void * scanner;
#endif
{
- YYUSE (yyvaluep);
- YYUSE (ctx);
- YYUSE (scanner);
+ YYUSE (yyvaluep);
+ YYUSE (ctx);
+ YYUSE (scanner);
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+ if (!yymsg)
+ yymsg = "Deleting";
+ YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
- YYUSE (yytype);
+ YYUSE (yytype);
}
@@ -1338,7 +1358,7 @@ yyparse (void *YYPARSE_PARAM)
#else
int
yyparse (YYPARSE_PARAM)
-void *YYPARSE_PARAM;
+ void *YYPARSE_PARAM;
#endif
#else /* ! YYPARSE_PARAM */
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -1348,17 +1368,17 @@ yyparse (uscxml::PromelaParser* ctx, void * scanner)
#else
int
yyparse (ctx, scanner)
-uscxml::PromelaParser* ctx;
-void * scanner;
+ uscxml::PromelaParser* ctx;
+ void * scanner;
#endif
#endif
{
- /* The lookahead symbol. */
- int yychar;
+/* The lookahead symbol. */
+int yychar;
#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
- /* Suppress an incorrect diagnostic about yylval being uninitialized. */
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
@@ -1366,9 +1386,9 @@ void * scanner;
# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
_Pragma ("GCC diagnostic pop")
#else
- /* Default value used for initialization, for pacifying older GCCs
- or non-GCC compilers. */
- static YYSTYPE yyval_default;
+/* Default value used for initialization, for pacifying older GCCs
+ or non-GCC compilers. */
+static YYSTYPE yyval_default;
# define YY_INITIAL_VALUE(Value) = Value
#endif
#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
@@ -1379,1177 +1399,995 @@ void * scanner;
# define YY_INITIAL_VALUE(Value) /* Nothing. */
#endif
- /* The semantic value of the lookahead symbol. */
- YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
+/* The semantic value of the lookahead symbol. */
+YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
- /* Number of syntax errors so far. */
- int yynerrs;
+ /* Number of syntax errors so far. */
+ int yynerrs;
- int yystate;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
- /* The stacks and their tools:
- `yyss': related to states.
- `yyvs': related to semantic values.
+ /* The stacks and their tools:
+ `yyss': related to states.
+ `yyvs': related to semantic values.
- Refer to the stacks through separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
+ Refer to the stacks through separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss;
- yytype_int16 *yyssp;
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs;
- YYSTYPE *yyvsp;
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
- YYSIZE_T yystacksize;
+ YYSIZE_T yystacksize;
- int yyn;
- int yyresult;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
+ int yyn;
+ int yyresult;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken = 0;
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+ /* Buffer for error messages, and its allocated size. */
+ char yymsgbuf[128];
+ char *yymsg = yymsgbuf;
+ YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
- /* The number of symbols on the RHS of the reduced rule.
- Keep to zero when no symbol should be popped. */
- int yylen = 0;
+ /* The number of symbols on the RHS of the reduced rule.
+ Keep to zero when no symbol should be popped. */
+ int yylen = 0;
- yyssp = yyss = yyssa;
- yyvsp = yyvs = yyvsa;
- yystacksize = YYINITDEPTH;
+ yyssp = yyss = yyssa;
+ yyvsp = yyvs = yyvsa;
+ yystacksize = YYINITDEPTH;
- YYDPRINTF ((stderr, "Starting parse\n"));
+ YYDPRINTF ((stderr, "Starting parse\n"));
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
- goto yysetstate;
+ yystate = 0;
+ yyerrstatus = 0;
+ yynerrs = 0;
+ yychar = YYEMPTY; /* Cause a token to be read. */
+ goto yysetstate;
- /*------------------------------------------------------------.
- | yynewstate -- Push a new state, which is found in yystate. |
- `------------------------------------------------------------*/
-yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. So pushing a state here evens the stacks. */
- yyssp++;
+/*------------------------------------------------------------.
+| yynewstate -- Push a new state, which is found in yystate. |
+`------------------------------------------------------------*/
+ yynewstate:
+ /* In all cases, when you get here, the value and location stacks
+ have just been pushed. So pushing a state here evens the stacks. */
+ yyssp++;
-yysetstate:
- *yyssp = yystate;
+ yysetstate:
+ *yyssp = yystate;
- if (yyss + yystacksize - 1 <= yyssp) {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
+ if (yyss + yystacksize - 1 <= yyssp)
+ {
+ /* Get the current used size of the three stacks, in elements. */
+ YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
- }
+ {
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ YYSTYPE *yyvs1 = yyvs;
+ yytype_int16 *yyss1 = yyss;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+
+ yyss = yyss1;
+ yyvs = yyvs1;
+ }
#else /* no yyoverflow */
# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
+ goto yyexhaustedlab;
# else
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+ /* Extend the stack our own way. */
+ if (YYMAXDEPTH <= yystacksize)
+ goto yyexhaustedlab;
+ yystacksize *= 2;
+ if (YYMAXDEPTH < yystacksize)
+ yystacksize = YYMAXDEPTH;
+
+ {
+ yytype_int16 *yyss1 = yyss;
+ union yyalloc *yyptr =
+ (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+ if (! yyptr)
+ goto yyexhaustedlab;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
+ }
# endif
#endif /* no yyoverflow */
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
+ yyssp = yyss + yysize - 1;
+ yyvsp = yyvs + yysize - 1;
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ YYDPRINTF ((stderr, "Stack size increased to %lu\n",
+ (unsigned long int) yystacksize));
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
- }
+ if (yyss + yystacksize - 1 <= yyssp)
+ YYABORT;
+ }
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
- if (yystate == YYFINAL)
- YYACCEPT;
+ if (yystate == YYFINAL)
+ YYACCEPT;
- goto yybackup;
+ goto yybackup;
- /*-----------.
- | yybackup. |
- `-----------*/
+/*-----------.
+| yybackup. |
+`-----------*/
yybackup:
- /* Do appropriate processing given the current state. Read a
- lookahead token if we need one and don't already have one. */
-
- /* First try to decide what to do without reference to lookahead token. */
- yyn = yypact[yystate];
- if (yypact_value_is_default (yyn))
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
- if (yychar == YYEMPTY) {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- }
-
- if (yychar <= YYEOF) {
- yychar = yytoken = YYEOF;
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- } else {
- yytoken = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0) {
- if (yytable_value_is_error (yyn))
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- /* Shift the lookahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the shifted token. */
- yychar = YYEMPTY;
-
- yystate = yyn;
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-
- goto yynewstate;
-
-
- /*-----------------------------------------------------------.
- | yydefault -- do the default action for the current state. |
- `-----------------------------------------------------------*/
+ /* Do appropriate processing given the current state. Read a
+ lookahead token if we need one and don't already have one. */
+
+ /* First try to decide what to do without reference to lookahead token. */
+ yyn = yypact[yystate];
+ if (yypact_value_is_default (yyn))
+ goto yydefault;
+
+ /* Not known => get a lookahead token if don't already have one. */
+
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
+ if (yychar == YYEMPTY)
+ {
+ YYDPRINTF ((stderr, "Reading a token: "));
+ yychar = YYLEX;
+ }
+
+ if (yychar <= YYEOF)
+ {
+ yychar = yytoken = YYEOF;
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
+ }
+ else
+ {
+ yytoken = YYTRANSLATE (yychar);
+ YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ }
+
+ /* If the proper action on seeing token YYTOKEN is to reduce or to
+ detect an error, take that action. */
+ yyn += yytoken;
+ if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ goto yydefault;
+ yyn = yytable[yyn];
+ if (yyn <= 0)
+ {
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
+ yyn = -yyn;
+ goto yyreduce;
+ }
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+
+ /* Shift the lookahead token. */
+ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
+
+ yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+
+ goto yynewstate;
+
+
+/*-----------------------------------------------------------.
+| yydefault -- do the default action for the current state. |
+`-----------------------------------------------------------*/
yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
+ yyn = yydefact[yystate];
+ if (yyn == 0)
+ goto yyerrlab;
+ goto yyreduce;
- /*-----------------------------.
- | yyreduce -- Do a reduction. |
- `-----------------------------*/
+/*-----------------------------.
+| yyreduce -- Do a reduction. |
+`-----------------------------*/
yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
+ /* yyn is the number of a rule to reduce with. */
+ yylen = yyr2[yyn];
- /* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
+ /* If YYLEN is nonzero, implement the default value of the action:
+ `$$ = $1'.
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
+ Otherwise, the following line sets YYVAL to garbage.
+ This behavior is undocumented and Bison
+ users should not rely upon it. Assigning to YYVAL
+ unconditionally makes the parser a bit smaller, and it avoids a
+ GCC warning that YYVAL may be used uninitialized. */
+ yyval = yyvsp[1-yylen];
- YY_REDUCE_PRINT (yyn);
- switch (yyn) {
- case 2:
- /* Line 1787 of yacc.c */
+ YY_REDUCE_PRINT (yyn);
+ switch (yyn)
+ {
+ case 2:
+/* Line 1787 of yacc.c */
#line 84 "promela.ypp"
- {
- ctx->ast = (yyvsp[(1) - (1)].node);
- ctx->type = PromelaParser::PROMELA_DECL;
- }
- break;
-
- case 3:
- /* Line 1787 of yacc.c */
+ {
+ ctx->ast = (yyvsp[(1) - (1)].node);
+ ctx->type = PromelaParser::PROMELA_DECL;
+ }
+ break;
+
+ case 3:
+/* Line 1787 of yacc.c */
#line 88 "promela.ypp"
- {
- ctx->ast = (yyvsp[(1) - (1)].node);
- ctx->type = PromelaParser::PROMELA_EXPR;
- }
- break;
-
- case 4:
- /* Line 1787 of yacc.c */
+ {
+ ctx->ast = (yyvsp[(1) - (1)].node);
+ ctx->type = PromelaParser::PROMELA_EXPR;
+ }
+ break;
+
+ case 4:
+/* Line 1787 of yacc.c */
#line 92 "promela.ypp"
- {
- ctx->ast = (yyvsp[(1) - (1)].node);
- ctx->type = PromelaParser::PROMELA_STMNT;
- }
- break;
-
- case 5:
- /* Line 1787 of yacc.c */
+ {
+ ctx->ast = (yyvsp[(1) - (1)].node);
+ ctx->type = PromelaParser::PROMELA_STMNT;
+ }
+ break;
+
+ case 5:
+/* Line 1787 of yacc.c */
#line 98 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
+ { (yyval.node) = (yyvsp[(1) - (1)].node); }
+ break;
- case 6:
- /* Line 1787 of yacc.c */
+ 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));
- }
- break;
+ { (yyval.node) = ctx->value(PML_NAME, (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
+ break;
- case 7:
- /* Line 1787 of yacc.c */
+ 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));
- }
- break;
+ { (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)); }
+ break;
- case 8:
- /* Line 1787 of yacc.c */
+ case 8:
+/* Line 1787 of yacc.c */
#line 106 "promela.ypp"
- {
- if ((yyvsp[(2) - (2)].node) != NULL) {
- if ((yyvsp[(2) - (2)].node)->type == PML_CMPND) {
- (yyval.node) = ctx->node(PML_CMPND, 1, (yyvsp[(1) - (2)].node));
- (yyval.node)->merge((yyvsp[(2) - (2)].node));
- delete (yyvsp[(2) - (2)].node);
- } else {
- (yyval.node) = ctx->node(PML_CMPND, 2, (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node));
+ {
+ if ((yyvsp[(2) - (2)].node) != NULL) {
+ if ((yyvsp[(2) - (2)].node)->type == PML_CMPND) {
+ (yyval.node) = ctx->node(PML_CMPND, 1, (yyvsp[(1) - (2)].node));
+ (yyval.node)->merge((yyvsp[(2) - (2)].node)); delete (yyvsp[(2) - (2)].node);
+ } else {
+ (yyval.node) = ctx->node(PML_CMPND, 2, (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node));
+ }
+ } else {
+ (yyval.node) = (yyvsp[(1) - (2)].node);
+ }
}
- } else {
- /* $$ = ctx->node(PML_CMPND, 1, $1);*/
- (yyval.node) = (yyvsp[(1) - (2)].node);
- }
- /* if ($2 != NULL) {
- $$ = ctx->node(PML_CMPND, 1, $1);
- if ($2->operands.size() > 0) {
- $$->merge($2);
- delete $2;
- } else {
- $$->push($2);
- }
- } else {
- $$ = $1;
- }
- */
- }
- break;
-
- case 9:
- /* Line 1787 of yacc.c */
+ break;
+
+ case 9:
+/* Line 1787 of yacc.c */
+#line 120 "promela.ypp"
+ { (yyval.node) = NULL; }
+ break;
+
+ case 10:
+/* Line 1787 of yacc.c */
+#line 121 "promela.ypp"
+ { (yyval.node) = (yyvsp[(2) - (2)].node); }
+ break;
+
+ case 11:
+/* Line 1787 of yacc.c */
+#line 131 "promela.ypp"
+ { (yyval.node) = (yyvsp[(2) - (3)].node); }
+ break;
+
+ case 12:
+/* Line 1787 of yacc.c */
#line 132 "promela.ypp"
- {
- (yyval.node) = NULL;
- }
- break;
+ { (yyval.node) = ctx->node(PML_PLUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
+ break;
- case 10:
- /* Line 1787 of yacc.c */
+ case 13:
+/* Line 1787 of yacc.c */
#line 133 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(2) - (2)].node);
- }
- break;
-
- case 11:
- /* Line 1787 of yacc.c */
+ { (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"
+ { (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"
+ { (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"
+ { (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"
+ { (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"
+ { (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"
+ { (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"
+ { (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"
+ { (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"
+ { (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"
- {
- (yyval.node) = (yyvsp[(2) - (3)].node);
- }
- break;
+ { (yyval.node) = ctx->node(PML_LE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
+ break;
- case 12:
- /* Line 1787 of yacc.c */
+ case 24:
+/* Line 1787 of yacc.c */
#line 144 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_PLUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
+ { (yyval.node) = ctx->node(PML_EQ, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
+ break;
- case 13:
- /* Line 1787 of yacc.c */
+ case 25:
+/* Line 1787 of yacc.c */
#line 145 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_MINUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
+ { (yyval.node) = ctx->node(PML_NE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
+ break;
- case 14:
- /* Line 1787 of yacc.c */
+ case 26:
+/* Line 1787 of yacc.c */
#line 146 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_TIMES, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
+ { (yyval.node) = ctx->node(PML_AND, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
+ break;
- case 15:
- /* Line 1787 of yacc.c */
+ case 27:
+/* Line 1787 of yacc.c */
#line 147 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_DIVIDE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
+ { (yyval.node) = ctx->node(PML_OR, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
+ break;
- case 16:
- /* Line 1787 of yacc.c */
+ case 28:
+/* Line 1787 of yacc.c */
#line 148 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_MODULO, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
+ { (yyval.node) = ctx->node(PML_LSHIFT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
+ break;
- case 17:
- /* Line 1787 of yacc.c */
+ case 29:
+/* Line 1787 of yacc.c */
#line 149 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_BITAND, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
+ { (yyval.node) = ctx->node(PML_RSHIFT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
+ break;
- case 18:
- /* Line 1787 of yacc.c */
+ case 30:
+/* Line 1787 of yacc.c */
#line 150 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_BITXOR, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
+ { (yyval.node) = ctx->node(PML_NEG, 1, (yyvsp[(2) - (2)].node)); }
+ break;
- case 19:
- /* Line 1787 of yacc.c */
+ case 31:
+/* Line 1787 of yacc.c */
#line 151 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_BITOR, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
+ { (yyval.node) = ctx->node(PML_MINUS, 1, (yyvsp[(2) - (2)].node)); }
+ break;
- case 20:
- /* Line 1787 of yacc.c */
-#line 152 "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 */
+ case 32:
+/* Line 1787 of yacc.c */
#line 153 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_LT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
+ { (yyval.node) = ctx->node(PML_LEN, 1, (yyvsp[(3) - (4)].node)); }
+ break;
- case 22:
- /* Line 1787 of yacc.c */
+ case 33:
+/* Line 1787 of yacc.c */
#line 154 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_GE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
+ { (yyval.node) = (yyvsp[(1) - (1)].node); }
+ break;
- case 23:
- /* Line 1787 of yacc.c */
+ case 34:
+/* Line 1787 of yacc.c */
#line 155 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_LE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
+ { (yyval.node) = ctx->value(PML_CONST, (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
+ break;
- case 24:
- /* Line 1787 of yacc.c */
+ case 35:
+/* Line 1787 of yacc.c */
#line 156 "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 157 "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 158 "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 159 "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 160 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_LSHIFT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
+ {
+ /* Non standard promela for string literals */
+ (yyval.node) = ctx->value(PML_STRING, (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
+ break;
- case 29:
- /* Line 1787 of yacc.c */
-#line 161 "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 */
+ case 36:
+/* Line 1787 of yacc.c */
#line 162 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_NEG, 1, (yyvsp[(2) - (2)].node));
- }
- break;
+ { (yyval.node) = ctx->node(PML_SHOW, 0); }
+ break;
- case 31:
- /* Line 1787 of yacc.c */
+ case 37:
+/* Line 1787 of yacc.c */
#line 163 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_MINUS, 1, (yyvsp[(2) - (2)].node));
- }
- break;
-
- case 32:
- /* Line 1787 of yacc.c */
-#line 165 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_LEN, 1, (yyvsp[(3) - (4)].node));
- }
- break;
+ { (yyval.node) = ctx->node(PML_HIDDEN, 0); }
+ break;
- case 33:
- /* Line 1787 of yacc.c */
-#line 166 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
+ case 38:
+/* Line 1787 of yacc.c */
+#line 164 "promela.ypp"
+ { (yyval.node) = ctx->node(PML_SHOW, 0); }
+ break;
- case 34:
- /* Line 1787 of yacc.c */
-#line 167 "promela.ypp"
- {
- (yyval.node) = ctx->value(PML_CONST, (yyvsp[(1) - (1)].value));
- free((yyvsp[(1) - (1)].value));
- }
- break;
+ case 39:
+/* Line 1787 of yacc.c */
+#line 165 "promela.ypp"
+ { (yyval.node) = ctx->node(PML_ISLOCAL, 0); }
+ break;
- case 35:
- /* Line 1787 of yacc.c */
+ case 40:
+/* Line 1787 of yacc.c */
#line 168 "promela.ypp"
- {
- /* Non standard promela for string literals */
- (yyval.node) = ctx->value(PML_STRING, (yyvsp[(1) - (1)].value));
- free((yyvsp[(1) - (1)].value));
- }
- break;
-
- case 36:
- /* Line 1787 of yacc.c */
+ { (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)); }
+ break;
+
+ case 41:
+/* Line 1787 of yacc.c */
+#line 169 "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)); }
+ break;
+
+ case 43:
+/* Line 1787 of yacc.c */
+#line 171 "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_SHOW, 0);
- }
- break;
+ { (yyval.node) = ctx->node(PML_TYPEDEF, 2, ctx->value(PML_NAME, (yyvsp[(2) - (5)].value)), (yyvsp[(4) - (5)].node)); }
+ break;
- case 37:
- /* Line 1787 of yacc.c */
-#line 175 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_HIDDEN, 0);
- }
- break;
-
- case 38:
- /* Line 1787 of yacc.c */
-#line 176 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_SHOW, 0);
- }
- break;
-
- case 39:
- /* Line 1787 of yacc.c */
+ case 45:
+/* Line 1787 of yacc.c */
#line 177 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_ISLOCAL, 0);
- }
- break;
-
- case 40:
- /* Line 1787 of yacc.c */
-#line 180 "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));
- }
- break;
-
- case 41:
- /* Line 1787 of yacc.c */
-#line 181 "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 182 "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));
- }
- break;
-
- case 43:
- /* Line 1787 of yacc.c */
-#line 183 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(2) - (2)].node);
- }
- break;
-
- case 44:
- /* Line 1787 of yacc.c */
-#line 186 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_TYPEDEF, 2, ctx->value(PML_NAME, (yyvsp[(2) - (5)].value)), (yyvsp[(4) - (5)].node));
- }
- break;
-
- case 45:
- /* Line 1787 of yacc.c */
+ { (yyval.node) = (yyvsp[(1) - (1)].node); }
+ break;
+
+ case 46:
+/* Line 1787 of yacc.c */
+#line 178 "promela.ypp"
+ { (yyval.node) = (yyvsp[(1) - (2)].node); }
+ break;
+
+ case 47:
+/* Line 1787 of yacc.c */
+#line 179 "promela.ypp"
+ {
+ (yyval.node) = ctx->node(PML_DECLLIST, 1, (yyvsp[(1) - (3)].node));
+ if((yyvsp[(3) - (3)].node)->type == PML_DECLLIST) {
+ (yyval.node)->merge((yyvsp[(3) - (3)].node)); delete (yyvsp[(3) - (3)].node);
+ } else {
+ (yyval.node)->push((yyvsp[(3) - (3)].node));
+ }
+ }
+ break;
+
+ case 48:
+/* Line 1787 of yacc.c */
#line 189 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
+ { (yyval.node) = ctx->node(PML_VARLIST, 1, (yyvsp[(1) - (1)].node)); }
+ break;
- case 46:
- /* Line 1787 of yacc.c */
+ case 49:
+/* Line 1787 of yacc.c */
#line 190 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (2)].node);
- }
- break;
-
- case 47:
- /* Line 1787 of yacc.c */
-#line 191 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_DECLLIST, 1, (yyvsp[(1) - (3)].node));
- if((yyvsp[(3) - (3)].node)->type == PML_DECLLIST) {
- (yyval.node)->merge((yyvsp[(3) - (3)].node));
- delete (yyvsp[(3) - (3)].node);
- } else {
- (yyval.node)->push((yyvsp[(3) - (3)].node));
- }
- }
- break;
-
- case 48:
- /* Line 1787 of yacc.c */
-#line 201 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_VARLIST, 1, (yyvsp[(1) - (1)].node));
- }
- break;
-
- case 49:
- /* Line 1787 of yacc.c */
+ { (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"
+ { (yyval.node) = (yyvsp[(1) - (1)].node); }
+ break;
+
+ case 51:
+/* Line 1787 of yacc.c */
+#line 194 "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)); }
+ 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)); }
+ 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)); }
+ break;
+
+ case 55:
+/* Line 1787 of yacc.c */
#line 202 "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 */
+ { (yyval.node) = ctx->value(PML_CONST, (yyvsp[(1) - (1)].value)); free((yyvsp[(1) - (1)].value)); }
+ break;
+
+ case 56:
+/* Line 1787 of yacc.c */
+#line 203 "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"
+ { (yyval.node) = (yyvsp[(2) - (3)].node); }
+ break;
+
+ case 58:
+/* Line 1787 of yacc.c */
#line 205 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
+ { (yyval.node) = ctx->node(PML_PLUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); }
+ break;
- case 51:
- /* Line 1787 of yacc.c */
+ case 59:
+/* Line 1787 of yacc.c */
#line 206 "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 */
+ { (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"
+ { (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"
+ { (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"
- {
- (yyval.node) = ctx->value(PML_NAME, (yyvsp[(1) - (1)].value));
- free((yyvsp[(1) - (1)].value));
- }
- break;
-
- case 53:
- /* Line 1787 of yacc.c */
-#line 210 "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));
- }
- break;
-
- case 54:
- /* Line 1787 of yacc.c */
-#line 211 "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));
- }
- break;
-
- case 55:
- /* Line 1787 of yacc.c */
-#line 214 "promela.ypp"
- {
- (yyval.node) = ctx->value(PML_CONST, (yyvsp[(1) - (1)].value));
- free((yyvsp[(1) - (1)].value));
- }
- break;
-
- case 56:
- /* Line 1787 of yacc.c */
-#line 215 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_MINUS, 1, (yyvsp[(2) - (2)].node));
- }
- break;
-
- case 57:
- /* Line 1787 of yacc.c */
-#line 216 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(2) - (3)].node);
- }
- break;
-
- case 58:
- /* Line 1787 of yacc.c */
-#line 217 "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 218 "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 219 "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 220 "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 221 "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 224 "promela.ypp"
- {
- (yyval.node) = ctx->value(PML_NAME, (yyvsp[(1) - (1)].value));
- free((yyvsp[(1) - (1)].value));
- }
- break;
-
- case 64:
- /* Line 1787 of yacc.c */
+ { (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)); }
+ break;
+
+ case 64:
+/* Line 1787 of yacc.c */
+#line 213 "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)));
+ } else {
+ (yyvsp[(1) - (2)].node)->push(ctx->value(PML_NAME, (yyvsp[(2) - (2)].value)));
+ }
+ free((yyvsp[(2) - (2)].value));
+ }
+ break;
+
+ case 65:
+/* Line 1787 of yacc.c */
+#line 222 "promela.ypp"
+ { (yyval.node) = (yyvsp[(1) - (2)].node); }
+ break;
+
+ case 66:
+/* Line 1787 of yacc.c */
#line 225 "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)));
- } else {
- (yyvsp[(1) - (2)].node)->push(ctx->value(PML_NAME, (yyvsp[(2) - (2)].value)));
- }
- free((yyvsp[(2) - (2)].value));
- }
- break;
-
- case 65:
- /* Line 1787 of yacc.c */
+ { (yyval.node) = (yyvsp[(1) - (1)].node); }
+ break;
+
+ case 67:
+/* Line 1787 of yacc.c */
+#line 226 "promela.ypp"
+ { (yyval.node) = (yyvsp[(1) - (2)].node); }
+ break;
+
+ case 68:
+/* Line 1787 of yacc.c */
+#line 227 "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"
+ { (yyval.node) = (yyvsp[(1) - (1)].node); }
+ break;
+
+ case 70:
+/* Line 1787 of yacc.c */
+#line 233 "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"
- {
- (yyval.node) = (yyvsp[(1) - (2)].node);
- }
- break;
-
- case 66:
- /* Line 1787 of yacc.c */
+ { (yyval.node) = ctx->node(PML_INCR, 1, (yyvsp[(1) - (2)].node)); }
+ break;
+
+ case 72:
+/* Line 1787 of yacc.c */
+#line 235 "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)); }
+ break;
+
+ case 74:
+/* Line 1787 of yacc.c */
#line 237 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
+ { (yyval.node) = ctx->node(PML_PRINT, 1, (yyvsp[(3) - (4)].node)); }
+ break;
- case 67:
- /* Line 1787 of yacc.c */
+ case 75:
+/* Line 1787 of yacc.c */
#line 238 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (2)].node);
- }
- break;
+ { (yyval.node) = ctx->node(PML_PRINT, 1, ctx->value(PML_CONST, (yyvsp[(3) - (4)].value))); free((yyvsp[(3) - (4)].value)); }
+ break;
- case 68:
- /* Line 1787 of yacc.c */
+ case 76:
+/* Line 1787 of yacc.c */
#line 239 "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 242 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
-
- case 70:
- /* Line 1787 of yacc.c */
-#line 245 "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 246 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_INCR, 1, (yyvsp[(1) - (2)].node));
- }
- break;
-
- case 72:
- /* Line 1787 of yacc.c */
+ { (yyval.node) = ctx->node(PML_ASSERT, 1, (yyvsp[(2) - (2)].node)); }
+ break;
+
+ case 77:
+/* Line 1787 of yacc.c */
+#line 240 "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, ""); }
+ break;
+
+ case 79:
+/* Line 1787 of yacc.c */
+#line 244 "promela.ypp"
+ { (yyval.node) = (yyvsp[(2) - (2)].node); }
+ break;
+
+ case 80:
+/* Line 1787 of yacc.c */
#line 247 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_DECR, 1, (yyvsp[(1) - (2)].node));
- }
- break;
+ { (yyval.node) = (yyvsp[(1) - (1)].node); }
+ break;
- case 73:
- /* Line 1787 of yacc.c */
+ case 81:
+/* Line 1787 of yacc.c */
#line 248 "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));
- }
- break;
-
- case 74:
- /* Line 1787 of yacc.c */
-#line 249 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_PRINTM, 1, (yyvsp[(3) - (4)].node));
- }
- break;
-
- case 75:
- /* Line 1787 of yacc.c */
-#line 250 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_PRINTM, 1, ctx->value(PML_CONST, (yyvsp[(3) - (4)].value)));
- free((yyvsp[(3) - (4)].value));
- }
- break;
-
- case 76:
- /* Line 1787 of yacc.c */
-#line 251 "promela.ypp"
- {
- (yyval.node) = ctx->node(PML_ASSERT, 1, (yyvsp[(2) - (2)].node));
- }
- break;
-
- case 77:
- /* Line 1787 of yacc.c */
-#line 252 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
-
- case 78:
- /* Line 1787 of yacc.c */
-#line 253 "promela.ypp"
- { }
- break;
-
- case 79:
- /* Line 1787 of yacc.c */
-#line 253 "promela.ypp"
- { }
- break;
-
- case 80:
- /* Line 1787 of yacc.c */
-#line 256 "promela.ypp"
- { }
- break;
-
- case 81:
- /* Line 1787 of yacc.c */
-#line 257 "promela.ypp"
- { }
- break;
-
- case 82:
- /* Line 1787 of yacc.c */
-#line 260 "promela.ypp"
- {
- (yyval.node) = ctx->value(0, "");
- }
- break;
-
- case 83:
- /* Line 1787 of yacc.c */
-#line 261 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(2) - (2)].node);
- }
- break;
-
- case 84:
- /* Line 1787 of yacc.c */
-#line 264 "promela.ypp"
- {
- (yyval.node) = (yyvsp[(1) - (1)].node);
- }
- break;
-
- case 85:
- /* Line 1787 of yacc.c */
-#line 265 "promela.ypp"
- {
- (yyval.node) = ctx->node(0, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node));
- }
- break;
-
-
- /* Line 1787 of yacc.c */
-#line 2207 "promela.tab.cpp"
- default:
- break;
- }
- /* User semantic actions sometimes alter yychar, and that requires
- that yytoken be updated with the new translation. We take the
- approach of translating immediately before every use of yytoken.
- One alternative is translating here after every semantic action,
- but that translation would be missed if the semantic action invokes
- YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
- if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
- incorrect destructor might then be invoked immediately. In the
- case of YYERROR or YYBACKUP, subsequent parser actions might lead
- to an incorrect destructor call or verbose syntax error message
- before the lookahead is translated. */
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
-
- *++yyvsp = yyval;
-
- /* Now `shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
-
- /*------------------------------------.
- | yyerrlab -- here on detecting error |
- `------------------------------------*/
+ { (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"
+ default: break;
+ }
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
+ YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+
+ *++yyvsp = yyval;
+
+ /* Now `shift' the result of the reduction. Determine what state
+ that goes to, based on the state we popped back to and the rule
+ number reduced by. */
+
+ yyn = yyr1[yyn];
+
+ yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
+ if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yytable[yystate];
+ else
+ yystate = yydefgoto[yyn - YYNTOKENS];
+
+ goto yynewstate;
+
+
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
yyerrlab:
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus) {
- ++yynerrs;
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
+
+ /* If not already recovering from an error, report this error. */
+ if (!yyerrstatus)
+ {
+ ++yynerrs;
#if ! YYERROR_VERBOSE
- yyerror (ctx, scanner, YY_("syntax error"));
+ yyerror (ctx, scanner, YY_("syntax error"));
#else
# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
yyssp, yytoken)
- {
- char const *yymsgp = YY_("syntax error");
- int yysyntax_error_status;
- yysyntax_error_status = YYSYNTAX_ERROR;
- if (yysyntax_error_status == 0)
- yymsgp = yymsg;
- else if (yysyntax_error_status == 1) {
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
- if (!yymsg) {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- yysyntax_error_status = 2;
- } else {
- yysyntax_error_status = YYSYNTAX_ERROR;
- yymsgp = yymsg;
- }
- }
- yyerror (ctx, scanner, yymsgp);
- if (yysyntax_error_status == 2)
- goto yyexhaustedlab;
- }
+ {
+ char const *yymsgp = YY_("syntax error");
+ int yysyntax_error_status;
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ if (yysyntax_error_status == 0)
+ yymsgp = yymsg;
+ else if (yysyntax_error_status == 1)
+ {
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
+ yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
+ if (!yymsg)
+ {
+ yymsg = yymsgbuf;
+ yymsg_alloc = sizeof yymsgbuf;
+ yysyntax_error_status = 2;
+ }
+ else
+ {
+ yysyntax_error_status = YYSYNTAX_ERROR;
+ yymsgp = yymsg;
+ }
+ }
+ yyerror (ctx, scanner, yymsgp);
+ if (yysyntax_error_status == 2)
+ goto yyexhaustedlab;
+ }
# undef YYSYNTAX_ERROR
#endif
- }
+ }
- if (yyerrstatus == 3) {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
+ if (yyerrstatus == 3)
+ {
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
- if (yychar <= YYEOF) {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- } else {
- yydestruct ("Error: discarding",
- yytoken, &yylval, ctx, scanner);
- yychar = YYEMPTY;
- }
+ if (yychar <= YYEOF)
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
+ else
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval, ctx, scanner);
+ yychar = YYEMPTY;
}
+ }
- /* Else will try to reuse lookahead token after shifting the error
- token. */
- goto yyerrlab1;
+ /* Else will try to reuse lookahead token after shifting the error
+ token. */
+ goto yyerrlab1;
- /*---------------------------------------------------.
- | yyerrorlab -- error raised explicitly by YYERROR. |
- `---------------------------------------------------*/
+/*---------------------------------------------------.
+| yyerrorlab -- error raised explicitly by YYERROR. |
+`---------------------------------------------------*/
yyerrorlab:
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
+ /* Pacify compilers like GCC when the user code never invokes
+ YYERROR and the label yyerrorlab therefore never appears in user
+ code. */
+ if (/*CONSTCOND*/ 0)
+ goto yyerrorlab;
- /* Do not reclaim the symbols of the rule which action triggered
- this YYERROR. */
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
- yystate = *yyssp;
- goto yyerrlab1;
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYERROR. */
+ YYPOPSTACK (yylen);
+ yylen = 0;
+ YY_STACK_PRINT (yyss, yyssp);
+ yystate = *yyssp;
+ goto yyerrlab1;
- /*-------------------------------------------------------------.
- | yyerrlab1 -- common code for both syntax error and YYERROR. |
- `-------------------------------------------------------------*/
+/*-------------------------------------------------------------.
+| yyerrlab1 -- common code for both syntax error and YYERROR. |
+`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;) {
- yyn = yypact[yystate];
- if (!yypact_value_is_default (yyn)) {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
-
- yydestruct ("Error: popping",
- yystos[yystate], yyvsp, ctx, scanner);
- YYPOPSTACK (1);
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[yystate];
+ if (!yypact_value_is_default (yyn))
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
}
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
+ /* Pop the current state because it cannot handle the error token. */
+ if (yyssp == yyss)
+ YYABORT;
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+ yydestruct ("Error: popping",
+ yystos[yystate], yyvsp, ctx, scanner);
+ YYPOPSTACK (1);
+ yystate = *yyssp;
+ YY_STACK_PRINT (yyss, yyssp);
+ }
- yystate = yyn;
- goto yynewstate;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ *++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
- /*-------------------------------------.
- | yyacceptlab -- YYACCEPT comes here. |
- `-------------------------------------*/
+ /* Shift the error token. */
+ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+
+ yystate = yyn;
+ goto yynewstate;
+
+
+/*-------------------------------------.
+| yyacceptlab -- YYACCEPT comes here. |
+`-------------------------------------*/
yyacceptlab:
- yyresult = 0;
- goto yyreturn;
+ yyresult = 0;
+ goto yyreturn;
- /*-----------------------------------.
- | yyabortlab -- YYABORT comes here. |
- `-----------------------------------*/
+/*-----------------------------------.
+| yyabortlab -- YYABORT comes here. |
+`-----------------------------------*/
yyabortlab:
- yyresult = 1;
- goto yyreturn;
+ yyresult = 1;
+ goto yyreturn;
#if !defined yyoverflow || YYERROR_VERBOSE
- /*-------------------------------------------------.
- | yyexhaustedlab -- memory exhaustion comes here. |
- `-------------------------------------------------*/
+/*-------------------------------------------------.
+| yyexhaustedlab -- memory exhaustion comes here. |
+`-------------------------------------------------*/
yyexhaustedlab:
- yyerror (ctx, scanner, YY_("memory exhausted"));
- yyresult = 2;
- /* Fall through. */
+ yyerror (ctx, scanner, YY_("memory exhausted"));
+ yyresult = 2;
+ /* Fall through. */
#endif
yyreturn:
- if (yychar != YYEMPTY) {
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = YYTRANSLATE (yychar);
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, ctx, scanner);
- }
- /* Do not reclaim the symbols of the rule which action triggered
- this YYABORT or YYACCEPT. */
- YYPOPSTACK (yylen);
- YY_STACK_PRINT (yyss, yyssp);
- while (yyssp != yyss) {
- yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, ctx, scanner);
- YYPOPSTACK (1);
- }
+ if (yychar != YYEMPTY)
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval, ctx, scanner);
+ }
+ /* Do not reclaim the symbols of the rule which action triggered
+ this YYABORT or YYACCEPT. */
+ YYPOPSTACK (yylen);
+ YY_STACK_PRINT (yyss, yyssp);
+ while (yyssp != yyss)
+ {
+ yydestruct ("Cleanup: popping",
+ yystos[*yyssp], yyvsp, ctx, scanner);
+ YYPOPSTACK (1);
+ }
#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
+ if (yyss != yyssa)
+ YYSTACK_FREE (yyss);
#endif
#if YYERROR_VERBOSE
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
+ if (yymsg != yymsgbuf)
+ YYSTACK_FREE (yymsg);
#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
+ /* Make sure YYID is used. */
+ return YYID (yyresult);
}
/* Line 2050 of yacc.c */
-#line 269 "promela.ypp"
+#line 252 "promela.ypp"
diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.ypp b/src/uscxml/plugins/datamodel/promela/parser/promela.ypp
index 45767ed..8e87c75 100644
--- a/src/uscxml/plugins/datamodel/promela/parser/promela.ypp
+++ b/src/uscxml/plugins/datamodel/promela/parser/promela.ypp
@@ -234,15 +234,10 @@ 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_PRINTM '(' varref ')' { $$ = ctx->node(PML_PRINTM, 1, $3); }
- | PML_PRINTM '(' PML_CONST ')' { $$ = ctx->node(PML_PRINTM, 1, ctx->value(PML_CONST, $3)); 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_ASSERT expr { $$ = ctx->node(PML_ASSERT, 1, $2); }
| expr { $$ = $1; }
- | varref PML_ASGN PML_INAME { } '(' args ')' Stmnt { }
- ;
-
-args : /* empty */ { }
- | arg { }
;
prargs : /* empty */ { $$ = ctx->value(0, ""); }
diff --git a/src/uscxml/transform/ChartToFSM.cpp b/src/uscxml/transform/ChartToFSM.cpp
index c5ddd80..8d286a7 100644
--- a/src/uscxml/transform/ChartToFSM.cpp
+++ b/src/uscxml/transform/ChartToFSM.cpp
@@ -90,22 +90,40 @@ for (int i = 0; i < contents.size(); i++) { \
std::cerr << ")";
-uint64_t Complexity::stateMachineComplexity(const Arabica::DOM::Element<std::string>& root) {
+uint64_t Complexity::stateMachineComplexity(const Arabica::DOM::Element<std::string>& root, Variant variant) {
Complexity complexity = calculateStateMachineComplexity(root);
uint64_t value = complexity.value;
- for (std::list<uint64_t>::const_iterator histIter = complexity.history.begin(); histIter != complexity.history.end(); histIter++) {
- value *= *histIter;
+
+ if (variant != IGNORE_HISTORY_AND_NESTED_DATA && variant != IGNORE_HISTORY) {
+ for (std::list<uint64_t>::const_iterator histIter = complexity.history.begin(); histIter != complexity.history.end(); histIter++) {
+ value *= *histIter;
+ }
}
-
+
+ if (variant != IGNORE_HISTORY_AND_NESTED_DATA && variant != IGNORE_NESTED_DATA) {
+ bool ignoreNestedData = false;
+ if (root.getLocalName() == "scxml" && (!HAS_ATTR_CAST(root, "binding") || boost::to_lower_copy(ATTR_CAST(root, "binding")) == "early")) {
+ ignoreNestedData = true;
+ }
+
+ if (!ignoreNestedData) {
+ uint64_t power = complexity.nestedData;
+ while(power--) {
+ value *= 2;
+ }
+ }
+ }
+
return value;
}
-
+
Complexity Complexity::calculateStateMachineComplexity(const Arabica::DOM::Element<std::string>& root) {
Complexity complexity;
bool hasFlatHistory = false;
bool hasDeepHistory = false;
-
+ bool hasNestedData = false;
+
Arabica::DOM::NodeList<std::string> childElems = root.getChildNodes();
for (int i = 0; i < childElems.getLength(); i++) {
if (childElems.item(i).getNodeType() != Node_base::ELEMENT_NODE)
@@ -118,8 +136,18 @@ Complexity Complexity::calculateStateMachineComplexity(const Arabica::DOM::Eleme
hasFlatHistory = true;
}
}
+ if (!hasNestedData && childElem.getLocalName() == "datamodel") {
+ Arabica::DOM::NodeList<std::string> dataElemChilds = childElem.getChildNodes();
+ for (int j = 0; j < dataElemChilds.getLength(); j++) {
+ if (dataElemChilds.item(j).getLocalName() == "data")
+ hasNestedData = true;
+ }
+ }
}
+ if (hasNestedData)
+ complexity.nestedData++;
+
if (InterpreterImpl::isCompound(root) || TAGNAME(root) == "scxml") {
// compounds can be in any of the child state -> add
NodeSet<std::string> childs = InterpreterImpl::getChildStates(root);
@@ -217,6 +245,7 @@ InterpreterState ChartToFSM::interpret() {
uint64_t complexity = Complexity::stateMachineComplexity(_scxml) + 1;
std::cerr << "Approximate Complexity: " << complexity << std::endl;
+ std::cerr << "Approximate Active Complexity: " << Complexity::stateMachineComplexity(_scxml, Complexity::IGNORE_HISTORY_AND_NESTED_DATA) + 1 << std::endl;
if (complexity > 1000) {
_skipEventChainCalculations = true;
@@ -252,6 +281,11 @@ InterpreterState ChartToFSM::interpret() {
}
}
+ // identify all history elements
+ NodeSet<std::string> histories = filterChildElements(_nsInfo.xmlNSPrefix + "history", _scxml, true);
+ for (int i = 0; i < histories.size(); i++) {
+ _historyTargets[ATTR_CAST(histories[i], "id")] = Element<std::string>(histories[i]);
+ }
_binding = (HAS_ATTR(_scxml, "binding") && iequals(ATTR(_scxml, "binding"), "late") ? LATE : EARLY);
@@ -341,6 +375,7 @@ InterpreterState ChartToFSM::interpret() {
enterStates(initialTransitions);
globalTransition->destination = FlatStateIdentifier::toStateId(_configuration);
+ globalTransition->activeDestination = globalTransition->destination;
explode();
@@ -355,8 +390,13 @@ InterpreterState ChartToFSM::interpret() {
#endif
std::cerr << "Actual Complexity: " << _globalConf.size() << std::endl;
+ std::cerr << "Actual Active Complexity: " << _activeConf.size() << std::endl;
std::cerr << "Internal Queue: " << _maxEventRaisedChain << std::endl;
std::cerr << "External Queue: " << _maxEventSentChain << std::endl;
+
+ if (complexity < _globalConf.size())
+ throw std::runtime_error("Upper bound for states exceeded");
+
return _state;
}
@@ -839,14 +879,16 @@ void ChartToFSM::explode() {
_globalConf[globalState->stateId] = globalState;
_globalConf[globalState->stateId]->index = _lastStateIndex++;
- if(_globalConf[globalState->stateId]->isFinal)
+ if(_globalConf[globalState->stateId]->isFinal) {
+ _activeConf[globalState->activeId] = globalState; // remember as active configuration
continue; // done in this branch
+ }
- if (_transPerActiveConf.find(globalState->activeId) != _transPerActiveConf.end()) {
+ if (_activeConf.find(globalState->activeId) != _activeConf.end()) {
// we already know these transition sets, just copy over
- std::list<GlobalTransition*>::iterator sortTransIter = _transPerActiveConf[globalState->activeId]->sortedOutgoing.begin();
- while(sortTransIter != _transPerActiveConf[globalState->activeId]->sortedOutgoing.end()) {
- globalState->sortedOutgoing.push_back(new GlobalTransition(**sortTransIter)); // copy constructor
+ std::list<GlobalTransition*>::iterator sortTransIter = _activeConf[globalState->activeId]->sortedOutgoing.begin();
+ while(sortTransIter != _activeConf[globalState->activeId]->sortedOutgoing.end()) {
+ globalState->sortedOutgoing.push_back(GlobalTransition::copyWithoutExecContent(*sortTransIter));
globalState->sortedOutgoing.back()->index = _lastTransIndex++;
_perfTransUsed++;
sortTransIter++;
@@ -859,7 +901,7 @@ void ChartToFSM::explode() {
std::map<std::string, GlobalTransition*> transitionSets;
getPotentialTransitionsForConf(refsToStates(globalState->activeStatesRefs), transitionSets);
- // TODO: reduce and sort transition sets
+ // reduce and sort transition sets
for(std::map<std::string, GlobalTransition*>::iterator transSetIter = transitionSets.begin();
transSetIter != transitionSets.end();
transSetIter++) {
@@ -872,7 +914,7 @@ void ChartToFSM::explode() {
// unique is not quite like what we need, but it was a start
globalState->sortedOutgoing = reapplyUniquePredicates(globalState->sortedOutgoing);
- _transPerActiveConf[globalState->activeId] = globalState;
+ _activeConf[globalState->activeId] = globalState;
}
// take every transition set and append resulting new state
@@ -919,7 +961,7 @@ void ChartToFSM::explode() {
// remember that the last transition lead here
outgoingTrans->destination = statesRemaining.back().second->stateId;
-
+ outgoingTrans->activeDestination = statesRemaining.back().second->activeId;
// reset state for next transition set
_configuration = globalState->getActiveStates();
_alreadyEntered = globalState->getAlreadyEnteredStates();
@@ -1084,6 +1126,14 @@ GlobalState::GlobalState(const Arabica::XPath::NodeSet<std::string>& activeState
activeId = flatStateId.getFlatActive();
}
+GlobalTransition* GlobalTransition::copyWithoutExecContent(GlobalTransition* other) {
+ GlobalTransition* newTrans = new GlobalTransition(*other);
+ newTrans->actions.clear();
+ newTrans->historyBase = other;
+ other->historyTrans.push_back(newTrans);
+ return newTrans;
+}
+
GlobalTransition::GlobalTransition(const Arabica::XPath::NodeSet<std::string>& transitionSet, DataModel dataModel, ChartToFSM* flattener) {
interpreter = flattener;
@@ -1091,6 +1141,7 @@ GlobalTransition::GlobalTransition(const Arabica::XPath::NodeSet<std::string>& t
eventsSent = 0;
eventsChainRaised = 0;
eventsChainSent = 0;
+ historyBase = NULL;
for (int i = 0; i < transitionSet.size(); i++) {
transitionRefs.insert(strTo<int>(ATTR_CAST(transitionSet[i], "index")));
@@ -1192,7 +1243,7 @@ GlobalTransition::GlobalTransition(const Arabica::XPath::NodeSet<std::string>& t
eventDesc = "*";
}
- // extract conditions
+ // extract conditions and history targets
std::list<std::string> conditions;
for (int i = 0; i < transitionSet.size(); i++) {
Arabica::DOM::Element<std::string> transElem = Arabica::DOM::Element<std::string>(transitionSet[i]);
@@ -1200,6 +1251,17 @@ GlobalTransition::GlobalTransition(const Arabica::XPath::NodeSet<std::string>& t
if (HAS_ATTR(transElem, "cond")) {
conditions.push_back(ATTR(transElem, "cond"));
}
+
+ std::list<std::string> targets = InterpreterImpl::tokenizeIdRefs(ATTR(transElem, "target"));
+ std::list<std::string>::iterator targetIter = targets.begin();
+ while(targetIter != targets.end()) {
+// std::cout << "// " << *targetIter << std::endl;
+ if (flattener->_historyTargets.find(*targetIter) != flattener->_historyTargets.end()) {
+ histTargets.insert(*targetIter);
+ }
+ targetIter++;
+ }
+// std::cout << std::endl << std::endl;
}
int index = 0;
diff --git a/src/uscxml/transform/ChartToFSM.h b/src/uscxml/transform/ChartToFSM.h
index f5d7c50..f8dad5a 100644
--- a/src/uscxml/transform/ChartToFSM.h
+++ b/src/uscxml/transform/ChartToFSM.h
@@ -35,27 +35,38 @@ class ChartToFSM;
class USCXML_API Complexity {
public:
- Complexity() : value(0) {}
- Complexity(uint64_t value) : value(value) {}
+
+ enum Variant {
+ IGNORE_NOTHING,
+ IGNORE_HISTORY,
+ IGNORE_NESTED_DATA,
+ IGNORE_HISTORY_AND_NESTED_DATA,
+ };
+
+ Complexity() : value(0), nestedData(0) {}
+ Complexity(uint64_t value) : value(value), nestedData(0) {}
Complexity& operator+=(const Complexity& rhs) {
value += rhs.value;
+ nestedData += rhs.nestedData;
history.insert(history.end(), rhs.history.begin(), rhs.history.end());
return *this;
}
Complexity& operator*=(const Complexity& rhs) {
value *= rhs.value;
+ nestedData += rhs.nestedData;
history.insert(history.end(), rhs.history.begin(), rhs.history.end());
return *this;
}
- static uint64_t stateMachineComplexity(const Arabica::DOM::Element<std::string>& root);
+ static uint64_t stateMachineComplexity(const Arabica::DOM::Element<std::string>& root, Complexity::Variant variant = IGNORE_NOTHING);
protected:
static Complexity calculateStateMachineComplexity(const Arabica::DOM::Element<std::string>& root);
uint64_t value;
+ uint64_t nestedData;
std::list<uint64_t> history;
};
@@ -92,6 +103,33 @@ class USCXML_API GlobalTransition {
public:
class Action {
public:
+ bool operator<(const Action& other) const {
+ if (onEntry < other.onEntry)
+ return onEntry < other.onEntry;
+ if (onExit < other.onExit)
+ return onExit < other.onExit;
+ if (transition < other.transition)
+ return transition < other.transition;
+ if (entered < other.entered)
+ return entered < other.entered;
+ if (exited < other.exited)
+ return exited < other.exited;
+ if (invoke < other.invoke)
+ return invoke < other.invoke;
+ if (uninvoke < other.uninvoke)
+ return uninvoke < other.uninvoke;
+ return false;
+ }
+
+ bool operator==(const Action& other) const {
+ return !(other < *this) && !(*this < other);
+ }
+ bool operator!=(const Action& other) const {
+ return !operator==(other);
+ }
+
+ typedef std::list<GlobalTransition::Action>::iterator iter_t;
+
Arabica::DOM::Element<std::string> onEntry;
Arabica::DOM::Element<std::string> onExit;
Arabica::DOM::Element<std::string> transition;
@@ -99,10 +137,12 @@ public:
Arabica::DOM::Element<std::string> exited;
Arabica::DOM::Element<std::string> invoke;
Arabica::DOM::Element<std::string> uninvoke;
+
};
GlobalTransition(const Arabica::XPath::NodeSet<std::string>& transitions, DataModel dataModel, ChartToFSM* flattener);
-
+ static GlobalTransition* copyWithoutExecContent(GlobalTransition* other);
+
bool isValid; // constructor will determine, calling code will delete if not
bool isEventless; // whether or not all our transitions are eventless
bool isTargetless; // whether or not all our transitions are eventless
@@ -130,6 +170,11 @@ public:
std::string transitionId;
std::string source;
std::string destination;
+ std::string activeDestination;
+
+ GlobalTransition* historyBase; // we have a base transition that left our source with no history (-> we are a history transition)
+ std::list<GlobalTransition*> historyTrans; // transitions from the same source but different histories
+ std::set<std::string> histTargets; // constituting targets to history states
long index;
ChartToFSM* interpreter;
@@ -219,7 +264,8 @@ protected:
GlobalTransition* _currGlobalTransition;
Arabica::DOM::Document<std::string> _flatDoc;
std::map<std::string, GlobalState*> _globalConf;
- std::map<std::string, GlobalState*> _transPerActiveConf; // potentially enabled transition sets per active configuration
+ std::map<std::string, GlobalState*> _activeConf; // potentially enabled transition sets per active configuration
+ std::map<std::string, Arabica::DOM::Element<std::string> > _historyTargets; // ids of all history states
friend class GlobalTransition;
friend class GlobalState;
diff --git a/src/uscxml/transform/ChartToPromela.cpp b/src/uscxml/transform/ChartToPromela.cpp
index 930fb8d..ea83784 100644
--- a/src/uscxml/transform/ChartToPromela.cpp
+++ b/src/uscxml/transform/ChartToPromela.cpp
@@ -50,6 +50,54 @@
for (int indentIndex = start; indentIndex < cols; indentIndex++) \
stream << " ";
+#define DIFF_MAPS(base, compare, result) \
+{ \
+ histIter_t baseIter = base.begin(); \
+ while(baseIter != base.end()) { \
+ if (compare.find(baseIter->first) == compare.end()) { \
+ result[baseIter->first] = baseIter->second; \
+ } else { \
+ histMemberIter_t baseMemberIter = baseIter->second.begin(); \
+ while(baseMemberIter != baseIter->second.end()) { \
+ if (compare.at(baseIter->first).find(*baseMemberIter) == compare.at(baseIter->first).end()) { \
+ result[baseIter->first].insert(*baseMemberIter); \
+ } \
+ baseMemberIter++; \
+ } \
+ } \
+ baseIter++; \
+ } \
+}
+
+#define INTERSECT_MAPS(base, compare, result) \
+{ \
+ histIter_t baseIter = base.begin(); \
+ while(baseIter != base.end()) { \
+ if (compare.find(baseIter->first) != compare.end()) { \
+ histMemberIter_t baseMemberIter = baseIter->second.begin(); \
+ while(baseMemberIter != baseIter->second.end()) { \
+ if (compare.at(baseIter->first).find(*baseMemberIter) != compare.at(baseIter->first).end()) { \
+ result[baseIter->first].insert(*baseMemberIter); \
+ } \
+ baseMemberIter++; \
+ } \
+ } \
+ baseIter++; \
+ } \
+}
+
+#define PRETTY_PRINT_LIST(stream, var) \
+{ \
+ std::list<std::string>::const_iterator listIter = var.begin(); \
+ std::string sep;\
+ while(listIter != var.end()) { \
+ stream << sep << *listIter; \
+ sep = ", "; \
+ listIter++; \
+ } \
+}
+
+
namespace uscxml {
using namespace Arabica::DOM;
@@ -63,48 +111,21 @@ void ChartToPromela::writeTo(std::ostream& stream) {
writeProgram(stream);
}
-void PromelaEventSource::writeStartEventSources(std::ostream& stream, int indent) {
+void PromelaEventSource::writeStart(std::ostream& stream, int indent) {
std::string padding;
for (int i = 0; i < indent; i++) {
padding += " ";
}
-
- std::list<PromelaInline>::iterator sourceIter = eventSources.inlines.begin();
- int i = 0;
- while(sourceIter != eventSources.inlines.end()) {
- if (sourceIter->type != PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM && sourceIter->type != PromelaInline::PROMELA_EVENT_SOURCE) {
- sourceIter++;
- continue;
- }
- std::string sourceName = name + "_"+ toStr(i);
- stream << padding << "run " << sourceName << "EventSource();" << std::endl;
-
- i++;
- sourceIter++;
- }
-
+ stream << padding << "run " << name << "EventSource();" << std::endl;
}
-void PromelaEventSource::writeStopEventSources(std::ostream& stream, int indent) {
+void PromelaEventSource::writeStop(std::ostream& stream, int indent) {
std::string padding;
for (int i = 0; i < indent; i++) {
padding += " ";
}
- std::list<PromelaInline>::iterator sourceIter = eventSources.inlines.begin();
- int i = 0;
- while(sourceIter != eventSources.inlines.end()) {
- if (sourceIter->type != PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM && sourceIter->type != PromelaInline::PROMELA_EVENT_SOURCE) {
- sourceIter++;
- continue;
- }
- std::string sourceName = name + "_"+ toStr(i);
- stream << padding << sourceName << "EventSourceDone = 1;" << std::endl;
-
- i++;
- sourceIter++;
- }
-
+ stream << padding << name << "EventSourceDone = 1;" << std::endl;
}
void PromelaEventSource::writeDeclarations(std::ostream& stream, int indent) {
@@ -112,86 +133,138 @@ void PromelaEventSource::writeDeclarations(std::ostream& stream, int indent) {
for (int i = 0; i < indent; i++) {
padding += " ";
}
-
- std::list<PromelaInline>::iterator sourceIter = eventSources.inlines.begin();
- int i = 0;
- while(sourceIter != eventSources.inlines.end()) {
- if (sourceIter->type != PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM && sourceIter->type != PromelaInline::PROMELA_EVENT_SOURCE) {
- sourceIter++;
- continue;
- }
- std::string sourceName = name + "_"+ toStr(i);
- stream << "bool " << sourceName << "EventSourceDone = 0;" << std::endl;
-
- i++;
- sourceIter++;
- }
+ stream << "bool " << name << "EventSourceDone = 0;" << std::endl;
+
}
-void PromelaEventSource::writeEventSource(std::ostream& stream) {
+void PromelaEventSource::writeBody(std::ostream& stream) {
- std::list<PromelaInline>::iterator sourceIter = eventSources.inlines.begin();
- int i = 0;
- while(sourceIter != eventSources.inlines.end()) {
- if (sourceIter->type != PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM && sourceIter->type != PromelaInline::PROMELA_EVENT_SOURCE) {
- sourceIter++;
- continue;
- }
-
- std::string sourceName = name + "_"+ toStr(i);
-
- stream << "proctype " << sourceName << "EventSource() {" << std::endl;
- stream << " " << sourceName << "EventSourceDone = 0;" << std::endl;
- stream << " " << sourceName << "NewEvent:" << std::endl;
- stream << " " << "if" << std::endl;
- stream << " " << ":: " << sourceName << "EventSourceDone -> skip;" << std::endl;
- stream << " " << ":: else { " << std::endl;
-
- Trie& trie = analyzer->getTrie();
-
- if (sourceIter->type == PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM) {
- std::string content = sourceIter->content;
+ stream << "proctype " << name << "EventSource() {" << std::endl;
+ stream << " " << name << "EventSourceDone = 0;" << std::endl;
+ if (analyzer->usesComplexEventStruct()) {
+ stream << " _event_t tmpEvent;" << std::endl;
+ }
+ stream << " " << name << "NewEvent:" << std::endl;
+ stream << " " << "if" << std::endl;
+ stream << " " << ":: " << name << "EventSourceDone -> skip;" << std::endl;
+ stream << " " << ":: " << "len(eQ) <= " << externalQueueLength << " -> skip;" << std::endl;
+ stream << " " << ":: else { " << std::endl;
- boost::replace_all(content, "#REDO#", sourceName + "NewEvent");
- boost::replace_all(content, "#DONE#", sourceName + "Done");
+ Trie& trie = analyzer->getTrie();
+ if (source.type == PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM) {
+ // custom event source
+ std::string content = source.content;
- std::list<TrieNode*> eventNames = trie.getChildsWithWords(trie.getNodeWithPrefix(""));
- std::list<TrieNode*>::iterator eventNameIter = eventNames.begin();
- while(eventNameIter != eventNames.end()) {
- boost::replace_all(content, "#" + (*eventNameIter)->value + "#", (*eventNameIter)->identifier);
- eventNameIter++;
- }
+ boost::replace_all(content, "#REDO#", name + "NewEvent");
+ boost::replace_all(content, "#DONE#", name + "Done");
- stream << ChartToPromela::beautifyIndentation(content, 2) << std::endl;
+ std::list<TrieNode*> eventNames = trie.getChildsWithWords(trie.getNodeWithPrefix(""));
+ std::list<TrieNode*>::iterator eventNameIter = eventNames.begin();
+ while(eventNameIter != eventNames.end()) {
+ boost::replace_all(content, "#" + (*eventNameIter)->value + "#", (*eventNameIter)->identifier);
+ eventNameIter++;
+ }
- } else {
- stream << " " << " if" << std::endl;
-// stream << " " << " :: 1 -> " << "goto " << sourceName << "NewEvent;" << std::endl;
-
- std::list<std::list<std::string> >::const_iterator seqIter = sourceIter->sequences.begin();
- while(seqIter != sourceIter->sequences.end()) {
- stream << " " << ":: ";
- std::list<std::string>::const_iterator evIter = seqIter->begin();
- while(evIter != seqIter->end()) {
- TrieNode* node = trie.getNodeWithPrefix(*evIter);
- stream << "eQ!" << node->identifier << "; ";
+ stream << ChartToPromela::beautifyIndentation(content, 2) << std::endl;
+ } else {
+ // standard event source
+ stream << " " << " if" << std::endl;
+// stream << " " << " :: 1 -> " << "goto " << sourceName << "NewEvent;" << std::endl;
+
+ std::list<std::list<std::string> >::const_iterator seqIter = sequences.begin();
+ while(seqIter != sequences.end()) {
+ stream << " " << ":: skip -> { ";
+ std::list<std::string>::const_iterator evIter = seqIter->begin();
+ while(evIter != seqIter->end()) {
+ TrieNode* node = trie.getNodeWithPrefix(*evIter);
+ if (!node) {
+ std::cerr << "Event " << *evIter << " defined in event source but never used in transitions" << std::endl;
evIter++;
+ continue;
}
- stream << "goto " << sourceName << "NewEvent;" << std::endl;
- seqIter++;
+ if (analyzer->usesComplexEventStruct()) {
+ stream << "tmpEvent.name = " << analyzer->macroForLiteral(node->value) << "; eQ!tmpEvent; ";
+ } else {
+ stream << "eQ!" << analyzer->macroForLiteral(node->value) << "; ";
+ }
+ evIter++;
}
-
- stream << " " << " fi;" << std::endl;
+ stream << "goto " << name << "NewEvent;";
+ stream << " }" << std::endl;
+ seqIter++;
}
- stream << " " << "}" << std::endl;
- stream << " " << "fi;" << std::endl;
- stream << sourceName << "Done:" << " skip;" << std::endl;
- stream << "}" << std::endl;
-
- i++;
- sourceIter++;
+ stream << " " << " fi;" << std::endl;
}
+
+ stream << " " << "}" << std::endl;
+ stream << " " << "fi;" << std::endl;
+ stream << name << "Done:" << " skip;" << std::endl;
+ stream << "}" << std::endl;
+
+
+// std::list<PromelaInline>::iterator sourceIter = eventSources.inlines.begin();
+// int i = 0;
+// while(sourceIter != eventSources.inlines.end()) {
+// if (sourceIter->type != PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM && sourceIter->type != PromelaInline::PROMELA_EVENT_SOURCE) {
+// sourceIter++;
+// continue;
+// }
+//
+// std::string sourceName = name + "_"+ toStr(i);
+//
+// stream << "proctype " << sourceName << "EventSource() {" << std::endl;
+// stream << " " << sourceName << "EventSourceDone = 0;" << std::endl;
+// stream << " " << sourceName << "NewEvent:" << std::endl;
+// stream << " " << "if" << std::endl;
+// stream << " " << ":: " << sourceName << "EventSourceDone -> skip;" << std::endl;
+// stream << " " << ":: else { " << std::endl;
+//
+// Trie& trie = analyzer->getTrie();
+//
+// if (sourceIter->type == PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM) {
+// std::string content = sourceIter->content;
+//
+// boost::replace_all(content, "#REDO#", sourceName + "NewEvent");
+// boost::replace_all(content, "#DONE#", sourceName + "Done");
+//
+// std::list<TrieNode*> eventNames = trie.getChildsWithWords(trie.getNodeWithPrefix(""));
+// std::list<TrieNode*>::iterator eventNameIter = eventNames.begin();
+// while(eventNameIter != eventNames.end()) {
+// boost::replace_all(content, "#" + (*eventNameIter)->value + "#", (*eventNameIter)->identifier);
+// eventNameIter++;
+// }
+//
+// stream << ChartToPromela::beautifyIndentation(content, 2) << std::endl;
+//
+// } else {
+// stream << " " << " if" << std::endl;
+//// stream << " " << " :: 1 -> " << "goto " << sourceName << "NewEvent;" << std::endl;
+//
+// std::list<std::list<std::string> >::const_iterator seqIter = sourceIter->sequences.begin();
+// while(seqIter != sourceIter->sequences.end()) {
+// stream << " " << ":: ";
+// std::list<std::string>::const_iterator evIter = seqIter->begin();
+// while(evIter != seqIter->end()) {
+// TrieNode* node = trie.getNodeWithPrefix(*evIter);
+// stream << "eQ!" << node->identifier << "; ";
+// evIter++;
+// }
+// stream << "goto " << sourceName << "NewEvent;" << std::endl;
+// seqIter++;
+// }
+//
+// stream << " " << " fi;" << std::endl;
+// }
+//
+// stream << " " << "}" << std::endl;
+// stream << " " << "fi;" << std::endl;
+// stream << sourceName << "Done:" << " skip;" << std::endl;
+// stream << "}" << std::endl;
+//
+// i++;
+// sourceIter++;
+// }
}
PromelaEventSource::PromelaEventSource() {
@@ -199,12 +272,34 @@ PromelaEventSource::PromelaEventSource() {
analyzer = NULL;
}
-PromelaEventSource::PromelaEventSource(const PromelaInlines& sources, const Arabica::DOM::Node<std::string>& parent) {
+PromelaEventSource::PromelaEventSource(const PromelaInline& source, uint32_t eQueueLength) {
type = PROMELA_EVENT_SOURCE_INVALID;
analyzer = NULL;
+ externalQueueLength = eQueueLength;
+
+ this->source = source;
+
+ if (source.type == PromelaInline::PROMELA_EVENT_SOURCE) {
+ std::stringstream ssLines(source.content);
+ std::string line;
+ while(std::getline(ssLines, line)) {
+ boost::trim(line);
+ if (line.length() == 0)
+ continue;
+ if (boost::starts_with(line, "//"))
+ continue;
- eventSources = sources;
- container = parent;
+ std::list<std::string> seq;
+ std::stringstream ssToken(line);
+ std::string token;
+ while(std::getline(ssToken, token, ' ')) {
+ if (token.length() == 0)
+ continue;
+ seq.push_back(token);
+ }
+ sequences.push_back(seq);
+ }
+ }
}
void PromelaCodeAnalyzer::addCode(const std::string& code) {
@@ -347,31 +442,7 @@ void PromelaCodeAnalyzer::addState(const std::string& stateName) {
return;
createMacroName(stateName);
-
-#if 0
-// addLiteral(stateName);
-// _states[stateName] = enumerateLiteral(stateName);
- if (_origStateMap.find(stateName) == _origStateMap.end()) {
- FlatStateIdentifier flatId(stateName);
- _origStateMap[stateName] = flatId.getActive();
- for (std::list<std::string>::iterator origIter = _origStateMap[stateName].begin(); origIter != _origStateMap[stateName].end(); origIter++) {
- //addLiteral(*origIter); // add original state names as string literals
- if (_origStateIndex.find(*origIter) == _origStateIndex.end()) {
- _origStateIndex[*origIter] = _lastStateIndex++;
- createMacroName(*origIter);
- }
- }
- }
-#endif
-}
-
-#if 0
-int PromelaCodeAnalyzer::arrayIndexForOrigState(const std::string& stateName) {
- if (_origStateIndex.find(stateName) == _origStateIndex.end())
- throw std::runtime_error("No original state " + stateName + " known");
- return _origStateIndex[stateName];
}
-#endif
void PromelaCodeAnalyzer::addLiteral(const std::string& literal, int forceIndex) {
if (boost::starts_with(literal, "'"))
@@ -394,7 +465,7 @@ int PromelaCodeAnalyzer::enumerateLiteral(const std::string& literal, int forceI
if (_strIndex.find(literal) != _strIndex.end())
return _strIndex[literal];
- _strIndex[literal] = ++_lastStrIndex;
+ _strIndex[literal] = _lastStrIndex++;
return _lastStrIndex + 1;
}
@@ -428,7 +499,11 @@ std::string PromelaCodeAnalyzer::createMacroName(const std::string& literal) {
}
}
macroName = tmp;
-
+ if(macroName.length() < 1)
+ macroName = "_EMPTY_STRING";
+ if(macroName.length() < 2 && macroName[0] == '_')
+ macroName = "_WEIRD_CHARS";
+
unsigned int index = 2;
while (_macroNameSet.find(macroName) != _macroNameSet.end()) {
std::string suffix = toStr(index);
@@ -501,8 +576,8 @@ void ChartToPromela::writeEvents(std::ostream& stream) {
void ChartToPromela::writeStates(std::ostream& stream) {
stream << "/* state name identifiers */" << std::endl;
- std::map<std::string, GlobalState*>::iterator stateIter = _globalConf.begin();
- while(stateIter != _globalConf.end()) {
+ std::map<std::string, GlobalState*>::iterator stateIter = _activeConf.begin();
+ while(stateIter != _activeConf.end()) {
stream << "#define " << "s" << stateIter->second->index << " " << stateIter->second->index;
stream << " /* from \"" << stateIter->first << "\" */" << std::endl;
stateIter++;
@@ -534,6 +609,23 @@ void ChartToPromela::writeStateMap(std::ostream& stream) {
// }
}
+void ChartToPromela::writeHistoryArrays(std::ostream& stream) {
+ stream << "/* history assignments */" << std::endl;
+ std::map<std::string, std::map<std::string, size_t> >::iterator histNameIter = _historyMembers.begin();
+ while(histNameIter != _historyMembers.end()) {
+ stream << "bool _hist_" << boost::to_lower_copy(histNameIter->first) << "[" << histNameIter->second.size() << "];";
+
+ stream << " /* ";
+ std::map<std::string, size_t>::iterator histMemberIter = histNameIter->second.begin();
+ while(histMemberIter != histNameIter->second.end()) {
+ stream << " " << histMemberIter->second << ":" << histMemberIter->first;
+ histMemberIter++;
+ }
+ stream << " */" << std::endl;
+ histNameIter++;
+ }
+}
+
void ChartToPromela::writeTypeDefs(std::ostream& stream) {
stream << "/* typedefs */" << std::endl;
PromelaCodeAnalyzer::PromelaTypedef typeDefs = _analyzer.getTypes();
@@ -622,75 +714,6 @@ std::string ChartToPromela::declForRange(const std::string& identifier, long min
}
}
-
-#if 0
-Arabica::XPath::NodeSet<std::string> ChartToPromela::getTransientContent(const Arabica::DOM::Element<std::string>& state, const std::string& source) {
- Arabica::XPath::NodeSet<std::string> content;
- Arabica::DOM::Element<std::string> currState = state;
- FlatStateIdentifier prevFlatId(source);
- for (;;) {
- if (_analyzer.usesInPredicate()) {
- // insert state assignments into executable content
-
- std::stringstream stateSetPromela;
- stateSetPromela << "#promela-inline " << std::endl;
- FlatStateIdentifier currFlatId(ATTR(currState, "id"));
- stateSetPromela << " /* from " << prevFlatId.getFlatActive() << " to " << currFlatId.getFlatActive() << " */" << std::endl;
-
- // add all that are missing from prevFlatId
- std::map<std::string, int> allOrigStates = _analyzer.getOrigStates();
- for (std::map<std::string, int>::iterator allOrigIter = allOrigStates.begin(); allOrigIter != allOrigStates.end(); allOrigIter++) {
- if (std::find(currFlatId.getActive().begin(), currFlatId.getActive().end(), allOrigIter->first) != currFlatId.getActive().end() &&
- std::find(prevFlatId.getActive().begin(), prevFlatId.getActive().end(), allOrigIter->first) == prevFlatId.getActive().end()) {
- // active now but not previously
- stateSetPromela << " _x.states[" << _analyzer.macroForLiteral(allOrigIter->first) << "] = true; " << std::endl;
- } else if (std::find(currFlatId.getActive().begin(), currFlatId.getActive().end(), allOrigIter->first) == currFlatId.getActive().end() &&
- std::find(prevFlatId.getActive().begin(), prevFlatId.getActive().end(), allOrigIter->first) != prevFlatId.getActive().end()) {
- // previously active but not now
- stateSetPromela << " _x.states[" << _analyzer.macroForLiteral(allOrigIter->first) << "] = false; " << std::endl;
- }
- }
- Comment<std::string> comment = _document.createComment(stateSetPromela.str());
- _document.importNode(comment, true);
- currState.insertBefore(comment, currState.getFirstChild());
- prevFlatId = currFlatId;
- }
-
- content.push_back(filterChildType(Node_base::COMMENT_NODE, currState));
- if (_analyzer.usesInPredicate()) assert(content.size() > 0);
-
- if (!HAS_ATTR(currState, "transient") || !DOMUtils::attributeIsTrue(ATTR(currState, "transient"))) {
- // breaking here causes final state assignment to be written
- break;
- }
-
- content.push_back(filterChildElements(_nsInfo.xmlNSPrefix + "invoke", currState));
- content.push_back(filterChildElements(_nsInfo.xmlNSPrefix + "onentry", currState));
- content.push_back(filterChildElements(_nsInfo.xmlNSPrefix + "onexit", currState));
-
- NodeSet<std::string> transitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", currState);
- currState = _states[ATTR_CAST(transitions[0], "target")];
- }
- return content;
-}
-#endif
-
-#if 0
-Node<std::string> ChartToPromela::getUltimateTarget(const Arabica::DOM::Element<std::string>& transition) {
- if (!HAS_ATTR(transition, "target")) {
- return transition.getParentNode();
- }
-
- Arabica::DOM::Element<std::string> currState = _states[ATTR_CAST(transition, "target")];
-
- for (;;) {
- if (!HAS_ATTR(currState, "transient") || !DOMUtils::attributeIsTrue(ATTR(currState, "transient")))
- return currState;
- NodeSet<std::string> transitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", currState);
- currState = _states[ATTR_CAST(transitions[0], "target")];
- }
-}
-#endif
void ChartToPromela::writeInlineComment(std::ostream& stream, const Arabica::DOM::Node<std::string>& node) {
if (node.getNodeType() != Node_base::COMMENT_NODE)
@@ -711,96 +734,584 @@ void ChartToPromela::writeInlineComment(std::ostream& stream, const Arabica::DOM
}
}
-void ChartToPromela::writeTransition(std::ostream& stream, const GlobalTransition* transition, int indent) {
+std::string ChartToPromela::conditionForHistoryTransition(const GlobalTransition* transition) {
+ FlatStateIdentifier flatSource(transition->source);
+ FlatStateIdentifier flatTarget(transition->destination);
+ std::string condition;
+
+ return condition;
+}
+
+std::string ChartToPromela::conditionalizeForHist(GlobalTransition* transition, int indent) {
+ std::set<GlobalTransition*> transitions;
+ transitions.insert(transition);
+ return conditionalizeForHist(transitions);
+}
+
+std::string ChartToPromela::conditionalizeForHist(const std::set<GlobalTransition*>& transitions, int indent) {
+ std::stringstream condition;
+ std::string memberSep;
+
+ std::set<std::map<std::string, std::list<std::string> > > histSeen;
+
+ for (std::set<GlobalTransition*>::const_iterator transIter = transitions.begin(); transIter != transitions.end(); transIter++) {
+ if ((*transIter)->histTargets.size() == 0) // there are no history transitions in here!
+ continue;
+
+ std::map<std::string, std::list<std::string> > relevantHist;
+ std::map<std::string, std::list<std::string> > currentHist;
+ FlatStateIdentifier flatSource((*transIter)->source);
+ currentHist = flatSource.getHistory();
+
+ std::set<std::string>::iterator histTargetIter = (*transIter)->histTargets.begin();
+ while(histTargetIter != (*transIter)->histTargets.end()) {
+ if (currentHist.find(*histTargetIter) != currentHist.end()) {
+ relevantHist[*histTargetIter] = currentHist[*histTargetIter];
+ }
+ histTargetIter++;
+ }
+ if (relevantHist.size() == 0)
+ continue;
+
+ if (histSeen.find(relevantHist) != histSeen.end())
+ continue;
+ histSeen.insert(relevantHist);
+
+ std::string itemSep;
+ std::map<std::string, std::list<std::string> >::iterator relevanthistIter = relevantHist.begin();
+
+ if (relevantHist.size() > 0)
+ condition << memberSep;
+
+ while(relevanthistIter != relevantHist.end()) {
+ std::list<std::string>::iterator histItemIter = relevanthistIter->second.begin();
+ while(histItemIter != relevanthistIter->second.end()) {
+ assert(_historyMembers.find(relevanthistIter->first) != _historyMembers.end());
+ assert(_historyMembers[relevanthistIter->first].find(*histItemIter) != _historyMembers[relevanthistIter->first].end());
+ condition << itemSep << "_hist_" << boost::to_lower_copy(_analyzer.macroForLiteral(relevanthistIter->first)) << "[" << _historyMembers[relevanthistIter->first][*histItemIter] << "]";
+ itemSep = " && ";
+ histItemIter++;
+ }
+ relevanthistIter++;
+ }
+
+ if (relevantHist.size() > 0)
+ memberSep = " || ";
+
+ }
+ if (condition.str().size() > 0)
+ return "(" + condition.str() + ")";
+ return "";
+}
+
+void ChartToPromela::writeTransition(std::ostream& stream, GlobalTransition* transition, int indent) {
std::string padding;
for (int i = 0; i < indent; i++) {
padding += " ";
}
- stream << "t" << transition->index << ":";
- int digits = 0;
- LENGTH_FOR_NUMBER(transition->index, digits);
-
- INDENT_MIN(stream, 2 + digits, MIN_COMMENT_PADDING);
- stream << " /* from state " << transition->source << " */" << std::endl;
+ stream << std::endl << "t" << transition->index << ": /* ######################## " << std::endl;
+ stream << " from state: ";
+ FlatStateIdentifier flatActiveSource(transition->source);
+ PRETTY_PRINT_LIST(stream, flatActiveSource.getActive());
+ stream << std::endl;
+ stream << " on event: " << (transition->eventDesc.size() > 0 ? transition->eventDesc : "SPONTANEOUS") << std::endl;
+ stream << "############################### */" << std::endl;
+ stream << std::endl;
stream << padding << "atomic {" << std::endl;
+ padding += " ";
indent++;
+ // iterators of history transitions executable content
+ std::map<GlobalTransition*, std::pair<GlobalTransition::Action::iter_t, GlobalTransition::Action::iter_t> > actionIters;
+ std::map<GlobalTransition*, std::set<GlobalTransition::Action> > actionsInTransition;
+
+ typedef std::map<GlobalTransition*, std::pair<GlobalTransition::Action::iter_t, GlobalTransition::Action::iter_t> > actionIters_t;
+
+ std::list<GlobalTransition*>::const_iterator histIter = transition->historyTrans.begin();
+ while(histIter != transition->historyTrans.end()) {
+ actionIters.insert(std::make_pair((*histIter), std::make_pair((*histIter)->actions.begin(), (*histIter)->actions.end())));
+ // add history transitions actions to the set
+ std::copy((*histIter)->actions.begin(), (*histIter)->actions.end(), std::inserter(actionsInTransition[*histIter], actionsInTransition[*histIter].begin()));
+ histIter++;
+ }
+ std::copy(transition->actions.begin(), transition->actions.end(), std::inserter(actionsInTransition[transition], actionsInTransition[transition].begin()));
+
+
+// GlobalTransition::Action action;
+ std::set<GlobalTransition*> allBut;
+ std::list<ExecContentSeqItem> ecSeq;
+
for (std::list<GlobalTransition::Action>::const_iterator actionIter = transition->actions.begin(); actionIter != transition->actions.end(); actionIter++) {
- if (actionIter->transition) {
+ // for every executable content in base transition
+ const GlobalTransition::Action& baseAction = *actionIter;
+ allBut.clear();
+
+ for (actionIters_t::iterator histActionIter = actionIters.begin(); histActionIter != actionIters.end(); histActionIter++) {
+ // iterate every history transition
+ GlobalTransition* histTrans = histActionIter->first;
+ GlobalTransition::Action& histAction = *(histActionIter->second.first);
+
+ // is the current action identical?
+ if (baseAction != histAction) {
+ // executable content differs - will given executable content appear later in history?
+ if (actionsInTransition[histTrans].find(baseAction) != actionsInTransition[histTrans].end()) {
+ // yes -> write all exec content exclusive to this history transition until base executable content
+ while(baseAction != *(histActionIter->second.first)) {
+ histAction = *(histActionIter->second.first);
+ ecSeq.push_back(ExecContentSeqItem(ExecContentSeqItem::EXEC_CONTENT_ONLY_FOR, histTrans, histAction));
+ actionsInTransition[histTrans].erase(histAction);
+ histActionIter->second.first++;
+ }
+ } else {
+ // no -> exclude this history transition
+ allBut.insert(histTrans);
+ }
+ } else {
+ // that's great, they are equal, just increase iterator
+ histActionIter->second.first++;
+ }
+ }
+
+ if (allBut.empty()) {
+ // everyone has the current actionIter one behind the base action
+ ecSeq.push_back(ExecContentSeqItem(ExecContentSeqItem::EXEC_CONTENT_EVERY, NULL, baseAction));
+ } else {
+ // everyone but some have this content
+ ecSeq.push_back(ExecContentSeqItem(ExecContentSeqItem::EXEC_CONTENT_ALL_BUT, allBut, baseAction));
+ }
+ }
+
+ // see what remains in history transitions and add as exclusive
+ for (actionIters_t::iterator histActionIter = actionIters.begin(); histActionIter != actionIters.end(); histActionIter++) {
+ GlobalTransition* histTrans = histActionIter->first;
+
+ while(histActionIter->second.first != histActionIter->second.second) {
+ GlobalTransition::Action& histAction = *(histActionIter->second.first);
+ ecSeq.push_back(ExecContentSeqItem(ExecContentSeqItem::EXEC_CONTENT_ONLY_FOR, histTrans, histAction));
+ histActionIter->second.first++;
+ }
+ }
+
+ bool isConditionalized = false;
+ bool wroteHistoryAssignments = false;
+ std::set<GlobalTransition*> condSet;
+
+ for (std::list<ExecContentSeqItem>::const_iterator ecIter = ecSeq.begin(); ecIter != ecSeq.end(); ecIter++) {
+ const GlobalTransition::Action& action = ecIter->action;
+
+ if (action.exited) {
+ // first onexit handler writes history assignments
+ if (!wroteHistoryAssignments) {
+ writeHistoryAssignments(stream, transition, indent);
+ wroteHistoryAssignments = true;
+ }
+ }
+
+ if (!_analyzer.usesInPredicate() && (action.entered || action.exited)) {
+ continue;
+ }
+
+ if (ecIter->type == ExecContentSeqItem::EXEC_CONTENT_ONLY_FOR) {
+ assert(!wroteHistoryAssignments); // we need to move assignments after dispatching?
+ if (condSet != ecIter->transitions) {
+ stream << padding << "if" << std::endl;
+ stream << padding << ":: " << conditionalizeForHist(ecIter->transitions) << " -> {" << std::endl;
+ padding += " ";
+ indent++;
+ isConditionalized = true;
+ condSet = ecIter->transitions;
+ }
+ } else if (ecIter->type == ExecContentSeqItem::EXEC_CONTENT_ALL_BUT) {
+ assert(!wroteHistoryAssignments); // we need to move assignments after dispatching?
+ if (condSet != ecIter->transitions) {
+ stream << padding << "if" << std::endl;
+ stream << padding << ":: " << conditionalizeForHist(ecIter->transitions) << " -> skip;" << std::endl;
+ stream << padding << ":: else -> {" << std::endl;
+ padding += " ";
+ indent++;
+ isConditionalized = true;
+ condSet = ecIter->transitions;
+ }
+ } else {
+ isConditionalized = false;
+ condSet.clear();
+ }
+
+ if (action.exited) {
+ // we left a state
+ stream << padding << "_x.states[" << _analyzer.macroForLiteral(ATTR(action.exited, "id")) << "] = false; " << std::endl;
+ continue;
+ }
+
+ if (action.entered) {
+ // we entered a state
+ stream << padding << "_x.states[" << _analyzer.macroForLiteral(ATTR(action.entered, "id")) << "] = true; " << std::endl;
+ continue;
+ }
+
+ if (action.transition) {
// this is executable content from a transition
- writeExecutableContent(stream, actionIter->transition, indent);
+ writeExecutableContent(stream, action.transition, indent);
continue;
}
- if (actionIter->onExit) {
+ if (action.onExit) {
// executable content from an onexit element
- writeExecutableContent(stream, actionIter->onExit, indent);
+ writeExecutableContent(stream, action.onExit, indent);
continue;
}
- if (actionIter->onEntry) {
+ if (action.onEntry) {
// executable content from an onentry element
- writeExecutableContent(stream, actionIter->onEntry, indent);
+ writeExecutableContent(stream, action.onEntry, indent);
continue;
}
- if (actionIter->invoke) {
+ if (action.invoke) {
// an invoke element
continue;
}
- if (actionIter->uninvoke) {
+ if (action.uninvoke) {
// an invoke element to uninvoke
continue;
}
- if (actionIter->exited) {
- // we left a state
- if (_analyzer.usesInPredicate()) {
- stream << padding << "_x.states[" << _analyzer.macroForLiteral(ATTR(actionIter->exited, "id")) << "] = false; " << std::endl;
+ if (isConditionalized) {
+ padding = padding.substr(2);
+ indent--;
+ if (ecIter->type == ExecContentSeqItem::EXEC_CONTENT_ALL_BUT) {
+ stream << padding << "}" << std::endl;
+ stream << padding << "fi" << std::endl;
+ } else if(ecIter->type == ExecContentSeqItem::EXEC_CONTENT_ONLY_FOR) {
+ stream << padding << "}" << std::endl;
+ stream << padding << ":: else -> skip;" << std::endl;
+ stream << padding << "fi;" << std::endl;
}
- continue;
}
+ }
+
+ if (!wroteHistoryAssignments) {
+ writeHistoryAssignments(stream, transition, indent);
+ wroteHistoryAssignments = true;
+ }
+
+ // write new state assignment and goto dispatching
+ GlobalState* origNewState = NULL;
+
+ // sort history transitions by new active state
+ std::map<GlobalState*, std::set<GlobalTransition*> > histTargets;
+ histIter = transition->historyTrans.begin();
+ while(histIter != transition->historyTrans.end()) {
+ origNewState = _activeConf[(*histIter)->activeDestination];
+ assert(origNewState != NULL);
+ histTargets[origNewState].insert(*histIter);
+ histIter++;
+ }
+
+ origNewState = _activeConf[transition->activeDestination];
+ bool hasHistoryTarget = false;
+
+ for (std::map<GlobalState*, std::set<GlobalTransition*> >::const_iterator histTargetIter = histTargets.begin(); histTargetIter != histTargets.end(); histTargetIter++) {
+ GlobalState* histNewState = histTargetIter->first;
+ if (histNewState == origNewState)
+ continue;
+ stream << padding << "if" << std::endl;
+ stream << padding << "::" << conditionalizeForHist(histTargetIter->second) << " -> {" << std::endl;
+ stream << std::endl << "/* via hist ";
+ FlatStateIdentifier flatActiveDest(histNewState->activeId);
+ PRETTY_PRINT_LIST(stream, flatActiveDest.getActive());
+ stream << "*/" << std::endl;
+
+ stream << padding << " s = s" << histNewState->index << ";" << std::endl;
- if (actionIter->entered) {
- // we entered a state
- if (_analyzer.usesInPredicate()) {
- stream << padding << "_x.states[" << _analyzer.macroForLiteral(ATTR(actionIter->entered, "id")) << "] = true; " << std::endl;
+ writeTransitionClosure(stream, *histTargetIter->second.begin(), histNewState, indent + 1); // is this correct for everyone in set?
+
+ stream << padding << "}" << std::endl;
+ hasHistoryTarget = true;
+ }
+
+ if (hasHistoryTarget) {
+ stream << padding << ":: else {" << std::endl;
+ padding += " ";
+ indent++;
+ }
+
+ origNewState = _activeConf[transition->activeDestination];
+ assert(origNewState != NULL);
+
+
+ stream << std::endl << "/* to state ";
+ FlatStateIdentifier flatActiveDest(transition->activeDestination);
+ PRETTY_PRINT_LIST(stream, flatActiveDest.getActive());
+ stream << " */" << std::endl;
+
+ stream << padding << "s = s" << origNewState->index << ";" << std::endl;
+
+ writeTransitionClosure(stream, transition, origNewState, indent);
+
+ if (hasHistoryTarget) {
+ padding = padding.substr(2);
+ indent--;
+ stream << padding << "}" << std::endl;
+ stream << padding << "fi;" << std::endl;
+ }
+
+ padding = padding.substr(2);
+ stream << padding << "}" << std::endl;
+
+}
+
+void ChartToPromela::writeHistoryAssignments(std::ostream& stream, GlobalTransition* transition, int indent) {
+ std::string padding;
+ for (int i = 0; i < indent; i++) {
+ padding += " ";
+ }
+
+ // GlobalState to *changed* history configuration
+ std::list<HistoryTransitionClass> histClasses;
+
+ std::set<GlobalTransition*> allTrans;
+ allTrans.insert(transition);
+ allTrans.insert(transition->historyTrans.begin(), transition->historyTrans.end());
+
+ // iterate all transitions
+ std::set<GlobalTransition*>::iterator transIter = allTrans.begin();
+ while(transIter != allTrans.end()) {
+ histClasses.push_back(HistoryTransitionClass(*transIter));
+ transIter++;
+ }
+
+ // nothing to do here
+ if (histClasses.size() == 0)
+ return;
+
+// std::cout << histClasses.size() << " / ";
+
+ // now sort into equivalence classes
+ std::list<HistoryTransitionClass>::iterator outerHistClassIter = histClasses.begin();
+ std::list<HistoryTransitionClass>::iterator innerHistClassIter = histClasses.begin();
+ while(outerHistClassIter != histClasses.end()) {
+ HistoryTransitionClass& outerClass = *outerHistClassIter;
+
+ // iterate inner iter for every outer iter and see if we can merge
+ innerHistClassIter = outerHistClassIter;
+ innerHistClassIter++;
+
+ while(innerHistClassIter != histClasses.end()) {
+ // can we merge the inner class into the outer one?
+ HistoryTransitionClass& innerClass = *innerHistClassIter;
+
+ if (outerClass.matches(innerClass)) {
+ outerClass.merge(innerClass);
+ histClasses.erase(innerHistClassIter);
}
+
+ innerHistClassIter++;
+ }
+ outerHistClassIter++;
+ }
+// std::cout << histClasses.size() << std::endl;
+
+ bool preambelWritten = false;
+ std::list<HistoryTransitionClass>::iterator histClassIter = histClasses.begin();
+ std::list<HistoryTransitionClass>::iterator defaultHistClassIter = histClasses.end();
+ size_t nrMembers = 0;
+ while(histClassIter != histClasses.end() || defaultHistClassIter != histClasses.end()) {
+
+ // remember iterator position with default transition
+ if (histClassIter == histClasses.end() && defaultHistClassIter != histClasses.end()) {
+ histClassIter = defaultHistClassIter;
+ } else if (histClassIter->members.find(transition) != histClassIter->members.end()) {
+ defaultHistClassIter = histClassIter;
+ histClassIter++;
continue;
}
+
+ nrMembers += histClassIter->members.size();
+
+ if (!preambelWritten && histClasses.size() > 1) {
+ stream << padding << "if" << std::endl;
+ preambelWritten = true;
+ }
+
+ if (histClasses.size() > 1) {
+ stream << padding << "::" << conditionalizeForHist(histClassIter->members) << " {" << std::endl;
+ }
+
+ {
+ std::map<std::string, std::set<std::string> >::iterator forgetIter = histClassIter->toForget.begin();
+ while(forgetIter != histClassIter->toForget.end()) {
+ std::set<std::string>::iterator forgetMemberIter = forgetIter->second.begin();
+ while(forgetMemberIter != forgetIter->second.end()) {
+ stream << padding << "_hist_" << boost::to_lower_copy(_analyzer.macroForLiteral(forgetIter->first));
+ stream << "[" << _historyMembers[forgetIter->first][*forgetMemberIter] << "] = 0;";
+ stream << " \t/* " << *forgetMemberIter << " */" << std::endl;
+ forgetMemberIter++;
+ }
+ forgetIter++;
+ }
+ }
+
+ {
+ std::map<std::string, std::set<std::string> >::iterator rememberIter = histClassIter->toRemember.begin();
+ while(rememberIter != histClassIter->toRemember.end()) {
+ std::set<std::string>::iterator rememberMemberIter = rememberIter->second.begin();
+ while(rememberMemberIter != rememberIter->second.end()) {
+ stream << padding << "_hist_" << boost::to_lower_copy(_analyzer.macroForLiteral(rememberIter->first));
+ stream << "[" << _historyMembers[rememberIter->first][*rememberMemberIter] << "] = 1;";
+ stream << " \t/* " << *rememberMemberIter << " */" << std::endl;
+ rememberMemberIter++;
+ }
+ rememberIter++;
+ }
+ }
+
+ if (histClasses.size() > 1) {
+ stream << padding << "}" << std::endl;
+ }
+
+ if (histClassIter == defaultHistClassIter) {
+ break;
+ }
+
+ histClassIter++;
}
+ assert(nrMembers == allTrans.size());
- GlobalState* newState = _globalConf[transition->destination];
- assert(newState != NULL);
+}
+
+HistoryTransitionClass::HistoryTransitionClass(GlobalTransition* transition) {
+ members.insert(transition);
+ init(transition->source, transition->destination);
+}
+
+HistoryTransitionClass::HistoryTransitionClass(const std::string& from, const std::string& to) {
+ init(from, to);
+}
+
+void HistoryTransitionClass::init(const std::string& from, const std::string& to) {
+ FlatStateIdentifier flatSource(from);
+ FlatStateIdentifier flatTarget(to);
- stream << padding << " s = s" << newState->index << ";";
- LENGTH_FOR_NUMBER(newState->index, digits);
- INDENT_MIN(stream, 10 + digits, MIN_COMMENT_PADDING);
+ std::map<std::string, std::set<std::string> > activeBefore = flatSource.getHistorySets();
+ std::map<std::string, std::set<std::string> > activeAfter = flatTarget.getHistorySets();
- stream << " /* to state " << transition->destination << " */" << std::endl;
+ std::map<std::string, std::set<std::string> >::const_iterator targetHistIter = activeAfter.begin();
+ while(targetHistIter != activeAfter.end()) {
+ // for every history state in target, see if it existed in source
+ if (activeBefore.find(targetHistIter->first) == activeBefore.end()) {
+ // this target history did not exist source -> every item is changed
+ std::set<std::string>::const_iterator histMemberIter = activeAfter.at(targetHistIter->first).begin();
+ while(histMemberIter != activeAfter.at(targetHistIter->first).end()) {
+ toRemember[targetHistIter->first].insert(*histMemberIter);
+ histMemberIter++;
+ }
+ } else {
+ // this target *did* already exist, but was it equally assigned?
+ std::set<std::string>::const_iterator sourceHistMemberIter = activeBefore.at(targetHistIter->first).begin();
+ while(sourceHistMemberIter != activeBefore.at(targetHistIter->first).end()) {
+ // iterate every item in source and try to find it in target
+ if (targetHistIter->second.find(*sourceHistMemberIter) == targetHistIter->second.end()) {
+ // no, source is no longer in target
+ toForget[targetHistIter->first].insert(*sourceHistMemberIter);
+ } else {
+ toKeep[targetHistIter->first].insert(*sourceHistMemberIter);
+ }
+ sourceHistMemberIter++;
+ }
+
+ std::set<std::string>::const_iterator targetHistMemberIter = activeAfter.at(targetHistIter->first).begin();
+ while(targetHistMemberIter != activeAfter.at(targetHistIter->first).end()) {
+ // iterate member of target history and see if it is new
+ if (activeBefore.at(targetHistIter->first).find(*targetHistMemberIter) == activeBefore.at(targetHistIter->first).end()) {
+ // not found -> new assignment
+ toRemember[targetHistIter->first].insert(*targetHistMemberIter);
+ }
+ targetHistMemberIter++;
+ }
+ }
+ targetHistIter++;
+ }
+}
+
+bool HistoryTransitionClass::matches(const HistoryTransitionClass& other) {
+ /* does the given transition match this one?:
+ 1. everything remembered has to be remembered as well or already enabled
+ 2. everything forgot has to be forgotten as well or already disabled
+ and vice versa
+ */
- if (newState->isFinal) {
- stream << padding << " goto terminate;";
- INDENT_MIN(stream, padding.length() + 14, MIN_COMMENT_PADDING);
- stream << "/* final state */" << std::endl;
- } else if (transition->isEventless) {
- stream << padding << " goto nextTransition;";
- INDENT_MIN(stream, padding.length() + 19, MIN_COMMENT_PADDING);
- stream << "/* spontaneous transition, check for more transitions */" << std::endl;
- } else {
- stream << padding << " eventLess = true;" << std::endl;
- stream << padding << " goto nextTransition;";
- INDENT_MIN(stream, padding.length() + 21, MIN_COMMENT_PADDING);
- stream << "/* ordinary transition, check for spontaneous transitions */" << std::endl;
+ std::map<std::string, std::set<std::string> > tmp;
+
+ typedef std::map<std::string, std::set<std::string> >::const_iterator histIter_t;
+ typedef std::set<std::string>::const_iterator histMemberIter_t;
+
+ // we will remember these - will the other try to forget them?
+ INTERSECT_MAPS(toRemember, other.toForget, tmp);
+ if (tmp.size() > 0)
+ return false;
+
+ // we will keep these - will the other try to forget them?
+ INTERSECT_MAPS(toKeep, other.toForget, tmp);
+ if (tmp.size() > 0)
+ return false;
+
+ // we will forget these - will the other try to keep or even remember?
+ INTERSECT_MAPS(toForget, other.toKeep, tmp);
+ if (tmp.size() > 0)
+ return false;
+ INTERSECT_MAPS(toForget, other.toRemember, tmp);
+ if (tmp.size() > 0)
+ return false;
+
+ return true;
+}
+
+void HistoryTransitionClass::merge(const HistoryTransitionClass& other) {
+ members.insert(other.members.begin(), other.members.end());
+
+ std::map<std::string, std::set<std::string> >::const_iterator histIter;
+
+ histIter = other.toRemember.begin();
+ while(histIter != other.toRemember.end()) {
+ toRemember[histIter->first].insert(histIter->second.begin(), histIter->second.end());
+ histIter++;
+ }
+
+ histIter = other.toForget.begin();
+ while(histIter != other.toForget.end()) {
+ toForget[histIter->first].insert(histIter->second.begin(), histIter->second.end());
+ histIter++;
+ }
+
+ histIter = other.toKeep.begin();
+ while(histIter != other.toKeep.end()) {
+ toKeep[histIter->first].insert(histIter->second.begin(), histIter->second.end());
+ histIter++;
}
- stream << padding << "}" << std::endl;
}
+void ChartToPromela::writeTransitionClosure(std::ostream& stream, GlobalTransition* transition, GlobalState* state, int indent) {
+ std::string padding;
+ for (int i = 0; i < indent; i++) {
+ padding += " ";
+ }
+
+ if (state->isFinal) {
+ stream << padding << "goto terminate;" << std::endl;
+ } else {
+ if (!transition->isEventless) {
+ stream << padding << "spontaneous = true;" << std::endl;
+ }
+ stream << padding << "goto microStep;" << std::endl;
+ }
+}
+
void ChartToPromela::writeExecutableContent(std::ostream& stream, const Arabica::DOM::Node<std::string>& node, int indent) {
if (!node)
return;
@@ -812,7 +1323,7 @@ void ChartToPromela::writeExecutableContent(std::ostream& stream, const Arabica:
if (node.getNodeType() == Node_base::COMMENT_NODE) {
// we cannot have labels in an atomic block, just process inline promela
- PromelaInlines promInls = getInlinePromela(boost::trim_copy(node.getNodeValue()));
+ PromelaInlines promInls = PromelaInlines::fromNode(node);
// TODO!
// if (promInls) {
// stream << padding << "skip;" << std::endl;
@@ -983,7 +1494,7 @@ void ChartToPromela::writeExecutableContent(std::ostream& stream, const Arabica:
}
}
} else if(TAGNAME(nodeElem) == "invoke") {
- _invokers[ATTR(nodeElem, "invokeid")].writeStartEventSources(stream, indent);
+ _invokers[ATTR(nodeElem, "invokeid")].writeStart(stream, indent);
} else if(TAGNAME(nodeElem) == "uninvoke") {
stream << padding << ATTR(nodeElem, "invokeid") << "EventSourceDone" << "= 1;" << std::endl;
} else if(TAGNAME(nodeElem) == "cancel") {
@@ -993,322 +1504,37 @@ void ChartToPromela::writeExecutableContent(std::ostream& stream, const Arabica:
assert(false);
}
}
-
-#if 0
-void ChartToPromela::writeExecutableContent(std::ostream& stream, const Arabica::DOM::Node<std::string>& node, int indent) {
-
-// std::cout << std::endl << node << std::endl;
- if (!node)
- return;
-
- std::string padding;
- for (int i = 0; i < indent; i++) {
- padding += " ";
- }
-
-// std::cerr << node << std::endl;
-
- if (node.getNodeType() == Node_base::COMMENT_NODE) {
- // we cannot have labels in an atomic block, just process inline promela
- std::string comment = node.getNodeValue();
- boost::trim(comment);
- std::stringstream inlinePromela;
- if (!boost::starts_with(comment, "#promela-inline"))
- return;
- std::stringstream ssLine(comment);
- std::string line;
- std::getline(ssLine, line); // consume first line
- while(std::getline(ssLine, line)) {
- if (line.length() == 0)
- continue;
- inlinePromela << line << std::endl;
- }
- stream << padding << "skip;" << std::endl;
- stream << beautifyIndentation(inlinePromela.str(), indent) << std::endl;
+
+PromelaInlines PromelaInlines::fromNodeSet(const NodeSet<std::string>& node, bool recurse) {
+ PromelaInlines allPromInls;
+ Arabica::XPath::NodeSet<std::string> comments = InterpreterImpl::filterChildType(Node_base::COMMENT_NODE, node, recurse);
+ for (int i = 0; i < comments.size(); i++) {
+ allPromInls.merge(PromelaInlines::fromNode(comments[i]));
}
+ return allPromInls;
+
+}
- if (node.getNodeType() != Node_base::ELEMENT_NODE)
- return;
-
- Arabica::DOM::Element<std::string> nodeElem = Arabica::DOM::Element<std::string>(node);
-
- if (false) {
-// } else if(TAGNAME(nodeElem) == "state") {
-// if (HAS_ATTR(nodeElem, "transient") && DOMUtils::attributeIsTrue(ATTR(nodeElem, "transient"))) {
-// Arabica::XPath::NodeSet<std::string> execContent = getTransientContent(nodeElem);
-// for (int i = 0; i < execContent.size(); i++) {
-// writeExecutableContent(stream, execContent[i], indent);
-// }
-// }
- } else if(TAGNAME(nodeElem) == "transition") {
- stream << "t" << _transitions[nodeElem] << ":";
-
- int number = _transitions[nodeElem];
- int digits = 0;
- do {
- number /= 10;
- digits++;
- } while (number != 0);
-
- INDENT_MIN(stream, 2 + digits, MIN_COMMENT_PADDING);
-
- Node<std::string> source = node.getParentNode();
- stream << " /* from state " << ATTR_CAST(source, "id") << " */" << std::endl;
-
- // gather all executable content
- NodeSet<std::string> execContent = getTransientContent(_states[ATTR(nodeElem, "target")], ATTR_CAST(source, "id"));
-
- // check for special promela labels
- if (HAS_ATTR(nodeElem, "target")) {
- PromelaInlines promInls = getInlinePromela(execContent, true);
-
- if (promInls.acceptLabels > 0)
- stream << padding << "acceptLabelT" << _transitions[nodeElem] << ":" << std::endl;
- if (promInls.endLabels > 0)
- stream << padding << "endLabelT" << _transitions[nodeElem] << ":" << std::endl;
- if (promInls.progressLabels > 0)
- stream << padding << "progressLabelT" << _transitions[nodeElem] << ":" << std::endl;
- }
-
- stream << padding << "atomic {" << std::endl;
-// writeExecutableContent(stream, _states[ATTR(nodeElem, "target")], indent+1);
- for (int i = 0; i < execContent.size(); i++) {
- writeExecutableContent(stream, execContent[i], indent+1);
- }
- stream << padding << " skip;" << std::endl;
-
- Node<std::string> newState = getUltimateTarget(nodeElem);
- for (int i = 0; i < _globalStates.size(); i++) {
- if (newState != _globalStates[i])
- continue;
-
- std::string stateId = ATTR_CAST(_globalStates[i], "id");
-
- stream << padding << " s = s" << i << ";";
-
- int number = i;
- int digits = 0;
- do {
- number /= 10;
- digits++;
- } while (number != 0);
-
- INDENT_MIN(stream, 10 + digits, MIN_COMMENT_PADDING);
-
- stream << " /* to state " << stateId << " */" << std::endl;
-
-// if (_analyzer.usesInPredicate()) {
-// FlatStateIdentifier flatId(stateId);
-// std::map<std::string, int> allOrigStates = _analyzer.getOrigStates();
-// for (std::map<std::string, int>::iterator allOrigIter = allOrigStates.begin(); allOrigIter != allOrigStates.end(); allOrigIter++) {
-// stream << padding << " _x.states[" << _analyzer.macroForLiteral(allOrigIter->first) << "] = ";
-// if (std::find(flatId.getActive().begin(), flatId.getActive().end(), allOrigIter->first) != flatId.getActive().end()) {
-// stream << "true;" << std::endl;
-// } else {
-// stream << "false;" << std::endl;
-// }
-// }
-// }
-
- }
-
- stream << padding << "}" << std::endl;
- if (isFinal(Element<std::string>(newState))) {
- stream << padding << "goto terminate;";
- INDENT_MIN(stream, padding.length() + 14, MIN_COMMENT_PADDING);
- stream << "/* final state */" << std::endl;
- } else if (!HAS_ATTR_CAST(node, "event")) {
- stream << padding << "goto nextTransition;";
- INDENT_MIN(stream, padding.length() + 19, MIN_COMMENT_PADDING);
- stream << "/* spontaneous transition, check for more transitions */" << std::endl;
- } else {
- stream << padding << "eventLess = true;" << std::endl;
- stream << padding << "goto nextTransition;";
- INDENT_MIN(stream, padding.length() + 21, MIN_COMMENT_PADDING);
- stream << "/* ordinary transition, check for spontaneous transitions */" << std::endl;
- }
-
- } else if(TAGNAME(nodeElem) == "onentry" || TAGNAME(nodeElem) == "onexit") {
- Arabica::DOM::Node<std::string> child = node.getFirstChild();
- while(child) {
-// std::cerr << node << std::endl;
- if (child.getNodeType() == Node_base::TEXT_NODE) {
- if (boost::trim_copy(child.getNodeValue()).length() > 0)
- stream << beautifyIndentation(_analyzer.replaceLiterals(child.getNodeValue()), indent) << std::endl;
- }
- if (child.getNodeType() == Node_base::ELEMENT_NODE) {
- writeExecutableContent(stream, child, indent);
- }
- child = child.getNextSibling();
- }
-
- } else if(TAGNAME(nodeElem) == "script") {
- NodeSet<std::string> scriptText = filterChildType(Node_base::TEXT_NODE, node, true);
- for (int i = 0; i < scriptText.size(); i++) {
- stream << _analyzer.replaceLiterals(beautifyIndentation(scriptText[i].getNodeValue(), indent)) << std::endl;
- }
-
- } else if(TAGNAME(nodeElem) == "log") {
- std::string label = (HAS_ATTR(nodeElem, "label") ? ATTR(nodeElem, "label") : "");
- std::string expr = (HAS_ATTR(nodeElem, "expr") ? ATTR(nodeElem, "expr") : "");
- std::string trimmedExpr = boost::trim_copy(expr);
- bool isStringLiteral = (boost::starts_with(trimmedExpr, "\"") || boost::starts_with(trimmedExpr, "'"));
-
- std::string formatString;
- std::string varString;
- std::string seperator;
-
- if (label.size() > 0) {
- formatString += label + ": ";
- }
-
- if (isStringLiteral) {
- formatString += expr;
- } else {
- formatString += "%d";
- varString += seperator + expr;
- }
-
- if (varString.length() > 0) {
- stream << padding << "printf(\"" + formatString + "\", " + varString + ");" << std::endl;
- } else {
- stream << padding << "printf(\"" + formatString + "\");" << std::endl;
- }
-
- } else if(TAGNAME(nodeElem) == "foreach") {
- stream << padding << "for (" << (HAS_ATTR(nodeElem, "index") ? ATTR(nodeElem, "index") : "_index") << " in " << ATTR(nodeElem, "array") << ") {" << std::endl;
- if (HAS_ATTR(nodeElem, "item")) {
- stream << padding << " " << ATTR(nodeElem, "item") << " = " << ATTR(nodeElem, "array") << "[" << (HAS_ATTR(nodeElem, "index") ? ATTR(nodeElem, "index") : "_index") << "];" << std::endl;
- }
- Arabica::DOM::Node<std::string> child = node.getFirstChild();
- while(child) {
- writeExecutableContent(stream, child, indent + 1);
- child = child.getNextSibling();
- }
- if (HAS_ATTR(nodeElem, "index"))
- stream << padding << " " << ATTR(nodeElem, "index") << "++;" << std::endl;
- stream << padding << "}" << std::endl;
-
- } else if(TAGNAME(nodeElem) == "if") {
- NodeSet<std::string> condChain;
- condChain.push_back(node);
- condChain.push_back(filterChildElements(_nsInfo.xmlNSPrefix + "elseif", node));
- condChain.push_back(filterChildElements(_nsInfo.xmlNSPrefix + "else", node));
-
- writeIfBlock(stream, condChain, indent);
-
- } else if(TAGNAME(nodeElem) == "assign") {
- if (HAS_ATTR(nodeElem, "location")) {
- stream << padding << ATTR(nodeElem, "location") << " = ";
- }
- if (HAS_ATTR(nodeElem, "expr")) {
- stream << _analyzer.replaceLiterals(ATTR(nodeElem, "expr")) << ";" << std::endl;
- } else {
- NodeSet<std::string> assignTexts = filterChildType(Node_base::TEXT_NODE, nodeElem, true);
- if (assignTexts.size() > 0) {
- stream << _analyzer.replaceLiterals(boost::trim_copy(assignTexts[0].getNodeValue())) << ";" << std::endl;
- }
- }
- } else if(TAGNAME(nodeElem) == "send" || TAGNAME(nodeElem) == "raise") {
- std::string targetQueue;
- if (TAGNAME(nodeElem) == "raise") {
- targetQueue = "iQ!";
- } else if (!HAS_ATTR(nodeElem, "target")) {
- targetQueue = "tmpQ!";
- } else if (ATTR(nodeElem, "target").compare("#_internal") == 0) {
- targetQueue = "iQ!";
- }
- if (targetQueue.length() > 0) {
- // this is for our external queue
- std::string event;
-
- if (HAS_ATTR(nodeElem, "event")) {
- event = _analyzer.macroForLiteral(ATTR(nodeElem, "event"));
- } else if (HAS_ATTR(nodeElem, "eventexpr")) {
- event = ATTR(nodeElem, "eventexpr");
- }
- if (_analyzer.usesComplexEventStruct()) {
- stream << padding << "{" << std::endl;
- stream << padding << " _event_t tmpEvent;" << std::endl;
- stream << padding << " tmpEvent.name = " << event << ";" << std::endl;
-
- if (HAS_ATTR(nodeElem, "idlocation")) {
- stream << padding << " /* idlocation */" << std::endl;
- stream << padding << " _lastSendId = _lastSendId + 1;" << std::endl;
- stream << padding << " " << ATTR(nodeElem, "idlocation") << " = _lastSendId;" << std::endl;
- stream << padding << " tmpEvent.sendid = _lastSendId;" << std::endl;
- stream << padding << " if" << std::endl;
- stream << padding << " :: _lastSendId == 2147483647 -> _lastSendId = 0;" << std::endl;
- stream << padding << " :: timeout -> skip;" << std::endl;
- stream << padding << " fi;" << std::endl;
- } else if (HAS_ATTR(nodeElem, "id")) {
- stream << padding << " tmpEvent.sendid = " << _analyzer.macroForLiteral(ATTR(nodeElem, "id")) << ";" << std::endl;
- }
-
- if (_analyzer.usesEventField("origintype") && targetQueue.compare("iQ!") != 0) {
- stream << padding << " tmpEvent.origintype = " << _analyzer.macroForLiteral("http://www.w3.org/TR/scxml/#SCXMLEventProcessor") << ";" << std::endl;
- }
-
- if (_analyzer.usesEventField("type")) {
- std::string eventType = (targetQueue.compare("iQ!") == 0 ? _analyzer.macroForLiteral("internal") : _analyzer.macroForLiteral("external"));
- stream << padding << " tmpEvent.type = " << eventType << ";" << std::endl;
- }
-
- NodeSet<std::string> sendParams = filterChildElements(_nsInfo.xmlNSPrefix + "param", nodeElem);
- NodeSet<std::string> sendContents = filterChildElements(_nsInfo.xmlNSPrefix + "content", nodeElem);
- std::string sendNameList = ATTR(nodeElem, "namelist");
- if (sendParams.size() > 0) {
- for (int i = 0; i < sendParams.size(); i++) {
- Element<std::string> paramElem = Element<std::string>(sendParams[i]);
- stream << padding << " tmpEvent.data." << ATTR(paramElem, "name") << " = " << ATTR(paramElem, "expr") << ";" << std::endl;
- }
- }
- if (sendNameList.size() > 0) {
- std::list<std::string> nameListIds = tokenizeIdRefs(sendNameList);
- std::list<std::string>::iterator nameIter = nameListIds.begin();
- while(nameIter != nameListIds.end()) {
- stream << padding << " tmpEvent.data." << *nameIter << " = " << *nameIter << ";" << std::endl;
- nameIter++;
- }
- }
-
- if (sendParams.size() == 0 && sendNameList.size() == 0 && sendContents.size() > 0) {
- Element<std::string> contentElem = Element<std::string>(sendContents[0]);
- if (contentElem.hasChildNodes() && contentElem.getFirstChild().getNodeType() == Node_base::TEXT_NODE) {
- stream << padding << " tmpEvent.data = " << spaceNormalize(contentElem.getFirstChild().getNodeValue()) << ";" << std::endl;
- } else if (HAS_ATTR(contentElem, "expr")) {
- stream << padding << " tmpEvent.data = " << _analyzer.replaceLiterals(ATTR(contentElem, "expr")) << ";" << std::endl;
- }
- }
- stream << padding << " " << targetQueue << "tmpEvent;" << std::endl;
- stream << padding << "}" << std::endl;
- } else {
- stream << padding << targetQueue << event << ";" << std::endl;
- }
- }
- } else if(TAGNAME(nodeElem) == "invoke") {
- _invokers[ATTR(nodeElem, "invokeid")].writeStartEventSources(stream, indent);
- } else if(TAGNAME(nodeElem) == "uninvoke") {
- stream << padding << ATTR(nodeElem, "invokeid") << "EventSourceDone" << "= 1;" << std::endl;
- } else if(TAGNAME(nodeElem) == "cancel") {
- // noop
- } else {
+PromelaInlines PromelaInlines::fromNode(const Arabica::DOM::Node<std::string>& node) {
+ if (node.getNodeType() != Node_base::COMMENT_NODE && node.getNodeType() != Node_base::TEXT_NODE)
+ return PromelaInlines();
+ return PromelaInlines(node.getNodeValue(), node);
+}
- std::cerr << "'" << TAGNAME(nodeElem) << "'" << std::endl << nodeElem << std::endl;
- assert(false);
- }
+ PromelaInlines PromelaInlines::fromString(const std::string& text) {
+ return PromelaInlines(text, Arabica::DOM::Node<std::string>());
+}
+PromelaInlines::PromelaInlines() : nrProgressLabels(0), nrAcceptLabels(0), nrEndLabels(0), nrEventSources(0), nrCodes(0) {
}
-#endif
-
-PromelaInlines ChartToPromela::getInlinePromela(const std::string& content) {
- PromelaInlines prom;
+
+PromelaInlines::PromelaInlines(const std::string& content, const Arabica::DOM::Node<std::string>& node)
+ : nrProgressLabels(0), nrAcceptLabels(0), nrEndLabels(0), nrEventSources(0), nrCodes(0) {
std::stringstream ssLine(content);
std::string line;
bool isInPromelaCode = false;
- bool isInPromelaEventSource = false;
PromelaInline promInl;
while(std::getline(ssLine, line)) {
@@ -1316,79 +1542,54 @@ PromelaInlines ChartToPromela::getInlinePromela(const std::string& content) {
if (trimLine.length() == 0)
continue;
if (boost::starts_with(trimLine, "#promela")) {
- if (isInPromelaCode || isInPromelaEventSource) {
- prom.inlines.push_back(promInl);
+ if (isInPromelaCode) {
+ code.push_back(promInl);
isInPromelaCode = false;
- isInPromelaEventSource = false;
}
promInl = PromelaInline();
}
if (false) {
} else if (boost::starts_with(trimLine, "#promela-progress")) {
- prom.progressLabels++;
+ nrProgressLabels++;
promInl.type = PromelaInline::PROMELA_PROGRESS_LABEL;
promInl.content = line;
- prom.inlines.push_back(promInl);
+ code.push_back(promInl);
} else if (boost::starts_with(trimLine, "#promela-accept")) {
- prom.acceptLabels++;
+ nrAcceptLabels++;
promInl.type = PromelaInline::PROMELA_ACCEPT_LABEL;
promInl.content = line;
- prom.inlines.push_back(promInl);
+ code.push_back(promInl);
} else if (boost::starts_with(trimLine, "#promela-end")) {
- prom.endLabels++;
+ nrEndLabels++;
promInl.type = PromelaInline::PROMELA_END_LABEL;
promInl.content = line;
- prom.inlines.push_back(promInl);
+ code.push_back(promInl);
} else if (boost::starts_with(trimLine, "#promela-inline")) {
- prom.codes++;
+ nrCodes++;
isInPromelaCode = true;
promInl.type = PromelaInline::PROMELA_CODE;
} else if (boost::starts_with(trimLine, "#promela-event-source-custom")) {
- prom.customEventSources++;
+ nrEventSources++;
isInPromelaCode = true;
promInl.type = PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM;
} else if (boost::starts_with(trimLine, "#promela-event-source")) {
- prom.eventSources++;
- isInPromelaEventSource = true;
+ nrEventSources++;
+ isInPromelaCode = true;
promInl.type = PromelaInline::PROMELA_EVENT_SOURCE;
} else if (isInPromelaCode) {
promInl.content += line;
promInl.content += "\n";
- } else if (isInPromelaEventSource) {
- std::list<std::string> seq;
- std::stringstream ssToken(trimLine);
- std::string token;
- while(std::getline(ssToken, token, ' ')) {
- if (token.length() == 0)
- continue;
- seq.push_back(token);
- }
- promInl.sequences.push_back(seq);
}
}
// inline code ends with comment
- if (isInPromelaCode || isInPromelaEventSource) {
- prom.inlines.push_back(promInl);
+ if (isInPromelaCode) {
+ code.push_back(promInl);
}
+
+ // iterate inlinesFound and classify
+// PromelaEventSource promES; // TODO! use this
- return prom;
-}
-
-PromelaInlines ChartToPromela::getInlinePromela(const Arabica::DOM::Node<std::string>& node) {
- if (node.getNodeType() != Node_base::COMMENT_NODE)
- return getInlinePromela(std::string());
- return getInlinePromela(node.getNodeValue());
-}
-
-PromelaInlines ChartToPromela::getInlinePromela(const Arabica::XPath::NodeSet<std::string>& elements, bool recurse) {
- PromelaInlines allPromInls;
-
- Arabica::XPath::NodeSet<std::string> comments = filterChildType(Node_base::COMMENT_NODE, elements, recurse);
- for (int i = 0; i < comments.size(); i++) {
- allPromInls.merge(getInlinePromela(comments[i]));
- }
- return allPromInls;
}
void ChartToPromela::writeIfBlock(std::ostream& stream, const Arabica::XPath::NodeSet<std::string>& condChain, int indent) {
@@ -1454,7 +1655,6 @@ void ChartToPromela::writeIfBlock(std::ostream& stream, const Arabica::XPath::No
}
writeIfBlock(stream, cdrCondChain, indent + 1);
stream << padding << "}" << std::endl;
-
}
stream << padding << "fi;" << std::endl;
@@ -1512,20 +1712,20 @@ void ChartToPromela::writeDeclarations(std::ostream& stream) {
if (_analyzer.usesComplexEventStruct()) {
// event is defined with the typedefs
stream << "_event_t _event; /* current state */" << std::endl;
- stream << "unsigned s : " << BIT_WIDTH(_globalConf.size() + 1) << "; /* current state */" << std::endl;
+ stream << "unsigned s : " << BIT_WIDTH(_activeConf.size() + 1) << "; /* current state */" << std::endl;
stream << "chan iQ = [" << MAX(_internalQueueLength, 1) << "] of {_event_t} /* internal queue */" << std::endl;
stream << "chan eQ = [" << _externalQueueLength + 1 << "] of {_event_t} /* external queue */" << std::endl;
stream << "chan tmpQ = [" << MAX(_externalQueueLength, 1) << "] of {_event_t} /* temporary queue for external events in transitions */" << std::endl;
stream << "hidden _event_t tmpQItem;" << std::endl;
} else {
stream << "unsigned _event : " << BIT_WIDTH(_analyzer.getEvents().size() + 1) << "; /* current event */" << std::endl;
- stream << "unsigned s : " << BIT_WIDTH(_globalConf.size() + 1) << "; /* current state */" << std::endl;
+ stream << "unsigned s : " << BIT_WIDTH(_activeConf.size() + 1) << "; /* current state */" << std::endl;
stream << "chan iQ = [" << MAX(_internalQueueLength, 1) << "] of {int} /* internal queue */" << std::endl;
stream << "chan eQ = [" << _externalQueueLength + 1 << "] of {int} /* external queue */" << std::endl;
stream << "chan tmpQ = [" << MAX(_externalQueueLength, 1) << "] of {int} /* temporary queue for external events in transitions */" << std::endl;
stream << "hidden unsigned tmpQItem : " << BIT_WIDTH(_analyzer.getEvents().size() + 1) << ";" << std::endl;
}
- stream << "bool eventLess = true; /* whether to process event-less only n this step */" << std::endl;
+ stream << "bool spontaneous = true; /* whether to process event-less only n this step */" << std::endl;
stream << "hidden int _index; /* helper for indexless foreach loops */" << std::endl;
if (_analyzer.getTypes().types.find("_ioprocessors") != _analyzer.getTypes().types.end()) {
@@ -1540,7 +1740,7 @@ void ChartToPromela::writeDeclarations(std::ostream& stream) {
// stream << "_x_t _x;" << std::endl;
// }
- stream << std::endl;
+ stream << std::endl << std::endl;
// get all data elements
NodeSet<std::string> datas = _xpath.evaluate("//" + _nsInfo.xpathPrefix + "data", _scxml).asNodeSet();
@@ -1647,12 +1847,12 @@ void ChartToPromela::writeEventSources(std::ostream& stream) {
std::list<PromelaInline>::iterator inlineIter;
if (_globalEventSource) {
- _globalEventSource.writeEventSource(stream);
+ _globalEventSource.writeBody(stream);
}
std::map<std::string, PromelaEventSource>::iterator invIter = _invokers.begin();
while(invIter != _invokers.end()) {
- invIter->second.writeEventSource(stream);
+ invIter->second.writeBody(stream);
invIter++;
}
}
@@ -1665,27 +1865,27 @@ void ChartToPromela::writeFSM(std::ostream& stream) {
// transitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", _startState);
// assert(transitions.size() == 1);
- stream << " /* transition to initial state */" << std::endl;
+ stream << "/* transition to initial state */" << std::endl;
assert(_start->sortedOutgoing.size() == 1);
// initial transition has to be first one for control flow at start
writeTransition(stream, _start->sortedOutgoing.front(), 1);
stream << std::endl;
- stream << " /* transition's executable content */" << std::endl;
// every other transition
- for (std::map<std::string, GlobalState*>::iterator stateIter = _globalConf.begin(); stateIter != _globalConf.end(); stateIter++) {
+ for (std::map<std::string, GlobalState*>::iterator stateIter = _activeConf.begin(); stateIter != _activeConf.end(); stateIter++) {
for (std::list<GlobalTransition*>::iterator transIter = stateIter->second->sortedOutgoing.begin(); transIter != stateIter->second->sortedOutgoing.end(); transIter++) {
// don't write initial transition
if (_start->sortedOutgoing.front() == *transIter)
continue;
- // don't write trivial transitions
- if ((*transIter)->hasExecutableContent)
+ // don't write trivial or history transitions
+ if ((*transIter)->historyBase == NULL) // TODO!
+// if ((*transIter)->hasExecutableContent && (*transIter)->historyBase == NULL)
writeTransition(stream, *transIter, 1);
}
}
stream << std::endl;
- stream << "nextStep:" << std::endl;
+ stream << "macroStep:" << std::endl;
stream << " /* push send events to external queue */" << std::endl;
stream << " if" << std::endl;
stream << " :: len(tmpQ) != 0 -> { tmpQ?_event; eQ!_event }" << std::endl;
@@ -1697,23 +1897,24 @@ void ChartToPromela::writeFSM(std::ostream& stream) {
stream << " :: len(iQ) != 0 -> iQ ? _event /* from internal queue */" << std::endl;
stream << " :: else -> eQ ? _event /* from external queue */" << std::endl;
stream << " fi;" << std::endl << std::endl;
+ stream << "microStep:" << std::endl;
stream << " /* event dispatching per state */" << std::endl;
- stream << "nextTransition:" << std::endl;
stream << " if" << std::endl;
writeEventDispatching(stream);
- stream << " :: else -> assert(false); /* this is an error as we dispatched all valid states */" << std::endl;
+ stream << "/* this is an error as we dispatched all valid states */" << std::endl;
+ stream << " :: else -> assert(false);" << std::endl;
stream << " fi;" << std::endl;
stream << "terminate: skip;" << std::endl;
// stop all event sources
if (_globalEventSource)
- _globalEventSource.writeStopEventSources(stream, 1);
+ _globalEventSource.writeStop(stream, 1);
std::map<std::string, PromelaEventSource>::iterator invIter = _invokers.begin();
while(invIter != _invokers.end()) {
- invIter->second.writeStopEventSources(stream, 1);
+ invIter->second.writeStop(stream, 1);
invIter++;
}
@@ -1721,23 +1922,26 @@ void ChartToPromela::writeFSM(std::ostream& stream) {
}
void ChartToPromela::writeEventDispatching(std::ostream& stream) {
- for (std::map<std::string, GlobalState*>::iterator stateIter = _globalConf.begin(); stateIter != _globalConf.end(); stateIter++) {
+ for (std::map<std::string, GlobalState*>::iterator stateIter = _activeConf.begin(); stateIter != _activeConf.end(); stateIter++) {
// if (_globalStates[i] == _startState)
// continue;
+ // do not write state with history - we only iterate pure active
+// if (stateIter->second->historyStatesRefs.size() > 0)
+// continue;
+
const std::string& stateId = stateIter->first;
const GlobalState* state = stateIter->second;
- int digits = 0;
- LENGTH_FOR_NUMBER(state->index, digits);
- stream << " :: (s == s" << state->index << ") -> {";
-
- INDENT_MIN(stream, 18 + digits, MIN_COMMENT_PADDING);
+ stream << std::endl << "/* ### current state ";
+ FlatStateIdentifier flatActiveSource(stateId);
+ PRETTY_PRINT_LIST(stream, flatActiveSource.getActive());
+ stream << " ######################## */" << std::endl;
- stream << " /* from state " << stateId << " */" << std::endl;
+ stream << " :: (s == s" << state->index << ") -> {" << std::endl;
writeDispatchingBlock(stream, state->sortedOutgoing, 2);
-// stream << " goto nextStep;";
+// stream << " goto macroStep;";
stream << " }" << std::endl;
}
}
@@ -1749,29 +1953,26 @@ void ChartToPromela::writeDispatchingBlock(std::ostream& stream, std::list<Globa
}
if (transitions.size() == 0) {
- stream << padding << "eventLess = false;" << std::endl;
- stream << padding << "goto nextStep;";
- INDENT_MIN(stream, padding.size() + 13, MIN_COMMENT_PADDING);
stream << "/* no transition applicable */" << std::endl;
+ stream << padding << "spontaneous = false;" << std::endl;
+ stream << padding << "goto macroStep;" << std::endl;
return;
}
GlobalTransition* currTrans = transitions.front();
transitions.pop_front();
- std::stringstream tmpSS;
- tmpSS << padding << "if" << std::endl;
- size_t lineStart = tmpSS.tellp();
+ stream << padding << "if" << std::endl;
if (currTrans->condition.size() > 0) {
- tmpSS << padding << ":: ((";
+ stream << padding << ":: ((";
} else {
- tmpSS << padding << ":: (";
+ stream << padding << ":: (";
}
if (currTrans->isEventless) {
- tmpSS << "eventLess";
+ stream << "spontaneous";
} else {
std::string eventDescs = currTrans->eventDesc;
@@ -1792,64 +1993,57 @@ void ChartToPromela::writeDispatchingBlock(std::ostream& stream, std::list<Globa
}
if (eventPrefixes.size() > 0) {
- tmpSS << "!eventLess && ";
+ stream << "!spontaneous && ";
} else {
- tmpSS << "!eventLess";
+ stream << "!spontaneous";
}
std::string seperator;
std::set<std::string>::iterator eventIter = eventPrefixes.begin();
while(eventIter != eventPrefixes.end()) {
if (_analyzer.usesComplexEventStruct()) {
- tmpSS << seperator << "_event.name == " << _analyzer.macroForLiteral(*eventIter);
+ stream << seperator << "_event.name == " << _analyzer.macroForLiteral(*eventIter);
} else {
- tmpSS << seperator << "_event == " << _analyzer.macroForLiteral(*eventIter);
+ stream << seperator << "_event == " << _analyzer.macroForLiteral(*eventIter);
}
seperator = " || ";
eventIter++;
}
}
- tmpSS << ")";
+ stream << ")";
if (currTrans->condition.size() > 0) {
- tmpSS << " && " + _analyzer.replaceLiterals(currTrans->condition) + ")";
+ stream << " && " + _analyzer.replaceLiterals(currTrans->condition) + ")";
}
- if (currTrans->hasExecutableContent) {
- tmpSS << " -> goto t" << currTrans->index << ";";
- size_t lineEnd = tmpSS.tellp();
- size_t lineLength = lineEnd - lineStart;
-
- for (int i = lineLength; i < MIN_COMMENT_PADDING; i++)
- tmpSS << " ";
+ if (currTrans->hasExecutableContent || currTrans->historyTrans.size() > 0) {
+ stream << " -> { " << std::endl;
+
+ stream << "/* transition to ";
+ FlatStateIdentifier flatActiveSource(currTrans->activeDestination);
+ PRETTY_PRINT_LIST(stream, flatActiveSource.getActive());
+ stream << " */" << std::endl;
- tmpSS << " /* transition to " << currTrans->destination << " */" << std::endl;
+ stream << padding << " goto t" << currTrans->index << ";" << std::endl;
+ stream << padding << "}" << std::endl;
+
} else {
- tmpSS << " -> {" << std::endl;
- GlobalState* newState = _globalConf[currTrans->destination];
+ stream << " -> {" << std::endl;
+ GlobalState* newState = _activeConf[currTrans->activeDestination];
assert(newState != NULL);
- tmpSS << padding << " s = s" << newState->index << ";" << std::endl;
-
- if (newState->isFinal) {
- tmpSS << padding << " goto terminate;";
- INDENT_MIN(tmpSS, padding.length() + 14, MIN_COMMENT_PADDING);
- tmpSS << "/* final state */" << std::endl;
- } else if (currTrans->isEventless) {
- tmpSS << padding << " goto nextTransition;";
- INDENT_MIN(tmpSS, padding.length() + 19, MIN_COMMENT_PADDING);
- tmpSS << "/* spontaneous transition, check for more transitions */" << std::endl;
- } else {
- tmpSS << padding << " eventLess = true;" << std::endl;
- tmpSS << padding << " goto nextTransition;";
- INDENT_MIN(tmpSS, padding.length() + 21, MIN_COMMENT_PADDING);
- tmpSS << "/* ordinary transition, check for spontaneous transitions */" << std::endl;
- }
- tmpSS << padding << "}" << std::endl;
+ stream << "/* new state ";
+ FlatStateIdentifier flatActiveDest(currTrans->activeDestination);
+ PRETTY_PRINT_LIST(stream, flatActiveDest.getActive());
+ stream << " */" << std::endl;
+
+ stream << padding << " s = s" << newState->index << ";" << std::endl;
+
+ writeTransitionClosure(stream, currTrans, newState, indent + 1);
+ stream << padding << "}" << std::endl;
}
- stream << tmpSS.str();
- stream << padding << ":: else {" << std::endl;
+ stream << padding << ":: else -> {" << std::endl;
writeDispatchingBlock(stream, transitions, indent + 1);
@@ -1869,7 +2063,7 @@ void ChartToPromela::writeMain(std::ostream& stream) {
stream << std::endl;
}
if (_globalEventSource)
- _globalEventSource.writeStartEventSources(stream, 1);
+ _globalEventSource.writeStart(stream, 1);
stream << " run step();" << std::endl;
stream << "}" << std::endl;
@@ -1888,11 +2082,26 @@ void ChartToPromela::initNodes() {
continue;
Element<std::string> stateElem(states[i]);
_analyzer.addOrigState(ATTR(stateElem, "id"));
- if ((isCompound(stateElem) || isParallel(stateElem)) && !parentIsScxmlState(stateElem)) {
+ if (isCompound(stateElem) || isParallel(stateElem)) {
_analyzer.addEvent("done.state." + ATTR(stateElem, "id"));
}
}
+ // gather all potential members per history
+ std::map<std::string, Arabica::DOM::Element<std::string> >::iterator histIter = _historyTargets.begin();
+ while(histIter != _historyTargets.end()) {
+ NodeSet<std::string> histStatesMembers;
+ bool isDeep = (HAS_ATTR_CAST(histIter->second, "type") && ATTR_CAST(histIter->second, "type") == "deep");
+ histStatesMembers.push_back(filterChildElements(_nsInfo.xmlNSPrefix + "state", histIter->second.getParentNode(), isDeep));
+ histStatesMembers.push_back(filterChildElements(_nsInfo.xmlNSPrefix + "parallel", histIter->second.getParentNode(), isDeep));
+ histStatesMembers.push_back(filterChildElements(_nsInfo.xmlNSPrefix + "final", histIter->second.getParentNode(), isDeep));
+
+ for (int i = 0; i < histStatesMembers.size(); i++) {
+ _historyMembers[histIter->first].insert(std::make_pair(ATTR_CAST(histStatesMembers[i], "id"), i));
+ }
+ histIter++;
+ }
+
// initialize event trie with all events that might occur
NodeSet<std::string> internalEventNames;
internalEventNames.push_back(_xpath.evaluate("//" + _nsInfo.xpathPrefix + "transition", _scxml).asNodeSet());
@@ -1938,42 +2147,38 @@ void ChartToPromela::initNodes() {
}
- // external event names from comments
+ // external event names from comments and event sources
NodeSet<std::string> promelaEventSourceComments;
NodeSet<std::string> invokers = _xpath.evaluate("//" + _nsInfo.xpathPrefix + "invoke", _scxml).asNodeSet();
promelaEventSourceComments.push_back(filterChildType(Node_base::COMMENT_NODE, invokers, false)); // comments in invoke elements
promelaEventSourceComments.push_back(filterChildType(Node_base::COMMENT_NODE, _scxml, false)); // comments in scxml element
for (int i = 0; i < promelaEventSourceComments.size(); i++) {
- PromelaInlines promInls = getInlinePromela(promelaEventSourceComments[i]);
- PromelaEventSource promES(promInls, promelaEventSourceComments[i].getParentNode());
-
- if (TAGNAME_CAST(promelaEventSourceComments[i].getParentNode()) == "scxml") {
- promES.type = PromelaEventSource::PROMELA_EVENT_SOURCE_GLOBAL;
- promES.analyzer = &_analyzer;
- promES.name = "global";
- _globalEventSource = promES;
- } else if (TAGNAME_CAST(promelaEventSourceComments[i].getParentNode()) == "invoke") {
- if (!HAS_ATTR_CAST(promelaEventSourceComments[i].getParentNode(), "invokeid")) {
- Element<std::string> invoker = Element<std::string>(promelaEventSourceComments[i].getParentNode());
- invoker.setAttribute("invokeid", "invoker" + toStr(_invokers.size()));
+ PromelaInlines promInls = PromelaInlines::fromNode(promelaEventSourceComments[i]);
+
+ for ( std::list<PromelaInline>::iterator promIter = promInls.code.begin(); promIter != promInls.code.end(); promIter++) {
+ if (promIter->type == PromelaInline::PROMELA_EVENT_SOURCE || promIter->type == PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM) {
+ PromelaEventSource promES(*promIter, _externalQueueLength);
+ if (TAGNAME_CAST(promelaEventSourceComments[i].getParentNode()) == "scxml") {
+ promES.type = PromelaEventSource::PROMELA_EVENT_SOURCE_GLOBAL;
+ promES.name = "global";
+ promES.analyzer = &_analyzer;
+ _globalEventSource = promES;
+ } else {
+ if (!HAS_ATTR_CAST(promelaEventSourceComments[i].getParentNode(), "invokeid")) {
+ Element<std::string> invoker = Element<std::string>(promelaEventSourceComments[i].getParentNode());
+ invoker.setAttribute("invokeid", "invoker" + toStr(_invokers.size())); // if there is no invokeid, enumerate
+ }
+ std::string invokeId = ATTR_CAST(promelaEventSourceComments[i].getParentNode(), "invokeid");
+
+ promES.type = PromelaEventSource::PROMELA_EVENT_SOURCE_INVOKER;
+ promES.name = invokeId;
+ promES.analyzer = &_analyzer;
+ _invokers[invokeId] = promES;
+ }
}
- std::string invokeId = ATTR_CAST(promelaEventSourceComments[i].getParentNode(), "invokeid");
- promES.type = PromelaEventSource::PROMELA_EVENT_SOURCE_INVOKER;
- promES.analyzer = &_analyzer;
- promES.name = invokeId;
- _invokers[invokeId] = promES;
}
}
-
-#if 0
- // enumerate transitions
- NodeSet<std::string> transitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", _scxml, true);
- int index = 0;
- for (int i = 0; i < transitions.size(); i++) {
- _transitions[Element<std::string>(transitions[i])] = index++;
- }
-#endif
// add platform variables as string literals
_analyzer.addLiteral("_sessionid");
@@ -1986,8 +2191,9 @@ void ChartToPromela::initNodes() {
NodeSet<std::string> contents = filterChildElements(_nsInfo.xmlNSPrefix + "content", _scxml, true);
for (int i = 0; i < contents.size(); i++) {
Element<std::string> contentElem = Element<std::string>(contents[i]);
- if (contentElem.hasChildNodes() && contentElem.getFirstChild().getNodeType() == Node_base::TEXT_NODE) {
- _analyzer.addLiteral(spaceNormalize(contentElem.getFirstChild().getNodeValue()));
+ if (contentElem.hasChildNodes() && contentElem.getFirstChild().getNodeType() == Node_base::TEXT_NODE && contentElem.getChildNodes().getLength() == 1) {
+ std::string content = contentElem.getFirstChild().getNodeValue();
+ _analyzer.addLiteral(spaceNormalize(content));
}
}
@@ -2072,16 +2278,16 @@ std::string ChartToPromela::sanitizeCode(const std::string& code) {
}
void PromelaInline::dump() {
- std::list<std::list<std::string> >::iterator outerIter = sequences.begin();
- while(outerIter != sequences.end()) {
- std::list<std::string>::iterator innerIter = outerIter->begin();
- while(innerIter != outerIter->end()) {
- std::cout << *innerIter << " ";
- innerIter++;
- }
- std::cout << std::endl;
- outerIter++;
- }
+// std::list<std::list<std::string> >::iterator outerIter = sequences.begin();
+// while(outerIter != sequences.end()) {
+// std::list<std::string>::iterator innerIter = outerIter->begin();
+// while(innerIter != outerIter->end()) {
+// std::cout << *innerIter << " ";
+// innerIter++;
+// }
+// std::cout << std::endl;
+// outerIter++;
+// }
}
void ChartToPromela::writeProgram(std::ostream& stream) {
@@ -2112,6 +2318,10 @@ void ChartToPromela::writeProgram(std::ostream& stream) {
writeStateMap(stream);
stream << std::endl;
}
+ if (_historyMembers.size() > 0) {
+ writeHistoryArrays(stream);
+ stream << std::endl;
+ }
writeTypeDefs(stream);
stream << std::endl;
writeStrings(stream);
@@ -2129,7 +2339,7 @@ void ChartToPromela::writeProgram(std::ostream& stream) {
std::stringstream acceptingStates;
std::string seperator;
- for (std::map<std::string, GlobalState*>::iterator stateIter = _globalConf.begin(); stateIter != _globalConf.end(); stateIter++) {
+ for (std::map<std::string, GlobalState*>::iterator stateIter = _activeConf.begin(); stateIter != _activeConf.end(); stateIter++) {
FlatStateIdentifier flatId(stateIter->first);
if (std::find(flatId.getActive().begin(), flatId.getActive().end(), "pass") != flatId.getActive().end()) {
acceptingStates << seperator << "s == s" << stateIter->second->index;
@@ -2139,15 +2349,6 @@ void ChartToPromela::writeProgram(std::ostream& stream) {
if (acceptingStates.str().size() > 0) {
stream << "ltl { eventually (" << acceptingStates.str() << ") }" << std::endl;
}
-
-// if (_states.find("active:{pass}") != _states.end()) {
-// for (int i = 0; i < _globalStates.size(); i++) {
-// if (_states["active:{pass}"] != _globalStates[i])
-// continue;
-// stream << "ltl { eventually (s == s" << i << ") }";
-// break;
-// }
-// }
}
} \ No newline at end of file
diff --git a/src/uscxml/transform/ChartToPromela.h b/src/uscxml/transform/ChartToPromela.h
index a8ebe75..fe0660f 100644
--- a/src/uscxml/transform/ChartToPromela.h
+++ b/src/uscxml/transform/ChartToPromela.h
@@ -33,6 +33,8 @@
namespace uscxml {
+class PromelaCodeAnalyzer;
+
class USCXML_API PromelaInline {
public:
PromelaInline() : type(PROMELA_NIL) {}
@@ -54,36 +56,69 @@ public:
};
std::string content;
- std::list<std::list<std::string> > sequences;
-
PromelaInlineType type;
};
+class USCXML_API PromelaEventSource {
+public:
+
+ enum PromelaEventSourceType {
+ PROMELA_EVENT_SOURCE_INVALID,
+ PROMELA_EVENT_SOURCE_INVOKER,
+ PROMELA_EVENT_SOURCE_GLOBAL,
+ };
+
+ PromelaEventSource();
+ PromelaEventSource(const PromelaInline& source, uint32_t externalQueueLength = 0);
+
+ void writeStart(std::ostream& stream, int indent = 0);
+ void writeStop(std::ostream& stream, int indent = 0);
+ void writeDeclarations(std::ostream& stream, int indent = 0);
+ void writeBody(std::ostream& stream);
+
+ operator bool() {
+ return type != PROMELA_EVENT_SOURCE_INVALID;
+ }
+
+ PromelaInline source;
+ std::string name;
+ uint32_t externalQueueLength;
+
+ Arabica::DOM::Node<std::string> container;
+ std::list<std::list<std::string> > sequences;
+ PromelaEventSourceType type;
+ PromelaCodeAnalyzer* analyzer;
+};
+
class USCXML_API PromelaInlines {
public:
- PromelaInlines() : progressLabels(0), acceptLabels(0), endLabels(0), eventSources(0), customEventSources(0), codes(0) {}
+
+ static PromelaInlines fromNodeSet(const Arabica::XPath::NodeSet<std::string>& node, bool recurse = false);
+ static PromelaInlines fromNode(const Arabica::DOM::Node<std::string>& node);
+ static PromelaInlines fromString(const std::string& text);
+
+ PromelaInlines(const std::string& text, const Arabica::DOM::Node<std::string>& node);
+ PromelaInlines();
void merge(const PromelaInlines& other) {
- inlines.insert(inlines.end(), other.inlines.begin(), other.inlines.end());
- progressLabels += other.progressLabels;
- acceptLabels += other.acceptLabels;
- endLabels += other.endLabels;
- eventSources += other.eventSources;
- customEventSources += other.customEventSources;
- codes += other.codes;
+ code.insert(code.end(), other.code.begin(), other.code.end());
+ nrProgressLabels += other.nrProgressLabels;
+ nrAcceptLabels += other.nrAcceptLabels;
+ nrEndLabels += other.nrEndLabels;
+ nrEventSources += other.nrEventSources;
+ nrCodes += other.nrCodes;
}
operator bool() {
- return inlines.size() > 0;
+ return code.size() > 0;
}
- std::list<PromelaInline> inlines;
- int progressLabels;
- int acceptLabels;
- int endLabels;
- int eventSources;
- int customEventSources;
- int codes;
+ std::list<PromelaInline> code;
+ int nrProgressLabels;
+ int nrAcceptLabels;
+ int nrEndLabels;
+ int nrEventSources;
+ int nrCodes;
};
class USCXML_API PromelaCodeAnalyzer {
@@ -184,34 +219,44 @@ private:
bool _usesPlatformVars;
};
-class USCXML_API PromelaEventSource {
+class ExecContentSeqItem {
public:
-
- enum PromelaEventSourceType {
- PROMELA_EVENT_SOURCE_INVALID,
- PROMELA_EVENT_SOURCE_INVOKER,
- PROMELA_EVENT_SOURCE_GLOBAL,
+ enum ExecContentType {
+ EXEC_CONTENT_ALL_BUT,
+ EXEC_CONTENT_ONLY_FOR,
+ EXEC_CONTENT_EVERY
};
- PromelaEventSource();
- PromelaEventSource(const PromelaInlines& sources, const Arabica::DOM::Node<std::string>& parent);
+ ExecContentSeqItem(ExecContentType type, const std::set<GlobalTransition*>& transitions, const GlobalTransition::Action& action)
+ : type(type), transitions(transitions), action(action) {}
+ ExecContentSeqItem(ExecContentType type, GlobalTransition* transition, const GlobalTransition::Action& action)
+ : type(type), action(action) {
+ transitions.insert(transition);
+ }
+
+ ExecContentType type;
+ std::set<GlobalTransition*> transitions;
+ GlobalTransition::Action action;
+};
- void writeStartEventSources(std::ostream& stream, int indent = 0);
- void writeStopEventSources(std::ostream& stream, int indent = 0);
- void writeDeclarations(std::ostream& stream, int indent = 0);
- void writeEventSource(std::ostream& stream);
+class HistoryTransitionClass {
+public:
+ HistoryTransitionClass(GlobalTransition* transition);
+ HistoryTransitionClass(const std::string& from, const std::string& to);
+
+ void init(const std::string& from, const std::string& to);
+
+ std::map<std::string, std::set<std::string> > toRemember;
+ std::map<std::string, std::set<std::string> > toKeep;
+ std::map<std::string, std::set<std::string> > toForget;
+
+ std::set<GlobalTransition*> members;
- operator bool() {
- return type != PROMELA_EVENT_SOURCE_INVALID;
- }
- std::string name;
- PromelaInlines eventSources;
- Arabica::DOM::Node<std::string> container;
- PromelaEventSourceType type;
- PromelaCodeAnalyzer* analyzer;
+ void merge(const HistoryTransitionClass& other);
+ bool matches(const HistoryTransitionClass& other);
};
-
+
class USCXML_API ChartToPromela : public TransformerImpl, public ChartToFSM {
public:
@@ -232,11 +277,17 @@ protected:
void writeEvents(std::ostream& stream);
void writeStates(std::ostream& stream);
void writeStateMap(std::ostream& stream);
+ void writeHistoryArrays(std::ostream& stream);
void writeTypeDefs(std::ostream& stream);
void writeStrings(std::ostream& stream);
void writeDeclarations(std::ostream& stream);
void writeEventSources(std::ostream& stream);
- void writeTransition(std::ostream& stream, const GlobalTransition* transition, int indent = 0);
+ void writeTransition(std::ostream& stream, GlobalTransition* transition, int indent = 0);
+ std::string conditionalizeForHist(const std::set<GlobalTransition*>& transitions, int indent = 0);
+ std::string conditionalizeForHist(GlobalTransition* transition, int indent = 0);
+ void writeHistoryAssignments(std::ostream& stream, GlobalTransition* transition, int indent = 0);
+ void writeTransitionClosure(std::ostream& stream, GlobalTransition* transition, GlobalState* state, int indent = 0);
+
void writeExecutableContent(std::ostream& stream, const Arabica::DOM::Node<std::string>& node, int indent = 0);
void writeInlineComment(std::ostream& stream, const Arabica::DOM::Node<std::string>& node);
void writeFSM(std::ostream& stream);
@@ -248,13 +299,10 @@ protected:
Arabica::XPath::NodeSet<std::string> getTransientContent(const Arabica::DOM::Element<std::string>& state, const std::string& source = "");
//Arabica::DOM::Node<std::string> getUltimateTarget(const Arabica::DOM::Element<std::string>& transition);
-
- static PromelaInlines getInlinePromela(const std::string&);
- static PromelaInlines getInlinePromela(const Arabica::XPath::NodeSet<std::string>& elements, bool recurse = false);
- static PromelaInlines getInlinePromela(const Arabica::DOM::Node<std::string>& elements);
static std::string declForRange(const std::string& identifier, long minValue, long maxValue, bool nativeOnly = false);
-
+ static std::string conditionForHistoryTransition(const GlobalTransition* transition);
+
// std::string replaceStringsInExpression(const std::string& expr);
std::string sanitizeCode(const std::string& code);
@@ -274,6 +322,8 @@ protected:
std::map<std::string, PromelaEventSource> _invokers;
PromelaEventSource _globalEventSource;
+ std::map<std::string, std::map<std::string, size_t> > _historyMembers; // ids of all history states
+
friend class PromelaEventSource;
};
diff --git a/src/uscxml/transform/FlatStateIdentifier.h b/src/uscxml/transform/FlatStateIdentifier.h
index 92e6e8a..011888a 100644
--- a/src/uscxml/transform/FlatStateIdentifier.h
+++ b/src/uscxml/transform/FlatStateIdentifier.h
@@ -110,6 +110,7 @@ public:
if (closingBracketPos != std::string::npos) {
state = state.substr(0, closingBracketPos);
}
+ boost::trim(state);
if (state.length() > 0) {
active.push_back(state);
}
@@ -123,6 +124,7 @@ public:
if (closingBracketPos != std::string::npos) {
state = state.substr(0, closingBracketPos);
}
+ boost::trim(state);
if (state.length() > 0) {
visited.push_back(state);
}
@@ -150,7 +152,11 @@ public:
if (closingBracketPos != std::string::npos) {
state = state.substr(0, closingBracketPos);
}
- histories[histName].push_back(state);
+ boost::trim(state);
+ if (state.length() > 0) {
+ histories[histName].push_back(state);
+ }
+
}
start = end + 2;
@@ -171,6 +177,10 @@ public:
return flatActive;
}
+ const std::string& getFlatHistory() {
+ return flatHistories;
+ }
+
const std::list<std::string>& getVisited() {
return visited;
}
@@ -181,8 +191,15 @@ public:
const std::map<std::string, std::list<std::string> > & getHistory() {
return histories;
}
- const std::string& getFlatHistory() {
- return flatHistories;
+
+ const std::map<std::string, std::set<std::string> > getHistorySets() {
+ std::map<std::string, std::set<std::string> > histSet;
+ std::map<std::string, std::list<std::string> >::const_iterator histIter = histories.begin();
+ while(histIter != histories.end()) {
+ histSet[histIter->first].insert(histIter->second.begin(), histIter->second.end());
+ histIter++;
+ }
+ return histSet;
}
protected: