]>
git.r.bdr.sh - rbdr/tree-sitter-api-notation/blob - grammar.js
1 module
.exports
= grammar({
5 source_file: $ => repeat(
14 definition: $ => prec
.right(seq(
24 entry: $ => prec
.right(seq(
36 optional($.type_annotation
),
37 optional($.parameter_list
),
38 optional($.return_statement
),
39 optional($.throw_statement
),
42 member_type: $ => choice(
54 parameter_list: $ => seq(
56 optional($._identifier_list
),
59 return_statement: $ => seq(
63 throw_statement: $ => seq(
67 _entry_list: $ => prec
.left(seq(
76 _identifier_list: $ => seq(
85 identifier: $ => prec
.left(seq(
90 optional($.type_annotation
),
91 optional($.parameter_list
),
92 optional($.return_statement
),
93 optional($.throw_statement
),
95 optional_value: $ => seq(
100 type_annotation: $ => seq(
110 _label: $ => /[a-zA-Z0-9][a-zA-Z0-9_-]*/,
111 _newline: $ => token('\n')