Skip to content

Commit 584a878

Browse files
[8.18] Update lexer / parser and fix the categorize function (#209964) (#210032)
# Backport This will backport the following commits from `main` to `8.18`: - [Update lexer / parser and fix the categorize function (#209964)](#209964) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Stratoula Kalafateli","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-02-06T14:57:02Z","message":"Update lexer / parser and fix the categorize function (#209964)\n\n## Summary\n\n- Fixes the categorize wrong autocomplete suggestions\n- Updates the lexer / parser as I want this to get merged in 8.18 / 9.0","sha":"ee866a745a23efd7442262232f149080fa4de609","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Feature:ES|QL","Team:ESQL","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"Update lexer / parser and fix the categorize function","number":209964,"url":"https://github.com/elastic/kibana/pull/209964","mergeCommit":{"message":"Update lexer / parser and fix the categorize function (#209964)\n\n## Summary\n\n- Fixes the categorize wrong autocomplete suggestions\n- Updates the lexer / parser as I want this to get merged in 8.18 / 9.0","sha":"ee866a745a23efd7442262232f149080fa4de609"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/209964","number":209964,"mergeCommit":{"message":"Update lexer / parser and fix the categorize function (#209964)\n\n## Summary\n\n- Fixes the categorize wrong autocomplete suggestions\n- Updates the lexer / parser as I want this to get merged in 8.18 / 9.0","sha":"ee866a745a23efd7442262232f149080fa4de609"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Stratoula Kalafateli <[email protected]>
1 parent a9233d8 commit 584a878

File tree

12 files changed

+831
-916
lines changed

12 files changed

+831
-916
lines changed

src/platform/packages/shared/kbn-esql-ast/src/antlr/esql_lexer.g4

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// DO NOT MODIFY THIS FILE BY HAND. IT IS MANAGED BY A CI JOB.
2-
31
/*
42
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
53
* or more contributor license agreements. Licensed under the Elastic License
@@ -316,8 +314,8 @@ mode PROJECT_MODE;
316314
PROJECT_PIPE : PIPE -> type(PIPE), popMode;
317315
PROJECT_DOT: DOT -> type(DOT);
318316
PROJECT_COMMA : COMMA -> type(COMMA);
319-
PROJECT_PARAM : {this.isDevVersion()}? PARAM -> type(PARAM);
320-
PROJECT_NAMED_OR_POSITIONAL_PARAM : {this.isDevVersion()}? NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
317+
PROJECT_PARAM : PARAM -> type(PARAM);
318+
PROJECT_NAMED_OR_POSITIONAL_PARAM : NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
321319
322320
fragment UNQUOTED_ID_BODY_WITH_PATTERN
323321
: (LETTER | DIGIT | UNDERSCORE | ASTERISK)
@@ -351,8 +349,8 @@ RENAME_PIPE : PIPE -> type(PIPE), popMode;
351349
RENAME_ASSIGN : ASSIGN -> type(ASSIGN);
352350
RENAME_COMMA : COMMA -> type(COMMA);
353351
RENAME_DOT: DOT -> type(DOT);
354-
RENAME_PARAM : {this.isDevVersion()}? PARAM -> type(PARAM);
355-
RENAME_NAMED_OR_POSITIONAL_PARAM : {this.isDevVersion()}? NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
352+
RENAME_PARAM : PARAM -> type(PARAM);
353+
RENAME_NAMED_OR_POSITIONAL_PARAM : NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
356354
357355
AS : 'as';
358356
@@ -424,8 +422,8 @@ ENRICH_FIELD_QUOTED_IDENTIFIER
424422
: QUOTED_IDENTIFIER -> type(QUOTED_IDENTIFIER)
425423
;
426424

427-
ENRICH_FIELD_PARAM : {this.isDevVersion()}? PARAM -> type(PARAM);
428-
ENRICH_FIELD_NAMED_OR_POSITIONAL_PARAM : {this.isDevVersion()}? NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
425+
ENRICH_FIELD_PARAM : PARAM -> type(PARAM);
426+
ENRICH_FIELD_NAMED_OR_POSITIONAL_PARAM : NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
429427

430428
ENRICH_FIELD_LINE_COMMENT
431429
: LINE_COMMENT -> channel(HIDDEN)
@@ -442,8 +440,8 @@ ENRICH_FIELD_WS
442440
mode MVEXPAND_MODE;
443441
MVEXPAND_PIPE : PIPE -> type(PIPE), popMode;
444442
MVEXPAND_DOT: DOT -> type(DOT);
445-
MVEXPAND_PARAM : {this.isDevVersion()}? PARAM -> type(PARAM);
446-
MVEXPAND_NAMED_OR_POSITIONAL_PARAM : {this.isDevVersion()}? NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
443+
MVEXPAND_PARAM : PARAM -> type(PARAM);
444+
MVEXPAND_NAMED_OR_POSITIONAL_PARAM : NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
447445

448446
MVEXPAND_QUOTED_IDENTIFIER
449447
: QUOTED_IDENTIFIER -> type(QUOTED_IDENTIFIER)

src/platform/packages/shared/kbn-esql-ast/src/antlr/esql_lexer.interp

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

src/platform/packages/shared/kbn-esql-ast/src/antlr/esql_lexer.ts

Lines changed: 471 additions & 547 deletions
Large diffs are not rendered by default.

src/platform/packages/shared/kbn-esql-ast/src/antlr/esql_parser.g4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ identifier
195195

196196
identifierPattern
197197
: ID_PATTERN
198-
| {this.isDevVersion()}? parameter
198+
| parameter
199199
;
200200

201201
constant
@@ -218,7 +218,7 @@ parameter
218218

219219
identifierOrParameter
220220
: identifier
221-
| {this.isDevVersion()}? parameter
221+
| parameter
222222
;
223223

224224
limitCommand

src/platform/packages/shared/kbn-esql-ast/src/antlr/esql_parser.interp

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

0 commit comments

Comments
 (0)