libutap
|
A reference to an expression. More...
#include <expression.h>
Public Member Functions | |
expression_t () | |
Default constructor. More... | |
expression_t (const expression_t &) | |
Copy constructor. More... | |
~expression_t () | |
Destructor. More... | |
bool | usesFP () const |
bool | usesClock () const |
bool | isDynamic () const |
bool | hasDynamicSub () const |
expression_t | clone () const |
Make a shallow clone of the expression. More... | |
expression_t | deeperClone () const |
Makes a deep clone of the expression. More... | |
expression_t | deeperClone (symbol_t from, symbol_t to) const |
Makes a deep clone of the expression and replaces the symbol "from" with the symbol "to". More... | |
expression_t | deeperClone (frame_t frame, frame_t select=frame_t()) const |
Makes a deep clone of the expression and replaces each symbol with a symbol from the given frame(s), with the same name. More... | |
Constants::kind_t | getKind () const |
Returns the kind of the expression. More... | |
size_t | getSize () const |
Returns the number of subexpression. More... | |
const position_t & | getPosition () const |
Returns the position of this expression. More... | |
type_t | getType () const |
Returns the type of the expression. More... | |
void | setType (type_t) |
Sets the type of the expression. More... | |
int32_t | getValue () const |
Returns the value field of this expression. More... | |
int32_t | getIndex () const |
Returns the index field of this expression. More... | |
double | getDoubleValue () const |
Returns the value field of this expression. More... | |
bool | empty () const |
Returns true if this is an empty expression. More... | |
Constants::synchronisation_t | getSync () const |
Returns the synchronisation type of SYNC operations. More... | |
std::string | toString (bool old=false) const |
Returns a string representation of the expression. More... | |
expression_t & | operator[] (uint32_t) |
Returns the ith subexpression. More... | |
const expression_t | operator[] (uint32_t) const |
Returns the ith subexpression. More... | |
expression_t & | get (uint32_t) |
Returns the ith subexpression. More... | |
const expression_t & | get (uint32_t) const |
Returns the ith subexpression. More... | |
expression_t & | operator= (const expression_t &) |
Assignment operator. More... | |
bool | equal (const expression_t &) const |
Equality operator. More... | |
symbol_t | getSymbol () |
Returns the symbol of a variable reference. More... | |
void | getSymbols (std::set< symbol_t > &symbols) const |
Returns the set of symbols this expression might resolve into. More... | |
const symbol_t | getSymbol () const |
Returns the symbol this expression evaluates to. More... | |
bool | isReferenceTo (const std::set< symbol_t > &) const |
Returns true if this expression is a reference to a symbol in the given set. More... | |
bool | changesVariable (const std::set< symbol_t > &) const |
True if this expression can change any of the variables identified by the given symbols. More... | |
bool | changesAnyVariable () const |
True if this expression can change any variable at all. More... | |
bool | dependsOn (const std::set< symbol_t > &) const |
True if the evaluation of this expression depends on any of the symbols in the given set. More... | |
void | collectPossibleWrites (std::set< symbol_t > &) const |
void | collectPossibleReads (std::set< symbol_t > &, bool collectRandom=false) const |
bool | operator< (const expression_t) const |
Less-than operator. More... | |
bool | operator== (const expression_t) const |
Equality operator. More... | |
expression_t | subst (symbol_t, expression_t) const |
bool | isTrue () const |
A reference to an expression.
An expression is a tree of operations and is identified by the root of the tree. There are many kinds of operations (see kind_t), some are leafs in the tree (identifers, constants), some are unary operations (unary minus, negation), some are binary (plus, minus, etc.), and some are n-ary (lists, function calls).
Expressions can be annotated with types. The type of an expression should never contain information about whether the expression is a variable reference, a constant value or about the range of the result value. Use the TypeChecker and RangeChecker classes to determine these informations.
All nodes have the following attributes:
kind indicates the kind of operation position indicates the position of the expression in the input file. type the type of the result of evaluating the expression size the number of subexpressions sub the subexpressions
Some nodes have extra attributes (depending on the kind):
value the value of a CONSTANT node sync the synchronisation of a SYNC node index the index of a DOT node symbol the symbol of an IDENTIFIER node
Expressions are created by using the static factory methods.
expression_t::expression_t | ( | ) |
Default constructor.
Creates an empty expression.
expression_t::expression_t | ( | const expression_t & | e | ) |
Copy constructor.
expression_t::~expression_t | ( | ) |
Destructor.
bool expression_t::changesAnyVariable | ( | ) | const |
True if this expression can change any variable at all.
Referenced by UTAP::TypeChecker::visitAssertStatement(), UTAP::TypeChecker::visitBlockStatement(), UTAP::TypeChecker::visitCondition(), UTAP::TypeChecker::visitEdge(), UTAP::TypeChecker::visitHybridClock(), UTAP::TypeChecker::visitInstance(), UTAP::TypeChecker::visitIODecl(), UTAP::TypeChecker::visitMessage(), UTAP::TypeChecker::visitProperty(), UTAP::TypeChecker::visitState(), and UTAP::TypeChecker::visitVariable().
bool expression_t::changesVariable | ( | const std::set< symbol_t > & | symbols | ) | const |
True if this expression can change any of the variables identified by the given symbols.
expression_t expression_t::clone | ( | ) | const |
Make a shallow clone of the expression.
Referenced by UTAP::ExpressionBuilder::exprExistsDynamicEnd(), and UTAP::ExpressionBuilder::exprForAllDynamicEnd().
void expression_t::collectPossibleReads | ( | std::set< symbol_t > & | , |
bool | collectRandom = false |
||
) | const |
References UTAP::function_t::depends, UTAP::Constants::FUNCALL, UTAP::symbol_t::getData(), UTAP::symbol_t::getType(), UTAP::Constants::IDENTIFIER, UTAP::type_t::isFunction(), UTAP::Constants::RANDOM_F, and UTAP::symbol().
Referenced by UTAP::StatementBuilder::collectDependencies(), collectDependencies(), and UTAP::CollectDependenciesVisitor::visitExpression().
void expression_t::collectPossibleWrites | ( | std::set< symbol_t > & | ) | const |
References UTAP::Constants::ASSAND, UTAP::Constants::ASSDIV, UTAP::Constants::ASSIGN, UTAP::Constants::ASSLSHIFT, UTAP::Constants::ASSMINUS, UTAP::Constants::ASSMOD, UTAP::Constants::ASSMULT, UTAP::Constants::ASSOR, UTAP::Constants::ASSPLUS, UTAP::Constants::ASSRSHIFT, UTAP::Constants::ASSXOR, UTAP::function_t::changes, UTAP::Constants::FUNCALL, UTAP::symbol_t::getData(), UTAP::symbol_t::getType(), UTAP::type_t::isConstant(), UTAP::type_t::isFunction(), UTAP::Constants::POSTDECREMENT, UTAP::Constants::POSTINCREMENT, UTAP::Constants::PREDECREMENT, UTAP::Constants::PREINCREMENT, UTAP::Constants::REF, UTAP::type_t::size(), UTAP::symbol(), and UTAP::function_t::uid.
Referenced by UTAP::CollectChangesVisitor::visitExpression().
|
static |
Create a binary expression.
Referenced by UTAP::ExpressionBuilder::exprArray(), UTAP::ExpressionBuilder::exprAssignment(), UTAP::ExpressionBuilder::exprBinary(), UTAP::ExpressionBuilder::exprBuiltinFunction2(), UTAP::ExpressionBuilder::exprCallEnd(), UTAP::ExpressionBuilder::exprComma(), UTAP::ExpressionBuilder::exprExistsEnd(), UTAP::ExpressionBuilder::exprForAllEnd(), UTAP::ExpressionBuilder::exprMitlConj(), UTAP::ExpressionBuilder::exprMitlDisj(), UTAP::ExpressionBuilder::exprScenario(), and UTAP::ExpressionBuilder::exprSumEnd().
|
static |
Create a CONSTANT expression.
References UTAP::Constants::CONSTANT, UTAP::type_t::createPrimitive(), and UTAP::Constants::INT.
Referenced by UTAP::ExpressionBuilder::exprMitlBox(), UTAP::ExpressionBuilder::exprMitlDiamond(), UTAP::ExpressionBuilder::exprMitlRelease(), UTAP::ExpressionBuilder::exprMitlUntil(), UTAP::ExpressionBuilder::exprProbaCompare(), UTAP::ExpressionBuilder::exprProbaExpected(), UTAP::ExpressionBuilder::exprProbaQualitative(), UTAP::ExpressionBuilder::exprProbaQuantitative(), UTAP::ExpressionBuilder::exprSimulate(), UTAP::ExpressionBuilder::exprSMCControl(), and UTAP::ExpressionBuilder::makeConstant().
|
static |
Create a DEADLOCK expression.
References UTAP::Constants::CONSTRAINT, UTAP::type_t::createPrimitive(), and UTAP::Constants::DEADLOCK.
Referenced by UTAP::ExpressionBuilder::exprDeadlock().
|
static |
Create a DOT expression.
References UTAP::Constants::DOT.
Referenced by UTAP::ExpressionBuilder::exprDot(), and UTAP::ExpressionBuilder::exprScenario().
|
static |
|
static |
References UTAP::type_t::createPrimitive(), UTAP::Constants::EXIT, and UTAP::Constants::VOID_TYPE.
Referenced by UTAP::ExpressionBuilder::exprExit().
|
static |
Create an IDENTIFIER expression.
References UTAP::symbol_t::getType(), UTAP::Constants::IDENTIFIER, and UTAP::symbol().
Referenced by UTAP::ExpressionBuilder::exprDot(), UTAP::ExpressionBuilder::exprExistsDynamicEnd(), UTAP::ExpressionBuilder::exprExistsEnd(), UTAP::ExpressionBuilder::exprForAllDynamicEnd(), UTAP::ExpressionBuilder::exprForAllEnd(), UTAP::ExpressionBuilder::exprForeachDynamicEnd(), UTAP::ExpressionBuilder::exprId(), UTAP::ExpressionBuilder::exprScenario(), UTAP::ExpressionBuilder::exprSumDynamicEnd(), and UTAP::ExpressionBuilder::exprSumEnd().
|
static |
Create an n-ary expression.
Referenced by UTAP::StatementBuilder::declInitialiserList(), UTAP::ExpressionBuilder::exprCallEnd(), UTAP::ExpressionBuilder::exprDot(), UTAP::ExpressionBuilder::exprExistsDynamicEnd(), UTAP::ExpressionBuilder::exprForAllDynamicEnd(), UTAP::ExpressionBuilder::exprForeachDynamicEnd(), UTAP::ExpressionBuilder::exprMitlBox(), UTAP::ExpressionBuilder::exprMitlDiamond(), UTAP::ExpressionBuilder::exprMitlRelease(), UTAP::ExpressionBuilder::exprMitlUntil(), UTAP::ExpressionBuilder::exprNary(), UTAP::ExpressionBuilder::exprProbaCompare(), UTAP::ExpressionBuilder::exprProbaExpected(), UTAP::ExpressionBuilder::exprProbaQualitative(), UTAP::ExpressionBuilder::exprProbaQuantitative(), UTAP::ExpressionBuilder::exprSimulate(), UTAP::ExpressionBuilder::exprSpawn(), and UTAP::ExpressionBuilder::exprSumDynamicEnd().
|
static |
Create a SYNC expression.
References UTAP::Constants::SYNC.
Referenced by UTAP::SystemBuilder::procMessage(), and UTAP::SystemBuilder::procSync().
|
static |
Create a ternary expression.
Referenced by UTAP::ExpressionBuilder::exprInlineIf(), UTAP::ExpressionBuilder::exprSMCControl(), and UTAP::ExpressionBuilder::exprTernary().
|
static |
Create a unary expression.
Referenced by UTAP::ExpressionBuilder::exprBuiltinFunction1(), UTAP::ExpressionBuilder::exprMitlAtom(), UTAP::ExpressionBuilder::exprMitlBox(), UTAP::ExpressionBuilder::exprMitlDiamond(), UTAP::ExpressionBuilder::exprMitlFormula(), UTAP::ExpressionBuilder::exprMitlNext(), UTAP::ExpressionBuilder::exprNumOf(), UTAP::ExpressionBuilder::exprPostDecrement(), UTAP::ExpressionBuilder::exprPostIncrement(), UTAP::ExpressionBuilder::exprPreDecrement(), UTAP::ExpressionBuilder::exprPreIncrement(), UTAP::ExpressionBuilder::exprProbaQualitative(), UTAP::ExpressionBuilder::exprScenario(), UTAP::ExpressionBuilder::exprUnary(), and toMITLAtom().
expression_t expression_t::deeperClone | ( | ) | const |
Makes a deep clone of the expression.
expression_t expression_t::deeperClone | ( | symbol_t | from, |
symbol_t | to | ||
) | const |
Makes a deep clone of the expression and replaces the symbol "from" with the symbol "to".
expression_t expression_t::deeperClone | ( | frame_t | frame, |
frame_t | select = frame_t() |
||
) | const |
Makes a deep clone of the expression and replaces each symbol with a symbol from the given frame(s), with the same name.
References UTAP::frame_t::resolve().
bool expression_t::dependsOn | ( | const std::set< symbol_t > & | symbols | ) | const |
True if the evaluation of this expression depends on any of the symbols in the given set.
bool expression_t::empty | ( | ) | const |
Returns true if this is an empty expression.
Referenced by UTAP::TypeChecker::checkExpression(), UTAP::XMLWriter::labels(), UTAP::XMLWriter::location(), UTAP::TypeChecker::visitBlockStatement(), UTAP::TypeChecker::visitCondition(), UTAP::TypeChecker::visitEdge(), UTAP::SignalFlow::visitExpression(), UTAP::TypeChecker::visitMessage(), UTAP::TypeChecker::visitProgressMeasure(), UTAP::TypeChecker::visitReturnStatement(), UTAP::TypeChecker::visitState(), UTAP::TypeChecker::visitUpdate(), and UTAP::TypeChecker::visitVariable().
bool expression_t::equal | ( | const expression_t & | e | ) | const |
Equality operator.
Two expressions are identical iff all the sub expressions are identical and if the kind, value and symbol of the root are identical.
References getSize().
expression_t & expression_t::get | ( | uint32_t | i | ) |
Returns the ith subexpression.
Referenced by UTAP::ExpressionBuilder::exprExistsDynamicEnd(), UTAP::ExpressionBuilder::exprForAllDynamicEnd(), hasMITLInQuantifiedSub(), hasSpawnOrExit(), UTAP::TypeChecker::visitEdge(), and UTAP::TypeChecker::visitMessage().
const expression_t & expression_t::get | ( | uint32_t | i | ) | const |
Returns the ith subexpression.
double expression_t::getDoubleValue | ( | ) | const |
Returns the value field of this expression.
This call is not valid for all expressions.
References UTAP::Constants::CONSTANT, and UTAP::Constants::DOUBLE.
int32_t expression_t::getIndex | ( | ) | const |
Returns the index field of this expression.
References UTAP::Constants::DOT.
kind_t expression_t::getKind | ( | ) | const |
Returns the kind of the expression.
Referenced by UTAP::TypeChecker::checkExpression(), checkIDList(), UTAP::ExpressionBuilder::exprExistsDynamicEnd(), UTAP::ExpressionBuilder::exprForAllDynamicEnd(), hasMITLInQuantifiedSub(), hasSpawnOrExit(), hasStrictLowerBound(), hasStrictUpperBound(), isConstantDouble(), isConstantInteger(), isGameProperty(), isListOfFormulas(), isMITL(), isProcessID(), UTAP::SignalFlow::visitExpression(), UTAP::TypeChecker::visitIODecl(), UTAP::TypeChecker::visitProperty(), UTAP::TypeChecker::visitState(), and UTAP::TypeChecker::visitSystemAfter().
const position_t & expression_t::getPosition | ( | ) | const |
Returns the position of this expression.
|
static |
References UTAP::Constants::A_BUCHI, UTAP::Constants::A_UNTIL, UTAP::Constants::A_WEAKUNTIL, UTAP::Constants::AF, UTAP::Constants::AG, UTAP::Constants::AG_R_Piotr, UTAP::Constants::AND, UTAP::Constants::ARRAY, UTAP::Constants::ASSAND, UTAP::Constants::ASSDIV, UTAP::Constants::ASSIGN, UTAP::Constants::ASSLSHIFT, UTAP::Constants::ASSMINUS, UTAP::Constants::ASSMOD, UTAP::Constants::ASSMULT, UTAP::Constants::ASSOR, UTAP::Constants::ASSPLUS, UTAP::Constants::ASSRSHIFT, UTAP::Constants::ASSXOR, UTAP::Constants::BIT_AND, UTAP::Constants::BIT_LSHIFT, UTAP::Constants::BIT_OR, UTAP::Constants::BIT_RSHIFT, UTAP::Constants::BIT_XOR, UTAP::Constants::CEIL_F, UTAP::Constants::COMMA, UTAP::Constants::CONSISTENCY, UTAP::Constants::CONSTANT, UTAP::Constants::CONTROL, UTAP::Constants::CONTROL_TOPT, UTAP::Constants::CONTROL_TOPT_DEF1, UTAP::Constants::CONTROL_TOPT_DEF2, UTAP::Constants::COS_F, UTAP::Constants::DEADLOCK, UTAP::Constants::DIV, UTAP::Constants::DOT, UTAP::Constants::DYNAMICEVAL, UTAP::Constants::EF, UTAP::Constants::EF_CONTROL, UTAP::Constants::EF_R_Piotr, UTAP::Constants::EG, UTAP::Constants::EQ, UTAP::Constants::EXISTS, UTAP::Constants::EXISTSDYNAMIC, UTAP::Constants::EXIT, UTAP::Constants::EXP_F, UTAP::Constants::FABS_F, UTAP::Constants::FLOOR_F, UTAP::Constants::FORALL, UTAP::Constants::FORALLDYNAMIC, UTAP::Constants::FOREACHDYNAMIC, UTAP::Constants::FRACTION, UTAP::Constants::FUNCALL, UTAP::Constants::GE, UTAP::Constants::GT, UTAP::Constants::IDENTIFIER, UTAP::Constants::IMPLEMENTATION, UTAP::Constants::INF_VAR, UTAP::Constants::INLINEIF, UTAP::Constants::LE, UTAP::Constants::LEADSTO, UTAP::Constants::LIST, UTAP::Constants::LN_F, UTAP::Constants::LOG_F, UTAP::Constants::LT, UTAP::Constants::MAX, UTAP::Constants::MIN, UTAP::Constants::MINUS, UTAP::Constants::MITLATOM, UTAP::Constants::MITLCONJ, UTAP::Constants::MITLDISJ, UTAP::Constants::MITLFORMULA, UTAP::Constants::MITLNEXT, UTAP::Constants::MITLRELEASE, UTAP::Constants::MITLUNTIL, UTAP::Constants::MOD, UTAP::Constants::MULT, UTAP::Constants::NEQ, UTAP::Constants::NOT, UTAP::Constants::NUMOF, UTAP::Constants::OR, UTAP::Constants::PLUS, UTAP::Constants::PO_CONTROL, UTAP::Constants::POSTDECREMENT, UTAP::Constants::POSTINCREMENT, UTAP::Constants::POW_F, UTAP::Constants::PREDECREMENT, UTAP::Constants::PREINCREMENT, UTAP::Constants::PROBABOX, UTAP::Constants::PROBADIAMOND, UTAP::Constants::PROBAEXP, UTAP::Constants::PROBAMINBOX, UTAP::Constants::PROBAMINDIAMOND, UTAP::Constants::PROCESSVAR, UTAP::Constants::RANDOM_F, UTAP::Constants::RATE, UTAP::Constants::REFINEMENT_GE, UTAP::Constants::REFINEMENT_LE, UTAP::Constants::RESTRICT, UTAP::Constants::SCENARIO, UTAP::Constants::SCENARIO2, UTAP::Constants::SIMULATE, UTAP::Constants::SIMULATION_GE, UTAP::Constants::SIMULATION_LE, UTAP::Constants::SIN_F, UTAP::Constants::SMC_CONTROL, UTAP::Constants::SPAWN, UTAP::Constants::SPECIFICATION, UTAP::Constants::SQRT_F, UTAP::Constants::SUM, UTAP::Constants::SUMDYNAMIC, UTAP::Constants::SUP_VAR, UTAP::Constants::SYNC, UTAP::Constants::SYNTAX_COMPOSITION, UTAP::Constants::TIOCOMPOSITION, UTAP::Constants::TIOCONJUNCTION, UTAP::Constants::TIOQUOTIENT, UTAP::Constants::UNARY_MINUS, and UTAP::Constants::XOR.
size_t expression_t::getSize | ( | ) | const |
Returns the number of subexpression.
References UTAP::Constants::A_BUCHI, UTAP::Constants::A_UNTIL, UTAP::Constants::A_WEAKUNTIL, UTAP::Constants::AF, UTAP::Constants::AG, UTAP::Constants::AG_R_Piotr, UTAP::Constants::AND, UTAP::Constants::ARRAY, UTAP::Constants::ASSAND, UTAP::Constants::ASSDIV, UTAP::Constants::ASSIGN, UTAP::Constants::ASSLSHIFT, UTAP::Constants::ASSMINUS, UTAP::Constants::ASSMOD, UTAP::Constants::ASSMULT, UTAP::Constants::ASSOR, UTAP::Constants::ASSPLUS, UTAP::Constants::ASSRSHIFT, UTAP::Constants::ASSXOR, UTAP::Constants::BIT_AND, UTAP::Constants::BIT_LSHIFT, UTAP::Constants::BIT_OR, UTAP::Constants::BIT_RSHIFT, UTAP::Constants::BIT_XOR, UTAP::Constants::CEIL_F, UTAP::Constants::COMMA, UTAP::Constants::CONSISTENCY, UTAP::Constants::CONSTANT, UTAP::Constants::CONTROL, UTAP::Constants::CONTROL_TOPT, UTAP::Constants::CONTROL_TOPT_DEF1, UTAP::Constants::CONTROL_TOPT_DEF2, UTAP::Constants::COS_F, UTAP::Constants::DEADLOCK, UTAP::Constants::DIV, UTAP::Constants::DOT, UTAP::Constants::DYNAMICEVAL, UTAP::Constants::EF, UTAP::Constants::EF_CONTROL, UTAP::Constants::EF_R_Piotr, UTAP::Constants::EG, UTAP::Constants::EQ, UTAP::Constants::EXISTS, UTAP::Constants::EXISTSDYNAMIC, UTAP::Constants::EXIT, UTAP::Constants::EXP_F, UTAP::Constants::FABS_F, UTAP::Constants::FLOOR_F, UTAP::Constants::FORALL, UTAP::Constants::FORALLDYNAMIC, UTAP::Constants::FOREACHDYNAMIC, UTAP::Constants::FRACTION, UTAP::Constants::FUNCALL, UTAP::Constants::GE, UTAP::Constants::GT, UTAP::Constants::IDENTIFIER, UTAP::Constants::IMPLEMENTATION, UTAP::Constants::INF_VAR, UTAP::Constants::INLINEIF, UTAP::Constants::LE, UTAP::Constants::LEADSTO, UTAP::Constants::LIST, UTAP::Constants::LN_F, UTAP::Constants::LOG_F, UTAP::Constants::LT, UTAP::Constants::MAX, UTAP::Constants::MIN, UTAP::Constants::MINUS, UTAP::Constants::MITLATOM, UTAP::Constants::MITLCONJ, UTAP::Constants::MITLDISJ, UTAP::Constants::MITLEXISTS, UTAP::Constants::MITLFORALL, UTAP::Constants::MITLFORMULA, UTAP::Constants::MITLNEXT, UTAP::Constants::MITLRELEASE, UTAP::Constants::MITLUNTIL, UTAP::Constants::MOD, UTAP::Constants::MULT, UTAP::Constants::NEQ, UTAP::Constants::NOT, UTAP::Constants::NUMOF, UTAP::Constants::OR, UTAP::Constants::PLUS, UTAP::Constants::PMAX, UTAP::Constants::PO_CONTROL, UTAP::Constants::POSTDECREMENT, UTAP::Constants::POSTINCREMENT, UTAP::Constants::POW_F, UTAP::Constants::PREDECREMENT, UTAP::Constants::PREINCREMENT, UTAP::Constants::PROBABOX, UTAP::Constants::PROBACMP, UTAP::Constants::PROBADIAMOND, UTAP::Constants::PROBAEXP, UTAP::Constants::PROBAMINBOX, UTAP::Constants::PROBAMINDIAMOND, UTAP::Constants::RANDOM_F, UTAP::Constants::RATE, UTAP::Constants::REFINEMENT_GE, UTAP::Constants::REFINEMENT_LE, UTAP::Constants::RESTRICT, UTAP::Constants::SCENARIO, UTAP::Constants::SCENARIO2, UTAP::Constants::SIMULATE, UTAP::Constants::SIMULATEREACH, UTAP::Constants::SIMULATION_GE, UTAP::Constants::SIMULATION_LE, UTAP::Constants::SIN_F, UTAP::Constants::SMC_CONTROL, UTAP::Constants::SPAWN, UTAP::Constants::SPECIFICATION, UTAP::Constants::SQRT_F, UTAP::Constants::SUM, UTAP::Constants::SUMDYNAMIC, UTAP::Constants::SUP_VAR, UTAP::Constants::SYNC, UTAP::Constants::SYNTAX_COMPOSITION, UTAP::Constants::TIOCOMPOSITION, UTAP::Constants::TIOCONJUNCTION, UTAP::Constants::TIOQUOTIENT, UTAP::Constants::UNARY_MINUS, and UTAP::Constants::XOR.
Referenced by UTAP::TypeChecker::checkExpression(), checkIDList(), equal(), hasMITLInQuantifiedSub(), hasSpawnOrExit(), hasStrictLowerBound(), hasStrictUpperBound(), isListOfFormulas(), UTAP::SignalFlow::visitExpression(), and UTAP::TypeChecker::visitProperty().
symbol_t expression_t::getSymbol | ( | ) |
Returns the symbol of a variable reference.
The expression must be a left-hand side value. In case of dot-expressions, the record/process symbol is returned. In case of an inline if, the 'true' branch is returned.
(a=1).getSymbol() returns 'a' (s.f).getSymbol() returns 's' (i<1?j:k).getSymbol() returns 'j'
The expression must be a left-hand side value. The symbol returned is the symbol of the variable the expression if resulting in a reference to. NOTE: In case of inline if, the symbol referenced by the 'true' part is returned.
Referenced by UTAP::ExpressionBuilder::exprDot(), and UTAP::SignalFlow::visitExpression().
const symbol_t expression_t::getSymbol | ( | ) | const |
Returns the symbol this expression evaluates to.
Notice that not all expression evaluate to a symbol.
References UTAP::Constants::ARRAY, UTAP::Constants::ASSAND, UTAP::Constants::ASSDIV, UTAP::Constants::ASSIGN, UTAP::Constants::ASSLSHIFT, UTAP::Constants::ASSMINUS, UTAP::Constants::ASSMOD, UTAP::Constants::ASSMULT, UTAP::Constants::ASSOR, UTAP::Constants::ASSPLUS, UTAP::Constants::ASSRSHIFT, UTAP::Constants::ASSXOR, UTAP::Constants::COMMA, UTAP::Constants::DOT, UTAP::Constants::FUNCALL, UTAP::Constants::IDENTIFIER, UTAP::Constants::INLINEIF, UTAP::Constants::PREDECREMENT, UTAP::Constants::PREINCREMENT, UTAP::Constants::SCENARIO, and UTAP::Constants::SYNC.
void expression_t::getSymbols | ( | std::set< symbol_t > & | symbols | ) | const |
Returns the set of symbols this expression might resolve into.
In case of inline if, both the 'true' and 'false' branch is added. In case of dot-expressions, both the left hand reference and the member field are returned.
(a=1).getSymbol() returns 'a' (s.f).getSymbol() returns 's,f' (i<1?j:k).getSymbol() returns 'j,k'
References UTAP::Constants::ARRAY, UTAP::Constants::ASSAND, UTAP::Constants::ASSDIV, UTAP::Constants::ASSIGN, UTAP::Constants::ASSLSHIFT, UTAP::Constants::ASSMINUS, UTAP::Constants::ASSMOD, UTAP::Constants::ASSMULT, UTAP::Constants::ASSOR, UTAP::Constants::ASSPLUS, UTAP::Constants::ASSRSHIFT, UTAP::Constants::ASSXOR, UTAP::Constants::COMMA, UTAP::Constants::DOT, UTAP::Constants::IDENTIFIER, UTAP::Constants::INLINEIF, UTAP::Constants::PREDECREMENT, UTAP::Constants::PREINCREMENT, and UTAP::Constants::SYNC.
synchronisation_t expression_t::getSync | ( | ) | const |
Returns the synchronisation type of SYNC operations.
References UTAP::Constants::SYNC.
Referenced by UTAP::TypeChecker::visitEdge(), and UTAP::SignalFlow::visitExpression().
type_t expression_t::getType | ( | ) | const |
Returns the type of the expression.
Referenced by UTAP::TypeChecker::checkExpression(), UTAP::ExpressionBuilder::exprArray(), UTAP::ExpressionBuilder::exprAssignment(), UTAP::ExpressionBuilder::exprBuiltinFunction2(), UTAP::ExpressionBuilder::exprComma(), UTAP::ExpressionBuilder::exprDot(), UTAP::ExpressionBuilder::exprInlineIf(), UTAP::ExpressionBuilder::exprScenario(), UTAP::ExpressionBuilder::exprSumDynamicEnd(), isBound(), isClock(), isConstraint(), isCost(), isDiff(), isDouble(), isFormula(), isGuard(), isInteger(), isIntegral(), isInvariant(), isInvariantWR(), isProcessID(), isVoid(), UTAP::TypeChecker::visitCondition(), UTAP::TypeChecker::visitEdge(), UTAP::SignalFlow::visitExpression(), UTAP::TypeChecker::visitMessage(), UTAP::TypeChecker::visitProperty(), UTAP::TypeChecker::visitState(), and UTAP::TypeChecker::visitSystemAfter().
int32_t expression_t::getValue | ( | ) | const |
Returns the value field of this expression.
This call is not valid for all expressions.
References UTAP::Constants::CONSTANT.
Referenced by UTAP::TypeChecker::checkExpression(), and UTAP::SignalFlow::visitExpression().
bool expression_t::hasDynamicSub | ( | ) | const |
Referenced by UTAP::CollectDynamicExpressions::visitExpression(), and UTAP::TypeChecker::visitVariable().
bool expression_t::isDynamic | ( | ) | const |
bool expression_t::isReferenceTo | ( | const std::set< symbol_t > & | symbols | ) | const |
Returns true if this expression is a reference to a symbol in the given set.
Returns true if expr might be a reference to a symbol in the set.
bool expression_t::isTrue | ( | ) | const |
References UTAP::Constants::CONSTANT.
Referenced by UTAP::TypeChecker::visitEdge().
bool expression_t::operator< | ( | const expression_t | e | ) | const |
Less-than operator.
Makes it possible to put expression_t objects into an STL set.
expression_t & expression_t::operator= | ( | const expression_t & | e | ) |
Assignment operator.
bool expression_t::operator== | ( | const expression_t | e | ) | const |
Equality operator.
Returns true if the two references point to the same expression object.
expression_t & expression_t::operator[] | ( | uint32_t | i | ) |
Returns the ith subexpression.
const expression_t expression_t::operator[] | ( | uint32_t | i | ) | const |
Returns the ith subexpression.
void expression_t::setType | ( | type_t | type | ) |
Sets the type of the expression.
Referenced by UTAP::TypeChecker::checkExpression(), UTAP::ExpressionBuilder::exprCallEnd(), UTAP::ExpressionBuilder::exprDouble(), UTAP::ExpressionBuilder::exprFalse(), UTAP::ExpressionBuilder::exprProbaQuantitative(), and UTAP::ExpressionBuilder::exprTrue().
expression_t expression_t::subst | ( | symbol_t | symbol, |
expression_t | expr | ||
) | const |
References UTAP::Constants::IDENTIFIER, and subst().
Referenced by subst().
std::string expression_t::toString | ( | bool | old = false | ) | const |
Returns a string representation of the expression.
The string returned must be deallocated with delete[]. Returns NULL is the expression is empty.
Referenced by UTAP::ExpressionBuilder::exprDot(), UTAP::XMLWriter::labels(), UTAP::XMLWriter::location(), operator<<(), UTAP::ExprStatement::toString(), UTAP::AssertStatement::toString(), UTAP::ForStatement::toString(), UTAP::WhileStatement::toString(), UTAP::SwitchStatement::toString(), UTAP::CaseStatement::toString(), UTAP::IfStatement::toString(), UTAP::ReturnStatement::toString(), and UTAP::simregion_t::toString().
bool expression_t::usesClock | ( | ) | const |
References isClock().
bool expression_t::usesFP | ( | ) | const |
References UTAP::Constants::CEIL_F, UTAP::Constants::COS_F, UTAP::Constants::DOUBLE, UTAP::Constants::EXP_F, UTAP::Constants::FABS_F, UTAP::Constants::FLOOR_F, UTAP::Constants::LN_F, UTAP::Constants::LOG_F, UTAP::Constants::POW_F, UTAP::Constants::RANDOM_F, UTAP::Constants::SIN_F, and UTAP::Constants::SQRT_F.