Remove trailing commas in 'select_value' arguments
This commit is contained in:
parent
7d8f958a90
commit
8166742493
|
@ -2,6 +2,10 @@ function commaSeparated(elem) {
|
|||
return seq(elem, repeat(seq(",", elem)), optional(","))
|
||||
}
|
||||
|
||||
function commaSeparatedNoTrailing(elem) {
|
||||
return seq(elem, repeat(seq(",", elem)))
|
||||
}
|
||||
|
||||
function trailingCommaSeparated(elem) {
|
||||
return repeat(seq(elem, ","))
|
||||
}
|
||||
|
@ -130,7 +134,7 @@ module.exports = grammar({
|
|||
select_value: ($) => seq(
|
||||
field("name", $.identifier),
|
||||
"(",
|
||||
field("arguments", optional(commaSeparated($._string_literal))),
|
||||
field("arguments", optional(commaSeparatedNoTrailing($._string_literal))),
|
||||
")",
|
||||
),
|
||||
|
||||
|
|
12
src/grammar.json
generated
12
src/grammar.json
generated
|
@ -529,18 +529,6 @@
|
|||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "CHOICE",
|
||||
"members": [
|
||||
{
|
||||
"type": "STRING",
|
||||
"value": ","
|
||||
},
|
||||
{
|
||||
"type": "BLANK"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
1471
src/parser.c
generated
1471
src/parser.c
generated
File diff suppressed because it is too large
Load diff
|
@ -226,6 +226,34 @@ foo = select(release_variable("ONE", "TWO"), {
|
|||
(default)
|
||||
(interpreted_string_literal))))))
|
||||
|
||||
================================================================================
|
||||
Select (trailing comma in arguments)
|
||||
================================================================================
|
||||
|
||||
foo = select(some_boolean("VALUE",), {
|
||||
true: "true",
|
||||
false: "false",
|
||||
})
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
(source_file
|
||||
(assignment
|
||||
(identifier)
|
||||
(operator)
|
||||
(select_expression
|
||||
(select_value
|
||||
(identifier)
|
||||
(interpreted_string_literal)
|
||||
(ERROR))
|
||||
(select_cases
|
||||
(select_case
|
||||
(boolean_literal)
|
||||
(interpreted_string_literal))
|
||||
(select_case
|
||||
(boolean_literal)
|
||||
(interpreted_string_literal))))))
|
||||
|
||||
================================================================================
|
||||
Select (boolean typed)
|
||||
================================================================================
|
||||
|
|
Loading…
Reference in a new issue