libutap
|
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 *) | |
virtual void | typeArrayOfSize (size_t) |
Called to create an array type. More... | |
virtual void | typeArrayOfType (size_t) |
Called to create an array type. More... | |
virtual void | typeStruct (PREFIX, uint32_t fields) |
Used to construct a new struct type, which is then pushed onto the type stack. More... | |
virtual void | structField (const char *name) |
Used to declare the fields of a structure. More... | |
virtual void | declTypeDef (const char *name) |
A type definition. More... | |
virtual void | declVar (const char *name, bool init) |
Declare a new variable of the given name. More... | |
virtual void | declInitialiserList (uint32_t num) |
virtual void | declFieldInit (const char *name) |
virtual void | declParameter (const char *name, bool) |
virtual void | declFuncBegin (const char *name) |
virtual void | declFuncEnd () |
virtual void | blockBegin () |
virtual void | blockEnd () |
virtual void | emptyStatement () |
virtual void | forBegin () |
virtual void | forEnd () |
virtual void | iterationBegin (const char *name) |
virtual void | iterationEnd (const char *name) |
virtual void | whileBegin () |
virtual void | whileEnd () |
virtual void | doWhileBegin () |
virtual void | doWhileEnd () |
virtual void | ifBegin () |
virtual void | ifElse () |
virtual void | ifEnd (bool) |
virtual void | exprStatement () |
virtual void | returnStatement (bool) |
virtual void | assertStatement () |
virtual void | exprCallBegin () |
![]() | |
ExpressionBuilder (TimedAutomataSystem *) | |
ExpressionFragments & | getExpressions () |
virtual void | addPosition (uint32_t position, uint32_t offset, uint32_t line, std::string path) |
Add mapping from an absolute position to a relative XML element. More... | |
virtual void | handleError (std::string) |
virtual void | handleWarning (std::string) |
virtual void | typeDuplicate () |
Duplicate type at the top of the type stack. More... | |
virtual void | typePop () |
Pop type at the topof the type stack. More... | |
virtual void | typeBool (PREFIX) |
Called whenever a boolean type is parsed. More... | |
virtual void | typeInt (PREFIX) |
Called whenever an integer type is parsed. More... | |
virtual void | typeDouble (PREFIX) |
Called whenever a double type is parsed. More... | |
virtual void | typeBoundedInt (PREFIX) |
Called whenever an integer type with a range is parsed. More... | |
virtual void | typeChannel (PREFIX) |
Called whenever a channel type is parsed. More... | |
virtual void | typeClock (PREFIX) |
Called whenever a clock type is parsed. More... | |
virtual void | typeVoid () |
Called whenever a void type is parsed. More... | |
virtual void | typeScalar (PREFIX) |
Called whenever a scalar type is parsed. More... | |
virtual void | typeName (PREFIX, const char *name) |
Called when a type name has been parsed. More... | |
virtual bool | isType (const char *) |
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... | |
virtual void | exprTrue () |
virtual void | exprFalse () |
virtual void | exprDouble (double) |
virtual void | exprId (const char *varName) |
virtual void | exprNat (int32_t) |
virtual void | exprCallEnd (uint32_t n) |
virtual void | exprArray () |
virtual void | exprPostIncrement () |
virtual void | exprPreIncrement () |
virtual void | exprPostDecrement () |
virtual void | exprPreDecrement () |
virtual void | exprAssignment (Constants::kind_t op) |
virtual void | exprUnary (Constants::kind_t unaryop) |
virtual void | exprBinary (Constants::kind_t binaryop) |
virtual void | exprNary (Constants::kind_t op, uint32_t num) |
virtual void | exprScenario (const char *name) |
virtual expression_t | exprScenario () |
virtual void | exprTernary (Constants::kind_t ternaryop, bool firstMissing) |
virtual void | exprInlineIf () |
virtual void | exprComma () |
virtual void | exprDot (const char *) |
virtual void | exprDeadlock () |
virtual void | exprForAllBegin (const char *name) |
virtual void | exprForAllEnd (const char *name) |
virtual void | exprExistsBegin (const char *name) |
virtual void | exprExistsEnd (const char *name) |
virtual void | exprSumBegin (const char *name) |
virtual void | exprSumEnd (const char *name) |
virtual void | exprSMCControl (int) |
virtual void | exprProbaQualitative (int, Constants::kind_t, Constants::kind_t, double) |
virtual void | exprProbaQuantitative (int, Constants::kind_t, bool stopCondition=false) |
virtual void | exprProbaCompare (int, Constants::kind_t, int, Constants::kind_t) |
virtual void | exprProbaExpected (int, const char *) |
virtual void | exprBuiltinFunction1 (Constants::kind_t) |
virtual void | exprBuiltinFunction2 (Constants::kind_t) |
virtual void | exprSimulate (int, int, int, bool=false, int=0) |
virtual void | exprMitlFormula () |
virtual void | exprMitlUntil (int, int) |
virtual void | exprMitlRelease (int, int) |
virtual void | exprMitlDisj () |
virtual void | exprMitlConj () |
virtual void | exprMitlNext () |
virtual void | exprMitlAtom () |
virtual void | exprMitlDiamond (int, int) |
virtual void | exprMitlBox (int, int) |
virtual void | exprSpawn (int params) |
virtual void | exprExit () |
virtual void | exprNumOf () |
virtual void | exprForAllDynamicBegin (const char *, const char *) |
virtual void | exprForAllDynamicEnd (const char *name) |
virtual void | exprExistsDynamicBegin (const char *, const char *) |
virtual void | exprExistsDynamicEnd (const char *) |
virtual void | exprSumDynamicBegin (const char *, const char *) |
virtual void | exprSumDynamicEnd (const char *name) |
virtual void | exprForeachDynamicBegin (const char *, const char *) |
virtual void | exprForeachDynamicEnd (const char *name) |
virtual void | pushDynamicFrameOf (template_t *t, std::string name) |
virtual void | popDynamicFrameOf (std::string name) |
![]() | |
AbstractBuilder () | |
virtual void | setPosition (uint32_t, uint32_t) |
Sets the current position. More... | |
virtual void | ganttDeclStart (const char *name) |
virtual void | ganttDeclSelect (const char *id) |
virtual void | ganttDeclEnd () |
virtual void | ganttEntryStart () |
virtual void | ganttEntrySelect (const char *id) |
virtual void | ganttEntryEnd () |
virtual void | declProgress (bool) |
Guard progress measure declaration. More... | |
virtual void | procBegin (const char *name, const bool isTA=true, const std::string type="", const std::string mode="") |
virtual void | procEnd () |
virtual void | procState (const char *name, bool hasInvariant, bool hasER) |
virtual void | procStateCommit (const char *name) |
virtual void | procStateUrgent (const char *name) |
virtual void | procStateInit (const char *name) |
virtual void | procBranchpoint (const char *name) |
virtual void | procEdgeBegin (const char *from, const char *to, const bool control, const char *actname) |
virtual void | procEdgeEnd (const char *from, const char *to) |
virtual void | procSelect (const char *id) |
virtual void | procGuard () |
virtual void | procSync (Constants::synchronisation_t type) |
virtual void | procUpdate () |
virtual void | procProb () |
virtual void | procInstanceLine () |
virtual void | instanceName (const char *name, bool templ=true) |
virtual void | instanceNameBegin (const char *name) |
virtual void | instanceNameEnd (const char *name, size_t arguments) |
virtual void | procMessage (const char *from, const char *to, const int loc, const bool pch) |
virtual void | procMessage (Constants::synchronisation_t type) |
virtual void | procCondition (const std::vector< char * > anchors, const int loc, const bool pch, const bool hot) |
virtual void | procCondition () |
virtual void | procLscUpdate (const char *anchor, const int loc, const bool pch) |
virtual void | procLscUpdate () |
virtual void | hasPrechart (const bool pch) |
virtual void | breakStatement () |
virtual void | continueStatement () |
virtual void | switchBegin () |
virtual void | switchEnd () |
virtual void | caseBegin () |
virtual void | caseEnd () |
virtual void | defaultBegin () |
virtual void | defaultEnd () |
virtual void | exprSync (Constants::synchronisation_t type) |
virtual void | declIO (const char *, int, int) |
virtual void | exprProbaQuantitative (int, Constants::kind_t) |
virtual void | exprSimulate (int, int, int) |
virtual void | instantiationBegin (const char *, size_t, const char *) |
virtual void | instantiationEnd (const char *, size_t, const char *, size_t) |
virtual void | process (const char *) |
virtual void | processListEnd () |
virtual void | done () |
virtual void | property () |
virtual void | scenario (const char *) |
virtual void | parse (const char *) |
virtual void | beforeUpdate () |
virtual void | afterUpdate () |
virtual void | beginChanPriority () |
virtual void | addChanPriority (char separator) |
virtual void | defaultChanPriority () |
virtual void | incProcPriority () |
virtual void | procPriority (const char *) |
virtual void | declDynamicTemplate (std::string) |
Dynamic. More... | |
virtual void | exprDynamicProcessExpr (const char *) |
virtual void | exprMITLForAllDynamicBegin (const char *, const char *) |
virtual void | exprMITLForAllDynamicEnd (const char *name) |
virtual void | exprMITLExistsDynamicBegin (const char *, const char *) |
virtual void | exprMITLExistsDynamicEnd (const char *name) |
virtual void | queryBegin () |
Verification queries. More... | |
virtual void | queryFormula (const char *formula, const char *location) |
virtual void | queryComment (const char *comment) |
virtual void | queryEnd () |
![]() | |
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 (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.
StatementBuilder::StatementBuilder | ( | TimedAutomataSystem * | system | ) |
References UTAP::frame_t::createFrame(), currentFun, UTAP::ExpressionBuilder::currentTemplate, and params.
|
protectedpure virtual |
Implemented in UTAP::SystemBuilder.
Referenced by declFuncBegin().
|
protectedpure virtual |
Implemented in UTAP::SystemBuilder.
Referenced by declVar(), and iterationBegin().
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
References blocks, UTAP::ExpressionBuilder::fragments, and UTAP::ExpressionBuilder::ExpressionFragments::pop().
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
References blocks, UTAP::frame_t::createFrame(), UTAP::ExpressionBuilder::frames, and UTAP::ExpressionBuilder::pushFrame().
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
References blocks, and UTAP::ExpressionBuilder::popFrame().
|
staticprotected |
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
References UTAP::ExpressionBuilder::fragments, and UTAP::AbstractBuilder::position.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
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.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
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.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
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.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
References UTAP::frame_t::addSymbol(), UTAP::type_t::createPrefix(), params, UTAP::ExpressionBuilder::TypeFragments::pop(), UTAP::Constants::REF, and UTAP::ExpressionBuilder::typeFragments.
|
virtual |
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.
References UTAP::type_t::createTypeDef(), UTAP::ExpressionBuilder::frames, UTAP::ExpressionBuilder::TypeFragments::pop(), UTAP::AbstractBuilder::position, and UTAP::ExpressionBuilder::typeFragments.
|
virtual |
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.
References addVariable(), currentFun, UTAP::ExpressionBuilder::fragments, UTAP::ExpressionBuilder::handleError(), initialisable(), mustInitialise(), UTAP::ExpressionBuilder::ExpressionFragments::pop(), UTAP::ExpressionBuilder::TypeFragments::pop(), and UTAP::ExpressionBuilder::typeFragments.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
References blocks, UTAP::ExpressionBuilder::fragments, and UTAP::ExpressionBuilder::ExpressionFragments::pop().
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
References blocks.
|
virtual |
Reimplemented from UTAP::ExpressionBuilder.
References currentFun, UTAP::ExpressionBuilder::exprCallBegin(), UTAP::ExpressionBuilder::fragments, UTAP::ExpressionBuilder::handleError(), and UTAP::function_t::uid.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
References blocks, UTAP::ExpressionBuilder::fragments, and UTAP::ExpressionBuilder::ExpressionFragments::pop().
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
References blocks, UTAP::ExpressionBuilder::fragments, and UTAP::ExpressionBuilder::ExpressionFragments::pop().
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
References blocks, UTAP::ExpressionBuilder::fragments, and UTAP::ExpressionBuilder::ExpressionFragments::pop().
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
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.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
References blocks, and UTAP::ExpressionBuilder::popFrame().
|
virtual |
|
virtual |
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.
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.
|
virtual |
Called to create an array type.
The size of the array was previously pushed as an expression.
Reimplemented from UTAP::AbstractBuilder.
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().
|
virtual |
Called to create an array type.
The size of the array was previously pushed as a type.
Reimplemented from UTAP::AbstractBuilder.
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().
|
virtual |
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.
References UTAP::ExpressionBuilder::applyPrefix(), UTAP::type_t::createRecord(), fields, labels, UTAP::AbstractBuilder::position, UTAP::ExpressionBuilder::TypeFragments::push(), and UTAP::ExpressionBuilder::typeFragments.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
|
virtual |
Reimplemented from UTAP::AbstractBuilder.
References blocks, UTAP::ExpressionBuilder::fragments, and UTAP::ExpressionBuilder::ExpressionFragments::pop().
|
protected |
Stack of nested statement blocks.
Referenced by assertStatement(), blockBegin(), blockEnd(), declFuncBegin(), declFuncEnd(), doWhileEnd(), emptyStatement(), exprStatement(), forEnd(), ifEnd(), iterationBegin(), iterationEnd(), returnStatement(), and whileEnd().
|
protected |
The function currently being parsed.
Referenced by UTAP::SystemBuilder::addFunction(), UTAP::SystemBuilder::addVariable(), declFuncBegin(), declFuncEnd(), declVar(), exprCallBegin(), returnStatement(), and StatementBuilder().
|
protected |
The types of a struct.
Referenced by declInitialiserList(), structField(), and typeStruct().
|
protected |
The labels of a struct.
Referenced by declFuncBegin(), declInitialiserList(), structField(), and typeStruct().
|
protected |
The params frame is used temporarily during parameter parsing.
Referenced by UTAP::SystemBuilder::declDynamicTemplate(), declFuncBegin(), declParameter(), UTAP::SystemBuilder::instanceNameBegin(), UTAP::SystemBuilder::instanceNameEnd(), UTAP::SystemBuilder::instantiationBegin(), UTAP::SystemBuilder::instantiationEnd(), UTAP::SystemBuilder::procBegin(), and StatementBuilder().