module.exports = grammar({
- name: 'apinotation',
+ name: 'api_notation',
rules: {
source_file: $ => repeat(
)
),
identifier: $ => prec.left(seq(
- $._label,
+ choice(
+ $.optional_value,
+ $._label,
+ ),
optional($.type_annotation),
optional($.parameter_list),
optional($.return_statement),
optional($.throw_statement),
)),
+ optional_value: $ => seq(
+ '[',
+ $._label,
+ ']'
+ ),
type_annotation: $ => seq(
'<',
$._entry_list,