Skip to content

Commit

Permalink
[ES|QL] pull in multi-file grammars (#212430)
Browse files Browse the repository at this point in the history
## Summary

Resolve #210518

Successful grammar update PR!
#212442
  • Loading branch information
drewdaemon authored Feb 26, 2025
1 parent 443fd5b commit 2435a17
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 189 deletions.
6 changes: 6 additions & 0 deletions .buildkite/scripts/steps/esql_grammar_sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ set -euo pipefail
synchronize_lexer_grammar () {
license_header="$1"
source_file="$PARENT_DIR/elasticsearch/x-pack/plugin/esql/src/main/antlr/EsqlBaseLexer.g4"
source_lib_dir="$PARENT_DIR/elasticsearch/x-pack/plugin/esql/src/main/antlr/lexer"
destination_file="./src/platform/packages/shared/kbn-esql-ast/src/antlr/esql_lexer.g4"
destination_lib_dir="./src/platform/packages/shared/kbn-esql-ast/src/antlr/lexer"

# Copy the file
cp "$source_file" "$destination_file"
cp -r "$source_lib_dir" "$destination_lib_dir"

# Insert the license header
temp_file=$(mktemp)
Expand All @@ -26,10 +29,13 @@ synchronize_lexer_grammar () {
synchronize_parser_grammar () {
license_header="$1"
source_file="$PARENT_DIR/elasticsearch/x-pack/plugin/esql/src/main/antlr/EsqlBaseParser.g4"
source_lib_dir="$PARENT_DIR/elasticsearch/x-pack/plugin/esql/src/main/antlr/parser"
destination_file="./src/platform/packages/shared/kbn-esql-ast/src/antlr/esql_parser.g4"
destination_lib_dir="./src/platform/packages/shared/kbn-esql-ast/src/antlr/parser"

# Copy the file
cp "$source_file" "$destination_file"
cp -r "$source_lib_dir" "$destination_lib_dir"

# Insert the license header
temp_file=$(mktemp)
Expand Down
24 changes: 13 additions & 11 deletions src/platform/packages/shared/kbn-esql-ast/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "@kbn/esql-ast",
"version": "1.0.0",
"private": true,
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
"scripts": {
"build:antlr4:esql": "antlr -Dlanguage=TypeScript src/antlr/esql_lexer.g4 src/antlr/esql_parser.g4 && node ./scripts/fix_generated_antlr.js && node ./scripts/esql_update_ast_script.js",
"prebuild:antlr4": "brew bundle --file=./scripts/antlr4_tools/brewfile",
"build:antlr4": "npm run build:antlr4:esql"
},
"sideEffects": false
}
"name": "@kbn/esql-ast",
"version": "1.0.0",
"private": true,
"license": "Elastic License 2.0 OR AGPL-3.0-only OR SSPL-1.0",
"scripts": {
"build:antlr4:esql:parser": "antlr -Dlanguage=TypeScript -lib src/antlr/parser src/antlr/esql_parser.g4",
"build:antlr4:esql:lexer": "antlr -Dlanguage=TypeScript -lib src/antlr/lexer src/antlr/esql_lexer.g4",
"build:antlr4:esql": "npm run build:antlr4:esql:parser && npm run build:antlr4:esql:lexer",
"prebuild:antlr4": "brew bundle --file=./scripts/antlr4_tools/brewfile",
"build:antlr4": "npm run build:antlr4:esql"
},
"sideEffects": false
}

This file was deleted.

This file was deleted.

0 comments on commit 2435a17

Please sign in to comment.