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.
* @param input source string
*/
protected abstract createLexerFormCharStream(charStreams: CodePointCharStream): L;
protected abstract createLexerFromCharStream(charStreams: CodePointCharStream): L;
/**
* Create Parser by CommonTokenStream
@ -93,7 +93,7 @@ export default abstract class BasicParser<
*/
public createLexer(input: string, errorListener?: ErrorListener<any>) {
const charStreams = CharStreams.fromString(input.toUpperCase());
const lexer = this.createLexerFormCharStream(charStreams);
const lexer = this.createLexerFromCharStream(charStreams);
if (errorListener) {
lexer.removeErrorListeners();
lexer.addErrorListener(new ParseErrorListener(errorListener));
@ -140,7 +140,7 @@ export default abstract class BasicParser<
private createParserWithCache(input: string): P {
this._parseTree = null;
this._charStreams = CharStreams.fromString(input.toUpperCase());
this._lexer = this.createLexerFormCharStream(this._charStreams);
this._lexer = this.createLexerFromCharStream(this._charStreams);
this._lexer.removeErrorListeners();
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';
export default class FlinkSQL extends BasicParser<FlinkSqlLexer, ProgramContext, FlinkSqlParser> {
protected createLexerFormCharStream(charStreams) {
protected createLexerFromCharStream(charStreams) {
const lexer = new FlinkSqlLexer(charStreams);
return lexer;
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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