]> git.r.bdr.sh - rbdr/tree-sitter-api-notation/blob - src/grammar.json
1d2d121d4fb51a72c6441010308d9c69b0c1cdd2
[rbdr/tree-sitter-api-notation] / src / grammar.json
1 {
2 "name": "apinotation",
3 "rules": {
4 "source_file": {
5 "type": "REPEAT",
6 "content": {
7 "type": "SEQ",
8 "members": [
9 {
10 "type": "CHOICE",
11 "members": [
12 {
13 "type": "SYMBOL",
14 "name": "definition"
15 },
16 {
17 "type": "SYMBOL",
18 "name": "comment"
19 }
20 ]
21 },
22 {
23 "type": "REPEAT",
24 "content": {
25 "type": "SYMBOL",
26 "name": "_newline"
27 }
28 }
29 ]
30 }
31 },
32 "definition": {
33 "type": "PREC_RIGHT",
34 "value": 0,
35 "content": {
36 "type": "SEQ",
37 "members": [
38 {
39 "type": "SYMBOL",
40 "name": "entry"
41 },
42 {
43 "type": "SYMBOL",
44 "name": "_newline"
45 },
46 {
47 "type": "REPEAT",
48 "content": {
49 "type": "CHOICE",
50 "members": [
51 {
52 "type": "SYMBOL",
53 "name": "member"
54 },
55 {
56 "type": "SYMBOL",
57 "name": "comment"
58 }
59 ]
60 }
61 }
62 ]
63 }
64 },
65 "entry": {
66 "type": "PREC_RIGHT",
67 "value": 0,
68 "content": {
69 "type": "SEQ",
70 "members": [
71 {
72 "type": "SYMBOL",
73 "name": "identifier"
74 },
75 {
76 "type": "REPEAT",
77 "content": {
78 "type": "SEQ",
79 "members": [
80 {
81 "type": "TOKEN",
82 "content": {
83 "type": "STRING",
84 "value": "."
85 }
86 },
87 {
88 "type": "SYMBOL",
89 "name": "identifier"
90 }
91 ]
92 }
93 }
94 ]
95 }
96 },
97 "member": {
98 "type": "SEQ",
99 "members": [
100 {
101 "type": "SYMBOL",
102 "name": "member_type"
103 },
104 {
105 "type": "SYMBOL",
106 "name": "_label"
107 },
108 {
109 "type": "CHOICE",
110 "members": [
111 {
112 "type": "SYMBOL",
113 "name": "type_annotation"
114 },
115 {
116 "type": "BLANK"
117 }
118 ]
119 },
120 {
121 "type": "CHOICE",
122 "members": [
123 {
124 "type": "SYMBOL",
125 "name": "parameter_list"
126 },
127 {
128 "type": "BLANK"
129 }
130 ]
131 },
132 {
133 "type": "CHOICE",
134 "members": [
135 {
136 "type": "SYMBOL",
137 "name": "return_statement"
138 },
139 {
140 "type": "BLANK"
141 }
142 ]
143 },
144 {
145 "type": "CHOICE",
146 "members": [
147 {
148 "type": "SYMBOL",
149 "name": "throw_statement"
150 },
151 {
152 "type": "BLANK"
153 }
154 ]
155 },
156 {
157 "type": "SYMBOL",
158 "name": "_newline"
159 }
160 ]
161 },
162 "member_type": {
163 "type": "CHOICE",
164 "members": [
165 {
166 "type": "STRING",
167 "value": "::"
168 },
169 {
170 "type": "STRING",
171 "value": "->"
172 },
173 {
174 "type": "STRING",
175 "value": "<-"
176 },
177 {
178 "type": "STRING",
179 "value": "~>"
180 },
181 {
182 "type": "STRING",
183 "value": "<~"
184 },
185 {
186 "type": "STRING",
187 "value": "+>"
188 },
189 {
190 "type": "STRING",
191 "value": "<+"
192 },
193 {
194 "type": "STRING",
195 "value": "#"
196 },
197 {
198 "type": "STRING",
199 "value": "+"
200 },
201 {
202 "type": "STRING",
203 "value": "-"
204 }
205 ]
206 },
207 "parameter_list": {
208 "type": "SEQ",
209 "members": [
210 {
211 "type": "STRING",
212 "value": "("
213 },
214 {
215 "type": "CHOICE",
216 "members": [
217 {
218 "type": "SYMBOL",
219 "name": "_identifier_list"
220 },
221 {
222 "type": "BLANK"
223 }
224 ]
225 },
226 {
227 "type": "STRING",
228 "value": ")"
229 }
230 ]
231 },
232 "return_statement": {
233 "type": "SEQ",
234 "members": [
235 {
236 "type": "STRING",
237 "value": "=>"
238 },
239 {
240 "type": "SYMBOL",
241 "name": "entry"
242 }
243 ]
244 },
245 "throw_statement": {
246 "type": "SEQ",
247 "members": [
248 {
249 "type": "STRING",
250 "value": "#>"
251 },
252 {
253 "type": "SYMBOL",
254 "name": "_entry_list"
255 }
256 ]
257 },
258 "_entry_list": {
259 "type": "PREC_LEFT",
260 "value": 0,
261 "content": {
262 "type": "SEQ",
263 "members": [
264 {
265 "type": "SYMBOL",
266 "name": "entry"
267 },
268 {
269 "type": "REPEAT",
270 "content": {
271 "type": "SEQ",
272 "members": [
273 {
274 "type": "STRING",
275 "value": ","
276 },
277 {
278 "type": "SYMBOL",
279 "name": "entry"
280 }
281 ]
282 }
283 }
284 ]
285 }
286 },
287 "_identifier_list": {
288 "type": "SEQ",
289 "members": [
290 {
291 "type": "SYMBOL",
292 "name": "identifier"
293 },
294 {
295 "type": "REPEAT",
296 "content": {
297 "type": "SEQ",
298 "members": [
299 {
300 "type": "STRING",
301 "value": ","
302 },
303 {
304 "type": "SYMBOL",
305 "name": "identifier"
306 }
307 ]
308 }
309 }
310 ]
311 },
312 "identifier": {
313 "type": "PREC_LEFT",
314 "value": 0,
315 "content": {
316 "type": "SEQ",
317 "members": [
318 {
319 "type": "SYMBOL",
320 "name": "_label"
321 },
322 {
323 "type": "CHOICE",
324 "members": [
325 {
326 "type": "SYMBOL",
327 "name": "type_annotation"
328 },
329 {
330 "type": "BLANK"
331 }
332 ]
333 },
334 {
335 "type": "CHOICE",
336 "members": [
337 {
338 "type": "SYMBOL",
339 "name": "parameter_list"
340 },
341 {
342 "type": "BLANK"
343 }
344 ]
345 },
346 {
347 "type": "CHOICE",
348 "members": [
349 {
350 "type": "SYMBOL",
351 "name": "return_statement"
352 },
353 {
354 "type": "BLANK"
355 }
356 ]
357 },
358 {
359 "type": "CHOICE",
360 "members": [
361 {
362 "type": "SYMBOL",
363 "name": "throw_statement"
364 },
365 {
366 "type": "BLANK"
367 }
368 ]
369 }
370 ]
371 }
372 },
373 "type_annotation": {
374 "type": "SEQ",
375 "members": [
376 {
377 "type": "STRING",
378 "value": "<"
379 },
380 {
381 "type": "SYMBOL",
382 "name": "_entry_list"
383 },
384 {
385 "type": "STRING",
386 "value": ">"
387 }
388 ]
389 },
390 "comment": {
391 "type": "SEQ",
392 "members": [
393 {
394 "type": "STRING",
395 "value": "//"
396 },
397 {
398 "type": "PATTERN",
399 "value": "[^\\n]*"
400 },
401 {
402 "type": "SYMBOL",
403 "name": "_newline"
404 }
405 ]
406 },
407 "_label": {
408 "type": "PATTERN",
409 "value": "[a-zA-Z0-9][a-zA-Z0-9_-]*"
410 },
411 "_newline": {
412 "type": "TOKEN",
413 "content": {
414 "type": "STRING",
415 "value": "\n"
416 }
417 }
418 },
419 "extras": [
420 {
421 "type": "PATTERN",
422 "value": "\\s"
423 }
424 ],
425 "conflicts": [],
426 "precedences": [],
427 "externals": [],
428 "inline": [],
429 "supertypes": []
430 }
431