Skip to content

Commit 43f66d9

Browse files
committed
fix: split whiteSpace into multiple tokens to fix findCaretTokenIndex may undefined
1 parent bdb4b96 commit 43f66d9

35 files changed

+7428
-7319
lines changed

Diff for: src/grammar/flink/FlinkSqlLexer.g4

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ options {
1111

1212
// SKIP
1313

14-
SPACE : [ \t\r\n]+ -> channel(HIDDEN);
14+
SPACE : (' ' | '\t' | '\r' | '\n') -> channel(HIDDEN);
1515
COMMENT_INPUT : '/*' .*? '*/' -> channel(HIDDEN);
1616
LINE_COMMENT: (('--' | '#') ~[\r\n]* ('\r'? '\n' | EOF) | '--' ('\r'? '\n' | EOF)) -> channel(HIDDEN);
1717

Diff for: src/grammar/flink/FlinkSqlParser.g4

+1-1
Original file line numberDiff line numberDiff line change
@@ -1217,4 +1217,4 @@ nonReservedKeywords
12171217
| KW_WEEK
12181218
| KW_YEARS
12191219
| KW_ZONE
1220-
;
1220+
;

Diff for: src/grammar/impala/ImpalaSqlLexer.g4

+1-1
Original file line numberDiff line numberDiff line change
@@ -350,4 +350,4 @@ SIMPLE_COMMENT: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN);
350350

351351
BRACKETED_COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
352352

353-
WS: [ \r\n\t]+ -> channel(HIDDEN);
353+
WS: (' ' | '\t' | '\r' | '\n') -> channel(HIDDEN);

Diff for: src/grammar/mysql/MySqlLexer.g4

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ channels {
4141
ERRORCHANNEL
4242
}
4343

44-
SPACE : [ \t\r\n]+ -> channel(HIDDEN);
44+
SPACE : (' ' | '\t' | '\r' | '\n') -> channel(HIDDEN);
4545
SPEC_MYSQL_COMMENT : '/*!' .+? '*/' -> channel(MYSQLCOMMENT);
4646
COMMENT_INPUT : '/*' .*? '*/' -> channel(HIDDEN);
4747
LINE_COMMENT: (('--' [ \t]* | '#') ~[\r\n]* ('\r'? '\n' | EOF) | '--' ('\r'? '\n' | EOF)) -> channel(HIDDEN);

Diff for: src/grammar/spark/SparkSqlLexer.g4

+1-1
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,7 @@ SIMPLE_COMMENT: '--' ('\\\n' | ~[\r\n])* '\r'? '\n'? -> channel(HIDDEN);
481481
BRACKETED_COMMENT:
482482
'/*' (BRACKETED_COMMENT | .)*? ('*/' | {this.markUnclosedComment();} EOF) -> channel(HIDDEN);
483483

484-
WS: [ \r\n\t]+ -> channel(HIDDEN);
484+
WS: (' ' | '\t' | '\r' | '\n') -> channel(HIDDEN);
485485

486486
// Catch-all for anything we can't recognize.
487487
// We use this to be able to ignore and recover all the text

Diff for: src/grammar/trino/TrinoSql.g4

+1-1
Original file line numberDiff line numberDiff line change
@@ -1650,7 +1650,7 @@ SIMPLE_COMMENT: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN);
16501650

16511651
BRACKETED_COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
16521652

1653-
WS: [ \r\n\t]+ -> channel(HIDDEN);
1653+
WS: (' ' | '\t' | '\r' | '\n') -> channel(HIDDEN);
16541654

16551655
// Catch-all for anything we can't recognize.
16561656
// We use this to be able to ignore and recover all the text

Diff for: src/lib/flink/FlinkSqlLexer.interp

+1-1
Large diffs are not rendered by default.

Diff for: src/lib/flink/FlinkSqlLexer.ts

+1,961-1,962
Large diffs are not rendered by default.

Diff for: src/lib/flink/FlinkSqlParser.interp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ addConstraint
11511151
dropConstraint
11521152
addUnique
11531153
notForced
1154-
alertView
1154+
alterView
11551155
alterDatabase
11561156
alterFunction
11571157
dropCatalog

Diff for: src/lib/flink/FlinkSqlParser.ts

+16-16
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,7 @@ export class FlinkSqlParser extends SQLParserBase {
622622
public static readonly RULE_dropConstraint = 61;
623623
public static readonly RULE_addUnique = 62;
624624
public static readonly RULE_notForced = 63;
625-
public static readonly RULE_alertView = 64;
625+
public static readonly RULE_alterView = 64;
626626
public static readonly RULE_alterDatabase = 65;
627627
public static readonly RULE_alterFunction = 66;
628628
public static readonly RULE_dropCatalog = 67;
@@ -975,7 +975,7 @@ export class FlinkSqlParser extends SQLParserBase {
975975
"likeDefinition", "likeOption", "createCatalog", "createDatabase",
976976
"createView", "createFunction", "usingClause", "jarFileName", "alterTable",
977977
"renameDefinition", "setKeyValueDefinition", "addConstraint", "dropConstraint",
978-
"addUnique", "notForced", "alertView", "alterDatabase", "alterFunction",
978+
"addUnique", "notForced", "alterView", "alterDatabase", "alterFunction",
979979
"dropCatalog", "dropTable", "dropDatabase", "dropView", "dropFunction",
980980
"insertStatement", "insertSimpleStatement", "insertPartitionDefinition",
981981
"valuesDefinition", "valuesRowDefinition", "insertMulStatementCompatibility",
@@ -1315,7 +1315,7 @@ export class FlinkSqlParser extends SQLParserBase {
13151315
this.enterOuterAlt(localContext, 7);
13161316
{
13171317
this.state = 413;
1318-
this.alertView();
1318+
this.alterView();
13191319
}
13201320
break;
13211321
case 8:
@@ -4457,9 +4457,9 @@ export class FlinkSqlParser extends SQLParserBase {
44574457
}
44584458
return localContext;
44594459
}
4460-
public alertView(): AlertViewContext {
4461-
let localContext = new AlertViewContext(this.context, this.state);
4462-
this.enterRule(localContext, 128, FlinkSqlParser.RULE_alertView);
4460+
public alterView(): AlterViewContext {
4461+
let localContext = new AlterViewContext(this.context, this.state);
4462+
this.enterRule(localContext, 128, FlinkSqlParser.RULE_alterView);
44634463
try {
44644464
this.enterOuterAlt(localContext, 1);
44654465
{
@@ -12777,8 +12777,8 @@ export class DdlStatementContext extends antlr.ParserRuleContext {
1277712777
public alterTable(): AlterTableContext | null {
1277812778
return this.getRuleContext(0, AlterTableContext);
1277912779
}
12780-
public alertView(): AlertViewContext | null {
12781-
return this.getRuleContext(0, AlertViewContext);
12780+
public alterView(): AlterViewContext | null {
12781+
return this.getRuleContext(0, AlterViewContext);
1278212782
}
1278312783
public alterDatabase(): AlterDatabaseContext | null {
1278412784
return this.getRuleContext(0, AlterDatabaseContext);
@@ -15555,7 +15555,7 @@ export class NotForcedContext extends antlr.ParserRuleContext {
1555515555
}
1555615556

1555715557

15558-
export class AlertViewContext extends antlr.ParserRuleContext {
15558+
export class AlterViewContext extends antlr.ParserRuleContext {
1555915559
public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) {
1556015560
super(parent, invokingState);
1556115561
}
@@ -15578,21 +15578,21 @@ export class AlertViewContext extends antlr.ParserRuleContext {
1557815578
return this.getRuleContext(0, QueryStatementContext);
1557915579
}
1558015580
public override get ruleIndex(): number {
15581-
return FlinkSqlParser.RULE_alertView;
15581+
return FlinkSqlParser.RULE_alterView;
1558215582
}
1558315583
public override enterRule(listener: FlinkSqlParserListener): void {
15584-
if(listener.enterAlertView) {
15585-
listener.enterAlertView(this);
15584+
if(listener.enterAlterView) {
15585+
listener.enterAlterView(this);
1558615586
}
1558715587
}
1558815588
public override exitRule(listener: FlinkSqlParserListener): void {
15589-
if(listener.exitAlertView) {
15590-
listener.exitAlertView(this);
15589+
if(listener.exitAlterView) {
15590+
listener.exitAlterView(this);
1559115591
}
1559215592
}
1559315593
public override accept<Result>(visitor: FlinkSqlParserVisitor<Result>): Result | null {
15594-
if (visitor.visitAlertView) {
15595-
return visitor.visitAlertView(this);
15594+
if (visitor.visitAlterView) {
15595+
return visitor.visitAlterView(this);
1559615596
} else {
1559715597
return visitor.visitChildren(this);
1559815598
}

Diff for: src/lib/flink/FlinkSqlParserListener.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ import { AddConstraintContext } from "./FlinkSqlParser.js";
7373
import { DropConstraintContext } from "./FlinkSqlParser.js";
7474
import { AddUniqueContext } from "./FlinkSqlParser.js";
7575
import { NotForcedContext } from "./FlinkSqlParser.js";
76-
import { AlertViewContext } from "./FlinkSqlParser.js";
76+
import { AlterViewContext } from "./FlinkSqlParser.js";
7777
import { AlterDatabaseContext } from "./FlinkSqlParser.js";
7878
import { AlterFunctionContext } from "./FlinkSqlParser.js";
7979
import { DropCatalogContext } from "./FlinkSqlParser.js";
@@ -883,15 +883,15 @@ export class FlinkSqlParserListener implements ParseTreeListener {
883883
*/
884884
exitNotForced?: (ctx: NotForcedContext) => void;
885885
/**
886-
* Enter a parse tree produced by `FlinkSqlParser.alertView`.
886+
* Enter a parse tree produced by `FlinkSqlParser.alterView`.
887887
* @param ctx the parse tree
888888
*/
889-
enterAlertView?: (ctx: AlertViewContext) => void;
889+
enterAlterView?: (ctx: AlterViewContext) => void;
890890
/**
891-
* Exit a parse tree produced by `FlinkSqlParser.alertView`.
891+
* Exit a parse tree produced by `FlinkSqlParser.alterView`.
892892
* @param ctx the parse tree
893893
*/
894-
exitAlertView?: (ctx: AlertViewContext) => void;
894+
exitAlterView?: (ctx: AlterViewContext) => void;
895895
/**
896896
* Enter a parse tree produced by `FlinkSqlParser.alterDatabase`.
897897
* @param ctx the parse tree

Diff for: src/lib/flink/FlinkSqlParserVisitor.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ import { AddConstraintContext } from "./FlinkSqlParser.js";
7373
import { DropConstraintContext } from "./FlinkSqlParser.js";
7474
import { AddUniqueContext } from "./FlinkSqlParser.js";
7575
import { NotForcedContext } from "./FlinkSqlParser.js";
76-
import { AlertViewContext } from "./FlinkSqlParser.js";
76+
import { AlterViewContext } from "./FlinkSqlParser.js";
7777
import { AlterDatabaseContext } from "./FlinkSqlParser.js";
7878
import { AlterFunctionContext } from "./FlinkSqlParser.js";
7979
import { DropCatalogContext } from "./FlinkSqlParser.js";
@@ -624,11 +624,11 @@ export class FlinkSqlParserVisitor<Result> extends AbstractParseTreeVisitor<Resu
624624
*/
625625
visitNotForced?: (ctx: NotForcedContext) => Result;
626626
/**
627-
* Visit a parse tree produced by `FlinkSqlParser.alertView`.
627+
* Visit a parse tree produced by `FlinkSqlParser.alterView`.
628628
* @param ctx the parse tree
629629
* @return the visitor result
630630
*/
631-
visitAlertView?: (ctx: AlertViewContext) => Result;
631+
visitAlterView?: (ctx: AlterViewContext) => Result;
632632
/**
633633
* Visit a parse tree produced by `FlinkSqlParser.alterDatabase`.
634634
* @param ctx the parse tree

Diff for: src/lib/impala/ImpalaSqlLexer.interp

+1-1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)