Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T04:59:03.664Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

highlights.scm

377 lines · 8.1 KB · text
1; Identifier naming conventions; these "soft conventions" should stay at the top of the file as they're often overridden
2(identifier) @variable
3
4(attribute
5  attribute: (identifier) @property)
6
7; CamelCase for classes
8((identifier) @type.class
9  (#match? @type.class "^_*[A-Z][A-Za-z0-9_]*$"))
10
11; ALL_CAPS for constants:
12((identifier) @constant
13  (#match? @constant "^_*[A-Z][A-Z0-9_]*$"))
14
15(type
16  (identifier) @type)
17
18(generic_type
19  (identifier) @type)
20
21(comment) @comment
22
23(string) @string
24
25(escape_sequence) @string.escape
26
27; Type alias
28(type_alias_statement
29  "type" @keyword)
30
31; TypeVar with constraints in type parameters
32(type
33  (tuple
34    (identifier) @type))
35
36; Forward references
37(type
38  (string) @type)
39
40; Function calls
41(call
42  function: (attribute
43    attribute: (identifier) @function.method.call))
44
45(call
46  function: (identifier) @function.call)
47
48(decorator
49  "@" @punctuation.special)
50
51(decorator
52  "@" @punctuation.special
53  [
54    (identifier) @function.decorator
55    (attribute
56      attribute: (identifier) @function.decorator)
57    (call
58      function: (identifier) @function.decorator.call)
59    (call
60      (attribute
61        attribute: (identifier) @function.decorator.call))
62  ])
63
64; Function and class definitions
65(function_definition
66  name: (identifier) @function.definition)
67
68((call
69  function: (identifier) @_isinstance
70  arguments: (argument_list
71    (_)
72    (identifier) @type))
73  (#eq? @_isinstance "isinstance"))
74
75((call
76  function: (identifier) @_issubclass
77  arguments: (argument_list
78    (identifier) @type
79    (identifier) @type))
80  (#eq? @_issubclass "issubclass"))
81
82; Function arguments
83(function_definition
84  parameters: (parameters
85    [
86      (identifier) @variable.parameter ; Simple parameters
87      (typed_parameter
88        (identifier) @variable.parameter) ; Typed parameters
89      (default_parameter
90        name: (identifier) @variable.parameter) ; Default parameters
91      (typed_default_parameter
92        name: (identifier) @variable.parameter) ; Typed default parameters
93      (list_splat_pattern
94        (identifier) @variable.parameter) ; List splat parameters (*args)
95      (dictionary_splat_pattern
96        (identifier) @variable.parameter) ; Dictionary splat parameters (**kwargs)
97      (typed_parameter
98        (list_splat_pattern
99          (identifier) @variable.parameter)) ; Typed list splat parameters
100      (typed_parameter
101        (dictionary_splat_pattern
102          (identifier) @variable.parameter)) ; Typed dictionary splat parameters
103    ]))
104
105; Keyword arguments
106(call
107  arguments: (argument_list
108    (keyword_argument
109      name: (identifier) @function.kwargs)))
110
111; Class definitions and calling: needs to come after the regex matching above
112(class_definition
113  name: (identifier) @type.class.definition)
114
115(class_definition
116  superclasses: (argument_list
117    (identifier) @type.class.inheritance))
118
119(call
120  function: (identifier) @type.class.call
121  (#match? @type.class.call "^_*[A-Z][A-Za-z0-9_]*$"))
122
123; Builtins
124((call
125  function: (identifier) @function.builtin)
126  (#any-of? @function.builtin
127    "abs" "aiter" "all" "anext" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes"
128    "callable" "chr" "classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate"
129    "eval" "exec" "filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help"
130    "hex" "id" "input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max"
131    "memoryview" "min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr"
132    "reversed" "round" "set" "setattr" "sentinel" "slice" "sorted" "staticmethod" "str" "sum"
133    "super" "tuple" "type" "vars" "zip" "__import__"))
134
135; Literals
136[
137  (true)
138  (false)
139] @boolean
140
141[
142  (none)
143  (ellipsis)
144] @constant.builtin
145
146[
147  (integer)
148  (float)
149] @number
150
151; Self references
152[
153  (parameters
154    (identifier) @variable.special)
155  (attribute
156    (identifier) @variable.special)
157  (#any-of? @variable.special "self" "cls")
158]
159
160[
161  "."
162  ","
163  ":"
164] @punctuation.delimiter
165
166[
167  "("
168  ")"
169  "["
170  "]"
171  "{"
172  "}"
173] @punctuation.bracket
174
175(interpolation
176  "{" @punctuation.special
177  "}" @punctuation.special) @embedded
178
179; Docstrings.
180([
181  (expression_statement
182    (assignment))
183  (type_alias_statement)
184]
185  .
186  (expression_statement
187    (string) @string.doc)+)
188
189(module
190  .
191  (expression_statement
192    (string) @string.doc)+)
193
194(class_definition
195  body: (block
196    .
197    (expression_statement
198      (string) @string.doc)+))
199
200(function_definition
201  "async"?
202  "def"
203  name: (_)
204  (parameters)?
205  body: (block
206    .
207    (expression_statement
208      (string) @string.doc)+))
209
210(class_definition
211  body: (block
212    .
213    (comment) @comment*
214    .
215    (expression_statement
216      (string) @string.doc)+))
217
218(module
219  .
220  (comment) @comment*
221  .
222  (expression_statement
223    (string) @string.doc)+)
224
225(class_definition
226  body: (block
227    (expression_statement
228      (assignment))
229    .
230    (expression_statement
231      (string) @string.doc)+))
232
233(class_definition
234  body: (block
235    (function_definition
236      name: (identifier) @function.method.constructor
237      (#eq? @function.method.constructor "__init__")
238      body: (block
239        (expression_statement
240          (assignment))
241        .
242        (expression_statement
243          (string) @string.doc)+))))
244
245[
246  "-"
247  "-="
248  "!="
249  "*"
250  "**"
251  "**="
252  "*="
253  "/"
254  "//"
255  "//="
256  "/="
257  "&"
258  "%"
259  "%="
260  "@"
261  "^"
262  "+"
263  "->"
264  "+="
265  "<"
266  "<<"
267  "<="
268  "<>"
269  "="
270  ":="
271  "=="
272  ">"
273  ">="
274  ">>"
275  "|"
276  "~"
277  "&="
278  "<<="
279  ">>="
280  "@="
281  "^="
282  "|="
283] @operator
284
285[
286  "and"
287  "in"
288  "is"
289  "not"
290  "or"
291  "is not"
292  "not in"
293] @keyword.operator
294
295[
296  "as"
297  "assert"
298  "async"
299  "await"
300  "break"
301  "class"
302  "continue"
303  "def"
304  "del"
305  "elif"
306  "else"
307  "except"
308  "exec"
309  "finally"
310  "for"
311  "from"
312  "global"
313  "if"
314  "import"
315  "lambda"
316  "nonlocal"
317  "pass"
318  "print"
319  "raise"
320  "return"
321  "try"
322  "while"
323  "with"
324  "yield"
325  "match"
326  "case"
327] @keyword
328
329; Definition keywords def, class, async def, lambda
330[
331  "async"
332  "def"
333  "class"
334  "lambda"
335] @keyword.definition
336
337(decorator
338  (identifier) @attribute.builtin
339  (#any-of? @attribute.builtin "classmethod" "staticmethod" "property"))
340
341; Builtin types as identifiers
342[
343  (call
344    function: (identifier) @type.builtin)
345  (type
346    (identifier) @type.builtin)
347  (generic_type
348    (identifier) @type.builtin)
349  ; also check if type binary operator left identifier for union types
350  (type
351    (binary_operator
352      left: (identifier) @type.builtin))
353  (#any-of? @type.builtin
354    "bool" "bytearray" "bytes" "complex" "dict" "float" "frozenset" "frozendict" "int" "list"
355    "memoryview" "object" "range" "set" "slice" "str" "tuple")
356]
357
358((identifier) @type.class.builtin
359  (#any-of? @type.class.builtin
360    ; Exceptions
361    "BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError"
362    "AttributeError" "EOFError" "FloatingPointError" "GeneratorExit" "ImportError"
363    "ModuleNotFoundError" "IndexError" "KeyError" "KeyboardInterrupt" "MemoryError" "NameError"
364    "NotImplementedError" "OSError" "OverflowError" "RecursionError" "ReferenceError" "RuntimeError"
365    "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError" "SystemError"
366    "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError"
367    "UnicodeDecodeError" "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError"
368    "IOError" "WindowsError" "BlockingIOError" "ChildProcessError" "ConnectionError"
369    "BrokenPipeError" "ConnectionAbortedError" "ConnectionRefusedError" "ConnectionResetError"
370    "FileExistsError" "FileNotFoundError" "InterruptedError" "IsADirectoryError"
371    "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "ExceptionGroup"
372    "BaseExceptionGroup"
373    ; Warnings
374    "Warning" "UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning"
375    "RuntimeWarning" "FutureWarning" "ImportWarning" "UnicodeWarning" "EncodingWarning"
376    "BytesWarning" "ResourceWarning"))
377
Served at tenant.openagents/omega Member data and write actions are omitted.