Skip to content

Commit 2ce80c7

Browse files
committed
Address review comments
1 parent 6f52fe9 commit 2ce80c7

File tree

10 files changed

+1149
-1147
lines changed

10 files changed

+1149
-1147
lines changed

x-pack/plugin/esql/src/main/antlr/lexer/ChangePoint.g4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CHANGE_POINT : 'change_point' -> pushMode(CHANGE_POINT_MODE);
1313

1414
mode CHANGE_POINT_MODE;
1515
CHANGE_POINT_PIPE : PIPE -> type(PIPE), popMode;
16+
// explicit popMode of RP to allow CHANGE_POINT in FORK branches
1617
CHANGE_POINT_RP : RP -> type(RP), popMode, popMode;
1718
CHANGE_POINT_ON : ON -> type(ON);
1819
CHANGE_POINT_AS : AS -> type(AS);

x-pack/plugin/esql/src/main/antlr/lexer/Enrich.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ ENRICH : 'enrich' -> pushMode(ENRICH_MODE);
1414

1515
mode ENRICH_MODE;
1616
ENRICH_PIPE : PIPE -> type(PIPE), popMode;
17+
// explicit popMode of RP to allow ENRICH in FORK branches
1718
ENRICH_RP : RP -> type(RP), popMode, popMode;
1819
ENRICH_OPENING_BRACKET : OPENING_BRACKET -> type(OPENING_BRACKET), pushMode(SETTING_MODE);
1920

@@ -84,7 +85,6 @@ ENRICH_FIELD_WS
8485
8586
mode SETTING_MODE;
8687
SETTING_CLOSING_BRACKET : CLOSING_BRACKET -> type(CLOSING_BRACKET), popMode;
87-
SETTING_RP : RP -> type(RP), popMode, popMode, popMode;
8888
8989
SETTING_COLON : COLON -> type(COLON);
9090

x-pack/plugin/esql/src/main/antlr/lexer/Fork.g4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ lexer grammar Fork;
1212
DEV_FORK : {this.isDevVersion()}? 'fork' -> pushMode(FORK_MODE);
1313

1414
mode FORK_MODE;
15+
// commands needs to break out of their mode and the default mode when they encounter RP
1516
FORK_LP : LP -> type(LP), pushMode(DEFAULT_MODE);
17+
// explicit popMode of RP to allow FORK in FORK branches
1618
FORK_RP : RP -> type(RP), popMode, popMode;
1719
FORK_PIPE : PIPE -> type(PIPE), popMode;
1820

x-pack/plugin/esql/src/main/antlr/lexer/Lookup.g4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ DEV_LOOKUP : {this.isDevVersion()}? 'lookup_🐔' -> pushMode(LOOKUP_M
1313

1414
mode LOOKUP_MODE;
1515
LOOKUP_PIPE : PIPE -> type(PIPE), popMode;
16+
// explicit popMode of RP to allow lookup_🐔 in FORK branches
1617
LOOKUP_RP : RP -> type(RP), popMode, popMode;
1718
LOOKUP_COLON : COLON -> type(COLON);
1819
LOOKUP_COMMA : COMMA -> type(COMMA);

x-pack/plugin/esql/src/main/antlr/lexer/MvExpand.g4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ MV_EXPAND : 'mv_expand' -> pushMode(MVEXPAND_MODE);
1414

1515
mode MVEXPAND_MODE;
1616
MVEXPAND_PIPE : PIPE -> type(PIPE), popMode;
17+
// explicit popMode of RP to allow MV_EXPAND in FORK branches
1718
MVEXPAND_RP : RP -> type(RP), popMode, popMode;
1819
MVEXPAND_DOT: DOT -> type(DOT);
1920
MVEXPAND_PARAM : PARAM -> type(PARAM);

x-pack/plugin/esql/src/main/antlr/lexer/Project.g4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ DEV_INSIST : {this.isDevVersion()}? 'insist_🐔' -> pushMode(PROJECT_
1515

1616
mode PROJECT_MODE;
1717
PROJECT_PIPE : PIPE -> type(PIPE), popMode;
18+
// explicit popMode of RP to allow DROP and KEEP in FORK branches
1819
PROJECT_RP : RP -> type(RP), popMode, popMode;
1920
PROJECT_DOT: DOT -> type(DOT);
2021
PROJECT_COMMA : COMMA -> type(COMMA);

x-pack/plugin/esql/src/main/antlr/lexer/Rename.g4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ RENAME : 'rename' -> pushMode(RENAME_MODE);
1414

1515
mode RENAME_MODE;
1616
RENAME_PIPE : PIPE -> type(PIPE), popMode;
17+
// explicit popMode of RP to allow RENAME in FORK branches
1718
RENAME_RP : RP -> type(RP), popMode, popMode;
1819
RENAME_ASSIGN : ASSIGN -> type(ASSIGN);
1920
RENAME_COMMA : COMMA -> type(COMMA);

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseLexer.interp

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/EsqlBaseLexer.java

Lines changed: 1138 additions & 1144 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/StatementParserTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3336,6 +3336,8 @@ public void testInvalidFork() {
33363336

33373337
expectError("FROM foo* | FORK ( x+1 ) ( WHERE y>2 )", "line 1:20: mismatched input 'x+1'");
33383338
expectError("FROM foo* | FORK ( LIMIT 10 ) ( y+2 )", "line 1:33: mismatched input 'y+2'");
3339+
expectError("FROM foo* | FORK (where true) ()", "line 1:32: mismatched input ')'");
3340+
expectError("FROM foo* | FORK () (where true)", "line 1:19: mismatched input ')'");
33393341
}
33403342

33413343
public void testFieldNamesAsCommands() throws Exception {

0 commit comments

Comments
 (0)