@sshadows/tree-sitter-al 3.0.0 → 3.0.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/README.md +25 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,12 +13,26 @@ Validated against **15,358 production AL files** from the Business Central codeb
|
|
|
13
13
|
| Metric | Value |
|
|
14
14
|
|--------|-------|
|
|
15
15
|
| **Success rate** | **100%** (15,358 / 15,358 files) |
|
|
16
|
-
| Tests | 1,
|
|
17
|
-
| parser.c size | ~
|
|
18
|
-
| grammar.js | ~3,
|
|
16
|
+
| Tests | 1,451 |
|
|
17
|
+
| parser.c size | ~28 MB |
|
|
18
|
+
| grammar.js | ~3,930 lines |
|
|
19
19
|
| Named keywords | 82 (queryable via highlights/tags) |
|
|
20
20
|
| Scanner tokens | 8 (stateful, depth-tracking) |
|
|
21
|
-
| Query files |
|
|
21
|
+
| Query files | 6 (highlights, locals, tags, indents, folds, textobjects) |
|
|
22
|
+
|
|
23
|
+
## What's new in 3.0.0
|
|
24
|
+
|
|
25
|
+
**Breaking parse-tree change for editor textobjects and code navigation.** Every
|
|
26
|
+
scoped construct now exposes its content as a single node via a `body` field
|
|
27
|
+
(e.g. `(page_declaration body: (declaration_body …))`,
|
|
28
|
+
`(code_block (begin_keyword) body: (statement_block …) (end_keyword))`), instead of a
|
|
29
|
+
flat list of direct children. This powers Helix / nvim-treesitter textobjects
|
|
30
|
+
(`@class.inside`, `@function.inside`, `@parameter`) via the new
|
|
31
|
+
[`queries/textobjects.scm`](queries/textobjects.scm), plus a `parameters` field on
|
|
32
|
+
procedures/triggers/events.
|
|
33
|
+
|
|
34
|
+
Tree-walkers and structural queries must descend through the `body` field — see
|
|
35
|
+
[CHANGELOG.md](CHANGELOG.md) for the full migration guide.
|
|
22
36
|
|
|
23
37
|
## Installation
|
|
24
38
|
|
|
@@ -40,7 +54,7 @@ println!("{}", tree.root_node().to_sexp());
|
|
|
40
54
|
|
|
41
55
|
Query constants are also available:
|
|
42
56
|
```rust
|
|
43
|
-
use tree_sitter_al::{HIGHLIGHTS_QUERY, TAGS_QUERY, LOCALS_QUERY, FOLDS_QUERY, INDENTS_QUERY};
|
|
57
|
+
use tree_sitter_al::{HIGHLIGHTS_QUERY, TAGS_QUERY, LOCALS_QUERY, FOLDS_QUERY, INDENTS_QUERY, TEXTOBJECTS_QUERY};
|
|
44
58
|
```
|
|
45
59
|
|
|
46
60
|
### Python (tree-sitter 0.24+)
|
|
@@ -88,11 +102,11 @@ The grammar was rewritten from scratch in March 2026, achieving a **major reduct
|
|
|
88
102
|
| Errors | 14 | **0** |
|
|
89
103
|
| Success rate | 99.91% | **100%** |
|
|
90
104
|
| Symbols | 2,249 | **~814** |
|
|
91
|
-
| States | 29,126 | **~
|
|
92
|
-
| grammar.js | 8,500 lines | **~3,
|
|
93
|
-
| Tests | 1,225 | **1,
|
|
105
|
+
| States | 29,126 | **~12,600** |
|
|
106
|
+
| grammar.js | 8,500 lines | **~3,930 lines** |
|
|
107
|
+
| Tests | 1,225 | **1,451** |
|
|
94
108
|
| Keywords | invisible in queries | **82 named nodes** |
|
|
95
|
-
| Query files | 3 (partial) | **
|
|
109
|
+
| Query files | 3 (partial) | **6 (comprehensive)** |
|
|
96
110
|
|
|
97
111
|
### Key design decisions
|
|
98
112
|
|
|
@@ -145,8 +159,8 @@ tree-sitter parse path/to/file.al -q # Quiet (errors only)
|
|
|
145
159
|
|------|---------|
|
|
146
160
|
| `grammar.js` | Main grammar definition |
|
|
147
161
|
| `src/scanner.c` | External scanner (8 tokens: property, depth tracking, named begin/end, split detection) |
|
|
148
|
-
| `test/corpus/` | Test suite (1,
|
|
149
|
-
| `queries/` | Syntax highlighting, code navigation, folding, indentation |
|
|
162
|
+
| `test/corpus/` | Test suite (1,451 tests) |
|
|
163
|
+
| `queries/` | Syntax highlighting, code navigation, folding, indentation, textobjects |
|
|
150
164
|
|
|
151
165
|
## Contributing
|
|
152
166
|
|