Simplify 'select_value' rule
Upstream has greatly simplified the parsing of `select` expressions, in order to add multi-valued `select`. To this end, we remove the hard-coded list of function names, and accept an arbitrary number of arguments.
This commit is contained in:
parent
8137fd3e5b
commit
1c1387fee0
5 changed files with 1375 additions and 2935 deletions
23
grammar.js
23
grammar.js
|
|
@ -121,33 +121,16 @@ module.exports = grammar({
|
|||
select_expression: ($) => seq(
|
||||
"select",
|
||||
"(",
|
||||
choice($.select_value, $.soong_config_variable),
|
||||
$.select_value,
|
||||
",",
|
||||
$.select_cases,
|
||||
")",
|
||||
),
|
||||
|
||||
select_value: ($) => seq(
|
||||
field("type", alias(
|
||||
choice("product_variable", "release_variable", "variant"),
|
||||
$.selection_type,
|
||||
)),
|
||||
field("type", alias($.identifier, $.selection_type)),
|
||||
"(",
|
||||
field("condition", $._string_literal),
|
||||
")",
|
||||
),
|
||||
|
||||
soong_config_variable: ($) => seq(
|
||||
field("type", alias("soong_config_variable", $.selection_type)),
|
||||
"(",
|
||||
field(
|
||||
"condition",
|
||||
seq(
|
||||
field("namespace", $._string_literal),
|
||||
",",
|
||||
field("variable", $._string_literal),
|
||||
),
|
||||
),
|
||||
field("condition", optional(commaSeparated($._string_literal))),
|
||||
")",
|
||||
),
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue