ANTLR Support Libraries 2.7.1+
Classes | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
TreeParser Class Referenceabstract

#include <TreeParser.hpp>

Collaboration diagram for TreeParser:
Collaboration graph
[legend]

Classes

class  Tracer
 

Public Member Functions

 TreeParser ()
 
 TreeParser (const TreeParserSharedInputState &state)
 
virtual ~TreeParser ()
 
virtual RefAST getAST ()=0
 Get the AST return value squirreled away in the parser. More...
 
virtual void match (RefAST t, const BitSet &b)
 
virtual void setASTFactory (ASTFactory *factory)
 
virtual ASTFactorygetASTFactory () const
 Return pointer to ASTFactory. More...
 
virtual const char * getTokenName (int num) const =0
 Get the name for token 'num'. More...
 
virtual int getNumTokens () const =0
 Return the number of tokens defined. More...
 
virtual const char *const * getTokenNames () const =0
 Return an array of getNumTokens() token names. More...
 
virtual void reportError (const RecognitionException &ex)
 Parser error-reporting function can be overridden in subclass. More...
 
virtual void reportError (const std ::string &s)
 Parser error-reporting function can be overridden in subclass. More...
 
virtual void reportWarning (const std ::string &s)
 Parser warning-reporting function can be overridden in subclass. More...
 
virtual void traceIndent ()
 These are used during when traceTreeParser commandline option is passed. More...
 
virtual void traceIn (const char *rname, RefAST t)
 
virtual void traceOut (const char *rname, RefAST t)
 

Static Public Attributes

static RefAST ASTNULL
 

Protected Member Functions

virtual void match (RefAST t, int ttype)
 
virtual void matchNot (RefAST t, int ttype)
 

Protected Attributes

ASTFactoryastFactory
 
TreeParserSharedInputState inputState
 The input state of this tree parser. More...
 
int traceDepth
 

Private Member Functions

 TreeParser (const TreeParser &other)
 
TreeParseroperator= (const TreeParser &other)
 

Constructor & Destructor Documentation

◆ TreeParser() [1/3]

TreeParser::TreeParser ( )
inline

◆ TreeParser() [2/3]

TreeParser::TreeParser ( const TreeParserSharedInputState state)
inline

◆ ~TreeParser()

virtual TreeParser::~TreeParser ( )
inlinevirtual

◆ TreeParser() [3/3]

TreeParser::TreeParser ( const TreeParser other)
private

Member Function Documentation

◆ getAST()

virtual RefAST TreeParser::getAST ( )
pure virtual

Get the AST return value squirreled away in the parser.

◆ getASTFactory()

virtual ASTFactory* TreeParser::getASTFactory ( ) const
inlinevirtual

Return pointer to ASTFactory.

◆ getNumTokens()

virtual int TreeParser::getNumTokens ( ) const
pure virtual

Return the number of tokens defined.

◆ getTokenName()

virtual const char* TreeParser::getTokenName ( int  num) const
pure virtual

Get the name for token 'num'.

◆ getTokenNames()

virtual const char* const* TreeParser::getTokenNames ( ) const
pure virtual

Return an array of getNumTokens() token names.

◆ match() [1/2]

virtual void TreeParser::match ( RefAST  t,
const BitSet b 
)
inlinevirtual

Make sure current lookahead symbol matches the given set Throw an exception upon mismatch, which is caught by either the error handler or by a syntactic predicate.

◆ match() [2/2]

virtual void TreeParser::match ( RefAST  t,
int  ttype 
)
inlineprotectedvirtual

◆ matchNot()

virtual void TreeParser::matchNot ( RefAST  t,
int  ttype 
)
inlineprotectedvirtual

◆ operator=()

TreeParser& TreeParser::operator= ( const TreeParser other)
private

◆ reportError() [1/2]

void TreeParser::reportError ( const RecognitionException ex)
virtual

Parser error-reporting function can be overridden in subclass.

Parser error-reporting function can be overridden in subclass

◆ reportError() [2/2]

void TreeParser::reportError ( const std ::string &  s)
virtual

Parser error-reporting function can be overridden in subclass.

Parser error-reporting function can be overridden in subclass

◆ reportWarning()

void TreeParser::reportWarning ( const std ::string &  s)
virtual

Parser warning-reporting function can be overridden in subclass.

Parser warning-reporting function can be overridden in subclass

◆ setASTFactory()

virtual void TreeParser::setASTFactory ( ASTFactory factory)
inlinevirtual

Specify the AST factory to be used during tree building. (Compulsory) Setting the factory is compulsory (if you intend to modify the tree in the treeparser). The AST Factory is shared between parser (who builds the initial AST) and treeparser.

See also
Parser::getASTFactory()

◆ traceIn()

void TreeParser::traceIn ( const char *  rname,
RefAST  t 
)
virtual

◆ traceIndent()

void TreeParser::traceIndent ( )
virtual

These are used during when traceTreeParser commandline option is passed.

Procedure to write out an indent for traceIn and traceOut

◆ traceOut()

void TreeParser::traceOut ( const char *  rname,
RefAST  t 
)
virtual

Member Data Documentation

◆ astFactory

ASTFactory* TreeParser::astFactory
protected

AST support code; parser and treeparser delegate to this object

◆ ASTNULL

RefAST TreeParser::ASTNULL
static

The AST Null object; the parsing cursor is set to this when it is found to be null. This way, we can test the token type of a node without having to have tests for 0 everywhere.

The AST Null object; the parsing cursor is set to this when it is found to be null. This way, we can test the token type of a node without having to have tests for null everywhere.

◆ inputState

TreeParserSharedInputState TreeParser::inputState
protected

The input state of this tree parser.

◆ traceDepth

int TreeParser::traceDepth
protected

Used to keep track of indent depth with -traceTreeParser


The documentation for this class was generated from the following files: