Skip to content

Commit

Permalink
[8.x] [ES|QL] Update grammars (elastic#196046) (elastic#196320)
Browse files Browse the repository at this point in the history
# Backport

This will backport the following commits from `main` to `8.x`:
- [[ES|QL] Update grammars
(elastic#196046)](elastic#196046)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Kibana
Machine","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-10-15T13:47:08Z","message":"[ES|QL]
Update grammars (elastic#196046)\n\nThis PR updates the ES|QL grammars (lexer
and parser) to match the\r\nlatest version in
Elasticsearch.\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula
Kalafateli
<[email protected]>","sha":"bed5c4e9fe0cf5acc2e5b3326ca306134bc18891","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-minor","Feature:ES|QL","Team:ESQL","v8.16.0"],"title":"[ES|QL]
Update
grammars","number":196046,"url":"https://github.com/elastic/kibana/pull/196046","mergeCommit":{"message":"[ES|QL]
Update grammars (elastic#196046)\n\nThis PR updates the ES|QL grammars (lexer
and parser) to match the\r\nlatest version in
Elasticsearch.\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula
Kalafateli
<[email protected]>","sha":"bed5c4e9fe0cf5acc2e5b3326ca306134bc18891"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/196046","number":196046,"mergeCommit":{"message":"[ES|QL]
Update grammars (elastic#196046)\n\nThis PR updates the ES|QL grammars (lexer
and parser) to match the\r\nlatest version in
Elasticsearch.\r\n\r\n---------\r\n\r\nCo-authored-by: Stratoula
Kalafateli
<[email protected]>","sha":"bed5c4e9fe0cf5acc2e5b3326ca306134bc18891"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->
  • Loading branch information
kibanamachine authored Oct 15, 2024
1 parent a8cec56 commit b57c9a6
Show file tree
Hide file tree
Showing 23 changed files with 1,904 additions and 1,996 deletions.
30 changes: 9 additions & 21 deletions packages/kbn-esql-ast/src/antlr/esql_lexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ FROM : 'from' -> pushMode(FROM_MODE);
GROK : 'grok' -> pushMode(EXPRESSION_MODE);
KEEP : 'keep' -> pushMode(PROJECT_MODE);
LIMIT : 'limit' -> pushMode(EXPRESSION_MODE);
META : 'meta' -> pushMode(META_MODE);
MV_EXPAND : 'mv_expand' -> pushMode(MVEXPAND_MODE);
RENAME : 'rename' -> pushMode(RENAME_MODE);
ROW : 'row' -> pushMode(EXPRESSION_MODE);
Expand Down Expand Up @@ -309,6 +308,8 @@ mode PROJECT_MODE;
PROJECT_PIPE : PIPE -> type(PIPE), popMode;
PROJECT_DOT: DOT -> type(DOT);
PROJECT_COMMA : COMMA -> type(COMMA);
PROJECT_PARAM : PARAM -> type(PARAM);
PROJECT_NAMED_OR_POSITIONAL_PARAM : NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
fragment UNQUOTED_ID_BODY_WITH_PATTERN
: (LETTER | DIGIT | UNDERSCORE | ASTERISK)
Expand Down Expand Up @@ -342,6 +343,8 @@ RENAME_PIPE : PIPE -> type(PIPE), popMode;
RENAME_ASSIGN : ASSIGN -> type(ASSIGN);
RENAME_COMMA : COMMA -> type(COMMA);
RENAME_DOT: DOT -> type(DOT);
RENAME_PARAM : PARAM -> type(PARAM);
RENAME_NAMED_OR_POSITIONAL_PARAM : NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);
AS : 'as';
Expand Down Expand Up @@ -413,6 +416,9 @@ ENRICH_FIELD_QUOTED_IDENTIFIER
: QUOTED_IDENTIFIER -> type(QUOTED_IDENTIFIER)
;

ENRICH_FIELD_PARAM : PARAM -> type(PARAM);
ENRICH_FIELD_NAMED_OR_POSITIONAL_PARAM : NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);

ENRICH_FIELD_LINE_COMMENT
: LINE_COMMENT -> channel(HIDDEN)
;
Expand All @@ -428,6 +434,8 @@ ENRICH_FIELD_WS
mode MVEXPAND_MODE;
MVEXPAND_PIPE : PIPE -> type(PIPE), popMode;
MVEXPAND_DOT: DOT -> type(DOT);
MVEXPAND_PARAM : PARAM -> type(PARAM);
MVEXPAND_NAMED_OR_POSITIONAL_PARAM : NAMED_OR_POSITIONAL_PARAM -> type(NAMED_OR_POSITIONAL_PARAM);

MVEXPAND_QUOTED_IDENTIFIER
: QUOTED_IDENTIFIER -> type(QUOTED_IDENTIFIER)
Expand Down Expand Up @@ -469,26 +477,6 @@ SHOW_WS
: WS -> channel(HIDDEN)
;

//
// META commands
//
mode META_MODE;
META_PIPE : PIPE -> type(PIPE), popMode;

FUNCTIONS : 'functions';

META_LINE_COMMENT
: LINE_COMMENT -> channel(HIDDEN)
;

META_MULTILINE_COMMENT
: MULTILINE_COMMENT -> channel(HIDDEN)
;

META_WS
: WS -> channel(HIDDEN)
;

mode SETTING_MODE;
SETTING_CLOSING_BRACKET : CLOSING_BRACKET -> type(CLOSING_BRACKET), popMode;

Expand Down
27 changes: 9 additions & 18 deletions packages/kbn-esql-ast/src/antlr/esql_lexer.interp

Large diffs are not rendered by default.

Loading

0 comments on commit b57c9a6

Please sign in to comment.