aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaan Qureshi <amaanq12@gmail.com>2023-03-07 04:32:20 -0500
committerChristian Clason <c.clason@uni-graz.at>2023-03-07 12:49:04 +0100
commitba4bce9bb79f5a5fb2e7b5a6b9b4b0fb256f3db9 (patch)
tree563c7e02ee7727d422ea6d76bba4d882af8d4693
parentUpdate parsers: yuck (diff)
downloadnvim-treesitter-ba4bce9bb79f5a5fb2e7b5a6b9b4b0fb256f3db9.tar
nvim-treesitter-ba4bce9bb79f5a5fb2e7b5a6b9b4b0fb256f3db9.tar.gz
nvim-treesitter-ba4bce9bb79f5a5fb2e7b5a6b9b4b0fb256f3db9.tar.bz2
nvim-treesitter-ba4bce9bb79f5a5fb2e7b5a6b9b4b0fb256f3db9.tar.lz
nvim-treesitter-ba4bce9bb79f5a5fb2e7b5a6b9b4b0fb256f3db9.tar.xz
nvim-treesitter-ba4bce9bb79f5a5fb2e7b5a6b9b4b0fb256f3db9.tar.zst
nvim-treesitter-ba4bce9bb79f5a5fb2e7b5a6b9b4b0fb256f3db9.zip
feat: add Uxn Tal
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua10
-rw-r--r--queries/uxntal/folds.scm7
-rw-r--r--queries/uxntal/highlights.scm84
-rw-r--r--queries/uxntal/indents.scm17
-rw-r--r--queries/uxntal/injections.scm1
-rw-r--r--queries/uxntal/locals.scm22
8 files changed, 145 insertions, 0 deletions
diff --git a/README.md b/README.md
index 6371f7c10..78a228a07 100644
--- a/README.md
+++ b/README.md
@@ -333,6 +333,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [twig](https://github.com/gbprod/tree-sitter-twig) (maintained by @gbprod)
- [x] [typescript](https://github.com/tree-sitter/tree-sitter-typescript) (maintained by @steelsojka)
- [x] [ungrammar](https://github.com/Philipp-M/tree-sitter-ungrammar) (maintained by @Philipp-M, @amaanq)
+- [x] [uxn tal](https://github.com/amaanq/tree-sitter-uxntal) (maintained by @amaanq)
- [x] [v](https://github.com/vlang/vls) (maintained by @kkharji)
- [x] [vala](https://github.com/vala-lang/tree-sitter-vala) (maintained by @Prince781)
- [x] [verilog](https://github.com/tree-sitter/tree-sitter-verilog) (maintained by @zegervdv)
diff --git a/lockfile.json b/lockfile.json
index 1f014fefc..2deb48d6b 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -479,6 +479,9 @@
"ungrammar": {
"revision": "debd26fed283d80456ebafa33a06957b0c52e451"
},
+ "uxntal": {
+ "revision": "14e47600afef0affffcbfbe1543381b1ac8fbc5c"
+ },
"v": {
"revision": "66cf9d3086fb5ecc827cb32c64c5d812ab17d2c6"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 1185d02d3..a2fbe23d8 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1520,6 +1520,16 @@ list.ungrammar = {
maintainers = { "@Philipp-M", "@amaanq" },
}
+list.uxntal = {
+ install_info = {
+ url = "https://github.com/amaanq/tree-sitter-uxntal",
+ files = { "src/parser.c", "src/scanner.c" },
+ },
+ filetype = "tal",
+ maintainers = { "@amaanq" },
+ readme_name = "uxn tal",
+}
+
list.v = {
install_info = {
url = "https://github.com/vlang/vls",
diff --git a/queries/uxntal/folds.scm b/queries/uxntal/folds.scm
new file mode 100644
index 000000000..2043df867
--- /dev/null
+++ b/queries/uxntal/folds.scm
@@ -0,0 +1,7 @@
+[
+ (macro)
+ (memory_execution)
+ (subroutine)
+
+ (comment)
+] @fold
diff --git a/queries/uxntal/highlights.scm b/queries/uxntal/highlights.scm
new file mode 100644
index 000000000..25b1148d7
--- /dev/null
+++ b/queries/uxntal/highlights.scm
@@ -0,0 +1,84 @@
+; Includes
+
+(include
+ "~" @include
+ _ @text.uri @string.special)
+
+; Macros
+
+(macro
+ "%"
+ (identifier) @function.macro)
+
+((identifier) @function.macro
+ (#lua-match? @function.macro "^[a-z]?[0-9]*[A-Z-_]+$"))
+
+(rune
+ . rune_start: (rune_char ",")
+ . (identifier) @function.call)
+
+(rune
+ . rune_start: (rune_char ";")
+ . (identifier) @function.call)
+
+((identifier) @function.call
+ (#lua-match? @function.call "^:"))
+
+; Keywords
+
+(opcode) @keyword
+
+; Labels
+
+(label
+ "@" @symbol
+ (identifier) @function)
+
+(sublabel_reference
+ (identifier) @namespace
+ "/" @punctuation.delimiter
+ (identifier) @label)
+
+; Repeats
+
+((identifier) @repeat
+ (#eq? @repeat "while"))
+
+; Variables
+
+(identifier) @variable
+
+; Literals
+
+(raw_ascii) @string
+
+(hex_literal
+ "#" @symbol
+ (hex_lit_value) @string.special)
+
+(number) @number
+
+; Punctuation
+
+[ "{" "}" ] @punctuation.bracket
+
+[ "[" "]" ] @punctuation.bracket
+
+[
+ "%"
+ "|"
+ "$"
+ ","
+ "_"
+ "."
+ "-"
+ ";"
+ "="
+ "!"
+ "?"
+ "&"
+] @punctuation.special
+
+; Comments
+
+(comment) @comment @spell
diff --git a/queries/uxntal/indents.scm b/queries/uxntal/indents.scm
new file mode 100644
index 000000000..2802cfd1f
--- /dev/null
+++ b/queries/uxntal/indents.scm
@@ -0,0 +1,17 @@
+(memory_execution) @auto
+
+[
+ (subroutine)
+ (brackets)
+] @indent
+
+"}" @indent_end
+
+[ "{" "}" ] @branch
+
+[ "[" "]" ] @branch
+
+[
+ (ERROR)
+ (comment)
+] @auto
diff --git a/queries/uxntal/injections.scm b/queries/uxntal/injections.scm
new file mode 100644
index 000000000..4bb7d675d
--- /dev/null
+++ b/queries/uxntal/injections.scm
@@ -0,0 +1 @@
+(comment) @comment
diff --git a/queries/uxntal/locals.scm b/queries/uxntal/locals.scm
new file mode 100644
index 000000000..0a8ddee96
--- /dev/null
+++ b/queries/uxntal/locals.scm
@@ -0,0 +1,22 @@
+; Scopes
+
+[
+ (program)
+ (macro)
+ (memory_execution)
+ (subroutine)
+] @scope
+
+; References
+
+(identifier) @reference
+
+; Definitions
+
+(label
+ "@"
+ . (identifier) @definition.function)
+
+(macro
+ "%"
+ . (identifier) @definition.macro)