|
|
|
|
@ -210,7 +210,7 @@ module.exports = grammar({
|
|
|
|
|
|
|
|
|
|
namespace_selectors: $ => seq(
|
|
|
|
|
'{',
|
|
|
|
|
commaSep1(choice(
|
|
|
|
|
trailingCommaSep1(choice(
|
|
|
|
|
$._namespace_given_by_type,
|
|
|
|
|
$.namespace_wildcard,
|
|
|
|
|
$.identifier,
|
|
|
|
|
@ -279,7 +279,7 @@ module.exports = grammar({
|
|
|
|
|
// make that distinction.
|
|
|
|
|
type_parameters: $ => seq(
|
|
|
|
|
'[',
|
|
|
|
|
commaSep1($._variant_type_parameter),
|
|
|
|
|
trailingCommaSep1($._variant_type_parameter),
|
|
|
|
|
']'
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
@ -599,14 +599,14 @@ module.exports = grammar({
|
|
|
|
|
class_parameters: $ => prec(1, seq(
|
|
|
|
|
'(',
|
|
|
|
|
optional(choice('implicit', 'using')),
|
|
|
|
|
commaSep($.class_parameter),
|
|
|
|
|
trailingCommaSep($.class_parameter),
|
|
|
|
|
')'
|
|
|
|
|
)),
|
|
|
|
|
|
|
|
|
|
parameters: $ => seq(
|
|
|
|
|
'(',
|
|
|
|
|
optional(choice('implicit', 'using')),
|
|
|
|
|
commaSep($.parameter),
|
|
|
|
|
trailingCommaSep($.parameter),
|
|
|
|
|
')'
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
@ -704,7 +704,7 @@ module.exports = grammar({
|
|
|
|
|
|
|
|
|
|
tuple_type: $ => seq(
|
|
|
|
|
'(',
|
|
|
|
|
commaSep1($._type),
|
|
|
|
|
trailingCommaSep1($._type),
|
|
|
|
|
')',
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
@ -747,7 +747,7 @@ module.exports = grammar({
|
|
|
|
|
parameter_types: $ => prec(-1, choice(
|
|
|
|
|
$._annotated_type,
|
|
|
|
|
// Prioritize a parenthesized param list over a single tuple_type.
|
|
|
|
|
prec.dynamic(1, seq('(', commaSep($._param_type), ')' )),
|
|
|
|
|
prec.dynamic(1, seq('(', trailingCommaSep($._param_type), ')' )),
|
|
|
|
|
$.compound_type,
|
|
|
|
|
$.infix_type,
|
|
|
|
|
)),
|
|
|
|
|
@ -790,7 +790,7 @@ module.exports = grammar({
|
|
|
|
|
case_class_pattern: $ => seq(
|
|
|
|
|
field('type', choice($._type_identifier, $.stable_type_identifier)),
|
|
|
|
|
'(',
|
|
|
|
|
field('pattern', commaSep($._pattern)),
|
|
|
|
|
field('pattern', trailingCommaSep($._pattern)),
|
|
|
|
|
')'
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
@ -939,7 +939,7 @@ module.exports = grammar({
|
|
|
|
|
|
|
|
|
|
bindings: $ => seq(
|
|
|
|
|
'(',
|
|
|
|
|
commaSep($.binding),
|
|
|
|
|
trailingCommaSep($.binding),
|
|
|
|
|
')',
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
@ -1098,6 +1098,7 @@ module.exports = grammar({
|
|
|
|
|
'(',
|
|
|
|
|
$.expression,
|
|
|
|
|
repeat1(seq(',', $.expression)),
|
|
|
|
|
optional(','),
|
|
|
|
|
')'
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
@ -1109,13 +1110,13 @@ module.exports = grammar({
|
|
|
|
|
|
|
|
|
|
type_arguments: $ => seq(
|
|
|
|
|
'[',
|
|
|
|
|
commaSep1($._type),
|
|
|
|
|
trailingCommaSep1($._type),
|
|
|
|
|
']'
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
arguments: $ => seq(
|
|
|
|
|
'(',
|
|
|
|
|
commaSep($.expression),
|
|
|
|
|
trailingCommaSep($.expression),
|
|
|
|
|
')'
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
@ -1428,6 +1429,18 @@ function commaSep1(rule) {
|
|
|
|
|
return sep1(',', rule)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function trailingCommaSep(rule) {
|
|
|
|
|
return optional(trailingCommaSep1(rule))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function trailingCommaSep1(rule) {
|
|
|
|
|
return trailingSep1(',', rule)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function trailingSep1(delimiter, rule) {
|
|
|
|
|
return seq(sep1(delimiter, rule), optional(delimiter))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sep1(delimiter, rule) {
|
|
|
|
|
return seq(rule, repeat(seq(delimiter, rule)))
|
|
|
|
|
}
|
|
|
|
|
|