tan
0.0.1
|
Public Member Functions | |
ASTBase (ASTNodeType node_type, TokenizedSourceFile *src, int bp) | |
ASTNodeType | get_node_type () const |
void | set_node_type (ASTNodeType node_type) |
int | get_bp () const |
Context * | ctx () |
virtual vector< ASTBase * > | get_children () const |
Get a ordered list of child nodes. More... | |
str | repr (const str &prefix="-") const |
AST tree string representation. More... | |
virtual bool | is_stmt () const =0 |
virtual bool | is_expr () const =0 |
virtual str | terminal_token () const |
Which terminal token is expected immediately after this node. More... | |
Public Member Functions inherited from tanlang::SourceTraceable | |
SourceTraceable (TokenizedSourceFile *src) | |
uint32_t | start () const |
uint32_t | end () const |
void | set_start (uint32_t val) |
void | set_end (uint32_t val) |
TokenizedSourceFile * | src () const |
Static Public Attributes | |
static umap< ASTNodeType, str > | ASTTypeNames |
string representation of ASTNodeType More... | |
static umap< ASTNodeType, int > | OpPrecedence |
operator precedence of tokens More... | |
Protected Member Functions | |
virtual str | to_string (bool include_source_code=false) const |
Different from repr, to_string output doesn't include child nodes. More... | |
virtual ASTBase * | get () const |
Get the "actual" this. Used for implementing proxy classes. More... | |
Definition at line 13 of file ast_base.h.
|
protectedvirtual |
Get the "actual" this. Used for implementing proxy classes.
Reimplemented in tanlang::BinaryOrUnary.
Definition at line 49 of file ast_base.cpp.
|
virtual |
Get a ordered list of child nodes.
Reimplemented in tanlang::If, tanlang::Loop, tanlang::Return, tanlang::CompoundStmt, tanlang::Stmt, tanlang::Package, tanlang::Intrinsic, tanlang::Cast, tanlang::Assignment, tanlang::FunctionCall, tanlang::Parenthesis, tanlang::BinaryOrUnary, tanlang::UnaryOperator, tanlang::BinaryOperator, tanlang::Expr, tanlang::StructDecl, tanlang::FunctionDecl, and tanlang::Decl.
Definition at line 51 of file ast_base.cpp.
Referenced by tanlang::Intrinsic::get_children(), and repr().
str ASTBase::repr | ( | const str & | prefix = "-" | ) | const |
AST tree string representation.
Definition at line 23 of file ast_base.cpp.
References get_children(), and to_string().
|
inlinevirtual |
Which terminal token is expected immediately after this node.
Reimplemented in tanlang::If, tanlang::Loop, tanlang::CompoundStmt, tanlang::Intrinsic, tanlang::StructDecl, and tanlang::FunctionDecl.
Definition at line 45 of file ast_base.h.
|
protectedvirtual |
Different from repr, to_string output doesn't include child nodes.
Reimplemented in tanlang::CompoundStmt.
Definition at line 38 of file ast_base.cpp.
References ASTTypeNames.
Referenced by repr(), and tanlang::CompoundStmt::to_string().
|
static |
string representation of ASTNodeType
Definition at line 16 of file ast_base.h.
Referenced by to_string().
|
static |
operator precedence of tokens
Definition at line 19 of file ast_base.h.