private ASTList parseMemberMods() { int t; ASTList list = null; while (true) { t = lex.lookAhead(); if (t == ABSTRACT || t == FINAL || t == PUBLIC || t == PROTECTED || t == PRIVATE || t == SYNCHRONIZED || t == STATIC || t == VOLATILE || t == TRANSIENT || t == STRICT) list = new ASTList(new Keyword(lex.get()), list); else break; } return list; }
private static boolean isAlwaysBranch(ASTree expr, boolean branchIf) { if (expr instanceof Keyword) { int t = ((Keyword)expr).get(); return branchIf ? t == TRUE : t == FALSE; } return false; }
private static boolean isAlwaysBranch(ASTree expr, boolean branchIf) { if (expr instanceof Keyword) { int t = ((Keyword)expr).get(); return branchIf ? t == TRUE : t == FALSE; } return false; }
private ASTList parseMemberMods() { int t; ASTList list = null; while (true) { t = lex.lookAhead(); if (t == ABSTRACT || t == FINAL || t == PUBLIC || t == PROTECTED || t == PRIVATE || t == SYNCHRONIZED || t == STATIC || t == VOLATILE || t == TRANSIENT || t == STRICT) list = new ASTList(new Keyword(lex.get()), list); else break; } return list; }
Keyword k = (Keyword)mods.head(); mods = mods.tail(); switch (k.get()) { case STATIC : m |= Modifier.STATIC;
public static ASTree getConstantFieldValue(CtField f) { if (f == null) return null; Object value = f.getConstantValue(); if (value == null) return null; if (value instanceof String) return new StringL((String)value); else if (value instanceof Double || value instanceof Float) { int token = (value instanceof Double) ? DoubleConstant : FloatConstant; return new DoubleConst(((Number)value).doubleValue(), token); } else if (value instanceof Number) { int token = (value instanceof Long) ? LongConstant : IntConstant; return new IntConst(((Number)value).longValue(), token); } else if (value instanceof Boolean) return new Keyword(((Boolean)value).booleanValue() ? TokenId.TRUE : TokenId.FALSE); else return null; }
public void atKeyword(Keyword k) throws CompileError { arrayDim = 0; int token = k.get(); switch (token) { case TRUE : case FALSE : exprType = BOOLEAN; break; case NULL : exprType = NULL; break; case THIS : case SUPER : exprType = CLASS; if (token == THIS) className = getThisName(); else className = getSuperName(); break; default : fatal(); } }
public static ASTree getConstantFieldValue(CtField f) { if (f == null) return null; Object value = f.getConstantValue(); if (value == null) return null; if (value instanceof String) return new StringL((String)value); else if (value instanceof Double || value instanceof Float) { int token = (value instanceof Double) ? DoubleConstant : FloatConstant; return new DoubleConst(((Number)value).doubleValue(), token); } else if (value instanceof Number) { int token = (value instanceof Long) ? LongConstant : IntConstant; return new IntConst(((Number)value).longValue(), token); } else if (value instanceof Boolean) return new Keyword(((Boolean)value).booleanValue() ? TokenId.TRUE : TokenId.FALSE); else return null; }
/** * Returns non-null if target is something like Foo.super * for accessing the default method in an interface. * Otherwise, null. * * @return the class name followed by {@code .super} or null. */ static String isDotSuper(ASTree target) { if (target instanceof Expr) { Expr e = (Expr)target; if (e.getOperator() == '.') { ASTree right = e.oprand2(); if (right instanceof Keyword && ((Keyword)right).get() == SUPER) return ((Symbol)e.oprand1()).get(); } } return null; }
case FALSE : case NULL : return new Keyword(t); case Identifier : name = lex.getString();
Keyword k = (Keyword)mods.head(); mods = mods.tail(); switch (k.get()) { case STATIC : m |= Modifier.STATIC;
case FALSE : case NULL : return new Keyword(t); case Identifier : name = lex.getString();
private ASTree parseMethodCall(SymbolTable tbl, ASTree expr) throws CompileError { if (expr instanceof Keyword) { int token = ((Keyword)expr).get(); if (token != THIS && token != SUPER) throw new SyntaxError(lex); } else if (expr instanceof Symbol) // Identifier ; else if (expr instanceof Expr) { int op = ((Expr)expr).getOperator(); if (op != '.' && op != MEMBER) throw new SyntaxError(lex); } return CallExpr.makeCall(expr, parseArgumentList(tbl)); }
expr = parseDotClass(expr, 0); else if (t == SUPER) expr = Expr.make('.', new Symbol(toClassName(expr)), new Keyword(t)); else if (t == Identifier) { str = lex.getString();
@Override public void atKeyword(Keyword k) throws CompileError { arrayDim = 0; int token = k.get(); switch (token) { case TRUE : case FALSE : exprType = BOOLEAN; break; case NULL : exprType = NULL; break; case THIS : case SUPER : exprType = CLASS; if (token == THIS) className = getThisName(); else className = getSuperName(); break; default : fatal(); } }
expr = parseDotClass(expr, 0); else if (t == SUPER) expr = Expr.make('.', new Symbol(toClassName(expr)), new Keyword(t)); else if (t == Identifier) { str = lex.getString();
/** * Returns non-null if target is something like Foo.super * for accessing the default method in an interface. * Otherwise, null. * * @return the class name followed by {@code .super} or null. */ static String isDotSuper(ASTree target) { if (target instanceof Expr) { Expr e = (Expr)target; if (e.getOperator() == '.') { ASTree right = e.oprand2(); if (right instanceof Keyword && ((Keyword)right).get() == SUPER) return ((Symbol)e.oprand1()).get(); } } return null; }
private ASTList parseMemberMods() { int t; ASTList list = null; while (true) { t = lex.lookAhead(); if (t == ABSTRACT || t == FINAL || t == PUBLIC || t == PROTECTED || t == PRIVATE || t == SYNCHRONIZED || t == STATIC || t == VOLATILE || t == TRANSIENT || t == STRICT) list = new ASTList(new Keyword(lex.get()), list); else break; } return list; }
private boolean needsSuperCall(Stmnt body) throws CompileError { if (body.getOperator() == BLOCK) body = (Stmnt)body.head(); if (body != null && body.getOperator() == EXPR) { ASTree expr = body.head(); if (expr != null && expr instanceof Expr && ((Expr)expr).getOperator() == CALL) { ASTree target = ((Expr)expr).head(); if (target instanceof Keyword) { int token = ((Keyword)target).get(); return token != THIS && token != SUPER; } } } return true; }
private ASTList parseMemberMods() { int t; ASTList list = null; while (true) { t = lex.lookAhead(); if (t == ABSTRACT || t == FINAL || t == PUBLIC || t == PROTECTED || t == PRIVATE || t == SYNCHRONIZED || t == STATIC || t == VOLATILE || t == TRANSIENT || t == STRICT) list = new ASTList(new Keyword(lex.get()), list); else break; } return list; }