feat: add Uxn Tal

This commit is contained in:
Amaan Qureshi 2023-03-07 04:32:20 -05:00 committed by Christian Clason
parent 356c9db347
commit ba4bce9bb7
8 changed files with 145 additions and 0 deletions

View file

@ -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)

View file

@ -479,6 +479,9 @@
"ungrammar": {
"revision": "debd26fed283d80456ebafa33a06957b0c52e451"
},
"uxntal": {
"revision": "14e47600afef0affffcbfbe1543381b1ac8fbc5c"
},
"v": {
"revision": "66cf9d3086fb5ecc827cb32c64c5d812ab17d2c6"
},

View file

@ -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",

7
queries/uxntal/folds.scm Normal file
View file

@ -0,0 +1,7 @@
[
(macro)
(memory_execution)
(subroutine)
(comment)
] @fold

View file

@ -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

View file

@ -0,0 +1,17 @@
(memory_execution) @auto
[
(subroutine)
(brackets)
] @indent
"}" @indent_end
[ "{" "}" ] @branch
[ "[" "]" ] @branch
[
(ERROR)
(comment)
] @auto

View file

@ -0,0 +1 @@
(comment) @comment

22
queries/uxntal/locals.scm Normal file
View file

@ -0,0 +1,22 @@
; Scopes
[
(program)
(macro)
(memory_execution)
(subroutine)
] @scope
; References
(identifier) @reference
; Definitions
(label
"@"
. (identifier) @definition.function)
(macro
"%"
. (identifier) @definition.macro)