@apple/tree-sitter-pkl 0.16.0 → 0.17.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.
Files changed (58) hide show
  1. package/CHANGELOG.adoc +40 -0
  2. package/Cargo.lock +1 -1
  3. package/Cargo.toml +1 -1
  4. package/Package.swift +24 -0
  5. package/README.md +42 -0
  6. package/bindings/c/tree-sitter-pkl.h +16 -0
  7. package/bindings/swift/TreeSitterPkl/pkl.h +16 -0
  8. package/grammar.js +147 -63
  9. package/package.json +3 -4
  10. package/queries/highlights.scm +3 -8
  11. package/queries/injections.scm +3 -3
  12. package/src/grammar.json +750 -353
  13. package/src/node-types.json +1768 -1043
  14. package/src/parser.c +45772 -50670
  15. package/src/scanner.c +60 -28
  16. package/src/tree_sitter/alloc.h +54 -0
  17. package/src/tree_sitter/array.h +290 -0
  18. package/src/tree_sitter/parser.h +54 -13
  19. package/test/corpus/basic/annotation.txt +243 -0
  20. package/test/corpus/basic/comments.txt +41 -0
  21. package/test/corpus/basic/shebangComment.txt +15 -0
  22. package/test/corpus/basic/types.txt +232 -0
  23. package/test/corpus/class/constModifier.txt +24 -0
  24. package/test/corpus/class/fixedModifier.txt +24 -0
  25. package/test/corpus/expr/binary.txt +109 -0
  26. package/test/corpus/expr/functionLiteral.txt +23 -0
  27. package/test/corpus/expr/if.txt +15 -0
  28. package/test/corpus/expr/import.txt +20 -0
  29. package/test/corpus/expr/let.txt +17 -0
  30. package/test/corpus/expr/new.txt +36 -0
  31. package/test/corpus/expr/qualifiedAccess.txt +95 -0
  32. package/test/corpus/expr/read.txt +29 -0
  33. package/test/corpus/expr/throw.txt +14 -0
  34. package/test/corpus/expr/trace.txt +14 -0
  35. package/test/corpus/module/moduleHeader1.txt +23 -0
  36. package/test/corpus/module/moduleHeader2.txt +29 -0
  37. package/test/corpus/module/moduleHeader3.error.txt +23 -0
  38. package/test/corpus/module/moduleHeader4.txt +34 -0
  39. package/test/corpus/module/moduleHeader5.txt +16 -0
  40. package/test/corpus/module/moduleHeader6.txt +17 -0
  41. package/test/corpus/number/underscores.txt +99 -0
  42. package/test/corpus/object/objectAmendChain.txt +38 -0
  43. package/test/corpus/object/objectElementsWithParens.txt +51 -0
  44. package/test/corpus/object/objectGenerator.txt +53 -0
  45. package/test/corpus/object/objectMember.txt +129 -0
  46. package/test/corpus/object/objectMemberPredicate.txt +41 -0
  47. package/test/corpus/object/objectSpread.txt +51 -0
  48. package/test/corpus/object/objectWhenGenerator.txt +71 -0
  49. package/test/corpus/string/customStringDelimiters.txt +397 -0
  50. package/test/corpus/string/missingDelimiter.txt +28 -0
  51. package/test/corpus/string/multiline.txt +39 -0
  52. package/test/corpus/string/multilineInterpolation.txt +102 -0
  53. package/test/corpus/string/simple.txt +13 -0
  54. package/test/corpus/string/singleLineEscapes.txt +64 -0
  55. package/test/corpus/string/singleLineInterpolation.txt +94 -0
  56. package/test/corpus/string/stringWithTwoSlashes.txt +20 -0
  57. package/README.adoc +0 -61
  58. package/src/synctests.ts +0 -44
@@ -3,7 +3,7 @@
3
3
  (clazz (identifier) @type)
4
4
  (typeAlias (identifier) @type)
5
5
  ((identifier) @type
6
- (match? @type "^[A-Z]"))
6
+ (#match? @type "^[A-Z]"))
7
7
 
8
8
  (typeArgumentList
9
9
  "<" @punctuation.bracket
@@ -55,6 +55,7 @@
55
55
  (lineComment) @comment
56
56
  (blockComment) @comment
57
57
  (docComment) @comment
58
+ (shebangComment) @comment
58
59
 
59
60
  ; Operators
60
61
 
@@ -79,10 +80,6 @@
79
80
  "%" @operator
80
81
  "|>" @operator
81
82
 
82
- "?" @operator.type
83
- "|" @operator.type
84
- "->" @operator.type
85
-
86
83
  "," @punctuation.delimiter
87
84
  ":" @punctuation.delimiter
88
85
  "." @punctuation.delimiter
@@ -90,7 +87,7 @@
90
87
 
91
88
  "(" @punctuation.bracket
92
89
  ")" @punctuation.bracket
93
- ; "[" @punctuation.bracket TODO: FIGURE OUT HOW TO REFER TO CUSTOM TOKENS
90
+ "[" @punctuation.bracket
94
91
  "]" @punctuation.bracket
95
92
  "{" @punctuation.bracket
96
93
  "}" @punctuation.bracket
@@ -120,7 +117,6 @@
120
117
  (moduleExpr "module" @type.builtin)
121
118
  "module" @keyword
122
119
  "new" @keyword
123
- "nothing" @type.builtin
124
120
  (nullLiteral) @constant.builtin
125
121
  "open" @keyword
126
122
  "out" @keyword
@@ -134,5 +130,4 @@
134
130
  "trace" @function.method.builtin
135
131
  (trueLiteral) @constant.builtin
136
132
  "typealias" @keyword
137
- "unknown" @type.builtin
138
133
  "when" @keyword
@@ -3,7 +3,7 @@
3
3
  ; * string delimiters are considered part of the regex
4
4
  (
5
5
  ((methodCallExpr (identifier) @methodName (argumentList (slStringLiteral) @injection.content))
6
- (set! injection.language "regex"))
7
- (eq? @methodName "Regex"))
6
+ (#set! injection.language "regex"))
7
+ (#eq? @methodName "Regex"))
8
8
 
9
- ; TODO: inject markdown into doc comments
9
+ ; TODO: inject markdown into doc comments