public class Parser extends java.lang.Object implements ParserConstants
Modifier and Type | Field and Description |
---|---|
Token |
jj_nt
Next token.
|
Token |
token
Current token.
|
ParserTokenManager |
token_source
Generated Token Manager.
|
AND, ASSIGN, BREAK, CLASS, COMMA, DECR, DEFAULT, DIGIT, DIVIDE, DOT, ELSE, EOF, EQ, EXTENDS, FALSE, FOR, GE, GT, IDENTIFIER, IF, INCR, INSTANCEOF, INTCONST, LBRACE, LE, LETTER, LPAREN, LSQBRACE, LT, MINUS, MODULUS, MULTI_LINE_COMMENT, NE, NEW, NOT, OR, PLUS, RBRACE, RETURN, RPAREN, RSQBRACE, SEMICOLON, SINGLE_LINE_COMMENT, STRINGCONST, TIMES, tokenImage, TRUE, WHILE
Constructor and Description |
---|
Parser(java.io.InputStream stream)
Constructor with InputStream.
|
Parser(java.io.InputStream stream,
java.lang.String encoding)
Constructor with InputStream and supplied encoding
|
Parser(ParserTokenManager tm)
Constructor with generated Token Manager.
|
Parser(java.io.Reader stream)
Constructor.
|
Parser(java.lang.String[] filenames,
boolean debug)
Parser constructor
|
public ParserTokenManager token_source
public Token token
public Token jj_nt
public Parser(java.lang.String[] filenames, boolean debug)
filenames
- array of filenames for the source filesdebug
- flag indicating whether debugging is enabledpublic Parser(java.io.InputStream stream)
public Parser(java.io.InputStream stream, java.lang.String encoding)
public Parser(java.io.Reader stream)
public Parser(ParserTokenManager tm)
public Program parse()
public final Program Goal() throws ParseException
ParseException
public final Class_ ParseClass() throws ParseException
ParseException
public final Member ParseMember() throws ParseException
ParseException
public final Member ParseMemberAux(java.lang.String type, java.lang.String name, int line) throws ParseException
ParseException
public final Field ParseField(java.lang.String type, java.lang.String name, int line) throws ParseException
ParseException
public final Method ParseMethod(java.lang.String returnType, java.lang.String name, int line) throws ParseException
ParseException
public final Formal ParseFormal() throws ParseException
ParseException
public final Stmt ParseStmt() throws ParseException
ParseException
public final BlockStmt ParseBlockStmt() throws ParseException
ParseException
public final DeclStmt ParseDeclStmt() throws ParseException
ParseException
public final WhileStmt ParseWhileStmt() throws ParseException
ParseException
public final ForStmt ParseForStmt() throws ParseException
ParseException
public final BreakStmt ParseBreakStmt() throws ParseException
ParseException
public final IfStmt ParseIfStmt() throws ParseException
ParseException
public final ExprStmt ParseExprStmt() throws ParseException
ParseException
public final ReturnStmt ParseReturnStmt() throws ParseException
ParseException
public final Expr ParseExpr() throws ParseException
ParseException
public final Expr ParseExpr1() throws ParseException
ParseException
public final Expr ParseExpr2() throws ParseException
ParseException
public final Expr ParseExpr3() throws ParseException
ParseException
public final Expr ParseExpr4() throws ParseException
ParseException
public final Expr ParseExpr5() throws ParseException
ParseException
public final Expr ParseExpr6() throws ParseException
ParseException
public final Expr ParseExpr7() throws ParseException
ParseException
public final Expr ParseExpr8() throws ParseException
ParseException
public final Expr ParseExpr9() throws ParseException
ParseException
public final Expr ParseExpr10() throws ParseException
ParseException
public final Expr Parse11Expr() throws ParseException
ParseException
public final Expr ParseExpr11() throws ParseException
ParseException
public final Expr ParseNewExpr() throws ParseException
ParseException
public final Expr ParseNewExprAux(java.lang.String id, int line) throws ParseException
ParseException
public final Expr ParseVarExpr() throws ParseException
ParseException
public final ConstBooleanExpr ParseConstBooleanExpr() throws ParseException
ParseException
public final ConstIntExpr ParseConstIntExpr() throws ParseException
ParseException
public final ConstStringExpr ParseConstStringExpr() throws ParseException
ParseException
public final java.lang.String ParseIdentifier() throws ParseException
ParseException
public final java.lang.String ParseType() throws ParseException
ParseException
public final ExprList ParseExprList() throws ParseException
ParseException
public void ReInit(java.io.InputStream stream)
public void ReInit(java.io.InputStream stream, java.lang.String encoding)
public void ReInit(java.io.Reader stream)
public void ReInit(ParserTokenManager tm)
public final Token getNextToken()
public final Token getToken(int index)
public ParseException generateParseException()
public final void enable_tracing()
public final void disable_tracing()