Storm
A Modern Probabilistic Model Checker
|
#include <ExpressionParser.h>
Public Member Functions | |
ExpressionParser (storm::expressions::ExpressionManager const &manager, qi::symbols< char, uint_fast64_t > const &invalidIdentifiers_=qi::symbols< char, uint_fast64_t >(), bool enableErrorHandling=true, bool allowBacktracking=false) | |
Creates an expression parser. | |
~ExpressionParser () | |
ExpressionParser (ExpressionParser const &other)=delete | |
ExpressionParser & | operator= (ExpressionParser const &other)=delete |
void | setIdentifierMapping (qi::symbols< char, storm::expressions::Expression > const *identifiers_) |
Sets an identifier mapping that is used to determine valid variables in the expression. | |
void | setIdentifierMapping (std::unordered_map< std::string, storm::expressions::Expression > const &identifierMapping) |
Sets an identifier mapping that is used to determine valid variables in the expression. | |
void | unsetIdentifierMapping () |
Unsets a previously set identifier mapping. | |
void | setAcceptDoubleLiterals (bool flag) |
Sets whether double literals are to be accepted or not. | |
storm::expressions::Expression | parseFromString (std::string const &expressionString, bool ignoreError=false) const |
Parses an expression from the given string. | |
Definition at line 36 of file ExpressionParser.h.
storm::parser::ExpressionParser::ExpressionParser | ( | storm::expressions::ExpressionManager const & | manager, |
qi::symbols< char, uint_fast64_t > const & | invalidIdentifiers_ = qi::symbols<char, uint_fast64_t>() , |
||
bool | enableErrorHandling = true , |
||
bool | allowBacktracking = false |
||
) |
Creates an expression parser.
Initially the parser is set to a mode in which it will not generate the actual expressions but only perform a syntax check and return the expression "false". To make the parser generate the actual expressions, a mapping of valid identifiers to their expressions need to be provided later.
manager | The manager responsible for the expressions. |
invalidIdentifiers_ | A symbol table of identifiers that are to be rejected. |
enableErrorHandling | Enables error handling within the parser. Note that this should should be set to true when using the parser as the top level parser. |
allowBacktracking | A flag that indicates whether or not the parser is supposed to backtrack beyond points it would typically allow. This can, for example, be used to prevent errors if the outer grammar also parses boolean conjuncts that are erroneously consumed by the expression parser. |
Enable this for debugging purposes. debug(expression); debug(iteExpression); debug(orExpression); debug(andExpression); debug(equalityExpression); debug(relativeExpression); debug(plusExpression); debug(multiplicationExpression); debug(infixPowerModuloExpression); debug(unaryExpression); debug(atomicExpression); debug(literalExpression); debug(identifierExpression);
Definition at line 42 of file ExpressionParser.cpp.
storm::parser::ExpressionParser::~ExpressionParser | ( | ) |
Definition at line 296 of file ExpressionParser.cpp.
|
delete |
|
delete |
storm::expressions::Expression storm::parser::ExpressionParser::parseFromString | ( | std::string const & | expressionString, |
bool | ignoreError = false |
||
) | const |
Parses an expression from the given string.
ignoreError | If set, no exception is thrown upon a parser error. The returned expression will be uninitialized. |
Definition at line 323 of file ExpressionParser.cpp.
void storm::parser::ExpressionParser::setAcceptDoubleLiterals | ( | bool | flag | ) |
Sets whether double literals are to be accepted or not.
flag | If set to true, double literals are accepted. |
Definition at line 312 of file ExpressionParser.cpp.
void storm::parser::ExpressionParser::setIdentifierMapping | ( | qi::symbols< char, storm::expressions::Expression > const * | identifiers_ | ) |
Sets an identifier mapping that is used to determine valid variables in the expression.
The mapped-to expressions will be substituted wherever the key value appears in the parsed expression. After setting this, the parser will generate expressions.
identifiers_ | A pointer to a mapping from identifiers to expressions. |
Definition at line 300 of file ExpressionParser.cpp.
void storm::parser::ExpressionParser::setIdentifierMapping | ( | std::unordered_map< std::string, storm::expressions::Expression > const & | identifierMapping | ) |
Sets an identifier mapping that is used to determine valid variables in the expression.
The mapped-to expressions will be substituted wherever the key value appears in the parsed expression. After setting this, the parser will generate expressions.
identifierMapping | A mapping from identifiers to expressions. |
Definition at line 304 of file ExpressionParser.cpp.
void storm::parser::ExpressionParser::unsetIdentifierMapping | ( | ) |
Unsets a previously set identifier mapping.
This will make the parser not generate expressions any more but merely check for syntactic correctness of an expression.
Definition at line 308 of file ExpressionParser.cpp.