Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: split whiteSpace into multiple tokens to fix findCaretTokenIndex… #385

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/grammar/flink/FlinkSqlLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ options {

// SKIP

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

Expand Down
2 changes: 1 addition & 1 deletion src/grammar/flink/FlinkSqlParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -1217,4 +1217,4 @@ nonReservedKeywords
| KW_WEEK
| KW_YEARS
| KW_ZONE
;
;
2 changes: 1 addition & 1 deletion src/grammar/impala/ImpalaSqlLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -350,4 +350,4 @@ SIMPLE_COMMENT: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN);

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

WS: [ \r\n\t]+ -> channel(HIDDEN);
WS: (' ' | '\t' | '\r' | '\n') -> channel(HIDDEN);
2 changes: 1 addition & 1 deletion src/grammar/mysql/MySqlLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ channels {
ERRORCHANNEL
}

SPACE : [ \t\r\n]+ -> channel(HIDDEN);
SPACE : (' ' | '\t' | '\r' | '\n') -> channel(HIDDEN);
SPEC_MYSQL_COMMENT : '/*!' .+? '*/' -> channel(MYSQLCOMMENT);
COMMENT_INPUT : '/*' .*? '*/' -> channel(HIDDEN);
LINE_COMMENT: (('--' [ \t]* | '#') ~[\r\n]* ('\r'? '\n' | EOF) | '--' ('\r'? '\n' | EOF)) -> channel(HIDDEN);
Expand Down
2 changes: 1 addition & 1 deletion src/grammar/spark/SparkSqlLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ SIMPLE_COMMENT: '--' ('\\\n' | ~[\r\n])* '\r'? '\n'? -> channel(HIDDEN);
BRACKETED_COMMENT:
'/*' (BRACKETED_COMMENT | .)*? ('*/' | {this.markUnclosedComment();} EOF) -> channel(HIDDEN);

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

// Catch-all for anything we can't recognize.
// We use this to be able to ignore and recover all the text
Expand Down
2 changes: 1 addition & 1 deletion src/grammar/trino/TrinoSql.g4
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,7 @@ SIMPLE_COMMENT: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN);

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

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

// Catch-all for anything we can't recognize.
// We use this to be able to ignore and recover all the text
Expand Down
2 changes: 1 addition & 1 deletion src/lib/flink/FlinkSqlLexer.interp

Large diffs are not rendered by default.

3,923 changes: 1,961 additions & 1,962 deletions src/lib/flink/FlinkSqlLexer.ts

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/lib/flink/FlinkSqlParser.interp
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,7 @@ addConstraint
dropConstraint
addUnique
notForced
alertView
alterView
alterDatabase
alterFunction
dropCatalog
Expand Down
32 changes: 16 additions & 16 deletions src/lib/flink/FlinkSqlParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ export class FlinkSqlParser extends SQLParserBase {
public static readonly RULE_dropConstraint = 61;
public static readonly RULE_addUnique = 62;
public static readonly RULE_notForced = 63;
public static readonly RULE_alertView = 64;
public static readonly RULE_alterView = 64;
public static readonly RULE_alterDatabase = 65;
public static readonly RULE_alterFunction = 66;
public static readonly RULE_dropCatalog = 67;
Expand Down Expand Up @@ -975,7 +975,7 @@ export class FlinkSqlParser extends SQLParserBase {
"likeDefinition", "likeOption", "createCatalog", "createDatabase",
"createView", "createFunction", "usingClause", "jarFileName", "alterTable",
"renameDefinition", "setKeyValueDefinition", "addConstraint", "dropConstraint",
"addUnique", "notForced", "alertView", "alterDatabase", "alterFunction",
"addUnique", "notForced", "alterView", "alterDatabase", "alterFunction",
"dropCatalog", "dropTable", "dropDatabase", "dropView", "dropFunction",
"insertStatement", "insertSimpleStatement", "insertPartitionDefinition",
"valuesDefinition", "valuesRowDefinition", "insertMulStatementCompatibility",
Expand Down Expand Up @@ -1315,7 +1315,7 @@ export class FlinkSqlParser extends SQLParserBase {
this.enterOuterAlt(localContext, 7);
{
this.state = 413;
this.alertView();
this.alterView();
}
break;
case 8:
Expand Down Expand Up @@ -4457,9 +4457,9 @@ export class FlinkSqlParser extends SQLParserBase {
}
return localContext;
}
public alertView(): AlertViewContext {
let localContext = new AlertViewContext(this.context, this.state);
this.enterRule(localContext, 128, FlinkSqlParser.RULE_alertView);
public alterView(): AlterViewContext {
let localContext = new AlterViewContext(this.context, this.state);
this.enterRule(localContext, 128, FlinkSqlParser.RULE_alterView);
try {
this.enterOuterAlt(localContext, 1);
{
Expand Down Expand Up @@ -12777,8 +12777,8 @@ export class DdlStatementContext extends antlr.ParserRuleContext {
public alterTable(): AlterTableContext | null {
return this.getRuleContext(0, AlterTableContext);
}
public alertView(): AlertViewContext | null {
return this.getRuleContext(0, AlertViewContext);
public alterView(): AlterViewContext | null {
return this.getRuleContext(0, AlterViewContext);
}
public alterDatabase(): AlterDatabaseContext | null {
return this.getRuleContext(0, AlterDatabaseContext);
Expand Down Expand Up @@ -15555,7 +15555,7 @@ export class NotForcedContext extends antlr.ParserRuleContext {
}


export class AlertViewContext extends antlr.ParserRuleContext {
export class AlterViewContext extends antlr.ParserRuleContext {
public constructor(parent: antlr.ParserRuleContext | null, invokingState: number) {
super(parent, invokingState);
}
Expand All @@ -15578,21 +15578,21 @@ export class AlertViewContext extends antlr.ParserRuleContext {
return this.getRuleContext(0, QueryStatementContext);
}
public override get ruleIndex(): number {
return FlinkSqlParser.RULE_alertView;
return FlinkSqlParser.RULE_alterView;
}
public override enterRule(listener: FlinkSqlParserListener): void {
if(listener.enterAlertView) {
listener.enterAlertView(this);
if(listener.enterAlterView) {
listener.enterAlterView(this);
}
}
public override exitRule(listener: FlinkSqlParserListener): void {
if(listener.exitAlertView) {
listener.exitAlertView(this);
if(listener.exitAlterView) {
listener.exitAlterView(this);
}
}
public override accept<Result>(visitor: FlinkSqlParserVisitor<Result>): Result | null {
if (visitor.visitAlertView) {
return visitor.visitAlertView(this);
if (visitor.visitAlterView) {
return visitor.visitAlterView(this);
} else {
return visitor.visitChildren(this);
}
Expand Down
10 changes: 5 additions & 5 deletions src/lib/flink/FlinkSqlParserListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import { AddConstraintContext } from "./FlinkSqlParser.js";
import { DropConstraintContext } from "./FlinkSqlParser.js";
import { AddUniqueContext } from "./FlinkSqlParser.js";
import { NotForcedContext } from "./FlinkSqlParser.js";
import { AlertViewContext } from "./FlinkSqlParser.js";
import { AlterViewContext } from "./FlinkSqlParser.js";
import { AlterDatabaseContext } from "./FlinkSqlParser.js";
import { AlterFunctionContext } from "./FlinkSqlParser.js";
import { DropCatalogContext } from "./FlinkSqlParser.js";
Expand Down Expand Up @@ -883,15 +883,15 @@ export class FlinkSqlParserListener implements ParseTreeListener {
*/
exitNotForced?: (ctx: NotForcedContext) => void;
/**
* Enter a parse tree produced by `FlinkSqlParser.alertView`.
* Enter a parse tree produced by `FlinkSqlParser.alterView`.
* @param ctx the parse tree
*/
enterAlertView?: (ctx: AlertViewContext) => void;
enterAlterView?: (ctx: AlterViewContext) => void;
/**
* Exit a parse tree produced by `FlinkSqlParser.alertView`.
* Exit a parse tree produced by `FlinkSqlParser.alterView`.
* @param ctx the parse tree
*/
exitAlertView?: (ctx: AlertViewContext) => void;
exitAlterView?: (ctx: AlterViewContext) => void;
/**
* Enter a parse tree produced by `FlinkSqlParser.alterDatabase`.
* @param ctx the parse tree
Expand Down
6 changes: 3 additions & 3 deletions src/lib/flink/FlinkSqlParserVisitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import { AddConstraintContext } from "./FlinkSqlParser.js";
import { DropConstraintContext } from "./FlinkSqlParser.js";
import { AddUniqueContext } from "./FlinkSqlParser.js";
import { NotForcedContext } from "./FlinkSqlParser.js";
import { AlertViewContext } from "./FlinkSqlParser.js";
import { AlterViewContext } from "./FlinkSqlParser.js";
import { AlterDatabaseContext } from "./FlinkSqlParser.js";
import { AlterFunctionContext } from "./FlinkSqlParser.js";
import { DropCatalogContext } from "./FlinkSqlParser.js";
Expand Down Expand Up @@ -624,11 +624,11 @@ export class FlinkSqlParserVisitor<Result> extends AbstractParseTreeVisitor<Resu
*/
visitNotForced?: (ctx: NotForcedContext) => Result;
/**
* Visit a parse tree produced by `FlinkSqlParser.alertView`.
* Visit a parse tree produced by `FlinkSqlParser.alterView`.
* @param ctx the parse tree
* @return the visitor result
*/
visitAlertView?: (ctx: AlertViewContext) => Result;
visitAlterView?: (ctx: AlterViewContext) => Result;
/**
* Visit a parse tree produced by `FlinkSqlParser.alterDatabase`.
* @param ctx the parse tree
Expand Down
2 changes: 1 addition & 1 deletion src/lib/impala/ImpalaSqlLexer.interp

Large diffs are not rendered by default.

Loading
Loading