private Declarator parseFormalType(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(); if (isBuiltinType(t) || t == VOID) { lex.get(); // primitive type int dim = parseArrayDimension(); return new Declarator(t, dim); } else { ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return new Declarator(name, dim); } }
private ASTree parseInstanceOf(SymbolTable tbl, ASTree expr) throws CompileError { int t = lex.lookAhead(); if (isBuiltinType(t)) { lex.get(); // primitive type int dim = parseArrayDimension(); return new InstanceOfExpr(t, dim, expr); } else { ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return new InstanceOfExpr(name, dim, expr); } }
private ASTree parseInstanceOf(SymbolTable tbl, ASTree expr) throws CompileError { int t = lex.lookAhead(); if (isBuiltinType(t)) { lex.get(); // primitive type int dim = parseArrayDimension(); return new InstanceOfExpr(t, dim, expr); } ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return new InstanceOfExpr(name, dim, expr); }
private Declarator parseFormalType(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(); if (isBuiltinType(t) || t == VOID) { lex.get(); // primitive type int dim = parseArrayDimension(); return new Declarator(t, dim); } ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return new Declarator(name, dim); }
private NewExpr parseNew(SymbolTable tbl) throws CompileError { ArrayInit init = null; int t = lex.lookAhead(); if (isBuiltinType(t)) { lex.get(); ASTList size = parseArraySize(tbl); if (lex.lookAhead() == '{') init = parseArrayInitializer(tbl); return new NewExpr(t, size, init); } else if (t == Identifier) { ASTList name = parseClassType(tbl); t = lex.lookAhead(); if (t == '(') { ASTList args = parseArgumentList(tbl); return new NewExpr(name, args); } else if (t == '[') { ASTList size = parseArraySize(tbl); if (lex.lookAhead() == '{') init = parseArrayInitializer(tbl); return NewExpr.makeObjectArray(name, size, init); } } throw new SyntaxError(lex); }
private ASTree parseCast(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(1); if (isBuiltinType(t) && nextIsBuiltinCast()) { lex.get(); // '(' lex.get(); // primitive type int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(t, dim, parseUnaryExpr(tbl)); } else if (t == Identifier && nextIsClassCast()) { lex.get(); // '(' ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(name, dim, parseUnaryExpr(tbl)); } else return parsePostfix(tbl); }
if (i >= 0) if (lex.lookAhead(i) == Identifier) { ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return parseDeclarators(tbl, new Declarator(name, dim));
private NewExpr parseNew(SymbolTable tbl) throws CompileError { ArrayInit init = null; int t = lex.lookAhead(); if (isBuiltinType(t)) { lex.get(); ASTList size = parseArraySize(tbl); if (lex.lookAhead() == '{') init = parseArrayInitializer(tbl); return new NewExpr(t, size, init); } else if (t == Identifier) { ASTList name = parseClassType(tbl); t = lex.lookAhead(); if (t == '(') { ASTList args = parseArgumentList(tbl); return new NewExpr(name, args); } else if (t == '[') { ASTList size = parseArraySize(tbl); if (lex.lookAhead() == '{') init = parseArrayInitializer(tbl); return NewExpr.makeObjectArray(name, size, init); } } throw new SyntaxError(lex); }
lex.get(); while (true) { throwsList = ASTList.append(throwsList, parseClassType(tbl)); if (lex.lookAhead() == ',') lex.get();
private ASTree parseCast(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(1); if (isBuiltinType(t) && nextIsBuiltinCast()) { lex.get(); // '(' lex.get(); // primitive type int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(t, dim, parseUnaryExpr(tbl)); } else if (t == Identifier && nextIsClassCast()) { lex.get(); // '(' ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); if (lex.get() != ')') throw new CompileError(") is missing", lex); return new CastExpr(name, dim, parseUnaryExpr(tbl)); } else return parsePostfix(tbl); }
if (i >= 0) if (lex.lookAhead(i) == Identifier) { ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return parseDeclarators(tbl, new Declarator(name, dim));
lex.get(); while (true) { throwsList = ASTList.append(throwsList, parseClassType(tbl)); if (lex.lookAhead() == ',') lex.get();
private Declarator parseFormalType(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(); if (isBuiltinType(t) || t == VOID) { lex.get(); // primitive type int dim = parseArrayDimension(); return new Declarator(t, dim); } else { ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return new Declarator(name, dim); } }
private Declarator parseFormalType(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(); if (isBuiltinType(t) || t == VOID) { lex.get(); // primitive type int dim = parseArrayDimension(); return new Declarator(t, dim); } else { ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return new Declarator(name, dim); } }
private Declarator parseFormalType(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(); if (isBuiltinType(t) || t == VOID) { lex.get(); // primitive type int dim = parseArrayDimension(); return new Declarator(t, dim); } else { ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return new Declarator(name, dim); } }
private Declarator parseFormalType(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(); if (isBuiltinType(t) || t == VOID) { lex.get(); // primitive type int dim = parseArrayDimension(); return new Declarator(t, dim); } else { ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return new Declarator(name, dim); } }
private Declarator parseFormalType(SymbolTable tbl) throws CompileError { int t = lex.lookAhead(); if (isBuiltinType(t) || t == VOID) { lex.get(); // primitive type int dim = parseArrayDimension(); return new Declarator(t, dim); } else { ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return new Declarator(name, dim); } }
private ASTree parseInstanceOf(SymbolTable tbl, ASTree expr) throws CompileError { int t = lex.lookAhead(); if (isBuiltinType(t)) { lex.get(); // primitive type int dim = parseArrayDimension(); return new InstanceOfExpr(t, dim, expr); } else { ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return new InstanceOfExpr(name, dim, expr); } }
private ASTree parseInstanceOf(SymbolTable tbl, ASTree expr) throws CompileError { int t = lex.lookAhead(); if (isBuiltinType(t)) { lex.get(); // primitive type int dim = parseArrayDimension(); return new InstanceOfExpr(t, dim, expr); } else { ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return new InstanceOfExpr(name, dim, expr); } }
private ASTree parseInstanceOf(SymbolTable tbl, ASTree expr) throws CompileError { int t = lex.lookAhead(); if (isBuiltinType(t)) { lex.get(); // primitive type int dim = parseArrayDimension(); return new InstanceOfExpr(t, dim, expr); } else { ASTList name = parseClassType(tbl); int dim = parseArrayDimension(); return new InstanceOfExpr(name, dim, expr); } }