Debian Codegraph @

Xtree-house/test-grammars/erlang/highlights.scm

raw symbols SCIP
1 ; Comments
2 (tripledot) @comment.discard
3
4 [(comment) (line_comment) (shebang)] @comment
5
6 ; Basic types
7 (variable) @variable
8 (atom) @string.special.symbol
9 ((atom) @constant.builtin.boolean
10 (#match? @constant.builtin.boolean "^(true|false)$"))
11 [(string) (sigil)] @string
12 (character) @constant.character
13 (escape_sequence) @constant.character.escape
14
15 (integer) @constant.numeric.integer
16 (float) @constant.numeric.float
17
18 ; Punctuation
19 ["," "." "-" ";"] @punctuation.delimiter
20 ["(" ")" "#" "{" "}" "[" "]" "<<" ">>"] @punctuation.bracket
21
22 ; Operators
23 (binary_operator operator: _ @operator)
24 (unary_operator operator: _ @operator)
25 ["/" ":" "->"] @operator
26
27 (binary_operator
28 left: (atom) @function
29 operator: "/"
30 right: (integer) @constant.numeric.integer)
31
32 ((binary_operator operator: _ @keyword.operator)
33 (#match? @keyword.operator "^\\w+$"))
34 ((unary_operator operator: _ @keyword.operator)
35 (#match? @keyword.operator "^\\w+$"))
36
37
38 ; Keywords
39 (attribute name: (atom) @keyword)
40
41 ["case" "fun" "if" "of" "when" "end" "receive" "try" "catch" "after" "begin" "maybe"] @keyword
42
43 ; Attributes
44 ; module declaration
45 (attribute
46 name: (atom) @keyword
47 (arguments (atom) @namespace)
48 (#any-of? @keyword "module" "behaviour" "behavior"))
49
50 (attribute
51 name: (atom) @keyword
52 (arguments
53 .
54 (atom) @namespace)
55 (#eq? @keyword "import"))
56
57 (attribute
58 name: (atom) @keyword
59 (arguments
60 .
61 [(atom) @type (macro)]
62 [
63 (tuple (atom)? @variable.other.member)
64 (tuple
65 (binary_operator
66 left: (atom) @variable.other.member
67 operator: ["=" "::"]))
68 (tuple
69 (binary_operator
70 left:
71 (binary_operator
72 left: (atom) @variable.other.member
73 operator: "=")
74 operator: "::"))
75 ])
76 (#eq? @keyword "record"))
77
78 (attribute
79 name: (atom) @keyword
80 (arguments
81 .
82 [
83 (atom) @constant
84 (variable) @constant
85 (call
86 function:
87 [(variable) (atom)] @keyword.directive)
88 ])
89 (#eq? @keyword "define"))
90
91 (attribute
92 name: (atom) @keyword
93 (arguments
94 (_) @keyword.directive)
95 (#any-of? @keyword "ifndef" "ifdef"))
96
97 (attribute
98 name: (atom) @keyword
99 module: (atom) @namespace
100 (#any-of? @keyword "spec" "callback"))
101
102 (attribute
103 name: (atom) @keyword
104 (arguments [
105 (string)
106 (sigil)
107 ] @comment.block.documentation)
108 (#any-of? @keyword "doc" "moduledoc"))
109
110 ; Functions
111 (function_clause name: (atom) @function)
112 (call module: (atom) @namespace)
113 (call function: (atom) @function)
114 (stab_clause name: (atom) @function)
115 (function_capture module: (atom) @namespace)
116 (function_capture function: (atom) @function)
117
118 ; Ignored variables
119 ((variable) @comment.discard
120 (#match? @comment.discard "^_"))
121
122 ; Macros
123 (macro
124 "?"+ @constant
125 name: (_) @constant
126 !arguments)
127
128 (macro
129 "?"+ @keyword.directive
130 name: (_) @keyword.directive)
131
132 ; Parameters
133 ; specs
134 ((attribute
135 name: (atom) @keyword
136 (stab_clause
137 pattern: (arguments (variable)? @variable.parameter)
138 body: (variable)? @variable.parameter))
139 (#match? @keyword "(spec|callback)"))
140 ; functions
141 (function_clause pattern: (arguments (variable) @variable.parameter))
142 ; anonymous functions
143 (stab_clause pattern: (arguments (variable) @variable.parameter))
144 ; parametric types
145 ((attribute
146 name: (atom) @keyword
147 (arguments
148 (binary_operator
149 left: (call (arguments (variable) @variable.parameter))
150 operator: "::")))
151 (#match? @keyword "(type|opaque)"))
152 ; macros
153 ((attribute
154 name: (atom) @keyword
155 (arguments
156 (call (arguments (variable) @variable.parameter))))
157 (#eq? @keyword "define"))
158
159 ; Records
160 (record_content
161 (binary_operator
162 left: (atom) @variable.other.member
163 operator: "="))
164
165 (record field: (atom) @variable.other.member)
166 (record name: (atom) @type)