diff options
261 files changed, 24578 insertions, 43 deletions
diff --git a/contrib/cmake/BuildXercesC.cmake b/contrib/cmake/BuildXercesC.cmake index 0c82132..179ab82 100644 --- a/contrib/cmake/BuildXercesC.cmake +++ b/contrib/cmake/BuildXercesC.cmake @@ -38,8 +38,8 @@ if(MSVC) endif() externalproject_add(xerces-c - URL http://ftp.halifax.rwth-aachen.de/apache/xerces/c/3/sources/xerces-c-3.1.3.tar.gz - URL_MD5 70320ab0e3269e47d978a6ca0c0e1e2d + URL http://www.apache.org/dist/xerces/c/3/sources/xerces-c-3.1.4.tar.gz + URL_MD5 21bb097b711a513275379b59757cba4c BUILD_IN_SOURCE 1 PREFIX ${CMAKE_BINARY_DIR}/deps/xerces-c CONFIGURE_COMMAND "" @@ -58,8 +58,8 @@ if(MSVC) ) else() externalproject_add(xerces-c - URL http://ftp.halifax.rwth-aachen.de/apache/xerces/c/3/sources/xerces-c-3.1.3.tar.gz - URL_MD5 70320ab0e3269e47d978a6ca0c0e1e2d + URL http://www.apache.org/dist/xerces/c/3/sources/xerces-c-3.1.4.tar.gz + URL_MD5 21bb097b711a513275379b59757cba4c BUILD_IN_SOURCE 0 PREFIX ${CMAKE_BINARY_DIR}/deps/xerces-c CONFIGURE_COMMAND diff --git a/contrib/src/uscxml/InterpreterOptions.h b/contrib/src/uscxml/InterpreterOptions.h index 44bb399..b6c0e88 100644 --- a/contrib/src/uscxml/InterpreterOptions.h +++ b/contrib/src/uscxml/InterpreterOptions.h @@ -41,7 +41,7 @@ public: withHTTP(true), withHTTPS(true), withWS(true), - withDebugger(true), + withDebugger(false), logLevel(0), httpPort(5080), httpsPort(5443), diff --git a/src/uscxml/debug/Breakpoint.cpp b/src/uscxml/debug/Breakpoint.cpp index 1e40ee3..3287075 100644 --- a/src/uscxml/debug/Breakpoint.cpp +++ b/src/uscxml/debug/Breakpoint.cpp @@ -86,20 +86,20 @@ Breakpoint::Breakpoint(const Data& data) { if (data.hasKey("eventName")) eventName = data.at("eventName").atom; - if (data.hasKey("executableName")) - executableName = data.at("executableName").atom; + if (data.hasKey("execName")) + executableName = data.at("execName").atom; - if (data.hasKey("executableXPath")) - executableXPath = data.at("executableXPath").atom; + if (data.hasKey("execXPath")) + executableXPath = data.at("execXPath").atom; if (data.hasKey("stateId")) stateId = data.at("stateId").atom; - if (data.hasKey("transSourceId")) - transSourceId = data.at("transSourceId").atom; + if (data.hasKey("source")) + transSourceId = data.at("source").atom; - if (data.hasKey("transTargetId")) - transTargetId = data.at("transTargetId").atom; + if (data.hasKey("target")) + transTargetId = data.at("target").atom; } @@ -173,10 +173,10 @@ Data Breakpoint::toData() const { data.compound["eventName"] = Data(eventName, Data::VERBATIM); if (executableName.length() > 0) - data.compound["executableName"] = Data(executableName, Data::VERBATIM); + data.compound["execName"] = Data(executableName, Data::VERBATIM); if (executableXPath.length() > 0) { - data.compound["executableXPath"] = Data(executableXPath, Data::VERBATIM); + data.compound["execXPath"] = Data(executableXPath, Data::VERBATIM); } if (element) @@ -186,10 +186,10 @@ Data Breakpoint::toData() const { data.compound["stateId"] = Data(stateId, Data::VERBATIM); if (transSourceId.length() > 0) - data.compound["transSourceId"] = Data(transSourceId, Data::VERBATIM); + data.compound["source"] = Data(transSourceId, Data::VERBATIM); if (transTargetId.length() > 0) - data.compound["transTargetId"] = Data(transTargetId, Data::VERBATIM); + data.compound["target"] = Data(transTargetId, Data::VERBATIM); if (condition.length() > 0) data.compound["condition"] = Data(condition, Data::VERBATIM); diff --git a/src/uscxml/debug/DebugSession.cpp b/src/uscxml/debug/DebugSession.cpp index 042235e..60dcdfb 100644 --- a/src/uscxml/debug/DebugSession.cpp +++ b/src/uscxml/debug/DebugSession.cpp @@ -86,7 +86,9 @@ void DebugSession::breakExecution(Data replyData) { replyData.compound["replyType"] = Data("breakpoint", Data::VERBATIM); _debugger->pushData(shared_from_this(), replyData); - _resumeCond.wait(_mutex); + + // wait for resume from the client + _resumeCond.wait(_mutex); } Data DebugSession::debugPrepare(const Data& data) { @@ -102,14 +104,18 @@ Data DebugSession::debugPrepare(const Data& data) { _isAttached = false; - if (data.hasKey("xml")) { - _interpreter = Interpreter::fromXML(data.at("xml").atom, (data.hasKey("url") ? data.at("url").atom : "")); - } else if (data.hasKey("url")) { - _interpreter = Interpreter::fromURL(data.at("url").atom); - } else { - _interpreter = Interpreter(); - } - + try { + if (data.hasKey("xml")) { + _interpreter = Interpreter::fromXML(data.at("xml").atom, (data.hasKey("url") ? data.at("url").atom : "")); + } else if (data.hasKey("url")) { + _interpreter = Interpreter::fromURL(data.at("url").atom); + } else { + _interpreter = Interpreter(); + } + } catch(ErrorEvent e) { + std::cerr << e; + } catch(...) {} + if (_interpreter) { // register ourself as a monitor _interpreter.addMonitor(_debugger); @@ -201,7 +207,7 @@ void DebugSession::run(void* instance) { InterpreterState state = USCXML_UNDEF; while(state != USCXML_FINISHED && INSTANCE->_isRunning) { - state = INSTANCE->_interpreter.step(100); + state = INSTANCE->_interpreter.step(); // if (!INSTANCE->_isStarted) { // // we have been cancelled @@ -288,9 +294,19 @@ Data DebugSession::skipToBreakPoint(const Data& data) { std::lock_guard<std::recursive_mutex> lock(_mutex); _skipTo = Breakpoint(data); + Data replyData; - Data replyData; - replyData.compound["status"] = Data("success", Data::VERBATIM); + if (_interpreter) { + // register ourself as a monitor + if (!_isRunning) { + _isRunning = true; + _interpreterThread = new std::thread(DebugSession::run, this); + } + + replyData.compound["status"] = Data("success", Data::VERBATIM); + } else { + replyData.compound["status"] = Data("failure", Data::VERBATIM); + } _resumeCond.notify_one(); return replyData; diff --git a/src/uscxml/interpreter/ContentExecutorImpl.h b/src/uscxml/interpreter/ContentExecutorImpl.h index 0e12aff..d23b7be 100644 --- a/src/uscxml/interpreter/ContentExecutorImpl.h +++ b/src/uscxml/interpreter/ContentExecutorImpl.h @@ -66,6 +66,7 @@ public: /** Monitoring */ virtual std::set<InterpreterMonitor*> getMonitors() = 0; + virtual InterpreterImpl* getInterpreter() = 0; }; diff --git a/src/uscxml/interpreter/InterpreterImpl.h b/src/uscxml/interpreter/InterpreterImpl.h index 6d047ec..fa7bf89 100644 --- a/src/uscxml/interpreter/InterpreterImpl.h +++ b/src/uscxml/interpreter/InterpreterImpl.h @@ -140,6 +140,10 @@ public: return _monitors; } + virtual InterpreterImpl* getInterpreter() { + return this; + } + /** DataModelCallbacks */ diff --git a/src/uscxml/interpreter/InterpreterMonitor.h b/src/uscxml/interpreter/InterpreterMonitor.h index ff2e7cb..aae4296 100644 --- a/src/uscxml/interpreter/InterpreterMonitor.h +++ b/src/uscxml/interpreter/InterpreterMonitor.h @@ -34,13 +34,13 @@ catch (...) { LOG(ERROR) << "An exception occurred when calling " #callback " on if (_state == USCXML_DESTROYED) { throw std::bad_weak_ptr(); } #define USCXML_MONITOR_CALLBACK(callbacks, function) \ -for (auto callback : callbacks) { callback->function(NULL); } +for (auto callback : callbacks) { callback->function(_callbacks->getInterpreter()); } #define USCXML_MONITOR_CALLBACK1(callbacks, function, arg1) \ -for (auto callback : callbacks) { callback->function(NULL, arg1); } +for (auto callback : callbacks) { callback->function(_callbacks->getInterpreter(), arg1); } #define USCXML_MONITOR_CALLBACK2(callbacks, function, arg1, arg2) \ -for (auto callback : callbacks) { callback->function(NULL, arg1, arg2); } +for (auto callback : callbacks) { callback->function(_callbacks->getInterpreter(), arg1, arg2); } // forward declare namespace XERCESC_NS { diff --git a/src/uscxml/interpreter/MicroStepImpl.h b/src/uscxml/interpreter/MicroStepImpl.h index cb4aec6..a9287aa 100644 --- a/src/uscxml/interpreter/MicroStepImpl.h +++ b/src/uscxml/interpreter/MicroStepImpl.h @@ -61,6 +61,7 @@ public: /** Monitoring */ virtual std::set<InterpreterMonitor*> getMonitors() = 0; + virtual InterpreterImpl* getInterpreter() = 0; }; /** diff --git a/src/uscxml/plugins/datamodel/CMakeLists.txt b/src/uscxml/plugins/datamodel/CMakeLists.txt index 561d06c..a60552e 100644 --- a/src/uscxml/plugins/datamodel/CMakeLists.txt +++ b/src/uscxml/plugins/datamodel/CMakeLists.txt @@ -50,8 +50,9 @@ endif() if (ON) set(USCXML_DATAMODELS "c89 ${USCXML_DATAMODELS}") # Lua ecmascript datamodel - file(GLOB C89_DATAMODEL + file(GLOB_RECURSE C89_DATAMODEL c89/*.cpp + c89/*.c c89/*.h ) list (APPEND USCXML_FILES ${C89_DATAMODEL}) diff --git a/src/uscxml/plugins/datamodel/c89/C89Parser.cpp b/src/uscxml/plugins/datamodel/c89/C89Parser.cpp new file mode 100644 index 0000000..540db37 --- /dev/null +++ b/src/uscxml/plugins/datamodel/c89/C89Parser.cpp @@ -0,0 +1,284 @@ +/** + * @file + * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * 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. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see <http://www.opensource.org/licenses/bsd-license>. + * @endcond + */ + +#include "C89Parser.h" +#include "parser/c89.tab.hpp" +#include "uscxml/messages/Event.h" + +#include <iostream> +#include <cassert> + +struct yy_buffer_state; +typedef yy_buffer_state *YY_BUFFER_STATE; +extern YY_BUFFER_STATE c89__scan_buffer(char *, size_t, void*); +void c89__delete_buffer(YY_BUFFER_STATE, void*); +YY_BUFFER_STATE c89__scan_string (const char * yystr , void*); + + +extern int c89_lex (C89_STYPE* yylval_param, C89_LTYPE* yylloc_param, void* yyscanner); +int c89_lex_init (void**); +int c89_lex_destroy (void*); + +void c89_error (void* yylloc_param, uscxml::C89Parser* ctx, void* yyscanner, const char* err) { + C89_LTYPE* yylloc = (C89_LTYPE*)yylloc_param; + // mark as pending exception as we cannot throw from constructor and have the destructor called + ERROR_EXECUTION(excEvent, err); + excEvent.data.compound["line"] = uscxml::Data(yylloc->first_line, uscxml::Data::VERBATIM); + excEvent.data.compound["col"] = uscxml::Data(yylloc->first_column, uscxml::Data::VERBATIM); + + std::stringstream ssUnderline; + for (size_t i = 0; i < yylloc->first_column; i++) + ssUnderline << " "; + ssUnderline << "^"; + excEvent.data.compound["sourcemark"] = uscxml::Data(ssUnderline.str(), uscxml::Data::VERBATIM); + + ctx->pendingException = excEvent; +} + +namespace uscxml { + +C89Parser::C89Parser(const std::string& expr) { + init(expr); +} + +C89Parser::C89Parser(const std::string& expr, int nrArgs, ...) { + init(expr); + + if (nrArgs == 0) + return; + + std::stringstream errSS; + std::string seperator; + errSS << "C89 syntax type mismatch: Expected {"; + + va_list ap; + va_start(ap, nrArgs); + for(int i = 1; i <= nrArgs; i++) { + int expectedType = va_arg(ap, int); + if (type == expectedType) + return; + errSS << seperator << typeToDesc(expectedType); + seperator = ", "; + } + errSS << "} but got " << typeToDesc(type); + ERROR_EXECUTION_THROW(errSS.str()); +} + +void C89Parser::init(const std::string& expr) { + ast = NULL; + parseInCompound = 0; + input_length = expr.length() + 2; // plus some zero terminators + input = (char*) calloc(1, input_length); + memcpy(input, expr.c_str(), expr.length()); + + c89_lex_init(&scanner); + // c89_assign_set_extra(ast, &scanner); + buffer = c89__scan_string(input, scanner); + // buffer = c89__scan_buffer(input, input_length, scanner); + c89_parse(this, scanner); + if (pendingException.name.size() > 0) { + // parsing failed in c89_error + destroy(); + pendingException.data.compound["sourceline"] = Data(expr, Data::VERBATIM); + throw pendingException; + } +} + +void C89Parser::destroy() { + if (ast) + delete(ast); + free(input); + c89__delete_buffer((YY_BUFFER_STATE)buffer, scanner); + c89_lex_destroy(scanner); +} + +C89Parser::~C89Parser() { + destroy(); +} + +std::string C89Parser::typeToDesc(int type) { + return ""; +} + +C89ParserNode::~C89ParserNode() { + while(operands.size() > 0) { + delete operands.front(); + operands.pop_front(); + } + if (loc) + free(loc); +} + +C89ParserNode* C89Parser::node(int type, int nrArgs, ...) { + C89ParserNode* newNode = new C89ParserNode(); + + newNode->type = type; + va_list ap; + va_start(ap, nrArgs); + for(int i = 1; i <= nrArgs; i++) { + C89ParserNode* op = va_arg(ap, C89ParserNode*); + assert(op != NULL); + + newNode->operands.push_back(op); + newNode->operands.back()->parent = newNode; + } + + this->ast = newNode; + return newNode; +} + +C89ParserNode* C89Parser::value(int type, void* location, const char* value) { + C89ParserNode* newNode = new C89ParserNode(); + + if (location) { + C89_LTYPE* location_param = (C89_LTYPE*)location; + newNode->loc = (C89ParserNode::Location*)malloc(sizeof(C89ParserNode::Location)); + newNode->loc->firstCol = location_param->first_column; + newNode->loc->firstLine = location_param->first_line; + newNode->loc->lastCol = location_param->last_column; + newNode->loc->lastLine = location_param->last_line; + } + + if (value != NULL) { + newNode->value = value; + } + newNode->type = type; + this->ast = newNode; + return newNode; +} + + +void C89Parser::dump() { + switch (type) { + case C89_EXPR: + std::cout << "C89 Expression" << std::endl; + break; + case C89_DECL: + std::cout << "C89 Declarations" << std::endl; + break; + case C89_STMNT: + std::cout << "C89 Statement" << std::endl; + break; + } + ast->dump(); +} + + +void C89ParserNode::merge(C89ParserNode* node) { + for (std::list<C89ParserNode*>::iterator iter = node->operands.begin(); + iter != node->operands.end(); iter++) { + operands.push_back(*iter); + (*iter)->parent = this; + } + node->operands.clear(); +} + +void C89ParserNode::push(C89ParserNode* node) { + node->parent = this; + operands.push_back(node); +} + +void C89ParserNode::dump(int indent) { + std::string padding; + for (size_t i = 0; i < indent; i++) { + padding += " "; + } + std::cout << padding << typeToDesc(type) << ": " << value; + if (loc != NULL) { + std::cout << " (" << loc->firstLine << ":" << loc->firstCol << ")-(" << loc->lastLine << ":" << loc->lastCol << ")"; + } + std::cout << std::endl; + for (std::list<C89ParserNode*>::iterator iter = operands.begin(); + iter != operands.end(); iter++) { + (*iter)->dump(indent + 1); + } +} + +std::string C89ParserNode::typeToDesc(int type) { + if (type < 256) { + return std::string((char*)(&type), 1); + } + + switch(type) { + + case IDENTIFIER: return "IDENTIFIER"; + case CONSTANT: return "CONSTANT"; + case STRING_LITERAL: return "STRING_LITERAL"; + case SIZEOF: return "SIZEOF"; + case PTR_OP: return "PTR_OP"; + case INC_OP: return "INC_OP"; + case DEC_OP: return "DEC_OP"; + case LEFT_OP: return "LEFT_OP"; + case RIGHT_OP: return "RIGHT_OP"; + case LE_OP: return "LE_OP"; + case GE_OP: return "GE_OP"; + case EQ_OP: return "EQ_OP"; + case NE_OP: return "NE_OP"; + case AND_OP: return "AND_OP"; + case OR_OP: return "OR_OP"; + case MUL_ASSIGN: return "MUL_ASSIGN"; + case DIV_ASSIGN: return "DIV_ASSIGN"; + case MOD_ASSIGN: return "MOD_ASSIGN"; + case ADD_ASSIGN: return "ADD_ASSIGN"; + case SUB_ASSIGN: return "SUB_ASSIGN"; + case LEFT_ASSIGN: return "LEFT_ASSIGN"; + case RIGHT_ASSIGN: return "RIGHT_ASSIGN"; + case AND_ASSIGN: return "AND_ASSIGN"; + case XOR_ASSIGN: return "XOR_ASSIGN"; + case OR_ASSIGN: return "OR_ASSIGN"; + case TYPE_NAME: return "TYPE_NAME"; + case TYPEDEF: return "TYPEDEF"; + case EXTERN: return "EXTERN"; + case STATIC: return "STATIC"; + case AUTO: return "AUTO"; + case REGISTER: return "REGISTER"; + case CHAR: return "CHAR"; + case SHORT: return "SHORT"; + case INT: return "INT"; + case LONG: return "LONG"; + case SIGNED: return "SIGNED"; + case UNSIGNED: return "UNSIGNED"; + case FLOAT: return "FLOAT"; + case DOUBLE: return "DOUBLE"; + case CONST: return "CONST"; + case VOLATILE: return "VOLATILE"; + case VOID: return "VOID"; + case STRUCT: return "STRUCT"; + case UNION: return "UNION"; + case ENUM: return "ENUM"; + case ELLIPSIS: return "ELLIPSIS"; + case CASE: return "CASE"; + case DEFAULT: return "DEFAULT"; + case IF: return "IF"; + case ELSE: return "ELSE"; + case SWITCH: return "SWITCH"; + case WHILE: return "WHILE"; + case DO: return "DO"; + case FOR: return "FOR"; + case GOTO: return "GOTO"; + case CONTINUE: return "CONTINUE"; + case BREAK: return "BREAK"; + case RETURN: return "RETURN"; + + default: + return std::string("UNK(") + toStr(type) + ")"; + } +} + +}
\ No newline at end of file diff --git a/src/uscxml/plugins/datamodel/c89/C89Parser.h b/src/uscxml/plugins/datamodel/c89/C89Parser.h new file mode 100644 index 0000000..d20d319 --- /dev/null +++ b/src/uscxml/plugins/datamodel/c89/C89Parser.h @@ -0,0 +1,107 @@ +/** + * @file + * @author 2016 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @copyright Simplified BSD + * + * @cond + * This program is free software: you can redistribute it and/or modify + * it under the terms of the FreeBSD license as published by the FreeBSD + * project. + * + * 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. + * + * You should have received a copy of the FreeBSD license along with this + * program. If not, see <http://www.opensource.org/licenses/bsd-license>. + * @endcond + */ + +// bison -v c89.ypp && flex c89.l + +#ifndef C89PARSER_H_FE8E7C3E +#define C89PARSER_H_FE8E7C3E + + +#include <string> +#include <list> +#include <stdlib.h> +//#include <stdarg.h> +#include <cstdarg> + +#include "uscxml/messages/Event.h" + +namespace uscxml { + +class C89Parser; + +class C89ParserNode { +public: + struct Location { + int firstLine; + int firstCol; + int lastLine; + int lastCol; + }; + + C89ParserNode() : type(0), parent(NULL), loc(NULL) {} + virtual ~C89ParserNode(); + + void merge(C89ParserNode* node); + void push(C89ParserNode* node); + void dump(int indent = 0); + + static std::string typeToDesc(int type); + + int type; + std::string value; + std::list<C89ParserNode*> operands; + C89ParserNode* parent; + Location* loc; +}; + +class C89Parser { +public: + enum Type { + C89_EXPR, + C89_DECL, + C89_STMNT + }; + + static std::string typeToDesc(int type); + + C89Parser() : ast(NULL) {} + C89Parser(const std::string& expr); + C89Parser(const std::string& expr, int nrArgs, ...); + virtual ~C89Parser(); + + virtual C89ParserNode* node(int type, int nrArgs, ...); + virtual C89ParserNode* value(int type, void* location, const char* value); + void dump(); + + int parseInCompound; + + C89ParserNode* ast; + Type type; + + Event pendingException; + operator bool() const { + return ast != NULL; + } + +protected: + + void init(const std::string& expr); + void destroy(); + + void* buffer; + void* scanner; + char* input; + size_t input_length; +}; + +} + +void c89_error (void* yylloc_param, uscxml::C89Parser* ctx, void* yyscanner, const char* err); + +#endif /* end of include guard: C89PARSER_H_FE8E7C3E */ diff --git a/src/uscxml/plugins/datamodel/c89/parser/c89.l b/src/uscxml/plugins/datamodel/c89/parser/c89.l new file mode 100644 index 0000000..8681565 --- /dev/null +++ b/src/uscxml/plugins/datamodel/c89/parser/c89.l @@ -0,0 +1,158 @@ +/* see: http://www.phpcompiler.org/articles/reentrantparser.html */ +/* see: http://spinroot.com/spin/Man/operators.html */ + +%option yylineno +%option reentrant +%option bison-bridge +%option prefix="c89_" +%option outfile="c89.lex.yy.cpp" +%option noyywrap +/*%option debug*/ +%option never-interactive nounistd +%option bison-locations + +%{ + +#include "../C89Parser.h" +#include "c89.tab.hpp" +#define YYSTYPE C89_STYPE +#define YYLTYPE C89_LTYPE +#define YY_USER_INIT \ + yycolumn = yylloc->first_line = yylloc->first_column = 0; \ + yylineno = yylloc->last_line = yylloc->last_column = 0; \ + +//int yycolumn = 1; + +#define YY_USER_ACTION \ +{ \ + yylloc->first_line = yylineno; \ + yylloc->first_column = yycolumn; \ + yylloc->last_column = yycolumn + yyleng; \ + yylloc->last_line = yylineno; \ + yycolumn = yycolumn + yyleng; \ +} + +%} + +D [0-9] +L [a-zA-Z_] +H [a-fA-F0-9] +E [Ee][+-]?{D}+ +FS (f|F|l|L) +IS (u|U|l|L)* + +%{ +#include <stdio.h> + +int check_type() +{ +/* if (yytext == uint) + return(TYPE_NAME); +*/ + return(IDENTIFIER); +} + +%} + +%% +\/\*([^*]|\*[^/])*\*+\/ /* multiline comments */ +"//".* /* singlelien comments */ +"#".* /* singlelien comments */ + +"auto" { return(AUTO); } +"break" { return(BREAK); } +"case" { return(CASE); } +"char" { return(CHAR); } +"const" { return(CONST); } +"continue" { return(CONTINUE); } +"default" { return(DEFAULT); } +"do" { return(DO); } +"double" { return(DOUBLE); } +"else" { return(ELSE); } +"enum" { return(ENUM); } +"extern" { return(EXTERN); } +"float" { return(FLOAT); } +"for" { return(FOR); } +"goto" { return(GOTO); } +"if" { return(IF); } +"int" { return(INT); } +"long" { return(LONG); } +"register" { return(REGISTER); } +"return" { return(RETURN); } +"short" { return(SHORT); } +"signed" { return(SIGNED); } +"sizeof" { return(SIZEOF); } +"static" { return(STATIC); } +"struct" { return(STRUCT); } +"switch" { return(SWITCH); } +"typedef" { return(TYPEDEF); } +"union" { return(UNION); } +"unsigned" { return(UNSIGNED); } +"void" { return(VOID); } +"volatile" { return(VOLATILE); } +"while" { return(WHILE); } + +{L}({L}|{D})* { yylval->value = strdup(yytext); return(IDENTIFIER); } + +0[xX]{H}+{IS}? { yylval->value = strdup(yytext); return(CONSTANT); } +0{D}+{IS}? { yylval->value = strdup(yytext); return(CONSTANT); } +{D}+{IS}? { yylval->value = strdup(yytext); return(CONSTANT); } +L?'(\\.|[^\\'])+' { yylval->value = strdup(yytext); return(CONSTANT); } + +{D}+{E}{FS}? { yylval->value = strdup(yytext); return(CONSTANT); } +{D}*"."{D}+({E})?{FS}? { yylval->value = strdup(yytext); return(CONSTANT); } +{D}+"."{D}*({E})?{FS}? { yylval->value = strdup(yytext); return(CONSTANT); } + +L?\"(\\.|[^\\"])*\" { yylval->value = strdup(yytext); return(STRING_LITERAL); } + +"..." { return(ELLIPSIS); } +">>=" { return(RIGHT_ASSIGN); } +"<<=" { return(LEFT_ASSIGN); } +"+=" { return(ADD_ASSIGN); } +"-=" { return(SUB_ASSIGN); } +"*=" { return(MUL_ASSIGN); } +"/=" { return(DIV_ASSIGN); } +"%=" { return(MOD_ASSIGN); } +"&=" { return(AND_ASSIGN); } +"^=" { return(XOR_ASSIGN); } +"|=" { return(OR_ASSIGN); } +">>" { return(RIGHT_OP); } +"<<" { return(LEFT_OP); } +"++" { return(INC_OP); } +"--" { return(DEC_OP); } +"->" { return(PTR_OP); } +"&&" { return(AND_OP); } +"||" { return(OR_OP); } +"<=" { return(LE_OP); } +">=" { return(GE_OP); } +"==" { return(EQ_OP); } +"!=" { return(NE_OP); } +";" { return(';'); } +("{"|"<%") { return('{'); } +("}"|"%>") { return('}'); } +"," { return(','); } +":" { return(':'); } +"=" { return('='); } +"(" { return('('); } +")" { return(')'); } +("["|"<:") { return('['); } +("]"|":>") { return(']'); } +"." { return('.'); } +"&" { return('&'); } +"!" { return('!'); } +"~" { return('~'); } +"-" { return('-'); } +"+" { return('+'); } +"*" { return('*'); } +"/" { return('/'); } +"%" { return('%'); } +"<" { return('<'); } +">" { return('>'); } +"^" { return('^'); } +"|" { return('|'); } +"?" { return('?'); } + +[ \t\v\n\f] { } +. { /* ignore bad characters */ } + +%% diff --git a/src/uscxml/plugins/datamodel/c89/parser/c89.lex.yy.cpp b/src/uscxml/plugins/datamodel/c89/parser/c89.lex.yy.cpp new file mode 100644 index 0000000..58654f0 --- /dev/null +++ b/src/uscxml/plugins/datamodel/c89/parser/c89.lex.yy.cpp @@ -0,0 +1,2721 @@ +#line 2 "c89.lex.yy.cpp" + +#line 4 "c89.lex.yy.cpp" + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 0 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include <stdio.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ + +#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. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include <inttypes.h> +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +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 short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +#ifdef __cplusplus + +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST + +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const +#else +#define yyconst +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. + */ +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) + +/* An opaque pointer. */ +#ifndef YY_TYPEDEF_YY_SCANNER_T +#define YY_TYPEDEF_YY_SCANNER_T +typedef void* yyscan_t; +#endif + +/* For convenience, these vars (plus the bison vars far below) + are macros in the reentrant scanner. */ +#define yyin yyg->yyin_r +#define yyout yyg->yyout_r +#define yyextra yyg->yyextra_r +#define yyleng yyg->yyleng_r +#define yytext yyg->yytext_r +#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno) +#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column) +#define yy_flex_debug yyg->yy_flex_debug_r + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN yyg->yy_start = 1 + 2 * + +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START ((yyg->yy_start - 1) / 2) +#define YYSTATE YY_START + +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE c89_restart(yyin ,yyscanner ) + +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE c89_lex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-yylineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + int yyl;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ + }while(0) + #define YY_LINENO_REWIND_TO(dst) \ + do {\ + const char *p;\ + for ( p = yy_cp-1; p >= (dst); --p)\ + if ( *p == '\n' )\ + --yylineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = yyg->yy_hold_char; \ + YY_RESTORE_YY_MORE_OFFSET \ + yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) + +#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + yy_size_t yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + yy_size_t yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + 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. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via c89_restart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \ + ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \ + : NULL) + +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] + +void c89_restart (FILE *input_file ,yyscan_t yyscanner ); +void c89__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +YY_BUFFER_STATE c89__create_buffer (FILE *file,int size ,yyscan_t yyscanner ); +void c89__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void c89__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner ); +void c89_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner ); +void c89_pop_buffer_state (yyscan_t yyscanner ); + +static void c89_ensure_buffer_stack (yyscan_t yyscanner ); +static void c89__load_buffer_state (yyscan_t yyscanner ); +static void c89__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner ); + +#define YY_FLUSH_BUFFER c89__flush_buffer(YY_CURRENT_BUFFER ,yyscanner) + +YY_BUFFER_STATE c89__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); +YY_BUFFER_STATE c89__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); +YY_BUFFER_STATE c89__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); + +void *c89_alloc (yy_size_t ,yyscan_t yyscanner ); +void *c89_realloc (void *,yy_size_t ,yyscan_t yyscanner ); +void c89_free (void * ,yyscan_t yyscanner ); + +#define yy_new_buffer c89__create_buffer + +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + c89_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + c89__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } + +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + c89_ensure_buffer_stack (yyscanner); \ + YY_CURRENT_BUFFER_LVALUE = \ + c89__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } + +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define c89_wrap(yyscanner) (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP + +typedef unsigned char YY_CHAR; + +typedef int yy_state_type; + +#define yytext_ptr yytext_r + +static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); +static int yy_get_next_buffer (yyscan_t yyscanner ); +#if defined(__GNUC__) && __GNUC__ >= 3 +__attribute__((__noreturn__)) +#endif +static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + yyg->yytext_ptr = yy_bp; \ + yyleng = (size_t) (yy_cp - yy_bp); \ + yyg->yy_hold_char = *yy_cp; \ + *yy_cp = '\0'; \ + yyg->yy_c_buf_p = yy_cp; + +#define YY_NUM_RULES 93 +#define YY_END_OF_BUFFER 94 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static yyconst flex_int16_t yy_accept[251] = + { 0, + 0, 0, 94, 92, 91, 91, 79, 92, 3, 85, + 78, 92, 73, 74, 83, 82, 70, 81, 77, 84, + 39, 39, 71, 67, 86, 72, 87, 90, 36, 36, + 75, 76, 88, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 68, 89, + 69, 80, 66, 0, 44, 0, 3, 52, 69, 61, + 53, 0, 0, 50, 58, 48, 59, 49, 60, 0, + 42, 0, 2, 51, 43, 38, 0, 39, 0, 39, + 76, 68, 75, 57, 63, 65, 64, 56, 36, 0, + 0, 54, 36, 36, 36, 36, 36, 36, 11, 36, + + 36, 36, 36, 36, 36, 19, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 55, 62, 40, + 45, 0, 42, 0, 0, 2, 42, 0, 43, 38, + 0, 41, 37, 47, 46, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 17, 36, 20, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, + 36, 36, 36, 36, 0, 42, 0, 1, 0, 42, + 0, 43, 41, 37, 4, 36, 6, 7, 36, 36, + 36, 36, 13, 14, 36, 36, 18, 21, 36, 36, + 36, 36, 36, 36, 36, 36, 36, 36, 36, 33, + + 36, 36, 1, 0, 42, 5, 8, 36, 36, 36, + 36, 16, 36, 36, 24, 36, 36, 36, 36, 36, + 36, 31, 36, 36, 35, 36, 36, 12, 15, 36, + 23, 25, 26, 27, 28, 29, 36, 36, 36, 36, + 10, 36, 30, 36, 36, 9, 22, 32, 34, 0 + } ; + +static yyconst YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 4, 5, 6, 1, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, + 19, 19, 19, 19, 19, 19, 19, 20, 21, 22, + 23, 24, 25, 1, 26, 26, 26, 26, 27, 28, + 29, 29, 29, 29, 29, 30, 29, 29, 29, 29, + 29, 29, 29, 29, 31, 29, 29, 32, 29, 29, + 33, 34, 35, 36, 29, 1, 37, 38, 39, 40, + + 41, 42, 43, 44, 45, 29, 46, 47, 48, 49, + 50, 51, 29, 52, 53, 54, 55, 56, 57, 58, + 59, 60, 61, 62, 63, 64, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 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 YY_CHAR yy_meta[65] = + { 0, + 1, 1, 2, 1, 1, 1, 1, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, + 1, 1, 1, 1, 1, 4, 4, 4, 5, 5, + 5, 5, 1, 1, 1, 1, 4, 4, 4, 4, + 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 1, 1, 1, 1 + } ; + +static yyconst flex_uint16_t yy_base[258] = + { 0, + 0, 0, 395, 396, 396, 396, 371, 60, 0, 43, + 60, 359, 396, 396, 369, 56, 396, 57, 55, 65, + 79, 74, 367, 396, 80, 367, 52, 396, 0, 80, + 396, 396, 366, 333, 335, 75, 58, 69, 67, 336, + 42, 335, 343, 78, 324, 333, 331, 336, 396, 84, + 396, 396, 396, 108, 396, 376, 0, 396, 396, 396, + 396, 115, 127, 396, 396, 396, 396, 396, 396, 362, + 120, 365, 0, 396, 136, 141, 161, 139, 0, 171, + 396, 396, 396, 353, 396, 396, 396, 352, 0, 139, + 340, 396, 319, 331, 318, 333, 320, 326, 312, 313, + + 310, 310, 313, 310, 307, 0, 306, 310, 97, 308, + 85, 104, 312, 305, 25, 86, 310, 396, 396, 396, + 396, 190, 396, 342, 141, 0, 192, 210, 396, 169, + 166, 212, 205, 396, 396, 303, 315, 310, 298, 138, + 312, 310, 306, 298, 304, 307, 0, 293, 0, 299, + 296, 285, 287, 289, 296, 282, 280, 280, 292, 282, + 286, 290, 292, 281, 188, 219, 215, 396, 238, 396, + 195, 244, 396, 234, 0, 281, 0, 0, 272, 280, + 266, 263, 0, 0, 252, 242, 0, 0, 242, 242, + 239, 249, 238, 242, 246, 245, 243, 233, 236, 0, + + 223, 235, 263, 225, 250, 0, 0, 224, 224, 229, + 218, 0, 204, 206, 0, 210, 206, 207, 191, 197, + 180, 0, 168, 170, 0, 149, 143, 0, 0, 154, + 0, 0, 0, 0, 0, 0, 151, 140, 128, 124, + 0, 100, 0, 103, 55, 0, 0, 0, 0, 396, + 297, 302, 307, 309, 314, 319, 82 + } ; + +static yyconst flex_int16_t yy_def[258] = + { 0, + 250, 1, 250, 250, 250, 250, 250, 251, 252, 250, + 250, 253, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 254, 254, + 250, 250, 250, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 250, 250, + 250, 250, 250, 251, 250, 251, 252, 250, 250, 250, + 250, 253, 253, 250, 250, 250, 250, 250, 250, 250, + 250, 255, 256, 250, 250, 250, 250, 250, 257, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 254, 251, + 253, 250, 254, 254, 254, 254, 254, 254, 254, 254, + + 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 250, 250, 250, + 250, 250, 250, 255, 255, 256, 250, 250, 250, 250, + 250, 250, 257, 250, 250, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 250, 250, 255, 250, 250, 250, + 250, 250, 250, 250, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + + 254, 254, 255, 250, 250, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, + 254, 254, 254, 254, 254, 254, 254, 254, 254, 0, + 250, 250, 250, 250, 250, 250, 250 + } ; + +static yyconst flex_uint16_t yy_nxt[461] = + { 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, 28, 29, 29, 29, 29, 30, + 29, 29, 31, 4, 32, 33, 34, 35, 36, 37, + 38, 39, 40, 29, 41, 29, 42, 29, 29, 29, + 29, 43, 44, 45, 46, 47, 48, 29, 29, 29, + 49, 50, 51, 52, 55, 58, 59, 60, 65, 160, + 70, 67, 71, 71, 87, 88, 72, 161, 66, 68, + 69, 73, 61, 106, 90, 133, 82, 74, 91, 75, + 107, 80, 80, 56, 75, 249, 76, 76, 98, 83, + + 77, 84, 85, 78, 78, 77, 118, 99, 78, 78, + 79, 95, 55, 103, 77, 100, 104, 101, 96, 77, + 78, 110, 111, 120, 97, 78, 102, 154, 78, 250, + 162, 112, 163, 78, 113, 62, 79, 71, 71, 151, + 156, 56, 248, 55, 155, 119, 122, 123, 63, 123, + 152, 247, 167, 127, 127, 157, 75, 168, 76, 76, + 122, 123, 128, 129, 246, 129, 123, 77, 78, 78, + 130, 130, 56, 131, 245, 131, 128, 129, 132, 132, + 244, 77, 129, 132, 132, 78, 75, 130, 80, 80, + 179, 180, 243, 78, 242, 130, 241, 77, 130, 130, + + 78, 78, 165, 240, 165, 166, 166, 166, 166, 127, + 127, 77, 172, 172, 239, 130, 238, 78, 169, 170, + 237, 170, 171, 130, 171, 78, 125, 172, 172, 132, + 132, 203, 169, 170, 174, 174, 166, 166, 170, 173, + 236, 173, 205, 205, 235, 234, 123, 233, 123, 232, + 204, 174, 204, 173, 231, 205, 205, 230, 173, 174, + 123, 172, 172, 174, 174, 123, 229, 205, 205, 228, + 227, 129, 226, 129, 125, 225, 224, 170, 223, 170, + 174, 222, 221, 220, 219, 129, 218, 217, 174, 216, + 129, 170, 215, 214, 213, 212, 170, 54, 54, 54, + + 54, 54, 57, 211, 57, 57, 57, 62, 62, 210, + 62, 62, 89, 89, 124, 124, 124, 124, 124, 126, + 209, 126, 126, 126, 208, 207, 206, 202, 201, 200, + 199, 198, 197, 196, 195, 194, 193, 192, 191, 190, + 189, 188, 187, 186, 185, 184, 183, 182, 181, 178, + 177, 176, 175, 125, 164, 159, 158, 153, 150, 149, + 148, 147, 146, 145, 144, 143, 142, 141, 140, 139, + 138, 137, 136, 63, 135, 134, 125, 121, 250, 117, + 116, 115, 114, 109, 108, 105, 94, 93, 92, 86, + 81, 64, 63, 53, 250, 3, 250, 250, 250, 250, + + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250 + } ; + +static yyconst flex_int16_t yy_chk[461] = + { 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, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 8, 10, 10, 11, 16, 115, + 19, 18, 19, 19, 27, 27, 20, 115, 16, 18, + 18, 20, 11, 41, 30, 257, 25, 20, 30, 22, + 41, 22, 22, 8, 21, 245, 21, 21, 37, 25, + + 22, 25, 25, 22, 22, 21, 50, 37, 21, 21, + 21, 36, 54, 39, 22, 38, 39, 38, 36, 21, + 22, 44, 44, 62, 36, 21, 38, 111, 22, 63, + 116, 44, 116, 21, 44, 63, 21, 71, 71, 109, + 112, 54, 244, 90, 111, 50, 71, 71, 62, 71, + 109, 242, 125, 75, 75, 112, 76, 125, 76, 76, + 71, 71, 75, 75, 240, 75, 71, 76, 78, 78, + 76, 76, 90, 77, 239, 77, 75, 75, 77, 77, + 238, 76, 75, 131, 131, 78, 80, 76, 80, 80, + 140, 140, 237, 78, 230, 76, 227, 80, 130, 130, + + 80, 80, 122, 226, 122, 165, 165, 122, 122, 127, + 127, 80, 171, 171, 224, 130, 223, 80, 127, 127, + 221, 127, 128, 130, 128, 80, 167, 128, 128, 132, + 132, 167, 127, 127, 133, 133, 166, 166, 127, 132, + 220, 132, 204, 204, 219, 218, 166, 217, 166, 216, + 169, 133, 169, 132, 214, 169, 169, 213, 132, 133, + 166, 172, 172, 174, 174, 166, 211, 205, 205, 210, + 209, 172, 208, 172, 203, 202, 201, 205, 199, 205, + 174, 198, 197, 196, 195, 172, 194, 193, 174, 192, + 172, 205, 191, 190, 189, 186, 205, 251, 251, 251, + + 251, 251, 252, 185, 252, 252, 252, 253, 253, 182, + 253, 253, 254, 254, 255, 255, 255, 255, 255, 256, + 181, 256, 256, 256, 180, 179, 176, 164, 163, 162, + 161, 160, 159, 158, 157, 156, 155, 154, 153, 152, + 151, 150, 148, 146, 145, 144, 143, 142, 141, 139, + 138, 137, 136, 124, 117, 114, 113, 110, 108, 107, + 105, 104, 103, 102, 101, 100, 99, 98, 97, 96, + 95, 94, 93, 91, 88, 84, 72, 70, 56, 48, + 47, 46, 45, 43, 42, 40, 35, 34, 33, 26, + 23, 15, 12, 7, 3, 250, 250, 250, 250, 250, + + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, + 250, 250, 250, 250, 250, 250, 250, 250, 250, 250 + } ; + +/* Table of booleans, true if rule could match eol. */ +static yyconst flex_int32_t yy_rule_can_match_eol[94] = + { 0, +1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, }; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +#line 1 "c89.l" +/* see: http://www.phpcompiler.org/articles/reentrantparser.html */ +/* see: http://spinroot.com/spin/Man/operators.html */ +/*%option debug*/ +#define YY_NO_UNISTD_H 1 +#line 15 "c89.l" + +#include "../C89Parser.h" +#include "c89.tab.hpp" +#define YYSTYPE C89_STYPE +#define YYLTYPE C89_LTYPE +#define YY_USER_INIT \ + yycolumn = yylloc->first_line = yylloc->first_column = 0; \ + yylineno = yylloc->last_line = yylloc->last_column = 0; \ + +//int yycolumn = 1; + +#define YY_USER_ACTION \ +{ \ + yylloc->first_line = yylineno; \ + yylloc->first_column = yycolumn; \ + yylloc->last_column = yycolumn + yyleng; \ + yylloc->last_line = yylineno; \ + yycolumn = yycolumn + yyleng; \ +} + +#line 45 "c89.l" +#include <stdio.h> + +int check_type() +{ +/* if (yytext == uint) + return(TYPE_NAME); +*/ + return(IDENTIFIER); +} + +#line 693 "c89.lex.yy.cpp" + +#define INITIAL 0 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include <unistd.h> +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +/* 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; + + YYLTYPE * yylloc_r; + + }; /* end struct yyguts_t */ + +static int yy_init_globals (yyscan_t yyscanner ); + + /* This must go here because YYSTYPE and YYLTYPE are included + * from bison output in section 1.*/ + # define yylval yyg->yylval_r + + # define yylloc yyg->yylloc_r + +int c89_lex_init (yyscan_t* scanner); + +int c89_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int c89_lex_destroy (yyscan_t yyscanner ); + +int c89_get_debug (yyscan_t yyscanner ); + +void c89_set_debug (int debug_flag ,yyscan_t yyscanner ); + +YY_EXTRA_TYPE c89_get_extra (yyscan_t yyscanner ); + +void c89_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); + +FILE *c89_get_in (yyscan_t yyscanner ); + +void c89_set_in (FILE * _in_str ,yyscan_t yyscanner ); + +FILE *c89_get_out (yyscan_t yyscanner ); + +void c89_set_out (FILE * _out_str ,yyscan_t yyscanner ); + +yy_size_t c89_get_leng (yyscan_t yyscanner ); + +char *c89_get_text (yyscan_t yyscanner ); + +int c89_get_lineno (yyscan_t yyscanner ); + +void c89_set_lineno (int _line_number ,yyscan_t yyscanner ); + +int c89_get_column (yyscan_t yyscanner ); + +void c89_set_column (int _column_no ,yyscan_t yyscanner ); + +YYSTYPE * c89_get_lval (yyscan_t yyscanner ); + +void c89_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner ); + + YYLTYPE *c89_get_lloc (yyscan_t yyscanner ); + + void c89_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int c89_wrap (yyscan_t yyscanner ); +#else +extern int c89_wrap (yyscan_t yyscanner ); +#endif +#endif + +#ifndef YY_NO_UNPUT + + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); + +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner); +#endif + +#ifndef YY_NO_INPUT + +#ifdef __cplusplus +static int yyinput (yyscan_t yyscanner ); +#else +static int input (yyscan_t yyscanner ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ + { \ + int c = '*'; \ + size_t n; \ + for ( n = 0; n < max_size && \ + (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + buf[n] = (char) c; \ + if ( c == '\n' ) \ + buf[n++] = (char) c; \ + if ( c == EOF && ferror( yyin ) ) \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + result = n; \ + } \ + else \ + { \ + errno=0; \ + while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + } \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int c89_lex \ + (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); + +#define YY_DECL int c89_lex \ + (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK /*LINTED*/break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yylval = yylval_param; + + yylloc = yylloc_param; + + if ( !yyg->yy_init ) + { + yyg->yy_init = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! yyg->yy_start ) + yyg->yy_start = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + c89_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + c89__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + c89__load_buffer_state(yyscanner ); + } + + { +#line 57 "c89.l" + +#line 980 "c89.lex.yy.cpp" + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *yy_cp = yyg->yy_hold_char; + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = yyg->yy_start; +yy_match: + do + { + YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ; + 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 ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 251 ) + 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 != 250 ); + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + yy_size_t yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + do{ yylineno++; + yycolumn=0; + }while(0) +; + } + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ + 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 +#line 58 "c89.l" +/* multiline comments */ + YY_BREAK +case 2: +YY_RULE_SETUP +#line 59 "c89.l" +/* singlelien comments */ + YY_BREAK +case 3: +YY_RULE_SETUP +#line 60 "c89.l" +/* singlelien comments */ + YY_BREAK +case 4: +YY_RULE_SETUP +#line 62 "c89.l" +{ return(AUTO); } + YY_BREAK +case 5: +YY_RULE_SETUP +#line 63 "c89.l" +{ return(BREAK); } + YY_BREAK +case 6: +YY_RULE_SETUP +#line 64 "c89.l" +{ return(CASE); } + YY_BREAK +case 7: +YY_RULE_SETUP +#line 65 "c89.l" +{ return(CHAR); } + YY_BREAK +case 8: +YY_RULE_SETUP +#line 66 "c89.l" +{ return(CONST); } + YY_BREAK +case 9: +YY_RULE_SETUP +#line 67 "c89.l" +{ return(CONTINUE); } + YY_BREAK +case 10: +YY_RULE_SETUP +#line 68 "c89.l" +{ return(DEFAULT); } + YY_BREAK +case 11: +YY_RULE_SETUP +#line 69 "c89.l" +{ return(DO); } + YY_BREAK +case 12: +YY_RULE_SETUP +#line 70 "c89.l" +{ return(DOUBLE); } + YY_BREAK +case 13: +YY_RULE_SETUP +#line 71 "c89.l" +{ return(ELSE); } + YY_BREAK +case 14: +YY_RULE_SETUP +#line 72 "c89.l" +{ return(ENUM); } + YY_BREAK +case 15: +YY_RULE_SETUP +#line 73 "c89.l" +{ return(EXTERN); } + YY_BREAK +case 16: +YY_RULE_SETUP +#line 74 "c89.l" +{ return(FLOAT); } + YY_BREAK +case 17: +YY_RULE_SETUP +#line 75 "c89.l" +{ return(FOR); } + YY_BREAK +case 18: +YY_RULE_SETUP +#line 76 "c89.l" +{ return(GOTO); } + YY_BREAK +case 19: +YY_RULE_SETUP +#line 77 "c89.l" +{ return(IF); } + YY_BREAK +case 20: +YY_RULE_SETUP +#line 78 "c89.l" +{ return(INT); } + YY_BREAK +case 21: +YY_RULE_SETUP +#line 79 "c89.l" +{ return(LONG); } + YY_BREAK +case 22: +YY_RULE_SETUP +#line 80 "c89.l" +{ return(REGISTER); } + YY_BREAK +case 23: +YY_RULE_SETUP +#line 81 "c89.l" +{ return(RETURN); } + YY_BREAK +case 24: +YY_RULE_SETUP +#line 82 "c89.l" +{ return(SHORT); } + YY_BREAK +case 25: +YY_RULE_SETUP +#line 83 "c89.l" +{ return(SIGNED); } + YY_BREAK +case 26: +YY_RULE_SETUP +#line 84 "c89.l" +{ return(SIZEOF); } + YY_BREAK +case 27: +YY_RULE_SETUP +#line 85 "c89.l" +{ return(STATIC); } + YY_BREAK +case 28: +YY_RULE_SETUP +#line 86 "c89.l" +{ return(STRUCT); } + YY_BREAK +case 29: +YY_RULE_SETUP +#line 87 "c89.l" +{ return(SWITCH); } + YY_BREAK +case 30: +YY_RULE_SETUP +#line 88 "c89.l" +{ return(TYPEDEF); } + YY_BREAK +case 31: +YY_RULE_SETUP +#line 89 "c89.l" +{ return(UNION); } + YY_BREAK +case 32: +YY_RULE_SETUP +#line 90 "c89.l" +{ return(UNSIGNED); } + YY_BREAK +case 33: +YY_RULE_SETUP +#line 91 "c89.l" +{ return(VOID); } + YY_BREAK +case 34: +YY_RULE_SETUP +#line 92 "c89.l" +{ return(VOLATILE); } + YY_BREAK +case 35: +YY_RULE_SETUP +#line 93 "c89.l" +{ return(WHILE); } + YY_BREAK +case 36: +YY_RULE_SETUP +#line 95 "c89.l" +{ yylval->value = strdup(yytext); return(IDENTIFIER); } + YY_BREAK +case 37: +YY_RULE_SETUP +#line 97 "c89.l" +{ yylval->value = strdup(yytext); return(CONSTANT); } + YY_BREAK +case 38: +YY_RULE_SETUP +#line 98 "c89.l" +{ yylval->value = strdup(yytext); return(CONSTANT); } + YY_BREAK +case 39: +YY_RULE_SETUP +#line 99 "c89.l" +{ yylval->value = strdup(yytext); return(CONSTANT); } + YY_BREAK +case 40: +/* rule 40 can match eol */ +YY_RULE_SETUP +#line 100 "c89.l" +{ yylval->value = strdup(yytext); return(CONSTANT); } + YY_BREAK +case 41: +YY_RULE_SETUP +#line 102 "c89.l" +{ yylval->value = strdup(yytext); return(CONSTANT); } + YY_BREAK +case 42: +YY_RULE_SETUP +#line 103 "c89.l" +{ yylval->value = strdup(yytext); return(CONSTANT); } + YY_BREAK +case 43: +YY_RULE_SETUP +#line 104 "c89.l" +{ yylval->value = strdup(yytext); return(CONSTANT); } + YY_BREAK +case 44: +/* rule 44 can match eol */ +YY_RULE_SETUP +#line 106 "c89.l" +{ yylval->value = strdup(yytext); return(STRING_LITERAL); } + YY_BREAK +case 45: +YY_RULE_SETUP +#line 108 "c89.l" +{ return(ELLIPSIS); } + YY_BREAK +case 46: +YY_RULE_SETUP +#line 109 "c89.l" +{ return(RIGHT_ASSIGN); } + YY_BREAK +case 47: +YY_RULE_SETUP +#line 110 "c89.l" +{ return(LEFT_ASSIGN); } + YY_BREAK +case 48: +YY_RULE_SETUP +#line 111 "c89.l" +{ return(ADD_ASSIGN); } + YY_BREAK +case 49: +YY_RULE_SETUP +#line 112 "c89.l" +{ return(SUB_ASSIGN); } + YY_BREAK +case 50: +YY_RULE_SETUP +#line 113 "c89.l" +{ return(MUL_ASSIGN); } + YY_BREAK +case 51: +YY_RULE_SETUP +#line 114 "c89.l" +{ return(DIV_ASSIGN); } + YY_BREAK +case 52: +YY_RULE_SETUP +#line 115 "c89.l" +{ return(MOD_ASSIGN); } + YY_BREAK +case 53: +YY_RULE_SETUP +#line 116 "c89.l" +{ return(AND_ASSIGN); } + YY_BREAK +case 54: +YY_RULE_SETUP +#line 117 "c89.l" +{ return(XOR_ASSIGN); } + YY_BREAK +case 55: +YY_RULE_SETUP +#line 118 "c89.l" +{ return(OR_ASSIGN); } + YY_BREAK +case 56: +YY_RULE_SETUP +#line 119 "c89.l" +{ return(RIGHT_OP); } + YY_BREAK +case 57: +YY_RULE_SETUP +#line 120 "c89.l" +{ return(LEFT_OP); } + YY_BREAK +case 58: +YY_RULE_SETUP +#line 121 "c89.l" +{ return(INC_OP); } + YY_BREAK +case 59: +YY_RULE_SETUP +#line 122 "c89.l" +{ return(DEC_OP); } + YY_BREAK +case 60: +YY_RULE_SETUP +#line 123 "c89.l" +{ return(PTR_OP); } + YY_BREAK +case 61: +YY_RULE_SETUP +#line 124 "c89.l" +{ return(AND_OP); } + YY_BREAK +case 62: +YY_RULE_SETUP +#line 125 "c89.l" +{ return(OR_OP); } + YY_BREAK +case 63: +YY_RULE_SETUP +#line 126 "c89.l" +{ return(LE_OP); } + YY_BREAK +case 64: +YY_RULE_SETUP +#line 127 "c89.l" +{ return(GE_OP); } + YY_BREAK +case 65: +YY_RULE_SETUP +#line 128 "c89.l" +{ return(EQ_OP); } + YY_BREAK +case 66: +YY_RULE_SETUP +#line 129 "c89.l" +{ return(NE_OP); } + YY_BREAK +case 67: +YY_RULE_SETUP +#line 130 "c89.l" +{ return(';'); } + YY_BREAK +case 68: +YY_RULE_SETUP +#line 131 "c89.l" +{ return('{'); } + YY_BREAK +case 69: +YY_RULE_SETUP +#line 132 "c89.l" +{ return('}'); } + YY_BREAK +case 70: +YY_RULE_SETUP +#line 133 "c89.l" +{ return(','); } + YY_BREAK +case 71: +YY_RULE_SETUP +#line 134 "c89.l" +{ return(':'); } + YY_BREAK +case 72: +YY_RULE_SETUP +#line 135 "c89.l" +{ return('='); } + YY_BREAK +case 73: +YY_RULE_SETUP +#line 136 "c89.l" +{ return('('); } + YY_BREAK +case 74: +YY_RULE_SETUP +#line 137 "c89.l" +{ return(')'); } + YY_BREAK +case 75: +YY_RULE_SETUP +#line 138 "c89.l" +{ return('['); } + YY_BREAK +case 76: +YY_RULE_SETUP +#line 139 "c89.l" +{ return(']'); } + YY_BREAK +case 77: +YY_RULE_SETUP +#line 140 "c89.l" +{ return('.'); } + YY_BREAK +case 78: +YY_RULE_SETUP +#line 141 "c89.l" +{ return('&'); } + YY_BREAK +case 79: +YY_RULE_SETUP +#line 142 "c89.l" +{ return('!'); } + YY_BREAK +case 80: +YY_RULE_SETUP +#line 143 "c89.l" +{ return('~'); } + YY_BREAK +case 81: +YY_RULE_SETUP +#line 144 "c89.l" +{ return('-'); } + YY_BREAK +case 82: +YY_RULE_SETUP +#line 145 "c89.l" +{ return('+'); } + YY_BREAK +case 83: +YY_RULE_SETUP +#line 146 "c89.l" +{ return('*'); } + YY_BREAK +case 84: +YY_RULE_SETUP +#line 147 "c89.l" +{ return('/'); } + YY_BREAK +case 85: +YY_RULE_SETUP +#line 148 "c89.l" +{ return('%'); } + YY_BREAK +case 86: +YY_RULE_SETUP +#line 149 "c89.l" +{ return('<'); } + YY_BREAK +case 87: +YY_RULE_SETUP +#line 150 "c89.l" +{ return('>'); } + YY_BREAK +case 88: +YY_RULE_SETUP +#line 151 "c89.l" +{ return('^'); } + YY_BREAK +case 89: +YY_RULE_SETUP +#line 152 "c89.l" +{ return('|'); } + YY_BREAK +case 90: +YY_RULE_SETUP +#line 153 "c89.l" +{ return('?'); } + YY_BREAK +case 91: +/* rule 91 can match eol */ +YY_RULE_SETUP +#line 155 "c89.l" +{ } + YY_BREAK +case 92: +YY_RULE_SETUP +#line 156 "c89.l" +{ /* ignore bad characters */ } + YY_BREAK +case 93: +YY_RULE_SETUP +#line 158 "c89.l" +ECHO; + YY_BREAK +#line 1514 "c89.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 + * c89_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; + + yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text; + + 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). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + + 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; + } + + else + { + 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 ( c89_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; + } + break; + } + + 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_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]; + + 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; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of c89_lex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = yyg->yytext_ptr; + yy_size_t number_to_move, i; + int ret_val; + + 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" ); + + 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 + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + 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; + + 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_LVALUE; + + int yy_c_buf_p_offset = + (int) (yyg->yy_c_buf_p - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + yy_size_t new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + c89_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" ); + + 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; + + } + + 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 ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; + } + + if ( yyg->yy_n_chars == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + c89_restart(yyin ,yyscanner); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) c89_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + } + + yyg->yy_n_chars += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; + + yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (yyscan_t yyscanner) +{ + yy_state_type yy_current_state; + char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + yy_current_state = yyg->yy_start; + + for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) + { + YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + 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 ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 251 ) + 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; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) +{ + int yy_is_jam; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + char *yy_cp = yyg->yy_c_buf_p; + + YY_CHAR yy_c = 1; + 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 ) + { + yy_current_state = (int) yy_def[yy_current_state]; + if ( yy_current_state >= 251 ) + 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 == 250); + + (void)yyg; + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp , yyscan_t yyscanner) +{ + char *yy_cp; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + 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 */ + /* +2 for EOB chars. */ + yy_size_t number_to_move = yyg->yy_n_chars + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + 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; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ){ + --yylineno; + } + + yyg->yytext_ptr = yy_bp; + yyg->yy_hold_char = *yy_cp; + yyg->yy_c_buf_p = yy_cp; +} + +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (yyscan_t yyscanner) +#else + static int input (yyscan_t yyscanner) +#endif + +{ + int c; + 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 ) + { + /* 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. + */ + if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] ) + /* This was really a NUL. */ + *yyg->yy_c_buf_p = '\0'; + + 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. */ + c89_restart(yyin ,yyscanner); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( c89_wrap(yyscanner ) ) + return EOF; + + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(yyscanner); +#else + return input(yyscanner); +#endif + } + + 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; + + if ( c == '\n' ) + + do{ yylineno++; + yycolumn=0; + }while(0) +; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * @param yyscanner The scanner object. + * @note This function does not reset the start condition to @c INITIAL . + */ + void c89_restart (FILE * input_file , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! YY_CURRENT_BUFFER ){ + c89_ensure_buffer_stack (yyscanner); + YY_CURRENT_BUFFER_LVALUE = + c89__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); + } + + c89__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner); + c89__load_buffer_state(yyscanner ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * @param yyscanner The scanner object. + */ + void c89__switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* TODO. We should be able to replace this entire function body + * with + * c89_pop_buffer_state(); + * c89_push_buffer_state(new_buffer); + */ + c89_ensure_buffer_stack (yyscanner); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + 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; + c89__load_buffer_state(yyscanner ); + + /* We don't actually know whether we did this switch during + * EOF (c89_wrap()) processing, but the only time this flag + * is looked at is after c89_wrap() is called, so it's safe + * to go ahead and always set it. + */ + yyg->yy_did_buffer_switch_on_eof = 1; +} + +static void c89__load_buffer_state (yyscan_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; + yyg->yy_hold_char = *yyg->yy_c_buf_p; +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * @param yyscanner The scanner object. + * @return the allocated buffer state. + */ + YY_BUFFER_STATE c89__create_buffer (FILE * file, int size , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) c89_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in c89__create_buffer()" ); + + b->yy_buf_size = (yy_size_t)size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) c89_alloc(b->yy_buf_size + 2 ,yyscanner ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in c89__create_buffer()" ); + + b->yy_is_our_buffer = 1; + + c89__init_buffer(b,file ,yyscanner); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with c89__create_buffer() + * @param yyscanner The scanner object. + */ + void c89__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + c89_free((void *) b->yy_ch_buf ,yyscanner ); + + c89_free((void *) b ,yyscanner ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a c89_restart() or at EOF. + */ + static void c89__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner) + +{ + int oerrno = errno; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + c89__flush_buffer(b ,yyscanner); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then c89__init_buffer was _probably_ + * called from c89_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; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * @param yyscanner The scanner object. + */ + void c89__flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + c89__load_buffer_state(yyscanner ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * @param yyscanner The scanner object. + */ +void c89_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (new_buffer == NULL) + return; + + c89_ensure_buffer_stack(yyscanner); + + /* This block is copied from c89__switch_to_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) + yyg->yy_buffer_stack_top++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from c89__switch_to_buffer. */ + c89__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * @param yyscanner The scanner object. + */ +void c89_pop_buffer_state (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + if (!YY_CURRENT_BUFFER) + return; + + c89__delete_buffer(YY_CURRENT_BUFFER ,yyscanner); + YY_CURRENT_BUFFER_LVALUE = NULL; + if (yyg->yy_buffer_stack_top > 0) + --yyg->yy_buffer_stack_top; + + if (YY_CURRENT_BUFFER) { + c89__load_buffer_state(yyscanner ); + yyg->yy_did_buffer_switch_on_eof = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void c89_ensure_buffer_stack (yyscan_t yyscanner) +{ + yy_size_t num_to_alloc; + 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; // After all that talk, this was set to 1 anyways... + yyg->yy_buffer_stack = (struct yy_buffer_state**)c89_alloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + , yyscanner); + if ( ! yyg->yy_buffer_stack ) + YY_FATAL_ERROR( "out of dynamic memory in c89_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){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = yyg->yy_buffer_stack_max + grow_size; + yyg->yy_buffer_stack = (struct yy_buffer_state**)c89_realloc + (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 c89_ensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*)); + yyg->yy_buffer_stack_max = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @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. + */ +YY_BUFFER_STATE c89__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 ) + /* They forgot to leave room for the EOB's. */ + return 0; + + b = (YY_BUFFER_STATE) c89_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in c89__scan_buffer()" ); + + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = 0; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + c89__switch_to_buffer(b ,yyscanner ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to c89_lex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * c89__scan_bytes() instead. + */ +YY_BUFFER_STATE c89__scan_string (yyconst char * yystr , yyscan_t yyscanner) +{ + + return c89__scan_bytes(yystr,strlen(yystr) ,yyscanner); +} + +/** Setup the input buffer state to scan the given bytes. The next call to c89_lex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param yyscanner The scanner object. + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE c89__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + yy_size_t i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = _yybytes_len + 2; + buf = (char *) c89_alloc(n ,yyscanner ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in c89__scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = c89__scan_buffer(buf,n ,yyscanner); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in c89__scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + (void) fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = yyg->yy_hold_char; \ + yyg->yy_c_buf_p = yytext + yyless_macro_arg; \ + yyg->yy_hold_char = *yyg->yy_c_buf_p; \ + *yyg->yy_c_buf_p = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the user-defined data for this scanner. + * @param yyscanner The scanner object. + */ +YY_EXTRA_TYPE c89_get_extra (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yyextra; +} + +/** Get the current line number. + * @param yyscanner The scanner object. + */ +int c89_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 c89_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 *c89_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 *c89_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 c89_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 *c89_get_text (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yytext; +} + +/** Set the user-defined data. This data is never touched by the scanner. + * @param user_defined The data to be associated with this scanner. + * @param yyscanner The scanner object. + */ +void c89_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyextra = user_defined ; +} + +/** Set the current line number. + * @param _line_number line number + * @param yyscanner The scanner object. + */ +void c89_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( "c89_set_lineno called with no buffer" ); + + yylineno = _line_number; +} + +/** Set the current column. + * @param _column_no column number + * @param yyscanner The scanner object. + */ +void c89_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( "c89_set_column called with no buffer" ); + + yycolumn = _column_no; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * @param yyscanner The scanner object. + * @see c89__switch_to_buffer + */ +void c89_set_in (FILE * _in_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyin = _in_str ; +} + +void c89_set_out (FILE * _out_str , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yyout = _out_str ; +} + +int c89_get_debug (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yy_flex_debug; +} + +void c89_set_debug (int _bdebug , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yy_flex_debug = _bdebug ; +} + +/* Accessor methods for yylval and yylloc */ + +YYSTYPE * c89_get_lval (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylval; +} + +void c89_set_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylval = yylval_param; +} + +YYLTYPE *c89_get_lloc (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + return yylloc; +} + +void c89_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + yylloc = yylloc_param; +} + +/* User-visible API */ + +/* c89_lex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int c89_lex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) c89_alloc ( sizeof( struct yyguts_t ), NULL ); + + 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)); + + return yy_init_globals ( *ptr_yy_globals ); +} + +/* c89_lex_init_extra has the same functionality as c89_lex_init, but follows the + * convention of taking the scanner as the last argument. Note however, that + * this is a *pointer* to a scanner, as it will be allocated by this call (and + * is the reason, too, why this function also must handle its own declaration). + * The user defined value in the first argument will be available to c89_alloc in + * the yyextra field. + */ + +int c89_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals ) + +{ + struct yyguts_t dummy_yyguts; + + c89_set_extra (yy_user_defined, &dummy_yyguts); + + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) c89_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)); + + c89_set_extra (yy_user_defined, *ptr_yy_globals); + + return yy_init_globals ( *ptr_yy_globals ); +} + +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 c89_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; +#else + yyin = (FILE *) 0; + yyout = (FILE *) 0; +#endif + + /* For future reference: Set errno on error, since we are called by + * c89_lex_init() + */ + return 0; +} + +/* c89_lex_destroy is for both reentrant and non-reentrant scanners. */ +int c89_lex_destroy (yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + c89__delete_buffer(YY_CURRENT_BUFFER ,yyscanner ); + YY_CURRENT_BUFFER_LVALUE = NULL; + c89_pop_buffer_state(yyscanner); + } + + /* Destroy the stack itself. */ + c89_free(yyg->yy_buffer_stack ,yyscanner); + yyg->yy_buffer_stack = NULL; + + /* Destroy the start condition stack. */ + c89_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 + * c89_lex() is called, initialization will occur. */ + yy_init_globals( yyscanner); + + /* Destroy the main struct (reentrant only). */ + c89_free ( yyscanner , yyscanner ); + yyscanner = NULL; + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *c89_alloc (yy_size_t size , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + return (void *) malloc( size ); +} + +void *c89_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + /* 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 + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return (void *) realloc( (char *) ptr, size ); +} + +void c89_free (void * ptr , yyscan_t yyscanner) +{ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + free( (char *) ptr ); /* see c89_realloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +#line 158 "c89.l" + + + diff --git a/src/uscxml/plugins/datamodel/c89/parser/c89.output b/src/uscxml/plugins/datamodel/c89/parser/c89.output new file mode 100644 index 0000000..a83648b --- /dev/null +++ b/src/uscxml/plugins/datamodel/c89/parser/c89.output @@ -0,0 +1,6137 @@ +State 333 conflicts: 1 shift/reduce + + +Grammar + + 0 $accept: translation_unit $end + + 1 primary_expression: IDENTIFIER + 2 | CONSTANT + 3 | STRING_LITERAL + 4 | '(' expression ')' + + 5 postfix_expression: primary_expression + 6 | postfix_expression '[' expression ']' + 7 | postfix_expression '(' ')' + 8 | postfix_expression '(' argument_expression_list ')' + 9 | postfix_expression '.' IDENTIFIER + 10 | postfix_expression PTR_OP IDENTIFIER + 11 | postfix_expression INC_OP + 12 | postfix_expression DEC_OP + + 13 argument_expression_list: assignment_expression + 14 | argument_expression_list ',' assignment_expression + + 15 unary_expression: postfix_expression + 16 | INC_OP unary_expression + 17 | DEC_OP unary_expression + 18 | unary_operator cast_expression + 19 | SIZEOF unary_expression + 20 | SIZEOF '(' type_name ')' + + 21 unary_operator: '&' + 22 | '*' + 23 | '+' + 24 | '-' + 25 | '~' + 26 | '!' + + 27 cast_expression: unary_expression + 28 | '(' type_name ')' cast_expression + + 29 multiplicative_expression: cast_expression + 30 | multiplicative_expression '*' cast_expression + 31 | multiplicative_expression '/' cast_expression + 32 | multiplicative_expression '%' cast_expression + + 33 additive_expression: multiplicative_expression + 34 | additive_expression '+' multiplicative_expression + 35 | additive_expression '-' multiplicative_expression + + 36 shift_expression: additive_expression + 37 | shift_expression LEFT_OP additive_expression + 38 | shift_expression RIGHT_OP additive_expression + + 39 relational_expression: shift_expression + 40 | relational_expression '<' shift_expression + 41 | relational_expression '>' shift_expression + 42 | relational_expression LE_OP shift_expression + 43 | relational_expression GE_OP shift_expression + + 44 equality_expression: relational_expression + 45 | equality_expression EQ_OP relational_expression + 46 | equality_expression NE_OP relational_expression + + 47 and_expression: equality_expression + 48 | and_expression '&' equality_expression + + 49 exclusive_or_expression: and_expression + 50 | exclusive_or_expression '^' and_expression + + 51 inclusive_or_expression: exclusive_or_expression + 52 | inclusive_or_expression '|' exclusive_or_expression + + 53 logical_and_expression: inclusive_or_expression + 54 | logical_and_expression AND_OP inclusive_or_expression + + 55 logical_or_expression: logical_and_expression + 56 | logical_or_expression OR_OP logical_and_expression + + 57 conditional_expression: logical_or_expression + 58 | logical_or_expression '?' expression ':' conditional_expression + + 59 assignment_expression: conditional_expression + 60 | unary_expression assignment_operator assignment_expression + + 61 assignment_operator: '=' + 62 | MUL_ASSIGN + 63 | DIV_ASSIGN + 64 | MOD_ASSIGN + 65 | ADD_ASSIGN + 66 | SUB_ASSIGN + 67 | LEFT_ASSIGN + 68 | RIGHT_ASSIGN + 69 | AND_ASSIGN + 70 | XOR_ASSIGN + 71 | OR_ASSIGN + + 72 expression: assignment_expression + 73 | expression ',' assignment_expression + + 74 constant_expression: conditional_expression + + 75 declaration: declaration_specifiers ';' + 76 | declaration_specifiers init_declarator_list ';' + + 77 declaration_specifiers: storage_class_specifier + 78 | storage_class_specifier declaration_specifiers + 79 | type_specifier + 80 | type_specifier declaration_specifiers + 81 | type_qualifier + 82 | type_qualifier declaration_specifiers + + 83 init_declarator_list: init_declarator + 84 | init_declarator_list ',' init_declarator + + 85 init_declarator: declarator + 86 | declarator '=' initializer + + 87 storage_class_specifier: TYPEDEF + 88 | EXTERN + 89 | STATIC + 90 | AUTO + 91 | REGISTER + + 92 type_specifier: VOID + 93 | CHAR + 94 | SHORT + 95 | INT + 96 | LONG + 97 | FLOAT + 98 | DOUBLE + 99 | SIGNED + 100 | UNSIGNED + 101 | struct_or_union_specifier + 102 | enum_specifier + 103 | TYPE_NAME + + 104 struct_or_union_specifier: struct_or_union IDENTIFIER '{' struct_declaration_list '}' + 105 | struct_or_union '{' struct_declaration_list '}' + 106 | struct_or_union IDENTIFIER + + 107 struct_or_union: STRUCT + 108 | UNION + + 109 struct_declaration_list: struct_declaration + 110 | struct_declaration_list struct_declaration + + 111 struct_declaration: specifier_qualifier_list struct_declarator_list ';' + + 112 specifier_qualifier_list: type_specifier specifier_qualifier_list + 113 | type_specifier + 114 | type_qualifier specifier_qualifier_list + 115 | type_qualifier + + 116 struct_declarator_list: struct_declarator + 117 | struct_declarator_list ',' struct_declarator + + 118 struct_declarator: declarator + 119 | ':' constant_expression + 120 | declarator ':' constant_expression + + 121 enum_specifier: ENUM '{' enumerator_list '}' + 122 | ENUM IDENTIFIER '{' enumerator_list '}' + 123 | ENUM IDENTIFIER + + 124 enumerator_list: enumerator + 125 | enumerator_list ',' enumerator + + 126 enumerator: IDENTIFIER + 127 | IDENTIFIER '=' constant_expression + + 128 type_qualifier: CONST + 129 | VOLATILE + + 130 declarator: pointer direct_declarator + 131 | direct_declarator + + 132 direct_declarator: IDENTIFIER + 133 | '(' declarator ')' + 134 | direct_declarator '[' constant_expression ']' + 135 | direct_declarator '[' ']' + 136 | direct_declarator '(' parameter_type_list ')' + 137 | direct_declarator '(' identifier_list ')' + 138 | direct_declarator '(' ')' + + 139 pointer: '*' + 140 | '*' type_qualifier_list + 141 | '*' pointer + 142 | '*' type_qualifier_list pointer + + 143 type_qualifier_list: type_qualifier + 144 | type_qualifier_list type_qualifier + + 145 parameter_type_list: parameter_list + 146 | parameter_list ',' ELLIPSIS + + 147 parameter_list: parameter_declaration + 148 | parameter_list ',' parameter_declaration + + 149 parameter_declaration: declaration_specifiers declarator + 150 | declaration_specifiers abstract_declarator + 151 | declaration_specifiers + + 152 identifier_list: IDENTIFIER + 153 | identifier_list ',' IDENTIFIER + + 154 type_name: specifier_qualifier_list + 155 | specifier_qualifier_list abstract_declarator + + 156 abstract_declarator: pointer + 157 | direct_abstract_declarator + 158 | pointer direct_abstract_declarator + + 159 direct_abstract_declarator: '(' abstract_declarator ')' + 160 | '[' ']' + 161 | '[' constant_expression ']' + 162 | direct_abstract_declarator '[' ']' + 163 | direct_abstract_declarator '[' constant_expression ']' + 164 | '(' ')' + 165 | '(' parameter_type_list ')' + 166 | direct_abstract_declarator '(' ')' + 167 | direct_abstract_declarator '(' parameter_type_list ')' + + 168 initializer: assignment_expression + 169 | '{' initializer_list '}' + 170 | '{' initializer_list ',' '}' + + 171 initializer_list: initializer + 172 | initializer_list ',' initializer + + 173 statement: labeled_statement + 174 | compound_statement + 175 | expression_statement + 176 | selection_statement + 177 | iteration_statement + 178 | jump_statement + + 179 labeled_statement: IDENTIFIER ':' statement + 180 | CASE constant_expression ':' statement + 181 | DEFAULT ':' statement + + 182 compound_statement: '{' '}' + 183 | '{' statement_list '}' + 184 | '{' declaration_list '}' + 185 | '{' declaration_list statement_list '}' + + 186 declaration_list: declaration + 187 | declaration_list declaration + + 188 statement_list: statement + 189 | statement_list statement + + 190 expression_statement: ';' + 191 | expression ';' + + 192 selection_statement: IF '(' expression ')' statement + 193 | IF '(' expression ')' statement ELSE statement + 194 | SWITCH '(' expression ')' statement + + 195 iteration_statement: WHILE '(' expression ')' statement + 196 | DO statement WHILE '(' expression ')' ';' + 197 | FOR '(' expression_statement expression_statement ')' statement + 198 | FOR '(' expression_statement expression_statement expression ')' statement + + 199 jump_statement: GOTO IDENTIFIER ';' + 200 | CONTINUE ';' + 201 | BREAK ';' + 202 | RETURN ';' + 203 | RETURN expression ';' + + 204 translation_unit: external_declaration + 205 | translation_unit external_declaration + + 206 external_declaration: function_definition + 207 | declaration + + 208 function_definition: declaration_specifiers declarator declaration_list compound_statement + 209 | declaration_specifiers declarator compound_statement + 210 | declarator declaration_list compound_statement + 211 | declarator compound_statement + + +Terminals, with rules where they appear + +$end (0) 0 +'!' (33) 26 +'%' (37) 32 +'&' (38) 21 48 +'(' (40) 4 7 8 20 28 133 136 137 138 159 164 165 166 167 192 193 194 + 195 196 197 198 +')' (41) 4 7 8 20 28 133 136 137 138 159 164 165 166 167 192 193 194 + 195 196 197 198 +'*' (42) 22 30 139 140 141 142 +'+' (43) 23 34 +',' (44) 14 73 84 117 125 146 148 153 170 172 +'-' (45) 24 35 +'.' (46) 9 +'/' (47) 31 +':' (58) 58 119 120 179 180 181 +';' (59) 75 76 111 190 191 196 199 200 201 202 203 +'<' (60) 40 +'=' (61) 61 86 127 +'>' (62) 41 +'?' (63) 58 +'[' (91) 6 134 135 160 161 162 163 +']' (93) 6 134 135 160 161 162 163 +'^' (94) 50 +'{' (123) 104 105 121 122 169 170 182 183 184 185 +'|' (124) 52 +'}' (125) 104 105 121 122 169 170 182 183 184 185 +'~' (126) 25 +error (256) +IDENTIFIER (258) 1 9 10 104 106 122 123 126 127 132 152 153 179 199 +CONSTANT (259) 2 +STRING_LITERAL (260) 3 +SIZEOF (261) 19 20 +PTR_OP (262) 10 +INC_OP (263) 11 16 +DEC_OP (264) 12 17 +LEFT_OP (265) 37 +RIGHT_OP (266) 38 +LE_OP (267) 42 +GE_OP (268) 43 +EQ_OP (269) 45 +NE_OP (270) 46 +AND_OP (271) 54 +OR_OP (272) 56 +MUL_ASSIGN (273) 62 +DIV_ASSIGN (274) 63 +MOD_ASSIGN (275) 64 +ADD_ASSIGN (276) 65 +SUB_ASSIGN (277) 66 +LEFT_ASSIGN (278) 67 +RIGHT_ASSIGN (279) 68 +AND_ASSIGN (280) 69 +XOR_ASSIGN (281) 70 +OR_ASSIGN (282) 71 +TYPE_NAME (283) 103 +TYPEDEF (284) 87 +EXTERN (285) 88 +STATIC (286) 89 +AUTO (287) 90 +REGISTER (288) 91 +CHAR (289) 93 +SHORT (290) 94 +INT (291) 95 +LONG (292) 96 +SIGNED (293) 99 +UNSIGNED (294) 100 +FLOAT (295) 97 +DOUBLE (296) 98 +CONST (297) 128 +VOLATILE (298) 129 +VOID (299) 92 +STRUCT (300) 107 +UNION (301) 108 +ENUM (302) 121 122 123 +ELLIPSIS (303) 146 +CASE (304) 180 +DEFAULT (305) 181 +IF (306) 192 193 +ELSE (307) 193 +SWITCH (308) 194 +WHILE (309) 195 196 +DO (310) 196 +FOR (311) 197 198 +GOTO (312) 199 +CONTINUE (313) 200 +BREAK (314) 201 +RETURN (315) 202 203 + + +Nonterminals, with rules where they appear + +$accept (85) + on left: 0 +primary_expression (86) + on left: 1 2 3 4, on right: 5 +postfix_expression (87) + on left: 5 6 7 8 9 10 11 12, on right: 6 7 8 9 10 11 12 15 +argument_expression_list (88) + on left: 13 14, on right: 8 14 +unary_expression (89) + on left: 15 16 17 18 19 20, on right: 16 17 19 27 60 +unary_operator (90) + on left: 21 22 23 24 25 26, on right: 18 +cast_expression (91) + on left: 27 28, on right: 18 28 29 30 31 32 +multiplicative_expression (92) + on left: 29 30 31 32, on right: 30 31 32 33 34 35 +additive_expression (93) + on left: 33 34 35, on right: 34 35 36 37 38 +shift_expression (94) + on left: 36 37 38, on right: 37 38 39 40 41 42 43 +relational_expression (95) + on left: 39 40 41 42 43, on right: 40 41 42 43 44 45 46 +equality_expression (96) + on left: 44 45 46, on right: 45 46 47 48 +and_expression (97) + on left: 47 48, on right: 48 49 50 +exclusive_or_expression (98) + on left: 49 50, on right: 50 51 52 +inclusive_or_expression (99) + on left: 51 52, on right: 52 53 54 +logical_and_expression (100) + on left: 53 54, on right: 54 55 56 +logical_or_expression (101) + on left: 55 56, on right: 56 57 58 +conditional_expression (102) + on left: 57 58, on right: 58 59 74 +assignment_expression (103) + on left: 59 60, on right: 13 14 60 72 73 168 +assignment_operator (104) + on left: 61 62 63 64 65 66 67 68 69 70 71, on right: 60 +expression (105) + on left: 72 73, on right: 4 6 58 73 191 192 193 194 195 196 198 + 203 +constant_expression (106) + on left: 74, on right: 119 120 127 134 161 163 180 +declaration (107) + on left: 75 76, on right: 186 187 207 +declaration_specifiers (108) + on left: 77 78 79 80 81 82, on right: 75 76 78 80 82 149 150 151 + 208 209 +init_declarator_list (109) + on left: 83 84, on right: 76 84 +init_declarator (110) + on left: 85 86, on right: 83 84 +storage_class_specifier (111) + on left: 87 88 89 90 91, on right: 77 78 +type_specifier (112) + on left: 92 93 94 95 96 97 98 99 100 101 102 103, on right: 79 + 80 112 113 +struct_or_union_specifier (113) + on left: 104 105 106, on right: 101 +struct_or_union (114) + on left: 107 108, on right: 104 105 106 +struct_declaration_list (115) + on left: 109 110, on right: 104 105 110 +struct_declaration (116) + on left: 111, on right: 109 110 +specifier_qualifier_list (117) + on left: 112 113 114 115, on right: 111 112 114 154 155 +struct_declarator_list (118) + on left: 116 117, on right: 111 117 +struct_declarator (119) + on left: 118 119 120, on right: 116 117 +enum_specifier (120) + on left: 121 122 123, on right: 102 +enumerator_list (121) + on left: 124 125, on right: 121 122 125 +enumerator (122) + on left: 126 127, on right: 124 125 +type_qualifier (123) + on left: 128 129, on right: 81 82 114 115 143 144 +declarator (124) + on left: 130 131, on right: 85 86 118 120 133 149 208 209 210 211 +direct_declarator (125) + on left: 132 133 134 135 136 137 138, on right: 130 131 134 135 + 136 137 138 +pointer (126) + on left: 139 140 141 142, on right: 130 141 142 156 158 +type_qualifier_list (127) + on left: 143 144, on right: 140 142 144 +parameter_type_list (128) + on left: 145 146, on right: 136 165 167 +parameter_list (129) + on left: 147 148, on right: 145 146 148 +parameter_declaration (130) + on left: 149 150 151, on right: 147 148 +identifier_list (131) + on left: 152 153, on right: 137 153 +type_name (132) + on left: 154 155, on right: 20 28 +abstract_declarator (133) + on left: 156 157 158, on right: 150 155 159 +direct_abstract_declarator (134) + on left: 159 160 161 162 163 164 165 166 167, on right: 157 158 + 162 163 166 167 +initializer (135) + on left: 168 169 170, on right: 86 171 172 +initializer_list (136) + on left: 171 172, on right: 169 170 172 +statement (137) + on left: 173 174 175 176 177 178, on right: 179 180 181 188 189 + 192 193 194 195 196 197 198 +labeled_statement (138) + on left: 179 180 181, on right: 173 +compound_statement (139) + on left: 182 183 184 185, on right: 174 208 209 210 211 +declaration_list (140) + on left: 186 187, on right: 184 185 187 208 210 +statement_list (141) + on left: 188 189, on right: 183 185 189 +expression_statement (142) + on left: 190 191, on right: 175 197 198 +selection_statement (143) + on left: 192 193 194, on right: 176 +iteration_statement (144) + on left: 195 196 197 198, on right: 177 +jump_statement (145) + on left: 199 200 201 202 203, on right: 178 +translation_unit (146) + on left: 204 205, on right: 0 205 +external_declaration (147) + on left: 206 207, on right: 204 205 +function_definition (148) + on left: 208 209 210 211, on right: 206 + + +State 0 + + 0 $accept: . translation_unit $end + + IDENTIFIER shift, and go to state 1 + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + '(' shift, and go to state 22 + '*' shift, and go to state 23 + + declaration go to state 24 + declaration_specifiers go to state 25 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + declarator go to state 32 + direct_declarator go to state 33 + pointer go to state 34 + translation_unit go to state 35 + external_declaration go to state 36 + function_definition go to state 37 + + +State 1 + + 132 direct_declarator: IDENTIFIER . + + $default reduce using rule 132 (direct_declarator) + + +State 2 + + 103 type_specifier: TYPE_NAME . + + $default reduce using rule 103 (type_specifier) + + +State 3 + + 87 storage_class_specifier: TYPEDEF . + + $default reduce using rule 87 (storage_class_specifier) + + +State 4 + + 88 storage_class_specifier: EXTERN . + + $default reduce using rule 88 (storage_class_specifier) + + +State 5 + + 89 storage_class_specifier: STATIC . + + $default reduce using rule 89 (storage_class_specifier) + + +State 6 + + 90 storage_class_specifier: AUTO . + + $default reduce using rule 90 (storage_class_specifier) + + +State 7 + + 91 storage_class_specifier: REGISTER . + + $default reduce using rule 91 (storage_class_specifier) + + +State 8 + + 93 type_specifier: CHAR . + + $default reduce using rule 93 (type_specifier) + + +State 9 + + 94 type_specifier: SHORT . + + $default reduce using rule 94 (type_specifier) + + +State 10 + + 95 type_specifier: INT . + + $default reduce using rule 95 (type_specifier) + + +State 11 + + 96 type_specifier: LONG . + + $default reduce using rule 96 (type_specifier) + + +State 12 + + 99 type_specifier: SIGNED . + + $default reduce using rule 99 (type_specifier) + + +State 13 + + 100 type_specifier: UNSIGNED . + + $default reduce using rule 100 (type_specifier) + + +State 14 + + 97 type_specifier: FLOAT . + + $default reduce using rule 97 (type_specifier) + + +State 15 + + 98 type_specifier: DOUBLE . + + $default reduce using rule 98 (type_specifier) + + +State 16 + + 128 type_qualifier: CONST . + + $default reduce using rule 128 (type_qualifier) + + +State 17 + + 129 type_qualifier: VOLATILE . + + $default reduce using rule 129 (type_qualifier) + + +State 18 + + 92 type_specifier: VOID . + + $default reduce using rule 92 (type_specifier) + + +State 19 + + 107 struct_or_union: STRUCT . + + $default reduce using rule 107 (struct_or_union) + + +State 20 + + 108 struct_or_union: UNION . + + $default reduce using rule 108 (struct_or_union) + + +State 21 + + 121 enum_specifier: ENUM . '{' enumerator_list '}' + 122 | ENUM . IDENTIFIER '{' enumerator_list '}' + 123 | ENUM . IDENTIFIER + + IDENTIFIER shift, and go to state 38 + '{' shift, and go to state 39 + + +State 22 + + 133 direct_declarator: '(' . declarator ')' + + IDENTIFIER shift, and go to state 1 + '(' shift, and go to state 22 + '*' shift, and go to state 23 + + declarator go to state 40 + direct_declarator go to state 33 + pointer go to state 34 + + +State 23 + + 139 pointer: '*' . + 140 | '*' . type_qualifier_list + 141 | '*' . pointer + 142 | '*' . type_qualifier_list pointer + + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + '*' shift, and go to state 23 + + $default reduce using rule 139 (pointer) + + type_qualifier go to state 41 + pointer go to state 42 + type_qualifier_list go to state 43 + + +State 24 + + 207 external_declaration: declaration . + + $default reduce using rule 207 (external_declaration) + + +State 25 + + 75 declaration: declaration_specifiers . ';' + 76 | declaration_specifiers . init_declarator_list ';' + 208 function_definition: declaration_specifiers . declarator declaration_list compound_statement + 209 | declaration_specifiers . declarator compound_statement + + IDENTIFIER shift, and go to state 1 + '(' shift, and go to state 22 + '*' shift, and go to state 23 + ';' shift, and go to state 44 + + init_declarator_list go to state 45 + init_declarator go to state 46 + declarator go to state 47 + direct_declarator go to state 33 + pointer go to state 34 + + +State 26 + + 77 declaration_specifiers: storage_class_specifier . + 78 | storage_class_specifier . declaration_specifiers + + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + + $default reduce using rule 77 (declaration_specifiers) + + declaration_specifiers go to state 48 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + + +State 27 + + 79 declaration_specifiers: type_specifier . + 80 | type_specifier . declaration_specifiers + + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + + $default reduce using rule 79 (declaration_specifiers) + + declaration_specifiers go to state 49 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + + +State 28 + + 101 type_specifier: struct_or_union_specifier . + + $default reduce using rule 101 (type_specifier) + + +State 29 + + 104 struct_or_union_specifier: struct_or_union . IDENTIFIER '{' struct_declaration_list '}' + 105 | struct_or_union . '{' struct_declaration_list '}' + 106 | struct_or_union . IDENTIFIER + + IDENTIFIER shift, and go to state 50 + '{' shift, and go to state 51 + + +State 30 + + 102 type_specifier: enum_specifier . + + $default reduce using rule 102 (type_specifier) + + +State 31 + + 81 declaration_specifiers: type_qualifier . + 82 | type_qualifier . declaration_specifiers + + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + + $default reduce using rule 81 (declaration_specifiers) + + declaration_specifiers go to state 52 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + + +State 32 + + 210 function_definition: declarator . declaration_list compound_statement + 211 | declarator . compound_statement + + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + '{' shift, and go to state 53 + + declaration go to state 54 + declaration_specifiers go to state 55 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + compound_statement go to state 56 + declaration_list go to state 57 + + +State 33 + + 131 declarator: direct_declarator . + 134 direct_declarator: direct_declarator . '[' constant_expression ']' + 135 | direct_declarator . '[' ']' + 136 | direct_declarator . '(' parameter_type_list ')' + 137 | direct_declarator . '(' identifier_list ')' + 138 | direct_declarator . '(' ')' + + '(' shift, and go to state 58 + '[' shift, and go to state 59 + + $default reduce using rule 131 (declarator) + + +State 34 + + 130 declarator: pointer . direct_declarator + + IDENTIFIER shift, and go to state 1 + '(' shift, and go to state 22 + + direct_declarator go to state 60 + + +State 35 + + 0 $accept: translation_unit . $end + 205 translation_unit: translation_unit . external_declaration + + $end shift, and go to state 61 + IDENTIFIER shift, and go to state 1 + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + '(' shift, and go to state 22 + '*' shift, and go to state 23 + + declaration go to state 24 + declaration_specifiers go to state 25 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + declarator go to state 32 + direct_declarator go to state 33 + pointer go to state 34 + external_declaration go to state 62 + function_definition go to state 37 + + +State 36 + + 204 translation_unit: external_declaration . + + $default reduce using rule 204 (translation_unit) + + +State 37 + + 206 external_declaration: function_definition . + + $default reduce using rule 206 (external_declaration) + + +State 38 + + 122 enum_specifier: ENUM IDENTIFIER . '{' enumerator_list '}' + 123 | ENUM IDENTIFIER . + + '{' shift, and go to state 63 + + $default reduce using rule 123 (enum_specifier) + + +State 39 + + 121 enum_specifier: ENUM '{' . enumerator_list '}' + + IDENTIFIER shift, and go to state 64 + + enumerator_list go to state 65 + enumerator go to state 66 + + +State 40 + + 133 direct_declarator: '(' declarator . ')' + + ')' shift, and go to state 67 + + +State 41 + + 143 type_qualifier_list: type_qualifier . + + $default reduce using rule 143 (type_qualifier_list) + + +State 42 + + 141 pointer: '*' pointer . + + $default reduce using rule 141 (pointer) + + +State 43 + + 140 pointer: '*' type_qualifier_list . + 142 | '*' type_qualifier_list . pointer + 144 type_qualifier_list: type_qualifier_list . type_qualifier + + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + '*' shift, and go to state 23 + + $default reduce using rule 140 (pointer) + + type_qualifier go to state 68 + pointer go to state 69 + + +State 44 + + 75 declaration: declaration_specifiers ';' . + + $default reduce using rule 75 (declaration) + + +State 45 + + 76 declaration: declaration_specifiers init_declarator_list . ';' + 84 init_declarator_list: init_declarator_list . ',' init_declarator + + ',' shift, and go to state 70 + ';' shift, and go to state 71 + + +State 46 + + 83 init_declarator_list: init_declarator . + + $default reduce using rule 83 (init_declarator_list) + + +State 47 + + 85 init_declarator: declarator . + 86 | declarator . '=' initializer + 208 function_definition: declaration_specifiers declarator . declaration_list compound_statement + 209 | declaration_specifiers declarator . compound_statement + + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + '=' shift, and go to state 72 + '{' shift, and go to state 53 + + $default reduce using rule 85 (init_declarator) + + declaration go to state 54 + declaration_specifiers go to state 55 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + compound_statement go to state 73 + declaration_list go to state 74 + + +State 48 + + 78 declaration_specifiers: storage_class_specifier declaration_specifiers . + + $default reduce using rule 78 (declaration_specifiers) + + +State 49 + + 80 declaration_specifiers: type_specifier declaration_specifiers . + + $default reduce using rule 80 (declaration_specifiers) + + +State 50 + + 104 struct_or_union_specifier: struct_or_union IDENTIFIER . '{' struct_declaration_list '}' + 106 | struct_or_union IDENTIFIER . + + '{' shift, and go to state 75 + + $default reduce using rule 106 (struct_or_union_specifier) + + +State 51 + + 105 struct_or_union_specifier: struct_or_union '{' . struct_declaration_list '}' + + TYPE_NAME shift, and go to state 2 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + + type_specifier go to state 76 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + struct_declaration_list go to state 77 + struct_declaration go to state 78 + specifier_qualifier_list go to state 79 + enum_specifier go to state 30 + type_qualifier go to state 80 + + +State 52 + + 82 declaration_specifiers: type_qualifier declaration_specifiers . + + $default reduce using rule 82 (declaration_specifiers) + + +State 53 + + 182 compound_statement: '{' . '}' + 183 | '{' . statement_list '}' + 184 | '{' . declaration_list '}' + 185 | '{' . declaration_list statement_list '}' + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + '}' shift, and go to state 106 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + declaration go to state 54 + declaration_specifiers go to state 55 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + statement go to state 125 + labeled_statement go to state 126 + compound_statement go to state 127 + declaration_list go to state 128 + statement_list go to state 129 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 54 + + 186 declaration_list: declaration . + + $default reduce using rule 186 (declaration_list) + + +State 55 + + 75 declaration: declaration_specifiers . ';' + 76 | declaration_specifiers . init_declarator_list ';' + + IDENTIFIER shift, and go to state 1 + '(' shift, and go to state 22 + '*' shift, and go to state 23 + ';' shift, and go to state 44 + + init_declarator_list go to state 45 + init_declarator go to state 46 + declarator go to state 134 + direct_declarator go to state 33 + pointer go to state 34 + + +State 56 + + 211 function_definition: declarator compound_statement . + + $default reduce using rule 211 (function_definition) + + +State 57 + + 187 declaration_list: declaration_list . declaration + 210 function_definition: declarator declaration_list . compound_statement + + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + '{' shift, and go to state 53 + + declaration go to state 135 + declaration_specifiers go to state 55 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + compound_statement go to state 136 + + +State 58 + + 136 direct_declarator: direct_declarator '(' . parameter_type_list ')' + 137 | direct_declarator '(' . identifier_list ')' + 138 | direct_declarator '(' . ')' + + IDENTIFIER shift, and go to state 137 + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + ')' shift, and go to state 138 + + declaration_specifiers go to state 139 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + parameter_type_list go to state 140 + parameter_list go to state 141 + parameter_declaration go to state 142 + identifier_list go to state 143 + + +State 59 + + 134 direct_declarator: direct_declarator '[' . constant_expression ']' + 135 | direct_declarator '[' . ']' + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + ']' shift, and go to state 145 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 147 + constant_expression go to state 148 + + +State 60 + + 130 declarator: pointer direct_declarator . + 134 direct_declarator: direct_declarator . '[' constant_expression ']' + 135 | direct_declarator . '[' ']' + 136 | direct_declarator . '(' parameter_type_list ')' + 137 | direct_declarator . '(' identifier_list ')' + 138 | direct_declarator . '(' ')' + + '(' shift, and go to state 58 + '[' shift, and go to state 59 + + $default reduce using rule 130 (declarator) + + +State 61 + + 0 $accept: translation_unit $end . + + $default accept + + +State 62 + + 205 translation_unit: translation_unit external_declaration . + + $default reduce using rule 205 (translation_unit) + + +State 63 + + 122 enum_specifier: ENUM IDENTIFIER '{' . enumerator_list '}' + + IDENTIFIER shift, and go to state 64 + + enumerator_list go to state 149 + enumerator go to state 66 + + +State 64 + + 126 enumerator: IDENTIFIER . + 127 | IDENTIFIER . '=' constant_expression + + '=' shift, and go to state 150 + + $default reduce using rule 126 (enumerator) + + +State 65 + + 121 enum_specifier: ENUM '{' enumerator_list . '}' + 125 enumerator_list: enumerator_list . ',' enumerator + + ',' shift, and go to state 151 + '}' shift, and go to state 152 + + +State 66 + + 124 enumerator_list: enumerator . + + $default reduce using rule 124 (enumerator_list) + + +State 67 + + 133 direct_declarator: '(' declarator ')' . + + $default reduce using rule 133 (direct_declarator) + + +State 68 + + 144 type_qualifier_list: type_qualifier_list type_qualifier . + + $default reduce using rule 144 (type_qualifier_list) + + +State 69 + + 142 pointer: '*' type_qualifier_list pointer . + + $default reduce using rule 142 (pointer) + + +State 70 + + 84 init_declarator_list: init_declarator_list ',' . init_declarator + + IDENTIFIER shift, and go to state 1 + '(' shift, and go to state 22 + '*' shift, and go to state 23 + + init_declarator go to state 153 + declarator go to state 134 + direct_declarator go to state 33 + pointer go to state 34 + + +State 71 + + 76 declaration: declaration_specifiers init_declarator_list ';' . + + $default reduce using rule 76 (declaration) + + +State 72 + + 86 init_declarator: declarator '=' . initializer + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + '{' shift, and go to state 154 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 155 + initializer go to state 156 + + +State 73 + + 209 function_definition: declaration_specifiers declarator compound_statement . + + $default reduce using rule 209 (function_definition) + + +State 74 + + 187 declaration_list: declaration_list . declaration + 208 function_definition: declaration_specifiers declarator declaration_list . compound_statement + + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + '{' shift, and go to state 53 + + declaration go to state 135 + declaration_specifiers go to state 55 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + compound_statement go to state 157 + + +State 75 + + 104 struct_or_union_specifier: struct_or_union IDENTIFIER '{' . struct_declaration_list '}' + + TYPE_NAME shift, and go to state 2 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + + type_specifier go to state 76 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + struct_declaration_list go to state 158 + struct_declaration go to state 78 + specifier_qualifier_list go to state 79 + enum_specifier go to state 30 + type_qualifier go to state 80 + + +State 76 + + 112 specifier_qualifier_list: type_specifier . specifier_qualifier_list + 113 | type_specifier . + + TYPE_NAME shift, and go to state 2 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + + $default reduce using rule 113 (specifier_qualifier_list) + + type_specifier go to state 76 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + specifier_qualifier_list go to state 159 + enum_specifier go to state 30 + type_qualifier go to state 80 + + +State 77 + + 105 struct_or_union_specifier: struct_or_union '{' struct_declaration_list . '}' + 110 struct_declaration_list: struct_declaration_list . struct_declaration + + TYPE_NAME shift, and go to state 2 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + '}' shift, and go to state 160 + + type_specifier go to state 76 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + struct_declaration go to state 161 + specifier_qualifier_list go to state 79 + enum_specifier go to state 30 + type_qualifier go to state 80 + + +State 78 + + 109 struct_declaration_list: struct_declaration . + + $default reduce using rule 109 (struct_declaration_list) + + +State 79 + + 111 struct_declaration: specifier_qualifier_list . struct_declarator_list ';' + + IDENTIFIER shift, and go to state 1 + '(' shift, and go to state 22 + '*' shift, and go to state 23 + ':' shift, and go to state 162 + + struct_declarator_list go to state 163 + struct_declarator go to state 164 + declarator go to state 165 + direct_declarator go to state 33 + pointer go to state 34 + + +State 80 + + 114 specifier_qualifier_list: type_qualifier . specifier_qualifier_list + 115 | type_qualifier . + + TYPE_NAME shift, and go to state 2 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + + $default reduce using rule 115 (specifier_qualifier_list) + + type_specifier go to state 76 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + specifier_qualifier_list go to state 166 + enum_specifier go to state 30 + type_qualifier go to state 80 + + +State 81 + + 1 primary_expression: IDENTIFIER . + 179 labeled_statement: IDENTIFIER . ':' statement + + ':' shift, and go to state 167 + + $default reduce using rule 1 (primary_expression) + + +State 82 + + 2 primary_expression: CONSTANT . + + $default reduce using rule 2 (primary_expression) + + +State 83 + + 3 primary_expression: STRING_LITERAL . + + $default reduce using rule 3 (primary_expression) + + +State 84 + + 19 unary_expression: SIZEOF . unary_expression + 20 | SIZEOF . '(' type_name ')' + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 168 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 169 + unary_operator go to state 110 + + +State 85 + + 16 unary_expression: INC_OP . unary_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 170 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 171 + unary_operator go to state 110 + + +State 86 + + 17 unary_expression: DEC_OP . unary_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 170 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 172 + unary_operator go to state 110 + + +State 87 + + 180 labeled_statement: CASE . constant_expression ':' statement + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 147 + constant_expression go to state 173 + + +State 88 + + 181 labeled_statement: DEFAULT . ':' statement + + ':' shift, and go to state 174 + + +State 89 + + 192 selection_statement: IF . '(' expression ')' statement + 193 | IF . '(' expression ')' statement ELSE statement + + '(' shift, and go to state 175 + + +State 90 + + 194 selection_statement: SWITCH . '(' expression ')' statement + + '(' shift, and go to state 176 + + +State 91 + + 195 iteration_statement: WHILE . '(' expression ')' statement + + '(' shift, and go to state 177 + + +State 92 + + 196 iteration_statement: DO . statement WHILE '(' expression ')' ';' + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + statement go to state 178 + labeled_statement go to state 126 + compound_statement go to state 127 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 93 + + 197 iteration_statement: FOR . '(' expression_statement expression_statement ')' statement + 198 | FOR . '(' expression_statement expression_statement expression ')' statement + + '(' shift, and go to state 179 + + +State 94 + + 199 jump_statement: GOTO . IDENTIFIER ';' + + IDENTIFIER shift, and go to state 180 + + +State 95 + + 200 jump_statement: CONTINUE . ';' + + ';' shift, and go to state 181 + + +State 96 + + 201 jump_statement: BREAK . ';' + + ';' shift, and go to state 182 + + +State 97 + + 202 jump_statement: RETURN . ';' + 203 | RETURN . expression ';' + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 183 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 184 + + +State 98 + + 4 primary_expression: '(' . expression ')' + 28 cast_expression: '(' . type_name ')' cast_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + TYPE_NAME shift, and go to state 2 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 185 + type_specifier go to state 76 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + specifier_qualifier_list go to state 186 + enum_specifier go to state 30 + type_qualifier go to state 80 + type_name go to state 187 + + +State 99 + + 21 unary_operator: '&' . + + $default reduce using rule 21 (unary_operator) + + +State 100 + + 22 unary_operator: '*' . + + $default reduce using rule 22 (unary_operator) + + +State 101 + + 23 unary_operator: '+' . + + $default reduce using rule 23 (unary_operator) + + +State 102 + + 24 unary_operator: '-' . + + $default reduce using rule 24 (unary_operator) + + +State 103 + + 25 unary_operator: '~' . + + $default reduce using rule 25 (unary_operator) + + +State 104 + + 26 unary_operator: '!' . + + $default reduce using rule 26 (unary_operator) + + +State 105 + + 190 expression_statement: ';' . + + $default reduce using rule 190 (expression_statement) + + +State 106 + + 182 compound_statement: '{' '}' . + + $default reduce using rule 182 (compound_statement) + + +State 107 + + 5 postfix_expression: primary_expression . + + $default reduce using rule 5 (postfix_expression) + + +State 108 + + 6 postfix_expression: postfix_expression . '[' expression ']' + 7 | postfix_expression . '(' ')' + 8 | postfix_expression . '(' argument_expression_list ')' + 9 | postfix_expression . '.' IDENTIFIER + 10 | postfix_expression . PTR_OP IDENTIFIER + 11 | postfix_expression . INC_OP + 12 | postfix_expression . DEC_OP + 15 unary_expression: postfix_expression . + + PTR_OP shift, and go to state 188 + INC_OP shift, and go to state 189 + DEC_OP shift, and go to state 190 + '(' shift, and go to state 191 + '[' shift, and go to state 192 + '.' shift, and go to state 193 + + $default reduce using rule 15 (unary_expression) + + +State 109 + + 27 cast_expression: unary_expression . + 60 assignment_expression: unary_expression . assignment_operator assignment_expression + + MUL_ASSIGN shift, and go to state 194 + DIV_ASSIGN shift, and go to state 195 + MOD_ASSIGN shift, and go to state 196 + ADD_ASSIGN shift, and go to state 197 + SUB_ASSIGN shift, and go to state 198 + LEFT_ASSIGN shift, and go to state 199 + RIGHT_ASSIGN shift, and go to state 200 + AND_ASSIGN shift, and go to state 201 + XOR_ASSIGN shift, and go to state 202 + OR_ASSIGN shift, and go to state 203 + '=' shift, and go to state 204 + + $default reduce using rule 27 (cast_expression) + + assignment_operator go to state 205 + + +State 110 + + 18 unary_expression: unary_operator . cast_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 206 + + +State 111 + + 29 multiplicative_expression: cast_expression . + + $default reduce using rule 29 (multiplicative_expression) + + +State 112 + + 30 multiplicative_expression: multiplicative_expression . '*' cast_expression + 31 | multiplicative_expression . '/' cast_expression + 32 | multiplicative_expression . '%' cast_expression + 33 additive_expression: multiplicative_expression . + + '*' shift, and go to state 207 + '/' shift, and go to state 208 + '%' shift, and go to state 209 + + $default reduce using rule 33 (additive_expression) + + +State 113 + + 34 additive_expression: additive_expression . '+' multiplicative_expression + 35 | additive_expression . '-' multiplicative_expression + 36 shift_expression: additive_expression . + + '+' shift, and go to state 210 + '-' shift, and go to state 211 + + $default reduce using rule 36 (shift_expression) + + +State 114 + + 37 shift_expression: shift_expression . LEFT_OP additive_expression + 38 | shift_expression . RIGHT_OP additive_expression + 39 relational_expression: shift_expression . + + LEFT_OP shift, and go to state 212 + RIGHT_OP shift, and go to state 213 + + $default reduce using rule 39 (relational_expression) + + +State 115 + + 40 relational_expression: relational_expression . '<' shift_expression + 41 | relational_expression . '>' shift_expression + 42 | relational_expression . LE_OP shift_expression + 43 | relational_expression . GE_OP shift_expression + 44 equality_expression: relational_expression . + + LE_OP shift, and go to state 214 + GE_OP shift, and go to state 215 + '<' shift, and go to state 216 + '>' shift, and go to state 217 + + $default reduce using rule 44 (equality_expression) + + +State 116 + + 45 equality_expression: equality_expression . EQ_OP relational_expression + 46 | equality_expression . NE_OP relational_expression + 47 and_expression: equality_expression . + + EQ_OP shift, and go to state 218 + NE_OP shift, and go to state 219 + + $default reduce using rule 47 (and_expression) + + +State 117 + + 48 and_expression: and_expression . '&' equality_expression + 49 exclusive_or_expression: and_expression . + + '&' shift, and go to state 220 + + $default reduce using rule 49 (exclusive_or_expression) + + +State 118 + + 50 exclusive_or_expression: exclusive_or_expression . '^' and_expression + 51 inclusive_or_expression: exclusive_or_expression . + + '^' shift, and go to state 221 + + $default reduce using rule 51 (inclusive_or_expression) + + +State 119 + + 52 inclusive_or_expression: inclusive_or_expression . '|' exclusive_or_expression + 53 logical_and_expression: inclusive_or_expression . + + '|' shift, and go to state 222 + + $default reduce using rule 53 (logical_and_expression) + + +State 120 + + 54 logical_and_expression: logical_and_expression . AND_OP inclusive_or_expression + 55 logical_or_expression: logical_and_expression . + + AND_OP shift, and go to state 223 + + $default reduce using rule 55 (logical_or_expression) + + +State 121 + + 56 logical_or_expression: logical_or_expression . OR_OP logical_and_expression + 57 conditional_expression: logical_or_expression . + 58 | logical_or_expression . '?' expression ':' conditional_expression + + OR_OP shift, and go to state 224 + '?' shift, and go to state 225 + + $default reduce using rule 57 (conditional_expression) + + +State 122 + + 59 assignment_expression: conditional_expression . + + $default reduce using rule 59 (assignment_expression) + + +State 123 + + 72 expression: assignment_expression . + + $default reduce using rule 72 (expression) + + +State 124 + + 73 expression: expression . ',' assignment_expression + 191 expression_statement: expression . ';' + + ',' shift, and go to state 226 + ';' shift, and go to state 227 + + +State 125 + + 188 statement_list: statement . + + $default reduce using rule 188 (statement_list) + + +State 126 + + 173 statement: labeled_statement . + + $default reduce using rule 173 (statement) + + +State 127 + + 174 statement: compound_statement . + + $default reduce using rule 174 (statement) + + +State 128 + + 184 compound_statement: '{' declaration_list . '}' + 185 | '{' declaration_list . statement_list '}' + 187 declaration_list: declaration_list . declaration + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + '}' shift, and go to state 228 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + declaration go to state 135 + declaration_specifiers go to state 55 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + statement go to state 125 + labeled_statement go to state 126 + compound_statement go to state 127 + statement_list go to state 229 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 129 + + 183 compound_statement: '{' statement_list . '}' + 189 statement_list: statement_list . statement + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + '}' shift, and go to state 230 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + statement go to state 231 + labeled_statement go to state 126 + compound_statement go to state 127 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 130 + + 175 statement: expression_statement . + + $default reduce using rule 175 (statement) + + +State 131 + + 176 statement: selection_statement . + + $default reduce using rule 176 (statement) + + +State 132 + + 177 statement: iteration_statement . + + $default reduce using rule 177 (statement) + + +State 133 + + 178 statement: jump_statement . + + $default reduce using rule 178 (statement) + + +State 134 + + 85 init_declarator: declarator . + 86 | declarator . '=' initializer + + '=' shift, and go to state 72 + + $default reduce using rule 85 (init_declarator) + + +State 135 + + 187 declaration_list: declaration_list declaration . + + $default reduce using rule 187 (declaration_list) + + +State 136 + + 210 function_definition: declarator declaration_list compound_statement . + + $default reduce using rule 210 (function_definition) + + +State 137 + + 152 identifier_list: IDENTIFIER . + + $default reduce using rule 152 (identifier_list) + + +State 138 + + 138 direct_declarator: direct_declarator '(' ')' . + + $default reduce using rule 138 (direct_declarator) + + +State 139 + + 149 parameter_declaration: declaration_specifiers . declarator + 150 | declaration_specifiers . abstract_declarator + 151 | declaration_specifiers . + + IDENTIFIER shift, and go to state 1 + '(' shift, and go to state 232 + '[' shift, and go to state 233 + '*' shift, and go to state 23 + + $default reduce using rule 151 (parameter_declaration) + + declarator go to state 234 + direct_declarator go to state 33 + pointer go to state 235 + abstract_declarator go to state 236 + direct_abstract_declarator go to state 237 + + +State 140 + + 136 direct_declarator: direct_declarator '(' parameter_type_list . ')' + + ')' shift, and go to state 238 + + +State 141 + + 145 parameter_type_list: parameter_list . + 146 | parameter_list . ',' ELLIPSIS + 148 parameter_list: parameter_list . ',' parameter_declaration + + ',' shift, and go to state 239 + + $default reduce using rule 145 (parameter_type_list) + + +State 142 + + 147 parameter_list: parameter_declaration . + + $default reduce using rule 147 (parameter_list) + + +State 143 + + 137 direct_declarator: direct_declarator '(' identifier_list . ')' + 153 identifier_list: identifier_list . ',' IDENTIFIER + + ')' shift, and go to state 240 + ',' shift, and go to state 241 + + +State 144 + + 1 primary_expression: IDENTIFIER . + + $default reduce using rule 1 (primary_expression) + + +State 145 + + 135 direct_declarator: direct_declarator '[' ']' . + + $default reduce using rule 135 (direct_declarator) + + +State 146 + + 27 cast_expression: unary_expression . + + $default reduce using rule 27 (cast_expression) + + +State 147 + + 74 constant_expression: conditional_expression . + + $default reduce using rule 74 (constant_expression) + + +State 148 + + 134 direct_declarator: direct_declarator '[' constant_expression . ']' + + ']' shift, and go to state 242 + + +State 149 + + 122 enum_specifier: ENUM IDENTIFIER '{' enumerator_list . '}' + 125 enumerator_list: enumerator_list . ',' enumerator + + ',' shift, and go to state 151 + '}' shift, and go to state 243 + + +State 150 + + 127 enumerator: IDENTIFIER '=' . constant_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 147 + constant_expression go to state 244 + + +State 151 + + 125 enumerator_list: enumerator_list ',' . enumerator + + IDENTIFIER shift, and go to state 64 + + enumerator go to state 245 + + +State 152 + + 121 enum_specifier: ENUM '{' enumerator_list '}' . + + $default reduce using rule 121 (enum_specifier) + + +State 153 + + 84 init_declarator_list: init_declarator_list ',' init_declarator . + + $default reduce using rule 84 (init_declarator_list) + + +State 154 + + 169 initializer: '{' . initializer_list '}' + 170 | '{' . initializer_list ',' '}' + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + '{' shift, and go to state 154 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 155 + initializer go to state 246 + initializer_list go to state 247 + + +State 155 + + 168 initializer: assignment_expression . + + $default reduce using rule 168 (initializer) + + +State 156 + + 86 init_declarator: declarator '=' initializer . + + $default reduce using rule 86 (init_declarator) + + +State 157 + + 208 function_definition: declaration_specifiers declarator declaration_list compound_statement . + + $default reduce using rule 208 (function_definition) + + +State 158 + + 104 struct_or_union_specifier: struct_or_union IDENTIFIER '{' struct_declaration_list . '}' + 110 struct_declaration_list: struct_declaration_list . struct_declaration + + TYPE_NAME shift, and go to state 2 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + '}' shift, and go to state 248 + + type_specifier go to state 76 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + struct_declaration go to state 161 + specifier_qualifier_list go to state 79 + enum_specifier go to state 30 + type_qualifier go to state 80 + + +State 159 + + 112 specifier_qualifier_list: type_specifier specifier_qualifier_list . + + $default reduce using rule 112 (specifier_qualifier_list) + + +State 160 + + 105 struct_or_union_specifier: struct_or_union '{' struct_declaration_list '}' . + + $default reduce using rule 105 (struct_or_union_specifier) + + +State 161 + + 110 struct_declaration_list: struct_declaration_list struct_declaration . + + $default reduce using rule 110 (struct_declaration_list) + + +State 162 + + 119 struct_declarator: ':' . constant_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 147 + constant_expression go to state 249 + + +State 163 + + 111 struct_declaration: specifier_qualifier_list struct_declarator_list . ';' + 117 struct_declarator_list: struct_declarator_list . ',' struct_declarator + + ',' shift, and go to state 250 + ';' shift, and go to state 251 + + +State 164 + + 116 struct_declarator_list: struct_declarator . + + $default reduce using rule 116 (struct_declarator_list) + + +State 165 + + 118 struct_declarator: declarator . + 120 | declarator . ':' constant_expression + + ':' shift, and go to state 252 + + $default reduce using rule 118 (struct_declarator) + + +State 166 + + 114 specifier_qualifier_list: type_qualifier specifier_qualifier_list . + + $default reduce using rule 114 (specifier_qualifier_list) + + +State 167 + + 179 labeled_statement: IDENTIFIER ':' . statement + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + statement go to state 253 + labeled_statement go to state 126 + compound_statement go to state 127 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 168 + + 4 primary_expression: '(' . expression ')' + 20 unary_expression: SIZEOF '(' . type_name ')' + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + TYPE_NAME shift, and go to state 2 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 185 + type_specifier go to state 76 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + specifier_qualifier_list go to state 186 + enum_specifier go to state 30 + type_qualifier go to state 80 + type_name go to state 254 + + +State 169 + + 19 unary_expression: SIZEOF unary_expression . + + $default reduce using rule 19 (unary_expression) + + +State 170 + + 4 primary_expression: '(' . expression ')' + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 185 + + +State 171 + + 16 unary_expression: INC_OP unary_expression . + + $default reduce using rule 16 (unary_expression) + + +State 172 + + 17 unary_expression: DEC_OP unary_expression . + + $default reduce using rule 17 (unary_expression) + + +State 173 + + 180 labeled_statement: CASE constant_expression . ':' statement + + ':' shift, and go to state 255 + + +State 174 + + 181 labeled_statement: DEFAULT ':' . statement + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + statement go to state 256 + labeled_statement go to state 126 + compound_statement go to state 127 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 175 + + 192 selection_statement: IF '(' . expression ')' statement + 193 | IF '(' . expression ')' statement ELSE statement + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 257 + + +State 176 + + 194 selection_statement: SWITCH '(' . expression ')' statement + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 258 + + +State 177 + + 195 iteration_statement: WHILE '(' . expression ')' statement + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 259 + + +State 178 + + 196 iteration_statement: DO statement . WHILE '(' expression ')' ';' + + WHILE shift, and go to state 260 + + +State 179 + + 197 iteration_statement: FOR '(' . expression_statement expression_statement ')' statement + 198 | FOR '(' . expression_statement expression_statement expression ')' statement + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + expression_statement go to state 261 + + +State 180 + + 199 jump_statement: GOTO IDENTIFIER . ';' + + ';' shift, and go to state 262 + + +State 181 + + 200 jump_statement: CONTINUE ';' . + + $default reduce using rule 200 (jump_statement) + + +State 182 + + 201 jump_statement: BREAK ';' . + + $default reduce using rule 201 (jump_statement) + + +State 183 + + 202 jump_statement: RETURN ';' . + + $default reduce using rule 202 (jump_statement) + + +State 184 + + 73 expression: expression . ',' assignment_expression + 203 jump_statement: RETURN expression . ';' + + ',' shift, and go to state 226 + ';' shift, and go to state 263 + + +State 185 + + 4 primary_expression: '(' expression . ')' + 73 expression: expression . ',' assignment_expression + + ')' shift, and go to state 264 + ',' shift, and go to state 226 + + +State 186 + + 154 type_name: specifier_qualifier_list . + 155 | specifier_qualifier_list . abstract_declarator + + '(' shift, and go to state 265 + '[' shift, and go to state 233 + '*' shift, and go to state 23 + + $default reduce using rule 154 (type_name) + + pointer go to state 266 + abstract_declarator go to state 267 + direct_abstract_declarator go to state 237 + + +State 187 + + 28 cast_expression: '(' type_name . ')' cast_expression + + ')' shift, and go to state 268 + + +State 188 + + 10 postfix_expression: postfix_expression PTR_OP . IDENTIFIER + + IDENTIFIER shift, and go to state 269 + + +State 189 + + 11 postfix_expression: postfix_expression INC_OP . + + $default reduce using rule 11 (postfix_expression) + + +State 190 + + 12 postfix_expression: postfix_expression DEC_OP . + + $default reduce using rule 12 (postfix_expression) + + +State 191 + + 7 postfix_expression: postfix_expression '(' . ')' + 8 | postfix_expression '(' . argument_expression_list ')' + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + ')' shift, and go to state 270 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + argument_expression_list go to state 271 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 272 + + +State 192 + + 6 postfix_expression: postfix_expression '[' . expression ']' + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 273 + + +State 193 + + 9 postfix_expression: postfix_expression '.' . IDENTIFIER + + IDENTIFIER shift, and go to state 274 + + +State 194 + + 62 assignment_operator: MUL_ASSIGN . + + $default reduce using rule 62 (assignment_operator) + + +State 195 + + 63 assignment_operator: DIV_ASSIGN . + + $default reduce using rule 63 (assignment_operator) + + +State 196 + + 64 assignment_operator: MOD_ASSIGN . + + $default reduce using rule 64 (assignment_operator) + + +State 197 + + 65 assignment_operator: ADD_ASSIGN . + + $default reduce using rule 65 (assignment_operator) + + +State 198 + + 66 assignment_operator: SUB_ASSIGN . + + $default reduce using rule 66 (assignment_operator) + + +State 199 + + 67 assignment_operator: LEFT_ASSIGN . + + $default reduce using rule 67 (assignment_operator) + + +State 200 + + 68 assignment_operator: RIGHT_ASSIGN . + + $default reduce using rule 68 (assignment_operator) + + +State 201 + + 69 assignment_operator: AND_ASSIGN . + + $default reduce using rule 69 (assignment_operator) + + +State 202 + + 70 assignment_operator: XOR_ASSIGN . + + $default reduce using rule 70 (assignment_operator) + + +State 203 + + 71 assignment_operator: OR_ASSIGN . + + $default reduce using rule 71 (assignment_operator) + + +State 204 + + 61 assignment_operator: '=' . + + $default reduce using rule 61 (assignment_operator) + + +State 205 + + 60 assignment_expression: unary_expression assignment_operator . assignment_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 275 + + +State 206 + + 18 unary_expression: unary_operator cast_expression . + + $default reduce using rule 18 (unary_expression) + + +State 207 + + 30 multiplicative_expression: multiplicative_expression '*' . cast_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 276 + + +State 208 + + 31 multiplicative_expression: multiplicative_expression '/' . cast_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 277 + + +State 209 + + 32 multiplicative_expression: multiplicative_expression '%' . cast_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 278 + + +State 210 + + 34 additive_expression: additive_expression '+' . multiplicative_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 279 + + +State 211 + + 35 additive_expression: additive_expression '-' . multiplicative_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 280 + + +State 212 + + 37 shift_expression: shift_expression LEFT_OP . additive_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 281 + + +State 213 + + 38 shift_expression: shift_expression RIGHT_OP . additive_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 282 + + +State 214 + + 42 relational_expression: relational_expression LE_OP . shift_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 283 + + +State 215 + + 43 relational_expression: relational_expression GE_OP . shift_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 284 + + +State 216 + + 40 relational_expression: relational_expression '<' . shift_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 285 + + +State 217 + + 41 relational_expression: relational_expression '>' . shift_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 286 + + +State 218 + + 45 equality_expression: equality_expression EQ_OP . relational_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 287 + + +State 219 + + 46 equality_expression: equality_expression NE_OP . relational_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 288 + + +State 220 + + 48 and_expression: and_expression '&' . equality_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 289 + + +State 221 + + 50 exclusive_or_expression: exclusive_or_expression '^' . and_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 290 + + +State 222 + + 52 inclusive_or_expression: inclusive_or_expression '|' . exclusive_or_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 291 + + +State 223 + + 54 logical_and_expression: logical_and_expression AND_OP . inclusive_or_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 292 + + +State 224 + + 56 logical_or_expression: logical_or_expression OR_OP . logical_and_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 293 + + +State 225 + + 58 conditional_expression: logical_or_expression '?' . expression ':' conditional_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 294 + + +State 226 + + 73 expression: expression ',' . assignment_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 295 + + +State 227 + + 191 expression_statement: expression ';' . + + $default reduce using rule 191 (expression_statement) + + +State 228 + + 184 compound_statement: '{' declaration_list '}' . + + $default reduce using rule 184 (compound_statement) + + +State 229 + + 185 compound_statement: '{' declaration_list statement_list . '}' + 189 statement_list: statement_list . statement + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + '}' shift, and go to state 296 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + statement go to state 231 + labeled_statement go to state 126 + compound_statement go to state 127 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 230 + + 183 compound_statement: '{' statement_list '}' . + + $default reduce using rule 183 (compound_statement) + + +State 231 + + 189 statement_list: statement_list statement . + + $default reduce using rule 189 (statement_list) + + +State 232 + + 133 direct_declarator: '(' . declarator ')' + 159 direct_abstract_declarator: '(' . abstract_declarator ')' + 164 | '(' . ')' + 165 | '(' . parameter_type_list ')' + + IDENTIFIER shift, and go to state 1 + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + '(' shift, and go to state 232 + ')' shift, and go to state 297 + '[' shift, and go to state 233 + '*' shift, and go to state 23 + + declaration_specifiers go to state 139 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + declarator go to state 40 + direct_declarator go to state 33 + pointer go to state 235 + parameter_type_list go to state 298 + parameter_list go to state 141 + parameter_declaration go to state 142 + abstract_declarator go to state 299 + direct_abstract_declarator go to state 237 + + +State 233 + + 160 direct_abstract_declarator: '[' . ']' + 161 | '[' . constant_expression ']' + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + ']' shift, and go to state 300 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 147 + constant_expression go to state 301 + + +State 234 + + 149 parameter_declaration: declaration_specifiers declarator . + + $default reduce using rule 149 (parameter_declaration) + + +State 235 + + 130 declarator: pointer . direct_declarator + 156 abstract_declarator: pointer . + 158 | pointer . direct_abstract_declarator + + IDENTIFIER shift, and go to state 1 + '(' shift, and go to state 232 + '[' shift, and go to state 233 + + $default reduce using rule 156 (abstract_declarator) + + direct_declarator go to state 60 + direct_abstract_declarator go to state 302 + + +State 236 + + 150 parameter_declaration: declaration_specifiers abstract_declarator . + + $default reduce using rule 150 (parameter_declaration) + + +State 237 + + 157 abstract_declarator: direct_abstract_declarator . + 162 direct_abstract_declarator: direct_abstract_declarator . '[' ']' + 163 | direct_abstract_declarator . '[' constant_expression ']' + 166 | direct_abstract_declarator . '(' ')' + 167 | direct_abstract_declarator . '(' parameter_type_list ')' + + '(' shift, and go to state 303 + '[' shift, and go to state 304 + + $default reduce using rule 157 (abstract_declarator) + + +State 238 + + 136 direct_declarator: direct_declarator '(' parameter_type_list ')' . + + $default reduce using rule 136 (direct_declarator) + + +State 239 + + 146 parameter_type_list: parameter_list ',' . ELLIPSIS + 148 parameter_list: parameter_list ',' . parameter_declaration + + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + ELLIPSIS shift, and go to state 305 + + declaration_specifiers go to state 139 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + parameter_declaration go to state 306 + + +State 240 + + 137 direct_declarator: direct_declarator '(' identifier_list ')' . + + $default reduce using rule 137 (direct_declarator) + + +State 241 + + 153 identifier_list: identifier_list ',' . IDENTIFIER + + IDENTIFIER shift, and go to state 307 + + +State 242 + + 134 direct_declarator: direct_declarator '[' constant_expression ']' . + + $default reduce using rule 134 (direct_declarator) + + +State 243 + + 122 enum_specifier: ENUM IDENTIFIER '{' enumerator_list '}' . + + $default reduce using rule 122 (enum_specifier) + + +State 244 + + 127 enumerator: IDENTIFIER '=' constant_expression . + + $default reduce using rule 127 (enumerator) + + +State 245 + + 125 enumerator_list: enumerator_list ',' enumerator . + + $default reduce using rule 125 (enumerator_list) + + +State 246 + + 171 initializer_list: initializer . + + $default reduce using rule 171 (initializer_list) + + +State 247 + + 169 initializer: '{' initializer_list . '}' + 170 | '{' initializer_list . ',' '}' + 172 initializer_list: initializer_list . ',' initializer + + ',' shift, and go to state 308 + '}' shift, and go to state 309 + + +State 248 + + 104 struct_or_union_specifier: struct_or_union IDENTIFIER '{' struct_declaration_list '}' . + + $default reduce using rule 104 (struct_or_union_specifier) + + +State 249 + + 119 struct_declarator: ':' constant_expression . + + $default reduce using rule 119 (struct_declarator) + + +State 250 + + 117 struct_declarator_list: struct_declarator_list ',' . struct_declarator + + IDENTIFIER shift, and go to state 1 + '(' shift, and go to state 22 + '*' shift, and go to state 23 + ':' shift, and go to state 162 + + struct_declarator go to state 310 + declarator go to state 165 + direct_declarator go to state 33 + pointer go to state 34 + + +State 251 + + 111 struct_declaration: specifier_qualifier_list struct_declarator_list ';' . + + $default reduce using rule 111 (struct_declaration) + + +State 252 + + 120 struct_declarator: declarator ':' . constant_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 147 + constant_expression go to state 311 + + +State 253 + + 179 labeled_statement: IDENTIFIER ':' statement . + + $default reduce using rule 179 (labeled_statement) + + +State 254 + + 20 unary_expression: SIZEOF '(' type_name . ')' + + ')' shift, and go to state 312 + + +State 255 + + 180 labeled_statement: CASE constant_expression ':' . statement + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + statement go to state 313 + labeled_statement go to state 126 + compound_statement go to state 127 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 256 + + 181 labeled_statement: DEFAULT ':' statement . + + $default reduce using rule 181 (labeled_statement) + + +State 257 + + 73 expression: expression . ',' assignment_expression + 192 selection_statement: IF '(' expression . ')' statement + 193 | IF '(' expression . ')' statement ELSE statement + + ')' shift, and go to state 314 + ',' shift, and go to state 226 + + +State 258 + + 73 expression: expression . ',' assignment_expression + 194 selection_statement: SWITCH '(' expression . ')' statement + + ')' shift, and go to state 315 + ',' shift, and go to state 226 + + +State 259 + + 73 expression: expression . ',' assignment_expression + 195 iteration_statement: WHILE '(' expression . ')' statement + + ')' shift, and go to state 316 + ',' shift, and go to state 226 + + +State 260 + + 196 iteration_statement: DO statement WHILE . '(' expression ')' ';' + + '(' shift, and go to state 317 + + +State 261 + + 197 iteration_statement: FOR '(' expression_statement . expression_statement ')' statement + 198 | FOR '(' expression_statement . expression_statement expression ')' statement + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + expression_statement go to state 318 + + +State 262 + + 199 jump_statement: GOTO IDENTIFIER ';' . + + $default reduce using rule 199 (jump_statement) + + +State 263 + + 203 jump_statement: RETURN expression ';' . + + $default reduce using rule 203 (jump_statement) + + +State 264 + + 4 primary_expression: '(' expression ')' . + + $default reduce using rule 4 (primary_expression) + + +State 265 + + 159 direct_abstract_declarator: '(' . abstract_declarator ')' + 164 | '(' . ')' + 165 | '(' . parameter_type_list ')' + + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + '(' shift, and go to state 265 + ')' shift, and go to state 297 + '[' shift, and go to state 233 + '*' shift, and go to state 23 + + declaration_specifiers go to state 139 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + pointer go to state 266 + parameter_type_list go to state 298 + parameter_list go to state 141 + parameter_declaration go to state 142 + abstract_declarator go to state 299 + direct_abstract_declarator go to state 237 + + +State 266 + + 156 abstract_declarator: pointer . + 158 | pointer . direct_abstract_declarator + + '(' shift, and go to state 265 + '[' shift, and go to state 233 + + $default reduce using rule 156 (abstract_declarator) + + direct_abstract_declarator go to state 302 + + +State 267 + + 155 type_name: specifier_qualifier_list abstract_declarator . + + $default reduce using rule 155 (type_name) + + +State 268 + + 28 cast_expression: '(' type_name ')' . cast_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 319 + + +State 269 + + 10 postfix_expression: postfix_expression PTR_OP IDENTIFIER . + + $default reduce using rule 10 (postfix_expression) + + +State 270 + + 7 postfix_expression: postfix_expression '(' ')' . + + $default reduce using rule 7 (postfix_expression) + + +State 271 + + 8 postfix_expression: postfix_expression '(' argument_expression_list . ')' + 14 argument_expression_list: argument_expression_list . ',' assignment_expression + + ')' shift, and go to state 320 + ',' shift, and go to state 321 + + +State 272 + + 13 argument_expression_list: assignment_expression . + + $default reduce using rule 13 (argument_expression_list) + + +State 273 + + 6 postfix_expression: postfix_expression '[' expression . ']' + 73 expression: expression . ',' assignment_expression + + ']' shift, and go to state 322 + ',' shift, and go to state 226 + + +State 274 + + 9 postfix_expression: postfix_expression '.' IDENTIFIER . + + $default reduce using rule 9 (postfix_expression) + + +State 275 + + 60 assignment_expression: unary_expression assignment_operator assignment_expression . + + $default reduce using rule 60 (assignment_expression) + + +State 276 + + 30 multiplicative_expression: multiplicative_expression '*' cast_expression . + + $default reduce using rule 30 (multiplicative_expression) + + +State 277 + + 31 multiplicative_expression: multiplicative_expression '/' cast_expression . + + $default reduce using rule 31 (multiplicative_expression) + + +State 278 + + 32 multiplicative_expression: multiplicative_expression '%' cast_expression . + + $default reduce using rule 32 (multiplicative_expression) + + +State 279 + + 30 multiplicative_expression: multiplicative_expression . '*' cast_expression + 31 | multiplicative_expression . '/' cast_expression + 32 | multiplicative_expression . '%' cast_expression + 34 additive_expression: additive_expression '+' multiplicative_expression . + + '*' shift, and go to state 207 + '/' shift, and go to state 208 + '%' shift, and go to state 209 + + $default reduce using rule 34 (additive_expression) + + +State 280 + + 30 multiplicative_expression: multiplicative_expression . '*' cast_expression + 31 | multiplicative_expression . '/' cast_expression + 32 | multiplicative_expression . '%' cast_expression + 35 additive_expression: additive_expression '-' multiplicative_expression . + + '*' shift, and go to state 207 + '/' shift, and go to state 208 + '%' shift, and go to state 209 + + $default reduce using rule 35 (additive_expression) + + +State 281 + + 34 additive_expression: additive_expression . '+' multiplicative_expression + 35 | additive_expression . '-' multiplicative_expression + 37 shift_expression: shift_expression LEFT_OP additive_expression . + + '+' shift, and go to state 210 + '-' shift, and go to state 211 + + $default reduce using rule 37 (shift_expression) + + +State 282 + + 34 additive_expression: additive_expression . '+' multiplicative_expression + 35 | additive_expression . '-' multiplicative_expression + 38 shift_expression: shift_expression RIGHT_OP additive_expression . + + '+' shift, and go to state 210 + '-' shift, and go to state 211 + + $default reduce using rule 38 (shift_expression) + + +State 283 + + 37 shift_expression: shift_expression . LEFT_OP additive_expression + 38 | shift_expression . RIGHT_OP additive_expression + 42 relational_expression: relational_expression LE_OP shift_expression . + + LEFT_OP shift, and go to state 212 + RIGHT_OP shift, and go to state 213 + + $default reduce using rule 42 (relational_expression) + + +State 284 + + 37 shift_expression: shift_expression . LEFT_OP additive_expression + 38 | shift_expression . RIGHT_OP additive_expression + 43 relational_expression: relational_expression GE_OP shift_expression . + + LEFT_OP shift, and go to state 212 + RIGHT_OP shift, and go to state 213 + + $default reduce using rule 43 (relational_expression) + + +State 285 + + 37 shift_expression: shift_expression . LEFT_OP additive_expression + 38 | shift_expression . RIGHT_OP additive_expression + 40 relational_expression: relational_expression '<' shift_expression . + + LEFT_OP shift, and go to state 212 + RIGHT_OP shift, and go to state 213 + + $default reduce using rule 40 (relational_expression) + + +State 286 + + 37 shift_expression: shift_expression . LEFT_OP additive_expression + 38 | shift_expression . RIGHT_OP additive_expression + 41 relational_expression: relational_expression '>' shift_expression . + + LEFT_OP shift, and go to state 212 + RIGHT_OP shift, and go to state 213 + + $default reduce using rule 41 (relational_expression) + + +State 287 + + 40 relational_expression: relational_expression . '<' shift_expression + 41 | relational_expression . '>' shift_expression + 42 | relational_expression . LE_OP shift_expression + 43 | relational_expression . GE_OP shift_expression + 45 equality_expression: equality_expression EQ_OP relational_expression . + + LE_OP shift, and go to state 214 + GE_OP shift, and go to state 215 + '<' shift, and go to state 216 + '>' shift, and go to state 217 + + $default reduce using rule 45 (equality_expression) + + +State 288 + + 40 relational_expression: relational_expression . '<' shift_expression + 41 | relational_expression . '>' shift_expression + 42 | relational_expression . LE_OP shift_expression + 43 | relational_expression . GE_OP shift_expression + 46 equality_expression: equality_expression NE_OP relational_expression . + + LE_OP shift, and go to state 214 + GE_OP shift, and go to state 215 + '<' shift, and go to state 216 + '>' shift, and go to state 217 + + $default reduce using rule 46 (equality_expression) + + +State 289 + + 45 equality_expression: equality_expression . EQ_OP relational_expression + 46 | equality_expression . NE_OP relational_expression + 48 and_expression: and_expression '&' equality_expression . + + EQ_OP shift, and go to state 218 + NE_OP shift, and go to state 219 + + $default reduce using rule 48 (and_expression) + + +State 290 + + 48 and_expression: and_expression . '&' equality_expression + 50 exclusive_or_expression: exclusive_or_expression '^' and_expression . + + '&' shift, and go to state 220 + + $default reduce using rule 50 (exclusive_or_expression) + + +State 291 + + 50 exclusive_or_expression: exclusive_or_expression . '^' and_expression + 52 inclusive_or_expression: inclusive_or_expression '|' exclusive_or_expression . + + '^' shift, and go to state 221 + + $default reduce using rule 52 (inclusive_or_expression) + + +State 292 + + 52 inclusive_or_expression: inclusive_or_expression . '|' exclusive_or_expression + 54 logical_and_expression: logical_and_expression AND_OP inclusive_or_expression . + + '|' shift, and go to state 222 + + $default reduce using rule 54 (logical_and_expression) + + +State 293 + + 54 logical_and_expression: logical_and_expression . AND_OP inclusive_or_expression + 56 logical_or_expression: logical_or_expression OR_OP logical_and_expression . + + AND_OP shift, and go to state 223 + + $default reduce using rule 56 (logical_or_expression) + + +State 294 + + 58 conditional_expression: logical_or_expression '?' expression . ':' conditional_expression + 73 expression: expression . ',' assignment_expression + + ',' shift, and go to state 226 + ':' shift, and go to state 323 + + +State 295 + + 73 expression: expression ',' assignment_expression . + + $default reduce using rule 73 (expression) + + +State 296 + + 185 compound_statement: '{' declaration_list statement_list '}' . + + $default reduce using rule 185 (compound_statement) + + +State 297 + + 164 direct_abstract_declarator: '(' ')' . + + $default reduce using rule 164 (direct_abstract_declarator) + + +State 298 + + 165 direct_abstract_declarator: '(' parameter_type_list . ')' + + ')' shift, and go to state 324 + + +State 299 + + 159 direct_abstract_declarator: '(' abstract_declarator . ')' + + ')' shift, and go to state 325 + + +State 300 + + 160 direct_abstract_declarator: '[' ']' . + + $default reduce using rule 160 (direct_abstract_declarator) + + +State 301 + + 161 direct_abstract_declarator: '[' constant_expression . ']' + + ']' shift, and go to state 326 + + +State 302 + + 158 abstract_declarator: pointer direct_abstract_declarator . + 162 direct_abstract_declarator: direct_abstract_declarator . '[' ']' + 163 | direct_abstract_declarator . '[' constant_expression ']' + 166 | direct_abstract_declarator . '(' ')' + 167 | direct_abstract_declarator . '(' parameter_type_list ')' + + '(' shift, and go to state 303 + '[' shift, and go to state 304 + + $default reduce using rule 158 (abstract_declarator) + + +State 303 + + 166 direct_abstract_declarator: direct_abstract_declarator '(' . ')' + 167 | direct_abstract_declarator '(' . parameter_type_list ')' + + TYPE_NAME shift, and go to state 2 + TYPEDEF shift, and go to state 3 + EXTERN shift, and go to state 4 + STATIC shift, and go to state 5 + AUTO shift, and go to state 6 + REGISTER shift, and go to state 7 + CHAR shift, and go to state 8 + SHORT shift, and go to state 9 + INT shift, and go to state 10 + LONG shift, and go to state 11 + SIGNED shift, and go to state 12 + UNSIGNED shift, and go to state 13 + FLOAT shift, and go to state 14 + DOUBLE shift, and go to state 15 + CONST shift, and go to state 16 + VOLATILE shift, and go to state 17 + VOID shift, and go to state 18 + STRUCT shift, and go to state 19 + UNION shift, and go to state 20 + ENUM shift, and go to state 21 + ')' shift, and go to state 327 + + declaration_specifiers go to state 139 + storage_class_specifier go to state 26 + type_specifier go to state 27 + struct_or_union_specifier go to state 28 + struct_or_union go to state 29 + enum_specifier go to state 30 + type_qualifier go to state 31 + parameter_type_list go to state 328 + parameter_list go to state 141 + parameter_declaration go to state 142 + + +State 304 + + 162 direct_abstract_declarator: direct_abstract_declarator '[' . ']' + 163 | direct_abstract_declarator '[' . constant_expression ']' + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + ']' shift, and go to state 329 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 147 + constant_expression go to state 330 + + +State 305 + + 146 parameter_type_list: parameter_list ',' ELLIPSIS . + + $default reduce using rule 146 (parameter_type_list) + + +State 306 + + 148 parameter_list: parameter_list ',' parameter_declaration . + + $default reduce using rule 148 (parameter_list) + + +State 307 + + 153 identifier_list: identifier_list ',' IDENTIFIER . + + $default reduce using rule 153 (identifier_list) + + +State 308 + + 170 initializer: '{' initializer_list ',' . '}' + 172 initializer_list: initializer_list ',' . initializer + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + '{' shift, and go to state 154 + '}' shift, and go to state 331 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 155 + initializer go to state 332 + + +State 309 + + 169 initializer: '{' initializer_list '}' . + + $default reduce using rule 169 (initializer) + + +State 310 + + 117 struct_declarator_list: struct_declarator_list ',' struct_declarator . + + $default reduce using rule 117 (struct_declarator_list) + + +State 311 + + 120 struct_declarator: declarator ':' constant_expression . + + $default reduce using rule 120 (struct_declarator) + + +State 312 + + 20 unary_expression: SIZEOF '(' type_name ')' . + + $default reduce using rule 20 (unary_expression) + + +State 313 + + 180 labeled_statement: CASE constant_expression ':' statement . + + $default reduce using rule 180 (labeled_statement) + + +State 314 + + 192 selection_statement: IF '(' expression ')' . statement + 193 | IF '(' expression ')' . statement ELSE statement + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + statement go to state 333 + labeled_statement go to state 126 + compound_statement go to state 127 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 315 + + 194 selection_statement: SWITCH '(' expression ')' . statement + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + statement go to state 334 + labeled_statement go to state 126 + compound_statement go to state 127 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 316 + + 195 iteration_statement: WHILE '(' expression ')' . statement + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + statement go to state 335 + labeled_statement go to state 126 + compound_statement go to state 127 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 317 + + 196 iteration_statement: DO statement WHILE '(' . expression ')' ';' + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 336 + + +State 318 + + 197 iteration_statement: FOR '(' expression_statement expression_statement . ')' statement + 198 | FOR '(' expression_statement expression_statement . expression ')' statement + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + ')' shift, and go to state 337 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 338 + + +State 319 + + 28 cast_expression: '(' type_name ')' cast_expression . + + $default reduce using rule 28 (cast_expression) + + +State 320 + + 8 postfix_expression: postfix_expression '(' argument_expression_list ')' . + + $default reduce using rule 8 (postfix_expression) + + +State 321 + + 14 argument_expression_list: argument_expression_list ',' . assignment_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 339 + + +State 322 + + 6 postfix_expression: postfix_expression '[' expression ']' . + + $default reduce using rule 6 (postfix_expression) + + +State 323 + + 58 conditional_expression: logical_or_expression '?' expression ':' . conditional_expression + + IDENTIFIER shift, and go to state 144 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 146 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 340 + + +State 324 + + 165 direct_abstract_declarator: '(' parameter_type_list ')' . + + $default reduce using rule 165 (direct_abstract_declarator) + + +State 325 + + 159 direct_abstract_declarator: '(' abstract_declarator ')' . + + $default reduce using rule 159 (direct_abstract_declarator) + + +State 326 + + 161 direct_abstract_declarator: '[' constant_expression ']' . + + $default reduce using rule 161 (direct_abstract_declarator) + + +State 327 + + 166 direct_abstract_declarator: direct_abstract_declarator '(' ')' . + + $default reduce using rule 166 (direct_abstract_declarator) + + +State 328 + + 167 direct_abstract_declarator: direct_abstract_declarator '(' parameter_type_list . ')' + + ')' shift, and go to state 341 + + +State 329 + + 162 direct_abstract_declarator: direct_abstract_declarator '[' ']' . + + $default reduce using rule 162 (direct_abstract_declarator) + + +State 330 + + 163 direct_abstract_declarator: direct_abstract_declarator '[' constant_expression . ']' + + ']' shift, and go to state 342 + + +State 331 + + 170 initializer: '{' initializer_list ',' '}' . + + $default reduce using rule 170 (initializer) + + +State 332 + + 172 initializer_list: initializer_list ',' initializer . + + $default reduce using rule 172 (initializer_list) + + +State 333 + + 192 selection_statement: IF '(' expression ')' statement . + 193 | IF '(' expression ')' statement . ELSE statement + + ELSE shift, and go to state 343 + + ELSE [reduce using rule 192 (selection_statement)] + $default reduce using rule 192 (selection_statement) + + +State 334 + + 194 selection_statement: SWITCH '(' expression ')' statement . + + $default reduce using rule 194 (selection_statement) + + +State 335 + + 195 iteration_statement: WHILE '(' expression ')' statement . + + $default reduce using rule 195 (iteration_statement) + + +State 336 + + 73 expression: expression . ',' assignment_expression + 196 iteration_statement: DO statement WHILE '(' expression . ')' ';' + + ')' shift, and go to state 344 + ',' shift, and go to state 226 + + +State 337 + + 197 iteration_statement: FOR '(' expression_statement expression_statement ')' . statement + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + statement go to state 345 + labeled_statement go to state 126 + compound_statement go to state 127 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 338 + + 73 expression: expression . ',' assignment_expression + 198 iteration_statement: FOR '(' expression_statement expression_statement expression . ')' statement + + ')' shift, and go to state 346 + ',' shift, and go to state 226 + + +State 339 + + 14 argument_expression_list: argument_expression_list ',' assignment_expression . + + $default reduce using rule 14 (argument_expression_list) + + +State 340 + + 58 conditional_expression: logical_or_expression '?' expression ':' conditional_expression . + + $default reduce using rule 58 (conditional_expression) + + +State 341 + + 167 direct_abstract_declarator: direct_abstract_declarator '(' parameter_type_list ')' . + + $default reduce using rule 167 (direct_abstract_declarator) + + +State 342 + + 163 direct_abstract_declarator: direct_abstract_declarator '[' constant_expression ']' . + + $default reduce using rule 163 (direct_abstract_declarator) + + +State 343 + + 193 selection_statement: IF '(' expression ')' statement ELSE . statement + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + statement go to state 347 + labeled_statement go to state 126 + compound_statement go to state 127 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 344 + + 196 iteration_statement: DO statement WHILE '(' expression ')' . ';' + + ';' shift, and go to state 348 + + +State 345 + + 197 iteration_statement: FOR '(' expression_statement expression_statement ')' statement . + + $default reduce using rule 197 (iteration_statement) + + +State 346 + + 198 iteration_statement: FOR '(' expression_statement expression_statement expression ')' . statement + + IDENTIFIER shift, and go to state 81 + CONSTANT shift, and go to state 82 + STRING_LITERAL shift, and go to state 83 + SIZEOF shift, and go to state 84 + INC_OP shift, and go to state 85 + DEC_OP shift, and go to state 86 + CASE shift, and go to state 87 + DEFAULT shift, and go to state 88 + IF shift, and go to state 89 + SWITCH shift, and go to state 90 + WHILE shift, and go to state 91 + DO shift, and go to state 92 + FOR shift, and go to state 93 + GOTO shift, and go to state 94 + CONTINUE shift, and go to state 95 + BREAK shift, and go to state 96 + RETURN shift, and go to state 97 + '(' shift, and go to state 98 + '&' shift, and go to state 99 + '*' shift, and go to state 100 + '+' shift, and go to state 101 + '-' shift, and go to state 102 + '~' shift, and go to state 103 + '!' shift, and go to state 104 + ';' shift, and go to state 105 + '{' shift, and go to state 53 + + primary_expression go to state 107 + postfix_expression go to state 108 + unary_expression go to state 109 + unary_operator go to state 110 + cast_expression go to state 111 + multiplicative_expression go to state 112 + additive_expression go to state 113 + shift_expression go to state 114 + relational_expression go to state 115 + equality_expression go to state 116 + and_expression go to state 117 + exclusive_or_expression go to state 118 + inclusive_or_expression go to state 119 + logical_and_expression go to state 120 + logical_or_expression go to state 121 + conditional_expression go to state 122 + assignment_expression go to state 123 + expression go to state 124 + statement go to state 349 + labeled_statement go to state 126 + compound_statement go to state 127 + expression_statement go to state 130 + selection_statement go to state 131 + iteration_statement go to state 132 + jump_statement go to state 133 + + +State 347 + + 193 selection_statement: IF '(' expression ')' statement ELSE statement . + + $default reduce using rule 193 (selection_statement) + + +State 348 + + 196 iteration_statement: DO statement WHILE '(' expression ')' ';' . + + $default reduce using rule 196 (iteration_statement) + + +State 349 + + 198 iteration_statement: FOR '(' expression_statement expression_statement expression ')' statement . + + $default reduce using rule 198 (iteration_statement) diff --git a/src/uscxml/plugins/datamodel/c89/parser/c89.tab.cpp b/src/uscxml/plugins/datamodel/c89/parser/c89.tab.cpp new file mode 100644 index 0000000..be58093 --- /dev/null +++ b/src/uscxml/plugins/datamodel/c89/parser/c89.tab.cpp @@ -0,0 +1,3587 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 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/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + 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. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output. */ +#define YYBISON 1 + +/* Bison version. */ +#define YYBISON_VERSION "3.0.4" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 1 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + +/* Substitute the type names. */ +#define YYSTYPE C89_STYPE +#define YYLTYPE C89_LTYPE +/* Substitute the variable and function names. */ +#define yyparse c89_parse +#define yylex c89_lex +#define yyerror c89_error +#define yydebug c89_debug +#define yynerrs c89_nerrs + + +/* Copy the first part of user declarations. */ +#line 1 "c89.ypp" /* yacc.c:339 */ + +#include "../C89Parser.h" +#include "c89.tab.hpp" +#include <sys/types.h> +#include <stdarg.h> + +#define YYMAXDEPTH 20000 // default is 10000 +#define YYDEBUG 1 +#define YYERROR_VERBOSE 1 + +extern int c89_lex (C89_STYPE* yylval_param, C89_LTYPE* yylloc_param, void* yyscanner); + +using namespace uscxml; + +#line 89 "c89.tab.cpp" /* yacc.c:339 */ + +# ifndef YY_NULLPTR +# if defined __cplusplus && 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# endif + +/* Enabling verbose error messages. */ +#ifdef YYERROR_VERBOSE +# undef YYERROR_VERBOSE +# define YYERROR_VERBOSE 1 +#else +# define YYERROR_VERBOSE 1 +#endif + +/* In a future release of Bison, this section will be replaced + by #include "c89.tab.hpp". */ +#ifndef YY_C89_C89_TAB_HPP_INCLUDED +# define YY_C89_C89_TAB_HPP_INCLUDED +/* Debug traces. */ +#ifndef C89_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define C89_DEBUG 1 +# else +# define C89_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define C89_DEBUG 1 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined C89_DEBUG */ +#if C89_DEBUG +extern int c89_debug; +#endif + +/* Token type. */ +#ifndef C89_TOKENTYPE +# define C89_TOKENTYPE + enum c89_tokentype + { + IDENTIFIER = 258, + CONSTANT = 259, + STRING_LITERAL = 260, + SIZEOF = 261, + PTR_OP = 262, + INC_OP = 263, + DEC_OP = 264, + LEFT_OP = 265, + RIGHT_OP = 266, + LE_OP = 267, + GE_OP = 268, + EQ_OP = 269, + NE_OP = 270, + AND_OP = 271, + OR_OP = 272, + MUL_ASSIGN = 273, + DIV_ASSIGN = 274, + MOD_ASSIGN = 275, + ADD_ASSIGN = 276, + SUB_ASSIGN = 277, + LEFT_ASSIGN = 278, + RIGHT_ASSIGN = 279, + AND_ASSIGN = 280, + XOR_ASSIGN = 281, + OR_ASSIGN = 282, + TYPE_NAME = 283, + TYPEDEF = 284, + EXTERN = 285, + STATIC = 286, + AUTO = 287, + REGISTER = 288, + CHAR = 289, + SHORT = 290, + INT = 291, + LONG = 292, + SIGNED = 293, + UNSIGNED = 294, + FLOAT = 295, + DOUBLE = 296, + CONST = 297, + VOLATILE = 298, + VOID = 299, + STRUCT = 300, + UNION = 301, + ENUM = 302, + ELLIPSIS = 303, + CASE = 304, + DEFAULT = 305, + IF = 306, + ELSE = 307, + SWITCH = 308, + WHILE = 309, + DO = 310, + FOR = 311, + GOTO = 312, + CONTINUE = 313, + BREAK = 314, + RETURN = 315 + }; +#endif + +/* Value type. */ +#if ! defined C89_STYPE && ! defined C89_STYPE_IS_DECLARED + +union C89_STYPE +{ +#line 26 "c89.ypp" /* yacc.c:355 */ + + uscxml::C89ParserNode* node; + char* value; + +#line 203 "c89.tab.cpp" /* yacc.c:355 */ +}; + +typedef union C89_STYPE C89_STYPE; +# define C89_STYPE_IS_TRIVIAL 1 +# define C89_STYPE_IS_DECLARED 1 +#endif + +/* Location type. */ +#if ! defined C89_LTYPE && ! defined C89_LTYPE_IS_DECLARED +typedef struct C89_LTYPE C89_LTYPE; +struct C89_LTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +}; +# define C89_LTYPE_IS_DECLARED 1 +# define C89_LTYPE_IS_TRIVIAL 1 +#endif + + + +int c89_parse (uscxml::C89Parser* ctx, void * scanner); + +#endif /* !YY_C89_C89_TAB_HPP_INCLUDED */ + +/* Copy the second part of user declarations. */ + +#line 233 "c89.tab.cpp" /* yacc.c:358 */ + +#ifdef short +# undef short +#endif + +#ifdef YYTYPE_UINT8 +typedef YYTYPE_UINT8 yytype_uint8; +#else +typedef unsigned char yytype_uint8; +#endif + +#ifdef YYTYPE_INT8 +typedef YYTYPE_INT8 yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef YYTYPE_UINT16 +typedef YYTYPE_UINT16 yytype_uint16; +#else +typedef unsigned short int yytype_uint16; +#endif + +#ifdef YYTYPE_INT16 +typedef YYTYPE_INT16 yytype_int16; +#else +typedef short int yytype_int16; +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif ! defined YYSIZE_T +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned int +# endif +#endif + +#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include <libintl.h> /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + +#ifndef YY_ATTRIBUTE +# if (defined __GNUC__ \ + && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ + || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C +# define YY_ATTRIBUTE(Spec) __attribute__(Spec) +# else +# define YY_ATTRIBUTE(Spec) /* empty */ +# endif +#endif + +#ifndef YY_ATTRIBUTE_PURE +# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) +#endif + +#if !defined _Noreturn \ + && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) +# if defined _MSC_VER && 1200 <= _MSC_VER +# define _Noreturn __declspec (noreturn) +# else +# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YYUSE(E) ((void) (E)) +#else +# define YYUSE(E) /* empty */ +#endif + +#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + + +#if ! defined yyoverflow || YYERROR_VERBOSE + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (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. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ + + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined C89_LTYPE_IS_TRIVIAL && C89_LTYPE_IS_TRIVIAL \ + && defined C89_STYPE_IS_TRIVIAL && C89_STYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + + 2 * YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYSIZE_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / sizeof (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYSIZE_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 61 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 1301 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 85 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 64 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 212 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 350 + +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ +#define YYUNDEFTOK 2 +#define YYMAXUTOK 315 + +#define YYTRANSLATE(YYX) \ + ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, without out-of-bounds checking. */ +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, 72, 2, 2, 2, 74, 67, 2, + 61, 62, 68, 69, 66, 70, 65, 73, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 80, 82, + 75, 81, 76, 79, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 63, 2, 64, 77, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 83, 78, 84, 71, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 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, 11, 12, 13, 14, + 15, 16, 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 +}; + +#if C89_DEBUG + /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_uint16 yyrline[] = +{ + 0, 79, 79, 82, 85, 88, 94, 97, 100, 103, + 106, 109, 112, 115, 121, 124, 130, 133, 136, 139, + 142, 145, 151, 152, 153, 154, 155, 156, 160, 161, + 165, 166, 169, 172, 178, 179, 182, 188, 189, 192, + 198, 199, 202, 205, 208, 214, 215, 218, 224, 225, + 231, 232, 238, 239, 245, 246, 252, 253, 259, 260, + 266, 267, 273, 274, 275, 276, 277, 278, 279, 280, + 281, 282, 283, 287, 288, 294, 298, 299, 305, 306, + 309, 310, 313, 314, 320, 321, 327, 328, 334, 335, + 336, 337, 338, 342, 343, 344, 345, 346, 347, 348, + 349, 350, 351, 352, 353, 357, 360, 363, 369, 370, + 374, 375, 381, 387, 390, 391, 394, 398, 399, 405, + 406, 409, 415, 416, 417, 421, 422, 428, 431, 435, + 436, 440, 443, 447, 450, 453, 456, 459, 462, 465, + 471, 472, 473, 474, 478, 479, 486, 487, 491, 492, + 498, 501, 504, 508, 511, 517, 518, 524, 525, 526, + 530, 531, 532, 533, 534, 537, 538, 539, 540, 546, + 547, 550, 556, 557, 563, 564, 565, 566, 567, 568, + 572, 575, 578, 584, 587, 590, 593, 599, 600, 606, + 607, 613, 616, 622, 625, 628, 634, 637, 640, 643, + 649, 650, 651, 652, 653, 657, 658, 662, 663, 667, + 670, 673, 676 +}; +#endif + +#if C89_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", "IDENTIFIER", "CONSTANT", + "STRING_LITERAL", "SIZEOF", "PTR_OP", "INC_OP", "DEC_OP", "LEFT_OP", + "RIGHT_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", + "MUL_ASSIGN", "DIV_ASSIGN", "MOD_ASSIGN", "ADD_ASSIGN", "SUB_ASSIGN", + "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", + "TYPE_NAME", "TYPEDEF", "EXTERN", "STATIC", "AUTO", "REGISTER", "CHAR", + "SHORT", "INT", "LONG", "SIGNED", "UNSIGNED", "FLOAT", "DOUBLE", "CONST", + "VOLATILE", "VOID", "STRUCT", "UNION", "ENUM", "ELLIPSIS", "CASE", + "DEFAULT", "IF", "ELSE", "SWITCH", "WHILE", "DO", "FOR", "GOTO", + "CONTINUE", "BREAK", "RETURN", "'('", "')'", "'['", "']'", "'.'", "','", + "'&'", "'*'", "'+'", "'-'", "'~'", "'!'", "'/'", "'%'", "'<'", "'>'", + "'^'", "'|'", "'?'", "':'", "'='", "';'", "'{'", "'}'", "$accept", + "primary_expression", "postfix_expression", "argument_expression_list", + "unary_expression", "unary_operator", "cast_expression", + "multiplicative_expression", "additive_expression", "shift_expression", + "relational_expression", "equality_expression", "and_expression", + "exclusive_or_expression", "inclusive_or_expression", + "logical_and_expression", "logical_or_expression", + "conditional_expression", "assignment_expression", "assignment_operator", + "expression", "constant_expression", "declaration", + "declaration_specifiers", "init_declarator_list", "init_declarator", + "storage_class_specifier", "type_specifier", "struct_or_union_specifier", + "struct_or_union", "struct_declaration_list", "struct_declaration", + "specifier_qualifier_list", "struct_declarator_list", + "struct_declarator", "enum_specifier", "enumerator_list", "enumerator", + "type_qualifier", "declarator", "direct_declarator", "pointer", + "type_qualifier_list", "parameter_type_list", "parameter_list", + "parameter_declaration", "identifier_list", "type_name", + "abstract_declarator", "direct_abstract_declarator", "initializer", + "initializer_list", "statement", "labeled_statement", + "compound_statement", "declaration_list", "statement_list", + "expression_statement", "selection_statement", "iteration_statement", + "jump_statement", "translation_unit", "external_declaration", + "function_definition", YY_NULLPTR +}; +#endif + +# ifdef YYPRINT +/* YYTOKNUM[NUM] -- (External) token number corresponding to the + (internal) symbol number NUM (which must be that of a token). */ +static const yytype_uint16 yytoknum[] = +{ + 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, + 265, 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, 40, 41, 91, 93, 46, 44, 38, 42, 43, + 45, 126, 33, 47, 37, 60, 62, 94, 124, 63, + 58, 61, 59, 123, 125 +}; +# endif + +#define YYPACT_NINF -223 + +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-223))) + +#define YYTABLE_NINF -1 + +#define yytable_value_is_error(Yytable_value) \ + 0 + + /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 969, -223, -223, -223, -223, -223, -223, -223, -223, -223, + -223, -223, -223, -223, -223, -223, -223, -223, -223, -223, + -223, 5, 42, 4, -223, 31, 1254, 1254, -223, 11, + -223, 1254, 1101, 88, 26, 879, -223, -223, -60, 51, + 14, -223, -223, 4, -223, 38, -223, 1081, -223, -223, + -10, 1055, -223, 278, -223, 31, -223, 1101, 408, 666, + 88, -223, -223, 51, 69, -23, -223, -223, -223, -223, + 42, -223, 542, -223, 1101, 1055, 1055, 1004, -223, 72, + 1055, -12, -223, -223, 785, 806, 806, 830, 17, 123, + 129, 132, 524, 141, 109, 127, 134, 559, 645, -223, + -223, -223, -223, -223, -223, -223, -223, -223, 192, 274, + 830, -223, 121, 36, 224, 116, 229, 151, 150, 158, + 236, -2, -223, -223, 43, -223, -223, -223, 348, 418, + -223, -223, -223, -223, 164, -223, -223, -223, -223, 18, + 198, 188, -223, 16, -223, -223, -223, -223, 197, -15, + 830, 51, -223, -223, 542, -223, -223, -223, 1024, -223, + -223, -223, 830, 76, -223, 184, -223, 524, 645, -223, + 830, -223, -223, 190, 524, 830, 830, 830, 217, 596, + 191, -223, -223, -223, 114, 49, 85, 212, 273, -223, + -223, 690, 830, 275, -223, -223, -223, -223, -223, -223, + -223, -223, -223, -223, -223, 830, -223, 830, 830, 830, + 830, 830, 830, 830, 830, 830, 830, 830, 830, 830, + 830, 830, 830, 830, 830, 830, 830, -223, -223, 454, + -223, -223, 924, 715, -223, 22, -223, 165, -223, 1233, + -223, 282, -223, -223, -223, -223, -223, 35, -223, -223, + 72, -223, 830, -223, 215, 524, -223, 81, 120, 145, + 227, 596, -223, -223, -223, 1157, 170, -223, 830, -223, + -223, 146, -223, 1, -223, -223, -223, -223, -223, 121, + 121, 36, 36, 224, 224, 224, 224, 116, 116, 229, + 151, 150, 158, 236, -50, -223, -223, -223, 228, 240, + -223, 225, 165, 1198, 736, -223, -223, -223, 488, -223, + -223, -223, -223, -223, 524, 524, 524, 830, 760, -223, + -223, 830, -223, 830, -223, -223, -223, -223, 242, -223, + 241, -223, -223, 239, -223, -223, 148, 524, 155, -223, + -223, -223, -223, 524, 244, -223, 524, -223, -223, -223 +}; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_uint8 yydefact[] = +{ + 0, 133, 104, 88, 89, 90, 91, 92, 94, 95, + 96, 97, 100, 101, 98, 99, 129, 130, 93, 108, + 109, 0, 0, 140, 208, 0, 78, 80, 102, 0, + 103, 82, 0, 132, 0, 0, 205, 207, 124, 0, + 0, 144, 142, 141, 76, 0, 84, 86, 79, 81, + 107, 0, 83, 0, 187, 0, 212, 0, 0, 0, + 131, 1, 206, 0, 127, 0, 125, 134, 145, 143, + 0, 77, 0, 210, 0, 0, 114, 0, 110, 0, + 116, 2, 3, 4, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, + 23, 24, 25, 26, 27, 191, 183, 6, 16, 28, + 0, 30, 34, 37, 40, 45, 48, 50, 52, 54, + 56, 58, 60, 73, 0, 189, 174, 175, 0, 0, + 176, 177, 178, 179, 86, 188, 211, 153, 139, 152, + 0, 146, 148, 0, 2, 136, 28, 75, 0, 0, + 0, 0, 122, 85, 0, 169, 87, 209, 0, 113, + 106, 111, 0, 0, 117, 119, 115, 0, 0, 20, + 0, 17, 18, 0, 0, 0, 0, 0, 0, 0, + 0, 201, 202, 203, 0, 0, 155, 0, 0, 12, + 13, 0, 0, 0, 63, 64, 65, 66, 67, 68, + 69, 70, 71, 72, 62, 0, 19, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 192, 185, 0, + 184, 190, 0, 0, 150, 157, 151, 158, 137, 0, + 138, 0, 135, 123, 128, 126, 172, 0, 105, 120, + 0, 112, 0, 180, 0, 0, 182, 0, 0, 0, + 0, 0, 200, 204, 5, 0, 157, 156, 0, 11, + 8, 0, 14, 0, 10, 61, 31, 32, 33, 35, + 36, 38, 39, 43, 44, 41, 42, 46, 47, 49, + 51, 53, 55, 57, 0, 74, 186, 165, 0, 0, + 161, 0, 159, 0, 0, 147, 149, 154, 0, 170, + 118, 121, 21, 181, 0, 0, 0, 0, 0, 29, + 9, 0, 7, 0, 166, 160, 162, 167, 0, 163, + 0, 171, 173, 193, 195, 196, 0, 0, 0, 15, + 59, 168, 164, 0, 0, 198, 0, 194, 197, 199 +}; + + /* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -223, -223, -223, -223, -48, -223, -91, 37, 46, 8, + 48, 110, 119, 122, 118, 135, -223, -55, -70, -223, + -38, -54, 6, 0, -223, 272, -223, -27, -223, -223, + 268, -67, -24, -223, 108, -223, 300, 213, 47, -13, + -29, -3, -223, -57, -223, 126, -223, 199, -122, -222, + -151, -223, -74, -223, 156, -25, 238, -172, -223, -223, + -223, -223, 333, -223 +}; + + /* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_int16 yydefgoto[] = +{ + -1, 107, 108, 271, 109, 110, 111, 112, 113, 114, + 115, 116, 117, 118, 119, 120, 121, 122, 123, 205, + 124, 148, 54, 55, 45, 46, 26, 27, 28, 29, + 77, 78, 79, 163, 164, 30, 65, 66, 31, 32, + 33, 34, 43, 298, 141, 142, 143, 187, 299, 237, + 156, 247, 125, 126, 127, 57, 129, 130, 131, 132, + 133, 35, 36, 37 +}; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_uint16 yytable[] = +{ + 25, 140, 155, 246, 147, 60, 24, 261, 38, 40, + 161, 146, 47, 302, 50, 224, 226, 236, 178, 206, + 42, 1, 74, 63, 76, 1, 48, 49, 128, 1, + 323, 52, 147, 173, 1, 25, 169, 171, 172, 146, + 69, 24, 134, 151, 302, 1, 16, 17, 76, 76, + 76, 151, 159, 76, 64, 231, 166, 134, 139, 184, + 185, 152, 146, 135, 267, 322, 165, 226, 167, 243, + 41, 76, 23, 75, 186, 1, 67, 225, 240, 232, + 135, 233, 241, 232, 155, 233, 23, 22, 39, 318, + 68, 161, 22, 253, 51, 147, 244, 174, 80, 23, + 256, 308, 146, 22, 70, 210, 211, 147, 249, 226, + 23, 264, 180, 44, 146, 226, 276, 277, 278, 309, + 71, 272, 80, 80, 80, 227, 234, 80, 214, 215, + 185, 76, 185, 22, 135, 275, 235, 257, 258, 259, + 23, 76, 250, 314, 186, 80, 265, 226, 233, 58, + 150, 59, 162, 23, 273, 231, 295, 332, 251, 146, + 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, + 146, 146, 146, 146, 146, 146, 146, 319, 147, 301, + 226, 313, 315, 266, 175, 146, 226, 294, 56, 207, + 176, 216, 217, 177, 208, 209, 263, 147, 311, 188, + 189, 190, 179, 73, 146, 80, 60, 316, 320, 181, + 344, 226, 321, 136, 226, 80, 182, 346, 220, 40, + 146, 226, 283, 284, 285, 286, 303, 221, 304, 235, + 157, 265, 139, 233, 212, 213, 222, 165, 155, 139, + 333, 334, 335, 218, 219, 72, 328, 279, 280, 147, + 330, 339, 223, 191, 239, 192, 146, 193, 281, 282, + 238, 242, 266, 345, 252, 139, 287, 288, 340, 347, + 255, 260, 349, 262, 268, 146, 269, 312, 274, 336, + 338, 81, 82, 83, 84, 307, 85, 86, 317, 326, + 324, 343, 194, 195, 196, 197, 198, 199, 200, 201, + 202, 203, 325, 139, 341, 342, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 348, 87, 88, 89, + 289, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 290, 292, 153, 158, 291, 99, 100, 101, 102, 103, + 104, 81, 82, 83, 84, 204, 85, 86, 310, 293, + 105, 53, 106, 149, 245, 306, 229, 254, 62, 0, + 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 0, 87, 88, 89, + 0, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 0, 137, 0, 0, 0, 99, 100, 101, 102, 103, + 104, 81, 82, 83, 84, 0, 85, 86, 0, 0, + 105, 53, 228, 0, 0, 0, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 0, 81, 82, 83, + 84, 0, 85, 86, 0, 0, 0, 87, 88, 89, + 138, 90, 91, 92, 93, 94, 95, 96, 97, 98, + 0, 0, 0, 0, 0, 99, 100, 101, 102, 103, + 104, 144, 82, 83, 84, 0, 85, 86, 0, 0, + 105, 53, 230, 87, 88, 89, 0, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 0, 0, 0, 0, + 0, 99, 100, 101, 102, 103, 104, 81, 82, 83, + 84, 0, 85, 86, 0, 0, 105, 53, 296, 0, + 0, 0, 0, 0, 0, 144, 82, 83, 84, 98, + 85, 86, 0, 0, 0, 99, 100, 101, 102, 103, + 104, 0, 144, 82, 83, 84, 0, 85, 86, 0, + 0, 154, 331, 87, 88, 89, 0, 90, 91, 92, + 93, 94, 95, 96, 97, 98, 0, 0, 0, 0, + 0, 99, 100, 101, 102, 103, 104, 0, 0, 144, + 82, 83, 84, 98, 85, 86, 105, 53, 0, 99, + 100, 101, 102, 103, 104, 0, 0, 0, 0, 0, + 98, 0, 0, 0, 0, 154, 99, 100, 101, 102, + 103, 104, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 183, 0, 0, 0, 0, 0, 0, 144, 82, + 83, 84, 0, 85, 86, 0, 0, 98, 0, 0, + 0, 0, 0, 99, 100, 101, 102, 103, 104, 144, + 82, 83, 84, 2, 85, 86, 0, 0, 105, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 144, 82, 83, 84, 0, 85, 86, + 0, 0, 0, 0, 0, 0, 98, 0, 0, 0, + 0, 0, 99, 100, 101, 102, 103, 104, 144, 82, + 83, 84, 0, 85, 86, 0, 0, 98, 0, 0, + 145, 0, 0, 99, 100, 101, 102, 103, 104, 144, + 82, 83, 84, 0, 85, 86, 0, 0, 0, 0, + 0, 98, 270, 0, 0, 0, 0, 99, 100, 101, + 102, 103, 104, 144, 82, 83, 84, 0, 85, 86, + 0, 0, 0, 0, 0, 0, 98, 0, 0, 300, + 0, 0, 99, 100, 101, 102, 103, 104, 144, 82, + 83, 84, 0, 85, 86, 0, 0, 98, 0, 0, + 329, 0, 0, 99, 100, 101, 102, 103, 104, 144, + 82, 83, 84, 0, 85, 86, 0, 0, 0, 0, + 0, 98, 337, 0, 0, 0, 0, 99, 100, 101, + 102, 103, 104, 144, 82, 83, 84, 0, 85, 86, + 0, 0, 0, 0, 0, 0, 168, 0, 0, 0, + 0, 0, 99, 100, 101, 102, 103, 104, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 170, 0, 0, + 0, 0, 0, 99, 100, 101, 102, 103, 104, 61, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 98, 0, 0, 0, 0, 0, 99, 100, 101, + 102, 103, 104, 0, 0, 0, 0, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 22, 0, 0, 0, 0, 0, 0, 23, 0, 0, + 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 1, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 232, 297, 233, 0, 0, + 0, 0, 23, 0, 0, 0, 0, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 22, 0, 2, 0, 0, 0, 0, 23, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 2, 0, 0, 0, 0, 0, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 2, 0, 0, 0, 0, 160, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 0, 0, 0, 0, 0, 248, 2, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 2, + 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13, 14, 15, 16, 17, 18, 19, 20, 21, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 72, 0, 53, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 53, 2, 3, 4, 5, 6, + 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 265, 297, + 233, 0, 0, 0, 0, 23, 2, 3, 4, 5, + 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 327, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 305, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21 +}; + +static const yytype_int16 yycheck[] = +{ + 0, 58, 72, 154, 59, 34, 0, 179, 3, 22, + 77, 59, 25, 235, 3, 17, 66, 139, 92, 110, + 23, 3, 47, 83, 51, 3, 26, 27, 53, 3, + 80, 31, 87, 87, 3, 35, 84, 85, 86, 87, + 43, 35, 55, 66, 266, 3, 42, 43, 75, 76, + 77, 66, 76, 80, 3, 129, 80, 70, 58, 97, + 98, 84, 110, 57, 186, 64, 79, 66, 80, 84, + 23, 98, 68, 83, 98, 3, 62, 79, 62, 61, + 74, 63, 66, 61, 154, 63, 68, 61, 83, 261, + 43, 158, 61, 167, 83, 150, 150, 80, 51, 68, + 174, 66, 150, 61, 66, 69, 70, 162, 162, 66, + 68, 62, 3, 82, 162, 66, 207, 208, 209, 84, + 82, 191, 75, 76, 77, 82, 139, 80, 12, 13, + 168, 158, 170, 61, 128, 205, 139, 175, 176, 177, + 68, 168, 66, 62, 168, 98, 61, 66, 63, 61, + 81, 63, 80, 68, 192, 229, 226, 308, 82, 207, + 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, + 218, 219, 220, 221, 222, 223, 224, 268, 233, 233, + 66, 255, 62, 186, 61, 233, 66, 225, 32, 68, + 61, 75, 76, 61, 73, 74, 82, 252, 252, 7, + 8, 9, 61, 47, 252, 158, 235, 62, 62, 82, + 62, 66, 66, 57, 66, 168, 82, 62, 67, 232, + 268, 66, 214, 215, 216, 217, 61, 77, 63, 232, + 74, 61, 232, 63, 10, 11, 78, 250, 308, 239, + 314, 315, 316, 14, 15, 81, 303, 210, 211, 304, + 304, 321, 16, 61, 66, 63, 304, 65, 212, 213, + 62, 64, 265, 337, 80, 265, 218, 219, 323, 343, + 80, 54, 346, 82, 62, 323, 3, 62, 3, 317, + 318, 3, 4, 5, 6, 3, 8, 9, 61, 64, + 62, 52, 18, 19, 20, 21, 22, 23, 24, 25, + 26, 27, 62, 303, 62, 64, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 82, 49, 50, 51, + 220, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 221, 223, 70, 75, 222, 67, 68, 69, 70, 71, + 72, 3, 4, 5, 6, 81, 8, 9, 250, 224, + 82, 83, 84, 63, 151, 239, 128, 168, 35, -1, + -1, -1, -1, -1, -1, -1, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, -1, 49, 50, 51, + -1, 53, 54, 55, 56, 57, 58, 59, 60, 61, + -1, 3, -1, -1, -1, 67, 68, 69, 70, 71, + 72, 3, 4, 5, 6, -1, 8, 9, -1, -1, + 82, 83, 84, -1, -1, -1, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, -1, 3, 4, 5, + 6, -1, 8, 9, -1, -1, -1, 49, 50, 51, + 62, 53, 54, 55, 56, 57, 58, 59, 60, 61, + -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, + 72, 3, 4, 5, 6, -1, 8, 9, -1, -1, + 82, 83, 84, 49, 50, 51, -1, 53, 54, 55, + 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, + -1, 67, 68, 69, 70, 71, 72, 3, 4, 5, + 6, -1, 8, 9, -1, -1, 82, 83, 84, -1, + -1, -1, -1, -1, -1, 3, 4, 5, 6, 61, + 8, 9, -1, -1, -1, 67, 68, 69, 70, 71, + 72, -1, 3, 4, 5, 6, -1, 8, 9, -1, + -1, 83, 84, 49, 50, 51, -1, 53, 54, 55, + 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, + -1, 67, 68, 69, 70, 71, 72, -1, -1, 3, + 4, 5, 6, 61, 8, 9, 82, 83, -1, 67, + 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, 83, 67, 68, 69, 70, + 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 82, -1, -1, -1, -1, -1, -1, 3, 4, + 5, 6, -1, 8, 9, -1, -1, 61, -1, -1, + -1, -1, -1, 67, 68, 69, 70, 71, 72, 3, + 4, 5, 6, 28, 8, 9, -1, -1, 82, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 3, 4, 5, 6, -1, 8, 9, + -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, + -1, -1, 67, 68, 69, 70, 71, 72, 3, 4, + 5, 6, -1, 8, 9, -1, -1, 61, -1, -1, + 64, -1, -1, 67, 68, 69, 70, 71, 72, 3, + 4, 5, 6, -1, 8, 9, -1, -1, -1, -1, + -1, 61, 62, -1, -1, -1, -1, 67, 68, 69, + 70, 71, 72, 3, 4, 5, 6, -1, 8, 9, + -1, -1, -1, -1, -1, -1, 61, -1, -1, 64, + -1, -1, 67, 68, 69, 70, 71, 72, 3, 4, + 5, 6, -1, 8, 9, -1, -1, 61, -1, -1, + 64, -1, -1, 67, 68, 69, 70, 71, 72, 3, + 4, 5, 6, -1, 8, 9, -1, -1, -1, -1, + -1, 61, 62, -1, -1, -1, -1, 67, 68, 69, + 70, 71, 72, 3, 4, 5, 6, -1, 8, 9, + -1, -1, -1, -1, -1, -1, 61, -1, -1, -1, + -1, -1, 67, 68, 69, 70, 71, 72, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, + -1, -1, -1, 67, 68, 69, 70, 71, 72, 0, + -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, + -1, 61, -1, -1, -1, -1, -1, 67, 68, 69, + 70, 71, 72, -1, -1, -1, -1, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, 3, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 61, -1, -1, -1, -1, -1, -1, 68, -1, -1, + -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 3, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 61, 62, 63, -1, -1, + -1, -1, 68, -1, -1, -1, -1, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 46, 47, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 61, -1, 28, -1, -1, -1, -1, 68, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 28, -1, -1, -1, -1, -1, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 28, -1, -1, -1, -1, 84, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, -1, -1, -1, -1, -1, 84, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 28, + 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 81, -1, 83, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 83, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 61, 62, + 63, -1, -1, -1, -1, 68, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 62, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47 +}; + + /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing + symbol of state STATE-NUM. */ +static const yytype_uint8 yystos[] = +{ + 0, 3, 28, 29, 30, 31, 32, 33, 34, 35, + 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, + 46, 47, 61, 68, 107, 108, 111, 112, 113, 114, + 120, 123, 124, 125, 126, 146, 147, 148, 3, 83, + 124, 123, 126, 127, 82, 109, 110, 124, 108, 108, + 3, 83, 108, 83, 107, 108, 139, 140, 61, 63, + 125, 0, 147, 83, 3, 121, 122, 62, 123, 126, + 66, 82, 81, 139, 140, 83, 112, 115, 116, 117, + 123, 3, 4, 5, 6, 8, 9, 49, 50, 51, + 53, 54, 55, 56, 57, 58, 59, 60, 61, 67, + 68, 69, 70, 71, 72, 82, 84, 86, 87, 89, + 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, + 100, 101, 102, 103, 105, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 124, 107, 139, 3, 62, 108, + 128, 129, 130, 131, 3, 64, 89, 102, 106, 121, + 81, 66, 84, 110, 83, 103, 135, 139, 115, 117, + 84, 116, 80, 118, 119, 124, 117, 80, 61, 89, + 61, 89, 89, 106, 80, 61, 61, 61, 137, 61, + 3, 82, 82, 82, 105, 105, 117, 132, 7, 8, + 9, 61, 63, 65, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 81, 104, 91, 68, 73, 74, + 69, 70, 10, 11, 12, 13, 75, 76, 14, 15, + 67, 77, 78, 16, 17, 79, 66, 82, 84, 141, + 84, 137, 61, 63, 124, 126, 133, 134, 62, 66, + 62, 66, 64, 84, 106, 122, 135, 136, 84, 106, + 66, 82, 80, 137, 132, 80, 137, 105, 105, 105, + 54, 142, 82, 82, 62, 61, 126, 133, 62, 3, + 62, 88, 103, 105, 3, 103, 91, 91, 91, 92, + 92, 93, 93, 94, 94, 94, 94, 95, 95, 96, + 97, 98, 99, 100, 105, 103, 84, 62, 128, 133, + 64, 106, 134, 61, 63, 48, 130, 3, 66, 84, + 119, 106, 62, 137, 62, 62, 62, 61, 142, 91, + 62, 66, 64, 80, 62, 62, 64, 62, 128, 64, + 106, 84, 135, 137, 137, 137, 105, 62, 105, 103, + 102, 62, 64, 52, 62, 137, 62, 137, 82, 137 +}; + + /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = +{ + 0, 85, 86, 86, 86, 86, 87, 87, 87, 87, + 87, 87, 87, 87, 88, 88, 89, 89, 89, 89, + 89, 89, 90, 90, 90, 90, 90, 90, 91, 91, + 92, 92, 92, 92, 93, 93, 93, 94, 94, 94, + 95, 95, 95, 95, 95, 96, 96, 96, 97, 97, + 98, 98, 99, 99, 100, 100, 101, 101, 102, 102, + 103, 103, 104, 104, 104, 104, 104, 104, 104, 104, + 104, 104, 104, 105, 105, 106, 107, 107, 108, 108, + 108, 108, 108, 108, 109, 109, 110, 110, 111, 111, + 111, 111, 111, 112, 112, 112, 112, 112, 112, 112, + 112, 112, 112, 112, 112, 113, 113, 113, 114, 114, + 115, 115, 116, 117, 117, 117, 117, 118, 118, 119, + 119, 119, 120, 120, 120, 121, 121, 122, 122, 123, + 123, 124, 124, 125, 125, 125, 125, 125, 125, 125, + 126, 126, 126, 126, 127, 127, 128, 128, 129, 129, + 130, 130, 130, 131, 131, 132, 132, 133, 133, 133, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 135, + 135, 135, 136, 136, 137, 137, 137, 137, 137, 137, + 138, 138, 138, 139, 139, 139, 139, 140, 140, 141, + 141, 142, 142, 143, 143, 143, 144, 144, 144, 144, + 145, 145, 145, 145, 145, 146, 146, 147, 147, 148, + 148, 148, 148 +}; + + /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = +{ + 0, 2, 1, 1, 1, 3, 1, 4, 3, 4, + 3, 3, 2, 2, 1, 3, 1, 2, 2, 2, + 2, 4, 1, 1, 1, 1, 1, 1, 1, 4, + 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, + 1, 3, 3, 3, 3, 1, 3, 3, 1, 3, + 1, 3, 1, 3, 1, 3, 1, 3, 1, 5, + 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 1, 2, 3, 1, 2, + 1, 2, 1, 2, 1, 3, 1, 3, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 5, 4, 2, 1, 1, + 1, 2, 3, 2, 1, 2, 1, 1, 3, 1, + 2, 3, 4, 5, 2, 1, 3, 1, 3, 1, + 1, 2, 1, 1, 3, 4, 3, 4, 4, 3, + 1, 2, 2, 3, 1, 2, 1, 3, 1, 3, + 2, 2, 1, 1, 3, 1, 2, 1, 1, 2, + 3, 2, 3, 3, 4, 2, 3, 3, 4, 1, + 3, 4, 1, 3, 1, 1, 1, 1, 1, 1, + 3, 4, 3, 2, 3, 3, 4, 1, 2, 1, + 2, 1, 2, 5, 7, 5, 5, 7, 6, 7, + 3, 2, 2, 2, 3, 1, 2, 1, 1, 4, + 3, 3, 2 +}; + + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) +#define YYEMPTY (-2) +#define YYEOF 0 + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ +do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (&yylloc, ctx, scanner, YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ +while (0) + +/* Error token number */ +#define YYTERROR 1 +#define YYERRCODE 256 + + +/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. + If N is 0, then set CURRENT to the empty location which ends + the previous symbol: RHS[0] (always defined). */ + +#ifndef YYLLOC_DEFAULT +# define YYLLOC_DEFAULT(Current, Rhs, N) \ + do \ + if (N) \ + { \ + (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ + (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ + (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ + (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ + } \ + else \ + { \ + (Current).first_line = (Current).last_line = \ + YYRHSLOC (Rhs, 0).last_line; \ + (Current).first_column = (Current).last_column = \ + YYRHSLOC (Rhs, 0).last_column; \ + } \ + while (0) +#endif + +#define YYRHSLOC(Rhs, K) ((Rhs)[K]) + + +/* Enable debugging if requested. */ +#if C89_DEBUG + +# ifndef YYFPRINTF +# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + + +/* YY_LOCATION_PRINT -- Print the location on the stream. + This macro was not mandated originally: define only if we know + we won't break user code: when these are the locations we know. */ + +#ifndef YY_LOCATION_PRINT +# if defined C89_LTYPE_IS_TRIVIAL && C89_LTYPE_IS_TRIVIAL + +/* Print *YYLOCP on YYO. Private, do not rely on its existence. */ + +YY_ATTRIBUTE_UNUSED +static unsigned +yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) +{ + unsigned res = 0; + int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0; + if (0 <= yylocp->first_line) + { + res += YYFPRINTF (yyo, "%d", yylocp->first_line); + if (0 <= yylocp->first_column) + res += YYFPRINTF (yyo, ".%d", yylocp->first_column); + } + if (0 <= yylocp->last_line) + { + if (yylocp->first_line < yylocp->last_line) + { + res += YYFPRINTF (yyo, "-%d", yylocp->last_line); + if (0 <= end_col) + res += YYFPRINTF (yyo, ".%d", end_col); + } + else if (0 <= end_col && yylocp->first_column < end_col) + res += YYFPRINTF (yyo, "-%d", end_col); + } + return res; + } + +# define YY_LOCATION_PRINT(File, Loc) \ + yy_location_print_ (File, &(Loc)) + +# else +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif +#endif + + +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Type, Value, Location, ctx, scanner); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, uscxml::C89Parser* ctx, void * scanner) +{ + FILE *yyo = yyoutput; + YYUSE (yyo); + YYUSE (yylocationp); + YYUSE (ctx); + YYUSE (scanner); + if (!yyvaluep) + return; +# ifdef YYPRINT + if (yytype < YYNTOKENS) + YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); +# endif + YYUSE (yytype); +} + + +/*--------------------------------. +| Print this symbol on YYOUTPUT. | +`--------------------------------*/ + +static void +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, uscxml::C89Parser* ctx, void * scanner) +{ + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + + YY_LOCATION_PRINT (yyoutput, *yylocationp); + YYFPRINTF (yyoutput, ": "); + yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, ctx, scanner); + YYFPRINTF (yyoutput, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, uscxml::C89Parser* ctx, void * scanner) +{ + unsigned long int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + 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, + yystos[yyssp[yyi + 1 - yynrhs]], + &(yyvsp[(yyi + 1) - (yynrhs)]) + , &(yylsp[(yyi + 1) - (yynrhs)]) , ctx, scanner); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, yylsp, Rule, ctx, scanner); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !C89_DEBUG */ +# define YYDPRINTF(Args) +# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !C89_DEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + +#if YYERROR_VERBOSE + +# ifndef yystrlen +# if defined __GLIBC__ && defined _STRING_H +# define yystrlen strlen +# else +/* Return the length of YYSTR. */ +static YYSIZE_T +yystrlen (const char *yystr) +{ + YYSIZE_T yylen; + for (yylen = 0; yystr[yylen]; yylen++) + continue; + return yylen; +} +# endif +# endif + +# ifndef yystpcpy +# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE +# define yystpcpy stpcpy +# else +/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in + YYDEST. */ +static char * +yystpcpy (char *yydest, const char *yysrc) +{ + char *yyd = yydest; + const char *yys = yysrc; + + while ((*yyd++ = *yys++) != '\0') + continue; + + return yyd - 1; +} +# endif +# endif + +# ifndef yytnamerr +/* Copy to YYRES the contents of YYSTR after stripping away unnecessary + quotes and backslashes, so that it's suitable for yyerror. The + heuristic is that double-quoting is unnecessary unless the string + contains an apostrophe, a comma, or backslash (other than + backslash-backslash). YYSTR is taken from yytname. If YYRES is + 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; +} +# endif + +/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message + about the unexpected token YYTOKEN for the state stack whose top is + YYSSP. + + Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is + not large enough to hold the message. In that case, also set + *YYMSG_ALLOC to the required number of bytes. Return 2 if the + 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_NULLPTR, yytname[yytoken]); + YYSIZE_T yysize = yysize0; + enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; + /* Internationalized format string. */ + const char *yyformat = YY_NULLPTR; + /* 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: + - 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_NULLPTR, 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")); +# 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; +} +#endif /* YYERROR_VERBOSE */ + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, uscxml::C89Parser* ctx, void * scanner) +{ + YYUSE (yyvaluep); + YYUSE (yylocationp); + YYUSE (ctx); + YYUSE (scanner); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (uscxml::C89Parser* ctx, void * scanner) +{ +/* The lookahead symbol. */ +int yychar; + + +/* The semantic value of the lookahead symbol. */ +/* Default value used for initialization, for pacifying older GCCs + or non-GCC compilers. */ +YY_INITIAL_VALUE (static YYSTYPE yyval_default;) +YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default); + +/* Location data for the lookahead symbol. */ +static YYLTYPE yyloc_default +# if defined C89_LTYPE_IS_TRIVIAL && C89_LTYPE_IS_TRIVIAL + = { 1, 1, 1, 1 } +# endif +; +YYLTYPE yylloc = yyloc_default; + + /* Number of syntax errors so far. */ + int yynerrs; + + 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. + 'yyls': related to locations. + + 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 semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[3]; + + YYSIZE_T yystacksize; + + int yyn; + 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; + YYLTYPE yyloc; + +#if YYERROR_VERBOSE + /* 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), yylsp -= (N)) + + /* 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; + yylsp = yyls = yylsa; + yystacksize = YYINITDEPTH; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yystate = 0; + yyerrstatus = 0; + yynerrs = 0; + yychar = YYEMPTY; /* Cause a token to be read. */ + yylsp[0] = yylloc; + 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++; + + 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; + +#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; + YYLTYPE *yyls1 = yyls; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + 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), + &yyls1, yysize * sizeof (*yylsp), + &yystacksize); + + yyls = yyls1; + yyss = yyss1; + yyvs = yyvs1; + } +#else /* no yyoverflow */ +# ifndef YYSTACK_RELOCATE + 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); + YYSTACK_RELOCATE (yyls_alloc, yyls); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif +#endif /* no yyoverflow */ + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + yylsp = yyls + yysize - 1; + + YYDPRINTF ((stderr, "Stack size increased to %lu\n", + (unsigned long int) yystacksize)); + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } + + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + + if (yystate == YYFINAL) + YYACCEPT; + + goto 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 (&yylval, &yylloc, scanner); + } + + 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 + *++yylsp = yylloc; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- Do a reduction. | +`-----------------------------*/ +yyreduce: + /* 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'. + + 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]; + + /* Default location. */ + YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 2: +#line 79 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->value(IDENTIFIER, (void*)&((yylsp[0])), (yyvsp[0].value)); free((yyvsp[0].value)); + } +#line 1888 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 3: +#line 82 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->value(CONSTANT, (void*)&((yylsp[0])), (yyvsp[0].value)); free((yyvsp[0].value)); + } +#line 1896 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 4: +#line 85 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->value(STRING_LITERAL, (void*)&((yylsp[0])), (yyvsp[0].value)); free((yyvsp[0].value)); + } +#line 1904 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 5: +#line 88 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = (yyvsp[-1].node); + } +#line 1912 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 6: +#line 94 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = (yyvsp[0].node); + } +#line 1920 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 7: +#line 97 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-3].node), (yyvsp[-1].node)); + } +#line 1928 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 8: +#line 100 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 1, (yyvsp[-2].node)); + } +#line 1936 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 9: +#line 103 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-3].node), (yyvsp[-1].node)); + } +#line 1944 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 10: +#line 106 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].value)); + } +#line 1952 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 11: +#line 109 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(PTR_OP, 2, (yyvsp[-2].node), (yyvsp[0].value)); + } +#line 1960 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 12: +#line 112 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(INC_OP, 1, (yyvsp[-1].node)); + } +#line 1968 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 13: +#line 115 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(DEC_OP, 1, (yyvsp[-1].node)); + } +#line 1976 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 14: +#line 121 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = (yyvsp[0].node); + } +#line 1984 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 15: +#line 124 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 1992 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 16: +#line 130 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = (yyvsp[0].node); + } +#line 2000 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 17: +#line 133 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(INC_OP, 1, (yyvsp[0].node)); + } +#line 2008 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 18: +#line 136 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(DEC_OP, 1, (yyvsp[0].node)); + } +#line 2016 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 19: +#line 139 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 2024 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 20: +#line 142 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(SIZEOF, 1, (yyvsp[0].node)); + } +#line 2032 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 21: +#line 145 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(SIZEOF, 1, (yyvsp[-1].node)); + } +#line 2040 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 22: +#line 151 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 0); } +#line 2046 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 23: +#line 152 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 0); } +#line 2052 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 24: +#line 153 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 0); } +#line 2058 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 25: +#line 154 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 0); } +#line 2064 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 26: +#line 155 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 0); } +#line 2070 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 27: +#line 156 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 0); } +#line 2076 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 28: +#line 160 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2082 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 29: +#line 161 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 2088 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 30: +#line 165 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2094 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 31: +#line 166 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2102 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 32: +#line 169 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2110 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 33: +#line 172 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2118 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 34: +#line 178 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2124 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 35: +#line 179 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2132 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 36: +#line 182 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2140 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 37: +#line 188 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2146 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 38: +#line 189 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(LEFT_OP, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2154 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 39: +#line 192 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(RIGHT_OP, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2162 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 40: +#line 198 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2168 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 41: +#line 199 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2176 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 42: +#line 202 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2184 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 43: +#line 205 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(LE_OP, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2192 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 44: +#line 208 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(GE_OP, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2200 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 45: +#line 214 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2206 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 46: +#line 215 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(EQ_OP, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2214 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 47: +#line 218 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(NE_OP, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2222 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 48: +#line 224 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2228 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 49: +#line 225 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2236 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 50: +#line 231 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2242 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 51: +#line 232 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2250 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 52: +#line 238 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2256 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 53: +#line 239 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2264 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 54: +#line 245 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2270 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 55: +#line 246 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(AND_OP, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2278 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 56: +#line 252 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2284 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 57: +#line 253 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(OR_OP, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2292 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 58: +#line 259 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2298 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 59: +#line 260 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 3, (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2306 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 60: +#line 266 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2312 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 61: +#line 267 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2320 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 62: +#line 273 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node('=', 0); } +#line 2326 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 63: +#line 274 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(MUL_ASSIGN, 0); } +#line 2332 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 64: +#line 275 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(DIV_ASSIGN, 0); } +#line 2338 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 65: +#line 276 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(MOD_ASSIGN, 0); } +#line 2344 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 66: +#line 277 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(ADD_ASSIGN, 0); } +#line 2350 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 67: +#line 278 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(SUB_ASSIGN, 0); } +#line 2356 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 68: +#line 279 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(LEFT_ASSIGN, 0); } +#line 2362 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 69: +#line 280 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(RIGHT_ASSIGN, 0); } +#line 2368 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 70: +#line 281 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(AND_ASSIGN, 0); } +#line 2374 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 71: +#line 282 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(XOR_ASSIGN, 0); } +#line 2380 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 72: +#line 283 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(OR_ASSIGN, 0); } +#line 2386 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 73: +#line 287 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2392 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 74: +#line 288 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2400 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 75: +#line 294 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2406 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 76: +#line 298 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[-1].node); } +#line 2412 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 77: +#line 299 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-2].node), (yyvsp[-1].node)); + } +#line 2420 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 78: +#line 305 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2426 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 79: +#line 306 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 2434 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 80: +#line 309 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2440 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 81: +#line 310 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 2448 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 82: +#line 313 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2454 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 83: +#line 314 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 2462 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 84: +#line 320 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2468 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 85: +#line 321 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2476 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 86: +#line 327 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2482 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 87: +#line 328 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2490 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 88: +#line 334 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(TYPEDEF, 0); } +#line 2496 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 89: +#line 335 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(EXTERN, 0); } +#line 2502 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 90: +#line 336 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(STATIC, 0); } +#line 2508 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 91: +#line 337 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(AUTO, 0); } +#line 2514 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 92: +#line 338 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(REGISTER, 0); } +#line 2520 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 93: +#line 342 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(VOID, 0); } +#line 2526 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 94: +#line 343 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(CHAR, 0); } +#line 2532 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 95: +#line 344 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(SHORT, 0); } +#line 2538 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 96: +#line 345 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(INT, 0); } +#line 2544 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 97: +#line 346 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(LONG, 0); } +#line 2550 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 98: +#line 347 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(FLOAT, 0); } +#line 2556 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 99: +#line 348 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(DOUBLE, 0); } +#line 2562 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 100: +#line 349 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(SIGNED, 0); } +#line 2568 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 101: +#line 350 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(UNSIGNED, 0); } +#line 2574 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 102: +#line 351 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2580 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 103: +#line 352 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2586 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 104: +#line 353 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(TYPE_NAME, 0); } +#line 2592 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 105: +#line 357 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 3, (yyvsp[-4].node), (yyvsp[-3].value), (yyvsp[-1].node)); + } +#line 2600 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 106: +#line 360 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-3].node), (yyvsp[-1].node)); + } +#line 2608 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 107: +#line 363 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 1, (yyvsp[-1].node)); + } +#line 2616 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 108: +#line 369 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(STRUCT, 0); } +#line 2622 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 109: +#line 370 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(STRUCT, 1); } +#line 2628 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 110: +#line 374 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2634 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 111: +#line 375 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 2642 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 112: +#line 381 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[-1].node)); + } +#line 2650 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 113: +#line 387 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 2658 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 114: +#line 390 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2664 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 115: +#line 391 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 2672 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 116: +#line 394 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2678 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 117: +#line 398 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2684 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 118: +#line 399 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2692 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 119: +#line 405 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2698 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 120: +#line 406 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 1, (yyvsp[0].node)); + } +#line 2706 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 121: +#line 409 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2714 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 122: +#line 415 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(ENUM, 1, (yyvsp[-1].node)); } +#line 2720 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 123: +#line 416 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(ENUM, 2, (yyvsp[-3].value), (yyvsp[-1].node)); } +#line 2726 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 124: +#line 417 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(ENUM, 1, (yyvsp[0].value)); } +#line 2732 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 125: +#line 421 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2738 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 126: +#line 422 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2746 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 127: +#line 428 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->value(IDENTIFIER, (void*)&((yylsp[0])), (yyvsp[0].value)); free((yyvsp[0].value)); + } +#line 2754 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 128: +#line 431 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 2, (yyvsp[-2].value), (yyvsp[0].node)); } +#line 2760 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 129: +#line 435 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2766 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 130: +#line 436 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2772 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 131: +#line 440 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 2780 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 132: +#line 443 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2786 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 133: +#line 447 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->value(IDENTIFIER, (void*)&((yylsp[0])), (yyvsp[0].value)); free((yyvsp[0].value)); + } +#line 2794 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 134: +#line 450 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 1, (yyvsp[-1].node)); + } +#line 2802 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 135: +#line 453 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-3].node), (yyvsp[-1].node)); + } +#line 2810 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 136: +#line 456 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 1, (yyvsp[-2].node)); + } +#line 2818 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 137: +#line 459 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-3].node), (yyvsp[-1].node)); + } +#line 2826 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 138: +#line 462 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-3].node), (yyvsp[-1].node)); + } +#line 2834 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 139: +#line 465 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 1, (yyvsp[-2].node)); + } +#line 2842 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 140: +#line 471 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 0); } +#line 2848 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 141: +#line 472 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 1, (yyvsp[0].node)); } +#line 2854 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 142: +#line 473 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 1, (yyvsp[0].node)); } +#line 2860 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 143: +#line 474 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 2, (yyvsp[-1].node), (yyvsp[0].node)); } +#line 2866 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 144: +#line 478 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2872 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 145: +#line 479 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 2880 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 146: +#line 486 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2886 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 147: +#line 487 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(ELLIPSIS, 1, (yyvsp[-2].node)); } +#line 2892 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 148: +#line 491 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2898 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 149: +#line 492 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 2906 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 150: +#line 498 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 2914 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 151: +#line 501 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 2922 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 152: +#line 504 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2928 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 153: +#line 508 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->value(IDENTIFIER, (void*)&((yylsp[0])), (yyvsp[0].value)); free((yyvsp[0].value)); + } +#line 2936 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 154: +#line 511 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-2].node), (yyvsp[0].value)); + } +#line 2944 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 155: +#line 517 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2950 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 156: +#line 518 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 2958 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 157: +#line 524 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2964 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 158: +#line 525 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 2970 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 159: +#line 526 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[-1].node); } +#line 2976 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 160: +#line 530 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[-1].node); } +#line 2982 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 161: +#line 531 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 0); } +#line 2988 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 162: +#line 532 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[-1].node); } +#line 2994 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 163: +#line 533 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[-2].node); } +#line 3000 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 164: +#line 534 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-3].node), (yyvsp[-1].node)); + } +#line 3008 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 165: +#line 537 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 0); } +#line 3014 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 166: +#line 538 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 1, (yyvsp[-1].node)); } +#line 3020 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 167: +#line 539 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 1, (yyvsp[-2].node)); } +#line 3026 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 168: +#line 540 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-3].node), (yyvsp[-1].node)); + } +#line 3034 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 169: +#line 546 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3040 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 170: +#line 547 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 1, (yyvsp[-1].node)); + } +#line 3048 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 171: +#line 550 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 1, (yyvsp[-2].node)); + } +#line 3056 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 172: +#line 556 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3062 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 173: +#line 557 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 3070 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 174: +#line 563 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3076 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 175: +#line 564 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3082 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 176: +#line 565 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3088 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 177: +#line 566 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3094 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 178: +#line 567 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3100 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 179: +#line 568 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3106 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 180: +#line 572 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(IDENTIFIER, 2, (yyvsp[-2].value), (yyvsp[0].node)); + } +#line 3114 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 181: +#line 575 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(CASE, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 3122 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 182: +#line 578 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(DEFAULT, 1, (yyvsp[0].node)); + } +#line 3130 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 183: +#line 584 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 0); + } +#line 3138 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 184: +#line 587 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 1, (yyvsp[-1].node)); + } +#line 3146 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 185: +#line 590 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 1, (yyvsp[-1].node)); + } +#line 3154 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 186: +#line 593 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[-1].node)); + } +#line 3162 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 187: +#line 599 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3168 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 188: +#line 600 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 3176 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 189: +#line 606 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3182 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 190: +#line 607 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(',', 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 3190 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 191: +#line 613 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 0); + } +#line 3198 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 192: +#line 616 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = (yyvsp[-1].node); + } +#line 3206 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 193: +#line 622 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(IF, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 3214 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 194: +#line 625 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(IF, 3, (yyvsp[-4].node), (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 3222 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 195: +#line 628 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(SWITCH, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 3230 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 196: +#line 634 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(WHILE, 2, (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 3238 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 197: +#line 637 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(DO, 2, (yyvsp[-2].node), (yyvsp[-5].node)); + } +#line 3246 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 198: +#line 640 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(FOR, 3, (yyvsp[-3].node), (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 3254 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 199: +#line 643 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(FOR, 4, (yyvsp[-4].node), (yyvsp[-3].node), (yyvsp[-2].node), (yyvsp[0].node)); + } +#line 3262 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 200: +#line 649 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(GOTO, 1, (yyvsp[-1].value)); } +#line 3268 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 201: +#line 650 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(CONTINUE, 0); } +#line 3274 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 202: +#line 651 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(BREAK, 0); } +#line 3280 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 203: +#line 652 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(RETURN, 0); } +#line 3286 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 204: +#line 653 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(RETURN, 1, (yyvsp[-1].node)); } +#line 3292 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 205: +#line 657 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3298 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 206: +#line 658 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = ctx->node(0, 2, (yyvsp[-1].node), (yyvsp[0].node)); } +#line 3304 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 207: +#line 662 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3310 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 208: +#line 663 "c89.ypp" /* yacc.c:1646 */ + { (yyval.node) = (yyvsp[0].node); } +#line 3316 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 209: +#line 667 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 4, (yyvsp[-3].node), (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 3324 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 210: +#line 670 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 3, (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 3332 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 211: +#line 673 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 3, (yyvsp[-2].node), (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 3340 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + case 212: +#line 676 "c89.ypp" /* yacc.c:1646 */ + { + (yyval.node) = ctx->node(0, 2, (yyvsp[-1].node), (yyvsp[0].node)); + } +#line 3348 "c89.tab.cpp" /* yacc.c:1646 */ + break; + + +#line 3352 "c89.tab.cpp" /* yacc.c:1646 */ + 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; + *++yylsp = yyloc; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + 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; +#if ! YYERROR_VERBOSE + yyerror (&yylloc, 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 (&yylloc, ctx, scanner, yymsgp); + if (yysyntax_error_status == 2) + goto yyexhaustedlab; + } +# undef YYSYNTAX_ERROR +#endif + } + + yyerror_range[1] = yylloc; + + 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, &yylloc, ctx, scanner); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| 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; + + yyerror_range[1] = yylsp[1-yylen]; + /* Do not reclaim the symbols of the rule whose 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: + 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; + + yyerror_range[1] = *yylsp; + yydestruct ("Error: popping", + yystos[yystate], yyvsp, yylsp, ctx, scanner); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + yyerror_range[2] = yylloc; + /* Using YYLLOC is tempting, but would change the location of + the lookahead. YYLOC is available though. */ + YYLLOC_DEFAULT (yyloc, yyerror_range, 2); + *++yylsp = yyloc; + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturn; + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturn; + +#if !defined yyoverflow || YYERROR_VERBOSE +/*-------------------------------------------------. +| yyexhaustedlab -- memory exhaustion comes here. | +`-------------------------------------------------*/ +yyexhaustedlab: + yyerror (&yylloc, 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, &yylloc, ctx, scanner); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + yystos[*yyssp], yyvsp, yylsp, ctx, scanner); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif +#if YYERROR_VERBOSE + if (yymsg != yymsgbuf) + YYSTACK_FREE (yymsg); +#endif + return yyresult; +} +#line 681 "c89.ypp" /* yacc.c:1906 */ + diff --git a/src/uscxml/plugins/datamodel/c89/parser/c89.tab.hpp b/src/uscxml/plugins/datamodel/c89/parser/c89.tab.hpp new file mode 100644 index 0000000..01eaea1 --- /dev/null +++ b/src/uscxml/plugins/datamodel/c89/parser/c89.tab.hpp @@ -0,0 +1,153 @@ +/* A Bison parser, made by GNU Bison 3.0.4. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015 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/>. */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + 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. */ + +#ifndef YY_C89_C89_TAB_HPP_INCLUDED +# define YY_C89_C89_TAB_HPP_INCLUDED +/* Debug traces. */ +#ifndef C89_DEBUG +# if defined YYDEBUG +#if YYDEBUG +# define C89_DEBUG 1 +# else +# define C89_DEBUG 0 +# endif +# else /* ! defined YYDEBUG */ +# define C89_DEBUG 1 +# endif /* ! defined YYDEBUG */ +#endif /* ! defined C89_DEBUG */ +#if C89_DEBUG +extern int c89_debug; +#endif + +/* Token type. */ +#ifndef C89_TOKENTYPE +# define C89_TOKENTYPE + enum c89_tokentype + { + IDENTIFIER = 258, + CONSTANT = 259, + STRING_LITERAL = 260, + SIZEOF = 261, + PTR_OP = 262, + INC_OP = 263, + DEC_OP = 264, + LEFT_OP = 265, + RIGHT_OP = 266, + LE_OP = 267, + GE_OP = 268, + EQ_OP = 269, + NE_OP = 270, + AND_OP = 271, + OR_OP = 272, + MUL_ASSIGN = 273, + DIV_ASSIGN = 274, + MOD_ASSIGN = 275, + ADD_ASSIGN = 276, + SUB_ASSIGN = 277, + LEFT_ASSIGN = 278, + RIGHT_ASSIGN = 279, + AND_ASSIGN = 280, + XOR_ASSIGN = 281, + OR_ASSIGN = 282, + TYPE_NAME = 283, + TYPEDEF = 284, + EXTERN = 285, + STATIC = 286, + AUTO = 287, + REGISTER = 288, + CHAR = 289, + SHORT = 290, + INT = 291, + LONG = 292, + SIGNED = 293, + UNSIGNED = 294, + FLOAT = 295, + DOUBLE = 296, + CONST = 297, + VOLATILE = 298, + VOID = 299, + STRUCT = 300, + UNION = 301, + ENUM = 302, + ELLIPSIS = 303, + CASE = 304, + DEFAULT = 305, + IF = 306, + ELSE = 307, + SWITCH = 308, + WHILE = 309, + DO = 310, + FOR = 311, + GOTO = 312, + CONTINUE = 313, + BREAK = 314, + RETURN = 315 + }; +#endif + +/* Value type. */ +#if ! defined C89_STYPE && ! defined C89_STYPE_IS_DECLARED + +union C89_STYPE +{ +#line 26 "c89.ypp" /* yacc.c:1909 */ + + uscxml::C89ParserNode* node; + char* value; + +#line 128 "c89.tab.hpp" /* yacc.c:1909 */ +}; + +typedef union C89_STYPE C89_STYPE; +# define C89_STYPE_IS_TRIVIAL 1 +# define C89_STYPE_IS_DECLARED 1 +#endif + +/* Location type. */ +#if ! defined C89_LTYPE && ! defined C89_LTYPE_IS_DECLARED +typedef struct C89_LTYPE C89_LTYPE; +struct C89_LTYPE +{ + int first_line; + int first_column; + int last_line; + int last_column; +}; +# define C89_LTYPE_IS_DECLARED 1 +# define C89_LTYPE_IS_TRIVIAL 1 +#endif + + + +int c89_parse (uscxml::C89Parser* ctx, void * scanner); + +#endif /* !YY_C89_C89_TAB_HPP_INCLUDED */ diff --git a/src/uscxml/plugins/datamodel/c89/parser/c89.ypp b/src/uscxml/plugins/datamodel/c89/parser/c89.ypp new file mode 100644 index 0000000..8e113c8 --- /dev/null +++ b/src/uscxml/plugins/datamodel/c89/parser/c89.ypp @@ -0,0 +1,681 @@ +%{ +#include "../C89Parser.h" +#include "c89.tab.hpp" +#include <sys/types.h> +#include <stdarg.h> + +#define YYMAXDEPTH 20000 // default is 10000 +#define YYDEBUG 1 +#define YYERROR_VERBOSE 1 + +extern int c89_lex (C89_STYPE* yylval_param, C89_LTYPE* yylloc_param, void* yyscanner); + +using namespace uscxml; +%} + +%pure-parser +%debug +%locations +%file-prefix "c89" +%parse-param { uscxml::C89Parser* ctx } +%lex-param {void * scanner} +%parse-param {void * scanner} +%define api.prefix {c89_} +%defines + +%union { + uscxml::C89ParserNode* node; + char* value; +} + +%error-verbose + +%type <node> primary_expression expression postfix_expression +%type <node> argument_expression_list assignment_expression +%type <node> unary_expression unary_operator cast_expression +%type <node> type_name assignment_operator +%type <node> multiplicative_expression additive_expression shift_expression +%type <node> relational_expression equality_expression and_expression +%type <node> exclusive_or_expression inclusive_or_expression +%type <node> logical_and_expression logical_or_expression conditional_expression +%type <node> specifier_qualifier_list abstract_declarator +%type <node> type_specifier type_qualifier struct_or_union_specifier +%type <node> enum_specifier pointer direct_abstract_declarator +%type <node> struct_or_union enumerator_list enumerator +%type <node> constant_expression type_qualifier_list +%type <node> parameter_type_list parameter_declaration parameter_list +%type <node> declaration_specifiers declarator storage_class_specifier +%type <node> init_declarator_list init_declarator initializer +%type <node> direct_declarator initializer_list identifier_list +%type <node> statement labeled_statement compound_statement expression_statement +%type <node> selection_statement iteration_statement jump_statement +%type <node> statement_list declaration_list declaration +%type <node> translation_unit external_declaration function_definition +%type <node> struct_declarator struct_declaration +%type <node> struct_declarator_list struct_declaration_list + +%type <node> VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED TYPE_NAME +%type <node> CONST VOLATILE + +%type <value> IDENTIFIER CONSTANT STRING_LITERAL + +%token IDENTIFIER CONSTANT STRING_LITERAL SIZEOF +%token PTR_OP INC_OP DEC_OP LEFT_OP RIGHT_OP LE_OP GE_OP EQ_OP NE_OP +%token AND_OP OR_OP MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN +%token SUB_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN +%token XOR_ASSIGN OR_ASSIGN TYPE_NAME + +%token TYPEDEF EXTERN STATIC AUTO REGISTER +%token CHAR SHORT INT LONG SIGNED UNSIGNED FLOAT DOUBLE CONST VOLATILE VOID +%token STRUCT UNION ENUM ELLIPSIS + +%token CASE DEFAULT IF ELSE SWITCH WHILE DO FOR GOTO CONTINUE BREAK RETURN + +%start translation_unit +%% + + +primary_expression + : IDENTIFIER { + $$ = ctx->value(IDENTIFIER, (void*)&(@1), $1); free($1); + } + | CONSTANT { + $$ = ctx->value(CONSTANT, (void*)&(@1), $1); free($1); + } + | STRING_LITERAL { + $$ = ctx->value(STRING_LITERAL, (void*)&(@1), $1); free($1); + } + | '(' expression ')' { + $$ = $2; + } + ; + +postfix_expression + : primary_expression { + $$ = $1; + } + | postfix_expression '[' expression ']' { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | postfix_expression '(' ')' { + $$ = ctx->node(__LINE__, 1, $1); + } + | postfix_expression '(' argument_expression_list ')' { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | postfix_expression '.' IDENTIFIER { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | postfix_expression PTR_OP IDENTIFIER { + $$ = ctx->node(PTR_OP, 2, $1, $3); + } + | postfix_expression INC_OP { + $$ = ctx->node(INC_OP, 1, $1); + } + | postfix_expression DEC_OP { + $$ = ctx->node(DEC_OP, 1, $1); + } + ; + +argument_expression_list + : assignment_expression { + $$ = $1; + } + | argument_expression_list ',' assignment_expression { + $$ = ctx->node(',', 2, $1, $3); + } + ; + +unary_expression + : postfix_expression { + $$ = $1; + } + | INC_OP unary_expression { + $$ = ctx->node(INC_OP, 1, $2); + } + | DEC_OP unary_expression { + $$ = ctx->node(DEC_OP, 1, $2); + } + | unary_operator cast_expression { + $$ = ctx->node(__LINE__, 2, $1, $2); + } + | SIZEOF unary_expression { + $$ = ctx->node(SIZEOF, 1, $2); + } + | SIZEOF '(' type_name ')' { + $$ = ctx->node(SIZEOF, 1, $3); + } + ; + +unary_operator + : '&' { $$ = ctx->node(__LINE__, 0); } + | '*' { $$ = ctx->node(__LINE__, 0); } + | '+' { $$ = ctx->node(__LINE__, 0); } + | '-' { $$ = ctx->node(__LINE__, 0); } + | '~' { $$ = ctx->node(__LINE__, 0); } + | '!' { $$ = ctx->node(__LINE__, 0); } + ; + +cast_expression + : unary_expression { $$ = $1; } + | '(' type_name ')' cast_expression { $$ = ctx->node(__LINE__, 2, $2, $4); } + ; + +multiplicative_expression + : cast_expression { $$ = $1; } + | multiplicative_expression '*' cast_expression { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | multiplicative_expression '/' cast_expression { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | multiplicative_expression '%' cast_expression { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + ; + +additive_expression + : multiplicative_expression { $$ = $1; } + | additive_expression '+' multiplicative_expression { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | additive_expression '-' multiplicative_expression { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + ; + +shift_expression + : additive_expression { $$ = $1; } + | shift_expression LEFT_OP additive_expression { + $$ = ctx->node(LEFT_OP, 2, $1, $3); + } + | shift_expression RIGHT_OP additive_expression { + $$ = ctx->node(RIGHT_OP, 2, $1, $3); + } + ; + +relational_expression + : shift_expression { $$ = $1; } + | relational_expression '<' shift_expression { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | relational_expression '>' shift_expression { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | relational_expression LE_OP shift_expression { + $$ = ctx->node(LE_OP, 2, $1, $3); + } + | relational_expression GE_OP shift_expression { + $$ = ctx->node(GE_OP, 2, $1, $3); + } + ; + +equality_expression + : relational_expression { $$ = $1; } + | equality_expression EQ_OP relational_expression { + $$ = ctx->node(EQ_OP, 2, $1, $3); + } + | equality_expression NE_OP relational_expression { + $$ = ctx->node(NE_OP, 2, $1, $3); + } + ; + +and_expression + : equality_expression { $$ = $1; } + | and_expression '&' equality_expression { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + ; + +exclusive_or_expression + : and_expression { $$ = $1; } + | exclusive_or_expression '^' and_expression { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + ; + +inclusive_or_expression + : exclusive_or_expression { $$ = $1; } + | inclusive_or_expression '|' exclusive_or_expression { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + ; + +logical_and_expression + : inclusive_or_expression { $$ = $1; } + | logical_and_expression AND_OP inclusive_or_expression { + $$ = ctx->node(AND_OP, 2, $1, $3); + } + ; + +logical_or_expression + : logical_and_expression { $$ = $1; } + | logical_or_expression OR_OP logical_and_expression { + $$ = ctx->node(OR_OP, 2, $1, $3); + } + ; + +conditional_expression + : logical_or_expression { $$ = $1; } + | logical_or_expression '?' expression ':' conditional_expression { + $$ = ctx->node(__LINE__, 3, $1, $3, $5); + } + ; + +assignment_expression + : conditional_expression { $$ = $1; } + | unary_expression assignment_operator assignment_expression { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + ; + +assignment_operator + : '=' { $$ = ctx->node('=', 0); } + | MUL_ASSIGN { $$ = ctx->node(MUL_ASSIGN, 0); } + | DIV_ASSIGN { $$ = ctx->node(DIV_ASSIGN, 0); } + | MOD_ASSIGN { $$ = ctx->node(MOD_ASSIGN, 0); } + | ADD_ASSIGN { $$ = ctx->node(ADD_ASSIGN, 0); } + | SUB_ASSIGN { $$ = ctx->node(SUB_ASSIGN, 0); } + | LEFT_ASSIGN { $$ = ctx->node(LEFT_ASSIGN, 0); } + | RIGHT_ASSIGN { $$ = ctx->node(RIGHT_ASSIGN, 0); } + | AND_ASSIGN { $$ = ctx->node(AND_ASSIGN, 0); } + | XOR_ASSIGN { $$ = ctx->node(XOR_ASSIGN, 0); } + | OR_ASSIGN { $$ = ctx->node(OR_ASSIGN, 0); } + ; + +expression + : assignment_expression { $$ = $1; } + | expression ',' assignment_expression { + $$ = ctx->node(',', 2, $1, $3); + } + ; + +constant_expression + : conditional_expression { $$ = $1; } + ; + +declaration + : declaration_specifiers ';' { $$ = $1; } + | declaration_specifiers init_declarator_list ';' { + $$ = ctx->node(',', 2, $1, $2); + } + ; + +declaration_specifiers + : storage_class_specifier { $$ = $1; } + | storage_class_specifier declaration_specifiers { + $$ = ctx->node(__LINE__, 2, $1, $2); + } + | type_specifier { $$ = $1; } + | type_specifier declaration_specifiers { + $$ = ctx->node(__LINE__, 2, $1, $2); + } + | type_qualifier { $$ = $1; } + | type_qualifier declaration_specifiers { + $$ = ctx->node(__LINE__, 2, $1, $2); + } + ; + +init_declarator_list + : init_declarator { $$ = $1; } + | init_declarator_list ',' init_declarator { + $$ = ctx->node(',', 2, $1, $3); + } + ; + +init_declarator + : declarator { $$ = $1; } + | declarator '=' initializer { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + ; + +storage_class_specifier + : TYPEDEF { $$ = ctx->node(TYPEDEF, 0); } + | EXTERN { $$ = ctx->node(EXTERN, 0); } + | STATIC { $$ = ctx->node(STATIC, 0); } + | AUTO { $$ = ctx->node(AUTO, 0); } + | REGISTER { $$ = ctx->node(REGISTER, 0); } + ; + +type_specifier + : VOID { $$ = ctx->node(VOID, 0); } + | CHAR { $$ = ctx->node(CHAR, 0); } + | SHORT { $$ = ctx->node(SHORT, 0); } + | INT { $$ = ctx->node(INT, 0); } + | LONG { $$ = ctx->node(LONG, 0); } + | FLOAT { $$ = ctx->node(FLOAT, 0); } + | DOUBLE { $$ = ctx->node(DOUBLE, 0); } + | SIGNED { $$ = ctx->node(SIGNED, 0); } + | UNSIGNED { $$ = ctx->node(UNSIGNED, 0); } + | struct_or_union_specifier { $$ = $1; } + | enum_specifier { $$ = $1; } + | TYPE_NAME { $$ = ctx->node(TYPE_NAME, 0); } + ; + +struct_or_union_specifier + : struct_or_union IDENTIFIER '{' struct_declaration_list '}' { + $$ = ctx->node(__LINE__, 3, $1, $2, $4); + } + | struct_or_union '{' struct_declaration_list '}' { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | struct_or_union IDENTIFIER { + $$ = ctx->node(__LINE__, 1, $1); + } + ; + +struct_or_union + : STRUCT { $$ = ctx->node(STRUCT, 0); } + | UNION { $$ = ctx->node(STRUCT, 1); } + ; + +struct_declaration_list + : struct_declaration { $$ = $1; } + | struct_declaration_list struct_declaration { + $$ = ctx->node(',', 2, $1, $2); + } + ; + +struct_declaration + : specifier_qualifier_list struct_declarator_list ';' { + $$ = ctx->node(__LINE__, 2, $1, $2); + } + ; + +specifier_qualifier_list + : type_specifier specifier_qualifier_list { + $$ = ctx->node(',', 2, $1, $2); + } + | type_specifier { $$ = $1; } + | type_qualifier specifier_qualifier_list { + $$ = ctx->node(__LINE__, 2, $1, $2); + } + | type_qualifier { $$ = $1; } + ; + +struct_declarator_list + : struct_declarator { $$ = $1; } + | struct_declarator_list ',' struct_declarator { + $$ = ctx->node(',', 2, $1, $3); + } + ; + +struct_declarator + : declarator { $$ = $1; } + | ':' constant_expression { + $$ = ctx->node(__LINE__, 1, $2); + } + | declarator ':' constant_expression { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + ; + +enum_specifier + : ENUM '{' enumerator_list '}' { $$ = ctx->node(ENUM, 1, $3); } + | ENUM IDENTIFIER '{' enumerator_list '}' { $$ = ctx->node(ENUM, 2, $2, $4); } + | ENUM IDENTIFIER { $$ = ctx->node(ENUM, 1, $2); } + ; + +enumerator_list + : enumerator { $$ = $1; } + | enumerator_list ',' enumerator { + $$ = ctx->node(',', 2, $1, $3); + } + ; + +enumerator + : IDENTIFIER { + $$ = ctx->value(IDENTIFIER, (void*)&(@1), $1); free($1); + } + | IDENTIFIER '=' constant_expression { $$ = ctx->node(__LINE__, 2, $1, $3); } + ; + +type_qualifier + : CONST { $$ = $1; } + | VOLATILE { $$ = $1; } + ; + +declarator + : pointer direct_declarator { + $$ = ctx->node(__LINE__, 2, $1, $2); + } + | direct_declarator { $$ = $1; } + ; + +direct_declarator + : IDENTIFIER { + $$ = ctx->value(IDENTIFIER, (void*)&(@1), $1); free($1); + } + | '(' declarator ')' { + $$ = ctx->node(__LINE__, 1, $2); + } + | direct_declarator '[' constant_expression ']' { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | direct_declarator '[' ']' { + $$ = ctx->node(__LINE__, 1, $1); + } + | direct_declarator '(' parameter_type_list ')' { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | direct_declarator '(' identifier_list ')' { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | direct_declarator '(' ')' { + $$ = ctx->node(__LINE__, 1, $1); + } + ; + +pointer + : '*' { $$ = ctx->node(__LINE__, 0); } + | '*' type_qualifier_list { $$ = ctx->node(__LINE__, 1, $2); } + | '*' pointer { $$ = ctx->node(__LINE__, 1, $2); } + | '*' type_qualifier_list pointer { $$ = ctx->node(__LINE__, 2, $2, $3); } + ; + +type_qualifier_list + : type_qualifier { $$ = $1; } + | type_qualifier_list type_qualifier { + $$ = ctx->node(',', 2, $1, $2); + } + ; + + +parameter_type_list + : parameter_list { $$ = $1; } + | parameter_list ',' ELLIPSIS { $$ = ctx->node(ELLIPSIS, 1, $1); } + ; + +parameter_list + : parameter_declaration { $$ = $1; } + | parameter_list ',' parameter_declaration { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + ; + +parameter_declaration + : declaration_specifiers declarator { + $$ = ctx->node(__LINE__, 2, $1, $2); + } + | declaration_specifiers abstract_declarator { + $$ = ctx->node(__LINE__, 2, $1, $2); + } + | declaration_specifiers { $$ = $1; } + ; + +identifier_list + : IDENTIFIER { + $$ = ctx->value(IDENTIFIER, (void*)&(@1), $1); free($1); + } + | identifier_list ',' IDENTIFIER { + $$ = ctx->node(',', 2, $1, $3); + } + ; + +type_name + : specifier_qualifier_list { $$ = $1; } + | specifier_qualifier_list abstract_declarator { + $$ = ctx->node(__LINE__, 2, $1, $2); + } + ; + +abstract_declarator + : pointer { $$ = $1; } + | direct_abstract_declarator { $$ = $1; } + | pointer direct_abstract_declarator { $$ = $1; } + ; + +direct_abstract_declarator + : '(' abstract_declarator ')' { $$ = $2; } + | '[' ']' { $$ = ctx->node(__LINE__, 0); } + | '[' constant_expression ']' { $$ = $2; } + | direct_abstract_declarator '[' ']' { $$ = $1; } + | direct_abstract_declarator '[' constant_expression ']' { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + | '(' ')' { $$ = ctx->node(__LINE__, 0); } + | '(' parameter_type_list ')' { $$ = ctx->node(__LINE__, 1, $2); } + | direct_abstract_declarator '(' ')' { $$ = ctx->node(__LINE__, 1, $1); } + | direct_abstract_declarator '(' parameter_type_list ')' { + $$ = ctx->node(__LINE__, 2, $1, $3); + } + ; + +initializer + : assignment_expression { $$ = $1; } + | '{' initializer_list '}' { + $$ = ctx->node(__LINE__, 1, $2); + } + | '{' initializer_list ',' '}' { + $$ = ctx->node(__LINE__, 1, $2); + } + ; + +initializer_list + : initializer { $$ = $1; } + | initializer_list ',' initializer { + $$ = ctx->node(',', 2, $1, $3); + } + ; + +statement + : labeled_statement { $$ = $1; } + | compound_statement { $$ = $1; } + | expression_statement { $$ = $1; } + | selection_statement { $$ = $1; } + | iteration_statement { $$ = $1; } + | jump_statement { $$ = $1; } + ; + +labeled_statement + : IDENTIFIER ':' statement { + $$ = ctx->node(IDENTIFIER, 2, $1, $3); + } + | CASE constant_expression ':' statement { + $$ = ctx->node(CASE, 2, $2, $4); + } + | DEFAULT ':' statement { + $$ = ctx->node(DEFAULT, 1, $3); + } + ; + +compound_statement + : '{' '}' { + $$ = ctx->node(__LINE__, 0); + } + | '{' statement_list '}' { + $$ = ctx->node(__LINE__, 1, $2); + } + | '{' declaration_list '}' { + $$ = ctx->node(__LINE__, 1, $2); + } + | '{' declaration_list statement_list '}' { + $$ = ctx->node(__LINE__, 2, $2, $3); + } + ; + +declaration_list + : declaration { $$ = $1; } + | declaration_list declaration { + $$ = ctx->node(',', 2, $1, $2); + } + ; + +statement_list + : statement { $$ = $1; } + | statement_list statement { + $$ = ctx->node(',', 2, $1, $2); + } + ; + +expression_statement + : ';' { + $$ = ctx->node(__LINE__, 0); + } + | expression ';' { + $$ = $1; + } + ; + +selection_statement + : IF '(' expression ')' statement { + $$ = ctx->node(IF, 2, $3, $5); + } + | IF '(' expression ')' statement ELSE statement { + $$ = ctx->node(IF, 3, $3, $5, $7); + } + | SWITCH '(' expression ')' statement { + $$ = ctx->node(SWITCH, 2, $3, $5); + } + ; + +iteration_statement + : WHILE '(' expression ')' statement { + $$ = ctx->node(WHILE, 2, $3, $5); + } + | DO statement WHILE '(' expression ')' ';' { + $$ = ctx->node(DO, 2, $5, $2); + } + | FOR '(' expression_statement expression_statement ')' statement { + $$ = ctx->node(FOR, 3, $3, $4, $6); + } + | FOR '(' expression_statement expression_statement expression ')' statement { + $$ = ctx->node(FOR, 4, $3, $4, $5, $7); + } + ; + +jump_statement + : GOTO IDENTIFIER ';' { $$ = ctx->node(GOTO, 1, $2); } + | CONTINUE ';' { $$ = ctx->node(CONTINUE, 0); } + | BREAK ';' { $$ = ctx->node(BREAK, 0); } + | RETURN ';' { $$ = ctx->node(RETURN, 0); } + | RETURN expression ';' { $$ = ctx->node(RETURN, 1, $2); } + ; + +translation_unit + : external_declaration { $$ = $1; } + | translation_unit external_declaration { $$ = ctx->node(__LINE__, 2, $1, $2); } + ; + +external_declaration + : function_definition { $$ = $1; } + | declaration { $$ = $1; } + ; + +function_definition + : declaration_specifiers declarator declaration_list compound_statement { + $$ = ctx->node(__LINE__, 4, $1, $2, $3, $4); + } + | declaration_specifiers declarator compound_statement { + $$ = ctx->node(__LINE__, 3, $1, $2, $3); + } + | declarator declaration_list compound_statement { + $$ = ctx->node(__LINE__, 3, $1, $2, $3); + } + | declarator compound_statement { + $$ = ctx->node(__LINE__, 2, $1, $2); + } + ; + +%% diff --git a/src/uscxml/server/HTTPServer.cpp b/src/uscxml/server/HTTPServer.cpp index 044cb6c..071846c 100644 --- a/src/uscxml/server/HTTPServer.cpp +++ b/src/uscxml/server/HTTPServer.cpp @@ -386,9 +386,14 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD key = item.substr(0, equalPos); value = item.substr(equalPos + 1, item.length() - (equalPos + 1)); - char* keyCStr = evhttp_decode_uri(key.c_str()); - char* valueCStr = evhttp_decode_uri(value.c_str()); - request.data.compound["content"].compound[keyCStr] = Data(valueCStr, Data::VERBATIM); + size_t keyCStrLen = 0; + size_t valueCStrLen = 0; + char* keyCStr = evhttp_uridecode(key.c_str(), 1, &keyCStrLen); + char* valueCStr = evhttp_uridecode(value.c_str(), 1, &valueCStrLen); + std::string decKey = std::string(keyCStr, keyCStrLen); + std::string decValue = std::string(valueCStr, valueCStrLen); + + request.data.compound["content"].compound[decKey] = Data(decValue, Data::VERBATIM); free(keyCStr); free(valueCStr); key.clear(); @@ -412,6 +417,12 @@ void HTTPServer::httpRecvReqCallback(struct evhttp_request *req, void *callbackD request.raw = raw.str(); +#if 0 + std::cout << "====" << std::endl; + std::cout << request.raw << std::endl; + std::cout << "====" << std::endl; +#endif + // try with the handler registered for path first bool answered = false; if (callbackData != NULL) diff --git a/src/uscxml/util/URL.cpp b/src/uscxml/util/URL.cpp index 2e98fce..23b9854 100644 --- a/src/uscxml/util/URL.cpp +++ b/src/uscxml/util/URL.cpp @@ -79,10 +79,10 @@ void URLImpl::prepareException(ErrorEvent& exception, int errorCode, const std:: } } -URLImpl::URLImpl() : _handle(NULL), _isDownloaded(false), _hasFailed(false) { +URLImpl::URLImpl() : _handle(NULL), _requestType(GET), _isDownloaded(false), _hasFailed(false) { } -URLImpl::URLImpl(const std::string& url) : _orig(url), _handle(NULL), _isDownloaded(false), _hasFailed(false) { +URLImpl::URLImpl(const std::string& url) : _orig(url), _handle(NULL), _requestType(GET), _isDownloaded(false), _hasFailed(false) { UriParserStateA state; state.uri = &_uri; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 8c6765c..bba5e5f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -5,6 +5,7 @@ find_program(SPIN spin) find_program(CC gcc) find_program(CXX g++) find_program(ANT_EXECUTABLE ant) +find_program(PERL perl) function(USCXML_TEST_COMPILE) set(options BUILD_ONLY) @@ -28,6 +29,7 @@ USCXML_TEST_COMPILE(NAME test-url LABEL general/test-url FILES src/test-url.cpp) USCXML_TEST_COMPILE(NAME test-lifecycle LABEL general/test-lifecycle FILES src/test-lifecycle.cpp) USCXML_TEST_COMPILE(NAME test-validating LABEL general/test-validating FILES src/test-validating.cpp) USCXML_TEST_COMPILE(NAME test-snippets LABEL general/test-snippets FILES src/test-snippets.cpp) +USCXML_TEST_COMPILE(NAME test-c89-parser LABEL general/test-c89-parser FILES src/test-c89-parser.cpp) # test-stress is not an automated test add_executable(test-stress src/test-stress.cpp) @@ -102,6 +104,19 @@ foreach(USCXML_HEADER ${USCXML_PUBLIC_HEADERS} ) endforeach() +# debugger REST API +if (PERL) + add_test(NAME "general/test-debug-api" + COMMAND ${PERL} + "${PROJECT_SOURCE_DIR}/test/src/test-http-debugger.pl" + "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/uscxml-browser" + WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/test/src + ) + set_property(TEST "general/test-debug-api" PROPERTY LABELS "general/test-debug-api") + set_tests_properties("general/test-debug-api" PROPERTIES DEPENDS uscxml-browser) + +endif() + # declare W3C tests if (NOT BUILD_MINIMAL) diff --git a/test/src/perl/JSON.pm b/test/src/perl/JSON.pm new file mode 100644 index 0000000..f57c555 --- /dev/null +++ b/test/src/perl/JSON.pm @@ -0,0 +1,2267 @@ +package JSON; + + +use strict; +use Carp (); +use base qw(Exporter); +@JSON::EXPORT = qw(from_json to_json jsonToObj objToJson encode_json decode_json); + +BEGIN { + $JSON::VERSION = '2.53'; + $JSON::DEBUG = 0 unless (defined $JSON::DEBUG); + $JSON::DEBUG = $ENV{ PERL_JSON_DEBUG } if exists $ENV{ PERL_JSON_DEBUG }; +} + +my $Module_XS = 'JSON::XS'; +my $Module_PP = 'JSON::PP'; +my $Module_bp = 'JSON::backportPP'; # included in JSON distribution +my $PP_Version = '2.27200'; +my $XS_Version = '2.27'; + + +# XS and PP common methods + +my @PublicMethods = qw/ + ascii latin1 utf8 pretty indent space_before space_after relaxed canonical allow_nonref + allow_blessed convert_blessed filter_json_object filter_json_single_key_object + shrink max_depth max_size encode decode decode_prefix allow_unknown +/; + +my @Properties = qw/ + ascii latin1 utf8 indent space_before space_after relaxed canonical allow_nonref + allow_blessed convert_blessed shrink max_depth max_size allow_unknown +/; + +my @XSOnlyMethods = qw//; # Currently nothing + +my @PPOnlyMethods = qw/ + indent_length sort_by + allow_singlequote allow_bignum loose allow_barekey escape_slash as_nonblessed +/; # JSON::PP specific + + +# used in _load_xs and _load_pp ($INSTALL_ONLY is not used currently) +my $_INSTALL_DONT_DIE = 1; # When _load_xs fails to load XS, don't die. +my $_INSTALL_ONLY = 2; # Don't call _set_methods() +my $_ALLOW_UNSUPPORTED = 0; +my $_UNIV_CONV_BLESSED = 0; +my $_USSING_bpPP = 0; + + +# Check the environment variable to decide worker module. + +unless ($JSON::Backend) { + $JSON::DEBUG and Carp::carp("Check used worker module..."); + + my $backend = exists $ENV{PERL_JSON_BACKEND} ? $ENV{PERL_JSON_BACKEND} : 1; + + if ($backend eq '1' or $backend =~ /JSON::XS\s*,\s*JSON::PP/) { + _load_xs($_INSTALL_DONT_DIE) or _load_pp(); + } + elsif ($backend eq '0' or $backend eq 'JSON::PP') { + _load_pp(); + } + elsif ($backend eq '2' or $backend eq 'JSON::XS') { + _load_xs(); + } + elsif ($backend eq 'JSON::backportPP') { + $_USSING_bpPP = 1; + _load_pp(); + } + else { + Carp::croak "The value of environmental variable 'PERL_JSON_BACKEND' is invalid."; + } +} + + +sub import { + my $pkg = shift; + my @what_to_export; + my $no_export; + + for my $tag (@_) { + if ($tag eq '-support_by_pp') { + if (!$_ALLOW_UNSUPPORTED++) { + JSON::Backend::XS + ->support_by_pp(@PPOnlyMethods) if ($JSON::Backend eq $Module_XS); + } + next; + } + elsif ($tag eq '-no_export') { + $no_export++, next; + } + elsif ( $tag eq '-convert_blessed_universally' ) { + eval q| + require B; + *UNIVERSAL::TO_JSON = sub { + my $b_obj = B::svref_2object( $_[0] ); + return $b_obj->isa('B::HV') ? { %{ $_[0] } } + : $b_obj->isa('B::AV') ? [ @{ $_[0] } ] + : undef + ; + } + | if ( !$_UNIV_CONV_BLESSED++ ); + next; + } + push @what_to_export, $tag; + } + + return if ($no_export); + + __PACKAGE__->export_to_level(1, $pkg, @what_to_export); +} + + +# OBSOLETED + +sub jsonToObj { + my $alternative = 'from_json'; + if (defined $_[0] and UNIVERSAL::isa($_[0], 'JSON')) { + shift @_; $alternative = 'decode'; + } + Carp::carp "'jsonToObj' will be obsoleted. Please use '$alternative' instead."; + return JSON::from_json(@_); +}; + +sub objToJson { + my $alternative = 'to_json'; + if (defined $_[0] and UNIVERSAL::isa($_[0], 'JSON')) { + shift @_; $alternative = 'encode'; + } + Carp::carp "'objToJson' will be obsoleted. Please use '$alternative' instead."; + JSON::to_json(@_); +}; + + +# INTERFACES + +sub to_json ($@) { + if ( + ref($_[0]) eq 'JSON' + or (@_ > 2 and $_[0] eq 'JSON') + ) { + Carp::croak "to_json should not be called as a method."; + } + my $json = new JSON; + + if (@_ == 2 and ref $_[1] eq 'HASH') { + my $opt = $_[1]; + for my $method (keys %$opt) { + $json->$method( $opt->{$method} ); + } + } + + $json->encode($_[0]); +} + + +sub from_json ($@) { + if ( ref($_[0]) eq 'JSON' or $_[0] eq 'JSON' ) { + Carp::croak "from_json should not be called as a method."; + } + my $json = new JSON; + + if (@_ == 2 and ref $_[1] eq 'HASH') { + my $opt = $_[1]; + for my $method (keys %$opt) { + $json->$method( $opt->{$method} ); + } + } + + return $json->decode( $_[0] ); +} + + +sub true { $JSON::true } + +sub false { $JSON::false } + +sub null { undef; } + + +sub require_xs_version { $XS_Version; } + +sub backend { + my $proto = shift; + $JSON::Backend; +} + +#*module = *backend; + + +sub is_xs { + return $_[0]->module eq $Module_XS; +} + + +sub is_pp { + return not $_[0]->xs; +} + + +sub pureperl_only_methods { @PPOnlyMethods; } + + +sub property { + my ($self, $name, $value) = @_; + + if (@_ == 1) { + my %props; + for $name (@Properties) { + my $method = 'get_' . $name; + if ($name eq 'max_size') { + my $value = $self->$method(); + $props{$name} = $value == 1 ? 0 : $value; + next; + } + $props{$name} = $self->$method(); + } + return \%props; + } + elsif (@_ > 3) { + Carp::croak('property() can take only the option within 2 arguments.'); + } + elsif (@_ == 2) { + if ( my $method = $self->can('get_' . $name) ) { + if ($name eq 'max_size') { + my $value = $self->$method(); + return $value == 1 ? 0 : $value; + } + $self->$method(); + } + } + else { + $self->$name($value); + } + +} + + + +# INTERNAL + +sub _load_xs { + my $opt = shift; + + $JSON::DEBUG and Carp::carp "Load $Module_XS."; + + # if called after install module, overload is disable.... why? + JSON::Boolean::_overrride_overload($Module_XS); + JSON::Boolean::_overrride_overload($Module_PP); + + eval qq| + use $Module_XS $XS_Version (); + |; + + if ($@) { + if (defined $opt and $opt & $_INSTALL_DONT_DIE) { + $JSON::DEBUG and Carp::carp "Can't load $Module_XS...($@)"; + return 0; + } + Carp::croak $@; + } + + unless (defined $opt and $opt & $_INSTALL_ONLY) { + _set_module( $JSON::Backend = $Module_XS ); + my $data = join("", <DATA>); # this code is from Jcode 2.xx. + close(DATA); + eval $data; + JSON::Backend::XS->init; + } + + return 1; +}; + + +sub _load_pp { + my $opt = shift; + my $backend = $_USSING_bpPP ? $Module_bp : $Module_PP; + + $JSON::DEBUG and Carp::carp "Load $backend."; + + # if called after install module, overload is disable.... why? + JSON::Boolean::_overrride_overload($Module_XS); + JSON::Boolean::_overrride_overload($backend); + + if ( $_USSING_bpPP ) { + eval qq| require $backend |; + } + else { + eval qq| use $backend $PP_Version () |; + } + + if ($@) { + if ( $backend eq $Module_PP ) { + $JSON::DEBUG and Carp::carp "Can't load $Module_PP ($@), so try to load $Module_bp"; + $_USSING_bpPP++; + $backend = $Module_bp; + JSON::Boolean::_overrride_overload($backend); + local $^W; # if PP installed but invalid version, backportPP redifines methods. + eval qq| require $Module_bp |; + } + Carp::croak $@ if $@; + } + + unless (defined $opt and $opt & $_INSTALL_ONLY) { + _set_module( $JSON::Backend = $Module_PP ); # even if backportPP, set $Backend with 'JSON::PP' + JSON::Backend::PP->init; + } +}; + + +sub _set_module { + return if defined $JSON::true; + + my $module = shift; + + local $^W; + no strict qw(refs); + + $JSON::true = ${"$module\::true"}; + $JSON::false = ${"$module\::false"}; + + push @JSON::ISA, $module; + push @{"$module\::Boolean::ISA"}, qw(JSON::Boolean); + + *{"JSON::is_bool"} = \&{"$module\::is_bool"}; + + for my $method ($module eq $Module_XS ? @PPOnlyMethods : @XSOnlyMethods) { + *{"JSON::$method"} = sub { + Carp::carp("$method is not supported in $module."); + $_[0]; + }; + } + + return 1; +} + + + +# +# JSON Boolean +# + +package JSON::Boolean; + +my %Installed; + +sub _overrride_overload { + return if ($Installed{ $_[0] }++); + + my $boolean = $_[0] . '::Boolean'; + + eval sprintf(q| + package %s; + use overload ( + '""' => sub { ${$_[0]} == 1 ? 'true' : 'false' }, + 'eq' => sub { + my ($obj, $op) = ref ($_[0]) ? ($_[0], $_[1]) : ($_[1], $_[0]); + if ($op eq 'true' or $op eq 'false') { + return "$obj" eq 'true' ? 'true' eq $op : 'false' eq $op; + } + else { + return $obj ? 1 == $op : 0 == $op; + } + }, + ); + |, $boolean); + + if ($@) { Carp::croak $@; } + + return 1; +} + + +# +# Helper classes for Backend Module (PP) +# + +package JSON::Backend::PP; + +sub init { + local $^W; + no strict qw(refs); # this routine may be called after JSON::Backend::XS init was called. + *{"JSON::decode_json"} = \&{"JSON::PP::decode_json"}; + *{"JSON::encode_json"} = \&{"JSON::PP::encode_json"}; + *{"JSON::PP::is_xs"} = sub { 0 }; + *{"JSON::PP::is_pp"} = sub { 1 }; + return 1; +} + +# +# To save memory, the below lines are read only when XS backend is used. +# + +package JSON; + +1; +__DATA__ + + +# +# Helper classes for Backend Module (XS) +# + +package JSON::Backend::XS; + +use constant INDENT_LENGTH_FLAG => 15 << 12; + +use constant UNSUPPORTED_ENCODE_FLAG => { + ESCAPE_SLASH => 0x00000010, + ALLOW_BIGNUM => 0x00000020, + AS_NONBLESSED => 0x00000040, + EXPANDED => 0x10000000, # for developer's +}; + +use constant UNSUPPORTED_DECODE_FLAG => { + LOOSE => 0x00000001, + ALLOW_BIGNUM => 0x00000002, + ALLOW_BAREKEY => 0x00000004, + ALLOW_SINGLEQUOTE => 0x00000008, + EXPANDED => 0x20000000, # for developer's +}; + + +sub init { + local $^W; + no strict qw(refs); + *{"JSON::decode_json"} = \&{"JSON::XS::decode_json"}; + *{"JSON::encode_json"} = \&{"JSON::XS::encode_json"}; + *{"JSON::XS::is_xs"} = sub { 1 }; + *{"JSON::XS::is_pp"} = sub { 0 }; + return 1; +} + + +sub support_by_pp { + my ($class, @methods) = @_; + + local $^W; + no strict qw(refs); + + my $JSON_XS_encode_orignal = \&JSON::XS::encode; + my $JSON_XS_decode_orignal = \&JSON::XS::decode; + my $JSON_XS_incr_parse_orignal = \&JSON::XS::incr_parse; + + *JSON::XS::decode = \&JSON::Backend::XS::Supportable::_decode; + *JSON::XS::encode = \&JSON::Backend::XS::Supportable::_encode; + *JSON::XS::incr_parse = \&JSON::Backend::XS::Supportable::_incr_parse; + + *{JSON::XS::_original_decode} = $JSON_XS_decode_orignal; + *{JSON::XS::_original_encode} = $JSON_XS_encode_orignal; + *{JSON::XS::_original_incr_parse} = $JSON_XS_incr_parse_orignal; + + push @JSON::Backend::XS::Supportable::ISA, 'JSON'; + + my $pkg = 'JSON::Backend::XS::Supportable'; + + *{JSON::new} = sub { + my $proto = new JSON::XS; $$proto = 0; + bless $proto, $pkg; + }; + + + for my $method (@methods) { + my $flag = uc($method); + my $type |= (UNSUPPORTED_ENCODE_FLAG->{$flag} || 0); + $type |= (UNSUPPORTED_DECODE_FLAG->{$flag} || 0); + + next unless($type); + + $pkg->_make_unsupported_method($method => $type); + } + + push @{"JSON::XS::Boolean::ISA"}, qw(JSON::PP::Boolean); + push @{"JSON::PP::Boolean::ISA"}, qw(JSON::Boolean); + + $JSON::DEBUG and Carp::carp("set -support_by_pp mode."); + + return 1; +} + + + + +# +# Helper classes for XS +# + +package JSON::Backend::XS::Supportable; + +$Carp::Internal{'JSON::Backend::XS::Supportable'} = 1; + +sub _make_unsupported_method { + my ($pkg, $method, $type) = @_; + + local $^W; + no strict qw(refs); + + *{"$pkg\::$method"} = sub { + local $^W; + if (defined $_[1] ? $_[1] : 1) { + ${$_[0]} |= $type; + } + else { + ${$_[0]} &= ~$type; + } + $_[0]; + }; + + *{"$pkg\::get_$method"} = sub { + ${$_[0]} & $type ? 1 : ''; + }; + +} + + +sub _set_for_pp { + JSON::_load_pp( $_INSTALL_ONLY ); + + my $type = shift; + my $pp = new JSON::PP; + my $prop = $_[0]->property; + + for my $name (keys %$prop) { + $pp->$name( $prop->{$name} ? $prop->{$name} : 0 ); + } + + my $unsupported = $type eq 'encode' ? JSON::Backend::XS::UNSUPPORTED_ENCODE_FLAG + : JSON::Backend::XS::UNSUPPORTED_DECODE_FLAG; + my $flags = ${$_[0]} || 0; + + for my $name (keys %$unsupported) { + next if ($name eq 'EXPANDED'); # for developer's + my $enable = ($flags & $unsupported->{$name}) ? 1 : 0; + my $method = lc $name; + $pp->$method($enable); + } + + $pp->indent_length( $_[0]->get_indent_length ); + + return $pp; +} + +sub _encode { # using with PP encod + if (${$_[0]}) { + _set_for_pp('encode' => @_)->encode($_[1]); + } + else { + $_[0]->_original_encode( $_[1] ); + } +} + + +sub _decode { # if unsupported-flag is set, use PP + if (${$_[0]}) { + _set_for_pp('decode' => @_)->decode($_[1]); + } + else { + $_[0]->_original_decode( $_[1] ); + } +} + + +sub decode_prefix { # if unsupported-flag is set, use PP + _set_for_pp('decode' => @_)->decode_prefix($_[1]); +} + + +sub _incr_parse { + if (${$_[0]}) { + _set_for_pp('decode' => @_)->incr_parse($_[1]); + } + else { + $_[0]->_original_incr_parse( $_[1] ); + } +} + + +sub get_indent_length { + ${$_[0]} << 4 >> 16; +} + + +sub indent_length { + my $length = $_[1]; + + if (!defined $length or $length > 15 or $length < 0) { + Carp::carp "The acceptable range of indent_length() is 0 to 15."; + } + else { + local $^W; + $length <<= 12; + ${$_[0]} &= ~ JSON::Backend::XS::INDENT_LENGTH_FLAG; + ${$_[0]} |= $length; + *JSON::XS::encode = \&JSON::Backend::XS::Supportable::_encode; + } + + $_[0]; +} + + +1; +__END__ + +=head1 NAME + +JSON - JSON (JavaScript Object Notation) encoder/decoder + +=head1 SYNOPSIS + + use JSON; # imports encode_json, decode_json, to_json and from_json. + + # simple and fast interfaces (expect/generate UTF-8) + + $utf8_encoded_json_text = encode_json $perl_hash_or_arrayref; + $perl_hash_or_arrayref = decode_json $utf8_encoded_json_text; + + # OO-interface + + $json = JSON->new->allow_nonref; + + $json_text = $json->encode( $perl_scalar ); + $perl_scalar = $json->decode( $json_text ); + + $pretty_printed = $json->pretty->encode( $perl_scalar ); # pretty-printing + + # If you want to use PP only support features, call with '-support_by_pp' + # When XS unsupported feature is enable, using PP (de|en)code instead of XS ones. + + use JSON -support_by_pp; + + # option-acceptable interfaces (expect/generate UNICODE by default) + + $json_text = to_json( $perl_scalar, { ascii => 1, pretty => 1 } ); + $perl_scalar = from_json( $json_text, { utf8 => 1 } ); + + # Between (en|de)code_json and (to|from)_json, if you want to write + # a code which communicates to an outer world (encoded in UTF-8), + # recommend to use (en|de)code_json. + +=head1 VERSION + + 2.53 + +This version is compatible with JSON::XS B<2.27> and later. + + +=head1 NOTE + +JSON::PP was inculded in C<JSON> distribution. +It comes to be a perl core module in Perl 5.14. +And L<JSON::PP> will be split away it. + +C<JSON> distribution will inculde yet another JSON::PP modules. +They are JSNO::backportPP and so on. JSON.pm should work as it did at all. + +=head1 DESCRIPTION + + ************************** CAUTION ******************************** + * This is 'JSON module version 2' and there are many differences * + * to version 1.xx * + * Please check your applications useing old version. * + * See to 'INCOMPATIBLE CHANGES TO OLD VERSION' * + ******************************************************************* + +JSON (JavaScript Object Notation) is a simple data format. +See to L<http://www.json.org/> and C<RFC4627>(L<http://www.ietf.org/rfc/rfc4627.txt>). + +This module converts Perl data structures to JSON and vice versa using either +L<JSON::XS> or L<JSON::PP>. + +JSON::XS is the fastest and most proper JSON module on CPAN which must be +compiled and installed in your environment. +JSON::PP is a pure-Perl module which is bundled in this distribution and +has a strong compatibility to JSON::XS. + +This module try to use JSON::XS by default and fail to it, use JSON::PP instead. +So its features completely depend on JSON::XS or JSON::PP. + +See to L<BACKEND MODULE DECISION>. + +To distinguish the module name 'JSON' and the format type JSON, +the former is quoted by CE<lt>E<gt> (its results vary with your using media), +and the latter is left just as it is. + +Module name : C<JSON> + +Format type : JSON + +=head2 FEATURES + +=over + +=item * correct unicode handling + +This module (i.e. backend modules) knows how to handle Unicode, documents +how and when it does so, and even documents what "correct" means. + +Even though there are limitations, this feature is available since Perl version 5.6. + +JSON::XS requires Perl 5.8.2 (but works correctly in 5.8.8 or later), so in older versions +C<JSON> sholud call JSON::PP as the backend which can be used since Perl 5.005. + +With Perl 5.8.x JSON::PP works, but from 5.8.0 to 5.8.2, because of a Perl side problem, +JSON::PP works slower in the versions. And in 5.005, the Unicode handling is not available. +See to L<JSON::PP/UNICODE HANDLING ON PERLS> for more information. + +See also to L<JSON::XS/A FEW NOTES ON UNICODE AND PERL> +and L<JSON::XS/ENCODING/CODESET_FLAG_NOTES>. + + +=item * round-trip integrity + +When you serialise a perl data structure using only data types supported +by JSON and Perl, the deserialised data structure is identical on the Perl +level. (e.g. the string "2.0" doesn't suddenly become "2" just because +it looks like a number). There I<are> minor exceptions to this, read the +L</MAPPING> section below to learn about those. + + +=item * strict checking of JSON correctness + +There is no guessing, no generating of illegal JSON texts by default, +and only JSON is accepted as input by default (the latter is a security +feature). + +See to L<JSON::XS/FEATURES> and L<JSON::PP/FEATURES>. + +=item * fast + +This module returns a JSON::XS object itself if available. +Compared to other JSON modules and other serialisers such as Storable, +JSON::XS usually compares favourably in terms of speed, too. + +If not available, C<JSON> returns a JSON::PP object instead of JSON::XS and +it is very slow as pure-Perl. + +=item * simple to use + +This module has both a simple functional interface as well as an +object oriented interface interface. + +=item * reasonably versatile output formats + +You can choose between the most compact guaranteed-single-line format possible +(nice for simple line-based protocols), a pure-ASCII format (for when your transport +is not 8-bit clean, still supports the whole Unicode range), or a pretty-printed +format (for when you want to read that stuff). Or you can combine those features +in whatever way you like. + +=back + +=head1 FUNCTIONAL INTERFACE + +Some documents are copied and modified from L<JSON::XS/FUNCTIONAL INTERFACE>. +C<to_json> and C<from_json> are additional functions. + +=head2 encode_json + + $json_text = encode_json $perl_scalar + +Converts the given Perl data structure to a UTF-8 encoded, binary string. + +This function call is functionally identical to: + + $json_text = JSON->new->utf8->encode($perl_scalar) + +=head2 decode_json + + $perl_scalar = decode_json $json_text + +The opposite of C<encode_json>: expects an UTF-8 (binary) string and tries +to parse that as an UTF-8 encoded JSON text, returning the resulting +reference. + +This function call is functionally identical to: + + $perl_scalar = JSON->new->utf8->decode($json_text) + + +=head2 to_json + + $json_text = to_json($perl_scalar) + +Converts the given Perl data structure to a json string. + +This function call is functionally identical to: + + $json_text = JSON->new->encode($perl_scalar) + +Takes a hash reference as the second. + + $json_text = to_json($perl_scalar, $flag_hashref) + +So, + + $json_text = to_json($perl_scalar, {utf8 => 1, pretty => 1}) + +equivalent to: + + $json_text = JSON->new->utf8(1)->pretty(1)->encode($perl_scalar) + +If you want to write a modern perl code which communicates to outer world, +you should use C<encode_json> (supposed that JSON data are encoded in UTF-8). + +=head2 from_json + + $perl_scalar = from_json($json_text) + +The opposite of C<to_json>: expects a json string and tries +to parse it, returning the resulting reference. + +This function call is functionally identical to: + + $perl_scalar = JSON->decode($json_text) + +Takes a hash reference as the second. + + $perl_scalar = from_json($json_text, $flag_hashref) + +So, + + $perl_scalar = from_json($json_text, {utf8 => 1}) + +equivalent to: + + $perl_scalar = JSON->new->utf8(1)->decode($json_text) + +If you want to write a modern perl code which communicates to outer world, +you should use C<decode_json> (supposed that JSON data are encoded in UTF-8). + +=head2 JSON::is_bool + + $is_boolean = JSON::is_bool($scalar) + +Returns true if the passed scalar represents either JSON::true or +JSON::false, two constants that act like C<1> and C<0> respectively +and are also used to represent JSON C<true> and C<false> in Perl strings. + +=head2 JSON::true + +Returns JSON true value which is blessed object. +It C<isa> JSON::Boolean object. + +=head2 JSON::false + +Returns JSON false value which is blessed object. +It C<isa> JSON::Boolean object. + +=head2 JSON::null + +Returns C<undef>. + +See L<MAPPING>, below, for more information on how JSON values are mapped to +Perl. + +=head1 HOW DO I DECODE A DATA FROM OUTER AND ENCODE TO OUTER + +This section supposes that your perl vresion is 5.8 or later. + +If you know a JSON text from an outer world - a network, a file content, and so on, +is encoded in UTF-8, you should use C<decode_json> or C<JSON> module object +with C<utf8> enable. And the decoded result will contain UNICODE characters. + + # from network + my $json = JSON->new->utf8; + my $json_text = CGI->new->param( 'json_data' ); + my $perl_scalar = $json->decode( $json_text ); + + # from file content + local $/; + open( my $fh, '<', 'json.data' ); + $json_text = <$fh>; + $perl_scalar = decode_json( $json_text ); + +If an outer data is not encoded in UTF-8, firstly you should C<decode> it. + + use Encode; + local $/; + open( my $fh, '<', 'json.data' ); + my $encoding = 'cp932'; + my $unicode_json_text = decode( $encoding, <$fh> ); # UNICODE + + # or you can write the below code. + # + # open( my $fh, "<:encoding($encoding)", 'json.data' ); + # $unicode_json_text = <$fh>; + +In this case, C<$unicode_json_text> is of course UNICODE string. +So you B<cannot> use C<decode_json> nor C<JSON> module object with C<utf8> enable. +Instead of them, you use C<JSON> module object with C<utf8> disable or C<from_json>. + + $perl_scalar = $json->utf8(0)->decode( $unicode_json_text ); + # or + $perl_scalar = from_json( $unicode_json_text ); + +Or C<encode 'utf8'> and C<decode_json>: + + $perl_scalar = decode_json( encode( 'utf8', $unicode_json_text ) ); + # this way is not efficient. + +And now, you want to convert your C<$perl_scalar> into JSON data and +send it to an outer world - a network or a file content, and so on. + +Your data usually contains UNICODE strings and you want the converted data to be encoded +in UTF-8, you should use C<encode_json> or C<JSON> module object with C<utf8> enable. + + print encode_json( $perl_scalar ); # to a network? file? or display? + # or + print $json->utf8->encode( $perl_scalar ); + +If C<$perl_scalar> does not contain UNICODE but C<$encoding>-encoded strings +for some reason, then its characters are regarded as B<latin1> for perl +(because it does not concern with your $encoding). +You B<cannot> use C<encode_json> nor C<JSON> module object with C<utf8> enable. +Instead of them, you use C<JSON> module object with C<utf8> disable or C<to_json>. +Note that the resulted text is a UNICODE string but no problem to print it. + + # $perl_scalar contains $encoding encoded string values + $unicode_json_text = $json->utf8(0)->encode( $perl_scalar ); + # or + $unicode_json_text = to_json( $perl_scalar ); + # $unicode_json_text consists of characters less than 0x100 + print $unicode_json_text; + +Or C<decode $encoding> all string values and C<encode_json>: + + $perl_scalar->{ foo } = decode( $encoding, $perl_scalar->{ foo } ); + # ... do it to each string values, then encode_json + $json_text = encode_json( $perl_scalar ); + +This method is a proper way but probably not efficient. + +See to L<Encode>, L<perluniintro>. + + +=head1 COMMON OBJECT-ORIENTED INTERFACE + +=head2 new + + $json = new JSON + +Returns a new C<JSON> object inherited from either JSON::XS or JSON::PP +that can be used to de/encode JSON strings. + +All boolean flags described below are by default I<disabled>. + +The mutators for flags all return the JSON object again and thus calls can +be chained: + + my $json = JSON->new->utf8->space_after->encode({a => [1,2]}) + => {"a": [1, 2]} + +=head2 ascii + + $json = $json->ascii([$enable]) + + $enabled = $json->get_ascii + +If $enable is true (or missing), then the encode method will not generate characters outside +the code range 0..127. Any Unicode characters outside that range will be escaped using either +a single \uXXXX or a double \uHHHH\uLLLLL escape sequence, as per RFC4627. + +If $enable is false, then the encode method will not escape Unicode characters unless +required by the JSON syntax or other flags. This results in a faster and more compact format. + +This feature depends on the used Perl version and environment. + +See to L<JSON::PP/UNICODE HANDLING ON PERLS> if the backend is PP. + + JSON->new->ascii(1)->encode([chr 0x10401]) + => ["\ud801\udc01"] + +=head2 latin1 + + $json = $json->latin1([$enable]) + + $enabled = $json->get_latin1 + +If $enable is true (or missing), then the encode method will encode the resulting JSON +text as latin1 (or iso-8859-1), escaping any characters outside the code range 0..255. + +If $enable is false, then the encode method will not escape Unicode characters +unless required by the JSON syntax or other flags. + + JSON->new->latin1->encode (["\x{89}\x{abc}"] + => ["\x{89}\\u0abc"] # (perl syntax, U+abc escaped, U+89 not) + +=head2 utf8 + + $json = $json->utf8([$enable]) + + $enabled = $json->get_utf8 + +If $enable is true (or missing), then the encode method will encode the JSON result +into UTF-8, as required by many protocols, while the decode method expects to be handled +an UTF-8-encoded string. Please note that UTF-8-encoded strings do not contain any +characters outside the range 0..255, they are thus useful for bytewise/binary I/O. + +In future versions, enabling this option might enable autodetection of the UTF-16 and UTF-32 +encoding families, as described in RFC4627. + +If $enable is false, then the encode method will return the JSON string as a (non-encoded) +Unicode string, while decode expects thus a Unicode string. Any decoding or encoding +(e.g. to UTF-8 or UTF-16) needs to be done yourself, e.g. using the Encode module. + + +Example, output UTF-16BE-encoded JSON: + + use Encode; + $jsontext = encode "UTF-16BE", JSON::XS->new->encode ($object); + +Example, decode UTF-32LE-encoded JSON: + + use Encode; + $object = JSON::XS->new->decode (decode "UTF-32LE", $jsontext); + +See to L<JSON::PP/UNICODE HANDLING ON PERLS> if the backend is PP. + + +=head2 pretty + + $json = $json->pretty([$enable]) + +This enables (or disables) all of the C<indent>, C<space_before> and +C<space_after> (and in the future possibly more) flags in one call to +generate the most readable (or most compact) form possible. + +Equivalent to: + + $json->indent->space_before->space_after + +The indent space length is three and JSON::XS cannot change the indent +space length. + +=head2 indent + + $json = $json->indent([$enable]) + + $enabled = $json->get_indent + +If C<$enable> is true (or missing), then the C<encode> method will use a multiline +format as output, putting every array member or object/hash key-value pair +into its own line, identing them properly. + +If C<$enable> is false, no newlines or indenting will be produced, and the +resulting JSON text is guarenteed not to contain any C<newlines>. + +This setting has no effect when decoding JSON texts. + +The indent space length is three. +With JSON::PP, you can also access C<indent_length> to change indent space length. + + +=head2 space_before + + $json = $json->space_before([$enable]) + + $enabled = $json->get_space_before + +If C<$enable> is true (or missing), then the C<encode> method will add an extra +optional space before the C<:> separating keys from values in JSON objects. + +If C<$enable> is false, then the C<encode> method will not add any extra +space at those places. + +This setting has no effect when decoding JSON texts. + +Example, space_before enabled, space_after and indent disabled: + + {"key" :"value"} + + +=head2 space_after + + $json = $json->space_after([$enable]) + + $enabled = $json->get_space_after + +If C<$enable> is true (or missing), then the C<encode> method will add an extra +optional space after the C<:> separating keys from values in JSON objects +and extra whitespace after the C<,> separating key-value pairs and array +members. + +If C<$enable> is false, then the C<encode> method will not add any extra +space at those places. + +This setting has no effect when decoding JSON texts. + +Example, space_before and indent disabled, space_after enabled: + + {"key": "value"} + + +=head2 relaxed + + $json = $json->relaxed([$enable]) + + $enabled = $json->get_relaxed + +If C<$enable> is true (or missing), then C<decode> will accept some +extensions to normal JSON syntax (see below). C<encode> will not be +affected in anyway. I<Be aware that this option makes you accept invalid +JSON texts as if they were valid!>. I suggest only to use this option to +parse application-specific files written by humans (configuration files, +resource files etc.) + +If C<$enable> is false (the default), then C<decode> will only accept +valid JSON texts. + +Currently accepted extensions are: + +=over 4 + +=item * list items can have an end-comma + +JSON I<separates> array elements and key-value pairs with commas. This +can be annoying if you write JSON texts manually and want to be able to +quickly append elements, so this extension accepts comma at the end of +such items not just between them: + + [ + 1, + 2, <- this comma not normally allowed + ] + { + "k1": "v1", + "k2": "v2", <- this comma not normally allowed + } + +=item * shell-style '#'-comments + +Whenever JSON allows whitespace, shell-style comments are additionally +allowed. They are terminated by the first carriage-return or line-feed +character, after which more white-space and comments are allowed. + + [ + 1, # this comment not allowed in JSON + # neither this one... + ] + +=back + + +=head2 canonical + + $json = $json->canonical([$enable]) + + $enabled = $json->get_canonical + +If C<$enable> is true (or missing), then the C<encode> method will output JSON objects +by sorting their keys. This is adding a comparatively high overhead. + +If C<$enable> is false, then the C<encode> method will output key-value +pairs in the order Perl stores them (which will likely change between runs +of the same script). + +This option is useful if you want the same data structure to be encoded as +the same JSON text (given the same overall settings). If it is disabled, +the same hash might be encoded differently even if contains the same data, +as key-value pairs have no inherent ordering in Perl. + +This setting has no effect when decoding JSON texts. + +=head2 allow_nonref + + $json = $json->allow_nonref([$enable]) + + $enabled = $json->get_allow_nonref + +If C<$enable> is true (or missing), then the C<encode> method can convert a +non-reference into its corresponding string, number or null JSON value, +which is an extension to RFC4627. Likewise, C<decode> will accept those JSON +values instead of croaking. + +If C<$enable> is false, then the C<encode> method will croak if it isn't +passed an arrayref or hashref, as JSON texts must either be an object +or array. Likewise, C<decode> will croak if given something that is not a +JSON object or array. + + JSON->new->allow_nonref->encode ("Hello, World!") + => "Hello, World!" + +=head2 allow_unknown + + $json = $json->allow_unknown ([$enable]) + + $enabled = $json->get_allow_unknown + +If $enable is true (or missing), then "encode" will *not* throw an +exception when it encounters values it cannot represent in JSON (for +example, filehandles) but instead will encode a JSON "null" value. +Note that blessed objects are not included here and are handled +separately by c<allow_nonref>. + +If $enable is false (the default), then "encode" will throw an +exception when it encounters anything it cannot encode as JSON. + +This option does not affect "decode" in any way, and it is +recommended to leave it off unless you know your communications +partner. + +=head2 allow_blessed + + $json = $json->allow_blessed([$enable]) + + $enabled = $json->get_allow_blessed + +If C<$enable> is true (or missing), then the C<encode> method will not +barf when it encounters a blessed reference. Instead, the value of the +B<convert_blessed> option will decide whether C<null> (C<convert_blessed> +disabled or no C<TO_JSON> method found) or a representation of the +object (C<convert_blessed> enabled and C<TO_JSON> method found) is being +encoded. Has no effect on C<decode>. + +If C<$enable> is false (the default), then C<encode> will throw an +exception when it encounters a blessed object. + + +=head2 convert_blessed + + $json = $json->convert_blessed([$enable]) + + $enabled = $json->get_convert_blessed + +If C<$enable> is true (or missing), then C<encode>, upon encountering a +blessed object, will check for the availability of the C<TO_JSON> method +on the object's class. If found, it will be called in scalar context +and the resulting scalar will be encoded instead of the object. If no +C<TO_JSON> method is found, the value of C<allow_blessed> will decide what +to do. + +The C<TO_JSON> method may safely call die if it wants. If C<TO_JSON> +returns other blessed objects, those will be handled in the same +way. C<TO_JSON> must take care of not causing an endless recursion cycle +(== crash) in this case. The name of C<TO_JSON> was chosen because other +methods called by the Perl core (== not by the user of the object) are +usually in upper case letters and to avoid collisions with the C<to_json> +function or method. + +This setting does not yet influence C<decode> in any way. + +If C<$enable> is false, then the C<allow_blessed> setting will decide what +to do when a blessed object is found. + +=over + +=item convert_blessed_universally mode + +If use C<JSON> with C<-convert_blessed_universally>, the C<UNIVERSAL::TO_JSON> +subroutine is defined as the below code: + + *UNIVERSAL::TO_JSON = sub { + my $b_obj = B::svref_2object( $_[0] ); + return $b_obj->isa('B::HV') ? { %{ $_[0] } } + : $b_obj->isa('B::AV') ? [ @{ $_[0] } ] + : undef + ; + } + +This will cause that C<encode> method converts simple blessed objects into +JSON objects as non-blessed object. + + JSON -convert_blessed_universally; + $json->allow_blessed->convert_blessed->encode( $blessed_object ) + +This feature is experimental and may be removed in the future. + +=back + +=head2 filter_json_object + + $json = $json->filter_json_object([$coderef]) + +When C<$coderef> is specified, it will be called from C<decode> each +time it decodes a JSON object. The only argument passed to the coderef +is a reference to the newly-created hash. If the code references returns +a single scalar (which need not be a reference), this value +(i.e. a copy of that scalar to avoid aliasing) is inserted into the +deserialised data structure. If it returns an empty list +(NOTE: I<not> C<undef>, which is a valid scalar), the original deserialised +hash will be inserted. This setting can slow down decoding considerably. + +When C<$coderef> is omitted or undefined, any existing callback will +be removed and C<decode> will not change the deserialised hash in any +way. + +Example, convert all JSON objects into the integer 5: + + my $js = JSON->new->filter_json_object (sub { 5 }); + # returns [5] + $js->decode ('[{}]'); # the given subroutine takes a hash reference. + # throw an exception because allow_nonref is not enabled + # so a lone 5 is not allowed. + $js->decode ('{"a":1, "b":2}'); + + +=head2 filter_json_single_key_object + + $json = $json->filter_json_single_key_object($key [=> $coderef]) + +Works remotely similar to C<filter_json_object>, but is only called for +JSON objects having a single key named C<$key>. + +This C<$coderef> is called before the one specified via +C<filter_json_object>, if any. It gets passed the single value in the JSON +object. If it returns a single value, it will be inserted into the data +structure. If it returns nothing (not even C<undef> but the empty list), +the callback from C<filter_json_object> will be called next, as if no +single-key callback were specified. + +If C<$coderef> is omitted or undefined, the corresponding callback will be +disabled. There can only ever be one callback for a given key. + +As this callback gets called less often then the C<filter_json_object> +one, decoding speed will not usually suffer as much. Therefore, single-key +objects make excellent targets to serialise Perl objects into, especially +as single-key JSON objects are as close to the type-tagged value concept +as JSON gets (it's basically an ID/VALUE tuple). Of course, JSON does not +support this in any way, so you need to make sure your data never looks +like a serialised Perl hash. + +Typical names for the single object key are C<__class_whatever__>, or +C<$__dollars_are_rarely_used__$> or C<}ugly_brace_placement>, or even +things like C<__class_md5sum(classname)__>, to reduce the risk of clashing +with real hashes. + +Example, decode JSON objects of the form C<< { "__widget__" => <id> } >> +into the corresponding C<< $WIDGET{<id>} >> object: + + # return whatever is in $WIDGET{5}: + JSON + ->new + ->filter_json_single_key_object (__widget__ => sub { + $WIDGET{ $_[0] } + }) + ->decode ('{"__widget__": 5') + + # this can be used with a TO_JSON method in some "widget" class + # for serialisation to json: + sub WidgetBase::TO_JSON { + my ($self) = @_; + + unless ($self->{id}) { + $self->{id} = ..get..some..id..; + $WIDGET{$self->{id}} = $self; + } + + { __widget__ => $self->{id} } + } + + +=head2 shrink + + $json = $json->shrink([$enable]) + + $enabled = $json->get_shrink + +With JSON::XS, this flag resizes strings generated by either +C<encode> or C<decode> to their minimum size possible. This can save +memory when your JSON texts are either very very long or you have many +short strings. It will also try to downgrade any strings to octet-form +if possible: perl stores strings internally either in an encoding called +UTF-X or in octet-form. The latter cannot store everything but uses less +space in general (and some buggy Perl or C code might even rely on that +internal representation being used). + +With JSON::PP, it is noop about resizing strings but tries +C<utf8::downgrade> to the returned string by C<encode>. See to L<utf8>. + +See to L<JSON::XS/OBJECT-ORIENTED INTERFACE> and L<JSON::PP/METHODS>. + +=head2 max_depth + + $json = $json->max_depth([$maximum_nesting_depth]) + + $max_depth = $json->get_max_depth + +Sets the maximum nesting level (default C<512>) accepted while encoding +or decoding. If a higher nesting level is detected in JSON text or a Perl +data structure, then the encoder and decoder will stop and croak at that +point. + +Nesting level is defined by number of hash- or arrayrefs that the encoder +needs to traverse to reach a given point or the number of C<{> or C<[> +characters without their matching closing parenthesis crossed to reach a +given character in a string. + +If no argument is given, the highest possible setting will be used, which +is rarely useful. + +Note that nesting is implemented by recursion in C. The default value has +been chosen to be as large as typical operating systems allow without +crashing. (JSON::XS) + +With JSON::PP as the backend, when a large value (100 or more) was set and +it de/encodes a deep nested object/text, it may raise a warning +'Deep recursion on subroutin' at the perl runtime phase. + +See L<JSON::XS/SECURITY CONSIDERATIONS> for more info on why this is useful. + +=head2 max_size + + $json = $json->max_size([$maximum_string_size]) + + $max_size = $json->get_max_size + +Set the maximum length a JSON text may have (in bytes) where decoding is +being attempted. The default is C<0>, meaning no limit. When C<decode> +is called on a string that is longer then this many bytes, it will not +attempt to decode the string but throw an exception. This setting has no +effect on C<encode> (yet). + +If no argument is given, the limit check will be deactivated (same as when +C<0> is specified). + +See L<JSON::XS/SECURITY CONSIDERATIONS>, below, for more info on why this is useful. + +=head2 encode + + $json_text = $json->encode($perl_scalar) + +Converts the given Perl data structure (a simple scalar or a reference +to a hash or array) to its JSON representation. Simple scalars will be +converted into JSON string or number sequences, while references to arrays +become JSON arrays and references to hashes become JSON objects. Undefined +Perl values (e.g. C<undef>) become JSON C<null> values. +References to the integers C<0> and C<1> are converted into C<true> and C<false>. + +=head2 decode + + $perl_scalar = $json->decode($json_text) + +The opposite of C<encode>: expects a JSON text and tries to parse it, +returning the resulting simple scalar or reference. Croaks on error. + +JSON numbers and strings become simple Perl scalars. JSON arrays become +Perl arrayrefs and JSON objects become Perl hashrefs. C<true> becomes +C<1> (C<JSON::true>), C<false> becomes C<0> (C<JSON::false>) and +C<null> becomes C<undef>. + +=head2 decode_prefix + + ($perl_scalar, $characters) = $json->decode_prefix($json_text) + +This works like the C<decode> method, but instead of raising an exception +when there is trailing garbage after the first JSON object, it will +silently stop parsing there and return the number of characters consumed +so far. + + JSON->new->decode_prefix ("[1] the tail") + => ([], 3) + +See to L<JSON::XS/OBJECT-ORIENTED INTERFACE> + +=head2 property + + $boolean = $json->property($property_name) + +Returns a boolean value about above some properties. + +The available properties are C<ascii>, C<latin1>, C<utf8>, +C<indent>,C<space_before>, C<space_after>, C<relaxed>, C<canonical>, +C<allow_nonref>, C<allow_unknown>, C<allow_blessed>, C<convert_blessed>, +C<shrink>, C<max_depth> and C<max_size>. + + $boolean = $json->property('utf8'); + => 0 + $json->utf8; + $boolean = $json->property('utf8'); + => 1 + +Sets the property with a given boolean value. + + $json = $json->property($property_name => $boolean); + +With no argumnt, it returns all the above properties as a hash reference. + + $flag_hashref = $json->property(); + +=head1 INCREMENTAL PARSING + +Most of this section are copied and modified from L<JSON::XS/INCREMENTAL PARSING>. + +In some cases, there is the need for incremental parsing of JSON texts. +This module does allow you to parse a JSON stream incrementally. +It does so by accumulating text until it has a full JSON object, which +it then can decode. This process is similar to using C<decode_prefix> +to see if a full JSON object is available, but is much more efficient +(and can be implemented with a minimum of method calls). + +The backend module will only attempt to parse the JSON text once it is sure it +has enough text to get a decisive result, using a very simple but +truly incremental parser. This means that it sometimes won't stop as +early as the full parser, for example, it doesn't detect parenthese +mismatches. The only thing it guarantees is that it starts decoding as +soon as a syntactically valid JSON text has been seen. This means you need +to set resource limits (e.g. C<max_size>) to ensure the parser will stop +parsing in the presence if syntax errors. + +The following methods implement this incremental parser. + +=head2 incr_parse + + $json->incr_parse( [$string] ) # void context + + $obj_or_undef = $json->incr_parse( [$string] ) # scalar context + + @obj_or_empty = $json->incr_parse( [$string] ) # list context + +This is the central parsing function. It can both append new text and +extract objects from the stream accumulated so far (both of these +functions are optional). + +If C<$string> is given, then this string is appended to the already +existing JSON fragment stored in the C<$json> object. + +After that, if the function is called in void context, it will simply +return without doing anything further. This can be used to add more text +in as many chunks as you want. + +If the method is called in scalar context, then it will try to extract +exactly I<one> JSON object. If that is successful, it will return this +object, otherwise it will return C<undef>. If there is a parse error, +this method will croak just as C<decode> would do (one can then use +C<incr_skip> to skip the errornous part). This is the most common way of +using the method. + +And finally, in list context, it will try to extract as many objects +from the stream as it can find and return them, or the empty list +otherwise. For this to work, there must be no separators between the JSON +objects or arrays, instead they must be concatenated back-to-back. If +an error occurs, an exception will be raised as in the scalar context +case. Note that in this case, any previously-parsed JSON texts will be +lost. + +Example: Parse some JSON arrays/objects in a given string and return them. + + my @objs = JSON->new->incr_parse ("[5][7][1,2]"); + +=head2 incr_text + + $lvalue_string = $json->incr_text + +This method returns the currently stored JSON fragment as an lvalue, that +is, you can manipulate it. This I<only> works when a preceding call to +C<incr_parse> in I<scalar context> successfully returned an object. Under +all other circumstances you must not call this function (I mean it. +although in simple tests it might actually work, it I<will> fail under +real world conditions). As a special exception, you can also call this +method before having parsed anything. + +This function is useful in two cases: a) finding the trailing text after a +JSON object or b) parsing multiple JSON objects separated by non-JSON text +(such as commas). + + $json->incr_text =~ s/\s*,\s*//; + +In Perl 5.005, C<lvalue> attribute is not available. +You must write codes like the below: + + $string = $json->incr_text; + $string =~ s/\s*,\s*//; + $json->incr_text( $string ); + +=head2 incr_skip + + $json->incr_skip + +This will reset the state of the incremental parser and will remove the +parsed text from the input buffer. This is useful after C<incr_parse> +died, in which case the input buffer and incremental parser state is left +unchanged, to skip the text parsed so far and to reset the parse state. + +=head2 incr_reset + + $json->incr_reset + +This completely resets the incremental parser, that is, after this call, +it will be as if the parser had never parsed anything. + +This is useful if you want ot repeatedly parse JSON objects and want to +ignore any trailing data, which means you have to reset the parser after +each successful decode. + +See to L<JSON::XS/INCREMENTAL PARSING> for examples. + + +=head1 JSON::PP SUPPORT METHODS + +The below methods are JSON::PP own methods, so when C<JSON> works +with JSON::PP (i.e. the created object is a JSON::PP object), available. +See to L<JSON::PP/JSON::PP OWN METHODS> in detail. + +If you use C<JSON> with additonal C<-support_by_pp>, some methods +are available even with JSON::XS. See to L<USE PP FEATURES EVEN THOUGH XS BACKEND>. + + BEING { $ENV{PERL_JSON_BACKEND} = 'JSON::XS' } + + use JSON -support_by_pp; + + my $json = new JSON; + $json->allow_nonref->escape_slash->encode("/"); + + # functional interfaces too. + print to_json(["/"], {escape_slash => 1}); + print from_json('["foo"]', {utf8 => 1}); + +If you do not want to all functions but C<-support_by_pp>, +use C<-no_export>. + + use JSON -support_by_pp, -no_export; + # functional interfaces are not exported. + +=head2 allow_singlequote + + $json = $json->allow_singlequote([$enable]) + +If C<$enable> is true (or missing), then C<decode> will accept +any JSON strings quoted by single quotations that are invalid JSON +format. + + $json->allow_singlequote->decode({"foo":'bar'}); + $json->allow_singlequote->decode({'foo':"bar"}); + $json->allow_singlequote->decode({'foo':'bar'}); + +As same as the C<relaxed> option, this option may be used to parse +application-specific files written by humans. + +=head2 allow_barekey + + $json = $json->allow_barekey([$enable]) + +If C<$enable> is true (or missing), then C<decode> will accept +bare keys of JSON object that are invalid JSON format. + +As same as the C<relaxed> option, this option may be used to parse +application-specific files written by humans. + + $json->allow_barekey->decode('{foo:"bar"}'); + +=head2 allow_bignum + + $json = $json->allow_bignum([$enable]) + +If C<$enable> is true (or missing), then C<decode> will convert +the big integer Perl cannot handle as integer into a L<Math::BigInt> +object and convert a floating number (any) into a L<Math::BigFloat>. + +On the contary, C<encode> converts C<Math::BigInt> objects and C<Math::BigFloat> +objects into JSON numbers with C<allow_blessed> enable. + + $json->allow_nonref->allow_blessed->allow_bignum; + $bigfloat = $json->decode('2.000000000000000000000000001'); + print $json->encode($bigfloat); + # => 2.000000000000000000000000001 + +See to L<MAPPING> aboout the conversion of JSON number. + +=head2 loose + + $json = $json->loose([$enable]) + +The unescaped [\x00-\x1f\x22\x2f\x5c] strings are invalid in JSON strings +and the module doesn't allow to C<decode> to these (except for \x2f). +If C<$enable> is true (or missing), then C<decode> will accept these +unescaped strings. + + $json->loose->decode(qq|["abc + def"]|); + +See to L<JSON::PP/JSON::PP OWN METHODS>. + +=head2 escape_slash + + $json = $json->escape_slash([$enable]) + +According to JSON Grammar, I<slash> (U+002F) is escaped. But by default +JSON backend modules encode strings without escaping slash. + +If C<$enable> is true (or missing), then C<encode> will escape slashes. + +=head2 indent_length + + $json = $json->indent_length($length) + +With JSON::XS, The indent space length is 3 and cannot be changed. +With JSON::PP, it sets the indent space length with the given $length. +The default is 3. The acceptable range is 0 to 15. + +=head2 sort_by + + $json = $json->sort_by($function_name) + $json = $json->sort_by($subroutine_ref) + +If $function_name or $subroutine_ref are set, its sort routine are used. + + $js = $pc->sort_by(sub { $JSON::PP::a cmp $JSON::PP::b })->encode($obj); + # is($js, q|{"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9}|); + + $js = $pc->sort_by('own_sort')->encode($obj); + # is($js, q|{"a":1,"b":2,"c":3,"d":4,"e":5,"f":6,"g":7,"h":8,"i":9}|); + + sub JSON::PP::own_sort { $JSON::PP::a cmp $JSON::PP::b } + +As the sorting routine runs in the JSON::PP scope, the given +subroutine name and the special variables C<$a>, C<$b> will begin +with 'JSON::PP::'. + +If $integer is set, then the effect is same as C<canonical> on. + +See to L<JSON::PP/JSON::PP OWN METHODS>. + +=head1 MAPPING + +This section is copied from JSON::XS and modified to C<JSON>. +JSON::XS and JSON::PP mapping mechanisms are almost equivalent. + +See to L<JSON::XS/MAPPING>. + +=head2 JSON -> PERL + +=over 4 + +=item object + +A JSON object becomes a reference to a hash in Perl. No ordering of object +keys is preserved (JSON does not preserver object key ordering itself). + +=item array + +A JSON array becomes a reference to an array in Perl. + +=item string + +A JSON string becomes a string scalar in Perl - Unicode codepoints in JSON +are represented by the same codepoints in the Perl string, so no manual +decoding is necessary. + +=item number + +A JSON number becomes either an integer, numeric (floating point) or +string scalar in perl, depending on its range and any fractional parts. On +the Perl level, there is no difference between those as Perl handles all +the conversion details, but an integer may take slightly less memory and +might represent more values exactly than floating point numbers. + +If the number consists of digits only, C<JSON> will try to represent +it as an integer value. If that fails, it will try to represent it as +a numeric (floating point) value if that is possible without loss of +precision. Otherwise it will preserve the number as a string value (in +which case you lose roundtripping ability, as the JSON number will be +re-encoded toa JSON string). + +Numbers containing a fractional or exponential part will always be +represented as numeric (floating point) values, possibly at a loss of +precision (in which case you might lose perfect roundtripping ability, but +the JSON number will still be re-encoded as a JSON number). + +Note that precision is not accuracy - binary floating point values cannot +represent most decimal fractions exactly, and when converting from and to +floating point, C<JSON> only guarantees precision up to but not including +the leats significant bit. + +If the backend is JSON::PP and C<allow_bignum> is enable, the big integers +and the numeric can be optionally converted into L<Math::BigInt> and +L<Math::BigFloat> objects. + +=item true, false + +These JSON atoms become C<JSON::true> and C<JSON::false>, +respectively. They are overloaded to act almost exactly like the numbers +C<1> and C<0>. You can check wether a scalar is a JSON boolean by using +the C<JSON::is_bool> function. + +If C<JSON::true> and C<JSON::false> are used as strings or compared as strings, +they represent as C<true> and C<false> respectively. + + print JSON::true . "\n"; + => true + print JSON::true + 1; + => 1 + + ok(JSON::true eq 'true'); + ok(JSON::true eq '1'); + ok(JSON::true == 1); + +C<JSON> will install these missing overloading features to the backend modules. + + +=item null + +A JSON null atom becomes C<undef> in Perl. + +C<JSON::null> returns C<unddef>. + +=back + + +=head2 PERL -> JSON + +The mapping from Perl to JSON is slightly more difficult, as Perl is a +truly typeless language, so we can only guess which JSON type is meant by +a Perl value. + +=over 4 + +=item hash references + +Perl hash references become JSON objects. As there is no inherent ordering +in hash keys (or JSON objects), they will usually be encoded in a +pseudo-random order that can change between runs of the same program but +stays generally the same within a single run of a program. C<JSON> +optionally sort the hash keys (determined by the I<canonical> flag), so +the same datastructure will serialise to the same JSON text (given same +settings and version of JSON::XS), but this incurs a runtime overhead +and is only rarely useful, e.g. when you want to compare some JSON text +against another for equality. + +In future, the ordered object feature will be added to JSON::PP using C<tie> mechanism. + + +=item array references + +Perl array references become JSON arrays. + +=item other references + +Other unblessed references are generally not allowed and will cause an +exception to be thrown, except for references to the integers C<0> and +C<1>, which get turned into C<false> and C<true> atoms in JSON. You can +also use C<JSON::false> and C<JSON::true> to improve readability. + + to_json [\0,JSON::true] # yields [false,true] + +=item JSON::true, JSON::false, JSON::null + +These special values become JSON true and JSON false values, +respectively. You can also use C<\1> and C<\0> directly if you want. + +JSON::null returns C<undef>. + +=item blessed objects + +Blessed objects are not directly representable in JSON. See the +C<allow_blessed> and C<convert_blessed> methods on various options on +how to deal with this: basically, you can choose between throwing an +exception, encoding the reference as if it weren't blessed, or provide +your own serialiser method. + +With C<convert_blessed_universally> mode, C<encode> converts blessed +hash references or blessed array references (contains other blessed references) +into JSON members and arrays. + + use JSON -convert_blessed_universally; + JSON->new->allow_blessed->convert_blessed->encode( $blessed_object ); + +See to L<convert_blessed>. + +=item simple scalars + +Simple Perl scalars (any scalar that is not a reference) are the most +difficult objects to encode: JSON::XS and JSON::PP will encode undefined scalars as +JSON C<null> values, scalars that have last been used in a string context +before encoding as JSON strings, and anything else as number value: + + # dump as number + encode_json [2] # yields [2] + encode_json [-3.0e17] # yields [-3e+17] + my $value = 5; encode_json [$value] # yields [5] + + # used as string, so dump as string + print $value; + encode_json [$value] # yields ["5"] + + # undef becomes null + encode_json [undef] # yields [null] + +You can force the type to be a string by stringifying it: + + my $x = 3.1; # some variable containing a number + "$x"; # stringified + $x .= ""; # another, more awkward way to stringify + print $x; # perl does it for you, too, quite often + +You can force the type to be a number by numifying it: + + my $x = "3"; # some variable containing a string + $x += 0; # numify it, ensuring it will be dumped as a number + $x *= 1; # same thing, the choise is yours. + +You can not currently force the type in other, less obscure, ways. + +Note that numerical precision has the same meaning as under Perl (so +binary to decimal conversion follows the same rules as in Perl, which +can differ to other languages). Also, your perl interpreter might expose +extensions to the floating point numbers of your platform, such as +infinities or NaN's - these cannot be represented in JSON, and it is an +error to pass those in. + +=item Big Number + +If the backend is JSON::PP and C<allow_bignum> is enable, +C<encode> converts C<Math::BigInt> objects and C<Math::BigFloat> +objects into JSON numbers. + + +=back + +=head1 JSON and ECMAscript + +See to L<JSON::XS/JSON and ECMAscript>. + +=head1 JSON and YAML + +JSON is not a subset of YAML. +See to L<JSON::XS/JSON and YAML>. + + +=head1 BACKEND MODULE DECISION + +When you use C<JSON>, C<JSON> tries to C<use> JSON::XS. If this call failed, it will +C<uses> JSON::PP. The required JSON::XS version is I<2.2> or later. + +The C<JSON> constructor method returns an object inherited from the backend module, +and JSON::XS object is a blessed scaler reference while JSON::PP is a blessed hash +reference. + +So, your program should not depend on the backend module, especially +returned objects should not be modified. + + my $json = JSON->new; # XS or PP? + $json->{stash} = 'this is xs object'; # this code may raise an error! + +To check the backend module, there are some methods - C<backend>, C<is_pp> and C<is_xs>. + + JSON->backend; # 'JSON::XS' or 'JSON::PP' + + JSON->backend->is_pp: # 0 or 1 + + JSON->backend->is_xs: # 1 or 0 + + $json->is_xs; # 1 or 0 + + $json->is_pp; # 0 or 1 + + +If you set an enviornment variable C<PERL_JSON_BACKEND>, The calling action will be changed. + +=over + +=item PERL_JSON_BACKEND = 0 or PERL_JSON_BACKEND = 'JSON::PP' + +Always use JSON::PP + +=item PERL_JSON_BACKEND == 1 or PERL_JSON_BACKEND = 'JSON::XS,JSON::PP' + +(The default) Use compiled JSON::XS if it is properly compiled & installed, +otherwise use JSON::PP. + +=item PERL_JSON_BACKEND == 2 or PERL_JSON_BACKEND = 'JSON::XS' + +Always use compiled JSON::XS, die if it isn't properly compiled & installed. + +=item PERL_JSON_BACKEND = 'JSON::backportPP' + +Always use JSON::backportPP. +JSON::backportPP is JSON::PP back port module. +C<JSON> includs JSON::backportPP instead of JSON::PP. + +=back + +These ideas come from L<DBI::PurePerl> mechanism. + +example: + + BEGIN { $ENV{PERL_JSON_BACKEND} = 'JSON::PP' } + use JSON; # always uses JSON::PP + +In future, it may be able to specify another module. + +=head1 USE PP FEATURES EVEN THOUGH XS BACKEND + +Many methods are available with either JSON::XS or JSON::PP and +when the backend module is JSON::XS, if any JSON::PP specific (i.e. JSON::XS unspported) +method is called, it will C<warn> and be noop. + +But If you C<use> C<JSON> passing the optional string C<-support_by_pp>, +it makes a part of those unupported methods available. +This feature is achieved by using JSON::PP in C<de/encode>. + + BEGIN { $ENV{PERL_JSON_BACKEND} = 2 } # with JSON::XS + use JSON -support_by_pp; + my $json = new JSON; + $json->allow_nonref->escape_slash->encode("/"); + +At this time, the returned object is a C<JSON::Backend::XS::Supportable> +object (re-blessed XS object), and by checking JSON::XS unsupported flags +in de/encoding, can support some unsupported methods - C<loose>, C<allow_bignum>, +C<allow_barekey>, C<allow_singlequote>, C<escape_slash> and C<indent_length>. + +When any unsupported methods are not enable, C<XS de/encode> will be +used as is. The switch is achieved by changing the symbolic tables. + +C<-support_by_pp> is effective only when the backend module is JSON::XS +and it makes the de/encoding speed down a bit. + +See to L<JSON::PP SUPPORT METHODS>. + +=head1 INCOMPATIBLE CHANGES TO OLD VERSION + +There are big incompatibility between new version (2.00) and old (1.xx). +If you use old C<JSON> 1.xx in your code, please check it. + +See to L<Transition ways from 1.xx to 2.xx.> + +=over + +=item jsonToObj and objToJson are obsoleted. + +Non Perl-style name C<jsonToObj> and C<objToJson> are obsoleted +(but not yet deleted from the source). +If you use these functions in your code, please replace them +with C<from_json> and C<to_json>. + + +=item Global variables are no longer available. + +C<JSON> class variables - C<$JSON::AUTOCONVERT>, C<$JSON::BareKey>, etc... +- are not available any longer. +Instead, various features can be used through object methods. + + +=item Package JSON::Converter and JSON::Parser are deleted. + +Now C<JSON> bundles with JSON::PP which can handle JSON more properly than them. + +=item Package JSON::NotString is deleted. + +There was C<JSON::NotString> class which represents JSON value C<true>, C<false>, C<null> +and numbers. It was deleted and replaced by C<JSON::Boolean>. + +C<JSON::Boolean> represents C<true> and C<false>. + +C<JSON::Boolean> does not represent C<null>. + +C<JSON::null> returns C<undef>. + +C<JSON> makes L<JSON::XS::Boolean> and L<JSON::PP::Boolean> is-a relation +to L<JSON::Boolean>. + +=item function JSON::Number is obsoleted. + +C<JSON::Number> is now needless because JSON::XS and JSON::PP have +round-trip integrity. + +=item JSONRPC modules are deleted. + +Perl implementation of JSON-RPC protocol - C<JSONRPC >, C<JSONRPC::Transport::HTTP> +and C<Apache::JSONRPC > are deleted in this distribution. +Instead of them, there is L<JSON::RPC> which supports JSON-RPC protocol version 1.1. + +=back + +=head2 Transition ways from 1.xx to 2.xx. + +You should set C<suport_by_pp> mode firstly, because +it is always successful for the below codes even with JSON::XS. + + use JSON -support_by_pp; + +=over + +=item Exported jsonToObj (simple) + + from_json($json_text); + +=item Exported objToJson (simple) + + to_json($perl_scalar); + +=item Exported jsonToObj (advanced) + + $flags = {allow_barekey => 1, allow_singlequote => 1}; + from_json($json_text, $flags); + +equivalent to: + + $JSON::BareKey = 1; + $JSON::QuotApos = 1; + jsonToObj($json_text); + +=item Exported objToJson (advanced) + + $flags = {allow_blessed => 1, allow_barekey => 1}; + to_json($perl_scalar, $flags); + +equivalent to: + + $JSON::BareKey = 1; + objToJson($perl_scalar); + +=item jsonToObj as object method + + $json->decode($json_text); + +=item objToJson as object method + + $json->encode($perl_scalar); + +=item new method with parameters + +The C<new> method in 2.x takes any parameters no longer. +You can set parameters instead; + + $json = JSON->new->pretty; + +=item $JSON::Pretty, $JSON::Indent, $JSON::Delimiter + +If C<indent> is enable, that means C<$JSON::Pretty> flag set. And +C<$JSON::Delimiter> was substituted by C<space_before> and C<space_after>. +In conclusion: + + $json->indent->space_before->space_after; + +Equivalent to: + + $json->pretty; + +To change indent length, use C<indent_length>. + +(Only with JSON::PP, if C<-support_by_pp> is not used.) + + $json->pretty->indent_length(2)->encode($perl_scalar); + +=item $JSON::BareKey + +(Only with JSON::PP, if C<-support_by_pp> is not used.) + + $json->allow_barekey->decode($json_text) + +=item $JSON::ConvBlessed + +use C<-convert_blessed_universally>. See to L<convert_blessed>. + +=item $JSON::QuotApos + +(Only with JSON::PP, if C<-support_by_pp> is not used.) + + $json->allow_singlequote->decode($json_text) + +=item $JSON::SingleQuote + +Disable. C<JSON> does not make such a invalid JSON string any longer. + +=item $JSON::KeySort + + $json->canonical->encode($perl_scalar) + +This is the ascii sort. + +If you want to use with your own sort routine, check the C<sort_by> method. + +(Only with JSON::PP, even if C<-support_by_pp> is used currently.) + + $json->sort_by($sort_routine_ref)->encode($perl_scalar) + + $json->sort_by(sub { $JSON::PP::a <=> $JSON::PP::b })->encode($perl_scalar) + +Can't access C<$a> and C<$b> but C<$JSON::PP::a> and C<$JSON::PP::b>. + +=item $JSON::SkipInvalid + + $json->allow_unknown + +=item $JSON::AUTOCONVERT + +Needless. C<JSON> backend modules have the round-trip integrity. + +=item $JSON::UTF8 + +Needless because C<JSON> (JSON::XS/JSON::PP) sets +the UTF8 flag on properly. + + # With UTF8-flagged strings + + $json->allow_nonref; + $str = chr(1000); # UTF8-flagged + + $json_text = $json->utf8(0)->encode($str); + utf8::is_utf8($json_text); + # true + $json_text = $json->utf8(1)->encode($str); + utf8::is_utf8($json_text); + # false + + $str = '"' . chr(1000) . '"'; # UTF8-flagged + + $perl_scalar = $json->utf8(0)->decode($str); + utf8::is_utf8($perl_scalar); + # true + $perl_scalar = $json->utf8(1)->decode($str); + # died because of 'Wide character in subroutine' + +See to L<JSON::XS/A FEW NOTES ON UNICODE AND PERL>. + +=item $JSON::UnMapping + +Disable. See to L<MAPPING>. + +=item $JSON::SelfConvert + +This option was deleted. +Instead of it, if a givien blessed object has the C<TO_JSON> method, +C<TO_JSON> will be executed with C<convert_blessed>. + + $json->convert_blessed->encode($bleesed_hashref_or_arrayref) + # if need, call allow_blessed + +Note that it was C<toJson> in old version, but now not C<toJson> but C<TO_JSON>. + +=back + +=head1 TODO + +=over + +=item example programs + +=back + +=head1 THREADS + +No test with JSON::PP. If with JSON::XS, See to L<JSON::XS/THREADS>. + + +=head1 BUGS + +Please report bugs relevant to C<JSON> to E<lt>makamaka[at]cpan.orgE<gt>. + + +=head1 SEE ALSO + +Most of the document is copied and modified from JSON::XS doc. + +L<JSON::XS>, L<JSON::PP> + +C<RFC4627>(L<http://www.ietf.org/rfc/rfc4627.txt>) + +=head1 AUTHOR + +Makamaka Hannyaharamitu, E<lt>makamaka[at]cpan.orgE<gt> + +JSON::XS was written by Marc Lehmann <schmorp[at]schmorp.de> + +The relese of this new version owes to the courtesy of Marc Lehmann. + + +=head1 COPYRIGHT AND LICENSE + +Copyright 2005-2011 by Makamaka Hannyaharamitu + +This library is free software; you can redistribute it and/or modify +it under the same terms as Perl itself. + +=cut + diff --git a/test/src/test-c89-parser.cpp b/test/src/test-c89-parser.cpp new file mode 100644 index 0000000..a9e5d34 --- /dev/null +++ b/test/src/test-c89-parser.cpp @@ -0,0 +1,120 @@ +#define protected public +#include "uscxml/util/URL.h" +#include "uscxml/plugins/datamodel/c89/C89DataModel.h" +#include "uscxml/plugins/datamodel/c89/C89Parser.h" + +#include <iostream> + +using namespace uscxml; + +extern int c89_debug; + +void testC89Parser() { + + c89_debug = 0; + + std::list<std::string> localTest = { + "int main() { a = 10; }" + }; + + for (auto test : localTest) { + try { + C89Parser ast(test); + ast.dump(); + } catch (Event e) { + std::cerr << e << std::endl; + } + } + + assert(false); + + std::list<URL> remoteTests = { + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/00_assignment.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/01_comment.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/02_printf.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/03_struct.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/04_for.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/05_array.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/06_case.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/07_function.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/08_while.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/09_do_while.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/10_pointer.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/11_precedence.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/12_hashdefine.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/13_integer_literals.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/14_if.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/15_recursion.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/16_nesting.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/17_enum.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/18_include.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/19_pointer_arithmetic.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/20_pointer_comparison.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/21_char_array.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/22_floating_point.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/23_type_coercion.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/24_math_library.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/25_quicksort.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/26_character_constants.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/27_sizeof.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/28_strings.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/29_array_address.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/30_hanoi.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/31_args.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/32_led.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/33_ternary_op.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/34_array_assignment.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/35_sizeof.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/36_array_initialisers.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/37_sprintf.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/38_multiple_array_index.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/39_typedef.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/40_stdio.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/41_hashif.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/42_function_pointer.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/43_void_param.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/44_scoped_declarations.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/45_empty_for.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/46_grep.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/47_switch_return.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/48_nested_break.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/49_bracket_evaluation.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/50_logical_second_arg.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/51_static.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/52_unnamed_enum.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/54_goto.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/55_array_initialiser.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/56_cross_structure.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/57_macro_bug.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/58_return_outside.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/59_break_before_loop.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/60_local_vars.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/61_initializers.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/62_float.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/63_typedef.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/64_double_prefix_op.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/65_typeless.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/66_printf_undefined.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/67_macro_crash.c"), + URL("https://raw.githubusercontent.com/zsaleeba/picoc/master/tests/68_return.c") + }; + + for (auto testURL : remoteTests) { + try { + std::cout << std::endl << "'" << (std::string)testURL << "':" << std::endl; + std::cout << testURL.getInContent() << std::endl; + + C89Parser ast(testURL.getInContent()); + ast.dump(); + + } catch (Event e) { + std::cerr << e << std::endl; + } + std::this_thread::sleep_for(std::chrono::seconds(10)); + } + +} + +int main(int argc, char** argv) { + testC89Parser(); +}
\ No newline at end of file diff --git a/test/src/test-http-debugger.pl b/test/src/test-http-debugger.pl new file mode 100755 index 0000000..14b2468 --- /dev/null +++ b/test/src/test-http-debugger.pl @@ -0,0 +1,208 @@ +#!/usr/bin/perl + +use lib './perl'; +use strict; +use File::Spec; +use File::Basename; +use Cwd 'abs_path'; +use JSON qw(from_json to_json); +use LWP; +use HTTP::Request::Common qw(POST GET); +use Data::Dumper; + +my $scxmlBin = abs_path(shift); +die ("First argument needs to be path to uscxml-browser binary") if (!$scxmlBin); +die("'" . $scxmlBin . "' is not an executable file") if (! -x $scxmlBin); + +my $baseDir = File::Spec->canonpath(dirname($0)); +chdir $baseDir; + +my $ua = LWP::UserAgent->new; +my $request; +my $response; +my $data; +my @breakpointSeq; + +my $pid = fork; + +if (!$pid) { + # exec("$scxmlBin -t4088 -d"); + exit; +} + +# my $baseURL = 'http://localhost:4088/debug'; +my $baseURL = 'http://localhost:5080/debug'; + +sub assertSuccess { + my $response = shift; + my $message = shift; + from_json($response->content())->{'status'} eq "success" or die($message); +} + +sub popAndCompare { + my $qualified = shift; + my $bp = shift(@breakpointSeq); + for my $key (keys %{$bp}) { + if (! exists($qualified->{$key}) || $qualified->{$key} ne $bp->{$key}) { + print Dumper($qualified); + print Dumper($bp); + die("Expected different breakpoint"); + } + } + print "SUCCESS\n"; +} + +sub testSimpleStepping { + + my $xml = << 'END_SCXML'; + <scxml> + <state id='s1'> + <onentry> + <log label="'foo'" /> + </onentry> + <transition target='s2' /> + </state> + <state id='s2'> + <transition target='pass' /> + </state> + <final id='pass' /> + </scxml> +END_SCXML + + @breakpointSeq = ( + { subject => "microstep", when => "before" }, + { subject => "state", when => "before", action => "enter" }, + { subject => "state", when => "after", action => "enter" }, + { subject => "state", when => "before", action => "enter", stateId => "s1" }, + { subject => "executable", when => "before", execName => "log" }, + { subject => "executable", when => "after", execName => "log" }, + { subject => "state", when => "after", action => "enter", stateId => "s1" }, + { subject => "microstep", when => "after" }, + { subject => "microstep", when => "before" }, + { subject => "state", when => "before", action => "exit", stateId => "s1" }, + { subject => "state", when => "after", action => "exit", stateId => "s1" }, + { subject => "transition", when => "before", source => "s1", target => "s2"}, + { subject => "transition", when => "after", source => "s1", target => "s2"}, + { subject => "state", when => "before", action => "enter", stateId => "s2" }, + { subject => "state", when => "after", action => "enter", stateId => "s2" }, + { subject => "microstep", when => "after" }, + { subject => "microstep", when => "before" }, + { subject => "state", when => "before", action => "exit", stateId => "s2" }, + { subject => "state", when => "after", action => "exit", stateId => "s2" }, + { subject => "transition", when => "before", source => "s2", target => "pass"}, + { subject => "transition", when => "after", source => "s2", target => "pass"}, + { subject => "state", when => "before", action => "enter", stateId => "pass" }, + { subject => "state", when => "after", action => "enter", stateId => "pass" }, + { subject => "microstep", when => "after" }, + + ); + + ### Get a session + $request = GET $baseURL.'/connect'; + $response = $ua->request($request); + assertSuccess($response, "Could not connect"); + + my $session = from_json($response->content())->{'session'}; + die("Cannot acquire session from server") if (!$session); + + ### Prepare an SCXML interpreter + $request = POST $baseURL.'/prepare', + [ + 'session' => $session, + 'url' => 'http://localhost/test152.scxml', + 'xml' => $xml + ]; + $response = $ua->request($request); + assertSuccess($response, "Could not prepare SCXML"); + + while(@breakpointSeq > 0) { + ### Take a step + $request = POST $baseURL.'/step', ['session' => $session]; + $response = $ua->request($request); + assertSuccess($response, "Could not step"); + # this will cause the interpreter to pause execution + + ### Get the pending messages + $request = POST $baseURL.'/poll', ['session' => $session]; + $response = $ua->request($request); + assertSuccess($response, "Could not get breakpoint after step"); + + # compare to what we expect + $data = from_json($response->content()); + popAndCompare($data->{'qualified'}); + } + + ### last step will finalize the interpreter + $request = POST $baseURL.'/step', ['session' => $session]; + $response = $ua->request($request); + assertSuccess($response, "Could not get breakpoint after step"); + + ### get the pending server push reply + $request = POST $baseURL.'/poll', ['session' => $session]; + $response = $ua->request($request); + assertSuccess($response, "Could not get breakpoint after step"); + + $data = from_json($response->content()); + die("Machine not yet finished") if ($data->{'replyType'} ne "finished"); + +} + +sub testBreakpoint { + my $xml = << 'END_SCXML'; + <scxml> + <state id='s1'> + <onentry> + <log label="'foo'" /> + </onentry> + <transition target='s2' /> + </state> + <state id='s2'> + <transition target='pass' /> + </state> + <final id='pass' /> + </scxml> +END_SCXML + + ### Get a session + $request = GET $baseURL.'/connect'; + $response = $ua->request($request); + assertSuccess($response, "Could not connect"); + + my $session = from_json($response->content())->{'session'}; + die("Cannot acquire session from server") if (!$session); + + ### Prepare an SCXML interpreter + $request = POST $baseURL.'/prepare', + [ + 'session' => $session, + 'url' => 'http://localhost/test154.scxml', + 'xml' => $xml + ]; + $response = $ua->request($request); + assertSuccess($response, "Could not prepare SCXML"); + + ### Skip to breakpoint + $request = POST $baseURL.'/breakpoint/skipto', + [ + 'session' => $session, + 'when' => 'after', + 'action' => 'enter', + 'subject' => 'state', + 'stateId' => 's1' + ]; + $response = $ua->request($request); + assertSuccess($response, "Could not add breakpoint"); + + ### get the pending server push reply + $request = POST $baseURL.'/poll', ['session' => $session]; + $response = $ua->request($request); + assertSuccess($response, "Could not get breakpoint after step"); + + $data = from_json($response->content()); + print Dumper($data); +} + +# &testSimpleStepping(); +&testBreakpoint(); + +kill('TERM', $pid);
\ No newline at end of file diff --git a/test/w3c/c89/test144.scxml b/test/w3c/c89/test144.scxml new file mode 100644 index 0000000..70588f9 --- /dev/null +++ b/test/w3c/c89/test144.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that events are inserted into the queue in the order in which they are raised. If +foo occurs before bar, success, otherwise failure --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <raise event="foo"/> + <raise event="bar"/> + </onentry> + <transition event="foo" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition event="bar" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test147.scxml b/test/w3c/c89/test147.scxml new file mode 100644 index 0000000..4ad167e --- /dev/null +++ b/test/w3c/c89/test147.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the first clause that evaluates to true - and only that clause - is executed. +Only one event should be raised, and it should be bar --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <if cond="false"> + <raise event="foo"/> + <assign location="Var1" expr="Var1 + 1"/> + <elseif cond="true"/> + <raise event="bar"/> + <assign location="Var1" expr="Var1 + 1"/> + <else/> + <raise event="baz"/> + <assign location="Var1" expr="Var1 + 1"/> + </if> + <raise event="bat"/> + </onentry> + <transition event="bar" cond="Var1==1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test148.scxml b/test/w3c/c89/test148.scxml new file mode 100644 index 0000000..dae0415 --- /dev/null +++ b/test/w3c/c89/test148.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the else clause executes if <if> and <elseif> evaluate to false. +Baz should be the only event generated by the <if>. bat is raised to catch the case where the <else> clause +fails and baz is not generated, i.e. it makes sure that the test doesn't hang. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <if cond="false"> + <raise event="foo"/> + <assign location="Var1" expr="Var1 + 1"/> + <elseif cond="false"/> + <raise event="bar"/> + <assign location="Var1" expr="Var1 + 1"/> + <else/> + <raise event="baz"/> + <assign location="Var1" expr="Var1 + 1"/> + </if> + <raise event="bat"/> + </onentry> + <transition event="baz" cond="Var1==1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test149.scxml b/test/w3c/c89/test149.scxml new file mode 100644 index 0000000..7720f7b --- /dev/null +++ b/test/w3c/c89/test149.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that neither if clause executes, so that bat is the only event raised. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <if cond="false"> + <raise event="foo"/> + <assign location="Var1" expr="Var1 + 1"/> + <elseif cond="false"/> + <raise event="bar"/> + <assign location="Var1" expr="Var1 + 1"/> + </if> + <raise event="bat"/> + </onentry> + <transition event="bat" cond="Var1==0" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test150.scxml b/test/w3c/c89/test150.scxml new file mode 100644 index 0000000..5769dcc --- /dev/null +++ b/test/w3c/c89/test150.scxml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that foreach causes a new variable to be declared if 'item' doesn't already exist. Also +test that it will use an existing var if it does exist. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1"/> + <data id="Var2"/> + <data id="Var3"> + [1,2,3] + </data> + </datamodel> + <state id="s0"> + <onentry> + <!-- first use declared variables --> + <foreach item="Var1" index="Var2" array="Var3"/> + <raise event="foo"/> + </onentry> + <transition event="error" target="fail"/> + <transition event="*" target="s1"/> + </state> + <state id="s1"> + <onentry> + <!-- now use undeclared variables --> + <foreach item="Var4" index="Var5" array="Var3"/> + <raise event="bar"/> + </onentry> + <transition event="error" target="fail"/> + <transition event="*" target="s2"/> + </state> + <state id="s2"> + <!-- check that var4 is bound --> + <transition cond="Var4" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test151.scxml b/test/w3c/c89/test151.scxml new file mode 100644 index 0000000..03721e8 --- /dev/null +++ b/test/w3c/c89/test151.scxml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that foreach causes a new variable to be declared if 'item' doesn't already exist. Also +test that it will use an existing var if it does exist. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1"/> + <data id="Var2"/> + <data id="Var3"> + [1,2,3] + </data> + </datamodel> + <state id="s0"> + <onentry> + <!-- first use declared variables --> + <foreach item="Var1" index="Var2" array="Var3"/> + <raise event="foo"/> + </onentry> + <transition event="error" target="fail"/> + <transition event="*" target="s1"/> + </state> + <state id="s1"> + <onentry> + <!-- now use undeclared variables --> + <foreach item="Var4" index="Var5" array="Var3"/> + <raise event="bar"/> + </onentry> + <transition event="error" target="fail"/> + <transition event="*" target="s2"/> + </state> + <state id="s2"> + <!-- check that var5 is bound --> + <transition cond="Var5" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test152.scxml b/test/w3c/c89/test152.scxml new file mode 100644 index 0000000..1c9eeef --- /dev/null +++ b/test/w3c/c89/test152.scxml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an illegal array or item value causes error.execution and results in executable content +not being executed. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1" expr="0"/> + <data id="Var2"/> + <data id="Var3"/> + <data id="Var4" expr="7"/> + <data id="Var5"> + [1,2,3] + </data> + </datamodel> + <state id="s0"> + <onentry> + <!-- invalid array, legal item --> + <foreach item="Var2" index="Var3" array="Var4"> + <assign location="Var1" expr="Var1 + 1"/> + </foreach> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <!-- illegal item, legal array --> + <foreach item="'continue'" index="Var3" array="Var5"> + <assign location="Var1" expr="Var1 + 1"/> + </foreach> + <raise event="bar"/> + </onentry> + <transition event="error.execution" target="s2"/> + <transition event="bar" target="fail"/> + </state> + <state id="s2"> + <!-- check that var1 has its original value (so executable content never got executed --> + <transition cond="Var1==0" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test153.scxml b/test/w3c/c89/test153.scxml new file mode 100644 index 0000000..d1be3c4 --- /dev/null +++ b/test/w3c/c89/test153.scxml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that foreach goes over the array in the right order. since the array contains 1 2 3, we compare the current +value with the previous value, which is stored in var1. The current value should always be larger. If +it ever isn't, set Var4 to 0, indicating failure --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + <!-- contains the previous value --> + <data id="Var2"/> + <!-- the item which will contain the current value --> + <data id="Var3"> + [1,2,3] + </data> + <data id="Var4" expr="1"/> + <!-- 1 if success, 0 if failure --> + </datamodel> + <state id="s0"> + <onentry> + <foreach item="Var2" array="Var3"> + <if cond="Var1<Var2"> + <assign location="Var1" expr="Var2"/> + <else/> + <!-- values are out of order, record failure --> + <assign location="Var4" expr="0"/> + </if> + </foreach> + </onentry> + <!-- check that var1 has its original value --> + <transition cond="Var4==0" target="fail"/> + <transition target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test155.scxml b/test/w3c/c89/test155.scxml new file mode 100644 index 0000000..dc4321e --- /dev/null +++ b/test/w3c/c89/test155.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that foreach executes the executable content once for each item in the list '(1,2,3)'. The executable +content sums the items into var1 so it should be 6 at the end --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + <data id="Var2"/> + <data id="Var3"> + [1,2,3] + </data> + </datamodel> + <state id="s0"> + <onentry> + <foreach item="Var2" array="Var3"> + <assign location="Var1" expr="Var1 + Var2"/> + </foreach> + </onentry> + <transition cond="Var1==6" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test156.scxml b/test/w3c/c89/test156.scxml new file mode 100644 index 0000000..5fb58d1 --- /dev/null +++ b/test/w3c/c89/test156.scxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an error causes the foreach to stop execution. The second piece of executable content +should cause an error, so var1 should be incremented only once --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + <data id="Var2"/> + <data id="Var3"> + [1,2,3] + </data> + </datamodel> + <state id="s0"> + <onentry> + <foreach item="Var2" array="Var3"> + <assign location="Var1" expr="Var1 + 1"/> + <!-- assign an illegal value to a non-existent var --> + <assign location="Var5" expr="return"/> + </foreach> + </onentry> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test158.scxml b/test/w3c/c89/test158.scxml new file mode 100644 index 0000000..17eef6f --- /dev/null +++ b/test/w3c/c89/test158.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that executable content executes in document order. if event1 occurs then event2, succeed, otherwise fail --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <raise event="event1"/> + <raise event="event2"/> + </onentry> + <transition event="event1" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test159.scxml b/test/w3c/c89/test159.scxml new file mode 100644 index 0000000..569587b --- /dev/null +++ b/test/w3c/c89/test159.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that any error raised by an element of executable content causes all subsequent elements to be skipped. +The send tag will raise an error so var1 should not be incremented. If it is fail, otherwise succeed --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="thisWillFail" target="baz"/> + <assign location="Var1" expr="Var1 + 1"/> + </onentry> + <transition cond="Var1==1" target="fail"/> + <transition target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test172.scxml b/test/w3c/c89/test172.scxml new file mode 100644 index 0000000..6555efd --- /dev/null +++ b/test/w3c/c89/test172.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that eventexpr uses the current value of var1, not its initial value --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1" expr="&event1&"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="&event2&"/> + <send eventexpr="Var1"/> + </onentry> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test173.scxml b/test/w3c/c89/test173.scxml new file mode 100644 index 0000000..62afabd --- /dev/null +++ b/test/w3c/c89/test173.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that targetexpr uses the current value of var1, not its initial value +(If it uses the initial value, it will generate an error. If it uses the current value, event1 will be raised --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="27"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="&#_internal&"/> + <send targetexpr="Var1" event="event1"/> + </onentry> + <transition event="event1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test174.scxml b/test/w3c/c89/test174.scxml new file mode 100644 index 0000000..6b9c6ee --- /dev/null +++ b/test/w3c/c89/test174.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that typeexpr uses the current value of var1, not its initial value +(If it uses the initial value, it will generate an error. If it uses the current value, event1 will be raised --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1" expr="27"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="&http://www.w3.org/TR/scxml/#SCXMLEventProcessor&"/> + <send typeexpr="Var1" event="event1"/> + </onentry> + <transition event="event1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test175.scxml b/test/w3c/c89/test175.scxml new file mode 100644 index 0000000..7761a3e --- /dev/null +++ b/test/w3c/c89/test175.scxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that delayexpr uses the current value of var1, not its initial value +(If it uses the initial value, event2 will be generated first, before event1. If it uses the current value, +event1 will be raised first. Succeed if event1 occurs before event2, otherwise fail --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="&0s&"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="&1s&"/> + <send delayexpr="Var1" event="event2"/> + <send delayexpr="&.5s&" event="event1"/> + </onentry> + <transition event="event1" target="s1"/> + <transition event="event2" target="fail"/> + </state> + <state id="s1"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test176.scxml b/test/w3c/c89/test176.scxml new file mode 100644 index 0000000..c452d8b --- /dev/null +++ b/test/w3c/c89/test176.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that <param> uses the current value of var1, not its initial value. If the value of +aParam in event1 is 2 so that var2 gets set to 2, success, otherwise failure --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="1"/> + <data id="Var2"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="2"/> + <send event="event1"> + <param name="aParam" expr="Var1"/> + </send> + </onentry> + <transition event="event1" target="s1"> + <assign location="Var2" expr="_event.data.aParam"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var2==2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test178.scxml b/test/w3c/c89/test178.scxml new file mode 100644 index 0000000..45bf413 --- /dev/null +++ b/test/w3c/c89/test178.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that multiple key/value pairs are included, even when the keys are the same. +This is a manual test. The tester must look at the log output and verify that both +keys are there. (This test uses the SCXML Event I/O processor, which is the only +one that all platforms must support. It does not specify the message format, so +we cannot test _event.raw directly. Therefore we print it out for visual +inspection.) --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="event1"> + <param name="Var1" expr="2"/> + <param name="Var1" expr="3"/> + </send> + </onentry> + <transition event="event1" target="final"> + <log label="_event " expr="_event.raw"/> + </transition> + <transition event="*" target="fail"/> + </state> + <final id="final"/> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test179.scxml b/test/w3c/c89/test179.scxml new file mode 100644 index 0000000..c8bbaff --- /dev/null +++ b/test/w3c/c89/test179.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that <content> can be used to populate body of a message --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="event1"> + <content>123</content> + </send> + </onentry> + <transition event="event1" cond="_event.data == 123" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test183.scxml b/test/w3c/c89/test183.scxml new file mode 100644 index 0000000..f99e15b --- /dev/null +++ b/test/w3c/c89/test183.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that <send> stores the value of the sendid in idlocation. If it does, +var1 has a value and we pass. Otherwise we fail --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="event1" idlocation="Var1"/> + </onentry> + <transition cond="Var1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test185.scxml b/test/w3c/c89/test185.scxml new file mode 100644 index 0000000..ac72374 --- /dev/null +++ b/test/w3c/c89/test185.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that <send> respects the delay specification. If it does, event1 arrives before event2 + and we pass. Otherwise we fail --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="event2" delayexpr="&1s&"/> + <send event="event1"/> + </onentry> + <transition event="event1" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test186.scxml b/test/w3c/c89/test186.scxml new file mode 100644 index 0000000..eea2689 --- /dev/null +++ b/test/w3c/c89/test186.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that <send> evals its args when it is evaluated, not when the delay interval expires and the +message is actually sent. If it does, aParam will have the value of 1 (even though var1 has been incremented +in the interval.) If var2 ends up == 1, we pass. Otherwise we fail --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="1"/> + <data id="Var2"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="event1" delayexpr="&1s&"> + <param name="aParam" expr="Var1"/> + </send> + <assign location="Var1" expr="2"/> + </onentry> + <transition event="event1" target="s1"> + <assign location="Var2" expr="_event.data.aParam"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var2==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test187.scxml b/test/w3c/c89/test187.scxml new file mode 100644 index 0000000..291410d --- /dev/null +++ b/test/w3c/c89/test187.scxml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that delayed <send> is not sent if the sending session terminates. In this case, +a subscript is invoked which sends the event childToParent delayed by 1 second, and then terminates. The +parent session, should not receive childToParent. If it does, we fail. Otherwise the +10 sec timer expires and we pass --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="timeout" delayexpr="&1s&"/> + </onentry> + <invoke type="scxml"> + <content> + <!-- exit before the delayed send can execute --> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <state id="sub0"> + <onentry> + <send event="childToParent" target="#_parent" delayexpr="&.5s&"/> + </onentry> + <transition target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="childToParent" target="fail"/> + <transition event="timeout" target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test189.scxml b/test/w3c/c89/test189.scxml new file mode 100644 index 0000000..d7500a9 --- /dev/null +++ b/test/w3c/c89/test189.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that #_internal as a target of <send> puts the event on the internal queue. If it does, +event1 will be processed before event2, because event1 is added to the internal queue while event2 is +added to the external queue (event though event2 is generated first) --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <!-- goes to the external queue --> + <send event="event2"/> + <!-- to the internal queue --> + <send event="event1" target="#_internal"/> + </onentry> + <!-- once we've entered the state, we should check for internal events first --> + <transition event="event1" target="pass"/> + <transition event="event2" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test190.scxml b/test/w3c/c89/test190.scxml new file mode 100644 index 0000000..dfa0a98 --- /dev/null +++ b/test/w3c/c89/test190.scxml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that #_scxml_sessionid as a target of <send> puts the event on the external queue. If it does, +event1 will be processed before event2, because event1 is added to the internal queue while event2 is +added to the external queue (event though event2 is generated first). we have to make sure that event2 +is actually delivered. The delayed <send> makes sure another event is generated (so the test doesn't hang) --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="&#_scxml_&"/> + <data id="Var2" expr="_sessionid"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="Var1 + Var2"/> + <!-- goes to the external queue --> + <send event="event2" targetexpr="Var1"/> + <!-- to the internal queue --> + <raise event="event1"/> + <!-- this should get added to the external queue after event2 --> + <send event="timeout"/> + </onentry> + <!-- once we've entered the state, we should check for internal events first --> + <transition event="event1" target="s1"/> + <transition event="*" target="fail"/> + </state> + <!-- now check that we get event2 and not a timeout --> + <state id="s1"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test191.scxml b/test/w3c/c89/test191.scxml new file mode 100644 index 0000000..562f662 --- /dev/null +++ b/test/w3c/c89/test191.scxml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that #_parent works as a target of <send> . a subscript is invoked and sends the event +childToParent to its parent session (ths session) using #_parent as the target. If we get this event, we +pass, otherwise we fail. The timer insures that some event is generated and that the test does not hang. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="timeout" delay="5s"/> + </onentry> + <invoke type="scxml"> + <content> + <!-- send an event to the parent session using #_parent as the target --> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <state id="sub0"> + <onentry> + <send event="childToParent" target="#_parent"/> + </onentry> + <transition target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="childToParent" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test192.scxml b/test/w3c/c89/test192.scxml new file mode 100644 index 0000000..31d6b26 --- /dev/null +++ b/test/w3c/c89/test192.scxml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that #_invokeid works as a target of <send> . A child script is invoked and sends us +childToParent once its running. Then we send it the event parentToChild using its invokeid as the target. +If it receives this event, it sends sends the event eventReceived to its parent session (ths session). +If we get this event, we pass, otherwise the child script eventually times out sends invoke.done and we fail. +We also set a timeout in this process to make sure the test doesn't hang --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="5s"/> + </onentry> + <invoke type="scxml" id="invokedChild"> + <content> + <!-- let the parent session know we're running by sending childToParent, then wait for parentToChild. + If we get it, send eventReceived. If we don't we eventually time out --> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <state id="sub0"> + <onentry> + <send event="childToParent" target="#_parent"/> + <send event="timeout" delay="3s"/> + </onentry> + <transition event="parentToChild" target="subFinal"> + <send target="#_parent" event="eventReceived"/> + </transition> + <transition event="timeout" target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="timeout" target="fail"/> + <transition event="done.invoke" target="fail"/> + <state id="s01"> + <transition event="childToParent" target="s02"> + <send target="#_invokedChild" event="parentToChild"/> + </transition> + </state> + <state id="s02"> + <transition event="eventReceived" target="pass"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test193.scxml b/test/w3c/c89/test193.scxml new file mode 100644 index 0000000..c0d5db1 --- /dev/null +++ b/test/w3c/c89/test193.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that omitting target and targetexpr of <send> when using the +SCXML event i/o processor puts the event on the external queue. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="internal"/> + <!-- this should put event1 in the external queue --> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor"/> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="event1" target="fail"/> + <transition event="internal" target="s1"/> + </state> + <state id="s1"> + <transition event="event1" target="pass"/> + <transition event="timeout" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test194.scxml b/test/w3c/c89/test194.scxml new file mode 100644 index 0000000..dd1d125 --- /dev/null +++ b/test/w3c/c89/test194.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that specifying an illegal target for <send> causes the event error.execution to be raised. If it does, +we succeed. Otherwise we eventually timeout and fail. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <!-- should cause an error --> + <send target="baz" event="event2"/> + <!-- this will get added to the external event queue after the error has been raised --> + <send event="timeout"/> + </onentry> + <!-- once we've entered the state, we should check for internal events first --> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test198.scxml b/test/w3c/c89/test198.scxml new file mode 100644 index 0000000..df85813 --- /dev/null +++ b/test/w3c/c89/test198.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that if type is not provided <send> uses the scxml event i/o processor. The only way to tell +what processor was used is to look at the origintype of the resulting event --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="event1"/> + <send event="timeout"/> + </onentry> + <transition event="event1" cond=" _event.origintype == 'http://www.w3.org/TR/scxml/#SCXMLEventProcessor'" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test199.scxml b/test/w3c/c89/test199.scxml new file mode 100644 index 0000000..6820ecf --- /dev/null +++ b/test/w3c/c89/test199.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that using an invalid send type results in error.execution --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send type="27" event="event1"/> + <send event="timeout"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test200.scxml b/test/w3c/c89/test200.scxml new file mode 100644 index 0000000..12c537a --- /dev/null +++ b/test/w3c/c89/test200.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the processor supports the scxml event i/o processor --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="event1"/> + <send event="timeout"/> + </onentry> + <transition event="event1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test201.scxml b/test/w3c/c89/test201.scxml new file mode 100644 index 0000000..c7862f5 --- /dev/null +++ b/test/w3c/c89/test201.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the processor supports the basic http event i/o processor. This is an optional +test since platforms are not required to support basic http event i/o --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor" targetexpr="_ioprocessors['basichttp']['location']" event="event1"/> + <send event="timeout"/> + </onentry> + <transition event="event1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test205.scxml b/test/w3c/c89/test205.scxml new file mode 100644 index 0000000..41753ae --- /dev/null +++ b/test/w3c/c89/test205.scxml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the processor doesn't change the message. We can't test that it never does this, but +at least we can check that the event name and included data are the same as we sent. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="event1"> + <param name="aParam" expr="1"/> + </send> + <send event="timeout"/> + </onentry> + <transition event="event1" target="s1"> + <assign location="Var1" expr="_event.data.aParam"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test207.scxml b/test/w3c/c89/test207.scxml new file mode 100644 index 0000000..34803f5 --- /dev/null +++ b/test/w3c/c89/test207.scxml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that that we can't cancel an event in another session. We invoke a child process. It notifies +us when it has generated a delayed event with sendid foo. We try to cancel foo. The child process sends us event + event success if the event is not cancelled, event fail otherwise. This doesn't test that there is absolutely no way to cancel an event +raised in another session, but the spec doesn't define any way to refer to an event in another process --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delayexpr="&2s&"/> + </onentry> + <invoke type="scxml"> + <content> + <!-- when invoked, we raise a delayed event1 with sendid 'foo' and notify our parent. Then we wait. + If event1 occurs, the parent hasn't succeeded in canceling it and we return pass. If event2 occurs + it means event1 was canceled (because event2 is delayed longer than event1) and we return 'fail'. --> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <state id="sub0"> + <onentry> + <send event="event1" id="foo" delayexpr="&1s&"/> + <send event="event2" delayexpr="&1.5s&"/> + <send target="#_parent" event="childToParent"/> + </onentry> + <transition event="event1" target="subFinal"> + <send target="#_parent" event="pass"/> + </transition> + <transition event="*" target="subFinal"> + <send target="#_parent" event="fail"/> + </transition> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <state id="s01"> + <transition event="childToParent" target="s02"> + <cancel sendid="foo"/> + </transition> + </state> + <state id="s02"> + <transition event="pass" target="pass"/> + <transition event="fail" target="fail"/> + <transition event="timeout" target="fail"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test208.scxml b/test/w3c/c89/test208.scxml new file mode 100644 index 0000000..c57f7a6 --- /dev/null +++ b/test/w3c/c89/test208.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that cancel works. We cancel delayed event1. If cancel works, we get event2 first and pass. If +we get event1 or an error first, cancel didn't work and we fail. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send id="foo" event="event1" delayexpr="&1s&"/> + <send event="event2" delayexpr="&1.5s&"/> + <cancel sendid="foo"/> + </onentry> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test210.scxml b/test/w3c/c89/test210.scxml new file mode 100644 index 0000000..ed186f6 --- /dev/null +++ b/test/w3c/c89/test210.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that sendidexpr works with cancel. If it takes the most recent value of var1, it should cancel +delayed event1. Thus we get event2 first and pass. If we get event1 or an error first, cancel didn't work and we fail. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="&bar&"/> + </datamodel> + <state id="s0"> + <onentry> + <send id="foo" event="event1" delayexpr="&1s&"/> + <send event="event2" delayexpr="&1.5s&"/> + <assign location="Var1" expr="&foo&"/> + <cancel sendidexpr="Var1"/> + </onentry> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test215.scxml b/test/w3c/c89/test215.scxml new file mode 100644 index 0000000..ab31830 --- /dev/null +++ b/test/w3c/c89/test215.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that typexpr is evaluated at runtime. If the original value of var1 is used, the invocation +will fail (test215sub1.scxml is not of type 'foo', even if the platform supports foo as a type). If +the runtime value is used, the invocation will succeed --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1" expr="&foo&"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="5s"/> + <assign location="Var1" expr="&http://www.w3.org/TR/scxml/&"/> + </onentry> + <invoke typeexpr="Var1"> + <content> + <!-- when invoked, terminate returning done.invoke. This proves that the invocation succeeded. --> + <scxml initial="subFinal" datamodel="c89" version="1.0"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="done.invoke" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test216.scxml b/test/w3c/c89/test216.scxml new file mode 100644 index 0000000..c463ace --- /dev/null +++ b/test/w3c/c89/test216.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that srcexpr is evaluated at runtime. If the original value of var1 is used, the invocation +will fail (assuming that there is no script named 'foo'). If +the runtime value is used, the invocation will succeed --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="&foo&"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="5s"/> + <assign location="Var1" expr="&file:test216sub1.scxml&"/> + </onentry> + <invoke srcexpr="Var1" type="http://www.w3.org/TR/scxml"/> + <transition event="done.invoke" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test216sub1.scxml b/test/w3c/c89/test216sub1.scxml new file mode 100644 index 0000000..5c45dd7 --- /dev/null +++ b/test/w3c/c89/test216sub1.scxml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- when invoked, terminate returning done.invoke. This proves that the invocation succeeded. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="final" version="1.0" datamodel="c89"> + <final id="final"/> +</scxml> diff --git a/test/w3c/c89/test220.scxml b/test/w3c/c89/test220.scxml new file mode 100644 index 0000000..76556da --- /dev/null +++ b/test/w3c/c89/test220.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the scxml type is supported. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="timeout" delay="5s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <!-- when invoked, terminate returning done.invoke. This proves that the invocation succeeded. --> + <scxml initial="subFinal" version="1.0" datamodel="c89"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="done.invoke" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test223.scxml b/test/w3c/c89/test223.scxml new file mode 100644 index 0000000..6b31a51 --- /dev/null +++ b/test/w3c/c89/test223.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that idlocation is supported. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" idlocation="Var1"> + <content> + <!-- when invoked, terminate returning done.invoke. This proves that the invocation succeeded. --> + <scxml initial="subFinal" version="1.0" datamodel="c89"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="*" target="s1"/> + </state> + <state id="s1"> + <transition cond="Var1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test224.scxml b/test/w3c/c89/test224.scxml new file mode 100644 index 0000000..7688f2a --- /dev/null +++ b/test/w3c/c89/test224.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the automatically generated id has the form stateid.platformid. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1"/> + <data id="Var2" expr="&s0.&"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" idlocation="Var1"> + <content> + <!-- when invoked, terminate returning done.invoke. This proves that the invocation succeeded. --> + <scxml version="1.0" initial="subFinal" datamodel="c89"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="*" target="s1"/> + </state> + <state id="s1"> + <transition cond="(function(str, starts){if (starts === '') return true;if (str == null || starts == null) return false;str = String(str); starts = String(starts);return str.length >= starts.length && str.slice(0, starts.length) === starts;})(Var1, Var2)" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test225.scxml b/test/w3c/c89/test225.scxml new file mode 100644 index 0000000..dedb708 --- /dev/null +++ b/test/w3c/c89/test225.scxml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the automatically generated id is unique, we call invoke twice and compare the ids. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1"/> + <data id="Var2"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" idlocation="Var1"> + <content> + <scxml initial="subFinal1" version="1.0" datamodel="c89"> + <final id="subFinal1"/> + </scxml> + </content> + </invoke> + <invoke type="http://www.w3.org/TR/scxml/" idlocation="Var2"> + <content> + <scxml initial="subFinal2" version="1.0" datamodel="c89"> + <final id="subFinal2"/> + </scxml> + </content> + </invoke> + <transition event="*" target="s1"/> + </state> + <state id="s1"> + <transition cond="Var1===Var2" target="fail"/> + <transition target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test226.scxml b/test/w3c/c89/test226.scxml new file mode 100644 index 0000000..6e6e171 --- /dev/null +++ b/test/w3c/c89/test226.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- this is basically just a test that invoke works correctly and that you can pass data +to the invoked process. If the invoked session finds aParam==1, it exits, signalling +success. otherwise it will hang and the timeout in this doc signifies failure. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" src="file:test226sub1.scxml"> + <param name="Var1" expr="1"/> + </invoke> + <transition event="varBound" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test226sub1.scxml b/test/w3c/c89/test226sub1.scxml new file mode 100644 index 0000000..d7bb061 --- /dev/null +++ b/test/w3c/c89/test226sub1.scxml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- when invoked, if var1 has a value notify parent. Then terminate. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="final"> + <send target="#_parent" event="varBound"/> + </transition> + <transition target="final"/> + </state> + <final id="final"/> +</scxml> diff --git a/test/w3c/c89/test228.scxml b/test/w3c/c89/test228.scxml new file mode 100644 index 0000000..bad00c4 --- /dev/null +++ b/test/w3c/c89/test228.scxml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the invokeid is included in events returned from the invoked process. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" id="foo"> + <content> + <scxml initial="subFinal" version="1.0" datamodel="c89"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="done.invoke" target="s1"> + <assign location="Var1" expr="_event.invokeid"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var1=='foo'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test229.scxml b/test/w3c/c89/test229.scxml new file mode 100644 index 0000000..e24280f --- /dev/null +++ b/test/w3c/c89/test229.scxml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that autofoward works. If the child process receives back a copy of the +childToParent event that it sends to this doc, it sends eventReceived, signalling success. (Note +that this doc is not required to process that event explicitly. It should be forwarded in any case.) Otherwise +it eventually times out and the done.invoke signals failure --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" autoforward="true"> + <content> + <!-- when invoked, send childToParent to parent. + If it is forwarded back to us, send + eventReceived to signal success and terminate. + Otherwise wait for timer to expire and terminate. --> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <state id="sub0"> + <onentry> + <send target="#_parent" event="childToParent"/> + <send event="timeout" delay="3s"/> + </onentry> + <transition event="childToParent" target="subFinal"> + <send target="#_parent" event="eventReceived"/> + </transition> + <transition event="*" target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="childToParent"/> + <transition event="eventReceived" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test230.scxml b/test/w3c/c89/test230.scxml new file mode 100644 index 0000000..97d1fa9 --- /dev/null +++ b/test/w3c/c89/test230.scxml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- a manual test that an autofowarded event has the same fields and values as the original event. +the child process sends the parent process an event which is forwarded back to it. +Both the parent and child process print out the contents of the event. The tester +must check if they are the same and report his result. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" autoforward="true"> + <content> + <!-- when invoked, send childToParent to parent. If it is forwarded back to us, print out its + fields and terminate. --> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <state id="sub0"> + <onentry> + <send target="#_parent" event="childToParent"/> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="childToParent" target="subFinal"> + <log label="name is " expr="_event.name"/> + <log label="type is " expr="_event.type"/> + <log label="sendid is " expr="_event.sendid"/> + <log label="origin is " expr="_event.origin"/> + <log label="origintype is " expr="_event.origintype"/> + <log label="invokeid is " expr="_event.invokeid"/> + <log label="data is " expr="_event.data"/> + </transition> + <transition event="*" target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="timeout" target="final"/> + <state id="s01"> + <transition event="childToParent" target="s02"> + <log label="name is " expr="_event.name"/> + <log label="type is " expr="_event.type"/> + <log label="sendid is " expr="_event.sendid"/> + <log label="origin is " expr="_event.origin"/> + <log label="origintype is " expr="_event.origintype"/> + <log label="invokeid is " expr="_event.invokeid"/> + <log label="data is " expr="_event.data"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s02"> + <!-- wait till we get the done event to ensure that the child process has time to print out its results --> + <transition event="done.invoke" target="final"/> + </state> + </state> + <final id="final"/> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test232.scxml b/test/w3c/c89/test232.scxml new file mode 100644 index 0000000..54c9fe3 --- /dev/null +++ b/test/w3c/c89/test232.scxml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a parent process can receive multiple events from a child process --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml initial="subFinal" version="1.0" datamodel="c89"> + <final id="subFinal"> + <onentry> + <send target="#_parent" event="childToParent1"/> + <send target="#_parent" event="childToParent2"/> + </onentry> + </final> + </scxml> + </content> + </invoke> + <transition event="timeout" target="fail"/> + <state id="s01"> + <transition event="childToParent1" target="s02"/> + </state> + <state id="s02"> + <transition event="childToParent2" target="s03"/> + </state> + <state id="s03"> + <transition event="done.invoke" target="pass"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test233.scxml b/test/w3c/c89/test233.scxml new file mode 100644 index 0000000..5d729ea --- /dev/null +++ b/test/w3c/c89/test233.scxml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that finalize markup runs before the event is processed. The invoked process will +return 2 in _event.data.aParam, so that new value should be in force when we select +the transtitions. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml initial="subFinal" version="1.0" datamodel="c89"> + <final id="subFinal"> + <onentry> + <send target="#_parent" event="childToParent"> + <param name="aParam" expr="2"/> + </send> + </onentry> + </final> + </scxml> + </content> + <finalize> + <assign location="Var1" expr="_event.data.aParam"/> + </finalize> + </invoke> + <transition event="childToParent" cond="Var1==2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test234.scxml b/test/w3c/c89/test234.scxml new file mode 100644 index 0000000..e7da47b --- /dev/null +++ b/test/w3c/c89/test234.scxml @@ -0,0 +1,69 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that only finalize markup in the invoking state runs. the first invoked process will +return 2 in _event.data.aParam, while second invoked process sleeps without returning any events. +Only the first finalize should execute. So when we get to s1 var1 should have value 2 but +var2 should still be set to 1 --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="p0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="1"/> + <data id="Var2" expr="1"/> + </datamodel> + <parallel id="p0"> + <onentry> + <send event="timeout" delay="3s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="p01"> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml version="1.0" initial="subFinal1" datamodel="c89"> + <final id="subFinal1"> + <onentry> + <send target="#_parent" event="childToParent"> + <param name="aParam" expr="2"/> + </send> + </onentry> + </final> + </scxml> + </content> + <finalize> + <assign location="Var1" expr="_event.data.aParam"/> + </finalize> + </invoke> + <transition event="childToParent" cond="Var1==2" target="s1"/> + <transition event="childToParent" target="fail"/> + </state> + <state id="p02"> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml version="1.0" initial="sub0" datamodel="c89"> + <state id="sub0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="timeout" target="subFinal2"/> + </state> + <final id="subFinal2"/> + </scxml> + </content> + <finalize> + <assign location="Var2" expr="_event.data.aParam"/> + </finalize> + </invoke> + </state> + </parallel> + <state id="s1"> + <transition cond="Var2==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test235.scxml b/test/w3c/c89/test235.scxml new file mode 100644 index 0000000..d3014bd --- /dev/null +++ b/test/w3c/c89/test235.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that done.invoke.id event has the right id. the invoked child terminates immediately +and should generate done.invoke.foo --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" id="foo"> + <content> + <scxml initial="subFinal" version="1.0" datamodel="c89"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="done.invoke.foo" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test236.scxml b/test/w3c/c89/test236.scxml new file mode 100644 index 0000000..8ee4212 --- /dev/null +++ b/test/w3c/c89/test236.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that done.invoke.id event is the last event we receive. the invoked process sends childToParent +in the exit handler of its final state. We should get it before the done.invoke, and we should get no +events after the done.invoke. Hence timeout indicates success --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="timeout" delayexpr="&2s&"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml initial="subFinal" version="1.0" datamodel="c89"> + <final id="subFinal"> + <onexit> + <send target="#_parent" event="childToParent"/> + </onexit> + </final> + </scxml> + </content> + </invoke> + <transition event="childToParent" target="s1"/> + <transition event="done.invoke" target="fail"/> + </state> + <state id="s1"> + <!-- here we should get done.invoke --> + <transition event="done.invoke" target="s2"/> + <transition event="*" target="fail"/> + </state> + <state id="s2"> + <transition event="timeout" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test237.scxml b/test/w3c/c89/test237.scxml new file mode 100644 index 0000000..037ebab --- /dev/null +++ b/test/w3c/c89/test237.scxml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that cancelling works. invoked child sleeps for two seconds, then terminates. We +sleep for 1 sec in s0, then move to s1. This should cause the invocation to get cancelled. +If we receive done.invoke, the invocation wasn't cancelled, and we fail. If we receive no events by +the time timeout2 fires, success --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="timeout1" delayexpr="&1s&"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <!-- when invoked, sleep for 2 secs then terminate. Parent will try to cancel this session --> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <state id="sub0"> + <onentry> + <send event="timeout" delayexpr="&2s&"/> + </onentry> + <transition event="timeout" target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="timeout1" target="s1"/> + </state> + <state id="s1"> + <onentry> + <send event="timeout2" delayexpr="&1.5s&"/> + </onentry> + <!-- here we should NOT get done.invoke --> + <transition event="done.invoke" target="fail"/> + <transition event="*" target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test239.scxml b/test/w3c/c89/test239.scxml new file mode 100644 index 0000000..ed67141 --- /dev/null +++ b/test/w3c/c89/test239.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that markup can be specified both by 'src' and by <content> --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s01"> + <invoke type="http://www.w3.org/TR/scxml/" src="file:test239sub1.scxml"/> + <transition event="done.invoke" target="s02"/> + </state> + <state id="s02"> + <invoke type="http://www.w3.org/TR/scxml/"> + <!-- identical to test239sub1.scxml. --> + <content> + <scxml version="1.0" initial="final" datamodel="c89"> + <final id="final"/> + </scxml> + </content> + </invoke> + <transition event="done.invoke" target="pass"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test239sub1.scxml b/test/w3c/c89/test239sub1.scxml new file mode 100644 index 0000000..dcb9b8e --- /dev/null +++ b/test/w3c/c89/test239sub1.scxml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- when invoked, just terminate. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="final" version="1.0" datamodel="c89"> + <final id="final"/> +</scxml> diff --git a/test/w3c/c89/test240.scxml b/test/w3c/c89/test240.scxml new file mode 100644 index 0000000..742f513 --- /dev/null +++ b/test/w3c/c89/test240.scxml @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that datamodel values can be specified both by 'namelist' and by <param>. +invoked child will return success if its Var1 is set to 1, failure otherwise. This +test will fail schema validation because of the multiple occurences of Var1, but +should run correctly. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s01"> + <invoke type="http://www.w3.org/TR/scxml/" namelist="Var1"> + <content> + <scxml initial="sub01" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="sub01"> + <transition cond="Var1==1" target="subFinal1"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal1"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal1"/> + </scxml> + </content> + </invoke> + <transition event="success" target="s02"/> + <transition event="failure" target="fail"/> + </state> + <state id="s02"> + <invoke type="http://www.w3.org/TR/scxml/"> + <param name="Var1" expr="1"/> + <content> + <scxml initial="sub02" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="sub02"> + <transition cond="Var1==1" target="subFinal2"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal2"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal2"/> + </scxml> + </content> + </invoke> + <transition event="success" target="pass"/> + <transition event="failure" target="fail"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test241.scxml b/test/w3c/c89/test241.scxml new file mode 100644 index 0000000..18e35b7 --- /dev/null +++ b/test/w3c/c89/test241.scxml @@ -0,0 +1,96 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- The child process will return success ifits Var1 is set to 1, failure otherwise. For this test +we try passing in Var1 by param and by namelist and check that we either get two successes +or two failures. This test will fail schema validation due to multiple declarations of +Var1, but should run correctly. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s01"> + <invoke type="http://www.w3.org/TR/scxml/" namelist="Var1"> + <content> + <scxml initial="sub01" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="sub01"> + <transition cond="Var1==1" target="subFinal1"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal1"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal1"/> + </scxml> + </content> + </invoke> + <transition event="success" target="s02"/> + <transition event="failure" target="s03"/> + </state> + <state id="s02"> + <invoke type="http://www.w3.org/TR/scxml/"> + <param name="Var1" expr="1"/> + <content> + <scxml initial="sub02" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="sub02"> + <transition cond="Var1==1" target="subFinal2"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal2"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal2"/> + </scxml> + </content> + </invoke> + <!-- we got success in s01, so we need to do so here --> + <transition event="success" target="pass"/> + <transition event="failure" target="fail"/> + </state> + <state id="s03"> + <invoke type="http://www.w3.org/TR/scxml/"> + <param name="Var1" expr="1"/> + <content> + <scxml initial="sub03" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="sub03"> + <transition cond="Var1==1" target="subFinal3"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal3"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal3"/> + </scxml> + </content> + </invoke> + <!-- we got failure in s01, so we need to do so here --> + <transition event="failure" target="pass"/> + <transition event="success" target="fail"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test242.scxml b/test/w3c/c89/test242.scxml new file mode 100644 index 0000000..de2b871 --- /dev/null +++ b/test/w3c/c89/test242.scxml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that markup specified by 'src' and by <content> is treated the same way. That means that +either we get done.invoke in both cases or in neither case (in which case we timeout) --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="timeout1" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <invoke type="http://www.w3.org/TR/scxml/" src="file:test242sub1.scxml"/> + <transition event="done.invoke" target="s02"/> + <transition event="timeout1" target="s03"/> + </state> + <state id="s02"> + <onentry> + <send event="timeout2" delay="1s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <!-- identical to test242sub1.scxml. --> + <content> + <scxml version="1.0" initial="subFinal1" datamodel="c89"> + <final id="subFinal1"/> + </scxml> + </content> + </invoke> + <!-- we got done.invoke last time, so we need it this time too --> + <transition event="done.invoke" target="pass"/> + <transition event="timeout2" target="fail"/> + </state> + <state id="s03"> + <onentry> + <send event="timeout3" delay="1s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <!-- identical to test242sub1.scxml. --> + <content> + <scxml version="1.0" initial="subFinal2" datamodel="c89"> + <final id="subFinal2"/> + </scxml> + </content> + </invoke> + <!-- we got timeout last time, so we need it this time too --> + <transition event="timeout3" target="pass"/> + <transition event="done.invoke" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test242sub1.scxml b/test/w3c/c89/test242sub1.scxml new file mode 100644 index 0000000..dcb9b8e --- /dev/null +++ b/test/w3c/c89/test242sub1.scxml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- when invoked, just terminate. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="final" version="1.0" datamodel="c89"> + <final id="final"/> +</scxml> diff --git a/test/w3c/c89/test243.scxml b/test/w3c/c89/test243.scxml new file mode 100644 index 0000000..04b28da --- /dev/null +++ b/test/w3c/c89/test243.scxml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that datamodel values can be specified by param. +test240sub1 will return success ifits Var1 is set to 1, failure otherwise. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <param name="Var1" expr="1"/> + <content> + <scxml version="1.0" initial="sub0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="sub0"> + <transition cond="Var1==1" target="subFinal"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="success" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test244.scxml b/test/w3c/c89/test244.scxml new file mode 100644 index 0000000..51d4905 --- /dev/null +++ b/test/w3c/c89/test244.scxml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that datamodel values can be specified by namelist. +invoked child will return success ifits Var1 is set to 1, failure otherwise. +This test will fail schema validation due to multiple occurrences of Var1, +but should run correctly. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" namelist="Var1"> + <content> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="sub0"> + <transition cond="Var1==1" target="subFinal"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="success" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test245.scxml b/test/w3c/c89/test245.scxml new file mode 100644 index 0000000..6254df2 --- /dev/null +++ b/test/w3c/c89/test245.scxml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that non-existent datamodel values are not set. Var2 is not defined in +invoked child's datamodel. It will will return success if its Var2 remains unbound, failure otherwise. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var2" expr="3"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/" namelist="Var2"> + <content> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <state id="sub0"> + <transition cond="Var2" target="subFinal"> + <send target="#_parent" event="failure"/> + </transition> + <transition target="subFinal"> + <send target="#_parent" event="success"/> + </transition> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="success" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test247.scxml b/test/w3c/c89/test247.scxml new file mode 100644 index 0000000..64bf2f5 --- /dev/null +++ b/test/w3c/c89/test247.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that we get done.invoke. timeout indicates failure --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml version="1.0" initial="subFinal" datamodel="c89"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="done.invoke" target="pass"/> + <transition event="timeout" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test250.scxml b/test/w3c/c89/test250.scxml new file mode 100644 index 0000000..b8476fd --- /dev/null +++ b/test/w3c/c89/test250.scxml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the onexit handlers run in the invoked process if it is cancelled. This has to be a +manual test, since this process won't accept any events from the child process once it has been cancelled. +Tester must examine log output from child process to determine success --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="foo"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <state id="sub0" initial="sub01"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="timeout" target="subFinal"/> + <onexit> + <log expr="&Exiting sub0&"/> + </onexit> + <state id="sub01"> + <onexit> + <log expr="&Exiting sub01&"/> + </onexit> + </state> + </state> + <final id="subFinal"> + <onentry> + <log expr="&entering final state, invocation was not cancelled&"/> + </onentry> + </final> + </scxml> + </content> + </invoke> + <!-- this transition will cause the invocation to be cancelled --> + <transition event="foo" target="final"/> + </state> + <final id="final"/> +</scxml> diff --git a/test/w3c/c89/test252.scxml b/test/w3c/c89/test252.scxml new file mode 100644 index 0000000..0d06df6 --- /dev/null +++ b/test/w3c/c89/test252.scxml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that we don't process any events received from the invoked process once it is cancelled. child +process tries to send us childToParent in an onexit handler. If we get it, we fail. +timeout indicates success. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delayexpr="&1s&"/> + </onentry> + <transition event="timeout" target="pass"/> + <transition event="childToParent" target="fail"/> + <transition event="done.invoke" target="fail"/> + <state id="s01"> + <onentry> + <send event="foo"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <state id="sub0"> + <onentry> + <send event="timeout" delayexpr="&.5s&"/> + </onentry> + <transition event="timeout" target="subFinal"/> + <onexit> + <send target="#_parent" event="childToParent"/> + </onexit> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <!-- this transition will cause the invocation to be cancelled --> + <transition event="foo" target="s02"/> + </state> + <state id="s02"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test253.scxml b/test/w3c/c89/test253.scxml new file mode 100644 index 0000000..e93feb3 --- /dev/null +++ b/test/w3c/c89/test253.scxml @@ -0,0 +1,75 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the scxml event processor is used in both directions. If child process uses the +scxml event i/o processor to communicate with us, send it an event. It will send back success if +this process uses the scxml processor to send the message to it, otherwise failure. For this test we allow +'scxml' as an alternative to the full url. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1"/> + </datamodel> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="timeout" target="fail"/> + <invoke type="scxml" id="foo"> + <content> + <!-- inform parent we're running then wait for it to send us an event. If it uses the scxml event i/o + processor to do so, return success, otherwise return failure. --> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var2"/> + </datamodel> + <state id="sub0"> + <onentry> + <send target="#_parent" event="childRunning"/> + </onentry> + <transition event="parentToChild" target="sub1"> + <assign location="Var2" expr="_event.origintype"/> + </transition> + </state> + <state id="sub1"> + <transition cond="Var2=='http://www.w3.org/TR/scxml/#SCXMLEventProcessor'" target="subFinal"> + <send target="#_parent" event="success"/> + </transition> + <transition cond="Var2=='scxml'" target="subFinal"> + <send target="#_parent" event="success"/> + </transition> + <transition target="subFinal"> + <send target="#_parent" event="failure"/> + </transition> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <state id="s01"> + <transition event="childRunning" target="s02"> + <assign location="Var1" expr="_event.origintype"/> + </transition> + </state> + <state id="s02"> + <transition cond="Var1=='http://www.w3.org/TR/scxml/#SCXMLEventProcessor'" target="s03"> + <send target="#_foo" event="parentToChild"/> + </transition> + <transition cond="Var1=='scxml'" target="s03"> + <send target="#_foo" event="parentToChild"/> + </transition> + <transition target="fail"/> + </state> + <state id="s03"> + <transition event="success" target="pass"/> + <transition event="fail" target="fail"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test276.scxml b/test/w3c/c89/test276.scxml new file mode 100644 index 0000000..250807c --- /dev/null +++ b/test/w3c/c89/test276.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that values passed in from parent process override default values specified in the child, test276sub1.scxml. +The child returns event1 if var1 has value 1, event0 if it has default value 0. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <invoke type="scxml" src="file:test276sub1.scxml"> + <param name="Var1" expr="1"/> + </invoke> + <transition event="event1" target="pass"/> + <transition event="event0" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test276sub1.scxml b/test/w3c/c89/test276sub1.scxml new file mode 100644 index 0000000..f584c54 --- /dev/null +++ b/test/w3c/c89/test276sub1.scxml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- define var1 with default value 0. Parent will invoke this process setting var1 = 1. Return event1 if var1 == 1, event0 otherwise --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0"> + <transition cond="Var1==1" target="final"> + <send target="#_parent" event="event1"/> + </transition> + <transition target="final"> + <send target="#_parent" event="event0"/> + </transition> + </state> + <final id="final"/> +</scxml> diff --git a/test/w3c/c89/test277.scxml b/test/w3c/c89/test277.scxml new file mode 100644 index 0000000..1320a6d --- /dev/null +++ b/test/w3c/c89/test277.scxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that platform creates undound variable if we assign an illegal value to it. Thus + we can assign to it later in state s1. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="return"/> + </datamodel> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="error.execution" cond="typeof Var1 === 'undefined' " target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <assign location="Var1" expr="1"/> + </onentry> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test278.scxml b/test/w3c/c89/test278.scxml new file mode 100644 index 0000000..d0e9719 --- /dev/null +++ b/test/w3c/c89/test278.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <!-- test that a variable can be accessed from a state that is outside its lexical scope --> + <state id="s0"> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <state id="s1"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test279.scxml b/test/w3c/c89/test279.scxml new file mode 100644 index 0000000..0caa560 --- /dev/null +++ b/test/w3c/c89/test279.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- testing that in case of early binding variables are assigned values at init time, before + the state containing them is visited --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <state id="s1"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test280.scxml b/test/w3c/c89/test280.scxml new file mode 100644 index 0000000..1981a77 --- /dev/null +++ b/test/w3c/c89/test280.scxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test late binding. var2 won't get bound until s1 is entered, so it shouldn't have a value in s0 and +accessing it should cause an error. It should get bound before the onentry code in s1 so it should be +possible access it there and assign its value to var1 --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89" binding="late"> + <datamodel> + <data id="Var1"/> + </datamodel> + <state id="s0"> + <transition cond="typeof Var2 === 'undefined' " target="s1"/> + <transition target="fail"/> + </state> + <state id="s1"> + <datamodel> + <data id="Var2" expr="1"/> + </datamodel> + <onentry> + <assign location="Var1" expr="Var2"/> + </onentry> + <transition cond="Var1===Var2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test286.scxml b/test/w3c/c89/test286.scxml new file mode 100644 index 0000000..e00bf70 --- /dev/null +++ b/test/w3c/c89/test286.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that assigment to a non-declared var causes an error. the transition on foo catches the case +where no error is raised --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <state id="s0"> + <onentry> + <assign location="foo.bar.baz " expr="1"/> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test287.scxml b/test/w3c/c89/test287.scxml new file mode 100644 index 0000000..5729459 --- /dev/null +++ b/test/w3c/c89/test287.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- a simple test that a legal value may be assigned to a valid data model location --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="c89" version="1.0" initial="s0"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="1"/> + </onentry> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test288.scxml b/test/w3c/c89/test288.scxml new file mode 100644 index 0000000..44dca65 --- /dev/null +++ b/test/w3c/c89/test288.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- a simple test that a legal value may be assigned to a valid data model location +using child content --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="c89" version="1.0" initial="s0"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1">123</assign> + </onentry> + <transition cond="Var1 == 123" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test294.scxml b/test/w3c/c89/test294.scxml new file mode 100644 index 0000000..1e626a1 --- /dev/null +++ b/test/w3c/c89/test294.scxml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a param inside donedata ends up in the data field of the done event and +that content inside donedata sets the full value of the event.data field --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0" initial="s01"> + <transition event="done.state.s0" cond="_event.data['Var1']==1" target="s1"> + </transition> + <transition event="done.state.s0" target="fail"> + </transition> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <param name="Var1" expr="1"/> + </donedata> + </final> + </state> + <state id="s1" initial="s11"> + <transition event="done.state.s1" cond="_event.data == 'foo'" target="pass"> + </transition> + <transition event="done.state.s1" target="fail"> + </transition> + <state id="s11"> + <transition target="s12"/> + </state> + <final id="s12"> + <donedata> + <content>foo</content> + </donedata> + </final> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test298.scxml b/test/w3c/c89/test298.scxml new file mode 100644 index 0000000..81022c6 --- /dev/null +++ b/test/w3c/c89/test298.scxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- reference a non-existent data model location in param in donedata and see that the right error is raised --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <param name="Var3" location="foo.bar.baz "/> + </donedata> + </final> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test301.scxml b/test/w3c/c89/test301.scxml new file mode 100644 index 0000000..652ebf2 --- /dev/null +++ b/test/w3c/c89/test301.scxml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- the processor should reject this document because it can't download the script. +Therefore we fail if it runs at all. This test is valid only for datamodels that support scripting --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0"> + <script src="D:\foo"/> + <state id="s0"> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test302.scxml b/test/w3c/c89/test302.scxml new file mode 100644 index 0000000..69e823c --- /dev/null +++ b/test/w3c/c89/test302.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a script is evaluated at load time. <conf:script> shoudl assign the value 1 to +Var1. Hence, if script is evaluated at download time, Var1 has a value in the initial state s0. +This test is valid only for datamodels that support scripting --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <script>var Var1 = 1</script> + <state id="s0"> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test303.scxml b/test/w3c/c89/test303.scxml new file mode 100644 index 0000000..6775620 --- /dev/null +++ b/test/w3c/c89/test303.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- to test that scripts are run as part of executable content, we check that it changes the value of a var at the +right point. This test is valid only for datamodels that support scripting --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="2"/> + <script>var Var1 = 1</script> + </onentry> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test304.scxml b/test/w3c/c89/test304.scxml new file mode 100644 index 0000000..4c7e18c --- /dev/null +++ b/test/w3c/c89/test304.scxml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a variable declared by a script can be accessed like any other part of the data model --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="c89" version="1.0" initial="s0"> + <script>var Var1 = 1</script> + <state id="s0"> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test307.scxml b/test/w3c/c89/test307.scxml new file mode 100644 index 0000000..ba89038 --- /dev/null +++ b/test/w3c/c89/test307.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="c89" version="1.0" initial="s0" binding="late"> + <!-- with binding=late, in s0 we access a variable that isn't created until we get to s1. Then in s1 +we access a non-existent substructure of a variable. We use log tags to report the values that both operations +yield, and whether there are errors. This is a manual test, since the tester must report whether the output +is the same in the two cases --> + <state id="s0"> + <onentry> + <log label="entering s0 value of Var 1 is: " expr="Var1"/> + <raise event="foo"/> + </onentry> + <transition event="error" target="s1"> + <log label="error in state s0" expr="_event"/> + </transition> + <transition event="foo" target="s1"> + <log label="no error in s0" expr=""/> + </transition> + </state> + <state id="s1"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + <onentry> + <log label="entering s1, value of non-existent substructure of Var 1 is: " expr="Var1.bar"/> + <raise event="bar"/> + </onentry> + <transition event="error" target="final"> + <log label="error in state s1" expr="_event"/> + </transition> + <transition event="bar" target="final"> + <log label="No error in s1" expr=""/> + </transition> + </state> + <final id="final"/> +</scxml> diff --git a/test/w3c/c89/test309.scxml b/test/w3c/c89/test309.scxml new file mode 100644 index 0000000..eecbcce --- /dev/null +++ b/test/w3c/c89/test309.scxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an expression that cannot be interpreted as a boolean is treated as false --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <state id="s0"> + <transition cond="return" target="fail"/> + <transition target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test310.scxml b/test/w3c/c89/test310.scxml new file mode 100644 index 0000000..1a90b15 --- /dev/null +++ b/test/w3c/c89/test310.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- simple test of the in() predicate --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="p"> + <parallel id="p"> + <state id="s0"> + <transition cond="In('s1')" target="pass"/> + <transition target="fail"/> + </state> + <state id="s1"/> + </parallel> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test311.scxml b/test/w3c/c89/test311.scxml new file mode 100644 index 0000000..ed3577f --- /dev/null +++ b/test/w3c/c89/test311.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that assignment to a non-existent location yields an error --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="1s"/> + <assign location="foo.bar.baz " expr="1"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event=".*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test312.scxml b/test/w3c/c89/test312.scxml new file mode 100644 index 0000000..35437a3 --- /dev/null +++ b/test/w3c/c89/test312.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that assignment with an illegal expr raises an error --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="return"/> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event=".*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test313.scxml b/test/w3c/c89/test313.scxml new file mode 100644 index 0000000..a52ccf9 --- /dev/null +++ b/test/w3c/c89/test313.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- this is a manual test. The processor is allowed to reject this doc, but if it executes it with its illegal +expression, it must raise an error --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="return"/> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event=".*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test314.scxml b/test/w3c/c89/test314.scxml new file mode 100644 index 0000000..3bfbf8f --- /dev/null +++ b/test/w3c/c89/test314.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- this is a manual test because the processor is allowed to reject this document. But if it executes it, +it should not raise an error until it gets to s03 and evaluates the illegal expr --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + <state id="s0" initial="s01"> + <transition event="error.execution" target="fail"/> + <state id="s01"> + <transition target="s02"/> + </state> + <state id="s02"> + <transition target="s03"/> + </state> + <state id="s03"> + <onentry> + <assign location="Var1" expr="return"/> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event=".*" target="fail"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test318.scxml b/test/w3c/c89/test318.scxml new file mode 100644 index 0000000..59784db --- /dev/null +++ b/test/w3c/c89/test318.scxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _event stays bound during the onexit and entry into the next state --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89" name="machineName"> + <datamodel> + <data id="Var1"/> + </datamodel> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="foo" target="s1"/> + </state> + <state id="s1"> + <onentry> + <raise event="bar"/> + <!-- _event should still be bound to 'foo' at this point --> + <assign location="Var1" expr="_event.name"/> + </onentry> + <transition cond="Var1=='foo'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test319.scxml b/test/w3c/c89/test319.scxml new file mode 100644 index 0000000..3e0762c --- /dev/null +++ b/test/w3c/c89/test319.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _event is not bound before any event has been raised --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0" name="machineName"> + <state id="s0"> + <onentry> + <if cond="_event"> + <raise event="bound"/> + <else/> + <raise event="unbound"/> + </if> + </onentry> + <transition event="unbound" target="pass"/> + <transition event="bound" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test321.scxml b/test/w3c/c89/test321.scxml new file mode 100644 index 0000000..72a349f --- /dev/null +++ b/test/w3c/c89/test321.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _sessionid is bound on startup --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0" name="machineName"> + <datamodel> + <data id="Var1" expr="_sessionid"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="pass"/> + <transition cond="true" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test322.scxml b/test/w3c/c89/test322.scxml new file mode 100644 index 0000000..6906a3e --- /dev/null +++ b/test/w3c/c89/test322.scxml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _sessionid remains bound to the same value throught the session. this means that it can't +be assigned to --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0" name="machineName"> + <datamodel> + <data id="Var1" expr="_sessionid"/> + <data id="Var2"/> + </datamodel> + <state id="s0"> + <transition target="s1"/> + </state> + <state id="s1"> + <onentry> + <assign location="_sessionid" expr="&otherName&"/> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="s2"/> + <transition event="*" target="fail"/> + </state> + <state id="s2"> + <transition cond="Var1==_sessionid" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test323.scxml b/test/w3c/c89/test323.scxml new file mode 100644 index 0000000..3b5bf21 --- /dev/null +++ b/test/w3c/c89/test323.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _name is bound on startup --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89" name="machineName"> + <datamodel> + <data id="Var1" expr="_name"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="pass"/> + <transition cond="true" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test324.scxml b/test/w3c/c89/test324.scxml new file mode 100644 index 0000000..fc2d13f --- /dev/null +++ b/test/w3c/c89/test324.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _name stays bound till the session ends. This means that it cannot be assigned to --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89" name="machineName"> + <state id="s0"> + <transition cond="_name === 'machineName'" target="s1"/> + <transition target="fail"/> + </state> + <state id="s1"> + <onentry> + <assign location="_name" expr="'otherName'"/> + </onentry> + <transition cond="_name === 'machineName'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test325.scxml b/test/w3c/c89/test325.scxml new file mode 100644 index 0000000..310303c --- /dev/null +++ b/test/w3c/c89/test325.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _ioprocessors is bound at startup. I'm not sure how to test for a set value or +how to test that the entries in it do represent I/O processors, since the set that each implementation +supports may be different. Suggestions welcome --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0" name="machineName"> + <datamodel> + <data id="Var1" expr="_ioprocessors"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test326.scxml b/test/w3c/c89/test326.scxml new file mode 100644 index 0000000..8904747 --- /dev/null +++ b/test/w3c/c89/test326.scxml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that _ioprocessors stays bound till the session ends. This means that it cannot be assigned to --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0" name="machineName"> + <datamodel> + <data id="Var1" expr="_ioprocessors"/> + <data id="Var2"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="s1"/> + <transition cond="true" target="fail"/> + </state> + <state id="s1"> + <onentry> + <assign location="_ioprocessors" expr="&otherName&"/> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="s2"/> + <transition event="*" target="fail"/> + </state> + <state id="s2"> + <onentry> + <assign location="Var2" expr="_ioprocessors"/> + </onentry> + <transition cond="Var1==Var2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test329.scxml b/test/w3c/c89/test329.scxml new file mode 100644 index 0000000..cb9b5c5 --- /dev/null +++ b/test/w3c/c89/test329.scxml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that none of the system variables can be modified --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89" name="machineName"> + <datamodel> + <data id="Var1"/> + <data id="Var2"/> + <data id="Var3"/> + <data id="Var4"/> + </datamodel> + <state id="s0"> + <onentry> + <!-- get _event bound so we can use it in s1--> + <raise event="foo"/> + <assign location="Var1" expr="_sessionid"/> + <assign location="_sessionid" expr="27"/> + </onentry> + <transition event="foo" cond="Var1==_sessionid" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <assign location="Var2" expr="_event"/> + <assign location="_event" expr="27"/> + </onentry> + <transition cond="Var2==_event" target="s2"/> + <transition target="fail"/> + </state> + <state id="s2"> + <onentry> + <assign location="Var3" expr="_name"/> + <assign location="_name" expr="27"/> + </onentry> + <transition cond="Var3==_name" target="s3"/> + <transition target="fail"/> + </state> + <state id="s3"> + <onentry> + <assign location="Var4" expr="_ioprocessors"/> + <assign location="_ioprocessors" expr="27"/> + </onentry> + <transition cond="Var4==_ioprocessors" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test330.scxml b/test/w3c/c89/test330.scxml new file mode 100644 index 0000000..9f234dd --- /dev/null +++ b/test/w3c/c89/test330.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- check that the required fields are present in both internal and external events --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" datamodel="c89" name="machineName"> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="foo" cond="'name' in _event && 'type' in _event && 'sendid' in _event && 'origin' in _event && 'origintype' in _event && 'invokeid' in _event && 'data' in _event" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <send event="foo"/> + </onentry> + <transition event="foo" cond="'name' in _event && 'type' in _event && 'sendid' in _event && 'origin' in _event && 'origintype' in _event && 'invokeid' in _event && 'data' in _event" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test331.scxml b/test/w3c/c89/test331.scxml new file mode 100644 index 0000000..0cb63bd --- /dev/null +++ b/test/w3c/c89/test331.scxml @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0" name="machineName"> + <!-- test that _event.type is set correctly for internal, platform, and external events --> + <datamodel> + <data id="Var1"/> + </datamodel> + <state id="s0"> + <onentry> + <!-- internal event --> + <raise event="foo"/> + </onentry> + <transition event="foo" target="s1"> + <assign location="Var1" expr="_event.type"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var1=='internal'" target="s2"/> + <transition target="fail"/> + </state> + <state id="s2"> + <onentry> + <!-- this will generate an error, which is a platform event --> + <assign location="foo.bar.baz " expr="1"/> + </onentry> + <transition event="error" target="s3"> + <assign location="Var1" expr="_event.type"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s3"> + <transition cond="Var1=='platform'" target="s4"/> + <transition target="fail"/> + </state> + <state id="s4"> + <onentry> + <!-- external event --> + <send event="foo"/> + </onentry> + <transition event="foo" target="s5"> + <assign location="Var1" expr="_event.type"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s5"> + <transition cond="Var1=='external'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test332.scxml b/test/w3c/c89/test332.scxml new file mode 100644 index 0000000..8a77e62 --- /dev/null +++ b/test/w3c/c89/test332.scxml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that sendid is present in error events triggered by send errors --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" datamodel="c89" name="machineName"> + <datamodel> + <data id="Var1"/> + <data id="Var2"/> + </datamodel> + <state id="s0"> + <onentry> + <!-- this will raise an error and also store the sendid in var1 --> + <send target="baz" event="foo" idlocation="Var1"/> + </onentry> + <transition event="error" target="s1"> + <!-- get the sendid out of the error event --> + <assign location="Var2" expr="_event.sendid"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <!-- make sure that the sendid in the error event matches the one generated when send executed --> + <transition cond="Var1===Var2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test333.scxml b/test/w3c/c89/test333.scxml new file mode 100644 index 0000000..a0a2a73 --- /dev/null +++ b/test/w3c/c89/test333.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- make sure sendid is blank in a non-error event --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" datamodel="c89" name="machineName"> + <state id="s0"> + <onentry> + <send event="foo"/> + </onentry> + <transition event="foo" cond="typeof _event.sendid === 'undefined' " target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test335.scxml b/test/w3c/c89/test335.scxml new file mode 100644 index 0000000..debc3b8 --- /dev/null +++ b/test/w3c/c89/test335.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that origin field is blank for internal events --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" datamodel="c89" name="machineName"> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="foo" cond="typeof _event.origin === 'undefined' " target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test336.scxml b/test/w3c/c89/test336.scxml new file mode 100644 index 0000000..dc53488 --- /dev/null +++ b/test/w3c/c89/test336.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the origin field of an external event contains a URL that lets you send back to the originator. In +this case it's the same session, so if we get bar we succeed --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0" name="machineName"> + <state id="s0"> + <onentry> + <send event="foo"/> + </onentry> + <transition event="foo" target="s1"> + <send event="bar" targetexpr="_event.origin" typeexpr="_event.origintype"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <send event="baz"/> + </onentry> + <transition event="bar" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test337.scxml b/test/w3c/c89/test337.scxml new file mode 100644 index 0000000..8a93c47 --- /dev/null +++ b/test/w3c/c89/test337.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that origintype is blank on internal events --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0" name="machineName"> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="foo" cond="typeof _event.origintype === 'undefined' " target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test338.scxml b/test/w3c/c89/test338.scxml new file mode 100644 index 0000000..a6338b4 --- /dev/null +++ b/test/w3c/c89/test338.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that invokeid is set correctly in events received from an invoked process. timeout event catches the +case where the invoke doesn't work correctly --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1"/> + <data id="Var2"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <invoke idlocation="Var1" type="http://www.w3.org/TR/scxml/"> + <content> + <scxml initial="sub0" version="1.0" datamodel="c89" name="machineName"> + <final id="sub0"> + <onentry> + <send target="#_parent" event="event1"/> + </onentry> + </final> + </scxml> + </content> + </invoke> + <transition event="event1" target="s1"> + <assign location="Var2" expr="_event.invokeid"/> + </transition> + <transition event="event0" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var1===Var2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test339.scxml b/test/w3c/c89/test339.scxml new file mode 100644 index 0000000..c06ec81 --- /dev/null +++ b/test/w3c/c89/test339.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that invokeid is blank in an event that wasn't returned from an invoked process --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89" name="machineName"> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="foo" cond="typeof _event.invokeid === 'undefined' " target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test342.scxml b/test/w3c/c89/test342.scxml new file mode 100644 index 0000000..5dd9586 --- /dev/null +++ b/test/w3c/c89/test342.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that eventexpr works and sets the name field of the resulting event --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89" name="machineName"> + <datamodel> + <data id="Var1" expr="&foo&"/> + <data id="Var2"/> + </datamodel> + <state id="s0"> + <onentry> + <send eventexpr="Var1"/> + </onentry> + <transition event="foo" target="s1"> + <assign location="Var2" expr="_event.name"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var1===Var2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test343.scxml b/test/w3c/c89/test343.scxml new file mode 100644 index 0000000..3831eff --- /dev/null +++ b/test/w3c/c89/test343.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that illegal <param> produces error.execution and empty event.data --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <state id="s0" initial="s01"> + <!-- we should get the error before the done event --> + <transition event="error.execution" target="s1"/> + <transition event="done.state.s0" target="fail"/> + <transition event="done.state.s0" target="fail"> + </transition> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <param location="foo.bar.baz " name="someParam"/> + </donedata> + </final> + </state> + <!-- if we get here, we received the error event. Now check that the done + event has empty event.data --> + <state id="s1"> + <transition event="done.state.s0" cond="typeof _event.data === 'undefined'" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test344.scxml b/test/w3c/c89/test344.scxml new file mode 100644 index 0000000..472d495 --- /dev/null +++ b/test/w3c/c89/test344.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a cond expression that cannot be evaluated as a +boolean cond expression evaluates to false and causes error.execution to be raised. +In some languages, any valid expression/object can be converted to a boolean, so conf:nonBoolean will +have to be mapped onto something that produces a syntax error or something similarly invalid --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <state id="s0"> + <transition cond="return" target="fail"/> + <transition target="s1"/> + </state> + <state id="s1"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test346.scxml b/test/w3c/c89/test346.scxml new file mode 100644 index 0000000..e85cc26 --- /dev/null +++ b/test/w3c/c89/test346.scxml @@ -0,0 +1,54 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that any attempt to change the value of a system variable causes error.execution to be raised. +Event1..4 are there to catch the case where the error event is not raised. In cases where it is, we have +to dispose of eventn in the next state, hence the targetless transitions (which simply throw away the event.) --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89" name="machineName"> + <state id="s0"> + <onentry> + <assign location="_sessionid" expr="&otherName&"/> + <raise event="event1"/> + </onentry> + <transition event="error.execution" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <assign location="_event" expr="&otherName&"/> + <raise event="event2"/> + </onentry> + <!-- throw out event1 if it's still around --> + <transition event="event1"/> + <transition event="error.execution" target="s2"/> + <!-- event1 would trigger this transition if we didn't drop it. We want this transition to have + a very general trigger to catch cases where the wrong error event was raised --> + <transition event="*" target="fail"/> + </state> + <state id="s2"> + <onentry> + <assign location="_ioprocessors" expr="&otherName&"/> + <raise event="event3"/> + </onentry> + <transition event="event2"/> + <transition event="error.execution" target="s3"/> + <transition event="*" target="fail"/> + </state> + <state id="s3"> + <onentry> + <assign location="_name" expr="&otherName&"/> + <raise event="event4"/> + </onentry> + <transition event="event3"/> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test347.scxml b/test/w3c/c89/test347.scxml new file mode 100644 index 0000000..b324da7 --- /dev/null +++ b/test/w3c/c89/test347.scxml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the scxml event I/O processor works by sending events back and forth between an invoked child +and its parent process --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0" initial="s01"> + <invoke id="child" type="scxml"> + <content> + <scxml initial="sub0" version="1.0" datamodel="c89" name="machineName"> + <state id="sub0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" target="#_parent" event="childToParent"/> + </onentry> + <transition event="parentToChild" target="subFinal"/> + </state> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <onentry> + <send delay="20s" event="timeout"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s01"> + <transition event="childToParent" target="s02"/> + </state> + <state id="s02"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" target="#_child" event="parentToChild"/> + </onentry> + <transition event="done.invoke" target="pass"/> + <transition event="error" target="fail"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test348.scxml b/test/w3c/c89/test348.scxml new file mode 100644 index 0000000..ec56680 --- /dev/null +++ b/test/w3c/c89/test348.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <!-- test that event param of send sets the name of the event --> + <state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="s0Event"/> + </onentry> + <transition event="s0Event" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test349.scxml b/test/w3c/c89/test349.scxml new file mode 100644 index 0000000..aea64d6 --- /dev/null +++ b/test/w3c/c89/test349.scxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that value in origin field can be used to send an event back to the sender --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1"/> + </datamodel> + <state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="s0Event"/> + </onentry> + <transition event="s0Event" target="s2"> + <assign location="Var1" expr="_event.origin"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s2"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" targetexpr="Var1" event="s0Event2"/> + </onentry> + <transition event="s0Event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test350.scxml b/test/w3c/c89/test350.scxml new file mode 100644 index 0000000..0688005 --- /dev/null +++ b/test/w3c/c89/test350.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that target value is used to decide what session to deliver the event to. A session should be +able to send an event to itself using its own session ID as the target --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1" expr="&#_scxml_&"/> + <data id="Var2" expr="_sessionid"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="Var1 + Var2"/> + <send delay="5s" event="timeout"/> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" targetexpr="Var1" event="s0Event"/> + </onentry> + <transition event="s0Event" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test351.scxml b/test/w3c/c89/test351.scxml new file mode 100644 index 0000000..ea56e67 --- /dev/null +++ b/test/w3c/c89/test351.scxml @@ -0,0 +1,47 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that sendid is set in event if present in send, blank otherwise --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1"/> + <data id="Var2"/> + </datamodel> + <state id="s0"> + <onentry> + <send delay="5s" event="timeout"/> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" id="send1" event="s0Event"/> + </onentry> + <transition event="s0Event" target="s1"> + <assign location="Var1" expr="_event.sendid"/> + </transition> + <transition event="*" target="fail"> + </transition> + </state> + <state id="s1"> + <transition cond="Var1=='send1'" target="s2"/> + <transition target="fail"/> + </state> + <state id="s2"> + <onentry> + <send delay="5s" event="timeout"/> + <send event="s0Event2"/> + </onentry> + <transition event="s0Event2" target="s3"> + <assign location="Var2" expr="_event.sendid"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s3"> + <transition cond="!Var2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test352.scxml b/test/w3c/c89/test352.scxml new file mode 100644 index 0000000..e37ccec --- /dev/null +++ b/test/w3c/c89/test352.scxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test the origintype is 'http://www.w3.org/TR/scxml/#SCXMLEventProcessor' --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1"/> + </datamodel> + <state id="s0"> + <onentry> + <send delay="5s" event="timeout"/> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="s0Event"/> + </onentry> + <transition event="s0Event" target="s1"> + <assign location="Var1" expr="_event.origintype"/> + </transition> + <transition event="*" target="fail"> + </transition> + </state> + <state id="s1"> + <transition cond="Var1=='http://www.w3.org/TR/scxml/#SCXMLEventProcessor'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test354.scxml b/test/w3c/c89/test354.scxml new file mode 100644 index 0000000..47bd8ee --- /dev/null +++ b/test/w3c/c89/test354.scxml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that event.data can be populated using both namelist, param and <content> +and that correct values are used --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="1"/> + <data id="Var2"/> + <data id="Var3"/> + </datamodel> + <state id="s0"> + <onentry> + <send delay="5s" event="timeout"/> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" namelist="Var1"> + <param name="param1" expr="2"/> + </send> + </onentry> + <transition event="event1" target="s1"> + <assign location="Var2" expr="_event.data.Var1"/> + <assign location="Var3" expr="_event.data.param1"/> + </transition> + <transition event="*" target="fail"> + </transition> + </state> + <state id="s1"> + <transition cond="Var2==1" target="s2"/> + <transition target="fail"/> + </state> + <state id="s2"> + <transition cond="Var3==2" target="s3"/> + <transition target="fail"/> + </state> + <state id="s3"> + <onentry> + <send delay="5s" event="timeout"/> + <send event="event2"> + <content>123</content> + </send> + </onentry> + <transition event="event2" cond="_event.data == 123" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test355.scxml b/test/w3c/c89/test355.scxml new file mode 100644 index 0000000..d76c7a5 --- /dev/null +++ b/test/w3c/c89/test355.scxml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that default initial state is first in document order. If we enter s0 first we succeed, if s1, failure. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="c89" version="1.0"> + <state id="s0"> + <transition target="pass"/> + </state> + <state id="s1"> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test364.scxml b/test/w3c/c89/test364.scxml new file mode 100644 index 0000000..318853e --- /dev/null +++ b/test/w3c/c89/test364.scxml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that default initial states are entered when a compound state is entered. First we test +the 'initial' attribute, then the initial element, then default to the first child in document order. +If we get to s01111 we succeed, if any other state, failure. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="c89" initial="s1" version="1.0"> + <state id="s1" initial="s11p112 s11p122"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s11" initial="s111"> + <state id="s111"/> + <parallel id="s11p1"> + <state id="s11p11" initial="s11p111"> + <state id="s11p111"/> + <state id="s11p112"> + <onentry> + <raise event="In-s11p112"/> + </onentry> + </state> + </state> + <state id="s11p12" initial="s11p121"> + <state id="s11p121"/> + <state id="s11p122"> + <transition event="In-s11p112" target="s2"/> + </state> + </state> + </parallel> + </state> + </state> + <state id="s2"> + <initial> + <transition target="s21p112 s21p122"/> + </initial> + <transition event="timeout" target="fail"/> + <state id="s21" initial="s211"> + <state id="s211"/> + <parallel id="s21p1"> + <state id="s21p11" initial="s21p111"> + <state id="s21p111"/> + <state id="s21p112"> + <onentry> + <raise event="In-s21p112"/> + </onentry> + </state> + </state> + <state id="s21p12" initial="s21p121"> + <state id="s21p121"/> + <state id="s21p122"> + <transition event="In-s21p112" target="s3"/> + </state> + </state> + </parallel> + </state> + </state> + <state id="s3"> + <transition target="fail"/> + <state id="s31"> + <state id="s311"> + <state id="s3111"> + <transition target="pass"/> + </state> + <state id="s3112"/> + <state id="s312"/> + <state id="s32"/> + </state> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test372.scxml b/test/w3c/c89/test372.scxml new file mode 100644 index 0000000..044f727 --- /dev/null +++ b/test/w3c/c89/test372.scxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that entering a final state generates done.state.parentid after executing the onentry elements. +Var1 should be set to 2 (but not 3) by the time the event is raised --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + <state id="s0" initial="s0final"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="done.state.s0" cond="Var1==2" target="pass"/> + <transition event="*" target="fail"/> + <final id="s0final"> + <onentry> + <assign location="Var1" expr="2"/> + </onentry> + <onexit> + <assign location="Var1" expr="3"/> + </onexit> + </final> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test375.scxml b/test/w3c/c89/test375.scxml new file mode 100644 index 0000000..38b7870 --- /dev/null +++ b/test/w3c/c89/test375.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that onentry handlers are executed in document order. event1 should be raised before event2 --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <raise event="event1"/> + </onentry> + <onentry> + <raise event="event2"/> + </onentry> + <transition event="event1" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test376.scxml b/test/w3c/c89/test376.scxml new file mode 100644 index 0000000..09fd484 --- /dev/null +++ b/test/w3c/c89/test376.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that each onentry handler is a separate block. The <send> of event1 will cause an error but + the increment to var1 should happen anyways --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + <state id="s0"> + <onentry> + <send target="baz" event="event1"/> + </onentry> + <onentry> + <assign location="Var1" expr="Var1 + 1"/> + </onentry> + <transition cond="Var1==2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test377.scxml b/test/w3c/c89/test377.scxml new file mode 100644 index 0000000..69fe236 --- /dev/null +++ b/test/w3c/c89/test377.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that onexit handlers are executed in document order. event1 should be raised before event2 --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="c89" version="1.0"> + <state id="s0"> + <onexit> + <raise event="event1"/> + </onexit> + <onexit> + <raise event="event2"/> + </onexit> + <transition target="s1"/> + </state> + <state id="s1"> + <transition event="event1" target="s2"/> + <transition event="*" target="fail"/> + </state> + <state id="s2"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test378.scxml b/test/w3c/c89/test378.scxml new file mode 100644 index 0000000..e191d68 --- /dev/null +++ b/test/w3c/c89/test378.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that each onexithandler is a separate block. The <send> of event1 will cause an error but + the increment to var1 should happen anyways --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + <state id="s0"> + <onexit> + <send target="baz" event="event1"/> + </onexit> + <onexit> + <assign location="Var1" expr="Var1 + 1"/> + </onexit> + <transition target="s1"/> + </state> + <state id="s1"> + <transition cond="Var1==2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test387.scxml b/test/w3c/c89/test387.scxml new file mode 100644 index 0000000..a09a7f6 --- /dev/null +++ b/test/w3c/c89/test387.scxml @@ -0,0 +1,93 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the default history state works correctly. From initial state s3 we take a transition to s0's default +shallow history state. That should generate "enteringS011", which takes us to s4. In s4, we +transition to s1's default deep history state. We should end up in s122, generating "enteringS122". Otherwise failure.--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s3" version="1.0" datamodel="c89"> + <state id="s0" initial="s01"> + <transition event="enteringS011" target="s4"/> + <transition event="*" target="fail"/> + <history type="shallow" id="s0HistShallow"> + <transition target="s01"/> + </history> + <history type="deep" id="s0HistDeep"> + <transition target="s022"/> + </history> + <state id="s01" initial="s011"> + <state id="s011"> + <onentry> + <raise event="enteringS011"/> + </onentry> + </state> + <state id="s012"> + <onentry> + <raise event="enteringS012"/> + </onentry> + </state> + </state> + <state id="s02" initial="s021"> + <state id="s021"> + <onentry> + <raise event="enteringS021"/> + </onentry> + </state> + <state id="s022"> + <onentry> + <raise event="enteringS022"/> + </onentry> + </state> + </state> + </state> + <state id="s1" initial="s11"> + <transition event="enteringS122" target="pass"/> + <transition event="*" target="fail"/> + <history type="shallow" id="s1HistShallow"> + <transition target="s11"/> + </history> + <history type="deep" id="s1HistDeep"> + <transition target="s122"/> + </history> + <state id="s11" initial="s111"> + <state id="s111"> + <onentry> + <raise event="enteringS111"/> + </onentry> + </state> + <state id="s112"> + <onentry> + <raise event="enteringS112"/> + </onentry> + </state> + </state> + <state id="s12" initial="s121"> + <state id="s121"> + <onentry> + <raise event="enteringS121"/> + </onentry> + </state> + <state id="s122"> + <onentry> + <raise event="enteringS122"/> + </onentry> + </state> + </state> + </state> + <state id="s3"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition target="s0HistShallow"/> + </state> + <state id="s4"> + <transition target="s1HistDeep"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test388.scxml b/test/w3c/c89/test388.scxml new file mode 100644 index 0000000..c63c957 --- /dev/null +++ b/test/w3c/c89/test388.scxml @@ -0,0 +1,74 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that history states works correctly. The counter Var1 counts how many times +we have entered s0. The initial state is s012. We then transition to s1, which transitions +to s0's deep history state. entering.s012 should be raised, otherwise failure. Then we transition +to s02, which transitions to s0's shallow history state. That should have value s01, and its initial +state is s011, so we should get entering.s011, otherwise failure.--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s012" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0" initial="s01"> + <onentry> + <assign location="Var1" expr="Var1 + 1"/> + </onentry> + <!-- the first time through, go to s1, setting a timer just in case something hangs --> + <transition event="entering.s012" cond="Var1==1" target="s1"> + <send event="timeout" delay="2s"/> + </transition> + <!-- the second time, we should get entering.s012. If so, go to s2, otherwise fail --> + <transition event="entering.s012" cond="Var1==2" target="s2"/> + <transition event="entering" cond="Var1==2" target="fail"/> + <!-- the third time we should get entering-s011. If so, pass, otherwise fail --> + <transition event="entering.s011" cond="Var1==3" target="pass"/> + <transition event="entering" cond="Var1==3" target="fail"/> + <!-- if we timeout, the state machine is hung somewhere, so fail --> + <transition event="timeout" target="fail"/> + <history type="shallow" id="s0HistShallow"> + <transition target="s02"/> + </history> + <history type="deep" id="s0HistDeep"> + <transition target="s022"/> + </history> + <state id="s01" initial="s011"> + <state id="s011"> + <onentry> + <raise event="entering.s011"/> + </onentry> + </state> + <state id="s012"> + <onentry> + <raise event="entering.s012"/> + </onentry> + </state> + </state> + <state id="s02" initial="s021"> + <state id="s021"> + <onentry> + <raise event="entering.s021"/> + </onentry> + </state> + <state id="s022"> + <onentry> + <raise event="entering.s022"/> + </onentry> + </state> + </state> + </state> + <state id="s1"> + <transition target="s0HistDeep"/> + </state> + <state id="s2"> + <transition target="s0HistShallow"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test396.scxml b/test/w3c/c89/test396.scxml new file mode 100644 index 0000000..aa07ba6 --- /dev/null +++ b/test/w3c/c89/test396.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the value in _event.name matches the event name used to match against transitions --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <raise event="foo"/> + </onentry> + <transition event="foo" cond="_event.name == &foo&" target="pass"/> + <transition event="foo" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test399.scxml b/test/w3c/c89/test399.scxml new file mode 100644 index 0000000..25a3b5e --- /dev/null +++ b/test/w3c/c89/test399.scxml @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the event name matching works correctly, including prefix matching and the fact +that the event attribute of transition may contain multiple event designators. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="2s"/> + </onentry> + <!-- this will catch the failure case --> + <transition event="timeout" target="fail"/> + <state id="s01"> + <onentry> + <raise event="foo"/> + </onentry> + <!-- test that an event can match against a transition with multiple descriptors --> + <transition event="foo bar" target="s02"/> + </state> + <state id="s02"> + <onentry> + <raise event="bar"/> + </onentry> + <!-- test that an event can match the second descriptor as well --> + <transition event="foo bar" target="s03"/> + </state> + <state id="s03"> + <onentry> + <raise event="foo.zoo"/> + </onentry> + <!-- test that a prefix descriptor matches --> + <transition event="foo bar" target="s04"/> + </state> + <state id="s04"> + <onentry> + <raise event="foos"/> + </onentry> + <!-- test that only token prefixes match --> + <transition event="foo" target="fail"/> + <transition event="foos" target="s05"/> + </state> + <state id="s05"> + <onentry> + <raise event="foo.zoo"/> + </onentry> + <!-- test that .* works at the end of a descriptor --> + <transition event="foo.*" target="s06"/> + </state> + <state id="s06"> + <onentry> + <raise event="foo"/> + </onentry> + <!-- test that "*" works by itself --> + <transition event="*" target="pass"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test401.scxml b/test/w3c/c89/test401.scxml new file mode 100644 index 0000000..45cc68b --- /dev/null +++ b/test/w3c/c89/test401.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that errors go in the internal event queue. We send ourselves an external event foo, then perform +and operation that raises an error. Then check that the error event is processed first, even though +it was raised second --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="foo"/> + <!-- assigning to a non-existent location should raise an error --> + <assign location="foo.bar.baz " expr="2"/> + </onentry> + <transition event="foo" target="fail"/> + <transition event="error" target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test402.scxml b/test/w3c/c89/test402.scxml new file mode 100644 index 0000000..6e28129 --- /dev/null +++ b/test/w3c/c89/test402.scxml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- the assertion that errors are 'like any other event' is pretty broad, but we can check that they +are pulled off the internal queue in order, and that prefix matching works on them. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01"> + <onentry> + <!-- catch the failure case --> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s01"> + <onentry> + <!-- the first internal event. The error will be the second, and event2 will be the third --> + <raise event="event1"/> + <!-- assigning to a non-existent location should raise an error --> + <assign location="foo.bar.baz " expr="2"/> + </onentry> + <transition event="event1" target="s02"> + <raise event="event2"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s02"> + <transition event="error" target="s03"/> + <transition event="*" target="fail"/> + </state> + <state id="s03"> + <transition event="event2" target="pass"/> + <transition event="*" target="fail"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test403a.scxml b/test/w3c/c89/test403a.scxml new file mode 100644 index 0000000..bad5e24 --- /dev/null +++ b/test/w3c/c89/test403a.scxml @@ -0,0 +1,46 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test one part of 'optimal enablement' meaning that of all transitions that are enabled, we chose the ones +in child states over parent states, and use document order to break ties. We have +a parent state s0 with two children, s01 and s02. In s01, we test that a) if +a transition in the child matches, we don't consider matches in the parent and b) +that if two transitions match in any state, we take the first in document order. +In s02 we test that we take a transition in the parent if there is no +matching transition in the child. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01"> + <onentry> + <!-- catch the failure case --> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <transition event="event1" target="fail"/> + <transition event="event2" target="pass"/> + <state id="s01"> + <onentry> + <!-- this should be caught by the first transition in this state, taking us to S02 --> + <raise event="event1"/> + </onentry> + <transition event="event1" target="s02"/> + <transition event="*" target="fail"/> + </state> + <state id="s02"> + <onentry> + <!-- since the local transition has a cond that evaluates to false this should be caught by a + transition in the parent state, taking us to pass --> + <raise event="event2"/> + </onentry> + <transition event="event1" target="fail"/> + <transition event="event2" cond="false" target="fail"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test403b.scxml b/test/w3c/c89/test403b.scxml new file mode 100644 index 0000000..b213795 --- /dev/null +++ b/test/w3c/c89/test403b.scxml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that 'optimally enabled set' really is a set, specifically that if a transition is optimally enabled in +two different states, it is taken only once. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0" initial="p0"> + <!-- this transition should never be taken because a transition in a lower state should + always be selected --> + <transition event="event1"> + <assign location="Var1" expr="Var1 + 1"/> + </transition> + <parallel id="p0"> + <onentry> + <raise event="event1"/> + <raise event="event2"/> + </onentry> + <!-- this transition will be selected by both states p0s1 and p0s2, but should be executed only once --> + <transition event="event1"> + <assign location="Var1" expr="Var1 + 1"/> + </transition> + <state id="p0s1"> + <transition event="event2" cond="Var1==1" target="pass"/> + <transition event="event2" target="fail"/> + </state> + <state id="p0s2"/> + </parallel> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test403c.scxml b/test/w3c/c89/test403c.scxml new file mode 100644 index 0000000..6c1c498 --- /dev/null +++ b/test/w3c/c89/test403c.scxml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test 'optimally enabled set', specifically that preemption works correctly --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0" initial="p0"> + <onentry> + <raise event="event1"/> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="event2" target="fail"/> + <transition event="timeout" target="fail"/> + <parallel id="p0"> + <state id="p0s1"> + <transition event="event1"/> + <transition event="event2"/> + </state> + <state id="p0s2"> + <transition event="event1" target="p0s1"> + <raise event="event2"/> + </transition> + </state> + <state id="p0s3"> + <!-- this transition should be blocked by the one in p0s2--> + <transition event="event1" target="fail"/> + <!-- this transition will preempt the one that p0s2 inherits + from an ancestor --> + <transition event="event2" target="s1"/> + </state> + <state id="p0s4"> + <!-- this transition never gets preempted, should fire twice --> + <transition event="*"> + <assign location="Var1" expr="Var1 + 1"/> + </transition> + </state> + </parallel> + </state> + <state id="s1"> + <transition cond="Var1==2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test404.scxml b/test/w3c/c89/test404.scxml new file mode 100644 index 0000000..a8bb8bf --- /dev/null +++ b/test/w3c/c89/test404.scxml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that states are exited in exit order (children before parents with reverse doc order used to break ties + before the executable content in the transitions. event1, event2, event3, event4 should be raised in that + order when s01p is exited --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01p"> + <parallel id="s01p"> + <onexit> + <!-- this should be the 3rd event raised --> + <raise event="event3"/> + </onexit> + <transition target="s02"> + <!-- this should be the fourth event raised --> + <raise event="event4"/> + </transition> + <state id="s01p1"> + <onexit> + <!-- this should be the second event raised --> + <raise event="event2"/> + </onexit> + </state> + <state id="s01p2"> + <!-- this should be the first event raised --> + <onexit> + <raise event="event1"/> + </onexit> + </state> + </parallel> + <state id="s02"> + <transition event="event1" target="s03"/> + <transition event="*" target="fail"/> + </state> + <state id="s03"> + <transition event="event2" target="s04"/> + <transition event="*" target="fail"/> + </state> + <state id="s04"> + <transition event="event3" target="s05"/> + <transition event="*" target="fail"/> + </state> + <state id="s05"> + <transition event="event4" target="pass"/> + <transition event="*" target="fail"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test405.scxml b/test/w3c/c89/test405.scxml new file mode 100644 index 0000000..0fcc8d2 --- /dev/null +++ b/test/w3c/c89/test405.scxml @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the executable content in the transitions is executed in document order after +the states are exited. event1, event2, event3, event4 should be raised in that order when the +state machine is entered --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01p"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <parallel id="s01p"> + <transition event="event1" target="s02"/> + <state id="s01p1" initial="s01p11"> + <state id="s01p11"> + <onexit> + <!-- this should be the second event raised --> + <raise event="event2"/> + </onexit> + <transition target="s01p12"> + <!-- this should be the third event raised --> + <raise event="event3"/> + </transition> + </state> + <state id="s01p12"/> + </state> + <!-- end s01p1 --> + <state id="s01p2" initial="s01p21"> + <state id="s01p21"> + <onexit> + <!-- this should be the first event raised --> + <raise event="event1"/> + </onexit> + <transition target="s01p22"> + <!-- this should be the fourth event raised --> + <raise event="event4"/> + </transition> + </state> + <state id="s01p22"/> + </state> + <!-- end s01p2 --> + </parallel> + <state id="s02"> + <transition event="event2" target="s03"/> + <transition event="*" target="fail"/> + </state> + <state id="s03"> + <transition event="event3" target="s04"/> + <transition event="*" target="fail"/> + </state> + <state id="s04"> + <transition event="event4" target="pass"/> + <transition event="*" target="fail"/> + </state> + </state> + <!-- end s01 --> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test406.scxml b/test/w3c/c89/test406.scxml new file mode 100644 index 0000000..19ccd41 --- /dev/null +++ b/test/w3c/c89/test406.scxml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Test that states are entered in entry order (parents before children with document order used to break ties) +after the executable content in the transition is executed. event1, event2, event3, event4 should be raised in that +order when the transition in s01 is taken --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" datamodel="c89"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s01"> + <transition target="s0p2"> + <!-- this should be the first event raised --> + <raise event="event1"/> + </transition> + </state> + <parallel id="s0p2"> + <transition event="event1" target="s03"/> + <state id="s01p21"> + <onentry> + <!-- third event --> + <raise event="event3"/> + </onentry> + </state> + <state id="s01p22"> + <onentry> + <!-- the fourth event --> + <raise event="event4"/> + </onentry> + </state> + <onentry> + <!-- this should be the second event raised --> + <raise event="event2"/> + </onentry> + </parallel> + <state id="s03"> + <transition event="event2" target="s04"/> + <transition event="*" target="fail"/> + </state> + <state id="s04"> + <transition event="event3" target="s05"/> + <transition event="*" target="fail"/> + </state> + <state id="s05"> + <transition event="event4" target="pass"/> + <transition event="*" target="fail"/> + </state> + </state> + <!-- end s0 --> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test407.scxml b/test/w3c/c89/test407.scxml new file mode 100644 index 0000000..7f4d2e8 --- /dev/null +++ b/test/w3c/c89/test407.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- a simple test that onexit handlers work. var1 should be incremented when we leave s0 --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0"> + <onexit> + <assign location="Var1" expr="Var1 + 1"/> + </onexit> + <transition target="s1"/> + </state> + <state id="s1"> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test409.scxml b/test/w3c/c89/test409.scxml new file mode 100644 index 0000000..05673c9 --- /dev/null +++ b/test/w3c/c89/test409.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that states are removed from the active states list as they are exited. When s01's onexit handler +fires, s011 should not be on the active state list, so in(S011) should be false, and event1 should not +be raised. Therefore the timeout should fire to indicate success --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delayexpr="&1s&"/> + </onentry> + <transition event="timeout" target="pass"/> + <transition event="event1" target="fail"/> + <state id="s01" initial="s011"> + <onexit> + <if cond="In('s011')"> + <raise event="event1"/> + </if> + </onexit> + <state id="s011"> + <transition target="s02"/> + </state> + </state> + <!-- end s01 --> + <state id="s02"/> + </state> + <!-- end s0 --> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test411.scxml b/test/w3c/c89/test411.scxml new file mode 100644 index 0000000..db61c7c --- /dev/null +++ b/test/w3c/c89/test411.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that states are added to the active states list as they are entered and before onentry handlers +are executed. When s0's onentry handler fires we should not be in s01. But when s01's onentry handler +fires, we should be in s01. Therefore event1 should not fire, but event2 should. Either event1 or +timeout also indicates failure --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="1s"/> + <if cond="In('s01')"> + <raise event="event1"/> + </if> + </onentry> + <transition event="timeout" target="fail"/> + <transition event="event1" target="fail"/> + <transition event="event2" target="pass"/> + <state id="s01"> + <onentry> + <if cond="In('s01')"> + <raise event="event2"/> + </if> + </onentry> + </state> + </state> + <!-- end s0 --> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test412.scxml b/test/w3c/c89/test412.scxml new file mode 100644 index 0000000..8990adb --- /dev/null +++ b/test/w3c/c89/test412.scxml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that executable content in the <initial> transition executes after the onentry handler on the state +and before the onentry handler of the child states. Event1, event2, and event3 should occur in that order. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0" initial="s01"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <transition event="event1" target="fail"/> + <transition event="event2" target="pass"/> + <state id="s01"> + <onentry> + <raise event="event1"/> + </onentry> + <initial> + <transition target="s011"> + <raise event="event2"/> + </transition> + </initial> + <state id="s011"> + <onentry> + <raise event="event3"/> + </onentry> + <transition target="s02"/> + </state> + </state> + <state id="s02"> + <transition event="event1" target="s03"/> + <transition event="*" target="fail"/> + </state> + <state id="s03"> + <transition event="event2" target="s04"/> + <transition event="*" target="fail"/> + </state> + <state id="s04"> + <transition event="event3" target="pass"/> + <transition event="*" target="fail"/> + </state> + </state> + <!-- end s0 --> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test413.scxml b/test/w3c/c89/test413.scxml new file mode 100644 index 0000000..3ba882f --- /dev/null +++ b/test/w3c/c89/test413.scxml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the state machine is put into the configuration specified by the initial element, without regard +to any other defaults. we should start off in s2p111 and s2p122. the atomic +states we should not enter all have immediate transitions to failure in them --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s2p112 s2p122" version="1.0" datamodel="c89"> + <state id="s1"> + <transition target="fail"/> + </state> + <state id="s2" initial="s2p1"> + <parallel id="s2p1"> + <!-- this transition will be triggered only if we end up in an illegal configuration where we're in + either s2p112 or s2p122, but not both of them --> + <transition target="fail"/> + <state id="s2p11" initial="s2p111"> + <state id="s2p111"> + <transition target="fail"/> + </state> + <state id="s2p112"> + <transition cond="In('s2p122')" target="pass"/> + </state> + </state> + <!-- end s2p11 --> + <state id="s2p12" initial="s2p121"> + <state id="s2p121"> + <transition target="fail"/> + </state> + <state id="s2p122"> + <transition cond="In('s2p112')" target="pass"/> + </state> + </state> + </parallel> + </state> + <!-- end s2 --> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test415.scxml b/test/w3c/c89/test415.scxml new file mode 100644 index 0000000..7511e25 --- /dev/null +++ b/test/w3c/c89/test415.scxml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Test that the state machine halts when it enters a top-level final state. Since + the initial state is a final state, this machine should halt immediately without + processing "event1" which is raised in the final state's on-entry handler. This + is a manual test since there is no platform-independent way to test that event1 + is not processed --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="final" version="1.0" datamodel="c89"> + <final id="final"> + <onentry> + <raise event="event1"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test416.scxml b/test/w3c/c89/test416.scxml new file mode 100644 index 0000000..5364acf --- /dev/null +++ b/test/w3c/c89/test416.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the done.state.id gets generated when we enter the final state of a compound state --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s1" datamodel="c89"> + <state id="s1" initial="s11"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s11" initial="s111"> + <transition event="done.state.s11" target="pass"/> + <state id="s111"> + <transition target="s11final"/> + </state> + <final id="s11final"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test417.scxml b/test/w3c/c89/test417.scxml new file mode 100644 index 0000000..750faf8 --- /dev/null +++ b/test/w3c/c89/test417.scxml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that we get the done.state.id event when all of a +parallel elements children enter final states. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s1" datamodel="c89"> + <state id="s1" initial="s1p1"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <parallel id="s1p1"> + <transition event="done.state.s1p1" target="pass"/> + <state id="s1p11" initial="s1p111"> + <state id="s1p111"> + <transition target="s1p11final"/> + </state> + <final id="s1p11final"/> + </state> + <state id="s1p12" initial="s1p121"> + <state id="s1p121"> + <transition target="s1p12final"/> + </state> + <final id="s1p12final"/> + </state> + </parallel> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test419.scxml b/test/w3c/c89/test419.scxml new file mode 100644 index 0000000..765754d --- /dev/null +++ b/test/w3c/c89/test419.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that eventless transitions take precedence over event-driven ones --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s1" datamodel="c89"> + <state id="s1"> + <onentry> + <raise event="internalEvent"/> + <send event="externalEvent"/> + </onentry> + <transition event="*" target="fail"/> + <transition target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test421.scxml b/test/w3c/c89/test421.scxml new file mode 100644 index 0000000..eb75353 --- /dev/null +++ b/test/w3c/c89/test421.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that internal events take priority over external ones, and that the processor +keeps pulling off internal events until it finds one that triggers a transition --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s1" datamodel="c89"> + <state id="s1" initial="s11"> + <onentry> + <send event="externalEvent"/> + <raise event="internalEvent1"/> + <raise event="internalEvent2"/> + <raise event="internalEvent3"/> + <raise event="internalEvent4"/> + </onentry> + <transition event="externalEvent" target="fail"/> + <state id="s11"> + <transition event="internalEvent3" target="s12"/> + </state> + <state id="s12"> + <transition event="internalEvent4" target="pass"/> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test422.scxml b/test/w3c/c89/test422.scxml new file mode 100644 index 0000000..82049f7 --- /dev/null +++ b/test/w3c/c89/test422.scxml @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Test that at the end of a macrostep, the processor executes all invokes in states +that have been entered and not exited during the step. (The invokes are supposed to be executed +in document order, but we can test that since each invocation is separate and they may take +different amounts to time to start up.) In this case, there are three invoke statements, +in states s1, s11 and s12. Each invoked process returns an event named after its parent state. +The invokes in s1 and s12 should execute, but not the one +in s11. So we should receive invokeS1, invokeS12, but not invokeS12. Furthermore, when the timeout fires, var1 should equal 2.--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s1" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s1" initial="s11"> + <onentry> + <send event="timeout" delayexpr="&2s&"/> + </onentry> + <transition event="invokeS1 invokeS12"> + <assign location="Var1" expr="Var1 + 1"/> + </transition> + <transition event="invokeS11" target="fail"/> + <transition event="timeout" cond="Var1==2" target="pass"/> + <transition event="timeout" target="fail"/> + <invoke> + <content> + <!-- when invoked, send 'foo' to parent, then terminate. --> + <scxml initial="sub0" version="1.0" datamodel="c89"> + <state id="sub0"> + <onentry> + <send target="#_parent" event="invokeS1"/> + </onentry> + <transition target="subFinal0"/> + </state> + <final id="subFinal0"/> + </scxml> + </content> + </invoke> + <state id="s11"> + <invoke> + <content> + <!-- when invoked, send 'foo' to parent, then terminate. --> + <scxml initial="sub1" version="1.0" datamodel="c89"> + <state id="sub1"> + <onentry> + <send target="#_parent" event="invokeS11"/> + </onentry> + <transition target="subFinal1"/> + </state> + <final id="subFinal1"/> + </scxml> + </content> + </invoke> + <transition target="s12"/> + </state> + <state id="s12"> + <invoke> + <content> + <!-- when invoked, send 'foo' to parent, then terminate. --> + <scxml initial="sub2" version="1.0" datamodel="c89"> + <state id="sub2"> + <onentry> + <send target="#_parent" event="invokeS12"/> + </onentry> + <transition target="subFinal2"/> + </state> + <final id="subFinal2"/> + </scxml> + </content> + </invoke> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test423.scxml b/test/w3c/c89/test423.scxml new file mode 100644 index 0000000..f672b58 --- /dev/null +++ b/test/w3c/c89/test423.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that we keep pulling external events off the queue till we find one that matches a transition. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="externalEvent1"/> + <send event="externalEvent2" delayexpr="&1s&"/> + <raise event="internalEvent"/> + </onentry> + <!-- in this state we should process only internalEvent --> + <transition event="internalEvent" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <!-- in this state we ignore externalEvent1 and wait for externalEvent2 --> + <transition event="externalEvent2" target="pass"/> + <transition event="internalEvent" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test436.scxml b/test/w3c/c89/test436.scxml new file mode 100644 index 0000000..3f60680 --- /dev/null +++ b/test/w3c/c89/test436.scxml @@ -0,0 +1,23 @@ +<?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="In('s1')" target="fail"/> + <transition cond="In('ps1')" target="pass"/> + <transition target="fail"/> + </state> + <state id="ps1"/> + </parallel> + <state id="s1"/> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test444.scxml b/test/w3c/c89/test444.scxml new file mode 100644 index 0000000..971a613 --- /dev/null +++ b/test/w3c/c89/test444.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that <data> creates a new ecmascript variable. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="ecmascript" version="1.0"> + <datamodel> + <data id="var1" expr="1"/> + </datamodel> + <state id="s0"> + <!-- test that var1 can be used as an ecmascript variable --> + <transition cond="++var1==2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test445.scxml b/test/w3c/c89/test445.scxml new file mode 100644 index 0000000..fd15a6e --- /dev/null +++ b/test/w3c/c89/test445.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that ecmascript objects defined by <data> have value undefined if <data> does not assign a value --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="ecmascript" version="1.0"> + <datamodel> + <data id="var1"/> + </datamodel> + <state id="s0"> + <transition cond="var1==undefined" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test446.scxml b/test/w3c/c89/test446.scxml new file mode 100644 index 0000000..4073cbd --- /dev/null +++ b/test/w3c/c89/test446.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- in the ECMA data model, test that if the child of <data> is JSON, the processor + assigns it as the value of the var --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + <datamodel> + <data id="var1">[1, 2, 3]</data> + <data id="var2" src="file:test446.txt"/> + </datamodel> + <state id="s0"> + <transition cond="var1 instanceof Array" target="s1"/> + <transition target="fail"/> + </state> + <state id="s1"> + <transition cond="var2 instanceof Array" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test448.scxml b/test/w3c/c89/test448.scxml new file mode 100644 index 0000000..b568f99 --- /dev/null +++ b/test/w3c/c89/test448.scxml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that all ecmascript objects are placed in a single global scope --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="ecmascript" version="1.0"> + <state id="s0"> + <!-- test that a parent state can access a variable defined in a child --> + <transition cond="var1==1" target="s1"/> + <transition target="fail"/> + <state id="s01"> + <datamodel> + <data id="var1" expr="1"/> + </datamodel> + </state> + </state> + <state id="s1" initial="s01p"> + <parallel id="s01p"> + <state id="s01p1"> + <!-- test that we can access a variable defined in a parallel sibling state --> + <transition cond="var2==1" target="pass"/> + <transition target="fail"/> + </state> + <state id="s01p2"> + <datamodel> + <data id="var2" expr="1"/> + </datamodel> + </state> + </parallel> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test449.scxml b/test/w3c/c89/test449.scxml new file mode 100644 index 0000000..d2f6be8 --- /dev/null +++ b/test/w3c/c89/test449.scxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that ecmascript objects are converted to booleans inside cond --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="ecmascript" version="1.0"> + <state id="s0"> + <transition cond="'foo'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test451.scxml b/test/w3c/c89/test451.scxml new file mode 100644 index 0000000..487f532 --- /dev/null +++ b/test/w3c/c89/test451.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- simple test of the in() predicate --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="ecmascript" initial="p"> + <parallel id="p"> + <state id="s0"> + <transition cond="In('s1')" target="pass"/> + <transition target="fail"/> + </state> + <state id="s1"/> + </parallel> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test452.scxml b/test/w3c/c89/test452.scxml new file mode 100644 index 0000000..4be9b4d --- /dev/null +++ b/test/w3c/c89/test452.scxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that we can assign to any location in the datamodel. In this case, we just test that we can assign +to a substructure (not the top level variable). This may not be the most idiomatic way to write the test --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="ecmascript" version="1.0"> + <datamodel> + <data id="foo" expr="0"/> + </datamodel> + <script> + function testobject() { + this.bar = 0;} + </script> + <state id="s0"> + <onentry> + <assign location="foo" expr="new testobject();"/> + <!-- try to assign to foo's bar property --> + <assign location="foo.bar" expr="1"/> + <raise event="event1"/> + </onentry> + <!-- test that we have assigned to foo's bar property --> + <transition event="event1" cond="foo.bar == 1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test453.scxml b/test/w3c/c89/test453.scxml new file mode 100644 index 0000000..a50d5f7 --- /dev/null +++ b/test/w3c/c89/test453.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that we can use any ecmascript expression as a value expression. +In this case, we just test that we can assign +a function to a variable and then call it. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="ecmascript" version="1.0"> + <datamodel> + <data id="var1" expr="function(invar) {return invar + 1;}"/> + </datamodel> + <state id="s0"> + <onentry> + <raise event="event1"/> + </onentry> + <!-- test that we can call the function --> + <transition event="event1" cond="var1(2) == 3" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test456.scxml b/test/w3c/c89/test456.scxml new file mode 100644 index 0000000..3f400e4 --- /dev/null +++ b/test/w3c/c89/test456.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we can't test that _any_ ecmascript is valid inside <script>, so we +just run a simple one and check that it can update the data model. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <state id="s0"> + <onentry> + <script> + Var1+=1 + </script> + </onentry> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test457.scxml b/test/w3c/c89/test457.scxml new file mode 100644 index 0000000..40ea9fd --- /dev/null +++ b/test/w3c/c89/test457.scxml @@ -0,0 +1,61 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an 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.. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="ecmascript" version="1.0"> + <datamodel> + <data id="Var1" expr="0"/> + <data id="Var2"/> + <data id="Var3"/> + <data id="Var4" expr="7"/> + <data id="Var5" expr="[1,2,3]"/> + <data id="Var6"/> + </datamodel> + <state id="s0"> + <onentry> + <!-- invalid array, legal item --> + <foreach item="Var2" index="Var3" array="Var4"> + <assign location="Var1" expr="Var1 + 1"/> + </foreach> + <raise event="foo"/> + </onentry> + <transition event="error.execution" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <onentry> + <!-- illegal item, legal array --> + <foreach item="'continue'" index="Var3" array="Var5"> + <assign location="Var1" expr="Var1 + 1"/> + </foreach> + <raise event="bar"/> + </onentry> + <transition event="error.execution" target="s2"/> + <transition event="bar" target="fail"/> + </state> + <state id="s2"> + <!-- check that var1 has its original value (so executable content never got executed --> + <transition cond="Var1==0" target="s3"/> + <transition target="fail"/> + </state> + <!-- finally check that a legal array works properly --> + <state id="s3"> + <onentry> + <assign location="Var6" expr="0"/> + <foreach item="Var2" array="Var5"> + <assign location="Var6" expr="Var6 + Var2"/> + </foreach> + </onentry> + <transition cond="Var6==6" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test459.scxml b/test/w3c/c89/test459.scxml new file mode 100644 index 0000000..9037a93 --- /dev/null +++ b/test/w3c/c89/test459.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that foreach goes over the array in the right order. since the array contains 1 2 3, we compare the current +value with the previous value, which is stored in var1. The current value should always be larger. If +it ever isn't, set Var4 to 0, indicating failure. Also check that the final value of the index +is 2 (meaning that the initial value was 0, not 1) --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + <datamodel> + <data id="Var1" expr="0"/> + <!-- contains the previous value --> + <data id="Var2"/> + <!-- the item which will contain the current value --> + <data id="Var3"/> + <!-- the index --> + <data id="Var4" expr="[1,2,3]"/> + <data id="Var5" expr="1"/> + <!-- 1 if success, 0 if failure --> + </datamodel> + <state id="s0"> + <onentry> + <foreach item="Var2" array="Var4" index="Var3"> + <if cond="Var1<Var2"> + <assign location="Var1" expr="Var2"/> + <else/> + <!-- values are out of order, record failure --> + <assign location="Var5" expr="0"/> + </if> + </foreach> + </onentry> + <!-- check that var1 has its original value --> + <transition cond="Var4==0 | Var3 != 2" target="fail"/> + <transition target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test460.scxml b/test/w3c/c89/test460.scxml new file mode 100644 index 0000000..3e05b0e --- /dev/null +++ b/test/w3c/c89/test460.scxml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that <foreach> does a shallow copy, so that modifying the array does not change +the iteration behavior. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="ecmascript" version="1.0"> + <datamodel> + <data id="Var1" expr="[1,2,3]"/> + <data id="Var2" expr="0"/> + <!-- counts the number of iterations --> + </datamodel> + <state id="s0"> + <onentry> + <foreach item="Var3" array="Var1"> + <assign location="Var1" expr="[].concat(Var1, [4])"/> + <assign location="Var2" expr="Var2 + 1"/> + </foreach> + </onentry> + <transition cond="Var2==3" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="'pass'"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="'fail'"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test463.scxml b/test/w3c/c89/test463.scxml new file mode 100644 index 0000000..8a4e774 --- /dev/null +++ b/test/w3c/c89/test463.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the <data> tag creates an element in the XML datamodel with the correct name and id attr +and binds an XPath variable to it --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="foo" expr="2"/> + </datamodel> + <state id="s0"> + <transition cond="local-name($foo)='data'and $foo/@id ='foo'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test464.scxml b/test/w3c/c89/test464.scxml new file mode 100644 index 0000000..afaf97b --- /dev/null +++ b/test/w3c/c89/test464.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an unassigned variable creates an empty <data> element --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="foo"/> + </datamodel> + <state id="s0"> + <transition cond="count($foo) = 1 and count($foo/*) = 0" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test465.scxml b/test/w3c/c89/test465.scxml new file mode 100644 index 0000000..1c32bd2 --- /dev/null +++ b/test/w3c/c89/test465.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that all xpath variables are in a single global scope--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="foo" expr="2"/> + </datamodel> + <state id="s0"> + <transition cond="count($foo) = 1 and count($bar) = 1" target="s1"/> + <transition target="fail"/> + </state> + <state id="s1"> + <datamodel> + <data id="bar" expr="1"/> + </datamodel> + <transition target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test466.scxml b/test/w3c/c89/test466.scxml new file mode 100644 index 0000000..0b6baf5 --- /dev/null +++ b/test/w3c/c89/test466.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that xpath expressions are converted to boolean when used as conditional expressions--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="foo" expr="2"/> + </datamodel> + <state id="s0"> + <transition cond="$foo" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test467.scxml b/test/w3c/c89/test467.scxml new file mode 100644 index 0000000..1ca867c --- /dev/null +++ b/test/w3c/c89/test467.scxml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that in() is available --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <state id="s0"> + <transition cond="In('s0')" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test468.scxml b/test/w3c/c89/test468.scxml new file mode 100644 index 0000000..25794b6 --- /dev/null +++ b/test/w3c/c89/test468.scxml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that XPath expressions can be used as location expressions. + This example is taken from the spec --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="cities"> + <list xmlns=""> + <city id="nyc" count="0">New York</city> + <city id="bos" count="0">Boston</city> + </list> + </data> + </datamodel> + <state id="s0"> + <onentry> + <assign location="$cities/list/city[@id='nyc']/@count" expr="1"/> + </onentry> + <transition cond="$cities/list/city[@id='nyc']/@count = 1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test469.scxml b/test/w3c/c89/test469.scxml new file mode 100644 index 0000000..1ca90e8 --- /dev/null +++ b/test/w3c/c89/test469.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that XPath expressions can be used as value expressions. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="copyOfEventData"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="event1"> + <param name="param1" expr="1"/> + </send> + </onentry> + <transition event="event1" target="s1"> + <assign location="$copyOfEventData" expr="$_event/data"/> + </transition> + </state> + <state id="s1"> + <transition cond="$copyOfEventData/data/data[@id='param1'] =1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test470.scxml b/test/w3c/c89/test470.scxml new file mode 100644 index 0000000..55e5b91 --- /dev/null +++ b/test/w3c/c89/test470.scxml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the processor makes a deep copy of a node set when assigning. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="var1"> + <foo xmlns=""> + <bar>2</bar> + </foo> + </data> + <data id="var2"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="$var2" expr="$var1/foo"/> + <assign location="$var1/foo/bar" expr="3"/> + </onentry> + <transition cond="$var2/foo/bar=2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test473.scxml b/test/w3c/c89/test473.scxml new file mode 100644 index 0000000..ea3d4d3 --- /dev/null +++ b/test/w3c/c89/test473.scxml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that 'replacechildren' in <assign> replaces all children with the new value. + This example is taken from the doc --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="cart"> + <myCart xmlns=""> + <books> + <book> + <title>The Zen Mind</title> + </book> + <book> + <title>Freakonomics</title> + </book> + </books> + <cds> + <cd name="Something"/> + </cds> + </myCart> + </data> + </datamodel> + <state id="s0"> + <onentry> + <assign location="$cart/myCart/books/book[1]"> + <bookinfo xmlns=""> + <isdn>12334455</isdn> + <author>some author</author> + </bookinfo> + </assign> + </onentry> + <transition cond="$cart/myCart/books/book[1]/bookinfo/isdn/text() = '12334455' and not($cart/myCart/books/book[1]/title)" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test474.scxml b/test/w3c/c89/test474.scxml new file mode 100644 index 0000000..463961c --- /dev/null +++ b/test/w3c/c89/test474.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that 'firstchild' in <assign> inserts the new value before the other children. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="cart"> + <myCart xmlns=""> + <books> + <book> + <title>The Zen Mind</title> + </book> + <book> + <title>Freakonomics</title> + </book> + </books> + <cds> + <cd name="Something"/> + </cds> + </myCart> + </data> + </datamodel> + <state id="s0"> + <onentry> + <assign location="$cart/myCart/books/book[1]" type="firstchild"> + <bookinfo xmlns=""> + <isdn>12334455</isdn> + <author>some author</author> + </bookinfo> + </assign> + </onentry> + <transition cond="$cart/myCart/books/book[1]/*[1]/isdn/text() = '12334455' and $cart/myCart/books/book[1]/*[2]/text() = 'The Zen Mind'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test475.scxml b/test/w3c/c89/test475.scxml new file mode 100644 index 0000000..2a71312 --- /dev/null +++ b/test/w3c/c89/test475.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that 'lastchild' in <assign> inserts the new value after the other children. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="cart"> + <myCart xmlns=""> + <books> + <book> + <title>The Zen Mind</title> + </book> + <book> + <title>Freakonomics</title> + </book> + </books> + <cds> + <cd name="Something"/> + </cds> + </myCart> + </data> + </datamodel> + <state id="s0"> + <onentry> + <assign location="$cart/myCart/books/book[1]" type="lastchild"> + <bookinfo xmlns=""> + <isdn>12334455</isdn> + <author>some author</author> + </bookinfo> + </assign> + </onentry> + <transition cond="$cart/myCart/books/book[1]/*[2]/isdn/text() = '12334455' and $cart/myCart/books/book[1]/*[1]/text() = 'The Zen Mind'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test476.scxml b/test/w3c/c89/test476.scxml new file mode 100644 index 0000000..174d334 --- /dev/null +++ b/test/w3c/c89/test476.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that 'nextsibling' in <assign> inserts the new value after the location. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="cart"> + <myCart xmlns=""> + <books> + <book> + <title>The Zen Mind</title> + </book> + <book> + <title>Freakonomics</title> + </book> + </books> + <cds> + <cd name="Something"/> + </cds> + </myCart> + </data> + </datamodel> + <state id="s0"> + <onentry> + <assign location="$cart/myCart/books/book[1]/title" type="nextsibling"> + <bookinfo xmlns=""> + <isdn>12334455</isdn> + <author>some author</author> + </bookinfo> + </assign> + </onentry> + <transition cond="$cart/myCart/books/book[1]/*[2]/isdn/text() = '12334455' and $cart/myCart/books/book[1]/*[1]/text() = 'The Zen Mind'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test477.scxml b/test/w3c/c89/test477.scxml new file mode 100644 index 0000000..92f0feb --- /dev/null +++ b/test/w3c/c89/test477.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that 'previoussibling' in <assign> inserts the new value before the location. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="cart"> + <myCart xmlns=""> + <books> + <book> + <title>The Zen Mind</title> + </book> + <book> + <title>Freakonomics</title> + </book> + </books> + <cds> + <cd name="Something"/> + </cds> + </myCart> + </data> + </datamodel> + <state id="s0"> + <onentry> + <assign location="$cart/myCart/books/book[1]/title" type="previoussibling"> + <bookinfo xmlns=""> + <isdn>12334455</isdn> + <author>some author</author> + </bookinfo> + </assign> + </onentry> + <transition cond="$cart/myCart/books/book[1]/*[1]/isdn/text() = '12334455' and $cart/myCart/books/book[1]/*[2]/text() = 'The Zen Mind'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test478.scxml b/test/w3c/c89/test478.scxml new file mode 100644 index 0000000..6712330 --- /dev/null +++ b/test/w3c/c89/test478.scxml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that 'replace' in <assign> replaces the value at the location. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="cart"> + <myCart xmlns=""> + <books> + <book> + <title>The Zen Mind</title> + </book> + <book> + <title>Freakonomics</title> + </book> + </books> + <cds> + <cd name="Something"/> + </cds> + </myCart> + </data> + </datamodel> + <state id="s0"> + <onentry> + <assign location="$cart/myCart/books/book[2]" type="replace"> + <cd xmlns=""> + <title>This is not a book</title> + </cd> + </assign> + </onentry> + <transition cond="$cart/myCart/books/cd/title = 'This is not a book'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test479.scxml b/test/w3c/c89/test479.scxml new file mode 100644 index 0000000..9abfa7e --- /dev/null +++ b/test/w3c/c89/test479.scxml @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that 'delete' in <assign> deletes the value at the location. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="cart"> + <myCart xmlns=""> + <books> + <book> + <title>The Zen Mind</title> + </book> + <book> + <title>Freakonomics</title> + </book> + </books> + <cds> + <cd name="Something"/> + </cds> + </myCart> + </data> + </datamodel> + <state id="s0"> + <onentry> + <assign location="$cart/myCart/cds" type="delete"> + <cd xmlns=""> + <title>This is not a book</title> + </cd> + </assign> + </onentry> + <transition cond="not($cart/myCart/cds)" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test480.scxml b/test/w3c/c89/test480.scxml new file mode 100644 index 0000000..df3ca0a --- /dev/null +++ b/test/w3c/c89/test480.scxml @@ -0,0 +1,38 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that 'addattr' in <assign> adds an attribute to the specified node. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="cart"> + <myCart xmlns=""> + <books> + <book> + <title>The Zen Mind</title> + </book> + <book> + <title>Freakonomics</title> + </book> + </books> + <cds> + <cd name="Something"/> + </cds> + </myCart> + </data> + </datamodel> + <state id="s0"> + <onentry> + <assign location="$cart/myCart/books/book[1]" type="addattribute" attr="author" expr="'somebody'"/> + </onentry> + <transition cond="$cart/myCart/books/book[1]/@author = 'somebody'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test481.scxml b/test/w3c/c89/test481.scxml new file mode 100644 index 0000000..fb46595 --- /dev/null +++ b/test/w3c/c89/test481.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that illegal assignments fail and have no side effects. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="cart"> + <myCart xmlns=""> + <books> + <book> + <title>The Zen Mind</title> + </book> + <book> + <title>Freakonomics</title> + </book> + </books> + <cds> + <cd name="Something"/> + </cds> + </myCart> + </data> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + <assign location="$cart/myCart/cds/cd/@name"> + <foo> + <bar/> + </foo> + </assign> + </onentry> + <transition event="error.execution" cond="$cart/myCart/cds/cd/@name = 'Something'" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test482.scxml b/test/w3c/c89/test482.scxml new file mode 100644 index 0000000..832ce14 --- /dev/null +++ b/test/w3c/c89/test482.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that system vars are created and bound to XPath variables --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" name="scxmltest" initial="s0" version="1.0" datamodel="xpath"> + <state id="s0"> + <onentry> + <!-- event isn't bound until an event is raised --> + <raise event="someevent"/> + </onentry> + <transition event="*" cond="local-name($_event) = 'data' and local-name($_sessionid) = 'data' and local-name($_name) = 'data' and local-name($_ioprocessors) = 'data'" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test483.scxml b/test/w3c/c89/test483.scxml new file mode 100644 index 0000000..84f3e0f --- /dev/null +++ b/test/w3c/c89/test483.scxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that foreach works correctly, iterating over node set in document order. + This tests assertions 483-485 --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" name="scxmltest" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="var1"> + <nodes xmlns=""> + <node/> + <node/> + <node/> + </nodes> + </data> + </datamodel> + <state id="s0"> + <onentry> + <foreach array="$var1/nodes/node" item="item" index="pos"> + <assign location="$item" type="addattribute" attr="position" expr="$pos"/> + </foreach> + </onentry> + <transition cond="$var1/nodes/node[1]/@position = 1 and $var1/nodes/node[2]/@position = 2 and $var1/nodes/node[3]/@position = 3" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test487.scxml b/test/w3c/c89/test487.scxml new file mode 100644 index 0000000..eff55f1 --- /dev/null +++ b/test/w3c/c89/test487.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test illegal assignment. error.execution should be raised. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1" expr="return"/> + <raise event="event"/> + </onentry> + <transition event="error.execution" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test488.scxml b/test/w3c/c89/test488.scxml new file mode 100644 index 0000000..64462ce --- /dev/null +++ b/test/w3c/c89/test488.scxml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that illegal expr in <param> produces error.execution and empty event.data --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <state id="s0" initial="s01"> + <!-- we should get the error before the done event --> + <transition event="error.execution" target="s1"/> + <transition event="done.state.s0" target="fail"/> + <transition event="done.state.s0" target="fail"> + </transition> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <param expr="return" name="someParam"/> + </donedata> + </final> + </state> + <!-- if we get here, we received the error event. Now check that the done + event has empty event.data --> + <state id="s1"> + <transition event="done.state.s0" cond="typeof _event.data === 'undefined'" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test495.scxml b/test/w3c/c89/test495.scxml new file mode 100644 index 0000000..2daaa06 --- /dev/null +++ b/test/w3c/c89/test495.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the scxml event i/o processor puts events in the correct queues.--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <!-- default target is external queue --> + <send event="event1" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor"/> + <send event="event2" target="#_internal" type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor"/> + </onentry> + <!-- we should get the internal event first --> + <transition event="event1" target="fail"/> + <transition event="event2" target="s1"/> + </state> + <state id="s1"> + <transition event="event1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test496.scxml b/test/w3c/c89/test496.scxml new file mode 100644 index 0000000..d49347c --- /dev/null +++ b/test/w3c/c89/test496.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send type="http://www.w3.org/TR/scxml/#SCXMLEventProcessor" event="event" target="#_scxml_foo"/> + <raise event="foo"/> + </onentry> + <transition event="error.communication" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test500.scxml b/test/w3c/c89/test500.scxml new file mode 100644 index 0000000..46c81c6 --- /dev/null +++ b/test/w3c/c89/test500.scxml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that location field is found inside entry for SCXML Event I/O processor --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="_ioprocessors['http://www.w3.org/TR/scxml/#SCXMLEventProcessor'].location"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test501.scxml b/test/w3c/c89/test501.scxml new file mode 100644 index 0000000..e6f0839 --- /dev/null +++ b/test/w3c/c89/test501.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the location entry for the SCXML Event I/O processor can be used as the target for an event --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="_ioprocessors['http://www.w3.org/TR/scxml/#SCXMLEventProcessor'].location"/> + </datamodel> + <state id="s0"> + <onentry> + <send targetexpr="Var1" event="foo"/> + <send event="timeout" delay="2s"/> + </onentry> + <transition event="foo" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test503.scxml b/test/w3c/c89/test503.scxml new file mode 100644 index 0000000..b4a31d0 --- /dev/null +++ b/test/w3c/c89/test503.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a targetless transition does not exit and reenter its source state --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s1" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + <!-- how often we have exited s2 --> + <data id="Var2" expr="0"/> + <!-- how often the targetless transition in s2 has been executed --> + </datamodel> + <state id="s1"> + <onentry> + <raise event="foo"/> + <raise event="bar"/> + </onentry> + <transition target="s2"/> + </state> + <state id="s2"> + <onexit> + <assign location="Var1" expr="Var1 + 1"/> + </onexit> + <transition event="foo"> + <assign location="Var2" expr="Var2 + 1"/> + </transition> + <!-- make sure the transition on foo was actually taken --> + <transition event="bar" cond="Var2==1" target="s3"/> + <transition event="bar" target="fail"/> + </state> + <state id="s3"> + <!-- make sure that s2 was exited only once --> + <transition cond="Var1==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test504.scxml b/test/w3c/c89/test504.scxml new file mode 100644 index 0000000..4687674 --- /dev/null +++ b/test/w3c/c89/test504.scxml @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an external transition exits all states up the the LCCA --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s1" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + <!-- how often we have exited p --> + <data id="Var2" expr="0"/> + <!-- how often we have exited ps1 --> + <data id="Var3" expr="0"/> + <!-- how often we have exited ps2 --> + <data id="Var4" expr="0"/> + <!-- how often the transition for foo has been taken --> + <data id="Var5" expr="0"/> + <!-- how often we have exited s2 --> + </datamodel> + <state id="s1"> + <onentry> + <raise event="foo"/> + <raise event="bar"/> + </onentry> + <transition target="p"/> + </state> + <state id="s2"> + <onexit> + <assign location="Var5" expr="Var5 + 1"/> + </onexit> + <parallel id="p"> + <onexit> + <assign location="Var1" expr="Var1 + 1"/> + </onexit> + <transition event="foo" target="ps1"> + <assign location="Var4" expr="Var4 + 1"/> + </transition> + <!-- make sure the transition on foo was actually taken --> + <transition event="bar" cond="Var4==1" target="s3"/> + <transition event="bar" target="fail"/> + <state id="ps1"> + <onexit> + <assign location="Var2" expr="Var2 + 1"/> + </onexit> + </state> + <state id="ps2"> + <onexit> + <assign location="Var3" expr="Var3 + 1"/> + </onexit> + </state> + </parallel> + </state> + <state id="s3"> + <!-- make sure that p was exited twice --> + <transition cond="Var1==2" target="s4"/> + <transition target="fail"/> + </state> + <state id="s4"> + <!-- make sure that ps1 was exited twice --> + <transition cond="Var2==2" target="s5"/> + <transition target="fail"/> + </state> + <state id="s5"> + <!-- make sure that ps2 was exited twice --> + <transition cond="Var3==2" target="s6"/> + <transition target="fail"/> + </state> + <state id="s6"> + <!-- make sure that s1 was exited once --> + <transition cond="Var5==1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test505.scxml b/test/w3c/c89/test505.scxml new file mode 100644 index 0000000..efaee37 --- /dev/null +++ b/test/w3c/c89/test505.scxml @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an internal transition does not exit its source state --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s1" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + <!-- how often we have exited s1 --> + <data id="Var2" expr="0"/> + <!-- how often we have exited s11 --> + <data id="Var3" expr="0"/> + <!-- how often the transition for foo has been taken --> + </datamodel> + <state id="s1"> + <onentry> + <raise event="foo"/> + <raise event="bar"/> + </onentry> + <onexit> + <assign location="Var1" expr="Var1 + 1"/> + </onexit> + <transition event="foo" type="internal" target="s11"> + <assign location="Var3" expr="Var3 + 1"/> + </transition> + <!-- make sure the transition on foo was actually taken --> + <transition event="bar" cond="Var3==1" target="s2"/> + <transition event="bar" target="fail"/> + <state id="s11"> + <onexit> + <assign location="Var2" expr="Var2 + 1"/> + </onexit> + </state> + </state> + <state id="s2"> + <!-- make sure that s1 was exited once --> + <transition cond="Var1==1" target="s3"/> + <transition target="fail"/> + </state> + <state id="s3"> + <!-- make sure that s11 was exited twice --> + <transition cond="Var2==2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test506.scxml b/test/w3c/c89/test506.scxml new file mode 100644 index 0000000..71c1e0c --- /dev/null +++ b/test/w3c/c89/test506.scxml @@ -0,0 +1,56 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an internal transition whose targets are not proper descendants of its source state +behaves like an external transition --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s1" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + <!-- how often we have exited s2 --> + <data id="Var2" expr="0"/> + <!-- how often we have exited s21 --> + <data id="Var3" expr="0"/> + <!-- how often the transition for foo has been taken --> + </datamodel> + <state id="s1"> + <onentry> + <raise event="foo"/> + <raise event="bar"/> + </onentry> + <transition target="s2"/> + </state> + <state id="s2" initial="s21"> + <onexit> + <assign location="Var1" expr="Var1 + 1"/> + </onexit> + <transition event="foo" type="internal" target="s2"> + <assign location="Var3" expr="Var3 + 1"/> + </transition> + <!-- make sure the transition on foo was actually taken --> + <transition event="bar" cond="Var3==1" target="s3"/> + <transition event="bar" target="fail"/> + <state id="s21"> + <onexit> + <assign location="Var2" expr="Var2 + 1"/> + </onexit> + </state> + </state> + <state id="s3"> + <!-- make sure that s2 was exited twice --> + <transition cond="Var1==2" target="s4"/> + <transition target="fail"/> + </state> + <state id="s4"> + <!-- make sure that s21 was exited twice --> + <transition cond="Var2==2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test509.scxml b/test/w3c/c89/test509.scxml new file mode 100644 index 0000000..8da83ce --- /dev/null +++ b/test/w3c/c89/test509.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that Basic HTTP Event I/O processor uses POST method and that it can receive messages +at the accessURI --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + </onentry> + <!-- if the event was send by http and we get it, we succeed --> + <transition event="test" cond="_event.raw.search('POST') !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test510.scxml b/test/w3c/c89/test510.scxml new file mode 100644 index 0000000..a2ac69b --- /dev/null +++ b/test/w3c/c89/test510.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that Basic HTTP messages go into external queue. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + <!-- this creates an internal event --> + <raise event="internal"/> + </onentry> + <!-- we should get 'internal' first, then 'test' --> + <transition event="internal" target="s1"/> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition event="test" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test518.scxml b/test/w3c/c89/test518.scxml new file mode 100644 index 0000000..219f9ca --- /dev/null +++ b/test/w3c/c89/test518.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that namelist values get encoded as POST parameters. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1" expr="2"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors['basichttp']['location']" namelist="Var1" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + </onentry> + <transition event="test" cond="_event.raw.search(/Var1=2/) !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test519.scxml b/test/w3c/c89/test519.scxml new file mode 100644 index 0000000..694cc7d --- /dev/null +++ b/test/w3c/c89/test519.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that <param> values get encoded as POST parameters. . --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <param name="param1" expr="1"/> + </send> + </onentry> + <!-- if other end sends us back this event, we succeed --> + <transition event="test" cond="_event.raw.search('param1=1') !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test520.scxml b/test/w3c/c89/test520.scxml new file mode 100644 index 0000000..34f0981 --- /dev/null +++ b/test/w3c/c89/test520.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that <content> gets sent as the body of the message. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <content>this is some content</content> + </send> + </onentry> + <!-- if other end sends us back this event, we succeed. Test for two common + ways of encoding --> + <transition event="HTTP.POST" cond="_event.raw.search(/this+is+some+content/) !== -1" target="pass"/> + <transition event="HTTP.POST" cond="_event.raw.search(/this%20is%20some%20content/) !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test521.scxml b/test/w3c/c89/test521.scxml new file mode 100644 index 0000000..86f70e8 --- /dev/null +++ b/test/w3c/c89/test521.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the processor raises error.communication if it cannot dispatch the event. +(To create an undispatchable event, we choose a non-existent session as target). If it raises +the error event, we succeed. Otherwise we eventually timeout and fail. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <!-- should cause an error --> + <send target="#_scxml_foo" event="event2"/> + <!-- this will get added to the external event queue after the error has been raised --> + <send event="timeout"/> + </onentry> + <!-- once we've entered the state, we should check for internal events first --> + <transition event="error.communication" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test522.scxml b/test/w3c/c89/test522.scxml new file mode 100644 index 0000000..33bd84d --- /dev/null +++ b/test/w3c/c89/test522.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that location field the entry for Basic HTTP Event I/O processor can be used +to send a message to the processor --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor" targetexpr="_ioprocessors['basichttp']['location']"/> + </onentry> + <!-- the event we receive should be called 'test', but that's not actually + required for this test. Only that the send deliver some event to us. So if + we get something other than timeout or error, we call it success --> + <transition event="timeout" target="fail"/> + <transition event="error" target="fail"/> + <transition event="*" target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test525.scxml b/test/w3c/c89/test525.scxml new file mode 100644 index 0000000..866abdb --- /dev/null +++ b/test/w3c/c89/test525.scxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that <foreach> does a shallow copy, so that modifying the array does not change +the iteration behavior. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1"> + [1,2,3] + </data> + <data id="Var2" expr="0"/> + <!-- counts the number of iterations --> + </datamodel> + <state id="s0"> + <onentry> + <foreach item="Var3" array="Var1"> + <assign location="Var1" expr="[].concat(Var1, [4])"/> + <assign location="Var2" expr="Var2 + 1"/> + </foreach> + </onentry> + <transition cond="Var2==3" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test527.scxml b/test/w3c/c89/test527.scxml new file mode 100644 index 0000000..0256de9 --- /dev/null +++ b/test/w3c/c89/test527.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- simple test that 'expr' works with <content> --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <state id="s0" initial="s01"> + <transition event="done.state.s0" cond="_event.data == 'foo'" target="pass"> + </transition> + <transition event="done.state.s0" target="fail"> + </transition> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <content expr="&foo&"/> + </donedata> + </final> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test528.scxml b/test/w3c/c89/test528.scxml new file mode 100644 index 0000000..07475e3 --- /dev/null +++ b/test/w3c/c89/test528.scxml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that illegal 'expr' produces error.execution and empty event.data --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <state id="s0" initial="s01"> + <!-- we should get the error before the done event --> + <transition event="error.execution" target="s1"/> + <transition event="done.state.s0" target="fail"/> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <content expr="return"/> + </donedata> + </final> + </state> + <!-- if we get here, we received the error event. Now check that the done + event has empty event.data --> + <state id="s1"> + <transition event="done.state.s0" cond="typeof _event.data === 'undefined'" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test529.scxml b/test/w3c/c89/test529.scxml new file mode 100644 index 0000000..5c6bb75 --- /dev/null +++ b/test/w3c/c89/test529.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- simple test that children workn with <content> --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" datamodel="c89" initial="s0"> + <state id="s0" initial="s01"> + <transition event="done.state.s0" cond="_event.data == 21" target="pass"> + </transition> + <transition event="done.state.s0" target="fail"> + </transition> + <state id="s01"> + <transition target="s02"/> + </state> + <final id="s02"> + <donedata> + <content>21</content> + </donedata> + </final> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test530.scxml b/test/w3c/c89/test530.scxml new file mode 100644 index 0000000..5d79d4b --- /dev/null +++ b/test/w3c/c89/test530.scxml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that <content> child is evaluated when <invoke> is. Var1 is initialized +with an integer value, then set to an scxml script in the onentry to s0. If <content> +is evaluated at the right time, we should get invoke.done, otherwise an error --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="1"/> + </datamodel> + <state id="s0"> + <onentry> + <assign location="Var1"> + <scxml version="1.0"> + <final/> + </scxml> + </assign> + <send event="timeout" delay="2s"/> + </onentry> + <invoke type="http://www.w3.org/TR/scxml/"> + <content expr="Var1"/> + </invoke> + <transition event="done.invoke" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test531.scxml b/test/w3c/c89/test531.scxml new file mode 100644 index 0000000..a01aad7 --- /dev/null +++ b/test/w3c/c89/test531.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that the value of the <param> _scxmleventname gets used as the name +of the raised event. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + <send targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <param name="_scxmleventname" expr="&test&"/> + </send> + </onentry> + <!-- if we get an event named 'test' we succeed. Otherwise fail --> + <transition event="test" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test532.scxml b/test/w3c/c89/test532.scxml new file mode 100644 index 0000000..fda7b9e --- /dev/null +++ b/test/w3c/c89/test532.scxml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that if _scxmleventname is not present, the name of the HTTP method is used +as the name of the resulting event. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + <send targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <!-- this content will be ignored, but it's here to make sure we have a message body --> + <content>some content</content> + </send> + </onentry> + <transition event="HTTP.POST" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test533.scxml b/test/w3c/c89/test533.scxml new file mode 100644 index 0000000..c29fb27 --- /dev/null +++ b/test/w3c/c89/test533.scxml @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that an internal transition whose source state is not compound does exit its source state --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s1" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + <!-- how often we have exited p --> + <data id="Var2" expr="0"/> + <!-- how often we have exited ps1 --> + <data id="Var3" expr="0"/> + <!-- how often we have exited ps2 --> + <data id="Var4" expr="0"/> + <!-- how often the transition for foo has been taken --> + </datamodel> + <state id="s1"> + <onentry> + <raise event="foo"/> + <raise event="bar"/> + </onentry> + <transition target="p"/> + </state> + <parallel id="p"> + <onexit> + <assign location="Var1" expr="Var1 + 1"/> + </onexit> + <transition event="foo" type="internal" target="ps1"> + <assign location="Var4" expr="Var4 + 1"/> + </transition> + <!-- make sure the transition on foo was actually taken --> + <transition event="bar" cond="Var4==1" target="s2"/> + <transition event="bar" target="fail"/> + <state id="ps1"> + <onexit> + <assign location="Var2" expr="Var2 + 1"/> + </onexit> + </state> + <state id="ps2"> + <onexit> + <assign location="Var3" expr="Var3 + 1"/> + </onexit> + </state> + </parallel> + <state id="s2"> + <!-- make sure that p was exited twice --> + <transition cond="Var1==2" target="s3"/> + <transition target="fail"/> + </state> + <state id="s3"> + <!-- make sure that ps1 was exited twice --> + <transition cond="Var2==2" target="s4"/> + <transition target="fail"/> + </state> + <state id="s4"> + <!-- make sure that ps2 was exited twice --> + <transition cond="Var3==2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test534.scxml b/test/w3c/c89/test534.scxml new file mode 100644 index 0000000..9256fe1 --- /dev/null +++ b/test/w3c/c89/test534.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that <send> 'event' value gets sent as the param _scxmleventname . --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <send event="timeout" delay="30s"/> + <send event="test" targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + </send> + </onentry> + <!-- if other end sends us back this event, we succeed --> + <transition event="test" cond="_event.raw.search('_scxmleventname=test') !== -1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test537.scxml b/test/w3c/c89/test537.scxml new file mode 100644 index 0000000..bdde730 --- /dev/null +++ b/test/w3c/c89/test537.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the root element of the datamodel is <datamodel> and that <data> elements are its +children--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="foo" expr="2"/> + </datamodel> + <state id="s0"> + <transition cond="local-name($foo/..)='datamodel'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test539.scxml b/test/w3c/c89/test539.scxml new file mode 100644 index 0000000..78ac02f --- /dev/null +++ b/test/w3c/c89/test539.scxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that if the child of <data> is XML, or if XML is loaded via src=, the processor + assigns it as the value of the var --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="var1"> + <books xmlns=""> + <book title="title1"/> + <book title="title2"/> + </books> + </data> + <data id="var2" src="file:test539.txt"/> + </datamodel> + <state id="s0"> + <transition cond="$var1/books/book[2]/@title = 'title2'" target="s1"/> + <transition target="fail"/> + </state> + <state id="s1"> + <transition cond="$var2/books/book[2]/@title = 'title2'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test540.scxml b/test/w3c/c89/test540.scxml new file mode 100644 index 0000000..6f32ce2 --- /dev/null +++ b/test/w3c/c89/test540.scxml @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that if the child of <data> is a string or if a string is loaded via src=, the processor + does white space normalization on it and assigns it as the value of the var --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="var1">123 +4 5 +</data> + <data id="var2" src="file:test540.txt"/> + </datamodel> + <state id="s0"> + <onentry> + <log label="var1 " expr="$var1"/> + </onentry> + <transition cond="$var1 = '123 4 5' and $var2 = '123 4 5'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test542.scxml b/test/w3c/c89/test542.scxml new file mode 100644 index 0000000..c3ff728 --- /dev/null +++ b/test/w3c/c89/test542.scxml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that <content> inside <donedata> handles XML and strings, + including white space normalization. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <state id="s0" initial="s01"> + <transition event="done.state.s0" cond="$_event/data/books/book[1]/@title = 'title1'" target="s1"/> + <transition event="done" target="fail"/> + <final id="s01"> + <donedata> + <content> + <books xmlns=""> + <book title="title1"/> + <book title="title2"/> + </books> + </content> + </donedata> + </final> + </state> + <state id="s1" initial="s11"> + <transition event="done.state.s1" cond="$_event/data = '123 4 5'" target="pass"/> + <transition event="done" target="fail"/> + <final id="s11"> + <donedata> + <content>123 +4 5 + </content> + </donedata> + </final> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test543.scxml b/test/w3c/c89/test543.scxml new file mode 100644 index 0000000..c22b769 --- /dev/null +++ b/test/w3c/c89/test543.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that event fields are present as children of _event --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" name="scxmltest" initial="s0" version="1.0" datamodel="xpath"> + <state id="s0"> + <onentry> + <!-- event isn't bound until an event is raised --> + <raise event="someevent"/> + </onentry> + <!-- origintype sendid, invokeid and data will not be bound in this event. name, type, and origin + are guaranteed to be there. --> + <transition event="*" cond="$_event/name and $_event/origin and $_event/type" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test544.scxml b/test/w3c/c89/test544.scxml new file mode 100644 index 0000000..0e57ac2 --- /dev/null +++ b/test/w3c/c89/test544.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that kvps are represented as <data> elements under event/data --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" name="scxmltest" initial="s0" version="1.0" datamodel="xpath"> + <state id="s0"> + <onentry> + <send event="someevent"> + <param name="key1" expr="2"/> + </send> + </onentry> + <transition event="*" cond="$_event/data/data[@id='key1'] = 2" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test545.scxml b/test/w3c/c89/test545.scxml new file mode 100644 index 0000000..e06445a --- /dev/null +++ b/test/w3c/c89/test545.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that xml content in send is place as XML under event/data --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" name="scxmltest" initial="s0" version="1.0" datamodel="xpath"> + <state id="s0"> + <onentry> + <send event="someevent"> + <content> + <foo xmlns=""> + <bar>3</bar> + </foo> + </content> + </send> + </onentry> + <transition event="*" cond="$_event/data/foo/bar = 3" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test546.scxml b/test/w3c/c89/test546.scxml new file mode 100644 index 0000000..d2bfa13 --- /dev/null +++ b/test/w3c/c89/test546.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that string content in send is place as a string under event/data --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" name="scxmltest" initial="s0" version="1.0" datamodel="xpath"> + <state id="s0"> + <onentry> + <send event="someevent"> + <content>some string</content> + </send> + </onentry> + <transition event="*" cond="$_event/data = 'some string'" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test547.scxml b/test/w3c/c89/test547.scxml new file mode 100644 index 0000000..f004e68 --- /dev/null +++ b/test/w3c/c89/test547.scxml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that assiging to a node set performs the assignment to each node. + This example is taken from the spec. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" name="scxmltest" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="cart"> + <myCart xmlns=""> + <books> + <book> + <title>The Zen Mind</title> + </book> + <book> + <title>Freakonomics</title> + </book> + </books> + <cds> + <cd name="Something"/> + </cds> + </myCart> + </data> + </datamodel> + <state id="s0"> + <onentry> + <assign location="$cart/myCart/books/book" expr="'The Zen Mind'"/> + </onentry> + <transition cond="$cart/myCart/books/book[1] = 'The Zen Mind' and $cart/myCart/books/book[2] = 'The Zen Mind'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test550.scxml b/test/w3c/c89/test550.scxml new file mode 100644 index 0000000..8d3c287 --- /dev/null +++ b/test/w3c/c89/test550.scxml @@ -0,0 +1,23 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that expr can be used to assign a value to a var. This test uses early binding --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89" binding="early"> + <state id="s0"> + <transition cond="Var1==2" target="pass"/> + <transition target="fail"/> + </state> + <state id="s1"> + <datamodel> + <data id="Var1" expr="2"/> + </datamodel> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test551.scxml b/test/w3c/c89/test551.scxml new file mode 100644 index 0000000..fb2d419 --- /dev/null +++ b/test/w3c/c89/test551.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that inline content can be used to assign a value to a var. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" binding="early" datamodel="c89"> + <state id="s0"> + <transition cond="Var1" target="pass"/> + <transition target="fail"/> + </state> + <state id="s1"> + <datamodel> + <data id="Var1"> + [1,2,3] + </data> + </datamodel> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test552.scxml b/test/w3c/c89/test552.scxml new file mode 100644 index 0000000..bddbfe2 --- /dev/null +++ b/test/w3c/c89/test552.scxml @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that src content can be used to assign a value to a var. Edit +test552.txt to have a value that's legal for the datamodel in question --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <datamodel> + <data id="Var1" src="file:test552.txt"/> + </datamodel> + <state id="s0"> + <transition cond="Var1" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test553.scxml b/test/w3c/c89/test553.scxml new file mode 100644 index 0000000..c682acb --- /dev/null +++ b/test/w3c/c89/test553.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- we test that the processor does not dispatch the event if evaluation +of <send>'s args causes an error.. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <!-- timeout event --> + <send event="timeout" delayexpr="&1s&"/> + <!-- generate an invalid namelist --> + <send event="event1" namelist=""foo"/> + </onentry> + <!-- if we get the timeout before event1, we assume that event1 hasn't been sent + We ignore the error event here because this assertion doesn't mention it --> + <transition event="timeout" target="pass"/> + <transition event="event1" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test554.scxml b/test/w3c/c89/test554.scxml new file mode 100644 index 0000000..62536f5 --- /dev/null +++ b/test/w3c/c89/test554.scxml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that if the evaluation of <invoke>'s args causes an error, the +invocation is cancelled. In this test, that means that we don't get done.invoke +before the timer goes off. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="c89"> + <state id="s0"> + <onentry> + <send event="timer" delayexpr="&1s&"/> + </onentry> + <!-- reference an invalid namelist --> + <invoke type="http://www.w3.org/TR/scxml/" namelist=""foo"> + <content> + <scxml initial="subFinal" version="1.0" datamodel="c89"> + <final id="subFinal"/> + </scxml> + </content> + </invoke> + <transition event="timer" target="pass"/> + <transition event="done.invoke" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test555.scxml b/test/w3c/c89/test555.scxml new file mode 100644 index 0000000..475ffac --- /dev/null +++ b/test/w3c/c89/test555.scxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- in the XPATH data model, test that processor coerces types to produce a string + where it's needed --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <datamodel> + <data id="var1"> + <books xmlns=""> + <book title="title1"/> + <book title="title2"/> + </books> + </data> + </datamodel> + <state id="s0"> + <onentry> + <send eventexpr="$var1"/> + </onentry> + <transition event="error" target="fail"/> + <!-- don't really know what the stringification of that xml structure should be, but if + we get something other than an error, we assume that it worked. --> + <transition event="*" target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test557.scxml b/test/w3c/c89/test557.scxml new file mode 100644 index 0000000..75ea35a --- /dev/null +++ b/test/w3c/c89/test557.scxml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- in the ECMA data model, test that if the child of <data> is XML, or if XML is loaded via src=, the processor + assigns it as the value of the var --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + <datamodel> + <data id="var1"> + <books xmlns=""> + <book title="title1"/> + <book title="title2"/> + </books> + </data> + <data id="var2" src="file:test557.txt"/> + </datamodel> + <state id="s0"> + <transition cond="var1.getElementsByTagName('book')[0].getAttribute('title') == 'title1'" target="s1"/> + <transition target="fail"/> + </state> + <state id="s1"> + <transition cond="var2.getElementsByTagName('book')[1].getAttribute('title') == 'title2'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test558.scxml b/test/w3c/c89/test558.scxml new file mode 100644 index 0000000..7cb5c01 --- /dev/null +++ b/test/w3c/c89/test558.scxml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- in the ECMA data model, test that if the child of <data> is not XML, or if XML is loaded via src=, + the processor treats the value as a string, does whitespace normalization and assigns it to the var.--> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + <datamodel> + <data id="var1"> +this is +a string +</data> + <data id="var2" src="file:test558.txt"/> + </datamodel> + <state id="s0"> + <transition cond="var1 == 'this is a string'" target="s1"/> + <transition target="fail"/> + </state> + <state id="s1"> + <transition cond="var2 == 'this is a string'" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test560.scxml b/test/w3c/c89/test560.scxml new file mode 100644 index 0000000..bb571b3 --- /dev/null +++ b/test/w3c/c89/test560.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- in the ECMA data model, test that processor creates correct structure in + _event.data when receiving KVPs in an event --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + <state id="s0"> + <onentry> + <send event="foo"> + <param name="aParam" expr="1"/> + </send> + </onentry> + <transition event="foo" cond="_event.data.aParam == 1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test561.scxml b/test/w3c/c89/test561.scxml new file mode 100644 index 0000000..2949275 --- /dev/null +++ b/test/w3c/c89/test561.scxml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- in the ECMA data model, test that processor creates an ECMAScript DOM object + _event.data when receiving XML in an event --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + <state id="s0"> + <onentry> + <send event="foo"> + <content> + <books xmlns=""> + <book title="title1"/> + <book title="title2"/> + </books> + </content> + </send> + </onentry> + <transition event="foo" cond="_event.data.getElementsByTagName('book')[1].getAttribute('title') == 'title2'" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test562.scxml b/test/w3c/c89/test562.scxml new file mode 100644 index 0000000..22be678 --- /dev/null +++ b/test/w3c/c89/test562.scxml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- in the ECMA data model, test that processor creates space normalized string in + _event.data when receiving anything other than KVPs or XML in an event --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + <state id="s0"> + <onentry> + <send event="foo"> + <content> +this is a +string +</content> + </send> + </onentry> + <transition event="foo" cond="_event.data == 'this is a string'" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test567.scxml b/test/w3c/c89/test567.scxml new file mode 100644 index 0000000..1add4ab --- /dev/null +++ b/test/w3c/c89/test567.scxml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that any content in the message other than _scxmleventname is used to populate +_event.data. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1" expr="2"/> + </datamodel> + <state id="s0"> + <onentry> + <send event="timeout" delay="3s"/> + <!-- in this case, 'test' will be placed in _scxmleventname. The <param> should + be used to populate _event.data --> + <send event="test" targetexpr="_ioprocessors['basichttp']['location']" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"> + <param name="param1" expr="2"/> + </send> + </onentry> + <!-- if we get this event, we succeed --> + <transition event="test" target="s1"> + <assign location="Var1" expr="_event.data.param1"/> + </transition> + <transition event="*" target="fail"/> + </state> + <state id="s1"> + <transition cond="Var1==2" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test568.scxml b/test/w3c/c89/test568.scxml new file mode 100644 index 0000000..ab48af6 --- /dev/null +++ b/test/w3c/c89/test568.scxml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that location field is found inside entry for SCXML Event I/O processor in the XPath +data model. The tests for the relevant event i/o processors will test that it can be used to +send events. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="xpath"> + <state id="s0"> + <transition cond="$_ioprocessors/[@name='http://www.w3.org/TR/scxml/#SCXMLEventProcessor']/location/text()" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test569.scxml b/test/w3c/c89/test569.scxml new file mode 100644 index 0000000..c6e2158 --- /dev/null +++ b/test/w3c/c89/test569.scxml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that location field is found inside entry for SCXML Event I/O processor in the ECMAScript +data model. The tests for the relevant event i/o processors will test that it can be used to +send events. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + <state id="s0"> + <transition cond="_ioprocessors['scxml'].location" target="pass"/> + <transition target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test570.scxml b/test/w3c/c89/test570.scxml new file mode 100644 index 0000000..5c8dd92 --- /dev/null +++ b/test/w3c/c89/test570.scxml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that we generate done.state.id when all a parallel state's children are in final states --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="p0" datamodel="c89" version="1.0"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <parallel id="p0"> + <onentry> + <send event="timeout" delay="2s"/> + <raise event="e1"/> + <raise event="e2"/> + </onentry> + <!-- record that we get the first done event --> + <transition event="done.state.p0s1"> + <assign location="Var1" expr="1"/> + </transition> + <!-- we should get the second done event before done.state.p0 --> + <transition event="done.state.p0s2" target="s1"/> + <transition event="timeout" target="fail"/> + <state id="p0s1" initial="p0s11"> + <state id="p0s11"> + <transition event="e1" target="p0s1final"/> + </state> + <final id="p0s1final"/> + </state> + <state id="p0s2" initial="p0s21"> + <state id="p0s21"> + <transition event="e2" target="p0s2final"/> + </state> + <final id="p0s2final"/> + </state> + </parallel> + <state id="s1"> + <!-- if we get done.state.p0, success --> + <transition event="done.state.p0" cond="Var1==1" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test576.scxml b/test/w3c/c89/test576.scxml new file mode 100644 index 0000000..8f61ad2 --- /dev/null +++ b/test/w3c/c89/test576.scxml @@ -0,0 +1,43 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that the 'initial' value of scxml is respected. We set the value to deeply nested non-default parallel siblings and +test that both are entered. --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s11p112 s11p122" datamodel="c89" version="1.0"> + <state id="s0"> + <transition target="fail"/> + </state> + <state id="s1"> + <onentry> + <send event="timeout" delay="1s"/> + </onentry> + <transition event="timeout" target="fail"/> + <state id="s11" initial="s111"> + <state id="s111"/> + <parallel id="s11p1"> + <state id="s11p11" initial="s11p111"> + <state id="s11p111"/> + <state id="s11p112"> + <onentry> + <raise event="In-s11p112"/> + </onentry> + </state> + </state> + <state id="s11p12" initial="s11p121"> + <state id="s11p121"/> + <state id="s11p122"> + <transition event="In-s11p112" target="pass"/> + </state> + </state> + </parallel> + </state> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test577.scxml b/test/w3c/c89/test577.scxml new file mode 100644 index 0000000..41c3406 --- /dev/null +++ b/test/w3c/c89/test577.scxml @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that that <send> without target in basichttp event i/o processor +causes error.communication to get added to internal queue . --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" datamodel="c89" version="1.0"> + <state id="s0"> + <onentry> + <!-- sent by scxml event i/o processor, added to external queue --> + <send event="event1"/> + <!-- should put error.communication on internal queue --> + <send event="test" type="http://www.w3.org/TR/scxml/#BasicHTTPEventProcessor"/> + </onentry> + <transition event="error.communication" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test578.scxml b/test/w3c/c89/test578.scxml new file mode 100644 index 0000000..3243687 --- /dev/null +++ b/test/w3c/c89/test578.scxml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- in the ECMA data model, test that processor creates an ECMAScript object + _event.data when receiving JSON in an event --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" initial="s0" version="1.0" datamodel="ecmascript"> + <state id="s0"> + <onentry> + <send event="foo"> + <content>{ "productName" : "bar", "size" : 27 }</content> + </send> + </onentry> + <transition event="foo" cond="_event.data.productName == 'bar'" target="pass"/> + <transition event="*" target="fail"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test579.scxml b/test/w3c/c89/test579.scxml new file mode 100644 index 0000000..43cb30d --- /dev/null +++ b/test/w3c/c89/test579.scxml @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that default history content is executed correctly. The Process MUST execute any executable content in the transition after the parent state's onentry handlers, and, in the case where the history pseudo-state is the target of an <initial> transition, +the executable content inside the <initial> transition. However the Processor MUST +execute this content only if there is no stored history. Once the history state's +parent state has been visited and exited, the default history content must not be executed --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="s0" datamodel="c89"> + <state id="s0"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <initial> + <transition target="sh1"> + <raise event="event2"/> + </transition> + </initial> + <onentry> + <send delayexpr="&1s&" event="timeout"/> + <raise event="event1"/> + </onentry> + <onexit> + <assign location="Var1" expr="Var1 + 1"/> + </onexit> + <history id="sh1"> + <transition target="s01"> + <raise event="event3"/> + </transition> + </history> + <state id="s01"> + <transition event="event1" target="s02"/> + <transition event="*" target="fail"/> + </state> + <state id="s02"> + <transition event="event2" target="s03"/> + <transition event="*" target="fail"/> + </state> + <state id="s03"> + <transition cond="Var1==0" event="event3" target="s0"/> + <transition cond="Var1==1" event="event1" target="s2"/> + <transition event="*" target="fail"/> + </state> + </state> + <state id="s2"> + <transition event="event2" target="s3"/> + <transition event="*" target="fail"/> + </state> + <state id="s3"> + <transition event="event3" target="fail"/> + <transition event="timeout" target="pass"/> + </state> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/c89/test580.scxml b/test/w3c/c89/test580.scxml new file mode 100644 index 0000000..e416e9e --- /dev/null +++ b/test/w3c/c89/test580.scxml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- test that a history state never ends up part of the configuration --> +<scxml xmlns="http://www.w3.org/2005/07/scxml" xmlns:conf="http://www.w3.org/2005/scxml-conformance" version="1.0" initial="p1" datamodel="c89"> + <datamodel> + <data id="Var1" expr="0"/> + </datamodel> + <parallel id="p1"> + <onentry> + <send delay="2s" event="timeout"/> + </onentry> + <state id="s0"> + <transition cond="In('sh1')" target="fail"/> + <transition event="timeout" target="fail"/> + </state> + <state id="s1"> + <initial> + <transition target="sh1"/> + </initial> + <history id="sh1"> + <transition target="s11"/> + </history> + <state id="s11"> + <transition cond="In('sh1')" target="fail"/> + <transition target="s12"/> + </state> + <state id="s12"/> + <transition cond="In('sh1')" target="fail"/> + <transition cond="Var1==0" target="sh1"/> + <transition cond="Var1==1" target="pass"/> + <onexit> + <assign location="Var1" expr="Var1 + 1"/> + </onexit> + </state> + </parallel> + <final id="pass"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> + <final id="fail"> + <onentry> + <log label="Outcome" expr="&pass&"/> + </onentry> + </final> +</scxml> diff --git a/test/w3c/confC89.xsl b/test/w3c/confC89.xsl index de55ffd..bd3fa8d 100644 --- a/test/w3c/confC89.xsl +++ b/test/w3c/confC89.xsl @@ -24,7 +24,7 @@ <xsl:template match="conf:pass"> <final xmlns="http://www.w3.org/2005/07/scxml" id="pass"> <onentry> - <log label="Outcome" expr="'pass'"/> + <log label="Outcome" expr="&pass&"/> </onentry> </final> </xsl:template> @@ -38,7 +38,7 @@ <xsl:template match="conf:fail"> <final xmlns="http://www.w3.org/2005/07/scxml" id="fail"> <onentry> - <log label="Outcome" expr="'fail'"/> + <log label="Outcome" expr="&pass&"/> </onentry> </final> </xsl:template> @@ -91,7 +91,7 @@ <!-- expr is quoted --> <xsl:template match="//@conf:quoteExpr"> - <xsl:attribute name="expr">'<xsl:value-of select="." />'</xsl:attribute> + <xsl:attribute name="expr">&<xsl:value-of select="." />&</xsl:attribute> </xsl:template> <!-- an expr that is the value of a variable --> @@ -250,7 +250,7 @@ <!-- computes a delayexpr based on the value passed in. this lets platforms determine how long to delay timeout events which cause the test to fail. The default value provided here is pretty long --> <xsl:template match="//@conf:delay"> - <xsl:attribute name="delayexpr">'<xsl:value-of select="."/>s'</xsl:attribute> + <xsl:attribute name="delayexpr">&<xsl:value-of select="."/>s&</xsl:attribute> </xsl:template> <!-- the specified variable is used as idlocation --> @@ -393,7 +393,7 @@ events which cause the test to fail. The default value provided here is pretty <!-- test that the event's name fieldhas the value specified --> <xsl:template match="//@conf:eventNameVal"> - <xsl:attribute name="cond">_event.name == <xsl:text>'</xsl:text><xsl:value-of select="."/><xsl:text>'</xsl:text> + <xsl:attribute name="cond">_event.name == <xsl:text>&</xsl:text><xsl:value-of select="."/><xsl:text>&</xsl:text> </xsl:attribute> </xsl:template> |