2020-09-11 17:39:10 +08:00
|
|
|
import { InputStream, CommonTokenStream, Lexer } from 'antlr4';
|
|
|
|
import { HiveSqlLexer } from '../lib/hive/HiveSqlLexer';
|
2020-11-25 16:57:53 +08:00
|
|
|
import { HiveSql } from '../lib/hive/HiveSql';
|
|
|
|
export * from '../lib/hive/HiveSqlListener';
|
|
|
|
export * from '../lib/hive/HiveSqlVisitor';
|
2020-09-11 17:39:10 +08:00
|
|
|
|
|
|
|
import BasicParser from './common/BasicParser';
|
|
|
|
|
|
|
|
export default class HiveSQL extends BasicParser {
|
|
|
|
public createLexer(input: string): Lexer {
|
|
|
|
const chars = new InputStream(input);
|
|
|
|
const lexer = <unknown> new HiveSqlLexer(chars) as Lexer;
|
|
|
|
return lexer;
|
|
|
|
}
|
|
|
|
public createParserFromLexer(lexer: Lexer) {
|
|
|
|
const tokenStream = new CommonTokenStream(lexer);
|
2020-11-25 16:57:53 +08:00
|
|
|
return new HiveSql(tokenStream);
|
2020-09-11 17:39:10 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|