private void emit(TokenType tokenType) {
        String value = valueBuilder.toString();
        Token t = new Token(tokenType, value, tokenLineNumber);

        // Strip out whitespace and convert keywords to the correct token
        // type.
        if (t.type == TokenType.WHITESPACE) {
            t = null;
        } else if (t.type == TokenType.ID) {
            if (t.value.equals("Schemes")) {
                t = new Token(TokenType.SCHEMES, t.value, t.lineNumber);
            } else if (t.value.equals("Facts")) {
                t = new Token(TokenType.FACTS, t.value, t.lineNumber);
            } else if (t.value.equals("Rules")) {
                t = new Token(TokenType.RULES, t.value, t.lineNumber);
            } else if (t.value.equals("Queries")) {
                t = new Token(TokenType.QUERIES, t.value, t.lineNumber);
            }
        }

        if (t != null) {
            tokenList.add(t);
        }

        valueBuilder.setLength(0);
        tokenLineNumber = lineNumber;
    }