diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-12-07 14:31:09 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2014-12-07 14:31:09 (GMT) |
commit | 9608216597fd17021d38e80689644beb3c85abb9 (patch) | |
tree | 1e3375c8beecd160be1f66750c201167c1b8c6a0 /src/uscxml/plugins | |
parent | 93f8cb376e6e496f0194d1e0657081354434da96 (diff) | |
download | uscxml-9608216597fd17021d38e80689644beb3c85abb9.zip uscxml-9608216597fd17021d38e80689644beb3c85abb9.tar.gz uscxml-9608216597fd17021d38e80689644beb3c85abb9.tar.bz2 |
More complete xinclude implementation and tests
Diffstat (limited to 'src/uscxml/plugins')
-rw-r--r-- | src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp | 10 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/promela/PromelaParser.cpp | 11 |
2 files changed, 18 insertions, 3 deletions
diff --git a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp index d63c354..5b3c79c 100644 --- a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp +++ b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp @@ -375,8 +375,14 @@ void PromelaDataModel::evaluateDecl(void* ast) { std::list<PromelaParserNode*>::iterator opIterAsgn = (*nameIter)->operands.begin(); PromelaParserNode* name = *opIterAsgn++; PromelaParserNode* expr = *opIterAsgn++; - - variable.compound["value"] = evaluateExpr(expr); + + try { + variable.compound["value"] = evaluateExpr(expr); + } catch(uscxml::Event e) { + // test277, declare and throw + _variables.compound[name->value] = variable; + throw e; + } assert(opIterAsgn == (*nameIter)->operands.end()); _variables.compound[name->value] = variable; diff --git a/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp b/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp index ada2c48..74cb791 100644 --- a/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp +++ b/src/uscxml/plugins/datamodel/promela/PromelaParser.cpp @@ -38,6 +38,15 @@ void promela_error (void* yylloc_param, uscxml::PromelaParser* ctx, void* yyscan PROMELA_LTYPE* yylloc = (PROMELA_LTYPE*)yylloc_param; // mark as pending exception as we cannot throw from constructor and have the destructor called ERROR_EXECUTION(excEvent, err); + excEvent.data.compound["line"] = uscxml::Data(yylloc->first_line, uscxml::Data::VERBATIM); + excEvent.data.compound["col"] = uscxml::Data(yylloc->first_column, uscxml::Data::VERBATIM); + + std::stringstream ssUnderline; + for (int i = 0; i < yylloc->first_column; i++) + ssUnderline << " "; + ssUnderline << "^"; + excEvent.data.compound["sourcemark"] = uscxml::Data(ssUnderline.str(), uscxml::Data::VERBATIM); + ctx->pendingException = excEvent; } @@ -85,7 +94,7 @@ void PromelaParser::init(const std::string& expr) { if (pendingException.name.size() > 0) { // parsing failed in promela_error destroy(); - pendingException.data.compound["code"] = Data(expr, Data::VERBATIM); + pendingException.data.compound["sourceline"] = Data(expr, Data::VERBATIM); throw pendingException; } } |