aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/ohm/highlights.scm
blob: 68477aacc5aa6bcb469342c3641ddacf2c90d4a5 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
; See: https://docs.helix-editor.com/master/themes.html#syntax-highlighting

; attribute
; ---------

(case_name) @attribute

; comment.line
; ------------

[
  (singleline_comment)
  (rule_descr)
] @comment.line

; comment.block
; -------------

(multiline_comment) @comment.block

; function.method
; ---------------

(rule
  name: (identifier) @function.method)

; function.builtin
; ----------------

; Lexical
((identifier) @function.builtin
  (#any-of? @function.builtin
    "any"
    "alnum"
    "end"
    "digit" "hexDigit"
    "letter"
    "space"
    "lower" "upper" "caseInsensitive"
    "listOf" "nonemptyListOf" "emptyListOf"
    "applySyntactic")
  (#is-not? local))

; Syntactic
((identifier) @function.builtin
  (#any-of? @function.builtin "ListOf" "NonemptyListOf" "EmptyListOf")
  (#is-not? local))

; function.method (continuing)
; ---------------

(term
  base: (identifier) @function.method)

; string.special
; --------------

(escape_char) @constant.character.escape

; string
; ------

[
  (terminal_string)
  (one_char_terminal)
] @string

; type
; ----

(super_grammar
  name: (identifier) @type)

(grammar
  name: (identifier) @type)

; operator
; --------

[
  ; "=" ":=" "+="
  (define) (override) (extend)

  ; "&" "~"
  (lookahead) (negative_lookahead)

  ; "#"
  (lexification)

  ; "*" "+" "?"
  (zero_or_more) (one_or_more) (zero_or_one)

  ; "..."
  (super_splice)

  "<:" ".." "|"
] @operator

; punctuation.bracket
; -------------------

[
  "<"
  ">"
  "{"
  "}"
] @punctuation.bracket

(alt
  "(" @punctuation.bracket
  ")" @punctuation.bracket)

; punctuation.delimiter
; ---------------------

"," @punctuation.delimiter

; variable.parameter
; ------------------

(formals
  (identifier) @variable.parameter)