Add boolean-typed select values
This commit is contained in:
parent
3bc77aab19
commit
7d8f958a90
|
@ -143,6 +143,7 @@ module.exports = grammar({
|
|||
select_case: ($) => seq(
|
||||
field("pattern", choice(
|
||||
$._string_literal,
|
||||
$.boolean_literal,
|
||||
alias("default", $.default),
|
||||
)),
|
||||
":",
|
||||
|
|
4
src/grammar.json
generated
4
src/grammar.json
generated
|
@ -606,6 +606,10 @@
|
|||
"type": "SYMBOL",
|
||||
"name": "_string_literal"
|
||||
},
|
||||
{
|
||||
"type": "SYMBOL",
|
||||
"name": "boolean_literal"
|
||||
},
|
||||
{
|
||||
"type": "ALIAS",
|
||||
"content": {
|
||||
|
|
4
src/node-types.json
generated
4
src/node-types.json
generated
|
@ -353,6 +353,10 @@
|
|||
"multiple": false,
|
||||
"required": true,
|
||||
"types": [
|
||||
{
|
||||
"type": "boolean_literal",
|
||||
"named": true
|
||||
},
|
||||
{
|
||||
"type": "default",
|
||||
"named": true
|
||||
|
|
2356
src/parser.c
generated
2356
src/parser.c
generated
File diff suppressed because it is too large
Load diff
|
@ -226,6 +226,33 @@ foo = select(release_variable("ONE", "TWO"), {
|
|||
(default)
|
||||
(interpreted_string_literal))))))
|
||||
|
||||
================================================================================
|
||||
Select (boolean typed)
|
||||
================================================================================
|
||||
|
||||
foo = select(some_boolean("IS_TRUE"), {
|
||||
true: "true",
|
||||
false: "false",
|
||||
})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(assignment
|
||||
(identifier)
|
||||
(operator)
|
||||
(select_expression
|
||||
(select_value
|
||||
(identifier)
|
||||
(interpreted_string_literal))
|
||||
(select_cases
|
||||
(select_case
|
||||
(boolean_literal)
|
||||
(interpreted_string_literal))
|
||||
(select_case
|
||||
(boolean_literal)
|
||||
(interpreted_string_literal))))))
|
||||
|
||||
================================================================================
|
||||
Select as an identifier
|
||||
================================================================================
|
||||
|
|
Loading…
Reference in a new issue