nvim-treesitter/queries/commonlisp/highlights.scm

188 lines
3.4 KiB
Scheme
Raw Normal View History

2021-04-05 14:37:53 +02:00
(sym_lit) @variable
;; A highlighting for functions/macros in th cl namespace is available in theHamsta/nvim-treesitter-commonlisp
2021-04-20 00:06:08 +02:00
;(list_lit . (sym_lit) @function.builtin (#cl-standard-function? @function.builtin))
;(list_lit . (sym_lit) @function.builtin (#cl-standard-macro? @function.macro))
2021-04-05 14:37:53 +02:00
2021-04-04 09:45:45 +02:00
(dis_expr) @comment
(defun_keyword) @function.macro
(defun_header
function_name: (_) @function)
(defun_header
lambda_list: (list_lit (sym_lit) @parameter))
(defun_header
keyword: (defun_keyword "defmethod")
2021-04-20 00:06:08 +02:00
lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @symbol)))
2021-04-04 09:45:45 +02:00
(defun_header
lambda_list: (list_lit (list_lit . (sym_lit) @parameter . (_))))
2021-04-05 14:37:53 +02:00
(defun_header
2021-04-20 00:06:08 +02:00
specifier: (sym_lit) @symbol)
2021-04-05 14:37:53 +02:00
2021-04-20 00:06:08 +02:00
[":" "::" "."] @punctuation.special
2021-04-04 09:45:45 +02:00
[
(accumulation_verb)
2021-04-05 14:37:53 +02:00
(for_clause_word)
2021-04-04 09:45:45 +02:00
"for"
"and"
"finally"
"thereis"
"always"
"when"
"if"
"unless"
2021-04-05 14:37:53 +02:00
"else"
2021-04-04 09:45:45 +02:00
"do"
"loop"
"below"
"in"
"from"
"across"
2021-04-05 14:37:53 +02:00
"repeat"
2021-04-04 09:45:45 +02:00
"being"
"into"
"with"
"as"
"while"
2021-04-05 14:37:53 +02:00
"until"
"return"
"initially"
2021-04-04 09:45:45 +02:00
] @function.macro
"=" @operator
2021-04-20 00:06:08 +02:00
(include_reader_macro) @symbol
2021-04-05 14:37:53 +02:00
["#C" "#c"] @number
2021-04-04 09:45:45 +02:00
2021-04-20 00:06:08 +02:00
[(kwd_lit) (self_referential_reader_macro)] @symbol
2021-04-05 14:37:53 +02:00
(package_lit
package: (_) @namespace)
"cl" @namespace
2021-04-04 09:45:45 +02:00
(str_lit) @string
(num_lit) @number
2021-04-05 14:37:53 +02:00
((sym_lit) @boolean (#match? @boolean "^(t|T)$"))
2021-04-04 09:45:45 +02:00
(nil_lit) @constant.builtin
(comment) @comment
;; dynamic variables
((sym_lit) @variable.builtin
(#match? @variable.builtin "^[*].+[*]$"))
;; quote
"'" @string.escape
2021-04-05 14:37:53 +02:00
(format_specifier) @string.escape
2021-04-04 09:45:45 +02:00
(quoting_lit) @string.escape
;; syntax quote
"`" @string.escape
"," @string.escape
",@" @string.escape
(syn_quoting_lit) @string.escape
(unquoting_lit) @none
(unquote_splicing_lit) @none
["(" ")"] @punctuation.bracket
(block_comment) @comment
2021-04-05 14:37:53 +02:00
(with_clause
type: (_) @type)
(for_clause
type: (_) @type)
2021-04-04 09:45:45 +02:00
;; defun-like things
(list_lit
.
(sym_lit) @function.macro
.
(sym_lit) @function
(#eq? @function.macro "deftest"))
2021-04-05 14:37:53 +02:00
;;; Macros and Special Operators
2021-04-04 09:45:45 +02:00
(list_lit
.
(sym_lit) @function.macro
2021-04-05 14:37:53 +02:00
;; For a complete and more efficient version install theHamsta/nvim-treesitter-commonlisp
(#any-of? @function.macro
2021-05-16 23:01:47 +02:00
"let"
"function"
"the"
"unwind-protect"
"labels"
"flet"
"tagbody"
"go"
"symbol-macrolet"
"symbol-macrolet"
"progn"
"prog1"
"error"
"or"
"and"
"defvar"
"defparameter"
"in-package"
"defpackage"
"case"
"ecase"
"typecase"
"etypecase"
"defstruct"
"defclass"
"if"
"when"
"unless"
"cond"
"switch"
"declaim"
"optimize"))
2021-04-04 09:45:45 +02:00
;; constant
((sym_lit) @constant
(#match? @constant "^[+].+[+]$"))
(var_quoting_lit
2021-04-20 00:06:08 +02:00
marker: "#'" @symbol
value: (_) @symbol)
2021-04-04 09:45:45 +02:00
2021-04-20 00:06:08 +02:00
["#" "#p" "#P"] @symbol
2021-04-04 09:45:45 +02:00
(list_lit
.
(sym_lit) @function.builtin
2021-04-05 14:37:53 +02:00
;; For a complete and more efficient version install theHamsta/nvim-treesitter-commonlisp
2021-05-16 23:01:47 +02:00
(#any-of? @function.builtin
"mapcar"
"reduce"
"remove-if-not"
"cons"
"car"
"last"
"nth"
"equal"
"cdr"
"first"
"rest"
"format"))
2021-04-04 09:45:45 +02:00
(list_lit
.
(sym_lit) @operator
(#match? @operator "^([+*-+=<>]|<=|>=|/=)$"))
2021-04-20 00:06:08 +02:00
((sym_lit) @symbol
(#match? @symbol "^[&]"))
2021-04-04 09:45:45 +02:00
2021-04-05 14:37:53 +02:00
[(array_dimension) "#0A" "#0a"] @number
(char_lit) @character