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:
Bruno BELANYI 2024-04-23 14:47:14 +00:00
parent 8137fd3e5b
commit 1c1387fee0
5 changed files with 1375 additions and 2935 deletions

View file

@ -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))),
")",
),