tree-sitter-fd 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/grammar.js +23 -16
- package/package.json +1 -1
- package/queries/highlights.scm +3 -3
- package/src/grammar.json +62 -26
- package/src/node-types.json +97 -73
- package/src/parser.c +2523 -3148
- package/src/tree_sitter/array.h +110 -71
- package/src/tree_sitter/parser.h +27 -7
package/grammar.js
CHANGED
|
@@ -20,38 +20,45 @@ module.exports = grammar({
|
|
|
20
20
|
$.style_block,
|
|
21
21
|
$.node_declaration,
|
|
22
22
|
$.constraint_line,
|
|
23
|
-
$.
|
|
23
|
+
$.spec_block,
|
|
24
24
|
),
|
|
25
25
|
),
|
|
26
26
|
|
|
27
27
|
// ─── Comments ────────────────────────────────────────────
|
|
28
28
|
comment: (_$) => token(prec(-1, seq("#", /[^#\n][^\n]*/))),
|
|
29
29
|
|
|
30
|
-
// ───
|
|
31
|
-
|
|
30
|
+
// ─── Spec Block ─────────────────────────────────────────
|
|
31
|
+
spec_block: ($) =>
|
|
32
32
|
seq(
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
"spec",
|
|
34
|
+
choice(
|
|
35
|
+
$.string, // Inline: spec "description"
|
|
36
|
+
seq("{", repeat($.spec_item), "}"), // Block: spec { ... }
|
|
36
37
|
),
|
|
37
38
|
),
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
spec_item: ($) =>
|
|
41
|
+
choice(
|
|
42
|
+
$.spec_typed,
|
|
43
|
+
$.string,
|
|
44
|
+
),
|
|
45
|
+
|
|
46
|
+
spec_typed: ($) =>
|
|
40
47
|
seq(
|
|
41
|
-
field("key", $.
|
|
48
|
+
field("key", $.spec_keyword),
|
|
42
49
|
":",
|
|
43
|
-
field("value", choice($.string, $.
|
|
50
|
+
field("value", choice($.string, $.spec_text)),
|
|
44
51
|
),
|
|
45
52
|
|
|
46
|
-
|
|
53
|
+
spec_text: (_$) => /[^\n}]+/,
|
|
47
54
|
|
|
48
|
-
|
|
55
|
+
spec_keyword: (_$) =>
|
|
49
56
|
choice("accept", "status", "priority", "tag"),
|
|
50
57
|
|
|
51
|
-
// ─── Style Block
|
|
58
|
+
// ─── Style/Theme Block ──────────────────────────────────
|
|
52
59
|
style_block: ($) =>
|
|
53
60
|
seq(
|
|
54
|
-
"style",
|
|
61
|
+
choice("theme", "style"),
|
|
55
62
|
field("name", $.identifier),
|
|
56
63
|
"{",
|
|
57
64
|
repeat($.property),
|
|
@@ -76,7 +83,7 @@ module.exports = grammar({
|
|
|
76
83
|
$.property,
|
|
77
84
|
$.node_declaration,
|
|
78
85
|
$.anim_block,
|
|
79
|
-
$.
|
|
86
|
+
$.spec_block,
|
|
80
87
|
),
|
|
81
88
|
|
|
82
89
|
// ─── Properties ──────────────────────────────────────────
|
|
@@ -109,10 +116,10 @@ module.exports = grammar({
|
|
|
109
116
|
key_value_pair: ($) =>
|
|
110
117
|
prec(1, seq($.identifier, "=", choice($.number, $.hex_color, $.string, $.identifier))),
|
|
111
118
|
|
|
112
|
-
// ─── Animation Block
|
|
119
|
+
// ─── When/Animation Block ────────────────────────────────
|
|
113
120
|
anim_block: ($) =>
|
|
114
121
|
seq(
|
|
115
|
-
"anim",
|
|
122
|
+
choice("when", "anim"),
|
|
116
123
|
field("trigger", $.anim_trigger),
|
|
117
124
|
"{",
|
|
118
125
|
repeat($.property),
|
package/package.json
CHANGED
package/queries/highlights.scm
CHANGED
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
; ─── Properties ────────────────────────────────────────────
|
|
18
18
|
(property_name) @property
|
|
19
19
|
|
|
20
|
-
; ───
|
|
21
|
-
"
|
|
22
|
-
(
|
|
20
|
+
; ─── Spec Blocks ───────────────────────────────────────────
|
|
21
|
+
"spec" @keyword
|
|
22
|
+
(spec_keyword) @attribute
|
|
23
23
|
|
|
24
24
|
; ─── Animation trigger ─────────────────────────────────────
|
|
25
25
|
(anim_trigger
|
package/src/grammar.json
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"type": "SYMBOL",
|
|
24
|
-
"name": "
|
|
24
|
+
"name": "spec_block"
|
|
25
25
|
}
|
|
26
26
|
]
|
|
27
27
|
}
|
|
@@ -46,41 +46,58 @@
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
|
-
"
|
|
49
|
+
"spec_block": {
|
|
50
50
|
"type": "SEQ",
|
|
51
51
|
"members": [
|
|
52
52
|
{
|
|
53
53
|
"type": "STRING",
|
|
54
|
-
"value": "
|
|
54
|
+
"value": "spec"
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
57
|
"type": "CHOICE",
|
|
58
58
|
"members": [
|
|
59
59
|
{
|
|
60
|
-
"type": "
|
|
60
|
+
"type": "SYMBOL",
|
|
61
|
+
"name": "string"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"type": "SEQ",
|
|
61
65
|
"members": [
|
|
62
66
|
{
|
|
63
|
-
"type": "
|
|
64
|
-
"
|
|
67
|
+
"type": "STRING",
|
|
68
|
+
"value": "{"
|
|
65
69
|
},
|
|
66
70
|
{
|
|
67
|
-
"type": "
|
|
68
|
-
"
|
|
71
|
+
"type": "REPEAT",
|
|
72
|
+
"content": {
|
|
73
|
+
"type": "SYMBOL",
|
|
74
|
+
"name": "spec_item"
|
|
75
|
+
}
|
|
69
76
|
},
|
|
70
77
|
{
|
|
71
|
-
"type": "
|
|
72
|
-
"
|
|
78
|
+
"type": "STRING",
|
|
79
|
+
"value": "}"
|
|
73
80
|
}
|
|
74
81
|
]
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"type": "BLANK"
|
|
78
82
|
}
|
|
79
83
|
]
|
|
80
84
|
}
|
|
81
85
|
]
|
|
82
86
|
},
|
|
83
|
-
"
|
|
87
|
+
"spec_item": {
|
|
88
|
+
"type": "CHOICE",
|
|
89
|
+
"members": [
|
|
90
|
+
{
|
|
91
|
+
"type": "SYMBOL",
|
|
92
|
+
"name": "spec_typed"
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"type": "SYMBOL",
|
|
96
|
+
"name": "string"
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
"spec_typed": {
|
|
84
101
|
"type": "SEQ",
|
|
85
102
|
"members": [
|
|
86
103
|
{
|
|
@@ -88,7 +105,7 @@
|
|
|
88
105
|
"name": "key",
|
|
89
106
|
"content": {
|
|
90
107
|
"type": "SYMBOL",
|
|
91
|
-
"name": "
|
|
108
|
+
"name": "spec_keyword"
|
|
92
109
|
}
|
|
93
110
|
},
|
|
94
111
|
{
|
|
@@ -107,18 +124,18 @@
|
|
|
107
124
|
},
|
|
108
125
|
{
|
|
109
126
|
"type": "SYMBOL",
|
|
110
|
-
"name": "
|
|
127
|
+
"name": "spec_text"
|
|
111
128
|
}
|
|
112
129
|
]
|
|
113
130
|
}
|
|
114
131
|
}
|
|
115
132
|
]
|
|
116
133
|
},
|
|
117
|
-
"
|
|
134
|
+
"spec_text": {
|
|
118
135
|
"type": "PATTERN",
|
|
119
|
-
"value": "[^\\n]+"
|
|
136
|
+
"value": "[^\\n}]+"
|
|
120
137
|
},
|
|
121
|
-
"
|
|
138
|
+
"spec_keyword": {
|
|
122
139
|
"type": "CHOICE",
|
|
123
140
|
"members": [
|
|
124
141
|
{
|
|
@@ -143,8 +160,17 @@
|
|
|
143
160
|
"type": "SEQ",
|
|
144
161
|
"members": [
|
|
145
162
|
{
|
|
146
|
-
"type": "
|
|
147
|
-
"
|
|
163
|
+
"type": "CHOICE",
|
|
164
|
+
"members": [
|
|
165
|
+
{
|
|
166
|
+
"type": "STRING",
|
|
167
|
+
"value": "theme"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"type": "STRING",
|
|
171
|
+
"value": "style"
|
|
172
|
+
}
|
|
173
|
+
]
|
|
148
174
|
},
|
|
149
175
|
{
|
|
150
176
|
"type": "FIELD",
|
|
@@ -273,7 +299,7 @@
|
|
|
273
299
|
},
|
|
274
300
|
{
|
|
275
301
|
"type": "SYMBOL",
|
|
276
|
-
"name": "
|
|
302
|
+
"name": "spec_block"
|
|
277
303
|
}
|
|
278
304
|
]
|
|
279
305
|
},
|
|
@@ -461,8 +487,17 @@
|
|
|
461
487
|
"type": "SEQ",
|
|
462
488
|
"members": [
|
|
463
489
|
{
|
|
464
|
-
"type": "
|
|
465
|
-
"
|
|
490
|
+
"type": "CHOICE",
|
|
491
|
+
"members": [
|
|
492
|
+
{
|
|
493
|
+
"type": "STRING",
|
|
494
|
+
"value": "when"
|
|
495
|
+
},
|
|
496
|
+
{
|
|
497
|
+
"type": "STRING",
|
|
498
|
+
"value": "anim"
|
|
499
|
+
}
|
|
500
|
+
]
|
|
466
501
|
},
|
|
467
502
|
{
|
|
468
503
|
"type": "FIELD",
|
|
@@ -599,5 +634,6 @@
|
|
|
599
634
|
"precedences": [],
|
|
600
635
|
"externals": [],
|
|
601
636
|
"inline": [],
|
|
602
|
-
"supertypes": []
|
|
603
|
-
}
|
|
637
|
+
"supertypes": [],
|
|
638
|
+
"reserved": {}
|
|
639
|
+
}
|
package/src/node-types.json
CHANGED
|
@@ -40,64 +40,6 @@
|
|
|
40
40
|
]
|
|
41
41
|
}
|
|
42
42
|
},
|
|
43
|
-
{
|
|
44
|
-
"type": "annotation",
|
|
45
|
-
"named": true,
|
|
46
|
-
"fields": {},
|
|
47
|
-
"children": {
|
|
48
|
-
"multiple": false,
|
|
49
|
-
"required": false,
|
|
50
|
-
"types": [
|
|
51
|
-
{
|
|
52
|
-
"type": "annotation_text",
|
|
53
|
-
"named": true
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"type": "annotation_typed",
|
|
57
|
-
"named": true
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"type": "string",
|
|
61
|
-
"named": true
|
|
62
|
-
}
|
|
63
|
-
]
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"type": "annotation_keyword",
|
|
68
|
-
"named": true,
|
|
69
|
-
"fields": {}
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
"type": "annotation_typed",
|
|
73
|
-
"named": true,
|
|
74
|
-
"fields": {
|
|
75
|
-
"key": {
|
|
76
|
-
"multiple": false,
|
|
77
|
-
"required": true,
|
|
78
|
-
"types": [
|
|
79
|
-
{
|
|
80
|
-
"type": "annotation_keyword",
|
|
81
|
-
"named": true
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
},
|
|
85
|
-
"value": {
|
|
86
|
-
"multiple": false,
|
|
87
|
-
"required": true,
|
|
88
|
-
"types": [
|
|
89
|
-
{
|
|
90
|
-
"type": "annotation_text",
|
|
91
|
-
"named": true
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"type": "string",
|
|
95
|
-
"named": true
|
|
96
|
-
}
|
|
97
|
-
]
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
43
|
{
|
|
102
44
|
"type": "constraint_line",
|
|
103
45
|
"named": true,
|
|
@@ -164,15 +106,15 @@
|
|
|
164
106
|
"required": false,
|
|
165
107
|
"types": [
|
|
166
108
|
{
|
|
167
|
-
"type": "
|
|
109
|
+
"type": "constraint_line",
|
|
168
110
|
"named": true
|
|
169
111
|
},
|
|
170
112
|
{
|
|
171
|
-
"type": "
|
|
113
|
+
"type": "node_declaration",
|
|
172
114
|
"named": true
|
|
173
115
|
},
|
|
174
116
|
{
|
|
175
|
-
"type": "
|
|
117
|
+
"type": "spec_block",
|
|
176
118
|
"named": true
|
|
177
119
|
},
|
|
178
120
|
{
|
|
@@ -222,15 +164,15 @@
|
|
|
222
164
|
"named": true
|
|
223
165
|
},
|
|
224
166
|
{
|
|
225
|
-
"type": "
|
|
167
|
+
"type": "node_declaration",
|
|
226
168
|
"named": true
|
|
227
169
|
},
|
|
228
170
|
{
|
|
229
|
-
"type": "
|
|
171
|
+
"type": "property",
|
|
230
172
|
"named": true
|
|
231
173
|
},
|
|
232
174
|
{
|
|
233
|
-
"type": "
|
|
175
|
+
"type": "spec_block",
|
|
234
176
|
"named": true
|
|
235
177
|
}
|
|
236
178
|
]
|
|
@@ -353,6 +295,79 @@
|
|
|
353
295
|
"named": true,
|
|
354
296
|
"fields": {}
|
|
355
297
|
},
|
|
298
|
+
{
|
|
299
|
+
"type": "spec_block",
|
|
300
|
+
"named": true,
|
|
301
|
+
"fields": {},
|
|
302
|
+
"children": {
|
|
303
|
+
"multiple": true,
|
|
304
|
+
"required": false,
|
|
305
|
+
"types": [
|
|
306
|
+
{
|
|
307
|
+
"type": "spec_item",
|
|
308
|
+
"named": true
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
"type": "string",
|
|
312
|
+
"named": true
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"type": "spec_item",
|
|
319
|
+
"named": true,
|
|
320
|
+
"fields": {},
|
|
321
|
+
"children": {
|
|
322
|
+
"multiple": false,
|
|
323
|
+
"required": true,
|
|
324
|
+
"types": [
|
|
325
|
+
{
|
|
326
|
+
"type": "spec_typed",
|
|
327
|
+
"named": true
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"type": "string",
|
|
331
|
+
"named": true
|
|
332
|
+
}
|
|
333
|
+
]
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
"type": "spec_keyword",
|
|
338
|
+
"named": true,
|
|
339
|
+
"fields": {}
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"type": "spec_typed",
|
|
343
|
+
"named": true,
|
|
344
|
+
"fields": {
|
|
345
|
+
"key": {
|
|
346
|
+
"multiple": false,
|
|
347
|
+
"required": true,
|
|
348
|
+
"types": [
|
|
349
|
+
{
|
|
350
|
+
"type": "spec_keyword",
|
|
351
|
+
"named": true
|
|
352
|
+
}
|
|
353
|
+
]
|
|
354
|
+
},
|
|
355
|
+
"value": {
|
|
356
|
+
"multiple": false,
|
|
357
|
+
"required": true,
|
|
358
|
+
"types": [
|
|
359
|
+
{
|
|
360
|
+
"type": "spec_text",
|
|
361
|
+
"named": true
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"type": "string",
|
|
365
|
+
"named": true
|
|
366
|
+
}
|
|
367
|
+
]
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
},
|
|
356
371
|
{
|
|
357
372
|
"type": "string",
|
|
358
373
|
"named": true,
|
|
@@ -388,10 +403,6 @@
|
|
|
388
403
|
"type": "\"",
|
|
389
404
|
"named": false
|
|
390
405
|
},
|
|
391
|
-
{
|
|
392
|
-
"type": "##",
|
|
393
|
-
"named": false
|
|
394
|
-
},
|
|
395
406
|
{
|
|
396
407
|
"type": "->",
|
|
397
408
|
"named": false
|
|
@@ -416,10 +427,6 @@
|
|
|
416
427
|
"type": "anim",
|
|
417
428
|
"named": false
|
|
418
429
|
},
|
|
419
|
-
{
|
|
420
|
-
"type": "annotation_text",
|
|
421
|
-
"named": true
|
|
422
|
-
},
|
|
423
430
|
{
|
|
424
431
|
"type": "bg",
|
|
425
432
|
"named": false
|
|
@@ -430,7 +437,8 @@
|
|
|
430
437
|
},
|
|
431
438
|
{
|
|
432
439
|
"type": "comment",
|
|
433
|
-
"named": true
|
|
440
|
+
"named": true,
|
|
441
|
+
"extra": true
|
|
434
442
|
},
|
|
435
443
|
{
|
|
436
444
|
"type": "corner",
|
|
@@ -516,6 +524,14 @@
|
|
|
516
524
|
"type": "shadow",
|
|
517
525
|
"named": false
|
|
518
526
|
},
|
|
527
|
+
{
|
|
528
|
+
"type": "spec",
|
|
529
|
+
"named": false
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"type": "spec_text",
|
|
533
|
+
"named": true
|
|
534
|
+
},
|
|
519
535
|
{
|
|
520
536
|
"type": "status",
|
|
521
537
|
"named": false
|
|
@@ -536,6 +552,10 @@
|
|
|
536
552
|
"type": "text",
|
|
537
553
|
"named": false
|
|
538
554
|
},
|
|
555
|
+
{
|
|
556
|
+
"type": "theme",
|
|
557
|
+
"named": false
|
|
558
|
+
},
|
|
539
559
|
{
|
|
540
560
|
"type": "translate",
|
|
541
561
|
"named": false
|
|
@@ -548,6 +568,10 @@
|
|
|
548
568
|
"type": "w",
|
|
549
569
|
"named": false
|
|
550
570
|
},
|
|
571
|
+
{
|
|
572
|
+
"type": "when",
|
|
573
|
+
"named": false
|
|
574
|
+
},
|
|
551
575
|
{
|
|
552
576
|
"type": "width",
|
|
553
577
|
"named": false
|