1#ifndef INC_TreeParser_hpp__
2#define INC_TreeParser_hpp__
11#include <antlr/config.hpp>
12#include <antlr/AST.hpp>
13#include <antlr/ASTFactory.hpp>
14#include <antlr/BitSet.hpp>
15#include <antlr/RecognitionException.hpp>
16#include <antlr/MismatchedTokenException.hpp>
17#include <antlr/TreeParserSharedInputState.hpp>
19#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
52 if ( !t || t==ASTNULL || !b.member(t->
getType()) )
82 virtual void reportError(
const ANTLR_USE_NAMESPACE(std)
string& s);
84 virtual void reportWarning(
const ANTLR_USE_NAMESPACE(std)
string& s);
87 virtual void traceIndent();
88 virtual void traceIn(
const char* rname,
RefAST t);
89 virtual void traceOut(
const char* rname,
RefAST t);
99 virtual void match(
RefAST t,
int ttype)
101 if (!t || t == ASTNULL || t->
getType() != ttype )
106 virtual void matchNot(
RefAST t,
int ttype)
108 if ( !t || t == ASTNULL || t->
getType() == ttype )
132 : parser(p), text(t), tree(a)
134 parser->traceIn(text,tree);
138 parser->traceOut(text,tree);
151#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
AST Super Factory shared by TreeParser and Parser.
virtual int getType() const =0
Get the token type for this node.
A BitSet to replace java.util.BitSet.
Utility class which allows tracing to work even when exceptions are thrown.
int traceDepth
Used to keep track of indent depth with -traceTreeParser.
virtual RefAST getAST()=0
Get the AST return value squirreled away in the parser.
virtual const char *const * getTokenNames() const =0
Return an array of getNumTokens() token names.
virtual void setASTFactory(ASTFactory *factory)
Specify the AST factory to be used during tree building.
virtual int getNumTokens() const =0
Return the number of tokens defined.
virtual ASTFactory * getASTFactory() const
Return pointer to ASTFactory.
virtual const char * getTokenName(int num) const =0
Get the name for token 'num'.
TreeParserSharedInputState inputState
The input state of this tree parser.
virtual void match(RefAST t, const BitSet &b)
Make sure current lookahead symbol matches the given set Throw an exception upon mismatch,...
ASTFactory * astFactory
AST support code; parser and treeparser delegate to this object.
static RefAST ASTNULL
The AST Null object; the parsing cursor is set to this when it is found to be null.