All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.alibaba.druid.sql.dialect.blink.parser.BlinkLexer Maven / Gradle / Ivy

There is a newer version: 1.2.23
Show newest version
package com.alibaba.druid.sql.dialect.blink.parser;

import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.parser.Keywords;
import com.alibaba.druid.sql.parser.Lexer;
import com.alibaba.druid.sql.parser.SQLParserFeature;
import com.alibaba.druid.sql.parser.Token;

import java.util.HashMap;
import java.util.Map;

public class BlinkLexer extends Lexer {
    public static final Keywords DEFAULT_BLINK_KEYWORDS;

    static {
        Map map = new HashMap();

        map.putAll(Keywords.DEFAULT_KEYWORDS.getKeywords());

        map.put("OF", Token.OF);
        map.put("CONCAT", Token.CONCAT);
        map.put("CONTINUE", Token.CONTINUE);
        map.put("MERGE", Token.MERGE);
        map.put("USING", Token.USING);

        map.put("ROW", Token.ROW);
        map.put("LIMIT", Token.LIMIT);
        map.put("IF", Token.IF);
        map.put("PERIOD", Token.PERIOD);

        DEFAULT_BLINK_KEYWORDS = new Keywords(map);
    }

    public BlinkLexer(String input) {
        super(input);
        super.keywords = DEFAULT_BLINK_KEYWORDS;
        dbType = DbType.blink;
    }

    public BlinkLexer(String input, SQLParserFeature... features) {
        super(input);
        super.keywords = DEFAULT_BLINK_KEYWORDS;
        dbType = DbType.blink;
        for (SQLParserFeature feature : features) {
            config(feature, true);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy