Package jminusminus
Class JavaCCParser
java.lang.Object
jminusminus.JavaCCParser
- All Implemented Interfaces:
JavaCCParserConstants
Parser generated by JavaCC. It parses a j-- compilation unit (program file), taking tokens from
the scanner (also generated by JavaCC), and produces an abstract syntax tree (AST) for it.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescription(package private) SimpleCharStream
Next token.Current token.Generated Token Manager.Fields inherited from interface jminusminus.JavaCCParserConstants
ABSTRACT, ASSIGN, BEGIN_COMMENT, BOOLEAN, CHAR, CHAR_LITERAL, CLASS, COMMA, COMMENT, DEC, DEFAULT, DIGIT, DOT, ELSE, END_COMMENT, EOF, EQUAL, ERROR, ESC, EXTENDS, FALSE, GT, IDENTIFIER, IF, IMPORT, IN_SINGLE_LINE_COMMENT, INC, INSTANCEOF, INT, INT_LITERAL, LAND, LBRACK, LCURLY, LE, LETTER, LNOT, LPAREN, MINUS, NEW, NULL, PACKAGE, PLUS, PLUS_ASSIGN, PRIVATE, PROTECTED, PUBLIC, RBRACK, RCURLY, RETURN, RPAREN, SEMI, STAR, STATIC, STRING_LITERAL, SUPER, THIS, tokenImage, TRUE, VOID, WHILE
-
Constructor Summary
ConstructorDescriptionJavaCCParser
(InputStream stream) Constructor with InputStream.JavaCCParser
(InputStream stream, String encoding) Constructor with InputStream and supplied encodingJavaCCParser
(Reader stream) Constructor.Constructor with generated Token Manager. -
Method Summary
Modifier and TypeMethodDescriptionfinal JCompilationUnit
final void
Disable tracing.final void
Enable tracing.boolean
Returnstrue
if a parser error has occurred up to now, andfalse
otherwise.void
Sets the name of the file being parsed.Generate ParseException.final Token
Get the next Token.final Token
getToken
(int index) Get the specific Token.void
ReInit
(InputStream stream) Reinitialise.void
ReInit
(InputStream stream, String encoding) Reinitialise.void
Reinitialise.void
Reinitialise.final boolean
Trace enabled.
-
Field Details
-
token_source
Generated Token Manager. -
jj_input_stream
SimpleCharStream jj_input_stream -
token
Current token. -
jj_nt
Next token.
-
-
Constructor Details
-
JavaCCParser
Constructor with InputStream. -
JavaCCParser
Constructor with InputStream and supplied encoding -
JavaCCParser
Constructor. -
JavaCCParser
Constructor with generated Token Manager.
-
-
Method Details
-
fileName
Sets the name of the file being parsed.- Parameters:
fileName
- name of the file being parsed.
-
errorHasOccurred
public boolean errorHasOccurred()Returnstrue
if a parser error has occurred up to now, andfalse
otherwise.- Returns:
true
if a parser error has occurred up to now, andfalse
otherwise.
-
compilationUnit
- Throws:
ParseException
-
ReInit
Reinitialise. -
ReInit
Reinitialise. -
ReInit
Reinitialise. -
ReInit
Reinitialise. -
getNextToken
Get the next Token. -
getToken
Get the specific Token. -
generateParseException
Generate ParseException. -
trace_enabled
public final boolean trace_enabled()Trace enabled. -
enable_tracing
public final void enable_tracing()Enable tracing. -
disable_tracing
public final void disable_tracing()Disable tracing.
-