mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[pkgs/peggy] unify arguments to peggy parser (#145585)
We're getting closer to building peggy outside of bazel, and would like to make configuring peggy something that is file-specific and not done by configuring a peggy cli flag. This pr moves the config to `${basename}.config.json` and then loads that in the cli instead. Down the road we'll be able to write wrappers around the peggy compiler which automatically picks up that file when it's located right next to the grammar.
This commit is contained in:
parent
6d4cadaeac
commit
c573527fc2
4 changed files with 13 additions and 5 deletions
|
@ -62,12 +62,13 @@ TYPES_DEPS = [
|
|||
peggy(
|
||||
name = "grammar",
|
||||
data = [
|
||||
":grammar/grammar.peggy"
|
||||
":grammar/grammar.peggy",
|
||||
":grammar/grammar.config.json"
|
||||
],
|
||||
output_dir = True,
|
||||
args = [
|
||||
"--allowed-start-rules",
|
||||
"start,Literal",
|
||||
"--extra-options-file",
|
||||
"./%s/grammar/grammar.config.json" % package_name(),
|
||||
"-o",
|
||||
"$(@D)/built_grammar.js",
|
||||
"./%s/grammar/grammar.peggy" % package_name()
|
||||
|
|
3
packages/kbn-es-query/grammar/grammar.config.json
Normal file
3
packages/kbn-es-query/grammar/grammar.config.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"allowedStartRules": ["start", "Literal"]
|
||||
}
|
|
@ -66,12 +66,13 @@ jsts_transpiler(
|
|||
peggy(
|
||||
name = "grammar",
|
||||
data = [
|
||||
":grammar/grammar.config.json",
|
||||
":grammar/grammar.peggy"
|
||||
],
|
||||
output_dir = True,
|
||||
args = [
|
||||
"--allowed-start-rules",
|
||||
"expression,argument",
|
||||
"--extra-options-file",
|
||||
"./%s/grammar/grammar.config.json" % package_name(),
|
||||
"-o",
|
||||
"$(@D)/built_grammar.js",
|
||||
"./%s/grammar/grammar.peggy" % package_name()
|
||||
|
|
3
packages/kbn-interpreter/grammar/grammar.config.json
Normal file
3
packages/kbn-interpreter/grammar/grammar.config.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"allowedStartRules": ["expression", "argument"]
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue