2020-09-11 17:39:10 +08:00
|
|
|
import { InputStream, CommonTokenStream, Lexer } from 'antlr4';
|
|
|
|
import { HiveSqlLexer } from '../lib/hive/HiveSqlLexer';
|
|
|
|
import { HiveSqlParser } from '../lib/hive/HiveSqlParser';
|
2020-11-25 15:03:16 +08:00
|
|
|
export * from '../lib/hive/HiveSqlParserListener';
|
|
|
|
export * from '../lib/hive/HiveSqlParserVisitor';
|
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);
|
|
|
|
return new HiveSqlParser(tokenStream);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|