Skip to content

Commit 8e11012

Browse files
authored
fix: split whiteSpace into multiple tokens to fix findCaretTokenIndex may undefined (#385)
+1
1 parent ee3c549 commit 8e11012

30 files changed

+7404
-7296
lines changed

src/grammar/flink/FlinkSqlLexer.g4

Lines changed: 1 addition & 1 deletion
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

src/grammar/impala/ImpalaSqlLexer.g4

Lines changed: 1 addition & 1 deletion
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);

src/grammar/mysql/MySqlLexer.g4

Lines changed: 1 addition & 1 deletion
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);

src/grammar/spark/SparkSqlLexer.g4

Lines changed: 1 addition & 1 deletion
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

src/grammar/trino/TrinoSql.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,7 @@ SIMPLE_COMMENT: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN);
16481648

16491649
BRACKETED_COMMENT: '/*' .*? '*/' -> channel(HIDDEN);
16501650

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

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

src/lib/flink/FlinkSqlLexer.interp

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/lib/flink/FlinkSqlLexer.ts

Lines changed: 1963 additions & 1965 deletions
Large diffs are not rendered by default.

src/lib/impala/ImpalaSqlLexer.interp

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/lib/impala/ImpalaSqlLexer.ts

Lines changed: 582 additions & 583 deletions
Large diffs are not rendered by default.

src/lib/mysql/MySqlLexer.interp

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)