diff options
22 files changed, 5505 insertions, 3448 deletions
@@ -29,16 +29,16 @@ uSCXML is a SCXML interpreter written in C/C++. It is [standards compliant](#test-reports) and [easily extended](#extending-uscxml) even in C# and Java. It runs on <b>Linux</b>, <b>Windows</b>, <b>Raspberry Pi</b> and <b>Mac OSX</b>, each 32- as well as 64Bits as well as <b>iOS</b>. -* <b>Datamodels</b> - * Full [ECMAScript datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/ecmascript) using Google's v8 (and JavaScriptCore on MacOSX and iOS) +* <b>Data Models</b> + * Full [ECMAScript data model](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/ecmascript) using Google's v8 (and JavaScriptCore on MacOSX and iOS) * Simplified support for [Web Storage](http://www.w3.org/TR/2013/REC-webstorage-20130730/) in document.localStorage * Support for binary data via [TypedArrays](https://www.khronos.org/registry/typedarray/specs/latest/) (will not throw exceptions yet) - * Full [NULL datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/null) with required <tt>In</tt> predicate - * [Prolog datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/prolog/swi) using SWI prolog - * Experimental [Promela datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/promela) for use + * Full [NULL data model](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/null) with required <tt>In</tt> predicate + * [Prolog data model](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/prolog/swi) using SWI prolog + * Experimental [Promela data model](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/promela) for use with the [SPIN](http://spinroot.com/spin/whatispin.html) model-checker - * Early support for a [Lua datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/lua) - * Rudimentary support for [XPath datamodel](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/xpath) + * Early support for a [Lua data model](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/lua) + * Rudimentary support for [XPath data model](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/datamodel/xpath) * <b>Invokers</b> * <tt>scxml</tt>: Invoke a nested scxml interpreter * <tt>dirmon</tt>: Watches a directory for changes to files @@ -47,17 +47,18 @@ even in C# and Java. It runs on <b>Linux</b>, <b>Windows</b>, <b>Raspberry Pi</b * <tt>umundo</tt>: Subscribe to channels and publish events * [Many others](https://github.com/tklab-tud/uscxml/tree/master/src/uscxml/plugins/invoker) * <b>DOM</b> - * DOM Core Level 2 + XPath extensions available for ecmascript datamodel + * DOM Core Level 2 + XPath extensions available for ecmascript data model * Namespace aware to embed custom markup for special invokers * <b>Communication</b> - * Features the standard basichttp io-processor - * Features the required SCXML io-processor - * <b>No</b> DOM io-processor + * Features the standard basichttp I/O processor + * Features the required SCXML I/O processor + * <b>No</b> DOM I/O processor * Early support for [WebSockets](http://datatracker.ietf.org/doc/rfc6455/) * Can actually respond to HTTP requests with data via <response> * <b>Language Bindings</b> - * PHP module for apache and cli interpreter * Java bindings + * C# bindings + * PHP module for apache and cli interpreter (discontinued) ### Test Reports @@ -157,7 +158,7 @@ details on how to build these. The uSCXML interpreter can be extended by introducing new -1. DataModels as embedded scripting languages (e.g. ECMAScript, Prolog and XPath) +1. Data models as embedded scripting languages (e.g. ECMAScript, Prolog and XPath) 2. Invokers to represent external components that deliver and accept events (e.g. iCal, SceneGraph, DirectoryMonitor) 3. I/O-Processors to provide communication with external systems (e.g. BasicHTTP, SCXML). 4. Elements for Executable Content (e.g. <respond>, <fetch>, <postpone>). @@ -197,7 +198,7 @@ approach can be used for invokers: interpreter.setInvoker("invokeId", invoker1); This will cause the interpreter to use the given instance for a given <tt>invokeId</tt> and not instantiate via -the factory. Similarly, datamodels can be registered via <tt>interpreter.setDataModel(DataModel dm)</tt>. +the factory. Similarly, data models can be registered via <tt>interpreter.setDataModel(DataModel dm)</tt>. <b>Note:</b> Providing ad-hoc extensions is only supported before the interpreter is started. If you change instances with a running interpreter, the behavior is undefined. @@ -241,13 +242,13 @@ itself is written in a subset of C++99 and ought to compile just fine. ## UTF8 support Currently, we use <tt>std::string</tt> to represent all strings. This is not a problem as e.g. the ECMAScript -datamodels will just interpret these as character arrays and handle Unicode respectively. Though it is a problem if +data models will just interpret these as character arrays and handle Unicode respectively. Though it is a problem if you like to use non-ASCII characters e.g. in the <tt>id</tt> attribute of states. ## Performance -The performance of uSCXML depends on many things like the employed datamodel and the platform it runs on. Using a -MacBook Pro with an Intel i7 @2.4Ghz and the ECMAScript datamodel (<tt>test/uscxml/test-performance.scxml</tt>), we +The performance of uSCXML depends on many things like the employed data model and the platform it runs on. Using a +MacBook Pro with an Intel i7 @2.4Ghz and the ECMAScript data model (<tt>test/uscxml/test-performance.scxml</tt>), we achieve about 20.000 events/sec. On a Raspberry Pi, however, only 350 events/sec are achieved. If performance ought to be increased further, the first place to look would be most likely the employed DOM diff --git a/apps/samples/vrml/vrml-server.scxml b/apps/samples/vrml/vrml-server.scxml index f6dc9dc..5c65afb 100644 --- a/apps/samples/vrml/vrml-server.scxml +++ b/apps/samples/vrml/vrml-server.scxml @@ -256,9 +256,22 @@ </send> <else /> <!-- There is no such model --> - <respond status="404" to="_event.origin"> - <header name="Connection" value="close" /> - </respond> + <send target="#_osgvonvert.toClient"> + <param name="source" expr="'/scratch/vrml/404.wrl'" /> + <param name="format" expr="_event['fileStruct'].ext" /> + <param name="pitch" expr="_event.fileStruct.pitch" /> + <param name="roll" expr="_event.fileStruct.roll" /> + <param name="yaw" expr="_event.fileStruct.yaw" /> + <param name="zoom" expr="_event.fileStruct.zoom" /> + <param name="x" expr="_event.fileStruct.x" /> + <param name="y" expr="_event.fileStruct.y" /> + <param name="z" expr="_event.fileStruct.z" /> + <param name="width" expr="_event.fileStruct.width" /> + <param name="height" expr="_event.fileStruct.height" /> + <param name="autorotate" expr="_event.fileStruct.autorotate" /> + <param name="context" expr="_event.origin" /> + </send> + </if> </transition> @@ -340,4 +353,4 @@ </state> </state> <state id="final" final="true" /> -</scxml>
\ No newline at end of file +</scxml> diff --git a/docs/Ubuntu-LTS.txt b/docs/Ubuntu-LTS.txt index df687ab..632b38a 100644 --- a/docs/Ubuntu-LTS.txt +++ b/docs/Ubuntu-LTS.txt @@ -41,4 +41,15 @@ $ git clone https://github.com/tklab-tud/uscxml.git $ cd uscxml $ mkdir build && cd build $ cmake .. -$ make
\ No newline at end of file +$ make + +Now, to run the VRML server make sure there is an X-Server running for OpenGL to create contexts or run a virtual +X-Server in a framebuffer: + +XVFB_RUNNING=`ps ax |grep 'Xvfb :7' |grep -v grep` +if [ ! "${XVFB_RUNNING}" ]; then + Xvfb :7 -screen 0 800x600x24 & +fi +export DISPLAY=":7" + +$ bin/uscxml-browser -v -t8086 ../apps/samples/vrml/vrml-server.scxml --vrml-path=/scratch/vrml --tmp-path=/scratch/vrml-processed
\ No newline at end of file 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 a32e7a3..8d286a7 100644 --- a/src/uscxml/transform/ChartToFSM.cpp +++ b/src/uscxml/transform/ChartToFSM.cpp @@ -39,22 +39,27 @@ #define DUMP_STATS(nrTrans) \ uint64_t now = tthread::chrono::system_clock::now(); \ if (now - _lastTimeStamp > 1000) { \ - std::cerr << "T: " << _perfTransTotal << " [" << _perfTransProcessed << "/sec]"; \ + std::cerr << "## Transition: " << _perfTransUsed << " / " << _perfTransTotal << " [" << _perfTransProcessed << "/sec]"; \ if (nrTrans > 0) { \ std::cerr << " - 2**" << nrTrans << " = " << pow(2.0, static_cast<double>(nrTrans)); \ } \ std::cerr << std::endl; \ - std::cerr << "S: " << _globalConf.size() << " [" << _perfStatesProcessed << "/sec]" << std::endl; \ - std::cerr << "C: " << _perfStatesCachedTotal << " [" << _perfStatesCachedProcessed << "/sec]" << std::endl; \ - std::cerr << "X: " << _perfStatesSkippedTotal << " [" << _perfStatesSkippedProcessed << "/sec]" << std::endl; \ - std::cerr << "Q: " << (_maxEventRaisedChain == UNDECIDABLE ? "UNK" : toStr(_maxEventRaisedChain)) << " / " << (_maxEventSentChain == UNDECIDABLE ? "UNK" : toStr(_maxEventSentChain)) << std::endl; \ - std::cerr << _perfTransTotal << ", " << _perfTransProcessed << ", " << _globalConf.size() << ", " << _perfStatesProcessed << ", " << _perfStatesCachedTotal << ", " << _perfStatesCachedProcessed << ", "; \ - std::cerr << _perfStatesSkippedTotal << ", " << _perfStatesSkippedProcessed << ", " << _maxEventRaisedChain << ", " << _maxEventSentChain << std::endl; \ + std::cerr << "## State : " << _globalConf.size() << " [" << _perfStatesProcessed << "/sec]" << std::endl; \ + std::cerr << "## Microstep : " << _perfMicroStepTotal << " [" << _perfMicroStepProcessed << "/sec]" << std::endl; \ + std::cerr << "## Cached : " << _perfStatesCachedTotal << " [" << _perfStatesCachedProcessed << "/sec]" << std::endl; \ + std::cerr << "## Skipped : " << _perfStatesSkippedTotal << " [" << _perfStatesSkippedProcessed << "/sec]" << std::endl; \ + std::cerr << "## Queues : " << (_maxEventRaisedChain == UNDECIDABLE ? "UNK" : toStr(_maxEventRaisedChain)) << " / " << (_maxEventSentChain == UNDECIDABLE ? "UNK" : toStr(_maxEventSentChain)) << std::endl; \ + std::cerr << _perfTransUsed << ", " << _perfTransTotal << ", " << _perfTransProcessed << ", "; \ + std::cerr << _globalConf.size() << ", " << _perfStatesProcessed << ", "; \ + std::cerr << _perfMicroStepTotal << ", " << _perfMicroStepProcessed << ", "; \ + std::cerr << _perfStatesCachedTotal << ", " << _perfStatesCachedProcessed << ", " << _perfStatesSkippedTotal << ", " << _perfStatesSkippedProcessed << ", "; \ + std::cerr << (_maxEventRaisedChain == UNDECIDABLE ? "UNK" : toStr(_maxEventRaisedChain)) << ", " << (_maxEventSentChain == UNDECIDABLE ? "UNK" : toStr(_maxEventSentChain)) << std::endl; \ std::cerr << std::endl; \ _perfTransProcessed = 0; \ _perfStatesProcessed = 0; \ _perfStatesCachedProcessed = 0; \ _perfStatesSkippedProcessed = 0; \ + _perfMicroStepProcessed = 0; \ _lastTimeStamp = now; \ } @@ -85,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) @@ -113,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); @@ -153,12 +186,15 @@ ChartToFSM::ChartToFSM(const Interpreter& other) { _lastTimeStamp = tthread::chrono::system_clock::now(); _perfTransProcessed = 0; _perfTransTotal = 0; + _perfTransUsed = 0; _perfStatesProcessed = 0; _perfStatesSkippedProcessed = 0; _perfStatesSkippedTotal = 0; _perfStatesCachedProcessed = 0; _perfStatesCachedTotal = 0; - + _perfMicroStepProcessed = 0; + _perfMicroStepTotal = 0; + _start = NULL; _currGlobalTransition = NULL; _lastTransientStateId = 0; @@ -209,8 +245,9 @@ 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 && false) { + if (complexity > 1000) { _skipEventChainCalculations = true; _maxEventRaisedChain = UNDECIDABLE; _maxEventSentChain = UNDECIDABLE; @@ -244,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); @@ -333,6 +375,7 @@ InterpreterState ChartToFSM::interpret() { enterStates(initialTransitions); globalTransition->destination = FlatStateIdentifier::toStateId(_configuration); + globalTransition->activeDestination = globalTransition->destination; explode(); @@ -347,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; } @@ -358,8 +406,18 @@ void ChartToFSM::executeContent(const Arabica::DOM::Element<std::string>& conten GlobalTransition::Action action; + NodeList<std::string> childs = content.getChildNodes(); + for (unsigned int i = 0; i < childs.getLength(); i++) { + Node_base::Type type = childs.item(i).getNodeType(); + if (type == Node_base::ELEMENT_NODE || type == Node_base::COMMENT_NODE || type == Node_base::TEXT_NODE) { + goto HAS_VALID_CHILDREN; + } + } + return; + +HAS_VALID_CHILDREN: if (false) { - } else if (TAGNAME(content) == "transition" && content.hasChildNodes()) { + } else if (TAGNAME(content) == "transition") { action.transition = content; } else if (TAGNAME(content) == "onexit") { action.onExit = content; @@ -372,7 +430,7 @@ void ChartToFSM::executeContent(const Arabica::DOM::Element<std::string>& conten } if (!_skipEventChainCalculations && - (_maxEventRaisedChain == UNDECIDABLE || _maxEventSentChain == UNDECIDABLE)) { + (_maxEventRaisedChain != UNDECIDABLE || _maxEventSentChain != UNDECIDABLE)) { assert(content.hasAttribute("raise") && content.hasAttribute("send")); std::string raiseAttr = content.getAttribute("raise"); @@ -445,7 +503,7 @@ void ChartToFSM::internalDoneSend(const Arabica::DOM::Element<std::string>& stat _currGlobalTransition->actions.push_back(action); if (!_skipEventChainCalculations && - (_maxEventRaisedChain == UNDECIDABLE || _maxEventSentChain == UNDECIDABLE)) + (_maxEventRaisedChain != UNDECIDABLE || _maxEventSentChain != UNDECIDABLE)) _currGlobalTransition->eventsRaised++; _currGlobalTransition->hasExecutableContent = true; @@ -751,7 +809,6 @@ void ChartToFSM::getPotentialTransitionsForConf(const Arabica::XPath::NodeSet<st delete transition; continue; } - transition->index = _lastTransIndex++; // two combinations might have projected onto the same conflict-free set if (outMap.find(transition->transitionId) != outMap.end()) { @@ -759,6 +816,9 @@ void ChartToFSM::getPotentialTransitionsForConf(const Arabica::XPath::NodeSet<st delete transition; continue; } + + transition->index = _lastTransIndex++; + _perfTransUsed++; // remember this conflict-free set // std::cerr << "New conflict-free subset: " << transition->transitionId << ":" << transition->eventDesc << std::endl; @@ -799,7 +859,7 @@ void ChartToFSM::explode() { if (_globalConf.find(globalState->stateId) != _globalConf.end()) { if (_currGlobalTransition->isEventless && !_skipEventChainCalculations && - (_maxEventRaisedChain == UNDECIDABLE || _maxEventSentChain == UNDECIDABLE)) { + (_maxEventRaisedChain != UNDECIDABLE || _maxEventSentChain != UNDECIDABLE)) { // we arrived via a spontaneaous transition, do we need to update? updateRaisedAndSendChains(_globalConf[globalState->stateId], _currGlobalTransition, std::set<GlobalTransition*>()); } @@ -819,15 +879,18 @@ 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++; } _perfStatesCachedTotal++; @@ -838,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++) { @@ -851,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 @@ -866,11 +929,15 @@ void ChartToFSM::explode() { _currGlobalTransition = outgoingTrans; microstep(refsToTransitions(outgoingTrans->transitionRefs)); + assert(isLegalConfiguration(_configuration)); + + _perfMicroStepProcessed++; + _perfMicroStepTotal++; // if outgoing transition is spontaneous, add number of events to chain if (outgoingTrans->isEventless && !_skipEventChainCalculations && - (_maxEventRaisedChain == UNDECIDABLE || _maxEventSentChain == UNDECIDABLE)) { + (_maxEventRaisedChain != UNDECIDABLE || _maxEventSentChain != UNDECIDABLE)) { outgoingTrans->eventsChainRaised = MIN(incomingTrans->eventsChainRaised + outgoingTrans->eventsRaised, UNDECIDABLE); outgoingTrans->eventsChainSent = MIN(incomingTrans->eventsChainSent + outgoingTrans->eventsSent, UNDECIDABLE); @@ -894,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(); @@ -1059,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; @@ -1066,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"))); @@ -1167,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]); @@ -1175,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 919a5b2..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; @@ -196,11 +241,14 @@ protected: uint64_t _perfTransProcessed; uint64_t _perfTransTotal; + uint64_t _perfTransUsed; uint64_t _perfStatesProcessed; uint64_t _perfStatesSkippedProcessed; uint64_t _perfStatesSkippedTotal; uint64_t _perfStatesCachedProcessed; uint64_t _perfStatesCachedTotal; + uint64_t _perfMicroStepProcessed; + uint64_t _perfMicroStepTotal; uint64_t _lastTimeStamp; size_t _lastTransientStateId; @@ -216,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 b9b1637..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) { @@ -279,8 +374,8 @@ void PromelaCodeAnalyzer::addCode(const std::string& code) { // break fall through from ASGN break; } - node->dump(); - assert(false); +// node->dump(); +// assert(false); break; } @@ -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++; } } @@ -1664,26 +1864,28 @@ void ChartToPromela::writeFSM(std::ostream& stream) { // write initial transition // transitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", _startState); // assert(transitions.size() == 1); - stream << " /* transition's executable content */" << 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; // 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; @@ -1695,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++; } @@ -1719,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; } } @@ -1747,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; @@ -1790,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); @@ -1867,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; @@ -1891,6 +2087,21 @@ void ChartToPromela::initNodes() { } } + // 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()); @@ -1936,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"); @@ -1984,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)); } } @@ -2070,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) { @@ -2110,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); @@ -2127,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; @@ -2137,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: diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8aa3fb5..dd86ac9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -39,6 +39,7 @@ USCXML_TEST_COMPILE(NAME test-url LABEL general/test-url FILES src/test-url.cpp) USCXML_TEST_COMPILE(NAME test-base64 LABEL general/test-base64 FILES src/test-base64.cpp) USCXML_TEST_COMPILE(NAME test-eventdelay LABEL general/test-eventdelay FILES src/test-eventdelay.cpp) USCXML_TEST_COMPILE(NAME test-flat-stateid LABEL general/test-flat-stateid FILES src/test-flat-stateid.cpp) +target_link_libraries(test-flat-stateid uscxml_transform) USCXML_TEST_COMPILE(NAME test-lifecycle LABEL general/test-lifecycle FILES src/test-lifecycle.cpp) USCXML_TEST_COMPILE(NAME test-issue-reporting LABEL general/test-issue-reporting FILES src/test-issue-reporting.cpp) USCXML_TEST_COMPILE(NAME test-cmdline-parsing LABEL general/test-cmdline-parsing FILES src/test-cmdline-parsing.cpp) diff --git a/test/ctest/CTestCustom.ctest.in b/test/ctest/CTestCustom.ctest.in index 03a3c33..609c926 100644 --- a/test/ctest/CTestCustom.ctest.in +++ b/test/ctest/CTestCustom.ctest.in @@ -15,6 +15,7 @@ set(CTEST_CUSTOM_TESTS_IGNORE "ecma/test301.scxml" # Manual - PASSED "ecma/test307.scxml" # Manual - PASSED "ecma/test415.scxml" # Manual - PASSED + # "ecma/test513.txt" # Manual - PASSED "fsm/ecma/test178.scxml" # manual test # "fsm/ecma/test224.scxml" # automatically generated id has the form stateid.platformid @@ -42,7 +43,6 @@ set(CTEST_CUSTOM_TESTS_IGNORE # "promela/test337.scxml" # no typeof or "defined" operator in promela "promela/test350.scxml" # string concatenation "promela/test415.scxml" # manual test - "promela/test436.scxml" # In(s) -> _x.states[s] prevents completion as NULL dm is hardcoded "promela/test509.scxml" # string operation contains "promela/test518.scxml" # string operation contains "promela/test519.scxml" # string operation contains @@ -155,6 +155,7 @@ set(CTEST_CUSTOM_TESTS_IGNORE "spin/promela/test552.scxml" # initialize data from file "spin/promela/test567.scxml" # uses _ioprocessors.basichttp.location "spin/promela/test577.scxml" # send without target for basichttp + "spin/promela/test579.scxml" # timeout with delay "spin/promela/test580.scxml" # timeout with delay diff --git a/test/src/test-flat-stateid.cpp b/test/src/test-flat-stateid.cpp index 7820d61..fcf50b7 100644 --- a/test/src/test-flat-stateid.cpp +++ b/test/src/test-flat-stateid.cpp @@ -1,7 +1,9 @@ #include "uscxml/transform/FlatStateIdentifier.h" +#include "uscxml/transform/ChartToPromela.h" #include <cassert> int main(int argc, char** argv) { + std::list<std::string>::const_iterator listIter; { @@ -54,4 +56,31 @@ int main(int argc, char** argv) { uscxml::FlatStateIdentifier flat2(flat1.getActive(), flat1.getVisited(), flat1.getHistory()); assert(flat2.getStateId() == stateId); } + + { + uscxml::HistoryTransitionClass histClass1("history:{h0:{s1, s4, s6}}", "history:{h0:{s0, s6}}"); + + // these will match + uscxml::HistoryTransitionClass histClass1Match1("history:{h0:{s1, s2, s3}}", "history:{h0:{s0}}"); + assert(histClass1.matches(histClass1Match1)); + + histClass1.merge(histClass1Match1); + assert(histClass1.toRemember.at("h0").find("s0") != histClass1.toRemember.at("h0").end()); + assert(histClass1.toRemember.at("h0").size() == 1); + + assert(histClass1.toForget.at("h0").find("s1") != histClass1.toForget.at("h0").end()); + assert(histClass1.toForget.at("h0").find("s2") != histClass1.toForget.at("h0").end()); + assert(histClass1.toForget.at("h0").find("s3") != histClass1.toForget.at("h0").end()); + + uscxml::HistoryTransitionClass histClass1NoMatch1("history:{h0:{s0}}", "history:{h0:{s1}}"); + assert(!histClass1.matches(histClass1NoMatch1)); + + uscxml::HistoryTransitionClass histClass1NoMatch2("history:{h0:{s1, s2, s3}}", "history:{h0:{s4}}"); + assert(!histClass1.matches(histClass1NoMatch2)); + + uscxml::HistoryTransitionClass histClass1NoMatch3("history:{h0:{s1, s2, s6}}", "history:{h0:{s0}}"); + assert(!histClass1.matches(histClass1NoMatch3)); + + } + }
\ No newline at end of file diff --git a/test/src/test-promela-parser.cpp b/test/src/test-promela-parser.cpp index 11333f1..955d39a 100644 --- a/test/src/test-promela-parser.cpp +++ b/test/src/test-promela-parser.cpp @@ -21,55 +21,52 @@ void testInlinePromela() { #promela-inline:\n \ This is foo!\ "; - PromelaInlines prmInls = ChartToPromela::getInlinePromela(test); - assert(prmInls.acceptLabels == 0 && - prmInls.codes == 1 && - prmInls.customEventSources == 0 && - prmInls.endLabels == 0 && - prmInls.eventSources == 0 && - prmInls.progressLabels == 0); - assert(prmInls.inlines.size() == 1); - assert(prmInls.inlines.front().type == PromelaInline::PROMELA_CODE); - assert(boost::trim_copy(prmInls.inlines.front().content) == "This is foo!"); + PromelaInlines prmInls = PromelaInlines::fromString(test); + assert(prmInls.nrAcceptLabels == 0 && + prmInls.nrCodes == 1 && + prmInls.nrEventSources == 0 && + prmInls.nrEndLabels == 0 && + prmInls.nrAcceptLabels == 0 && + prmInls.nrProgressLabels == 0); + assert(prmInls.code.size() == 1); + assert(prmInls.code.front().type == PromelaInline::PROMELA_CODE); + assert(boost::trim_copy(prmInls.code.front().content) == "This is foo!"); } { std::string test = "#promela-progress"; - PromelaInlines prmInls = ChartToPromela::getInlinePromela(test); - assert(prmInls.acceptLabels == 0 && - prmInls.codes == 0 && - prmInls.customEventSources == 0 && - prmInls.endLabels == 0 && - prmInls.eventSources == 0 && - prmInls.progressLabels == 1); - assert(prmInls.inlines.size() == 1); - assert(prmInls.inlines.front().type == PromelaInline::PROMELA_PROGRESS_LABEL); + PromelaInlines prmInls = PromelaInlines::fromString(test); + assert(prmInls.nrAcceptLabels == 0 && + prmInls.nrCodes == 0 && + prmInls.nrEventSources == 0 && + prmInls.nrEndLabels == 0 && + prmInls.nrProgressLabels == 1); + assert(prmInls.code.size() == 1); + assert(prmInls.code.front().type == PromelaInline::PROMELA_PROGRESS_LABEL); } { std::string test = "#promela-accept and then some"; - PromelaInlines prmInls = ChartToPromela::getInlinePromela(test); - assert(prmInls.acceptLabels == 1 && - prmInls.codes == 0 && - prmInls.customEventSources == 0 && - prmInls.endLabels == 0 && - prmInls.eventSources == 0 && - prmInls.progressLabels == 0); - assert(prmInls.inlines.size() == 1); - assert(prmInls.inlines.front().type == PromelaInline::PROMELA_ACCEPT_LABEL); + PromelaInlines prmInls = PromelaInlines::fromString(test); + assert(prmInls.nrAcceptLabels == 1 && + prmInls.nrCodes == 0 && + prmInls.nrEventSources == 0 && + prmInls.nrEndLabels == 0 && + prmInls.nrProgressLabels == 0); + assert(prmInls.code.size() == 1); + assert(prmInls.code.front().type == PromelaInline::PROMELA_ACCEPT_LABEL); } { std::string test = "#promela-end and then some"; - PromelaInlines prmInls = ChartToPromela::getInlinePromela(test); - assert(prmInls.acceptLabels == 0 && - prmInls.codes == 0 && - prmInls.customEventSources == 0 && - prmInls.endLabels == 1 && - prmInls.eventSources == 0 && - prmInls.progressLabels == 0); - assert(prmInls.inlines.size() == 1); - assert(prmInls.inlines.front().type == PromelaInline::PROMELA_END_LABEL); + PromelaInlines prmInls = PromelaInlines::fromString(test); + assert(prmInls.nrAcceptLabels == 0 && + prmInls.nrCodes == 0 && + prmInls.nrEventSources == 0 && + prmInls.nrEndLabels == 1 && + prmInls.nrProgressLabels == 0); + assert(prmInls.code.size() == 1); + assert(prmInls.code.front().type == PromelaInline::PROMELA_END_LABEL); } { @@ -77,24 +74,25 @@ void testInlinePromela() { #promela-event-source:\n \ This is foo!\ "; - PromelaInlines prmInls = ChartToPromela::getInlinePromela(test); - assert(prmInls.acceptLabels == 0 && - prmInls.codes == 0 && - prmInls.customEventSources == 0 && - prmInls.endLabels == 0 && - prmInls.eventSources == 1 && - prmInls.progressLabels == 0); - assert(prmInls.inlines.size() == 1); - assert(prmInls.inlines.front().type == PromelaInline::PROMELA_EVENT_SOURCE); - assert(prmInls.inlines.front().sequences.size() == 1); - std::list<std::list<std::string> >::iterator seqsIter = prmInls.inlines.front().sequences.begin(); + PromelaInlines prmInls = PromelaInlines::fromString(test); + assert(prmInls.nrAcceptLabels == 0 && + prmInls.nrCodes == 0 && + prmInls.nrEventSources == 1 && + prmInls.nrEndLabels == 0 && + prmInls.nrProgressLabels == 0); + assert(prmInls.code.size() == 1); + assert(prmInls.code.front().type == PromelaInline::PROMELA_EVENT_SOURCE); + + PromelaEventSource pmlES(prmInls.code.front()); + assert(pmlES.sequences.size() == 1); + std::list<std::list<std::string> >::iterator seqsIter = pmlES.sequences.begin(); std::list<std::string>::iterator seqIter = seqsIter->begin(); assert(*seqIter++ == "This"); assert(*seqIter++ == "is"); assert(*seqIter++ == "foo!"); assert(seqIter == seqsIter->end()); seqsIter++; - assert(seqsIter == prmInls.inlines.front().sequences.end()); + assert(seqsIter == pmlES.sequences.end()); } { @@ -103,17 +101,19 @@ void testInlinePromela() { This is foo!\n \ This is bar!\n \ "; - PromelaInlines prmInls = ChartToPromela::getInlinePromela(test); - assert(prmInls.acceptLabels == 0 && - prmInls.codes == 0 && - prmInls.customEventSources == 0 && - prmInls.endLabels == 0 && - prmInls.eventSources == 1 && - prmInls.progressLabels == 0); - assert(prmInls.inlines.size() == 1); - assert(prmInls.inlines.front().type == PromelaInline::PROMELA_EVENT_SOURCE); - assert(prmInls.inlines.front().sequences.size() == 2); - std::list<std::list<std::string> >::iterator seqsIter = prmInls.inlines.front().sequences.begin(); + PromelaInlines prmInls = PromelaInlines::fromString(test); + assert(prmInls.nrAcceptLabels == 0 && + prmInls.nrCodes == 0 && + prmInls.nrEventSources == 1 && + prmInls.nrEndLabels == 0 && + prmInls.nrProgressLabels == 0); + assert(prmInls.code.size() == 1); + assert(prmInls.code.front().type == PromelaInline::PROMELA_EVENT_SOURCE); + + PromelaEventSource pmlES(prmInls.code.front()); + + assert(pmlES.sequences.size() == 2); + std::list<std::list<std::string> >::iterator seqsIter = pmlES.sequences.begin(); std::list<std::string>::iterator seqIter = seqsIter->begin(); assert(*seqIter++ == "This"); assert(*seqIter++ == "is"); @@ -126,7 +126,7 @@ void testInlinePromela() { assert(*seqIter++ == "bar!"); assert(seqIter == seqsIter->end()); seqsIter++; - assert(seqsIter == prmInls.inlines.front().sequences.end()); + assert(seqsIter == pmlES.sequences.end()); } { @@ -134,17 +134,19 @@ void testInlinePromela() { #promela-event-source-custom:\n \ This is foo!\ "; - PromelaInlines prmInls = ChartToPromela::getInlinePromela(test); - assert(prmInls.acceptLabels == 0 && - prmInls.codes == 0 && - prmInls.customEventSources == 1 && - prmInls.endLabels == 0 && - prmInls.eventSources == 0 && - prmInls.progressLabels == 0); - assert(prmInls.inlines.size() == 1); - assert(prmInls.inlines.front().type == PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM); - assert(prmInls.inlines.front().sequences.size() == 0); - assert(boost::trim_copy(prmInls.inlines.front().content) == "This is foo!"); + PromelaInlines prmInls = PromelaInlines::fromString(test); + assert(prmInls.nrAcceptLabels == 0 && + prmInls.nrCodes == 0 && + prmInls.nrEventSources == 1 && + prmInls.nrEndLabels == 0 && + prmInls.nrProgressLabels == 0); + assert(prmInls.code.size() == 1); + assert(prmInls.code.front().type == PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM); + + PromelaEventSource pmlES(prmInls.code.front()); + + assert(pmlES.sequences.size() == 0); + assert(boost::trim_copy(pmlES.source.content) == "This is foo!"); } { @@ -153,17 +155,19 @@ void testInlinePromela() { This is foo! \n\ #promela-progress\ "; - PromelaInlines prmInls = ChartToPromela::getInlinePromela(test); - assert(prmInls.acceptLabels == 0 && - prmInls.codes == 0 && - prmInls.customEventSources == 1 && - prmInls.endLabels == 0 && - prmInls.eventSources == 0 && - prmInls.progressLabels == 1); - assert(prmInls.inlines.size() == 2); - assert(prmInls.inlines.front().type == PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM); - assert(prmInls.inlines.front().sequences.size() == 0); - assert(boost::trim_copy(prmInls.inlines.front().content) == "This is foo!"); + PromelaInlines prmInls = PromelaInlines::fromString(test); + assert(prmInls.nrAcceptLabels == 0 && + prmInls.nrCodes == 0 && + prmInls.nrEventSources == 1 && + prmInls.nrEndLabels == 0 && + prmInls.nrProgressLabels == 1); + assert(prmInls.code.size() == 2); + assert(prmInls.code.front().type == PromelaInline::PROMELA_EVENT_SOURCE_CUSTOM); + + PromelaEventSource pmlES(prmInls.code.front()); + + assert(pmlES.sequences.size() == 0); + assert(boost::trim_copy(pmlES.source.content) == "This is foo!"); } } diff --git a/test/uscxml/promela/test-history.scxml b/test/uscxml/promela/test-history.scxml new file mode 100644 index 0000000..ef48f6a --- /dev/null +++ b/test/uscxml/promela/test-history.scxml @@ -0,0 +1,16 @@ +<scxml datamodel="promela"> + <state id="s0"> + <history id="h01" type="deep" /> + <state id="s01"> + <transition target="s02" event="foo" /> + <transition target="s1" event="bar" /> + </state> + <state id="s02"> + <script>printf("In S02");</script> + <transition target="s1" /> + </state> + </state> + <state id="s1"> + <transition target="h01" /> + </state> +</scxml>
\ No newline at end of file diff --git a/test/uscxml/promela/test-ltl.scxml b/test/uscxml/promela/test-ltl.scxml new file mode 100644 index 0000000..23079d9 --- /dev/null +++ b/test/uscxml/promela/test-ltl.scxml @@ -0,0 +1,16 @@ +<scxml datamodel="promela"> + <!-- + #promela-event-source: + toggle.foo + --> + <datamodel> + <data id="foo" expr="0" type="bit" /> + </datamodel> + <parallel id="main"> + <state id="toggleFoo"> + <transition event="toggle.foo"> + <script>foo = !foo;</script> + </transition> + </state> + </parallel> +</scxml>
\ No newline at end of file diff --git a/test/w3c/analyze_tests.pl b/test/w3c/analyze_tests.pl index edc53da..2525008 100755 --- a/test/w3c/analyze_tests.pl +++ b/test/w3c/analyze_tests.pl @@ -87,14 +87,18 @@ while ($block = <FILE>) { if ($block =~ / Approximate\sComplexity:\s(\d+)\n + Approximate\sActive\sComplexity:\s(\d+)\n Actual\sComplexity:\s(\d+)\n + Actual\sActive\sComplexity:\s(\d+)\n Internal\sQueue:\s(\d+)\n External\sQueue:\s(\d+)\n /x ) { - $test->{$currTest}->{'flat'}->{'apprComplexity'} = $1; - $test->{$currTest}->{'flat'}->{'actualComplexity'} = $2; - $test->{$currTest}->{'flat'}->{'internalQueue'} = $3; - $test->{$currTest}->{'flat'}->{'externalQueue'} = $4; + $test->{$currTest}->{'flat'}->{'cmplx'}->{'appr'} = $1; + $test->{$currTest}->{'flat'}->{'cmplx'}->{'apprActv'} = $2; + $test->{$currTest}->{'flat'}->{'cmplx'}->{'actual'} = $3; + $test->{$currTest}->{'flat'}->{'cmplx'}->{'actualActv'} = $4; + $test->{$currTest}->{'flat'}->{'queue'}->{'internal'} = $5; + $test->{$currTest}->{'flat'}->{'queue'}->{'external'} = $6; if ($block =~ /State-vector (\d+) byte, depth reached (\d+), errors: (\d+)/) { $test->{$currTest}->{'pml'}->{'states'}->{'stateSize'} = $1; diff --git a/test/w3c/convert-tests.sh b/test/w3c/convert-tests.sh index 23010c7..059c8e1 100755 --- a/test/w3c/convert-tests.sh +++ b/test/w3c/convert-tests.sh @@ -34,6 +34,7 @@ find ./ecma -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv find ./xpath -type f -exec grep -Ili 'datamodel="ecmascript"' {} \; |xargs rm -fv find ./promela -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv find ./promela -type f -exec grep -Ili 'datamodel="ecmascript"' {} \; |xargs rm -fv +find ./promela -type f -exec grep -Ili 'datamodel="null"' {} \; |xargs rm -fv # format all SCXML files SCXMLS=`find . -type f -name '*.scxml'` diff --git a/test/w3c/manifest.xml b/test/w3c/manifest.xml new file mode 100644 index 0000000..3b78ebc --- /dev/null +++ b/test/w3c/manifest.xml @@ -0,0 +1,1689 @@ +<?xml version="1.0"?> +<assertions> + + + + <assert id="355" specnum="3.2" specid="#scxml"> + <![CDATA[At system initialization time, if the 'initial' attribute is not present, the Processor MUST enter the first state in document order.]]> + <test id="355" conformance="mandatory" manual="false"> + <start uri="355/test355.txml"/> + </test> + </assert> + + <assert id="576" specnum="3.2" specid="#scxml"> + <![CDATA[At system initialization time, the SCXML Processor MUST enter the states specified by the 'initial' attribute, if it is present. ]]> + <test id="576" conformance="mandatory" manual="false"> + <start uri="576/test576.txml"/> + </test> + </assert> + + <assert id="364" specnum="3.3" specid="#state"> + <![CDATA[ Definition: The default initial state(s) of a compound state are those specified by the 'initial' attribute or initial element, if either is present. Otherwise it is the state's first child state in document order. If a compound state is entered either as an initial state or as the target of a transition (i.e. and no descendent of it is specified), then the SCXML Processor MUST enter the default initial state(s) after it enters the parent state. ]]> + <test id="364" conformance="mandatory" manual="false"> + + <start uri="364/test364.txml"/> + </test> + </assert> + + <assert id="372" specnum="3.7" specid="#final"> + <![CDATA[When the state machine enters the final child of a state element, the SCXML processor MUST generate the event done.state.id after completion of the onentry elements, where id is the id of the parent state.]]> + <test id="372" conformance="mandatory" manual="false"> + <start uri="372/test372.txml"/> + </test> + </assert> + + <assert id="570" specnum="3.7" specid="#final"> + <![CDATA[Immediately after generating done.state.id upon entering a final child of state, if the parent state is a child of a parallel element, and all of the parallel's other children are also in final states, the Processor MUST generate the event done.state.id where id is the id of the parallel element. ]]> + <test id="570" conformance="mandatory" manual="false"> + <start uri="570/test570.txml"/> + </test> + </assert> + + <assert id="375" specnum="3.8" specid="#onentry"> + <![CDATA[The SCXML processor MUST execute the onentry handlers of a state in document order when the state is entered.]]> + <test id="375" conformance="mandatory" manual="false"> + <start uri="375/test375.txml"/> + </test> + </assert> + + <assert id="376" specnum="3.8" specid="#onentry"> + <![CDATA[The SCXML processor MUST treat each [onentry] handler as a separate block of executable content.]]> + <test id="376" conformance="mandatory" manual="false"> + <start uri="376/test376.txml"/> + </test> + </assert> + + + + <assert id="377" specnum="3.9" specid="#onexit"> + <![CDATA[The SCXML processor MUST execute the onexit handlers of a state in document order when the state is exited.]]> + <test id="377" conformance="mandatory" manual="false"> + <start uri="377/test377.txml"/> + </test> + </assert> + + <assert id="378" specnum="3.9" specid="#onexit"> + <![CDATA[The SCXML processor MUST treat each [onexit] handler as a separate block of executable content.]]> + <test id="378" conformance="mandatory" manual="false"> + <start uri="378/test378.txml"/> + </test> + </assert> + + <assert id="387" specnum="3.10" specid="#history"> + <![CDATA[Before the parent state has been visited for the first time, if a transition is executed that takes the history state as its target, the SCXML processor MUST behave as if the transition had taken the default stored state configuration as its target.]]> + <test id="387" conformance="mandatory" manual="false"> + <start uri="387/test387.txml"/> + </test> + </assert> + <assert id="579" specnum="3.10" specid="#history"> + <![CDATA[Before the parent state has been visited for the first time, if a transition is executed that takes the history state as its target, + the SCXML processor MUST execute any executable content in the transition + after the parent state's onentry content and any content in a possible + initial transition. ]]> + <test id="579" conformance="mandatory" manual="false"> + <start uri="579/test579.txml"/> + </test> + </assert> + + <assert id="580" specnum="3.10" specid="#history"> + <![CDATA[It follows from the semantics of history states that they never end up in the state configuration]]> + <test id="580" conformance="mandatory" manual="false"> + <start uri="580/test580.txml"/> + </test> + </assert> + + <assert id="388" specnum="3.10" specid="#history"> + <![CDATA[After the parent state has been visited for the first time, if a transition is executed that takes the history state as its target, the SCXML processor MUST behave as if the transition had taken the stored state configuration as its target. ]]> + <test id="388" conformance="mandatory" manual="false"> + <start uri="388/test388.txml"/> + </test> + </assert> + + + + <assert id="396" specnum="3.12" specid="#events"> + <![CDATA[The SCXML processor MUST use this same name value [the one reflected in the event variable] to match against the 'event' attribute of transitions.]]> + <test id="396" conformance="mandatory" manual="false"> + <start uri="396/test396.txml"/> + </test> + </assert> + + <assert id="399" specnum="3.12" specid="#events"> + <![CDATA[[Definition: A transition matches an event if at least one of its event descriptors matches the event's name. ] [Definition: An event descriptor matches an event name if its string of tokens is an exact match or a prefix of the set of tokens in the event's name. In all cases, the token matching is case sensitive. ] ]]> + <test id="399" conformance="mandatory" manual="false"> + <start uri="399/test399.txml"/> + </test> + </assert> + + <assert id="401" specnum="3.12" specid="#events"> + <![CDATA[The processor MUST place these [error] events in the internal event queue.]]> + <test id="401" conformance="mandatory" manual="false"> + <start uri="401/test401.txml"/> + </test> + </assert> + + <assert id="402" specnum="3.12" specid="#events"> + <![CDATA[The processor MUST process them [error events] like any other event.]]> + <test id="402" conformance="mandatory" manual="false"> + <start uri="402/test402.txml"/> + </test> + </assert> + + <assert id="403" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[To execute a microstep, the SCXML Processor MUST execute the transitions in the corresponding optimal enabled transition set, where the optimal transition set enabled by event E in state configuration C is the largest set of transitions such that a) each transition in the set is optimally enabled by E in an atomic state in C b) no transition conflicts with another transition in the set c) there is no optimally enabled transition outside + the set that has a higher priority than some member of the set.]]> + <test id="403" conformance="mandatory" manual="false"> + <start uri="403/test403a.txml"/> + <start uri="403/test403b.txml"/> + <start uri="403/test403c.txml"/> + </test> + </assert> + + <assert id="404" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[To execute a set of transitions, the SCXML Processor MUST first exit all the states in the transitions' exit set in exit order.]]> + <test id="404" conformance="mandatory" manual="false"> + <start uri="404/test404.txml"/> + </test> + </assert> + + <assert id="405" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[ [the SCXML Processor executing a set of transitions] MUST then [after the onexits] execute the executable content contained in the transitions in document order.]]> + <test id="405" conformance="mandatory" manual="false"> + <start uri="405/test405.txml"/> + </test> + </assert> + + <assert id="406" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[ [the SCXML Processor executing a set of transitions] MUST then [after the exits and the transitions] enter the states in the transitions' entry set in entry order.]]> + <test id="406" conformance="mandatory" manual="false"> + <start uri="406/test406.txml"/> + </test> + </assert> + +<assert id="407" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[ To exit a state, the SCXML Processor MUST execute the executable content in the state's onexit handler.]]> + <test id="407" conformance="mandatory" manual="false"> + <start uri="407/test407.txml"/> + </test> + </assert> + + <assert id="409" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[Finally [after the onexits and canceling the invocations], the Processor MUST remove the state from the active state's list.]]> + <test id="409" conformance="mandatory" manual="false"> + <start uri="409/test409.txml"/> + </test> + </assert> + + <assert id="411" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[To enter a state, the SCXML Processor MUST add the state to the active state's list. Then it MUST execute the executable content in the state's onentry handler.]]> + <test id="411" conformance="mandatory" manual="false"> + <start uri="411/test411.txml"/> + </test> + </assert> + + <assert id="412" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[If the state is a default entry state and has an initial child, the SCXML Processor MUST then [after doing the active state add and the onentry handlers] execute the executable content in the initial child's transition. ]]> + <test id="412" conformance="mandatory" manual="false"> + <start uri="412/test412.txml"/> + </test> + </assert> + + <assert id="413" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[At startup, the SCXML Processor MUST place the state machine in the configuration specified by the 'initial' attribute of the scxml element.]]> + <test id="413" conformance="mandatory" manual="false"> + <start uri="413/test413.txml"/> + </test> + </assert> + + <assert id="415" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[If it [the SCXML Processor] has entered a final state that is a child of scxml [during the last microstep], it MUST halt processing.]]> + <test id="415" conformance="mandatory" manual="true"> + <start uri="415/test415.txml"/> + </test> + </assert> + + + <assert id="416" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[If it [the SCXML processor] has entered a final state that is a child of a compound state [during the last microstep], it MUST generate the event done.state.id, where id is the id of the compound state.]]> + <test id="416" conformance="mandatory" manual="false"> + <start uri="416/test416.txml"/> + </test> + </assert> + + + <assert id="417" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[If the compound state [which has the final element that we entered this microstep] is itself the child of a parallel element, and all the parallel element's other children are in final states, the Processor MUST generate the event done.state.id, where id is the id of the parallel element.]]> + <test id="417" conformance="mandatory" manual="false"> + <start uri="417/test417.txml"/> + </test> + </assert> + + + <assert id="419" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[After checking the state configuration, the Processor MUST select the optimal transition set enabled by NULL in the current configuration. If the [optimal transition] set [enabled by NULL in the current configuration] is not + empty, it [the SCXML Processor] MUST execute it [the set] as a microstep.]]> + <test id="419" conformance="mandatory" manual="false"> + <start uri="419/test419.txml"/> + </test> + </assert> + + + <assert id="421" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[If the set (of eventless transitions) is empty, the Processor MUST remove events from the internal event queue until the queue is empty or it finds an event that enables a non-empty optimal transition set in the current configuration. + If it finds such a set [a non-empty optimal transition set], the processor MUST then execute it as a microstep.]]> + <test id="421" conformance="mandatory" manual="false"> + <start uri="421/test421.txml"/> + </test> + </assert> + + + <assert id="422" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[After completing a macrostep, the SCXML Processor MUST execute in document order the invoke handlers in all states that have been entered (and not exited) since the completion of the last macrostep.]]> + <test id="422" conformance="mandatory" manual="false"> + <start uri="422/test422.txml"/> + </test> + </assert> + + <assert id="423" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[Then [after invoking the new invoke handlers since the last macrostep] the Processor MUST remove events from the external event queue, waiting till events appear if necessary, until it finds one that enables a non-empty optimal transition set in the current configuration. + The Processor MUST then execute that set [the enabled non-empty optimal transition set in the current configuration triggered by an external event] as a microstep.]]> + <test id="423" conformance="mandatory" manual="false"> + <start uri="423/test423.txml"/> + </test> + </assert> + + <assert id="503" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[If the transition does not contain a 'target', its exit set is empty.]]> + <test id="503" conformance="mandatory" manual="false"> + <start uri="503/test503.txml"/> + </test> + </assert> + + <assert id="504" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[if [a transition's] 'type' is "external", its exit set consists of all active states that are proper descendents of the Least Common Compound Ancestor (LCCA) of the source and target states. ]]> + <test id="504" conformance="mandatory" manual="false"> + <start uri="504/test504.txml"/> + </test> + </assert> + + <assert id="505" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[Otherwise, if the transition has 'type' "internal", its source state is a compound state and all its target states are proper descendents of its source state, the target set consists of all active states that are proper descendents of its source state.]]> + <test id="505" conformance="mandatory" manual="false"> + <start uri="505/test505.txml"/> + </test> + </assert> + + <assert id="506" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[If a transition has 'type' of "internal", but its source state is not a compound state or its target states are not all proper descendents of its source state, its exit set is defined as if it had 'type' of "external".]]> + <test id="506" conformance="mandatory" manual="false"> + <start uri="506/test506.txml"/> + </test> + </assert> + + <assert id="533" specnum="3.13" specid="#SelectingTransitions"> + <![CDATA[If a transition has 'type' of "internal", but its source state is not a compound state, its exit set is defined as if it had 'type' of "external".]]> + <test id="533" conformance="mandatory" manual="false"> + <start uri="533/test533.txml"/> + </test> + </assert> + + <assert id="144" specnum="4.2" specid="#raise"> + <![CDATA[The SCXML processor MUST place the event that is generated by the raise element at the rear of the session's internal event queue. ]]> + <test id="144" conformance="mandatory" manual="false"> + <start uri="144/test144.txml"/> + </test> + </assert> + + <assert id="147" specnum="4.3" specid="#if"> + <![CDATA[When the if element is executed, the SCXML processor MUST execute the first partition in document order that is defined by a tag whose 'cond' attribute evaluates to true, if there is one.]]> + <test id="147" conformance="mandatory" manual="false"> + <start uri="147/test147.txml"/> + </test> + </assert> + + <assert id="148" specnum="4.3" specid="#if"> + <![CDATA[When the if element is executed, if no 'cond'attribute evaluates to true, the SCXML Processor must execute the partition defined by the else tag, if there is one.]]> + <test id="148" conformance="mandatory" manual="false"> + <start uri="148/test148.txml"/> + </test> + </assert> + + <assert id="149" specnum="4.3" specid="#if"> + <![CDATA[When it executes an if element, if no 'cond' attribute evaluates to true and there is no else element, the SCXML processor must not evaluate any executable content within the element. ]]> + <test id="149" conformance="mandatory" manual="false"> + <start uri="149/test149.txml"/> + </test> + </assert> + + <assert id="150" specnum="4.6" specid="#foreach"> + <![CDATA[In the foreach element, the SCXML processor MUST declare a new variable if the one specified by 'item' is not already defined.]]> + <test id="150" conformance="mandatory" manual="false"> + <start uri="150/test150.txml"/> + </test> + </assert> + + <assert id="151" specnum="4.6" specid="#foreach"> + <![CDATA[In the foreach element, if 'index' is present, the SCXML processor MUST declare a new variable if the one specified by 'index' is not already defined.]]> + <test id="151" conformance="mandatory" manual="false"> + <start uri="151/test151.txml"/> + </test> + </assert> + + <assert id="152" specnum="4.6" specid="#foreach"> + <![CDATA[In the foreach element, if 'array' does not evaluate to a legal iterable collection, or if 'item' does not specify a legal variable name, the SCXML processor MUST terminate execution of the foreach element and the block that contains it, and place the error error.execution on the internal event queue. ]]> + <test id="152" conformance="mandatory" manual="false"> + <start uri="152/test152.txml"/> + </test> + </assert> + + <assert id="153" specnum="4.6" specid="#foreach"> + <![CDATA[When evaluating foreach, the SCXML processor MUST start with the first item in the collection and proceed to the last item in the iteration order that is defined for the collection. For each item in the collection in turn, the processor MUST assign it to the item variable.]]> + <test id="153" conformance="mandatory" manual="false"> + <start uri="153/test153.txml"/> + </test> + </assert> + + <assert id="155" specnum="4.6" specid="#foreach"> + <![CDATA[when evaluating foreach, for each item, after making the assignment, the SCXML processor MUST evaluate its child executable content. It MUST then proceed to the next item in iteration order.]]> + <test id="155" conformance="mandatory" manual="false"> + <start uri="155/test155.txml"/> + </test> + </assert> + + <assert id="156" specnum="4.6" specid="#foreach"> + <![CDATA[If the evaluation of any child element of foreach causes an error, the processor MUST cease execution of the foreach element and the block that contains it. ]]> + <test id="156" conformance="mandatory" manual="false"> + <start uri="156/test156.txml"/> + </test> + </assert> + + <assert id="525" specnum="4.6" specid="#foreach"> + <![CDATA[The SCXML processor MUST act as if it has made a shallow copy of the collection produced by the evaluation of 'array'. Specifically, modifications to the collection during the execution of foreach MUST NOT affect the iteration behavior.]]> + <test id="525" conformance="mandatory" manual="false"> + <start uri="525/test525.txml"/> + </test> + </assert> + + <assert id="158" specnum="4.9" specid="#EvaluationofExecutableContent"> + <![CDATA[The SCXML processor MUST execute the elements of a block of executable contentin document order.]]> + <test id="158" conformance="mandatory" manual="false"> + <start uri="158/test158.txml"/> + </test> + </assert> + + <assert id="159" specnum="4.9" specid="#EvaluationofExecutableContent"> + <![CDATA[If the processing of an element of executable content causes an error to be raised, the processor MUST NOT process the remaining elements of the block. ]]> + <test id="159" conformance="mandatory" manual="false"> + <start uri="159/test159.txml"/> + </test> + </assert> + +<assert id="276" specnum="5.3" specid="#data"> + <![CDATA[The SCXML Processor MUST allow the environment to provide values for top-level data elements at instantiation time. (Top-level data elements are those that are children of the datamodel element that is a child of scxml). Specifically, the Processor MUST use the values provided at instantiation time instead of those contained in these data elements.]]> + <test id="276" conformance="mandatory" manual="false"> + <start uri="276/test276.txml"/> + <dep uri="276/test276sub1.txml"/> + </test> + </assert> + + <assert id="277" specnum="5.3" specid="#data"> + <![CDATA[If the value specified for a data element (by 'src', children, or the environment) is not a legal data value, the SCXML Processor MUST raise place error.execution in the internal event queue and MUST create an empty data element in the data model with the specified id. ]]> + <test id="277" conformance="mandatory" manual="false"> + <start uri="277/test277.txml"/> + </test> + </assert> + + <assert id="279" specnum="5.3" specid="#data"> + <![CDATA[When 'binding' attribute on the scxml element is assigned the value "early" (the default), the SCXML Processor MUST create all data elements and assign their initial values at document initialization time.]]> + <test id="279" conformance="mandatory" manual="false"> + <start uri="279/test279.txml"/> + </test> + </assert> + + <assert id="280" specnum="5.3" specid="#data"> + <![CDATA[When 'binding' attribute on the scxml element is assigned the value "late", the SCXML Processor MUST create the data elements at document initialization time, but MUST assign the specified initial value to a given data element only when the state that contains it is entered for the first time, before any onentry markup.]]> + <test id="280" conformance="mandatory" manual="false"> + <start uri="280/test280.txml"/> + </test> + </assert> + + <assert id="550" specnum="5.3" specid="#data"> + <![CDATA[If the 'expr' attribute is present, the Platform MUST evaluate the corresponding expression at the time specified by the 'binding' attribute of scxml and MUST assign the resulting value as the value of the data element]]> + <test id="550" conformance="mandatory" manual="false"> + <start uri="550/test550.txml"/> + </test> + </assert> + + <assert id="551" specnum="5.3" specid="#data"> + <![CDATA[f child content is specified, the Platform MUST assign it as the value of the data element at the time specified by the 'binding' attribute of scxml. ]]> + <test id="551" conformance="mandatory" manual="false"> + <start uri="551/test551.txml"/> + </test> + </assert> + + <assert id="552" specnum="5.3" specid="#data"> + <![CDATA[If the 'src' attribute is present, the Platform MUST fetch the specified object at the time specified by the 'binding' attribute of scxml and MUST assign it as the value of the data element.]]> + <test id="552" conformance="mandatory" manual="false"> + <start uri="552/test552.txml"/> + <dep uri="552/test552.txt"/> + </test> + </assert> + + <assert id="286" specnum="5.4" specid="#assign"> + <![CDATA[If the location expression of an assign does not denote a valid location in the datamodel the processor MUST place the error error.execution in the internal event queue.]]> + <test id="286" conformance="mandatory" manual="false"> + <start uri="286/test286.txml"/> + </test> + </assert> + + <assert id="287" specnum="5.4" specid="#assign"> + <![CDATA[If the location expression of an assign denotes a valid location in the datamodel and if the value specified by 'expr' is a legal value for the location specified, the processor MUST place the specified value at the specified location.]]> + <test id="287" conformance="mandatory" manual="false"> + <start uri="287/test287.txml"/> + </test> + </assert> + + <assert id="288" specnum="5.4" specid="#assign"> + <![CDATA[If the location expression of an assign denotes a valid location in the datamodel and if the value specified children is a legal value for the location specified, the processor MUST place the specified value at the specified location.]]> + <test id="288" conformance="mandatory" manual="false"> + <start uri="288/test288.txml"/> + </test> + </assert> + + <assert id="487" specnum="5.4" specid="#assign"> + <![CDATA[If the value specified (by 'expr' or children) is not a legal value for the location specified, the processor MUST place the error error.execution in the internal event queue.]]> + <test id="487" conformance="mandatory" manual="false"> + <start uri="487/test487.txml"/> + </test> + </assert> + + <assert id="294" specnum="5.5" specid="#donedata"> + <![CDATA[In cases where the SCXML Processor generates a 'done' event upon entry into the final state, it MUST evaluate the donedata elements param or content children and place the resulting data in the _event.data field. The exact format of that data will be determined by the datamodel]]> + <test id="294" conformance="mandatory" manual="false"> + <start uri="294/test294.txml"/> + </test> + </assert> + + <assert id="527" specnum="5.6" specid="#content"> + <![CDATA[When the SCXML Processor evaluates the content element, if the 'expr' value expression is present, the Processor MUST evaluate it and use the result as the output of the content element.]]> + <test id="527" conformance="mandatory" manual="false"> + <start uri="527/test527.txml"/> + </test> + </assert> + + <assert id="528" specnum="5.6" specid="#content"> + <![CDATA[f the evaluation of 'expr' produces an error, the Processor MUST place error.execution in the internal event queue and use the empty string as the output of the content element.]]> + <test id="528" conformance="mandatory" manual="false"> + <start uri="528/test528.txml"/> + </test> + </assert> + + + + <assert id="529" specnum="5.6" specid="#content"> + <![CDATA[If the 'expr' attribute is not present, the Processor MUST use the children of content as the output.]]> + <test id="529" conformance="mandatory" manual="false"> + <start uri="529/test529.txml"/> + </test> + </assert> + + + + <assert id="298" specnum="5.7" specid="#param"> + <![CDATA[If the 'location' attribute on a param element does not refer to a valid location in the data model, the processor MUST place the error error.execution on the internal event queue.]]> + <test id="298" conformance="mandatory" manual="false"> + <start uri="298/test298.txml"/> + </test> + </assert> + + <assert id="343" specnum="5.7" specid="#param"> + <![CDATA[If the 'location' attribute on a param element does not refer to a valid location in the data model, or if the evaluation of the 'expr' produces an error, the processor MUST ignore the name and value.]]> + <test id="343" conformance="mandatory" manual="false"> + <start uri="343/test343.txml"/> + </test> + </assert> + + <assert id="488" specnum="5.7" specid="#param"> + <![CDATA[if the evaluation of the 'expr' produces an error, the processor MUST place the error error.execution on the internal event queue.]]> + <test id="488" conformance="mandatory" manual="false"> + <start uri="488/test488.txml"/> + </test> + </assert> + + <assert id="301" specnum="5.8" specid="#script"> + <![CDATA[If the script specified by the 'src' attribute of a script element cannot be downloaded within a platform-specific timeout interval, the document is considered non-conformant, and the platform MUST reject it. N.B. This test is valid only for datamodels that support scripting.]]> + <test id="301" conformance="mandatory" manual="true"> + <start uri="301/test301.txml"/> + </test> + </assert> + + <assert id="302" specnum="5.8" specid="#script"> + <![CDATA[The SCXML Processor MUST evaluate any script element that is a child of scxml at document load time. N.B. This test is valid only for datamodels that support scripting.]]> + <test id="302" conformance="mandatory" manual="false"> + <start uri="302/test302.txml"/> + </test> + </assert> + + <assert id="303" specnum="5.8" specid="#script"> + <![CDATA[The SCXML Processor MUST evaluate all script elements not children of scxml as part of normal executable content evaluation. N.B. This test is valid only for datamodels that support scripting.]]> + <test id="303" conformance="mandatory" manual="false"> + <start uri="303/test303.txml"/> + </test> + </assert> + + <assert id="304" specnum="5.8" specid="#script"> + <![CDATA[In a conformant SCXML document, the name of any script variable MAY be used as a location expression. N.B. This test is valid only for datamodels that support scripting.]]> + <test id="304" conformance="mandatory" manual="false"> + <start uri="304/test304.txml"/> + </test> + </assert> + + <assert id="307" specnum="5.9" specid="#Expressions"> + <![CDATA[When "late" data binding is used, accessing data substructure in expressions before the corresponding data element is loaded MUST yield the same execution-time behavior as accessing non-existent data substructure in a loaded data instance.]]> + <test id="307" conformance="mandatory" manual="true"> + <start uri="307/test307.txml"/> + </test> + </assert> + + <assert id="309" specnum="5.9" specid="#Expressions"> + <![CDATA[If a conditional expression cannot be evaluated as a boolean value ('true' or 'false') or if its evaluation causes an error, the SCXML processor MUST treat the expression as if it evaluated to 'false'.]]> + <test id="309" conformance="mandatory" manual="false"> + <start uri="309/test309.txml"/> + </test> + </assert> + + <assert id="310" specnum="5.9" specid="#Expressions"> + <![CDATA[All datamodels MUST support the 'In()' predicate, which takes a stateID as its argument and returns true if the state machine is in that state.]]> + <test id="310" conformance="mandatory" manual="false"> + <start uri="310/test310.txml"/> + </test> + </assert> + + <assert id="311" specnum="5.9" specid="#Expressions"> + <![CDATA[If a location expression cannot be evaluated to yield a valid location, the SCXML processor MUST place the error error.execution in the internal event queue.]]> + <test id="311" conformance="mandatory" manual="false"> + <start uri="311/test311.txml"/> + </test> + </assert> + + <assert id="312" specnum="5.9" specid="#Expressions"> + <![CDATA[If a value expression does not return a legal data value, the SCXML processor MUST place the error error.execution in the internal event queue.]]> + <test id="312" conformance="mandatory" manual="false"> + <start uri="312/test312.txml"/> + </test> + </assert> + + <assert id="313" specnum="5.9" specid="#Expressions"> + <![CDATA[The SCXML processor MAY reject documents containing syntactically ill-formed expressions at document load time, or it MAY wait and place error.execution in the internal event queue at runtime when the expressions are evaluated.]]> + <test id="313" conformance="mandatory" manual="true"> + <start uri="313/test313.txml"/> + </test> + </assert> + + <assert id="314" specnum="5.9" specid="#Expressions"> + <![CDATA[If the SCXML processor waits until it evaluates the expressions at runtime to raise errors, it MUST raise errors caused by expressions returning illegal values at the points at which Appendix A Algorithm for SCXML Interpretation indicates that the expressions are to be evaluated.]]> + <test id="314" conformance="mandatory" manual="true"> + <start uri="314/test314.txml"/> + </test> + </assert> + + <assert id="344" specnum="5.9" specid="#Expressions"> + <![CDATA[If a conditional expression cannot be evaluated as a boolean value ('true' or 'false') or if its evaluation causes an error, the SCXML processor MUST place the error 'error.execution' in the internal event queue.]]> + <test id="344" conformance="mandatory" manual="false"> + <start uri="344/test344.txml"/> + </test> + </assert> + + <assert id="318" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The SCXML Processor MUST bind the _event variable when an event is pulled off the internal or external event queue to be processed, and MUST keep the variable bound to that event until another event is processed.]]> + <test id="318" conformance="mandatory" manual="false"> + <start uri="318/test318.txml"/> + </test> + </assert> + + <assert id="319" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The SCXML Processor MUST NOT bind _event at initialization time until the first event is processed.]]> + <test id="319" conformance="mandatory" manual="false"> + <start uri="319/test319.txml"/> + </test> + </assert> + + <assert id="321" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The Processor MUST bind the variable _sessionid at load time to the system-generated id for the current SCXML session.]]> + <test id="321" conformance="mandatory" manual="false"> + <start uri="321/test321.txml"/> + </test> + </assert> + + <assert id="322" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The Processor MUST keep the _sessionid variable bound to the system-generated id until the session terminates.]]> + <test id="322" conformance="mandatory" manual="false"> + <start uri="322/test322.txml"/> + </test> + </assert> + + <assert id="323" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The Processor MUST bind the variable _name at load time to the value of the 'name' attribute of the scxml element. a]]> + <test id="323" conformance="mandatory" manual="false"> + <start uri="323/test323.txml"/> + </test> + </assert> + + <assert id="324" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The Processor MUST keep the _name variable bound to the value of the 'name' attribute of the scxml element until the session terminates.]]> + <test id="324" conformance="mandatory" manual="false"> + <start uri="324/test324.txml"/> + </test> + </assert> + + <assert id="325" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The Processor MUST bind the variable _ioprocessors to a set of values, one for each Event I/O Processor that it supports.]]> + <test id="325" conformance="mandatory" manual="false"> + <start uri="325/test325.txml"/> + </test> + </assert> + + <assert id="326" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The Processor MUST keep the _ioprocessors variable bound to its set of values until the session terminates.]]> + <test id="326" conformance="mandatory" manual="false"> + <start uri="326/test326.txml"/> + </test> + </assert> + + <assert id="329" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The Processor MUST cause any attempt to change the value of a system variable to fail.]]> + <test id="329" conformance="mandatory" manual="false"> + <start uri="329/test329.txml"/> + </test> + </assert> + + <assert id="330" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The SCXML Processor MUST insure that the following fields (name, type, sendid, origin, origintype, invokeid, data) are present in all events (_event variable), whether internal or external.]]> + <test id="330" conformance="mandatory" manual="false"> + <start uri="330/test330.txml"/> + </test> + </assert> + + <assert id="331" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The SCXML Processor MUST set the type property of _event to: "platform" (for events raised by the platform itself, such as error events), "internal" (for events raised by raise and send with target '_internal') or "external" (for all other events).]]> + <test id="331" conformance="mandatory" manual="false"> + <start uri="331/test331.txml"/> + </test> + </assert> + + <assert id="332" specnum="5.10" specid="#SystemVariables"> + <![CDATA[ If the sending entity has specified a value for this, the Processor MUST set this field to that value. Otherwise, in the case of error events triggered by a failed attempt to send an event, the Processor MUST set the sendid field to the send id of the triggering send element.]]> + <test id="332" conformance="mandatory" manual="false"> + <start uri="332/test332.txml"/> + </test> + </assert> + + <assert id="333" specnum="5.10" specid="#SystemVariables"> + <![CDATA[For events other than error events triggered by a failed attempt to send an event, if the sending entity + did not specify a value for the sendid field, the Processor MUST leave the sendid field (of _event) blank.]]> + <test id="333" conformance="mandatory" manual="false"> + <start uri="333/test333.txml"/> + </test> + </assert> + + <assert id="335" specnum="5.10" specid="#SystemVariables"> + <![CDATA[If an event was not received from an external entity, the Processor MUST leave the origin field blank.]]> + <test id="335" conformance="mandatory" manual="false"> + <start uri="335/test335.txml"/> + </test> + </assert> + + <assert id="336" specnum="5.10" specid="#SystemVariables"> + <![CDATA[For external events, the SCXML Processor SHOULD set the origintype field to a value which, in combination with the 'origin' field, will allow the receiver of the event to send a response back to the originating entity.]]> + <test id="336" conformance="mandatory" manual="false"> + <start uri="336/test336.txml"/> + </test> + </assert> + + <assert id="337" specnum="5.10" specid="#SystemVariables"> + <![CDATA[For internal and platform events, the Processor MUST leave the origintype field blank.]]> + <test id="337" conformance="mandatory" manual="false"> + <start uri="337/test337.txml"/> + </test> + </assert> + + <assert id="338" specnum="5.10" specid="#SystemVariables"> + <![CDATA[If an event is generated from an invoked child process, the Processor MUST set the invokeid field to the invoke id of the invocation that triggered the child process.]]> + <test id="338" conformance="mandatory" manual="false"> + <start uri="338/test338.txml"/> + </test> + </assert> + + <assert id="339" specnum="5.10" specid="#SystemVariables"> + <![CDATA[If an event is not generated from an invoked child process, the Processor MUST leave the invokeid field blank.]]> + <test id="339" conformance="mandatory" manual="false"> + <start uri="339/test339.txml"/> + </test> + </assert> + + <assert id="342" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The SCXML Processor MUST set the name field (of the _event variable) to the name of the event.]]> + <test id="342" conformance="mandatory" manual="false"> + <start uri="342/test342.txml"/> + </test> + </assert> + + <assert id="346" specnum="5.10" specid="#SystemVariables"> + <![CDATA[The Processor MUST place the error error.execution on the internal event queue when any attempt to change the value of a system variable is made.]]> + <test id="346" conformance="mandatory" manual="false"> + <start uri="346/test346.txml"/> + </test> + </assert> + + <assert id="172" specnum="6.2" specid="#send"> + <![CDATA[If 'eventexpr' is present, the SCXML Processor MUST evaluate it when the parent send element is evaluated and treat the result as if it had been entered as the value of 'event'. ]]> + <test id="172" conformance="mandatory" manual="false"> + <start uri="172/test172.txml"/> + </test> + </assert> + + <assert id="173" specnum="6.2" specid="#send"> + <![CDATA[If 'targetexpr' is present, the SCXML Processor MUST evaluate it when the parent send element is evaluated and treat the result as if it had been entered as the value of 'target'. ]]> + <test id="173" conformance="mandatory" manual="false"> + <start uri="173/test173.txml"/> + </test> + </assert> + + <assert id="174" specnum="6.2" specid="#send"> + <![CDATA[If 'typexpr' is present, the SCXML Processor MUST evaluate it when the parent send element is evaluated and treat the result as if it had been entered as the value of 'type'. ]]> + <test id="174" conformance="mandatory" manual="false"> + <start uri="174/test174.txml"/> + </test> + </assert> + + <assert id="175" specnum="6.2" specid="#send"> + <![CDATA[If 'delayexpr' is present, the SCXML Processor MUST evaluate it when the parent send element is evaluated and treat the result as if it had been entered as the value of 'delay'. ]]> + <test id="175" conformance="mandatory" manual="false"> + <start uri="175/test175.txml"/> + </test> + </assert> + + <assert id="176" specnum="6.2" specid="#send"> + <![CDATA[The SCXML Processor MUST evaluate param when the parent send element is evaluated and pass the resulting data unmodified to the external service when the message is delivered]]> + <test id="176" conformance="mandatory" manual="false"> + <start uri="176/test176.txml"/> + </test> + </assert> + + <assert id="178" specnum="6.2" specid="#send"> + <![CDATA[The SCXML Processor MUST include all attributes and values provided by param and/or 'namelist' even if duplicates occur. ]]> + <test id="178" conformance="mandatory" manual="true"> + <start uri="178/test178.txml"/> + </test> + </assert> + + <assert id="179" specnum="6.2" specid="#send"> + <![CDATA[The SCXML Processor MUST evaluate the content element when the parent send element is evaluated and pass the resulting data unmodified to the external service when the message is delivered. ]]> + <test id="179" conformance="mandatory" manual="false"> + <start uri="179/test179.txml"/> + </test> + </assert> + + <assert id="183" specnum="6.2" specid="#send"> + <![CDATA[If 'idlocation' is present, the SCXML Processor MUST generate an id when the parent send element is evaluated and store it in this location]]> + <test id="183" conformance="mandatory" manual="false"> + <start uri="183/test183.txml"/> + </test> + </assert> + + <assert id="185" specnum="6.2" specid="#send"> + <![CDATA[If a delay is specified via 'delay' or 'delayexpr', the SCXML Processor MUST interpret the character string as a time interval. + the SCXML Processor MUST dispatch the message only when the delay interval elapses.]]> + <test id="185" conformance="mandatory" manual="false"> + <start uri="185/test185.txml"/> + </test> + </assert> + + <assert id="186" specnum="6.2" specid="#send"> + <![CDATA[The Processor MUST evaluate all arguments to send when the send element is evaluated, and not when the message is actually dispatched.]]> + <test id="186" conformance="mandatory" manual="false"> + <start uri="186/test186.txml"/> + </test> + </assert> + + <assert id="187" specnum="6.2" specid="#send"> + <![CDATA[If the SCXML session terminates before the delay interval has elapsed, the SCXML Processor MUST discard the message without attempting to deliver it. ]]> + <test id="187" conformance="mandatory" manual="false"> + <start uri="187/test187.txml"/> + </test> + </assert> + + <assert id="194" specnum="6.2" specid="#send"> + <![CDATA[If the value of the 'target' or 'targetexpr' attribute is not supported or invalid, the Processor MUST place the error error.execution on the internal event queue]]> + <test id="194" conformance="mandatory" manual="false"> + <start uri="194/test194.txml"/> + </test> + </assert> + + <assert id="198" specnum="6.2" specid="#send"> + <![CDATA[If neither the 'type' nor the 'typeexpr' is defined, the SCXML Processor MUST assume the default value of http://www.w3.org/TR/scxml/#SCXMLEventProcessor.]]> + <test id="198" conformance="mandatory" manual="false"> + <start uri="198/test198.txml"/> + </test> + </assert> + + <assert id="199" specnum="6.2" specid="#send"> + <![CDATA[f the SCXML Processor does not support the type that is specified, it MUST place the event error.execution on the internal event queue.]]> + <test id="199" conformance="mandatory" manual="false"> + <start uri="199/test199.txml"/> + </test> + </assert> + + <assert id="200" specnum="6.2" specid="#send"> + <![CDATA[SCXML Processors MUST support the type http://www.w3.org/TR/scxml/#SCXMLEventProcessor]]> + <test id="200" conformance="mandatory" manual="false"> + <start uri="200/test200.txml"/> + </test> + </assert> + + <assert id="201" specnum="6.2" specid="#send"> + <![CDATA[Processors that support HTTP POST must use the value http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor for the "type" attribute]]> + <test id="201" conformance="optional" manual="false"> + <start uri="201/test201.txml"/> + </test> + </assert> + + + <assert id="205" specnum="6.2" specid="#send"> + <![CDATA[The sending SCXML Interpreter MUST not alter the content of the send + and include it in the message that it sends to the destination specified in the target attribute of send.]]> + <test id="205" conformance="mandatory" manual="false"> + <start uri="205/test205.txml"/> + </test> + </assert> + + <assert id="521" specnum="6.2" specid="#send"> + <![CDATA[f the Processor cannot dispatch the event, it MUST place the error error.communication on the internal event queue of the session that attempted to send the event. ]]> + <test id="521" conformance="mandatory" manual="false"> + <start uri="521/test521.txml"/> + </test> + </assert> + + + + <assert id="553" specnum="6.2" specid="#send"> + <![CDATA[If the evaluation of send's arguments produces an error, If the evaluation of send's arguments produces an error, the Processor MUST discard the message without attempting to deliver it. ]]> + <test id="553" conformance="mandatory" manual="false"> + <start uri="553/test553.txml"/> + </test> + </assert> + + <assert id="207" specnum="6.3" specid="#cancel"> + <![CDATA[The SCXML Processor MUST NOT allow cancel to affect events that were not raised in the same session. ]]> + <test id="207" conformance="mandatory" manual="false"> + <start uri="207/test207.txml"/> + </test> + </assert> + + <assert id="208" specnum="6.3" specid="#cancel"> + <![CDATA[The Processor SHOULD make its best attempt to cancel all delayed events with the specified id.]]> + <test id="208" conformance="mandatory" manual="false"> + <start uri="208/test208.txml"/> + + </test> + </assert> + + <assert id="210" specnum="6.3" specid="#cancel"> + <![CDATA[If the 'sendidexpr' attribute is present, the SCXML Processor MUST evaluate it when the parent cancel element is evaluated and treat the result as if it had been entered as the value of 'sendid'. ]]> + <test id="210" conformance="mandatory" manual="false"> + <start uri="210/test210.txml"/> + </test> + </assert> + + <assert id="215" specnum="6.4" specid="#invoke"> + <![CDATA[If the typeexpr attribute is present, the SCXML Processor MUST evaluate it when the parent invoke element is evaluated and treat the result as if it had been entered as the value of 'type'. ]]> + <test id="215" conformance="mandatory" manual="false"> + <start uri="215/test215.txml"/> + </test> + </assert> + + <assert id="216" specnum="6.4" specid="#invoke"> + <![CDATA[If the srcexpr attribute is present, the SCXML Processor MUST evaluate it when the parent invoke element is evaluated and treat the result as if it had been entered as the value of 'src'. ]]> + <test id="216" conformance="mandatory" manual="false"> + <start uri="216/test216.txml"/> + <dep uri="216/test216sub1.txml"/> + </test> + </assert> + + <assert id="220" specnum="6.4" specid="#invoke"> + <![CDATA[Platforms MUST support http://www.w3.org/TR/scxml/, as a value for the 'type' attribute]]> + <test id="220" conformance="mandatory" manual="false"> + <start uri="220/test220.txml"/> + </test> + </assert> + + <assert id="223" specnum="6.4" specid="#invoke"> + <![CDATA[If the 'idlocation' attribute is present, the SCXML Processor MUST generate an id automatically when the invoke element is evaluated and store it in the location specified by 'idlocation'.]]> + <test id="223" conformance="mandatory" manual="false"> + <start uri="223/test223.txml"/> + </test> + </assert> + + <assert id="224" specnum="6.4" specid="#invoke"> + <![CDATA[When the platform generates an identifier for 'idlocation', the identifier MUST have the form stateid.platformid, where stateid is the id of the state containing this element and platformid is automatically generated.]]> + <test id="224" conformance="mandatory" manual="false"> + <start uri="224/test224.txml"/> + </test> + </assert> + + <assert id="225" specnum="6.4" specid="#invoke"> + <![CDATA[n the automatically generated invoke identifier, platformid MUST be unique within the current session]]> + <test id="225" conformance="mandatory" manual="false"> + <start uri="225/test225.txml"/> + </test> + </assert> + + + + <assert id="226" specnum="6.4" specid="#invoke"> + <![CDATA[When the invoke element is executed, the SCXML Processor MUST start a new logical instance of the external service specified in 'type' or 'typexpr', passing it the URL specified by 'src' or the data specified by content, or param. ]]> + <test id="226" conformance="mandatory" manual="false"> + <start uri="226/test226.txml"/> + <dep uri="226/test226sub1.txml"/> + </test> + </assert> + + <assert id="228" specnum="6.4" specid="#invoke"> + <![CDATA[the Processor MUST keep track of the unique invokeid and insure that it is included in all events that the invoked service returns to the invoking session. ]]> + <test id="228" conformance="mandatory" manual="false"> + <start uri="228/test228.txml"/> + </test> + </assert> + + <assert id="229" specnum="6.4" specid="#invoke"> + <![CDATA[When the 'autoforward' attribute is set to true, the SCXML Processor MUST send an exact copy of every external event it receives to the invoked process.]]> + <test id="229" conformance="mandatory" manual="false"> + <start uri="229/test229.txml"/> + </test> + </assert> + + <assert id="230" specnum="6.4" specid="#invoke"> + <![CDATA[When the SCXML Processor autoforwards an event to the invoked process, all the fields specified in 5.11.1 The Internal Structure of Events MUST have the same values in the forwarded copy of the event]]> + <test id="230" conformance="mandatory" manual="true"> + <start uri="230/test230.txml"/> + </test> + </assert> + + <assert id="232" specnum="6.4" specid="#invoke"> + <![CDATA[he invoked external service MAY return multiple events while it is processing]]> + <test id="232" conformance="mandatory" manual="false"> + <start uri="232/test232.txml"/> + </test> + </assert> + + <assert id="233" specnum="6.4" specid="#invoke"> + <![CDATA[If there is a finalize handler in the instance of invoke that created the service that generated the event, the SCXML Processor MUST execute the code in that finalize handler right before it removes the event from the event queue for processing.]]> + <test id="233" conformance="mandatory" manual="false"> + <start uri="233/test233.txml"/> + </test> + </assert> + + <assert id="234" specnum="6.4" specid="#invoke"> + <![CDATA[t MUST NOT execute the finalize handler in any other instance of invoke besides the one in the instance of invoke that created the service that generated the event.]]> + <test id="234" conformance="mandatory" manual="false"> + <start uri="234/test234.txml"/> + </test> + </assert> + + <assert id="235" specnum="6.4" specid="#invoke"> + <![CDATA[Once the invoked external service has finished processing it MUST return a special event 'done.invoke.id' to the external event queue of the invoking process, where id is the invokeid for the corresponding invoke element. ]]> + <test id="235" conformance="mandatory" manual="false"> + <start uri="235/test235.txml"/> + </test> + </assert> + + <assert id="236" specnum="6.4" specid="#invoke"> + <![CDATA[The external service MUST NOT generate any other events after the invoke.done.invokeid event.]]> + <test id="236" conformance="mandatory" manual="false"> + <start uri="236/test236.txml"/> + </test> + </assert> + + <assert id="237" specnum="6.4" specid="#invoke"> + <![CDATA[If the invoking session takes a transition out of the state containing the invoke before it receives the 'done.invoke.id' event, the SCXML Processor MUST automatically cancel the invoked component and stop its processing.]]> + <test id="237" conformance="mandatory" manual="false"> + <start uri="237/test237.txml"/> + </test> + </assert> + + <assert id="239" specnum="6.4" specid="#invoke"> + <![CDATA[Invoked services of type http://www.w3.org/TR/scxml/, http://www.w3.org/TR/ccxml/, http://www.w3.org/TR/voicexml30/, or http://www.w3.org/TR/voicexml21 MUST interpret values specified by the content element or 'src' attribute as markup to be executed]]> + <test id="239" conformance="mandatory" manual="false"> + <start uri="239/test239.txml"/> + <dep uri="239/test239sub1.txml"/> + </test> + </assert> + + <assert id="240" specnum="6.4" specid="#invoke"> + <![CDATA[Invoked services of type http://www.w3.org/TR/scxml/, http://www.w3.org/TR/ccxml/, http://www.w3.org/TR/voicexml30/, or http://www.w3.org/TR/voicexml21 MUST interpret values specified by param element or 'namelist' attribute as values that are to be injected into their data models]]> + <test id="240" conformance="mandatory" manual="false"> + <start uri="240/test240.txml"/> + </test> + </assert> + + <assert id="241" specnum="6.4" specid="#invoke"> + <![CDATA[Invoked services MUST treat values specified by param and namelist identically.]]> + <test id="241" conformance="mandatory" manual="false"> + <start uri="241/test241.txml"/> + </test> + </assert> + + <assert id="242" specnum="6.4" specid="#invoke"> + <![CDATA[Invoked services MUST also treat values specified by 'src' and content identically.]]> + <test id="242" conformance="mandatory" manual="false"> + <start uri="242/test242.txml"/> + <dep uri="242/test242sub1.txml"/> + </test> + </assert> + + <assert id="243" specnum="6.4" specid="#invoke"> + <![CDATA[If the invoked process is of type http://www.w3.org/TR/scxml/ and 'name' of a param element in the invoke matches the 'id' of a data element in the top-level data declarations of the invoked session, the SCXML Processor MUST use the value of the param element as the initial value of the corresponding data element. ]]> + <test id="243" conformance="mandatory" manual="false"> + <start uri="243/test243.txml"/> + </test> + </assert> + + <assert id="244" specnum="6.4" specid="#invoke"> + <![CDATA[If the invoked process is of type http://www.w3.org/TR/scxml/ and the key of namelist item in the invoke matches the 'id' of a data element in the top-level data declarations of the invoked session, the SCXML Processor MUST use the corresponding value as the initial value of the corresponding data element.]]> + <test id="244" conformance="mandatory" manual="false"> + <start uri="244/test244.txml"/> + </test> + </assert> + + <assert id="245" specnum="6.4" specid="#invoke"> + <![CDATA[If the invoked process is of type http://www.w3.org/TR/scxml/, and the name of a param element or the key of of a namelis item do not match the name of a data element in the invoked process, the Processor MUST NOT add the value of the param element or namelist key/value pair to the invoked session's data model.]]> + <test id="245" conformance="mandatory" manual="false"> + <start uri="245/test245.txml"/> + </test> + </assert> + + <assert id="247" specnum="6.4" specid="#invoke"> + <![CDATA[If the invoked state machine is of type http://www.w3.org/TR/scxml/ and it reaches a top-level final state, the Processor MUST place the event done.invoke.id on the external event queue of the invoking machine, where id is the invokeid for this invocation]]> + <test id="247" conformance="mandatory" manual="false"> + <start uri="247/test247.txml"/> + </test> + </assert> + + <assert id="250" specnum="6.4" specid="#invoke"> + <![CDATA[When an invoked process of type http://www.w3.org/TR/scxml/is cancelled by the invoking process, the Processor MUST execute the onexit handlers for all active states in the invoked session]]> + <test id="250" conformance="mandatory" manual="true"> + <start uri="250/test250.txml"/> + </test> + </assert> + + <assert id="252" specnum="6.4" specid="#invoke"> + <![CDATA[Once it cancels an invoked session, the Processor MUST NOT insert any events it receives from the invoked session into the external event queue of the invoking session. ]]> + <test id="252" conformance="mandatory" manual="false"> + <start uri="252/test252.txml"/> + </test> + </assert> + + <assert id="253" specnum="6.4" specid="#invoke"> + <![CDATA[When the invoked session is of type http://www.w3.org/TR/scxml/, The SCXML Processor MUST support the use of SCXML Event/IO processor (E.1 SCXML Event I/O Processor) to communicate between the invoking and the invoked sessions.]]> + <test id="253" conformance="mandatory" manual="false"> + <start uri="253/test253.txml"/> + </test> + </assert> + + <assert id="530" specnum="6.4" specid="#invoke"> + <![CDATA[The SCXML Processor MUST evaluate a child content element when the parent invoke element is evaluated and pass the resulting data to the invoked service.]]> + <test id="530" conformance="mandatory" manual="false"> + <start uri="530/test530.txml"/> + </test> + </assert> + + <assert id="554" specnum="6.4" specid="#invoke"> + <![CDATA[if the evaluation of the invoke element's arguments arguments produces an error, the SCXML Processor MUST terminate the processing of the element without further action.]]> + <test id="554" conformance="mandatory" manual="false"> + <start uri="554/test554.txml"/> + </test> + </assert> + + <assert id="436" specnum="C.1" specid="#minimal-profile"> + <![CDATA[When the "datamodel" attribute of the scxml element has the value "null", the In() predicate must return 'true' if and only if that state is in the current state configuration.]]> + <test id="436" conformance="mandatory" manual="false"> + <start uri="436/test436.txml"/> + </test> + </assert> + + + +<assert id="278" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript data model, the SCXML processor MUST allow any data element to be accessed from any state.]]> + <test id="278" conformance="optional" manual="false"> + <start uri="278/test278.txml"/> + </test> + </assert> + + <assert id="444" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript datamodel, for each data element in the document, the SCXML Processor must create an ECMAScript variable object whose name is the value of the id attribute of the data element.]]> + <test id="444" conformance="optional" manual="false"> + <start uri="444/test444.txml"/> + </test> + </assert> + + <assert id="445" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript datamodel for each data element in the document, if the variable object associated with the element is not assigned at the time indicated by the 'binding' attribute on the scxml element, then the SCXML Processor must assign the variable the default value ECMAScript undefined.]]> + <test id="445" conformance="optional" manual="false"> + <start uri="445/test445.txml"/> + </test> + </assert> + + <assert id="448" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript datamodel, the SCXML Processor must place all variables in a single global ECMAScript scope. ]]> + <test id="448" conformance="optional" manual="false"> + <start uri="448/test448.txml"/> + </test> + </assert> + + <assert id="449" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript datamodel, the SCXML Processor must convert ECMAScript expressions used in conditional expressions into their effective boolean value using the ToBoolean operator as described in Section 9.2 of [ECMASCRIPT-262].]]> + <test id="449" conformance="optional" manual="false"> + <start uri="449/test449.txml"/> + </test> + </assert> + + <assert id="451" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript datamodel, the SCXML Processor must add an ECMAScript + function 'In()' to the SCXML namespace that takes a stateID as its argument and + returns 'true' if and only if that state is in the current state configuration, + as described in 5.10.1 Conditional Expressions.]]> + <test id="451" conformance="optional" manual="false"> + <start uri="451/test451.txml"/> + </test> + </assert> + + <assert id="452" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript datamodel, the SCXML Processor must accept any ECMAScript left-hand-side expression as a location expression.]]> + <test id="452" conformance="optional" manual="false"> + <start uri="452/test452.txml"/> + </test> + </assert> + + + + <assert id="453" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript datamodel, the SCXML Processor must accept any ECMAScript expression as a value expression.]]> + <test id="453" conformance="optional" manual="false"> + <start uri="453/test453.txml"/> + </test> + </assert> + + <assert id="456" specnum="C.2" specid="#ecma-profile"> + <![CDATA[the SCXML Processor must accept any ECMAScript program as defined in Section 14 of [ECMASCRIPT-262] as the content of a script element.]]> + <test id="456" conformance="optional" manual="false"> + <start uri="456/test456.txml"/> + </test> + </assert> + + <assert id="446" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript data model, if either the 'src' attribute or in-line content is provided in the data elemenet, then if the content (whether fetched or provided in-line) is JSON and the processor supports JSON, the SCXML Processor MUST create the corresponding ECMAScript structure and assign it as the value of the data element.]]> + <test id="446" conformance="optional" manual="false"> + <start uri="446/test446.txml"/> + <dep uri="446/test446.txt"/> + </test> + </assert> + + <assert id="557" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript data model, if either the 'src' attribute or in-line content is provided in the data element, then if the content (whether fetched or provided in-line) is an XML document, the SCXML Processor MUST create the corresponding DOM structure and assign it as the value of the data element. ]]> + <test id="557" conformance="optional" manual="false"> + <start uri="557/test557.txml"/> + <dep uri="557/test557.txt"/> + </test> + </assert> + + <assert id="558" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript datamodel, if either the 'src' attribute or in-line content is provided in the data element, and the content (whether fetched or provided in-line) is not an XML document or JSON (or the + processor does not support JSON), then the Processor MUST treat the content as a space-normalized string literal and assign it as the value of the variable]]> + <test id="558" conformance="optional" manual="false"> + <start uri="558/test558.txml"/> + <dep uri="558/test558.txt"/> + </test> + </assert> + + <assert id="560" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript data model, if the content provided to populate _event.data can be interpeted as key-value pairs, then for each unique key, the SCXML Processor MUST create a property of _event.data whose name is the name of the key-value pair and whose value is the value of the key-value pair.]]> + <test id="560" conformance="optional" manual="false"> + <start uri="560/test560.txml"/> + </test> + </assert> + + <assert id="578" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript data model, if the content provided to populate _event.data cannot be interpreted as + key value pairs and can be interpeted as JSON and the + processor supports JSON, then the Processor MUST create the corresponding ECMAScript structure(s) as properties of _event.data.]]> + <test id="578" conformance="optional" manual="false"> + <start uri="578/test578.txml"/> + </test> + </assert> + + <assert id="561" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript data model, if the content provided to populate _event.data can be interpreted as a valid XML document + (and cannot be interpreted as key-value pairs or JSON), the Processor MUST create the corresponding DOM structure and assign it as the value _event.data. ]]> + <test id="561" conformance="optional" manual="false"> + <start uri="561/test561.txml"/> + </test> + </assert> + + <assert id="562" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript data model, if the content provided to populate _event.data is neither key-value pairs nor JSON nor a valid XML document, the Processor MUST treat the content treat the content as a space-normalized string literal and assign it as the value of _event.data.]]> + <test id="562" conformance="optional" manual="false"> + <start uri="562/test562.txml"/> + </test> + </assert> + + <assert id="569" specnum="C.2" specid="#ecma-profile"> + <![CDATA[For the _ioprocessors system variable in the ECMAScript datamodel the Processor MUST create an array with an object for each Event I/O processor that it supports, where the name of the object is the same as that of the I/O processor. For the SCXML and BasicHTTP Event I/O processors, the Processor MUST create a location property under the object, assigning the access URI as its String value.]]> + <test id="569" conformance="optional" manual="false"> + <start uri="569/test569.txml"/> + </test> + </assert> + + + <assert id="457" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript data model, the legal iterable collections are arrays, namely objects that satisfy instanceof(Array) in ECMAScript. The legal values for the 'item' attribute on foreach are legal ECMAScript variable names.]]> + <test id="457" conformance="optional" manual="false"> + <start uri="457/test457.txml"/> + </test> + </assert> + + <assert id="459" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript data model, the iteration order for the foreach element is the order of the underlying ECMAScript array, and goes from an index of 0 by increments of one to an index of array_name.length - 1. ]]> + <test id="459" conformance="optional" manual="false"> + <start uri="459/test459.txml"/> + </test> + </assert> + + + + <assert id="460" specnum="C.2" specid="#ecma-profile"> + <![CDATA[In the ECMAScript data model, since shallow copy is required for the foreach element, foreach assignment is equivalent to item = array_name[index] in ECMAScript.]]> + <test id="460" conformance="optional" manual="false"> + <start uri="460/test460.txml"/> + </test> + </assert> + + + + <assert id="463" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, for each data element in the document, the SCXML Processor MUST create a child of datamodel called <data> with an 'id' attribute whose value is the same as that of the 'id' attribute of the document data element. The Processor MUST bind an XPath variable of the same name to that datamodel data element. ]]> + <test id="463" conformance="optional" manual="false"> + <start uri="463/test463.txml"/> + </test> + </assert> + + <assert id="464" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, for each data element in the document, if a value is not assigned at the time indicated by the 'binding' attribute on the scxml element, then the SCXML Processor must leave the datamodel data element empty, as follows: <data xmlns=""></data> ]]> + <test id="464" conformance="optional" manual="false"> + <start uri="464/test464.txml"/> + </test> + </assert> + + <assert id="465" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, the SCXML Processor must place all variables in a single global XPath scope, such that they are subsequently available to all expressions within the document.]]> + <test id="465" conformance="optional" manual="false"> + <start uri="465/test465.txml"/> + </test> + </assert> + + <assert id="466" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, the SCXML Processor must accept any XPath 2.0 expression as a conditional expression and must convert it into its effective boolean value as described in section 2.4.3 of the [XPath 2.0] specification.]]> + <test id="466" conformance="optional" manual="false"> + <start uri="466/test466.txml"/> + </test> + </assert> + + <assert id="467" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, the SCXML Processor must add an XPath function to the SCXML namespace that takes a stateID as its argument and returns 'true' if and only if that state is in the current state configuration, as described in 5.10.1 Conditional Expressions. ]]> + <test id="467" conformance="optional" manual="false"> + <start uri="467/test467.txml"/> + </test> + </assert> + + <assert id="468" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, the SCXML Processor must accept any XPath 2.0 expression as a location expression.]]> + <test id="468" conformance="optional" manual="false"> + <start uri="468/test468.txml"/> + </test> + </assert> + + <assert id="469" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel,the SCXML Processor must allow any XPath expression to be used as a value expression.]]> + <test id="469" conformance="optional" manual="false"> + <start uri="469/test469.txml"/> + </test> + </assert> + + <assert id="470" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, if the result of a value expression is a node-set, the Processor must make a deep copy of the subtree rooted at each node.]]> + <test id="470" conformance="optional" manual="false"> + <start uri="470/test470.txml"/> + </test> + </assert> + + <assert id="473" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, if the 'type' attribute of the assign element is specified with a value of 'replacechildren', the SCXML Processor must either replace all the children at 'location' with the value specified by 'expr' or place the error error.execution on the internal event queue.]]> + <test id="473" conformance="optional" manual="false"> + <start uri="473/test473.txml"/> + </test> + </assert> + + <assert id="474" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, if the 'type' attribute of the assign element is specified with a value of 'firstchild', the SCXML Processor must either insert the value specified by 'expr' before all of the children at 'location' or place the error error.execution on the internal event queue.]]> + <test id="474" conformance="optional" manual="false"> + <start uri="474/test474.txml"/> + </test> + </assert> + + <assert id="475" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel,if the 'type' attribute of the assign element is specified with a value of 'lastchild', the SCXML Processor must either insert the value specified by 'expr' after all of the children at 'location' or place the error error.execution on the internal event queue.]]> + <test id="475" conformance="optional" manual="false"> + <start uri="475/test475.txml"/> + </test> + </assert> + + <assert id="476" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel,if the 'type' attribute of the assign element is specified with a value of 'previoussibling', the SCXML Processor must either insert the value specified by 'expr' before the node specified by 'location', keeping the same parent, or place the error error.execution on the internal event queue.]]> + <test id="476" conformance="optional" manual="false"> + <start uri="476/test476.txml"/> + </test> + </assert> + + <assert id="477" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, if the 'type' attribute of the assign element is specified with a value of 'nextsibling', the SCXML Processor must either insert the value specified by 'expr' after the node specified by 'location', keeping the same parent, or place the error error.execution on the internal event queue.]]> + <test id="477" conformance="optional" manual="false"> + <start uri="477/test477.txml"/> + </test> + </assert> + + <assert id="478" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, if the 'type' attribute of the assign element is specified with a value of 'replace', the SCXML Processor must either replace the node specified by 'location' with the value specified by 'expr' or place the error error.execution on the internal event queue.]]> + <test id="478" conformance="optional" manual="false"> + <start uri="478/test478.txml"/> + </test> + </assert> + + <assert id="479" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, if the 'type' attribute of the assign element is specified with a value of 'delete', the SCXML Processor must either delete the node specified by 'location' or place the error error.execution on the internal event queue.]]> + <test id="479" conformance="optional" manual="false"> + <start uri="479/test479.txml"/> + </test> + </assert> + + <assert id="480" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, if the 'type' attribute of the assign element is specified with a value of 'addattribute', the SCXML Processor must either add an attribute with the name specified by 'attr' and value specified by 'expr' to the node specified by 'location' or place the error error.execution on the internal event queue.]]> + <test id="480" conformance="optional" manual="false"> + <start uri="480/test480.txml"/> + </test> + </assert> + + <assert id="481" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, if the evaluation of any of the expressions in an assign element causes an error to be raised, evaluation of the element terminates immediately and the assign has no effect. Similarly, if the processor is unable to place the specified value at the node specified by 'location' it must terminate immediately, placing the error error.execution on the internal event queue, and the assign has no effect. ]]> + <test id="481" conformance="optional" manual="false"> + <start uri="481/test481.txml"/> + </test> + </assert> + + <assert id="482" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, for each system variable defined in 5.11 System Variables, the SCXML Processor MUST create a datamodel <data> element with an 'id' attribue whose value is the name of the system variable. The Processor also MUST bind an XPath variable whose name is the name of the system variable to this element. ]]> + <test id="482" conformance="optional" manual="false"> + <start uri="482/test482.txml"/> + </test> + </assert> + + <assert id="483" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, In the XPath data model, the legal iterable collections are Node-Sets, and + the legal values for the 'item' attribute on foreach are legal XPath variable names. + The iteration order is the order of the underlying Node-set, and goes from an index of 1 by increments of one to an index of count(node-set).]]> + <test id="483" conformance="optional" manual="false"> + <start uri="483/test483.txml"/> + </test> + </assert> + + + <assert id="537" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel,the SCXML Processor MUST maintain the XPath data model as an XML structure with a root element called <datamodel>. + For each datamodel <data> element, the Processor MUST insert the value of the document data element as the child(ren) of the datamodel <data> element.]]> + <test id="537" conformance="optional" manual="false"> + <start uri="537/test537.txml"/> + </test> + </assert> + + <assert id="539" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, for each data element, ff either the 'src' attribute or in-line content is provided in the document data element, then if the content (whether fetched or provided in-line) is XML, the SCXML Processor MUST insert the XML as the child(ren) of the datamodel <data> element]]> + <test id="539" conformance="optional" manual="false"> + <start uri="539/test539.txml"/> + <dep uri="539/test539.txt"/> + </test> + </assert> + + <assert id="540" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, for each data element, if either the 'src' attribute or in-line content is provided in the document data element, then if the content (whether fetched or provided in-line) is not XML, the Processor MUST treat the content as a space-normalized string literal and insert it as the child of the datamodel <data> element. ]]> + <test id="540" conformance="optional" manual="false"> + <start uri="540/test540.txml"/> + <dep uri="540/test540.txt"/> + </test> + </assert> + + <assert id="542" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, when content is a child of donedata, the Processor MUST interpret its value as defined in D.3.7.1 _event.data]]> + <test id="542" conformance="optional" manual="false"> + <start uri="542/test542.txml"/> + </test> + </assert> + + <assert id="543" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, for the _event system variable (i.e., the <data id="_event"> child of <datamodel>), for each of the fields defined in 5.11.1 The Internal Structure of Events, the Processor MUST create an child element whose name is the name of the field. ]]> + <test id="543" conformance="optional" manual="false"> + <start uri="543/test543.txml"/> + </test> + </assert> + + <assert id="544" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, if the content provided to populate _event.data can be interpreted as key-value pairs, then for each unique key, the SCXML Processor MUST create a <data> element as a child of _event's data child with an 'id' attribute whose value is the name of the key. The Processor MUST insert the value of the key-value pair as the content of this element. ]]> + <test id="544" conformance="optional" manual="false"> + <start uri="544/test544.txml"/> + </test> + </assert> + + + + <assert id="545" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel,if the content provided to populate _event.data can be interpreted as a valid XML document (and not as key-value pairs), the Processor MUST insert the XML structure as the content of _event's <data> child.]]> + <test id="545" conformance="optional" manual="false"> + <start uri="545/test545.txml"/> + </test> + </assert> + + <assert id="546" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, if the content provided to populate _event.data cannot be interpreted as either key-value pairs or as a vaild XML document, the Processor MUST treat the content as a space-normalized string literal and insert it as the content of _event's <data> child.]]> + <test id="546" conformance="optional" manual="false"> + <start uri="546/test546.txml"/> + </test> + </assert> + + <assert id="547" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, [when evaluating assign If the specified location contains a node set, the Processor MUST perform the assignment to each node in the set.]]> + <test id="547" conformance="optional" manual="false"> + <start uri="547/test547.txml"/> + </test> + </assert> + + <assert id="555" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, In contexts where a string is expected, the Processor MAY convert the expression result to a string using string().]]> + <test id="555" conformance="optional" manual="false"> + <start uri="555/test555.txml"/> + </test> + </assert> + + <assert id="568" specnum="C.3" specid="#xpath-profile"> + <![CDATA[In the XPath datamodel, For the _ioprocessors system variable the Processor MUST create an child element for each Event I/O processor that it supports, where the name of the child element is the same as that of the I/O processor. For the SCXML and BasicHTTP Event I/O processors, the Processor MUST create a <location>child under the child element, assigning the access URI as its text child.]]> + <test id="568" conformance="optional" manual="false"> + <start uri="568/test568.txml"/> + </test> + </assert> + + + <assert id="189" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[When using the scxml event i/o processor] If the target is the special term '#_internal', the Processor MUST add the event to the internal event queue of the sending session]]> + <test id="189" conformance="mandatory" manual="false"> + <start uri="189/test189.txml"/> + </test> + </assert> + + <assert id="190" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[[When using the scxml event i/o processor] If the target is the special term '#_scxml_sessionid', where sessionid is the id of an SCXML session that is accessible to the Processor, the Processor MUST add the event to the external queue of that session.]]> + <test id="190" conformance="mandatory" manual="false"> + <start uri="190/test190.txml"/> + </test> + </assert> + <assert id="191" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[[When using the scxml event i/o processor] If the target is the special term '#_parent', the Processor MUST add the event to the external event queue of the SCXML session that invoked the sending session, if there is one.]]> + <test id="191" conformance="mandatory" manual="false"> + <start uri="191/test191.txml"/> + </test> + </assert> + + <assert id="192" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[[When using the scxml event i/o processor] If the target is the special term '#_invokeid', where invokeid is the invokeid of an SCXML session that the sending session has created by invoke, the Processor MUST must add the event to the external queue of that session.]]> + <test id="192" conformance="mandatory" manual="false"> + <start uri="192/test192.txml"/> + </test> + </assert> + + <assert id="193" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[[When using the scxml event i/o processor] If neither the 'target' nor the 'targetexpr' attribute is specified, the SCXML Processor MUST add the event to the external event queue of the sending session. ]]> + <test id="193" conformance="optional" manual="false"> + <start uri="193/test193.txml"/> + </test> + </assert> + + <assert id="347" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[SCXML Processors MUST support sending messages to and receiving messages from other SCXML sessions using the SCXML Event I/O Processor.]]> + <test id="347" conformance="mandatory" manual="false"> + <start uri="347/test347.txml"/> + </test> + </assert> + + <assert id="348" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[name'. The sending SCXML Processor MUST take the value of this attribute from the 'event' attribute of the send element. The receiving SCXML Processor MUST use it as the value the 'name' field in the event that it generates.]]> + <test id="348" conformance="mandatory" manual="false"> + <start uri="348/test348.txml"/> + </test> + </assert> + + <assert id="349" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[source'. The sending SCXML Processor MUST populate this attribute with a URI that the receiving processor can use to reply to the sending processor. The receiving SCXML Processor MUST use this URI as the value of the 'origin' field in the event that it generates.]]> + <test id="349" conformance="mandatory" manual="false"> + <start uri="349/test349.txml"/> + </test> + </assert> + + <assert id="350" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[target'. The sending SCXML Processor MUST take the value of this attribute from the 'target' attribute of the send element. The receiving SCXML Processor MUST use this value to determine which session to deliver the message to.]]> + <test id="350" conformance="mandatory" manual="false"> + <start uri="350/test350.txml"/> + </test> + </assert> + + <assert id="351" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[sendid'. the sending SCXML Processor MUST populate this attribute with the identifier specified in the 'id' attribute or automatically generated by the platform when the send tag is executed in the sending session. (See 6.2 send.) The receiving SCXML Processor MUST use this value as the value of the 'sendid' field in the event that it generates. If the author of the sending session did not specify either the 'id' or 'idlocation' attribute, the sending SCXML Processor MUST leave this attribute empty.]]> + <test id="351" conformance="mandatory" manual="false"> + <start uri="351/test351.txml"/> + </test> + </assert> + + <assert id="352" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA['sourcetype'. The sending SCXML Processor MUST assign this attribute the value "scxml". (Note that other types of senders will assign different values.) The receiving Processor MUST use this value as the value of the 'origintype' field of the event that it generates. ]]> + <test id="352" conformance="mandatory" manual="false"> + <start uri="352/test352.txml"/> + </test> + </assert> + + <assert id="354" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[The 'data' field of the event raised in the receiving session MUST contain a copy of the data specified in the 'namelist' attribute or in param or content elements in the sending session. The nature of the copy operation depends on the datamodel in question. However, the Processor MUST ensure that changes to the transmitted data in the receiving session do not affect the data in the sending session and vice-versa. The format of the 'data' field will depend on the datamodel of the receiving session.]]> + <test id="354" conformance="mandatory" manual="false"> + <start uri="354/test354.txml"/> + </test> + </assert> + + <assert id="495" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[If no errors occur, the receiving Processor MUST convert the message into an SCXML event, using the mapping defined above and insert it into the appropriate queue, as defined in Send Targets. ]]> + <test id="495" conformance="mandatory" manual="false"> + <start uri="495/test495.txml"/> + </test> + </assert> + + <assert id="496" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[If the sending SCXML session specifies a session that does not exist or is inaccessible, the SCXML Processor MUST place the error error.communication on the internal event queue of the sending session.]]> + <test id="496" conformance="mandatory" manual="false"> + <start uri="496/test496.txml"/> + </test> + </assert> + + <assert id="500" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[SCXML Processors that support the BasicHTTP Event I/O Processor MUST maintain a 'scxml' entry in the _ioprocessors system variable. The Processor MUST maintain a 'location' field inside this entry whose value holds an address that external entities can use to communicate with this SCXML session using the SCXML Event I/O Processor. ]]> + <test id="500" conformance="mandatory" manual="false"> + <start uri="500/test500.txml"/> + </test> + </assert> + + <assert id="501" specnum="D.1" specid="#SCXMLEventProcessor"> + <![CDATA[The 'location' field inside the entry for the SCXML Event I/O Processor in the _ioprocessors system variable MUST hold an address that external entities can use to communicate with this SCXML session using the SCXML Event I/O Processor. ]]> + <test id="501" conformance="mandatory" manual="false"> + <start uri="501/test501.txml"/> + </test> + </assert> + + + + + <assert id="509" specnum="D.2" specid="#BasicHTTPEventProcessor"> + <![CDATA[An SCXML Processor that supports the Basic HTTP Event I/O Processor MUST accept messages at the access URI as HTTP POST requests]]> + <test id="509" conformance="optional" manual="false"> + <start uri="509/test509.txml"/> + </test> + </assert> + + <assert id="510" specnum="D.2" specid="#BasicHTTPEventProcessor"> + <![CDATA[The SCXML Processor MUST validate the message it receives [via the Basic HTTP Event I/O Processor] and then MUST build the appropriate SCXML event and MUST add it to the external event queue]]> + <test id="510" conformance="optional" manual="false"> + <start uri="510/test510.txml"/> + </test> + </assert> + + <assert id="513" specnum="D.2" specid="#BasicHTTPEventProcessor"> + <![CDATA[After it adds the received message to the appropriate event queue, the SCXML Processor MUST then indicate the result to the external component via a success response code 2XX. ]]> + <test id="513" conformance="optional" manual="true"> + <start uri="513/test513.txt"/> + </test> + </assert> + + <assert id="518" specnum="D.2" specid="#BasicHTTPEventProcessor"> + <![CDATA[If the namelist attribute is defined [in send], the SCXML Processor MUST map its variable names and values to HTTP POST parameters]]> + <test id="518" conformance="optional" manual="false"> + <start uri="518/test518.txml"/> + </test> + </assert> + + <assert id="519" specnum="D.2" specid="#BasicHTTPEventProcessor"> + <![CDATA[If one or more param children are present [in send], the SCXML Processor MUST map their names (i.e. name attributes) and values to HTTP POST parameters]]> + <test id="519" conformance="optional" manual="false"> + <start uri="519/test519.txml"/> + </test> + </assert> + + <assert id="520" specnum="D.2" specid="#BasicHTTPEventProcessor"> + <![CDATA[If a content child is present, the SCXML Processor MUST use its value as the body of the message. ]]> + <test id="520" conformance="optional" manual="false"> + <start uri="520/test520.txml"/> + </test> + </assert> + + <assert id="522" specnum="D.2" specid="#BasicHTTPEventProcessor"> + <![CDATA[SCXML Processors that support the BasicHTTP Event I/O Processor MUST maintain a 'basichttp' entry in the _ioprocessors system variable. The Processor MUST maintain a in 'location' field inside this entry whose value holds an address that external entities can use to communicate with this SCXML session using the Basic HTTP Event I/O Processor.]]> + <test id="522" conformance="optional" manual="false"> + <start uri="522/test522.txml"/> + </test> + </assert> + + <assert id="531" specnum="D.2" specid="#BasicHTTPEventProcessor"> + <![CDATA[If a single instance of the parameter '_scxmleventname' is present, the SCXML Processor MUST use its value as the name of the SCXML event that it raises.]]> + <test id="531" conformance="optional" manual="false"> + <start uri="531/test531.txml"/> + </test> + </assert> + + <assert id="532" specnum="D.2" specid="#BasicHTTPEventProcessor"> + <![CDATA[If _scxmleventname is not present, the Processor MUST the name of the HTTP method that was used to deliver the event as name of the SCXML event that it raises]]> + <test id="532" conformance="optional" manual="false"> + <start uri="532/test532.txml"/> + </test> + </assert> + + <assert id="534" specnum="D.2" specid="#BasicHTTPEventProcessor"> + <![CDATA[If the 'event' parameter of send is defined, the SCXML Processor MUST use its value as the value of the HTTP POST parameter _scxmleventname]]> + <test id="534" conformance="optional" manual="false"> + <start uri="534/test534.txml"/> + </test> + </assert> + + <assert id="567" specnum="D.2" specid="#BasicHTTPEventProcessor"> + <![CDATA[The processor MUST use any message content other than '_scxmleventname' to populate _event.data.]]> + <test id="567" conformance="optional" manual="false"> + <start uri="567/test567.txml"/> + </test> + </assert> + + <assert id="577" specnum="D.2" specid="#BasicHTTPEventProcessor"> + <![CDATA[ If neither the 'target' nor the 'targetexpr' attribute is specified, the SCXML Processor MUST add the event error.communication to the internal event queue of the sending session. ]]> + <test id="577" conformance="optional" manual="false"> + <start uri="577/test577.txml"/> + </test> + </assert> +</assertions>
\ No newline at end of file diff --git a/test/w3c/promela/test436.scxml b/test/w3c/promela/test436.scxml deleted file mode 100644 index 413b9ec..0000000 --- a/test/w3c/promela/test436.scxml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- test that in() predicate works in null data model --> -<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="null" version="1.0" initial="p"> - <parallel id="p"> - <state id="ps0"> - <transition cond="_x.states['s1']" target="fail"/> - <transition cond="_x.states['ps1']" target="pass"/> - <transition target="fail"/> - </state> - <state id="ps1"/> - </parallel> - <state id="s1"/> - <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="pass"> - <onentry> - <log label="Outcome" expr="'pass'"/> - </onentry> - </final> - <final xmlns:scxml="http://www.w3.org/2005/07/scxml" id="fail"> - <onentry> - <log label="Outcome" expr="'fail'"/> - </onentry> - </final> -</scxml> |