javacc-7.0.1.test.cpp.gen.Parser.h Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javacc Show documentation
Show all versions of javacc Show documentation
JavaCC is a parser/scanner generator for Java.
#pragma once
#include "JavaCC.h"
#include "CharStream.h"
#include "Token.h"
#include "TokenManager.h"
#include "ASTdcl.h"
#include "ParserConstants.h"
#include "ErrorHandler.h"
namespace SPL {
struct JJCalls {
int gen;
int arg;
JJCalls* next;
Token* first;
JJCalls() { next = nullptr; arg = 0; gen = -1; first = nullptr; }
~JJCalls() { if (next) delete next; }
};
class Parser {
public:
template
AST::CompilationUnit* CompilationUnit();
public:
void setErrorHandler(ErrorHandler *eh) {
if (errorHandler) delete errorHandler;
errorHandler = eh;
}
TokenManager *token_source = nullptr;
CharStream *jj_input_stream = nullptr;
/** Current token. */
Token *token = nullptr;
/** Next token. */
Token *jj_nt = nullptr;
private:
int jj_ntk;
JJCalls jj_2_rtns[1];
bool jj_rescan;
int jj_gc;
Token *jj_scanpos, *jj_lastpos;
int jj_la;
/** Whether we are looking ahead. */
bool jj_lookingAhead;
bool jj_semLA;
int jj_gen;
int jj_la1[1];
ErrorHandler *errorHandler = nullptr;
protected:
bool hasError;
Token *head;
public:
Parser(TokenManager *tokenManager);
virtual ~Parser();
void ReInit(TokenManager* tokenManager);
void clear();
Token * jj_consume_token(int kind);
Token * getNextToken();
Token * getToken(int index);
int jj_ntk_f();
private:
int jj_kind;
int **jj_expentries;
int *jj_expentry;
protected:
/** Generate ParseException. */
virtual void parseError();
private:
int indent; // trace indentation
bool trace = false; // trace enabled if true
public:
bool trace_enabled();
void enable_tracing();
void disable_tracing();
private:
bool jj_done;
};
}