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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) SimpleCharStreamNext 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
ConstructorsConstructorDescriptionJavaCCParser(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 JCompilationUnitfinal voidDisable tracing.final voidEnable tracing.booleanReturnstrueif a parser error has occurred up to now, andfalseotherwise.voidSets the name of the file being parsed.Generate ParseException.final TokenGet the next Token.final TokengetToken(int index) Get the specific Token.voidReInit(InputStream stream) Reinitialise.voidReInit(InputStream stream, String encoding) Reinitialise.voidReinitialise.voidReinitialise.final booleanTrace 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()Returnstrueif a parser error has occurred up to now, andfalseotherwise.- Returns:
trueif a parser error has occurred up to now, andfalseotherwise.
-
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.
-