// literal := INTEGER | FLOAT | TRUE | FALSE . public ast.Expression literal() throws IOException { ast.Expression expr = null; if (currentToken.kind.name().equals("INTEGER")) { expr = Command.newLiteral(expectRetrieve(Token.Kind.INTEGER)); } else if (currentToken.kind.name().equals("FLOAT")) { expr = Command.newLiteral(expectRetrieve(Token.Kind.FLOAT)); } else if (currentToken.kind.name().equals("TRUE")) { expr = Command.newLiteral(expectRetrieve(Token.Kind.TRUE)); } else if (currentToken.kind.name().equals("FALSE")) { expr = Command.newLiteral(expectRetrieve(Token.Kind.FALSE)); } return expr; }
// type := IDENTIFIER . private ast.Expression type() throws IOException { // TODO Auto-generated method stub // expects IDENTIFIER return Command.newLiteral(expectRetrieve(Token.Kind.IDENTIFIER)); }