Term.set(Term.ForeColor.GRAY);
System.out.print(prompt);
Term.restoreColor();
while (true) {
Token token = lexer.readToken();
if (token.getType() == TokenType.EOF) break;
switch (token.getType()) {
case LEFT_PAREN:
case RIGHT_PAREN:
case LEFT_BRACKET:
case RIGHT_BRACKET:
case LEFT_BRACE:
case RIGHT_BRACE:
case BACKTICK:
case COMMA:
case EQ:
Term.set(Term.ForeColor.GRAY);
break;
// Identifiers.
case NAME:
/*
if (token.isKeyword("this") ||
token.isKeyword("nothing") ||
token.isKeyword("it")) {
// special identifiers
Term.set(ForeColor.LIGHT_BLUE);
// TODO(bob): Fix this once we have token types for the reserved words.
} else if (repl.isKeyword(token.getString())) {
Term.set(ForeColor.CYAN);
} else {
*/
Term.set(ForeColor.WHITE);
/*
}
*/
break;
case FIELD:
Term.set(Term.ForeColor.GRAY);
break;
// literals
case BOOL:
case INT:
Term.set(Term.ForeColor.LIGHT_BLUE);
break;
case DOUBLE:
case STRING:
Term.set(Term.ForeColor.YELLOW);
break;
case BLOCK_COMMENT:
case DOC_COMMENT:
case LINE_COMMENT:
Term.set(Term.ForeColor.GRAY);
break;
default:
Term.restoreColor();
}
System.out.print(token.getText());
}
} catch(ParseException ex) {
// Do nothing, just eat it.
}