package com.chenyang.druid.sql.dialect.phoenix.parser;

import com.chenyang.druid.sql.parser.Keywords;
import com.chenyang.druid.sql.parser.Lexer;
import com.chenyang.druid.sql.parser.SQLParserFeature;
import com.chenyang.druid.sql.parser.Token;
import java.util.HashMap;
import java.util.Map;

public class PhoenixLexer extends Lexer {
   public static final Keywords DEFAULT_PHOENIX_KEYWORDS;

   public PhoenixLexer(String input, SQLParserFeature... features) {
      super(input);
      super.keywords = DEFAULT_PHOENIX_KEYWORDS;

      for(SQLParserFeature feature : features) {
         this.config(feature, true);
      }

   }

   static {
      Map<String, Token> map = new HashMap();
      map.putAll(Keywords.DEFAULT_KEYWORDS.getKeywords());
      map.put("FETCH", Token.FETCH);
      map.put("FIRST", Token.FIRST);
      map.put("ONLY", Token.ONLY);
      map.put("OPTIMIZE", Token.OPTIMIZE);
      map.put("OF", Token.OF);
      map.put("CONCAT", Token.CONCAT);
      map.put("CONTINUE", Token.CONTINUE);
      map.put("IDENTITY", Token.IDENTITY);
      map.put("MERGE", Token.MERGE);
      map.put("USING", Token.USING);
      map.put("MATCHED", Token.MATCHED);
      map.put("UPSERT", Token.UPSERT);
      DEFAULT_PHOENIX_KEYWORDS = new Keywords(map);
   }
}
