From aa5bb9cb7dbd6f07f815839788a82337f89fcd7f Mon Sep 17 00:00:00 2001 From: Tim Quatmann Date: Mon, 19 Apr 2021 12:21:45 +0200 Subject: [PATCH] PrismParser: Parsing unbounded integer variables --- src/storm-parsers/parser/PrismParser.cpp | 8 +++++++- src/storm-parsers/parser/PrismParser.h | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/storm-parsers/parser/PrismParser.cpp b/src/storm-parsers/parser/PrismParser.cpp index 36a01f05f..771578f17 100644 --- a/src/storm-parsers/parser/PrismParser.cpp +++ b/src/storm-parsers/parser/PrismParser.cpp @@ -151,7 +151,13 @@ namespace storm { booleanVariableDefinition = (((freshIdentifier > qi::lit(":")) >> qi::lit("bool")) > -((qi::lit("init") > boolExpression[qi::_a = qi::_1]) | qi::attr(manager->boolean(false))) > qi::lit(";"))[qi::_val = phoenix::bind(&PrismParser::createBooleanVariable, phoenix::ref(*this), qi::_1, qi::_a)]; booleanVariableDefinition.name("boolean variable definition"); - integerVariableDefinition = (((freshIdentifier > qi::lit(":")) >> qi::lit("[")) > intExpression > qi::lit("..") > intExpression > qi::lit("]") > -(qi::lit("init") > intExpression[qi::_a = qi::_1]) > qi::lit(";"))[qi::_val = phoenix::bind(&PrismParser::createIntegerVariable, phoenix::ref(*this), qi::_1, qi::_2, qi::_3, qi::_a)]; + boundedIntegerVariableDefinition = (((freshIdentifier > qi::lit(":")) >> qi::lit("[")) > intExpression > qi::lit("..") > intExpression > qi::lit("]") > -(qi::lit("init") > intExpression[qi::_a = qi::_1]) > qi::lit(";"))[qi::_val = phoenix::bind(&PrismParser::createIntegerVariable, phoenix::ref(*this), qi::_1, qi::_2, qi::_3, qi::_a)]; + boundedIntegerVariableDefinition.name("bounded integer variable definition"); + + unboundedIntegerVariableDefinition = (((freshIdentifier > qi::lit(":")) >> qi::lit("int")) > -(qi::lit("init") > intExpression[qi::_a = qi::_1]) > qi::lit(";"))[qi::_val = phoenix::bind(&PrismParser::createIntegerVariable, phoenix::ref(*this), qi::_1, storm::expressions::Expression(), storm::expressions::Expression(), qi::_a)]; + unboundedIntegerVariableDefinition.name("unbounded integer variable definition"); + + integerVariableDefinition = boundedIntegerVariableDefinition | unboundedIntegerVariableDefinition; integerVariableDefinition.name("integer variable definition"); clockVariableDefinition = (((freshIdentifier > qi::lit(":")) >> qi::lit("clock")) > qi::lit(";"))[qi::_val = phoenix::bind(&PrismParser::createClockVariable, phoenix::ref(*this), qi::_1)]; diff --git a/src/storm-parsers/parser/PrismParser.h b/src/storm-parsers/parser/PrismParser.h index 2a1d5beeb..0554d088f 100644 --- a/src/storm-parsers/parser/PrismParser.h +++ b/src/storm-parsers/parser/PrismParser.h @@ -240,8 +240,6 @@ namespace storm { // Rules for global variable definitions. qi::rule globalVariableDefinition; - qi::rule globalBooleanVariableDefinition; - qi::rule globalIntegerVariableDefinition; // Rules for modules definition. qi::rule knownModuleName; @@ -254,6 +252,8 @@ namespace storm { qi::rule&, std::vector&, std::vector&), Skipper> variableDefinition; qi::rule, Skipper> booleanVariableDefinition; qi::rule, Skipper> integerVariableDefinition; + qi::rule, Skipper> boundedIntegerVariableDefinition; + qi::rule, Skipper> unboundedIntegerVariableDefinition; qi::rule, Skipper> clockVariableDefinition; // Rules for command definitions.