X-Git-Url: https://git.r.bdr.sh/rbdr/tree-sitter-api-notation/blobdiff_plain/dc87cd894bad9ad0202dcd4a89e7d0af47c53fc9..4a1d56285559545a56cb7c79a0ea1564f01e09e5:/grammar.js?ds=inline 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,