aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorObserverOfTime <chronobserver@disroot.org>2023-11-21 02:19:07 +0200
committerObserverOfTime <chronobserver@disroot.org>2023-11-21 13:13:26 +0200
commit6b24db0c8fc1357522320e71c89069fdc66a4237 (patch)
tree7797c1a44ff2e72ae97b5126afc1ed1c321a731b
parentUpdate parsers: devicetree, wing (diff)
downloadnvim-treesitter-6b24db0c8fc1357522320e71c89069fdc66a4237.tar
nvim-treesitter-6b24db0c8fc1357522320e71c89069fdc66a4237.tar.gz
nvim-treesitter-6b24db0c8fc1357522320e71c89069fdc66a4237.tar.bz2
nvim-treesitter-6b24db0c8fc1357522320e71c89069fdc66a4237.tar.lz
nvim-treesitter-6b24db0c8fc1357522320e71c89069fdc66a4237.tar.xz
nvim-treesitter-6b24db0c8fc1357522320e71c89069fdc66a4237.tar.zst
nvim-treesitter-6b24db0c8fc1357522320e71c89069fdc66a4237.zip
feat: add properties parser
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua9
-rw-r--r--queries/properties/highlights.scm28
-rw-r--r--queries/properties/injections.scm2
-rw-r--r--queries/properties/locals.scm3
6 files changed, 46 insertions, 0 deletions
diff --git a/README.md b/README.md
index 559ae50da..bf96df17a 100644
--- a/README.md
+++ b/README.md
@@ -328,6 +328,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [pony](https://github.com/amaanq/tree-sitter-pony) (maintained by @amaanq, @mfelsche)
- [x] [prisma](https://github.com/victorhqc/tree-sitter-prisma) (maintained by @elianiva)
- [x] [promql](https://github.com/MichaHoffmann/tree-sitter-promql) (maintained by @MichaHoffmann)
+- [x] [properties](https://github.com/ObserverOfTime/tree-sitter-properties) (maintained by @ObserverOfTime)
- [x] [proto](https://github.com/treywood/tree-sitter-proto) (maintained by @treywood)
- [x] [prql](https://github.com/PRQL/tree-sitter-prql) (maintained by @matthias-Q)
- [x] [psv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq)
diff --git a/lockfile.json b/lockfile.json
index 94ad3a190..9e1bf1ae3 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -464,6 +464,9 @@
"promql": {
"revision": "77625d78eebc3ffc44d114a07b2f348dff3061b0"
},
+ "properties": {
+ "revision": "97253273bdf8b63546c8006e71ba155ecc27069e"
+ },
"proto": {
"revision": "e9f6b43f6844bd2189b50a422d4e2094313f6aa3"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index dc9135698..b012d514a 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1385,6 +1385,15 @@ list.promql = {
maintainers = { "@MichaHoffmann" },
}
+list.properties = {
+ install_info = {
+ url = "https://github.com/ObserverOfTime/tree-sitter-properties",
+ files = { "src/parser.c" },
+ },
+ filetype = "jproperties",
+ maintainers = { "@ObserverOfTime" },
+}
+
list.proto = {
install_info = {
url = "https://github.com/treywood/tree-sitter-proto",
diff --git a/queries/properties/highlights.scm b/queries/properties/highlights.scm
new file mode 100644
index 000000000..3414294b7
--- /dev/null
+++ b/queries/properties/highlights.scm
@@ -0,0 +1,28 @@
+(comment) @comment @spell
+
+(key) @property
+
+(value) @string
+
+(value (escape) @string.escape)
+
+((value) @boolean
+ (#any-of? @boolean "true" "false"))
+
+((value) @number
+ (#lua-match? @number "^%d+$"))
+
+(index) @number
+
+(property [ "=" ":" ] @operator)
+
+[ "${" "}" ] @punctuation.special
+
+(substitution ":" @punctuation.special)
+
+[ "[" "]" ] @punctuation.bracket
+
+[ "." "\\" ] @punctuation.delimiter
+
+((substitution (key) @constant)
+ (#lua-match? @constant "^[A-Z_][A-Z0-9_]*$"))
diff --git a/queries/properties/injections.scm b/queries/properties/injections.scm
new file mode 100644
index 000000000..321c90add
--- /dev/null
+++ b/queries/properties/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/queries/properties/locals.scm b/queries/properties/locals.scm
new file mode 100644
index 000000000..d9360c465
--- /dev/null
+++ b/queries/properties/locals.scm
@@ -0,0 +1,3 @@
+(property (key) @definition)
+
+(substitution (key) @reference)