mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 11:06:54 -04:00
feat(pkl): add parser and queries (#8011)
This commit is contained in:
parent
61ec748ef7
commit
fba060b623
5 changed files with 224 additions and 0 deletions
1
SUPPORTED_LANGUAGES.md
generated
1
SUPPORTED_LANGUAGES.md
generated
|
|
@ -208,6 +208,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ ` | | @steelsojka
|
||||||
[php_only](https://github.com/tree-sitter/tree-sitter-php)[^php_only] | unstable | `HFIJL` | | @tk-shirasaka, @calebdw
|
[php_only](https://github.com/tree-sitter/tree-sitter-php)[^php_only] | unstable | `HFIJL` | | @tk-shirasaka, @calebdw
|
||||||
[phpdoc](https://github.com/claytonrcarter/tree-sitter-phpdoc) | unstable | `H ` | | @mikehaertl
|
[phpdoc](https://github.com/claytonrcarter/tree-sitter-phpdoc) | unstable | `H ` | | @mikehaertl
|
||||||
[pioasm](https://github.com/leo60228/tree-sitter-pioasm) | unstable | `H J ` | | @leo60228
|
[pioasm](https://github.com/leo60228/tree-sitter-pioasm) | unstable | `H J ` | | @leo60228
|
||||||
|
[pkl](https://github.com/apple/tree-sitter-pkl) | unstable | `HF J ` | | @ribru17
|
||||||
[po](https://github.com/tree-sitter-grammars/tree-sitter-po) | unstable | `HF J ` | | @amaanq
|
[po](https://github.com/tree-sitter-grammars/tree-sitter-po) | unstable | `HF J ` | | @amaanq
|
||||||
[pod](https://github.com/tree-sitter-perl/tree-sitter-pod) | unstable | `H ` | | @RabbiVeesh, @LeoNerd
|
[pod](https://github.com/tree-sitter-perl/tree-sitter-pod) | unstable | `H ` | | @RabbiVeesh, @LeoNerd
|
||||||
[poe_filter](https://github.com/tree-sitter-grammars/tree-sitter-poe-filter)[^poe_filter] | unstable | `HFIJ ` | | @ObserverOfTime
|
[poe_filter](https://github.com/tree-sitter-grammars/tree-sitter-poe-filter)[^poe_filter] | unstable | `HFIJ ` | | @ObserverOfTime
|
||||||
|
|
|
||||||
|
|
@ -1608,6 +1608,14 @@ return {
|
||||||
maintainers = { '@leo60228' },
|
maintainers = { '@leo60228' },
|
||||||
tier = 2,
|
tier = 2,
|
||||||
},
|
},
|
||||||
|
pkl = {
|
||||||
|
install_info = {
|
||||||
|
revision = '4fc94a102c25ea383d70397dac7e677ca3731f1e',
|
||||||
|
url = 'https://github.com/apple/tree-sitter-pkl',
|
||||||
|
},
|
||||||
|
maintainers = { '@ribru17' },
|
||||||
|
tier = 2,
|
||||||
|
},
|
||||||
po = {
|
po = {
|
||||||
install_info = {
|
install_info = {
|
||||||
revision = 'bd860a0f57f697162bf28e576674be9c1500db5e',
|
revision = 'bd860a0f57f697162bf28e576674be9c1500db5e',
|
||||||
|
|
|
||||||
6
runtime/queries/pkl/folds.scm
Normal file
6
runtime/queries/pkl/folds.scm
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
[
|
||||||
|
(clazz)
|
||||||
|
(objectBody)
|
||||||
|
] @fold
|
||||||
|
|
||||||
|
(importClause)+ @fold
|
||||||
203
runtime/queries/pkl/highlights.scm
Normal file
203
runtime/queries/pkl/highlights.scm
Normal file
|
|
@ -0,0 +1,203 @@
|
||||||
|
(identifier) @variable
|
||||||
|
|
||||||
|
(qualifiedAccessExpr
|
||||||
|
(identifier) @function.method.call
|
||||||
|
.
|
||||||
|
(argumentList))
|
||||||
|
|
||||||
|
(qualifiedAccessExpr
|
||||||
|
(identifier) @variable.member .)
|
||||||
|
|
||||||
|
; Operators
|
||||||
|
[
|
||||||
|
"??"
|
||||||
|
"@"
|
||||||
|
"="
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
"!"
|
||||||
|
"=="
|
||||||
|
"!="
|
||||||
|
"<="
|
||||||
|
">="
|
||||||
|
"&&"
|
||||||
|
"||"
|
||||||
|
"+"
|
||||||
|
"-"
|
||||||
|
"**"
|
||||||
|
"*"
|
||||||
|
"/"
|
||||||
|
"~/"
|
||||||
|
"%"
|
||||||
|
"|>"
|
||||||
|
"..."
|
||||||
|
"|"
|
||||||
|
"->"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
[
|
||||||
|
","
|
||||||
|
":"
|
||||||
|
"."
|
||||||
|
"?."
|
||||||
|
] @punctuation.delimiter
|
||||||
|
|
||||||
|
[
|
||||||
|
"("
|
||||||
|
")"
|
||||||
|
"["
|
||||||
|
"]"
|
||||||
|
"{"
|
||||||
|
"}"
|
||||||
|
] @punctuation.bracket
|
||||||
|
|
||||||
|
; Types
|
||||||
|
(clazz
|
||||||
|
(identifier) @type.definition)
|
||||||
|
|
||||||
|
(typeAlias
|
||||||
|
(identifier) @type.definition)
|
||||||
|
|
||||||
|
((identifier) @type
|
||||||
|
(#lua-match? @type "^[A-Z]"))
|
||||||
|
|
||||||
|
(typeArgumentList
|
||||||
|
[
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
] @punctuation.bracket)
|
||||||
|
|
||||||
|
; Method definitions
|
||||||
|
(classMethod
|
||||||
|
(methodHeader
|
||||||
|
(identifier) @function.method))
|
||||||
|
|
||||||
|
(objectMethod
|
||||||
|
(methodHeader
|
||||||
|
(identifier) @function.method))
|
||||||
|
|
||||||
|
; Identifiers
|
||||||
|
(classProperty
|
||||||
|
(identifier) @property)
|
||||||
|
|
||||||
|
(objectProperty
|
||||||
|
(identifier) @property)
|
||||||
|
|
||||||
|
(parameterList
|
||||||
|
(typedIdentifier
|
||||||
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
|
(objectBodyParameters
|
||||||
|
(typedIdentifier
|
||||||
|
(identifier) @variable.parameter))
|
||||||
|
|
||||||
|
; Literals
|
||||||
|
[
|
||||||
|
(stringConstant)
|
||||||
|
(slStringLiteralExpr)
|
||||||
|
(mlStringLiteralExpr)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
(escapeSequence) @string.escape
|
||||||
|
|
||||||
|
(intLiteralExpr) @number
|
||||||
|
|
||||||
|
(floatLiteralExpr) @number.float
|
||||||
|
|
||||||
|
(stringInterpolation
|
||||||
|
[
|
||||||
|
"\\("
|
||||||
|
"\\#("
|
||||||
|
"\\##("
|
||||||
|
"\\###("
|
||||||
|
"\\####("
|
||||||
|
"\\#####("
|
||||||
|
"\\######("
|
||||||
|
] @punctuation.special
|
||||||
|
")" @punctuation.special)
|
||||||
|
|
||||||
|
(nullableType
|
||||||
|
"?" @punctuation.special)
|
||||||
|
|
||||||
|
[
|
||||||
|
(lineComment)
|
||||||
|
(blockComment)
|
||||||
|
] @comment @spell
|
||||||
|
|
||||||
|
(docComment) @comment.documentation @spell
|
||||||
|
|
||||||
|
(shebangComment) @keyword.directive
|
||||||
|
|
||||||
|
; Keywords
|
||||||
|
[
|
||||||
|
"abstract"
|
||||||
|
"external"
|
||||||
|
"for"
|
||||||
|
"is"
|
||||||
|
"let"
|
||||||
|
"new"
|
||||||
|
"out"
|
||||||
|
] @keyword
|
||||||
|
|
||||||
|
"function" @keyword.function
|
||||||
|
|
||||||
|
[
|
||||||
|
"as"
|
||||||
|
"in"
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
|
[
|
||||||
|
"typealias"
|
||||||
|
"class"
|
||||||
|
"module"
|
||||||
|
] @keyword.type
|
||||||
|
|
||||||
|
[
|
||||||
|
"import"
|
||||||
|
"import*"
|
||||||
|
"amends"
|
||||||
|
"extends"
|
||||||
|
] @keyword.import
|
||||||
|
|
||||||
|
[
|
||||||
|
"when"
|
||||||
|
"if"
|
||||||
|
"else"
|
||||||
|
] @keyword.conditional
|
||||||
|
|
||||||
|
(modifier) @keyword.modifier
|
||||||
|
|
||||||
|
(importExpr
|
||||||
|
[
|
||||||
|
"import"
|
||||||
|
"import*"
|
||||||
|
] @function.builtin)
|
||||||
|
|
||||||
|
(moduleExpr
|
||||||
|
"module" @type.builtin)
|
||||||
|
|
||||||
|
[
|
||||||
|
(outerExpr)
|
||||||
|
"super"
|
||||||
|
(thisExpr)
|
||||||
|
] @variable.builtin
|
||||||
|
|
||||||
|
[
|
||||||
|
"read"
|
||||||
|
"read?"
|
||||||
|
"read*"
|
||||||
|
"throw"
|
||||||
|
"trace"
|
||||||
|
] @function.builtin
|
||||||
|
|
||||||
|
(nullLiteralExpr) @constant.builtin
|
||||||
|
|
||||||
|
[
|
||||||
|
(falseLiteralExpr)
|
||||||
|
(trueLiteralExpr)
|
||||||
|
] @boolean
|
||||||
|
|
||||||
|
(newExpr
|
||||||
|
(declaredType
|
||||||
|
(qualifiedIdentifier
|
||||||
|
(identifier) @constructor .)))
|
||||||
6
runtime/queries/pkl/injections.scm
Normal file
6
runtime/queries/pkl/injections.scm
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
([
|
||||||
|
(lineComment)
|
||||||
|
(blockComment)
|
||||||
|
(docComment)
|
||||||
|
] @injection.content
|
||||||
|
(#set! injection.language "comment"))
|
||||||
Loading…
Add table
Add a link
Reference in a new issue