OpenMD 3.0
Molecular Dynamics in the Open
Loading...
Searching...
No Matches
antlr::TreeParser Class Referenceabstract

Classes

class  Tracer
 Utility class which allows tracing to work even when exceptions are thrown. More...
 

Public Member Functions

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

Static Public Attributes

static RefAST ASTNULL
 The AST Null object; the parsing cursor is set to this when it is found to be null.
 

Protected Member Functions

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

Protected Attributes

ASTFactoryastFactory
 AST support code; parser and treeparser delegate to this object.
 
TreeParserSharedInputState inputState
 The input state of this tree parser.
 
int traceDepth
 Used to keep track of indent depth with -traceTreeParser.
 

Detailed Description

Definition at line 23 of file TreeParser.hpp.

Constructor & Destructor Documentation

◆ TreeParser() [1/2]

antlr::TreeParser::TreeParser ( )
inline

Definition at line 25 of file TreeParser.hpp.

◆ TreeParser() [2/2]

antlr::TreeParser::TreeParser ( const TreeParserSharedInputState & state)
inline

Definition at line 32 of file TreeParser.hpp.

◆ ~TreeParser()

virtual antlr::TreeParser::~TreeParser ( )
inlinevirtual

Definition at line 39 of file TreeParser.hpp.

Member Function Documentation

◆ getASTFactory()

virtual ASTFactory * antlr::TreeParser::getASTFactory ( ) const
inlinevirtual

Return pointer to ASTFactory.

Definition at line 68 of file TreeParser.hpp.

◆ match() [1/2]

virtual void antlr::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.

Definition at line 50 of file TreeParser.hpp.

References antlr::AST::getType().

◆ match() [2/2]

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

Definition at line 99 of file TreeParser.hpp.

◆ matchNot()

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

Definition at line 106 of file TreeParser.hpp.

◆ reportError() [1/2]

void antlr::TreeParser::reportError ( const RecognitionException & ex)
virtual

Parser error-reporting function can be overridden in subclass.

Definition at line 23 of file TreeParser.cpp.

◆ reportError() [2/2]

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

Parser error-reporting function can be overridden in subclass.

Definition at line 29 of file TreeParser.cpp.

◆ reportWarning()

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

Parser warning-reporting function can be overridden in subclass.

Definition at line 35 of file TreeParser.cpp.

◆ setASTFactory()

virtual void antlr::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()

Definition at line 63 of file TreeParser.hpp.

◆ traceIn()

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

Definition at line 47 of file TreeParser.cpp.

◆ traceIndent()

void antlr::TreeParser::traceIndent ( )
virtual

These are used during when traceTreeParser commandline option is passed.

Procedure to write out an indent for traceIn and traceOut.

Definition at line 41 of file TreeParser.cpp.

References traceDepth.

◆ traceOut()

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

Definition at line 58 of file TreeParser.cpp.

Member Data Documentation

◆ astFactory

ASTFactory* antlr::TreeParser::astFactory
protected

AST support code; parser and treeparser delegate to this object.

Definition at line 114 of file TreeParser.hpp.

◆ ASTNULL

RefAST antlr::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.

This way, we can test the token type of a node without having to have tests for null everywhere.

Definition at line 96 of file TreeParser.hpp.

◆ inputState

TreeParserSharedInputState antlr::TreeParser::inputState
protected

The input state of this tree parser.

Definition at line 117 of file TreeParser.hpp.

◆ traceDepth

int antlr::TreeParser::traceDepth
protected

Used to keep track of indent depth with -traceTreeParser.

Definition at line 120 of file TreeParser.hpp.

Referenced by traceIndent().


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