lava-oushudb-dt-sql-parser/src/parser/mysql.ts
琉易 428d851913
feat: #190 improve mysql grammer (#196)
* refactor: generic rename to mysql

* refactor: g4 with mysql syntax

* test: mysql syntax

* refactor: remove useless keywords

* refactor: remove nonReserved keywords

* refactor: lint specificFunction

---------

Co-authored-by: liuyi <liuyi@dtstack.com>
2023-11-27 15:25:40 +08:00

35 lines
1.0 KiB
TypeScript

import { Token } from 'antlr4ts';
import { CandidatesCollection } from 'antlr4-c3';
import { MySqlLexer } from '../lib/mysql/MySqlLexer';
import { MySqlParser, ProgramContext } from '../lib/mysql/MySqlParser';
import BasicParser from './common/basicParser';
import { Suggestions } from './common/basic-parser-types';
export default class MySQL extends BasicParser<MySqlLexer, ProgramContext, MySqlParser> {
protected createLexerFormCharStream(charStreams): MySqlLexer {
const lexer = new MySqlLexer(charStreams);
return lexer;
}
protected createParserFromTokenStream(tokenStream): MySqlParser {
return new MySqlParser(tokenStream);
}
protected preferredRules: Set<number> = new Set();
protected get splitListener() {
return null as any;
}
protected processCandidates(
candidates: CandidatesCollection,
allTokens: Token[],
caretTokenIndex: number
): Suggestions<Token> {
return {
syntax: [],
keywords: [],
};
}
}