8#include "antlr/TreeParser.hpp"
9#include "antlr/ASTNULLType.hpp"
11#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
25 ANTLR_USE_NAMESPACE(std)cerr << ex.
toString().c_str() << ANTLR_USE_NAMESPACE(std)endl;
31 ANTLR_USE_NAMESPACE(std)cerr <<
"error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl;
37 ANTLR_USE_NAMESPACE(std)cerr <<
"warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl;
44 ANTLR_USE_NAMESPACE(std)cout <<
" ";
47void TreeParser::traceIn(
const char* rname,
RefAST t)
52 ANTLR_USE_NAMESPACE(std)cout <<
"> " << rname
53 <<
"(" << (t ? t->
toString().c_str() :
"null") <<
")"
55 << ANTLR_USE_NAMESPACE(std)endl;
58void TreeParser::traceOut(
const char* rname, RefAST t)
62 ANTLR_USE_NAMESPACE(std)cout <<
"< " << rname
63 <<
"(" << (t ? t->toString().c_str() :
"null") <<
")"
65 << ANTLR_USE_NAMESPACE(std)endl;
70#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
virtual std::string toString() const =0
Return this AST node as a string.
virtual std::string toString() const
Return complete error message with line/column number info (if present)
int traceDepth
Used to keep track of indent depth with -traceTreeParser.
virtual void reportError(const RecognitionException &ex)
Parser error-reporting function can be overridden in subclass.
virtual void traceIndent()
These are used during when traceTreeParser commandline option is passed.
virtual void reportWarning(const std ::string &s)
Parser warning-reporting function can be overridden in subclass.
TreeParserSharedInputState inputState
The input state of this tree parser.
static RefAST ASTNULL
The AST Null object; the parsing cursor is set to this when it is found to be null.