#include <ASTFactory.hpp>
Public Types | |
typedef factory_type_ | factory_type |
typedef factory_descriptor_ | factory_descriptor |
typedef factory_descriptor_list_ | factory_descriptor_list |
Public Member Functions | |
ASTFactory () | |
Make new factory. Per default (Ref)CommonAST instances are generated. | |
ASTFactory (const char *factory_node_name, factory_type factory) | |
virtual | ~ASTFactory () |
Destroy factory. | |
void | registerFactory (int type, const char *ast_name, factory_type factory) |
Register a node factory for the node type type with name ast_name. | |
void | setMaxNodeType (int type) |
Set the maximum node (AST) type this factory may encounter. | |
void | addASTChild (ASTPair ¤tAST, RefAST child) |
Add a child to the current AST. | |
virtual RefAST | create () |
Create new empty AST node. The right default type shou. | |
RefAST | create (int type) |
Create AST node of the right type for 'type'. | |
RefAST | create (int type, const ANTLR_USE_NAMESPACE(std) string &txt) |
Create AST node of the right type for 'type' and initialize with txt. | |
RefAST | create (RefAST tr) |
Create duplicate of tr. | |
RefAST | create (RefToken tok) |
Create new AST node and initialize contents from a token. | |
RefAST | create (const ANTLR_USE_NAMESPACE(std) string &txt, ANTLR_USE_NAMESPACE(std) istream &infile) |
Create new AST node and initialize contents from a stream. | |
RefAST | dup (RefAST t) |
RefAST | dupList (RefAST t) |
Duplicate tree including siblings of root. | |
RefAST | dupTree (RefAST t) |
RefAST | make (ANTLR_USE_NAMESPACE(std) vector< RefAST > &nodes) |
RefAST | make (ASTArray *nodes) |
void | makeASTRoot (ASTPair ¤tAST, RefAST root) |
Make an AST the root of current AST. | |
void | setASTNodeFactory (const char *factory_node_name, factory_type factory) |
Protected Member Functions | |
void | loadChildren (ANTLR_USE_NAMESPACE(std) istream &infile, RefAST current) |
void | loadSiblings (ANTLR_USE_NAMESPACE(std) istream &infile, RefAST current) |
bool | checkCloseTag (ANTLR_USE_NAMESPACE(std) istream &infile) |
RefAST | getNodeOfType (unsigned int type) |
const char * | getASTNodeType (unsigned int type) |
get the name of the node 'type' | |
factory_type | getASTNodeFactory (unsigned int type) |
Protected Attributes | |
factory_descriptor | default_factory_descriptor |
factory_descriptor_list | nodeFactories |
Private Member Functions | |
ASTFactory (const ASTFactory &) | |
ASTFactory & | operator= (const ASTFactory &) |
Definition at line 36 of file ASTFactory.hpp.
Definition at line 38 of file ASTFactory.hpp.
Definition at line 39 of file ASTFactory.hpp.
typedef factory_descriptor_list_ ASTFactory::factory_descriptor_list |
Definition at line 40 of file ASTFactory.hpp.
ASTFactory::ASTFactory | ( | ) |
Make new factory. Per default (Ref)CommonAST instances are generated.
ASTFactory::ASTFactory | ( | const char * | factory_node_name, | |
factory_type | factory | |||
) |
Initialize factory with a non default node type. factory_node_name should be the name of the AST node type the factory generates. (should exist during the existance of this ASTFactory instance)
virtual ASTFactory::~ASTFactory | ( | ) | [virtual] |
Destroy factory.
ASTFactory::ASTFactory | ( | const ASTFactory & | ) | [private] |
void ASTFactory::registerFactory | ( | int | type, | |
const char * | ast_name, | |||
factory_type | factory | |||
) |
Register a node factory for the node type type with name ast_name.
void ASTFactory::setMaxNodeType | ( | int | type | ) |
Set the maximum node (AST) type this factory may encounter.
virtual RefAST ASTFactory::create | ( | ) | [virtual] |
Create new empty AST node. The right default type shou.
RefAST ASTFactory::create | ( | int | type, | |
const ANTLR_USE_NAMESPACE(std) string & | txt | |||
) |
Create AST node of the right type for 'type' and initialize with txt.
Create new AST node and initialize contents from a token.
RefAST ASTFactory::create | ( | const ANTLR_USE_NAMESPACE(std) string & | txt, | |
ANTLR_USE_NAMESPACE(std) istream & | infile | |||
) |
Create new AST node and initialize contents from a stream.
Deep copy a single node. This function the new clone() methods in the AST interface. Returns a new RefAST(nullASTptr) if t is null.
Duplicate a tree, assuming this is a root node of a tree-- duplicate that node and what's below; ignore siblings of root node.
void ASTFactory::setASTNodeFactory | ( | const char * | factory_node_name, | |
factory_type | factory | |||
) |
Set a new default AST type. factory_node_name should be the name of the AST node type the factory generates. (should exist during the existance of this ASTFactory instance). Only change factory between parser runs. You might get unexpected results otherwise.
void ASTFactory::loadChildren | ( | ANTLR_USE_NAMESPACE(std) istream & | infile, | |
RefAST | current | |||
) | [protected] |
void ASTFactory::loadSiblings | ( | ANTLR_USE_NAMESPACE(std) istream & | infile, | |
RefAST | current | |||
) | [protected] |
bool ASTFactory::checkCloseTag | ( | ANTLR_USE_NAMESPACE(std) istream & | infile | ) | [protected] |
RefAST ASTFactory::getNodeOfType | ( | unsigned int | type | ) | [inline, protected] |
Definition at line 140 of file ASTFactory.hpp.
const char* ASTFactory::getASTNodeType | ( | unsigned int | type | ) | [inline, protected] |
factory_type ASTFactory::getASTNodeFactory | ( | unsigned int | type | ) | [inline, protected] |
Definition at line 149 of file ASTFactory.hpp.
ASTFactory& ASTFactory::operator= | ( | const ASTFactory & | ) | [private] |
Definition at line 44 of file ASTFactory.hpp.
factory_descriptor_list ASTFactory::nodeFactories [protected] |
Definition at line 45 of file ASTFactory.hpp.