aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/scheme/highlights.scm
blob: 3b7a42755b1b44462fada011508a0cd12d24cd81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
(number) @constant.numeric
(character) @constant.character
(boolean) @constant.builtin.boolean

[(string)
 (character)] @string

(escape_sequence) @constant.character.escape

[(comment)
 (block_comment)
 (directive)] @comment

[(boolean)
 (character)] @constant

((symbol) @function.builtin
 (#match? @function.builtin "^(eqv\\?|eq\\?|equal\\?)")) ; TODO

; keywords

((symbol) @keyword.conditional
 (#match? @keyword.conditional "^(if|cond|case|when|unless)$"))
 
((symbol) @keyword
 (#match? @keyword
  "^(define|lambda|begin|do|define-syntax|and|or|if|cond|case|when|unless|else|=>|let|let*|let-syntax|let-values|let*-values|letrec|letrec*|letrec-syntax|set!|syntax-rules|identifier-syntax|quote|unquote|quote-splicing|quasiquote|unquote-splicing|delay|assert|library|export|import|rename|only|except|prefix)$"))

; special forms

(list
 "["
 (symbol)+ @variable
 "]")

(list
 .
 (symbol) @_f
 .
 (list
   (symbol) @variable)
 (#eq? @_f "lambda"))

(list
 .
 (symbol) @_f
 .
 (list
   (list
     (symbol) @variable))
 (#match? @_f
  "^(let|let\\*|let-syntax|let-values|let\\*-values|letrec|letrec\\*|letrec-syntax)$"))

; operators

(list
  .
  (symbol) @operator
  (#match? @operator "^([+*/<>=-]|(<=)|(>=))$"))
  
; quote

(abbreviation
  "'" (symbol)) @constant

(list
 .
 (symbol) @_f
 (#eq? @_f "quote")) @symbol

; library

(list
 .
 (symbol) @_lib
 .
 (symbol) @namespace

 (#eq? @_lib "library"))

; procedure

(list
  .
  (symbol) @function)

;; variables

((symbol) @variable.builtin
 (#eq? @variable.builtin "..."))

(symbol) @variable
((symbol) @variable.builtin
 (#eq? @variable.builtin "."))

(symbol) @variable


["(" ")" "[" "]" "{" "}"] @punctuation.bracket