diff options
author | Stefan Radomski <github@mintwerk.de> | 2017-08-01 21:47:10 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2017-08-01 21:47:10 (GMT) |
commit | 045bde78c0587316e0373c7698413412d0f315f9 (patch) | |
tree | f90d4ceb9d48fdc0dc240fce031dc81308e471dd /src/uscxml | |
parent | e0a7e43e2e41639bb50127cc5419b712a7b1f6e2 (diff) | |
download | uscxml-045bde78c0587316e0373c7698413412d0f315f9.zip uscxml-045bde78c0587316e0373c7698413412d0f315f9.tar.gz uscxml-045bde78c0587316e0373c7698413412d0f315f9.tar.bz2 |
Reenabled V8, Debugger tests and smaller fixes
Diffstat (limited to 'src/uscxml')
28 files changed, 2548 insertions, 1674 deletions
diff --git a/src/uscxml/Common.h b/src/uscxml/Common.h index abe4921..7d254be 100644 --- a/src/uscxml/Common.h +++ b/src/uscxml/Common.h @@ -26,7 +26,9 @@ #define ELPP_STACKTRACE_ON_CRASH 1 #endif -#if __cplusplus >= 201402L +#if defined(SWIGIMPORTED) || defined(SWIG) +#define DEPRECATED +#elif __cplusplus >= 201402L #define DEPRECATED [[deprecated]] #elif defined(__GNUC__) #define DEPRECATED __attribute__((deprecated)) @@ -37,6 +39,7 @@ #define DEPRECATED(alternative) #endif + #if defined(_WIN32) && !defined(USCXML_STATIC) # ifdef USCXML_EXPORT # define USCXML_API __declspec(dllexport) diff --git a/src/uscxml/debug/DebugSession.cpp b/src/uscxml/debug/DebugSession.cpp index 42973fc..b5c1605 100644 --- a/src/uscxml/debug/DebugSession.cpp +++ b/src/uscxml/debug/DebugSession.cpp @@ -20,6 +20,7 @@ #include "uscxml/debug/DebugSession.h" #include "uscxml/debug/Debugger.h" #include "uscxml/util/Predicates.h" +#include "uscxml/util/DOM.h" #include "uscxml/interpreter/Logging.h" @@ -440,7 +441,7 @@ Data DebugSession::debugEval(const Data& data) { replyData.compound["reason"] = Data("No datamodel available", Data::VERBATIM); } else { try { - replyData.compound["eval"] = _interpreter.getImpl()->getAsData(expr); + replyData.compound["eval"] = _interpreter.getImpl()->evalAsData(expr); } catch (Event e) { replyData.compound["eval"] = e.data; replyData.compound["eval"].compound["error"] = Data(e.name, Data::VERBATIM); @@ -450,6 +451,37 @@ Data DebugSession::debugEval(const Data& data) { return replyData; } +Data DebugSession::debugEvent(const Data& data) { + Data replyData; + + if (!_interpreter) { + replyData.compound["status"] = Data("failure", Data::VERBATIM); + replyData.compound["reason"] = Data("No interpreter running", Data::VERBATIM); + } else if (!data.hasKey("name")) { + replyData.compound["status"] = Data("failure", Data::VERBATIM); + replyData.compound["reason"] = Data("No event name given", Data::VERBATIM); + return replyData; + } + try { + Event event(data.at("name").atom); + if (data.hasKey("data")) { + event.data = data.at("data"); + } + // TODO: this should not be necessary - initialize lazily + if (_interpreter.getState() == USCXML_INSTANTIATED) { + _interpreter.step(); + } + _interpreter.receive(event); + + } catch (Event e) { + replyData.compound["eval"] = e.data; + replyData.compound["eval"].compound["error"] = Data(e.name, Data::VERBATIM); + } + replyData.compound["status"] = Data("success", Data::VERBATIM); + + return replyData; +} + std::shared_ptr<LoggerImpl> DebugSession::create() { return shared_from_this(); } diff --git a/src/uscxml/debug/DebugSession.h b/src/uscxml/debug/DebugSession.h index e258568..ab4d79d 100644 --- a/src/uscxml/debug/DebugSession.h +++ b/src/uscxml/debug/DebugSession.h @@ -68,6 +68,7 @@ public: Data disableAllBreakPoints(); Data getIssues(); Data debugEval(const Data& data); + Data debugEvent(const Data& data); void setDebugger(Debugger* debugger) { _debugger = debugger; diff --git a/src/uscxml/debug/DebuggerServlet.cpp b/src/uscxml/debug/DebuggerServlet.cpp index 74853f4..8a7e087 100644 --- a/src/uscxml/debug/DebuggerServlet.cpp +++ b/src/uscxml/debug/DebuggerServlet.cpp @@ -106,8 +106,8 @@ bool DebuggerServlet::requestFromHTTP(const HTTPServer::Request& request) { } else if (boost::istarts_with(request.data.at("path").atom, "/debug/connect")) { processConnect(request); return true; - } else if (boost::starts_with(request.data.at("path").atom, "/debug/sessions")) { - processListSessions(request); + } else if (boost::starts_with(request.data.at("path").atom, "/debug/instances")) { + processListInstances(request); return true; } @@ -168,6 +168,8 @@ bool DebuggerServlet::requestFromHTTP(const HTTPServer::Request& request) { replyData = session->debugResume(request.data["content"]); } else if (boost::starts_with(request.data.at("path").atom, "/debug/eval")) { replyData = session->debugEval(request.data["content"]); + } else if (boost::starts_with(request.data.at("path").atom, "/debug/event")) { + replyData = session->debugEvent(request.data["content"]); } if (!replyData.empty()) { @@ -220,7 +222,7 @@ void DebuggerServlet::processDisconnect(const HTTPServer::Request& request) { returnData(request, replyData); } -void DebuggerServlet::processListSessions(const HTTPServer::Request& request) { +void DebuggerServlet::processListInstances(const HTTPServer::Request& request) { Data replyData; std::map<std::string, std::weak_ptr<InterpreterImpl> > instances = InterpreterImpl::getInstances(); @@ -234,7 +236,7 @@ void DebuggerServlet::processListSessions(const HTTPServer::Request& request) { sessionData.compound["source"] = Data(instance->getBaseURL(), Data::VERBATIM); sessionData.compound["xml"].node = instance->getDocument(); - replyData.compound["sessions"].array.push_back(sessionData); + replyData.compound["instances"].array.push_back(sessionData); } } diff --git a/src/uscxml/debug/DebuggerServlet.h b/src/uscxml/debug/DebuggerServlet.h index 4cd04bb..674d842 100644 --- a/src/uscxml/debug/DebuggerServlet.h +++ b/src/uscxml/debug/DebuggerServlet.h @@ -48,7 +48,7 @@ public: void processDisconnect(const HTTPServer::Request& request); void processConnect(const HTTPServer::Request& request); - void processListSessions(const HTTPServer::Request& request); + void processListInstances(const HTTPServer::Request& request); void processIssues(const HTTPServer::Request& request); diff --git a/src/uscxml/debug/InterpreterIssue.cpp b/src/uscxml/debug/InterpreterIssue.cpp index 346c0f6..f3620be 100644 --- a/src/uscxml/debug/InterpreterIssue.cpp +++ b/src/uscxml/debug/InterpreterIssue.cpp @@ -767,7 +767,9 @@ NEXT_SET: for (auto iter = scripts.begin(); iter != scripts.end(); iter++) { DOMElement* script = *iter; - if (HAS_ATTR(script, kXMLCharSource) && script->getChildNodes()->getLength() > 0) { + if (HAS_ATTR(script, kXMLCharSource) && + script->getChildNodes()->getLength() > 0 && + script->getUserData(X("downladed")) == NULL) { issues.push_back(InterpreterIssue("Script element cannot have src attribute and children", script, InterpreterIssue::USCXML_ISSUE_WARNING)); } } diff --git a/src/uscxml/interpreter/BasicContentExecutor.cpp b/src/uscxml/interpreter/BasicContentExecutor.cpp index 87c2180..7b62fd4 100644 --- a/src/uscxml/interpreter/BasicContentExecutor.cpp +++ b/src/uscxml/interpreter/BasicContentExecutor.cpp @@ -251,7 +251,7 @@ void BasicContentExecutor::processAssign(XERCESC_NS::DOMElement* content) { additionalAttr[X(attr->getNodeName()).str()] = X(attr->getNodeValue()).str(); } - _callbacks->assign(location, elementAsData(content, true), additionalAttr); + _callbacks->assign(location, elementAsData(content), additionalAttr); } void BasicContentExecutor::processForeach(XERCESC_NS::DOMElement* content) { @@ -545,7 +545,12 @@ void BasicContentExecutor::raiseDoneEvent(XERCESC_NS::DOMElement* state, XERCESC // content std::list<DOMElement*> contents = DOMUtils::filterChildElements(XML_PREFIX(doneData).str() + "content", doneData); if (contents.size() > 0) { - doneEvent.data = elementAsData(contents.front()); + if (HAS_ATTR(contents.front(), kXMLCharExpr) && + !_callbacks->isLegalDataValue(ATTR(contents.front(), kXMLCharExpr))) { + ERROR_EXECUTION_THROW2("Expression '" + ATTR(contents.front(), kXMLCharExpr) + "' is not a legal data value", contents.front()); + } else { + doneEvent.data = elementAsData(contents.front()); + } } } catch (ErrorEvent e) { ERROR_EXECUTION_RETHROW(e, "Syntax error in donedata element content", doneData); @@ -594,15 +599,14 @@ void BasicContentExecutor::processParams(std::multimap<std::string, Data>& param } } -Data BasicContentExecutor::elementAsData(XERCESC_NS::DOMElement* element, bool asExpression) { +Data BasicContentExecutor::elementAsData(XERCESC_NS::DOMElement* element) { // element with expr if (HAS_ATTR(element, kXMLCharExpr)) { - std::string expr = ATTR(element, kXMLCharExpr); - if (_callbacks->isLegalDataValue(expr)) { - return Data(expr, Data::INTERPRETED); - } else { - ERROR_EXECUTION_THROW2("Expression '" + expr + "' is not a legal data value", element); - } + // we cannot throw here: + // - with init, we need to check in the datamodel + // - with content, we need to invoke isLegalDataValue later + // test 277, 528 + return Data(ATTR(element, kXMLCharExpr), Data::INTERPRETED); } // element with external src - this ought to behave just as with child nodes below diff --git a/src/uscxml/interpreter/BasicContentExecutor.h b/src/uscxml/interpreter/BasicContentExecutor.h index 469c28e..de756dc 100644 --- a/src/uscxml/interpreter/BasicContentExecutor.h +++ b/src/uscxml/interpreter/BasicContentExecutor.h @@ -53,7 +53,7 @@ public: virtual void uninvoke(XERCESC_NS::DOMElement* invoke); virtual void raiseDoneEvent(XERCESC_NS::DOMElement* state, XERCESC_NS::DOMElement* doneData); - virtual Data elementAsData(XERCESC_NS::DOMElement* element, bool asExpression = false); + virtual Data elementAsData(XERCESC_NS::DOMElement* element); protected: void processNameLists(std::map<std::string, Data>& nameMap, XERCESC_NS::DOMElement* element); diff --git a/src/uscxml/interpreter/ContentExecutor.cpp b/src/uscxml/interpreter/ContentExecutor.cpp index 4aa6eb4..3e20e50 100644 --- a/src/uscxml/interpreter/ContentExecutor.cpp +++ b/src/uscxml/interpreter/ContentExecutor.cpp @@ -35,8 +35,8 @@ void ContentExecutor::uninvoke(XERCESC_NS::DOMElement* invoke) { _impl->uninvoke(invoke); } -Data ContentExecutor::elementAsData(XERCESC_NS::DOMElement* element, bool asExpression) { - return _impl->elementAsData(element, asExpression); +Data ContentExecutor::elementAsData(XERCESC_NS::DOMElement* element) { + return _impl->elementAsData(element); } void ContentExecutor::raiseDoneEvent(XERCESC_NS::DOMElement* state, XERCESC_NS::DOMElement* doneData) { diff --git a/src/uscxml/interpreter/ContentExecutor.h b/src/uscxml/interpreter/ContentExecutor.h index 78fdf94..64d1da6 100644 --- a/src/uscxml/interpreter/ContentExecutor.h +++ b/src/uscxml/interpreter/ContentExecutor.h @@ -46,7 +46,7 @@ public: virtual void process(XERCESC_NS::DOMElement* block); virtual void invoke(XERCESC_NS::DOMElement* invoke); virtual void uninvoke(XERCESC_NS::DOMElement* invoke); - virtual Data elementAsData(XERCESC_NS::DOMElement* element, bool asExpression = false); + virtual Data elementAsData(XERCESC_NS::DOMElement* element); virtual void raiseDoneEvent(XERCESC_NS::DOMElement* state, XERCESC_NS::DOMElement* doneData); virtual std::shared_ptr<ContentExecutorImpl> getImpl() const; diff --git a/src/uscxml/interpreter/ContentExecutorImpl.h b/src/uscxml/interpreter/ContentExecutorImpl.h index 8221591..42ef738 100644 --- a/src/uscxml/interpreter/ContentExecutorImpl.h +++ b/src/uscxml/interpreter/ContentExecutorImpl.h @@ -100,7 +100,7 @@ public: virtual void uninvoke(XERCESC_NS::DOMElement* invoke) = 0; virtual void raiseDoneEvent(XERCESC_NS::DOMElement* state, XERCESC_NS::DOMElement* doneData) = 0; - virtual Data elementAsData(XERCESC_NS::DOMElement* element, bool asExpression = false) = 0; + virtual Data elementAsData(XERCESC_NS::DOMElement* element) = 0; protected: ContentExecutorCallbacks* _callbacks; diff --git a/src/uscxml/interpreter/InterpreterImpl.cpp b/src/uscxml/interpreter/InterpreterImpl.cpp index 185ad75..5d6ced1 100644 --- a/src/uscxml/interpreter/InterpreterImpl.cpp +++ b/src/uscxml/interpreter/InterpreterImpl.cpp @@ -142,7 +142,7 @@ void InterpreterImpl::reset() { if (_microStepper) _microStepper.reset(); -// _isInitialized = false; + _isInitialized = false; _state = USCXML_INSTANTIATED; // _dataModel.reset(); if (_delayQueue) @@ -320,7 +320,12 @@ SCXML_STOP_SEARCH: XERCESC_NS::DOMText* scriptText = _document->createTextNode(X(contents)); XERCESC_NS::DOMNode* newNode = _document->importNode(scriptText, true); script->appendChild(newNode); - script->removeAttribute(kXMLCharSource); // remove attribute for validation: see issue 141 + /** + * We nees to download all scripts (issue134) but also fail validation when there + * are child nodes with the src attribute present (issue141). Make a note that we + * already downloaded the content. + */ + script->setUserData(X("downloaded"), newNode, NULL); } } @@ -378,7 +383,6 @@ void InterpreterImpl::init() { // do not override if already set if (_ioProcs.find(ioProcIter->first) != _ioProcs.end()) { - ioProcIter++; continue; } @@ -438,15 +442,12 @@ void InterpreterImpl::initData(XERCESC_NS::DOMElement* root) { } else if (_invokeReq.namelist.find(id) != _invokeReq.namelist.end()) { _dataModel.init(id, _invokeReq.namelist[id], additionalAttr); } else { - try { - _dataModel.init(id, _execContent.elementAsData(root), additionalAttr); - } catch (ErrorEvent e) { - // test 453 - _dataModel.init(id, _execContent.elementAsData(root, true), additionalAttr); - } + _dataModel.init(id, _execContent.elementAsData(root), additionalAttr); } } catch(ErrorEvent e) { // test 277 + e.data.compound["xpath"] = uscxml::Data(DOMUtils::xPathForNode(root), uscxml::Data::VERBATIM); + \ enqueueInternal(e); } } diff --git a/src/uscxml/plugins/DataModel.h b/src/uscxml/plugins/DataModel.h index b5ab31c..f8f19c4 100644 --- a/src/uscxml/plugins/DataModel.h +++ b/src/uscxml/plugins/DataModel.h @@ -79,13 +79,13 @@ public: const std::map<std::string, std::string>& attr = std::map<std::string, std::string>()); /// @copydoc DataModelImpl::isDeclared() - virtual bool isDeclared(const std::string& expr); + DEPRECATED virtual bool isDeclared(const std::string& expr); /// @copydoc DataModelImpl::replaceExpressions() - size_t replaceExpressions(std::string& content); + DEPRECATED size_t replaceExpressions(std::string& content); /// @copydoc DataModelImpl::addExtension() - virtual void addExtension(DataModelExtension* ext); + DEPRECATED virtual void addExtension(DataModelExtension* ext); protected: std::shared_ptr<DataModelImpl> _impl; diff --git a/src/uscxml/plugins/DataModelImpl.h b/src/uscxml/plugins/DataModelImpl.h index afb41bc..1df965d 100644 --- a/src/uscxml/plugins/DataModelImpl.h +++ b/src/uscxml/plugins/DataModelImpl.h @@ -149,7 +149,7 @@ public: * @param content The string with tokens to replace. * @return How many occurences where replaced. */ - size_t replaceExpressions(std::string& content); + DEPRECATED size_t replaceExpressions(std::string& content); /** * Evaluate the given expression as something iterable and return its length. @@ -206,7 +206,7 @@ public: * @param expr The variable / location to check. * @todo Is this still used? */ - virtual bool isDeclared(const std::string& expr) = 0; + DEPRECATED virtual bool isDeclared(const std::string& expr) = 0; /** * Assign a data object to a location in the data-model. @@ -248,7 +248,7 @@ public: * Register an extension to get data into and out of the data-model. * @todo This is currently unsupported */ - virtual void addExtension(DataModelExtension* ext); + DEPRECATED virtual void addExtension(DataModelExtension* ext); protected: DataModelCallbacks* _callbacks; diff --git a/src/uscxml/plugins/Factory.cpp b/src/uscxml/plugins/Factory.cpp index 9e885e5..8269e48 100644 --- a/src/uscxml/plugins/Factory.cpp +++ b/src/uscxml/plugins/Factory.cpp @@ -38,6 +38,8 @@ #include "uscxml/interpreter/FastMicroStep.h" #endif +#undef WITH_DM_ECMA_V8 + #if 0 #include <xercesc/dom/DOM.hpp> #include <xercesc/util/PlatformUtils.hpp> @@ -72,10 +74,14 @@ #include "uscxml/plugins/datamodel/null/NullDataModel.h" #if defined WITH_DM_ECMA_V8 -# include "uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h" -#endif - -#ifdef WITH_DM_ECMA_JSC +# if (V8_VERSION == 032317) +# include "uscxml/plugins/datamodel/ecmascript/v8/032317/V8DataModel.h" +# endif +# if (V8_VERSION == 031405) +# include "uscxml/plugins/datamodel/ecmascript/v8/031405/V8DataModel.h" +# endif + +#elif defined(WITH_DM_ECMA_JSC) # include "uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.h" #endif @@ -219,15 +225,15 @@ void Factory::registerPlugins() { V8DataModel* dataModel = new V8DataModel(); registerDataModel(dataModel); } -#endif -#ifdef WITH_DM_ECMA_JSC +#elif defined(WITH_DM_ECMA_JSC) { JSCDataModel* dataModel = new JSCDataModel(); registerDataModel(dataModel); } #endif + #ifdef WITH_DM_LUA { LuaDataModel* dataModel = new LuaDataModel(); diff --git a/src/uscxml/plugins/datamodel/CMakeLists.txt b/src/uscxml/plugins/datamodel/CMakeLists.txt index 05feb11..2d1a928 100644 --- a/src/uscxml/plugins/datamodel/CMakeLists.txt +++ b/src/uscxml/plugins/datamodel/CMakeLists.txt @@ -49,8 +49,8 @@ if (V8_FOUND) set(USCXML_DATAMODELS "ecmascript(V8) ${USCXML_DATAMODELS}") # JavaScriptCore ecmascript datamodel file(GLOB V8_DATAMODEL - ecmascript/v8/*.cpp - ecmascript/v8/*.h + ecmascript/v8/${V8_VERSION}/*.cpp + ecmascript/v8/${V8_VERSION}/*.h ecmascript/*.cpp ecmascript/*.h ) @@ -132,9 +132,6 @@ if (WITH_DM_PROMELA) uscxml ) # SET_SOURCE_FILES_PROPERTIES is directory scope - if (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) - SET_SOURCE_FILES_PROPERTIES(promela/parser/promela.lex.yy.cpp PROPERTIES COMPILE_FLAGS -Wno-deprecated-register ) - endif() set_target_properties(datamodel_promela PROPERTIES FOLDER "Plugins//DataModel") set_target_properties(datamodel_promela PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS") set_target_properties(datamodel_promela PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib/plugins") diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp index 69ed632..6f48631 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp @@ -709,20 +709,6 @@ JSValueRef JSCDataModel::getNodeAsValue(const DOMNode* node) { SWIG_as_voidptrptr(&node)), 0); -// switch (node->getNodeType()) { -// case DOMNode::ELEMENT_NODE: -// return SWIG_JSC_NewPointerObj(_ctx, (void*)node, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMElement, 0); -// break; -// -// case DOMNode::COMMENT_NODE: -// return SWIG_JSC_NewPointerObj(_ctx, (void*)node, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMComment, 0); -// break; -// -// // TODO: We need to dispatch more types here! -// default: -// return SWIG_JSC_NewPointerObj(_ctx, (void*)node, SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, 0); -// break; -// } } #endif diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/031405/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/031405/V8DataModel.cpp new file mode 100644 index 0000000..5c76b8b --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/031405/V8DataModel.cpp @@ -0,0 +1,863 @@ +/** + * @file + * @author 2012-2013 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 + */ + +/* + * Later v8 changed API considerably, have a look at the node.js(!) documentatio for an overview: + * http://strongloop.com/strongblog/node-js-v0-12-c-apis-breaking/ + */ + +#include "uscxml/Common.h" +#include "uscxml/util/URL.h" +#include "uscxml/util/String.h" + +#include "V8DataModel.h" + +#include "uscxml/messages/Event.h" +#ifndef NO_XERCESC +#include "uscxml/util/DOM.h" +#endif +#include "uscxml/interpreter/Logging.h" + +#include <boost/algorithm/string.hpp> + +#ifdef BUILD_AS_PLUGINS +#include <Pluma/Connector.hpp> +#endif + +using namespace XERCESC_NS; + +#define SWIG_V8_VERSION 0x031400 + +#ifndef NO_XERCESC +static v8::Local<v8::Value> XMLString2JS(const XMLCh* input) { + char* res = XERCESC_NS::XMLString::transcode(input); + v8::Local<v8::Value> handle = v8::String::New(res); + return handle; +} + +static XMLCh* JS2XMLString(const v8::Local<v8::Value>& value) { + v8::String::AsciiValue s(value); + XMLCh* ret = XERCESC_NS::XMLString::transcode(*s); + return(ret); +} + +// this is the version we support here + +#include "../V8DOM.cpp.inc" +#else +#include "../V8Event.cpp.inc" +#endif + +namespace uscxml { + +#ifdef BUILD_AS_PLUGINS +PLUMA_CONNECTOR +bool pluginConnect(pluma::Host& host) { + host.add( new V8DataModelProvider() ); + return true; +} +#endif + +V8DataModel::V8DataModel() { +// _contexts.push_back(v8::Context::New()); +} + +V8DataModel::~V8DataModel() { + _context.Dispose(); +// if (_isolate != NULL) { +// _isolate->Dispose(); +// } +} + +void V8DataModel::addExtension(DataModelExtension* ext) { +#if 0 + if (_extensions.find(ext) != _extensions.end()) + return; + + ext->dm = this; + _extensions.insert(ext); + + v8::Locker locker; + v8::HandleScope scope; + v8::Context::Scope contextScope(_contexts.front()); + v8::Local<v8::Object> currScope = _contexts.front()->Global(); + + std::list<std::string> locPath = tokenize(ext->provides(), '.'); + std::list<std::string>::iterator locIter = locPath.begin(); + while(true) { + std::string pathComp = *locIter; + v8::Local<v8::String> pathCompJS = v8::String::New(locIter->c_str()); + + if (++locIter != locPath.end()) { + // just another intermediate step + if (!currScope->Has(pathCompJS)) { + currScope->Set(pathCompJS, v8::Object::New()); + } + + v8::Local<v8::Value> newScope = currScope->Get(pathCompJS); + if (newScope->IsObject()) { + currScope = newScope->ToObject(); + } else { + throw "Cannot add datamodel extension in non-object"; + } + } else { + // this is the function! + currScope->Set(pathCompJS, v8::FunctionTemplate::New(jsExtension, v8::External::New(reinterpret_cast<void*>(ext)))->GetFunction(), v8::ReadOnly); + break; + } + } +#endif +} + +v8::Handle<v8::Value> V8DataModel::jsExtension(const v8::Arguments& args) { +#if 0 + DataModelExtension* extension = static_cast<DataModelExtension*>(v8::External::Unwrap(args.Data())); + + v8::Local<v8::String> memberJS; + std::string memberName; + + if (args.Length() > 0 && args[0]->IsString()) { + memberJS = args[0]->ToString(); + memberName = *v8::String::AsciiValue(memberJS); + } + + if (args.Length() > 1) { + // setter + Data data = ((V8DataModel*)(extension->dm))->getValueAsData(args[1]); + extension->setValueOf(memberName, data); + return v8::Undefined(); + } + + if (args.Length() == 1) { + // getter + return ((V8DataModel*)(extension->dm))->getDataAsValue(extension->getValueOf(memberName)); + } +#endif + return v8::Undefined(); +} + +std::mutex V8DataModel::_initMutex; + +//v8::Isolate* V8DataModel::_isolate = NULL; + +#ifndef NO_XERCESC +v8::Handle<v8::Value> V8NodeListIndexedPropertyHandler(uint32_t index, const v8::AccessorInfo &info) { + XERCESC_NS::DOMNodeList* list = NULL; + SWIG_V8_GetInstancePtr(info.Holder(), (void**)&list); + + if (list != NULL && list->getLength() >= index) { + XERCESC_NS::DOMNode* node = list->item(index); + + v8::Handle<v8::Value> val = SWIG_NewPointerObj(SWIG_as_voidptr(node), SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, SWIG_as_voidptrptr(&node)), 0 | 0 ); + return val; + } + return v8::Undefined(); + +} +#endif + +std::shared_ptr<DataModelImpl> V8DataModel::create(DataModelCallbacks* callbacks) { + std::shared_ptr<V8DataModel> dm(new V8DataModel()); + dm->_callbacks = callbacks; + dm->setup(); + return dm; +} + +void V8DataModel::setup() { + // TODO: we cannot use one isolate per thread as swig's type will be unknown :( + // We could register them by hand and avoid the _export_ globals in swig? + + v8::Locker locker; + v8::HandleScope scope; + + // Create a template for the global object where we set the built-in global functions. + v8::Local<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); + + // some free functions + global->Set(v8::String::New("In"), + v8::FunctionTemplate::New(jsIn, v8::External::New(reinterpret_cast<void*>(this))), v8::ReadOnly); + global->Set(v8::String::New("print"), + v8::FunctionTemplate::New(jsPrint, v8::External::New(reinterpret_cast<void*>(this))), v8::ReadOnly); + + _context = v8::Context::New(0, global); + v8::Context::Scope contextScope(_context); + +#ifndef NO_XERCESC + + // not thread safe! + { + std::lock_guard<std::mutex> lock(_initMutex); + SWIGV8_INIT(_context->Global()); + + // register subscript operator with nodelist + v8::Handle<v8::FunctionTemplate> _exports_DOMNodeList_class = SWIGV8_CreateClassTemplate("_exports_DOMNodeList"); + + _exports_DOMNodeList_class->InstanceTemplate()->SetIndexedPropertyHandler(V8NodeListIndexedPropertyHandler); + SWIGV8_AddMemberFunction(_exports_DOMNodeList_class, "item", _wrap_DOMNodeList_item); + SWIGV8_AddMemberFunction(_exports_DOMNodeList_class, "getLength", _wrap_DOMNodeList_getLength); + + SWIGV8_SET_CLASS_TEMPL(_exports_DOMNodeList_clientData.class_templ, _exports_DOMNodeList_class); + + } +#endif + + _context->Global()->SetAccessor(v8::String::NewSymbol("_sessionid"), + V8DataModel::getAttribute, + V8DataModel::setWithException, + v8::String::New(_callbacks->getSessionId().c_str())); + _context->Global()->SetAccessor(v8::String::NewSymbol("_name"), + V8DataModel::getAttribute, + V8DataModel::setWithException, + v8::String::New(_callbacks->getName().c_str())); + _context->Global()->SetAccessor(v8::String::NewSymbol("_ioprocessors"), + V8DataModel::getIOProcessors, + V8DataModel::setWithException, + v8::External::New(reinterpret_cast<void*>(this))); + _context->Global()->SetAccessor(v8::String::NewSymbol("_invokers"), + V8DataModel::getInvokers, + V8DataModel::setWithException, + v8::External::New(reinterpret_cast<void*>(this))); + +// v8::Persistent<v8::Value, v8::CopyablePersistentTraits<v8::Value> > persistent(_isolate, context); + +#if 0 + + // instantiate the document function + v8::Local<v8::Function> docCtor = V8Document::getTmpl()->GetFunction(); + v8::Local<v8::Object> docObj = docCtor->NewInstance(); + + V8Document::V8DocumentPrivate* privData = new V8Document::V8DocumentPrivate(); + privData->nativeObj = new Document<std::string>(interpreter->getDocument()); + privData->dom = _dom; + docObj->SetInternalField(0, V8DOM::toExternal(privData)); + + context->Global()->Set(v8::String::New("document"), docObj); + + // setup constructors + context->Global()->Set(v8::String::New("ArrayBuffer"), V8ArrayBuffer::getConstructor()->GetFunction()); + context->Global()->Set(v8::String::New("Int8Array"), V8Int8Array::getConstructor()->GetFunction()); + context->Global()->Set(v8::String::New("Uint8Array"), V8Uint8Array::getConstructor()->GetFunction()); + context->Global()->Set(v8::String::New("Uint8ClampedArray"), V8Uint8ClampedArray::getConstructor()->GetFunction()); + context->Global()->Set(v8::String::New("Int16Array"), V8Int16Array::getConstructor()->GetFunction()); + context->Global()->Set(v8::String::New("Uint16Array"), V8Uint16Array::getConstructor()->GetFunction()); + context->Global()->Set(v8::String::New("Int32Array"), V8Int32Array::getConstructor()->GetFunction()); + context->Global()->Set(v8::String::New("Uint32Array"), V8Uint32Array::getConstructor()->GetFunction()); + context->Global()->Set(v8::String::New("Float32Array"), V8Float32Array::getConstructor()->GetFunction()); + context->Global()->Set(v8::String::New("Float64Array"), V8Float64Array::getConstructor()->GetFunction()); + context->Global()->Set(v8::String::New("DataView"), V8DataView::getConstructor()->GetFunction()); + + + + // instantiate objects - we have to have a context for that! + eval(Element<std::string>(), "_x = {};"); +#endif + +} + +v8::Handle<v8::Value> V8DataModel::getAttribute(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + return info.Data(); +} + +void V8DataModel::setWithException(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info) { + v8::String::AsciiValue data(property); + std::string msg = "Cannot set " + std::string(*data); + v8::ThrowException(v8::Exception::ReferenceError(v8::String::New(msg.c_str()))); +} + +v8::Handle<v8::Value> V8DataModel::getIOProcessors(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::External> field = v8::Local<v8::External>::Cast(info.Data()); + V8DataModel* dataModel = (V8DataModel*)field->Value(); + + if (dataModel->_ioProcessors.IsEmpty()) { + + dataModel->_ioProcessors = v8::Persistent<v8::Object>::New(v8::Object::New()); + //v8::Handle<v8::Object> ioProcessorObj = v8::Object::New(); + std::map<std::string, IOProcessor> ioProcessors = dataModel->_callbacks->getIOProcessors(); + std::map<std::string, IOProcessor>::const_iterator ioProcIter = ioProcessors.begin(); + while(ioProcIter != ioProcessors.end()) { + // std::cout << ioProcIter->first << std::endl; + dataModel->_ioProcessors->Set(v8::String::New(ioProcIter->first.c_str()), + dataModel->getDataAsValue(ioProcIter->second.getDataModelVariables())); + ioProcIter++; + } + } + return dataModel->_ioProcessors; +} + +v8::Handle<v8::Value> V8DataModel::getInvokers(v8::Local<v8::String> property, const v8::AccessorInfo& info) { + v8::Local<v8::External> field = v8::Local<v8::External>::Cast(info.Data()); + V8DataModel* dataModel = (V8DataModel*)field->Value(); + + if (dataModel->_invokers.IsEmpty()) { + dataModel->_invokers = v8::Persistent<v8::Object>::New(v8::Object::New()); + //v8::Handle<v8::Object> ioProcessorObj = v8::Object::New(); + std::map<std::string, Invoker> invokers = dataModel->_callbacks->getInvokers(); + std::map<std::string, Invoker>::const_iterator invokerIter = invokers.begin(); + while(invokerIter != invokers.end()) { + // std::cout << ioProcIter->first << std::endl; + dataModel->_invokers->Set(v8::String::New(invokerIter->first.c_str()), + dataModel->getDataAsValue(invokerIter->second.getDataModelVariables())); + invokerIter++; + } + + } + return dataModel->_invokers; +} + +void V8DataModel::setEvent(const Event& event) { + + v8::Locker locker; + v8::HandleScope handleScope; + v8::Context::Scope contextScope(_context); + v8::Handle<v8::Object> global = _context->Global(); + +#if 0 + // this would work as swig_exports_ will get redefined per isolate + { + std::lock_guard<std::mutex> lock(_initMutex); + SWIGV8_INIT(context->Global()); + } +#endif + + Event* evPtr = new Event(event); + +// v8::Handle<v8::FunctionTemplate> classTmpl = v8::Local<v8::FunctionTemplate>::New(_isolate, V8SCXMLEvent::getTmpl()); +// v8::Local<v8::Object> eventObj = classTmpl->InstanceTemplate()->NewInstance(); +// eventObj->SetAlignedPointerInInternalField(0, (void*)evPtr); +// assert(eventObj->GetAlignedPointerFromInternalField(0) == evPtr); + + v8::Handle<v8::Value> eventVal = SWIG_V8_NewPointerObj(evPtr, SWIGTYPE_p_uscxml__Event, SWIG_POINTER_OWN); + v8::Handle<v8::Object> eventObj = v8::Handle<v8::Object>::Cast(eventVal); + + /* + v8::Local<v8::Array> properties = eventObj->GetPropertyNames(); + for (int i = 0; i < properties->Length(); i++) { + assert(properties->Get(i)->IsString()); + v8::String::AsciiValue key(v8::Local<v8::String>::Cast(properties->Get(i))); + std::cout << *key << std::endl; + } + */ + + // test333 + if (event.origintype.size() > 0) { + eventObj->Set(v8::String::NewSymbol("origintype"),v8::String::New(event.origintype.c_str())); + } else { + eventObj->Set(v8::String::NewSymbol("origintype"),v8::Undefined()); + } + // test335 + if (event.origin.size() > 0) { + eventObj->Set(v8::String::NewSymbol("origin"),v8::String::New(event.origin.c_str())); + } else { + eventObj->Set(v8::String::NewSymbol("origin"),v8::Undefined()); + } + // test337 + if (!event.hideSendId) { + eventObj->Set(v8::String::NewSymbol("sendid"),v8::String::New(event.sendid.c_str())); + } else { + eventObj->Set(v8::String::NewSymbol("sendid"),v8::Undefined()); + } + // test339 + if (event.invokeid.size() > 0) { + eventObj->Set(v8::String::NewSymbol("invokeid"),v8::String::New(event.invokeid.c_str())); + } else { + eventObj->Set(v8::String::NewSymbol("invokeid"),v8::Undefined()); + } + + // test 331 + switch (event.eventType) { + case Event::EXTERNAL: + eventObj->Set(v8::String::NewSymbol("type"), v8::String::New("external")); + break; + case Event::INTERNAL: + eventObj->Set(v8::String::NewSymbol("type"), v8::String::New("internal")); + break; + case Event::PLATFORM: + eventObj->Set(v8::String::NewSymbol("type"), v8::String::New("platform")); + break; + } + + if (event.data.node) { +#ifndef NO_XERCESC + eventObj->Set(v8::String::NewSymbol("data"), getNodeAsValue(event.data.node)); +#else + ERROR_EXECUTION_THROW("Compiled without DOM support"); +#endif + } else { + // _event.data is KVP + Data data = event.data; + if (!event.params.empty()) { + Event::params_t::const_iterator paramIter = event.params.begin(); + while(paramIter != event.params.end()) { + data.compound[paramIter->first] = paramIter->second; + paramIter++; + } + } + if (!event.namelist.empty()) { + Event::namelist_t::const_iterator nameListIter = event.namelist.begin(); + while(nameListIter != event.namelist.end()) { + data.compound[nameListIter->first] = nameListIter->second; + nameListIter++; + } + } + if (!data.empty()) { +// std::cout << Data::toJSON(data); + eventObj->Set(v8::String::NewSymbol("data"), getDataAsValue(data)); // set data part of _event + } else { + // test 343 / test 488 + eventObj->Set(v8::String::NewSymbol("data"), v8::Undefined()); // set data part of _event + } + } + // we cannot make _event v8::ReadOnly as it will ignore subsequent setEvents + global->Set(v8::String::NewSymbol("_event"), eventObj); + +// _event.Reset(_isolate, eventObj); +// _event = eventObj; +} + +Data V8DataModel::getAsData(const std::string& content) { + Data d = Data::fromJSON(content); + if (!d.empty()) + return d; + + std::string trimmed = boost::trim_copy(content); + if (trimmed.length() > 0) { + if (isNumeric(trimmed.c_str(), 10)) { + d = Data(trimmed, Data::INTERPRETED); + } else if (trimmed.length() >= 2 && + ((trimmed[0] == '"' && trimmed[trimmed.length() - 1] == '"') || + (trimmed[0] == '\'' && trimmed[trimmed.length() - 1] == '\''))) { + d = Data(trimmed.substr(1, trimmed.length() - 2), Data::VERBATIM); + } else { + // test558, test562 + ERROR_EXECUTION(e, "Given content cannot be interpreted as data"); + e.data.compound["literal"] = Data(trimmed, Data::VERBATIM); + throw e; + } + } + return d; +} + +Data V8DataModel::evalAsData(const std::string& content) { + v8::Locker locker; + v8::HandleScope handleScope; + v8::Context::Scope contextScope(_context); + + v8::Handle<v8::Value> result = evalAsValue(content); + Data data = getValueAsData(result); + return data; +} + +Data V8DataModel::getValueAsData(const v8::Handle<v8::Value>& value) { + v8::Locker locker; + v8::HandleScope handleScope; + v8::Context::Scope contextScope(_context); + + std::set<v8::Value*> foo = std::set<v8::Value*>(); + return getValueAsData(value, foo); +} + +Data V8DataModel::getValueAsData(const v8::Handle<v8::Value>& value, std::set<v8::Value*>& alreadySeen) { + + v8::Context::Scope contextScope(_context); + + Data data; + + /// TODO: Breaking cycles does not work yet + if (alreadySeen.find(*value) != alreadySeen.end()) + return data; + alreadySeen.insert(*value); + + if (false) { + } else if (value->IsArray()) { + v8::Handle<v8::Array> array = v8::Handle<v8::Array>::Cast(value); + for (unsigned int i = 0; i < array->Length(); i++) { + data.array.push_back(getValueAsData(array->Get(i), alreadySeen)); + } + } else if (value->IsBoolean()) { + data.atom = (value->ToBoolean()->Value() ? "true" : "false"); + } else if (value->IsBooleanObject()) { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "IsBooleanObject is unimplemented" << std::endl; + } else if (value->IsDate()) { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "IsDate is unimplemented" << std::endl; + } else if (value->IsExternal()) { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "IsExternal is unimplemented" << std::endl; + } else if (value->IsFalse()) { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "IsFalse is unimplemented" << std::endl; + } else if (value->IsFunction()) { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "IsFunction is unimplemented" << std::endl; + } else if (value->IsInt32()) { + int32_t prop = value->Int32Value(); + data.atom = toStr(prop); + } else if (value->IsNativeError()) { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "IsNativeError is unimplemented" << std::endl; + } else if (value->IsNull()) { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "IsNull is unimplemented" << std::endl; + } else if (value->IsNumber()) { + v8::String::AsciiValue prop(v8::Handle<v8::String>::Cast(v8::Handle<v8::Number>::Cast(value))); + data.atom = *prop; + } else if (value->IsNumberObject()) { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "IsNumberObject is unimplemented" << std::endl; + } else if (value->IsObject()) { + +// if (V8ArrayBuffer::hasInstance(value)) { +// uscxml::V8ArrayBuffer::V8ArrayBufferPrivate* privObj = V8DOM::toClassPtr<V8ArrayBuffer::V8ArrayBufferPrivate >(value->ToObject()->GetInternalField(0)); +// data.binary = privObj->nativeObj->_blob; +// return data; +// } +#ifndef NO_XERCESC + + v8::Local<v8::FunctionTemplate> tmpl = v8::Local<v8::FunctionTemplate>::New(_exports_DOMNode_clientData.class_templ); + if (tmpl->HasInstance(value)) { + SWIG_V8_GetInstancePtr(value, (void**)&(data.node)); + return data; + } +#endif + v8::Handle<v8::Object> object = v8::Handle<v8::Object>::Cast(value); + v8::Local<v8::Array> properties = object->GetPropertyNames(); + for (unsigned int i = 0; i < properties->Length(); i++) { + assert(properties->Get(i)->IsString()); + v8::String::AsciiValue key(v8::Local<v8::String>::Cast(properties->Get(i))); + v8::Local<v8::Value> property = object->Get(properties->Get(i)); + data.compound[*key] = getValueAsData(property, alreadySeen); + } + } else if (value->IsRegExp()) { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "IsRegExp is unimplemented" << std::endl; + } else if(value->IsString()) { + v8::String::AsciiValue property(v8::Handle<v8::String>::Cast(value)); + data.atom = *property; + data.type = Data::VERBATIM; + } else if(value->IsStringObject()) { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "IsStringObject is unimplemented" << std::endl; + } else if(value->IsTrue()) { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "IsTrue is unimplemented" << std::endl; + } else if(value->IsUint32()) { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "IsUint32 is unimplemented" << std::endl; + } else if(value->IsUndefined()) { + data.atom = "undefined"; + } else { + LOG(_callbacks->getLogger(), USCXML_ERROR) << "Value's type is unknown!" << std::endl; + } + return data; +} + +#ifndef NO_XERCESC +v8::Handle<v8::Value> V8DataModel::getNodeAsValue(const XERCESC_NS::DOMNode* node) { + return SWIG_NewPointerObj(SWIG_as_voidptr(node), + SWIG_TypeDynamicCast(SWIGTYPE_p_XERCES_CPP_NAMESPACE__DOMNode, + SWIG_as_voidptrptr(&node)), + 0); +} +#endif + +v8::Handle<v8::Value> V8DataModel::getDataAsValue(const Data& data) { + + if (data.compound.size() > 0) { + v8::Local<v8::Object> value = v8::Object::New(); + std::map<std::string, Data>::const_iterator compoundIter = data.compound.begin(); + while(compoundIter != data.compound.end()) { + value->Set(v8::String::NewSymbol(compoundIter->first.c_str()), getDataAsValue(compoundIter->second)); + compoundIter++; + } + return value; + } + if (data.array.size() > 0) { + v8::Local<v8::Object> value = v8::Array::New(data.array.size()); + std::list<Data>::const_iterator arrayIter = data.array.begin(); + uint32_t index = 0; + while(arrayIter != data.array.end()) { + value->Set(index++, getDataAsValue(*arrayIter)); + arrayIter++; + } + return value; + } + if (data.atom.length() > 0) { + switch (data.type) { + case Data::VERBATIM: + return v8::String::New(data.atom.c_str()); + break; + case Data::INTERPRETED: + return evalAsValue(data.atom); + break; + } + } + if (data.node) { +#ifndef NO_XERCESC + return getNodeAsValue(data.node); +#else + ERROR_EXECUTION_THROW("Compiled without DOM support"); +#endif + } + +// if (data.binary) { +// uscxml::ArrayBuffer* arrBuffer = new uscxml::ArrayBuffer(data.binary); +// v8::Local<v8::Function> retCtor = V8ArrayBuffer::getTmpl()->GetFunction(); +// v8::Persistent<v8::Object> retObj = v8::Persistent<v8::Object>::New(retCtor->NewInstance()); +// +// struct V8ArrayBuffer::V8ArrayBufferPrivate* retPrivData = new V8ArrayBuffer::V8ArrayBufferPrivate(); +// retPrivData->nativeObj = arrBuffer; +// retObj->SetInternalField(0, V8DOM::toExternal(retPrivData)); +// +// retObj.MakeWeak(0, V8ArrayBuffer::jsDestructor); +// return retObj; +// } + // this will never be reached + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8DataModel::jsPrint(const v8::Arguments& args) { + if (args.Length() > 0) { + v8::String::AsciiValue printMsg(args[0]->ToString()); + V8DataModel* dataModel = static_cast<V8DataModel*>(v8::External::Unwrap(args.Data())); + dataModel->_callbacks->getLogger().log(USCXML_LOG) << *printMsg; + } + return v8::Undefined(); +} + +v8::Handle<v8::Value> V8DataModel::jsIn(const v8::Arguments& args) { + V8DataModel* INSTANCE = static_cast<V8DataModel*>(v8::External::Unwrap(args.Data())); + for (auto i = 0; i < args.Length(); i++) { + if (args[i]->IsString()) { + std::string stateName(*v8::String::AsciiValue(args[i]->ToString())); + if (INSTANCE->_callbacks->isInState(stateName)) { + continue; + } + } + return v8::Boolean::New(false); + } + return v8::Boolean::New(true); +} + +bool V8DataModel::isLegalDataValue(const std::string& expr) { + return isValidSyntax("var __tmp = " + expr); +} + +bool V8DataModel::isValidSyntax(const std::string& expr) { + v8::Locker locker; + v8::HandleScope handleScope; + v8::TryCatch tryCatch; + v8::Context::Scope contextScope(_context); + + v8::Handle<v8::String> source = v8::String::New(expr.c_str()); + v8::Handle<v8::Script> script = v8::Script::Compile(source); + + if (script.IsEmpty() || tryCatch.HasCaught()) { + return false; + } + + return true; +} + +uint32_t V8DataModel::getLength(const std::string& expr) { + v8::Locker locker; + v8::HandleScope handleScope; + v8::TryCatch tryCatch; + v8::Context::Scope contextScope(_context); + + v8::Handle<v8::Value> result = evalAsValue(expr); + + if (!result.IsEmpty() && result->IsArray()) + return result.As<v8::Array>()->Length(); + + ERROR_EXECUTION_THROW("'" + expr + "' does not evaluate to an array.") +} + +void V8DataModel::setForeach(const std::string& item, + const std::string& array, + const std::string& index, + uint32_t iteration) { + v8::Locker locker; + v8::HandleScope handleScope; + v8::Context::Scope contextScope(_context); + + if (!isDeclared(item)) { + assign(item, Data()); + } + + +// v8::Local<v8::Context> ctx = v8::Local<v8::Context>::New(_isolate, _context); +// v8::Context::Scope contextScope(ctx); // segfaults at newinstance without! + + // assign array element to item + std::stringstream ss; + ss << item << " = " << array << "[" << iteration << "]"; +// assign(item, Data(ss.str(), Data::INTERPRETED)); + // test152: we need "'continue' = array[index]" to throw + evalAsValue(ss.str()); + if (index.length() > 0) { + // assign iteration element to index + std::stringstream ss; + ss << iteration; + assign(index, Data(ss.str(), Data::INTERPRETED)); + } +} + +bool V8DataModel::isDeclared(const std::string& expr) { + /** + * Undeclared variables can be checked by trying to access them and catching + * a reference error. + */ + + v8::Locker locker(); + v8::HandleScope scope(); + v8::Context::Scope contextScope(_context); // segfaults at newinstance without! + + v8::Local<v8::String> source = v8::String::New(expr.c_str()); + v8::Local<v8::Script> script = v8::Script::Compile(source); + + v8::Local<v8::Value> result; + if (!script.IsEmpty()) + result = script->Run(); + + if (result.IsEmpty()) + return false; + + return true; +} + +bool V8DataModel::evalAsBool(const std::string& expr) { + v8::Locker locker; + v8::HandleScope handleScope; + v8::Context::Scope contextScope(_context); + + v8::Handle<v8::Value> result = evalAsValue(expr); + return(result->ToBoolean()->BooleanValue()); +} + + +void V8DataModel::assign(const std::string& location, const Data& data, const std::map<std::string, std::string>& attr) { + + v8::Locker locker; + v8::HandleScope handleScope; + v8::Context::Scope contextScope(_context); + +#ifndef NO_XERCESC + v8::Local<v8::Object> global = _context->Global(); +#endif + + if (location.compare("_sessionid") == 0) // test 322 + ERROR_EXECUTION_THROW("Cannot assign to _sessionId"); + if (location.compare("_name") == 0) + ERROR_EXECUTION_THROW("Cannot assign to _name"); + if (location.compare("_ioprocessors") == 0) // test 326 + ERROR_EXECUTION_THROW("Cannot assign to _ioprocessors"); + if (location.compare("_invokers") == 0) + ERROR_EXECUTION_THROW("Cannot assign to _invokers"); + if (location.compare("_event") == 0) + ERROR_EXECUTION_THROW("Cannot assign to _event"); + + if (data.node) { +#ifndef NO_XERCESC + global->Set(v8::String::NewSymbol(location.c_str()), getNodeAsValue(data.node)); +#else + ERROR_EXECUTION_THROW("Compiled without DOM support"); +#endif + } else { + evalAsValue(location + " = " + Data::toJSON(data)); + } +} + +void V8DataModel::init(const std::string& location, const Data& data, const std::map<std::string, std::string>& attr) { + v8::Locker locker; + v8::HandleScope handleScope; + v8::Context::Scope contextScope(_context); + + try { + assign(location, data); + } catch (ErrorEvent e) { + // test 277 + evalAsValue(location + " = undefined", true); + + // we need to get error.execution into the queue + throw e; + } +} + +v8::Handle<v8::Value> V8DataModel::evalAsValue(const std::string& expr, bool dontThrow) { + +// v8::Locker locker(_isolate); +// v8::Isolate::Scope isoScope(_isolate); +// +// v8::HandleScope scope(_isolate); +// v8::EscapableHandleScope escape(_isolate); +// v8::Local<v8::Context> ctx = v8::Local<v8::Context>::New(_isolate, _context); +// v8::Context::Scope contextScope(ctx); // segfaults at newinstance without! + + v8::TryCatch tryCatch; + + v8::Local<v8::String> source = v8::String::New(expr.c_str()); + v8::Local<v8::Script> script = v8::Script::Compile(source); + + v8::Local<v8::Value> result; + if (!script.IsEmpty()) + result = script->Run(); + + if (script.IsEmpty() || result.IsEmpty()) { + // throw an exception + if (tryCatch.HasCaught() && !dontThrow) + throwExceptionEvent(tryCatch); + } + + return result; +} + +void V8DataModel::throwExceptionEvent(const v8::TryCatch& tryCatch) { + assert(tryCatch.HasCaught()); + ErrorEvent exceptionEvent; + exceptionEvent.name = "error.execution"; + exceptionEvent.eventType = Event::PLATFORM; + + std::string exceptionString(*v8::String::AsciiValue(tryCatch.Exception())); + exceptionEvent.data.compound["cause"] = Data(exceptionString, Data::VERBATIM);; + + v8::Local<v8::Message> message = tryCatch.Message(); + if (!message.IsEmpty()) { + std::string filename(*v8::String::AsciiValue(message->GetScriptResourceName())); + exceptionEvent.data.compound["filename"] = Data(filename, Data::VERBATIM); + + std::string sourceLine(*v8::String::AsciiValue(message->GetSourceLine())); + size_t startpos = sourceLine.find_first_not_of(" \t"); + if(std::string::npos != startpos) // remove leading white space + sourceLine = sourceLine.substr(startpos); + + exceptionEvent.data.compound["sourceline"] = Data(sourceLine, Data::VERBATIM); + + std::stringstream ssLineNumber; + int lineNumber = message->GetLineNumber(); + ssLineNumber << lineNumber; + exceptionEvent.data.compound["linenumber"] = Data(ssLineNumber.str(), Data::INTERPRETED); + + int startColumn = message->GetStartColumn(); + int endColumn = message->GetEndColumn(); + std::stringstream ssUnderline; + for (int i = 0; i < startColumn; i++) + ssUnderline << " "; + for (int i = startColumn; i < endColumn; i++) + ssUnderline << "^"; + exceptionEvent.data.compound["sourcemark"] = Data(ssUnderline.str(), Data::VERBATIM); + + std::string stackTrace(*v8::String::AsciiValue(tryCatch.StackTrace())); + exceptionEvent.data.compound["stacktrace"] = Data(stackTrace, Data::VERBATIM); + + } + +// _interpreter->receiveInternal(exceptionEvent); + throw(exceptionEvent); +} + +} diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/031405/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/031405/V8DataModel.h new file mode 100644 index 0000000..b129082 --- /dev/null +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/031405/V8DataModel.h @@ -0,0 +1,126 @@ +/** + * @file + * @author 2012-2013 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 + */ + +#ifndef V8DATAMODEL_H_KN8TWG0V +#define V8DATAMODEL_H_KN8TWG0V + +#include "uscxml/config.h" +#include "uscxml/plugins/DataModelImpl.h" + +#include <list> +#include <set> +#include <v8.h> +#include <mutex> + +#ifdef BUILD_AS_PLUGINS +#include "uscxml/plugins/Plugins.h" +#endif + +namespace uscxml { +class Event; +class Data; +} + +namespace uscxml { + +/** + * @ingroup datamodel + * ECMAScript data-model via Google's V8. + */ + +class V8DataModel : public DataModelImpl { +public: + V8DataModel(); + virtual ~V8DataModel(); + virtual std::shared_ptr<DataModelImpl> create(DataModelCallbacks* callbacks); + + virtual void addExtension(DataModelExtension* ext); + + virtual std::list<std::string> getNames() { + std::list<std::string> names; + names.push_back("ecmascript"); + return names; + } + + virtual bool isValidSyntax(const std::string& expr); + virtual bool isLegalDataValue(const std::string& expr); + + virtual void setEvent(const Event& event); + + // foreach + virtual uint32_t getLength(const std::string& expr); + virtual void setForeach(const std::string& item, + const std::string& array, + const std::string& index, + uint32_t iteration); + + virtual bool evalAsBool(const std::string& expr); + virtual Data evalAsData(const std::string& expr); + virtual Data getAsData(const std::string& content); + + virtual bool isDeclared(const std::string& expr); + + virtual void assign(const std::string& location, + const Data& data, + const std::map<std::string, std::string>& attr = std::map<std::string, std::string>()); + virtual void init(const std::string& location, + const Data& data, + const std::map<std::string, std::string>& attr = std::map<std::string, std::string>()); + +protected: + virtual void setup(); + + static v8::Handle<v8::Value> jsExtension(const v8::Arguments& args); + static v8::Handle<v8::Value> jsIn(const v8::Arguments& args); + static v8::Handle<v8::Value> jsPrint(const v8::Arguments& args); + + //v8::Local<v8::Object> _event; // Persistent events leak .. + v8::Persistent<v8::Context> _context; + //static v8::Isolate* _isolate; + + v8::Persistent<v8::Object> _ioProcessors; + v8::Persistent<v8::Object> _invokers; + + static v8::Handle<v8::Value> getIOProcessors(v8::Local<v8::String> property, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> getInvokers(v8::Local<v8::String> property, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> getAttribute(v8::Local<v8::String> property, const v8::AccessorInfo& info); + static void setWithException(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::AccessorInfo& info); + + v8::Handle<v8::Value> evalAsValue(const std::string& expr, bool dontThrow = false); + v8::Handle<v8::Value> getDataAsValue(const Data& data); + Data getValueAsData(const v8::Handle<v8::Value>& value); + v8::Handle<v8::Value> getNodeAsValue(const XERCESC_NS::DOMNode* node); + void throwExceptionEvent(const v8::TryCatch& tryCatch); + + std::set<DataModelExtension*> _extensions; + +private: + Data getValueAsData(const v8::Handle<v8::Value>& value, std::set<v8::Value*>& alreadySeen); + + static std::mutex _initMutex; + +}; + +#ifdef BUILD_AS_PLUGINS +PLUMA_INHERIT_PROVIDER(V8DataModel, DataModelImpl); +#endif + +} + +#endif /* end of include guard: V8DATAMODEL_H_KN8TWG0V */ diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/032317/V8DataModel.cpp index a7942a1..c245b67 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/032317/V8DataModel.cpp @@ -1,6 +1,6 @@ /** * @file - * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) + * @author 2012-2017 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de) * @copyright Simplified BSD * * @cond @@ -18,7 +18,9 @@ */ /* - * Later v8 changed API considerably, have a look at the node.js(!) documentatio for an overview: + * This file will compile for v8 version 3.23.17 as it was disributed e.g. by MacPorts for a while. + * + * Later v8 changed API considerably, have a look at the node.js(!) documentation for an overview: * http://strongloop.com/strongblog/node-js-v0-12-c-apis-breaking/ */ @@ -48,6 +50,7 @@ using namespace XERCESC_NS; static v8::Local<v8::Value> XMLString2JS(const XMLCh* input) { char* res = XERCESC_NS::XMLString::transcode(input); v8::Local<v8::Value> handle = v8::String::New(res); + free(res); return handle; } @@ -59,9 +62,9 @@ static XMLCh* JS2XMLString(const v8::Local<v8::Value>& value) { // this is the version we support here -#include "V8DOM.cpp.inc" +#include "../V8DOM.cpp.inc" #else -#include "V8Event.cpp.inc" +#include "../V8Event.cpp.inc" #endif namespace uscxml { @@ -232,11 +235,11 @@ void V8DataModel::setup() { context->Global()->SetAccessor(v8::String::NewSymbol("_sessionid"), V8DataModel::getAttribute, V8DataModel::setWithException, - v8::String::New(callbacks->getSessionId().c_str())); + v8::String::New(_callbacks->getSessionId().c_str())); context->Global()->SetAccessor(v8::String::NewSymbol("_name"), V8DataModel::getAttribute, V8DataModel::setWithException, - v8::String::New(callbacks->getName().c_str())); + v8::String::New(_callbacks->getName().c_str())); context->Global()->SetAccessor(v8::String::NewSymbol("_ioprocessors"), V8DataModel::getIOProcessors, V8DataModel::setWithException, @@ -359,11 +362,6 @@ void V8DataModel::setEvent(const Event& event) { Event* evPtr = new Event(event); -// v8::Handle<v8::FunctionTemplate> classTmpl = v8::Local<v8::FunctionTemplate>::New(_isolate, V8SCXMLEvent::getTmpl()); -// v8::Local<v8::Object> eventObj = classTmpl->InstanceTemplate()->NewInstance(); -// eventObj->SetAlignedPointerInInternalField(0, (void*)evPtr); -// assert(eventObj->GetAlignedPointerFromInternalField(0) == evPtr); - v8::Local<v8::Value> eventVal = SWIG_V8_NewPointerObj(evPtr, SWIGTYPE_p_uscxml__Event, SWIG_POINTER_OWN); v8::Local<v8::Object> eventObj = v8::Local<v8::Object>::Cast(eventVal); @@ -376,30 +374,17 @@ void V8DataModel::setEvent(const Event& event) { } */ - // test333 - if (event.origintype.size() > 0) { - eventObj->Set(v8::String::NewSymbol("origintype"),v8::String::NewFromUtf8(_isolate, event.origintype.c_str())); - } else { - eventObj->Set(v8::String::NewSymbol("origintype"),v8::Undefined(_isolate)); - } - // test335 - if (event.origin.size() > 0) { - eventObj->Set(v8::String::NewSymbol("origin"),v8::String::NewFromUtf8(_isolate, event.origin.c_str())); - } else { - eventObj->Set(v8::String::NewSymbol("origin"),v8::Undefined(_isolate)); - } - // test337 - if (!event.hideSendId) { - eventObj->Set(v8::String::NewSymbol("sendid"),v8::String::NewFromUtf8(_isolate, event.sendid.c_str())); - } else { - eventObj->Set(v8::String::NewSymbol("sendid"),v8::Undefined(_isolate)); - } - // test339 - if (event.invokeid.size() > 0) { - eventObj->Set(v8::String::NewSymbol("invokeid"),v8::String::NewFromUtf8(_isolate, event.invokeid.c_str())); - } else { - eventObj->Set(v8::String::NewSymbol("invokeid"),v8::Undefined(_isolate)); - } +#define V8_SET_FROMEVENT_OR_UNDEF(test, field) \ +if (test) { \ + eventObj->Set(v8::String::NewSymbol(#field),v8::String::NewFromUtf8(_isolate, event.field.c_str())); \ +} else { \ + eventObj->Set(v8::String::NewSymbol(#field),v8::Undefined(_isolate)); \ +} + + V8_SET_FROMEVENT_OR_UNDEF(event.origintype.size() > 0, origintype); // test333 + V8_SET_FROMEVENT_OR_UNDEF(event.origin.size() > 0, origin); // test335 + V8_SET_FROMEVENT_OR_UNDEF(!event.hideSendId, sendid); // test337 + V8_SET_FROMEVENT_OR_UNDEF(event.invokeid.size() > 0, invokeid); // test339 // test 331 switch (event.eventType) { @@ -438,7 +423,6 @@ void V8DataModel::setEvent(const Event& event) { } } if (!data.empty()) { -// std::cout << Data::toJSON(data); eventObj->Set(v8::String::NewSymbol("data"), getDataAsValue(data)); // set data part of _event } else { // test 343 / test 488 @@ -448,8 +432,6 @@ void V8DataModel::setEvent(const Event& event) { // we cannot make _event v8::ReadOnly as it will ignore subsequent setEvents global->Set(v8::String::NewSymbol("_event"), eventObj); -// _event.Reset(_isolate, eventObj); -// _event = eventObj; } Data V8DataModel::getAsData(const std::string& content) { @@ -546,6 +528,7 @@ Data V8DataModel::getValueAsData(const v8::Local<v8::Value>& value, std::set<v8: // data.binary = privObj->nativeObj->_blob; // return data; // } + #ifndef NO_XERCESC v8::Local<v8::FunctionTemplate> tmpl = v8::Local<v8::FunctionTemplate>::New(_isolate, _exports_DOMNode_clientData.class_templ); @@ -642,7 +625,7 @@ v8::Local<v8::Value> V8DataModel::getDataAsValue(const Data& data) { // retObj.MakeWeak(0, V8ArrayBuffer::jsDestructor); // return retObj; // } - // this will never be reached + return v8::Undefined(); } @@ -672,6 +655,10 @@ void V8DataModel::jsIn(const v8::FunctionCallbackInfo<v8::Value>& info) { info.GetReturnValue().Set(true); } +bool V8DataModel::isLegalDataValue(const std::string& expr) { + return isValidSyntax("var __tmp = " + expr); +} + bool V8DataModel::isValidSyntax(const std::string& expr) { v8::Locker locker(_isolate); v8::Isolate::Scope isoScope(_isolate); @@ -821,9 +808,14 @@ void V8DataModel::init(const std::string& location, const Data& data, const std: v8::Context::Scope contextScope(ctx); // segfaults at newinstance without! try { - assign(location, data); + if (data.empty()) { + // test 277 + evalAsValue(location + " = undefined", true); + } else { + assign(location, data); + } } catch (ErrorEvent e) { - // test 277 + // test 277 (before PROMELA init changes) evalAsValue(location + " = undefined", true); // we need to get error.execution into the queue diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h b/src/uscxml/plugins/datamodel/ecmascript/v8/032317/V8DataModel.h index e286c56..bee59bf 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/032317/V8DataModel.h @@ -58,6 +58,7 @@ public: } virtual bool isValidSyntax(const std::string& expr); + virtual bool isLegalDataValue(const std::string& expr); virtual void setEvent(const Event& event); diff --git a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp index c12491b..d7fe2a5 100644 --- a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp +++ b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp @@ -175,6 +175,13 @@ void PromelaDataModel::setEvent(const Event& event) { return; } + if (data.atom.length() > 0 && data.type == Data::INTERPRETED) { + // test 577 -> interpreted:'foo' + data.atom = evaluateExpr(data.atom); + data.type = Data::VERBATIM; + return; + } + if (data.array.size() > 0) { for (std::list<Data>::iterator iter = data.array.begin(); iter != data.array.end(); iter++) { adaptType(*iter); @@ -188,7 +195,10 @@ void PromelaDataModel::setEvent(const Event& event) { } return; } + } + bool PromelaDataModel::isLegalDataValue(const std::string& expr) { + return isValidSyntax("__tmp = " + expr); } bool PromelaDataModel::isValidSyntax(const std::string& expr) { @@ -269,7 +279,8 @@ void PromelaDataModel::setEvent(const Event& event) { Data PromelaDataModel::getAsData(const std::string& content) { try { - return evalAsData(content); + evaluateExpr("__tmp = " + content); + return evalAsData("__tmp"); } catch (ErrorEvent e) { return Data::fromJSON(content); } @@ -408,11 +419,13 @@ void PromelaDataModel::setEvent(const Event& event) { return Data(strTo<int>(node->value)); case PML_NAME: { Data d = getVariable(node); +#if 0 if (d.atom.size() != 0) - // fixes issue 127 + // fixes issue 127, breaks test277 if (isNumeric(d.atom.c_str(), 10)) { return Data(d.atom, Data::VERBATIM); } +#endif return d; // if (d.type == Data::INTERPRETED && d.atom[0] == '\'' && d.atom[d.atom.size() - 1] == '\'') // return Data(d.atom.substr(1, d.atom.size() - 2), Data::VERBATIM); @@ -628,7 +641,9 @@ void PromelaDataModel::setEvent(const Event& event) { switch(node->type) { case PML_NAME: if (_variables.compound.find(node->value) == _variables.compound.end()) { - ERROR_EXECUTION_THROW("No variable " + node->value + " was declared"); + // test 277 + return Data("false", Data::INTERPRETED); +// ERROR_EXECUTION_THROW("No variable " + node->value + " was declared"); } // if (_variables[node->value].compound.find("size") != _variables[node->value].compound.end()) { // ERROR_EXECUTION_THROW("Type error: Variable " + node->value + " is an array"); @@ -637,6 +652,11 @@ void PromelaDataModel::setEvent(const Event& event) { case PML_VAR_ARRAY: { PromelaParserNode* name = *opIter++; PromelaParserNode* expr = *opIter++; + // the in predicate is called config with promela dm + if (name->value == "config") { + return Data(_callbacks->isInState(expr->value) ? "true" : "false", Data::INTERPRETED); + } + int index = dataToInt(evaluateExpr(expr)); if (_variables.compound.find(name->value) == _variables.compound.end()) { @@ -735,7 +755,8 @@ void PromelaDataModel::setEvent(const Event& event) { Data d = Data::fromJSON(data); if (!d.empty()) setVariable(parser.ast, Data::fromJSON(data)); - setVariable(parser.ast, data); + // var1 = _sessionid + setVariable(parser.ast, evalAsData(data.atom)); } else { setVariable(parser.ast, data); } diff --git a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.h b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.h index 80f6b34..1e980c3 100644 --- a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.h +++ b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.h @@ -44,6 +44,7 @@ public: virtual void addExtension(DataModelExtension* ext); + virtual bool isLegalDataValue(const std::string& expr); virtual bool isValidSyntax(const std::string& expr); virtual void setEvent(const Event& event); diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.l b/src/uscxml/plugins/datamodel/promela/parser/promela.l index 1edc625..92f8c1f 100644 --- a/src/uscxml/plugins/datamodel/promela/parser/promela.l +++ b/src/uscxml/plugins/datamodel/promela/parser/promela.l @@ -53,6 +53,7 @@ false|skip|true { yylval->value = strdup(yytext); return PML_CONST; } printf { return PML_PRINT; } typedef { return PML_TYPEDEF; } assert { return PML_ASSERT; } +return { return PML_RETURN; } "!" { return PML_NEG; } "~" { return PML_COMPL; } @@ -103,7 +104,7 @@ assert { return PML_ASSERT; } L?\"(\\.|[^\\"])*\" { yylval->value = strdup(yytext); return(PML_STRING); } -L?'(\\.|[^\'])*\' { +L?\'(\\.|[^\'])*\' { /* Non PROMELA extension for single quoted string literals */ yylval->value = strdup(yytext); return(PML_STRING); } @@ -114,4 +115,4 @@ L?'(\\.|[^\'])*\' { [ \t\n]+ /* eat up whitespace */ -. { /*printf( "Unrecognized character: %s\n", yytext ); */ } +. { return PML_UNREC; } diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp b/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp index 1f2fd72..96e44f7 100644 --- a/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp +++ b/src/uscxml/plugins/datamodel/promela/parser/promela.lex.yy.cpp @@ -1,6 +1,3 @@ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-register" - #line 2 "promela.lex.yy.cpp" #line 4 "promela.lex.yy.cpp" @@ -19,8 +16,8 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 1 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -74,7 +71,6 @@ typedef int16_t flex_int16_t; typedef uint16_t flex_uint16_t; typedef int32_t flex_int32_t; typedef uint32_t flex_uint32_t; -typedef uint64_t flex_uint64_t; #else typedef signed char flex_int8_t; typedef short int flex_int16_t; @@ -82,7 +78,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -113,6 +108,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ /* %endif */ @@ -120,25 +117,13 @@ typedef unsigned int flex_uint32_t; /* %if-c++-only */ /* %endif */ -#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 +/* TODO: this is always defined, so inline it */ #define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) #else -#define yyconst +#define yynoreturn #endif /* %not-for-header */ @@ -204,7 +189,15 @@ typedef void* yyscan_t; /* 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. @@ -242,11 +235,18 @@ typedef size_t yy_size_t; */ #define YY_LESS_LINENO(n) \ do { \ - yy_size_t yyl;\ + 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) \ @@ -280,12 +280,12 @@ struct yy_buffer_state { /* Size of input buffer in bytes, not including room for EOB * characters. */ - yy_size_t yy_buf_size; + int yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ - yy_size_t yy_n_chars; + int 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 @@ -382,7 +382,7 @@ static void promela__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscann YY_BUFFER_STATE promela__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner ); YY_BUFFER_STATE promela__scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); -YY_BUFFER_STATE promela__scan_bytes (yyconst char *bytes,yy_size_t len ,yyscan_t yyscanner ); +YY_BUFFER_STATE promela__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); /* %endif */ @@ -416,7 +416,7 @@ void promela_free (void * ,yyscan_t yyscanner ); /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */ -#define promela_wrap(n) 1 +#define promela_wrap(yyscanner) (/*CONSTCOND*/1) #define YY_SKIP_YYWRAP #define FLEX_DEBUG @@ -427,12 +427,14 @@ typedef int yy_state_type; #define yytext_ptr yytext_r +/* %% [1.5] DFA */ + /* %if-c-only Standard (non-C++) definition */ 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 ); -static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); +static void yynoreturn yy_fatal_error (yyconst char* msg ,yyscan_t yyscanner ); /* %endif */ @@ -442,40 +444,41 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); #define YY_DO_BEFORE_ACTION \ yyg->yytext_ptr = yy_bp; \ /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\ - yyleng = (yy_size_t) (yy_cp - yy_bp); \ + yyleng = (int) (yy_cp - yy_bp); \ yyg->yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\ yyg->yy_c_buf_p = yy_cp; /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */ -#define YY_NUM_RULES 46 -#define YY_END_OF_BUFFER 47 +#define YY_NUM_RULES 47 +#define YY_END_OF_BUFFER 48 /* 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[126] = { +static yyconst flex_int16_t yy_accept[132] = { 0, - 0, 0, 47, 45, 44, 44, 8, 45, 14, 25, - 45, 33, 34, 12, 15, 31, 16, 30, 13, 42, - 32, 21, 39, 22, 43, 43, 35, 36, 26, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 37, - 27, 38, 9, 44, 23, 0, 40, 0, 28, 0, - 41, 0, 10, 11, 0, 42, 17, 19, 24, 20, - 18, 43, 0, 0, 43, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, - 29, 0, 41, 0, 0, 0, 43, 43, 2, 43, - 43, 43, 3, 43, 43, 43, 43, 43, 43, 43, - - 43, 0, 1, 43, 43, 43, 43, 43, 4, 43, - 43, 43, 1, 43, 43, 43, 43, 43, 7, 5, - 43, 43, 6, 43, 0 + 0, 0, 48, 46, 45, 45, 9, 46, 15, 26, + 46, 34, 35, 13, 16, 32, 17, 31, 14, 43, + 33, 22, 40, 23, 44, 44, 36, 37, 27, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 38, 28, 39, 10, 45, 24, 0, 41, 0, 29, + 0, 42, 0, 11, 12, 0, 43, 18, 20, 25, + 21, 19, 44, 0, 0, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 30, 0, 42, 0, 0, 0, 44, 44, + 2, 44, 44, 44, 3, 44, 44, 44, 44, 44, + + 44, 44, 44, 44, 0, 1, 44, 44, 44, 44, + 44, 44, 4, 44, 44, 44, 1, 44, 44, 44, + 44, 44, 44, 7, 5, 8, 44, 44, 6, 44, + 0 } ; -static yyconst flex_int32_t yy_ec[256] = { +static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -507,7 +510,7 @@ static yyconst flex_int32_t yy_ec[256] = { 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[51] = { +static yyconst YY_CHAR yy_meta[51] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, @@ -516,72 +519,74 @@ static yyconst flex_int32_t yy_meta[51] = { 2, 2, 2, 2, 2, 2, 1, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[131] = { +static yyconst flex_uint16_t yy_base[137] = { 0, - 0, 0, 172, 173, 49, 51, 151, 50, 173, 163, - 48, 173, 173, 173, 157, 173, 154, 173, 156, 149, - 173, 38, 145, 39, 0, 56, 173, 173, 173, 20, - 31, 136, 124, 131, 117, 118, 34, 30, 120, 173, - 110, 173, 173, 77, 173, 57, 173, 154, 173, 59, - 173, 66, 173, 173, 145, 138, 173, 173, 173, 173, - 173, 0, 76, 75, 111, 109, 108, 111, 106, 112, - 104, 108, 100, 110, 104, 108, 100, 96, 99, 96, - 173, 77, 78, 84, 127, 77, 106, 96, 0, 98, - 103, 90, 0, 91, 92, 88, 88, 93, 96, 95, - - 90, 78, 173, 82, 92, 91, 77, 76, 0, 80, - 88, 75, 96, 62, 73, 71, 68, 59, 0, 0, - 65, 65, 0, 65, 173, 109, 111, 88, 113, 115 + 0, 0, 177, 178, 49, 51, 156, 50, 178, 168, + 48, 178, 178, 178, 162, 178, 159, 178, 161, 154, + 178, 38, 150, 39, 0, 56, 178, 178, 178, 20, + 31, 141, 129, 136, 122, 123, 133, 34, 30, 124, + 178, 114, 178, 178, 77, 178, 57, 178, 158, 178, + 59, 178, 66, 178, 178, 149, 142, 178, 178, 178, + 178, 178, 0, 76, 75, 115, 113, 112, 115, 110, + 116, 108, 112, 104, 114, 104, 107, 111, 103, 99, + 102, 99, 178, 77, 78, 84, 130, 77, 109, 99, + 0, 101, 106, 93, 0, 94, 95, 88, 90, 90, + + 95, 98, 97, 92, 78, 178, 84, 94, 93, 79, + 80, 77, 0, 81, 89, 85, 97, 63, 74, 66, + 71, 68, 59, 0, 0, 0, 65, 65, 0, 65, + 178, 109, 111, 88, 113, 115 } ; -static yyconst flex_int16_t yy_def[131] = { +static yyconst flex_int16_t yy_def[137] = { 0, - 125, 1, 125, 125, 125, 125, 125, 126, 125, 125, - 127, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 128, 128, 125, 125, 125, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 125, - 125, 125, 125, 125, 125, 126, 125, 126, 125, 127, - 125, 129, 125, 125, 130, 125, 125, 125, 125, 125, - 125, 128, 126, 127, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 125, 127, 127, 129, 130, 130, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - - 128, 130, 125, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 130, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 0, 125, 125, 125, 125, 125 + 131, 1, 131, 131, 131, 131, 131, 132, 131, 131, + 133, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 134, 134, 131, 131, 131, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 131, 131, 131, 131, 131, 131, 132, 131, 132, 131, + 133, 131, 135, 131, 131, 136, 131, 131, 131, 131, + 131, 131, 134, 132, 133, 134, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 134, 134, 131, 133, 133, 135, 136, 136, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + + 134, 134, 134, 134, 136, 131, 134, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 136, 134, 134, 134, + 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, + 0, 131, 131, 131, 131, 131 } ; -static yyconst flex_int16_t yy_nxt[224] = { +static yyconst flex_uint16_t yy_nxt[229] = { 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 4, 28, 29, 30, 31, 25, 25, 32, 25, 25, 33, 25, 34, 35, 25, 25, - 36, 25, 37, 38, 39, 25, 40, 41, 42, 43, - 44, 44, 44, 44, 47, 51, 57, 58, 60, 61, - 63, 47, 65, 64, 66, 67, 51, 75, 50, 76, - 68, 78, 52, 83, 48, 79, 69, 77, 44, 44, - 47, 48, 51, 52, 51, 51, 50, 102, 86, 62, - 84, 83, 103, 113, 89, 124, 123, 122, 121, 52, - - 48, 52, 52, 89, 120, 119, 86, 118, 84, 46, - 46, 50, 50, 82, 82, 85, 85, 117, 116, 89, - 115, 89, 109, 114, 112, 111, 109, 110, 109, 108, - 107, 106, 105, 89, 89, 89, 104, 86, 101, 100, - 99, 98, 97, 96, 95, 94, 93, 89, 92, 91, - 90, 89, 88, 87, 56, 86, 125, 81, 80, 74, - 73, 72, 71, 70, 59, 56, 55, 54, 53, 49, - 45, 125, 3, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125 + 36, 37, 38, 39, 40, 25, 41, 42, 43, 44, + 45, 45, 45, 45, 48, 52, 58, 59, 61, 62, + 64, 48, 66, 65, 67, 68, 52, 77, 51, 78, + 69, 80, 53, 85, 49, 81, 70, 79, 45, 45, + 48, 49, 52, 53, 52, 52, 51, 105, 88, 63, + 86, 85, 106, 117, 91, 130, 129, 128, 127, 53, + + 49, 53, 53, 91, 126, 125, 124, 88, 86, 47, + 47, 51, 51, 84, 84, 87, 87, 123, 122, 121, + 91, 120, 119, 91, 113, 118, 116, 115, 113, 114, + 113, 112, 111, 110, 109, 108, 91, 91, 91, 107, + 88, 104, 103, 102, 101, 100, 99, 98, 97, 96, + 95, 91, 94, 93, 92, 91, 90, 89, 57, 88, + 131, 83, 82, 76, 75, 74, 73, 72, 71, 60, + 57, 56, 55, 54, 50, 46, 131, 3, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131 } ; -static yyconst flex_int16_t yy_chk[224] = { +static yyconst flex_int16_t yy_chk[229] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -589,42 +594,42 @@ static yyconst flex_int16_t yy_chk[224] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 5, 6, 6, 8, 11, 22, 22, 24, 24, - 26, 46, 30, 26, 30, 31, 50, 37, 52, 37, - 31, 38, 11, 52, 8, 38, 31, 37, 44, 44, - 63, 46, 64, 50, 82, 83, 84, 86, 102, 128, - 52, 84, 86, 102, 124, 122, 121, 118, 117, 64, - - 63, 82, 83, 116, 115, 114, 113, 112, 84, 126, - 126, 127, 127, 129, 129, 130, 130, 111, 110, 108, - 107, 106, 105, 104, 101, 100, 99, 98, 97, 96, - 95, 94, 92, 91, 90, 88, 87, 85, 80, 79, - 78, 77, 76, 75, 74, 73, 72, 71, 70, 69, - 68, 67, 66, 65, 56, 55, 48, 41, 39, 36, - 35, 34, 33, 32, 23, 20, 19, 17, 15, 10, - 7, 3, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, - 125, 125, 125 + 26, 47, 30, 26, 30, 31, 51, 38, 53, 38, + 31, 39, 11, 53, 8, 39, 31, 38, 45, 45, + 64, 47, 65, 51, 84, 85, 86, 88, 105, 134, + 53, 86, 88, 105, 130, 128, 127, 123, 122, 65, + + 64, 84, 85, 121, 120, 119, 118, 117, 86, 132, + 132, 133, 133, 135, 135, 136, 136, 116, 115, 114, + 112, 111, 110, 109, 108, 107, 104, 103, 102, 101, + 100, 99, 98, 97, 96, 94, 93, 92, 90, 89, + 87, 82, 81, 80, 79, 78, 77, 76, 75, 74, + 73, 72, 71, 70, 69, 68, 67, 66, 57, 56, + 49, 42, 40, 37, 36, 35, 34, 33, 32, 23, + 20, 19, 17, 15, 10, 7, 3, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, + 131, 131, 131, 131, 131, 131, 131, 131 } ; /* Table of booleans, true if rule could match eol. */ -static yyconst flex_int32_t yy_rule_can_match_eol[47] = { +static yyconst flex_int32_t yy_rule_can_match_eol[48] = { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 0, 0, 1, 0, 0, + 0, 1, 1, 0, 0, 1, 0, 0, }; -static yyconst flex_int16_t yy_rule_linenum[46] = { +static yyconst flex_int16_t yy_rule_linenum[47] = { 0, - 44, 46, 51, 52, 53, 54, 55, 57, 58, 59, - 60, 62, 63, 64, 66, 67, 69, 70, 72, 73, - 74, 75, 77, 78, 80, 81, 82, 85, 86, 88, - 89, 90, 92, 93, 95, 96, 98, 99, 101, 103, - 106, 111, 112, 114, 117 + 44, 46, 51, 52, 53, 54, 55, 56, 58, 59, + 60, 61, 63, 64, 65, 67, 68, 70, 71, 73, + 74, 75, 76, 78, 79, 81, 82, 83, 86, 87, + 89, 90, 91, 93, 94, 96, 97, 99, 100, 102, + 104, 107, 112, 113, 115, 118 } ; /* The intent behind this definition is that it'll catch @@ -659,7 +664,7 @@ static yyconst flex_int16_t yy_rule_linenum[46] = { yycolumn = yycolumn + yyleng; \ } -#line 661 "promela.lex.yy.cpp" +#line 669 "promela.lex.yy.cpp" #define INITIAL 0 @@ -694,8 +699,8 @@ struct yyguts_t { 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; + int yy_n_chars; + int yyleng_r; char *yy_c_buf_p; int yy_init; int yy_start; @@ -756,19 +761,23 @@ void promela_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner ); FILE *promela_get_in (yyscan_t yyscanner ); -void promela_set_in (FILE * in_str ,yyscan_t yyscanner ); +void promela_set_in (FILE * _in_str ,yyscan_t yyscanner ); FILE *promela_get_out (yyscan_t yyscanner ); -void promela_set_out (FILE * out_str ,yyscan_t yyscanner ); +void promela_set_out (FILE * _out_str ,yyscan_t yyscanner ); -yy_size_t promela_get_leng (yyscan_t yyscanner ); +int promela_get_leng (yyscan_t yyscanner ); char *promela_get_text (yyscan_t yyscanner ); int promela_get_lineno (yyscan_t yyscanner ); -void promela_set_lineno (int line_number ,yyscan_t yyscanner ); +void promela_set_lineno (int _line_number ,yyscan_t yyscanner ); + +int promela_get_column (yyscan_t yyscanner ); + +void promela_set_column (int _column_no ,yyscan_t yyscanner ); /* %if-bison-bridge */ @@ -796,8 +805,11 @@ extern int promela_wrap (yyscan_t yyscanner ); /* %not-for-header */ +#ifndef YY_NO_UNPUT + static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner); +#endif /* %ok-for-header */ /* %endif */ @@ -830,7 +842,12 @@ static int input (yyscan_t yyscanner ); /* 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. */ @@ -839,7 +856,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) /* %endif */ /* %if-c++-only C++ definition */ /* %endif */ @@ -854,7 +871,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - yy_size_t n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -867,7 +884,7 @@ static int input (yyscan_t yyscanner ); else \ { \ errno=0; \ - while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ + while ( (result = (int) fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ { \ if( errno != EINTR) \ { \ @@ -945,7 +962,7 @@ extern int promela_lex \ /* Code executed at the end of each rule. */ #ifndef YY_BREAK -#define YY_BREAK break; +#define YY_BREAK /*LINTED*/break; #endif /* %% [6.0] YY_RULE_SETUP definition goes here */ @@ -957,17 +974,11 @@ extern int promela_lex \ /** The main scanner function which does all the work. */ YY_DECL { - register yy_state_type yy_current_state; - register char *yy_cp, *yy_bp; - register int yy_act; + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - /* %% [7.0] user's declarations go here */ -#line 42 "promela.l" - - -#line 970 "promela.lex.yy.cpp" - yylval = yylval_param; yylloc = yylloc_param; @@ -1005,452 +1016,469 @@ YY_DECL { promela__load_buffer_state(yyscanner ); } - while ( 1 ) { /* loops until end-of-file is reached */ - /* %% [8.0] yymore()-related code goes here */ - yy_cp = yyg->yy_c_buf_p; + { + /* %% [7.0] user's declarations go here */ +#line 42 "promela.l" - /* 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; +#line 1029 "promela.lex.yy.cpp" - /* %% [9.0] code to set up and find next match goes here */ - yy_current_state = yyg->yy_start; + while ( /*CONSTCOND*/1 ) { /* loops until end-of-file is reached */ + /* %% [8.0] yymore()-related code goes here */ + yy_cp = yyg->yy_c_buf_p; + + /* Support of yytext. */ + *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; + + /* %% [9.0] code to set up and find next match goes here */ + yy_current_state = yyg->yy_start; yy_match: - do { - register 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 >= 126 ) - 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 != 125 ); - yy_cp = yyg->yy_last_accepting_cpos; - yy_current_state = yyg->yy_last_accepting_state; + 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 >= 132 ) + yy_c = yy_meta[(unsigned int) yy_c]; + } + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + ++yy_cp; + } while ( yy_current_state != 131 ); + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; yy_find_action: - /* %% [10.0] code to find the action number goes here */ - yy_act = yy_accept[yy_current_state]; + /* %% [10.0] code to find the action number goes here */ + yy_act = yy_accept[yy_current_state]; - YY_DO_BEFORE_ACTION; + YY_DO_BEFORE_ACTION; - /* %% [11.0] code for yylineno update goes here */ + /* %% [11.0] code for yylineno update goes here */ - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) { - yy_size_t yyl; - for ( yyl = 0; yyl < yyleng; ++yyl ) - if ( yytext[yyl] == '\n' ) + 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 { + yylineno++; + yycolumn=0; + } while(0) + ; + } do_action: /* This label is used only to access EOF actions. */ - /* %% [12.0] debug code goes here */ - if ( yy_flex_debug ) { - if ( yy_act == 0 ) - fprintf( stderr, "--scanner backing up\n" ); - else if ( yy_act < 46 ) - fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", - (long)yy_rule_linenum[yy_act], yytext ); - else if ( yy_act == 46 ) - fprintf( stderr, "--accepting default rule (\"%s\")\n", - yytext ); - else if ( yy_act == 47 ) - fprintf( stderr, "--(end of buffer or a NUL)\n" ); - else - fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); - } - - switch ( yy_act ) { - /* beginning of action switch */ - /* %% [13.0] actions go here */ - case 0: /* must back up */ - /* 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; + /* %% [12.0] debug code goes here */ + if ( yy_flex_debug ) { + if ( yy_act == 0 ) + fprintf( stderr, "--scanner backing up\n" ); + else if ( yy_act < 47 ) + fprintf( stderr, "--accepting rule at line %ld (\"%s\")\n", + (long)yy_rule_linenum[yy_act], yytext ); + else if ( yy_act == 47 ) + fprintf( stderr, "--accepting default rule (\"%s\")\n", + yytext ); + else if ( yy_act == 48 ) + fprintf( stderr, "--(end of buffer or a NUL)\n" ); + else + fprintf( stderr, "--EOF (start condition %d)\n", YY_START ); + } - case 1: - /* rule 1 can match eol */ - YY_RULE_SETUP + switch ( yy_act ) { + /* beginning of action switch */ + /* %% [13.0] actions go here */ + case 0: /* must back up */ + /* undo the effects of YY_DO_BEFORE_ACTION */ + *yy_cp = yyg->yy_hold_char; + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; + + case 1: + /* rule 1 can match eol */ + YY_RULE_SETUP #line 44 "promela.l" - /* multiline comments */ - YY_BREAK - case 2: - YY_RULE_SETUP + /* multiline comments */ + YY_BREAK + case 2: + YY_RULE_SETUP #line 46 "promela.l" - { - yylval->value = strdup(yytext); - return PML_TYPE; - } - YY_BREAK - case 3: - YY_RULE_SETUP + { + yylval->value = strdup(yytext); + return PML_TYPE; + } + YY_BREAK + case 3: + YY_RULE_SETUP #line 51 "promela.l" - { return PML_LEN; } - YY_BREAK - case 4: - YY_RULE_SETUP + { return PML_LEN; } + YY_BREAK + case 4: + YY_RULE_SETUP #line 52 "promela.l" - { yylval->value = strdup(yytext); return PML_CONST; } - YY_BREAK - case 5: - YY_RULE_SETUP + { yylval->value = strdup(yytext); return PML_CONST; } + YY_BREAK + case 5: + YY_RULE_SETUP #line 53 "promela.l" - { return PML_PRINT; } - YY_BREAK - case 6: - YY_RULE_SETUP + { return PML_PRINT; } + YY_BREAK + case 6: + YY_RULE_SETUP #line 54 "promela.l" - { return PML_TYPEDEF; } - YY_BREAK - case 7: - YY_RULE_SETUP + { return PML_TYPEDEF; } + YY_BREAK + case 7: + YY_RULE_SETUP #line 55 "promela.l" - { return PML_ASSERT; } - YY_BREAK - case 8: - YY_RULE_SETUP -#line 57 "promela.l" - { return PML_NEG; } - YY_BREAK - case 9: - YY_RULE_SETUP + { return PML_ASSERT; } + YY_BREAK + case 8: + YY_RULE_SETUP +#line 56 "promela.l" + { return PML_RETURN; } + YY_BREAK + case 9: + YY_RULE_SETUP #line 58 "promela.l" - { return PML_COMPL; } - YY_BREAK - case 10: - YY_RULE_SETUP + { return PML_NEG; } + YY_BREAK + case 10: + YY_RULE_SETUP #line 59 "promela.l" - { return PML_INCR; } - YY_BREAK - case 11: - YY_RULE_SETUP + { return PML_COMPL; } + YY_BREAK + case 11: + YY_RULE_SETUP #line 60 "promela.l" - { return PML_DECR; } - YY_BREAK - case 12: - YY_RULE_SETUP -#line 62 "promela.l" - { return PML_TIMES; } - YY_BREAK - case 13: - YY_RULE_SETUP + { return PML_INCR; } + YY_BREAK + case 12: + YY_RULE_SETUP +#line 61 "promela.l" + { return PML_DECR; } + YY_BREAK + case 13: + YY_RULE_SETUP #line 63 "promela.l" - { return PML_DIVIDE; } - YY_BREAK - case 14: - YY_RULE_SETUP + { return PML_TIMES; } + YY_BREAK + case 14: + YY_RULE_SETUP #line 64 "promela.l" - { return PML_MODULO; } - YY_BREAK - case 15: - YY_RULE_SETUP -#line 66 "promela.l" - { return PML_PLUS; } - YY_BREAK - case 16: - YY_RULE_SETUP + { return PML_DIVIDE; } + YY_BREAK + case 15: + YY_RULE_SETUP +#line 65 "promela.l" + { return PML_MODULO; } + YY_BREAK + case 16: + YY_RULE_SETUP #line 67 "promela.l" - { return PML_MINUS; } - YY_BREAK - case 17: - YY_RULE_SETUP -#line 69 "promela.l" - { return PML_LSHIFT; } - YY_BREAK - case 18: - YY_RULE_SETUP + { return PML_PLUS; } + YY_BREAK + case 17: + YY_RULE_SETUP +#line 68 "promela.l" + { return PML_MINUS; } + YY_BREAK + case 18: + YY_RULE_SETUP #line 70 "promela.l" - { return PML_RSHIFT; } - YY_BREAK - case 19: - YY_RULE_SETUP -#line 72 "promela.l" - { return PML_LE; } - YY_BREAK - case 20: - YY_RULE_SETUP + { return PML_LSHIFT; } + YY_BREAK + case 19: + YY_RULE_SETUP +#line 71 "promela.l" + { return PML_RSHIFT; } + YY_BREAK + case 20: + YY_RULE_SETUP #line 73 "promela.l" - { return PML_GE; } - YY_BREAK - case 21: - YY_RULE_SETUP + { return PML_LE; } + YY_BREAK + case 21: + YY_RULE_SETUP #line 74 "promela.l" - { return PML_LT; } - YY_BREAK - case 22: - YY_RULE_SETUP + { return PML_GE; } + YY_BREAK + case 22: + YY_RULE_SETUP #line 75 "promela.l" - { return PML_GT; } - YY_BREAK - case 23: - YY_RULE_SETUP -#line 77 "promela.l" - { return PML_NE; } - YY_BREAK - case 24: - YY_RULE_SETUP + { return PML_LT; } + YY_BREAK + case 23: + YY_RULE_SETUP +#line 76 "promela.l" + { return PML_GT; } + YY_BREAK + case 24: + YY_RULE_SETUP #line 78 "promela.l" - { return PML_EQ; } - YY_BREAK - case 25: - YY_RULE_SETUP -#line 80 "promela.l" - { return PML_BITAND; } - YY_BREAK - case 26: - YY_RULE_SETUP + { return PML_NE; } + YY_BREAK + case 25: + YY_RULE_SETUP +#line 79 "promela.l" + { return PML_EQ; } + YY_BREAK + case 26: + YY_RULE_SETUP #line 81 "promela.l" - { return PML_BITXOR; } - YY_BREAK - case 27: - YY_RULE_SETUP + { return PML_BITAND; } + YY_BREAK + case 27: + YY_RULE_SETUP #line 82 "promela.l" - { return PML_BITOR; } - YY_BREAK - case 28: - YY_RULE_SETUP -#line 85 "promela.l" - { return PML_AND; } - YY_BREAK - case 29: - YY_RULE_SETUP + { return PML_BITXOR; } + YY_BREAK + case 28: + YY_RULE_SETUP +#line 83 "promela.l" + { return PML_BITOR; } + YY_BREAK + case 29: + YY_RULE_SETUP #line 86 "promela.l" - { return PML_OR; } - YY_BREAK - case 30: - YY_RULE_SETUP -#line 88 "promela.l" - { return PML_DOT; } - YY_BREAK - case 31: - YY_RULE_SETUP + { return PML_AND; } + YY_BREAK + case 30: + YY_RULE_SETUP +#line 87 "promela.l" + { return PML_OR; } + YY_BREAK + case 31: + YY_RULE_SETUP #line 89 "promela.l" - { return PML_COMMA; } - YY_BREAK - case 32: - YY_RULE_SETUP + { return PML_DOT; } + YY_BREAK + case 32: + YY_RULE_SETUP #line 90 "promela.l" - { return PML_SEMI; } - YY_BREAK - case 33: - YY_RULE_SETUP -#line 92 "promela.l" - { return '('; } - YY_BREAK - case 34: - YY_RULE_SETUP + { return PML_COMMA; } + YY_BREAK + case 33: + YY_RULE_SETUP +#line 91 "promela.l" + { return PML_SEMI; } + YY_BREAK + case 34: + YY_RULE_SETUP #line 93 "promela.l" - { return ')'; } - YY_BREAK - case 35: - YY_RULE_SETUP -#line 95 "promela.l" - { return '['; } - YY_BREAK - case 36: - YY_RULE_SETUP + { return '('; } + YY_BREAK + case 35: + YY_RULE_SETUP +#line 94 "promela.l" + { return ')'; } + YY_BREAK + case 36: + YY_RULE_SETUP #line 96 "promela.l" - { return ']'; } - YY_BREAK - case 37: - YY_RULE_SETUP -#line 98 "promela.l" - { return '{'; } - YY_BREAK - case 38: - YY_RULE_SETUP + { return '['; } + YY_BREAK + case 37: + YY_RULE_SETUP +#line 97 "promela.l" + { return ']'; } + YY_BREAK + case 38: + YY_RULE_SETUP #line 99 "promela.l" - { return '}'; } - YY_BREAK - case 39: - YY_RULE_SETUP -#line 101 "promela.l" - { return PML_ASGN; } - YY_BREAK - case 40: - /* rule 40 can match eol */ - YY_RULE_SETUP -#line 103 "promela.l" - { yylval->value = strdup(yytext); return(PML_STRING); } - YY_BREAK - case 41: - /* rule 41 can match eol */ - YY_RULE_SETUP -#line 106 "promela.l" - { - /* Non PROMELA extension for single quoted string literals */ - yylval->value = strdup(yytext); - return(PML_STRING); - } - YY_BREAK - case 42: - YY_RULE_SETUP -#line 111 "promela.l" - { yylval->value = strdup(yytext); return PML_CONST; } - YY_BREAK - case 43: - YY_RULE_SETUP + { return '{'; } + YY_BREAK + case 39: + YY_RULE_SETUP +#line 100 "promela.l" + { return '}'; } + YY_BREAK + case 40: + YY_RULE_SETUP +#line 102 "promela.l" + { return PML_ASGN; } + YY_BREAK + case 41: + /* rule 41 can match eol */ + YY_RULE_SETUP +#line 104 "promela.l" + { yylval->value = strdup(yytext); return(PML_STRING); } + YY_BREAK + case 42: + /* rule 42 can match eol */ + YY_RULE_SETUP +#line 107 "promela.l" + { + /* Non PROMELA extension for single quoted string literals */ + yylval->value = strdup(yytext); + return(PML_STRING); + } + YY_BREAK + case 43: + YY_RULE_SETUP #line 112 "promela.l" - { yylval->value = strdup(yytext); return PML_NAME; } - YY_BREAK - case 44: - /* rule 44 can match eol */ - YY_RULE_SETUP -#line 114 "promela.l" - /* eat up whitespace */ - YY_BREAK - case 45: - YY_RULE_SETUP -#line 117 "promela.l" - { /*printf( "Unrecognized character: %s\n", yytext ); */ } - YY_BREAK - case 46: - YY_RULE_SETUP -#line 118 "promela.l" - ECHO; - YY_BREAK -#line 1336 "promela.lex.yy.cpp" - case YY_STATE_EOF(INITIAL): - yyterminate(); - - case YY_END_OF_BUFFER: { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = yyg->yy_hold_char; - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * promela_lex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* 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 ); + { yylval->value = strdup(yytext); return PML_CONST; } + YY_BREAK + case 44: + YY_RULE_SETUP +#line 113 "promela.l" + { yylval->value = strdup(yytext); return PML_NAME; } + YY_BREAK + case 45: + /* rule 45 can match eol */ + YY_RULE_SETUP +#line 115 "promela.l" + /* eat up whitespace */ + YY_BREAK + case 46: + YY_RULE_SETUP +#line 118 "promela.l" + { return PML_UNREC; } + YY_BREAK + case 47: + YY_RULE_SETUP +#line 119 "promela.l" + ECHO; + YY_BREAK +#line 1362 "promela.lex.yy.cpp" + case YY_STATE_EOF(INITIAL): + yyterminate(); + + case YY_END_OF_BUFFER: { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = yyg->yy_hold_char; + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * promela_lex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + /* %if-c-only */ + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + /* %endif */ + /* %if-c++-only */ + /* %endif */ + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } - /* 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). + /* 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_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); + yy_current_state = yy_get_previous_state( yyscanner ); - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + /* 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). + */ - if ( yy_next_state ) { - /* Consume the NUL. */ - yy_cp = ++yyg->yy_c_buf_p; - yy_current_state = yy_next_state; - goto yy_match; - } + yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner); - else { - /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ - yy_cp = yyg->yy_last_accepting_cpos; - yy_current_state = yyg->yy_last_accepting_state; - goto yy_find_action; - } - } + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - else switch ( yy_get_next_buffer( yyscanner ) ) { - case EOB_ACT_END_OF_FILE: { - yyg->yy_did_buffer_switch_on_eof = 0; - - if ( promela_wrap(yyscanner ) ) { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; + if ( yy_next_state ) { + /* Consume the NUL. */ + yy_cp = ++yyg->yy_c_buf_p; + yy_current_state = yy_next_state; + goto yy_match; } else { - if ( ! yyg->yy_did_buffer_switch_on_eof ) - YY_NEW_FILE; + /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */ + yy_cp = yyg->yy_last_accepting_cpos; + yy_current_state = yyg->yy_last_accepting_state; + goto yy_find_action; } - break; } - case EOB_ACT_CONTINUE_SCAN: - yyg->yy_c_buf_p = - yyg->yytext_ptr + yy_amount_of_matched_text; + else switch ( yy_get_next_buffer( yyscanner ) ) { + case EOB_ACT_END_OF_FILE: { + yyg->yy_did_buffer_switch_on_eof = 0; + + if ( promela_wrap(yyscanner ) ) { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else { + if ( ! yyg->yy_did_buffer_switch_on_eof ) + YY_NEW_FILE; + } + break; + } - yy_current_state = yy_get_previous_state( yyscanner ); + case EOB_ACT_CONTINUE_SCAN: + yyg->yy_c_buf_p = + yyg->yytext_ptr + yy_amount_of_matched_text; - yy_cp = yyg->yy_c_buf_p; - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - goto yy_match; + yy_current_state = yy_get_previous_state( yyscanner ); - case EOB_ACT_LAST_MATCH: - yyg->yy_c_buf_p = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; + yy_cp = yyg->yy_c_buf_p; + yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; + goto yy_match; - yy_current_state = yy_get_previous_state( yyscanner ); + case EOB_ACT_LAST_MATCH: + yyg->yy_c_buf_p = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars]; - yy_cp = yyg->yy_c_buf_p; - yy_bp = yyg->yytext_ptr + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } + 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 */ + 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 promela_lex */ /* %ok-for-header */ @@ -1475,9 +1503,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* %endif */ { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - register char *source = yyg->yytext_ptr; - register int number_to_move, i; + 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] ) @@ -1504,7 +1532,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; + 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++); @@ -1516,20 +1544,20 @@ static int yy_get_next_buffer (yyscan_t yyscanner) YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; else { - yy_size_t num_to_read = + int 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; + 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; + int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -1541,7 +1569,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) promela_realloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = 0; + b->yy_ch_buf = NULL; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -1580,9 +1608,9 @@ static int yy_get_next_buffer (yyscan_t yyscanner) 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) { + if ((int) (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); + int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) promela_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()" ); @@ -1607,8 +1635,8 @@ static yy_state_type yy_get_previous_state (yyscan_t yyscanner) /* %if-c++-only */ /* %endif */ { - register yy_state_type yy_current_state; - register char *yy_cp; + yy_state_type yy_current_state; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* %% [15.0] code to get the start state into yy_current_state goes here */ @@ -1616,17 +1644,17 @@ static yy_state_type yy_get_previous_state (yyscan_t yyscanner) for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp ) { /* %% [16.0] code to find the next state goes here */ - register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + 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 >= 126 ) + if ( yy_current_state >= 132 ) yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; } return yy_current_state; @@ -1643,35 +1671,37 @@ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_ /* %if-c++-only */ /* %endif */ { - register int yy_is_jam; + int yy_is_jam; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ - register char *yy_cp = yyg->yy_c_buf_p; + char *yy_cp = yyg->yy_c_buf_p; - register YY_CHAR yy_c = 1; + 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 >= 126 ) + if ( yy_current_state >= 132 ) 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 == 125); + yy_current_state = yy_nxt[yy_base[yy_current_state] + (flex_int16_t) yy_c]; + yy_is_jam = (yy_current_state == 131); + (void)yyg; return yy_is_jam ? 0 : yy_current_state; } +#ifndef YY_NO_UNPUT /* %if-c-only */ -static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) +static void yyunput (int c, char * yy_bp , yyscan_t yyscanner) /* %endif */ /* %if-c++-only */ /* %endif */ { - register char *yy_cp; + char *yy_cp; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yy_cp = yyg->yy_c_buf_p; @@ -1682,10 +1712,10 @@ static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - register yy_size_t number_to_move = yyg->yy_n_chars + 2; - register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - register char *source = + int 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 ) @@ -1694,7 +1724,7 @@ static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + yyg->yy_n_chars = (int) 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" ); @@ -1715,6 +1745,7 @@ static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner) /* %if-c-only */ /* %endif */ +#endif /* %if-c-only */ #ifndef YY_NO_INPUT @@ -1744,7 +1775,7 @@ static int input (yyscan_t yyscanner) else { /* need more input */ - yy_size_t offset = yyg->yy_c_buf_p - yyg->yytext_ptr; + int offset = yyg->yy_c_buf_p - yyg->yytext_ptr; ++yyg->yy_c_buf_p; switch ( yy_get_next_buffer( yyscanner ) ) { @@ -1826,6 +1857,9 @@ void promela_restart (FILE * input_file , yyscan_t yyscanner) promela__load_buffer_state(yyscanner ); } +/* %if-c++-only */ +/* %endif */ + /** Switch to a different input buffer. * @param new_buffer The new input buffer. * @param yyscanner The scanner object. @@ -1874,7 +1908,11 @@ static void promela__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; + /* %if-c-only */ yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + /* %endif */ + /* %if-c++-only */ + /* %endif */ yyg->yy_hold_char = *yyg->yy_c_buf_p; } @@ -1896,7 +1934,7 @@ YY_BUFFER_STATE promela__create_buffer (FILE * file, int size , yyscan_t yysca if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in promela__create_buffer()" ); - b->yy_buf_size = size; + 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. @@ -1912,6 +1950,9 @@ YY_BUFFER_STATE promela__create_buffer (FILE * file, int size , yyscan_t yysca return b; } +/* %if-c++-only */ +/* %endif */ + /** Destroy the buffer. * @param b a buffer created with promela__create_buffer() * @param yyscanner The scanner object. @@ -1936,13 +1977,6 @@ void promela__delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner) promela_free((void *) b ,yyscanner ); } -/* %if-c-only */ - -/* %endif */ - -/* %if-c++-only */ -/* %endif */ - /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, * such as during a promela_restart() or at EOF. @@ -1959,7 +1993,11 @@ static void promela__init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yy promela__flush_buffer(b ,yyscanner); + /* %if-c-only */ b->yy_input_file = file; + /* %endif */ + /* %if-c++-only */ + /* %endif */ b->yy_fill_buffer = 1; /* If b is the current buffer, then promela__init_buffer was _probably_ @@ -2088,7 +2126,7 @@ static void promela_ensure_buffer_stack (yyscan_t yyscanner) /* %if-c++-only */ /* %endif */ { - yy_size_t num_to_alloc; + int num_to_alloc; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; if (!yyg->yy_buffer_stack) { @@ -2097,7 +2135,7 @@ static void promela_ensure_buffer_stack (yyscan_t yyscanner) * 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; + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ yyg->yy_buffer_stack = (struct yy_buffer_state**)promela_alloc (num_to_alloc * sizeof(struct yy_buffer_state*) , yyscanner); @@ -2114,7 +2152,7 @@ static void promela_ensure_buffer_stack (yyscan_t yyscanner) if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1) { /* Increase the buffer to prepare for a possible push. */ - int grow_size = 8 /* arbitrary grow size */; + 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**)promela_realloc @@ -2145,7 +2183,7 @@ YY_BUFFER_STATE promela__scan_buffer (char * base, yy_size_t size , yyscan_t y 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; + return NULL; b = (YY_BUFFER_STATE) promela_alloc(sizeof( struct yy_buffer_state ) ,yyscanner ); if ( ! b ) @@ -2154,7 +2192,7 @@ YY_BUFFER_STATE promela__scan_buffer (char * base, yy_size_t size , yyscan_t y 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_input_file = NULL; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; @@ -2178,25 +2216,26 @@ YY_BUFFER_STATE promela__scan_buffer (char * base, yy_size_t size , yyscan_t y */ YY_BUFFER_STATE promela__scan_string (yyconst char * yystr , yyscan_t yyscanner) { - return promela__scan_bytes(yystr,strlen(yystr) ,yyscanner); + return promela__scan_bytes(yystr,(int) strlen(yystr) ,yyscanner); } /* %endif */ /* %if-c-only */ /** Setup the input buffer state to scan the given bytes. The next call to promela_lex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @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 promela__scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len , yyscan_t yyscanner) { +YY_BUFFER_STATE promela__scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; - yy_size_t n, i; + yy_size_t n; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; + n = (yy_size_t) _yybytes_len + 2; buf = (char *) promela_alloc(n ,yyscanner ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in promela__scan_bytes()" ); @@ -2224,7 +2263,9 @@ YY_BUFFER_STATE promela__scan_bytes (yyconst char * yybytes, yy_size_t _yybyte #endif /* %if-c-only */ -static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner) { +static void yynoreturn 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 ); } @@ -2307,7 +2348,7 @@ FILE *promela_get_out (yyscan_t yyscanner) { /** Get the length of the current token. * @param yyscanner The scanner object. */ -yy_size_t promela_get_leng (yyscan_t yyscanner) { +int promela_get_leng (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyleng; } @@ -2335,47 +2376,47 @@ void promela_set_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) { /* %endif */ /** Set the current line number. - * @param line_number + * @param _line_number line number * @param yyscanner The scanner object. */ -void promela_set_lineno (int line_number , yyscan_t yyscanner) { +void promela_set_lineno (int _line_number , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* lineno is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "promela_set_lineno called with no buffer" , yyscanner); + YY_FATAL_ERROR( "promela_set_lineno called with no buffer" ); - yylineno = line_number; + yylineno = _line_number; } /** Set the current column. - * @param line_number + * @param _column_no column number * @param yyscanner The scanner object. */ -void promela_set_column (int column_no , yyscan_t yyscanner) { +void promela_set_column (int _column_no , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* column is only valid if an input buffer exists. */ if (! YY_CURRENT_BUFFER ) - yy_fatal_error( "promela_set_column called with no buffer" , yyscanner); + YY_FATAL_ERROR( "promela_set_column called with no buffer" ); - yycolumn = column_no; + yycolumn = _column_no; } /** Set the input stream. This does not discard the current * input buffer. - * @param in_str A readable stream. + * @param _in_str A readable stream. * @param yyscanner The scanner object. * @see promela__switch_to_buffer */ -void promela_set_in (FILE * in_str , yyscan_t yyscanner) { +void promela_set_in (FILE * _in_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyin = in_str ; + yyin = _in_str ; } -void promela_set_out (FILE * out_str , yyscan_t yyscanner) { +void promela_set_out (FILE * _out_str , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yyout = out_str ; + yyout = _out_str ; } int promela_get_debug (yyscan_t yyscanner) { @@ -2383,9 +2424,9 @@ int promela_get_debug (yyscan_t yyscanner) { return yy_flex_debug; } -void promela_set_debug (int bdebug , yyscan_t yyscanner) { +void promela_set_debug (int _bdebug , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; - yy_flex_debug = bdebug ; + yy_flex_debug = _bdebug ; } /* %endif */ @@ -2490,10 +2531,10 @@ static int yy_init_globals (yyscan_t yyscanner) { * This function is called from promela_lex_destroy(), so don't allocate here. */ - yyg->yy_buffer_stack = 0; + yyg->yy_buffer_stack = NULL; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; - yyg->yy_c_buf_p = (char *) 0; + yyg->yy_c_buf_p = NULL; yyg->yy_init = 0; yyg->yy_start = 0; @@ -2506,8 +2547,8 @@ static int yy_init_globals (yyscan_t yyscanner) { yyin = stdin; yyout = stdout; #else - yyin = (FILE *) 0; - yyout = (FILE *) 0; + yyin = NULL; + yyout = NULL; #endif /* For future reference: Set errno on error, since we are called by @@ -2556,7 +2597,10 @@ int promela_lex_destroy (yyscan_t yyscanner) { #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) { - register int i; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + + int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -2564,7 +2608,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) { - register int n; + int n; for ( n = 0; s[n]; ++n ) ; @@ -2573,10 +2617,15 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) { #endif void *promela_alloc (yy_size_t size , yyscan_t yyscanner) { - return (void *) malloc( size ); + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; + return malloc(size); } void *promela_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 @@ -2584,10 +2633,12 @@ void *promela_realloc (void * ptr, yy_size_t size , yyscan_t yyscanner) { * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return (void *) realloc( (char *) ptr, size ); + return realloc(ptr, size); } void promela_free (void * ptr , yyscan_t yyscanner) { + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; + (void)yyg; free( (char *) ptr ); /* see promela_realloc() for (char *) cast */ } @@ -2598,4 +2649,4 @@ void promela_free (void * ptr , yyscan_t yyscanner) { /* %ok-for-header */ -#line 118 "promela.l" +#line 119 "promela.l" diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp b/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp index 098c890..eddb963 100644 --- a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp +++ b/src/uscxml/plugins/datamodel/promela/parser/promela.tab.cpp @@ -1,8 +1,8 @@ -/* A Bison parser, made by GNU Bison 2.7.12-4996. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. + 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 @@ -44,7 +44,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.7.12-4996" +#define YYBISON_VERSION "3.0.4" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -65,15 +65,12 @@ #define yyparse promela_parse #define yylex promela_lex #define yyerror promela_error -#define yylval promela_lval -#define yychar promela_char #define yydebug promela_debug #define yynerrs promela_nerrs -#define yylloc promela_lloc + /* Copy the first part of user declarations. */ -/* Line 371 of yacc.c */ -#line 14 "promela.ypp" +#line 14 "promela.ypp" /* yacc.c:339 */ #include "../PromelaParser.h" #include "promela.tab.hpp" @@ -88,14 +85,13 @@ extern int promela_lex (PROMELA_STYPE* yylval_param, PROMELA_LTYPE* yylloc_param using namespace uscxml; -/* Line 371 of yacc.c */ -#line 93 "promela.tab.cpp" +#line 89 "promela.tab.cpp" /* yacc.c:339 */ -# ifndef YY_NULL +# ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULL nullptr +# define YY_NULLPTR nullptr # else -# define YY_NULL 0 +# define YY_NULLPTR 0 # endif # endif @@ -111,10 +107,10 @@ using namespace uscxml; by #include "promela.tab.hpp". */ #ifndef YY_PROMELA_PROMELA_TAB_HPP_INCLUDED # define YY_PROMELA_PROMELA_TAB_HPP_INCLUDED -/* Enabling traces. */ +/* Debug traces. */ #ifndef PROMELA_DEBUG # if defined YYDEBUG -# if YYDEBUG +#if YYDEBUG # define PROMELA_DEBUG 1 # else # define PROMELA_DEBUG 0 @@ -127,11 +123,9 @@ using namespace uscxml; extern int promela_debug; #endif -/* Tokens. */ +/* Token type. */ #ifndef PROMELA_TOKENTYPE # define PROMELA_TOKENTYPE -/* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ enum promela_tokentype { PML_VAR_ARRAY = 258, PML_VARLIST = 259, @@ -181,85 +175,74 @@ enum promela_tokentype { PML_INIT = 303, PML_LTL = 304, PML_COMMA = 305, - PML_ASGN = 306, - PML_AND = 307, + PML_UNREC = 306, + PML_ASGN = 307, PML_OR = 308, - PML_BITAND = 309, - PML_BITXOR = 310, - PML_BITOR = 311, - PML_NE = 312, + PML_AND = 309, + PML_BITOR = 310, + PML_BITXOR = 311, + PML_BITAND = 312, PML_EQ = 313, - PML_LE = 314, - PML_GE = 315, + PML_NE = 314, + PML_GT = 315, PML_LT = 316, - PML_GT = 317, - PML_RSHIFT = 318, + PML_GE = 317, + PML_LE = 318, PML_LSHIFT = 319, - PML_MINUS = 320, + PML_RSHIFT = 320, PML_PLUS = 321, - PML_MODULO = 322, - PML_DIVIDE = 323, - PML_TIMES = 324, - PML_DECR = 325, + PML_MINUS = 322, + PML_TIMES = 323, + PML_DIVIDE = 324, + PML_MODULO = 325, PML_INCR = 326, - PML_COMPL = 327, - PML_NEG = 328, - PML_CMPND = 329, - PML_DOT = 330 + PML_DECR = 327, + PML_COMPL = 328, + PML_NEG = 329, + PML_DOT = 330, + PML_CMPND = 331 }; #endif - +/* Value type. */ #if ! defined PROMELA_STYPE && ! defined PROMELA_STYPE_IS_DECLARED -typedef union PROMELA_STYPE { - /* Line 387 of yacc.c */ -#line 39 "promela.ypp" + +union PROMELA_STYPE { +#line 39 "promela.ypp" /* yacc.c:355 */ uscxml::PromelaParserNode* node; char* value; +#line 219 "promela.tab.cpp" /* yacc.c:355 */ +}; - /* Line 387 of yacc.c */ -#line 225 "promela.tab.cpp" -} PROMELA_STYPE; +typedef union PROMELA_STYPE PROMELA_STYPE; # define PROMELA_STYPE_IS_TRIVIAL 1 -# define promela_stype PROMELA_STYPE /* obsolescent; will be withdrawn */ # define PROMELA_STYPE_IS_DECLARED 1 #endif +/* Location type. */ #if ! defined PROMELA_LTYPE && ! defined PROMELA_LTYPE_IS_DECLARED -typedef struct PROMELA_LTYPE { +typedef struct PROMELA_LTYPE PROMELA_LTYPE; +struct PROMELA_LTYPE { int first_line; int first_column; int last_line; int last_column; -} PROMELA_LTYPE; -# define promela_ltype PROMELA_LTYPE /* obsolescent; will be withdrawn */ +}; # define PROMELA_LTYPE_IS_DECLARED 1 # define PROMELA_LTYPE_IS_TRIVIAL 1 #endif -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int promela_parse (void *YYPARSE_PARAM); -#else -int promela_parse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus + int promela_parse (uscxml::PromelaParser* ctx, void * scanner); -#else -int promela_parse (); -#endif -#endif /* ! YYPARSE_PARAM */ #endif /* !YY_PROMELA_PROMELA_TAB_HPP_INCLUDED */ /* Copy the second part of user declarations. */ -/* Line 390 of yacc.c */ -#line 265 "promela.tab.cpp" +#line 249 "promela.tab.cpp" /* yacc.c:358 */ #ifdef short # undef short @@ -273,11 +256,8 @@ typedef unsigned char yytype_uint8; #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; #else -typedef short int yytype_int8; +typedef signed char yytype_int8; #endif #ifdef YYTYPE_UINT16 @@ -297,8 +277,7 @@ typedef short int yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# elif ! defined YYSIZE_T # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -320,11 +299,30 @@ typedef short int yytype_int16; # endif #endif -#ifndef __attribute__ -/* This feature is available in gcc versions 2.5 and later. */ -# if (! defined __GNUC__ || __GNUC__ < 2 \ - || (__GNUC__ == 2 && __GNUC_MINOR__ < 5)) -# define __attribute__(Spec) /* empty */ +#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 @@ -335,25 +333,26 @@ typedef short int yytype_int16; # define YYUSE(E) /* empty */ #endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(N) (N) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int yyi) +#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 -static int -YYID (yyi) -int yyi; +# define YY_INITIAL_VALUE(Value) Value #endif -{ - return yyi; -} +#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. */ @@ -371,8 +370,7 @@ int yyi; # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# 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 @@ -384,8 +382,8 @@ int yyi; # endif # ifdef YYSTACK_ALLOC -/* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) +/* 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 @@ -401,7 +399,7 @@ int yyi; # endif # if (defined __cplusplus && ! defined EXIT_SUCCESS \ && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) + && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef EXIT_SUCCESS # define EXIT_SUCCESS 0 @@ -409,15 +407,13 @@ int yyi; # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# 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 && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if ! defined free && ! defined EXIT_SUCCESS void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif @@ -427,8 +423,8 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ - || (defined PROMELA_LTYPE_IS_TRIVIAL && PROMELA_LTYPE_IS_TRIVIAL \ - && defined PROMELA_STYPE_IS_TRIVIAL && PROMELA_STYPE_IS_TRIVIAL))) + || (defined PROMELA_LTYPE_IS_TRIVIAL && PROMELA_LTYPE_IS_TRIVIAL \ + && defined PROMELA_STYPE_IS_TRIVIAL && PROMELA_STYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { @@ -453,16 +449,16 @@ union yyalloc { 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 (YYID (0)) +# 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 @@ -481,7 +477,7 @@ union yyalloc { for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif #endif /* !YYCOPY_NEEDED */ @@ -489,25 +485,27 @@ union yyalloc { /* YYFINAL -- State number of the termination state. */ #define YYFINAL 32 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 285 +#define YYLAST 288 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 82 +#define YYNTOKENS 83 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 21 /* YYNRULES -- Number of rules. */ #define YYNRULES 81 -/* YYNRULES -- Number of states. */ +/* YYNSTATES -- Number of states. */ #define YYNSTATES 143 -/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ +/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned + by yylex, with out-of-bounds checking. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 330 +#define YYMAXUTOK 331 -#define YYTRANSLATE(YYX) \ +#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) -/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ +/* 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, @@ -542,56 +540,11 @@ static const yytype_uint8 yytranslate[] = { 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, - 81 + 81, 82 }; #if PROMELA_DEBUG -/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in - YYRHS. */ -static const yytype_uint16 yyprhs[] = { - 0, 0, 3, 5, 7, 9, 11, 13, 18, 21, - 22, 25, 29, 33, 37, 41, 45, 49, 53, 57, - 61, 65, 69, 73, 77, 81, 85, 89, 93, 97, - 101, 104, 107, 112, 114, 116, 118, 119, 121, 123, - 125, 129, 133, 140, 143, 149, 151, 154, 158, 160, - 164, 166, 170, 172, 176, 181, 183, 186, 190, 194, - 198, 202, 206, 210, 212, 215, 218, 220, 223, 227, - 229, 233, 236, 239, 245, 250, 255, 258, 260, 261, - 264, 266 -}; - -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int8 yyrhs[] = { - 83, 0, -1, 92, -1, 88, -1, 98, -1, 86, - -1, 48, -1, 48, 13, 88, 14, -1, 85, 87, - -1, -1, 81, 86, -1, 11, 88, 12, -1, 88, - 72, 88, -1, 88, 71, 88, -1, 88, 75, 88, - -1, 88, 74, 88, -1, 88, 73, 88, -1, 88, - 60, 88, -1, 88, 61, 88, -1, 88, 62, 88, - -1, 88, 68, 88, -1, 88, 67, 88, -1, 88, - 66, 88, -1, 88, 65, 88, -1, 88, 64, 88, - -1, 88, 63, 88, -1, 88, 58, 88, -1, 88, - 59, 88, -1, 88, 70, 88, -1, 88, 69, 88, - -1, 79, 88, -1, 71, 88, -1, 20, 11, 84, - 12, -1, 84, -1, 45, -1, 21, -1, -1, 42, - -1, 43, -1, 44, -1, 89, 46, 93, -1, 89, - 49, 93, -1, 89, 46, 57, 15, 97, 16, -1, - 89, 91, -1, 22, 48, 15, 92, 16, -1, 90, - -1, 90, 31, -1, 90, 31, 92, -1, 94, -1, - 94, 56, 93, -1, 95, -1, 95, 57, 88, -1, - 48, -1, 48, 8, 45, -1, 48, 13, 96, 14, - -1, 45, -1, 71, 96, -1, 11, 96, 12, -1, - 96, 72, 96, -1, 96, 71, 96, -1, 96, 75, - 96, -1, 96, 74, 96, -1, 96, 73, 96, -1, - 48, -1, 97, 48, -1, 97, 56, -1, 99, -1, - 99, 31, -1, 99, 31, 98, -1, 100, -1, 84, - 57, 88, -1, 84, 77, -1, 84, 76, -1, 18, - 11, 21, 101, 12, -1, 18, 11, 84, 12, -1, - 18, 11, 45, 12, -1, 17, 88, -1, 88, -1, - -1, 56, 102, -1, 88, -1, 88, 56, 102, -1 -}; - -/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ +/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { 0, 85, 85, 89, 93, 99, 102, 103, 106, 121, 122, 132, 133, 134, 135, 136, 137, 138, 139, 140, @@ -619,20 +572,20 @@ static const char *const yytname[] = { "PML_SEP", "PML_DOTDOT", "PML_HIDDEN", "PML_SHOW", "PML_ISLOCAL", "PML_CONST", "PML_TYPE", "PML_XU", "PML_NAME", "PML_UNAME", "PML_PNAME", "PML_INAME", "PML_CLAIM", "PML_TRACE", "PML_INIT", "PML_LTL", - "PML_COMMA", "PML_ASGN", "PML_AND", "PML_OR", "PML_BITAND", "PML_BITXOR", - "PML_BITOR", "PML_NE", "PML_EQ", "PML_LE", "PML_GE", "PML_LT", "PML_GT", - "PML_RSHIFT", "PML_LSHIFT", "PML_MINUS", "PML_PLUS", "PML_MODULO", - "PML_DIVIDE", "PML_TIMES", "PML_DECR", "PML_INCR", "PML_COMPL", - "PML_NEG", "PML_CMPND", "PML_DOT", "$accept", "program", "varref", - "pfld", "cmpnd", "sfld", "expr", "vis", "one_decl", "utype", "decl_lst", - "var_list", "ivar", "vardcl", "const_expr", "nlst", "stmnt_lst", "stmnt", - "Stmnt", "prargs", "arg", YY_NULL + "PML_COMMA", "PML_UNREC", "PML_ASGN", "PML_OR", "PML_AND", "PML_BITOR", + "PML_BITXOR", "PML_BITAND", "PML_EQ", "PML_NE", "PML_GT", "PML_LT", + "PML_GE", "PML_LE", "PML_LSHIFT", "PML_RSHIFT", "PML_PLUS", "PML_MINUS", + "PML_TIMES", "PML_DIVIDE", "PML_MODULO", "PML_INCR", "PML_DECR", + "PML_COMPL", "PML_NEG", "PML_DOT", "PML_CMPND", "$accept", "program", + "varref", "pfld", "cmpnd", "sfld", "expr", "vis", "one_decl", "utype", + "decl_lst", "var_list", "ivar", "vardcl", "const_expr", "nlst", + "stmnt_lst", "stmnt", "Stmnt", "prargs", "arg", YY_NULLPTR }; #endif # ifdef YYPRINT -/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to - token YYLEX-NUM. */ +/* 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, 40, 41, 91, 93, 123, 125, 266, 267, 268, @@ -642,55 +595,66 @@ static const yytype_uint16 yytoknum[] = { 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, - 329, 330 + 329, 330, 331 }; # endif -/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = { - 0, 82, 83, 83, 83, 84, 85, 85, 86, 87, - 87, 88, 88, 88, 88, 88, 88, 88, 88, 88, - 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, - 88, 88, 88, 88, 88, 88, 89, 89, 89, 89, - 90, 90, 90, 90, 91, 92, 92, 92, 93, 93, - 94, 94, 95, 95, 95, 96, 96, 96, 96, 96, - 96, 96, 96, 97, 97, 97, 98, 98, 98, 99, - 100, 100, 100, 100, 100, 100, 100, 100, 101, 101, - 102, 102 -}; +#define YYPACT_NINF -112 -/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = { - 0, 2, 1, 1, 1, 1, 1, 4, 2, 0, - 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, - 2, 2, 4, 1, 1, 1, 0, 1, 1, 1, - 3, 3, 6, 2, 5, 1, 2, 3, 1, 3, - 1, 3, 1, 3, 4, 1, 2, 3, 3, 3, - 3, 3, 3, 1, 2, 2, 1, 2, 3, 1, - 3, 2, 2, 5, 4, 4, 2, 1, 0, 2, - 1, 3 +#define yypact_value_is_default(Yystate) \ + (!!((Yystate) == (-112))) + +#define YYTABLE_NINF -78 + +#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[] = { + 14, 54, 54, -6, -3, -112, -112, -112, -112, -112, + 2, 54, 54, 24, -51, -53, -112, 140, 64, 5, + -112, -112, 6, -112, -112, 76, 182, 69, 41, 54, + 30, -112, -112, 54, -112, -112, 41, -112, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 43, -45, 45, -112, + 175, 52, -112, 11, 86, 89, 95, 94, 182, -112, + 198, 198, 112, 112, 112, 209, 209, 48, 48, 48, + 48, 120, 120, 30, 30, -112, -112, -112, 97, 1, + 100, -112, 60, 70, -112, -112, 182, -112, 54, 114, + -112, -112, -112, -112, 130, 85, 19, 83, 45, 54, + 164, -112, -112, 117, -112, 19, -112, 19, 9, -112, + 55, -112, 182, 54, -112, 4, 212, -112, 19, 19, + 19, 19, 19, -112, -112, -112, -112, -112, 212, 212, + -112, -112, -112 }; -/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE doesn't specify something else to do. Zero +/* 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[] = { 36, 0, 0, 0, 0, 35, 37, 38, 39, 34, - 6, 0, 0, 0, 33, 9, 5, 3, 0, 45, - 2, 4, 66, 69, 33, 0, 76, 0, 0, 0, - 31, 30, 1, 0, 72, 71, 0, 8, 0, 0, + 6, 0, 0, 0, 33, 9, 5, 4, 0, 45, + 2, 3, 66, 69, 33, 0, 76, 0, 0, 0, + 31, 30, 1, 0, 71, 72, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 43, 36, 67, 11, 78, 0, 0, 0, 0, 70, 10, - 26, 27, 17, 18, 19, 25, 24, 23, 22, 21, - 20, 29, 28, 13, 12, 16, 15, 14, 0, 52, + 27, 26, 19, 18, 17, 24, 25, 20, 21, 22, + 23, 28, 29, 12, 13, 14, 15, 16, 0, 52, 0, 40, 48, 50, 41, 47, 77, 68, 0, 0, 75, 74, 32, 7, 36, 0, 0, 0, 0, 0, 80, 79, 73, 0, 53, 0, 55, 0, 0, 63, 0, 49, 51, 0, 44, 0, 56, 54, 0, 0, - 0, 0, 0, 42, 64, 65, 81, 57, 59, 58, - 62, 61, 60 + 0, 0, 0, 42, 64, 65, 81, 57, 58, 59, + 60, 61, 62 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = { + -112, -112, 68, -112, 153, -112, 0, -112, -112, -112, + -38, -48, -112, -112, -111, -112, 129, -112, -112, -112, + 74 }; /* YYDEFGOTO[NTERM-NUM]. */ @@ -700,152 +664,129 @@ static const yytype_int8 yydefgoto[] = { 111 }; -/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -#define YYPACT_NINF -112 -static const yytype_int16 yypact[] = { - 14, 53, 53, 3, 13, -112, -112, -112, -112, -112, - 15, 53, 53, 26, 34, -51, -112, 138, 81, 5, - -112, -112, 58, -112, -112, 75, 160, 169, 42, 53, - -66, -112, -112, 53, -112, -112, 42, -112, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 44, -35, 51, -112, - 72, 49, -112, 46, 88, 96, 100, 93, 160, -112, - 176, 176, 189, 189, 189, 200, 200, 207, 207, 207, - 207, 120, 120, -66, -66, -112, -112, -112, 98, -3, - 102, -112, 63, 74, -112, -112, 160, -112, 53, 113, - -112, -112, -112, -112, 62, 126, -8, 167, 51, 53, - 114, -112, -112, 267, -112, -8, -112, -8, 9, -112, - 70, -112, 160, 53, -112, 4, 48, -112, -8, -8, - -8, -8, -8, -112, -112, -112, -112, -112, 48, 48, - -112, -112, -112 -}; - -/* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = { - -112, -112, 68, -112, 180, -112, 0, -112, -112, -112, - -33, -43, -112, -112, -111, -112, 223, -112, -112, -112, - 162 -}; - -/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule which +/* 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. */ -#define YYTABLE_NINF -78 static const yytype_int16 yytable[] = { - 17, 25, 26, 115, 125, 105, 126, 53, 54, 55, - 106, 30, 31, 89, 27, 94, 137, 138, 139, 140, - 141, 142, 90, 127, 28, 1, 32, 95, 29, 67, - 36, 2, 3, 68, 4, 5, 60, 116, 70, 71, + 17, 25, 26, 89, 125, 27, 126, 33, 28, 105, + 94, 30, 31, 90, 106, 29, 137, 138, 139, 140, + 141, 142, 95, 127, 32, 1, 34, 35, 36, 67, + 115, 2, 3, 68, 4, 5, 60, 61, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 6, 7, 8, 9, - 1, 96, 10, 117, 1, 121, 2, 3, 14, 4, - 5, 113, -46, 4, 5, 128, 129, 130, 131, 132, - 128, 129, 130, 131, 132, 11, 133, 62, -46, 61, - 10, 33, 88, 12, 9, 65, 66, 10, 9, 89, - 100, 10, 98, 56, 6, 7, 8, 103, 101, 122, - 34, 35, 102, 104, 6, 7, 8, 107, 134, 108, - 11, 130, 131, 132, 11, 112, 135, 57, 12, 14, - 58, 109, 12, 38, 39, 40, 41, 42, 43, 44, + 121, 96, 10, 1, 116, 1, 113, 98, 14, 2, + 3, 133, 4, 5, 4, 5, 128, 129, 130, 131, + 132, 128, 129, 130, 131, 132, 56, 11, 62, 10, + 63, 88, 117, 89, 12, 65, 66, 9, 100, 9, + 10, 101, 10, 134, 53, 54, 55, 102, 103, 122, + 57, 135, 104, 58, 64, 107, 108, 10, 49, 50, + 51, 52, 53, 54, 55, 11, 112, 11, 109, 14, + 114, 119, 12, 124, 12, 38, 39, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 54, 55, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, + 55, -77, 6, 7, 8, -46, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 69, + 97, -46, 51, 52, 53, 54, 55, 136, 0, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, + 49, 50, 51, 52, 53, 54, 55, 6, 7, 8, + 123, 0, 0, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 50, 51, 52, 53, 54, 55, -77, - 123, 114, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, - 63, 51, 52, 53, 54, 55, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 64, 119, 69, 10, 38, 39, - 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 43, 44, 45, 46, 47, 48, 49, 50, + 47, 48, 49, 50, 51, 52, 53, 54, 55, 40, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 45, 46, 47, 48, 49, - 50, 51, 52, 53, 54, 55, 49, 50, 51, 52, - 53, 54, 55, 124, 97, 136 + 50, 51, 52, 53, 54, 55, 130, 131, 132 }; -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-112))) - -#define yytable_value_is_error(Yytable_value) \ - YYID (0) - -static const yytype_uint8 yycheck[] = { - 0, 1, 2, 11, 115, 8, 117, 73, 74, 75, - 13, 11, 12, 48, 11, 58, 12, 128, 129, 130, - 131, 132, 57, 14, 11, 11, 0, 60, 13, 29, - 81, 17, 18, 33, 20, 21, 31, 45, 38, 39, +static const yytype_int16 yycheck[] = { + 0, 1, 2, 48, 115, 11, 117, 58, 11, 8, + 58, 11, 12, 58, 13, 13, 12, 128, 129, 130, + 131, 132, 60, 14, 0, 11, 77, 78, 81, 29, + 11, 17, 18, 33, 20, 21, 31, 31, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 42, 43, 44, 45, - 11, 61, 48, 71, 11, 108, 17, 18, 0, 20, - 21, 104, 0, 20, 21, 71, 72, 73, 74, 75, - 71, 72, 73, 74, 75, 71, 16, 12, 16, 31, - 48, 57, 48, 79, 45, 27, 28, 48, 45, 48, - 12, 48, 56, 22, 42, 43, 44, 14, 12, 109, - 76, 77, 12, 15, 42, 43, 44, 15, 48, 56, - 71, 73, 74, 75, 71, 12, 56, 46, 79, 61, - 49, 57, 79, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 58, 59, 60, 61, 62, 63, 64, 65, 66, - 67, 68, 69, 70, 71, 72, 73, 74, 75, 31, - 56, 45, 58, 59, 60, 61, 62, 63, 64, 65, + 108, 61, 48, 11, 45, 11, 104, 56, 0, 17, + 18, 16, 20, 21, 20, 21, 72, 73, 74, 75, + 76, 72, 73, 74, 75, 76, 22, 73, 12, 48, + 21, 48, 73, 48, 80, 27, 28, 45, 12, 45, + 48, 12, 48, 48, 74, 75, 76, 12, 14, 109, + 46, 56, 15, 49, 45, 15, 56, 48, 70, 71, + 72, 73, 74, 75, 76, 73, 12, 73, 58, 61, + 45, 48, 80, 16, 80, 59, 60, 61, 62, 63, + 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, + 74, 75, 76, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, - 21, 71, 72, 73, 74, 75, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 45, 48, 36, 48, 58, 59, + 76, 31, 42, 43, 44, 0, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 36, + 61, 16, 72, 73, 74, 75, 76, 123, -1, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 60, 61, 62, 63, - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, - 74, 75, 63, 64, 65, 66, 67, 68, 69, 70, - 71, 72, 73, 74, 75, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 69, 70, 71, 72, - 73, 74, 75, 16, 61, 123 + 70, 71, 72, 73, 74, 75, 76, 42, 43, 44, + 56, -1, -1, 59, 60, 61, 62, 63, 64, 65, + 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, + 76, 59, 60, 61, 62, 63, 64, 65, 66, 67, + 68, 69, 70, 71, 72, 73, 74, 75, 76, 61, + 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, + 72, 73, 74, 75, 76, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 74, 75, 76 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 11, 17, 18, 20, 21, 42, 43, 44, 45, - 48, 71, 79, 83, 84, 85, 86, 88, 89, 90, - 92, 98, 99, 100, 84, 88, 88, 11, 11, 13, - 88, 88, 0, 57, 76, 77, 81, 87, 58, 59, - 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, - 70, 71, 72, 73, 74, 75, 22, 46, 49, 91, - 31, 31, 12, 21, 45, 84, 84, 88, 88, 86, - 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, - 88, 88, 88, 88, 88, 88, 88, 88, 48, 48, - 57, 93, 94, 95, 93, 92, 88, 98, 56, 101, - 12, 12, 12, 14, 15, 8, 13, 15, 56, 57, - 88, 102, 12, 92, 45, 11, 45, 71, 96, 48, - 97, 93, 88, 56, 16, 96, 96, 14, 71, 72, - 73, 74, 75, 16, 48, 56, 102, 12, 96, 96, - 96, 96, 96 + 48, 73, 80, 84, 85, 86, 87, 89, 90, 91, + 93, 99, 100, 101, 85, 89, 89, 11, 11, 13, + 89, 89, 0, 58, 77, 78, 81, 88, 59, 60, + 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, + 71, 72, 73, 74, 75, 76, 22, 46, 49, 92, + 31, 31, 12, 21, 45, 85, 85, 89, 89, 87, + 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, + 89, 89, 89, 89, 89, 89, 89, 89, 48, 48, + 58, 94, 95, 96, 94, 93, 89, 99, 56, 102, + 12, 12, 12, 14, 15, 8, 13, 15, 56, 58, + 89, 103, 12, 93, 45, 11, 45, 73, 97, 48, + 98, 94, 89, 56, 16, 97, 97, 14, 72, 73, + 74, 75, 76, 16, 48, 56, 103, 12, 97, 97, + 97, 97, 97 +}; + +/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ +static const yytype_uint8 yyr1[] = { + 0, 83, 84, 84, 84, 85, 86, 86, 87, 88, + 88, 89, 89, 89, 89, 89, 89, 89, 89, 89, + 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, + 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, + 91, 91, 91, 91, 92, 93, 93, 93, 94, 94, + 95, 95, 96, 96, 96, 97, 97, 97, 97, 97, + 97, 97, 97, 98, 98, 98, 99, 99, 99, 100, + 101, 101, 101, 101, 101, 101, 101, 101, 102, 102, + 103, 103 +}; + +/* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ +static const yytype_uint8 yyr2[] = { + 0, 2, 1, 1, 1, 1, 1, 4, 2, 0, + 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 2, 2, 4, 1, 1, 1, 0, 1, 1, 1, + 3, 3, 6, 2, 5, 1, 2, 3, 1, 3, + 1, 3, 1, 3, 4, 1, 2, 3, 3, 3, + 3, 3, 3, 1, 2, 2, 1, 2, 3, 1, + 3, 2, 2, 5, 4, 4, 2, 1, 0, 2, + 1, 3 }; -#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 - - -/* Like YYERROR except do call yyerror. This remains here temporarily - to ease the transition to the new meaning of YYERROR, for GCC. - Once GCC version 2 has supplanted version 1, this can go. However, - YYFAIL appears to be in use. Nevertheless, it is formally deprecated - in Bison 2.4.2's NEWS entry, where a plan to phase it out is - discussed. */ - -#define YYFAIL goto yyerrlab -#if defined YYFAIL -/* This is here to suppress warnings from the GCC cpp's - -Wunused-macros. Normally we don't worry about that warning, but - some users do, and we want to make it easy for users to remove - YYFAIL uses, which will produce warnings from Bison 2.5. */ -#endif + +#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) @@ -862,13 +803,13 @@ do \ else \ { \ yyerror (&yylloc, ctx, scanner, YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (YYID (0)) + YYERROR; \ + } \ +while (0) /* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 +#define YYTERROR 1 +#define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. @@ -878,7 +819,7 @@ while (YYID (0)) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ - if (YYID (N)) \ + if (N) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ @@ -892,12 +833,27 @@ while (YYID (0)) (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ - while (YYID (0)) + while (0) #endif #define YYRHSLOC(Rhs, K) ((Rhs)[K]) +/* Enable debugging if requested. */ +#if PROMELA_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. */ @@ -907,32 +863,23 @@ while (YYID (0)) /* Print *YYLOCP on YYO. Private, do not rely on its existence. */ -__attribute__((__unused__)) -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +YY_ATTRIBUTE_UNUSED static unsigned -yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp) -#else -static unsigned -yy_location_print_ (yyo, yylocp) -FILE *yyo; -YYLTYPE const * const yylocp; -#endif -{ +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 += fprintf (yyo, "%d", yylocp->first_line); + res += YYFPRINTF (yyo, "%d", yylocp->first_line); if (0 <= yylocp->first_column) - res += fprintf (yyo, ".%d", yylocp->first_column); + res += YYFPRINTF (yyo, ".%d", yylocp->first_column); } if (0 <= yylocp->last_line) { if (yylocp->first_line < yylocp->last_line) { - res += fprintf (yyo, "-%d", yylocp->last_line); + res += YYFPRINTF (yyo, "-%d", yylocp->last_line); if (0 <= end_col) - res += fprintf (yyo, ".%d", end_col); + res += YYFPRINTF (yyo, ".%d", end_col); } else if (0 <= end_col && yylocp->first_column < end_col) - res += fprintf (yyo, "-%d", end_col); + res += YYFPRINTF (yyo, "-%d", end_col); } return res; } @@ -946,71 +893,34 @@ YYLTYPE const * const yylocp; #endif -/* YYLEX -- calling `yylex' with the right arguments. */ -#ifdef YYLEX_PARAM -# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) -#else -# define YYLEX yylex (&yylval, &yylloc, scanner) -#endif - -/* Enable debugging if requested. */ -#if PROMELA_DEBUG - -# ifndef YYFPRINTF -# include <stdio.h> /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (YYID (0)) +# 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) -# 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 (YYID (0)) +/*----------------------------------------. +| Print this symbol's value on YYOUTPUT. | +`----------------------------------------*/ -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, uscxml::PromelaParser* ctx, void * scanner) -#else -static void -yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, ctx, scanner) -FILE *yyoutput; -int yytype; -YYSTYPE const * const yyvaluep; -YYLTYPE const * const yylocationp; -uscxml::PromelaParser* ctx; -void * scanner; -#endif -{ +yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, uscxml::PromelaParser* ctx, void * scanner) { FILE *yyo = yyoutput; YYUSE (yyo); - if (!yyvaluep) - return; YYUSE (yylocationp); YYUSE (ctx); YYUSE (scanner); + if (!yyvaluep) + return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# else - YYUSE (yyoutput); # endif YYUSE (yytype); } @@ -1020,25 +930,10 @@ void * scanner; | Print this symbol on YYOUTPUT. | `--------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, uscxml::PromelaParser* ctx, void * scanner) -#else static void -yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, ctx, scanner) -FILE *yyoutput; -int yytype; -YYSTYPE const * const yyvaluep; -YYLTYPE const * const yylocationp; -uscxml::PromelaParser* ctx; -void * scanner; -#endif -{ - if (yytype < YYNTOKENS) - YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); - else - YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); +yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, uscxml::PromelaParser* ctx, void * scanner) { + YYFPRINTF (yyoutput, "%s %s (", + yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); YY_LOCATION_PRINT (yyoutput, *yylocationp); YYFPRINTF (yyoutput, ": "); @@ -1051,17 +946,8 @@ void * scanner; | TOP (included). | `------------------------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -#else -static void -yy_stack_print (yybottom, yytop) -yytype_int16 *yybottom; -yytype_int16 *yytop; -#endif -{ +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; @@ -1070,51 +956,40 @@ yytype_int16 *yytop; YYFPRINTF (stderr, "\n"); } -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (YYID (0)) +# 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. | `------------------------------------------------*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, uscxml::PromelaParser* ctx, void * scanner) -#else -static void -yy_reduce_print (yyvsp, yylsp, yyrule, ctx, scanner) -YYSTYPE *yyvsp; -YYLTYPE *yylsp; -int yyrule; -uscxml::PromelaParser* ctx; -void * scanner; -#endif -{ +yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, uscxml::PromelaParser* ctx, void * scanner) { + unsigned long int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], + yy_symbol_print (stderr, + yystos[yyssp[yyi + 1 - yynrhs]], &(yyvsp[(yyi + 1) - (yynrhs)]) - , &(yylsp[(yyi + 1) - (yynrhs)]) , ctx, scanner); + , &(yylsp[(yyi + 1) - (yynrhs)]) , ctx, scanner); YYFPRINTF (stderr, "\n"); } } -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyvsp, yylsp, Rule, ctx, scanner); \ -} while (YYID (0)) +# 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. */ @@ -1128,7 +1003,7 @@ int yydebug; /* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH +#ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif @@ -1151,16 +1026,8 @@ int yydebug; # define yystrlen strlen # else /* Return the length of YYSTR. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static YYSIZE_T -yystrlen (const char *yystr) -#else -static YYSIZE_T -yystrlen (yystr) -const char *yystr; -#endif -{ +yystrlen (const char *yystr) { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; @@ -1175,17 +1042,8 @@ const char *yystr; # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static char * -yystpcpy (char *yydest, const char *yysrc) -#else -static char * -yystpcpy (yydest, yysrc) -char *yydest; -const char *yysrc; -#endif -{ +yystpcpy (char *yydest, const char *yysrc) { char *yyd = yydest; const char *yys = yysrc; @@ -1254,11 +1112,11 @@ do_not_strip_quotes: static int yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, yytype_int16 *yyssp, int yytoken) { - YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]); + YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); YYSIZE_T yysize = yysize0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; /* Internationalized format string. */ - const char *yyformat = YY_NULL; + 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 @@ -1266,10 +1124,6 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, int yycount = 0; /* There are many possibilities here to consider: - - Assume YYFAIL is not used. It's too flawed to consider. See - <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html> - for details. YYERROR is fine as it does not invoke this - function. - If this state is a consistent state with a default action, then the only way this function was invoked is if the default action is an error action. In that case, don't check for expected @@ -1315,7 +1169,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, } yyarg[yycount++] = yytname[yyx]; { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]); + YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) return 2; @@ -1377,32 +1231,19 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, | Release the memory associated to this symbol. | `-----------------------------------------------*/ -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, uscxml::PromelaParser* ctx, void * scanner) -#else -static void -yydestruct (yymsg, yytype, yyvaluep, yylocationp, ctx, scanner) -const char *yymsg; -int yytype; -YYSTYPE *yyvaluep; -YYLTYPE *yylocationp; -uscxml::PromelaParser* ctx; -void * scanner; -#endif -{ +yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, uscxml::PromelaParser* 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 } @@ -1412,67 +1253,26 @@ void * scanner; | yyparse. | `----------*/ -#ifdef YYPARSE_PARAM -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (void *YYPARSE_PARAM) -#else -int -yyparse (YYPARSE_PARAM) -void *YYPARSE_PARAM; -#endif -#else /* ! YYPARSE_PARAM */ -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -int -yyparse (uscxml::PromelaParser* ctx, void * scanner) -#else int -yyparse (ctx, scanner) -uscxml::PromelaParser* ctx; -void * scanner; -#endif -#endif -{ +yyparse (uscxml::PromelaParser* ctx, void * scanner) { /* The lookahead symbol. */ int yychar; -#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 + /* The semantic value of the lookahead symbol. */ /* Default value used for initialization, for pacifying older GCCs or non-GCC compilers. */ - static YYSTYPE yyval_default; -# define YY_INITIAL_VALUE(Value) = Value -#endif + 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 PROMELA_LTYPE_IS_TRIVIAL && PROMELA_LTYPE_IS_TRIVIAL = { 1, 1, 1, 1 } # endif ; -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - - /* The semantic value of the lookahead symbol. */ - YYSTYPE yylval YY_INITIAL_VALUE(yyval_default); - - /* Location data for the lookahead symbol. */ YYLTYPE yylloc = yyloc_default; - /* Number of syntax errors so far. */ int yynerrs; @@ -1481,9 +1281,9 @@ void * scanner; int yyerrstatus; /* The stacks and their tools: - `yyss': related to states. - `yyvs': related to semantic values. - `yyls': related to locations. + '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. */ @@ -1645,7 +1445,7 @@ yybackup: /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); - yychar = YYLEX; + yychar = yylex (&yylval, &yylloc, scanner); } if (yychar <= YYEOF) { @@ -1706,7 +1506,7 @@ yyreduce: yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: - `$$ = $1'. + '$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison @@ -1720,690 +1520,689 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: - /* Line 1787 of yacc.c */ -#line 85 "promela.ypp" +#line 85 "promela.ypp" /* yacc.c:1646 */ { - ctx->ast = (yyvsp[(1) - (1)].node); + ctx->ast = (yyvsp[0].node); ctx->type = PromelaParser::PROMELA_DECL; } +#line 1580 "promela.tab.cpp" /* yacc.c:1646 */ break; case 3: - /* Line 1787 of yacc.c */ -#line 89 "promela.ypp" +#line 89 "promela.ypp" /* yacc.c:1646 */ { - ctx->ast = (yyvsp[(1) - (1)].node); - ctx->type = PromelaParser::PROMELA_EXPR; + ctx->ast = (yyvsp[0].node); + ctx->type = PromelaParser::PROMELA_STMNT; } +#line 1589 "promela.tab.cpp" /* yacc.c:1646 */ break; case 4: - /* Line 1787 of yacc.c */ -#line 93 "promela.ypp" +#line 93 "promela.ypp" /* yacc.c:1646 */ { - ctx->ast = (yyvsp[(1) - (1)].node); - ctx->type = PromelaParser::PROMELA_STMNT; + ctx->ast = (yyvsp[0].node); + ctx->type = PromelaParser::PROMELA_EXPR; } +#line 1598 "promela.tab.cpp" /* yacc.c:1646 */ break; case 5: - /* Line 1787 of yacc.c */ -#line 99 "promela.ypp" +#line 99 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(1) - (1)].node); + (yyval.node) = (yyvsp[0].node); } +#line 1604 "promela.tab.cpp" /* yacc.c:1646 */ break; case 6: - /* Line 1787 of yacc.c */ -#line 102 "promela.ypp" +#line 102 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->value(PML_NAME, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value)); - free((yyvsp[(1) - (1)].value)); + (yyval.node) = ctx->value(PML_NAME, (void*)&((yylsp[0])), (yyvsp[0].value)); + free((yyvsp[0].value)); } +#line 1610 "promela.tab.cpp" /* yacc.c:1646 */ break; case 7: - /* Line 1787 of yacc.c */ -#line 103 "promela.ypp" +#line 103 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (void*)&((yylsp[(1) - (4)])), (yyvsp[(1) - (4)].value)), (yyvsp[(3) - (4)].node)); - free((yyvsp[(1) - (4)].value)); + (yyval.node) = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (void*)&((yylsp[-3])), (yyvsp[-3].value)), (yyvsp[-1].node)); + free((yyvsp[-3].value)); } +#line 1616 "promela.tab.cpp" /* yacc.c:1646 */ break; case 8: - /* Line 1787 of yacc.c */ -#line 107 "promela.ypp" - { - if ((yyvsp[(2) - (2)].node) != NULL) { - if ((yyvsp[(2) - (2)].node)->type == PML_CMPND) { - (yyval.node) = ctx->node(PML_CMPND, 1, (yyvsp[(1) - (2)].node)); - (yyval.node)->merge((yyvsp[(2) - (2)].node)); - delete (yyvsp[(2) - (2)].node); +#line 107 "promela.ypp" /* yacc.c:1646 */ + { + if ((yyvsp[0].node) != NULL) { + if ((yyvsp[0].node)->type == PML_CMPND) { + (yyval.node) = ctx->node(PML_CMPND, 1, (yyvsp[-1].node)); + (yyval.node)->merge((yyvsp[0].node)); + delete (yyvsp[0].node); } else { - (yyval.node) = ctx->node(PML_CMPND, 2, (yyvsp[(1) - (2)].node), (yyvsp[(2) - (2)].node)); + (yyval.node) = ctx->node(PML_CMPND, 2, (yyvsp[-1].node), (yyvsp[0].node)); } } else { - (yyval.node) = (yyvsp[(1) - (2)].node); + (yyval.node) = (yyvsp[-1].node); } } +#line 1633 "promela.tab.cpp" /* yacc.c:1646 */ break; case 9: - /* Line 1787 of yacc.c */ -#line 121 "promela.ypp" +#line 121 "promela.ypp" /* yacc.c:1646 */ { (yyval.node) = NULL; } +#line 1639 "promela.tab.cpp" /* yacc.c:1646 */ break; case 10: - /* Line 1787 of yacc.c */ -#line 122 "promela.ypp" +#line 122 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(2) - (2)].node); + (yyval.node) = (yyvsp[0].node); } +#line 1645 "promela.tab.cpp" /* yacc.c:1646 */ break; case 11: - /* Line 1787 of yacc.c */ -#line 132 "promela.ypp" +#line 132 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(2) - (3)].node); + (yyval.node) = (yyvsp[-1].node); } +#line 1651 "promela.tab.cpp" /* yacc.c:1646 */ break; case 12: - /* Line 1787 of yacc.c */ -#line 133 "promela.ypp" +#line 133 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_PLUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_PLUS, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1657 "promela.tab.cpp" /* yacc.c:1646 */ break; case 13: - /* Line 1787 of yacc.c */ -#line 134 "promela.ypp" +#line 134 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_MINUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_MINUS, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1663 "promela.tab.cpp" /* yacc.c:1646 */ break; case 14: - /* Line 1787 of yacc.c */ -#line 135 "promela.ypp" +#line 135 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_TIMES, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_TIMES, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1669 "promela.tab.cpp" /* yacc.c:1646 */ break; case 15: - /* Line 1787 of yacc.c */ -#line 136 "promela.ypp" +#line 136 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_DIVIDE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_DIVIDE, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1675 "promela.tab.cpp" /* yacc.c:1646 */ break; case 16: - /* Line 1787 of yacc.c */ -#line 137 "promela.ypp" +#line 137 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_MODULO, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_MODULO, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1681 "promela.tab.cpp" /* yacc.c:1646 */ break; case 17: - /* Line 1787 of yacc.c */ -#line 138 "promela.ypp" +#line 138 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_BITAND, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_BITAND, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1687 "promela.tab.cpp" /* yacc.c:1646 */ break; case 18: - /* Line 1787 of yacc.c */ -#line 139 "promela.ypp" +#line 139 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_BITXOR, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_BITXOR, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1693 "promela.tab.cpp" /* yacc.c:1646 */ break; case 19: - /* Line 1787 of yacc.c */ -#line 140 "promela.ypp" +#line 140 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_BITOR, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_BITOR, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1699 "promela.tab.cpp" /* yacc.c:1646 */ break; case 20: - /* Line 1787 of yacc.c */ -#line 141 "promela.ypp" +#line 141 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_GT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_GT, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1705 "promela.tab.cpp" /* yacc.c:1646 */ break; case 21: - /* Line 1787 of yacc.c */ -#line 142 "promela.ypp" +#line 142 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_LT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_LT, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1711 "promela.tab.cpp" /* yacc.c:1646 */ break; case 22: - /* Line 1787 of yacc.c */ -#line 143 "promela.ypp" +#line 143 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_GE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_GE, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1717 "promela.tab.cpp" /* yacc.c:1646 */ break; case 23: - /* Line 1787 of yacc.c */ -#line 144 "promela.ypp" +#line 144 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_LE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_LE, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1723 "promela.tab.cpp" /* yacc.c:1646 */ break; case 24: - /* Line 1787 of yacc.c */ -#line 145 "promela.ypp" +#line 145 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_EQ, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_EQ, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1729 "promela.tab.cpp" /* yacc.c:1646 */ break; case 25: - /* Line 1787 of yacc.c */ -#line 146 "promela.ypp" +#line 146 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_NE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_NE, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1735 "promela.tab.cpp" /* yacc.c:1646 */ break; case 26: - /* Line 1787 of yacc.c */ -#line 147 "promela.ypp" +#line 147 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_AND, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_AND, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1741 "promela.tab.cpp" /* yacc.c:1646 */ break; case 27: - /* Line 1787 of yacc.c */ -#line 148 "promela.ypp" +#line 148 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_OR, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_OR, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1747 "promela.tab.cpp" /* yacc.c:1646 */ break; case 28: - /* Line 1787 of yacc.c */ -#line 149 "promela.ypp" +#line 149 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_LSHIFT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_LSHIFT, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1753 "promela.tab.cpp" /* yacc.c:1646 */ break; case 29: - /* Line 1787 of yacc.c */ -#line 150 "promela.ypp" +#line 150 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_RSHIFT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_RSHIFT, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1759 "promela.tab.cpp" /* yacc.c:1646 */ break; case 30: - /* Line 1787 of yacc.c */ -#line 151 "promela.ypp" +#line 151 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_NEG, 1, (yyvsp[(2) - (2)].node)); + (yyval.node) = ctx->node(PML_NEG, 1, (yyvsp[0].node)); } +#line 1765 "promela.tab.cpp" /* yacc.c:1646 */ break; case 31: - /* Line 1787 of yacc.c */ -#line 152 "promela.ypp" +#line 152 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_MINUS, 1, (yyvsp[(2) - (2)].node)); + (yyval.node) = ctx->node(PML_MINUS, 1, (yyvsp[0].node)); } +#line 1771 "promela.tab.cpp" /* yacc.c:1646 */ break; case 32: - /* Line 1787 of yacc.c */ -#line 154 "promela.ypp" +#line 154 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_LEN, 1, (yyvsp[(3) - (4)].node)); + (yyval.node) = ctx->node(PML_LEN, 1, (yyvsp[-1].node)); } +#line 1777 "promela.tab.cpp" /* yacc.c:1646 */ break; case 33: - /* Line 1787 of yacc.c */ -#line 155 "promela.ypp" +#line 155 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(1) - (1)].node); + (yyval.node) = (yyvsp[0].node); } +#line 1783 "promela.tab.cpp" /* yacc.c:1646 */ break; case 34: - /* Line 1787 of yacc.c */ -#line 156 "promela.ypp" +#line 156 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->value(PML_CONST, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value)); - free((yyvsp[(1) - (1)].value)); + (yyval.node) = ctx->value(PML_CONST, (void*)&((yylsp[0])), (yyvsp[0].value)); + free((yyvsp[0].value)); } +#line 1789 "promela.tab.cpp" /* yacc.c:1646 */ break; case 35: - /* Line 1787 of yacc.c */ -#line 157 "promela.ypp" +#line 157 "promela.ypp" /* yacc.c:1646 */ { /* Non standard promela for string literals */ - (yyval.node) = ctx->value(PML_STRING, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value)); - free((yyvsp[(1) - (1)].value)); + (yyval.node) = ctx->value(PML_STRING, (void*)&((yylsp[0])), (yyvsp[0].value)); + free((yyvsp[0].value)); } +#line 1797 "promela.tab.cpp" /* yacc.c:1646 */ break; case 36: - /* Line 1787 of yacc.c */ -#line 163 "promela.ypp" +#line 163 "promela.ypp" /* yacc.c:1646 */ { (yyval.node) = ctx->node(PML_SHOW, 0); } +#line 1803 "promela.tab.cpp" /* yacc.c:1646 */ break; case 37: - /* Line 1787 of yacc.c */ -#line 164 "promela.ypp" +#line 164 "promela.ypp" /* yacc.c:1646 */ { (yyval.node) = ctx->node(PML_HIDDEN, 0); } +#line 1809 "promela.tab.cpp" /* yacc.c:1646 */ break; case 38: - /* Line 1787 of yacc.c */ -#line 165 "promela.ypp" +#line 165 "promela.ypp" /* yacc.c:1646 */ { (yyval.node) = ctx->node(PML_SHOW, 0); } +#line 1815 "promela.tab.cpp" /* yacc.c:1646 */ break; case 39: - /* Line 1787 of yacc.c */ -#line 166 "promela.ypp" +#line 166 "promela.ypp" /* yacc.c:1646 */ { (yyval.node) = ctx->node(PML_ISLOCAL, 0); } +#line 1821 "promela.tab.cpp" /* yacc.c:1646 */ break; case 40: - /* Line 1787 of yacc.c */ -#line 169 "promela.ypp" +#line 169 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_DECL, 3, (yyvsp[(1) - (3)].node), ctx->value(PML_TYPE, (void*)&((yylsp[(2) - (3)])), (yyvsp[(2) - (3)].value)), (yyvsp[(3) - (3)].node)); - free((yyvsp[(2) - (3)].value)); + (yyval.node) = ctx->node(PML_DECL, 3, (yyvsp[-2].node), ctx->value(PML_TYPE, (void*)&((yylsp[-1])), (yyvsp[-1].value)), (yyvsp[0].node)); + free((yyvsp[-1].value)); } +#line 1827 "promela.tab.cpp" /* yacc.c:1646 */ break; case 41: - /* Line 1787 of yacc.c */ -#line 170 "promela.ypp" +#line 170 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_UNAME, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_UNAME, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1833 "promela.tab.cpp" /* yacc.c:1646 */ break; case 42: - /* Line 1787 of yacc.c */ -#line 171 "promela.ypp" +#line 171 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_DECL, 3, (yyvsp[(1) - (6)].node), ctx->value(PML_TYPE, (void*)&((yylsp[(2) - (6)])), (yyvsp[(2) - (6)].value)), (yyvsp[(5) - (6)].node)); - free((yyvsp[(2) - (6)].value)); + (yyval.node) = ctx->node(PML_DECL, 3, (yyvsp[-5].node), ctx->value(PML_TYPE, (void*)&((yylsp[-4])), (yyvsp[-4].value)), (yyvsp[-1].node)); + free((yyvsp[-4].value)); } +#line 1839 "promela.tab.cpp" /* yacc.c:1646 */ break; case 43: - /* Line 1787 of yacc.c */ -#line 172 "promela.ypp" +#line 172 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(2) - (2)].node); + (yyval.node) = (yyvsp[0].node); } +#line 1845 "promela.tab.cpp" /* yacc.c:1646 */ break; case 44: - /* Line 1787 of yacc.c */ -#line 175 "promela.ypp" +#line 175 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_TYPEDEF, 2, ctx->value(PML_NAME, (void*)&((yylsp[(2) - (5)])), (yyvsp[(2) - (5)].value)), (yyvsp[(4) - (5)].node)); + (yyval.node) = ctx->node(PML_TYPEDEF, 2, ctx->value(PML_NAME, (void*)&((yylsp[-3])), (yyvsp[-3].value)), (yyvsp[-1].node)); } +#line 1851 "promela.tab.cpp" /* yacc.c:1646 */ break; case 45: - /* Line 1787 of yacc.c */ -#line 178 "promela.ypp" +#line 178 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(1) - (1)].node); + (yyval.node) = (yyvsp[0].node); } +#line 1857 "promela.tab.cpp" /* yacc.c:1646 */ break; case 46: - /* Line 1787 of yacc.c */ -#line 179 "promela.ypp" +#line 179 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(1) - (2)].node); + (yyval.node) = (yyvsp[-1].node); } +#line 1863 "promela.tab.cpp" /* yacc.c:1646 */ break; case 47: - /* Line 1787 of yacc.c */ -#line 180 "promela.ypp" +#line 180 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_DECLLIST, 1, (yyvsp[(1) - (3)].node)); - if((yyvsp[(3) - (3)].node)->type == PML_DECLLIST) { - (yyval.node)->merge((yyvsp[(3) - (3)].node)); - delete (yyvsp[(3) - (3)].node); + (yyval.node) = ctx->node(PML_DECLLIST, 1, (yyvsp[-2].node)); + if((yyvsp[0].node)->type == PML_DECLLIST) { + (yyval.node)->merge((yyvsp[0].node)); + delete (yyvsp[0].node); } else { - (yyval.node)->push((yyvsp[(3) - (3)].node)); + (yyval.node)->push((yyvsp[0].node)); } } +#line 1876 "promela.tab.cpp" /* yacc.c:1646 */ break; case 48: - /* Line 1787 of yacc.c */ -#line 190 "promela.ypp" +#line 190 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_VARLIST, 1, (yyvsp[(1) - (1)].node)); + (yyval.node) = ctx->node(PML_VARLIST, 1, (yyvsp[0].node)); } +#line 1882 "promela.tab.cpp" /* yacc.c:1646 */ break; case 49: - /* Line 1787 of yacc.c */ -#line 191 "promela.ypp" +#line 191 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_VARLIST, 1, (yyvsp[(1) - (3)].node)); - (yyval.node)->merge((yyvsp[(3) - (3)].node)); - delete (yyvsp[(3) - (3)].node); + (yyval.node) = ctx->node(PML_VARLIST, 1, (yyvsp[-2].node)); + (yyval.node)->merge((yyvsp[0].node)); + delete (yyvsp[0].node); } +#line 1888 "promela.tab.cpp" /* yacc.c:1646 */ break; case 50: - /* Line 1787 of yacc.c */ -#line 194 "promela.ypp" +#line 194 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(1) - (1)].node); + (yyval.node) = (yyvsp[0].node); } +#line 1894 "promela.tab.cpp" /* yacc.c:1646 */ break; case 51: - /* Line 1787 of yacc.c */ -#line 195 "promela.ypp" +#line 195 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_ASGN, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_ASGN, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1900 "promela.tab.cpp" /* yacc.c:1646 */ break; case 52: - /* Line 1787 of yacc.c */ -#line 198 "promela.ypp" +#line 198 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->value(PML_NAME, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value)); - free((yyvsp[(1) - (1)].value)); + (yyval.node) = ctx->value(PML_NAME, (void*)&((yylsp[0])), (yyvsp[0].value)); + free((yyvsp[0].value)); } +#line 1906 "promela.tab.cpp" /* yacc.c:1646 */ break; case 53: - /* Line 1787 of yacc.c */ -#line 199 "promela.ypp" +#line 199 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_COLON, 2, ctx->value(PML_NAME, (void*)&((yylsp[(1) - (3)])), (yyvsp[(1) - (3)].value)), ctx->value(PML_CONST, (void*)&((yylsp[(3) - (3)])), (yyvsp[(3) - (3)].value))); - free((yyvsp[(1) - (3)].value)); - free((yyvsp[(3) - (3)].value)); + (yyval.node) = ctx->node(PML_COLON, 2, ctx->value(PML_NAME, (void*)&((yylsp[-2])), (yyvsp[-2].value)), ctx->value(PML_CONST, (void*)&((yylsp[0])), (yyvsp[0].value))); + free((yyvsp[-2].value)); + free((yyvsp[0].value)); } +#line 1912 "promela.tab.cpp" /* yacc.c:1646 */ break; case 54: - /* Line 1787 of yacc.c */ -#line 200 "promela.ypp" +#line 200 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (void*)&((yylsp[(1) - (4)])), (yyvsp[(1) - (4)].value)), (yyvsp[(3) - (4)].node)); - free((yyvsp[(1) - (4)].value)); + (yyval.node) = ctx->node(PML_VAR_ARRAY, 2, ctx->value(PML_NAME, (void*)&((yylsp[-3])), (yyvsp[-3].value)), (yyvsp[-1].node)); + free((yyvsp[-3].value)); } +#line 1918 "promela.tab.cpp" /* yacc.c:1646 */ break; case 55: - /* Line 1787 of yacc.c */ -#line 203 "promela.ypp" +#line 203 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->value(PML_CONST, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value)); - free((yyvsp[(1) - (1)].value)); + (yyval.node) = ctx->value(PML_CONST, (void*)&((yylsp[0])), (yyvsp[0].value)); + free((yyvsp[0].value)); } +#line 1924 "promela.tab.cpp" /* yacc.c:1646 */ break; case 56: - /* Line 1787 of yacc.c */ -#line 204 "promela.ypp" +#line 204 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_MINUS, 1, (yyvsp[(2) - (2)].node)); + (yyval.node) = ctx->node(PML_MINUS, 1, (yyvsp[0].node)); } +#line 1930 "promela.tab.cpp" /* yacc.c:1646 */ break; case 57: - /* Line 1787 of yacc.c */ -#line 205 "promela.ypp" +#line 205 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(2) - (3)].node); + (yyval.node) = (yyvsp[-1].node); } +#line 1936 "promela.tab.cpp" /* yacc.c:1646 */ break; case 58: - /* Line 1787 of yacc.c */ -#line 206 "promela.ypp" +#line 206 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_PLUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_PLUS, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1942 "promela.tab.cpp" /* yacc.c:1646 */ break; case 59: - /* Line 1787 of yacc.c */ -#line 207 "promela.ypp" +#line 207 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_MINUS, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_MINUS, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1948 "promela.tab.cpp" /* yacc.c:1646 */ break; case 60: - /* Line 1787 of yacc.c */ -#line 208 "promela.ypp" +#line 208 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_TIMES, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_TIMES, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1954 "promela.tab.cpp" /* yacc.c:1646 */ break; case 61: - /* Line 1787 of yacc.c */ -#line 209 "promela.ypp" +#line 209 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_DIVIDE, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_DIVIDE, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1960 "promela.tab.cpp" /* yacc.c:1646 */ break; case 62: - /* Line 1787 of yacc.c */ -#line 210 "promela.ypp" +#line 210 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_MODULO, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_MODULO, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 1966 "promela.tab.cpp" /* yacc.c:1646 */ break; case 63: - /* Line 1787 of yacc.c */ -#line 213 "promela.ypp" +#line 213 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->value(PML_NAME, (void*)&((yylsp[(1) - (1)])), (yyvsp[(1) - (1)].value)); - free((yyvsp[(1) - (1)].value)); + (yyval.node) = ctx->value(PML_NAME, (void*)&((yylsp[0])), (yyvsp[0].value)); + free((yyvsp[0].value)); } +#line 1972 "promela.tab.cpp" /* yacc.c:1646 */ break; case 64: - /* Line 1787 of yacc.c */ -#line 214 "promela.ypp" +#line 214 "promela.ypp" /* yacc.c:1646 */ { - if ((yyvsp[(1) - (2)].node)->type == PML_NAME) { - (yyval.node) = ctx->node(PML_NAMELIST, 1, (yyvsp[(1) - (2)].node)); - (yyval.node)->push(ctx->value(PML_NAME, (void*)&((yylsp[(2) - (2)])), (yyvsp[(2) - (2)].value))); + if ((yyvsp[-1].node)->type == PML_NAME) { + (yyval.node) = ctx->node(PML_NAMELIST, 1, (yyvsp[-1].node)); + (yyval.node)->push(ctx->value(PML_NAME, (void*)&((yylsp[0])), (yyvsp[0].value))); } else { - (yyvsp[(1) - (2)].node)->push(ctx->value(PML_NAME, (void*)&((yylsp[(2) - (2)])), (yyvsp[(2) - (2)].value))); + (yyvsp[-1].node)->push(ctx->value(PML_NAME, (void*)&((yylsp[0])), (yyvsp[0].value))); } - free((yyvsp[(2) - (2)].value)); + free((yyvsp[0].value)); } +#line 1986 "promela.tab.cpp" /* yacc.c:1646 */ break; case 65: - /* Line 1787 of yacc.c */ -#line 223 "promela.ypp" +#line 223 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(1) - (2)].node); + (yyval.node) = (yyvsp[-1].node); } +#line 1992 "promela.tab.cpp" /* yacc.c:1646 */ break; case 66: - /* Line 1787 of yacc.c */ -#line 226 "promela.ypp" +#line 226 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(1) - (1)].node); + (yyval.node) = (yyvsp[0].node); } +#line 1998 "promela.tab.cpp" /* yacc.c:1646 */ break; case 67: - /* Line 1787 of yacc.c */ -#line 227 "promela.ypp" +#line 227 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(1) - (2)].node); + (yyval.node) = (yyvsp[-1].node); } +#line 2004 "promela.tab.cpp" /* yacc.c:1646 */ break; case 68: - /* Line 1787 of yacc.c */ -#line 228 "promela.ypp" +#line 228 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_STMNT, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_STMNT, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 2010 "promela.tab.cpp" /* yacc.c:1646 */ break; case 69: - /* Line 1787 of yacc.c */ -#line 231 "promela.ypp" +#line 231 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(1) - (1)].node); + (yyval.node) = (yyvsp[0].node); } +#line 2016 "promela.tab.cpp" /* yacc.c:1646 */ break; case 70: - /* Line 1787 of yacc.c */ -#line 234 "promela.ypp" +#line 234 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_ASGN, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(PML_ASGN, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 2022 "promela.tab.cpp" /* yacc.c:1646 */ break; case 71: - /* Line 1787 of yacc.c */ -#line 235 "promela.ypp" +#line 235 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_INCR, 1, (yyvsp[(1) - (2)].node)); + (yyval.node) = ctx->node(PML_INCR, 1, (yyvsp[-1].node)); } +#line 2028 "promela.tab.cpp" /* yacc.c:1646 */ break; case 72: - /* Line 1787 of yacc.c */ -#line 236 "promela.ypp" +#line 236 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_DECR, 1, (yyvsp[(1) - (2)].node)); + (yyval.node) = ctx->node(PML_DECR, 1, (yyvsp[-1].node)); } +#line 2034 "promela.tab.cpp" /* yacc.c:1646 */ break; case 73: - /* Line 1787 of yacc.c */ -#line 237 "promela.ypp" +#line 237 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_PRINT, 2, ctx->value(PML_STRING, (void*)&((yylsp[(3) - (5)])), (yyvsp[(3) - (5)].value)), (yyvsp[(4) - (5)].node)); - free((yyvsp[(3) - (5)].value)); + (yyval.node) = ctx->node(PML_PRINT, 2, ctx->value(PML_STRING, (void*)&((yylsp[-2])), (yyvsp[-2].value)), (yyvsp[-1].node)); + free((yyvsp[-2].value)); } +#line 2040 "promela.tab.cpp" /* yacc.c:1646 */ break; case 74: - /* Line 1787 of yacc.c */ -#line 238 "promela.ypp" +#line 238 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_PRINT, 1, (yyvsp[(3) - (4)].node)); + (yyval.node) = ctx->node(PML_PRINT, 1, (yyvsp[-1].node)); } +#line 2046 "promela.tab.cpp" /* yacc.c:1646 */ break; case 75: - /* Line 1787 of yacc.c */ -#line 239 "promela.ypp" +#line 239 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_PRINT, 1, ctx->value(PML_CONST, (void*)&((yylsp[(3) - (4)])), (yyvsp[(3) - (4)].value))); - free((yyvsp[(3) - (4)].value)); + (yyval.node) = ctx->node(PML_PRINT, 1, ctx->value(PML_CONST, (void*)&((yylsp[-1])), (yyvsp[-1].value))); + free((yyvsp[-1].value)); } +#line 2052 "promela.tab.cpp" /* yacc.c:1646 */ break; case 76: - /* Line 1787 of yacc.c */ -#line 240 "promela.ypp" +#line 240 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(PML_ASSERT, 1, (yyvsp[(2) - (2)].node)); + (yyval.node) = ctx->node(PML_ASSERT, 1, (yyvsp[0].node)); } +#line 2058 "promela.tab.cpp" /* yacc.c:1646 */ break; case 77: - /* Line 1787 of yacc.c */ -#line 241 "promela.ypp" +#line 241 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(1) - (1)].node); + (yyval.node) = (yyvsp[0].node); } +#line 2064 "promela.tab.cpp" /* yacc.c:1646 */ break; case 78: - /* Line 1787 of yacc.c */ -#line 244 "promela.ypp" +#line 244 "promela.ypp" /* yacc.c:1646 */ { (yyval.node) = ctx->value(0, NULL, ""); } +#line 2070 "promela.tab.cpp" /* yacc.c:1646 */ break; case 79: - /* Line 1787 of yacc.c */ -#line 245 "promela.ypp" +#line 245 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(2) - (2)].node); + (yyval.node) = (yyvsp[0].node); } +#line 2076 "promela.tab.cpp" /* yacc.c:1646 */ break; case 80: - /* Line 1787 of yacc.c */ -#line 248 "promela.ypp" +#line 248 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = (yyvsp[(1) - (1)].node); + (yyval.node) = (yyvsp[0].node); } +#line 2082 "promela.tab.cpp" /* yacc.c:1646 */ break; case 81: - /* Line 1787 of yacc.c */ -#line 249 "promela.ypp" +#line 249 "promela.ypp" /* yacc.c:1646 */ { - (yyval.node) = ctx->node(0, 2, (yyvsp[(1) - (3)].node), (yyvsp[(3) - (3)].node)); + (yyval.node) = ctx->node(0, 2, (yyvsp[-2].node), (yyvsp[0].node)); } +#line 2088 "promela.tab.cpp" /* yacc.c:1646 */ break; - /* Line 1787 of yacc.c */ -#line 2285 "promela.tab.cpp" +#line 2092 "promela.tab.cpp" /* yacc.c:1646 */ default: break; } @@ -2427,7 +2226,7 @@ yyreduce: *++yyvsp = yyval; *++yylsp = yyloc; - /* Now `shift' the result of the reduction. Determine what state + /* 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. */ @@ -2442,9 +2241,9 @@ yyreduce: goto yynewstate; - /*------------------------------------. - | yyerrlab -- here on detecting error | - `------------------------------------*/ + /*--------------------------------------. + | yyerrlab -- here on detecting error. | + `--------------------------------------*/ yyerrlab: /* Make sure we have latest lookahead translation. See comments at user semantic actions for why this is necessary. */ @@ -2489,7 +2288,7 @@ yyerrlab: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an - error, discard it. */ + error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ @@ -2519,7 +2318,7 @@ yyerrorlab: goto yyerrorlab; yyerror_range[1] = yylsp[1-yylen]; - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; @@ -2532,7 +2331,7 @@ yyerrorlab: | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ + yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; @@ -2606,7 +2405,7 @@ yyreturn: yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, ctx, scanner); } - /* Do not reclaim the symbols of the rule which action triggered + /* Do not reclaim the symbols of the rule whose action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); @@ -2623,12 +2422,8 @@ yyreturn: if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif - /* Make sure YYID is used. */ - return YYID (yyresult); + return yyresult; } - - -/* Line 2050 of yacc.c */ -#line 253 "promela.ypp" +#line 253 "promela.ypp" /* yacc.c:1906 */ diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp b/src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp index a48031a..c609868 100644 --- a/src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp +++ b/src/uscxml/plugins/datamodel/promela/parser/promela.tab.hpp @@ -1,19 +1,19 @@ -/* A Bison parser, made by GNU Bison 2.7.12-4996. */ +/* A Bison parser, made by GNU Bison 3.0.4. */ /* Bison interface for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc. - + + 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/>. */ @@ -26,16 +26,16 @@ 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_PROMELA_PROMELA_TAB_HPP_INCLUDED # define YY_PROMELA_PROMELA_TAB_HPP_INCLUDED -/* Enabling traces. */ +/* Debug traces. */ #ifndef PROMELA_DEBUG # if defined YYDEBUG -# if YYDEBUG +#if YYDEBUG # define PROMELA_DEBUG 1 # else # define PROMELA_DEBUG 0 @@ -48,133 +48,122 @@ extern int promela_debug; #endif -/* Tokens. */ +/* Token type. */ #ifndef PROMELA_TOKENTYPE # define PROMELA_TOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum promela_tokentype { - PML_VAR_ARRAY = 258, - PML_VARLIST = 259, - PML_DECL = 260, - PML_DECLLIST = 261, - PML_STMNT = 262, - PML_COLON = 263, - PML_EXPR = 264, - PML_NAMELIST = 265, - PML_ASSERT = 266, - PML_PRINT = 267, - PML_PRINTM = 268, - PML_LEN = 269, - PML_STRING = 270, - PML_TYPEDEF = 271, - PML_MTYPE = 272, - PML_INLINE = 273, - PML_RETURN = 274, - PML_LABEL = 275, - PML_OF = 276, - PML_GOTO = 277, - PML_BREAK = 278, - PML_ELSE = 279, - PML_SEMI = 280, - PML_ARROW = 281, - PML_IF = 282, - PML_FI = 283, - PML_DO = 284, - PML_OD = 285, - PML_FOR = 286, - PML_SELECT = 287, - PML_IN = 288, - PML_SEP = 289, - PML_DOTDOT = 290, - PML_HIDDEN = 291, - PML_SHOW = 292, - PML_ISLOCAL = 293, - PML_CONST = 294, - PML_TYPE = 295, - PML_XU = 296, - PML_NAME = 297, - PML_UNAME = 298, - PML_PNAME = 299, - PML_INAME = 300, - PML_CLAIM = 301, - PML_TRACE = 302, - PML_INIT = 303, - PML_LTL = 304, - PML_COMMA = 305, - PML_ASGN = 306, - PML_AND = 307, - PML_OR = 308, - PML_BITAND = 309, - PML_BITXOR = 310, - PML_BITOR = 311, - PML_NE = 312, - PML_EQ = 313, - PML_LE = 314, - PML_GE = 315, - PML_LT = 316, - PML_GT = 317, - PML_RSHIFT = 318, - PML_LSHIFT = 319, - PML_MINUS = 320, - PML_PLUS = 321, - PML_MODULO = 322, - PML_DIVIDE = 323, - PML_TIMES = 324, - PML_DECR = 325, - PML_INCR = 326, - PML_COMPL = 327, - PML_NEG = 328, - PML_CMPND = 329, - PML_DOT = 330 - }; + enum promela_tokentype + { + PML_VAR_ARRAY = 258, + PML_VARLIST = 259, + PML_DECL = 260, + PML_DECLLIST = 261, + PML_STMNT = 262, + PML_COLON = 263, + PML_EXPR = 264, + PML_NAMELIST = 265, + PML_ASSERT = 266, + PML_PRINT = 267, + PML_PRINTM = 268, + PML_LEN = 269, + PML_STRING = 270, + PML_TYPEDEF = 271, + PML_MTYPE = 272, + PML_INLINE = 273, + PML_RETURN = 274, + PML_LABEL = 275, + PML_OF = 276, + PML_GOTO = 277, + PML_BREAK = 278, + PML_ELSE = 279, + PML_SEMI = 280, + PML_ARROW = 281, + PML_IF = 282, + PML_FI = 283, + PML_DO = 284, + PML_OD = 285, + PML_FOR = 286, + PML_SELECT = 287, + PML_IN = 288, + PML_SEP = 289, + PML_DOTDOT = 290, + PML_HIDDEN = 291, + PML_SHOW = 292, + PML_ISLOCAL = 293, + PML_CONST = 294, + PML_TYPE = 295, + PML_XU = 296, + PML_NAME = 297, + PML_UNAME = 298, + PML_PNAME = 299, + PML_INAME = 300, + PML_CLAIM = 301, + PML_TRACE = 302, + PML_INIT = 303, + PML_LTL = 304, + PML_COMMA = 305, + PML_UNREC = 306, + PML_ASGN = 307, + PML_OR = 308, + PML_AND = 309, + PML_BITOR = 310, + PML_BITXOR = 311, + PML_BITAND = 312, + PML_EQ = 313, + PML_NE = 314, + PML_GT = 315, + PML_LT = 316, + PML_GE = 317, + PML_LE = 318, + PML_LSHIFT = 319, + PML_RSHIFT = 320, + PML_PLUS = 321, + PML_MINUS = 322, + PML_TIMES = 323, + PML_DIVIDE = 324, + PML_MODULO = 325, + PML_INCR = 326, + PML_DECR = 327, + PML_COMPL = 328, + PML_NEG = 329, + PML_DOT = 330, + PML_CMPND = 331 + }; #endif - +/* Value type. */ #if ! defined PROMELA_STYPE && ! defined PROMELA_STYPE_IS_DECLARED -typedef union PROMELA_STYPE + +union PROMELA_STYPE { -/* Line 2053 of yacc.c */ -#line 39 "promela.ypp" +#line 39 "promela.ypp" /* yacc.c:1909 */ uscxml::PromelaParserNode* node; char* value; +#line 144 "promela.tab.hpp" /* yacc.c:1909 */ +}; -/* Line 2053 of yacc.c */ -#line 146 "promela.tab.hpp" -} PROMELA_STYPE; +typedef union PROMELA_STYPE PROMELA_STYPE; # define PROMELA_STYPE_IS_TRIVIAL 1 -# define promela_stype PROMELA_STYPE /* obsolescent; will be withdrawn */ # define PROMELA_STYPE_IS_DECLARED 1 #endif +/* Location type. */ #if ! defined PROMELA_LTYPE && ! defined PROMELA_LTYPE_IS_DECLARED -typedef struct PROMELA_LTYPE +typedef struct PROMELA_LTYPE PROMELA_LTYPE; +struct PROMELA_LTYPE { int first_line; int first_column; int last_line; int last_column; -} PROMELA_LTYPE; -# define promela_ltype PROMELA_LTYPE /* obsolescent; will be withdrawn */ +}; # define PROMELA_LTYPE_IS_DECLARED 1 # define PROMELA_LTYPE_IS_TRIVIAL 1 #endif -#ifdef YYPARSE_PARAM -#if defined __STDC__ || defined __cplusplus -int promela_parse (void *YYPARSE_PARAM); -#else -int promela_parse (); -#endif -#else /* ! YYPARSE_PARAM */ -#if defined __STDC__ || defined __cplusplus + int promela_parse (uscxml::PromelaParser* ctx, void * scanner); -#else -int promela_parse (); -#endif -#endif /* ! YYPARSE_PARAM */ #endif /* !YY_PROMELA_PROMELA_TAB_HPP_INCLUDED */ diff --git a/src/uscxml/plugins/datamodel/promela/parser/promela.ypp b/src/uscxml/plugins/datamodel/promela/parser/promela.ypp index d76b24a..f26eb46 100644 --- a/src/uscxml/plugins/datamodel/promela/parser/promela.ypp +++ b/src/uscxml/plugins/datamodel/promela/parser/promela.ypp @@ -61,7 +61,7 @@ using namespace uscxml; %token <value> PML_CONST PML_TYPE PML_XU /* val */ %token <value> PML_NAME PML_UNAME PML_PNAME PML_INAME /* sym */ %token PML_CLAIM PML_TRACE PML_INIT PML_LTL /* sym */ -%token PML_COMMA +%token PML_COMMA PML_UNREC %right PML_ASGN %left PML_OR PML_AND @@ -86,14 +86,14 @@ program : ctx->ast = $1; ctx->type = PromelaParser::PROMELA_DECL; } - | expr { - ctx->ast = $1; - ctx->type = PromelaParser::PROMELA_EXPR; - } | stmnt_lst { ctx->ast = $1; ctx->type = PromelaParser::PROMELA_STMNT; } + | expr { + ctx->ast = $1; + ctx->type = PromelaParser::PROMELA_EXPR; + } ; varref : cmpnd { $$ = $1; } |