@apple/tree-sitter-pkl 0.18.0 → 0.18.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/CHANGELOG.adoc +9 -1
- package/CMakeLists.txt +1 -1
- package/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/Makefile +1 -1
- package/go.mod +2 -0
- package/go.sum +36 -0
- package/grammar.js +14 -14
- package/package.json +1 -1
- package/pyproject.toml +1 -1
- package/src/grammar.json +30 -31
- package/src/parser.c +12651 -12641
- package/src/scanner.c +1 -1
- package/test/corpus/expr/typeTest.txt +11 -0
- package/tree-sitter.json +4 -1
package/CHANGELOG.adoc
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
= Changelog
|
|
2
2
|
|
|
3
|
+
[[release-0.18.1]]
|
|
4
|
+
== 0.18.1 (2025-04-07)
|
|
5
|
+
|
|
6
|
+
=== Fixes
|
|
7
|
+
|
|
8
|
+
* Fix an issue where the project fails to be used as a Go library (https://github.com/apple/tree-sitter-pkl/pull/38[#38]).
|
|
9
|
+
* Fix an issue where qualified identifiers are parsed incorrectly in some cases (https://github.com/apple/tree-sitter-pkl/pull/39[#39]).
|
|
10
|
+
|
|
3
11
|
[[release-0.18.0]]
|
|
4
|
-
== 0.18.0 (
|
|
12
|
+
== 0.18.0 (2025-03-27)
|
|
5
13
|
|
|
6
14
|
This is a large change.
|
|
7
15
|
It changes the parse tree to match other Pkl parsers, and also fixes all known parser issues.
|
package/CMakeLists.txt
CHANGED
package/Cargo.lock
CHANGED
package/Cargo.toml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "tree-sitter-pkl"
|
|
3
3
|
description = "Pkl grammar for the tree-sitter parsing library"
|
|
4
|
-
version = "0.18.
|
|
4
|
+
version = "0.18.1"
|
|
5
5
|
keywords = ["incremental", "parsing", "pkl"]
|
|
6
6
|
categories = ["parsing", "text-editors"]
|
|
7
7
|
repository = "https://github.com/apple/tree-sitter-pkl"
|
package/Makefile
CHANGED
package/go.mod
CHANGED
package/go.sum
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
2
|
+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
3
|
+
github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0=
|
|
4
|
+
github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=
|
|
5
|
+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
6
|
+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
7
|
+
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
|
8
|
+
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
|
9
|
+
github.com/tree-sitter/go-tree-sitter v0.24.0 h1:kRZb6aBNfcI/u0Qh8XEt3zjNVnmxTisDBN+kXK0xRYQ=
|
|
10
|
+
github.com/tree-sitter/go-tree-sitter v0.24.0/go.mod h1:x681iFVoLMEwOSIHA1chaLkXlroXEN7WY+VHGFaoDbk=
|
|
11
|
+
github.com/tree-sitter/tree-sitter-c v0.21.5-0.20240818205408-927da1f210eb h1:A8425heRM8mylnv4H58FPUiH+aYivyitre0PzxrfmWs=
|
|
12
|
+
github.com/tree-sitter/tree-sitter-c v0.21.5-0.20240818205408-927da1f210eb/go.mod h1:dOF6gtQiF9UwNh995T5OphYmtIypkjsp3ap7r9AN/iA=
|
|
13
|
+
github.com/tree-sitter/tree-sitter-cpp v0.22.4-0.20240818224355-b1a4e2b25148 h1:AfFPZwtwGN01BW1jDdqBVqscTwetvMpydqYZz57RSlc=
|
|
14
|
+
github.com/tree-sitter/tree-sitter-cpp v0.22.4-0.20240818224355-b1a4e2b25148/go.mod h1:Bh6U3viD57rFXRYIQ+kmiYtr+1Bx0AceypDLJJSyi9s=
|
|
15
|
+
github.com/tree-sitter/tree-sitter-embedded-template v0.21.1-0.20240819044651-ffbf64942c33 h1:TwqSV3qLp3tKSqirGLRHnjFk9Tc2oy57LIl+FQ4GjI4=
|
|
16
|
+
github.com/tree-sitter/tree-sitter-embedded-template v0.21.1-0.20240819044651-ffbf64942c33/go.mod h1:CvCKCt3v04Ufos1zZnNCelBDeCGRpPucaN8QczoUsN4=
|
|
17
|
+
github.com/tree-sitter/tree-sitter-go v0.21.3-0.20240818010209-8c0f0e7a6012 h1:Xvxck3tE5FW7F7bTS97iNM2ADMyCMJztVqn5HYKdJGo=
|
|
18
|
+
github.com/tree-sitter/tree-sitter-go v0.21.3-0.20240818010209-8c0f0e7a6012/go.mod h1:T40D0O1cPvUU/+AmiXVXy1cncYQT6wem4Z0g4SfAYvY=
|
|
19
|
+
github.com/tree-sitter/tree-sitter-html v0.20.5-0.20240818004741-d11201a263d0 h1:c46K6uh5Dz00zJeU9BfjXdb8I+E4RkUdfnWJpQADXFo=
|
|
20
|
+
github.com/tree-sitter/tree-sitter-html v0.20.5-0.20240818004741-d11201a263d0/go.mod h1:hcNt/kOJHcIcuMvouE7LJcYdeFUFbVpBJ6d4wmOA+tU=
|
|
21
|
+
github.com/tree-sitter/tree-sitter-java v0.21.1-0.20240824015150-576d8097e495 h1:jrt4qbJVEFs4H93/ITxygHc6u0TGqAkkate7TQ4wFSA=
|
|
22
|
+
github.com/tree-sitter/tree-sitter-java v0.21.1-0.20240824015150-576d8097e495/go.mod h1:oyaR7fLnRV0hT9z6qwE9GkaeTom/hTDwK3H2idcOJFc=
|
|
23
|
+
github.com/tree-sitter/tree-sitter-javascript v0.21.5-0.20240818005344-15887341e5b5 h1:om4X9AVg3asL8gxNJDcz4e/Wp+VpQj1PY3uJXKr6EOg=
|
|
24
|
+
github.com/tree-sitter/tree-sitter-javascript v0.21.5-0.20240818005344-15887341e5b5/go.mod h1:nNqgPoV/h9uYWk6kYEFdEAhNVOacpfpRW5SFmdaP4tU=
|
|
25
|
+
github.com/tree-sitter/tree-sitter-json v0.21.1-0.20240818005659-bdd69eb8c8a5 h1:pfV3G3k7NCKqKk8THBmyuh2zA33lgYHS3GVrzRR8ry4=
|
|
26
|
+
github.com/tree-sitter/tree-sitter-json v0.21.1-0.20240818005659-bdd69eb8c8a5/go.mod h1:GbMKRjLfk0H+PI7nLi1Sx5lHf5wCpLz9al8tQYSxpEk=
|
|
27
|
+
github.com/tree-sitter/tree-sitter-php v0.22.9-0.20240819002312-a552625b56c1 h1:ZXZMDwE+IhUtGug4Brv6NjJWUU3rfkZBKpemf6RY8/g=
|
|
28
|
+
github.com/tree-sitter/tree-sitter-php v0.22.9-0.20240819002312-a552625b56c1/go.mod h1:UKCLuYnJ312Mei+3cyTmGOHzn0YAnaPRECgJmHtzrqs=
|
|
29
|
+
github.com/tree-sitter/tree-sitter-python v0.21.1-0.20240818005537-55a9b8a4fbfb h1:EXEM82lFM7JjJb6qiKZXkpIDaCcbV2obNn82ghwj9lw=
|
|
30
|
+
github.com/tree-sitter/tree-sitter-python v0.21.1-0.20240818005537-55a9b8a4fbfb/go.mod h1:lXCF1nGG5Dr4J3BTS0ObN4xJCCICiSu/b+Xe/VqMV7g=
|
|
31
|
+
github.com/tree-sitter/tree-sitter-ruby v0.21.1-0.20240818211811-7dbc1e2d0e2d h1:fcYCvoXdcP1uRQYXqJHRy6Hec+uKScQdKVtMwK9JeCI=
|
|
32
|
+
github.com/tree-sitter/tree-sitter-ruby v0.21.1-0.20240818211811-7dbc1e2d0e2d/go.mod h1:T1nShQ4v5AJtozZ8YyAS4uzUtDAJj/iv4YfwXSbUHzg=
|
|
33
|
+
github.com/tree-sitter/tree-sitter-rust v0.21.3-0.20240818005432-2b43eafe6447 h1:o9alBu1J/WjrcTKEthYtXmdkDc5OVXD+PqlvnEZ0Lzc=
|
|
34
|
+
github.com/tree-sitter/tree-sitter-rust v0.21.3-0.20240818005432-2b43eafe6447/go.mod h1:1Oh95COkkTn6Ezp0vcMbvfhRP5gLeqqljR0BYnBzWvc=
|
|
35
|
+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|
36
|
+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
package/grammar.js
CHANGED
|
@@ -18,11 +18,17 @@
|
|
|
18
18
|
|
|
19
19
|
/// <reference path="node_modules/tree-sitter-cli/dsl.d.ts" />
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* Operator precedences
|
|
23
|
-
*/
|
|
21
|
+
/** Precedences */
|
|
24
22
|
const PREC = {
|
|
25
|
-
|
|
23
|
+
QUALIFIED_IDENTIFIER: 31,
|
|
24
|
+
DECLARED_TYPE: 30,
|
|
25
|
+
CONSTRAINED_TYPE: 30,
|
|
26
|
+
NULLABLE_TYPE: 29,
|
|
27
|
+
UNION_DEFAULT_TYPE: 29,
|
|
28
|
+
UNION_TYPE: 28,
|
|
29
|
+
FUN_TYPE: 27,
|
|
30
|
+
|
|
31
|
+
ACCESS: 22,
|
|
26
32
|
NON_NULL: 21,
|
|
27
33
|
NEG: 20,
|
|
28
34
|
NOT: 19,
|
|
@@ -45,13 +51,6 @@ const PREC = {
|
|
|
45
51
|
READ: -8,
|
|
46
52
|
FUN: -11,
|
|
47
53
|
|
|
48
|
-
DECLARED_TYPE: 30,
|
|
49
|
-
CONSTRAINED_TYPE: 30,
|
|
50
|
-
NULLABLE_TYPE: 29,
|
|
51
|
-
UNION_DEFAULT_TYPE: 29,
|
|
52
|
-
UNION_TYPE: 28,
|
|
53
|
-
FUN_TYPE: 27,
|
|
54
|
-
|
|
55
54
|
AMEND_EXPR: 1,
|
|
56
55
|
OBJ_MEMBER: -2,
|
|
57
56
|
};
|
|
@@ -148,6 +147,7 @@ module.exports = grammar({
|
|
|
148
147
|
|
|
149
148
|
conflicts: $ => [
|
|
150
149
|
[$.typedIdentifier, $.unqualifiedAccessExpr],
|
|
150
|
+
[$.qualifiedIdentifier]
|
|
151
151
|
],
|
|
152
152
|
|
|
153
153
|
rules: {
|
|
@@ -389,7 +389,7 @@ module.exports = grammar({
|
|
|
389
389
|
|
|
390
390
|
stringLiteralType: $ => $.stringConstant,
|
|
391
391
|
|
|
392
|
-
declaredType: $ => prec.right(seq($.qualifiedIdentifier, optional($.typeArgumentList))),
|
|
392
|
+
declaredType: $ => prec.right(PREC.DECLARED_TYPE, seq($.qualifiedIdentifier, optional($.typeArgumentList))),
|
|
393
393
|
|
|
394
394
|
parenthesizedType: $ => seq("(", $._type, ")"),
|
|
395
395
|
|
|
@@ -844,10 +844,10 @@ module.exports = grammar({
|
|
|
844
844
|
|
|
845
845
|
functionLiteralExpr: $ => prec(PREC.FUN, seq($.parameterList, "->", $._expr)),
|
|
846
846
|
|
|
847
|
-
qualifiedIdentifier: $ =>
|
|
847
|
+
qualifiedIdentifier: $ => seq(
|
|
848
848
|
$.identifier,
|
|
849
849
|
repeat(seq(".", $.identifier)),
|
|
850
|
-
)
|
|
850
|
+
),
|
|
851
851
|
|
|
852
852
|
// TODO: adapt to pkl
|
|
853
853
|
identifier: $ => {
|
package/package.json
CHANGED
package/pyproject.toml
CHANGED
|
@@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tree-sitter-pkl"
|
|
7
7
|
description = "Parser for Pkl programming language"
|
|
8
|
-
version = "0.18.
|
|
8
|
+
version = "0.18.1"
|
|
9
9
|
keywords = ["incremental", "parsing", "tree-sitter", "pkl"]
|
|
10
10
|
classifiers = [
|
|
11
11
|
"Intended Audience :: Developers",
|
package/src/grammar.json
CHANGED
|
@@ -1147,7 +1147,7 @@
|
|
|
1147
1147
|
},
|
|
1148
1148
|
"declaredType": {
|
|
1149
1149
|
"type": "PREC_RIGHT",
|
|
1150
|
-
"value":
|
|
1150
|
+
"value": 30,
|
|
1151
1151
|
"content": {
|
|
1152
1152
|
"type": "SEQ",
|
|
1153
1153
|
"members": [
|
|
@@ -3237,7 +3237,7 @@
|
|
|
3237
3237
|
},
|
|
3238
3238
|
"subscriptExpr": {
|
|
3239
3239
|
"type": "PREC_LEFT",
|
|
3240
|
-
"value":
|
|
3240
|
+
"value": 22,
|
|
3241
3241
|
"content": {
|
|
3242
3242
|
"type": "SEQ",
|
|
3243
3243
|
"members": [
|
|
@@ -3880,7 +3880,7 @@
|
|
|
3880
3880
|
},
|
|
3881
3881
|
"superAccessExpr": {
|
|
3882
3882
|
"type": "PREC_LEFT",
|
|
3883
|
-
"value":
|
|
3883
|
+
"value": 22,
|
|
3884
3884
|
"content": {
|
|
3885
3885
|
"type": "SEQ",
|
|
3886
3886
|
"members": [
|
|
@@ -3913,7 +3913,7 @@
|
|
|
3913
3913
|
},
|
|
3914
3914
|
"superSubscriptExpr": {
|
|
3915
3915
|
"type": "PREC_LEFT",
|
|
3916
|
-
"value":
|
|
3916
|
+
"value": 22,
|
|
3917
3917
|
"content": {
|
|
3918
3918
|
"type": "SEQ",
|
|
3919
3919
|
"members": [
|
|
@@ -3943,7 +3943,7 @@
|
|
|
3943
3943
|
},
|
|
3944
3944
|
"qualifiedAccessExpr": {
|
|
3945
3945
|
"type": "PREC_LEFT",
|
|
3946
|
-
"value":
|
|
3946
|
+
"value": 22,
|
|
3947
3947
|
"content": {
|
|
3948
3948
|
"type": "SEQ",
|
|
3949
3949
|
"members": [
|
|
@@ -4014,33 +4014,29 @@
|
|
|
4014
4014
|
}
|
|
4015
4015
|
},
|
|
4016
4016
|
"qualifiedIdentifier": {
|
|
4017
|
-
"type": "
|
|
4018
|
-
"
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
"
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
"name": "identifier"
|
|
4038
|
-
}
|
|
4039
|
-
]
|
|
4040
|
-
}
|
|
4017
|
+
"type": "SEQ",
|
|
4018
|
+
"members": [
|
|
4019
|
+
{
|
|
4020
|
+
"type": "SYMBOL",
|
|
4021
|
+
"name": "identifier"
|
|
4022
|
+
},
|
|
4023
|
+
{
|
|
4024
|
+
"type": "REPEAT",
|
|
4025
|
+
"content": {
|
|
4026
|
+
"type": "SEQ",
|
|
4027
|
+
"members": [
|
|
4028
|
+
{
|
|
4029
|
+
"type": "STRING",
|
|
4030
|
+
"value": "."
|
|
4031
|
+
},
|
|
4032
|
+
{
|
|
4033
|
+
"type": "SYMBOL",
|
|
4034
|
+
"name": "identifier"
|
|
4035
|
+
}
|
|
4036
|
+
]
|
|
4041
4037
|
}
|
|
4042
|
-
|
|
4043
|
-
|
|
4038
|
+
}
|
|
4039
|
+
]
|
|
4044
4040
|
},
|
|
4045
4041
|
"identifier": {
|
|
4046
4042
|
"type": "TOKEN",
|
|
@@ -4178,6 +4174,9 @@
|
|
|
4178
4174
|
[
|
|
4179
4175
|
"typedIdentifier",
|
|
4180
4176
|
"unqualifiedAccessExpr"
|
|
4177
|
+
],
|
|
4178
|
+
[
|
|
4179
|
+
"qualifiedIdentifier"
|
|
4181
4180
|
]
|
|
4182
4181
|
],
|
|
4183
4182
|
"precedences": [],
|