presto-cli/src/main/java/io/prestosql/cli/InputHighlighter.java/InputHighlighter/highlight
class InputHighlighter:    @Override
    public AttributedString highlight(LineReader reader, String buffer)
    {
        TokenSource tokens = StatementSplitter.getLexer(buffer, STATEMENT_DELIMITERS);
        AttributedStringBuilder builder = new AttributedStringBuilder();

        boolean error = false;
        while (true) {
            Token token = tokens.nextToken();
            int type = token.getType();
            if (type == Token.EOF) {
                break;
            }
            String text = token.getText();

            if (error || (type == SqlBaseLexer.UNRECOGNIZED)) {
                error = true;
                builder.styled(ERROR_STYLE, text);
            }
            else if (isKeyword(text)) {
                builder.styled(KEYWORD_STYLE, text);
            }
            else if (isString(type)) {
                builder.styled(STRING_STYLE, text);
            }
            else if (isNumber(type)) {
                builder.styled(NUMBER_STYLE, text);
            }
            else if (isComment(type)) {
                builder.styled(COMMENT_STYLE, text);
            }
            else {
                builder.append(text);
            }
        }

        return builder.toAttributedString();
    }