fix: rename createLexerFormCharStream to createLexerFromCharStream (#243)

This commit is contained in:
霜序 2024-01-04 11:45:41 +08:00 committed by hayden
parent 1c288b737a
commit 4d19f05890
9 changed files with 11 additions and 11 deletions

View File

@ -60,7 +60,7 @@ export default abstract class BasicParser<
* Create a antlr4 Lexer instance. * Create a antlr4 Lexer instance.
* @param input source string * @param input source string
*/ */
protected abstract createLexerFormCharStream(charStreams: CodePointCharStream): L; protected abstract createLexerFromCharStream(charStreams: CodePointCharStream): L;
/** /**
* Create Parser by CommonTokenStream * Create Parser by CommonTokenStream
@ -93,7 +93,7 @@ export default abstract class BasicParser<
*/ */
public createLexer(input: string, errorListener?: ErrorListener<any>) { public createLexer(input: string, errorListener?: ErrorListener<any>) {
const charStreams = CharStreams.fromString(input.toUpperCase()); const charStreams = CharStreams.fromString(input.toUpperCase());
const lexer = this.createLexerFormCharStream(charStreams); const lexer = this.createLexerFromCharStream(charStreams);
if (errorListener) { if (errorListener) {
lexer.removeErrorListeners(); lexer.removeErrorListeners();
lexer.addErrorListener(new ParseErrorListener(errorListener)); lexer.addErrorListener(new ParseErrorListener(errorListener));
@ -140,7 +140,7 @@ export default abstract class BasicParser<
private createParserWithCache(input: string): P { private createParserWithCache(input: string): P {
this._parseTree = null; this._parseTree = null;
this._charStreams = CharStreams.fromString(input.toUpperCase()); this._charStreams = CharStreams.fromString(input.toUpperCase());
this._lexer = this.createLexerFormCharStream(this._charStreams); this._lexer = this.createLexerFromCharStream(this._charStreams);
this._lexer.removeErrorListeners(); this._lexer.removeErrorListeners();
this._lexer.addErrorListener(new ParseErrorListener(this._errorListener)); this._lexer.addErrorListener(new ParseErrorListener(this._errorListener));

View File

@ -11,7 +11,7 @@ import { SyntaxContextType, Suggestions, SyntaxSuggestion } from './common/basic
import BasicParser from './common/basicParser'; import BasicParser from './common/basicParser';
export default class FlinkSQL extends BasicParser<FlinkSqlLexer, ProgramContext, FlinkSqlParser> { export default class FlinkSQL extends BasicParser<FlinkSqlLexer, ProgramContext, FlinkSqlParser> {
protected createLexerFormCharStream(charStreams) { protected createLexerFromCharStream(charStreams) {
const lexer = new FlinkSqlLexer(charStreams); const lexer = new FlinkSqlLexer(charStreams);
return lexer; return lexer;
} }

View File

@ -7,7 +7,7 @@ import { HiveSqlParserListener } from '../lib/hive/HiveSqlParserListener';
import { SyntaxContextType, Suggestions, SyntaxSuggestion } from './common/basic-parser-types'; import { SyntaxContextType, Suggestions, SyntaxSuggestion } from './common/basic-parser-types';
export default class HiveSQL extends BasicParser<HiveSqlLexer, ProgramContext, HiveSqlParser> { export default class HiveSQL extends BasicParser<HiveSqlLexer, ProgramContext, HiveSqlParser> {
protected createLexerFormCharStream(charStreams) { protected createLexerFromCharStream(charStreams) {
const lexer = new HiveSqlLexer(charStreams); const lexer = new HiveSqlLexer(charStreams);
return lexer; return lexer;
} }

View File

@ -15,7 +15,7 @@ export default class ImpalaSQL extends BasicParser<
ProgramContext, ProgramContext,
ImpalaSqlParser ImpalaSqlParser
> { > {
protected createLexerFormCharStream(charStreams) { protected createLexerFromCharStream(charStreams) {
const lexer = new ImpalaSqlLexer(charStreams); const lexer = new ImpalaSqlLexer(charStreams);
return lexer; return lexer;
} }

View File

@ -7,7 +7,7 @@ import { Suggestions, SyntaxContextType, SyntaxSuggestion } from './common/basic
import { MySqlParserListener } from '../lib/mysql/MySqlParserListener'; import { MySqlParserListener } from '../lib/mysql/MySqlParserListener';
export default class MySQL extends BasicParser<MySqlLexer, ProgramContext, MySqlParser> { export default class MySQL extends BasicParser<MySqlLexer, ProgramContext, MySqlParser> {
protected createLexerFormCharStream(charStreams): MySqlLexer { protected createLexerFromCharStream(charStreams): MySqlLexer {
const lexer = new MySqlLexer(charStreams); const lexer = new MySqlLexer(charStreams);
return lexer; return lexer;
} }

View File

@ -11,7 +11,7 @@ export default class PostgresSQL extends BasicParser<
ProgramContext, ProgramContext,
PostgreSQLParser PostgreSQLParser
> { > {
protected createLexerFormCharStream(charStreams) { protected createLexerFromCharStream(charStreams) {
const lexer = new PostgreSQLLexer(charStreams); const lexer = new PostgreSQLLexer(charStreams);
return lexer; return lexer;
} }

View File

@ -6,7 +6,7 @@ import BasicParser from './common/basicParser';
import { Suggestions } from './common/basic-parser-types'; import { Suggestions } from './common/basic-parser-types';
export default class PLSQL extends BasicParser<PlSqlLexer, ProgramContext, PlSqlParser> { export default class PLSQL extends BasicParser<PlSqlLexer, ProgramContext, PlSqlParser> {
protected createLexerFormCharStream(charStreams) { protected createLexerFromCharStream(charStreams) {
const lexer = new PlSqlLexer(charStreams); const lexer = new PlSqlLexer(charStreams);
return lexer; return lexer;
} }

View File

@ -11,7 +11,7 @@ import { Suggestions, SyntaxContextType, SyntaxSuggestion } from './common/basic
import { SparkSqlParserListener } from '../lib/spark/SparkSqlParserListener'; import { SparkSqlParserListener } from '../lib/spark/SparkSqlParserListener';
export default class SparkSQL extends BasicParser<SparkSqlLexer, ProgramContext, SparkSqlParser> { export default class SparkSQL extends BasicParser<SparkSqlLexer, ProgramContext, SparkSqlParser> {
protected createLexerFormCharStream(charStreams) { protected createLexerFromCharStream(charStreams) {
const lexer = new SparkSqlLexer(charStreams); const lexer = new SparkSqlLexer(charStreams);
return lexer; return lexer;
} }

View File

@ -11,7 +11,7 @@ import BasicParser from './common/basicParser';
import { Suggestions, SyntaxContextType, SyntaxSuggestion } from './common/basic-parser-types'; import { Suggestions, SyntaxContextType, SyntaxSuggestion } from './common/basic-parser-types';
export default class TrinoSQL extends BasicParser<TrinoSqlLexer, ProgramContext, TrinoSqlParser> { export default class TrinoSQL extends BasicParser<TrinoSqlLexer, ProgramContext, TrinoSqlParser> {
protected createLexerFormCharStream(charStreams) { protected createLexerFromCharStream(charStreams) {
const lexer = new TrinoSqlLexer(charStreams); const lexer = new TrinoSqlLexer(charStreams);
return lexer; return lexer;
} }