X-Git-Url: https://git.r.bdr.sh/rbdr/tree-sitter-api-notation/blobdiff_plain/0931d6ef75e5dc37ba6bd7bb92c369d1df99e6d3..4a1d56285559545a56cb7c79a0ea1564f01e09e5:/grammar.js?ds=sidebyside diff --git a/grammar.js b/grammar.js index e74c27b..db1219d 100644 --- a/grammar.js +++ b/grammar.js @@ -83,12 +83,20 @@ module.exports = grammar({ ) ), 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,