Zen
A cross-platform functional programming language
|
#include <ParseContext.hpp>
Classes | |
struct | ImportFrame |
Stack item for imports. More... | |
class | IndexableTypeCaster |
The Indexable type visitor. More... | |
class | IndexExprCreator |
The indexable type visitor for index expressions. More... | |
class | InitVariableDefCreator |
The indexable type visitor for init variable definitions. More... | |
struct | TypeDefSig |
Temporary holder for typedef signature. More... | |
Public Types | |
typedef z::dict< const Ast::TypeSpec *, const Ast::Expr * > | TypeDefaultValueMap |
Type to default mapping type. | |
Public Member Functions | |
void | enterImport (const Ast::UserDefinedTypeSpec::NativeType &ntype, const z::string &fname) |
Push an import frame on the stack. | |
void | leaveImport () |
Pop import frame from the stack. | |
bool | inImport () const |
Check if parser is currently in an import file. | |
ImportFrame & | getImportFrame () |
Get top-most import frame. | |
const ImportFrame & | getImportFrame () const |
Get top-most import frame. | |
const Ast::UserDefinedTypeSpec::NativeType & | getNativeType () const |
Get native type of top-most import frame. | |
Ast::ChildTypeSpec & | getCurrentType () const |
Get type being currently defined. | |
Ast::ChildTypeSpec & | enterCurrentType (Ast::ChildTypeSpec &type) |
Enter a type definition. | |
Ast::ChildTypeSpec & | leaveCurrentType (Ast::ChildTypeSpec &type) |
Exit a type definition. | |
const z::string & | getFilename () const |
Get the name of the current file being compiled. | |
void | setTokenPos (const int &line, const int &col) |
Set the current token position. | |
ParseContext (zbl::Compiler &compiler, Ast::Unit &unit) | |
Default constructor. | |
~ParseContext () | |
Destructor. | |
const zbl::TokenData & | getNullToken () const |
Return reference to null token. | |
z::string | err () const |
Return an error string based on current token. | |
z::string | err (const zbl::TokenData &token) const |
Return an error string based on specified token. | |
void | importHeader (Ast::ImportStatement &stmt, const Ast::ImportStatement::Type &type) |
Imports a file. | |
Ast::ImportStatement & | createImportNamespace (const z::string &name) |
Enters an import level. | |
Ast::Namespace & | enterUnitNamespace (const z::string &name) |
Enters a namespace in current unit. | |
Ast::Namespace & | addUnitNamespace (Ast::Namespace &ns, const z::string &name) |
Add a child namespace to current namespace. | |
void | leaveUnitNamespace (Ast::Namespace &ns) |
Leave current namespace. | |
Ast::TypeSpec * | hasRootType (const z::string &name) |
Search for type. | |
Ast::TypeSpec * | hasChildType (const Ast::TypeSpec &parent, const z::string &name) |
Check if type has specified child. | |
Ast::TypeSpec & | getChildType (const Ast::TypeSpec &parent, const zbl::TokenData &name) |
Get child of specified parent. | |
Ast::TypeSpec & | enterTypeSpecRef (const zbl::TokenData &token) |
Enter type reference. | |
Ast::TypeSpec & | leaveTypeSpecRef (Ast::TypeSpec &typeSpec) |
Leave type reference. | |
Ast::QualifiedType & | createQualifiedType (const bool &isConst, const Ast::TypeSpec &type, const bool &isRef) |
Create qualified type. | |
void | enterCoertionList (const Ast::TypeSpec &type) |
Enter coertion list. | |
void | addCoertionItem (const Ast::TypeSpec &type) |
Add type to coertion list. | |
void | leaveCoertionList () |
Leave coertion list. | |
void | addCoertionMap (const Ast::TypeSpec &lhs, const Ast::TypeSpec &rhs, const Ast::TypeSpec &dst) |
Add coertion mapping. | |
void | addTypeDefaultValue (const Ast::TypeSpec &type, const Ast::Expr &expr) |
Add default value for type. | |
const Ast::Expr & | getTypeDefaultValue (const Ast::TypeSpec &type) |
Get default value for type. | |
Ast::StructMemberVariableDef & | createStructVariableDefInit (const Ast::QualifiedType &type, const z::string &name, const Ast::Expr &expr) |
Create AST node for struct member with init value. | |
Ast::StructMemberVariableDef & | createStructVariableDef (const Ast::QualifiedType &type, const z::string &name) |
Create AST node for struct member without init value. | |
Ast::ParamVariableDef & | createParamVariableDefInit (const Ast::QualifiedType &type, const z::string &name, const Ast::Expr &expr) |
Create AST node for function in-parameter with init value. | |
Ast::ParamVariableDef & | createParamVariableDef (const Ast::QualifiedType &type, const z::string &name) |
Create AST node for struct member without init value. | |
Ast::InitVariableDef & | createInitVariableDefInit (const Ast::VariableDef::DefType &defType, const Ast::QualifiedType &type, const z::string &name, const Ast::Expr &expr) |
Create AST node for local variable declaration with type specified. | |
Ast::InitVariableDef & | createInitVariableDef (const Ast::VariableDef::DefType &defType, const z::string &name, const Ast::Expr &expr) |
Create AST node for local variable declaration without type specified. | |
Ast::InitVariableDef & | createForeachInitVariableDef (const Ast::VariableDef::DefType &defType, const z::string &name, const Ast::Expr &expr) |
Create AST node for for-loop variable declaration without type specified. | |
Ast::QualifiedType & | createOutParam (const Ast::VariableDefMap &defList) |
Create AST node for out parameter. | |
Ast::SharedVariableDef & | createSharedTypeExprDef (const Ast::QualifiedType &qtype, const zbl::TokenData &name, const Ast::Expr &expr) |
Create AST node for shared variable definition. | |
Ast::SharedVariableDef & | createSharedExprDef (const zbl::TokenData &name, const Ast::Expr &expr) |
Create AST node for shared variable definition. | |
Ast::SharedVariableDef & | createSharedMemberDef (const Ast::VariableRef &vref) |
Create AST node for a member of a shared variable definition. | |
Ast::SharedDef & | createSharedDef (const Ast::VariableDefMap &defList) |
Create AST node for shared definition type. | |
Ast::FunctionDef & | getFunctionDef () const |
Get AST node for function definition type. | |
const Ast::VariableDef * | getIdentifier (const z::string &name, Ast::Storage::T &storage) const |
Get AST node for variable definition type in current and higher scopes. | |
Ast::VariableDefMap & | createVariableDefMap () |
Create AST node for variable definition map. | |
Ast::StructDefList & | createStructDefList () |
Create AST node for struct definition list. | |
Ast::StructDef & | enterStructDef (const Ast::TypeSpec::AccessType::T &accessType, const z::string &name) |
Enter struct definition. | |
Ast::StructDef & | leaveStructDef (Ast::StructDef &structDef) |
Leave struct definition. | |
Ast::StructDef & | leaveStructDefList (Ast::StructDef &structDef, const Ast::VariableDefMap &defList, const Ast::StructDefList &subTypeList) |
Leave struct definition with list of variable and subtype definitions. | |
Ast::EnumDef & | createEnumDef (const Ast::TypeSpec::AccessType::T &accessType, const z::string &name, Ast::EnumMemberDefList &defList) |
Create enum definition with list of variable definitions. | |
Ast::EnumMemberDefList & | createEnumMemberDefList () |
Create enum member definition list. | |
Ast::EnumMemberDef & | createEnumMemberDefInit (const zbl::TokenData &name, const bool &hasInit, const Ast::Expr &initExpr) |
Create enum member definition with init value. | |
Ast::EnumMemberDef & | createEnumMemberDef (const zbl::TokenData &name) |
Create enum member definition with init value. | |
TypeDefSig | createTypeDefSig (const Ast::TypeSpec::AccessType::T &accessType, const zbl::TokenData &name) |
Create typedef signature. | |
Ast::TypeDecl & | createTypeDecl (const TypeDefSig &sig) |
Create typedef declaration. | |
Ast::TypeDef & | createTypeDef (const TypeDefSig &sig, const Ast::QualifiedType &type) |
Create typedef definition. | |
Ast::GrammarToken & | createGrammarToken (const TokenData &name, const TokenData &txt, const bool &isRex, const bool &isNot) |
Create grammar token node. | |
Ast::GrammarTokenList & | createGrammarTokenList () |
Create empty grammar token list. | |
Ast::GrammarMemberId & | createGrammarMemberId (const TokenData &name) |
Create grammar member id node. | |
const Ast::VariableDef & | createGrammarMemberNameDef (const TokenData &name) |
Create grammar member name node. | |
Ast::GrammarMemberNameId & | createGrammarMemberNameId (const TokenData &name, const TokenData &txt) |
Create grammar member node. | |
Ast::GrammarMemberList & | createGrammarMemberList () |
Create empty grammar member list. | |
Ast::FunctionDef & | enterGrammarRuleOut (Ast::QualifiedType &out, const TokenData &name, Ast::Scope &in) |
Create grammar rule function definition with out parameter. | |
Ast::FunctionDef & | enterGrammarRule (const TokenData &name, Ast::Scope &in) |
Create grammar rule function definition without an out parameter, and enter grammar rule block. | |
Ast::GrammarRuleStatement & | leaveGrammarRuleBlock (Ast::FunctionDef &fdef, const Ast::GrammarMemberList &list, const Ast::StatementList &stmtList) |
Leave grammar rule block. | |
Ast::GrammarRuleStatement & | leaveGrammarRule (Ast::FunctionDef &fdef, const Ast::GrammarMemberList &list) |
Leave grammar rule block without statement list. | |
Ast::GrammarLexer & | enterLexerState (const TokenData &name) |
Enter lexer state. | |
Ast::GrammarLexer & | enterLexerState () |
Enter default lexer state. | |
Ast::GrammarLexer & | leaveLexerState (Ast::GrammarLexer &lexer, Ast::LexerStatementList &list) |
Leave lexer state. | |
Ast::FunctionDef & | enterLexer (const TokenData &name, Ast::Scope &in) |
Enter lexer. | |
Ast::LexerStatement & | leaveLexer (Ast::FunctionDef &fdef, const Ast::GrammarTokenList &list, const Ast::StatementList &stmtList) |
Leave lexer. | |
Ast::LexerStatement & | leaveLexer (Ast::FunctionDef &fdef, const Ast::GrammarTokenList &list) |
Leave lexer without a statement list. | |
Ast::LexerStatementList & | createLexerStatementList () |
Create empty lexer statement list. | |
Ast::GrammarLexerList & | createGrammarLexerList () |
Create empty grammar lexer list. | |
Ast::GrammarStatementList & | createGrammarStatementList () |
Create empty grammar statement list. | |
Ast::GrammarOptionValueList & | createGrammarOptionValueList (const TokenData &value) |
Create grammar option list. | |
Ast::GrammarOptionValueList & | addGrammarOptionValue (Ast::GrammarOptionValueList &list, const TokenData &value) |
Add value to grammar option list. | |
Ast::GrammarOption & | createGrammarOption (const TokenData &name, const Ast::GrammarOptionValueList &list) |
Create grammar option. | |
Ast::GrammarOptionList & | createGrammarOptionList () |
Create empty grammar option list. | |
Ast::FunctionDef & | enterFunctionName (const Ast::TypeSpec::AccessType::T &accessType, const Ast::QualifiedType &out, const z::string &name, Ast::Scope &in, const Ast::FunctionDef::Modifier::T &modifier) |
Enter function definition. | |
Ast::FunctionDef & | enterFunction (const Ast::TypeSpec::AccessType::T &accessType, Ast::QualifiedType &out, const zbl::TokenData &name, Ast::Scope &in, const Ast::FunctionDef::Modifier::T &modifier) |
Enter function definition with token name. | |
Ast::FunctionDef & | leaveFunction (Ast::FunctionDef &fdef) |
Enter function definition. | |
Ast::FunctionImplItem & | leaveFunctionDef (Ast::FunctionDef &fdef, const Ast::FunctionBlock &block) |
Leave function implementation definition. | |
Ast::RoutineImplItem & | leaveRoutineDef (Ast::FunctionDef &fdef, const Ast::RoutineBlock &block) |
Leave routine implementation definition. | |
Ast::GrammarImplItem & | leaveGrammarDef (Ast::FunctionDef &fdef, const Ast::GrammarBlock &block) |
Leave grammar implementation definition. | |
Ast::WindowImplItem & | leaveWindowDef (Ast::FunctionDef &fdef, const Ast::WindowBlock &block) |
Leave window implementation definition. | |
Ast::FunctionDef & | enterFunctionImpl (Ast::TypeSpec &type) |
Enter function implementation definition. | |
Ast::FunctionImplItem & | leaveFunctionImpl (Ast::FunctionDef &fdef, Ast::FunctionBlock &block) |
Leave function implementation definition. | |
Ast::FunctionImplExpr & | createFunctionImplExpr (Ast::FunctionImplItem &item) |
Create function implementation expression. | |
Ast::FunctionDefImplExpr & | createFunctionDefImplExpr (Ast::ImplItem &item) |
Create function definition implementation expression. | |
Ast::RoutineBlock & | createRoutineBlock (Ast::StatementList &list) |
Create routine block. | |
Ast::FunctionBlock & | createFunctionBlock (const Ast::StatementList &list) |
Create function block. | |
Ast::GrammarBlock & | createGrammarBlock (const Ast::GrammarOptionList &optList, const Ast::GrammarStatementList &list, const Ast::GrammarLexerList &lexList) |
Create grammar block. | |
Ast::WindowBlock & | createWindowBlock (Ast::FunctionBlock &functionBlock) |
Create window block. | |
Ast::OwnerTemplate & | createOwnerTemplate (const Ast::QualifiedType &type) |
Create owner type. | |
Ast::ListTemplate & | createListTemplate (const Ast::QualifiedType &type) |
Create list type. | |
Ast::DictTemplate & | createDictTemplate (const Ast::QualifiedType &key, const Ast::QualifiedType &type) |
Create dictionary type. | |
Ast::ListItem & | createListItem (const Ast::Expr &expr) |
Create list item. | |
void | addListItem (Ast::ListList &list, const Ast::ListItem &item) |
Add item to list. | |
Ast::ListList & | createListList () |
Create empty list. | |
Ast::DictItem & | createDictItem (const Ast::Expr &key, const Ast::Expr &expr) |
Create dictionary item. | |
void | addDictItem (Ast::DictList &list, const Ast::DictItem &item) |
Add item to dictionary. | |
Ast::DictList & | createDictList () |
Create empty dictionary. | |
Ast::DictItem & | createTreeItem (const Ast::Expr &key, const Ast::Expr &expr) |
Create tree item. | |
void | addTreeItem (Ast::DictList &list, const Ast::DictItem &item) |
Add item to tree. | |
Ast::DictList & | createTreeList () |
Create empty tree. | |
Ast::RunClosure & | createRunClosure () |
Create run closure. | |
Ast::ExitClosure & | createExitClosure () |
Create exit closure. | |
Ast::CallClosure & | createNamedCallClosure (const zbl::TokenData &name, const Ast::Invoker &fcall) |
Create named call closure. | |
Ast::CallClosure & | createCallClosure (const Ast::Invoker &fcall) |
Create call closure. | |
Ast::FunctionCallClosure & | createFunctionCallClosure (const zbl::TokenData &name, const Ast::Invoker &fcall) |
Create function call closure. | |
Ast::FunctionCallClosure & | createFunctionCallClosure (const Ast::Invoker &fcall) |
Create function call closure. | |
Ast::LoopClosure & | createLoopClosure (const Ast::Expr &expr) |
Create loop closure. | |
Ast::SharedClosure & | createSharedClosure (const zbl::TokenData &name, const Ast::SharedDef &sharedList) |
Create shared closure. | |
Ast::ReturnClosure & | createReturnClosure (const Ast::Closure::Type &type, const Ast::ExprList &list) |
Create return closure. | |
Ast::ReturnClosure & | createDefaultReturnClosure (const Ast::Closure::Type &type, Ast::FunctionDef &fdef) |
Create default return closure. | |
Ast::ClosureList & | createClosureList (Ast::Closure &closure) |
Create closure list. | |
Ast::ClosureList & | addClosureToList (Ast::ClosureList &list, const Ast::Closure::Type &type, Ast::Closure &closure) |
Add a closure to closure list. | |
Ast::ContinuationImplItem & | createContinuationImplItem (Ast::ClosureList &closureList, const Ast::ReturnClosure &retnClosure) |
Create a continuation implementation item. | |
Ast::ContinuationImplItem & | createContinuationImplItem (Ast::ClosureList &closureList) |
Create a continuation implementation item without a return closure. | |
Ast::ExprList & | createExprList () |
Create expression list. | |
Ast::QueryExpr & | createQueryExpr (const Ast::Expr &expr) |
Create query expression. | |
Ast::QueryPartExpr & | createQueryPartExpr (const Ast::Expr &keyExpr, const Ast::Expr &valExpr) |
Create query pair expression. | |
Ast::QueryValExpr & | createQueryValExpr () |
Create query value expression. | |
Ast::TernaryOpExpr & | createTernaryOpExpr (const Ast::Expr &lhs, const z::string &op1, const Ast::Expr &rhs1, const z::string &op2, const Ast::Expr &rhs2) |
Create ternary expression. | |
Ast::BinaryExpr & | createBinaryOpExpr (const Ast::Expr &lhs, const z::string &op, const Ast::Expr &rhs) |
Create ternary expression. | |
Ast::OrderedExpr & | createOrderedExpr (const Ast::Expr &rhs) |
Create ordered expression. | |
Ast::IndexExpr & | createIndexExpr (const Ast::Expr &expr, const Ast::Expr &idx) |
Create index expression. | |
Ast::IndexExpr & | createIndexKeyExpr (const Ast::Expr &expr, const TokenData &idx) |
Create index key expression. | |
Ast::PrefixOpExpr & | createPrefixOpExpr (const z::string &op, const Ast::Expr &rhs) |
Create prefix operator expression. | |
Ast::PostfixOpExpr & | createPostfixOpExpr (const Ast::Expr &lhs, const z::string &op) |
Create postfix operator expression. | |
Ast::StringFormatExpr & | createStringFormatExpr (const Ast::Expr &format, const Ast::DictList &list) |
Create string format expression. | |
Ast::ListExpr & | createListExpr (const Ast::ListList &list) |
Create list expression. | |
Ast::DictExpr & | createDictExpr (const Ast::DictList &list) |
Create dictionary expression. | |
Ast::TreeExpr & | createTreeExpr (const Ast::DictList &list) |
Create tree expression. | |
Ast::VariableRef & | createVariableRef (const Ast::Storage::T &storage, const Ast::VariableDef &vdef) |
Create variable reference node. | |
Ast::VariableRef & | createVariableRef (const zbl::TokenData &name) |
Create variable reference node. | |
Ast::VariableRef & | addVariableDefToList (Ast::VariableRef &vref, const zbl::TokenData &name) |
Add child to variable reference list. | |
Ast::VariableRefExpr & | createVariableRefExpr (const Ast::VariableRef &vref) |
Create variable reference expression. | |
Ast::Expr & | createEnumRefExpr (const Ast::TypeSpec &typeSpec, const zbl::TokenData &id) |
Create enum reference expression. | |
void | enterStructInit (const Ast::TypeSpec &typeSpec) |
Enter struct initialization. | |
Ast::StructInitItem & | createStructInitItem (const zbl::TokenData &name, const Ast::Expr &expr) |
Create struct initializaton item. | |
Ast::StructInitList & | addStructInitItemToList (Ast::StructInitList &list, const Ast::StructInitItem &item) |
Add struct initialization item to list. | |
Ast::StructInitList & | createStructInitList () |
Create empty struct initialization item list. | |
Ast::StructInitExpr & | createStructInitExpr (const Ast::StructInitList &initList) |
Create struct initialization expression. | |
Ast::StructInitExpr & | createStructInitEmptyExpr () |
Create empty struct initialization expression. | |
Ast::InstanceExpr & | createInstanceExpr (const Ast::TypeSpec &typeSpec, const Ast::ExprList &exprList) |
Create instance creation expression. | |
const Ast::QualifiedType & | getInternalCallType (const TokenData &name, const Ast::ExprList &exprList) |
get return type of internal function call | |
Ast::InternalCallExpr & | createInternalCallExpr (const TokenData &name, const Ast::ExprList &exprList) |
Create internal function call expression. | |
Ast::InvokerCallExpr & | createInvokerCallExpr (const Ast::Invoker &invoker) |
Create invoker call expression. | |
Ast::FunctionCallExpr & | createFunctionCallExpr (Ast::ContinuationImplItem &continuation) |
Create function call expression. | |
Ast::Invoker & | createInvoker (const Ast::InvokerType &invokerType, const Ast::ExprList &exprList) |
Create invoker. | |
Ast::FunctionCall & | createFunctionCall (const Ast::TypeSpec &typeSpec) |
Create function call invoker. | |
Ast::FunctionDefCall & | createFunctionDefCall (const Ast::ImplItem &item) |
Create function def invoker. | |
Ast::FunctionImplCall & | createFunctionImplCall (const Ast::ImplItem &item) |
Create function implementation invoker. | |
Ast::FunctorCall & | createFunctorExprCall (const Ast::Expr &expr) |
Create functor invoker. | |
Ast::FunctorCall & | createFunctorObjectCall (const Ast::VariableRef &vref) |
Create functor invoker. | |
Ast::NumericConstantExpr & | createNumericConstantExpr (const z::string &typestr, const z::string &val) |
Create numeric constant expression. | |
Ast::BooleanConstantExpr & | createBooleanConstantExpr (const z::string &val) |
Create boolean constant expression. | |
Ast::CharConstantExpr & | createCharConstantExpr (const z::string &val) |
Create char constant expression. | |
Ast::StringConstantExpr & | createStringConstantExpr (const zbl::TokenData &token) |
Create string constant expression. | |
Ast::ExprStatement & | createExprStatement (const Ast::Expr &expr) |
Create expression statement. | |
Ast::StatementBlock & | createStatementBlock (const Ast::StatementList &list) |
Create statement block. | |
Ast::DefineVarStatement & | createDefineVarStatement (Ast::InitVariableDef &vdef) |
Create local variable definition statement. | |
Ast::IfThenStatement & | createIfThenStatement (const Ast::Expr &cond, const Ast::StatementList &tlist) |
Create if-then statement. | |
Ast::IfElseStatement & | createIfElseStatement (const Ast::Expr &cond, const Ast::StatementList &tlist, const Ast::StatementList &flist) |
Create if-then-else statement. | |
Ast::IfElseStatement & | createIfElseIfStatement (const Ast::Expr &cond, const Ast::StatementList &tlist, Ast::Statement &fstmt) |
Create if-else-if ladder statement. | |
Ast::SelectStatement & | createSelectStatement (const Ast::SwitchLabelList &list) |
Create select statement. | |
Ast::SwitchStatement & | createSwitchStatement (const Ast::Expr &expr, const Ast::SwitchLabelList &list) |
Create switch statement. | |
Ast::SwitchLabelList & | createSwitchLabelList () |
Create empty switch label list. | |
Ast::CaseLabel & | createCaseLabel (const Ast::Expr &expr, const Ast::StatementList &list) |
Create switch case label. | |
Ast::DefaultLabel & | createDefaultLabel (const Ast::StatementList &list) |
Create switch default label. | |
Ast::ForStatement & | createForStatement (const Ast::InitVariableDef &init, const Ast::Expr &cond, const Ast::Expr &incx, const Ast::StatementList &list) |
Create for statement. | |
Ast::ForeachStatement & | createForeachStatement (const Ast::InitVariableDef &init, const Ast::StatementList &list) |
Create foreach statement. | |
Ast::WhileStatement & | createWhileStatement (const Ast::Expr &cond, const Ast::StatementList &list) |
Create while statement. | |
Ast::DoWhileStatement & | createDoWhileStatement (const Ast::Expr &cond, const Ast::StatementList &list) |
Create do-while statement. | |
Ast::LogStatement & | createLogStatement (const z::string &name, const Ast::ExprList &list) |
Create log statement. | |
Ast::BreakStatement & | createBreakStatement () |
Create break statement. | |
Ast::ContinueStatement & | createContinueStatement () |
Create continue statement. | |
Ast::EmptyStatement & | createEmptyStatement () |
Create empty statement. | |
Ast::RoutineReturnStatement & | createRoutineReturnStatement (const Ast::Expr &expr) |
Create routine return statement. | |
Ast::FunctionReturnStatement & | createFunctionReturnStatement (const Ast::ExprList &list) |
Create function return statement. | |
Ast::TypeSpecStatement & | createTypeSpecStatement (const Ast::TypeSpec &typeSpec) |
Create type definition statement. | |
Ast::TypeSpecStatement & | createFunctionImplStatement (const Ast::ImplItem &item) |
Create function implementation statement. | |
Ast::Scope & | enterInParamScope () |
Enter in-param scope. | |
void | leaveInParamScope () |
Leave in-param scope. | |
Ast::Scope & | enterBlockScope () |
Enter block scope. | |
void | leaveBlockScope () |
Leave block scope. | |
Ast::Scope & | enterContinuation () |
Leave continuation scope. | |
Ast::ContinuationImplItem & | leaveContinuation (Ast::ContinuationImplItem &continuation) |
Leave continuation scope. | |
Ast::StatementList & | enterStatementList (Ast::Statement &stmt) |
Enter statement list scope. | |
Ast::StatementList & | leaveStatementList (Ast::StatementList &list) |
Leave statement list scope. | |
Ast::StatementList & | createEmptyStatementList () |
Create empty statement list. | |
Ast::StatementList & | addStatement (Ast::StatementList &list, Ast::Statement &stmt) |
Add statement to statement list. | |
void | setProjectDef (const Ast::StructInitExpr &expr) |
When parsing a project file, set the root expression. | |
Public Attributes | |
TypeDefaultValueMap | _typeDefaultValueMap |
Type to default mapping instance. | |
Private Types | |
typedef z::stack< ImportFrame > | ImportStack |
Stack type for import frame. | |
typedef z::dict< z::string, Ast::QualifiedType * > | QualifiedTypeMap |
Type for mapping standard qualified types. | |
typedef z::list< const Ast::TypeSpec * > | CoertionList |
Type for maintaining coertion list. | |
typedef z::dict< const Ast::TypeSpec *, const Ast::TypeSpec * > | CoertionSubMap |
Type for maintaining coertion sub map. | |
typedef z::dict< const Ast::TypeSpec *, CoertionSubMap > | CoertionMap |
Type for maintaining coertion mapping. | |
typedef z::stack< const Ast::StructDef * > | StructInitStack |
Type of struct init stack. | |
typedef z::stack< Ast::Scope * > | ScopeStack |
Type of scope stack. | |
typedef z::stack < Ast::GrammarLexer * > | GrammarLexerStack |
Type of grammar lexer stack. | |
Private Member Functions | |
z::string | err (const int &line, const int &col) const |
Return an error string. | |
void | importHeaderFile (const Ast::ImportStatement &stmt, const Ast::ImportStatement::Type &type) |
Compiles a import file. | |
Ast::Namespace & | addChildNamespace (Ast::ChildTypeSpec &type, const z::string &name) |
Add a child namespace to current namespace. | |
Ast::ChildTypeSpec * | getParent (Ast::ChildTypeSpec *child) |
Get parent of specified type. | |
Ast::ChildTypeSpec & | getParent (Ast::ChildTypeSpec &child) |
Get parent of specified type. | |
Ast::QualifiedType & | getQualifiedType (const z::string &name) |
Create or get standard qualified type. | |
int | getTypeIndex (const Ast::QualifiedType &type) const |
Get int index of specified type in the coertion list. | |
const Ast::TypeSpec * | getTarget (const Ast::QualifiedType &lhs, const Ast::QualifiedType &rhs) |
Get the target for a coertion. | |
const Ast::VariableDef * | hasUdtMember (const Ast::UserDefinedTypeSpec &udt, const z::string &name) const |
Check if given UDT has specified member variable. | |
const Ast::VariableDef * | hasMember (const Ast::VariableDef &vd, const zbl::TokenData &name) const |
Check if a variable has specified member variable. | |
Ast::Expr & | getEnumRefExpr (const Ast::EnumDef &enumRef, const z::string &id) |
Create a expression node for reference to enum member. | |
bool | isAny (const Ast::QualifiedType &rhs) |
Check if specified type is of 'any' type. | |
const Ast::QualifiedType & | coerce (const Ast::QualifiedType &lhs, const Ast::QualifiedType &rhs) |
Coerce two types to one type if possible. | |
Ast::SharedVariableDef & | createSharedVariableDef (const Ast::QualifiedType &qtype, const z::string &name, const Ast::Expr &expr) |
Create AST node for shared variable definition. | |
Ast::VariableDef & | addVariableDef (const Ast::VariableDef::DefType &defType, const Ast::QualifiedType &type, const z::string &name) |
Add AST node for variable definition in current scope. | |
Ast::VariableDef & | addVariableDef (Ast::VariableDef &vdef) |
Add AST node for variable definition in current scope. | |
template<typename T > | |
T & | addChildLevel (T &t) |
Add child type to current type. | |
template<typename T > | |
T & | enterTypeSpec (T &t) |
Enter type definition. | |
template<typename T > | |
T & | leaveTypeSpec (T &t) |
Leave type definition. | |
Ast::GrammarLexer & | enterLexerState (const z::string &name) |
Enter lexer state. | |
void | addOutParamChild (Ast::MethodTypeSpec &rv, const Ast::QualifiedType &out) const |
Add out-param as a child of function definition. | |
template<typename BlockT , typename ImplT > | |
ImplT & | createImplItemT (Ast::FunctionDef &fdef, const BlockT &block) |
Create implementation item. | |
template<typename BlockT , typename ImplT > | |
ImplT & | leaveFunctionT (Ast::FunctionDef &fdef, const BlockT &block) |
Create function implementation item. | |
const Ast::AnyExpr & | createVarExpr (const Ast::Expr &expr) |
Create 'any' type expression. | |
const Ast::CastExpr & | createCastExpr (const Ast::Expr &expr) |
Create typecast expression. | |
const Ast::VariableDef & | addClosureVariableDef (const Ast::QualifiedType &type, const zbl::TokenData &name) |
Create closure variable definition. | |
const Ast::Expr & | convertToQueryConstant (const Ast::Expr &expr) |
Convert an expression to a query constant. | |
bool | isQueryType (const Ast::QualifiedType &type) |
Check if expression is a query type. | |
Ast::Scope & | enterScope (const Ast::Scope::Type &type) |
Enter scope. | |
void | leaveScope (const Ast::Scope::Type &type) |
Leave scope. | |
void | resetCurrentVDef () |
Reset current variable definition. | |
Private Attributes | |
ImportStack | _importStack |
Import frame stack. | |
QualifiedTypeMap | _qualifiedTypeMap |
Map of standard qualified types to name. | |
CoertionList | _coertionList |
Coertion list. | |
CoertionMap | _coertionMap |
Coertion mapping. | |
StructInitStack | _structInitStack |
struct initialization stack | |
zbl::Compiler & | _compiler |
The compiler instance. | |
Ast::Unit & | _unit |
The unit to read into. | |
ScopeStack | _scopeStack |
The scope stack. | |
GrammarLexerStack | _grammarLexerStack |
The grammar lexer stack. | |
Ast::InitVariableDef * | _curr_vdef |
The current vdef. | |
Token | _nullToken |
A null token. |
The Parser Context.
ParseContext | ( | zbl::Compiler & | compiler, |
Ast::Unit & | unit | ||
) | [inline] |
Default constructor.
compiler | The invoking compiler instance |
unit | The AST unit node into which to parse the unit |
T& addChildLevel | ( | T & | t | ) | [inline, private] |
Add child type to current type.
t | The child type |
Ast::Namespace& addChildNamespace | ( | Ast::ChildTypeSpec & | type, |
const z::string & | name | ||
) | [inline, private] |
Add a child namespace to current namespace.
type | Child namespace type |
name | The child namespace name |
Ast::ClosureList& addClosureToList | ( | Ast::ClosureList & | list, |
const Ast::Closure::Type & | type, | ||
Ast::Closure & | closure | ||
) | [inline] |
Add a closure to closure list.
list | The list to add to |
type | The join type |
closure | The closure to add |
const Ast::VariableDef& addClosureVariableDef | ( | const Ast::QualifiedType & | type, |
const zbl::TokenData & | name | ||
) | [inline, private] |
Create closure variable definition.
type | The type of the variable |
name | The variable name |
void addCoertionItem | ( | const Ast::TypeSpec & | type | ) | [inline] |
Add type to coertion list.
type | Type to add to coertion list |
void addCoertionMap | ( | const Ast::TypeSpec & | lhs, |
const Ast::TypeSpec & | rhs, | ||
const Ast::TypeSpec & | dst | ||
) | [inline] |
Add coertion mapping.
For example, short and int maps to int.
lhs | Type to map from |
rhs | Type to map to |
dst | Final mapping |
void addDictItem | ( | Ast::DictList & | list, |
const Ast::DictItem & | item | ||
) | [inline] |
Add item to dictionary.
list | dictionary to add to |
item | The item to add |
Ast::GrammarOptionValueList& addGrammarOptionValue | ( | Ast::GrammarOptionValueList & | list, |
const TokenData & | value | ||
) | [inline] |
Add value to grammar option list.
list | Grammar option value list |
value | Option value to add |
void addListItem | ( | Ast::ListList & | list, |
const Ast::ListItem & | item | ||
) | [inline] |
Add item to list.
list | List to add to |
item | The item to add |
void addOutParamChild | ( | Ast::MethodTypeSpec & | rv, |
const Ast::QualifiedType & | out | ||
) | const [inline, private] |
Add out-param as a child of function definition.
If out is a OutParam, add it as a child of functiondef.
rv | The function definition type |
out | The out parameter |
Ast::StatementList& addStatement | ( | Ast::StatementList & | list, |
Ast::Statement & | stmt | ||
) | [inline] |
Add statement to statement list.
list | Statement list |
stmt | First statement to add |
Ast::StructInitList& addStructInitItemToList | ( | Ast::StructInitList & | list, |
const Ast::StructInitItem & | item | ||
) | [inline] |
Add struct initialization item to list.
list | The struct initialization list |
item | The initialization item |
void addTreeItem | ( | Ast::DictList & | list, |
const Ast::DictItem & | item | ||
) | [inline] |
Add item to tree.
list | tree to add to |
item | The item to add |
void addTypeDefaultValue | ( | const Ast::TypeSpec & | type, |
const Ast::Expr & | expr | ||
) | [inline] |
Add default value for type.
type | The type |
expr | The default value |
Ast::Namespace& addUnitNamespace | ( | Ast::Namespace & | ns, |
const z::string & | name | ||
) | [inline] |
Add a child namespace to current namespace.
ns | The parent namespace |
name | The namespace name |
Ast::VariableDef& addVariableDef | ( | const Ast::VariableDef::DefType & | defType, |
const Ast::QualifiedType & | type, | ||
const z::string & | name | ||
) | [inline, private] |
Add AST node for variable definition in current scope.
defType | The definition type |
type | The variable type |
name | The variable name |
Ast::VariableDef& addVariableDef | ( | Ast::VariableDef & | vdef | ) | [inline, private] |
Add AST node for variable definition in current scope.
vdef | The variable definition |
Ast::VariableRef& addVariableDefToList | ( | Ast::VariableRef & | vref, |
const zbl::TokenData & | name | ||
) | [inline] |
Add child to variable reference list.
vref | The variable reference |
name | The child reference |
const Ast::QualifiedType& coerce | ( | const Ast::QualifiedType & | lhs, |
const Ast::QualifiedType & | rhs | ||
) | [inline, private] |
Coerce two types to one type if possible.
lhs | First type |
rhs | Second type |
Convert an expression to a query constant.
expr | Expression to convert |
Ast::BinaryExpr& createBinaryOpExpr | ( | const Ast::Expr & | lhs, |
const z::string & | op, | ||
const Ast::Expr & | rhs | ||
) | [inline] |
Create ternary expression.
lhs | The LHS expression |
op | The operator |
rhs | The RHS expression |
Ast::BooleanConstantExpr& createBooleanConstantExpr | ( | const z::string & | val | ) | [inline] |
Create boolean constant expression.
val | The value of the constant |
Ast::BreakStatement& createBreakStatement | ( | ) | [inline] |
Create break statement.
Ast::CallClosure& createCallClosure | ( | const Ast::Invoker & | fcall | ) | [inline] |
Create call closure.
fcall | The invoker |
Ast::CaseLabel& createCaseLabel | ( | const Ast::Expr & | expr, |
const Ast::StatementList & | list | ||
) | [inline] |
Create switch case label.
expr | The case expression |
list | The statement list |
const Ast::CastExpr& createCastExpr | ( | const Ast::Expr & | expr | ) | [inline, private] |
Create typecast expression.
expr | Value to be casted |
Ast::CharConstantExpr& createCharConstantExpr | ( | const z::string & | val | ) | [inline] |
Create char constant expression.
val | The value of the constant |
Ast::ClosureList& createClosureList | ( | Ast::Closure & | closure | ) | [inline] |
Ast::ContinuationImplItem& createContinuationImplItem | ( | Ast::ClosureList & | closureList, |
const Ast::ReturnClosure & | retnClosure | ||
) | [inline] |
Create a continuation implementation item.
closureList | The list of closures in the list |
retnClosure | The return closure |
Ast::ContinuationImplItem& createContinuationImplItem | ( | Ast::ClosureList & | closureList | ) | [inline] |
Create a continuation implementation item without a return closure.
Create a default return closure
closureList | The list of closures in the list |
Ast::ContinueStatement& createContinueStatement | ( | ) | [inline] |
Create continue statement.
Ast::DefaultLabel& createDefaultLabel | ( | const Ast::StatementList & | list | ) | [inline] |
Create switch default label.
list | The statement list |
Ast::ReturnClosure& createDefaultReturnClosure | ( | const Ast::Closure::Type & | type, |
Ast::FunctionDef & | fdef | ||
) | [inline] |
Create default return closure.
For continuations that do not have a return closure, create one with default values
type | Return type |
fdef | Function definition to return from |
Ast::DefineVarStatement& createDefineVarStatement | ( | Ast::InitVariableDef & | vdef | ) | [inline] |
Create local variable definition statement.
vdef | The variable definition |
Ast::DictExpr& createDictExpr | ( | const Ast::DictList & | list | ) | [inline] |
Create dictionary expression.
list | The values list |
Ast::DictItem& createDictItem | ( | const Ast::Expr & | key, |
const Ast::Expr & | expr | ||
) | [inline] |
Create dictionary item.
key | Key of item |
expr | Value of item |
Ast::DictList& createDictList | ( | ) | [inline] |
Create empty dictionary.
Ast::DictTemplate& createDictTemplate | ( | const Ast::QualifiedType & | key, |
const Ast::QualifiedType & | type | ||
) | [inline] |
Create dictionary type.
key | The type of the key |
type | Type of contained element |
Ast::DoWhileStatement& createDoWhileStatement | ( | const Ast::Expr & | cond, |
const Ast::StatementList & | list | ||
) | [inline] |
Create do-while statement.
cond | The condition expression |
list | The statement list |
Ast::EmptyStatement& createEmptyStatement | ( | ) | [inline] |
Create empty statement.
Ast::StatementList& createEmptyStatementList | ( | ) | [inline] |
Create empty statement list.
Ast::EnumDef& createEnumDef | ( | const Ast::TypeSpec::AccessType::T & | accessType, |
const z::string & | name, | ||
Ast::EnumMemberDefList & | defList | ||
) | [inline] |
Create enum definition with list of variable definitions.
accessType | The access type |
name | The enum name |
defList | The member variable definition list |
Ast::EnumMemberDef& createEnumMemberDef | ( | const zbl::TokenData & | name | ) | [inline] |
Create enum member definition with init value.
name | The member variable name |
Ast::EnumMemberDef& createEnumMemberDefInit | ( | const zbl::TokenData & | name, |
const bool & | hasInit, | ||
const Ast::Expr & | initExpr | ||
) | [inline] |
Create enum member definition with init value.
name | The member variable name |
hasInit | True if it has an initial value |
initExpr | Initial value expression |
Ast::EnumMemberDefList& createEnumMemberDefList | ( | ) | [inline] |
Create enum member definition list.
Ast::Expr& createEnumRefExpr | ( | const Ast::TypeSpec & | typeSpec, |
const zbl::TokenData & | id | ||
) | [inline] |
Create enum reference expression.
typeSpec | The enum reference |
id | The member id. |
Ast::ExitClosure& createExitClosure | ( | ) | [inline] |
Create exit closure.
Ast::ExprList& createExprList | ( | ) | [inline] |
Create expression list.
Ast::ExprStatement& createExprStatement | ( | const Ast::Expr & | expr | ) | [inline] |
Create expression statement.
expr | The expression |
Ast::InitVariableDef& createForeachInitVariableDef | ( | const Ast::VariableDef::DefType & | defType, |
const z::string & | name, | ||
const Ast::Expr & | expr | ||
) | [inline] |
Create AST node for for-loop variable declaration without type specified.
Derives type of variable from the indexable type of the container. For example:
foreach(x in mylist) { }
Here the type of x will be the type of the element contained in mylist.
defType | The definition type |
name | Name of member |
expr | The list variable |
Ast::ForeachStatement& createForeachStatement | ( | const Ast::InitVariableDef & | init, |
const Ast::StatementList & | list | ||
) | [inline] |
Create foreach statement.
init | The initialization expression |
list | The statement list |
Ast::ForStatement& createForStatement | ( | const Ast::InitVariableDef & | init, |
const Ast::Expr & | cond, | ||
const Ast::Expr & | incx, | ||
const Ast::StatementList & | list | ||
) | [inline] |
Create for statement.
init | The initialization expression |
cond | The condition expression |
incx | The increment expression |
list | The statement list |
Ast::FunctionBlock& createFunctionBlock | ( | const Ast::StatementList & | list | ) | [inline] |
Create function block.
list | List of statements in block |
Ast::FunctionCall& createFunctionCall | ( | const Ast::TypeSpec & | typeSpec | ) | [inline] |
Create function call invoker.
typeSpec | The function def to invoke |
Ast::FunctionCallClosure& createFunctionCallClosure | ( | const zbl::TokenData & | name, |
const Ast::Invoker & | fcall | ||
) | [inline] |
Create function call closure.
name | The variable name |
fcall | The invoker |
Ast::FunctionCallClosure& createFunctionCallClosure | ( | const Ast::Invoker & | fcall | ) | [inline] |
Create function call closure.
fcall | The invoker |
Ast::FunctionCallExpr& createFunctionCallExpr | ( | Ast::ContinuationImplItem & | continuation | ) | [inline] |
Create function call expression.
continuation | The continuation representing the function call. |
Ast::FunctionDefCall& createFunctionDefCall | ( | const Ast::ImplItem & | item | ) | [inline] |
Create function def invoker.
item | The implementation item to invoke |
Ast::FunctionDefImplExpr& createFunctionDefImplExpr | ( | Ast::ImplItem & | item | ) | [inline] |
Create function definition implementation expression.
item | The function implementation |
Ast::FunctionImplCall& createFunctionImplCall | ( | const Ast::ImplItem & | item | ) | [inline] |
Create function implementation invoker.
item | The implementation item to invoke |
Ast::FunctionImplExpr& createFunctionImplExpr | ( | Ast::FunctionImplItem & | item | ) | [inline] |
Create function implementation expression.
item | The function implementation |
Ast::TypeSpecStatement& createFunctionImplStatement | ( | const Ast::ImplItem & | item | ) | [inline] |
Create function implementation statement.
item | The implementation item |
Ast::FunctionReturnStatement& createFunctionReturnStatement | ( | const Ast::ExprList & | list | ) | [inline] |
Create function return statement.
list | The return expression list |
Ast::FunctorCall& createFunctorExprCall | ( | const Ast::Expr & | expr | ) | [inline] |
Create functor invoker.
expr | The functor object to invoke |
Ast::FunctorCall& createFunctorObjectCall | ( | const Ast::VariableRef & | vref | ) | [inline] |
Create functor invoker.
vref | The variable reference to the functor |
Ast::GrammarBlock& createGrammarBlock | ( | const Ast::GrammarOptionList & | optList, |
const Ast::GrammarStatementList & | list, | ||
const Ast::GrammarLexerList & | lexList | ||
) | [inline] |
Create grammar block.
optList | List of options in grammar block |
list | List of rule statements in block |
lexList | List of lexer in grammar block |
Ast::GrammarLexerList& createGrammarLexerList | ( | ) | [inline] |
Create empty grammar lexer list.
Ast::GrammarMemberId& createGrammarMemberId | ( | const TokenData & | name | ) | [inline] |
Create grammar member id node.
name | member name |
Ast::GrammarMemberList& createGrammarMemberList | ( | ) | [inline] |
Create empty grammar member list.
const Ast::VariableDef& createGrammarMemberNameDef | ( | const TokenData & | name | ) | [inline] |
Create grammar member name node.
name | member name token |
Ast::GrammarMemberNameId& createGrammarMemberNameId | ( | const TokenData & | name, |
const TokenData & | txt | ||
) | [inline] |
Create grammar member node.
name | member name |
txt | The member txt |
Ast::GrammarOption& createGrammarOption | ( | const TokenData & | name, |
const Ast::GrammarOptionValueList & | list | ||
) | [inline] |
Create grammar option.
name | Option name |
list | List of option values |
Ast::GrammarOptionList& createGrammarOptionList | ( | ) | [inline] |
Create empty grammar option list.
Ast::GrammarOptionValueList& createGrammarOptionValueList | ( | const TokenData & | value | ) | [inline] |
Create grammar option list.
value | Option value to add |
Ast::GrammarStatementList& createGrammarStatementList | ( | ) | [inline] |
Create empty grammar statement list.
Ast::GrammarToken& createGrammarToken | ( | const TokenData & | name, |
const TokenData & | txt, | ||
const bool & | isRex, | ||
const bool & | isNot | ||
) | [inline] |
Ast::GrammarTokenList& createGrammarTokenList | ( | ) | [inline] |
Create empty grammar token list.
Ast::IfElseStatement& createIfElseIfStatement | ( | const Ast::Expr & | cond, |
const Ast::StatementList & | tlist, | ||
Ast::Statement & | fstmt | ||
) | [inline] |
Create if-else-if ladder statement.
cond | The condition expression |
tlist | The true statement list |
fstmt | The else-if statement |
Ast::IfElseStatement& createIfElseStatement | ( | const Ast::Expr & | cond, |
const Ast::StatementList & | tlist, | ||
const Ast::StatementList & | flist | ||
) | [inline] |
Create if-then-else statement.
cond | The condition expression |
tlist | The true statement list |
flist | The false statement list |
Ast::IfThenStatement& createIfThenStatement | ( | const Ast::Expr & | cond, |
const Ast::StatementList & | tlist | ||
) | [inline] |
Create if-then statement.
cond | The condition expression |
tlist | The true statement list |
ImplT& createImplItemT | ( | Ast::FunctionDef & | fdef, |
const BlockT & | block | ||
) | [inline, private] |
Create implementation item.
fdef | The function definition |
block | The function block |
Ast::ImportStatement& createImportNamespace | ( | const z::string & | name | ) | [inline] |
Enters an import level.
name | The import file name |
Ast::IndexExpr& createIndexExpr | ( | const Ast::Expr & | expr, |
const Ast::Expr & | idx | ||
) | [inline] |
Create index expression.
expr | The container expression |
idx | The index expression |
Ast::IndexExpr& createIndexKeyExpr | ( | const Ast::Expr & | expr, |
const TokenData & | idx | ||
) | [inline] |
Create index key expression.
expr | The container expression |
idx | The index expression |
Ast::InitVariableDef& createInitVariableDef | ( | const Ast::VariableDef::DefType & | defType, |
const z::string & | name, | ||
const Ast::Expr & | expr | ||
) | [inline] |
Create AST node for local variable declaration without type specified.
defType | The type |
name | Name of member |
expr | Init value |
Ast::InitVariableDef& createInitVariableDefInit | ( | const Ast::VariableDef::DefType & | defType, |
const Ast::QualifiedType & | type, | ||
const z::string & | name, | ||
const Ast::Expr & | expr | ||
) | [inline] |
Create AST node for local variable declaration with type specified.
defType | The definition type |
type | The type |
name | Name of member |
expr | Init value |
Ast::InstanceExpr& createInstanceExpr | ( | const Ast::TypeSpec & | typeSpec, |
const Ast::ExprList & | exprList | ||
) | [inline] |
Create instance creation expression.
Creates an instance of different types like struct, function, list, etc
typeSpec | The struct type |
exprList | The initialization value list |
Ast::InternalCallExpr& createInternalCallExpr | ( | const TokenData & | name, |
const Ast::ExprList & | exprList | ||
) | [inline] |
Create internal function call expression.
name | Name of function |
exprList | The function call argument value list |
Ast::Invoker& createInvoker | ( | const Ast::InvokerType & | invokerType, |
const Ast::ExprList & | exprList | ||
) | [inline] |
Create invoker.
invokerType | The invocation type |
exprList | The argument list |
Ast::InvokerCallExpr& createInvokerCallExpr | ( | const Ast::Invoker & | invoker | ) | [inline] |
Create invoker call expression.
invoker | The invoker to call |
Ast::LexerStatementList& createLexerStatementList | ( | ) | [inline] |
Create empty lexer statement list.
Ast::ListExpr& createListExpr | ( | const Ast::ListList & | list | ) | [inline] |
Create list expression.
list | The values list |
Ast::ListItem& createListItem | ( | const Ast::Expr & | expr | ) | [inline] |
Create list item.
expr | Value of item |
Ast::ListList& createListList | ( | ) | [inline] |
Create empty list.
Ast::ListTemplate& createListTemplate | ( | const Ast::QualifiedType & | type | ) | [inline] |
Create list type.
type | Type of contained element |
Ast::LogStatement& createLogStatement | ( | const z::string & | name, |
const Ast::ExprList & | list | ||
) | [inline] |
Create log statement.
name | Name of log target |
list | The list of expressions to log |
Ast::LoopClosure& createLoopClosure | ( | const Ast::Expr & | expr | ) | [inline] |
Create loop closure.
expr | Loop confition expression |
Ast::CallClosure& createNamedCallClosure | ( | const zbl::TokenData & | name, |
const Ast::Invoker & | fcall | ||
) | [inline] |
Create named call closure.
name | The variable name |
fcall | The invoker |
Ast::NumericConstantExpr& createNumericConstantExpr | ( | const z::string & | typestr, |
const z::string & | val | ||
) | [inline] |
Create numeric constant expression.
typestr | The type of the constant |
val | The value of the constant |
Ast::OrderedExpr& createOrderedExpr | ( | const Ast::Expr & | rhs | ) | [inline] |
Create ordered expression.
rhs | The inner expression |
Ast::QualifiedType& createOutParam | ( | const Ast::VariableDefMap & | defList | ) | [inline] |
Create AST node for out parameter.
defList | The list of variable definitions in the out-parameter |
Ast::OwnerTemplate& createOwnerTemplate | ( | const Ast::QualifiedType & | type | ) | [inline] |
Create owner type.
type | Type of contained element |
Ast::ParamVariableDef& createParamVariableDef | ( | const Ast::QualifiedType & | type, |
const z::string & | name | ||
) | [inline] |
Create AST node for struct member without init value.
This function gets and uses default value for type
type | The type |
name | Name of member |
Ast::ParamVariableDef& createParamVariableDefInit | ( | const Ast::QualifiedType & | type, |
const z::string & | name, | ||
const Ast::Expr & | expr | ||
) | [inline] |
Create AST node for function in-parameter with init value.
type | The type |
name | Name of member |
expr | Init value |
Ast::PostfixOpExpr& createPostfixOpExpr | ( | const Ast::Expr & | lhs, |
const z::string & | op | ||
) | [inline] |
Create postfix operator expression.
lhs | The operand |
op | The prefix operator |
Ast::PrefixOpExpr& createPrefixOpExpr | ( | const z::string & | op, |
const Ast::Expr & | rhs | ||
) | [inline] |
Create prefix operator expression.
op | The prefix operator |
rhs | The operand |
Ast::QualifiedType& createQualifiedType | ( | const bool & | isConst, |
const Ast::TypeSpec & | type, | ||
const bool & | isRef | ||
) | [inline] |
Create qualified type.
isConst | True if type is a const |
type | The typespec |
isRef | True if this should be a reference |
Ast::QueryExpr& createQueryExpr | ( | const Ast::Expr & | expr | ) | [inline] |
Create query expression.
expr | The query expression |
Ast::QueryPartExpr& createQueryPartExpr | ( | const Ast::Expr & | keyExpr, |
const Ast::Expr & | valExpr | ||
) | [inline] |
Create query pair expression.
keyExpr | The key expression |
valExpr | The value expression |
Ast::QueryValExpr& createQueryValExpr | ( | ) | [inline] |
Create query value expression.
Ast::ReturnClosure& createReturnClosure | ( | const Ast::Closure::Type & | type, |
const Ast::ExprList & | list | ||
) | [inline] |
Create return closure.
type | Return type |
list | List of values to return |
Ast::RoutineBlock& createRoutineBlock | ( | Ast::StatementList & | list | ) | [inline] |
Create routine block.
list | List of statements in block |
Ast::RoutineReturnStatement& createRoutineReturnStatement | ( | const Ast::Expr & | expr | ) | [inline] |
Create routine return statement.
expr | The return expression |
Ast::RunClosure& createRunClosure | ( | ) | [inline] |
Create run closure.
Ast::SelectStatement& createSelectStatement | ( | const Ast::SwitchLabelList & | list | ) | [inline] |
Create select statement.
list | The label list |
Ast::SharedClosure& createSharedClosure | ( | const zbl::TokenData & | name, |
const Ast::SharedDef & | sharedList | ||
) | [inline] |
Create shared closure.
name | The variable name |
sharedList | The list of shared definitions |
Ast::SharedDef& createSharedDef | ( | const Ast::VariableDefMap & | defList | ) | [inline] |
Create AST node for shared definition type.
defList | The variable definition list |
Ast::SharedVariableDef& createSharedExprDef | ( | const zbl::TokenData & | name, |
const Ast::Expr & | expr | ||
) | [inline] |
Create AST node for shared variable definition.
name | Name of member |
expr | Init value |
Ast::SharedVariableDef& createSharedMemberDef | ( | const Ast::VariableRef & | vref | ) | [inline] |
Create AST node for a member of a shared variable definition.
vref | Variable reference |
Ast::SharedVariableDef& createSharedTypeExprDef | ( | const Ast::QualifiedType & | qtype, |
const zbl::TokenData & | name, | ||
const Ast::Expr & | expr | ||
) | [inline] |
Create AST node for shared variable definition.
qtype | The type |
name | Name of member |
expr | Init value |
Ast::SharedVariableDef& createSharedVariableDef | ( | const Ast::QualifiedType & | qtype, |
const z::string & | name, | ||
const Ast::Expr & | expr | ||
) | [inline, private] |
Create AST node for shared variable definition.
qtype | The type |
name | Name of member |
expr | Init value |
Ast::StatementBlock& createStatementBlock | ( | const Ast::StatementList & | list | ) | [inline] |
Create statement block.
list | The statement list |
Ast::StringConstantExpr& createStringConstantExpr | ( | const zbl::TokenData & | token | ) | [inline] |
Create string constant expression.
token | The string constant value |
Ast::StringFormatExpr& createStringFormatExpr | ( | const Ast::Expr & | format, |
const Ast::DictList & | list | ||
) | [inline] |
Create string format expression.
format | The format expression |
list | The values list |
Ast::StructDefList& createStructDefList | ( | ) | [inline] |
Create AST node for struct definition list.
Ast::StructInitExpr& createStructInitEmptyExpr | ( | ) | [inline] |
Create empty struct initialization expression.
Ast::StructInitExpr& createStructInitExpr | ( | const Ast::StructInitList & | initList | ) | [inline] |
Create struct initialization expression.
initList | The initialization list |
Ast::StructInitItem& createStructInitItem | ( | const zbl::TokenData & | name, |
const Ast::Expr & | expr | ||
) | [inline] |
Create struct initializaton item.
name | Name of member to initialize |
expr | The value to initialize with |
Ast::StructInitList& createStructInitList | ( | ) | [inline] |
Create empty struct initialization item list.
Ast::StructMemberVariableDef& createStructVariableDef | ( | const Ast::QualifiedType & | type, |
const z::string & | name | ||
) | [inline] |
Create AST node for struct member without init value.
This function gets the default init value for the type and uses that.
type | The type |
name | Name of member |
Ast::StructMemberVariableDef& createStructVariableDefInit | ( | const Ast::QualifiedType & | type, |
const z::string & | name, | ||
const Ast::Expr & | expr | ||
) | [inline] |
Create AST node for struct member with init value.
type | The type |
name | Name of member |
expr | Init value |
Ast::SwitchLabelList& createSwitchLabelList | ( | ) | [inline] |
Create empty switch label list.
Ast::SwitchStatement& createSwitchStatement | ( | const Ast::Expr & | expr, |
const Ast::SwitchLabelList & | list | ||
) | [inline] |
Create switch statement.
expr | The switch expression |
list | The label list |
Ast::TernaryOpExpr& createTernaryOpExpr | ( | const Ast::Expr & | lhs, |
const z::string & | op1, | ||
const Ast::Expr & | rhs1, | ||
const z::string & | op2, | ||
const Ast::Expr & | rhs2 | ||
) | [inline] |
Create ternary expression.
lhs | The LHS expression |
op1 | The first operator |
rhs1 | The first RHS expression |
op2 | The second operator |
rhs2 | The second RHS expression |
Ast::TreeExpr& createTreeExpr | ( | const Ast::DictList & | list | ) | [inline] |
Create tree expression.
list | The values list |
Ast::DictItem& createTreeItem | ( | const Ast::Expr & | key, |
const Ast::Expr & | expr | ||
) | [inline] |
Create tree item.
key | Key of item |
expr | Value of item |
Ast::DictList& createTreeList | ( | ) | [inline] |
Create empty tree.
Ast::TypeDecl& createTypeDecl | ( | const TypeDefSig & | sig | ) | [inline] |
Create typedef declaration.
sig | The typedef signature |
Ast::TypeDef& createTypeDef | ( | const TypeDefSig & | sig, |
const Ast::QualifiedType & | type | ||
) | [inline] |
Create typedef definition.
sig | The typedef signature |
type | The target type |
TypeDefSig createTypeDefSig | ( | const Ast::TypeSpec::AccessType::T & | accessType, |
const zbl::TokenData & | name | ||
) | [inline] |
Create typedef signature.
accessType | The access type |
name | The typedef name |
Ast::TypeSpecStatement& createTypeSpecStatement | ( | const Ast::TypeSpec & | typeSpec | ) | [inline] |
Create type definition statement.
typeSpec | The type definition |
const Ast::AnyExpr& createVarExpr | ( | const Ast::Expr & | expr | ) | [inline, private] |
Create 'any' type expression.
expr | Value of any instance |
Ast::VariableDefMap& createVariableDefMap | ( | ) | [inline] |
Create AST node for variable definition map.
Ast::VariableRef& createVariableRef | ( | const Ast::Storage::T & | storage, |
const Ast::VariableDef & | vdef | ||
) | [inline] |
Create variable reference node.
storage | The storage type of the definition |
vdef | The variable definition to refer to |
Ast::VariableRef& createVariableRef | ( | const zbl::TokenData & | name | ) | [inline] |
Create variable reference node.
name | The token |
Ast::VariableRefExpr& createVariableRefExpr | ( | const Ast::VariableRef & | vref | ) | [inline] |
Create variable reference expression.
vref | The variable reference |
Ast::WhileStatement& createWhileStatement | ( | const Ast::Expr & | cond, |
const Ast::StatementList & | list | ||
) | [inline] |
Create while statement.
cond | The condition expression |
list | The statement list |
Ast::WindowBlock& createWindowBlock | ( | Ast::FunctionBlock & | functionBlock | ) | [inline] |
Create window block.
functionBlock | Function block fr this window definition |
Ast::Scope& enterBlockScope | ( | ) | [inline] |
Enter block scope.
void enterCoertionList | ( | const Ast::TypeSpec & | type | ) | [inline] |
Enter coertion list.
type | Type to add to coertion list |
Ast::Scope& enterContinuation | ( | ) | [inline] |
Leave continuation scope.
Ast::ChildTypeSpec& enterCurrentType | ( | Ast::ChildTypeSpec & | type | ) | [inline] |
Enter a type definition.
Pushes the type on the type stack in the current import frame
type | The type being defined |
Ast::FunctionDef& enterFunction | ( | const Ast::TypeSpec::AccessType::T & | accessType, |
Ast::QualifiedType & | out, | ||
const zbl::TokenData & | name, | ||
Ast::Scope & | in, | ||
const Ast::FunctionDef::Modifier::T & | modifier | ||
) | [inline] |
Enter function definition with token name.
accessType | The access type |
out | Out parameters |
name | The typedef name |
in | In-parameters |
modifier | Function modifier |
Ast::FunctionDef& enterFunctionImpl | ( | Ast::TypeSpec & | type | ) | [inline] |
Enter function implementation definition.
type | The function type being defined |
Ast::FunctionDef& enterFunctionName | ( | const Ast::TypeSpec::AccessType::T & | accessType, |
const Ast::QualifiedType & | out, | ||
const z::string & | name, | ||
Ast::Scope & | in, | ||
const Ast::FunctionDef::Modifier::T & | modifier | ||
) | [inline] |
Enter function definition.
accessType | The access type |
out | Out parameters |
name | The typedef name |
in | In-parameters |
modifier | Function modifier |
Ast::FunctionDef& enterGrammarRule | ( | const TokenData & | name, |
Ast::Scope & | in | ||
) | [inline] |
Create grammar rule function definition without an out parameter, and enter grammar rule block.
Defaults to int as an out parameter
name | The grammar rule name |
in | The in parameter list |
Ast::FunctionDef& enterGrammarRuleOut | ( | Ast::QualifiedType & | out, |
const TokenData & | name, | ||
Ast::Scope & | in | ||
) | [inline] |
Create grammar rule function definition with out parameter.
out | The out parameter |
name | The grammar rule name |
in | The in parameter list |
void enterImport | ( | const Ast::UserDefinedTypeSpec::NativeType & | ntype, |
const z::string & | fname | ||
) | [inline] |
Push an import frame on the stack.
ntype | The native type for the import |
fname | The import filename |
Ast::Scope& enterInParamScope | ( | ) | [inline] |
Enter in-param scope.
Ast::FunctionDef& enterLexer | ( | const TokenData & | name, |
Ast::Scope & | in | ||
) | [inline] |
Enter lexer.
name | The lexer name |
in | The in parameters |
Ast::GrammarLexer& enterLexerState | ( | ) | [inline] |
Enter default lexer state.
Ast::GrammarLexer& enterLexerState | ( | const TokenData & | name | ) | [inline] |
Enter lexer state.
name | The lexer name |
Ast::GrammarLexer& enterLexerState | ( | const z::string & | name | ) | [inline, private] |
Enter lexer state.
name | The lexer name |
Ast::Scope& enterScope | ( | const Ast::Scope::Type & | type | ) | [inline, private] |
Enter scope.
type | Scope type |
Ast::StatementList& enterStatementList | ( | Ast::Statement & | stmt | ) | [inline] |
Enter statement list scope.
stmt | First statement in list |
Ast::StructDef& enterStructDef | ( | const Ast::TypeSpec::AccessType::T & | accessType, |
const z::string & | name | ||
) | [inline] |
Enter struct definition.
accessType | The access type |
name | The struct name |
void enterStructInit | ( | const Ast::TypeSpec & | typeSpec | ) | [inline] |
Enter struct initialization.
typeSpec | Type of struct being initialized |
T& enterTypeSpec | ( | T & | t | ) | [inline, private] |
Enter type definition.
t | The type |
Ast::TypeSpec& enterTypeSpecRef | ( | const zbl::TokenData & | token | ) | [inline] |
Enter type reference.
token | The token representing the type reference to enter |
Ast::Namespace& enterUnitNamespace | ( | const z::string & | name | ) | [inline] |
Enters a namespace in current unit.
name | The namespace name |
z::string err | ( | ) | const [inline] |
Return an error string based on current token.
z::string err | ( | const zbl::TokenData & | token | ) | const [inline] |
Return an error string based on specified token.
token | Token where error was detected |
z::string err | ( | const int & | line, |
const int & | col | ||
) | const [inline, private] |
Return an error string.
line | Line number in unit |
col | Column number in unit |
Ast::TypeSpec& getChildType | ( | const Ast::TypeSpec & | parent, |
const zbl::TokenData & | name | ||
) | [inline] |
Get child of specified parent.
parent | The parent type |
name | Child name to search for |
Ast::ChildTypeSpec& getCurrentType | ( | ) | const [inline] |
Get type being currently defined.
Ast::Expr& getEnumRefExpr | ( | const Ast::EnumDef & | enumRef, |
const z::string & | id | ||
) | [inline, private] |
Create a expression node for reference to enum member.
enumRef | The enum reference |
id | The enum member |
const z::string& getFilename | ( | ) | const [inline] |
Get the name of the current file being compiled.
Ast::FunctionDef& getFunctionDef | ( | ) | const [inline] |
Get AST node for function definition type.
const Ast::VariableDef* getIdentifier | ( | const z::string & | name, |
Ast::Storage::T & | storage | ||
) | const [inline] |
Get AST node for variable definition type in current and higher scopes.
name | The variable name |
storage | Return value reference for storage type where variable was found |
ImportFrame& getImportFrame | ( | ) | [inline] |
Get top-most import frame.
const ImportFrame& getImportFrame | ( | ) | const [inline] |
Get top-most import frame.
const Ast::QualifiedType& getInternalCallType | ( | const TokenData & | name, |
const Ast::ExprList & | exprList | ||
) | [inline] |
get return type of internal function call
For create(), it is the type of the contained item for every thing else it is void
name | Name of function |
exprList | The function call argument value list |
const Ast::UserDefinedTypeSpec::NativeType& getNativeType | ( | ) | const [inline] |
Get native type of top-most import frame.
const zbl::TokenData& getNullToken | ( | ) | const [inline] |
Return reference to null token.
Used by parser.
Ast::ChildTypeSpec& getParent | ( | Ast::ChildTypeSpec & | child | ) | [inline, private] |
Get parent of specified type.
child | The type whose parent to get |
Ast::ChildTypeSpec* getParent | ( | Ast::ChildTypeSpec * | child | ) | [inline, private] |
Get parent of specified type.
child | The type whose parent to get |
Ast::QualifiedType& getQualifiedType | ( | const z::string & | name | ) | [inline, private] |
Create or get standard qualified type.
This function checks if the specified type exists in the map, and if not creates it and returns a reference to it.
name | Name of qualified type |
const Ast::TypeSpec* getTarget | ( | const Ast::QualifiedType & | lhs, |
const Ast::QualifiedType & | rhs | ||
) | [inline, private] |
Get the target for a coertion.
lhs | Type to map from |
rhs | Type to map to |
const Ast::Expr& getTypeDefaultValue | ( | const Ast::TypeSpec & | type | ) | [inline] |
Get default value for type.
type | The type |
int getTypeIndex | ( | const Ast::QualifiedType & | type | ) | const [inline, private] |
Get int index of specified type in the coertion list.
type | The type |
Ast::TypeSpec* hasChildType | ( | const Ast::TypeSpec & | parent, |
const z::string & | name | ||
) | [inline] |
Check if type has specified child.
parent | The parent type |
name | Child name to search for |
const Ast::VariableDef* hasMember | ( | const Ast::VariableDef & | vd, |
const zbl::TokenData & | name | ||
) | const [inline, private] |
Check if a variable has specified member variable.
vd | The variable definition to check |
name | The member to check |
Ast::TypeSpec* hasRootType | ( | const z::string & | name | ) | [inline] |
Search for type.
Given a type, this function searches for it in current type, then parent type and so on until it reaches the root type. Then search the imported types.
name | Type name to search for |
const Ast::VariableDef* hasUdtMember | ( | const Ast::UserDefinedTypeSpec & | udt, |
const z::string & | name | ||
) | const [inline, private] |
Check if given UDT has specified member variable.
udt | The UDT to check |
name | The member to check |
void importHeader | ( | Ast::ImportStatement & | stmt, |
const Ast::ImportStatement::Type & | type | ||
) | [inline] |
Imports a file.
stmt | The import statement |
type | The import type |
void importHeaderFile | ( | const Ast::ImportStatement & | stmt, |
const Ast::ImportStatement::Type & | type | ||
) | [private] |
Compiles a import file.
This function is implemented in Compiler.cpp because the import should be done through the compiler instance
stmt | The import statement |
type | The import type |
bool inImport | ( | ) | const [inline] |
Check if parser is currently in an import file.
bool isAny | ( | const Ast::QualifiedType & | rhs | ) | [inline, private] |
Check if specified type is of 'any' type.
rhs | The type to check |
bool isQueryType | ( | const Ast::QualifiedType & | type | ) | [inline, private] |
Check if expression is a query type.
type | The query type |
Ast::ContinuationImplItem& leaveContinuation | ( | Ast::ContinuationImplItem & | continuation | ) | [inline] |
Leave continuation scope.
continuation | The continuation implementation item |
Ast::ChildTypeSpec& leaveCurrentType | ( | Ast::ChildTypeSpec & | type | ) | [inline] |
Exit a type definition.
Pops the type from the type stack
type | The type being defined |
Ast::FunctionDef& leaveFunction | ( | Ast::FunctionDef & | fdef | ) | [inline] |
Enter function definition.
fdef | Function modifier |
Ast::FunctionImplItem& leaveFunctionDef | ( | Ast::FunctionDef & | fdef, |
const Ast::FunctionBlock & | block | ||
) | [inline] |
Leave function implementation definition.
fdef | The function definition |
block | The function block |
Ast::FunctionImplItem& leaveFunctionImpl | ( | Ast::FunctionDef & | fdef, |
Ast::FunctionBlock & | block | ||
) | [inline] |
Leave function implementation definition.
fdef | The function definition |
block | The function block |
ImplT& leaveFunctionT | ( | Ast::FunctionDef & | fdef, |
const BlockT & | block | ||
) | [inline, private] |
Create function implementation item.
fdef | The function definition |
block | The function block |
Ast::GrammarImplItem& leaveGrammarDef | ( | Ast::FunctionDef & | fdef, |
const Ast::GrammarBlock & | block | ||
) | [inline] |
Leave grammar implementation definition.
fdef | The grammar definition |
block | The grammar block |
Ast::GrammarRuleStatement& leaveGrammarRule | ( | Ast::FunctionDef & | fdef, |
const Ast::GrammarMemberList & | list | ||
) | [inline] |
Leave grammar rule block without statement list.
Statement block defaults to a single "return true;" statement.
fdef | The function def for the grammar rule block |
list | The grammar member list |
Ast::GrammarRuleStatement& leaveGrammarRuleBlock | ( | Ast::FunctionDef & | fdef, |
const Ast::GrammarMemberList & | list, | ||
const Ast::StatementList & | stmtList | ||
) | [inline] |
Leave grammar rule block.
fdef | The function def for the grammar rule block |
list | The grammar member list |
stmtList | The list of statements in the block |
Ast::LexerStatement& leaveLexer | ( | Ast::FunctionDef & | fdef, |
const Ast::GrammarTokenList & | list | ||
) | [inline] |
Leave lexer without a statement list.
fdef | The function def for the lexer block |
list | The token list |
Ast::LexerStatement& leaveLexer | ( | Ast::FunctionDef & | fdef, |
const Ast::GrammarTokenList & | list, | ||
const Ast::StatementList & | stmtList | ||
) | [inline] |
Leave lexer.
fdef | The function def for the lexer block |
list | The token list |
stmtList | The statement list |
Ast::GrammarLexer& leaveLexerState | ( | Ast::GrammarLexer & | lexer, |
Ast::LexerStatementList & | list | ||
) | [inline] |
Leave lexer state.
lexer | The elxer to exit |
list | The list of statements in the lexer action |
Ast::RoutineImplItem& leaveRoutineDef | ( | Ast::FunctionDef & | fdef, |
const Ast::RoutineBlock & | block | ||
) | [inline] |
Leave routine implementation definition.
fdef | The routine definition |
block | The routine block |
void leaveScope | ( | const Ast::Scope::Type & | type | ) | [inline, private] |
Leave scope.
type | Scope type |
Ast::StatementList& leaveStatementList | ( | Ast::StatementList & | list | ) | [inline] |
Leave statement list scope.
list | Statement list |
Ast::StructDef& leaveStructDef | ( | Ast::StructDef & | structDef | ) | [inline] |
Leave struct definition.
structDef | The struct definition |
Ast::StructDef& leaveStructDefList | ( | Ast::StructDef & | structDef, |
const Ast::VariableDefMap & | defList, | ||
const Ast::StructDefList & | subTypeList | ||
) | [inline] |
Leave struct definition with list of variable and subtype definitions.
structDef | The struct definition |
defList | The member variable definition list |
subTypeList | The sub-type definition list |
T& leaveTypeSpec | ( | T & | t | ) | [inline, private] |
Leave type definition.
t | The type |
Ast::TypeSpec& leaveTypeSpecRef | ( | Ast::TypeSpec & | typeSpec | ) | [inline] |
Leave type reference.
typeSpec | The type reference to leave |
void leaveUnitNamespace | ( | Ast::Namespace & | ns | ) | [inline] |
Leave current namespace.
ns | The namespace type to exit |
Ast::WindowImplItem& leaveWindowDef | ( | Ast::FunctionDef & | fdef, |
const Ast::WindowBlock & | block | ||
) | [inline] |
Leave window implementation definition.
fdef | The window definition |
block | The window block |
void setProjectDef | ( | const Ast::StructInitExpr & | expr | ) | [inline] |
When parsing a project file, set the root expression.
expr | Project initialization expression |
void setTokenPos | ( | const int & | line, |
const int & | col | ||
) | [inline] |
Set the current token position.
line | The line number |
col | The column number |