tree-sitter-ucode 0.4.0 → 0.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tree-sitter-ucode",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Ucode grammar for tree-sitter",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,6 +28,9 @@
28
28
  "markup/src/**",
29
29
  "markup/queries/*",
30
30
  "scripts/generate-markup-grammar.js",
31
+ "ucdocs/grammar.js",
32
+ "ucdocs/src/**",
33
+ "ucdocs/queries/*",
31
34
  "*.wasm"
32
35
  ],
33
36
  "dependencies": {
@@ -25,6 +25,13 @@
25
25
 
26
26
  ; Function declaration names belong to the enclosing scope so that
27
27
  ; callers outside the function body can resolve them.
28
+ ;
29
+ ; NOTE: tree-sitter does not evaluate #set! predicates — it has no built-in
30
+ ; concept of "place this definition one scope level up." This annotation is
31
+ ; metadata only; the consumer must detect it (predicate name and args) and
32
+ ; implement the scope-parent walk itself. A consumer that builds a
33
+ ; scope -> definitions map by structural nesting alone will misplace this
34
+ ; definition: it will end up invisible to callers outside the function body.
28
35
  (function_declaration
29
36
  name: (identifier) @local.definition.function
30
37
  (#set! definition.function.scope parent))
package/queries/tags.scm CHANGED
@@ -1,5 +1,19 @@
1
1
  ; Tags queries for ucode.
2
2
  ; Used by GitHub code navigation and tools that index symbol definitions.
3
+ ;
4
+ ; NOTE on #strip! and #select-adjacent!: these are non-standard predicates with
5
+ ; no tree-sitter runtime support — tree-sitter only evaluates #eq?/#match?/
6
+ ; #not-match?-family predicates and filters non-matching captures; everything
7
+ ; else (including these two) passes through as metadata for the consumer to
8
+ ; act on. A consumer that reads @doc captures verbatim gets raw `/** ... */`
9
+ ; text with leading `*` characters intact (no #strip!), and may associate a
10
+ ; comment from several lines above with the wrong definition (no
11
+ ; #select-adjacent!). Expected semantics:
12
+ ; #strip! @capture <regex> — strip text matching <regex> from the
13
+ ; start/end of @capture's text.
14
+ ; #select-adjacent! @a @b — only keep this match if @a is on a line
15
+ ; immediately preceding @b (no blank
16
+ ; lines or other statements between).
3
17
 
4
18
  ; -------------------------------------------------------------------------
5
19
  ; Function definitions — named declarations (brace body or endfunction body)
@@ -87,5 +101,4 @@
87
101
 
88
102
  (call_expression
89
103
  function: (member_expression
90
- property: (property_identifier) @name)
91
- arguments: (_) @reference.call)
104
+ property: (property_identifier) @name)) @reference.call
package/src/grammar.json CHANGED
@@ -223,8 +223,12 @@
223
223
  "value": "export"
224
224
  },
225
225
  {
226
- "type": "SYMBOL",
227
- "name": "export_clause"
226
+ "type": "FIELD",
227
+ "name": "clause",
228
+ "content": {
229
+ "type": "SYMBOL",
230
+ "name": "export_clause"
231
+ }
228
232
  },
229
233
  {
230
234
  "type": "SYMBOL",
@@ -422,8 +426,12 @@
422
426
  "type": "SEQ",
423
427
  "members": [
424
428
  {
425
- "type": "SYMBOL",
426
- "name": "import_clause"
429
+ "type": "FIELD",
430
+ "name": "clause",
431
+ "content": {
432
+ "type": "SYMBOL",
433
+ "name": "import_clause"
434
+ }
427
435
  },
428
436
  {
429
437
  "type": "STRING",
@@ -459,19 +467,31 @@
459
467
  "type": "CHOICE",
460
468
  "members": [
461
469
  {
462
- "type": "SYMBOL",
463
- "name": "namespace_import"
470
+ "type": "FIELD",
471
+ "name": "namespace",
472
+ "content": {
473
+ "type": "SYMBOL",
474
+ "name": "namespace_import"
475
+ }
464
476
  },
465
477
  {
466
- "type": "SYMBOL",
467
- "name": "named_imports"
478
+ "type": "FIELD",
479
+ "name": "named",
480
+ "content": {
481
+ "type": "SYMBOL",
482
+ "name": "named_imports"
483
+ }
468
484
  },
469
485
  {
470
486
  "type": "SEQ",
471
487
  "members": [
472
488
  {
473
- "type": "SYMBOL",
474
- "name": "identifier"
489
+ "type": "FIELD",
490
+ "name": "default",
491
+ "content": {
492
+ "type": "SYMBOL",
493
+ "name": "identifier"
494
+ }
475
495
  },
476
496
  {
477
497
  "type": "CHOICE",
@@ -487,12 +507,20 @@
487
507
  "type": "CHOICE",
488
508
  "members": [
489
509
  {
490
- "type": "SYMBOL",
491
- "name": "namespace_import"
510
+ "type": "FIELD",
511
+ "name": "namespace",
512
+ "content": {
513
+ "type": "SYMBOL",
514
+ "name": "namespace_import"
515
+ }
492
516
  },
493
517
  {
494
- "type": "SYMBOL",
495
- "name": "named_imports"
518
+ "type": "FIELD",
519
+ "name": "named",
520
+ "content": {
521
+ "type": "SYMBOL",
522
+ "name": "named_imports"
523
+ }
496
524
  }
497
525
  ]
498
526
  }
@@ -909,6 +909,16 @@
909
909
  "type": "export_statement",
910
910
  "named": true,
911
911
  "fields": {
912
+ "clause": {
913
+ "multiple": false,
914
+ "required": false,
915
+ "types": [
916
+ {
917
+ "type": "export_clause",
918
+ "named": true
919
+ }
920
+ ]
921
+ },
912
922
  "declaration": {
913
923
  "multiple": false,
914
924
  "required": false,
@@ -929,16 +939,6 @@
929
939
  }
930
940
  ]
931
941
  }
932
- },
933
- "children": {
934
- "multiple": false,
935
- "required": false,
936
- "types": [
937
- {
938
- "type": "export_clause",
939
- "named": true
940
- }
941
- ]
942
942
  }
943
943
  },
944
944
  {
@@ -1762,24 +1762,37 @@
1762
1762
  {
1763
1763
  "type": "import_clause",
1764
1764
  "named": true,
1765
- "fields": {},
1766
- "children": {
1767
- "multiple": true,
1768
- "required": true,
1769
- "types": [
1770
- {
1771
- "type": "identifier",
1772
- "named": true
1773
- },
1774
- {
1775
- "type": "named_imports",
1776
- "named": true
1777
- },
1778
- {
1779
- "type": "namespace_import",
1780
- "named": true
1781
- }
1782
- ]
1765
+ "fields": {
1766
+ "default": {
1767
+ "multiple": false,
1768
+ "required": false,
1769
+ "types": [
1770
+ {
1771
+ "type": "identifier",
1772
+ "named": true
1773
+ }
1774
+ ]
1775
+ },
1776
+ "named": {
1777
+ "multiple": false,
1778
+ "required": false,
1779
+ "types": [
1780
+ {
1781
+ "type": "named_imports",
1782
+ "named": true
1783
+ }
1784
+ ]
1785
+ },
1786
+ "namespace": {
1787
+ "multiple": false,
1788
+ "required": false,
1789
+ "types": [
1790
+ {
1791
+ "type": "namespace_import",
1792
+ "named": true
1793
+ }
1794
+ ]
1795
+ }
1783
1796
  }
1784
1797
  },
1785
1798
  {
@@ -1820,6 +1833,16 @@
1820
1833
  "type": "import_statement",
1821
1834
  "named": true,
1822
1835
  "fields": {
1836
+ "clause": {
1837
+ "multiple": false,
1838
+ "required": false,
1839
+ "types": [
1840
+ {
1841
+ "type": "import_clause",
1842
+ "named": true
1843
+ }
1844
+ ]
1845
+ },
1823
1846
  "source": {
1824
1847
  "multiple": false,
1825
1848
  "required": true,
@@ -1830,16 +1853,6 @@
1830
1853
  }
1831
1854
  ]
1832
1855
  }
1833
- },
1834
- "children": {
1835
- "multiple": false,
1836
- "required": false,
1837
- "types": [
1838
- {
1839
- "type": "import_clause",
1840
- "named": true
1841
- }
1842
- ]
1843
1856
  }
1844
1857
  },
1845
1858
  {