tree-sitter-delphi13 1.4.0 → 1.4.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 +34 -8
- package/package.json +58 -58
- package/src/grammar.json +181 -0
- package/src/node-types.json +4 -0
- package/src/parser.c +283172 -280251
- package/tree-sitter.json +39 -39
package/grammar.js
CHANGED
|
@@ -430,6 +430,10 @@ module.exports = grammar({
|
|
|
430
430
|
// Phase 3b iter 11: declFieldNoSemi uses a narrower type set; conflicts
|
|
431
431
|
// with the full `type` rule's choices.
|
|
432
432
|
[$.type, $.declFieldNoSemi],
|
|
433
|
+
// 2026-11-03 GRAMMAR-LASTFIELD: the no-semi array form shares its prefix with
|
|
434
|
+
// declArray; the GLR splits on the token after the element (`;` vs `end`).
|
|
435
|
+
[$.type, $._arrayElemNoSemi],
|
|
436
|
+
[$.declArray, $._declArrayNoSemi],
|
|
433
437
|
// Iter 2026-07-06: an anonymous enum `(a, b, c)` in an array index slot is
|
|
434
438
|
// ambiguous with a parenthesized expression `_ref` (both start `(`). GLR
|
|
435
439
|
// resolves by what follows: `(a,b,c)]` in index position -> declEnum.
|
|
@@ -1684,18 +1688,40 @@ module.exports = grammar({
|
|
|
1684
1688
|
// Bare `string`/`ShortString` has no such tail, so it is
|
|
1685
1689
|
// unambiguous here.
|
|
1686
1690
|
$.kString,
|
|
1687
|
-
//
|
|
1688
|
-
//
|
|
1689
|
-
//
|
|
1690
|
-
//
|
|
1691
|
-
//
|
|
1692
|
-
//
|
|
1693
|
-
//
|
|
1694
|
-
//
|
|
1691
|
+
// 2026-11-03 (v1.4.1, GRAMMAR-LASTFIELD): `array[...] of T` as the
|
|
1692
|
+
// last field with no `;` (FireDAC.Phys.MongoDBCli `padding: array
|
|
1693
|
+
// [0 .. 83] of Byte end`, Winapi.ShlObj `szInsert: packed
|
|
1694
|
+
// array[0..MAX_PATH-1] of WCHAR end`). The full declArray is NOT
|
|
1695
|
+
// used: its element `type` includes declString, whose `[N]` made
|
|
1696
|
+
// `array[0..4] of String[1];` (OoMisc/Z19b5, WITH a trailing `;`)
|
|
1697
|
+
// ambiguous with the no-semi form. _declArrayNoSemi is the
|
|
1698
|
+
// constrained form: its element excludes every string type, so a
|
|
1699
|
+
// string element only ever parses through declField. Aliased to
|
|
1700
|
+
// declArray (element aliased to type) so the tree has the same
|
|
1701
|
+
// shape as the `;` form.
|
|
1702
|
+
alias($._declArrayNoSemi, $.declArray),
|
|
1695
1703
|
prec(-1, $.pp_block),
|
|
1696
1704
|
)),
|
|
1697
1705
|
field('defaultValue', optional($.defaultValue)),
|
|
1698
1706
|
),
|
|
1707
|
+
// Constrained `array [..] of T` for declFieldNoSemi only (see there).
|
|
1708
|
+
// Same index forms as declArray; the element excludes declString and
|
|
1709
|
+
// kString so `of String[N]` can never end a no-semi field.
|
|
1710
|
+
_declArrayNoSemi: $ => seq(
|
|
1711
|
+
optional($.kPacked),
|
|
1712
|
+
$.kArray,
|
|
1713
|
+
optional(seq('[', delimited(choice($.range, $.declEnum, $._expr)), ']')),
|
|
1714
|
+
$.kOf,
|
|
1715
|
+
choice(alias($._arrayElemNoSemi, $.type), $.subrangeType),
|
|
1716
|
+
),
|
|
1717
|
+
_arrayElemNoSemi: $ => choice(
|
|
1718
|
+
$.typeref,
|
|
1719
|
+
$.declMetaClass,
|
|
1720
|
+
$.declEnum,
|
|
1721
|
+
$.declSet,
|
|
1722
|
+
$.declProcRef,
|
|
1723
|
+
$.declClass,
|
|
1724
|
+
),
|
|
1699
1725
|
|
|
1700
1726
|
declField: $ => seq(
|
|
1701
1727
|
...enable_if(rtti, optional($.rttiAttributes)),
|
package/package.json
CHANGED
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "tree-sitter-delphi13",
|
|
3
|
-
"version": "1.4.
|
|
4
|
-
"description": "Tree-sitter grammar focused on Delphi 13 (RAD Studio 37.0)",
|
|
5
|
-
"main": "bindings/node",
|
|
6
|
-
"types": "bindings/node",
|
|
7
|
-
"repository": {
|
|
8
|
-
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/Alexl-git/tree-sitter-delphi13.git"
|
|
10
|
-
},
|
|
11
|
-
"keywords": [
|
|
12
|
-
"parser",
|
|
13
|
-
"tree-sitter",
|
|
14
|
-
"delphi",
|
|
15
|
-
"delphi13",
|
|
16
|
-
"pascal"
|
|
17
|
-
],
|
|
18
|
-
"homepage": "https://github.com/Alexl-git/tree-sitter-delphi13",
|
|
19
|
-
"bugs": {
|
|
20
|
-
"url": "https://github.com/Alexl-git/tree-sitter-delphi13/issues"
|
|
21
|
-
},
|
|
22
|
-
"author": "Alexander Liberov",
|
|
23
|
-
"license": "MIT",
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"prebuildify": "^6.0.1",
|
|
26
|
-
"web-tree-sitter": "^0.24.7",
|
|
27
|
-
"tree-sitter-cli": "^0.24.5"
|
|
28
|
-
},
|
|
29
|
-
"scripts": {
|
|
30
|
-
"build": "tree-sitter generate && node-gyp build",
|
|
31
|
-
"build-wasm": "tree-sitter build --wasm -o tree-sitter-delphi13.wasm .",
|
|
32
|
-
"test": "tree-sitter test && tree-sitter parse examples/* --quiet --time",
|
|
33
|
-
"install": "node-gyp-build",
|
|
34
|
-
"validate-queries": "node tools/validate-queries.js",
|
|
35
|
-
"prebuildify": "prebuildify --napi --strip"
|
|
36
|
-
},
|
|
37
|
-
"files": [
|
|
38
|
-
"grammar.js",
|
|
39
|
-
"binding.gyp",
|
|
40
|
-
"tree-sitter.json",
|
|
41
|
-
"prebuilds/**",
|
|
42
|
-
"bindings/node/*",
|
|
43
|
-
"queries/*",
|
|
44
|
-
"src/**",
|
|
45
|
-
"tree-sitter-delphi13.wasm"
|
|
46
|
-
],
|
|
47
|
-
"dependencies": {
|
|
48
|
-
"node-gyp-build": "^4.8.4"
|
|
49
|
-
},
|
|
50
|
-
"peerDependencies": {
|
|
51
|
-
"tree-sitter": "^0.22.0"
|
|
52
|
-
},
|
|
53
|
-
"peerDependenciesMeta": {
|
|
54
|
-
"tree_sitter": {
|
|
55
|
-
"optional": true
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "tree-sitter-delphi13",
|
|
3
|
+
"version": "1.4.1",
|
|
4
|
+
"description": "Tree-sitter grammar focused on Delphi 13 (RAD Studio 37.0)",
|
|
5
|
+
"main": "bindings/node",
|
|
6
|
+
"types": "bindings/node",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Alexl-git/tree-sitter-delphi13.git"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"parser",
|
|
13
|
+
"tree-sitter",
|
|
14
|
+
"delphi",
|
|
15
|
+
"delphi13",
|
|
16
|
+
"pascal"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://github.com/Alexl-git/tree-sitter-delphi13",
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/Alexl-git/tree-sitter-delphi13/issues"
|
|
21
|
+
},
|
|
22
|
+
"author": "Alexander Liberov",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"prebuildify": "^6.0.1",
|
|
26
|
+
"web-tree-sitter": "^0.24.7",
|
|
27
|
+
"tree-sitter-cli": "^0.24.5"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "tree-sitter generate && node-gyp build",
|
|
31
|
+
"build-wasm": "tree-sitter build --wasm -o tree-sitter-delphi13.wasm .",
|
|
32
|
+
"test": "tree-sitter test && tree-sitter parse examples/* --quiet --time",
|
|
33
|
+
"install": "node-gyp-build",
|
|
34
|
+
"validate-queries": "node tools/validate-queries.js",
|
|
35
|
+
"prebuildify": "prebuildify --napi --strip"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"grammar.js",
|
|
39
|
+
"binding.gyp",
|
|
40
|
+
"tree-sitter.json",
|
|
41
|
+
"prebuilds/**",
|
|
42
|
+
"bindings/node/*",
|
|
43
|
+
"queries/*",
|
|
44
|
+
"src/**",
|
|
45
|
+
"tree-sitter-delphi13.wasm"
|
|
46
|
+
],
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"node-gyp-build": "^4.8.4"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"tree-sitter": "^0.22.0"
|
|
52
|
+
},
|
|
53
|
+
"peerDependenciesMeta": {
|
|
54
|
+
"tree_sitter": {
|
|
55
|
+
"optional": true
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
package/src/grammar.json
CHANGED
|
@@ -9670,6 +9670,15 @@
|
|
|
9670
9670
|
"type": "SYMBOL",
|
|
9671
9671
|
"name": "kString"
|
|
9672
9672
|
},
|
|
9673
|
+
{
|
|
9674
|
+
"type": "ALIAS",
|
|
9675
|
+
"content": {
|
|
9676
|
+
"type": "SYMBOL",
|
|
9677
|
+
"name": "_declArrayNoSemi"
|
|
9678
|
+
},
|
|
9679
|
+
"named": true,
|
|
9680
|
+
"value": "declArray"
|
|
9681
|
+
},
|
|
9673
9682
|
{
|
|
9674
9683
|
"type": "PREC",
|
|
9675
9684
|
"value": -1,
|
|
@@ -9699,6 +9708,170 @@
|
|
|
9699
9708
|
}
|
|
9700
9709
|
]
|
|
9701
9710
|
},
|
|
9711
|
+
"_declArrayNoSemi": {
|
|
9712
|
+
"type": "SEQ",
|
|
9713
|
+
"members": [
|
|
9714
|
+
{
|
|
9715
|
+
"type": "CHOICE",
|
|
9716
|
+
"members": [
|
|
9717
|
+
{
|
|
9718
|
+
"type": "SYMBOL",
|
|
9719
|
+
"name": "kPacked"
|
|
9720
|
+
},
|
|
9721
|
+
{
|
|
9722
|
+
"type": "BLANK"
|
|
9723
|
+
}
|
|
9724
|
+
]
|
|
9725
|
+
},
|
|
9726
|
+
{
|
|
9727
|
+
"type": "SYMBOL",
|
|
9728
|
+
"name": "kArray"
|
|
9729
|
+
},
|
|
9730
|
+
{
|
|
9731
|
+
"type": "CHOICE",
|
|
9732
|
+
"members": [
|
|
9733
|
+
{
|
|
9734
|
+
"type": "SEQ",
|
|
9735
|
+
"members": [
|
|
9736
|
+
{
|
|
9737
|
+
"type": "STRING",
|
|
9738
|
+
"value": "["
|
|
9739
|
+
},
|
|
9740
|
+
{
|
|
9741
|
+
"type": "CHOICE",
|
|
9742
|
+
"members": [
|
|
9743
|
+
{
|
|
9744
|
+
"type": "SEQ",
|
|
9745
|
+
"members": [
|
|
9746
|
+
{
|
|
9747
|
+
"type": "CHOICE",
|
|
9748
|
+
"members": [
|
|
9749
|
+
{
|
|
9750
|
+
"type": "REPEAT1",
|
|
9751
|
+
"content": {
|
|
9752
|
+
"type": "PREC",
|
|
9753
|
+
"value": 0,
|
|
9754
|
+
"content": {
|
|
9755
|
+
"type": "SEQ",
|
|
9756
|
+
"members": [
|
|
9757
|
+
{
|
|
9758
|
+
"type": "CHOICE",
|
|
9759
|
+
"members": [
|
|
9760
|
+
{
|
|
9761
|
+
"type": "SYMBOL",
|
|
9762
|
+
"name": "range"
|
|
9763
|
+
},
|
|
9764
|
+
{
|
|
9765
|
+
"type": "SYMBOL",
|
|
9766
|
+
"name": "declEnum"
|
|
9767
|
+
},
|
|
9768
|
+
{
|
|
9769
|
+
"type": "SYMBOL",
|
|
9770
|
+
"name": "_expr"
|
|
9771
|
+
}
|
|
9772
|
+
]
|
|
9773
|
+
},
|
|
9774
|
+
{
|
|
9775
|
+
"type": "STRING",
|
|
9776
|
+
"value": ","
|
|
9777
|
+
}
|
|
9778
|
+
]
|
|
9779
|
+
}
|
|
9780
|
+
}
|
|
9781
|
+
},
|
|
9782
|
+
{
|
|
9783
|
+
"type": "BLANK"
|
|
9784
|
+
}
|
|
9785
|
+
]
|
|
9786
|
+
},
|
|
9787
|
+
{
|
|
9788
|
+
"type": "CHOICE",
|
|
9789
|
+
"members": [
|
|
9790
|
+
{
|
|
9791
|
+
"type": "SYMBOL",
|
|
9792
|
+
"name": "range"
|
|
9793
|
+
},
|
|
9794
|
+
{
|
|
9795
|
+
"type": "SYMBOL",
|
|
9796
|
+
"name": "declEnum"
|
|
9797
|
+
},
|
|
9798
|
+
{
|
|
9799
|
+
"type": "SYMBOL",
|
|
9800
|
+
"name": "_expr"
|
|
9801
|
+
}
|
|
9802
|
+
]
|
|
9803
|
+
}
|
|
9804
|
+
]
|
|
9805
|
+
},
|
|
9806
|
+
{
|
|
9807
|
+
"type": "BLANK"
|
|
9808
|
+
}
|
|
9809
|
+
]
|
|
9810
|
+
},
|
|
9811
|
+
{
|
|
9812
|
+
"type": "STRING",
|
|
9813
|
+
"value": "]"
|
|
9814
|
+
}
|
|
9815
|
+
]
|
|
9816
|
+
},
|
|
9817
|
+
{
|
|
9818
|
+
"type": "BLANK"
|
|
9819
|
+
}
|
|
9820
|
+
]
|
|
9821
|
+
},
|
|
9822
|
+
{
|
|
9823
|
+
"type": "SYMBOL",
|
|
9824
|
+
"name": "kOf"
|
|
9825
|
+
},
|
|
9826
|
+
{
|
|
9827
|
+
"type": "CHOICE",
|
|
9828
|
+
"members": [
|
|
9829
|
+
{
|
|
9830
|
+
"type": "ALIAS",
|
|
9831
|
+
"content": {
|
|
9832
|
+
"type": "SYMBOL",
|
|
9833
|
+
"name": "_arrayElemNoSemi"
|
|
9834
|
+
},
|
|
9835
|
+
"named": true,
|
|
9836
|
+
"value": "type"
|
|
9837
|
+
},
|
|
9838
|
+
{
|
|
9839
|
+
"type": "SYMBOL",
|
|
9840
|
+
"name": "subrangeType"
|
|
9841
|
+
}
|
|
9842
|
+
]
|
|
9843
|
+
}
|
|
9844
|
+
]
|
|
9845
|
+
},
|
|
9846
|
+
"_arrayElemNoSemi": {
|
|
9847
|
+
"type": "CHOICE",
|
|
9848
|
+
"members": [
|
|
9849
|
+
{
|
|
9850
|
+
"type": "SYMBOL",
|
|
9851
|
+
"name": "typeref"
|
|
9852
|
+
},
|
|
9853
|
+
{
|
|
9854
|
+
"type": "SYMBOL",
|
|
9855
|
+
"name": "declMetaClass"
|
|
9856
|
+
},
|
|
9857
|
+
{
|
|
9858
|
+
"type": "SYMBOL",
|
|
9859
|
+
"name": "declEnum"
|
|
9860
|
+
},
|
|
9861
|
+
{
|
|
9862
|
+
"type": "SYMBOL",
|
|
9863
|
+
"name": "declSet"
|
|
9864
|
+
},
|
|
9865
|
+
{
|
|
9866
|
+
"type": "SYMBOL",
|
|
9867
|
+
"name": "declProcRef"
|
|
9868
|
+
},
|
|
9869
|
+
{
|
|
9870
|
+
"type": "SYMBOL",
|
|
9871
|
+
"name": "declClass"
|
|
9872
|
+
}
|
|
9873
|
+
]
|
|
9874
|
+
},
|
|
9702
9875
|
"declField": {
|
|
9703
9876
|
"type": "SEQ",
|
|
9704
9877
|
"members": [
|
|
@@ -13220,6 +13393,14 @@
|
|
|
13220
13393
|
"type",
|
|
13221
13394
|
"declFieldNoSemi"
|
|
13222
13395
|
],
|
|
13396
|
+
[
|
|
13397
|
+
"type",
|
|
13398
|
+
"_arrayElemNoSemi"
|
|
13399
|
+
],
|
|
13400
|
+
[
|
|
13401
|
+
"declArray",
|
|
13402
|
+
"_declArrayNoSemi"
|
|
13403
|
+
],
|
|
13223
13404
|
[
|
|
13224
13405
|
"_ref",
|
|
13225
13406
|
"declEnumValue"
|