libutap
0.93
Uppaal Timed Automata Parser
|
Partial implementation of the builder interface, useful for building something with statements that is not a UTAP system. More...
#include <statementbuilder.h>
Public Member Functions | |
StatementBuilder (TimedAutomataSystem *) | |
~StatementBuilder () | |
void | typeArrayOfSize (size_t) override |
Called to create an array type. More... | |
void | typeArrayOfType (size_t) override |
Called to create an array type. More... | |
void | typeStruct (PREFIX, uint32_t fields) override |
Used to construct a new struct type, which is then pushed onto the type stack. More... | |
void | structField (const char *name) override |
Used to declare the fields of a structure. More... | |
void | declTypeDef (const char *name) override |
A type definition. More... | |
void | declVar (const char *name, bool init) override |
Declare a new variable of the given name. More... | |
void | declInitialiserList (uint32_t num) override |
void | declFieldInit (const char *name) override |
void | declParameter (const char *name, bool) override |
void | declFuncBegin (const char *name) override |
void | declFuncEnd () override |
void | blockBegin () override |
void | blockEnd () override |
void | emptyStatement () override |
void | forBegin () override |
void | forEnd () override |
void | iterationBegin (const char *name) override |
void | iterationEnd (const char *name) override |
void | whileBegin () override |
void | whileEnd () override |
void | doWhileBegin () override |
void | doWhileEnd () override |
void | ifBegin () override |
void | ifCondition () override |
void | ifThen () override |
void | ifEnd (bool) override |
void | exprStatement () override |
void | returnStatement (bool) override |
void | assertStatement () override |
void | exprCallBegin () override |
![]() | |
ExpressionBuilder (TimedAutomataSystem *) | |
ExpressionFragments & | getExpressions () |
void | addPosition (uint32_t position, uint32_t offset, uint32_t line, const std::string &path) override |
Add mapping from an absolute position to a relative XML element. More... | |
void | handleError (const std::string &) override |
void | handleWarning (const std::string &) override |
void | typeDuplicate () override |
Duplicate type at the top of the type stack. More... | |
void | typePop () override |
Pop type at the topof the type stack. More... | |
void | typeBool (PREFIX) override |
Called whenever a boolean type is parsed. More... | |
void | typeInt (PREFIX) override |
Called whenever an integer type is parsed. More... | |
void | typeDouble (PREFIX) override |
Called whenever a double type is parsed. More... | |
void | typeBoundedInt (PREFIX) override |
Called whenever an integer type with a range is parsed. More... | |
void | typeChannel (PREFIX) override |
Called whenever a channel type is parsed. More... | |
void | typeClock (PREFIX) override |
Called whenever a clock type is parsed. More... | |
void | typeVoid () override |
Called whenever a void type is parsed. More... | |
void | typeScalar (PREFIX) override |
Called whenever a scalar type is parsed. More... | |
void | typeName (PREFIX, const char *name) override |
Called when a type name has been parsed. More... | |
bool | isType (const char *) override |
Must return true if and only if name is registered in the symbol table as a named type, for instance, "int" or "bool" or a user defined type. More... | |
void | exprTrue () override |
void | exprFalse () override |
void | exprDouble (double) override |
void | exprId (const char *varName) override |
void | exprNat (int32_t) override |
void | exprCallEnd (uint32_t n) override |
void | exprArray () override |
void | exprPostIncrement () override |
void | exprPreIncrement () override |
void | exprPostDecrement () override |
void | exprPreDecrement () override |
void | exprAssignment (Constants::kind_t op) override |
void | exprUnary (Constants::kind_t unaryop) override |
void | exprBinary (Constants::kind_t binaryop) override |
void | exprNary (Constants::kind_t op, uint32_t num) override |
void | exprScenario (const char *name) override |
expression_t | exprScenario () |
void | exprTernary (Constants::kind_t ternaryop, bool firstMissing) override |
void | exprInlineIf () override |
void | exprComma () override |
void | exprDot (const char *) override |
void | exprDeadlock () override |
void | exprForAllBegin (const char *name) override |
void | exprForAllEnd (const char *name) override |
void | exprExistsBegin (const char *name) override |
void | exprExistsEnd (const char *name) override |
void | exprSumBegin (const char *name) override |
void | exprSumEnd (const char *name) override |
void | exprBuiltinFunction1 (Constants::kind_t) override |
void | exprBuiltinFunction2 (Constants::kind_t) override |
void | exprBuiltinFunction3 (Constants::kind_t) override |
void | exprSMCControl () override |
void | exprProbaQualitative (Constants::kind_t, Constants::kind_t, double) override |
void | exprProbaQuantitative (Constants::kind_t) override |
void | exprProbaCompare (Constants::kind_t, Constants::kind_t) override |
void | exprProbaExpected (const char *aggregatingOp) override |
void | exprSimulate (int, bool=false, int=0) override |
void | exprMitlFormula () override |
void | exprMitlUntil (int, int) override |
void | exprMitlRelease (int, int) override |
void | exprMitlDisj () override |
void | exprMitlConj () override |
void | exprMitlNext () override |
void | exprMitlAtom () override |
void | exprMitlDiamond (int, int) override |
void | exprMitlBox (int, int) override |
void | exprSpawn (int params) override |
void | exprExit () override |
void | exprNumOf () override |
void | exprForAllDynamicBegin (const char *, const char *) override |
void | exprForAllDynamicEnd (const char *name) override |
void | exprExistsDynamicBegin (const char *, const char *) override |
void | exprExistsDynamicEnd (const char *) override |
void | exprSumDynamicBegin (const char *, const char *) override |
void | exprSumDynamicEnd (const char *name) override |
void | exprForeachDynamicBegin (const char *, const char *) override |
void | exprForeachDynamicEnd (const char *name) override |
void | pushDynamicFrameOf (template_t *t, const std::string &name) |
void | popDynamicFrameOf (const std::string &name) |
![]() | |
AbstractBuilder () | |
void | setPosition (uint32_t, uint32_t) override |
Sets the current position. More... | |
void | ganttDeclStart (const char *name) override |
void | ganttDeclSelect (const char *id) override |
void | ganttDeclEnd () override |
void | ganttEntryStart () override |
void | ganttEntrySelect (const char *id) override |
void | ganttEntryEnd () override |
void | declProgress (bool) override |
Guard progress measure declaration. More... | |
void | procBegin (const char *name, const bool isTA=true, const std::string type="", const std::string mode="") override |
void | procEnd () override |
void | procState (const char *name, bool hasInvariant, bool hasER) override |
void | procStateCommit (const char *name) override |
void | procStateUrgent (const char *name) override |
void | procStateInit (const char *name) override |
void | procBranchpoint (const char *name) override |
void | procEdgeBegin (const char *from, const char *to, const bool control, const char *actname) override |
void | procEdgeEnd (const char *from, const char *to) override |
void | procSelect (const char *id) override |
void | procGuard () override |
void | procSync (Constants::synchronisation_t type) override |
void | procUpdate () override |
void | procProb () override |
void | procInstanceLine () override |
void | instanceName (const char *name, bool templ=true) override |
void | instanceNameBegin (const char *name) override |
void | instanceNameEnd (const char *name, size_t arguments) override |
void | procMessage (const char *from, const char *to, const int loc, const bool pch) override |
void | procMessage (Constants::synchronisation_t type) override |
void | procCondition (const std::vector< char *> anchors, const int loc, const bool pch, const bool hot) override |
void | procCondition () override |
void | procLscUpdate (const char *anchor, const int loc, const bool pch) override |
void | procLscUpdate () override |
void | hasPrechart (const bool pch) override |
void | breakStatement () override |
void | continueStatement () override |
void | switchBegin () override |
void | switchEnd () override |
void | caseBegin () override |
void | caseEnd () override |
void | defaultBegin () override |
void | defaultEnd () override |
void | exprSync (Constants::synchronisation_t type) override |
void | declIO (const char *, int, int) override |
void | instantiationBegin (const char *, size_t, const char *) override |
void | instantiationEnd (const char *, size_t, const char *, size_t) override |
void | process (const char *) override |
void | processListEnd () override |
void | done () override |
void | handleExpect (const char *text) override |
void | property () override |
void | scenario (const char *) override |
void | parse (const char *) override |
void | beforeUpdate () override |
void | afterUpdate () override |
void | beginChanPriority () override |
void | addChanPriority (char separator) override |
void | defaultChanPriority () override |
void | incProcPriority () override |
void | procPriority (const char *) override |
void | declDynamicTemplate (const std::string &) override |
Dynamic. More... | |
void | exprDynamicProcessExpr (const char *) override |
void | exprMITLForAllDynamicBegin (const char *, const char *) override |
void | exprMITLForAllDynamicEnd (const char *name) override |
void | exprMITLExistsDynamicBegin (const char *, const char *) override |
void | exprMITLExistsDynamicEnd (const char *name) override |
void | queryBegin () override |
Verification queries. More... | |
void | queryFormula (const char *formula, const char *location) override |
void | queryComment (const char *comment) override |
void | queryEnd () override |
![]() | |
virtual | ~ParserBuilder () |
void | handleWarning (const char *msg,...) |
void | handleError (const char *msg,...) |
Protected Member Functions | |
virtual variable_t * | addVariable (type_t type, const char *name, expression_t init)=0 |
virtual bool | addFunction (type_t type, const char *name)=0 |
![]() | |
void | pushFrame (frame_t) |
Push a new frame. More... | |
void | popFrame () |
Pop the topmost frame. More... | |
bool | resolve (const std::string &, symbol_t &) |
expression_t | makeConstant (int value) |
expression_t | makeConstant (double value) |
type_t | applyPrefix (PREFIX, type_t type) |
Given a prefix and a type, this method creates a new type by applying the prefix. More... | |
virtual bool | allowProcessReferences () |
If this method returns true, it is allowed to access the private identifiers of a process by prefixing the identifier with the process name. More... | |
Static Protected Member Functions | |
static void | collectDependencies (std::set< symbol_t > &, expression_t) |
static void | collectDependencies (std::set< symbol_t > &, type_t) |
Protected Attributes | |
frame_t | params |
The params frame is used temporarily during parameter parsing. More... | |
function_t * | currentFun |
The function currently being parsed. More... | |
std::vector< BlockStatement * > | blocks |
Stack of nested statement blocks. More... | |
std::vector< type_t > | fields |
The types of a struct. More... | |
std::vector< std::string > | labels |
The labels of a struct. More... | |
![]() | |
ExpressionFragments | fragments |
Expression stack. More... | |
TypeFragments | typeFragments |
Type stack. More... | |
std::stack< frame_t > | frames |
Frame stack. More... | |
TimedAutomataSystem * | system |
Pointer to the system under construction. More... | |
template_t * | currentTemplate |
The template currently being parsed. More... | |
int32_t | scalar_count |
Counter for creating unique scalarset names. More... | |
std::map< std::string, frame_t > | dynamicFrames |
![]() | |
position_t | position |
Additional Inherited Members | |
![]() | |
enum | PREFIX { PREFIX_NONE = 0, PREFIX_CONST = 1, PREFIX_URGENT = 2, PREFIX_BROADCAST = 4, PREFIX_URGENT_BROADCAST = 6, PREFIX_SYSTEM_META = 8, PREFIX_HYBRID = 16 } |
![]() | |
std::vector< std::string > | lscTemplateNames |
Partial implementation of the builder interface, useful for building something with statements that is not a UTAP system.
Definition at line 39 of file statementbuilder.h.
StatementBuilder::StatementBuilder | ( | TimedAutomataSystem * | system | ) |
Definition at line 44 of file statementbuilder.cpp.
References UTAP::frame_t::createFrame(), currentFun, UTAP::ExpressionBuilder::currentTemplate, and params.
StatementBuilder::~StatementBuilder | ( | ) |
Definition at line 52 of file statementbuilder.cpp.
References blocks.
|
protectedpure virtual |
Implemented in UTAP::SystemBuilder.
Referenced by declFuncBegin().
|
protectedpure virtual |
Implemented in UTAP::SystemBuilder.
Referenced by declVar(), and iterationBegin().
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 611 of file statementbuilder.cpp.
References blocks, UTAP::ExpressionBuilder::fragments, and UTAP::ExpressionBuilder::ExpressionFragments::pop().
Referenced by ifThen().
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 455 of file statementbuilder.cpp.
References blocks, UTAP::frame_t::createFrame(), UTAP::ExpressionBuilder::frames, and UTAP::ExpressionBuilder::pushFrame().
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 461 of file statementbuilder.cpp.
References blocks, and UTAP::ExpressionBuilder::popFrame().
|
staticprotected |
Definition at line 57 of file statementbuilder.cpp.
References UTAP::expression_t::collectPossibleReads(), UTAP::variable_t::expr, and UTAP::symbol_t::getData().
Referenced by collectDependencies(), UTAP::SystemBuilder::instanceNameEnd(), UTAP::SystemBuilder::instantiationEnd(), and typeArrayOfType().
|
staticprotected |
Definition at line 78 of file statementbuilder.cpp.
References collectDependencies(), UTAP::type_t::getKind(), UTAP::type_t::getRange(), UTAP::Constants::RANGE, and UTAP::type_t::size().
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 333 of file statementbuilder.cpp.
References UTAP::ExpressionBuilder::fragments, and UTAP::AbstractBuilder::position.
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 382 of file statementbuilder.cpp.
References addFunction(), blocks, UTAP::function_t::body, UTAP::frame_t::createFrame(), UTAP::type_t::createFunction(), currentFun, UTAP::ExpressionBuilder::frames, UTAP::frame_t::getSize(), UTAP::ExpressionBuilder::handleError(), labels, UTAP::frame_t::moveTo(), params, UTAP::ExpressionBuilder::TypeFragments::pop(), UTAP::AbstractBuilder::position, UTAP::ExpressionBuilder::pushFrame(), UTAP::ExpressionBuilder::typeFragments, and types.
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 415 of file statementbuilder.cpp.
References blocks, UTAP::function_t::body, currentFun, UTAP::symbol_t::getType(), UTAP::ExpressionBuilder::handleError(), UTAP::type_t::isVoid(), UTAP::ExpressionBuilder::popFrame(), and UTAP::function_t::uid.
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 339 of file statementbuilder.cpp.
References UTAP::expression_t::createNary(), UTAP::type_t::createRecord(), fields, UTAP::ExpressionBuilder::fragments, UTAP::type_t::getLabel(), labels, UTAP::Constants::LIST, UTAP::ExpressionBuilder::ExpressionFragments::pop(), UTAP::AbstractBuilder::position, UTAP::ExpressionBuilder::ExpressionFragments::push(), and types.
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 369 of file statementbuilder.cpp.
References UTAP::frame_t::addSymbol(), UTAP::type_t::createPrefix(), params, UTAP::ExpressionBuilder::TypeFragments::pop(), UTAP::Constants::REF, and UTAP::ExpressionBuilder::typeFragments.
|
overridevirtual |
A type definition.
Assign the name to the given type on the type fragment stack. In case of array types, dim constant expressions are expected on and popped from the expression stack.
Reimplemented from UTAP::AbstractBuilder.
Definition at line 190 of file statementbuilder.cpp.
References UTAP::type_t::createTypeDef(), UTAP::ExpressionBuilder::frames, UTAP::ExpressionBuilder::TypeFragments::pop(), UTAP::AbstractBuilder::position, and UTAP::ExpressionBuilder::typeFragments.
|
overridevirtual |
Declare a new variable of the given name.
The type is expected to be on the type stack. If the variable has an initialiser (the init parameter is true), then a constant expression is expected at the top of the expression stack. The expressions will be popped of the stack (the type is left untouched).
Reimplemented from UTAP::AbstractBuilder.
Definition at line 271 of file statementbuilder.cpp.
References addVariable(), currentFun, UTAP::ExpressionBuilder::fragments, UTAP::ExpressionBuilder::handleError(), initialisable(), mustInitialise(), UTAP::ExpressionBuilder::ExpressionFragments::pop(), UTAP::ExpressionBuilder::TypeFragments::pop(), and UTAP::ExpressionBuilder::typeFragments.
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 548 of file statementbuilder.cpp.
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 552 of file statementbuilder.cpp.
References blocks, UTAP::ExpressionBuilder::fragments, and UTAP::ExpressionBuilder::ExpressionFragments::pop().
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 473 of file statementbuilder.cpp.
References blocks.
|
overridevirtual |
Reimplemented from UTAP::ExpressionBuilder.
Definition at line 621 of file statementbuilder.cpp.
References currentFun, UTAP::ExpressionBuilder::exprCallBegin(), UTAP::ExpressionBuilder::fragments, UTAP::ExpressionBuilder::handleError(), and UTAP::function_t::uid.
Referenced by ifThen().
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 570 of file statementbuilder.cpp.
References blocks, UTAP::ExpressionBuilder::fragments, and UTAP::ExpressionBuilder::ExpressionFragments::pop().
Referenced by ifThen().
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 478 of file statementbuilder.cpp.
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 482 of file statementbuilder.cpp.
References blocks, UTAP::ExpressionBuilder::fragments, and UTAP::ExpressionBuilder::ExpressionFragments::pop().
|
inlineoverridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 93 of file statementbuilder.h.
|
inlineoverridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 94 of file statementbuilder.h.
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 559 of file statementbuilder.cpp.
References blocks, UTAP::ExpressionBuilder::fragments, and UTAP::ExpressionBuilder::ExpressionFragments::pop().
Referenced by ifThen().
|
inlineoverridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 95 of file statementbuilder.h.
References assertStatement(), exprCallBegin(), exprStatement(), ifEnd(), and returnStatement().
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 492 of file statementbuilder.cpp.
References addVariable(), blocks, UTAP::Constants::CONSTANT, UTAP::frame_t::createFrame(), UTAP::type_t::createPrefix(), UTAP::ExpressionBuilder::frames, UTAP::type_t::is(), UTAP::ExpressionBuilder::TypeFragments::pop(), UTAP::ExpressionBuilder::pushFrame(), UTAP::ExpressionBuilder::typeFragments, and UTAP::variable_t::uid.
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 520 of file statementbuilder.cpp.
References blocks, and UTAP::ExpressionBuilder::popFrame().
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 576 of file statementbuilder.cpp.
References blocks, currentFun, UTAP::ExpressionBuilder::fragments, UTAP::symbol_t::getType(), UTAP::ExpressionBuilder::handleError(), UTAP::type_t::isVoid(), UTAP::ExpressionBuilder::ExpressionFragments::pop(), and UTAP::function_t::uid.
Referenced by ifThen().
|
overridevirtual |
Used to declare the fields of a structure.
The type of the field is expected to be on the type fragment stack.
Reimplemented from UTAP::AbstractBuilder.
Definition at line 159 of file statementbuilder.cpp.
References UTAP::Constants::CONSTANT, fields, UTAP::ExpressionBuilder::handleError(), UTAP::type_t::is(), UTAP::type_t::isIntegral(), UTAP::type_t::isRecord(), UTAP::type_t::isScalar(), labels, UTAP::ExpressionBuilder::TypeFragments::pop(), UTAP::type_t::stripArray(), and UTAP::ExpressionBuilder::typeFragments.
|
overridevirtual |
Called to create an array type.
The size of the array was previously pushed as an expression.
Reimplemented from UTAP::AbstractBuilder.
Definition at line 98 of file statementbuilder.cpp.
References UTAP::ExpressionBuilder::exprBinary(), UTAP::ExpressionBuilder::exprNat(), UTAP::ExpressionBuilder::fragments, UTAP::Constants::MINUS, UTAP::ExpressionBuilder::ExpressionFragments::pop(), UTAP::ParserBuilder::PREFIX_NONE, UTAP::ExpressionBuilder::ExpressionFragments::push(), typeArrayOfType(), and UTAP::ExpressionBuilder::typeBoundedInt().
|
overridevirtual |
Called to create an array type.
The size of the array was previously pushed as a type.
Reimplemented from UTAP::AbstractBuilder.
Definition at line 115 of file statementbuilder.cpp.
References collectDependencies(), UTAP::type_t::createArray(), UTAP::ExpressionBuilder::currentTemplate, UTAP::ExpressionBuilder::handleError(), UTAP::type_t::is(), UTAP::type_t::isInteger(), UTAP::type_t::isScalar(), UTAP::ExpressionBuilder::TypeFragments::pop(), UTAP::AbstractBuilder::position, UTAP::Constants::RANGE, UTAP::instance_t::restricted, and UTAP::ExpressionBuilder::typeFragments.
Referenced by typeArrayOfSize().
|
overridevirtual |
Used to construct a new struct type, which is then pushed onto the type stack.
The type is based on n fields, which are expected to be on and will be popped off the type stack.
Reimplemented from UTAP::AbstractBuilder.
Definition at line 143 of file statementbuilder.cpp.
References UTAP::ExpressionBuilder::applyPrefix(), UTAP::type_t::createRecord(), fields, labels, UTAP::AbstractBuilder::position, UTAP::ExpressionBuilder::TypeFragments::push(), and UTAP::ExpressionBuilder::typeFragments.
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 535 of file statementbuilder.cpp.
|
overridevirtual |
Reimplemented from UTAP::AbstractBuilder.
Definition at line 539 of file statementbuilder.cpp.
References blocks, UTAP::ExpressionBuilder::fragments, and UTAP::ExpressionBuilder::ExpressionFragments::pop().
|
protected |
Stack of nested statement blocks.
Definition at line 52 of file statementbuilder.h.
Referenced by assertStatement(), blockBegin(), blockEnd(), declFuncBegin(), declFuncEnd(), doWhileEnd(), emptyStatement(), exprStatement(), forEnd(), ifEnd(), iterationBegin(), iterationEnd(), returnStatement(), whileEnd(), and ~StatementBuilder().
|
protected |
The function currently being parsed.
Definition at line 49 of file statementbuilder.h.
Referenced by UTAP::SystemBuilder::addFunction(), UTAP::SystemBuilder::addVariable(), declFuncBegin(), declFuncEnd(), declVar(), exprCallBegin(), returnStatement(), and StatementBuilder().
|
protected |
The types of a struct.
Definition at line 55 of file statementbuilder.h.
Referenced by declInitialiserList(), structField(), and typeStruct().
|
protected |
The labels of a struct.
Definition at line 58 of file statementbuilder.h.
Referenced by declFuncBegin(), declInitialiserList(), structField(), and typeStruct().
|
protected |
The params frame is used temporarily during parameter parsing.
Definition at line 46 of file statementbuilder.h.
Referenced by UTAP::SystemBuilder::declDynamicTemplate(), declFuncBegin(), declParameter(), UTAP::SystemBuilder::instanceNameBegin(), UTAP::SystemBuilder::instantiationBegin(), UTAP::SystemBuilder::procBegin(), and StatementBuilder().