Add 'any' select pattern

This commit is contained in:
Bruno BELANYI 2024-07-01 13:46:22 +00:00
parent 2326d709fb
commit 970241b323
5 changed files with 981 additions and 916 deletions

View file

@ -163,6 +163,7 @@ module.exports = grammar({
_select_pattern: ($) => choice( _select_pattern: ($) => choice(
$._string_literal, $._string_literal,
$.boolean_literal, $.boolean_literal,
alias("any", $.any),
alias("default", $.default), alias("default", $.default),
), ),

9
src/grammar.json generated
View file

@ -735,6 +735,15 @@
"type": "SYMBOL", "type": "SYMBOL",
"name": "boolean_literal" "name": "boolean_literal"
}, },
{
"type": "ALIAS",
"content": {
"type": "STRING",
"value": "any"
},
"named": true,
"value": "any"
},
{ {
"type": "ALIAS", "type": "ALIAS",
"content": { "content": {

8
src/node-types.json generated
View file

@ -483,6 +483,10 @@
"multiple": true, "multiple": true,
"required": true, "required": true,
"types": [ "types": [
{
"type": "any",
"named": true
},
{ {
"type": "boolean_literal", "type": "boolean_literal",
"named": true "named": true
@ -584,6 +588,10 @@
"type": "]", "type": "]",
"named": false "named": false
}, },
{
"type": "any",
"named": true
},
{ {
"type": "default", "type": "default",
"named": true "named": true

1874
src/parser.c generated

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@ Select
foo = select(release_variable("RELEASE_TEST"), { foo = select(release_variable("RELEASE_TEST"), {
"d": "d2", "d": "d2",
any: unset,
default: unset, default: unset,
}) })
@ -23,6 +24,10 @@ foo = select(release_variable("RELEASE_TEST"), {
(select_pattern (select_pattern
(interpreted_string_literal)) (interpreted_string_literal))
(interpreted_string_literal)) (interpreted_string_literal))
(select_case
(select_pattern
(any))
(unset))
(select_case (select_case
(select_pattern (select_pattern
(default)) (default))