Debian Codegraph @

runtime/queries/tlaplus/highlights.scm

raw symbols SCIP
1 ; ; Intended for consumption by GitHub and the tree-sitter highlight command
2 ; ; Default capture names found here:
3 ; ; https://github.com/tree-sitter/tree-sitter/blob/f5d1c0b8609f8697861eab352ead44916c068c74/cli/src/highlight.rs#L150-L171
4 ; ; In this file, captures defined earlier take precedence over captures defined later.
5
6 ; TLA⁺ Keywords
7 [
8 "ACTION"
9 "ASSUME"
10 "ASSUMPTION"
11 "AXIOM"
12 "BY"
13 "CASE"
14 "CHOOSE"
15 "CONSTANT"
16 "CONSTANTS"
17 "COROLLARY"
18 "DEF"
19 "DEFINE"
20 "DEFS"
21 "ELSE"
22 "EXCEPT"
23 "EXTENDS"
24 "HAVE"
25 "HIDE"
26 "IF"
27 "IN"
28 "INSTANCE"
29 "LAMBDA"
30 "LEMMA"
31 "LET"
32 "LOCAL"
33 "MODULE"
34 "NEW"
35 "OBVIOUS"
36 "OMITTED"
37 "ONLY"
38 "OTHER"
39 "PICK"
40 "PROOF"
41 "PROPOSITION"
42 "PROVE"
43 "QED"
44 "RECURSIVE"
45 "SF_"
46 "STATE"
47 "SUFFICES"
48 "TAKE"
49 "TEMPORAL"
50 "THEN"
51 "THEOREM"
52 "USE"
53 "VARIABLE"
54 "VARIABLES"
55 "WF_"
56 "WITH"
57 "WITNESS"
58 (address)
59 (all_map_to)
60 (assign)
61 (case_arrow)
62 (case_box)
63 (def_eq)
64 (exists)
65 (forall)
66 (gets)
67 (label_as)
68 (maps_to)
69 (set_in)
70 (temporal_exists)
71 (temporal_forall)
72 ] @keyword
73
74 ; PlusCal keywords
75 [
76 "algorithm"
77 "assert"
78 "await"
79 "begin"
80 "call"
81 "define"
82 "either"
83 "else"
84 "elsif"
85 "end"
86 "fair"
87 "goto"
88 "if"
89 "macro"
90 "or"
91 "print"
92 "procedure"
93 "process"
94 "variable"
95 "variables"
96 "when"
97 "with"
98 "then"
99 (pcal_algorithm_start)
100 (pcal_end_either)
101 (pcal_end_if)
102 (pcal_return)
103 (pcal_skip)
104 (pcal_process ("="))
105 (pcal_with ("="))
106 ] @keyword
107
108 ; Literals
109 (binary_number (format) @keyword)
110 (binary_number (value) @constant.numeric)
111 (boolean) @constant.builtin.boolean
112 (boolean_set) @type
113 (hex_number (format) @keyword)
114 (hex_number (value) @constant.numeric)
115 (int_number_set) @type
116 (nat_number) @constant.numeric.integer
117 (nat_number_set) @type
118 (octal_number (format) @keyword)
119 (octal_number (value) @constant.numeric)
120 (real_number) @constant.numeric.integer
121 (real_number_set) @type
122 (string) @string
123 (escape_char) @string.special.symbol
124 (string_set) @type
125
126 ; Namespaces and includes
127 (extends (identifier_ref) @namespace)
128 (instance (identifier_ref) @namespace)
129 (module name: (_) @namespace)
130 (pcal_algorithm name: (identifier) @namespace)
131
132 ; Constants and variables
133 (constant_declaration (identifier) @constant)
134 (constant_declaration (operator_declaration name: (_) @constant))
135 (pcal_var_decl (identifier) @variable.builtin)
136 (pcal_with (identifier) @variable.parameter)
137 ((".") . (identifier) @attribute)
138 (record_literal (identifier) @attribute)
139 (set_of_records (identifier) @attribute)
140 (variable_declaration (identifier) @variable.builtin)
141
142 ; Parameters
143 (choose (identifier) @variable.parameter)
144 (choose (tuple_of_identifiers (identifier) @variable.parameter))
145 (lambda (identifier) @variable.parameter)
146 (module_definition (operator_declaration name: (_) @variable.parameter))
147 (module_definition parameter: (identifier) @variable.parameter)
148 (operator_definition (operator_declaration name: (_) @variable.parameter))
149 (operator_definition parameter: (identifier) @variable.parameter)
150 (pcal_macro_decl parameter: (identifier) @variable.parameter)
151 (pcal_proc_var_decl (identifier) @variable.parameter)
152 (quantifier_bound (identifier) @variable.parameter)
153 (quantifier_bound (tuple_of_identifiers (identifier) @variable.parameter))
154 (unbounded_quantification (identifier) @variable.parameter)
155
156 ; Operators, functions, and macros
157 (function_definition name: (identifier) @function)
158 (module_definition name: (_) @namespace)
159 (operator_definition name: (_) @operator)
160 (pcal_macro_decl name: (identifier) @function)
161 (pcal_macro_call name: (identifier) @function)
162 (pcal_proc_decl name: (identifier) @function)
163 (pcal_process name: (identifier) @function)
164 (recursive_declaration (identifier) @operator)
165 (recursive_declaration (operator_declaration name: (_) @operator))
166
167 ; Delimiters
168 [
169 (langle_bracket)
170 (rangle_bracket)
171 (rangle_bracket_sub)
172 "{"
173 "}"
174 "["
175 "]"
176 "]_"
177 "("
178 ")"
179 ] @punctuation.bracket
180 [
181 ","
182 ":"
183 "."
184 "!"
185 ";"
186 (bullet_conj)
187 (bullet_disj)
188 (prev_func_val)
189 (placeholder)
190 ] @punctuation.delimiter
191
192 ; Proofs
193 (assume_prove (new (identifier) @variable.parameter))
194 (assume_prove (new (operator_declaration name: (_) @variable.parameter)))
195 (assumption name: (identifier) @constant)
196 (pick_proof_step (identifier) @variable.parameter)
197 (proof_step_id "<" @punctuation.bracket)
198 (proof_step_id (level) @tag)
199 (proof_step_id (name) @tag)
200 (proof_step_id ">" @punctuation.bracket)
201 (proof_step_ref "<" @punctuation.bracket)
202 (proof_step_ref (level) @tag)
203 (proof_step_ref (name) @tag)
204 (proof_step_ref ">" @punctuation.bracket)
205 (take_proof_step (identifier) @variable.parameter)
206 (theorem name: (identifier) @constant)
207
208 ; Comments and tags
209 (block_comment "(*" @comment.block)
210 (block_comment "*)" @comment.block)
211 (block_comment_text) @comment.block
212 (comment) @comment
213 (single_line) @comment
214 (_ label: (identifier) @tag)
215 (label name: (_) @tag)
216 (pcal_goto statement: (identifier) @tag)
217
218 ; Put these last so they are overridden by everything else
219 (bound_infix_op symbol: (_) @function.builtin)
220 (bound_nonfix_op symbol: (_) @function.builtin)
221 (bound_postfix_op symbol: (_) @function.builtin)
222 (bound_prefix_op symbol: (_) @function.builtin)
223 ((prefix_op_symbol) @function.builtin)
224 ((infix_op_symbol) @function.builtin)
225 ((postfix_op_symbol) @function.builtin)