tree-sitter-familymarkup 1.9.1 → 1.11.0

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 CHANGED
@@ -36,7 +36,7 @@ module.exports = grammar({
36
36
 
37
37
  relation: $ => seq(
38
38
  field('sources', $.sources),
39
- field('arrow', $._arrows),
39
+ field('arrow', choice($.eq, $.arrow)),
40
40
  field('label', optional($.words)),
41
41
  optional($._nl),
42
42
  field('targets', optional($.targets)),
@@ -47,7 +47,7 @@ module.exports = grammar({
47
47
  field('delimiter', choice('+', ',', $._words))
48
48
  ),
49
49
  targets: $ => repeatWith(
50
- choice($.name_ref, $.name_def, $.num_unknown, $.unknown, $.comment),
50
+ choice($.name_def, $.num_unknown, $.unknown, $.comment),
51
51
  field('delimiter', choice(',', $._nl, $._words))
52
52
  ),
53
53
 
@@ -63,6 +63,7 @@ module.exports = grammar({
63
63
  field('surname', optional($.new_surname)),
64
64
  field('name', $.name),
65
65
  field('aliases', optional($.name_aliases)),
66
+ field('surname', optional(alias($.name, $.surname))),
66
67
  ),
67
68
 
68
69
  num: _ => /\d+[.)]?/,
@@ -85,7 +86,9 @@ module.exports = grammar({
85
86
  words: _ => /\p{Ll}([\p{Ll}'"\s]*[\p{Ll}'"])?/u,
86
87
  _words: $ => alias($.words, '_words'),
87
88
 
88
- _arrows: _ => choice('=', '<->', '->', '<-', '-'),
89
+ eq: _ => "=",
90
+
91
+ arrow: _ => choice('<->', '->', '<-', '-'),
89
92
  },
90
93
  });
91
94
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "tree-sitter-familymarkup",
3
3
  "description": "Tree sitter for FamilyMarkup",
4
- "version": "1.9.1",
4
+ "version": "1.11.0",
5
5
  "main": "bindings/node",
6
6
  "types": "bindings/node",
7
7
  "scripts": {
@@ -18,6 +18,8 @@
18
18
  "files": [
19
19
  "grammar.js",
20
20
  "binding.gyp",
21
+ "tree-sitter.json",
22
+ "queries.json",
21
23
  "prebuilds/**",
22
24
  "bindings/node/*",
23
25
  "queries/*",
@@ -1,56 +1,42 @@
1
1
  (family_name
2
2
  (name) @class.declaration.family_name
3
- )
4
3
 
5
- (family_name
6
4
  (name_aliases
7
5
  (name) @class.declaration.family_name.alias
8
- )
6
+ )?
9
7
  )
10
8
 
11
9
  (name_ref
10
+ (name) @property.static.name.ref
12
11
  (surname) @class.family_name.ref
13
12
  )
14
13
 
15
- (name_ref
14
+ (name_def
16
15
  (name) @property.static.name.ref
17
- )
18
-
19
- (name_def
20
- (name) @property.declaration.static.name.def
21
- )
22
-
23
- (name_def
24
- (name_aliases (name) @property.declaration.static.name.def.alias)
16
+ (surname)? @class.family_name.ref
25
17
  )
26
18
 
27
19
  (sources
28
20
  (name) @property.static.name.ref
29
21
  )
30
22
 
31
- (targets
32
- (name_def
33
- .
34
- (name) @property.static.name.ref
35
- .
36
- )
37
- )
38
-
39
23
  (relation
40
- arrow: "="
24
+ (sources)
25
+ (eq)
41
26
  (targets
42
27
  (name_def
43
- .
28
+ (new_surname
29
+ (name) @class.family_name.ref
30
+ )?
44
31
  (name) @property.declaration.static.name.def
45
- .
32
+ (name_aliases
33
+ (name) @property.declaration.static.name.def.alias
34
+ )?
35
+ (surname)? @class.family_name.ref
46
36
  )
47
37
  )
48
38
  )
49
39
 
50
- (new_surname
51
- (name) @class.family_name.ref
52
- )
53
-
54
40
  (unknown) @string.unknown
55
41
 
56
42
  (comment) @comment
package/queries.json ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "highlights": "(family_name\n (name) @class.declaration.family_name\n\n (name_aliases\n (name) @class.declaration.family_name.alias\n )?\n)\n\n(name_ref\n (name) @property.static.name.ref\n (surname) @class.family_name.ref\n)\n\n(name_def\n (name) @property.static.name.ref\n (surname)? @class.family_name.ref\n)\n\n(sources\n (name) @property.static.name.ref\n)\n\n(relation\n (sources)\n (eq)\n (targets\n (name_def\n (new_surname\n (name) @class.family_name.ref\n )?\n (name) @property.declaration.static.name.def\n (name_aliases\n (name) @property.declaration.static.name.def.alias\n )?\n (surname)? @class.family_name.ref\n )\n )\n)\n\n(unknown) @string.unknown\n\n(comment) @comment\n\n(num) @number.targets\n\n(sources delimiter: _ @punctuation.delimiter.sources)\n(targets delimiter: _ @punctuation.delimiter.targets)\n\n\"+\" @operator.sources.join\n\n(relation arrow: _ @operator.arrow)\n\n(relation label: _ @string.label)\n"
3
+ }
package/src/grammar.json CHANGED
@@ -222,8 +222,17 @@
222
222
  "type": "FIELD",
223
223
  "name": "arrow",
224
224
  "content": {
225
- "type": "SYMBOL",
226
- "name": "_arrows"
225
+ "type": "CHOICE",
226
+ "members": [
227
+ {
228
+ "type": "SYMBOL",
229
+ "name": "eq"
230
+ },
231
+ {
232
+ "type": "SYMBOL",
233
+ "name": "arrow"
234
+ }
235
+ ]
227
236
  }
228
237
  },
229
238
  {
@@ -354,10 +363,6 @@
354
363
  {
355
364
  "type": "CHOICE",
356
365
  "members": [
357
- {
358
- "type": "SYMBOL",
359
- "name": "name_ref"
360
- },
361
366
  {
362
367
  "type": "SYMBOL",
363
368
  "name": "name_def"
@@ -408,10 +413,6 @@
408
413
  {
409
414
  "type": "CHOICE",
410
415
  "members": [
411
- {
412
- "type": "SYMBOL",
413
- "name": "name_ref"
414
- },
415
416
  {
416
417
  "type": "SYMBOL",
417
418
  "name": "name_def"
@@ -545,6 +546,27 @@
545
546
  }
546
547
  ]
547
548
  }
549
+ },
550
+ {
551
+ "type": "FIELD",
552
+ "name": "surname",
553
+ "content": {
554
+ "type": "CHOICE",
555
+ "members": [
556
+ {
557
+ "type": "ALIAS",
558
+ "content": {
559
+ "type": "SYMBOL",
560
+ "name": "name"
561
+ },
562
+ "named": true,
563
+ "value": "surname"
564
+ },
565
+ {
566
+ "type": "BLANK"
567
+ }
568
+ ]
569
+ }
548
570
  }
549
571
  ]
550
572
  },
@@ -703,13 +725,13 @@
703
725
  "named": false,
704
726
  "value": "_words"
705
727
  },
706
- "_arrows": {
728
+ "eq": {
729
+ "type": "STRING",
730
+ "value": "="
731
+ },
732
+ "arrow": {
707
733
  "type": "CHOICE",
708
734
  "members": [
709
- {
710
- "type": "STRING",
711
- "value": "="
712
- },
713
735
  {
714
736
  "type": "STRING",
715
737
  "value": "<->"
@@ -1,4 +1,9 @@
1
1
  [
2
+ {
3
+ "type": "arrow",
4
+ "named": true,
5
+ "fields": {}
6
+ },
2
7
  {
3
8
  "type": "comment",
4
9
  "named": true,
@@ -110,12 +115,16 @@
110
115
  ]
111
116
  },
112
117
  "surname": {
113
- "multiple": false,
118
+ "multiple": true,
114
119
  "required": false,
115
120
  "types": [
116
121
  {
117
122
  "type": "new_surname",
118
123
  "named": true
124
+ },
125
+ {
126
+ "type": "surname",
127
+ "named": true
119
128
  }
120
129
  ]
121
130
  }
@@ -183,24 +192,12 @@
183
192
  "required": true,
184
193
  "types": [
185
194
  {
186
- "type": "-",
187
- "named": false
188
- },
189
- {
190
- "type": "->",
191
- "named": false
192
- },
193
- {
194
- "type": "<-",
195
- "named": false
196
- },
197
- {
198
- "type": "<->",
199
- "named": false
195
+ "type": "arrow",
196
+ "named": true
200
197
  },
201
198
  {
202
- "type": "=",
203
- "named": false
199
+ "type": "eq",
200
+ "named": true
204
201
  }
205
202
  ]
206
203
  },
@@ -340,10 +337,6 @@
340
337
  "type": "name_def",
341
338
  "named": true
342
339
  },
343
- {
344
- "type": "name_ref",
345
- "named": true
346
- },
347
340
  {
348
341
  "type": "num_unknown",
349
342
  "named": true
@@ -404,10 +397,6 @@
404
397
  "type": "<->",
405
398
  "named": false
406
399
  },
407
- {
408
- "type": "=",
409
- "named": false
410
- },
411
400
  {
412
401
  "type": "?",
413
402
  "named": false
@@ -416,6 +405,10 @@
416
405
  "type": "_words",
417
406
  "named": false
418
407
  },
408
+ {
409
+ "type": "eq",
410
+ "named": true
411
+ },
419
412
  {
420
413
  "type": "name",
421
414
  "named": true