2023-06-09 11:22:53 +08:00
|
|
|
import { Token } from 'antlr4ts';
|
|
|
|
import { CandidatesCollection } from 'antlr4-c3';
|
2023-05-30 14:44:03 +08:00
|
|
|
import { SqlLexer } from '../lib/generic/SqlLexer';
|
2023-06-09 11:22:53 +08:00
|
|
|
import { SqlParser, ProgramContext } from '../lib/generic/SqlParser';
|
2021-01-05 15:27:43 +08:00
|
|
|
import BasicParser from './common/basicParser';
|
2023-06-09 11:22:53 +08:00
|
|
|
import { Suggestions } from './common/basic-parser-types';
|
2020-09-11 17:39:10 +08:00
|
|
|
|
2023-06-09 11:22:53 +08:00
|
|
|
export default class GenericSQL extends BasicParser<SqlLexer, ProgramContext, SqlParser> {
|
2023-06-16 16:14:53 +08:00
|
|
|
protected createLexerFormCharStream(charStreams): SqlLexer {
|
2023-06-09 11:22:53 +08:00
|
|
|
const lexer = new SqlLexer(charStreams);
|
2020-09-11 17:39:10 +08:00
|
|
|
return lexer;
|
|
|
|
}
|
2023-06-09 11:22:53 +08:00
|
|
|
|
2023-06-16 16:14:53 +08:00
|
|
|
protected createParserFromTokenStream(tokenStream): SqlParser {
|
2020-09-11 17:39:10 +08:00
|
|
|
return new SqlParser(tokenStream);
|
|
|
|
}
|
2023-06-09 11:22:53 +08:00
|
|
|
|
2023-06-16 16:14:53 +08:00
|
|
|
protected preferredRules: Set<number> = new Set();
|
2023-06-09 11:22:53 +08:00
|
|
|
|
|
|
|
protected get splitListener () {
|
|
|
|
return null as any;
|
|
|
|
}
|
|
|
|
|
2023-06-16 16:14:53 +08:00
|
|
|
protected processCandidates(
|
2023-06-09 11:22:53 +08:00
|
|
|
candidates: CandidatesCollection,
|
|
|
|
allTokens: Token[],
|
|
|
|
caretTokenIndex: number
|
|
|
|
): Suggestions<Token> {
|
|
|
|
return {
|
|
|
|
syntax: [],
|
|
|
|
keywords: []
|
|
|
|
}
|
|
|
|
}
|
2020-09-11 17:39:10 +08:00
|
|
|
}
|
|
|
|
|