@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 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 (2024-03-27)
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
@@ -1,7 +1,7 @@
1
1
  cmake_minimum_required(VERSION 3.13)
2
2
 
3
3
  project(tree-sitter-pkl
4
- VERSION "0.18.0"
4
+ VERSION "0.18.1"
5
5
  DESCRIPTION "Parser for Pkl programming language"
6
6
  HOMEPAGE_URL "https://github.com/apple/tree-sitter-pkl"
7
7
  LANGUAGES C)
package/Cargo.lock CHANGED
@@ -73,7 +73,7 @@ dependencies = [
73
73
 
74
74
  [[package]]
75
75
  name = "tree-sitter-pkl"
76
- version = "0.18.0"
76
+ version = "0.18.1"
77
77
  dependencies = [
78
78
  "cc",
79
79
  "tree-sitter",
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.0"
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
@@ -4,7 +4,7 @@ endif
4
4
 
5
5
  LANGUAGE_NAME := tree-sitter-pkl
6
6
  HOMEPAGE_URL := https://github.com/apple/tree-sitter-pkl
7
- VERSION := 0.18.0
7
+ VERSION := 0.18.1
8
8
 
9
9
  # repository
10
10
  SRC_DIR := src
package/go.mod CHANGED
@@ -3,3 +3,5 @@ module github.com/apple/tree-sitter-pkl
3
3
  go 1.22
4
4
 
5
5
  require github.com/tree-sitter/go-tree-sitter v0.24.0
6
+
7
+ require github.com/mattn/go-pointer v0.0.1 // indirect
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
- ACCESS: 99,
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: $ => prec.left(seq(
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apple/tree-sitter-pkl",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "description": "Pkl grammar for node-tree-sitter",
5
5
  "repository": {
6
6
  "type": "git",
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.0"
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": 0,
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": 99,
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": 99,
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": 99,
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": 99,
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": "PREC_LEFT",
4018
- "value": 0,
4019
- "content": {
4020
- "type": "SEQ",
4021
- "members": [
4022
- {
4023
- "type": "SYMBOL",
4024
- "name": "identifier"
4025
- },
4026
- {
4027
- "type": "REPEAT",
4028
- "content": {
4029
- "type": "SEQ",
4030
- "members": [
4031
- {
4032
- "type": "STRING",
4033
- "value": "."
4034
- },
4035
- {
4036
- "type": "SYMBOL",
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": [],