Update teal highlights

This commit is contained in:
Corey Williamson 2021-03-23 16:06:02 -05:00 committed by Stephan Seitz
parent 06a6510637
commit 548a0d8d7f
3 changed files with 44 additions and 19 deletions

View file

@ -385,7 +385,6 @@ list.teal = {
install_info = {
url = "https://github.com/euclidianAce/tree-sitter-teal",
files = { "src/parser.c", "src/scanner.c" },
requires_generate_from_grammar = true,
},
maintainers = {'@euclidianAce'},
}

View file

@ -10,3 +10,7 @@
(anon_function)
(table_constructor)
] @fold
(record_body
(record_entry
value: (record_body)) @fold)

View file

@ -1,4 +1,21 @@
;; Primitives
(boolean) @boolean
(comment) @comment
(shebang_comment) @comment
(identifier) @variable
((identifier) @variable.builtin
(#eq? @variable.builtin "self"))
(nil) @constant.builtin
(number) @number
(string) @string
(table_constructor ["{" "}"] @constructor)
(varargs "..." @constant.builtin)
[ "," "." ":" ";" ] @punctuation.delimiter
(escape_sequence) @string.escape
(format_specifier) @string.escape
;; Basic statements/Keywords
[ "if" "then" "elseif" "else" ] @conditional
[ "for" "while" "repeat" "until" ] @repeat
@ -13,12 +30,9 @@
(enum_declaration "global" @keyword)
;; Ops
[ "not" "and" "or" "as" "is" ] @keyword.operator
[ "=" "~=" "==" "<=" ">=" "<" ">"
"+" "-" "%" "/" "//" "*" "^"
"&" "~" "|" ">>" "<<"
".." "#" ] @operator
(bin_op (op) @operator)
(unary_op (op) @operator)
[ "=" "as" ] @operator
;; Functions
(function_statement
@ -86,17 +100,25 @@
. attribute: (attribute) @attribute
. ">" @punctuation.bracket))
[ "(" ")" "[" "]" "{" "}" ] @punctuation.bracket
(boolean) @boolean
(comment) @comment
(shebang_comment) @comment
(identifier) @variable
((identifier) @variable.builtin
(#eq? @variable.builtin "self"))
(nil) @constant.builtin
(number) @number
(string) @string
(table_constructor ["{" "}"] @constructor)
(varargs "..." @constant.builtin)
[ "," "." ":" ";" ] @punctuation.delimiter
;; Only highlight format specifiers in calls to string.format
;; string.format('...')
;(function_call
; called_object: (index
; (identifier) @base
; key: (identifier) @entry)
; arguments: (arguments .
; (string (format_specifier) @string.escape))
;
; (#eq? @base "string")
; (#eq? @entry "format"))
;; ('...'):format()
;(function_call
; called_object: (method_index
; (string (format_specifier) @string.escape)
; key: (identifier) @func-name)
; (#eq? @func-name "format"))
(ERROR) @error