2023-06-09 11:22:53 +08:00
|
|
|
import { Token } from 'antlr4ts';
|
|
|
|
import { CandidatesCollection } from 'antlr4-c3';
|
2023-11-27 15:25:40 +08:00
|
|
|
import { MySqlLexer } from '../lib/mysql/MySqlLexer';
|
|
|
|
import { MySqlParser, ProgramContext } from '../lib/mysql/MySqlParser';
|
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-11-27 15:25:40 +08:00
|
|
|
export default class MySQL extends BasicParser<MySqlLexer, ProgramContext, MySqlParser> {
|
|
|
|
protected createLexerFormCharStream(charStreams): MySqlLexer {
|
|
|
|
const lexer = new MySqlLexer(charStreams);
|
2020-09-11 17:39:10 +08:00
|
|
|
return lexer;
|
|
|
|
}
|
2023-06-09 11:22:53 +08:00
|
|
|
|
2023-11-27 15:25:40 +08:00
|
|
|
protected createParserFromTokenStream(tokenStream): MySqlParser {
|
|
|
|
return new MySqlParser(tokenStream);
|
2020-09-11 17:39:10 +08:00
|
|
|
}
|
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
|
|
|
|
2023-10-13 11:16:36 +08:00
|
|
|
protected get splitListener() {
|
2023-06-09 11:22:53 +08:00
|
|
|
return null as any;
|
|
|
|
}
|
|
|
|
|
2023-06-16 16:14:53 +08:00
|
|
|
protected processCandidates(
|
2023-10-13 11:16:36 +08:00
|
|
|
candidates: CandidatesCollection,
|
|
|
|
allTokens: Token[],
|
2023-06-09 11:22:53 +08:00
|
|
|
caretTokenIndex: number
|
|
|
|
): Suggestions<Token> {
|
|
|
|
return {
|
|
|
|
syntax: [],
|
2023-10-13 11:16:36 +08:00
|
|
|
keywords: [],
|
|
|
|
};
|
2023-06-09 11:22:53 +08:00
|
|
|
}
|
2020-09-11 17:39:10 +08:00
|
|
|
}
|