parent
4cfd843564
commit
a50309bec1
4 changed files with 33 additions and 0 deletions
|
|
@ -118,6 +118,7 @@ module.exports = grammar({
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
|
|
||||||
|
// FIXME
|
||||||
select_expression: ($) => seq(
|
select_expression: ($) => seq(
|
||||||
"select",
|
"select",
|
||||||
"(",
|
"(",
|
||||||
|
|
@ -127,6 +128,7 @@ module.exports = grammar({
|
||||||
")",
|
")",
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// FIXME
|
||||||
select_value: ($) => seq(
|
select_value: ($) => seq(
|
||||||
field("type", alias(
|
field("type", alias(
|
||||||
choice("product_variable", "release_variable", "variant"),
|
choice("product_variable", "release_variable", "variant"),
|
||||||
|
|
@ -137,6 +139,7 @@ module.exports = grammar({
|
||||||
")",
|
")",
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// FIXME
|
||||||
soong_config_variable: ($) => seq(
|
soong_config_variable: ($) => seq(
|
||||||
field("type", alias("soong_config_variable", $.selection_type)),
|
field("type", alias("soong_config_variable", $.selection_type)),
|
||||||
"(",
|
"(",
|
||||||
|
|
@ -151,6 +154,7 @@ module.exports = grammar({
|
||||||
")",
|
")",
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// FIXME should probably be hidden completely
|
||||||
select_cases: ($) => seq(
|
select_cases: ($) => seq(
|
||||||
"{",
|
"{",
|
||||||
optional(trailingCommaSeparated($.select_case)),
|
optional(trailingCommaSeparated($.select_case)),
|
||||||
|
|
@ -159,12 +163,14 @@ module.exports = grammar({
|
||||||
"}",
|
"}",
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// FIXME: Do I really need to account for default_case is being different?
|
||||||
select_case: ($) => seq(
|
select_case: ($) => seq(
|
||||||
field("pattern", $._string_literal),
|
field("pattern", $._string_literal),
|
||||||
":",
|
":",
|
||||||
field("value", $._case_value)
|
field("value", $._case_value)
|
||||||
),
|
),
|
||||||
|
|
||||||
|
// FIXME
|
||||||
default_case: ($) => seq(
|
default_case: ($) => seq(
|
||||||
field("pattern", "default"),
|
field("pattern", "default"),
|
||||||
":",
|
":",
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,15 @@
|
||||||
field: (identifier) @variable.member))
|
field: (identifier) @variable.member))
|
||||||
; }}}
|
; }}}
|
||||||
|
|
||||||
|
; Built-ins {{{
|
||||||
|
[
|
||||||
|
(unset)
|
||||||
|
"default"
|
||||||
|
] @variable.builtin
|
||||||
|
|
||||||
|
(selection_type) @function.builtin
|
||||||
|
; }}}
|
||||||
|
|
||||||
; Expressions {{{
|
; Expressions {{{
|
||||||
(map_expression
|
(map_expression
|
||||||
(property
|
(property
|
||||||
|
|
|
||||||
13
test/highlight/builtins.bp
Normal file
13
test/highlight/builtins.bp
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
foo = select(soong_config_variable("my_namespace", "my_var"), {
|
||||||
|
// ^ function.builtin
|
||||||
|
"foo": unset,
|
||||||
|
// ^ variable.builtin
|
||||||
|
default: true,
|
||||||
|
// <- variable.builtin
|
||||||
|
})
|
||||||
|
|
||||||
|
/* Assigning to builtins is conveniently not allowed at runtime */
|
||||||
|
unset = 12
|
||||||
|
// <- variable.builtin
|
||||||
|
default = 27
|
||||||
|
// <- variable.builtin
|
||||||
5
test/highlight/select.bp
Normal file
5
test/highlight/select.bp
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
foo = select(soong_config_variable("my_namespace", "my_var"), {
|
||||||
|
// ^ keyword.conditional
|
||||||
|
"foo": unset,
|
||||||
|
default: "bar",
|
||||||
|
})
|
||||||
Loading…
Add table
Add a link
Reference in a new issue