public void visitIntLiteral(IntLiteral binary) { try { binary.setResolvedType(context.getType(int.class)); final int base; final String literal; if (binary.getLiteral().startsWith("0x")) { base = 16; literal = binary.getLiteral().substring(2); } else if (binary.getLiteral().startsWith("0b")) { base = 2; literal = binary.getLiteral().substring(2); } else if (binary.getLiteral().startsWith("0")) { base = 8; literal = binary.getLiteral(); } else { base = 10; literal = binary.getLiteral(); } binary.setResolvedValueInt(Integer.parseInt(literal, base)); } catch (NumberFormatException e) { throw new InvalidExpressionException(String.format("Type mismatch: cannot convert from String '%s' to int", binary.getLiteral())); } }
public void visitIntLiteral(IntLiteral binary) { try { binary.setResolvedType(context.getType(int.class)); final int base; final String literal; if (binary.getLiteral().startsWith("0x")) { base = 16; literal = binary.getLiteral().substring(2); } else if (binary.getLiteral().startsWith("0b")) { base = 2; literal = binary.getLiteral().substring(2); } else if (binary.getLiteral().startsWith("0")) { base = 8; literal = binary.getLiteral(); } else { base = 10; literal = binary.getLiteral(); } binary.setResolvedValueInt(Integer.parseInt(literal, base)); } catch (NumberFormatException e) { throw new InvalidExpressionException(String.format("Type mismatch: cannot convert from String '%s' to int", binary.getLiteral())); } }
DSLExpression Factor() { DSLExpression result; result = null; if (la.kind == 1) { result = MemberExpression(result); } else if (la.kind == 2) { Get(); result = new IntLiteral(t.val); } else if (la.kind == 11) { Get(); result = Expression(); Expect(12); } else SynErr(16); return result; }
DSLExpression Factor() { DSLExpression result; result = null; if (la.kind == 1) { result = MemberExpression(result); } else if (la.kind == 2) { Get(); result = new IntLiteral(t.val); } else if (la.kind == 11) { Get(); result = Expression(); Expect(12); } else SynErr(16); return result; }
public void visitIntLiteral(IntLiteral binary) { push(string(binary.getLiteral())); }
public void visitIntLiteral(IntLiteral binary) { push(string(binary.getLiteral())); }