]> git.r.bdr.sh - rbdr/tree-sitter-api-notation/blame_incremental - src/grammar.json
Define identifiers as type definitions
[rbdr/tree-sitter-api-notation] / src / grammar.json
... / ...
CommitLineData
1{
2 "name": "api_notation",
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": "CHOICE",
320 "members": [
321 {
322 "type": "SYMBOL",
323 "name": "optional_value"
324 },
325 {
326 "type": "SYMBOL",
327 "name": "_label"
328 }
329 ]
330 },
331 {
332 "type": "CHOICE",
333 "members": [
334 {
335 "type": "SYMBOL",
336 "name": "type_annotation"
337 },
338 {
339 "type": "BLANK"
340 }
341 ]
342 },
343 {
344 "type": "CHOICE",
345 "members": [
346 {
347 "type": "SYMBOL",
348 "name": "parameter_list"
349 },
350 {
351 "type": "BLANK"
352 }
353 ]
354 },
355 {
356 "type": "CHOICE",
357 "members": [
358 {
359 "type": "SYMBOL",
360 "name": "return_statement"
361 },
362 {
363 "type": "BLANK"
364 }
365 ]
366 },
367 {
368 "type": "CHOICE",
369 "members": [
370 {
371 "type": "SYMBOL",
372 "name": "throw_statement"
373 },
374 {
375 "type": "BLANK"
376 }
377 ]
378 }
379 ]
380 }
381 },
382 "optional_value": {
383 "type": "SEQ",
384 "members": [
385 {
386 "type": "STRING",
387 "value": "["
388 },
389 {
390 "type": "SYMBOL",
391 "name": "_label"
392 },
393 {
394 "type": "STRING",
395 "value": "]"
396 }
397 ]
398 },
399 "type_annotation": {
400 "type": "SEQ",
401 "members": [
402 {
403 "type": "STRING",
404 "value": "<"
405 },
406 {
407 "type": "SYMBOL",
408 "name": "_entry_list"
409 },
410 {
411 "type": "STRING",
412 "value": ">"
413 }
414 ]
415 },
416 "comment": {
417 "type": "SEQ",
418 "members": [
419 {
420 "type": "STRING",
421 "value": "//"
422 },
423 {
424 "type": "PATTERN",
425 "value": "[^\\n]*"
426 },
427 {
428 "type": "SYMBOL",
429 "name": "_newline"
430 }
431 ]
432 },
433 "_label": {
434 "type": "PATTERN",
435 "value": "[a-zA-Z0-9][a-zA-Z0-9_-]*"
436 },
437 "_newline": {
438 "type": "TOKEN",
439 "content": {
440 "type": "STRING",
441 "value": "\n"
442 }
443 }
444 },
445 "extras": [
446 {
447 "type": "PATTERN",
448 "value": "\\s"
449 }
450 ],
451 "conflicts": [],
452 "precedences": [],
453 "externals": [],
454 "inline": [],
455 "supertypes": []
456}
457