8#include "antlr/Parser.hpp"
12#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
50bool DEBUG_PARSER =
false;
55 ANTLR_USE_NAMESPACE(std)cerr << ex.
toString().c_str() << ANTLR_USE_NAMESPACE(std)endl;
62 ANTLR_USE_NAMESPACE(std)cerr <<
"error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl;
64 ANTLR_USE_NAMESPACE(std)cerr <<
getFilename().c_str() <<
": error: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl;
71 ANTLR_USE_NAMESPACE(std)cerr <<
"warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl;
73 ANTLR_USE_NAMESPACE(std)cerr <<
getFilename().c_str() <<
": warning: " << s.c_str() << ANTLR_USE_NAMESPACE(std)endl;
81 for(
int i = 0; i < traceDepth; i++ )
82 ANTLR_USE_NAMESPACE(std)cout <<
" ";
85void Parser::traceIn(
const char* rname)
89 for(
int i = 0; i < traceDepth; i++ )
90 ANTLR_USE_NAMESPACE(std)cout <<
" ";
92 ANTLR_USE_NAMESPACE(std)cout <<
"> " << rname
93 <<
"; LA(1)==" <<
LT(1)->getText().c_str()
94 << ((inputState->
guessing>0)?
" [guessing]":
"")
95 << ANTLR_USE_NAMESPACE(std)endl;
98void Parser::traceOut(
const char* rname)
100 for(
int i = 0; i < traceDepth; i++ )
101 ANTLR_USE_NAMESPACE(std)cout <<
" ";
103 ANTLR_USE_NAMESPACE(std)cout <<
"< " << rname
104 <<
"; LA(1)==" <<
LT(1)->getText().c_str()
105 << ((inputState->
guessing>0)?
" [guessing]":
"")
106 << ANTLR_USE_NAMESPACE(std)endl;
111#ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
virtual void traceIndent()
Set or change the input token buffer.
virtual std::string getFilename() const
Return the filename of the input file.
virtual void reportWarning(const std ::string &s)
Parser warning-reporting function can be overridden in subclass.
virtual void reportError(const RecognitionException &ex)
Parser error-reporting function can be overridden in subclass.
virtual RefToken LT(unsigned int i)=0
Return the i-th token of lookahead.
virtual std::string toString() const
Return complete error message with line/column number info (if present)