smlflg commited on
Commit
e7dadf5
·
verified ·
1 Parent(s): 19afeae

Initial public upload from Projekte/Sidecar-Workspace (part 2)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/agile.py +25 -0
  2. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/algebra.py +303 -0
  3. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/ambient.py +75 -0
  4. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/amdgpu.py +54 -0
  5. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/ampl.py +87 -0
  6. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/apdlexer.py +593 -0
  7. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/apl.py +103 -0
  8. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/archetype.py +315 -0
  9. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/arrow.py +116 -0
  10. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/arturo.py +249 -0
  11. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/asc.py +55 -0
  12. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/asm.py +1058 -0
  13. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/asn1.py +178 -0
  14. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/automation.py +379 -0
  15. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/bare.py +101 -0
  16. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/basic.py +655 -0
  17. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/bdd.py +57 -0
  18. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/berry.py +99 -0
  19. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/bibtex.py +159 -0
  20. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/bitbake.py +166 -0
  21. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/blueprint.py +173 -0
  22. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/boa.py +97 -0
  23. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/bqn.py +112 -0
  24. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/business.py +625 -0
  25. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/c_cpp.py +481 -0
  26. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/c_like.py +743 -0
  27. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/capnproto.py +74 -0
  28. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/carbon.py +95 -0
  29. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/cddl.py +172 -0
  30. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/cel.py +142 -0
  31. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/chapel.py +139 -0
  32. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/clean.py +180 -0
  33. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/codeql.py +80 -0
  34. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/comal.py +81 -0
  35. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/compiled.py +35 -0
  36. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/configs.py +1499 -0
  37. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/console.py +125 -0
  38. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/cplint.py +43 -0
  39. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/crystal.py +364 -0
  40. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/csound.py +466 -0
  41. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/css.py +633 -0
  42. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/d.py +259 -0
  43. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/dalvik.py +126 -0
  44. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/data.py +763 -0
  45. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/dax.py +135 -0
  46. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/devicetree.py +120 -0
  47. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/diff.py +169 -0
  48. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/dns.py +109 -0
  49. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/dotnet.py +886 -0
  50. HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/dsls.py +970 -0
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/agile.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.agile
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Just export lexer classes previously contained in this module.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ # ruff: noqa: F401
12
+
13
+ from pygments.lexers.lisp import SchemeLexer
14
+ from pygments.lexers.jvm import IokeLexer, ClojureLexer
15
+ from pygments.lexers.python import PythonLexer, PythonConsoleLexer, \
16
+ PythonTracebackLexer, Python3Lexer, Python3TracebackLexer, DgLexer
17
+ from pygments.lexers.ruby import RubyLexer, RubyConsoleLexer, FancyLexer
18
+ from pygments.lexers.perl import PerlLexer, Perl6Lexer
19
+ from pygments.lexers.d import CrocLexer, MiniDLexer
20
+ from pygments.lexers.iolang import IoLexer
21
+ from pygments.lexers.tcl import TclLexer
22
+ from pygments.lexers.factor import FactorLexer
23
+ from pygments.lexers.scripting import LuaLexer, MoonScriptLexer
24
+
25
+ __all__ = []
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/algebra.py ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.algebra
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for computer algebra systems.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, words
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Generic, Whitespace
16
+
17
+ __all__ = ['GAPLexer', 'GAPConsoleLexer', 'MathematicaLexer', 'MuPADLexer',
18
+ 'BCLexer']
19
+
20
+
21
+ class GAPLexer(RegexLexer):
22
+ """
23
+ For GAP source code.
24
+ """
25
+ name = 'GAP'
26
+ url = 'https://www.gap-system.org'
27
+ aliases = ['gap']
28
+ filenames = ['*.g', '*.gd', '*.gi', '*.gap']
29
+ version_added = '2.0'
30
+
31
+ tokens = {
32
+ 'root': [
33
+ (r'#.*$', Comment.Single),
34
+ (r'"(?:[^"\\]|\\.)*"', String),
35
+ (r'\(|\)|\[|\]|\{|\}', Punctuation),
36
+ (r'''(?x)\b(?:
37
+ if|then|elif|else|fi|
38
+ for|while|do|od|
39
+ repeat|until|
40
+ break|continue|
41
+ function|local|return|end|
42
+ rec|
43
+ quit|QUIT|
44
+ IsBound|Unbind|
45
+ TryNextMethod|
46
+ Info|Assert
47
+ )\b''', Keyword),
48
+ (r'''(?x)\b(?:
49
+ true|false|fail|infinity
50
+ )\b''',
51
+ Name.Constant),
52
+ (r'''(?x)\b(?:
53
+ (Declare|Install)([A-Z][A-Za-z]+)|
54
+ BindGlobal|BIND_GLOBAL
55
+ )\b''',
56
+ Name.Builtin),
57
+ (r'\.|,|:=|;|=|\+|-|\*|/|\^|>|<', Operator),
58
+ (r'''(?x)\b(?:
59
+ and|or|not|mod|in
60
+ )\b''',
61
+ Operator.Word),
62
+ (r'''(?x)
63
+ (?:\w+|`[^`]*`)
64
+ (?:::\w+|`[^`]*`)*''', Name.Variable),
65
+ (r'[0-9]+(?:\.[0-9]*)?(?:e[0-9]+)?', Number),
66
+ (r'\.[0-9]+(?:e[0-9]+)?', Number),
67
+ (r'.', Text)
68
+ ],
69
+ }
70
+
71
+ def analyse_text(text):
72
+ score = 0.0
73
+
74
+ # Declaration part
75
+ if re.search(
76
+ r"(InstallTrueMethod|Declare(Attribute|Category|Filter|Operation" +
77
+ r"|GlobalFunction|Synonym|SynonymAttr|Property))", text
78
+ ):
79
+ score += 0.7
80
+
81
+ # Implementation part
82
+ if re.search(
83
+ r"(DeclareRepresentation|Install(GlobalFunction|Method|" +
84
+ r"ImmediateMethod|OtherMethod)|New(Family|Type)|Objectify)", text
85
+ ):
86
+ score += 0.7
87
+
88
+ return min(score, 1.0)
89
+
90
+
91
+ class GAPConsoleLexer(Lexer):
92
+ """
93
+ For GAP console sessions. Modeled after JuliaConsoleLexer.
94
+ """
95
+ name = 'GAP session'
96
+ aliases = ['gap-console', 'gap-repl']
97
+ filenames = ['*.tst']
98
+ url = 'https://www.gap-system.org'
99
+ version_added = '2.14'
100
+ _example = "gap-repl/euclidean.tst"
101
+
102
+ def get_tokens_unprocessed(self, text):
103
+ gaplexer = GAPLexer(**self.options)
104
+ start = 0
105
+ curcode = ''
106
+ insertions = []
107
+ output = False
108
+ error = False
109
+
110
+ for line in text.splitlines(keepends=True):
111
+ if line.startswith('gap> ') or line.startswith('brk> '):
112
+ insertions.append((len(curcode), [(0, Generic.Prompt, line[:5])]))
113
+ curcode += line[5:]
114
+ output = False
115
+ error = False
116
+ elif not output and line.startswith('> '):
117
+ insertions.append((len(curcode), [(0, Generic.Prompt, line[:2])]))
118
+ curcode += line[2:]
119
+ else:
120
+ if curcode:
121
+ yield from do_insertions(
122
+ insertions, gaplexer.get_tokens_unprocessed(curcode))
123
+ curcode = ''
124
+ insertions = []
125
+ if line.startswith('Error, ') or error:
126
+ yield start, Generic.Error, line
127
+ error = True
128
+ else:
129
+ yield start, Generic.Output, line
130
+ output = True
131
+ start += len(line)
132
+
133
+ if curcode:
134
+ yield from do_insertions(
135
+ insertions, gaplexer.get_tokens_unprocessed(curcode))
136
+
137
+ # the following is needed to distinguish Scilab and GAP .tst files
138
+ def analyse_text(text):
139
+ # GAP prompts are a dead give away, although hypothetical;y a
140
+ # file in another language could be trying to compare a variable
141
+ # "gap" as in "gap> 0.1". But that this should happen at the
142
+ # start of a line seems unlikely...
143
+ if re.search(r"^gap> ", text):
144
+ return 0.9
145
+ else:
146
+ return 0.0
147
+
148
+
149
+ class MathematicaLexer(RegexLexer):
150
+ """
151
+ Lexer for Mathematica source code.
152
+ """
153
+ name = 'Mathematica'
154
+ url = 'https://www.wolfram.com/language/'
155
+ aliases = ['mathematica', 'mma', 'nb', 'wl', 'wolfram']
156
+ filenames = ['*.nb', '*.cdf', '*.nbp', '*.ma', '*.wl', '*.wls']
157
+ mimetypes = ['application/mathematica',
158
+ 'application/vnd.wolfram.mathematica',
159
+ 'application/vnd.wolfram.mathematica.package',
160
+ 'application/vnd.wolfram.cdf',
161
+ 'application/vnd.wolfram.wl']
162
+ version_added = '2.0'
163
+
164
+ # https://reference.wolfram.com/language/guide/Syntax.html
165
+ operators = (
166
+ ";;", "=", "=.", "!=" "==", ":=", "->", ":>", "/.", "+", "-", "*", "/",
167
+ "^", "&&", "||", "!", "<>", "|", "/;", "?", "@", "//", "/@", "@@",
168
+ "@@@", "~~", "===", "&", "<", ">", "<=", ">=",
169
+ )
170
+
171
+ punctuation = (",", ";", "(", ")", "[", "]", "{", "}")
172
+
173
+ def _multi_escape(entries):
174
+ return '({})'.format('|'.join(re.escape(entry) for entry in entries))
175
+
176
+ tokens = {
177
+ 'root': [
178
+ (r'(?s)\(\*.*?\*\)', Comment),
179
+
180
+ # Named character escapes, e.g. \[Nu], \[CapitalAlpha].
181
+ (r'\\\[[A-Za-z][A-Za-z0-9]*\]', String.Escape),
182
+
183
+ (r'([a-zA-Z]+[A-Za-z0-9]*`)', Name.Namespace),
184
+ (r'([A-Za-z0-9]*_+[A-Za-z0-9]*)', Name.Variable),
185
+ (r'#\d*', Name.Variable),
186
+ (r'([a-zA-Z]+[a-zA-Z0-9]*)', Name),
187
+
188
+ (r'-?\d+\.\d*', Number.Float),
189
+ (r'-?\d*\.\d+', Number.Float),
190
+ (r'-?\d+', Number.Integer),
191
+
192
+ (words(operators), Operator),
193
+ (words(punctuation), Punctuation),
194
+ (r'".*?"', String),
195
+ (r'\s+', Text.Whitespace),
196
+ ],
197
+ }
198
+
199
+
200
+ class MuPADLexer(RegexLexer):
201
+ """
202
+ A MuPAD lexer.
203
+ Contributed by Christopher Creutzig <christopher@creutzig.de>.
204
+ """
205
+ name = 'MuPAD'
206
+ url = 'http://www.mupad.com'
207
+ aliases = ['mupad']
208
+ filenames = ['*.mu']
209
+ version_added = '0.8'
210
+
211
+ tokens = {
212
+ 'root': [
213
+ (r'//.*?$', Comment.Single),
214
+ (r'/\*', Comment.Multiline, 'comment'),
215
+ (r'"(?:[^"\\]|\\.)*"', String),
216
+ (r'\(|\)|\[|\]|\{|\}', Punctuation),
217
+ (r'''(?x)\b(?:
218
+ next|break|end|
219
+ axiom|end_axiom|category|end_category|domain|end_domain|inherits|
220
+ if|%if|then|elif|else|end_if|
221
+ case|of|do|otherwise|end_case|
222
+ while|end_while|
223
+ repeat|until|end_repeat|
224
+ for|from|to|downto|step|end_for|
225
+ proc|local|option|save|begin|end_proc|
226
+ delete|frame
227
+ )\b''', Keyword),
228
+ (r'''(?x)\b(?:
229
+ DOM_ARRAY|DOM_BOOL|DOM_COMPLEX|DOM_DOMAIN|DOM_EXEC|DOM_EXPR|
230
+ DOM_FAIL|DOM_FLOAT|DOM_FRAME|DOM_FUNC_ENV|DOM_HFARRAY|DOM_IDENT|
231
+ DOM_INT|DOM_INTERVAL|DOM_LIST|DOM_NIL|DOM_NULL|DOM_POLY|DOM_PROC|
232
+ DOM_PROC_ENV|DOM_RAT|DOM_SET|DOM_STRING|DOM_TABLE|DOM_VAR
233
+ )\b''', Name.Class),
234
+ (r'''(?x)\b(?:
235
+ PI|EULER|E|CATALAN|
236
+ NIL|FAIL|undefined|infinity|
237
+ TRUE|FALSE|UNKNOWN
238
+ )\b''',
239
+ Name.Constant),
240
+ (r'\b(?:dom|procname)\b', Name.Builtin.Pseudo),
241
+ (r'\.|,|:|;|=|\+|-|\*|/|\^|@|>|<|\$|\||!|\'|%|~=', Operator),
242
+ (r'''(?x)\b(?:
243
+ and|or|not|xor|
244
+ assuming|
245
+ div|mod|
246
+ union|minus|intersect|in|subset
247
+ )\b''',
248
+ Operator.Word),
249
+ (r'\b(?:I|RDN_INF|RD_NINF|RD_NAN)\b', Number),
250
+ # (r'\b(?:adt|linalg|newDomain|hold)\b', Name.Builtin),
251
+ (r'''(?x)
252
+ ((?:[a-zA-Z_#][\w#]*|`[^`]*`)
253
+ (?:::[a-zA-Z_#][\w#]*|`[^`]*`)*)(\s*)([(])''',
254
+ bygroups(Name.Function, Text, Punctuation)),
255
+ (r'''(?x)
256
+ (?:[a-zA-Z_#][\w#]*|`[^`]*`)
257
+ (?:::[a-zA-Z_#][\w#]*|`[^`]*`)*''', Name.Variable),
258
+ (r'[0-9]+(?:\.[0-9]*)?(?:e[0-9]+)?', Number),
259
+ (r'\.[0-9]+(?:e[0-9]+)?', Number),
260
+ (r'\s+', Whitespace),
261
+ (r'.', Text)
262
+ ],
263
+ 'comment': [
264
+ (r'[^/*]+', Comment.Multiline),
265
+ (r'/\*', Comment.Multiline, '#push'),
266
+ (r'\*/', Comment.Multiline, '#pop'),
267
+ (r'[*/]', Comment.Multiline)
268
+ ],
269
+ }
270
+
271
+
272
+ class BCLexer(RegexLexer):
273
+ """
274
+ A BC lexer.
275
+ """
276
+ name = 'BC'
277
+ url = 'https://www.gnu.org/software/bc/'
278
+ aliases = ['bc']
279
+ filenames = ['*.bc']
280
+ version_added = '2.1'
281
+
282
+ tokens = {
283
+ 'root': [
284
+ (r'/\*', Comment.Multiline, 'comment'),
285
+ (r'"(?:[^"\\]|\\.)*"', String),
286
+ (r'[{}();,]', Punctuation),
287
+ (words(('if', 'else', 'while', 'for', 'break', 'continue',
288
+ 'halt', 'return', 'define', 'auto', 'print', 'read',
289
+ 'length', 'scale', 'sqrt', 'limits', 'quit',
290
+ 'warranty'), suffix=r'\b'), Keyword),
291
+ (r'\+\+|--|\|\||&&|'
292
+ r'([-<>+*%\^/!=])=?', Operator),
293
+ # bc doesn't support exponential
294
+ (r'[0-9]+(\.[0-9]*)?', Number),
295
+ (r'\.[0-9]+', Number),
296
+ (r'.', Text)
297
+ ],
298
+ 'comment': [
299
+ (r'[^*/]+', Comment.Multiline),
300
+ (r'\*/', Comment.Multiline, '#pop'),
301
+ (r'[*/]', Comment.Multiline)
302
+ ],
303
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/ambient.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ambient
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for AmbientTalk language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, words, bygroups
14
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Whitespace
16
+
17
+ __all__ = ['AmbientTalkLexer']
18
+
19
+
20
+ class AmbientTalkLexer(RegexLexer):
21
+ """
22
+ Lexer for AmbientTalk source code.
23
+ """
24
+ name = 'AmbientTalk'
25
+ url = 'https://code.google.com/p/ambienttalk'
26
+ filenames = ['*.at']
27
+ aliases = ['ambienttalk', 'ambienttalk/2', 'at']
28
+ mimetypes = ['text/x-ambienttalk']
29
+ version_added = '2.0'
30
+
31
+ flags = re.MULTILINE | re.DOTALL
32
+
33
+ builtin = words(('if:', 'then:', 'else:', 'when:', 'whenever:', 'discovered:',
34
+ 'disconnected:', 'reconnected:', 'takenOffline:', 'becomes:',
35
+ 'export:', 'as:', 'object:', 'actor:', 'mirror:', 'taggedAs:',
36
+ 'mirroredBy:', 'is:'))
37
+ tokens = {
38
+ 'root': [
39
+ (r'\s+', Whitespace),
40
+ (r'//.*?\n', Comment.Single),
41
+ (r'/\*.*?\*/', Comment.Multiline),
42
+ (r'(def|deftype|import|alias|exclude)\b', Keyword),
43
+ (builtin, Name.Builtin),
44
+ (r'(true|false|nil)\b', Keyword.Constant),
45
+ (r'(~|lobby|jlobby|/)\.', Keyword.Constant, 'namespace'),
46
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
47
+ (r'\|', Punctuation, 'arglist'),
48
+ (r'<:|[*^!%&<>+=,./?-]|:=', Operator),
49
+ (r"`[a-zA-Z_]\w*", String.Symbol),
50
+ (r"[a-zA-Z_]\w*:", Name.Function),
51
+ (r"[{}()\[\];`]", Punctuation),
52
+ (r'(self|super)\b', Name.Variable.Instance),
53
+ (r"[a-zA-Z_]\w*", Name.Variable),
54
+ (r"@[a-zA-Z_]\w*", Name.Class),
55
+ (r"@\[", Name.Class, 'annotations'),
56
+ include('numbers'),
57
+ ],
58
+ 'numbers': [
59
+ (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
60
+ (r'\d+', Number.Integer)
61
+ ],
62
+ 'namespace': [
63
+ (r'[a-zA-Z_]\w*\.', Name.Namespace),
64
+ (r'[a-zA-Z_]\w*:', Name.Function, '#pop'),
65
+ (r'[a-zA-Z_]\w*(?!\.)', Name.Function, '#pop')
66
+ ],
67
+ 'annotations': [
68
+ (r"(.*?)\]", Name.Class, '#pop')
69
+ ],
70
+ 'arglist': [
71
+ (r'\|', Punctuation, '#pop'),
72
+ (r'(\s*)(,)(\s*)', bygroups(Whitespace, Punctuation, Whitespace)),
73
+ (r'[a-zA-Z_]\w*', Name.Variable),
74
+ ],
75
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/amdgpu.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.amdgpu
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the AMDGPU ISA assembly.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words
12
+ from pygments.token import Name, Text, Keyword, Whitespace, Number, Comment
13
+
14
+ import re
15
+
16
+ __all__ = ['AMDGPULexer']
17
+
18
+
19
+ class AMDGPULexer(RegexLexer):
20
+ """
21
+ For AMD GPU assembly.
22
+ """
23
+ name = 'AMDGPU'
24
+ aliases = ['amdgpu']
25
+ filenames = ['*.isa']
26
+ url = 'https://gpuopen.com/amd-isa-documentation'
27
+ version_added = '2.8'
28
+
29
+ flags = re.IGNORECASE
30
+
31
+ tokens = {
32
+ 'root': [
33
+ (r'\s+', Whitespace),
34
+ (r'[\r\n]+', Text),
35
+ (r'(([a-z_0-9])*:([a-z_0-9])*)', Name.Attribute),
36
+ (r'(\[|\]|\(|\)|,|\:|\&)', Text),
37
+ (r'([;#]|//).*?\n', Comment.Single),
38
+ (r'((s_)?(scratch|ds|buffer|flat|image)_[a-z0-9_]+)', Keyword.Reserved),
39
+ (r'(_lo|_hi)', Name.Variable),
40
+ (r'(vmcnt|lgkmcnt|expcnt)', Name.Attribute),
41
+ (r'(attr[0-9].[a-z])', Name.Attribute),
42
+ (words((
43
+ 'op', 'vaddr', 'vdata', 'off', 'soffset', 'srsrc', 'format',
44
+ 'offset', 'offen', 'idxen', 'glc', 'dlc', 'slc', 'tfe', 'lds',
45
+ 'lit', 'unorm'), suffix=r'\b'), Name.Attribute),
46
+ (r'(label_[a-z0-9]+)', Keyword),
47
+ (r'(_L[0-9]*)', Name.Variable),
48
+ (r'[sv]_[a-z0-9_]+', Keyword),
49
+ (r'(v[0-9.]+|vcc|exec|v)', Name.Variable),
50
+ (r's[0-9.]+|s', Name.Variable),
51
+ (r'[0-9]+\.[^0-9]+', Number.Float),
52
+ (r'(0[xX][a-z0-9]+)|([0-9]+)', Number.Integer)
53
+ ]
54
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/ampl.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ampl
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the AMPL language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, using, this, words
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation, Whitespace
14
+
15
+ __all__ = ['AmplLexer']
16
+
17
+
18
+ class AmplLexer(RegexLexer):
19
+ """
20
+ For AMPL source code.
21
+ """
22
+ name = 'Ampl'
23
+ url = 'http://ampl.com/'
24
+ aliases = ['ampl']
25
+ filenames = ['*.run']
26
+ version_added = '2.2'
27
+
28
+ tokens = {
29
+ 'root': [
30
+ (r'\n', Text),
31
+ (r'\s+', Whitespace),
32
+ (r'#.*?\n', Comment.Single),
33
+ (r'/[*][\s\S]*?[*]/', Comment.Multiline),
34
+ (words((
35
+ 'call', 'cd', 'close', 'commands', 'data', 'delete', 'display',
36
+ 'drop', 'end', 'environ', 'exit', 'expand', 'include', 'load',
37
+ 'model', 'objective', 'option', 'problem', 'purge', 'quit',
38
+ 'redeclare', 'reload', 'remove', 'reset', 'restore', 'shell',
39
+ 'show', 'solexpand', 'solution', 'solve', 'update', 'unload',
40
+ 'xref', 'coeff', 'coef', 'cover', 'obj', 'interval', 'default',
41
+ 'from', 'to', 'to_come', 'net_in', 'net_out', 'dimen',
42
+ 'dimension', 'check', 'complements', 'write', 'function',
43
+ 'pipe', 'format', 'if', 'then', 'else', 'in', 'while', 'repeat',
44
+ 'for'), suffix=r'\b'), Keyword.Reserved),
45
+ (r'(integer|binary|symbolic|ordered|circular|reversed|INOUT|IN|OUT|LOCAL)',
46
+ Keyword.Type),
47
+ (r'\".*?\"', String.Double),
48
+ (r'\'.*?\'', String.Single),
49
+ (r'[()\[\]{},;:]+', Punctuation),
50
+ (r'\b(\w+)(\.)(astatus|init0|init|lb0|lb1|lb2|lb|lrc|'
51
+ r'lslack|rc|relax|slack|sstatus|status|ub0|ub1|ub2|'
52
+ r'ub|urc|uslack|val)',
53
+ bygroups(Name.Variable, Punctuation, Keyword.Reserved)),
54
+ (r'(set|param|var|arc|minimize|maximize|subject to|s\.t\.|subj to|'
55
+ r'node|table|suffix|read table|write table)(\s+)(\w+)',
56
+ bygroups(Keyword.Declaration, Whitespace, Name.Variable)),
57
+ (r'(param)(\s*)(:)(\s*)(\w+)(\s*)(:)(\s*)((\w|\s)+)',
58
+ bygroups(Keyword.Declaration, Whitespace, Punctuation, Whitespace,
59
+ Name.Variable, Whitespace, Punctuation, Whitespace, Name.Variable)),
60
+ (r'(let|fix|unfix)(\s*)((?:\{.*\})?)(\s*)(\w+)',
61
+ bygroups(Keyword.Declaration, Whitespace, using(this), Whitespace,
62
+ Name.Variable)),
63
+ (words((
64
+ 'abs', 'acos', 'acosh', 'alias', 'asin', 'asinh', 'atan', 'atan2',
65
+ 'atanh', 'ceil', 'ctime', 'cos', 'exp', 'floor', 'log', 'log10',
66
+ 'max', 'min', 'precision', 'round', 'sin', 'sinh', 'sqrt', 'tan',
67
+ 'tanh', 'time', 'trunc', 'Beta', 'Cauchy', 'Exponential', 'Gamma',
68
+ 'Irand224', 'Normal', 'Normal01', 'Poisson', 'Uniform', 'Uniform01',
69
+ 'num', 'num0', 'ichar', 'char', 'length', 'substr', 'sprintf',
70
+ 'match', 'sub', 'gsub', 'print', 'printf', 'next', 'nextw', 'prev',
71
+ 'prevw', 'first', 'last', 'ord', 'ord0', 'card', 'arity',
72
+ 'indexarity'), prefix=r'\b', suffix=r'\b'), Name.Builtin),
73
+ (r'(\+|\-|\*|/|\*\*|=|<=|>=|==|\||\^|<|>|\!|\.\.|:=|\&|\!=|<<|>>)',
74
+ Operator),
75
+ (words((
76
+ 'or', 'exists', 'forall', 'and', 'in', 'not', 'within', 'union',
77
+ 'diff', 'difference', 'symdiff', 'inter', 'intersect',
78
+ 'intersection', 'cross', 'setof', 'by', 'less', 'sum', 'prod',
79
+ 'product', 'div', 'mod'), suffix=r'\b'),
80
+ Keyword.Reserved), # Operator.Name but not enough emphasized with that
81
+ (r'(\d+\.(?!\.)\d*|\.(?!.)\d+)([eE][+-]?\d+)?', Number.Float),
82
+ (r'\d+([eE][+-]?\d+)?', Number.Integer),
83
+ (r'[+-]?Infinity', Number.Integer),
84
+ (r'(\w+|(\.(?!\.)))', Text)
85
+ ]
86
+
87
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/apdlexer.py ADDED
@@ -0,0 +1,593 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.apdlexer
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for ANSYS Parametric Design Language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, words, default
14
+ from pygments.token import Comment, Keyword, Name, Number, Operator, \
15
+ String, Generic, Punctuation, Whitespace, Escape
16
+
17
+ __all__ = ['apdlexer']
18
+
19
+
20
+ class apdlexer(RegexLexer):
21
+ """
22
+ For APDL source code.
23
+ """
24
+ name = 'ANSYS parametric design language'
25
+ aliases = ['ansys', 'apdl']
26
+ filenames = ['*.ans']
27
+ url = 'https://www.ansys.com'
28
+ version_added = '2.9'
29
+
30
+ flags = re.IGNORECASE
31
+
32
+ # list of elements
33
+ elafunb = ("SURF152", "SURF153", "SURF154", "SURF156", "SHELL157",
34
+ "SURF159", "LINK160", "BEAM161", "PLANE162",
35
+ "SHELL163", "SOLID164", "COMBI165", "MASS166",
36
+ "LINK167", "SOLID168", "TARGE169", "TARGE170",
37
+ "CONTA171", "CONTA172", "CONTA173", "CONTA174",
38
+ "CONTA175", "CONTA176", "CONTA177", "CONTA178",
39
+ "PRETS179", "LINK180", "SHELL181", "PLANE182",
40
+ "PLANE183", "MPC184", "SOLID185", "SOLID186",
41
+ "SOLID187", "BEAM188", "BEAM189", "SOLSH190",
42
+ "INTER192", "INTER193", "INTER194", "INTER195",
43
+ "MESH200", "FOLLW201", "INTER202", "INTER203",
44
+ "INTER204", "INTER205", "SHELL208", "SHELL209",
45
+ "CPT212", "CPT213", "COMBI214", "CPT215", "CPT216",
46
+ "CPT217", "FLUID220", "FLUID221", "PLANE223",
47
+ "SOLID226", "SOLID227", "PLANE230", "SOLID231",
48
+ "SOLID232", "PLANE233", "SOLID236", "SOLID237",
49
+ "PLANE238", "SOLID239", "SOLID240", "HSFLD241",
50
+ "HSFLD242", "SURF251", "SURF252", "REINF263",
51
+ "REINF264", "REINF265", "SOLID272", "SOLID273",
52
+ "SOLID278", "SOLID279", "SHELL281", "SOLID285",
53
+ "PIPE288", "PIPE289", "ELBOW290", "USER300", "BEAM3",
54
+ "BEAM4", "BEAM23", "BEAM24", "BEAM44", "BEAM54",
55
+ "COMBIN7", "FLUID79", "FLUID80", "FLUID81", "FLUID141",
56
+ "FLUID142", "INFIN9", "INFIN47", "PLANE13", "PLANE25",
57
+ "PLANE42", "PLANE53", "PLANE67", "PLANE82", "PLANE83",
58
+ "PLANE145", "PLANE146", "CONTAC12", "CONTAC52",
59
+ "LINK1", "LINK8", "LINK10", "LINK32", "PIPE16",
60
+ "PIPE17", "PIPE18", "PIPE20", "PIPE59", "PIPE60",
61
+ "SHELL41", "SHELL43", "SHELL57", "SHELL63", "SHELL91",
62
+ "SHELL93", "SHELL99", "SHELL150", "SOLID5", "SOLID45",
63
+ "SOLID46", "SOLID65", "SOLID69", "SOLID92", "SOLID95",
64
+ "SOLID117", "SOLID127", "SOLID128", "SOLID147",
65
+ "SOLID148", "SOLID191", "VISCO88", "VISCO89",
66
+ "VISCO106", "VISCO107", "VISCO108", "TRANS109")
67
+
68
+ elafunc = ("PGRAPH", "/VT", "VTIN", "VTRFIL", "VTTEMP", "PGRSET",
69
+ "VTCLR", "VTMETH", "VTRSLT", "VTVMOD", "PGSELE",
70
+ "VTDISC", "VTMP", "VTSEC", "PGWRITE", "VTEVAL", "VTOP",
71
+ "VTSFE", "POUTRES", "VTFREQ", "VTPOST", "VTSL",
72
+ "FLDATA1-40", "HFPCSWP", "MSDATA", "MSVARY", "QFACT",
73
+ "FLOCHECK", "HFPOWER", "MSMASS", "PERI", "SPADP",
74
+ "FLREAD", "HFPORT", "MSMETH", "PLFSS", "SPARM",
75
+ "FLOTRAN", "HFSCAT", "MSMIR", "PLSCH", "SPFSS",
76
+ "HFADP", "ICE", "MSNOMF", "PLSYZ", "SPICE", "HFARRAY",
77
+ "ICEDELE", "MSPROP", "PLTD", "SPSCAN", "HFDEEM",
78
+ "ICELIST", "MSQUAD", "PLTLINE", "SPSWP", "HFEIGOPT",
79
+ "ICVFRC", "MSRELAX", "PLVFRC", "HFEREFINE", "LPRT",
80
+ "MSSOLU", "/PICE", "HFMODPRT", "MSADV", "MSSPEC",
81
+ "PLWAVE", "HFPA", "MSCAP", "MSTERM", "PRSYZ")
82
+
83
+ elafund = ("*VOPER", "VOVLAP", "*VPLOT", "VPLOT", "VPTN", "*VPUT",
84
+ "VPUT", "*VREAD", "VROTAT", "VSBA", "VSBV", "VSBW",
85
+ "/VSCALE", "*VSCFUN", "VSEL", "VSLA", "*VSTAT", "VSUM",
86
+ "VSWEEP", "VSYMM", "VTRAN", "VTYPE", "/VUP", "*VWRITE",
87
+ "/WAIT", "WAVES", "WERASE", "WFRONT", "/WINDOW",
88
+ "WMID", "WMORE", "WPAVE", "WPCSYS", "WPLANE", "WPOFFS",
89
+ "WPROTA", "WPSTYL", "WRFULL", "WRITE", "WRITEMAP",
90
+ "*WRK", "WSORT", "WSPRINGS", "WSTART", "WTBCREATE",
91
+ "XFDATA", "XFENRICH", "XFLIST", "/XFRM", "/XRANGE",
92
+ "XVAR", "/YRANGE", "/ZOOM", "/WB", "XMLO", "/XML",
93
+ "CNTR", "EBLOCK", "CMBLOCK", "NBLOCK", "/TRACK",
94
+ "CWZPLOT", "~EUI", "NELE", "EALL", "NALL", "FLITEM",
95
+ "LSLN", "PSOLVE", "ASLN", "/VERIFY", "/SSS", "~CFIN",
96
+ "*EVAL", "*MOONEY", "/RUNSTAT", "ALPFILL",
97
+ "ARCOLLAPSE", "ARDETACH", "ARFILL", "ARMERGE",
98
+ "ARSPLIT", "FIPLOT", "GAPFINISH", "GAPLIST",
99
+ "GAPMERGE", "GAPOPT", "GAPPLOT", "LNCOLLAPSE",
100
+ "LNDETACH", "LNFILL", "LNMERGE", "LNSPLIT", "PCONV",
101
+ "PLCONV", "PEMOPTS", "PEXCLUDE", "PINCLUDE", "PMETH",
102
+ "/PMETH", "PMOPTS", "PPLOT", "PPRANGE", "PRCONV",
103
+ "PRECISION", "RALL", "RFILSZ", "RITER", "RMEMRY",
104
+ "RSPEED", "RSTAT", "RTIMST", "/RUNST", "RWFRNT",
105
+ "SARPLOT", "SHSD", "SLPPLOT", "SLSPLOT", "VCVFILL",
106
+ "/OPT", "OPEQN", "OPFACT", "OPFRST", "OPGRAD",
107
+ "OPKEEP", "OPLOOP", "OPPRNT", "OPRAND", "OPSUBP",
108
+ "OPSWEEP", "OPTYPE", "OPUSER", "OPVAR", "OPADD",
109
+ "OPCLR", "OPDEL", "OPMAKE", "OPSEL", "OPANL", "OPDATA",
110
+ "OPRESU", "OPSAVE", "OPEXE", "OPLFA", "OPLGR",
111
+ "OPLIST", "OPLSW", "OPRFA", "OPRGR", "OPRSW",
112
+ "PILECALC", "PILEDISPSET", "PILEGEN", "PILELOAD",
113
+ "PILEMASS", "PILERUN", "PILESEL", "PILESTIF",
114
+ "PLVAROPT", "PRVAROPT", "TOCOMP", "TODEF", "TOFREQ",
115
+ "TOTYPE", "TOVAR", "TOEXE", "TOLOOP", "TOGRAPH",
116
+ "TOLIST", "TOPLOT", "TOPRINT", "TOSTAT", "TZAMESH",
117
+ "TZDELE", "TZEGEN", "XVAROPT", "PGSAVE", "SOLCONTROL",
118
+ "TOTAL", "VTGEOM", "VTREAL", "VTSTAT")
119
+
120
+ elafune = ("/ANUM", "AOFFST", "AOVLAP", "APLOT", "APPEND", "APTN",
121
+ "ARCLEN", "ARCTRM", "AREAS", "AREFINE", "AREMESH",
122
+ "AREVERSE", "AROTAT", "ARSCALE", "ARSYM", "ASBA",
123
+ "ASBL", "ASBV", "ASBW", "ASCRES", "ASEL", "ASIFILE",
124
+ "*ASK", "ASKIN", "ASLL", "ASLV", "ASOL", "/ASSIGN",
125
+ "ASUB", "ASUM", "ATAN", "ATRAN", "ATYPE", "/AUTO",
126
+ "AUTOTS", "/AUX2", "/AUX3", "/AUX12", "/AUX15",
127
+ "AVPRIN", "AVRES", "AWAVE", "/AXLAB", "*AXPY",
128
+ "/BATCH", "BCSOPTION", "BETAD", "BF", "BFA", "BFADELE",
129
+ "BFALIST", "BFCUM", "BFDELE", "BFE", "BFECUM",
130
+ "BFEDELE", "BFELIST", "BFESCAL", "BFINT", "BFK",
131
+ "BFKDELE", "BFKLIST", "BFL", "BFLDELE", "BFLIST",
132
+ "BFLLIST", "BFSCALE", "BFTRAN", "BFUNIF", "BFV",
133
+ "BFVDELE", "BFVLIST", "BIOOPT", "BIOT", "BLC4", "BLC5",
134
+ "BLOCK", "BOOL", "BOPTN", "BSAX", "BSMD", "BSM1",
135
+ "BSM2", "BSPLIN", "BSS1", "BSS2", "BSTE", "BSTQ",
136
+ "BTOL", "BUCOPT", "C", "CALC", "CAMPBELL", "CBDOF",
137
+ "CBMD", "CBMX", "CBTE", "CBTMP", "CDOPT", "CDREAD",
138
+ "CDWRITE", "CE", "CECHECK", "CECMOD", "CECYC",
139
+ "CEDELE", "CEINTF", "CELIST", "CENTER", "CEQN",
140
+ "CERIG", "CESGEN", "CFACT", "*CFCLOS", "*CFOPEN",
141
+ "*CFWRITE", "/CFORMAT", "CGLOC", "CGOMGA", "CGROW",
142
+ "CHECK", "CHKMSH", "CINT", "CIRCLE", "CISOL",
143
+ "/CLABEL", "/CLEAR", "CLOCAL", "CLOG", "/CLOG",
144
+ "CLRMSHLN", "CM", "CMACEL", "/CMAP", "CMATRIX",
145
+ "CMDELE", "CMDOMEGA", "CMEDIT", "CMGRP", "CMLIST",
146
+ "CMMOD", "CMOMEGA", "CMPLOT", "CMROTATE", "CMSEL",
147
+ "CMSFILE", "CMSOPT", "CMWRITE", "CNCHECK", "CNKMOD",
148
+ "CNTR", "CNVTOL", "/COLOR", "*COMP", "COMBINE",
149
+ "COMPRESS", "CON4", "CONE", "/CONFIG", "CONJUG",
150
+ "/CONTOUR", "/COPY", "CORIOLIS", "COUPLE", "COVAL",
151
+ "CP", "CPCYC", "CPDELE", "CPINTF", "/CPLANE", "CPLGEN",
152
+ "CPLIST", "CPMERGE", "CPNGEN", "CPSGEN", "CQC",
153
+ "*CREATE", "CRPLIM", "CS", "CSCIR", "CSDELE", "CSKP",
154
+ "CSLIST", "CSWPLA", "CSYS", "/CTYPE", "CURR2D",
155
+ "CUTCONTROL", "/CVAL", "CVAR", "/CWD", "CYCCALC",
156
+ "/CYCEXPAND", "CYCFILES", "CYCFREQ", "*CYCLE",
157
+ "CYCLIC", "CYCOPT", "CYCPHASE", "CYCSPEC", "CYL4",
158
+ "CYL5", "CYLIND", "CZDEL", "CZMESH", "D", "DA",
159
+ "DADELE", "DALIST", "DAMORPH", "DATA", "DATADEF",
160
+ "DCGOMG", "DCUM", "DCVSWP", "DDASPEC", "DDELE",
161
+ "DDOPTION", "DEACT", "DEFINE", "*DEL", "DELETE",
162
+ "/DELETE", "DELTIM", "DELTIME", "DEMORPH", "DERIV", "DESIZE",
163
+ "DESOL", "DETAB", "/DEVDISP", "/DEVICE", "/DFLAB",
164
+ "DFLX", "DFSWAVE", "DIG", "DIGIT", "*DIM",
165
+ "/DIRECTORY", "DISPLAY", "/DIST", "DJ", "DJDELE",
166
+ "DJLIST", "DK", "DKDELE", "DKLIST", "DL", "DLDELE",
167
+ "DLIST", "DLLIST", "*DMAT", "DMOVE", "DMPEXT",
168
+ "DMPOPTION", "DMPRAT", "DMPSTR", "DNSOL", "*DO", "DOF",
169
+ "DOFSEL", "DOMEGA", "*DOT", "*DOWHILE", "DSCALE",
170
+ "/DSCALE", "DSET", "DSPOPTION", "DSUM", "DSURF",
171
+ "DSYM", "DSYS", "DTRAN", "DUMP", "/DV3D", "DVAL",
172
+ "DVMORPH", "DYNOPT", "E", "EALIVE", "EDADAPT", "EDALE",
173
+ "EDASMP", "EDBOUND", "EDBX", "EDBVIS", "EDCADAPT",
174
+ "EDCGEN", "EDCLIST", "EDCMORE", "EDCNSTR", "EDCONTACT",
175
+ "EDCPU", "EDCRB", "EDCSC", "EDCTS", "EDCURVE",
176
+ "EDDAMP", "EDDBL", "EDDC", "EDDRELAX", "EDDUMP",
177
+ "EDELE", "EDENERGY", "EDFPLOT", "EDGCALE", "/EDGE",
178
+ "EDHGLS", "EDHIST", "EDHTIME", "EDINT", "EDIPART",
179
+ "EDIS", "EDLCS", "EDLOAD", "EDMP", "EDNB", "EDNDTSD",
180
+ "EDNROT", "EDOPT", "EDOUT", "EDPART", "EDPC", "EDPL",
181
+ "EDPVEL", "EDRC", "EDRD", "EDREAD", "EDRI", "EDRST",
182
+ "EDRUN", "EDSHELL", "EDSOLV", "EDSP", "EDSTART",
183
+ "EDTERM", "EDTP", "EDVEL", "EDWELD", "EDWRITE",
184
+ "EEXTRUDE", "/EFACET", "EGEN", "*EIGEN", "EINFIN",
185
+ "EINTF", "EKILL", "ELBOW", "ELEM", "ELIST", "*ELSE",
186
+ "*ELSEIF", "EMAGERR", "EMATWRITE", "EMF", "EMFT",
187
+ "EMID", "EMIS", "EMODIF", "EMORE", "EMSYM", "EMTGEN",
188
+ "EMUNIT", "EN", "*END", "*ENDDO", "*ENDIF",
189
+ "ENDRELEASE", "ENERSOL", "ENGEN", "ENORM", "ENSYM",
190
+ "EORIENT", "EPLOT", "EQSLV", "ERASE", "/ERASE",
191
+ "EREAD", "EREFINE", "EREINF", "ERESX", "ERNORM",
192
+ "ERRANG", "ESCHECK", "ESEL", "/ESHAPE", "ESIZE",
193
+ "ESLA", "ESLL", "ESLN", "ESLV", "ESOL", "ESORT",
194
+ "ESSOLV", "ESTIF", "ESURF", "ESYM", "ESYS", "ET",
195
+ "ETABLE", "ETCHG", "ETCONTROL", "ETDELE", "ETLIST",
196
+ "ETYPE", "EUSORT", "EWRITE", "*EXIT", "/EXIT", "EXP",
197
+ "EXPAND", "/EXPAND", "EXPASS", "*EXPORT", "EXPROFILE",
198
+ "EXPSOL", "EXTOPT", "EXTREM", "EXUNIT", "F", "/FACET",
199
+ "FATIGUE", "FC", "FCCHECK", "FCDELE", "FCLIST", "FCUM",
200
+ "FCTYP", "FDELE", "/FDELE", "FE", "FEBODY", "FECONS",
201
+ "FEFOR", "FELIST", "FESURF", "*FFT", "FILE",
202
+ "FILEAUX2", "FILEAUX3", "FILEDISP", "FILL", "FILLDATA",
203
+ "/FILNAME", "FINISH", "FITEM", "FJ", "FJDELE",
204
+ "FJLIST", "FK", "FKDELE", "FKLIST", "FL", "FLIST",
205
+ "FLLIST", "FLST", "FLUXV", "FLUREAD", "FMAGBC",
206
+ "FMAGSUM", "/FOCUS", "FOR2D", "FORCE", "FORM",
207
+ "/FORMAT", "FP", "FPLIST", "*FREE", "FREQ", "FRQSCL",
208
+ "FS", "FSCALE", "FSDELE", "FSLIST", "FSNODE", "FSPLOT",
209
+ "FSSECT", "FSSPARM", "FSUM", "FTCALC", "FTRAN",
210
+ "FTSIZE", "FTWRITE", "FTYPE", "FVMESH", "GAP", "GAPF",
211
+ "GAUGE", "GCDEF", "GCGEN", "/GCMD", "/GCOLUMN",
212
+ "GENOPT", "GEOM", "GEOMETRY", "*GET", "/GFILE",
213
+ "/GFORMAT", "/GLINE", "/GMARKER", "GMATRIX", "GMFACE",
214
+ "*GO", "/GO", "/GOLIST", "/GOPR", "GP", "GPDELE",
215
+ "GPLIST", "GPLOT", "/GRAPHICS", "/GRESUME", "/GRID",
216
+ "/GROPT", "GRP", "/GRTYP", "/GSAVE", "GSBDATA",
217
+ "GSGDATA", "GSLIST", "GSSOL", "/GST", "GSUM", "/GTHK",
218
+ "/GTYPE", "HARFRQ", "/HBC", "HBMAT", "/HEADER", "HELP",
219
+ "HELPDISP", "HEMIOPT", "HFANG", "HFSYM", "HMAGSOLV",
220
+ "HPGL", "HPTCREATE", "HPTDELETE", "HRCPLX", "HREXP",
221
+ "HROPT", "HROCEAN", "HROUT", "IC", "ICDELE", "ICLIST",
222
+ "/ICLWID", "/ICSCALE", "*IF", "IGESIN", "IGESOUT",
223
+ "/IMAGE", "IMAGIN", "IMESH", "IMMED", "IMPD",
224
+ "INISTATE", "*INIT", "/INPUT", "/INQUIRE", "INRES",
225
+ "INRTIA", "INT1", "INTSRF", "IOPTN", "IRLF", "IRLIST",
226
+ "*ITENGINE", "JPEG", "JSOL", "K", "KATT", "KBC",
227
+ "KBETW", "KCALC", "KCENTER", "KCLEAR", "KDELE",
228
+ "KDIST", "KEEP", "KESIZE", "KEYOPT", "KEYPTS", "KEYW",
229
+ "KFILL", "KGEN", "KL", "KLIST", "KMESH", "KMODIF",
230
+ "KMOVE", "KNODE", "KPLOT", "KPSCALE", "KREFINE",
231
+ "KSCALE", "KSCON", "KSEL", "KSLL", "KSLN", "KSUM",
232
+ "KSYMM", "KTRAN", "KUSE", "KWPAVE", "KWPLAN", "L",
233
+ "L2ANG", "L2TAN", "LANG", "LARC", "/LARC", "LAREA",
234
+ "LARGE", "LATT", "LAYER", "LAYERP26", "LAYLIST",
235
+ "LAYPLOT", "LCABS", "LCASE", "LCCALC", "LCCAT",
236
+ "LCDEF", "LCFACT", "LCFILE", "LCLEAR", "LCOMB",
237
+ "LCOPER", "LCSEL", "LCSL", "LCSUM", "LCWRITE",
238
+ "LCZERO", "LDELE", "LDIV", "LDRAG", "LDREAD", "LESIZE",
239
+ "LEXTND", "LFILLT", "LFSURF", "LGEN", "LGLUE",
240
+ "LGWRITE", "/LIGHT", "LINA", "LINE", "/LINE", "LINES",
241
+ "LINL", "LINP", "LINV", "LIST", "*LIST", "LLIST",
242
+ "LMATRIX", "LMESH", "LNSRCH", "LOCAL", "LOVLAP",
243
+ "LPLOT", "LPTN", "LREFINE", "LREVERSE", "LROTAT",
244
+ "LSBA", "*LSBAC", "LSBL", "LSBV", "LSBW", "LSCLEAR",
245
+ "LSDELE", "*LSDUMP", "LSEL", "*LSENGINE", "*LSFACTOR",
246
+ "LSLA", "LSLK", "LSOPER", "/LSPEC", "LSREAD",
247
+ "*LSRESTORE", "LSSCALE", "LSSOLVE", "LSTR", "LSUM",
248
+ "LSWRITE", "/LSYMBOL", "LSYMM", "LTAN", "LTRAN",
249
+ "LUMPM", "LVSCALE", "LWPLAN", "M", "MADAPT", "MAGOPT",
250
+ "MAGSOLV", "/MAIL", "MAP", "/MAP", "MAP2DTO3D",
251
+ "MAPSOLVE", "MAPVAR", "MASTER", "MAT", "MATER",
252
+ "MCHECK", "MDAMP", "MDELE", "MDPLOT", "MEMM", "/MENU",
253
+ "MESHING", "MFANALYSIS", "MFBUCKET", "MFCALC", "MFCI",
254
+ "MFCLEAR", "MFCMMAND", "MFCONV", "MFDTIME", "MFELEM",
255
+ "MFEM", "MFEXTER", "MFFNAME", "MFFR", "MFIMPORT",
256
+ "MFINTER", "MFITER", "MFLCOMM", "MFLIST", "MFMAP",
257
+ "MFORDER", "MFOUTPUT", "*MFOURI", "MFPSIMUL", "MFRC",
258
+ "MFRELAX", "MFRSTART", "MFSORDER", "MFSURFACE",
259
+ "MFTIME", "MFTOL", "*MFUN", "MFVOLUME", "MFWRITE",
260
+ "MGEN", "MIDTOL", "/MKDIR", "MLIST", "MMASS", "MMF",
261
+ "MODCONT", "MODE", "MODIFY", "MODMSH", "MODSELOPTION",
262
+ "MODOPT", "MONITOR", "*MOPER", "MOPT", "MORPH", "MOVE",
263
+ "MP", "MPAMOD", "MPCHG", "MPCOPY", "MPDATA", "MPDELE",
264
+ "MPDRES", "/MPLIB", "MPLIST", "MPPLOT", "MPREAD",
265
+ "MPRINT", "MPTEMP", "MPTGEN", "MPTRES", "MPWRITE",
266
+ "/MREP", "MSAVE", "*MSG", "MSHAPE", "MSHCOPY",
267
+ "MSHKEY", "MSHMID", "MSHPATTERN", "MSOLVE", "/MSTART",
268
+ "MSTOLE", "*MULT", "*MWRITE", "MXPAND", "N", "NANG",
269
+ "NAXIS", "NCNV", "NDELE", "NDIST", "NDSURF", "NEQIT",
270
+ "/NERR", "NFORCE", "NGEN", "NKPT", "NLADAPTIVE",
271
+ "NLDIAG", "NLDPOST", "NLGEOM", "NLHIST", "NLIST",
272
+ "NLMESH", "NLOG", "NLOPT", "NMODIF", "NOCOLOR",
273
+ "NODES", "/NOERASE", "/NOLIST", "NOOFFSET", "NOORDER",
274
+ "/NOPR", "NORA", "NORL", "/NORMAL", "NPLOT", "NPRINT",
275
+ "NREAD", "NREFINE", "NRLSUM", "*NRM", "NROPT",
276
+ "NROTAT", "NRRANG", "NSCALE", "NSEL", "NSLA", "NSLE",
277
+ "NSLK", "NSLL", "NSLV", "NSMOOTH", "NSOL", "NSORT",
278
+ "NSTORE", "NSUBST", "NSVR", "NSYM", "/NUMBER",
279
+ "NUMCMP", "NUMEXP", "NUMMRG", "NUMOFF", "NUMSTR",
280
+ "NUMVAR", "NUSORT", "NWPAVE", "NWPLAN", "NWRITE",
281
+ "OCDATA", "OCDELETE", "OCLIST", "OCREAD", "OCTABLE",
282
+ "OCTYPE", "OCZONE", "OMEGA", "OPERATE", "OPNCONTROL",
283
+ "OUTAERO", "OUTOPT", "OUTPR", "/OUTPUT", "OUTRES",
284
+ "OVCHECK", "PADELE", "/PAGE", "PAGET", "PAPUT",
285
+ "PARESU", "PARTSEL", "PARRES", "PARSAV", "PASAVE",
286
+ "PATH", "PAUSE", "/PBC", "/PBF", "PCALC", "PCGOPT",
287
+ "PCIRC", "/PCIRCLE", "/PCOPY", "PCROSS", "PDANL",
288
+ "PDCDF", "PDCFLD", "PDCLR", "PDCMAT", "PDCORR",
289
+ "PDDMCS", "PDDOEL", "PDEF", "PDEXE", "PDHIST",
290
+ "PDINQR", "PDLHS", "PDMETH", "PDOT", "PDPINV",
291
+ "PDPLOT", "PDPROB", "PDRESU", "PDROPT", "/PDS",
292
+ "PDSAVE", "PDSCAT", "PDSENS", "PDSHIS", "PDUSER",
293
+ "PDVAR", "PDWRITE", "PERBC2D", "PERTURB", "PFACT",
294
+ "PHYSICS", "PIVCHECK", "PLCAMP", "PLCFREQ", "PLCHIST",
295
+ "PLCINT", "PLCPLX", "PLCRACK", "PLDISP", "PLESOL",
296
+ "PLETAB", "PLFAR", "PLF2D", "PLGEOM", "PLLS", "PLMAP",
297
+ "PLMC", "PLNEAR", "PLNSOL", "/PLOPTS", "PLORB", "PLOT",
298
+ "PLOTTING", "PLPAGM", "PLPATH", "PLSECT", "PLST",
299
+ "PLTIME", "PLTRAC", "PLVAR", "PLVECT", "PLZZ",
300
+ "/PMACRO", "PMAP", "PMGTRAN", "PMLOPT", "PMLSIZE",
301
+ "/PMORE", "PNGR", "/PNUM", "POINT", "POLY", "/POLYGON",
302
+ "/POST1", "/POST26", "POWERH", "PPATH", "PRANGE",
303
+ "PRAS", "PRCAMP", "PRCINT", "PRCPLX", "PRED",
304
+ "PRENERGY", "/PREP7", "PRERR", "PRESOL", "PRETAB",
305
+ "PRFAR", "PRI2", "PRIM", "PRINT", "*PRINT", "PRISM",
306
+ "PRITER", "PRJSOL", "PRNEAR", "PRNLD", "PRNSOL",
307
+ "PROD", "PRORB", "PRPATH", "PRRFOR", "PRRSOL",
308
+ "PRSCONTROL", "PRSECT", "PRTIME", "PRVAR", "PRVECT",
309
+ "PSCONTROL", "PSCR", "PSDCOM", "PSDFRQ", "PSDGRAPH",
310
+ "PSDRES", "PSDSPL", "PSDUNIT", "PSDVAL", "PSDWAV",
311
+ "/PSEARCH", "PSEL", "/PSF", "PSMAT", "PSMESH",
312
+ "/PSPEC", "/PSTATUS", "PSTRES", "/PSYMB", "PTR",
313
+ "PTXY", "PVECT", "/PWEDGE", "QDVAL", "QRDOPT", "QSOPT",
314
+ "QUAD", "/QUIT", "QUOT", "R", "RACE", "RADOPT",
315
+ "RAPPND", "RATE", "/RATIO", "RBE3", "RCON", "RCYC",
316
+ "RDEC", "RDELE", "READ", "REAL", "REALVAR", "RECTNG",
317
+ "REMESH", "/RENAME", "REORDER", "*REPEAT", "/REPLOT",
318
+ "RESCOMBINE", "RESCONTROL", "RESET", "/RESET", "RESP",
319
+ "RESUME", "RESVEC", "RESWRITE", "*RETURN", "REXPORT",
320
+ "REZONE", "RFORCE", "/RGB", "RIGID", "RIGRESP",
321
+ "RIMPORT", "RLIST", "RMALIST", "RMANL", "RMASTER",
322
+ "RMCAP", "RMCLIST", "/RMDIR", "RMFLVEC", "RMLVSCALE",
323
+ "RMMLIST", "RMMRANGE", "RMMSELECT", "RMNDISP",
324
+ "RMNEVEC", "RMODIF", "RMORE", "RMPORDER", "RMRESUME",
325
+ "RMRGENERATE", "RMROPTIONS", "RMRPLOT", "RMRSTATUS",
326
+ "RMSAVE", "RMSMPLE", "RMUSE", "RMXPORT", "ROCK",
327
+ "ROSE", "RPOLY", "RPR4", "RPRISM", "RPSD", "RSFIT",
328
+ "RSOPT", "RSPLIT", "RSPLOT", "RSPRNT", "RSSIMS",
329
+ "RSTMAC", "RSTOFF", "RSURF", "RSYMM", "RSYS", "RTHICK",
330
+ "SABS", "SADD", "SALLOW", "SAVE", "SBCLIST", "SBCTRAN",
331
+ "SDELETE", "SE", "SECCONTROL", "SECDATA",
332
+ "SECFUNCTION", "SECJOINT", "/SECLIB", "SECLOCK",
333
+ "SECMODIF", "SECNUM", "SECOFFSET", "SECPLOT",
334
+ "SECREAD", "SECSTOP", "SECTYPE", "SECWRITE", "SED",
335
+ "SEDLIST", "SEEXP", "/SEG", "SEGEN", "SELIST", "SELM",
336
+ "SELTOL", "SENERGY", "SEOPT", "SESYMM", "*SET", "SET",
337
+ "SETFGAP", "SETRAN", "SEXP", "SF", "SFA", "SFACT",
338
+ "SFADELE", "SFALIST", "SFBEAM", "SFCALC", "SFCUM",
339
+ "SFDELE", "SFE", "SFEDELE", "SFELIST", "SFFUN",
340
+ "SFGRAD", "SFL", "SFLDELE", "SFLEX", "SFLIST",
341
+ "SFLLIST", "SFSCALE", "SFTRAN", "/SHADE", "SHELL",
342
+ "/SHOW", "/SHOWDISP", "SHPP", "/SHRINK", "SLIST",
343
+ "SLOAD", "SMALL", "*SMAT", "SMAX", "/SMBC", "SMBODY",
344
+ "SMCONS", "SMFOR", "SMIN", "SMOOTH", "SMRTSIZE",
345
+ "SMSURF", "SMULT", "SNOPTION", "SOLU", "/SOLU",
346
+ "SOLUOPT", "SOLVE", "SORT", "SOURCE", "SPACE",
347
+ "SPCNOD", "SPCTEMP", "SPDAMP", "SPEC", "SPFREQ",
348
+ "SPGRAPH", "SPH4", "SPH5", "SPHERE", "SPLINE", "SPLOT",
349
+ "SPMWRITE", "SPOINT", "SPOPT", "SPREAD", "SPTOPT",
350
+ "SPOWER", "SPUNIT", "SPVAL", "SQRT", "*SREAD", "SRSS",
351
+ "SSBT", "/SSCALE", "SSLN", "SSMT", "SSPA", "SSPB",
352
+ "SSPD", "SSPE", "SSPM", "SSUM", "SSTATE", "STABILIZE",
353
+ "STAOPT", "STAT", "*STATUS", "/STATUS", "STEF",
354
+ "STORE", "SUBOPT", "SUBSET", "SUCALC",
355
+ "SUCR", "SUDEL", "SUEVAL", "SUGET", "SUMAP", "SUMTYPE",
356
+ "SUPL", "SUPR", "SURESU", "SUSAVE", "SUSEL", "SUVECT",
357
+ "SV", "SVPLOT", "SVTYP", "SWADD", "SWDEL", "SWGEN",
358
+ "SWLIST", "SYNCHRO", "/SYP", "/SYS", "TALLOW",
359
+ "TARGET", "*TAXIS", "TB", "TBCOPY", "TBDATA", "TBDELE",
360
+ "TBEO", "TBIN", "TBFIELD", "TBFT", "TBLE", "TBLIST",
361
+ "TBMODIF", "TBPLOT", "TBPT", "TBTEMP", "TCHG", "/TEE",
362
+ "TERM", "THEXPAND", "THOPT", "TIFF", "TIME",
363
+ "TIMERANGE", "TIMINT", "TIMP", "TINTP",
364
+ "/TLABEL", "TOFFST", "*TOPER", "TORQ2D", "TORQC2D",
365
+ "TORQSUM", "TORUS", "TRANS", "TRANSFER", "*TREAD",
366
+ "TREF", "/TRIAD", "/TRLCY", "TRNOPT", "TRPDEL",
367
+ "TRPLIS", "TRPOIN", "TRTIME", "TSHAP", "/TSPEC",
368
+ "TSRES", "TUNIF", "TVAR", "/TXTRE", "/TYPE", "TYPE",
369
+ "/UCMD", "/UDOC", "/UI", "UIMP", "/UIS", "*ULIB", "/UPF",
370
+ "UNDELETE", "UNDO", "/UNITS", "UNPAUSE", "UPCOORD",
371
+ "UPGEOM", "*USE", "/USER", "USRCAL", "USRDOF",
372
+ "USRELEM", "V", "V2DOPT", "VA", "*VABS", "VADD",
373
+ "VARDEL", "VARNAM", "VATT", "VCLEAR", "*VCOL",
374
+ "/VCONE", "VCROSS", "*VCUM", "VDDAM", "VDELE", "VDGL",
375
+ "VDOT", "VDRAG", "*VEC", "*VEDIT", "VEORIENT", "VEXT",
376
+ "*VFACT", "*VFILL", "VFOPT", "VFQUERY", "VFSM",
377
+ "*VFUN", "VGEN", "*VGET", "VGET", "VGLUE", "/VIEW",
378
+ "VIMP", "VINP", "VINV", "*VITRP", "*VLEN", "VLIST",
379
+ "VLSCALE", "*VMASK", "VMESH", "VOFFST", "VOLUMES")
380
+
381
+ # list of in-built () functions
382
+ elafunf = ("NX()", "NY()", "NZ()", "KX()", "KY()", "KZ()", "LX()",
383
+ "LY()", "LZ()", "LSX()", "LSY()", "LSZ()", "NODE()",
384
+ "KP()", "DISTND()", "DISTKP()", "DISTEN()", "ANGLEN()",
385
+ "ANGLEK()", "NNEAR()", "KNEAR()", "ENEARN()",
386
+ "AREAND()", "AREAKP()", "ARNODE()", "NORMNX()",
387
+ "NORMNY()", "NORMNZ()", "NORMKX()", "NORMKY()",
388
+ "NORMKZ()", "ENEXTN()", "NELEM()", "NODEDOF()",
389
+ "ELADJ()", "NDFACE()", "NMFACE()", "ARFACE()", "UX()",
390
+ "UY()", "UZ()", "ROTX()", "ROTY()", "ROTZ()", "TEMP()",
391
+ "PRES()", "VX()", "VY()", "VZ()", "ENKE()", "ENDS()",
392
+ "VOLT()", "MAG()", "AX()", "AY()", "AZ()",
393
+ "VIRTINQR()", "KWGET()", "VALCHR()", "VALHEX()",
394
+ "CHRHEX()", "STRFILL()", "STRCOMP()", "STRPOS()",
395
+ "STRLENG()", "UPCASE()", "LWCASE()", "JOIN()",
396
+ "SPLIT()", "ABS()", "SIGN()", "CXABS()", "EXP()",
397
+ "LOG()", "LOG10()", "SQRT()", "NINT()", "MOD()",
398
+ "RAND()", "GDIS()", "SIN()", "COS()", "TAN()",
399
+ "SINH()", "COSH()", "TANH()", "ASIN()", "ACOS()",
400
+ "ATAN()", "ATAN2()")
401
+
402
+ elafung = ("NSEL()", "ESEL()", "KSEL()", "LSEL()", "ASEL()",
403
+ "VSEL()", "NDNEXT()", "ELNEXT()", "KPNEXT()",
404
+ "LSNEXT()", "ARNEXT()", "VLNEXT()", "CENTRX()",
405
+ "CENTRY()", "CENTRZ()")
406
+
407
+ elafunh = ("~CAT5IN", "~CATIAIN", "~PARAIN", "~PROEIN", "~SATIN",
408
+ "~UGIN", "A", "AADD", "AATT", "ABEXTRACT", "*ABBR",
409
+ "ABBRES", "ABBSAV", "ABS", "ACCAT", "ACCOPTION",
410
+ "ACEL", "ACLEAR", "ADAMS", "ADAPT", "ADD", "ADDAM",
411
+ "ADELE", "ADGL", "ADRAG", "AESIZE", "AFILLT", "AFLIST",
412
+ "AFSURF", "*AFUN", "AGEN", "AGLUE", "AINA", "AINP",
413
+ "AINV", "AL", "ALIST", "ALLSEL", "ALPHAD", "AMAP",
414
+ "AMESH", "/AN3D", "ANCNTR", "ANCUT", "ANCYC", "ANDATA",
415
+ "ANDSCL", "ANDYNA", "/ANFILE", "ANFLOW", "/ANGLE",
416
+ "ANHARM", "ANIM", "ANISOS", "ANMODE", "ANMRES",
417
+ "/ANNOT", "ANORM", "ANPRES", "ANSOL", "ANSTOAQWA",
418
+ "ANSTOASAS", "ANTIME", "ANTYPE")
419
+
420
+ special = ("/COM", "/TITLE", "STITLE")
421
+
422
+ elements = ("SOLID5",
423
+ "LINK11",
424
+ "PLANE13",
425
+ "COMBIN14",
426
+ "MASS2",
427
+ "PLANE25",
428
+ "MATRIX27",
429
+ "FLUID29",
430
+ "FLUID30",
431
+ "LINK31",
432
+ "LINK33",
433
+ "LINK34",
434
+ "PLANE35",
435
+ "SOURC36",
436
+ "COMBIN37",
437
+ "FLUID38",
438
+ "COMBIN39",
439
+ "COMBIN40",
440
+ "INFIN47",
441
+ "MATRIX50",
442
+ "PLANE55",
443
+ "SHELL61",
444
+ "LINK68",
445
+ "SOLID70",
446
+ "MASS71",
447
+ "PLANE75",
448
+ "PLANE77",
449
+ "PLANE78",
450
+ "PLANE83",
451
+ "SOLID87",
452
+ "SOLID90",
453
+ "CIRCU94",
454
+ "SOLID96",
455
+ "SOLID98",
456
+ "INFIN110",
457
+ "INFIN111",
458
+ "FLUID116",
459
+ "PLANE121",
460
+ "SOLID122",
461
+ "SOLID123",
462
+ "CIRCU124",
463
+ "CIRCU125",
464
+ "TRANS126",
465
+ "FLUID129",
466
+ "FLUID130",
467
+ "SHELL131",
468
+ "SHELL132",
469
+ "FLUID136",
470
+ "FLUID138",
471
+ "FLUID139",
472
+ "SURF151",
473
+ "SURF152",
474
+ "SURF153",
475
+ "SURF154",
476
+ "SURF155",
477
+ "SURF156",
478
+ "SHELL157",
479
+ "SURF159",
480
+ "TARGE169",
481
+ "TARGE170",
482
+ "CONTA172",
483
+ "CONTA174",
484
+ "CONTA175",
485
+ "CONTA177",
486
+ "CONTA178",
487
+ "PRETS179",
488
+ "LINK180",
489
+ "SHELL181",
490
+ "PLANE182",
491
+ "PLANE183",
492
+ "MPC184",
493
+ "SOLID185",
494
+ "SOLID186",
495
+ "SOLID187",
496
+ "BEAM188",
497
+ "BEAM189",
498
+ "SOLSH190",
499
+ "INTER192",
500
+ "INTER193",
501
+ "INTER194",
502
+ "INTER195",
503
+ "MESH200",
504
+ "FOLLW201",
505
+ "INTER202",
506
+ "INTER203",
507
+ "INTER204",
508
+ "INTER205",
509
+ "SHELL208",
510
+ "SHELL209",
511
+ "CPT212",
512
+ "CPT213",
513
+ "COMBI214",
514
+ "CPT215",
515
+ "CPT216",
516
+ "CPT217",
517
+ "FLUID218",
518
+ "FLUID220",
519
+ "FLUID221",
520
+ "PLANE222",
521
+ "PLANE223",
522
+ "SOLID225",
523
+ "SOLID226",
524
+ "SOLID227",
525
+ "PLANE230",
526
+ "SOLID231",
527
+ "SOLID232",
528
+ "PLANE233",
529
+ "SOLID236",
530
+ "SOLID237",
531
+ "PLANE238",
532
+ "SOLID239",
533
+ "SOLID240",
534
+ "HSFLD241",
535
+ "HSFLD242",
536
+ "COMBI250",
537
+ "SURF251",
538
+ "SURF252",
539
+ "INFIN257",
540
+ "REINF263",
541
+ "REINF264",
542
+ "REINF265",
543
+ "SOLID272",
544
+ "SOLID273",
545
+ "SOLID278",
546
+ "SOLID279",
547
+ "CABLE280",
548
+ "SHELL281",
549
+ "SOLID285",
550
+ "PIPE288",
551
+ "PIPE289",
552
+ "ELBOW290",
553
+ "SOLID291",
554
+ "PLANE292",
555
+ "PLANE293",
556
+ "USER300")
557
+
558
+ tokens = {
559
+ 'root': [
560
+ (r'[^\S\n]+', Whitespace),
561
+ (words((elafunb+elafunc+elafund+elafune+elafunh+special), suffix=r'\b'), Keyword, 'non-keyword'),
562
+ default('non-keyword'),
563
+ ],
564
+ 'non-keyword': [
565
+ (r'!.*\n', Comment, '#pop'),
566
+ (r'%.*?%', Escape),
567
+ include('strings'),
568
+ include('nums'),
569
+ (words((elafunf+elafung), suffix=r'\b'), Name.Builtin),
570
+ (words((elements), suffix=r'\b'), Name.Property),
571
+ include('core'),
572
+ (r'AR[0-9]+', Name.Variable.Instance),
573
+ (r'[a-z_][a-z0-9_]*', Name.Variable),
574
+ (r'\n+', Whitespace, '#pop'),
575
+ (r'[^\S\n]+', Whitespace),
576
+ ],
577
+ 'core': [
578
+ # Operators
579
+ (r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=|\(|\))', Operator),
580
+ (r'/EOF', Generic.Emph),
581
+ (r'[\.(),:&;]', Punctuation),
582
+ ],
583
+ 'strings': [
584
+ (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
585
+ (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
586
+ (r'[$%]', String.Symbol),
587
+ ],
588
+ 'nums': [
589
+ (r'[+-]?\d*\.\d+([efEF][-+]?\d+)?', Number.Float), # with dot
590
+ (r'([+-]?\d+([efEF][-+]?\d+))', Number.Float), # With scientific notation
591
+ (r'\b\d+(?![.ef])', Number.Integer), # integer simple
592
+ ]
593
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/apl.py ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.apl
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for APL.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer
12
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation, Whitespace
14
+
15
+ __all__ = ['APLLexer']
16
+
17
+
18
+ class APLLexer(RegexLexer):
19
+ """
20
+ A simple APL lexer.
21
+ """
22
+ name = 'APL'
23
+ url = 'https://en.m.wikipedia.org/wiki/APL_(programming_language)'
24
+ aliases = ['apl']
25
+ filenames = [
26
+ '*.apl', '*.aplf', '*.aplo', '*.apln',
27
+ '*.aplc', '*.apli', '*.dyalog',
28
+ ]
29
+ version_added = '2.0'
30
+
31
+ tokens = {
32
+ 'root': [
33
+ # Whitespace
34
+ # ==========
35
+ (r'\s+', Whitespace),
36
+ #
37
+ # Comment
38
+ # =======
39
+ # '⍝' is traditional; '#' is supported by GNU APL and NGN (but not Dyalog)
40
+ (r'[⍝#].*$', Comment.Single),
41
+ #
42
+ # Strings
43
+ # =======
44
+ (r'\'((\'\')|[^\'])*\'', String.Single),
45
+ (r'"(("")|[^"])*"', String.Double), # supported by NGN APL
46
+ #
47
+ # Punctuation
48
+ # ===========
49
+ # This token type is used for diamond and parenthesis
50
+ # but not for bracket and ; (see below)
51
+ (r'[⋄◇()]', Punctuation),
52
+ #
53
+ # Array indexing
54
+ # ==============
55
+ # Since this token type is very important in APL, it is not included in
56
+ # the punctuation token type but rather in the following one
57
+ (r'[\[\];]', String.Regex),
58
+ #
59
+ # Distinguished names
60
+ # ===================
61
+ # following IBM APL2 standard
62
+ (r'⎕[A-Za-zΔ∆⍙][A-Za-zΔ∆⍙_¯0-9]*', Name.Function),
63
+ #
64
+ # Labels
65
+ # ======
66
+ # following IBM APL2 standard
67
+ # (r'[A-Za-zΔ∆⍙][A-Za-zΔ∆⍙_¯0-9]*:', Name.Label),
68
+ #
69
+ # Variables
70
+ # =========
71
+ # following IBM APL2 standard (with a leading _ ok for GNU APL and Dyalog)
72
+ (r'[A-Za-zΔ∆⍙_][A-Za-zΔ∆⍙_¯0-9]*', Name.Variable),
73
+ #
74
+ # Numbers
75
+ # =======
76
+ (r'¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞)'
77
+ r'([Jj]¯?(0[Xx][0-9A-Fa-f]+|[0-9]*\.?[0-9]+([Ee][+¯]?[0-9]+)?|¯|∞))?',
78
+ Number),
79
+ #
80
+ # Operators
81
+ # ==========
82
+ (r'[\.\\\/⌿⍀¨⍣⍨⍠⍤∘⌸&⌶@⌺⍥⍛⍢]', Name.Attribute), # closest token type
83
+ (r'[+\-×÷⌈⌊∣|⍳?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⌸⍯↗⊆⊇⍸√⌾…⍮]',
84
+ Operator),
85
+ #
86
+ # Constant
87
+ # ========
88
+ (r'⍬', Name.Constant),
89
+ #
90
+ # Quad symbol
91
+ # ===========
92
+ (r'[⎕⍞]', Name.Variable.Global),
93
+ #
94
+ # Arrows left/right
95
+ # =================
96
+ (r'[←→]', Keyword.Declaration),
97
+ #
98
+ # D-Fn
99
+ # ====
100
+ (r'[⍺⍵⍶⍹∇:]', Name.Builtin.Pseudo),
101
+ (r'[{}]', Keyword.Type),
102
+ ],
103
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/archetype.py ADDED
@@ -0,0 +1,315 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.archetype
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Archetype-related syntaxes, including ODIN, ADL and cADL.
6
+
7
+ For uses of this syntax, see the openEHR archetypes <http://www.openEHR.org/ckm>
8
+
9
+ Contributed by Thomas Beale <https://github.com/wolandscat>,
10
+ <https://bitbucket.org/thomas_beale>.
11
+
12
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
13
+ :license: BSD, see LICENSE for details.
14
+ """
15
+
16
+ from pygments.lexer import RegexLexer, include, bygroups, using, default
17
+ from pygments.token import Text, Comment, Name, Literal, Number, String, \
18
+ Punctuation, Keyword, Operator, Generic, Whitespace
19
+
20
+ __all__ = ['OdinLexer', 'CadlLexer', 'AdlLexer']
21
+
22
+
23
+ class AtomsLexer(RegexLexer):
24
+ """
25
+ Lexer for Values used in ADL and ODIN.
26
+
27
+ .. versionadded:: 2.1
28
+ """
29
+
30
+ tokens = {
31
+ # ----- pseudo-states for inclusion -----
32
+ 'whitespace': [
33
+ (r'\n', Whitespace),
34
+ (r'\s+', Whitespace),
35
+ (r'([ \t]*)(--.*)$', bygroups(Whitespace, Comment)),
36
+ ],
37
+ 'archetype_id': [
38
+ (r'([ \t]*)(([a-zA-Z]\w{1,100}(\.[a-zA-Z]\w{1,100})*::)?[a-zA-Z]\w{1,100}(-[a-zA-Z]\w{1,100}){2}'
39
+ r'\.\w{1,100}[\w-]*\.v\d+(\.\d+){,2}((-[a-z]+)(\.\d+)?)?)',
40
+ bygroups(Whitespace, Name.Decorator)),
41
+ ],
42
+ 'date_constraints': [
43
+ # ISO 8601-based date/time constraints
44
+ (r'[Xx?YyMmDdHhSs\d]{2,4}([:-][Xx?YyMmDdHhSs\d]{2}){2}', Literal.Date),
45
+ # ISO 8601-based duration constraints + optional trailing slash
46
+ (r'(P[YyMmWwDd]+(T[HhMmSs]+)?|PT[HhMmSs]+)/?', Literal.Date),
47
+ ],
48
+ 'ordered_values': [
49
+ # ISO 8601 date with optional 'T' ligature
50
+ (r'\d{4}-\d{2}-\d{2}T?', Literal.Date),
51
+ # ISO 8601 time
52
+ (r'\d{2}:\d{2}:\d{2}(\.\d+)?([+-]\d{4}|Z)?', Literal.Date),
53
+ # ISO 8601 duration
54
+ (r'P((\d*(\.\d+)?[YyMmWwDd]){1,3}(T(\d*(\.\d+)?[HhMmSs]){,3})?|'
55
+ r'T(\d*(\.\d+)?[HhMmSs]){,3})', Literal.Date),
56
+ (r'[+-]?(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+', Number.Float),
57
+ (r'[+-]?\d*\.\d+%?', Number.Float),
58
+ (r'0x[0-9a-fA-F]+', Number.Hex),
59
+ (r'[+-]?\d+%?', Number.Integer),
60
+ ],
61
+ 'values': [
62
+ include('ordered_values'),
63
+ (r'([Tt]rue|[Ff]alse)', Literal),
64
+ (r'"', String, 'string'),
65
+ (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
66
+ (r'[a-z][a-z0-9+.-]*:', Literal, 'uri'),
67
+ # term code
68
+ (r'(\[)(\w[\w-]*(?:\([^)\n]+\))?)(::)(\w[\w-]*)(\])',
69
+ bygroups(Punctuation, Name.Decorator, Punctuation, Name.Decorator,
70
+ Punctuation)),
71
+ (r'\|', Punctuation, 'interval'),
72
+ # list continuation
73
+ (r'\.\.\.', Punctuation),
74
+ ],
75
+ 'constraint_values': [
76
+ (r'(\[)(\w[\w-]*(?:\([^)\n]+\))?)(::)',
77
+ bygroups(Punctuation, Name.Decorator, Punctuation), 'adl14_code_constraint'),
78
+ # ADL 1.4 ordinal constraint
79
+ (r'(\d*)(\|)(\[\w[\w-]*::\w[\w-]*\])((?:[,;])?)',
80
+ bygroups(Number, Punctuation, Name.Decorator, Punctuation)),
81
+ include('date_constraints'),
82
+ include('values'),
83
+ ],
84
+
85
+ # ----- real states -----
86
+ 'string': [
87
+ ('"', String, '#pop'),
88
+ (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|'
89
+ r'u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})', String.Escape),
90
+ # all other characters
91
+ (r'[^\\"]+', String),
92
+ # stray backslash
93
+ (r'\\', String),
94
+ ],
95
+ 'uri': [
96
+ # effective URI terminators
97
+ (r'[,>\s]', Punctuation, '#pop'),
98
+ (r'[^>\s,]+', Literal),
99
+ ],
100
+ 'interval': [
101
+ (r'\|', Punctuation, '#pop'),
102
+ include('ordered_values'),
103
+ (r'\.\.', Punctuation),
104
+ (r'[<>=] *', Punctuation),
105
+ # handle +/-
106
+ (r'\+/-', Punctuation),
107
+ (r'\s+', Whitespace),
108
+ ],
109
+ 'any_code': [
110
+ include('archetype_id'),
111
+ # if it is a code
112
+ (r'[a-z_]\w*[0-9.]+(@[^\]]+)?', Name.Decorator),
113
+ # if it is tuple with attribute names
114
+ (r'[a-z_]\w*', Name.Class),
115
+ # if it is an integer, i.e. Xpath child index
116
+ (r'[0-9]+', Text),
117
+ (r'\|', Punctuation, 'code_rubric'),
118
+ (r'\]', Punctuation, '#pop'),
119
+ # handle use_archetype statement
120
+ (r'(\s*)(,)(\s*)', bygroups(Whitespace, Punctuation, Whitespace)),
121
+ ],
122
+ 'code_rubric': [
123
+ (r'\|', Punctuation, '#pop'),
124
+ (r'[^|]+', String),
125
+ ],
126
+ 'adl14_code_constraint': [
127
+ (r'\]', Punctuation, '#pop'),
128
+ (r'\|', Punctuation, 'code_rubric'),
129
+ (r'(\w[\w-]*)([;,]?)', bygroups(Name.Decorator, Punctuation)),
130
+ include('whitespace'),
131
+ ],
132
+ }
133
+
134
+
135
+ class OdinLexer(AtomsLexer):
136
+ """
137
+ Lexer for ODIN syntax.
138
+ """
139
+ name = 'ODIN'
140
+ aliases = ['odin']
141
+ filenames = ['*.odin']
142
+ mimetypes = ['text/odin']
143
+ url = 'https://github.com/openEHR/odin'
144
+ version_added = '2.1'
145
+
146
+ tokens = {
147
+ 'path': [
148
+ (r'>', Punctuation, '#pop'),
149
+ # attribute name
150
+ (r'[a-z_]\w*', Name.Class),
151
+ (r'/', Punctuation),
152
+ (r'\[', Punctuation, 'key'),
153
+ (r'(\s*)(,)(\s*)', bygroups(Whitespace, Punctuation, Whitespace), '#pop'),
154
+ (r'\s+', Whitespace, '#pop'),
155
+ ],
156
+ 'key': [
157
+ include('values'),
158
+ (r'\]', Punctuation, '#pop'),
159
+ ],
160
+ 'type_cast': [
161
+ (r'\)', Punctuation, '#pop'),
162
+ (r'[^)]+', Name.Class),
163
+ ],
164
+ 'root': [
165
+ include('whitespace'),
166
+ (r'([Tt]rue|[Ff]alse)', Literal),
167
+ include('values'),
168
+ # x-ref path
169
+ (r'/', Punctuation, 'path'),
170
+ # x-ref path starting with key
171
+ (r'\[', Punctuation, 'key'),
172
+ # attribute name
173
+ (r'[a-z_]\w*', Name.Class),
174
+ (r'=', Operator),
175
+ (r'\(', Punctuation, 'type_cast'),
176
+ (r',', Punctuation),
177
+ (r'<', Punctuation),
178
+ (r'>', Punctuation),
179
+ (r';', Punctuation),
180
+ ],
181
+ }
182
+
183
+
184
+ class CadlLexer(AtomsLexer):
185
+ """
186
+ Lexer for cADL syntax.
187
+ """
188
+ name = 'cADL'
189
+ aliases = ['cadl']
190
+ filenames = ['*.cadl']
191
+ url = 'https://specifications.openehr.org/releases/AM/latest/ADL2.html#_cadl_constraint_adl'
192
+ version_added = '2.1'
193
+
194
+ tokens = {
195
+ 'path': [
196
+ # attribute name
197
+ (r'[a-z_]\w*', Name.Class),
198
+ (r'/', Punctuation),
199
+ (r'\[', Punctuation, 'any_code'),
200
+ (r'\s+', Punctuation, '#pop'),
201
+ ],
202
+ 'root': [
203
+ include('whitespace'),
204
+ (r'(cardinality|existence|occurrences|group|include|exclude|'
205
+ r'allow_archetype|use_archetype|use_node)\W', Keyword.Type),
206
+ (r'(and|or|not|there_exists|xor|implies|for_all)\W', Keyword.Type),
207
+ (r'(after|before|closed)\W', Keyword.Type),
208
+ (r'(not)\W', Operator),
209
+ (r'(matches|is_in)\W', Operator),
210
+ # is_in / not is_in char
211
+ ('(\u2208|\u2209)', Operator),
212
+ # there_exists / not there_exists / for_all / and / or
213
+ ('(\u2203|\u2204|\u2200|\u2227|\u2228|\u22BB|\223C)',
214
+ Operator),
215
+ # regex in slot or as string constraint
216
+ (r'(\{)(\s*)(/[^}]+/)(\s*)(\})',
217
+ bygroups(Punctuation, Whitespace, String.Regex, Whitespace, Punctuation)),
218
+ # regex in slot or as string constraint
219
+ (r'(\{)(\s*)(\^[^}]+\^)(\s*)(\})',
220
+ bygroups(Punctuation, Whitespace, String.Regex, Whitespace, Punctuation)),
221
+ (r'/', Punctuation, 'path'),
222
+ # for cardinality etc
223
+ (r'(\{)((?:\d+\.\.)?(?:\d+|\*))'
224
+ r'((?:\s*;\s*(?:ordered|unordered|unique)){,2})(\})',
225
+ bygroups(Punctuation, Number, Number, Punctuation)),
226
+ # [{ is start of a tuple value
227
+ (r'\[\{', Punctuation),
228
+ (r'\}\]', Punctuation),
229
+ (r'\{', Punctuation),
230
+ (r'\}', Punctuation),
231
+ include('constraint_values'),
232
+ # type name
233
+ (r'[A-Z]\w+(<[A-Z]\w+([A-Za-z_<>]*)>)?', Name.Class),
234
+ # attribute name
235
+ (r'[a-z_]\w*', Name.Class),
236
+ (r'\[', Punctuation, 'any_code'),
237
+ (r'(~|//|\\\\|\+|-|/|\*|\^|!=|=|<=|>=|<|>]?)', Operator),
238
+ (r'\(', Punctuation),
239
+ (r'\)', Punctuation),
240
+ # for lists of values
241
+ (r',', Punctuation),
242
+ (r'"', String, 'string'),
243
+ # for assumed value
244
+ (r';', Punctuation),
245
+ ],
246
+ }
247
+
248
+
249
+ class AdlLexer(AtomsLexer):
250
+ """
251
+ Lexer for ADL syntax.
252
+ """
253
+
254
+ name = 'ADL'
255
+ aliases = ['adl']
256
+ filenames = ['*.adl', '*.adls', '*.adlf', '*.adlx']
257
+ url = 'https://specifications.openehr.org/releases/AM/latest/ADL2.html'
258
+ version_added = '2.1'
259
+
260
+ tokens = {
261
+ 'whitespace': [
262
+ # blank line ends
263
+ (r'\s*\n', Whitespace),
264
+ # comment-only line
265
+ (r'^([ \t]*)(--.*)$', bygroups(Whitespace, Comment)),
266
+ ],
267
+ 'odin_section': [
268
+ # repeating the following two rules from the root state enable multi-line
269
+ # strings that start in the first column to be dealt with
270
+ (r'^(language|description|ontology|terminology|annotations|'
271
+ r'component_terminologies|revision_history)([ \t]*\n)',
272
+ bygroups(Generic.Heading, Whitespace)),
273
+ (r'^(definition)([ \t]*\n)', bygroups(Generic.Heading, Whitespace), 'cadl_section'),
274
+ (r'^([ \t]*|[ \t]+.*)\n', using(OdinLexer)),
275
+ (r'^([^"]*")(>[ \t]*\n)', bygroups(String, Punctuation)),
276
+ # template overlay delimiter
277
+ (r'^----------*\n', Text, '#pop'),
278
+ (r'^.*\n', String),
279
+ default('#pop'),
280
+ ],
281
+ 'cadl_section': [
282
+ (r'^([ \t]*|[ \t]+.*)\n', using(CadlLexer)),
283
+ default('#pop'),
284
+ ],
285
+ 'rules_section': [
286
+ (r'^[ \t]+.*\n', using(CadlLexer)),
287
+ default('#pop'),
288
+ ],
289
+ 'metadata': [
290
+ (r'\)', Punctuation, '#pop'),
291
+ (r';', Punctuation),
292
+ (r'([Tt]rue|[Ff]alse)', Literal),
293
+ # numbers and version ids
294
+ (r'\d+(\.\d+)*', Literal),
295
+ # Guids
296
+ (r'[0-9a-fA-F]{1,36}(-[0-9a-fA-F]{1,36}){3,}', Literal),
297
+ (r'\w+', Name.Class),
298
+ (r'"', String, 'string'),
299
+ (r'=', Operator),
300
+ (r'[ \t]+', Whitespace),
301
+ default('#pop'),
302
+ ],
303
+ 'root': [
304
+ (r'^(archetype|template_overlay|operational_template|template|'
305
+ r'speciali[sz]e)', Generic.Heading),
306
+ (r'^(language|description|ontology|terminology|annotations|'
307
+ r'component_terminologies|revision_history)[ \t]*\n',
308
+ Generic.Heading, 'odin_section'),
309
+ (r'^(definition)[ \t]*\n', Generic.Heading, 'cadl_section'),
310
+ (r'^(rules)[ \t]*\n', Generic.Heading, 'rules_section'),
311
+ include('archetype_id'),
312
+ (r'([ \t]*)(\()', bygroups(Whitespace, Punctuation), 'metadata'),
313
+ include('whitespace'),
314
+ ],
315
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/arrow.py ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.arrow
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Arrow.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, default, include
12
+ from pygments.token import Text, Operator, Keyword, Punctuation, Name, \
13
+ String, Number, Whitespace
14
+
15
+ __all__ = ['ArrowLexer']
16
+
17
+ TYPES = r'\b(int|bool|char)((?:\[\])*)(?=\s+)'
18
+ IDENT = r'([a-zA-Z_][a-zA-Z0-9_]*)'
19
+ DECL = TYPES + r'(\s+)' + IDENT
20
+
21
+
22
+ class ArrowLexer(RegexLexer):
23
+ """
24
+ Lexer for Arrow
25
+ """
26
+
27
+ name = 'Arrow'
28
+ url = 'https://pypi.org/project/py-arrow-lang/'
29
+ aliases = ['arrow']
30
+ filenames = ['*.arw']
31
+ version_added = '2.7'
32
+
33
+ tokens = {
34
+ 'root': [
35
+ (r'\s+', Whitespace),
36
+ (r'^[|\s]+', Punctuation),
37
+ include('blocks'),
38
+ include('statements'),
39
+ include('expressions'),
40
+ ],
41
+ 'blocks': [
42
+ (r'(function)(\n+)(/-->)(\s*)' +
43
+ DECL + # 4 groups
44
+ r'(\()', bygroups(
45
+ Keyword.Reserved, Whitespace, Punctuation,
46
+ Whitespace, Keyword.Type, Punctuation, Whitespace,
47
+ Name.Function, Punctuation
48
+ ), 'fparams'),
49
+ (r'/-->$|\\-->$|/--<|\\--<|\^', Punctuation),
50
+ ],
51
+ 'statements': [
52
+ (DECL, bygroups(Keyword.Type, Punctuation, Text, Name.Variable)),
53
+ (r'\[', Punctuation, 'index'),
54
+ (r'=', Operator),
55
+ (r'require|main', Keyword.Reserved),
56
+ (r'print', Keyword.Reserved, 'print'),
57
+ ],
58
+ 'expressions': [
59
+ (r'\s+', Whitespace),
60
+ (r'[0-9]+', Number.Integer),
61
+ (r'true|false', Keyword.Constant),
62
+ (r"'", String.Char, 'char'),
63
+ (r'"', String.Double, 'string'),
64
+ (r'\{', Punctuation, 'array'),
65
+ (r'==|!=|<|>|\+|-|\*|/|%', Operator),
66
+ (r'and|or|not|length', Operator.Word),
67
+ (r'(input)(\s+)(int|char\[\])', bygroups(
68
+ Keyword.Reserved, Whitespace, Keyword.Type
69
+ )),
70
+ (IDENT + r'(\()', bygroups(
71
+ Name.Function, Punctuation
72
+ ), 'fargs'),
73
+ (IDENT, Name.Variable),
74
+ (r'\[', Punctuation, 'index'),
75
+ (r'\(', Punctuation, 'expressions'),
76
+ (r'\)', Punctuation, '#pop'),
77
+ ],
78
+ 'print': [
79
+ include('expressions'),
80
+ (r',', Punctuation),
81
+ default('#pop'),
82
+ ],
83
+ 'fparams': [
84
+ (DECL, bygroups(Keyword.Type, Punctuation, Whitespace, Name.Variable)),
85
+ (r',', Punctuation),
86
+ (r'\)', Punctuation, '#pop'),
87
+ ],
88
+ 'escape': [
89
+ (r'\\(["\\/abfnrtv]|[0-9]{1,3}|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4})',
90
+ String.Escape),
91
+ ],
92
+ 'char': [
93
+ (r"'", String.Char, '#pop'),
94
+ include('escape'),
95
+ (r"[^'\\]", String.Char),
96
+ ],
97
+ 'string': [
98
+ (r'"', String.Double, '#pop'),
99
+ include('escape'),
100
+ (r'[^"\\]+', String.Double),
101
+ ],
102
+ 'array': [
103
+ include('expressions'),
104
+ (r'\}', Punctuation, '#pop'),
105
+ (r',', Punctuation),
106
+ ],
107
+ 'fargs': [
108
+ include('expressions'),
109
+ (r'\)', Punctuation, '#pop'),
110
+ (r',', Punctuation),
111
+ ],
112
+ 'index': [
113
+ include('expressions'),
114
+ (r'\]', Punctuation, '#pop'),
115
+ ],
116
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/arturo.py ADDED
@@ -0,0 +1,249 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.arturo
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Arturo language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, do_insertions, include, \
12
+ this, using, words
13
+ from pygments.token import Comment, Error, Keyword, Name, Number, Operator, \
14
+ Punctuation, String, Text
15
+
16
+ from pygments.util import ClassNotFound, get_bool_opt
17
+
18
+ __all__ = ['ArturoLexer']
19
+
20
+
21
+ class ArturoLexer(RegexLexer):
22
+ """
23
+ For Arturo source code.
24
+
25
+ See `Arturo's Github <https://github.com/arturo-lang/arturo>`_
26
+ and `Arturo's Website <https://arturo-lang.io/>`_.
27
+ """
28
+
29
+ name = 'Arturo'
30
+ aliases = ['arturo', 'art']
31
+ filenames = ['*.art']
32
+ url = 'https://arturo-lang.io/'
33
+ version_added = '2.14'
34
+
35
+ def __init__(self, **options):
36
+ self.handle_annotateds = get_bool_opt(options, 'handle_annotateds',
37
+ True)
38
+ RegexLexer.__init__(self, **options)
39
+
40
+ def handle_annotated_strings(self, match):
41
+ """Adds syntax from another languages inside annotated strings
42
+
43
+ match args:
44
+ 1:open_string,
45
+ 2:exclamation_mark,
46
+ 3:lang_name,
47
+ 4:space_or_newline,
48
+ 5:code,
49
+ 6:close_string
50
+ """
51
+ from pygments.lexers import get_lexer_by_name
52
+
53
+ # Header's section
54
+ yield match.start(1), String.Double, match.group(1)
55
+ yield match.start(2), String.Interpol, match.group(2)
56
+ yield match.start(3), String.Interpol, match.group(3)
57
+ yield match.start(4), Text.Whitespace, match.group(4)
58
+
59
+ lexer = None
60
+ if self.handle_annotateds:
61
+ try:
62
+ lexer = get_lexer_by_name(match.group(3).strip())
63
+ except ClassNotFound:
64
+ pass
65
+ code = match.group(5)
66
+
67
+ if lexer is None:
68
+ yield match.group(5), String, code
69
+ else:
70
+ yield from do_insertions([], lexer.get_tokens_unprocessed(code))
71
+
72
+ yield match.start(6), String.Double, match.group(6)
73
+
74
+ tokens = {
75
+ 'root': [
76
+ (r';.*?$', Comment.Single),
77
+ (r'^((\s#!)|(#!)).*?$', Comment.Hashbang),
78
+
79
+ # Constants
80
+ (words(('false', 'true', 'maybe'), # boolean
81
+ suffix=r'\b'), Name.Constant),
82
+ (words(('this', 'init'), # class related keywords
83
+ prefix=r'\b', suffix=r'\b\??:?'), Name.Builtin.Pseudo),
84
+ (r'`.`', String.Char), # character
85
+ (r'\\\w+\b\??:?', Name.Property), # array index
86
+ (r'#\w+', Name.Constant), # color
87
+ (r'\b[0-9]+\.[0-9]+', Number.Float), # float
88
+ (r'\b[0-9]+', Number.Integer), # integer
89
+ (r'\w+\b\??:', Name.Label), # label
90
+ # Note: Literals can be labeled too
91
+ (r'\'(?:\w+\b\??:?)', Keyword.Declaration), # literal
92
+ (r'\:\w+', Keyword.Type), # type
93
+ # Note: Attributes can be labeled too
94
+ (r'\.\w+\??:?', Name.Attribute), # attributes
95
+
96
+ # Switch structure
97
+ (r'(\()(.*?)(\)\?)',
98
+ bygroups(Punctuation, using(this), Punctuation)),
99
+
100
+ # Single Line Strings
101
+ (r'"', String.Double, 'inside-simple-string'),
102
+ (r'»', String.Single, 'inside-smart-string'),
103
+ (r'«««', String.Double, 'inside-safe-string'),
104
+ (r'\{\/', String.Single, 'inside-regex-string'),
105
+
106
+ # Multi Line Strings
107
+ (r'\{\:', String.Double, 'inside-curly-verb-string'),
108
+ (r'(\{)(\!)(\w+)(\s|\n)([\w\W]*?)(^\})', handle_annotated_strings),
109
+ (r'\{', String.Single, 'inside-curly-string'),
110
+ (r'\-{3,}', String.Single, 'inside-eof-string'),
111
+
112
+ include('builtin-functions'),
113
+
114
+ # Operators
115
+ (r'[()[\],]', Punctuation),
116
+ (words(('->', '==>', '|', '::', '@', '#', # sugar syntax
117
+ '$', '&', '!', '!!', './')), Name.Decorator),
118
+ (words(('<:', ':>', ':<', '>:', '<\\', '<>', '<', '>',
119
+ 'ø', '∞',
120
+ '+', '-', '*', '~', '=', '^', '%', '/', '//',
121
+ '==>', '<=>', '<==>',
122
+ '=>>', '<<=>>', '<<==>>',
123
+ '-->', '<->', '<-->',
124
+ '=|', '|=', '-:', ':-',
125
+ '_', '.', '..', '\\')), Operator),
126
+
127
+ (r'\b\w+', Name),
128
+ (r'\s+', Text.Whitespace),
129
+ (r'.+$', Error),
130
+ ],
131
+
132
+ 'inside-interpol': [
133
+ (r'\|', String.Interpol, '#pop'),
134
+ (r'[^|]+', using(this)),
135
+ ],
136
+ 'inside-template': [
137
+ (r'\|\|\>', String.Interpol, '#pop'),
138
+ (r'[^|]+', using(this)),
139
+ ],
140
+ 'string-escape': [
141
+ (words(('\\\\', '\\n', '\\t', '\\"')), String.Escape),
142
+ ],
143
+
144
+ 'inside-simple-string': [
145
+ include('string-escape'),
146
+ (r'\|', String.Interpol, 'inside-interpol'), # Interpolation
147
+ (r'\<\|\|', String.Interpol, 'inside-template'), # Templates
148
+ (r'"', String.Double, '#pop'), # Closing Quote
149
+ (r'[^|"]+', String) # String Content
150
+ ],
151
+ 'inside-smart-string': [
152
+ include('string-escape'),
153
+ (r'\|', String.Interpol, 'inside-interpol'), # Interpolation
154
+ (r'\<\|\|', String.Interpol, 'inside-template'), # Templates
155
+ (r'\n', String.Single, '#pop'), # Closing Quote
156
+ (r'[^|\n]+', String) # String Content
157
+ ],
158
+ 'inside-safe-string': [
159
+ include('string-escape'),
160
+ (r'\|', String.Interpol, 'inside-interpol'), # Interpolation
161
+ (r'\<\|\|', String.Interpol, 'inside-template'), # Templates
162
+ (r'»»»', String.Double, '#pop'), # Closing Quote
163
+ (r'[^|»]+', String) # String Content
164
+ ],
165
+ 'inside-regex-string': [
166
+ (r'\\[sSwWdDbBZApPxucItnvfr0]+', String.Escape),
167
+ (r'\|', String.Interpol, 'inside-interpol'), # Interpolation
168
+ (r'\<\|\|', String.Interpol, 'inside-template'), # Templates
169
+ (r'\/\}', String.Single, '#pop'), # Closing Quote
170
+ (r'[^|\/]+', String.Regex), # String Content
171
+ ],
172
+ 'inside-curly-verb-string': [
173
+ include('string-escape'),
174
+ (r'\|', String.Interpol, 'inside-interpol'), # Interpolation
175
+ (r'\<\|\|', String.Interpol, 'inside-template'), # Templates
176
+ (r'\:\}', String.Double, '#pop'), # Closing Quote
177
+ (r'[^|<:]+', String), # String Content
178
+ ],
179
+ 'inside-curly-string': [
180
+ include('string-escape'),
181
+ (r'\|', String.Interpol, 'inside-interpol'), # Interpolation
182
+ (r'\<\|\|', String.Interpol, 'inside-template'), # Templates
183
+ (r'\}', String.Single, '#pop'), # Closing Quote
184
+ (r'[^|<}]+', String), # String Content
185
+ ],
186
+ 'inside-eof-string': [
187
+ include('string-escape'),
188
+ (r'\|', String.Interpol, 'inside-interpol'), # Interpolation
189
+ (r'\<\|\|', String.Interpol, 'inside-template'), # Templates
190
+ (r'\Z', String.Single, '#pop'), # Closing Quote
191
+ (r'[^|<]+', String), # String Content
192
+ ],
193
+
194
+ 'builtin-functions': [
195
+ (words((
196
+ 'all', 'and', 'any', 'ascii', 'attr', 'attribute',
197
+ 'attributeLabel', 'binary', 'block' 'char', 'contains',
198
+ 'database', 'date', 'dictionary', 'empty', 'equal', 'even',
199
+ 'every', 'exists', 'false', 'floatin', 'function', 'greater',
200
+ 'greaterOrEqual', 'if', 'in', 'inline', 'integer', 'is',
201
+ 'key', 'label', 'leap', 'less', 'lessOrEqual', 'literal',
202
+ 'logical', 'lower', 'nand', 'negative', 'nor', 'not',
203
+ 'notEqual', 'null', 'numeric', 'odd', 'or', 'path',
204
+ 'pathLabel', 'positive', 'prefix', 'prime', 'set', 'some',
205
+ 'sorted', 'standalone', 'string', 'subset', 'suffix',
206
+ 'superset', 'ymbol', 'true', 'try', 'type', 'unless', 'upper',
207
+ 'when', 'whitespace', 'word', 'xnor', 'xor', 'zero',
208
+ ), prefix=r'\b', suffix=r'\b\?'), Name.Builtin),
209
+ (words((
210
+ 'abs', 'acos', 'acosh', 'acsec', 'acsech', 'actan', 'actanh',
211
+ 'add', 'after', 'alphabet', 'and', 'angle', 'append', 'arg',
212
+ 'args', 'arity', 'array', 'as', 'asec', 'asech', 'asin',
213
+ 'asinh', 'atan', 'atan2', 'atanh', 'attr', 'attrs', 'average',
214
+ 'before', 'benchmark', 'blend', 'break', 'builtins1',
215
+ 'builtins2', 'call', 'capitalize', 'case', 'ceil', 'chop',
216
+ 'chunk', 'clear', 'close', 'cluster', 'color', 'combine',
217
+ 'conj', 'continue', 'copy', 'cos', 'cosh', 'couple', 'csec',
218
+ 'csech', 'ctan', 'ctanh', 'cursor', 'darken', 'dec', 'decode',
219
+ 'decouple', 'define', 'delete', 'desaturate', 'deviation',
220
+ 'dictionary', 'difference', 'digest', 'digits', 'div', 'do',
221
+ 'download', 'drop', 'dup', 'e', 'else', 'empty', 'encode',
222
+ 'ensure', 'env', 'epsilon', 'escape', 'execute', 'exit', 'exp',
223
+ 'extend', 'extract', 'factors', 'false', 'fdiv', 'filter',
224
+ 'first', 'flatten', 'floor', 'fold', 'from', 'function',
225
+ 'gamma', 'gcd', 'get', 'goto', 'hash', 'help', 'hypot', 'if',
226
+ 'in', 'inc', 'indent', 'index', 'infinity', 'info', 'input',
227
+ 'insert', 'inspect', 'intersection', 'invert', 'join', 'keys',
228
+ 'kurtosis', 'last', 'let', 'levenshtein', 'lighten', 'list',
229
+ 'ln', 'log', 'loop', 'lower', 'mail', 'map', 'match', 'max',
230
+ 'maybe', 'median', 'min', 'mod', 'module', 'mul', 'nand',
231
+ 'neg', 'new', 'nor', 'normalize', 'not', 'now', 'null', 'open',
232
+ 'or', 'outdent', 'pad', 'panic', 'path', 'pause',
233
+ 'permissions', 'permutate', 'pi', 'pop', 'pow', 'powerset',
234
+ 'powmod', 'prefix', 'print', 'prints', 'process', 'product',
235
+ 'query', 'random', 'range', 'read', 'relative', 'remove',
236
+ 'rename', 'render', 'repeat', 'replace', 'request', 'return',
237
+ 'reverse', 'round', 'sample', 'saturate', 'script', 'sec',
238
+ 'sech', 'select', 'serve', 'set', 'shl', 'shr', 'shuffle',
239
+ 'sin', 'sinh', 'size', 'skewness', 'slice', 'sort', 'split',
240
+ 'sqrt', 'squeeze', 'stack', 'strip', 'sub', 'suffix', 'sum',
241
+ 'switch', 'symbols', 'symlink', 'sys', 'take', 'tan', 'tanh',
242
+ 'terminal', 'to', 'true', 'truncate', 'try', 'type', 'union',
243
+ 'unique', 'unless', 'until', 'unzip', 'upper', 'values', 'var',
244
+ 'variance', 'volume', 'webview', 'while', 'with', 'wordwrap',
245
+ 'write', 'xnor', 'xor', 'zip'
246
+ ), prefix=r'\b', suffix=r'\b'), Name.Builtin)
247
+ ],
248
+
249
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/asc.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.asc
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for various ASCII armored files.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+ import re
11
+
12
+ from pygments.lexer import RegexLexer, bygroups
13
+ from pygments.token import Comment, Generic, Name, Operator, String, Whitespace
14
+
15
+ __all__ = ['AscLexer']
16
+
17
+
18
+ class AscLexer(RegexLexer):
19
+ """
20
+ Lexer for ASCII armored files, containing `-----BEGIN/END ...-----` wrapped
21
+ base64 data.
22
+ """
23
+ name = 'ASCII armored'
24
+ aliases = ['asc', 'pem']
25
+ filenames = [
26
+ '*.asc', # PGP; *.gpg, *.pgp, and *.sig too, but those can be binary
27
+ '*.pem', # X.509; *.cer, *.crt, *.csr, and key etc too, but those can be binary
28
+ 'id_dsa', 'id_ecdsa', 'id_ecdsa_sk', 'id_ed25519', 'id_ed25519_sk',
29
+ 'id_rsa', # SSH private keys
30
+ ]
31
+ mimetypes = ['application/pgp-keys', 'application/pgp-encrypted',
32
+ 'application/pgp-signature', 'application/pem-certificate-chain']
33
+ url = 'https://www.openpgp.org'
34
+ version_added = '2.10'
35
+
36
+ flags = re.MULTILINE
37
+
38
+ tokens = {
39
+ 'root': [
40
+ (r'\s+', Whitespace),
41
+ (r'^-----BEGIN [^\n]+-----$', Generic.Heading, 'data'),
42
+ (r'\S+', Comment),
43
+ ],
44
+ 'data': [
45
+ (r'\s+', Whitespace),
46
+ (r'^([^:]+)(:)([ \t]+)(.*)',
47
+ bygroups(Name.Attribute, Operator, Whitespace, String)),
48
+ (r'^-----END [^\n]+-----$', Generic.Heading, 'root'),
49
+ (r'\S+', String),
50
+ ],
51
+ }
52
+
53
+ def analyse_text(text):
54
+ if re.search(r'^-----BEGIN [^\n]+-----\r?\n', text):
55
+ return True
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/asm.py ADDED
@@ -0,0 +1,1058 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.asm
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for assembly languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups, using, words, \
14
+ DelegatingLexer, default
15
+ from pygments.lexers.c_cpp import CppLexer, CLexer
16
+ from pygments.lexers.d import DLexer
17
+ from pygments.token import Text, Name, Number, String, Comment, Punctuation, \
18
+ Other, Keyword, Operator, Whitespace
19
+
20
+ __all__ = ['GasLexer', 'ObjdumpLexer', 'DObjdumpLexer', 'CppObjdumpLexer',
21
+ 'CObjdumpLexer', 'HsailLexer', 'LlvmLexer', 'LlvmMirBodyLexer',
22
+ 'LlvmMirLexer', 'NasmLexer', 'NasmObjdumpLexer', 'TasmLexer',
23
+ 'Ca65Lexer', 'Dasm16Lexer']
24
+
25
+
26
+ class GasLexer(RegexLexer):
27
+ """
28
+ For Gas (AT&T) assembly code.
29
+ """
30
+ name = 'GAS'
31
+ aliases = ['gas', 'asm']
32
+ filenames = ['*.s', '*.S']
33
+ mimetypes = ['text/x-gas']
34
+ url = 'https://www.gnu.org/software/binutils'
35
+ version_added = ''
36
+
37
+ #: optional Comment or Whitespace
38
+ string = r'"(\\"|[^"])*"'
39
+ char = r'[\w$.@-]'
40
+ identifier = r'(?:[a-zA-Z$_]' + char + r'*|\.' + char + '+)'
41
+ number = r'(?:0[xX][a-fA-F0-9]+|#?-?\d+)'
42
+ register = '%' + identifier + r'\b'
43
+
44
+ tokens = {
45
+ 'root': [
46
+ include('whitespace'),
47
+ (identifier + ':', Name.Label),
48
+ (r'\.' + identifier, Name.Attribute, 'directive-args'),
49
+ (r'lock|rep(n?z)?|data\d+', Name.Attribute),
50
+ (identifier, Name.Function, 'instruction-args'),
51
+ (r'[\r\n]+', Text)
52
+ ],
53
+ 'directive-args': [
54
+ (identifier, Name.Constant),
55
+ (string, String),
56
+ ('@' + identifier, Name.Attribute),
57
+ (number, Number.Integer),
58
+ (register, Name.Variable),
59
+ (r'[\r\n]+', Whitespace, '#pop'),
60
+ (r'([;#]|//).*?\n', Comment.Single, '#pop'),
61
+ (r'/[*].*?[*]/', Comment.Multiline),
62
+ (r'/[*].*?\n[\w\W]*?[*]/', Comment.Multiline, '#pop'),
63
+
64
+ include('punctuation'),
65
+ include('whitespace')
66
+ ],
67
+ 'instruction-args': [
68
+ # For objdump-disassembled code, shouldn't occur in
69
+ # actual assembler input
70
+ ('([a-z0-9]+)( )(<)('+identifier+')(>)',
71
+ bygroups(Number.Hex, Text, Punctuation, Name.Constant,
72
+ Punctuation)),
73
+ ('([a-z0-9]+)( )(<)('+identifier+')([-+])('+number+')(>)',
74
+ bygroups(Number.Hex, Text, Punctuation, Name.Constant,
75
+ Punctuation, Number.Integer, Punctuation)),
76
+
77
+ # Address constants
78
+ (identifier, Name.Constant),
79
+ (number, Number.Integer),
80
+ # Registers
81
+ (register, Name.Variable),
82
+ # Numeric constants
83
+ ('$'+number, Number.Integer),
84
+ (r"$'(.|\\')'", String.Char),
85
+ (r'[\r\n]+', Whitespace, '#pop'),
86
+ (r'([;#]|//).*?\n', Comment.Single, '#pop'),
87
+ (r'/[*].*?[*]/', Comment.Multiline),
88
+ (r'/[*].*?\n[\w\W]*?[*]/', Comment.Multiline, '#pop'),
89
+
90
+ include('punctuation'),
91
+ include('whitespace')
92
+ ],
93
+ 'whitespace': [
94
+ (r'\n', Whitespace),
95
+ (r'\s+', Whitespace),
96
+ (r'([;#]|//).*?\n', Comment.Single),
97
+ (r'/[*][\w\W]*?[*]/', Comment.Multiline)
98
+ ],
99
+ 'punctuation': [
100
+ (r'[-*,.()\[\]!:{}]+', Punctuation)
101
+ ]
102
+ }
103
+
104
+ def analyse_text(text):
105
+ if re.search(r'^\.(text|data|section)', text, re.M):
106
+ return True
107
+ elif re.search(r'^\.\w+', text, re.M):
108
+ return 0.1
109
+
110
+
111
+ def _objdump_lexer_tokens(asm_lexer):
112
+ """
113
+ Common objdump lexer tokens to wrap an ASM lexer.
114
+ """
115
+ hex_re = r'[0-9A-Za-z]'
116
+ return {
117
+ 'root': [
118
+ # File name & format:
119
+ ('(.*?)(:)( +file format )(.*?)$',
120
+ bygroups(Name.Label, Punctuation, Text, String)),
121
+ # Section header
122
+ ('(Disassembly of section )(.*?)(:)$',
123
+ bygroups(Text, Name.Label, Punctuation)),
124
+ # Function labels
125
+ # (With offset)
126
+ ('('+hex_re+'+)( )(<)(.*?)([-+])(0[xX][A-Za-z0-9]+)(>:)$',
127
+ bygroups(Number.Hex, Whitespace, Punctuation, Name.Function,
128
+ Punctuation, Number.Hex, Punctuation)),
129
+ # (Without offset)
130
+ ('('+hex_re+'+)( )(<)(.*?)(>:)$',
131
+ bygroups(Number.Hex, Whitespace, Punctuation, Name.Function,
132
+ Punctuation)),
133
+ # Code line with disassembled instructions
134
+ ('( *)('+hex_re+r'+:)(\t)((?:'+hex_re+hex_re+' )+)( *\t)([a-zA-Z].*?)$',
135
+ bygroups(Whitespace, Name.Label, Whitespace, Number.Hex, Whitespace,
136
+ using(asm_lexer))),
137
+ # Code line without raw instructions (objdump --no-show-raw-insn)
138
+ ('( *)('+hex_re+r'+:)( *\t)([a-zA-Z].*?)$',
139
+ bygroups(Whitespace, Name.Label, Whitespace,
140
+ using(asm_lexer))),
141
+ # Code line with ascii
142
+ ('( *)('+hex_re+r'+:)(\t)((?:'+hex_re+hex_re+' )+)( *)(.*?)$',
143
+ bygroups(Whitespace, Name.Label, Whitespace, Number.Hex, Whitespace, String)),
144
+ # Continued code line, only raw opcodes without disassembled
145
+ # instruction
146
+ ('( *)('+hex_re+r'+:)(\t)((?:'+hex_re+hex_re+' )+)$',
147
+ bygroups(Whitespace, Name.Label, Whitespace, Number.Hex)),
148
+ # Skipped a few bytes
149
+ (r'\t\.\.\.$', Text),
150
+ # Relocation line
151
+ # (With offset)
152
+ (r'(\t\t\t)('+hex_re+r'+:)( )([^\t]+)(\t)(.*?)([-+])(0x'+hex_re+'+)$',
153
+ bygroups(Whitespace, Name.Label, Whitespace, Name.Property, Whitespace,
154
+ Name.Constant, Punctuation, Number.Hex)),
155
+ # (Without offset)
156
+ (r'(\t\t\t)('+hex_re+r'+:)( )([^\t]+)(\t)(.*?)$',
157
+ bygroups(Whitespace, Name.Label, Whitespace, Name.Property, Whitespace,
158
+ Name.Constant)),
159
+ (r'[^\n]+\n', Other)
160
+ ]
161
+ }
162
+
163
+
164
+ class ObjdumpLexer(RegexLexer):
165
+ """
166
+ For the output of ``objdump -dr``.
167
+ """
168
+ name = 'objdump'
169
+ aliases = ['objdump']
170
+ filenames = ['*.objdump']
171
+ mimetypes = ['text/x-objdump']
172
+ url = 'https://www.gnu.org/software/binutils'
173
+ version_added = ''
174
+
175
+ tokens = _objdump_lexer_tokens(GasLexer)
176
+
177
+
178
+ class DObjdumpLexer(DelegatingLexer):
179
+ """
180
+ For the output of ``objdump -Sr`` on compiled D files.
181
+ """
182
+ name = 'd-objdump'
183
+ aliases = ['d-objdump']
184
+ filenames = ['*.d-objdump']
185
+ mimetypes = ['text/x-d-objdump']
186
+ url = 'https://www.gnu.org/software/binutils'
187
+ version_added = ''
188
+
189
+ def __init__(self, **options):
190
+ super().__init__(DLexer, ObjdumpLexer, **options)
191
+
192
+
193
+ class CppObjdumpLexer(DelegatingLexer):
194
+ """
195
+ For the output of ``objdump -Sr`` on compiled C++ files.
196
+ """
197
+ name = 'cpp-objdump'
198
+ aliases = ['cpp-objdump', 'c++-objdumb', 'cxx-objdump']
199
+ filenames = ['*.cpp-objdump', '*.c++-objdump', '*.cxx-objdump']
200
+ mimetypes = ['text/x-cpp-objdump']
201
+ url = 'https://www.gnu.org/software/binutils'
202
+ version_added = ''
203
+
204
+ def __init__(self, **options):
205
+ super().__init__(CppLexer, ObjdumpLexer, **options)
206
+
207
+
208
+ class CObjdumpLexer(DelegatingLexer):
209
+ """
210
+ For the output of ``objdump -Sr`` on compiled C files.
211
+ """
212
+ name = 'c-objdump'
213
+ aliases = ['c-objdump']
214
+ filenames = ['*.c-objdump']
215
+ mimetypes = ['text/x-c-objdump']
216
+ url = 'https://www.gnu.org/software/binutils'
217
+ version_added = ''
218
+
219
+
220
+ def __init__(self, **options):
221
+ super().__init__(CLexer, ObjdumpLexer, **options)
222
+
223
+
224
+ class HsailLexer(RegexLexer):
225
+ """
226
+ For HSAIL assembly code.
227
+ """
228
+ name = 'HSAIL'
229
+ aliases = ['hsail', 'hsa']
230
+ filenames = ['*.hsail']
231
+ mimetypes = ['text/x-hsail']
232
+ url = 'https://en.wikipedia.org/wiki/Heterogeneous_System_Architecture#HSA_Intermediate_Layer'
233
+ version_added = '2.2'
234
+
235
+ string = r'"[^"]*?"'
236
+ identifier = r'[a-zA-Z_][\w.]*'
237
+ # Registers
238
+ register_number = r'[0-9]+'
239
+ register = r'(\$(c|s|d|q)' + register_number + r')\b'
240
+ # Qualifiers
241
+ alignQual = r'(align\(\d+\))'
242
+ widthQual = r'(width\((\d+|all)\))'
243
+ allocQual = r'(alloc\(agent\))'
244
+ # Instruction Modifiers
245
+ roundingMod = (r'((_ftz)?(_up|_down|_zero|_near))')
246
+ datatypeMod = (r'_('
247
+ # packedTypes
248
+ r'u8x4|s8x4|u16x2|s16x2|u8x8|s8x8|u16x4|s16x4|u32x2|s32x2|'
249
+ r'u8x16|s8x16|u16x8|s16x8|u32x4|s32x4|u64x2|s64x2|'
250
+ r'f16x2|f16x4|f16x8|f32x2|f32x4|f64x2|'
251
+ # baseTypes
252
+ r'u8|s8|u16|s16|u32|s32|u64|s64|'
253
+ r'b128|b8|b16|b32|b64|b1|'
254
+ r'f16|f32|f64|'
255
+ # opaqueType
256
+ r'roimg|woimg|rwimg|samp|sig32|sig64)')
257
+
258
+ # Numeric Constant
259
+ float = r'((\d+\.)|(\d*\.\d+))[eE][+-]?\d+'
260
+ hexfloat = r'0[xX](([0-9a-fA-F]+\.[0-9a-fA-F]*)|([0-9a-fA-F]*\.[0-9a-fA-F]+))[pP][+-]?\d+'
261
+ ieeefloat = r'0(?:[hH][0-9a-fA-F]{4}|[fF][0-9a-fA-F]{8}|[dD][0-9a-fA-F]{16})'
262
+
263
+ tokens = {
264
+ 'root': [
265
+ include('whitespace'),
266
+ include('comments'),
267
+
268
+ (string, String),
269
+
270
+ (r'@' + identifier + ':?', Name.Label),
271
+
272
+ (register, Name.Variable.Anonymous),
273
+
274
+ include('keyword'),
275
+
276
+ (r'&' + identifier, Name.Variable.Global),
277
+ (r'%' + identifier, Name.Variable),
278
+
279
+ (hexfloat, Number.Hex),
280
+ (r'0[xX][a-fA-F0-9]+', Number.Hex),
281
+ (ieeefloat, Number.Float),
282
+ (float, Number.Float),
283
+ (r'\d+', Number.Integer),
284
+
285
+ (r'[=<>{}\[\]()*.,:;!]|x\b', Punctuation)
286
+ ],
287
+ 'whitespace': [
288
+ (r'\s+', Whitespace),
289
+ ],
290
+ 'comments': [
291
+ (r'/\*.*?\*/', Comment.Multiline),
292
+ (r'//.*?\n', Comment.Single),
293
+ ],
294
+ 'keyword': [
295
+ # Types
296
+ (r'kernarg' + datatypeMod, Keyword.Type),
297
+
298
+ # Regular keywords
299
+ (r'\$(full|base|small|large|default|zero|near)', Keyword),
300
+ (words((
301
+ 'module', 'extension', 'pragma', 'prog', 'indirect', 'signature',
302
+ 'decl', 'kernel', 'function', 'enablebreakexceptions',
303
+ 'enabledetectexceptions', 'maxdynamicgroupsize', 'maxflatgridsize',
304
+ 'maxflatworkgroupsize', 'requireddim', 'requiredgridsize',
305
+ 'requiredworkgroupsize', 'requirenopartialworkgroups'),
306
+ suffix=r'\b'), Keyword),
307
+
308
+ # instructions
309
+ (roundingMod, Keyword),
310
+ (datatypeMod, Keyword),
311
+ (r'_(' + alignQual + '|' + widthQual + ')', Keyword),
312
+ (r'_kernarg', Keyword),
313
+ (r'(nop|imagefence)\b', Keyword),
314
+ (words((
315
+ 'cleardetectexcept', 'clock', 'cuid', 'debugtrap', 'dim',
316
+ 'getdetectexcept', 'groupbaseptr', 'kernargbaseptr', 'laneid',
317
+ 'maxcuid', 'maxwaveid', 'packetid', 'setdetectexcept', 'waveid',
318
+ 'workitemflatabsid', 'workitemflatid', 'nullptr', 'abs', 'bitrev',
319
+ 'currentworkgroupsize', 'currentworkitemflatid', 'fract', 'ncos',
320
+ 'neg', 'nexp2', 'nlog2', 'nrcp', 'nrsqrt', 'nsin', 'nsqrt',
321
+ 'gridgroups', 'gridsize', 'not', 'sqrt', 'workgroupid',
322
+ 'workgroupsize', 'workitemabsid', 'workitemid', 'ceil', 'floor',
323
+ 'rint', 'trunc', 'add', 'bitmask', 'borrow', 'carry', 'copysign',
324
+ 'div', 'rem', 'sub', 'shl', 'shr', 'and', 'or', 'xor', 'unpackhi',
325
+ 'unpacklo', 'max', 'min', 'fma', 'mad', 'bitextract', 'bitselect',
326
+ 'shuffle', 'cmov', 'bitalign', 'bytealign', 'lerp', 'nfma', 'mul',
327
+ 'mulhi', 'mul24hi', 'mul24', 'mad24', 'mad24hi', 'bitinsert',
328
+ 'combine', 'expand', 'lda', 'mov', 'pack', 'unpack', 'packcvt',
329
+ 'unpackcvt', 'sad', 'sementp', 'ftos', 'stof', 'cmp', 'ld', 'st',
330
+ '_eq', '_ne', '_lt', '_le', '_gt', '_ge', '_equ', '_neu', '_ltu',
331
+ '_leu', '_gtu', '_geu', '_num', '_nan', '_seq', '_sne', '_slt',
332
+ '_sle', '_sgt', '_sge', '_snum', '_snan', '_sequ', '_sneu', '_sltu',
333
+ '_sleu', '_sgtu', '_sgeu', 'atomic', '_ld', '_st', '_cas', '_add',
334
+ '_and', '_exch', '_max', '_min', '_or', '_sub', '_wrapdec',
335
+ '_wrapinc', '_xor', 'ret', 'cvt', '_readonly', '_kernarg', '_global',
336
+ 'br', 'cbr', 'sbr', '_scacq', '_screl', '_scar', '_rlx', '_wave',
337
+ '_wg', '_agent', '_system', 'ldimage', 'stimage', '_v2', '_v3', '_v4',
338
+ '_1d', '_2d', '_3d', '_1da', '_2da', '_1db', '_2ddepth', '_2dadepth',
339
+ '_width', '_height', '_depth', '_array', '_channelorder',
340
+ '_channeltype', 'querysampler', '_coord', '_filter', '_addressing',
341
+ 'barrier', 'wavebarrier', 'initfbar', 'joinfbar', 'waitfbar',
342
+ 'arrivefbar', 'leavefbar', 'releasefbar', 'ldf', 'activelaneid',
343
+ 'activelanecount', 'activelanemask', 'activelanepermute', 'call',
344
+ 'scall', 'icall', 'alloca', 'packetcompletionsig',
345
+ 'addqueuewriteindex', 'casqueuewriteindex', 'ldqueuereadindex',
346
+ 'stqueuereadindex', 'readonly', 'global', 'private', 'group',
347
+ 'spill', 'arg', '_upi', '_downi', '_zeroi', '_neari', '_upi_sat',
348
+ '_downi_sat', '_zeroi_sat', '_neari_sat', '_supi', '_sdowni',
349
+ '_szeroi', '_sneari', '_supi_sat', '_sdowni_sat', '_szeroi_sat',
350
+ '_sneari_sat', '_pp', '_ps', '_sp', '_ss', '_s', '_p', '_pp_sat',
351
+ '_ps_sat', '_sp_sat', '_ss_sat', '_s_sat', '_p_sat')), Keyword),
352
+
353
+ # Integer types
354
+ (r'i[1-9]\d*', Keyword)
355
+ ]
356
+ }
357
+
358
+
359
+ class LlvmLexer(RegexLexer):
360
+ """
361
+ For LLVM assembly code.
362
+ """
363
+ name = 'LLVM'
364
+ url = 'https://llvm.org/docs/LangRef.html'
365
+ aliases = ['llvm']
366
+ filenames = ['*.ll']
367
+ mimetypes = ['text/x-llvm']
368
+ version_added = ''
369
+
370
+ #: optional Comment or Whitespace
371
+ string = r'"[^"]*?"'
372
+ identifier = r'([-a-zA-Z$._][\w\-$.]*|' + string + ')'
373
+ block_label = r'(' + identifier + r'|(\d+))'
374
+
375
+ tokens = {
376
+ 'root': [
377
+ include('whitespace'),
378
+
379
+ # Before keywords, because keywords are valid label names :(...
380
+ (block_label + r'\s*:', Name.Label),
381
+
382
+ include('keyword'),
383
+
384
+ (r'%' + identifier, Name.Variable),
385
+ (r'@' + identifier, Name.Variable.Global),
386
+ (r'%\d+', Name.Variable.Anonymous),
387
+ (r'@\d+', Name.Variable.Global),
388
+ (r'#\d+', Name.Variable.Global),
389
+ (r'!' + identifier, Name.Variable),
390
+ (r'!\d+', Name.Variable.Anonymous),
391
+ (r'c?' + string, String),
392
+
393
+ (r'0[xX][KLMHR]?[a-fA-F0-9]+', Number),
394
+ (r'-?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?', Number),
395
+
396
+ (r'[=<>{}\[\]()*.,!]|x\b', Punctuation)
397
+ ],
398
+ 'whitespace': [
399
+ (r'\s+', Whitespace),
400
+ (r';.*?\n', Comment),
401
+ (r'/\*', Comment, 'c-comment'),
402
+ ],
403
+ 'c-comment': [
404
+ (r'[^*]+', Comment),
405
+ (r'\*/', Comment, '#pop'),
406
+ # Consume lone asterisks as non-comment-ending content.
407
+ (r'\*', Comment),
408
+ ],
409
+ 'keyword': [
410
+ # Regular keywords
411
+ (words((
412
+ 'aarch64_sve_vector_pcs', 'aarch64_vector_pcs', 'acq_rel',
413
+ 'acquire', 'add', 'addrspace', 'addrspacecast', 'afn', 'alias',
414
+ 'aliasee', 'align', 'alignLog2', 'alignstack', 'alloca',
415
+ 'allocsize', 'allOnes', 'alwaysinline', 'alwaysInline',
416
+ 'amdgpu_cs', 'amdgpu_es', 'amdgpu_gfx', 'amdgpu_gs',
417
+ 'amdgpu_hs', 'amdgpu_kernel', 'amdgpu_ls', 'amdgpu_ps',
418
+ 'amdgpu_vs', 'and', 'any', 'anyregcc', 'appending', 'arcp',
419
+ 'argmemonly', 'args', 'arm_aapcs_vfpcc', 'arm_aapcscc',
420
+ 'arm_apcscc', 'ashr', 'asm', 'atomic', 'atomicrmw',
421
+ 'attributes', 'available_externally', 'avr_intrcc',
422
+ 'avr_signalcc', 'bit', 'bitcast', 'bitMask', 'blockaddress',
423
+ 'blockcount', 'br', 'branchFunnel', 'builtin', 'byArg',
424
+ 'byref', 'byte', 'byteArray', 'byval', 'c', 'call', 'callbr',
425
+ 'callee', 'caller', 'calls', 'canAutoHide', 'catch',
426
+ 'catchpad', 'catchret', 'catchswitch', 'cc', 'ccc',
427
+ 'cfguard_checkcc', 'cleanup', 'cleanuppad', 'cleanupret',
428
+ 'cmpxchg', 'cold', 'coldcc', 'comdat', 'common', 'constant',
429
+ 'contract', 'convergent', 'critical', 'cxx_fast_tlscc',
430
+ 'datalayout', 'declare', 'default', 'define', 'deplibs',
431
+ 'dereferenceable', 'dereferenceable_or_null', 'distinct',
432
+ 'dllexport', 'dllimport', 'dso_local', 'dso_local_equivalent',
433
+ 'dso_preemptable', 'dsoLocal', 'eq', 'exact', 'exactmatch',
434
+ 'extern_weak', 'external', 'externally_initialized',
435
+ 'extractelement', 'extractvalue', 'fadd', 'false', 'fast',
436
+ 'fastcc', 'fcmp', 'fdiv', 'fence', 'filter', 'flags', 'fmul',
437
+ 'fneg', 'fpext', 'fptosi', 'fptoui', 'fptrunc', 'freeze',
438
+ 'frem', 'from', 'fsub', 'funcFlags', 'function', 'gc',
439
+ 'getelementptr', 'ghccc', 'global', 'guid', 'gv', 'hash',
440
+ 'hhvm_ccc', 'hhvmcc', 'hidden', 'hot', 'hotness', 'icmp',
441
+ 'ifunc', 'inaccessiblemem_or_argmemonly',
442
+ 'inaccessiblememonly', 'inalloca', 'inbounds', 'indir',
443
+ 'indirectbr', 'info', 'initialexec', 'inline', 'inlineBits',
444
+ 'inlinehint', 'inrange', 'inreg', 'insertelement',
445
+ 'insertvalue', 'insts', 'intel_ocl_bicc', 'inteldialect',
446
+ 'internal', 'inttoptr', 'invoke', 'jumptable', 'kind',
447
+ 'landingpad', 'largest', 'linkage', 'linkonce', 'linkonce_odr',
448
+ 'live', 'load', 'local_unnamed_addr', 'localdynamic',
449
+ 'localexec', 'lshr', 'max', 'metadata', 'min', 'minsize',
450
+ 'module', 'monotonic', 'msp430_intrcc', 'mul', 'mustprogress',
451
+ 'musttail', 'naked', 'name', 'nand', 'ne', 'nest', 'ninf',
452
+ 'nnan', 'noalias', 'nobuiltin', 'nocallback', 'nocapture',
453
+ 'nocf_check', 'noduplicate', 'noduplicates', 'nofree',
454
+ 'noimplicitfloat', 'noinline', 'noInline', 'nomerge', 'none',
455
+ 'nonlazybind', 'nonnull', 'noprofile', 'norecurse',
456
+ 'noRecurse', 'noredzone', 'noreturn', 'nosync', 'notail',
457
+ 'notEligibleToImport', 'noundef', 'nounwind', 'nsw',
458
+ 'nsz', 'null', 'null_pointer_is_valid', 'nuw', 'oeq', 'offset',
459
+ 'oge', 'ogt', 'ole', 'olt', 'one', 'opaque', 'optforfuzzing',
460
+ 'optnone', 'optsize', 'or', 'ord', 'param', 'params',
461
+ 'partition', 'path', 'personality', 'phi', 'poison',
462
+ 'preallocated', 'prefix', 'preserve_allcc', 'preserve_mostcc',
463
+ 'private', 'prologue', 'protected', 'ptrtoint', 'ptx_device',
464
+ 'ptx_kernel', 'readnone', 'readNone', 'readonly', 'readOnly',
465
+ 'reassoc', 'refs', 'relbf', 'release', 'resByArg', 'resume',
466
+ 'ret', 'returnDoesNotAlias', 'returned', 'returns_twice',
467
+ 'safestack', 'samesize', 'sanitize_address',
468
+ 'sanitize_hwaddress', 'sanitize_memory', 'sanitize_memtag',
469
+ 'sanitize_thread', 'sdiv', 'section', 'select', 'seq_cst',
470
+ 'sext', 'sge', 'sgt', 'shadowcallstack', 'shl',
471
+ 'shufflevector', 'sideeffect', 'signext', 'single',
472
+ 'singleImpl', 'singleImplName', 'sitofp', 'sizeM1',
473
+ 'sizeM1BitWidth', 'sle', 'slt', 'source_filename',
474
+ 'speculatable', 'speculative_load_hardening', 'spir_func',
475
+ 'spir_kernel', 'splat', 'srem', 'sret', 'ssp', 'sspreq',
476
+ 'sspstrong', 'store', 'strictfp', 'sub', 'summaries',
477
+ 'summary', 'swiftcc', 'swifterror', 'swiftself', 'switch',
478
+ 'syncscope', 'tail', 'tailcc', 'target', 'thread_local', 'to',
479
+ 'token', 'triple', 'true', 'trunc', 'type',
480
+ 'typeCheckedLoadConstVCalls', 'typeCheckedLoadVCalls',
481
+ 'typeid', 'typeidCompatibleVTable', 'typeIdInfo',
482
+ 'typeTestAssumeConstVCalls', 'typeTestAssumeVCalls',
483
+ 'typeTestRes', 'typeTests', 'udiv', 'ueq', 'uge', 'ugt',
484
+ 'uitofp', 'ule', 'ult', 'umax', 'umin', 'undef', 'une',
485
+ 'uniformRetVal', 'uniqueRetVal', 'unknown', 'unnamed_addr',
486
+ 'uno', 'unordered', 'unreachable', 'unsat', 'unwind', 'urem',
487
+ 'uselistorder', 'uselistorder_bb', 'uwtable', 'va_arg',
488
+ 'varFlags', 'variable', 'vcall_visibility', 'vFuncId',
489
+ 'virtFunc', 'virtualConstProp', 'void', 'volatile', 'vscale',
490
+ 'vTableFuncs', 'weak', 'weak_odr', 'webkit_jscc', 'win64cc',
491
+ 'within', 'wpdRes', 'wpdResolutions', 'writeonly', 'x',
492
+ 'x86_64_sysvcc', 'x86_fastcallcc', 'x86_intrcc', 'x86_mmx',
493
+ 'x86_regcallcc', 'x86_stdcallcc', 'x86_thiscallcc',
494
+ 'x86_vectorcallcc', 'xchg', 'xor', 'zeroext',
495
+ 'zeroinitializer', 'zext', 'immarg', 'willreturn'),
496
+ suffix=r'\b'), Keyword),
497
+
498
+ # Types
499
+ (words(('void', 'half', 'bfloat', 'float', 'double', 'fp128',
500
+ 'x86_fp80', 'ppc_fp128', 'label', 'metadata', 'x86_mmx',
501
+ 'x86_amx', 'token', 'ptr')),
502
+ Keyword.Type),
503
+
504
+ # Integer types
505
+ (r'i[1-9]\d*', Keyword.Type)
506
+ ]
507
+ }
508
+
509
+
510
+ class LlvmMirBodyLexer(RegexLexer):
511
+ """
512
+ For LLVM MIR examples without the YAML wrapper.
513
+ """
514
+ name = 'LLVM-MIR Body'
515
+ url = 'https://llvm.org/docs/MIRLangRef.html'
516
+ aliases = ['llvm-mir-body']
517
+ filenames = []
518
+ mimetypes = []
519
+ version_added = '2.6'
520
+
521
+ tokens = {
522
+ 'root': [
523
+ # Attributes on basic blocks
524
+ (words(('liveins', 'successors'), suffix=':'), Keyword),
525
+ # Basic Block Labels
526
+ (r'bb\.[0-9]+(\.[a-zA-Z0-9_.-]+)?( \(address-taken\))?:', Name.Label),
527
+ (r'bb\.[0-9]+ \(%[a-zA-Z0-9_.-]+\)( \(address-taken\))?:', Name.Label),
528
+ (r'%bb\.[0-9]+(\.\w+)?', Name.Label),
529
+ # Stack references
530
+ (r'%stack\.[0-9]+(\.\w+\.addr)?', Name),
531
+ # Subreg indices
532
+ (r'%subreg\.\w+', Name),
533
+ # Virtual registers
534
+ (r'%[a-zA-Z0-9_]+ *', Name.Variable, 'vreg'),
535
+ # Reference to LLVM-IR global
536
+ include('global'),
537
+ # Reference to Intrinsic
538
+ (r'intrinsic\(\@[a-zA-Z0-9_.]+\)', Name.Variable.Global),
539
+ # Comparison predicates
540
+ (words(('eq', 'ne', 'sgt', 'sge', 'slt', 'sle', 'ugt', 'uge', 'ult',
541
+ 'ule'), prefix=r'intpred\(', suffix=r'\)'), Name.Builtin),
542
+ (words(('oeq', 'one', 'ogt', 'oge', 'olt', 'ole', 'ugt', 'uge',
543
+ 'ult', 'ule'), prefix=r'floatpred\(', suffix=r'\)'),
544
+ Name.Builtin),
545
+ # Physical registers
546
+ (r'\$\w+', String.Single),
547
+ # Assignment operator
548
+ (r'=', Operator),
549
+ # gMIR Opcodes
550
+ (r'(G_ANYEXT|G_[SZ]EXT|G_SEXT_INREG|G_TRUNC|G_IMPLICIT_DEF|G_PHI|'
551
+ r'G_FRAME_INDEX|G_GLOBAL_VALUE|G_INTTOPTR|G_PTRTOINT|G_BITCAST|'
552
+ r'G_CONSTANT|G_FCONSTANT|G_VASTART|G_VAARG|G_CTLZ|G_CTLZ_ZERO_UNDEF|'
553
+ r'G_CTTZ|G_CTTZ_ZERO_UNDEF|G_CTPOP|G_BSWAP|G_BITREVERSE|'
554
+ r'G_ADDRSPACE_CAST|G_BLOCK_ADDR|G_JUMP_TABLE|G_DYN_STACKALLOC|'
555
+ r'G_ADD|G_SUB|G_MUL|G_[SU]DIV|G_[SU]REM|G_AND|G_OR|G_XOR|G_SHL|'
556
+ r'G_[LA]SHR|G_[IF]CMP|G_SELECT|G_GEP|G_PTR_MASK|G_SMIN|G_SMAX|'
557
+ r'G_UMIN|G_UMAX|G_[US]ADDO|G_[US]ADDE|G_[US]SUBO|G_[US]SUBE|'
558
+ r'G_[US]MULO|G_[US]MULH|G_FNEG|G_FPEXT|G_FPTRUNC|G_FPTO[US]I|'
559
+ r'G_[US]ITOFP|G_FABS|G_FCOPYSIGN|G_FCANONICALIZE|G_FMINNUM|'
560
+ r'G_FMAXNUM|G_FMINNUM_IEEE|G_FMAXNUM_IEEE|G_FMINIMUM|G_FMAXIMUM|'
561
+ r'G_FADD|G_FSUB|G_FMUL|G_FMA|G_FMAD|G_FDIV|G_FREM|G_FPOW|G_FEXP|'
562
+ r'G_FEXP2|G_FLOG|G_FLOG2|G_FLOG10|G_FCEIL|G_FCOS|G_FSIN|G_FSQRT|'
563
+ r'G_FFLOOR|G_FRINT|G_FNEARBYINT|G_INTRINSIC_TRUNC|'
564
+ r'G_INTRINSIC_ROUND|G_LOAD|G_[ZS]EXTLOAD|G_INDEXED_LOAD|'
565
+ r'G_INDEXED_[ZS]EXTLOAD|G_STORE|G_INDEXED_STORE|'
566
+ r'G_ATOMIC_CMPXCHG_WITH_SUCCESS|G_ATOMIC_CMPXCHG|'
567
+ r'G_ATOMICRMW_(XCHG|ADD|SUB|AND|NAND|OR|XOR|MAX|MIN|UMAX|UMIN|FADD|'
568
+ r'FSUB)'
569
+ r'|G_FENCE|G_EXTRACT|G_UNMERGE_VALUES|G_INSERT|G_MERGE_VALUES|'
570
+ r'G_BUILD_VECTOR|G_BUILD_VECTOR_TRUNC|G_CONCAT_VECTORS|'
571
+ r'G_INTRINSIC|G_INTRINSIC_W_SIDE_EFFECTS|G_BR|G_BRCOND|'
572
+ r'G_BRINDIRECT|G_BRJT|G_INSERT_VECTOR_ELT|G_EXTRACT_VECTOR_ELT|'
573
+ r'G_SHUFFLE_VECTOR)\b',
574
+ Name.Builtin),
575
+ # Target independent opcodes
576
+ (r'(COPY|PHI|INSERT_SUBREG|EXTRACT_SUBREG|REG_SEQUENCE)\b',
577
+ Name.Builtin),
578
+ # Flags
579
+ (words(('killed', 'implicit')), Keyword),
580
+ # ConstantInt values
581
+ (r'(i[0-9]+)( +)', bygroups(Keyword.Type, Whitespace), 'constantint'),
582
+ # ConstantFloat values
583
+ (r'(half|float|double) +', Keyword.Type, 'constantfloat'),
584
+ # Bare immediates
585
+ include('integer'),
586
+ # MMO's
587
+ (r'(::)( *)', bygroups(Operator, Whitespace), 'mmo'),
588
+ # MIR Comments
589
+ (r';.*', Comment),
590
+ # If we get here, assume it's a target instruction
591
+ (r'[a-zA-Z0-9_]+', Name),
592
+ # Everything else that isn't highlighted
593
+ (r'[(), \n]+', Text),
594
+ ],
595
+ # The integer constant from a ConstantInt value
596
+ 'constantint': [
597
+ include('integer'),
598
+ (r'(?=.)', Text, '#pop'),
599
+ ],
600
+ # The floating point constant from a ConstantFloat value
601
+ 'constantfloat': [
602
+ include('float'),
603
+ (r'(?=.)', Text, '#pop'),
604
+ ],
605
+ 'vreg': [
606
+ # The bank or class if there is one
607
+ (r'( *)(:(?!:))', bygroups(Whitespace, Keyword), ('#pop', 'vreg_bank_or_class')),
608
+ # The LLT if there is one
609
+ (r'( *)(\()', bygroups(Whitespace, Text), 'vreg_type'),
610
+ (r'(?=.)', Text, '#pop'),
611
+ ],
612
+ 'vreg_bank_or_class': [
613
+ # The unassigned bank/class
614
+ (r'( *)(_)', bygroups(Whitespace, Name.Variable.Magic)),
615
+ (r'( *)([a-zA-Z0-9_]+)', bygroups(Whitespace, Name.Variable)),
616
+ # The LLT if there is one
617
+ (r'( *)(\()', bygroups(Whitespace, Text), 'vreg_type'),
618
+ (r'(?=.)', Text, '#pop'),
619
+ ],
620
+ 'vreg_type': [
621
+ # Scalar and pointer types
622
+ (r'( *)([sp][0-9]+)', bygroups(Whitespace, Keyword.Type)),
623
+ (r'( *)(<[0-9]+ *x *[sp][0-9]+>)', bygroups(Whitespace, Keyword.Type)),
624
+ (r'\)', Text, '#pop'),
625
+ (r'(?=.)', Text, '#pop'),
626
+ ],
627
+ 'mmo': [
628
+ (r'\(', Text),
629
+ (r' +', Whitespace),
630
+ (words(('load', 'store', 'on', 'into', 'from', 'align', 'monotonic',
631
+ 'acquire', 'release', 'acq_rel', 'seq_cst')),
632
+ Keyword),
633
+ # IR references
634
+ (r'%ir\.[a-zA-Z0-9_.-]+', Name),
635
+ (r'%ir-block\.[a-zA-Z0-9_.-]+', Name),
636
+ (r'[-+]', Operator),
637
+ include('integer'),
638
+ include('global'),
639
+ (r',', Punctuation),
640
+ (r'\), \(', Text),
641
+ (r'\)', Text, '#pop'),
642
+ ],
643
+ 'integer': [(r'-?[0-9]+', Number.Integer),],
644
+ 'float': [(r'-?[0-9]+\.[0-9]+(e[+-][0-9]+)?', Number.Float)],
645
+ 'global': [(r'\@[a-zA-Z0-9_.]+', Name.Variable.Global)],
646
+ }
647
+
648
+
649
+ class LlvmMirLexer(RegexLexer):
650
+ """
651
+ Lexer for the overall LLVM MIR document format.
652
+
653
+ MIR is a human readable serialization format that's used to represent LLVM's
654
+ machine specific intermediate representation. It allows LLVM's developers to
655
+ see the state of the compilation process at various points, as well as test
656
+ individual pieces of the compiler.
657
+ """
658
+ name = 'LLVM-MIR'
659
+ url = 'https://llvm.org/docs/MIRLangRef.html'
660
+ aliases = ['llvm-mir']
661
+ filenames = ['*.mir']
662
+ version_added = '2.6'
663
+
664
+ tokens = {
665
+ 'root': [
666
+ # Comments are hashes at the YAML level
667
+ (r'#.*', Comment),
668
+ # Documents starting with | are LLVM-IR
669
+ (r'--- \|$', Keyword, 'llvm_ir'),
670
+ # Other documents are MIR
671
+ (r'---', Keyword, 'llvm_mir'),
672
+ # Consume everything else in one token for efficiency
673
+ (r'[^-#]+|.', Text),
674
+ ],
675
+ 'llvm_ir': [
676
+ # Documents end with '...' or '---'
677
+ (r'(\.\.\.|(?=---))', Keyword, '#pop'),
678
+ # Delegate to the LlvmLexer
679
+ (r'([\s\S]+?)(?=(\.\.\.|---))', bygroups(using(LlvmLexer))),
680
+ ],
681
+ 'llvm_mir': [
682
+ # Comments are hashes at the YAML level
683
+ (r'#.*', Comment),
684
+ # Documents end with '...' or '---'
685
+ (r'(\.\.\.|(?=---))', Keyword, '#pop'),
686
+ # Handle the simple attributes
687
+ (r'name:', Keyword, 'name'),
688
+ (words(('alignment', ),
689
+ suffix=':'), Keyword, 'number'),
690
+ (words(('legalized', 'regBankSelected', 'tracksRegLiveness',
691
+ 'selected', 'exposesReturnsTwice'),
692
+ suffix=':'), Keyword, 'boolean'),
693
+ # Handle the attributes don't highlight inside
694
+ (words(('registers', 'stack', 'fixedStack', 'liveins', 'frameInfo',
695
+ 'machineFunctionInfo'),
696
+ suffix=':'), Keyword),
697
+ # Delegate the body block to the LlvmMirBodyLexer
698
+ (r'body: *\|', Keyword, 'llvm_mir_body'),
699
+ # Consume everything else
700
+ (r'.+', Text),
701
+ (r'\n', Whitespace),
702
+ ],
703
+ 'name': [
704
+ (r'[^\n]+', Name),
705
+ default('#pop'),
706
+ ],
707
+ 'boolean': [
708
+ (r' *(true|false)', Name.Builtin),
709
+ default('#pop'),
710
+ ],
711
+ 'number': [
712
+ (r' *[0-9]+', Number),
713
+ default('#pop'),
714
+ ],
715
+ 'llvm_mir_body': [
716
+ # Documents end with '...' or '---'.
717
+ # We have to pop llvm_mir_body and llvm_mir
718
+ (r'(\.\.\.|(?=---))', Keyword, '#pop:2'),
719
+ # Delegate the body block to the LlvmMirBodyLexer
720
+ (r'([\s\S]+?)(?=\.\.\.|---)', bygroups(using(LlvmMirBodyLexer))),
721
+ # The '...' is optional. If we didn't already find it then it isn't
722
+ # there. There might be a '---' instead though.
723
+ (r'(?!\.\.\.|---)([\s\S]+)', bygroups(using(LlvmMirBodyLexer))),
724
+ ],
725
+ }
726
+
727
+
728
+ class NasmLexer(RegexLexer):
729
+ """
730
+ For Nasm (Intel) assembly code.
731
+ """
732
+ name = 'NASM'
733
+ aliases = ['nasm']
734
+ filenames = ['*.asm', '*.ASM', '*.nasm']
735
+ mimetypes = ['text/x-nasm']
736
+ url = 'https://nasm.us'
737
+ version_added = ''
738
+
739
+ # Tasm uses the same file endings, but TASM is not as common as NASM, so
740
+ # we prioritize NASM higher by default
741
+ priority = 1.0
742
+
743
+ identifier = r'[a-z$._?][\w$.?#@~]*'
744
+ hexn = r'(?:0x[0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)'
745
+ octn = r'[0-7]+q'
746
+ binn = r'[01]+b'
747
+ decn = r'[0-9]+'
748
+ floatn = decn + r'\.e?' + decn
749
+ string = r'"(\\"|[^"\n])*"|' + r"'(\\'|[^'\n])*'|" + r"`(\\`|[^`\n])*`"
750
+ declkw = r'(?:res|d)[bwdqt]|times'
751
+ register = (r'(r[0-9][0-5]?[bwd]?|'
752
+ r'[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|'
753
+ r'mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7]|k[0-7]|'
754
+ r'[xyz]mm(?:[12][0-9]?|3[01]?|[04-9]))\b')
755
+ wordop = r'seg|wrt|strict|rel|abs'
756
+ type = r'byte|[dq]?word'
757
+ # Directives must be followed by whitespace, otherwise CPU will match
758
+ # cpuid for instance.
759
+ directives = (r'(?:BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|'
760
+ r'ORG|ALIGN|STRUC|ENDSTRUC|COMMON|CPU|GROUP|UPPERCASE|IMPORT|'
761
+ r'EXPORT|LIBRARY|MODULE)(?=\s)')
762
+
763
+ flags = re.IGNORECASE | re.MULTILINE
764
+ tokens = {
765
+ 'root': [
766
+ (r'^\s*%', Comment.Preproc, 'preproc'),
767
+ include('whitespace'),
768
+ (identifier + ':', Name.Label),
769
+ (rf'({identifier})(\s+)(equ)',
770
+ bygroups(Name.Constant, Whitespace, Keyword.Declaration),
771
+ 'instruction-args'),
772
+ (directives, Keyword, 'instruction-args'),
773
+ (declkw, Keyword.Declaration, 'instruction-args'),
774
+ (identifier, Name.Function, 'instruction-args'),
775
+ (r'[\r\n]+', Whitespace)
776
+ ],
777
+ 'instruction-args': [
778
+ (string, String),
779
+ (hexn, Number.Hex),
780
+ (octn, Number.Oct),
781
+ (binn, Number.Bin),
782
+ (floatn, Number.Float),
783
+ (decn, Number.Integer),
784
+ include('punctuation'),
785
+ (register, Name.Builtin),
786
+ (identifier, Name.Variable),
787
+ (r'[\r\n]+', Whitespace, '#pop'),
788
+ include('whitespace')
789
+ ],
790
+ 'preproc': [
791
+ (r'[^;\n]+', Comment.Preproc),
792
+ (r';.*?\n', Comment.Single, '#pop'),
793
+ (r'\n', Comment.Preproc, '#pop'),
794
+ ],
795
+ 'whitespace': [
796
+ (r'\n', Whitespace),
797
+ (r'[ \t]+', Whitespace),
798
+ (r';.*', Comment.Single),
799
+ (r'#.*', Comment.Single)
800
+ ],
801
+ 'punctuation': [
802
+ (r'[,{}():\[\]]+', Punctuation),
803
+ (r'[&|^<>+*/%~-]+', Operator),
804
+ (r'[$]+', Keyword.Constant),
805
+ (wordop, Operator.Word),
806
+ (type, Keyword.Type)
807
+ ],
808
+ }
809
+
810
+ def analyse_text(text):
811
+ # Probably TASM
812
+ if re.match(r'PROC', text, re.IGNORECASE):
813
+ return False
814
+
815
+
816
+ class NasmObjdumpLexer(ObjdumpLexer):
817
+ """
818
+ For the output of ``objdump -d -M intel``.
819
+ """
820
+ name = 'objdump-nasm'
821
+ aliases = ['objdump-nasm']
822
+ filenames = ['*.objdump-intel']
823
+ mimetypes = ['text/x-nasm-objdump']
824
+ url = 'https://www.gnu.org/software/binutils'
825
+ version_added = '2.0'
826
+
827
+ tokens = _objdump_lexer_tokens(NasmLexer)
828
+
829
+
830
+ class TasmLexer(RegexLexer):
831
+ """
832
+ For Tasm (Turbo Assembler) assembly code.
833
+ """
834
+ name = 'TASM'
835
+ aliases = ['tasm']
836
+ filenames = ['*.asm', '*.ASM', '*.tasm']
837
+ mimetypes = ['text/x-tasm']
838
+ url = 'https://en.wikipedia.org/wiki/Turbo_Assembler'
839
+ version_added = ''
840
+
841
+ identifier = r'[@a-z$._?][\w$.?#@~]*'
842
+ hexn = r'(?:0x[0-9a-f]+|$0[0-9a-f]*|[0-9]+[0-9a-f]*h)'
843
+ octn = r'[0-7]+q'
844
+ binn = r'[01]+b'
845
+ decn = r'[0-9]+'
846
+ floatn = decn + r'\.e?' + decn
847
+ string = r'"(\\"|[^"\n])*"|' + r"'(\\'|[^'\n])*'|" + r"`(\\`|[^`\n])*`"
848
+ declkw = r'(?:res|d)[bwdqt]|times'
849
+ register = (r'(r[0-9][0-5]?[bwd]|'
850
+ r'[a-d][lh]|[er]?[a-d]x|[er]?[sb]p|[er]?[sd]i|[c-gs]s|st[0-7]|'
851
+ r'mm[0-7]|cr[0-4]|dr[0-367]|tr[3-7])\b')
852
+ wordop = r'seg|wrt|strict'
853
+ type = r'byte|[dq]?word'
854
+ directives = (r'BITS|USE16|USE32|SECTION|SEGMENT|ABSOLUTE|EXTERN|GLOBAL|'
855
+ r'ORG|ALIGN|STRUC|ENDSTRUC|ENDS|COMMON|CPU|GROUP|UPPERCASE|INCLUDE|'
856
+ r'EXPORT|LIBRARY|MODULE|PROC|ENDP|USES|ARG|DATASEG|UDATASEG|END|IDEAL|'
857
+ r'P386|MODEL|ASSUME|CODESEG|SIZE')
858
+ # T[A-Z][a-z] is more of a convention. Lexer should filter out STRUC definitions
859
+ # and then 'add' them to datatype somehow.
860
+ datatype = (r'db|dd|dw|T[A-Z][a-z]+')
861
+
862
+ flags = re.IGNORECASE | re.MULTILINE
863
+ tokens = {
864
+ 'root': [
865
+ (r'^\s*%', Comment.Preproc, 'preproc'),
866
+ include('whitespace'),
867
+ (identifier + ':', Name.Label),
868
+ (directives, Keyword, 'instruction-args'),
869
+ (rf'({identifier})(\s+)({datatype})',
870
+ bygroups(Name.Constant, Whitespace, Keyword.Declaration),
871
+ 'instruction-args'),
872
+ (declkw, Keyword.Declaration, 'instruction-args'),
873
+ (identifier, Name.Function, 'instruction-args'),
874
+ (r'[\r\n]+', Whitespace)
875
+ ],
876
+ 'instruction-args': [
877
+ (string, String),
878
+ (hexn, Number.Hex),
879
+ (octn, Number.Oct),
880
+ (binn, Number.Bin),
881
+ (floatn, Number.Float),
882
+ (decn, Number.Integer),
883
+ include('punctuation'),
884
+ (register, Name.Builtin),
885
+ (identifier, Name.Variable),
886
+ # Do not match newline when it's preceded by a backslash
887
+ (r'(\\)(\s*)(;.*)([\r\n])',
888
+ bygroups(Text, Whitespace, Comment.Single, Whitespace)),
889
+ (r'[\r\n]+', Whitespace, '#pop'),
890
+ include('whitespace')
891
+ ],
892
+ 'preproc': [
893
+ (r'[^;\n]+', Comment.Preproc),
894
+ (r';.*?\n', Comment.Single, '#pop'),
895
+ (r'\n', Comment.Preproc, '#pop'),
896
+ ],
897
+ 'whitespace': [
898
+ (r'[\n\r]', Whitespace),
899
+ (r'(\\)([\n\r])', bygroups(Text, Whitespace)),
900
+ (r'[ \t]+', Whitespace),
901
+ (r';.*', Comment.Single)
902
+ ],
903
+ 'punctuation': [
904
+ (r'[,():\[\]]+', Punctuation),
905
+ (r'[&|^<>+*=/%~-]+', Operator),
906
+ (r'[$]+', Keyword.Constant),
907
+ (wordop, Operator.Word),
908
+ (type, Keyword.Type)
909
+ ],
910
+ }
911
+
912
+ def analyse_text(text):
913
+ # See above
914
+ if re.match(r'PROC', text, re.I):
915
+ return True
916
+
917
+
918
+ class Ca65Lexer(RegexLexer):
919
+ """
920
+ For ca65 assembler sources.
921
+ """
922
+ name = 'ca65 assembler'
923
+ aliases = ['ca65']
924
+ filenames = ['*.s']
925
+ url = 'https://cc65.github.io'
926
+ version_added = '1.6'
927
+
928
+ flags = re.IGNORECASE
929
+
930
+ tokens = {
931
+ 'root': [
932
+ (r';.*', Comment.Single),
933
+ (r'\s+', Whitespace),
934
+ (r'[a-z_.@$][\w.@$]*:', Name.Label),
935
+ (r'((ld|st)[axy]|(in|de)[cxy]|asl|lsr|ro[lr]|adc|sbc|cmp|cp[xy]'
936
+ r'|cl[cvdi]|se[cdi]|jmp|jsr|bne|beq|bpl|bmi|bvc|bvs|bcc|bcs'
937
+ r'|p[lh][ap]|rt[is]|brk|nop|ta[xy]|t[xy]a|txs|tsx|and|ora|eor'
938
+ r'|bit)\b', Keyword),
939
+ (r'\.\w+', Keyword.Pseudo),
940
+ (r'[-+~*/^&|!<>=]', Operator),
941
+ (r'"[^"\n]*.', String),
942
+ (r"'[^'\n]*.", String.Char),
943
+ (r'\$[0-9a-f]+|[0-9a-f]+h\b', Number.Hex),
944
+ (r'\d+', Number.Integer),
945
+ (r'%[01]+', Number.Bin),
946
+ (r'[#,.:()=\[\]]', Punctuation),
947
+ (r'[a-z_.@$][\w.@$]*', Name),
948
+ ]
949
+ }
950
+
951
+ def analyse_text(self, text):
952
+ # comments in GAS start with "#"
953
+ if re.search(r'^\s*;', text, re.MULTILINE):
954
+ return 0.9
955
+
956
+
957
+ class Dasm16Lexer(RegexLexer):
958
+ """
959
+ For DCPU-16 Assembly.
960
+ """
961
+ name = 'DASM16'
962
+ url = 'http://0x10c.com/doc/dcpu-16.txt'
963
+ aliases = ['dasm16']
964
+ filenames = ['*.dasm16', '*.dasm']
965
+ mimetypes = ['text/x-dasm16']
966
+ version_added = '2.4'
967
+
968
+ INSTRUCTIONS = [
969
+ 'SET',
970
+ 'ADD', 'SUB',
971
+ 'MUL', 'MLI',
972
+ 'DIV', 'DVI',
973
+ 'MOD', 'MDI',
974
+ 'AND', 'BOR', 'XOR',
975
+ 'SHR', 'ASR', 'SHL',
976
+ 'IFB', 'IFC', 'IFE', 'IFN', 'IFG', 'IFA', 'IFL', 'IFU',
977
+ 'ADX', 'SBX',
978
+ 'STI', 'STD',
979
+ 'JSR',
980
+ 'INT', 'IAG', 'IAS', 'RFI', 'IAQ', 'HWN', 'HWQ', 'HWI',
981
+ ]
982
+
983
+ REGISTERS = [
984
+ 'A', 'B', 'C',
985
+ 'X', 'Y', 'Z',
986
+ 'I', 'J',
987
+ 'SP', 'PC', 'EX',
988
+ 'POP', 'PEEK', 'PUSH'
989
+ ]
990
+
991
+ # Regexes yo
992
+ char = r'[a-zA-Z0-9_$@.]'
993
+ identifier = r'(?:[a-zA-Z$_]' + char + r'*|\.' + char + '+)'
994
+ number = r'[+-]?(?:0[xX][a-zA-Z0-9]+|\d+)'
995
+ binary_number = r'0b[01_]+'
996
+ instruction = r'(?i)(' + '|'.join(INSTRUCTIONS) + ')'
997
+ single_char = r"'\\?" + char + "'"
998
+ string = r'"(\\"|[^"])*"'
999
+
1000
+ def guess_identifier(lexer, match):
1001
+ ident = match.group(0)
1002
+ klass = Name.Variable if ident.upper() in lexer.REGISTERS else Name.Label
1003
+ yield match.start(), klass, ident
1004
+
1005
+ tokens = {
1006
+ 'root': [
1007
+ include('whitespace'),
1008
+ (':' + identifier, Name.Label),
1009
+ (identifier + ':', Name.Label),
1010
+ (instruction, Name.Function, 'instruction-args'),
1011
+ (r'\.' + identifier, Name.Function, 'data-args'),
1012
+ (r'[\r\n]+', Whitespace)
1013
+ ],
1014
+
1015
+ 'numeric' : [
1016
+ (binary_number, Number.Integer),
1017
+ (number, Number.Integer),
1018
+ (single_char, String),
1019
+ ],
1020
+
1021
+ 'arg' : [
1022
+ (identifier, guess_identifier),
1023
+ include('numeric')
1024
+ ],
1025
+
1026
+ 'deref' : [
1027
+ (r'\+', Punctuation),
1028
+ (r'\]', Punctuation, '#pop'),
1029
+ include('arg'),
1030
+ include('whitespace')
1031
+ ],
1032
+
1033
+ 'instruction-line' : [
1034
+ (r'[\r\n]+', Whitespace, '#pop'),
1035
+ (r';.*?$', Comment, '#pop'),
1036
+ include('whitespace')
1037
+ ],
1038
+
1039
+ 'instruction-args': [
1040
+ (r',', Punctuation),
1041
+ (r'\[', Punctuation, 'deref'),
1042
+ include('arg'),
1043
+ include('instruction-line')
1044
+ ],
1045
+
1046
+ 'data-args' : [
1047
+ (r',', Punctuation),
1048
+ include('numeric'),
1049
+ (string, String),
1050
+ include('instruction-line')
1051
+ ],
1052
+
1053
+ 'whitespace': [
1054
+ (r'\n', Whitespace),
1055
+ (r'\s+', Whitespace),
1056
+ (r';.*?\n', Comment)
1057
+ ],
1058
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/asn1.py ADDED
@@ -0,0 +1,178 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.asn1
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Pygments lexers for ASN.1.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
14
+ Number, Punctuation, Whitespace
15
+ from pygments.lexer import RegexLexer, words, bygroups
16
+
17
+ __all__ = ['Asn1Lexer']
18
+
19
+ SINGLE_WORD_KEYWORDS = [
20
+ "ENCODED",
21
+ "ABSTRACT-SYNTAX",
22
+ "END",
23
+ "APPLICATION",
24
+ "EXPLICIT",
25
+ "IMPLICIT",
26
+ "AUTOMATIC",
27
+ "TAGS",
28
+ "BEGIN",
29
+ "EXTENSIBILITY",
30
+ "BY",
31
+ "FROM",
32
+ "COMPONENT",
33
+ "UNIVERSAL",
34
+ "COMPONENTS",
35
+ "CONSTRAINED",
36
+ "IMPLIED",
37
+ "DEFINITIONS",
38
+ "INCLUDES",
39
+ "PRIVATE",
40
+ "WITH",
41
+ "OF",
42
+ ]
43
+
44
+ OPERATOR_WORDS = [
45
+ "EXCEPT",
46
+ "UNION",
47
+ "INTERSECTION",
48
+ ]
49
+
50
+ SINGLE_WORD_NAMESPACE_KEYWORDS = [
51
+ "EXPORTS",
52
+ "IMPORTS",
53
+ ]
54
+
55
+ MULTI_WORDS_DECLARATIONS = [
56
+ "SEQUENCE OF",
57
+ "SET OF",
58
+ "INSTANCE OF",
59
+ "WITH SYNTAX",
60
+ ]
61
+
62
+ SINGLE_WORDS_DECLARATIONS = [
63
+ "SIZE",
64
+ "SEQUENCE",
65
+ "SET",
66
+ "CLASS",
67
+ "UNIQUE",
68
+ "DEFAULT",
69
+ "CHOICE",
70
+ "PATTERN",
71
+ "OPTIONAL",
72
+ "PRESENT",
73
+ "ABSENT",
74
+ "CONTAINING",
75
+ "ENUMERATED",
76
+ "ALL",
77
+ ]
78
+
79
+ TWO_WORDS_TYPES = [
80
+ "OBJECT IDENTIFIER",
81
+ "BIT STRING",
82
+ "OCTET STRING",
83
+ "CHARACTER STRING",
84
+ "EMBEDDED PDV",
85
+ ]
86
+
87
+ SINGLE_WORD_TYPES = [
88
+ "RELATIVE-OID",
89
+ "TYPE-IDENTIFIER",
90
+ "ObjectDescriptor",
91
+ "IA5String",
92
+ "INTEGER",
93
+ "ISO646String",
94
+ "T61String",
95
+ "BMPString",
96
+ "NumericString",
97
+ "TeletexString",
98
+ "GeneralizedTime",
99
+ "REAL",
100
+ "BOOLEAN",
101
+ "GeneralString",
102
+ "GraphicString",
103
+ "UniversalString",
104
+ "UTCTime",
105
+ "VisibleString",
106
+ "UTF8String",
107
+ "PrintableString",
108
+ "VideotexString",
109
+ "EXTERNAL",
110
+ ]
111
+
112
+
113
+ def word_sequences(tokens):
114
+ return "(" + '|'.join(token.replace(' ', r'\s+') for token in tokens) + r')\b'
115
+
116
+
117
+ class Asn1Lexer(RegexLexer):
118
+
119
+ """
120
+ Lexer for ASN.1 module definition
121
+ """
122
+
123
+ flags = re.MULTILINE
124
+
125
+ name = 'ASN.1'
126
+ aliases = ['asn1']
127
+ filenames = ["*.asn1"]
128
+ url = "https://www.itu.int/ITU-T/studygroups/com17/languages/X.680-0207.pdf"
129
+ version_added = '2.16'
130
+
131
+ tokens = {
132
+ 'root': [
133
+ # Whitespace:
134
+ (r'\s+', Whitespace),
135
+ # Comments:
136
+ (r'--.*$', Comment.Single),
137
+ (r'/\*', Comment.Multiline, 'comment'),
138
+ # Numbers:
139
+ (r'\d+\.\d+([eE][-+]?\d+)?', Number.Float),
140
+ (r'\d+', Number.Integer),
141
+ # Identifier:
142
+ (r"&?[a-z][-a-zA-Z0-9]*[a-zA-Z0-9]\b", Name.Variable),
143
+ # Constants:
144
+ (words(("TRUE", "FALSE", "NULL", "MINUS-INFINITY", "PLUS-INFINITY", "MIN", "MAX"), suffix=r'\b'), Keyword.Constant),
145
+ # Builtin types:
146
+ (word_sequences(TWO_WORDS_TYPES), Keyword.Type),
147
+ (words(SINGLE_WORD_TYPES, suffix=r'\b'), Keyword.Type),
148
+ # Other keywords:
149
+ (r"EXPORTS\s+ALL\b", Keyword.Namespace),
150
+ (words(SINGLE_WORD_NAMESPACE_KEYWORDS, suffix=r'\b'), Operator.Namespace),
151
+ (word_sequences(MULTI_WORDS_DECLARATIONS), Keyword.Declaration),
152
+ (words(SINGLE_WORDS_DECLARATIONS, suffix=r'\b'), Keyword.Declaration),
153
+ (words(OPERATOR_WORDS, suffix=r'\b'), Operator.Word),
154
+ (words(SINGLE_WORD_KEYWORDS), Keyword),
155
+ # Type identifier:
156
+ (r"&?[A-Z][-a-zA-Z0-9]*[a-zA-Z0-9]\b", Name.Type),
157
+ # Operators:
158
+ (r"(::=|\.\.\.|\.\.|\[\[|\]\]|\||\^|-)", Operator),
159
+ # Punctuation:
160
+ (r"(\.|,|\{|\}|\(|\)|\[|\])", Punctuation),
161
+ # String:
162
+ (r'"', String, 'string'),
163
+ # Binary string:
164
+ (r"('[01 ]*')(B)\b", bygroups(String, String.Affix)),
165
+ (r"('[0-9A-F ]*')(H)\b",bygroups(String, String.Affix)),
166
+ ],
167
+ 'comment': [
168
+ (r'[^*/]+', Comment.Multiline),
169
+ (r'/\*', Comment.Multiline, '#push'),
170
+ (r'\*/', Comment.Multiline, '#pop'),
171
+ (r'[*/]', Comment.Multiline)
172
+ ],
173
+ 'string': [
174
+ (r'""', String),
175
+ (r'"', String, "#pop"),
176
+ (r'[^"]', String),
177
+ ]
178
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/automation.py ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.automation
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for automation scripting languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, include, bygroups, combined
12
+ from pygments.token import Text, Comment, Operator, Name, String, \
13
+ Number, Punctuation, Generic
14
+
15
+ __all__ = ['AutohotkeyLexer', 'AutoItLexer']
16
+
17
+
18
+ class AutohotkeyLexer(RegexLexer):
19
+ """
20
+ For autohotkey source code.
21
+ """
22
+ name = 'autohotkey'
23
+ url = 'http://www.autohotkey.com/'
24
+ aliases = ['autohotkey', 'ahk']
25
+ filenames = ['*.ahk', '*.ahkl']
26
+ mimetypes = ['text/x-autohotkey']
27
+ version_added = '1.4'
28
+
29
+ tokens = {
30
+ 'root': [
31
+ (r'^(\s*)(/\*)', bygroups(Text, Comment.Multiline), 'incomment'),
32
+ (r'^(\s*)(\()', bygroups(Text, Generic), 'incontinuation'),
33
+ (r'\s+;.*?$', Comment.Single),
34
+ (r'^;.*?$', Comment.Single),
35
+ (r'[]{}(),;[]', Punctuation),
36
+ (r'(in|is|and|or|not)\b', Operator.Word),
37
+ (r'\%[a-zA-Z_#@$][\w#@$]*\%', Name.Variable),
38
+ (r'!=|==|:=|\.=|<<|>>|[-~+/*%=<>&^|?:!.]', Operator),
39
+ include('commands'),
40
+ include('labels'),
41
+ include('builtInFunctions'),
42
+ include('builtInVariables'),
43
+ (r'"', String, combined('stringescape', 'dqs')),
44
+ include('numbers'),
45
+ (r'[a-zA-Z_#@$][\w#@$]*', Name),
46
+ (r'\\|\'', Text),
47
+ (r'\`([,%`abfnrtv\-+;])', String.Escape),
48
+ include('garbage'),
49
+ ],
50
+ 'incomment': [
51
+ (r'^\s*\*/', Comment.Multiline, '#pop'),
52
+ (r'[^*]+', Comment.Multiline),
53
+ (r'\*', Comment.Multiline)
54
+ ],
55
+ 'incontinuation': [
56
+ (r'^\s*\)', Generic, '#pop'),
57
+ (r'[^)]', Generic),
58
+ (r'[)]', Generic),
59
+ ],
60
+ 'commands': [
61
+ (r'(?i)^(\s*)(global|local|static|'
62
+ r'#AllowSameLineComments|#ClipboardTimeout|#CommentFlag|'
63
+ r'#ErrorStdOut|#EscapeChar|#HotkeyInterval|#HotkeyModifierTimeout|'
64
+ r'#Hotstring|#IfWinActive|#IfWinExist|#IfWinNotActive|'
65
+ r'#IfWinNotExist|#IncludeAgain|#Include|#InstallKeybdHook|'
66
+ r'#InstallMouseHook|#KeyHistory|#LTrim|#MaxHotkeysPerInterval|'
67
+ r'#MaxMem|#MaxThreads|#MaxThreadsBuffer|#MaxThreadsPerHotkey|'
68
+ r'#NoEnv|#NoTrayIcon|#Persistent|#SingleInstance|#UseHook|'
69
+ r'#WinActivateForce|AutoTrim|BlockInput|Break|Click|ClipWait|'
70
+ r'Continue|Control|ControlClick|ControlFocus|ControlGetFocus|'
71
+ r'ControlGetPos|ControlGetText|ControlGet|ControlMove|ControlSend|'
72
+ r'ControlSendRaw|ControlSetText|CoordMode|Critical|'
73
+ r'DetectHiddenText|DetectHiddenWindows|Drive|DriveGet|'
74
+ r'DriveSpaceFree|Edit|Else|EnvAdd|EnvDiv|EnvGet|EnvMult|EnvSet|'
75
+ r'EnvSub|EnvUpdate|Exit|ExitApp|FileAppend|'
76
+ r'FileCopy|FileCopyDir|FileCreateDir|FileCreateShortcut|'
77
+ r'FileDelete|FileGetAttrib|FileGetShortcut|FileGetSize|'
78
+ r'FileGetTime|FileGetVersion|FileInstall|FileMove|FileMoveDir|'
79
+ r'FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|'
80
+ r'FileRemoveDir|FileSelectFile|FileSelectFolder|FileSetAttrib|'
81
+ r'FileSetTime|FormatTime|GetKeyState|Gosub|Goto|GroupActivate|'
82
+ r'GroupAdd|GroupClose|GroupDeactivate|Gui|GuiControl|'
83
+ r'GuiControlGet|Hotkey|IfEqual|IfExist|IfGreaterOrEqual|IfGreater|'
84
+ r'IfInString|IfLess|IfLessOrEqual|IfMsgBox|IfNotEqual|IfNotExist|'
85
+ r'IfNotInString|IfWinActive|IfWinExist|IfWinNotActive|'
86
+ r'IfWinNotExist|If |ImageSearch|IniDelete|IniRead|IniWrite|'
87
+ r'InputBox|Input|KeyHistory|KeyWait|ListHotkeys|ListLines|'
88
+ r'ListVars|Loop|Menu|MouseClickDrag|MouseClick|MouseGetPos|'
89
+ r'MouseMove|MsgBox|OnExit|OutputDebug|Pause|PixelGetColor|'
90
+ r'PixelSearch|PostMessage|Process|Progress|Random|RegDelete|'
91
+ r'RegRead|RegWrite|Reload|Repeat|Return|RunAs|RunWait|Run|'
92
+ r'SendEvent|SendInput|SendMessage|SendMode|SendPlay|SendRaw|Send|'
93
+ r'SetBatchLines|SetCapslockState|SetControlDelay|'
94
+ r'SetDefaultMouseSpeed|SetEnv|SetFormat|SetKeyDelay|'
95
+ r'SetMouseDelay|SetNumlockState|SetScrollLockState|'
96
+ r'SetStoreCapslockMode|SetTimer|SetTitleMatchMode|'
97
+ r'SetWinDelay|SetWorkingDir|Shutdown|Sleep|Sort|SoundBeep|'
98
+ r'SoundGet|SoundGetWaveVolume|SoundPlay|SoundSet|'
99
+ r'SoundSetWaveVolume|SplashImage|SplashTextOff|SplashTextOn|'
100
+ r'SplitPath|StatusBarGetText|StatusBarWait|StringCaseSense|'
101
+ r'StringGetPos|StringLeft|StringLen|StringLower|StringMid|'
102
+ r'StringReplace|StringRight|StringSplit|StringTrimLeft|'
103
+ r'StringTrimRight|StringUpper|Suspend|SysGet|Thread|ToolTip|'
104
+ r'Transform|TrayTip|URLDownloadToFile|While|WinActivate|'
105
+ r'WinActivateBottom|WinClose|WinGetActiveStats|WinGetActiveTitle|'
106
+ r'WinGetClass|WinGetPos|WinGetText|WinGetTitle|WinGet|WinHide|'
107
+ r'WinKill|WinMaximize|WinMenuSelectItem|WinMinimizeAllUndo|'
108
+ r'WinMinimizeAll|WinMinimize|WinMove|WinRestore|WinSetTitle|'
109
+ r'WinSet|WinShow|WinWaitActive|WinWaitClose|WinWaitNotActive|'
110
+ r'WinWait)\b', bygroups(Text, Name.Builtin)),
111
+ ],
112
+ 'builtInFunctions': [
113
+ (r'(?i)(Abs|ACos|Asc|ASin|ATan|Ceil|Chr|Cos|DllCall|Exp|FileExist|'
114
+ r'Floor|GetKeyState|IL_Add|IL_Create|IL_Destroy|InStr|IsFunc|'
115
+ r'IsLabel|Ln|Log|LV_Add|LV_Delete|LV_DeleteCol|LV_GetCount|'
116
+ r'LV_GetNext|LV_GetText|LV_Insert|LV_InsertCol|LV_Modify|'
117
+ r'LV_ModifyCol|LV_SetImageList|Mod|NumGet|NumPut|OnMessage|'
118
+ r'RegExMatch|RegExReplace|RegisterCallback|Round|SB_SetIcon|'
119
+ r'SB_SetParts|SB_SetText|Sin|Sqrt|StrLen|SubStr|Tan|TV_Add|'
120
+ r'TV_Delete|TV_GetChild|TV_GetCount|TV_GetNext|TV_Get|'
121
+ r'TV_GetParent|TV_GetPrev|TV_GetSelection|TV_GetText|TV_Modify|'
122
+ r'VarSetCapacity|WinActive|WinExist|Object|ComObjActive|'
123
+ r'ComObjArray|ComObjEnwrap|ComObjUnwrap|ComObjParameter|'
124
+ r'ComObjType|ComObjConnect|ComObjCreate|ComObjGet|ComObjError|'
125
+ r'ComObjValue|Insert|MinIndex|MaxIndex|Remove|SetCapacity|'
126
+ r'GetCapacity|GetAddress|_NewEnum|FileOpen|Read|Write|ReadLine|'
127
+ r'WriteLine|ReadNumType|WriteNumType|RawRead|RawWrite|Seek|Tell|'
128
+ r'Close|Next|IsObject|StrPut|StrGet|Trim|LTrim|RTrim)\b',
129
+ Name.Function),
130
+ ],
131
+ 'builtInVariables': [
132
+ (r'(?i)(A_AhkPath|A_AhkVersion|A_AppData|A_AppDataCommon|'
133
+ r'A_AutoTrim|A_BatchLines|A_CaretX|A_CaretY|A_ComputerName|'
134
+ r'A_ControlDelay|A_Cursor|A_DDDD|A_DDD|A_DD|A_DefaultMouseSpeed|'
135
+ r'A_Desktop|A_DesktopCommon|A_DetectHiddenText|'
136
+ r'A_DetectHiddenWindows|A_EndChar|A_EventInfo|A_ExitReason|'
137
+ r'A_FormatFloat|A_FormatInteger|A_Gui|A_GuiEvent|A_GuiControl|'
138
+ r'A_GuiControlEvent|A_GuiHeight|A_GuiWidth|A_GuiX|A_GuiY|A_Hour|'
139
+ r'A_IconFile|A_IconHidden|A_IconNumber|A_IconTip|A_Index|'
140
+ r'A_IPAddress1|A_IPAddress2|A_IPAddress3|A_IPAddress4|A_ISAdmin|'
141
+ r'A_IsCompiled|A_IsCritical|A_IsPaused|A_IsSuspended|A_KeyDelay|'
142
+ r'A_Language|A_LastError|A_LineFile|A_LineNumber|A_LoopField|'
143
+ r'A_LoopFileAttrib|A_LoopFileDir|A_LoopFileExt|A_LoopFileFullPath|'
144
+ r'A_LoopFileLongPath|A_LoopFileName|A_LoopFileShortName|'
145
+ r'A_LoopFileShortPath|A_LoopFileSize|A_LoopFileSizeKB|'
146
+ r'A_LoopFileSizeMB|A_LoopFileTimeAccessed|A_LoopFileTimeCreated|'
147
+ r'A_LoopFileTimeModified|A_LoopReadLine|A_LoopRegKey|'
148
+ r'A_LoopRegName|A_LoopRegSubkey|A_LoopRegTimeModified|'
149
+ r'A_LoopRegType|A_MDAY|A_Min|A_MM|A_MMM|A_MMMM|A_Mon|A_MouseDelay|'
150
+ r'A_MSec|A_MyDocuments|A_Now|A_NowUTC|A_NumBatchLines|A_OSType|'
151
+ r'A_OSVersion|A_PriorHotkey|A_ProgramFiles|A_Programs|'
152
+ r'A_ProgramsCommon|A_ScreenHeight|A_ScreenWidth|A_ScriptDir|'
153
+ r'A_ScriptFullPath|A_ScriptName|A_Sec|A_Space|A_StartMenu|'
154
+ r'A_StartMenuCommon|A_Startup|A_StartupCommon|A_StringCaseSense|'
155
+ r'A_Tab|A_Temp|A_ThisFunc|A_ThisHotkey|A_ThisLabel|A_ThisMenu|'
156
+ r'A_ThisMenuItem|A_ThisMenuItemPos|A_TickCount|A_TimeIdle|'
157
+ r'A_TimeIdlePhysical|A_TimeSincePriorHotkey|A_TimeSinceThisHotkey|'
158
+ r'A_TitleMatchMode|A_TitleMatchModeSpeed|A_UserName|A_WDay|'
159
+ r'A_WinDelay|A_WinDir|A_WorkingDir|A_YDay|A_YEAR|A_YWeek|A_YYYY|'
160
+ r'Clipboard|ClipboardAll|ComSpec|ErrorLevel|ProgramFiles|True|'
161
+ r'False|A_IsUnicode|A_FileEncoding|A_OSVersion|A_PtrSize)\b',
162
+ Name.Variable),
163
+ ],
164
+ 'labels': [
165
+ # hotkeys and labels
166
+ # technically, hotkey names are limited to named keys and buttons
167
+ (r'(^\s*)([^:\s("]+?:{1,2})', bygroups(Text, Name.Label)),
168
+ (r'(^\s*)(::[^:\s]+?::)', bygroups(Text, Name.Label)),
169
+ ],
170
+ 'numbers': [
171
+ (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
172
+ (r'\d+[eE][+-]?[0-9]+', Number.Float),
173
+ (r'0\d+', Number.Oct),
174
+ (r'0[xX][a-fA-F0-9]+', Number.Hex),
175
+ (r'\d+L', Number.Integer.Long),
176
+ (r'\d+', Number.Integer)
177
+ ],
178
+ 'stringescape': [
179
+ (r'\"\"|\`([,%`abfnrtv])', String.Escape),
180
+ ],
181
+ 'strings': [
182
+ (r'[^"\n]+', String),
183
+ ],
184
+ 'dqs': [
185
+ (r'"', String, '#pop'),
186
+ include('strings')
187
+ ],
188
+ 'garbage': [
189
+ (r'[^\S\n]', Text),
190
+ # (r'.', Text), # no cheating
191
+ ],
192
+ }
193
+
194
+
195
+ class AutoItLexer(RegexLexer):
196
+ """
197
+ For AutoIt files.
198
+
199
+ AutoIt is a freeware BASIC-like scripting language
200
+ designed for automating the Windows GUI and general scripting
201
+ """
202
+ name = 'AutoIt'
203
+ url = 'http://www.autoitscript.com/site/autoit/'
204
+ aliases = ['autoit']
205
+ filenames = ['*.au3']
206
+ mimetypes = ['text/x-autoit']
207
+ version_added = '1.6'
208
+
209
+ # Keywords, functions, macros from au3.keywords.properties
210
+ # which can be found in AutoIt installed directory, e.g.
211
+ # c:\Program Files (x86)\AutoIt3\SciTE\au3.keywords.properties
212
+
213
+ keywords = """\
214
+ #include-once #include #endregion #forcedef #forceref #region
215
+ and byref case continueloop dim do else elseif endfunc endif
216
+ endselect exit exitloop for func global
217
+ if local next not or return select step
218
+ then to until wend while exit""".split()
219
+
220
+ functions = """\
221
+ abs acos adlibregister adlibunregister asc ascw asin assign atan
222
+ autoitsetoption autoitwingettitle autoitwinsettitle beep binary binarylen
223
+ binarymid binarytostring bitand bitnot bitor bitrotate bitshift bitxor
224
+ blockinput break call cdtray ceiling chr chrw clipget clipput consoleread
225
+ consolewrite consolewriteerror controlclick controlcommand controldisable
226
+ controlenable controlfocus controlgetfocus controlgethandle controlgetpos
227
+ controlgettext controlhide controllistview controlmove controlsend
228
+ controlsettext controlshow controltreeview cos dec dircopy dircreate
229
+ dirgetsize dirmove dirremove dllcall dllcalladdress dllcallbackfree
230
+ dllcallbackgetptr dllcallbackregister dllclose dllopen dllstructcreate
231
+ dllstructgetdata dllstructgetptr dllstructgetsize dllstructsetdata
232
+ drivegetdrive drivegetfilesystem drivegetlabel drivegetserial drivegettype
233
+ drivemapadd drivemapdel drivemapget drivesetlabel drivespacefree
234
+ drivespacetotal drivestatus envget envset envupdate eval execute exp
235
+ filechangedir fileclose filecopy filecreatentfslink filecreateshortcut
236
+ filedelete fileexists filefindfirstfile filefindnextfile fileflush
237
+ filegetattrib filegetencoding filegetlongname filegetpos filegetshortcut
238
+ filegetshortname filegetsize filegettime filegetversion fileinstall filemove
239
+ fileopen fileopendialog fileread filereadline filerecycle filerecycleempty
240
+ filesavedialog fileselectfolder filesetattrib filesetpos filesettime
241
+ filewrite filewriteline floor ftpsetproxy guicreate guictrlcreateavi
242
+ guictrlcreatebutton guictrlcreatecheckbox guictrlcreatecombo
243
+ guictrlcreatecontextmenu guictrlcreatedate guictrlcreatedummy
244
+ guictrlcreateedit guictrlcreategraphic guictrlcreategroup guictrlcreateicon
245
+ guictrlcreateinput guictrlcreatelabel guictrlcreatelist
246
+ guictrlcreatelistview guictrlcreatelistviewitem guictrlcreatemenu
247
+ guictrlcreatemenuitem guictrlcreatemonthcal guictrlcreateobj
248
+ guictrlcreatepic guictrlcreateprogress guictrlcreateradio
249
+ guictrlcreateslider guictrlcreatetab guictrlcreatetabitem
250
+ guictrlcreatetreeview guictrlcreatetreeviewitem guictrlcreateupdown
251
+ guictrldelete guictrlgethandle guictrlgetstate guictrlread guictrlrecvmsg
252
+ guictrlregisterlistviewsort guictrlsendmsg guictrlsendtodummy
253
+ guictrlsetbkcolor guictrlsetcolor guictrlsetcursor guictrlsetdata
254
+ guictrlsetdefbkcolor guictrlsetdefcolor guictrlsetfont guictrlsetgraphic
255
+ guictrlsetimage guictrlsetlimit guictrlsetonevent guictrlsetpos
256
+ guictrlsetresizing guictrlsetstate guictrlsetstyle guictrlsettip guidelete
257
+ guigetcursorinfo guigetmsg guigetstyle guiregistermsg guisetaccelerators
258
+ guisetbkcolor guisetcoord guisetcursor guisetfont guisethelp guiseticon
259
+ guisetonevent guisetstate guisetstyle guistartgroup guiswitch hex hotkeyset
260
+ httpsetproxy httpsetuseragent hwnd inetclose inetget inetgetinfo inetgetsize
261
+ inetread inidelete iniread inireadsection inireadsectionnames
262
+ inirenamesection iniwrite iniwritesection inputbox int isadmin isarray
263
+ isbinary isbool isdeclared isdllstruct isfloat ishwnd isint iskeyword
264
+ isnumber isobj isptr isstring log memgetstats mod mouseclick mouseclickdrag
265
+ mousedown mousegetcursor mousegetpos mousemove mouseup mousewheel msgbox
266
+ number objcreate objcreateinterface objevent objevent objget objname
267
+ onautoitexitregister onautoitexitunregister opt ping pixelchecksum
268
+ pixelgetcolor pixelsearch pluginclose pluginopen processclose processexists
269
+ processgetstats processlist processsetpriority processwait processwaitclose
270
+ progressoff progresson progressset ptr random regdelete regenumkey
271
+ regenumval regread regwrite round run runas runaswait runwait send
272
+ sendkeepactive seterror setextended shellexecute shellexecutewait shutdown
273
+ sin sleep soundplay soundsetwavevolume splashimageon splashoff splashtexton
274
+ sqrt srandom statusbargettext stderrread stdinwrite stdioclose stdoutread
275
+ string stringaddcr stringcompare stringformat stringfromasciiarray
276
+ stringinstr stringisalnum stringisalpha stringisascii stringisdigit
277
+ stringisfloat stringisint stringislower stringisspace stringisupper
278
+ stringisxdigit stringleft stringlen stringlower stringmid stringregexp
279
+ stringregexpreplace stringreplace stringright stringsplit stringstripcr
280
+ stringstripws stringtoasciiarray stringtobinary stringtrimleft
281
+ stringtrimright stringupper tan tcpaccept tcpclosesocket tcpconnect
282
+ tcplisten tcpnametoip tcprecv tcpsend tcpshutdown tcpstartup timerdiff
283
+ timerinit tooltip traycreateitem traycreatemenu traygetmsg trayitemdelete
284
+ trayitemgethandle trayitemgetstate trayitemgettext trayitemsetonevent
285
+ trayitemsetstate trayitemsettext traysetclick trayseticon traysetonevent
286
+ traysetpauseicon traysetstate traysettooltip traytip ubound udpbind
287
+ udpclosesocket udpopen udprecv udpsend udpshutdown udpstartup vargettype
288
+ winactivate winactive winclose winexists winflash wingetcaretpos
289
+ wingetclasslist wingetclientsize wingethandle wingetpos wingetprocess
290
+ wingetstate wingettext wingettitle winkill winlist winmenuselectitem
291
+ winminimizeall winminimizeallundo winmove winsetontop winsetstate
292
+ winsettitle winsettrans winwait winwaitactive winwaitclose
293
+ winwaitnotactive""".split()
294
+
295
+ macros = """\
296
+ @appdatacommondir @appdatadir @autoitexe @autoitpid @autoitversion
297
+ @autoitx64 @com_eventobj @commonfilesdir @compiled @computername @comspec
298
+ @cpuarch @cr @crlf @desktopcommondir @desktopdepth @desktopdir
299
+ @desktopheight @desktoprefresh @desktopwidth @documentscommondir @error
300
+ @exitcode @exitmethod @extended @favoritescommondir @favoritesdir
301
+ @gui_ctrlhandle @gui_ctrlid @gui_dragfile @gui_dragid @gui_dropid
302
+ @gui_winhandle @homedrive @homepath @homeshare @hotkeypressed @hour
303
+ @ipaddress1 @ipaddress2 @ipaddress3 @ipaddress4 @kblayout @lf
304
+ @logondnsdomain @logondomain @logonserver @mday @min @mon @msec @muilang
305
+ @mydocumentsdir @numparams @osarch @osbuild @oslang @osservicepack @ostype
306
+ @osversion @programfilesdir @programscommondir @programsdir @scriptdir
307
+ @scriptfullpath @scriptlinenumber @scriptname @sec @startmenucommondir
308
+ @startmenudir @startupcommondir @startupdir @sw_disable @sw_enable @sw_hide
309
+ @sw_lock @sw_maximize @sw_minimize @sw_restore @sw_show @sw_showdefault
310
+ @sw_showmaximized @sw_showminimized @sw_showminnoactive @sw_showna
311
+ @sw_shownoactivate @sw_shownormal @sw_unlock @systemdir @tab @tempdir
312
+ @tray_id @trayiconflashing @trayiconvisible @username @userprofiledir @wday
313
+ @windowsdir @workingdir @yday @year""".split()
314
+
315
+ tokens = {
316
+ 'root': [
317
+ (r';.*\n', Comment.Single),
318
+ (r'(#comments-start|#cs)[\s\S]*?(#comments-end|#ce)',
319
+ Comment.Multiline),
320
+ (r'[\[\]{}(),;]', Punctuation),
321
+ (r'(and|or|not)\b', Operator.Word),
322
+ (r'[$|@][a-zA-Z_]\w*', Name.Variable),
323
+ (r'!=|==|:=|\.=|<<|>>|[-~+/*%=<>&^|?:!.]', Operator),
324
+ include('commands'),
325
+ include('labels'),
326
+ include('builtInFunctions'),
327
+ include('builtInMarcros'),
328
+ (r'"', String, combined('stringescape', 'dqs')),
329
+ (r"'", String, 'sqs'),
330
+ include('numbers'),
331
+ (r'[a-zA-Z_#@$][\w#@$]*', Name),
332
+ (r'\\|\'', Text),
333
+ (r'\`([,%`abfnrtv\-+;])', String.Escape),
334
+ (r'_\n', Text), # Line continuation
335
+ include('garbage'),
336
+ ],
337
+ 'commands': [
338
+ (r'(?i)(\s*)({})\b'.format('|'.join(keywords)),
339
+ bygroups(Text, Name.Builtin)),
340
+ ],
341
+ 'builtInFunctions': [
342
+ (r'(?i)({})\b'.format('|'.join(functions)),
343
+ Name.Function),
344
+ ],
345
+ 'builtInMarcros': [
346
+ (r'(?i)({})\b'.format('|'.join(macros)),
347
+ Name.Variable.Global),
348
+ ],
349
+ 'labels': [
350
+ # sendkeys
351
+ (r'(^\s*)(\{\S+?\})', bygroups(Text, Name.Label)),
352
+ ],
353
+ 'numbers': [
354
+ (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
355
+ (r'\d+[eE][+-]?[0-9]+', Number.Float),
356
+ (r'0\d+', Number.Oct),
357
+ (r'0[xX][a-fA-F0-9]+', Number.Hex),
358
+ (r'\d+L', Number.Integer.Long),
359
+ (r'\d+', Number.Integer)
360
+ ],
361
+ 'stringescape': [
362
+ (r'\"\"|\`([,%`abfnrtv])', String.Escape),
363
+ ],
364
+ 'strings': [
365
+ (r'[^"\n]+', String),
366
+ ],
367
+ 'dqs': [
368
+ (r'"', String, '#pop'),
369
+ include('strings')
370
+ ],
371
+ 'sqs': [
372
+ (r'\'\'|\`([,%`abfnrtv])', String.Escape),
373
+ (r"'", String, '#pop'),
374
+ (r"[^'\n]+", String)
375
+ ],
376
+ 'garbage': [
377
+ (r'[^\S\n]', Text),
378
+ ],
379
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/bare.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.bare
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the BARE schema.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words, bygroups
12
+ from pygments.token import Text, Comment, Keyword, Name, Literal, Whitespace
13
+
14
+ __all__ = ['BareLexer']
15
+
16
+
17
+ class BareLexer(RegexLexer):
18
+ """
19
+ For BARE schema source.
20
+ """
21
+ name = 'BARE'
22
+ url = 'https://baremessages.org'
23
+ filenames = ['*.bare']
24
+ aliases = ['bare']
25
+ version_added = '2.7'
26
+
27
+ keywords = [
28
+ 'type',
29
+ 'enum',
30
+ 'u8',
31
+ 'u16',
32
+ 'u32',
33
+ 'u64',
34
+ 'uint',
35
+ 'i8',
36
+ 'i16',
37
+ 'i32',
38
+ 'i64',
39
+ 'int',
40
+ 'f32',
41
+ 'f64',
42
+ 'bool',
43
+ 'void',
44
+ 'data',
45
+ 'string',
46
+ 'optional',
47
+ 'map',
48
+ ]
49
+
50
+ tokens = {
51
+ 'root': [
52
+ (r'(type)(\s+)([A-Z][a-zA-Z0-9]+)(\s+)(\{)',
53
+ bygroups(Keyword, Whitespace, Name.Class, Whitespace, Text), 'struct'),
54
+ (r'(type)(\s+)([A-Z][a-zA-Z0-9]+)(\s+)(\()',
55
+ bygroups(Keyword, Whitespace, Name.Class, Whitespace, Text), 'union'),
56
+ (r'(type)(\s+)([A-Z][a-zA-Z0-9]+)(\s+)',
57
+ bygroups(Keyword, Whitespace, Name, Whitespace), 'typedef'),
58
+ (r'(enum)(\s+)([A-Z][a-zA-Z0-9]+)(\s+\{)',
59
+ bygroups(Keyword, Whitespace, Name.Class, Whitespace), 'enum'),
60
+ (r'#.*?$', Comment),
61
+ (r'\s+', Whitespace),
62
+ ],
63
+ 'struct': [
64
+ (r'\{', Text, '#push'),
65
+ (r'\}', Text, '#pop'),
66
+ (r'([a-zA-Z0-9]+)(:)(\s*)',
67
+ bygroups(Name.Attribute, Text, Whitespace), 'typedef'),
68
+ (r'\s+', Whitespace),
69
+ ],
70
+ 'union': [
71
+ (r'\)', Text, '#pop'),
72
+ (r'(\s*)(\|)(\s*)', bygroups(Whitespace, Text, Whitespace)),
73
+ (r'[A-Z][a-zA-Z0-9]+', Name.Class),
74
+ (words(keywords), Keyword),
75
+ (r'\s+', Whitespace),
76
+ ],
77
+ 'typedef': [
78
+ (r'\[\]', Text),
79
+ (r'#.*?$', Comment, '#pop'),
80
+ (r'(\[)(\d+)(\])', bygroups(Text, Literal, Text)),
81
+ (r'<|>', Text),
82
+ (r'\(', Text, 'union'),
83
+ (r'(\[)([a-z][a-z-A-Z0-9]+)(\])', bygroups(Text, Keyword, Text)),
84
+ (r'(\[)([A-Z][a-z-A-Z0-9]+)(\])', bygroups(Text, Name.Class, Text)),
85
+ (r'([A-Z][a-z-A-Z0-9]+)', Name.Class),
86
+ (words(keywords), Keyword),
87
+ (r'\n', Text, '#pop'),
88
+ (r'\{', Text, 'struct'),
89
+ (r'\s+', Whitespace),
90
+ (r'\d+', Literal),
91
+ ],
92
+ 'enum': [
93
+ (r'\{', Text, '#push'),
94
+ (r'\}', Text, '#pop'),
95
+ (r'([A-Z][A-Z0-9_]*)(\s*=\s*)(\d+)',
96
+ bygroups(Name.Attribute, Text, Literal)),
97
+ (r'([A-Z][A-Z0-9_]*)', bygroups(Name.Attribute)),
98
+ (r'#.*?$', Comment),
99
+ (r'\s+', Whitespace),
100
+ ],
101
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/basic.py ADDED
@@ -0,0 +1,655 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.basic
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for BASIC like languages (other than VB.net).
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, bygroups, default, words, include
14
+ from pygments.token import Comment, Error, Keyword, Name, Number, \
15
+ Punctuation, Operator, String, Text, Whitespace
16
+ from pygments.lexers import _vbscript_builtins
17
+
18
+
19
+ __all__ = ['BlitzBasicLexer', 'BlitzMaxLexer', 'MonkeyLexer', 'CbmBasicV2Lexer',
20
+ 'QBasicLexer', 'VBScriptLexer', 'BBCBasicLexer']
21
+
22
+
23
+ class BlitzMaxLexer(RegexLexer):
24
+ """
25
+ For BlitzMax source code.
26
+ """
27
+
28
+ name = 'BlitzMax'
29
+ url = 'http://blitzbasic.com'
30
+ aliases = ['blitzmax', 'bmax']
31
+ filenames = ['*.bmx']
32
+ mimetypes = ['text/x-bmx']
33
+ version_added = '1.4'
34
+
35
+ bmax_vopwords = r'\b(Shl|Shr|Sar|Mod)\b'
36
+ bmax_sktypes = r'@{1,2}|[!#$%]'
37
+ bmax_lktypes = r'\b(Int|Byte|Short|Float|Double|Long)\b'
38
+ bmax_name = r'[a-z_]\w*'
39
+ bmax_var = (rf'({bmax_name})(?:(?:([ \t]*)({bmax_sktypes})|([ \t]*:[ \t]*\b(?:Shl|Shr|Sar|Mod)\b)'
40
+ rf'|([ \t]*)(:)([ \t]*)(?:{bmax_lktypes}|({bmax_name})))(?:([ \t]*)(Ptr))?)')
41
+ bmax_func = bmax_var + r'?((?:[ \t]|\.\.\n)*)([(])'
42
+
43
+ flags = re.MULTILINE | re.IGNORECASE
44
+ tokens = {
45
+ 'root': [
46
+ # Text
47
+ (r'\s+', Whitespace),
48
+ (r'(\.\.)(\n)', bygroups(Text, Whitespace)), # Line continuation
49
+ # Comments
50
+ (r"'.*?\n", Comment.Single),
51
+ (r'([ \t]*)\bRem\n[\s\S]*?\s*\bEnd([ \t]*)Rem', Comment.Multiline),
52
+ # Data types
53
+ ('"', String.Double, 'string'),
54
+ # Numbers
55
+ (r'[0-9]+\.[0-9]*(?!\.)', Number.Float),
56
+ (r'\.[0-9]*(?!\.)', Number.Float),
57
+ (r'[0-9]+', Number.Integer),
58
+ (r'\$[0-9a-f]+', Number.Hex),
59
+ (r'\%[10]+', Number.Bin),
60
+ # Other
61
+ (rf'(?:(?:(:)?([ \t]*)(:?{bmax_vopwords}|([+\-*/&|~]))|Or|And|Not|[=<>^]))', Operator),
62
+ (r'[(),.:\[\]]', Punctuation),
63
+ (r'(?:#[\w \t]*)', Name.Label),
64
+ (r'(?:\?[\w \t]*)', Comment.Preproc),
65
+ # Identifiers
66
+ (rf'\b(New)\b([ \t]?)([(]?)({bmax_name})',
67
+ bygroups(Keyword.Reserved, Whitespace, Punctuation, Name.Class)),
68
+ (rf'\b(Import|Framework|Module)([ \t]+)({bmax_name}\.{bmax_name})',
69
+ bygroups(Keyword.Reserved, Whitespace, Keyword.Namespace)),
70
+ (bmax_func, bygroups(Name.Function, Whitespace, Keyword.Type,
71
+ Operator, Whitespace, Punctuation, Whitespace,
72
+ Keyword.Type, Name.Class, Whitespace,
73
+ Keyword.Type, Whitespace, Punctuation)),
74
+ (bmax_var, bygroups(Name.Variable, Whitespace, Keyword.Type, Operator,
75
+ Whitespace, Punctuation, Whitespace, Keyword.Type,
76
+ Name.Class, Whitespace, Keyword.Type)),
77
+ (rf'\b(Type|Extends)([ \t]+)({bmax_name})',
78
+ bygroups(Keyword.Reserved, Whitespace, Name.Class)),
79
+ # Keywords
80
+ (r'\b(Ptr)\b', Keyword.Type),
81
+ (r'\b(Pi|True|False|Null|Self|Super)\b', Keyword.Constant),
82
+ (r'\b(Local|Global|Const|Field)\b', Keyword.Declaration),
83
+ (words((
84
+ 'TNullMethodException', 'TNullFunctionException',
85
+ 'TNullObjectException', 'TArrayBoundsException',
86
+ 'TRuntimeException'), prefix=r'\b', suffix=r'\b'), Name.Exception),
87
+ (words((
88
+ 'Strict', 'SuperStrict', 'Module', 'ModuleInfo',
89
+ 'End', 'Return', 'Continue', 'Exit', 'Public', 'Private',
90
+ 'Var', 'VarPtr', 'Chr', 'Len', 'Asc', 'SizeOf', 'Sgn', 'Abs', 'Min', 'Max',
91
+ 'New', 'Release', 'Delete', 'Incbin', 'IncbinPtr', 'IncbinLen',
92
+ 'Framework', 'Include', 'Import', 'Extern', 'EndExtern',
93
+ 'Function', 'EndFunction', 'Type', 'EndType', 'Extends', 'Method', 'EndMethod',
94
+ 'Abstract', 'Final', 'If', 'Then', 'Else', 'ElseIf', 'EndIf',
95
+ 'For', 'To', 'Next', 'Step', 'EachIn', 'While', 'Wend', 'EndWhile',
96
+ 'Repeat', 'Until', 'Forever', 'Select', 'Case', 'Default', 'EndSelect',
97
+ 'Try', 'Catch', 'EndTry', 'Throw', 'Assert', 'Goto', 'DefData', 'ReadData',
98
+ 'RestoreData'), prefix=r'\b', suffix=r'\b'),
99
+ Keyword.Reserved),
100
+ # Final resolve (for variable names and such)
101
+ (rf'({bmax_name})', Name.Variable),
102
+ ],
103
+ 'string': [
104
+ (r'""', String.Double),
105
+ (r'"C?', String.Double, '#pop'),
106
+ (r'[^"]+', String.Double),
107
+ ],
108
+ }
109
+
110
+
111
+ class BlitzBasicLexer(RegexLexer):
112
+ """
113
+ For BlitzBasic source code.
114
+ """
115
+
116
+ name = 'BlitzBasic'
117
+ url = 'http://blitzbasic.com'
118
+ aliases = ['blitzbasic', 'b3d', 'bplus']
119
+ filenames = ['*.bb', '*.decls']
120
+ mimetypes = ['text/x-bb']
121
+ version_added = '2.0'
122
+
123
+ bb_sktypes = r'@{1,2}|[#$%]'
124
+ bb_name = r'[a-z]\w*'
125
+ bb_var = (rf'({bb_name})(?:([ \t]*)({bb_sktypes})|([ \t]*)([.])([ \t]*)(?:({bb_name})))?')
126
+
127
+ flags = re.MULTILINE | re.IGNORECASE
128
+ tokens = {
129
+ 'root': [
130
+ # Text
131
+ (r'\s+', Whitespace),
132
+ # Comments
133
+ (r";.*?\n", Comment.Single),
134
+ # Data types
135
+ ('"', String.Double, 'string'),
136
+ # Numbers
137
+ (r'[0-9]+\.[0-9]*(?!\.)', Number.Float),
138
+ (r'\.[0-9]+(?!\.)', Number.Float),
139
+ (r'[0-9]+', Number.Integer),
140
+ (r'\$[0-9a-f]+', Number.Hex),
141
+ (r'\%[10]+', Number.Bin),
142
+ # Other
143
+ (words(('Shl', 'Shr', 'Sar', 'Mod', 'Or', 'And', 'Not',
144
+ 'Abs', 'Sgn', 'Handle', 'Int', 'Float', 'Str',
145
+ 'First', 'Last', 'Before', 'After'),
146
+ prefix=r'\b', suffix=r'\b'),
147
+ Operator),
148
+ (r'([+\-*/~=<>^])', Operator),
149
+ (r'[(),:\[\]\\]', Punctuation),
150
+ (rf'\.([ \t]*)({bb_name})', Name.Label),
151
+ # Identifiers
152
+ (rf'\b(New)\b([ \t]+)({bb_name})',
153
+ bygroups(Keyword.Reserved, Whitespace, Name.Class)),
154
+ (rf'\b(Gosub|Goto)\b([ \t]+)({bb_name})',
155
+ bygroups(Keyword.Reserved, Whitespace, Name.Label)),
156
+ (rf'\b(Object)\b([ \t]*)([.])([ \t]*)({bb_name})\b',
157
+ bygroups(Operator, Whitespace, Punctuation, Whitespace, Name.Class)),
158
+ (rf'\b{bb_var}\b([ \t]*)(\()',
159
+ bygroups(Name.Function, Whitespace, Keyword.Type, Whitespace, Punctuation,
160
+ Whitespace, Name.Class, Whitespace, Punctuation)),
161
+ (rf'\b(Function)\b([ \t]+){bb_var}',
162
+ bygroups(Keyword.Reserved, Whitespace, Name.Function, Whitespace, Keyword.Type,
163
+ Whitespace, Punctuation, Whitespace, Name.Class)),
164
+ (rf'\b(Type)([ \t]+)({bb_name})',
165
+ bygroups(Keyword.Reserved, Whitespace, Name.Class)),
166
+ # Keywords
167
+ (r'\b(Pi|True|False|Null)\b', Keyword.Constant),
168
+ (r'\b(Local|Global|Const|Field|Dim)\b', Keyword.Declaration),
169
+ (words((
170
+ 'End', 'Return', 'Exit', 'Chr', 'Len', 'Asc', 'New', 'Delete', 'Insert',
171
+ 'Include', 'Function', 'Type', 'If', 'Then', 'Else', 'ElseIf', 'EndIf',
172
+ 'For', 'To', 'Next', 'Step', 'Each', 'While', 'Wend',
173
+ 'Repeat', 'Until', 'Forever', 'Select', 'Case', 'Default',
174
+ 'Goto', 'Gosub', 'Data', 'Read', 'Restore'), prefix=r'\b', suffix=r'\b'),
175
+ Keyword.Reserved),
176
+ # Final resolve (for variable names and such)
177
+ # (r'(%s)' % (bb_name), Name.Variable),
178
+ (bb_var, bygroups(Name.Variable, Whitespace, Keyword.Type,
179
+ Whitespace, Punctuation, Whitespace, Name.Class)),
180
+ ],
181
+ 'string': [
182
+ (r'""', String.Double),
183
+ (r'"C?', String.Double, '#pop'),
184
+ (r'[^"\n]+', String.Double),
185
+ ],
186
+ }
187
+
188
+
189
+ class MonkeyLexer(RegexLexer):
190
+ """
191
+ For Monkey source code.
192
+ """
193
+
194
+ name = 'Monkey'
195
+ aliases = ['monkey']
196
+ filenames = ['*.monkey']
197
+ mimetypes = ['text/x-monkey']
198
+ url = 'https://blitzresearch.itch.io/monkeyx'
199
+ version_added = '1.6'
200
+
201
+ name_variable = r'[a-z_]\w*'
202
+ name_function = r'[A-Z]\w*'
203
+ name_constant = r'[A-Z_][A-Z0-9_]*'
204
+ name_class = r'[A-Z]\w*'
205
+ name_module = r'[a-z0-9_]*'
206
+
207
+ keyword_type = r'(?:Int|Float|String|Bool|Object|Array|Void)'
208
+ # ? == Bool // % == Int // # == Float // $ == String
209
+ keyword_type_special = r'[?%#$]'
210
+
211
+ flags = re.MULTILINE
212
+
213
+ tokens = {
214
+ 'root': [
215
+ # Text
216
+ (r'\s+', Whitespace),
217
+ # Comments
218
+ (r"'.*", Comment),
219
+ (r'(?i)^#rem\b', Comment.Multiline, 'comment'),
220
+ # preprocessor directives
221
+ (r'(?i)^(?:#If|#ElseIf|#Else|#EndIf|#End|#Print|#Error)\b', Comment.Preproc),
222
+ # preprocessor variable (any line starting with '#' that is not a directive)
223
+ (r'^#', Comment.Preproc, 'variables'),
224
+ # String
225
+ ('"', String.Double, 'string'),
226
+ # Numbers
227
+ (r'[0-9]+\.[0-9]*(?!\.)', Number.Float),
228
+ (r'\.[0-9]+(?!\.)', Number.Float),
229
+ (r'[0-9]+', Number.Integer),
230
+ (r'\$[0-9a-fA-Z]+', Number.Hex),
231
+ (r'\%[10]+', Number.Bin),
232
+ # Native data types
233
+ (rf'\b{keyword_type}\b', Keyword.Type),
234
+ # Exception handling
235
+ (r'(?i)\b(?:Try|Catch|Throw)\b', Keyword.Reserved),
236
+ (r'Throwable', Name.Exception),
237
+ # Builtins
238
+ (r'(?i)\b(?:Null|True|False)\b', Name.Builtin),
239
+ (r'(?i)\b(?:Self|Super)\b', Name.Builtin.Pseudo),
240
+ (r'\b(?:HOST|LANG|TARGET|CONFIG)\b', Name.Constant),
241
+ # Keywords
242
+ (r'(?i)^(Import)(\s+)(.*)(\n)',
243
+ bygroups(Keyword.Namespace, Whitespace, Name.Namespace, Whitespace)),
244
+ (r'(?i)^Strict\b.*\n', Keyword.Reserved),
245
+ (r'(?i)(Const|Local|Global|Field)(\s+)',
246
+ bygroups(Keyword.Declaration, Whitespace), 'variables'),
247
+ (r'(?i)(New|Class|Interface|Extends|Implements)(\s+)',
248
+ bygroups(Keyword.Reserved, Whitespace), 'classname'),
249
+ (r'(?i)(Function|Method)(\s+)',
250
+ bygroups(Keyword.Reserved, Whitespace), 'funcname'),
251
+ (r'(?i)(?:End|Return|Public|Private|Extern|Property|'
252
+ r'Final|Abstract)\b', Keyword.Reserved),
253
+ # Flow Control stuff
254
+ (r'(?i)(?:If|Then|Else|ElseIf|EndIf|'
255
+ r'Select|Case|Default|'
256
+ r'While|Wend|'
257
+ r'Repeat|Until|Forever|'
258
+ r'For|To|Until|Step|EachIn|Next|'
259
+ r'Exit|Continue)(?=\s)', Keyword.Reserved),
260
+ # not used yet
261
+ (r'(?i)\b(?:Module|Inline)\b', Keyword.Reserved),
262
+ # Array
263
+ (r'[\[\]]', Punctuation),
264
+ # Other
265
+ (r'<=|>=|<>|\*=|/=|\+=|-=|&=|~=|\|=|[-&*/^+=<>|~]', Operator),
266
+ (r'(?i)(?:Not|Mod|Shl|Shr|And|Or)', Operator.Word),
267
+ (r'[(){}!#,.:]', Punctuation),
268
+ # catch the rest
269
+ (rf'{name_constant}\b', Name.Constant),
270
+ (rf'{name_function}\b', Name.Function),
271
+ (rf'{name_variable}\b', Name.Variable),
272
+ ],
273
+ 'funcname': [
274
+ (rf'(?i){name_function}\b', Name.Function),
275
+ (r':', Punctuation, 'classname'),
276
+ (r'\s+', Whitespace),
277
+ (r'\(', Punctuation, 'variables'),
278
+ (r'\)', Punctuation, '#pop')
279
+ ],
280
+ 'classname': [
281
+ (rf'{name_module}\.', Name.Namespace),
282
+ (rf'{keyword_type}\b', Keyword.Type),
283
+ (rf'{name_class}\b', Name.Class),
284
+ # array (of given size)
285
+ (r'(\[)(\s*)(\d*)(\s*)(\])',
286
+ bygroups(Punctuation, Whitespace, Number.Integer, Whitespace, Punctuation)),
287
+ # generics
288
+ (r'\s+(?!<)', Whitespace, '#pop'),
289
+ (r'<', Punctuation, '#push'),
290
+ (r'>', Punctuation, '#pop'),
291
+ (r'\n', Whitespace, '#pop'),
292
+ default('#pop')
293
+ ],
294
+ 'variables': [
295
+ (rf'{name_constant}\b', Name.Constant),
296
+ (rf'{name_variable}\b', Name.Variable),
297
+ (rf'{keyword_type_special}', Keyword.Type),
298
+ (r'\s+', Whitespace),
299
+ (r':', Punctuation, 'classname'),
300
+ (r',', Punctuation, '#push'),
301
+ default('#pop')
302
+ ],
303
+ 'string': [
304
+ (r'[^"~]+', String.Double),
305
+ (r'~q|~n|~r|~t|~z|~~', String.Escape),
306
+ (r'"', String.Double, '#pop'),
307
+ ],
308
+ 'comment': [
309
+ (r'(?i)^#rem.*?', Comment.Multiline, "#push"),
310
+ (r'(?i)^#end.*?', Comment.Multiline, "#pop"),
311
+ (r'\n', Comment.Multiline),
312
+ (r'.+', Comment.Multiline),
313
+ ],
314
+ }
315
+
316
+
317
+ class CbmBasicV2Lexer(RegexLexer):
318
+ """
319
+ For CBM BASIC V2 sources.
320
+ """
321
+ name = 'CBM BASIC V2'
322
+ aliases = ['cbmbas']
323
+ filenames = ['*.bas']
324
+ url = 'https://en.wikipedia.org/wiki/Commodore_BASIC'
325
+ version_added = '1.6'
326
+
327
+ flags = re.IGNORECASE
328
+
329
+ tokens = {
330
+ 'root': [
331
+ (r'rem.*\n', Comment.Single),
332
+ (r'\s+', Whitespace),
333
+ (r'new|run|end|for|to|next|step|go(to|sub)?|on|return|stop|cont'
334
+ r'|if|then|input#?|read|wait|load|save|verify|poke|sys|print#?'
335
+ r'|list|clr|cmd|open|close|get#?', Keyword.Reserved),
336
+ (r'data|restore|dim|let|def|fn', Keyword.Declaration),
337
+ (r'tab|spc|sgn|int|abs|usr|fre|pos|sqr|rnd|log|exp|cos|sin|tan|atn'
338
+ r'|peek|len|val|asc|(str|chr|left|right|mid)\$', Name.Builtin),
339
+ (r'[-+*/^<>=]', Operator),
340
+ (r'not|and|or', Operator.Word),
341
+ (r'"[^"\n]*.', String),
342
+ (r'\d+|[-+]?\d*\.\d*(e[-+]?\d+)?', Number.Float),
343
+ (r'[(),:;]', Punctuation),
344
+ (r'\w+[$%]?', Name),
345
+ ]
346
+ }
347
+
348
+ def analyse_text(text):
349
+ # if it starts with a line number, it shouldn't be a "modern" Basic
350
+ # like VB.net
351
+ if re.match(r'^\d+', text):
352
+ return 0.2
353
+
354
+
355
+ class QBasicLexer(RegexLexer):
356
+ """
357
+ For QBasic source code.
358
+ """
359
+
360
+ name = 'QBasic'
361
+ aliases = ['qbasic', 'basic']
362
+ filenames = ['*.BAS', '*.bas']
363
+ mimetypes = ['text/basic']
364
+ url = 'https://en.wikipedia.org/wiki/QBasic'
365
+ version_added = '2.0'
366
+
367
+ declarations = ('DATA', 'LET')
368
+
369
+ functions = (
370
+ 'ABS', 'ASC', 'ATN', 'CDBL', 'CHR$', 'CINT', 'CLNG',
371
+ 'COMMAND$', 'COS', 'CSNG', 'CSRLIN', 'CVD', 'CVDMBF', 'CVI',
372
+ 'CVL', 'CVS', 'CVSMBF', 'DATE$', 'ENVIRON$', 'EOF', 'ERDEV',
373
+ 'ERDEV$', 'ERL', 'ERR', 'EXP', 'FILEATTR', 'FIX', 'FRE',
374
+ 'FREEFILE', 'HEX$', 'INKEY$', 'INP', 'INPUT$', 'INSTR', 'INT',
375
+ 'IOCTL$', 'LBOUND', 'LCASE$', 'LEFT$', 'LEN', 'LOC', 'LOF',
376
+ 'LOG', 'LPOS', 'LTRIM$', 'MID$', 'MKD$', 'MKDMBF$', 'MKI$',
377
+ 'MKL$', 'MKS$', 'MKSMBF$', 'OCT$', 'PEEK', 'PEN', 'PLAY',
378
+ 'PMAP', 'POINT', 'POS', 'RIGHT$', 'RND', 'RTRIM$', 'SADD',
379
+ 'SCREEN', 'SEEK', 'SETMEM', 'SGN', 'SIN', 'SPACE$', 'SPC',
380
+ 'SQR', 'STICK', 'STR$', 'STRIG', 'STRING$', 'TAB', 'TAN',
381
+ 'TIME$', 'TIMER', 'UBOUND', 'UCASE$', 'VAL', 'VARPTR',
382
+ 'VARPTR$', 'VARSEG'
383
+ )
384
+
385
+ metacommands = ('$DYNAMIC', '$INCLUDE', '$STATIC')
386
+
387
+ operators = ('AND', 'EQV', 'IMP', 'NOT', 'OR', 'XOR')
388
+
389
+ statements = (
390
+ 'BEEP', 'BLOAD', 'BSAVE', 'CALL', 'CALL ABSOLUTE',
391
+ 'CALL INTERRUPT', 'CALLS', 'CHAIN', 'CHDIR', 'CIRCLE', 'CLEAR',
392
+ 'CLOSE', 'CLS', 'COLOR', 'COM', 'COMMON', 'CONST', 'DATA',
393
+ 'DATE$', 'DECLARE', 'DEF FN', 'DEF SEG', 'DEFDBL', 'DEFINT',
394
+ 'DEFLNG', 'DEFSNG', 'DEFSTR', 'DEF', 'DIM', 'DO', 'LOOP',
395
+ 'DRAW', 'END', 'ENVIRON', 'ERASE', 'ERROR', 'EXIT', 'FIELD',
396
+ 'FILES', 'FOR', 'NEXT', 'FUNCTION', 'GET', 'GOSUB', 'GOTO',
397
+ 'IF', 'THEN', 'INPUT', 'INPUT #', 'IOCTL', 'KEY', 'KEY',
398
+ 'KILL', 'LET', 'LINE', 'LINE INPUT', 'LINE INPUT #', 'LOCATE',
399
+ 'LOCK', 'UNLOCK', 'LPRINT', 'LSET', 'MID$', 'MKDIR', 'NAME',
400
+ 'ON COM', 'ON ERROR', 'ON KEY', 'ON PEN', 'ON PLAY',
401
+ 'ON STRIG', 'ON TIMER', 'ON UEVENT', 'ON', 'OPEN', 'OPEN COM',
402
+ 'OPTION BASE', 'OUT', 'PAINT', 'PALETTE', 'PCOPY', 'PEN',
403
+ 'PLAY', 'POKE', 'PRESET', 'PRINT', 'PRINT #', 'PRINT USING',
404
+ 'PSET', 'PUT', 'PUT', 'RANDOMIZE', 'READ', 'REDIM', 'REM',
405
+ 'RESET', 'RESTORE', 'RESUME', 'RETURN', 'RMDIR', 'RSET', 'RUN',
406
+ 'SCREEN', 'SEEK', 'SELECT CASE', 'SHARED', 'SHELL', 'SLEEP',
407
+ 'SOUND', 'STATIC', 'STOP', 'STRIG', 'SUB', 'SWAP', 'SYSTEM',
408
+ 'TIME$', 'TIMER', 'TROFF', 'TRON', 'TYPE', 'UEVENT', 'UNLOCK',
409
+ 'VIEW', 'WAIT', 'WHILE', 'WEND', 'WIDTH', 'WINDOW', 'WRITE'
410
+ )
411
+
412
+ keywords = (
413
+ 'ACCESS', 'ALIAS', 'ANY', 'APPEND', 'AS', 'BASE', 'BINARY',
414
+ 'BYVAL', 'CASE', 'CDECL', 'DOUBLE', 'ELSE', 'ELSEIF', 'ENDIF',
415
+ 'INTEGER', 'IS', 'LIST', 'LOCAL', 'LONG', 'LOOP', 'MOD',
416
+ 'NEXT', 'OFF', 'ON', 'OUTPUT', 'RANDOM', 'SIGNAL', 'SINGLE',
417
+ 'STEP', 'STRING', 'THEN', 'TO', 'UNTIL', 'USING', 'WEND'
418
+ )
419
+
420
+ tokens = {
421
+ 'root': [
422
+ (r'\n+', Text),
423
+ (r'\s+', Text.Whitespace),
424
+ (r'^(\s*)(\d*)(\s*)(REM .*)$',
425
+ bygroups(Text.Whitespace, Name.Label, Text.Whitespace,
426
+ Comment.Single)),
427
+ (r'^(\s*)(\d+)(\s*)',
428
+ bygroups(Text.Whitespace, Name.Label, Text.Whitespace)),
429
+ (r'(?=[\s]*)(\w+)(?=[\s]*=)', Name.Variable.Global),
430
+ (r'(?=[^"]*)\'.*$', Comment.Single),
431
+ (r'"[^\n"]*"', String.Double),
432
+ (r'(END)(\s+)(FUNCTION|IF|SELECT|SUB)',
433
+ bygroups(Keyword.Reserved, Text.Whitespace, Keyword.Reserved)),
434
+ (r'(DECLARE)(\s+)([A-Z]+)(\s+)(\S+)',
435
+ bygroups(Keyword.Declaration, Text.Whitespace, Name.Variable,
436
+ Text.Whitespace, Name)),
437
+ (r'(DIM)(\s+)(SHARED)(\s+)([^\s(]+)',
438
+ bygroups(Keyword.Declaration, Text.Whitespace, Name.Variable,
439
+ Text.Whitespace, Name.Variable.Global)),
440
+ (r'(DIM)(\s+)([^\s(]+)',
441
+ bygroups(Keyword.Declaration, Text.Whitespace, Name.Variable.Global)),
442
+ (r'^(\s*)([a-zA-Z_]+)(\s*)(\=)',
443
+ bygroups(Text.Whitespace, Name.Variable.Global, Text.Whitespace,
444
+ Operator)),
445
+ (r'(GOTO|GOSUB)(\s+)(\w+\:?)',
446
+ bygroups(Keyword.Reserved, Text.Whitespace, Name.Label)),
447
+ (r'(SUB)(\s+)(\w+\:?)',
448
+ bygroups(Keyword.Reserved, Text.Whitespace, Name.Label)),
449
+ include('declarations'),
450
+ include('functions'),
451
+ include('metacommands'),
452
+ include('operators'),
453
+ include('statements'),
454
+ include('keywords'),
455
+ (r'[a-zA-Z_]\w*[$@#&!]', Name.Variable.Global),
456
+ (r'[a-zA-Z_]\w*\:', Name.Label),
457
+ (r'\-?\d*\.\d+[@|#]?', Number.Float),
458
+ (r'\-?\d+[@|#]', Number.Float),
459
+ (r'\-?\d+#?', Number.Integer.Long),
460
+ (r'!=|==|:=|\.=|<<|>>|[-~+/\\*%=<>&^|?:!.]', Operator),
461
+ (r'[\[\]{}(),;]', Punctuation),
462
+ (r'[\w]+', Name.Variable.Global),
463
+ ],
464
+ # can't use regular \b because of X$()
465
+ # XXX: use words() here
466
+ 'declarations': [
467
+ (r'\b({})(?=\(|\b)'.format('|'.join(map(re.escape, declarations))),
468
+ Keyword.Declaration),
469
+ ],
470
+ 'functions': [
471
+ (r'\b({})(?=\(|\b)'.format('|'.join(map(re.escape, functions))),
472
+ Keyword.Reserved),
473
+ ],
474
+ 'metacommands': [
475
+ (r'\b({})(?=\(|\b)'.format('|'.join(map(re.escape, metacommands))),
476
+ Keyword.Constant),
477
+ ],
478
+ 'operators': [
479
+ (r'\b({})(?=\(|\b)'.format('|'.join(map(re.escape, operators))), Operator.Word),
480
+ ],
481
+ 'statements': [
482
+ (r'\b({})\b'.format('|'.join(map(re.escape, statements))),
483
+ Keyword.Reserved),
484
+ ],
485
+ 'keywords': [
486
+ (r'\b({})\b'.format('|'.join(keywords)), Keyword),
487
+ ],
488
+ }
489
+
490
+ def analyse_text(text):
491
+ if '$DYNAMIC' in text or '$STATIC' in text:
492
+ return 0.9
493
+
494
+
495
+ class VBScriptLexer(RegexLexer):
496
+ """
497
+ VBScript is scripting language that is modeled on Visual Basic.
498
+ """
499
+ name = 'VBScript'
500
+ aliases = ['vbscript']
501
+ filenames = ['*.vbs', '*.VBS']
502
+ url = 'https://learn.microsoft.com/en-us/previous-versions/t0aew7h6(v=vs.85)'
503
+ version_added = '2.4'
504
+
505
+ flags = re.IGNORECASE
506
+
507
+ tokens = {
508
+ 'root': [
509
+ (r"'[^\n]*", Comment.Single),
510
+ (r'\s+', Whitespace),
511
+ ('"', String.Double, 'string'),
512
+ ('&h[0-9a-f]+', Number.Hex),
513
+ # Float variant 1, for example: 1., 1.e2, 1.2e3
514
+ (r'[0-9]+\.[0-9]*(e[+-]?[0-9]+)?', Number.Float),
515
+ (r'\.[0-9]+(e[+-]?[0-9]+)?', Number.Float), # Float variant 2, for example: .1, .1e2
516
+ (r'[0-9]+e[+-]?[0-9]+', Number.Float), # Float variant 3, for example: 123e45
517
+ (r'[0-9]+', Number.Integer),
518
+ ('#.+#', String), # date or time value
519
+ (r'(dim)(\s+)([a-z_][a-z0-9_]*)',
520
+ bygroups(Keyword.Declaration, Whitespace, Name.Variable), 'dim_more'),
521
+ (r'(function|sub)(\s+)([a-z_][a-z0-9_]*)',
522
+ bygroups(Keyword.Declaration, Whitespace, Name.Function)),
523
+ (r'(class)(\s+)([a-z_][a-z0-9_]*)',
524
+ bygroups(Keyword.Declaration, Whitespace, Name.Class)),
525
+ (r'(const)(\s+)([a-z_][a-z0-9_]*)',
526
+ bygroups(Keyword.Declaration, Whitespace, Name.Constant)),
527
+ (r'(end)(\s+)(class|function|if|property|sub|with)',
528
+ bygroups(Keyword, Whitespace, Keyword)),
529
+ (r'(on)(\s+)(error)(\s+)(goto)(\s+)(0)',
530
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword, Whitespace, Number.Integer)),
531
+ (r'(on)(\s+)(error)(\s+)(resume)(\s+)(next)',
532
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword, Whitespace, Keyword)),
533
+ (r'(option)(\s+)(explicit)', bygroups(Keyword, Whitespace, Keyword)),
534
+ (r'(property)(\s+)(get|let|set)(\s+)([a-z_][a-z0-9_]*)',
535
+ bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration, Whitespace, Name.Property)),
536
+ (r'rem\s.*[^\n]*', Comment.Single),
537
+ (words(_vbscript_builtins.KEYWORDS, suffix=r'\b'), Keyword),
538
+ (words(_vbscript_builtins.OPERATORS), Operator),
539
+ (words(_vbscript_builtins.OPERATOR_WORDS, suffix=r'\b'), Operator.Word),
540
+ (words(_vbscript_builtins.BUILTIN_CONSTANTS, suffix=r'\b'), Name.Constant),
541
+ (words(_vbscript_builtins.BUILTIN_FUNCTIONS, suffix=r'\b'), Name.Builtin),
542
+ (words(_vbscript_builtins.BUILTIN_VARIABLES, suffix=r'\b'), Name.Builtin),
543
+ (r'[a-z_][a-z0-9_]*', Name),
544
+ (r'\b_\n', Operator),
545
+ (words(r'(),.:'), Punctuation),
546
+ (r'.+(\n)?', Error)
547
+ ],
548
+ 'dim_more': [
549
+ (r'(\s*)(,)(\s*)([a-z_][a-z0-9]*)',
550
+ bygroups(Whitespace, Punctuation, Whitespace, Name.Variable)),
551
+ default('#pop'),
552
+ ],
553
+ 'string': [
554
+ (r'[^"\n]+', String.Double),
555
+ (r'\"\"', String.Double),
556
+ (r'"', String.Double, '#pop'),
557
+ (r'\n', Error, '#pop'), # Unterminated string
558
+ ],
559
+ }
560
+
561
+
562
+ class BBCBasicLexer(RegexLexer):
563
+ """
564
+ BBC Basic was supplied on the BBC Micro, and later Acorn RISC OS.
565
+ It is also used by BBC Basic For Windows.
566
+ """
567
+ base_keywords = ['OTHERWISE', 'AND', 'DIV', 'EOR', 'MOD', 'OR', 'ERROR',
568
+ 'LINE', 'OFF', 'STEP', 'SPC', 'TAB', 'ELSE', 'THEN',
569
+ 'OPENIN', 'PTR', 'PAGE', 'TIME', 'LOMEM', 'HIMEM', 'ABS',
570
+ 'ACS', 'ADVAL', 'ASC', 'ASN', 'ATN', 'BGET', 'COS', 'COUNT',
571
+ 'DEG', 'ERL', 'ERR', 'EVAL', 'EXP', 'EXT', 'FALSE', 'FN',
572
+ 'GET', 'INKEY', 'INSTR', 'INT', 'LEN', 'LN', 'LOG', 'NOT',
573
+ 'OPENUP', 'OPENOUT', 'PI', 'POINT', 'POS', 'RAD', 'RND',
574
+ 'SGN', 'SIN', 'SQR', 'TAN', 'TO', 'TRUE', 'USR', 'VAL',
575
+ 'VPOS', 'CHR$', 'GET$', 'INKEY$', 'LEFT$', 'MID$',
576
+ 'RIGHT$', 'STR$', 'STRING$', 'EOF', 'PTR', 'PAGE', 'TIME',
577
+ 'LOMEM', 'HIMEM', 'SOUND', 'BPUT', 'CALL', 'CHAIN', 'CLEAR',
578
+ 'CLOSE', 'CLG', 'CLS', 'DATA', 'DEF', 'DIM', 'DRAW', 'END',
579
+ 'ENDPROC', 'ENVELOPE', 'FOR', 'GOSUB', 'GOTO', 'GCOL', 'IF',
580
+ 'INPUT', 'LET', 'LOCAL', 'MODE', 'MOVE', 'NEXT', 'ON',
581
+ 'VDU', 'PLOT', 'PRINT', 'PROC', 'READ', 'REM', 'REPEAT',
582
+ 'REPORT', 'RESTORE', 'RETURN', 'RUN', 'STOP', 'COLOUR',
583
+ 'TRACE', 'UNTIL', 'WIDTH', 'OSCLI']
584
+
585
+ basic5_keywords = ['WHEN', 'OF', 'ENDCASE', 'ENDIF', 'ENDWHILE', 'CASE',
586
+ 'CIRCLE', 'FILL', 'ORIGIN', 'POINT', 'RECTANGLE', 'SWAP',
587
+ 'WHILE', 'WAIT', 'MOUSE', 'QUIT', 'SYS', 'INSTALL',
588
+ 'LIBRARY', 'TINT', 'ELLIPSE', 'BEATS', 'TEMPO', 'VOICES',
589
+ 'VOICE', 'STEREO', 'OVERLAY', 'APPEND', 'AUTO', 'CRUNCH',
590
+ 'DELETE', 'EDIT', 'HELP', 'LIST', 'LOAD', 'LVAR', 'NEW',
591
+ 'OLD', 'RENUMBER', 'SAVE', 'TEXTLOAD', 'TEXTSAVE',
592
+ 'TWIN', 'TWINO', 'INSTALL', 'SUM', 'BEAT']
593
+
594
+
595
+ name = 'BBC Basic'
596
+ aliases = ['bbcbasic']
597
+ filenames = ['*.bbc']
598
+ url = 'https://www.bbcbasic.co.uk/bbcbasic.html'
599
+ version_added = '2.4'
600
+
601
+ tokens = {
602
+ 'root': [
603
+ (r"[0-9]+", Name.Label),
604
+ (r"(\*)([^\n]*)",
605
+ bygroups(Keyword.Pseudo, Comment.Special)),
606
+ default('code'),
607
+ ],
608
+
609
+ 'code': [
610
+ (r"(REM)([^\n]*)",
611
+ bygroups(Keyword.Declaration, Comment.Single)),
612
+ (r'\n', Whitespace, 'root'),
613
+ (r'\s+', Whitespace),
614
+ (r':', Comment.Preproc),
615
+
616
+ # Some special cases to make functions come out nicer
617
+ (r'(DEF)(\s*)(FN|PROC)([A-Za-z_@][\w@]*)',
618
+ bygroups(Keyword.Declaration, Whitespace,
619
+ Keyword.Declaration, Name.Function)),
620
+ (r'(FN|PROC)([A-Za-z_@][\w@]*)',
621
+ bygroups(Keyword, Name.Function)),
622
+
623
+ (r'(GOTO|GOSUB|THEN|RESTORE)(\s*)(\d+)',
624
+ bygroups(Keyword, Whitespace, Name.Label)),
625
+
626
+ (r'(TRUE|FALSE)', Keyword.Constant),
627
+ (r'(PAGE|LOMEM|HIMEM|TIME|WIDTH|ERL|ERR|REPORT\$|POS|VPOS|VOICES)',
628
+ Keyword.Pseudo),
629
+
630
+ (words(base_keywords), Keyword),
631
+ (words(basic5_keywords), Keyword),
632
+
633
+ ('"', String.Double, 'string'),
634
+
635
+ ('%[01]{1,32}', Number.Bin),
636
+ ('&[0-9a-f]{1,8}', Number.Hex),
637
+
638
+ (r'[+-]?[0-9]+\.[0-9]*(E[+-]?[0-9]+)?', Number.Float),
639
+ (r'[+-]?\.[0-9]+(E[+-]?[0-9]+)?', Number.Float),
640
+ (r'[+-]?[0-9]+E[+-]?[0-9]+', Number.Float),
641
+ (r'[+-]?\d+', Number.Integer),
642
+
643
+ (r'([A-Za-z_@][\w@]*[%$]?)', Name.Variable),
644
+ (r'([+\-]=|[$!|?+\-*/%^=><();]|>=|<=|<>|<<|>>|>>>|,)', Operator),
645
+ ],
646
+ 'string': [
647
+ (r'[^"\n]+', String.Double),
648
+ (r'"', String.Double, '#pop'),
649
+ (r'\n', Error, 'root'), # Unterminated string
650
+ ],
651
+ }
652
+
653
+ def analyse_text(text):
654
+ if text.startswith('10REM >') or text.startswith('REM >'):
655
+ return 0.9
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/bdd.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.bdd
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for BDD(Behavior-driven development).
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, include
12
+ from pygments.token import Comment, Keyword, Name, String, Number, Text, \
13
+ Punctuation, Whitespace
14
+
15
+ __all__ = ['BddLexer']
16
+
17
+ class BddLexer(RegexLexer):
18
+ """
19
+ Lexer for BDD(Behavior-driven development), which highlights not only
20
+ keywords, but also comments, punctuations, strings, numbers, and variables.
21
+ """
22
+
23
+ name = 'Bdd'
24
+ aliases = ['bdd']
25
+ filenames = ['*.feature']
26
+ mimetypes = ['text/x-bdd']
27
+ url = 'https://en.wikipedia.org/wiki/Behavior-driven_development'
28
+ version_added = '2.11'
29
+
30
+ step_keywords = (r'Given|When|Then|Add|And|Feature|Scenario Outline|'
31
+ r'Scenario|Background|Examples|But')
32
+
33
+ tokens = {
34
+ 'comments': [
35
+ (r'^\s*#.*$', Comment),
36
+ ],
37
+ 'miscellaneous': [
38
+ (r'(<|>|\[|\]|=|\||:|\(|\)|\{|\}|,|\.|;|-|_|\$)', Punctuation),
39
+ (r'((?<=\<)[^\\>]+(?=\>))', Name.Variable),
40
+ (r'"([^\"]*)"', String),
41
+ (r'^@\S+', Name.Label),
42
+ ],
43
+ 'numbers': [
44
+ (r'(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number),
45
+ ],
46
+ 'root': [
47
+ (r'\n|\s+', Whitespace),
48
+ (step_keywords, Keyword),
49
+ include('comments'),
50
+ include('miscellaneous'),
51
+ include('numbers'),
52
+ (r'\S+', Text),
53
+ ]
54
+ }
55
+
56
+ def analyse_text(self, text):
57
+ return
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/berry.py ADDED
@@ -0,0 +1,99 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.berry
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Berry.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words, include, bygroups
12
+ from pygments.token import Comment, Whitespace, Operator, Keyword, Name, \
13
+ String, Number, Punctuation
14
+
15
+ __all__ = ['BerryLexer']
16
+
17
+
18
+ class BerryLexer(RegexLexer):
19
+ """
20
+ For Berry source code.
21
+ """
22
+ name = 'Berry'
23
+ aliases = ['berry', 'be']
24
+ filenames = ['*.be']
25
+ mimetypes = ['text/x-berry', 'application/x-berry']
26
+ url = 'https://berry-lang.github.io'
27
+ version_added = '2.12'
28
+
29
+ _name = r'\b[^\W\d]\w*'
30
+
31
+ tokens = {
32
+ 'root': [
33
+ include('whitespace'),
34
+ include('numbers'),
35
+ include('keywords'),
36
+ (rf'(def)(\s+)({_name})',
37
+ bygroups(Keyword.Declaration, Whitespace, Name.Function)),
38
+ (rf'\b(class)(\s+)({_name})',
39
+ bygroups(Keyword.Declaration, Whitespace, Name.Class)),
40
+ (rf'\b(import)(\s+)({_name})',
41
+ bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
42
+ include('expr')
43
+ ],
44
+ 'expr': [
45
+ (r'[^\S\n]+', Whitespace),
46
+ (r'\.\.|[~!%^&*+=|?:<>/-]', Operator),
47
+ (r'[(){}\[\],.;]', Punctuation),
48
+ include('controls'),
49
+ include('builtins'),
50
+ include('funccall'),
51
+ include('member'),
52
+ include('name'),
53
+ include('strings')
54
+ ],
55
+ 'whitespace': [
56
+ (r'\s+', Whitespace),
57
+ (r'#-[\s\S]*?-#', Comment.Multiline),
58
+ (r'#.*?$', Comment.Single)
59
+ ],
60
+ 'keywords': [
61
+ (words((
62
+ 'as', 'break', 'continue', 'import', 'static', 'self', 'super'),
63
+ suffix=r'\b'), Keyword.Reserved),
64
+ (r'(true|false|nil)\b', Keyword.Constant),
65
+ (r'(var|def)\b', Keyword.Declaration)
66
+ ],
67
+ 'controls': [
68
+ (words((
69
+ 'if', 'elif', 'else', 'for', 'while', 'do', 'end', 'break',
70
+ 'continue', 'return', 'try', 'except', 'raise'),
71
+ suffix=r'\b'), Keyword)
72
+ ],
73
+ 'builtins': [
74
+ (words((
75
+ 'assert', 'bool', 'input', 'classname', 'classof', 'number', 'real',
76
+ 'bytes', 'compile', 'map', 'list', 'int', 'isinstance', 'print',
77
+ 'range', 'str', 'super', 'module', 'size', 'issubclass', 'open',
78
+ 'file', 'type', 'call'),
79
+ suffix=r'\b'), Name.Builtin)
80
+ ],
81
+ 'numbers': [
82
+ (r'0[xX][a-fA-F0-9]+', Number.Hex),
83
+ (r'-?\d+', Number.Integer),
84
+ (r'(-?\d+\.?|\.\d)\d*([eE][+-]?\d+)?', Number.Float)
85
+ ],
86
+ 'name': [
87
+ (_name, Name)
88
+ ],
89
+ 'funccall': [
90
+ (rf'{_name}(?=\s*\()', Name.Function, '#pop')
91
+ ],
92
+ 'member': [
93
+ (rf'(?<=\.){_name}\b(?!\()', Name.Attribute, '#pop')
94
+ ],
95
+ 'strings': [
96
+ (r'"([^\\]|\\.)*?"', String.Double, '#pop'),
97
+ (r'\'([^\\]|\\.)*?\'', String.Single, '#pop')
98
+ ]
99
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/bibtex.py ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.bibtex
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for BibTeX bibliography data and styles
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, default, \
14
+ words
15
+ from pygments.token import Name, Comment, String, Error, Number, Keyword, \
16
+ Punctuation, Whitespace
17
+
18
+ __all__ = ['BibTeXLexer', 'BSTLexer']
19
+
20
+
21
+ class BibTeXLexer(ExtendedRegexLexer):
22
+ """
23
+ A lexer for BibTeX bibliography data format.
24
+ """
25
+
26
+ name = 'BibTeX'
27
+ aliases = ['bibtex', 'bib']
28
+ filenames = ['*.bib']
29
+ mimetypes = ["text/x-bibtex"]
30
+ version_added = '2.2'
31
+ flags = re.IGNORECASE
32
+ url = 'https://texfaq.org/FAQ-BibTeXing'
33
+
34
+ ALLOWED_CHARS = r'@!$&*+\-./:;<>?\[\\\]^`|~'
35
+ IDENTIFIER = '[{}][{}]*'.format('a-z_' + ALLOWED_CHARS, r'\w' + ALLOWED_CHARS)
36
+
37
+ def open_brace_callback(self, match, ctx):
38
+ opening_brace = match.group()
39
+ ctx.opening_brace = opening_brace
40
+ yield match.start(), Punctuation, opening_brace
41
+ ctx.pos = match.end()
42
+
43
+ def close_brace_callback(self, match, ctx):
44
+ closing_brace = match.group()
45
+ if (
46
+ ctx.opening_brace == '{' and closing_brace != '}' or
47
+ ctx.opening_brace == '(' and closing_brace != ')'
48
+ ):
49
+ yield match.start(), Error, closing_brace
50
+ else:
51
+ yield match.start(), Punctuation, closing_brace
52
+ del ctx.opening_brace
53
+ ctx.pos = match.end()
54
+
55
+ tokens = {
56
+ 'root': [
57
+ include('whitespace'),
58
+ (r'@comment(?!ary)', Comment),
59
+ ('@preamble', Name.Class, ('closing-brace', 'value', 'opening-brace')),
60
+ ('@string', Name.Class, ('closing-brace', 'field', 'opening-brace')),
61
+ ('@' + IDENTIFIER, Name.Class,
62
+ ('closing-brace', 'command-body', 'opening-brace')),
63
+ ('.+', Comment),
64
+ ],
65
+ 'opening-brace': [
66
+ include('whitespace'),
67
+ (r'[{(]', open_brace_callback, '#pop'),
68
+ ],
69
+ 'closing-brace': [
70
+ include('whitespace'),
71
+ (r'[})]', close_brace_callback, '#pop'),
72
+ ],
73
+ 'command-body': [
74
+ include('whitespace'),
75
+ (r'[^\s\,\}]+', Name.Label, ('#pop', 'fields')),
76
+ ],
77
+ 'fields': [
78
+ include('whitespace'),
79
+ (',', Punctuation, 'field'),
80
+ default('#pop'),
81
+ ],
82
+ 'field': [
83
+ include('whitespace'),
84
+ (IDENTIFIER, Name.Attribute, ('value', '=')),
85
+ default('#pop'),
86
+ ],
87
+ '=': [
88
+ include('whitespace'),
89
+ ('=', Punctuation, '#pop'),
90
+ ],
91
+ 'value': [
92
+ include('whitespace'),
93
+ (IDENTIFIER, Name.Variable),
94
+ ('"', String, 'quoted-string'),
95
+ (r'\{', String, 'braced-string'),
96
+ (r'[\d]+', Number),
97
+ ('#', Punctuation),
98
+ default('#pop'),
99
+ ],
100
+ 'quoted-string': [
101
+ (r'\{', String, 'braced-string'),
102
+ ('"', String, '#pop'),
103
+ (r'[^\{\"]+', String),
104
+ ],
105
+ 'braced-string': [
106
+ (r'\{', String, '#push'),
107
+ (r'\}', String, '#pop'),
108
+ (r'[^\{\}]+', String),
109
+ ],
110
+ 'whitespace': [
111
+ (r'\s+', Whitespace),
112
+ ],
113
+ }
114
+
115
+
116
+ class BSTLexer(RegexLexer):
117
+ """
118
+ A lexer for BibTeX bibliography styles.
119
+ """
120
+
121
+ name = 'BST'
122
+ aliases = ['bst', 'bst-pybtex']
123
+ filenames = ['*.bst']
124
+ version_added = '2.2'
125
+ flags = re.IGNORECASE | re.MULTILINE
126
+ url = 'https://texfaq.org/FAQ-BibTeXing'
127
+
128
+ tokens = {
129
+ 'root': [
130
+ include('whitespace'),
131
+ (words(['read', 'sort']), Keyword),
132
+ (words(['execute', 'integers', 'iterate', 'reverse', 'strings']),
133
+ Keyword, ('group')),
134
+ (words(['function', 'macro']), Keyword, ('group', 'group')),
135
+ (words(['entry']), Keyword, ('group', 'group', 'group')),
136
+ ],
137
+ 'group': [
138
+ include('whitespace'),
139
+ (r'\{', Punctuation, ('#pop', 'group-end', 'body')),
140
+ ],
141
+ 'group-end': [
142
+ include('whitespace'),
143
+ (r'\}', Punctuation, '#pop'),
144
+ ],
145
+ 'body': [
146
+ include('whitespace'),
147
+ (r"\'[^#\"\{\}\s]+", Name.Function),
148
+ (r'[^#\"\{\}\s]+\$', Name.Builtin),
149
+ (r'[^#\"\{\}\s]+', Name.Variable),
150
+ (r'"[^\"]*"', String),
151
+ (r'#-?\d+', Number),
152
+ (r'\{', Punctuation, ('group-end', 'body')),
153
+ default('#pop'),
154
+ ],
155
+ 'whitespace': [
156
+ (r'\s+', Whitespace),
157
+ ('%.*?$', Comment.Single),
158
+ ],
159
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/bitbake.py ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.bitbake
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for BitBake recipes, classes, includes and configuration files
6
+ used by the Yocto Project / OpenEmbedded build system.
7
+
8
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
9
+ :license: BSD, see LICENSE for details.
10
+ """
11
+
12
+ import re
13
+
14
+ from pygments.lexer import RegexLexer, bygroups, include, using, words
15
+ from pygments.lexers.python import PythonLexer
16
+ from pygments.lexers.shell import BashLexer
17
+ from pygments.token import Comment, Keyword, Name, Operator, Punctuation, \
18
+ String, Text, Whitespace
19
+
20
+ __all__ = ['BitBakeLexer']
21
+
22
+ # A bare BitBake identifier (variable, function or flag name). Allows the
23
+ # characters used by OE-Core variable names (digits, ``-``, ``.``, ``+``).
24
+ _IDENT = r'[A-Za-z_][A-Za-z0-9_\-.+]*'
25
+
26
+ # Optional OE override chain such as ``:append``, ``:remove``, ``:class-target``
27
+ # or ``:${PN}-doc``. Anchored so it only consumes ``:foo`` runs and never
28
+ # eats the leading ``:`` of the ``:=`` assignment operator.
29
+ _OVERRIDE = r'(?::[A-Za-z0-9_\-.+${}]+)*'
30
+
31
+ # All BitBake variable assignment operators, ordered so that the longer
32
+ # operators win the regex alternation.
33
+ _ASSIGN = r'(?:\?\?=|\?=|:=|\+=|=\+|\.=|=\.|=)'
34
+
35
+
36
+ class BitBakeLexer(RegexLexer):
37
+ """
38
+ Lexer for BitBake recipes, classes, includes and configuration files
39
+ used by the Yocto Project and OpenEmbedded build system.
40
+ """
41
+
42
+ name = 'BitBake'
43
+ url = 'https://docs.yoctoproject.org/bitbake/'
44
+ aliases = ['bitbake']
45
+ filenames = ['*.bbclass', '*.bbappend']
46
+ mimetypes = ['text/x-bitbake']
47
+ version_added = '2.21'
48
+
49
+ flags = re.MULTILINE
50
+
51
+ tokens = {
52
+ 'root': [
53
+ (r'[ \t]+', Whitespace),
54
+ (r'\n', Whitespace),
55
+ (r'#.*$', Comment.Single),
56
+
57
+ # ``python [name]() { ... }`` blocks (also ``fakeroot python``).
58
+ # Must be tried before the generic shell function rule so the
59
+ # ``python`` keyword is not mistaken for a shell function name.
60
+ (r'(^(?:fakeroot[ \t]+)?)(python)((?:[ \t]+' + _IDENT + r')?)'
61
+ r'([ \t]*\([ \t]*\)[ \t]*)(\{[ \t]*\n)'
62
+ r'((?:.*\n)*?)'
63
+ r'(^\}[ \t]*$)',
64
+ bygroups(Keyword.Type, Keyword, Name.Function, Text,
65
+ Punctuation, using(PythonLexer), Punctuation)),
66
+
67
+ # Shell task bodies: ``[fakeroot ]name[:override]() { ... }``.
68
+ (r'(^(?:fakeroot[ \t]+)?)(' + _IDENT + r')(' + _OVERRIDE + r')'
69
+ r'([ \t]*\([ \t]*\)[ \t]*)(\{[ \t]*\n)'
70
+ r'((?:.*\n)*?)'
71
+ r'(^\}[ \t]*$)',
72
+ bygroups(Keyword.Type, Name.Function, Name.Decorator, Text,
73
+ Punctuation, using(BashLexer), Punctuation)),
74
+
75
+ # Top-level python ``def`` blocks; the body is any run of
76
+ # indented or blank lines following the signature.
77
+ (r'^def[ \t]+' + _IDENT + r'[ \t]*\([^)]*\)[ \t]*:[ \t]*\n'
78
+ r'(?:[ \t]+.*\n|\n)+',
79
+ using(PythonLexer)),
80
+
81
+ # ``inherit`` / ``inherit_defer`` / ``include`` / ``include_all`` /
82
+ # ``require`` directives. Longer keywords are listed first so the
83
+ # regex alternation does not match the shorter prefix.
84
+ (r'^(inherit_defer|inherit|include_all|include|require)\b',
85
+ Keyword.Namespace, 'include-line'),
86
+
87
+ # ``addtask`` / ``deltask`` / ``addhandler`` / ``EXPORT_FUNCTIONS``.
88
+ (r'^(addtask|deltask|addhandler|EXPORT_FUNCTIONS)\b',
89
+ Keyword, 'statement'),
90
+
91
+ # ``VAR[flag] = "value"`` (varflag assignment).
92
+ (r'^(' + _IDENT + r')(\[)(' + _IDENT + r')(\])([ \t]*)('
93
+ + _ASSIGN + r')',
94
+ bygroups(Name.Variable, Punctuation, Name.Attribute,
95
+ Punctuation, Whitespace, Operator),
96
+ 'value'),
97
+
98
+ # ``[export ]VAR[:override...] OP "value"`` assignments.
99
+ (r'^(export[ \t]+)?(' + _IDENT + r')(' + _OVERRIDE + r')'
100
+ r'([ \t]*)(' + _ASSIGN + r')',
101
+ bygroups(Keyword.Type, Name.Variable, Name.Decorator,
102
+ Whitespace, Operator),
103
+ 'value'),
104
+
105
+ # Anything else: consume runs of "boring" characters in one
106
+ # token, then fall back to a single character if needed.
107
+ (r'[^\s#${}\[\]:=+?.@\\"\']+', Text),
108
+ (r'.', Text),
109
+ ],
110
+
111
+ 'include-line': [
112
+ (r'[ \t]+', Whitespace),
113
+ (r'\\\n', Text),
114
+ (r'\n', Whitespace, '#pop'),
115
+ include('interp'),
116
+ (r'[^\s$]+', String),
117
+ ],
118
+
119
+ 'statement': [
120
+ (r'[ \t]+', Whitespace),
121
+ (r'\\\n', Text),
122
+ (r'\n', Whitespace, '#pop'),
123
+ (words(('after', 'before'), suffix=r'\b'), Keyword),
124
+ include('interp'),
125
+ (r'[^\s$\\]+', Name),
126
+ ],
127
+
128
+ 'value': [
129
+ (r'[ \t]+', Whitespace),
130
+ (r'\\\n', String.Escape),
131
+ (r'\n', Whitespace, '#pop'),
132
+ (r'"', String.Double, 'string-double'),
133
+ (r"'", String.Single, 'string-single'),
134
+ include('interp'),
135
+ (r'[^\s"\'$\\]+', String),
136
+ ],
137
+
138
+ 'string-double': [
139
+ (r'\\\n', String.Escape),
140
+ (r'\\.', String.Escape),
141
+ (r'"', String.Double, '#pop'),
142
+ include('interp'),
143
+ (r'[^"\\$]+', String.Double),
144
+ ],
145
+
146
+ 'string-single': [
147
+ (r'\\\n', String.Escape),
148
+ (r'\\.', String.Escape),
149
+ (r"'", String.Single, '#pop'),
150
+ include('interp'),
151
+ (r"[^'\\$]+", String.Single),
152
+ ],
153
+
154
+ 'interp': [
155
+ # ``${@ python expression }`` evaluated by BitBake at parse time.
156
+ (r'\$\{@', String.Interpol, 'py-interp'),
157
+ # ``${VAR}`` variable expansion.
158
+ (r'(\$\{)([A-Za-z0-9_\-:.+/]+)(\})',
159
+ bygroups(String.Interpol, Name.Variable, String.Interpol)),
160
+ ],
161
+
162
+ 'py-interp': [
163
+ (r'\}', String.Interpol, '#pop'),
164
+ (r'[^}]+', using(PythonLexer)),
165
+ ],
166
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/blueprint.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.blueprint
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Blueprint UI markup language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups, words
14
+ from pygments.token import (
15
+ Comment,
16
+ Operator,
17
+ Keyword,
18
+ Name,
19
+ String,
20
+ Number,
21
+ Punctuation,
22
+ Whitespace,
23
+ )
24
+
25
+ __all__ = ["BlueprintLexer"]
26
+
27
+
28
+ class BlueprintLexer(RegexLexer):
29
+ """
30
+ For Blueprint UI markup.
31
+ """
32
+
33
+ name = "Blueprint"
34
+ aliases = ["blueprint"]
35
+ filenames = ["*.blp"]
36
+ mimetypes = ["text/x-blueprint"]
37
+ url = "https://gitlab.gnome.org/jwestman/blueprint-compiler"
38
+ version_added = '2.16'
39
+
40
+ flags = re.IGNORECASE
41
+ tokens = {
42
+ "root": [
43
+ include("block-content"),
44
+ ],
45
+ "type": [
46
+ (r"\$\s*[a-z_][a-z0-9_\-]*", Name.Class),
47
+ (r"(?:([a-z_][a-z0-9_\-]*)(\s*)(\.)(\s*))?([a-z_][a-z0-9_\-]*)",
48
+ bygroups(Name.Namespace, Whitespace, Punctuation, Whitespace, Name.Class)),
49
+ ],
50
+ "whitespace": [
51
+ (r"\s+", Whitespace),
52
+ (r"//.*?\n", Comment.Single),
53
+ (r"/\*", Comment.Multiline, "comment-multiline"),
54
+ ],
55
+ "comment-multiline": [
56
+ (r"\*/", Comment.Multiline, "#pop"),
57
+ (r"[^*]+", Comment.Multiline),
58
+ (r"\*", Comment.Multiline),
59
+ ],
60
+ "value": [
61
+ (r"(typeof)(\s*)(<)", bygroups(Keyword, Whitespace, Punctuation), "typeof"),
62
+ (words(("true", "false", "null")), Keyword.Constant),
63
+ (r"[a-z_][a-z0-9_\-]*", Name.Variable),
64
+ (r"\|", Operator),
65
+ (r'".*?"', String.Double),
66
+ (r"\'.*?\'", String.Single),
67
+ (r"0x[\d_]*", Number.Hex),
68
+ (r"[0-9_]+", Number.Integer),
69
+ (r"\d[\d\.a-z_]*", Number),
70
+ ],
71
+ "typeof": [
72
+ include("whitespace"),
73
+ include("type"),
74
+ (r">", Punctuation, "#pop"),
75
+ ],
76
+ "content": [
77
+ include("whitespace"),
78
+ # Keywords
79
+ (words(("after", "bidirectional", "bind-property", "bind", "default",
80
+ "destructive", "disabled", "inverted", "no-sync-create",
81
+ "suggested", "swapped", "sync-create", "template")),
82
+ Keyword),
83
+ # Translated strings
84
+ (r"(C?_)(\s*)(\()",
85
+ bygroups(Name.Function.Builtin, Whitespace, Punctuation),
86
+ "paren-content"),
87
+ # Cast expressions
88
+ (r"(as)(\s*)(<)", bygroups(Keyword, Whitespace, Punctuation), "typeof"),
89
+ # Closures
90
+ (r"(\$?[a-z_][a-z0-9_\-]*)(\s*)(\()",
91
+ bygroups(Name.Function, Whitespace, Punctuation),
92
+ "paren-content"),
93
+ # Objects
94
+ (r"(?:(\$\s*[a-z_][a-z0-9_\-]+)|(?:([a-z_][a-z0-9_\-]*)(\s*)(\.)(\s*))?([a-z_][a-z0-9_\-]*))(?:(\s+)([a-z_][a-z0-9_\-]*))?(\s*)(\{)",
95
+ bygroups(Name.Class, Name.Namespace, Whitespace, Punctuation, Whitespace,
96
+ Name.Class, Whitespace, Name.Variable, Whitespace, Punctuation),
97
+ "brace-block"),
98
+ # Misc
99
+ include("value"),
100
+ (r",|\.", Punctuation),
101
+ ],
102
+ "block-content": [
103
+ # Import statements
104
+ (r"(using)(\s+)([a-z_][a-z0-9_\-]*)(\s+)(\d[\d\.]*)(;)",
105
+ bygroups(Keyword, Whitespace, Name.Namespace, Whitespace,
106
+ Name.Namespace, Punctuation)),
107
+ # Menus
108
+ (r"(menu|section|submenu)(?:(\s+)([a-z_][a-z0-9_\-]*))?(\s*)(\{)",
109
+ bygroups(Keyword, Whitespace, Name.Variable, Whitespace, Punctuation),
110
+ "brace-block"),
111
+ (r"(item)(\s*)(\{)",
112
+ bygroups(Keyword, Whitespace, Punctuation),
113
+ "brace-block"),
114
+ (r"(item)(\s*)(\()",
115
+ bygroups(Keyword, Whitespace, Punctuation),
116
+ "paren-block"),
117
+ # Templates
118
+ (r"template", Keyword.Declaration, "template"),
119
+ # Nested blocks. When extensions are added, this is where they go.
120
+ (r"(responses|items|mime-types|patterns|suffixes|marks|widgets|strings|styles)(\s*)(\[)",
121
+ bygroups(Keyword, Whitespace, Punctuation),
122
+ "bracket-block"),
123
+ (r"(accessibility|setters|layout|item)(\s*)(\{)",
124
+ bygroups(Keyword, Whitespace, Punctuation),
125
+ "brace-block"),
126
+ (r"(condition|mark|item)(\s*)(\()",
127
+ bygroups(Keyword, Whitespace, Punctuation),
128
+ "paren-content"),
129
+ (r"\[", Punctuation, "child-type"),
130
+ # Properties and signals
131
+ (r"([a-z_][a-z0-9_\-]*(?:::[a-z0-9_]+)?)(\s*)(:|=>)",
132
+ bygroups(Name.Property, Whitespace, Punctuation),
133
+ "statement"),
134
+ include("content"),
135
+ ],
136
+ "paren-block": [
137
+ include("block-content"),
138
+ (r"\)", Punctuation, "#pop"),
139
+ ],
140
+ "paren-content": [
141
+ include("content"),
142
+ (r"\)", Punctuation, "#pop"),
143
+ ],
144
+ "bracket-block": [
145
+ include("block-content"),
146
+ (r"\]", Punctuation, "#pop"),
147
+ ],
148
+ "brace-block": [
149
+ include("block-content"),
150
+ (r"\}", Punctuation, "#pop"),
151
+ ],
152
+ "statement": [
153
+ include("content"),
154
+ (r";", Punctuation, "#pop"),
155
+ ],
156
+ "child-type": [
157
+ include("whitespace"),
158
+ (r"(action)(\s+)(response)(\s*)(=)(\s*)",
159
+ bygroups(Keyword, Whitespace, Name.Attribute, Whitespace,
160
+ Punctuation, Whitespace)),
161
+ (words(("default", "internal-child", "response")), Keyword),
162
+ (r"[a-z_][a-z0-9_\-]*", Name.Decorator),
163
+ include("value"),
164
+ (r"=", Punctuation),
165
+ (r"\]", Punctuation, "#pop"),
166
+ ],
167
+ "template": [
168
+ include("whitespace"),
169
+ include("type"),
170
+ (r":", Punctuation),
171
+ (r"\{", Punctuation, ("#pop", "brace-block")),
172
+ ],
173
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/boa.py ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.boa
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Boa language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words
12
+ from pygments.token import String, Comment, Keyword, Name, Number, Operator, \
13
+ Punctuation, Whitespace
14
+
15
+ __all__ = ['BoaLexer']
16
+
17
+
18
+ class BoaLexer(RegexLexer):
19
+ """
20
+ Lexer for the Boa language.
21
+ """
22
+ name = 'Boa'
23
+ aliases = ['boa']
24
+ filenames = ['*.boa']
25
+ url = 'https://boa.cs.iastate.edu/docs'
26
+ version_added = '2.4'
27
+
28
+ reserved = words(
29
+ ('input', 'output', 'of', 'weight', 'before', 'after', 'stop',
30
+ 'ifall', 'foreach', 'exists', 'function', 'break', 'switch', 'case',
31
+ 'visitor', 'default', 'return', 'visit', 'while', 'if', 'else'),
32
+ suffix=r'\b', prefix=r'\b')
33
+ keywords = words(
34
+ ('bottom', 'collection', 'maximum', 'mean', 'minimum', 'set', 'sum',
35
+ 'top', 'string', 'int', 'bool', 'float', 'time', 'false', 'true',
36
+ 'array', 'map', 'stack', 'enum', 'type'), suffix=r'\b', prefix=r'\b')
37
+ classes = words(
38
+ ('Project', 'ForgeKind', 'CodeRepository', 'Revision', 'RepositoryKind',
39
+ 'ChangedFile', 'FileKind', 'ASTRoot', 'Namespace', 'Declaration', 'Type',
40
+ 'Method', 'Variable', 'Statement', 'Expression', 'Modifier',
41
+ 'StatementKind', 'ExpressionKind', 'ModifierKind', 'Visibility',
42
+ 'TypeKind', 'Person', 'ChangeKind'),
43
+ suffix=r'\b', prefix=r'\b')
44
+ operators = ('->', ':=', ':', '=', '<<', '!', '++', '||',
45
+ '&&', '+', '-', '*', ">", "<")
46
+ string_sep = ('`', '\"')
47
+ built_in_functions = words(
48
+ (
49
+ # Array functions
50
+ 'new', 'sort',
51
+ # Date & Time functions
52
+ 'yearof', 'dayofyear', 'hourof', 'minuteof', 'secondof', 'now',
53
+ 'addday', 'addmonth', 'addweek', 'addyear', 'dayofmonth', 'dayofweek',
54
+ 'dayofyear', 'formattime', 'trunctoday', 'trunctohour', 'trunctominute',
55
+ 'trunctomonth', 'trunctosecond', 'trunctoyear',
56
+ # Map functions
57
+ 'clear', 'haskey', 'keys', 'lookup', 'remove', 'values',
58
+ # Math functions
59
+ 'abs', 'acos', 'acosh', 'asin', 'asinh', 'atan', 'atan2', 'atanh',
60
+ 'ceil', 'cos', 'cosh', 'exp', 'floor', 'highbit', 'isfinite', 'isinf',
61
+ 'isnan', 'isnormal', 'log', 'log10', 'max', 'min', 'nrand', 'pow',
62
+ 'rand', 'round', 'sin', 'sinh', 'sqrt', 'tan', 'tanh', 'trunc',
63
+ # Other functions
64
+ 'def', 'hash', 'len',
65
+ # Set functions
66
+ 'add', 'contains', 'remove',
67
+ # String functions
68
+ 'format', 'lowercase', 'match', 'matchposns', 'matchstrs', 'regex',
69
+ 'split', 'splitall', 'splitn', 'strfind', 'strreplace', 'strrfind',
70
+ 'substring', 'trim', 'uppercase',
71
+ # Type Conversion functions
72
+ 'bool', 'float', 'int', 'string', 'time',
73
+ # Domain-Specific functions
74
+ 'getast', 'getsnapshot', 'hasfiletype', 'isfixingrevision', 'iskind',
75
+ 'isliteral',
76
+ ),
77
+ prefix=r'\b',
78
+ suffix=r'\(')
79
+
80
+ tokens = {
81
+ 'root': [
82
+ (r'#.*?$', Comment.Single),
83
+ (r'/\*.*?\*/', Comment.Multiline),
84
+ (reserved, Keyword.Reserved),
85
+ (built_in_functions, Name.Function),
86
+ (keywords, Keyword.Type),
87
+ (classes, Name.Classes),
88
+ (words(operators), Operator),
89
+ (r'[][(),;{}\\.]', Punctuation),
90
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
91
+ (r"`(\\\\|\\[^\\]|[^`\\])*`", String.Backtick),
92
+ (words(string_sep), String.Delimiter),
93
+ (r'[a-zA-Z_]+', Name.Variable),
94
+ (r'[0-9]+', Number.Integer),
95
+ (r'\s+', Whitespace), # Whitespace
96
+ ]
97
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/bqn.py ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.bqn
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for BQN.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer
12
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation, Whitespace
14
+
15
+ __all__ = ['BQNLexer']
16
+
17
+
18
+ class BQNLexer(RegexLexer):
19
+ """
20
+ A simple BQN lexer.
21
+ """
22
+ name = 'BQN'
23
+ url = 'https://mlochbaum.github.io/BQN/index.html'
24
+ aliases = ['bqn']
25
+ filenames = ['*.bqn']
26
+ mimetypes = []
27
+ version_added = '2.16'
28
+
29
+ # An inter_word_char. Necessary because \w matches all alphanumeric
30
+ # Unicode characters, including ones (e.g., 𝕊) that BQN treats special.
31
+ _iwc = r'((?=[^𝕎𝕏𝔽𝔾𝕊𝕨𝕩𝕗𝕘𝕤𝕣])\w)'
32
+
33
+ tokens = {
34
+ 'root': [
35
+ # Whitespace
36
+ # ==========
37
+ (r'\s+', Whitespace),
38
+ #
39
+ # Comment
40
+ # =======
41
+ # '#' is a comment that continues to the end of the line
42
+ (r'#.*$', Comment.Single),
43
+ #
44
+ # Strings
45
+ # =======
46
+ (r'\'((\'\')|[^\'])*\'', String.Single),
47
+ (r'"(("")|[^"])*"', String.Double),
48
+ #
49
+ # Null Character
50
+ # ==============
51
+ # Literal representation of the null character
52
+ (r'@', String.Symbol),
53
+ #
54
+ # Punctuation
55
+ # ===========
56
+ # This token type is used for diamond, commas
57
+ # and array and list brackets and strand syntax
58
+ (r'[\.⋄,\[\]⟨⟩‿]', Punctuation),
59
+ #
60
+ # Expression Grouping
61
+ # ===================
62
+ # Since this token type is important in BQN, it is not included in
63
+ # the punctuation token type but rather in the following one
64
+ (r'[\(\)]', String.Regex),
65
+ #
66
+ # Numbers
67
+ # =======
68
+ # Includes the numeric literals and the Nothing character
69
+ (r'¯?[0-9](([0-9]|_)*\.?([0-9]|_)+|([0-9]|_)*)([Ee][¯]?([0-9]|_)+)?|¯|∞|π|·', Number),
70
+ #
71
+ # Variables
72
+ # =========
73
+ (r'[a-z]' + _iwc + r'*', Name.Variable),
74
+ #
75
+ # 2-Modifiers
76
+ # ===========
77
+ # Needs to come before the 1-modifiers due to _𝕣 and _𝕣_
78
+ (r'[∘○⊸⟜⌾⊘◶⎉⚇⍟⎊]', Name.Property),
79
+ (r'_(𝕣|[a-zA-Z0-9]+)_', Name.Property),
80
+ #
81
+ # 1-Modifiers
82
+ # ===========
83
+ (r'[˙˜˘¨⌜⁼´˝`𝕣]', Name.Attribute),
84
+ (r'_(𝕣|[a-zA-Z0-9]+)', Name.Attribute),
85
+ #
86
+ # Functions
87
+ # =========
88
+ # The monadic or dyadic function primitives and function
89
+ # operands and arguments, along with function self-reference
90
+ (r'[+\-×÷\⋆√⌊⌈∧∨¬|≤<>≥=≠≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!𝕎𝕏𝔽𝔾𝕊]',
91
+ Operator),
92
+ (r'[A-Z]' + _iwc + r'*|•' + _iwc + r'+', Operator),
93
+ #
94
+ # Constant
95
+ # ========
96
+ (r'˙', Name.Constant),
97
+ #
98
+ # Define/Export/Change
99
+ # ====================
100
+ (r'[←↩⇐]', Keyword.Declaration),
101
+ #
102
+ # Blocks
103
+ # ======
104
+ (r'[{}]', Keyword.Type),
105
+ #
106
+ # Extra characters
107
+ # ================
108
+ (r'[;:?𝕨𝕩𝕗𝕘𝕤]', Name.Entity),
109
+ #
110
+
111
+ ],
112
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/business.py ADDED
@@ -0,0 +1,625 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.business
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for "business-oriented" languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, words, bygroups
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Error, Whitespace
16
+
17
+ from pygments.lexers._openedge_builtins import OPENEDGEKEYWORDS
18
+
19
+ __all__ = ['CobolLexer', 'CobolFreeformatLexer', 'ABAPLexer', 'OpenEdgeLexer',
20
+ 'GoodDataCLLexer', 'MaqlLexer']
21
+
22
+
23
+ class CobolLexer(RegexLexer):
24
+ """
25
+ Lexer for OpenCOBOL code.
26
+ """
27
+ name = 'COBOL'
28
+ aliases = ['cobol']
29
+ filenames = ['*.cob', '*.COB', '*.cpy', '*.CPY']
30
+ mimetypes = ['text/x-cobol']
31
+ url = 'https://en.wikipedia.org/wiki/COBOL'
32
+ version_added = '1.6'
33
+
34
+ flags = re.IGNORECASE | re.MULTILINE
35
+
36
+ # Data Types: by PICTURE and USAGE
37
+ # Operators: **, *, +, -, /, <, >, <=, >=, =, <>
38
+ # Logical (?): NOT, AND, OR
39
+
40
+ # Reserved words:
41
+ # http://opencobol.add1tocobol.com/#reserved-words
42
+ # Intrinsics:
43
+ # http://opencobol.add1tocobol.com/#does-opencobol-implement-any-intrinsic-functions
44
+
45
+ tokens = {
46
+ 'root': [
47
+ include('comment'),
48
+ include('strings'),
49
+ include('core'),
50
+ include('nums'),
51
+ (r'[a-z0-9]([\w\-]*[a-z0-9]+)?', Name.Variable),
52
+ # (r'[\s]+', Text),
53
+ (r'[ \t]+', Whitespace),
54
+ ],
55
+ 'comment': [
56
+ (r'(^.{6}[*/].*\n|^.{6}|\*>.*\n)', Comment),
57
+ ],
58
+ 'core': [
59
+ # Figurative constants
60
+ (r'(^|(?<=[^\w\-]))(ALL\s+)?'
61
+ r'((ZEROES)|(HIGH-VALUE|LOW-VALUE|QUOTE|SPACE|ZERO)(S)?)'
62
+ r'\s*($|(?=[^\w\-]))',
63
+ Name.Constant),
64
+
65
+ # Reserved words STATEMENTS and other bolds
66
+ (words((
67
+ 'ACCEPT', 'ADD', 'ALLOCATE', 'CALL', 'CANCEL', 'CLOSE', 'COMPUTE',
68
+ 'CONFIGURATION', 'CONTINUE', 'DATA', 'DELETE', 'DISPLAY', 'DIVIDE',
69
+ 'DIVISION', 'ELSE', 'END', 'END-ACCEPT',
70
+ 'END-ADD', 'END-CALL', 'END-COMPUTE', 'END-DELETE', 'END-DISPLAY',
71
+ 'END-DIVIDE', 'END-EVALUATE', 'END-IF', 'END-MULTIPLY', 'END-OF-PAGE',
72
+ 'END-PERFORM', 'END-READ', 'END-RETURN', 'END-REWRITE', 'END-SEARCH',
73
+ 'END-START', 'END-STRING', 'END-SUBTRACT', 'END-UNSTRING', 'END-WRITE',
74
+ 'ENVIRONMENT', 'EVALUATE', 'EXIT', 'FD', 'FILE', 'FILE-CONTROL', 'FOREVER',
75
+ 'FREE', 'GENERATE', 'GO', 'GOBACK', 'IDENTIFICATION', 'IF', 'INITIALIZE',
76
+ 'INITIATE', 'INPUT-OUTPUT', 'INSPECT', 'INVOKE', 'I-O-CONTROL', 'LINKAGE',
77
+ 'LOCAL-STORAGE', 'MERGE', 'MOVE', 'MULTIPLY', 'OPEN', 'PERFORM',
78
+ 'PROCEDURE', 'PROGRAM-ID', 'RAISE', 'READ', 'RELEASE', 'RESUME',
79
+ 'RETURN', 'REWRITE', 'SCREEN', 'SD', 'SEARCH', 'SECTION', 'SET',
80
+ 'SORT', 'START', 'STOP', 'STRING', 'SUBTRACT', 'SUPPRESS',
81
+ 'TERMINATE', 'THEN', 'UNLOCK', 'UNSTRING', 'USE', 'VALIDATE',
82
+ 'WORKING-STORAGE', 'WRITE'), prefix=r'(^|(?<=[^\w\-]))',
83
+ suffix=r'\s*($|(?=[^\w\-]))'),
84
+ Keyword.Reserved),
85
+
86
+ # Reserved words
87
+ (words((
88
+ 'ACCESS', 'ADDRESS', 'ADVANCING', 'AFTER', 'ALL',
89
+ 'ALPHABET', 'ALPHABETIC', 'ALPHABETIC-LOWER', 'ALPHABETIC-UPPER',
90
+ 'ALPHANUMERIC', 'ALPHANUMERIC-EDITED', 'ALSO', 'ALTER', 'ALTERNATE',
91
+ 'ANY', 'ARE', 'AREA', 'AREAS', 'ARGUMENT-NUMBER', 'ARGUMENT-VALUE', 'AS',
92
+ 'ASCENDING', 'ASSIGN', 'AT', 'AUTO', 'AUTO-SKIP', 'AUTOMATIC',
93
+ 'AUTOTERMINATE', 'BACKGROUND-COLOR', 'BASED', 'BEEP', 'BEFORE', 'BELL',
94
+ 'BLANK', 'BLINK', 'BLOCK', 'BOTTOM', 'BY', 'BYTE-LENGTH', 'CHAINING',
95
+ 'CHARACTER', 'CHARACTERS', 'CLASS', 'CODE', 'CODE-SET', 'COL',
96
+ 'COLLATING', 'COLS', 'COLUMN', 'COLUMNS', 'COMMA', 'COMMAND-LINE',
97
+ 'COMMIT', 'COMMON', 'CONSTANT', 'CONTAINS', 'CONTENT', 'CONTROL',
98
+ 'CONTROLS', 'CONVERTING', 'COPY', 'CORR', 'CORRESPONDING', 'COUNT', 'CRT',
99
+ 'CURRENCY', 'CURSOR', 'CYCLE', 'DATE', 'DAY', 'DAY-OF-WEEK', 'DE',
100
+ 'DEBUGGING', 'DECIMAL-POINT', 'DECLARATIVES', 'DEFAULT', 'DELIMITED',
101
+ 'DELIMITER', 'DEPENDING', 'DESCENDING', 'DETAIL', 'DISK',
102
+ 'DOWN', 'DUPLICATES', 'DYNAMIC', 'EBCDIC',
103
+ 'ENTRY', 'ENVIRONMENT-NAME', 'ENVIRONMENT-VALUE', 'EOL', 'EOP',
104
+ 'EOS', 'ERASE', 'ERROR', 'ESCAPE', 'EXCEPTION',
105
+ 'EXCLUSIVE', 'EXTEND', 'EXTERNAL', 'FILE-ID', 'FILLER', 'FINAL',
106
+ 'FIRST', 'FIXED', 'FLOAT-LONG', 'FLOAT-SHORT',
107
+ 'FOOTING', 'FOR', 'FOREGROUND-COLOR', 'FORMAT', 'FROM', 'FULL',
108
+ 'FUNCTION', 'FUNCTION-ID', 'GIVING', 'GLOBAL', 'GROUP',
109
+ 'HEADING', 'HIGHLIGHT', 'I-O', 'ID',
110
+ 'IGNORE', 'IGNORING', 'IN', 'INDEX', 'INDEXED', 'INDICATE',
111
+ 'INITIAL', 'INITIALIZED', 'INPUT', 'INTO', 'INTRINSIC', 'INVALID',
112
+ 'IS', 'JUST', 'JUSTIFIED', 'KEY', 'LABEL',
113
+ 'LAST', 'LEADING', 'LEFT', 'LENGTH', 'LIMIT', 'LIMITS', 'LINAGE',
114
+ 'LINAGE-COUNTER', 'LINE', 'LINES', 'LOCALE', 'LOCK',
115
+ 'LOWLIGHT', 'MANUAL', 'MEMORY', 'MINUS', 'MODE', 'MULTIPLE',
116
+ 'NATIONAL', 'NATIONAL-EDITED', 'NATIVE', 'NEGATIVE', 'NEXT', 'NO',
117
+ 'NULL', 'NULLS', 'NUMBER', 'NUMBERS', 'NUMERIC', 'NUMERIC-EDITED',
118
+ 'OBJECT-COMPUTER', 'OCCURS', 'OF', 'OFF', 'OMITTED', 'ON', 'ONLY',
119
+ 'OPTIONAL', 'ORDER', 'ORGANIZATION', 'OTHER', 'OUTPUT', 'OVERFLOW',
120
+ 'OVERLINE', 'PACKED-DECIMAL', 'PADDING', 'PAGE', 'PARAGRAPH',
121
+ 'PLUS', 'POINTER', 'POSITION', 'POSITIVE', 'PRESENT', 'PREVIOUS',
122
+ 'PRINTER', 'PRINTING', 'PROCEDURE-POINTER', 'PROCEDURES',
123
+ 'PROCEED', 'PROGRAM', 'PROGRAM-POINTER', 'PROMPT', 'QUOTE',
124
+ 'QUOTES', 'RANDOM', 'RD', 'RECORD', 'RECORDING', 'RECORDS', 'RECURSIVE',
125
+ 'REDEFINES', 'REEL', 'REFERENCE', 'RELATIVE', 'REMAINDER', 'REMOVAL',
126
+ 'RENAMES', 'REPLACING', 'REPORT', 'REPORTING', 'REPORTS', 'REPOSITORY',
127
+ 'REQUIRED', 'RESERVE', 'RETURNING', 'REVERSE-VIDEO', 'REWIND',
128
+ 'RIGHT', 'ROLLBACK', 'ROUNDED', 'RUN', 'SAME', 'SCROLL',
129
+ 'SECURE', 'SEGMENT-LIMIT', 'SELECT', 'SENTENCE', 'SEPARATE',
130
+ 'SEQUENCE', 'SEQUENTIAL', 'SHARING', 'SIGN', 'SIGNED', 'SIGNED-INT',
131
+ 'SIGNED-LONG', 'SIGNED-SHORT', 'SIZE', 'SORT-MERGE', 'SOURCE',
132
+ 'SOURCE-COMPUTER', 'SPECIAL-NAMES', 'STANDARD',
133
+ 'STANDARD-1', 'STANDARD-2', 'STATUS', 'SUBKEY', 'SUM',
134
+ 'SYMBOLIC', 'SYNC', 'SYNCHRONIZED', 'TALLYING', 'TAPE',
135
+ 'TEST', 'THROUGH', 'THRU', 'TIME', 'TIMES', 'TO', 'TOP', 'TRAILING',
136
+ 'TRANSFORM', 'TYPE', 'UNDERLINE', 'UNIT', 'UNSIGNED',
137
+ 'UNSIGNED-INT', 'UNSIGNED-LONG', 'UNSIGNED-SHORT', 'UNTIL', 'UP',
138
+ 'UPDATE', 'UPON', 'USAGE', 'USING', 'VALUE', 'VALUES', 'VARYING',
139
+ 'WAIT', 'WHEN', 'WITH', 'WORDS', 'YYYYDDD', 'YYYYMMDD'),
140
+ prefix=r'(^|(?<=[^\w\-]))', suffix=r'\s*($|(?=[^\w\-]))'),
141
+ Keyword.Pseudo),
142
+
143
+ # inactive reserved words
144
+ (words((
145
+ 'ACTIVE-CLASS', 'ALIGNED', 'ANYCASE', 'ARITHMETIC', 'ATTRIBUTE',
146
+ 'B-AND', 'B-NOT', 'B-OR', 'B-XOR', 'BIT', 'BOOLEAN', 'CD', 'CENTER',
147
+ 'CF', 'CH', 'CHAIN', 'CLASS-ID', 'CLASSIFICATION', 'COMMUNICATION',
148
+ 'CONDITION', 'DATA-POINTER', 'DESTINATION', 'DISABLE', 'EC', 'EGI',
149
+ 'EMI', 'ENABLE', 'END-RECEIVE', 'ENTRY-CONVENTION', 'EO', 'ESI',
150
+ 'EXCEPTION-OBJECT', 'EXPANDS', 'FACTORY', 'FLOAT-BINARY-16',
151
+ 'FLOAT-BINARY-34', 'FLOAT-BINARY-7', 'FLOAT-DECIMAL-16',
152
+ 'FLOAT-DECIMAL-34', 'FLOAT-EXTENDED', 'FORMAT', 'FUNCTION-POINTER',
153
+ 'GET', 'GROUP-USAGE', 'IMPLEMENTS', 'INFINITY', 'INHERITS',
154
+ 'INTERFACE', 'INTERFACE-ID', 'INVOKE', 'LC_ALL', 'LC_COLLATE',
155
+ 'LC_CTYPE', 'LC_MESSAGES', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME',
156
+ 'LINE-COUNTER', 'MESSAGE', 'METHOD', 'METHOD-ID', 'NESTED', 'NONE',
157
+ 'NORMAL', 'OBJECT', 'OBJECT-REFERENCE', 'OPTIONS', 'OVERRIDE',
158
+ 'PAGE-COUNTER', 'PF', 'PH', 'PROPERTY', 'PROTOTYPE', 'PURGE',
159
+ 'QUEUE', 'RAISE', 'RAISING', 'RECEIVE', 'RELATION', 'REPLACE',
160
+ 'REPRESENTS-NOT-A-NUMBER', 'RESET', 'RESUME', 'RETRY', 'RF', 'RH',
161
+ 'SECONDS', 'SEGMENT', 'SELF', 'SEND', 'SOURCES', 'STATEMENT',
162
+ 'STEP', 'STRONG', 'SUB-QUEUE-1', 'SUB-QUEUE-2', 'SUB-QUEUE-3',
163
+ 'SUPER', 'SYMBOL', 'SYSTEM-DEFAULT', 'TABLE', 'TERMINAL', 'TEXT',
164
+ 'TYPEDEF', 'UCS-4', 'UNIVERSAL', 'USER-DEFAULT', 'UTF-16', 'UTF-8',
165
+ 'VAL-STATUS', 'VALID', 'VALIDATE', 'VALIDATE-STATUS'),
166
+ prefix=r'(^|(?<=[^\w\-]))', suffix=r'\s*($|(?=[^\w\-]))'),
167
+ Error),
168
+
169
+ # Data Types
170
+ (r'(^|(?<=[^\w\-]))'
171
+ r'(PIC\s+.+?(?=(\s|\.\s))|PICTURE\s+.+?(?=(\s|\.\s))|'
172
+ r'(COMPUTATIONAL)(-[1-5X])?|(COMP)(-[1-5X])?|'
173
+ r'BINARY-C-LONG|'
174
+ r'BINARY-CHAR|BINARY-DOUBLE|BINARY-LONG|BINARY-SHORT|'
175
+ r'BINARY)\s*($|(?=[^\w\-]))', Keyword.Type),
176
+
177
+ # Operators
178
+ (r'(\*\*|\*|\+|-|/|<=|>=|<|>|==|/=|=)', Operator),
179
+
180
+ # (r'(::)', Keyword.Declaration),
181
+
182
+ (r'([(),;:&%.])', Punctuation),
183
+
184
+ # Intrinsics
185
+ (r'(^|(?<=[^\w\-]))(ABS|ACOS|ANNUITY|ASIN|ATAN|BYTE-LENGTH|'
186
+ r'CHAR|COMBINED-DATETIME|CONCATENATE|COS|CURRENT-DATE|'
187
+ r'DATE-OF-INTEGER|DATE-TO-YYYYMMDD|DAY-OF-INTEGER|DAY-TO-YYYYDDD|'
188
+ r'EXCEPTION-(?:FILE|LOCATION|STATEMENT|STATUS)|EXP10|EXP|E|'
189
+ r'FACTORIAL|FRACTION-PART|INTEGER-OF-(?:DATE|DAY|PART)|INTEGER|'
190
+ r'LENGTH|LOCALE-(?:DATE|TIME(?:-FROM-SECONDS)?)|LOG(?:10)?|'
191
+ r'LOWER-CASE|MAX|MEAN|MEDIAN|MIDRANGE|MIN|MOD|NUMVAL(?:-C)?|'
192
+ r'ORD(?:-MAX|-MIN)?|PI|PRESENT-VALUE|RANDOM|RANGE|REM|REVERSE|'
193
+ r'SECONDS-FROM-FORMATTED-TIME|SECONDS-PAST-MIDNIGHT|SIGN|SIN|SQRT|'
194
+ r'STANDARD-DEVIATION|STORED-CHAR-LENGTH|SUBSTITUTE(?:-CASE)?|'
195
+ r'SUM|TAN|TEST-DATE-YYYYMMDD|TEST-DAY-YYYYDDD|TRIM|'
196
+ r'UPPER-CASE|VARIANCE|WHEN-COMPILED|YEAR-TO-YYYY)\s*'
197
+ r'($|(?=[^\w\-]))', Name.Function),
198
+
199
+ # Booleans
200
+ (r'(^|(?<=[^\w\-]))(true|false)\s*($|(?=[^\w\-]))', Name.Builtin),
201
+ # Comparing Operators
202
+ (r'(^|(?<=[^\w\-]))(equal|equals|ne|lt|le|gt|ge|'
203
+ r'greater|less|than|not|and|or)\s*($|(?=[^\w\-]))', Operator.Word),
204
+ ],
205
+
206
+ # \"[^\"\n]*\"|\'[^\'\n]*\'
207
+ 'strings': [
208
+ # apparently strings can be delimited by EOL if they are continued
209
+ # in the next line
210
+ (r'"[^"\n]*("|\n)', String.Double),
211
+ (r"'[^'\n]*('|\n)", String.Single),
212
+ ],
213
+
214
+ 'nums': [
215
+ (r'\d+(\s*|\.$|$)', Number.Integer),
216
+ (r'[+-]?\d*\.\d+(E[-+]?\d+)?', Number.Float),
217
+ (r'[+-]?\d+\.\d*(E[-+]?\d+)?', Number.Float),
218
+ ],
219
+ }
220
+
221
+
222
+ class CobolFreeformatLexer(CobolLexer):
223
+ """
224
+ Lexer for Free format OpenCOBOL code.
225
+ """
226
+ name = 'COBOLFree'
227
+ aliases = ['cobolfree']
228
+ filenames = ['*.cbl', '*.CBL']
229
+ mimetypes = []
230
+ url = 'https://opencobol.add1tocobol.com'
231
+ version_added = '1.6'
232
+
233
+ flags = re.IGNORECASE | re.MULTILINE
234
+
235
+ tokens = {
236
+ 'comment': [
237
+ (r'(\*>.*\n|^\w*\*.*$)', Comment),
238
+ ],
239
+ }
240
+
241
+
242
+ class ABAPLexer(RegexLexer):
243
+ """
244
+ Lexer for ABAP, SAP's integrated language.
245
+ """
246
+ name = 'ABAP'
247
+ aliases = ['abap']
248
+ filenames = ['*.abap', '*.ABAP']
249
+ mimetypes = ['text/x-abap']
250
+ url = 'https://community.sap.com/topics/abap'
251
+ version_added = '1.1'
252
+
253
+ flags = re.IGNORECASE | re.MULTILINE
254
+
255
+ tokens = {
256
+ 'common': [
257
+ (r'\s+', Whitespace),
258
+ (r'^\*.*$', Comment.Single),
259
+ (r'\".*?\n', Comment.Single),
260
+ (r'##\w+', Comment.Special),
261
+ ],
262
+ 'variable-names': [
263
+ (r'<\S+>', Name.Variable),
264
+ (r'\w[\w~]*(?:(\[\])|->\*)?', Name.Variable),
265
+ ],
266
+ 'root': [
267
+ include('common'),
268
+ # function calls
269
+ (r'CALL\s+(?:BADI|CUSTOMER-FUNCTION|FUNCTION)',
270
+ Keyword),
271
+ (r'(CALL\s+(?:DIALOG|SCREEN|SUBSCREEN|SELECTION-SCREEN|'
272
+ r'TRANSACTION|TRANSFORMATION))\b',
273
+ Keyword),
274
+ (r'(FORM|PERFORM)(\s+)(\w+)',
275
+ bygroups(Keyword, Whitespace, Name.Function)),
276
+ (r'(PERFORM)(\s+)(\()(\w+)(\))',
277
+ bygroups(Keyword, Whitespace, Punctuation, Name.Variable, Punctuation)),
278
+ (r'(MODULE)(\s+)(\S+)(\s+)(INPUT|OUTPUT)',
279
+ bygroups(Keyword, Whitespace, Name.Function, Whitespace, Keyword)),
280
+
281
+ # method implementation
282
+ (r'(METHOD)(\s+)([\w~]+)',
283
+ bygroups(Keyword, Whitespace, Name.Function)),
284
+ # method calls
285
+ (r'(\s+)([\w\-]+)([=\-]>)([\w\-~]+)',
286
+ bygroups(Whitespace, Name.Variable, Operator, Name.Function)),
287
+ # call methodnames returning style
288
+ (r'(?<=[=-]>)([\w\-~]+)(?=\()', Name.Function),
289
+
290
+ # text elements
291
+ (r'(TEXT)(-)(\d{3})',
292
+ bygroups(Keyword, Punctuation, Number.Integer)),
293
+ (r'(TEXT)(-)(\w{3})',
294
+ bygroups(Keyword, Punctuation, Name.Variable)),
295
+
296
+ # keywords with dashes in them.
297
+ # these need to be first, because for instance the -ID part
298
+ # of MESSAGE-ID wouldn't get highlighted if MESSAGE was
299
+ # first in the list of keywords.
300
+ (r'(ADD-CORRESPONDING|AUTHORITY-CHECK|'
301
+ r'CLASS-DATA|CLASS-EVENTS|CLASS-METHODS|CLASS-POOL|'
302
+ r'DELETE-ADJACENT|DIVIDE-CORRESPONDING|'
303
+ r'EDITOR-CALL|ENHANCEMENT-POINT|ENHANCEMENT-SECTION|EXIT-COMMAND|'
304
+ r'FIELD-GROUPS|FIELD-SYMBOLS|FIELD-SYMBOL|FUNCTION-POOL|'
305
+ r'INTERFACE-POOL|INVERTED-DATE|'
306
+ r'LOAD-OF-PROGRAM|LOG-POINT|'
307
+ r'MESSAGE-ID|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|'
308
+ r'NEW-LINE|NEW-PAGE|NEW-SECTION|NO-EXTENSION|'
309
+ r'OUTPUT-LENGTH|PRINT-CONTROL|'
310
+ r'SELECT-OPTIONS|START-OF-SELECTION|SUBTRACT-CORRESPONDING|'
311
+ r'SYNTAX-CHECK|SYSTEM-EXCEPTIONS|'
312
+ r'TYPE-POOL|TYPE-POOLS|NO-DISPLAY'
313
+ r')\b', Keyword),
314
+
315
+ # keyword kombinations
316
+ (r'(?<![-\>])(CREATE\s+(PUBLIC|PRIVATE|DATA|OBJECT)|'
317
+ r'(PUBLIC|PRIVATE|PROTECTED)\s+SECTION|'
318
+ r'(TYPE|LIKE)\s+((LINE\s+OF|REF\s+TO|'
319
+ r'(SORTED|STANDARD|HASHED)\s+TABLE\s+OF))?|'
320
+ r'FROM\s+(DATABASE|MEMORY)|CALL\s+METHOD|'
321
+ r'(GROUP|ORDER) BY|HAVING|SEPARATED BY|'
322
+ r'GET\s+(BADI|BIT|CURSOR|DATASET|LOCALE|PARAMETER|'
323
+ r'PF-STATUS|(PROPERTY|REFERENCE)\s+OF|'
324
+ r'RUN\s+TIME|TIME\s+(STAMP)?)?|'
325
+ r'SET\s+(BIT|BLANK\s+LINES|COUNTRY|CURSOR|DATASET|EXTENDED\s+CHECK|'
326
+ r'HANDLER|HOLD\s+DATA|LANGUAGE|LEFT\s+SCROLL-BOUNDARY|'
327
+ r'LOCALE|MARGIN|PARAMETER|PF-STATUS|PROPERTY\s+OF|'
328
+ r'RUN\s+TIME\s+(ANALYZER|CLOCK\s+RESOLUTION)|SCREEN|'
329
+ r'TITLEBAR|UPADTE\s+TASK\s+LOCAL|USER-COMMAND)|'
330
+ r'CONVERT\s+((INVERTED-)?DATE|TIME|TIME\s+STAMP|TEXT)|'
331
+ r'(CLOSE|OPEN)\s+(DATASET|CURSOR)|'
332
+ r'(TO|FROM)\s+(DATA BUFFER|INTERNAL TABLE|MEMORY ID|'
333
+ r'DATABASE|SHARED\s+(MEMORY|BUFFER))|'
334
+ r'DESCRIBE\s+(DISTANCE\s+BETWEEN|FIELD|LIST|TABLE)|'
335
+ r'FREE\s(MEMORY|OBJECT)?|'
336
+ r'PROCESS\s+(BEFORE\s+OUTPUT|AFTER\s+INPUT|'
337
+ r'ON\s+(VALUE-REQUEST|HELP-REQUEST))|'
338
+ r'AT\s+(LINE-SELECTION|USER-COMMAND|END\s+OF|NEW)|'
339
+ r'AT\s+SELECTION-SCREEN(\s+(ON(\s+(BLOCK|(HELP|VALUE)-REQUEST\s+FOR|'
340
+ r'END\s+OF|RADIOBUTTON\s+GROUP))?|OUTPUT))?|'
341
+ r'SELECTION-SCREEN:?\s+((BEGIN|END)\s+OF\s+((TABBED\s+)?BLOCK|LINE|'
342
+ r'SCREEN)|COMMENT|FUNCTION\s+KEY|'
343
+ r'INCLUDE\s+BLOCKS|POSITION|PUSHBUTTON|'
344
+ r'SKIP|ULINE)|'
345
+ r'LEAVE\s+(LIST-PROCESSING|PROGRAM|SCREEN|'
346
+ r'TO LIST-PROCESSING|TO TRANSACTION)'
347
+ r'(ENDING|STARTING)\s+AT|'
348
+ r'FORMAT\s+(COLOR|INTENSIFIED|INVERSE|HOTSPOT|INPUT|FRAMES|RESET)|'
349
+ r'AS\s+(CHECKBOX|SUBSCREEN|WINDOW)|'
350
+ r'WITH\s+(((NON-)?UNIQUE)?\s+KEY|FRAME)|'
351
+ r'(BEGIN|END)\s+OF|'
352
+ r'DELETE(\s+ADJACENT\s+DUPLICATES\sFROM)?|'
353
+ r'COMPARING(\s+ALL\s+FIELDS)?|'
354
+ r'(INSERT|APPEND)(\s+INITIAL\s+LINE\s+(IN)?TO|\s+LINES\s+OF)?|'
355
+ r'IN\s+((BYTE|CHARACTER)\s+MODE|PROGRAM)|'
356
+ r'END-OF-(DEFINITION|PAGE|SELECTION)|'
357
+ r'WITH\s+FRAME(\s+TITLE)|'
358
+ r'(REPLACE|FIND)\s+((FIRST|ALL)\s+OCCURRENCES?\s+OF\s+)?(SUBSTRING|REGEX)?|'
359
+ r'MATCH\s+(LENGTH|COUNT|LINE|OFFSET)|'
360
+ r'(RESPECTING|IGNORING)\s+CASE|'
361
+ r'IN\s+UPDATE\s+TASK|'
362
+ r'(SOURCE|RESULT)\s+(XML)?|'
363
+ r'REFERENCE\s+INTO|'
364
+
365
+ # simple kombinations
366
+ r'AND\s+(MARK|RETURN)|CLIENT\s+SPECIFIED|CORRESPONDING\s+FIELDS\s+OF|'
367
+ r'IF\s+FOUND|FOR\s+EVENT|INHERITING\s+FROM|LEAVE\s+TO\s+SCREEN|'
368
+ r'LOOP\s+AT\s+(SCREEN)?|LOWER\s+CASE|MATCHCODE\s+OBJECT|MODIF\s+ID|'
369
+ r'MODIFY\s+SCREEN|NESTING\s+LEVEL|NO\s+INTERVALS|OF\s+STRUCTURE|'
370
+ r'RADIOBUTTON\s+GROUP|RANGE\s+OF|REF\s+TO|SUPPRESS DIALOG|'
371
+ r'TABLE\s+OF|UPPER\s+CASE|TRANSPORTING\s+NO\s+FIELDS|'
372
+ r'VALUE\s+CHECK|VISIBLE\s+LENGTH|HEADER\s+LINE|COMMON\s+PART)\b', Keyword),
373
+
374
+ # single word keywords.
375
+ (r'(^|(?<=(\s|\.)))(ABBREVIATED|ABSTRACT|ADD|ALIASES|ALIGN|ALPHA|'
376
+ r'ASSERT|AS|ASSIGN(ING)?|AT(\s+FIRST)?|'
377
+ r'BACK|BLOCK|BREAK-POINT|'
378
+ r'CASE|CAST|CATCH|CHANGING|CHECK|CLASS|CLEAR|COLLECT|COLOR|COMMIT|COND|CONV|'
379
+ r'CREATE|COMMUNICATION|COMPONENTS?|COMPUTE|CONCATENATE|CONDENSE|'
380
+ r'CONSTANTS|CONTEXTS|CONTINUE|CONTROLS|COUNTRY|CURRENCY|'
381
+ r'DATA|DATE|DECIMALS|DEFAULT|DEFINE|DEFINITION|DEFERRED|DEMAND|'
382
+ r'DETAIL|DIRECTORY|DIVIDE|DO|DUMMY|'
383
+ r'ELSE(IF)?|ENDAT|ENDCASE|ENDCATCH|ENDCLASS|ENDDO|ENDFORM|ENDFUNCTION|'
384
+ r'ENDIF|ENDINTERFACE|ENDLOOP|ENDMETHOD|ENDMODULE|ENDSELECT|ENDTRY|ENDWHILE|'
385
+ r'ENHANCEMENT|EVENTS|EXACT|EXCEPTIONS?|EXIT|EXPONENT|EXPORT|EXPORTING|EXTRACT|'
386
+ r'FETCH|FIELDS?|FOR|FORM|FORMAT|FREE|FROM|FUNCTION|'
387
+ r'HIDE|'
388
+ r'ID|IF|IMPORT|IMPLEMENTATION|IMPORTING|IN|INCLUDE|INCLUDING|'
389
+ r'INDEX|INFOTYPES|INITIALIZATION|INTERFACE|INTERFACES|INTO|'
390
+ r'LANGUAGE|LEAVE|LENGTH|LINES|LOAD|LOCAL|'
391
+ r'JOIN|'
392
+ r'KEY|'
393
+ r'NEW|NEXT|'
394
+ r'MAXIMUM|MESSAGE|METHOD[S]?|MINIMUM|MODULE|MODIFIER|MODIFY|MOVE|MULTIPLY|'
395
+ r'NODES|NUMBER|'
396
+ r'OBLIGATORY|OBJECT|OF|OFF|ON|OTHERS|OVERLAY|'
397
+ r'PACK|PAD|PARAMETERS|PERCENTAGE|POSITION|PROGRAM|PROVIDE|PUBLIC|PUT|PF\d\d|'
398
+ r'RAISE|RAISING|RANGES?|READ|RECEIVE|REDEFINITION|REFRESH|REJECT|REPORT|RESERVE|'
399
+ r'REF|RESUME|RETRY|RETURN|RETURNING|RIGHT|ROLLBACK|REPLACE|'
400
+ r'SCROLL|SEARCH|SELECT|SHIFT|SIGN|SINGLE|SIZE|SKIP|SORT|SPLIT|STATICS|STOP|'
401
+ r'STYLE|SUBMATCHES|SUBMIT|SUBTRACT|SUM(?!\()|SUMMARY|SUMMING|SUPPLY|SWITCH|'
402
+ r'TABLE|TABLES|TIMESTAMP|TIMES?|TIMEZONE|TITLE|\??TO|'
403
+ r'TOP-OF-PAGE|TRANSFER|TRANSLATE|TRY|TYPES|'
404
+ r'ULINE|UNDER|UNPACK|UPDATE|USING|'
405
+ r'VALUE|VALUES|VIA|VARYING|VARY|'
406
+ r'WAIT|WHEN|WHERE|WIDTH|WHILE|WITH|WINDOW|WRITE|XSD|ZERO)\b', Keyword),
407
+
408
+ # builtins
409
+ (r'(abs|acos|asin|atan|'
410
+ r'boolc|boolx|bit_set|'
411
+ r'char_off|charlen|ceil|cmax|cmin|condense|contains|'
412
+ r'contains_any_of|contains_any_not_of|concat_lines_of|cos|cosh|'
413
+ r'count|count_any_of|count_any_not_of|'
414
+ r'dbmaxlen|distance|'
415
+ r'escape|exp|'
416
+ r'find|find_end|find_any_of|find_any_not_of|floor|frac|from_mixed|'
417
+ r'insert|'
418
+ r'lines|log|log10|'
419
+ r'match|matches|'
420
+ r'nmax|nmin|numofchar|'
421
+ r'repeat|replace|rescale|reverse|round|'
422
+ r'segment|shift_left|shift_right|sign|sin|sinh|sqrt|strlen|'
423
+ r'substring|substring_after|substring_from|substring_before|substring_to|'
424
+ r'tan|tanh|to_upper|to_lower|to_mixed|translate|trunc|'
425
+ r'xstrlen)(\()\b', bygroups(Name.Builtin, Punctuation)),
426
+
427
+ (r'&[0-9]', Name),
428
+ (r'[0-9]+', Number.Integer),
429
+
430
+ # operators which look like variable names before
431
+ # parsing variable names.
432
+ (r'(?<=(\s|.))(AND|OR|EQ|NE|GT|LT|GE|LE|CO|CN|CA|NA|CS|NOT|NS|CP|NP|'
433
+ r'BYTE-CO|BYTE-CN|BYTE-CA|BYTE-NA|BYTE-CS|BYTE-NS|'
434
+ r'IS\s+(NOT\s+)?(INITIAL|ASSIGNED|REQUESTED|BOUND))\b', Operator.Word),
435
+
436
+ include('variable-names'),
437
+
438
+ # standard operators after variable names,
439
+ # because < and > are part of field symbols.
440
+ (r'[?*<>=\-+&]', Operator),
441
+ (r"'(''|[^'])*'", String.Single),
442
+ (r"`([^`])*`", String.Single),
443
+ (r"([|}])([^{}|]*?)([|{])",
444
+ bygroups(Punctuation, String.Single, Punctuation)),
445
+ (r'[/;:()\[\],.]', Punctuation),
446
+ (r'(!)(\w+)', bygroups(Operator, Name)),
447
+ ],
448
+ }
449
+
450
+
451
+ class OpenEdgeLexer(RegexLexer):
452
+ """
453
+ Lexer for OpenEdge ABL (formerly Progress) source code.
454
+ """
455
+ name = 'OpenEdge ABL'
456
+ aliases = ['openedge', 'abl', 'progress']
457
+ filenames = ['*.p', '*.cls']
458
+ mimetypes = ['text/x-openedge', 'application/x-openedge']
459
+ url = 'https://www.progress.com/openedge/features/abl'
460
+ version_added = '1.5'
461
+
462
+ types = (r'(?i)(^|(?<=[^\w\-]))(CHARACTER|CHAR|CHARA|CHARAC|CHARACT|CHARACTE|'
463
+ r'COM-HANDLE|DATE|DATETIME|DATETIME-TZ|'
464
+ r'DECIMAL|DEC|DECI|DECIM|DECIMA|HANDLE|'
465
+ r'INT64|INTEGER|INT|INTE|INTEG|INTEGE|'
466
+ r'LOGICAL|LONGCHAR|MEMPTR|RAW|RECID|ROWID)\s*($|(?=[^\w\-]))')
467
+
468
+ keywords = words(OPENEDGEKEYWORDS,
469
+ prefix=r'(?i)(^|(?<=[^\w\-]))',
470
+ suffix=r'\s*($|(?=[^\w\-]))')
471
+
472
+ tokens = {
473
+ 'root': [
474
+ (r'/\*', Comment.Multiline, 'comment'),
475
+ (r'\{', Comment.Preproc, 'preprocessor'),
476
+ (r'\s*&.*', Comment.Preproc),
477
+ (r'0[xX][0-9a-fA-F]+[LlUu]*', Number.Hex),
478
+ (r'(?i)(DEFINE|DEF|DEFI|DEFIN)\b', Keyword.Declaration),
479
+ (types, Keyword.Type),
480
+ (keywords, Name.Builtin),
481
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
482
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
483
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
484
+ (r'[0-9]+', Number.Integer),
485
+ (r'\s+', Whitespace),
486
+ (r'[+*/=-]', Operator),
487
+ (r'[.:()]', Punctuation),
488
+ (r'.', Name.Variable), # Lazy catch-all
489
+ ],
490
+ 'comment': [
491
+ (r'[^*/]', Comment.Multiline),
492
+ (r'/\*', Comment.Multiline, '#push'),
493
+ (r'\*/', Comment.Multiline, '#pop'),
494
+ (r'[*/]', Comment.Multiline)
495
+ ],
496
+ 'preprocessor': [
497
+ (r'[^{}]', Comment.Preproc),
498
+ (r'\{', Comment.Preproc, '#push'),
499
+ (r'\}', Comment.Preproc, '#pop'),
500
+ ],
501
+ }
502
+
503
+ def analyse_text(text):
504
+ """Try to identify OpenEdge ABL based on a few common constructs."""
505
+ result = 0
506
+
507
+ if 'END.' in text:
508
+ result += 0.05
509
+
510
+ if 'END PROCEDURE.' in text:
511
+ result += 0.05
512
+
513
+ if 'ELSE DO:' in text:
514
+ result += 0.05
515
+
516
+ return result
517
+
518
+
519
+ class GoodDataCLLexer(RegexLexer):
520
+ """
521
+ Lexer for GoodData-CL script files.
522
+ """
523
+
524
+ name = 'GoodData-CL'
525
+ aliases = ['gooddata-cl']
526
+ filenames = ['*.gdc']
527
+ mimetypes = ['text/x-gooddata-cl']
528
+ url = 'https://github.com/gooddata/GoodData-CL'
529
+ version_added = '1.4'
530
+
531
+ flags = re.IGNORECASE
532
+
533
+ # Syntax:
534
+ # https://github.com/gooddata/GoodData-CL/raw/master/cli/src/main/resources/com/gooddata/processor/COMMANDS.txt
535
+ tokens = {
536
+ 'root': [
537
+ # Comments
538
+ (r'#.*', Comment.Single),
539
+ # Function call
540
+ (r'[a-z]\w*', Name.Function),
541
+ # Argument list
542
+ (r'\(', Punctuation, 'args-list'),
543
+ # Punctuation
544
+ (r';', Punctuation),
545
+ # Space is not significant
546
+ (r'\s+', Text)
547
+ ],
548
+ 'args-list': [
549
+ (r'\)', Punctuation, '#pop'),
550
+ (r',', Punctuation),
551
+ (r'[a-z]\w*', Name.Variable),
552
+ (r'=', Operator),
553
+ (r'"', String, 'string-literal'),
554
+ (r'[0-9]+(?:\.[0-9]+)?(?:e[+-]?[0-9]{1,3})?', Number),
555
+ # Space is not significant
556
+ (r'\s', Whitespace)
557
+ ],
558
+ 'string-literal': [
559
+ (r'\\[tnrfbae"\\]', String.Escape),
560
+ (r'"', String, '#pop'),
561
+ (r'[^\\"]+', String)
562
+ ]
563
+ }
564
+
565
+
566
+ class MaqlLexer(RegexLexer):
567
+ """
568
+ Lexer for GoodData MAQL scripts.
569
+ """
570
+
571
+ name = 'MAQL'
572
+ aliases = ['maql']
573
+ filenames = ['*.maql']
574
+ mimetypes = ['text/x-gooddata-maql', 'application/x-gooddata-maql']
575
+ url = 'https://help.gooddata.com/doc/enterprise/en/dashboards-and-insights/maql-analytical-query-language'
576
+ version_added = '1.4'
577
+
578
+ flags = re.IGNORECASE
579
+ tokens = {
580
+ 'root': [
581
+ # IDENTITY
582
+ (r'IDENTIFIER\b', Name.Builtin),
583
+ # IDENTIFIER
584
+ (r'\{[^}]+\}', Name.Variable),
585
+ # NUMBER
586
+ (r'[0-9]+(?:\.[0-9]+)?(?:e[+-]?[0-9]{1,3})?', Number),
587
+ # STRING
588
+ (r'"', String, 'string-literal'),
589
+ # RELATION
590
+ (r'\<\>|\!\=', Operator),
591
+ (r'\=|\>\=|\>|\<\=|\<', Operator),
592
+ # :=
593
+ (r'\:\=', Operator),
594
+ # OBJECT
595
+ (r'\[[^]]+\]', Name.Variable.Class),
596
+ # keywords
597
+ (words((
598
+ 'DIMENSION', 'DIMENSIONS', 'BOTTOM', 'METRIC', 'COUNT', 'OTHER',
599
+ 'FACT', 'WITH', 'TOP', 'OR', 'ATTRIBUTE', 'CREATE', 'PARENT',
600
+ 'FALSE', 'ROW', 'ROWS', 'FROM', 'ALL', 'AS', 'PF', 'COLUMN',
601
+ 'COLUMNS', 'DEFINE', 'REPORT', 'LIMIT', 'TABLE', 'LIKE', 'AND',
602
+ 'BY', 'BETWEEN', 'EXCEPT', 'SELECT', 'MATCH', 'WHERE', 'TRUE',
603
+ 'FOR', 'IN', 'WITHOUT', 'FILTER', 'ALIAS', 'WHEN', 'NOT', 'ON',
604
+ 'KEYS', 'KEY', 'FULLSET', 'PRIMARY', 'LABELS', 'LABEL',
605
+ 'VISUAL', 'TITLE', 'DESCRIPTION', 'FOLDER', 'ALTER', 'DROP',
606
+ 'ADD', 'DATASET', 'DATATYPE', 'INT', 'BIGINT', 'DOUBLE', 'DATE',
607
+ 'VARCHAR', 'DECIMAL', 'SYNCHRONIZE', 'TYPE', 'DEFAULT', 'ORDER',
608
+ 'ASC', 'DESC', 'HYPERLINK', 'INCLUDE', 'TEMPLATE', 'MODIFY'),
609
+ suffix=r'\b'),
610
+ Keyword),
611
+ # FUNCNAME
612
+ (r'[a-z]\w*\b', Name.Function),
613
+ # Comments
614
+ (r'#.*', Comment.Single),
615
+ # Punctuation
616
+ (r'[,;()]', Punctuation),
617
+ # Space is not significant
618
+ (r'\s+', Whitespace)
619
+ ],
620
+ 'string-literal': [
621
+ (r'\\[tnrfbae"\\]', String.Escape),
622
+ (r'"', String, '#pop'),
623
+ (r'[^\\"]+', String)
624
+ ],
625
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/c_cpp.py ADDED
@@ -0,0 +1,481 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.c_cpp
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for C/C++ languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups, using, \
14
+ this, inherit, default, words
15
+ from pygments.util import get_bool_opt
16
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
17
+ Number, Punctuation, Whitespace
18
+
19
+ __all__ = ['CLexer', 'CppLexer']
20
+
21
+
22
+ class CFamilyLexer(RegexLexer):
23
+ """
24
+ For C family source code. This is used as a base class to avoid repetitious
25
+ definitions.
26
+ """
27
+
28
+ # The trailing ?, rather than *, avoids a geometric performance drop here.
29
+ #: only one /* */ style comment
30
+ _ws1 = r'\s*(?:/[*].*?[*]/\s*)?'
31
+
32
+ # Hexadecimal part in an hexadecimal integer/floating-point literal.
33
+ # This includes decimal separators matching.
34
+ _hexpart = r'[0-9a-fA-F](\'?[0-9a-fA-F])*'
35
+ # Decimal part in an decimal integer/floating-point literal.
36
+ # This includes decimal separators matching.
37
+ _decpart = r'\d(\'?\d)*'
38
+ # Integer literal suffix (e.g. 'ull' or 'll').
39
+ _intsuffix = r'(([uU]?[zZ])|([zZ][uU])|([uU][lL]{0,2})|([lL]{1,2}[uU]?))?'
40
+
41
+ # Identifier regex with C and C++ Universal Character Name (UCN) support.
42
+ _ident = r'(?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8})+'
43
+ _namespaced_ident = r'(?!\d)(?:[\w$]|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|::)+'
44
+
45
+ # Single and multiline comment regexes
46
+ # Beware not to use *? for the inner content! When these regexes
47
+ # are embedded in larger regexes, that can cause the stuff*? to
48
+ # match more than it would have if the regex had been used in
49
+ # a standalone way ...
50
+ _comment_single = r'//(?:.|(?<=\\)\n)*\n'
51
+ _comment_multiline = r'/(?:\\\n)?[*](?:[^*]|[*](?!(?:\\\n)?/))*[*](?:\\\n)?/'
52
+
53
+ # Regex to match optional comments
54
+ _possible_comments = rf'\s*(?:(?:(?:{_comment_single})|(?:{_comment_multiline}))\s*)*'
55
+
56
+ tokens = {
57
+ 'whitespace': [
58
+ # preprocessor directives: without whitespace
59
+ (r'^#if\s+0', Comment.Preproc, 'if0'),
60
+ ('^#', Comment.Preproc, 'macro'),
61
+ # or with whitespace
62
+ ('^(' + _ws1 + r')(#if\s+0)',
63
+ bygroups(using(this), Comment.Preproc), 'if0'),
64
+ ('^(' + _ws1 + ')(#)',
65
+ bygroups(using(this), Comment.Preproc), 'macro'),
66
+ # Labels:
67
+ # Line start and possible indentation.
68
+ (r'(^[ \t]*)'
69
+ # Not followed by keywords which can be mistaken as labels.
70
+ r'(?!(?:public|private|protected|default)\b)'
71
+ # Actual label, followed by a single colon.
72
+ r'(' + _ident + r')(\s*)(:)(?!:)',
73
+ bygroups(Whitespace, Name.Label, Whitespace, Punctuation)),
74
+ (r'\n', Whitespace),
75
+ (r'[^\S\n]+', Whitespace),
76
+ (r'\\\n', Text), # line continuation
77
+ (_comment_single, Comment.Single),
78
+ (_comment_multiline, Comment.Multiline),
79
+ # Open until EOF, so no ending delimiter
80
+ (r'/(\\\n)?[*][\w\W]*', Comment.Multiline),
81
+ ],
82
+ 'statements': [
83
+ include('keywords'),
84
+ include('types'),
85
+ (r'([LuU]|u8)?(")', bygroups(String.Affix, String), 'string'),
86
+ (r"([LuU]|u8)?(')(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])(')",
87
+ bygroups(String.Affix, String.Char, String.Char, String.Char)),
88
+
89
+ # Hexadecimal floating-point literals (C11, C++17)
90
+ (r'0[xX](' + _hexpart + r'\.' + _hexpart + r'|\.' + _hexpart +
91
+ r'|' + _hexpart + r')[pP][+-]?' + _hexpart + r'[lL]?', Number.Float),
92
+
93
+ (r'(-)?(' + _decpart + r'\.' + _decpart + r'|\.' + _decpart + r'|' +
94
+ _decpart + r')[eE][+-]?' + _decpart + r'[fFlL]?', Number.Float),
95
+ (r'(-)?((' + _decpart + r'\.(' + _decpart + r')?|\.' +
96
+ _decpart + r')[fFlL]?)|(' + _decpart + r'[fFlL])', Number.Float),
97
+ (r'(-)?0[xX]' + _hexpart + _intsuffix, Number.Hex),
98
+ (r'(-)?0[bB][01](\'?[01])*' + _intsuffix, Number.Bin),
99
+ (r'(-)?0(\'?[0-7])+' + _intsuffix, Number.Oct),
100
+ (r'(-)?' + _decpart + _intsuffix, Number.Integer),
101
+ (r'[~!%^&*+=|?:<>/-]', Operator),
102
+ (r'[()\[\],.]', Punctuation),
103
+ (r'(true|false|NULL|nullptr)\b', Name.Builtin),
104
+ (_ident, Name)
105
+ ],
106
+ 'types': [
107
+ (words(('int8', 'int16', 'int32', 'int64', 'wchar_t'), prefix=r'__',
108
+ suffix=r'\b'), Keyword.Reserved),
109
+ (words(('bool', 'int', 'long', 'float', 'short', 'double', 'char',
110
+ 'unsigned', 'signed', 'void', '_BitInt',
111
+ '__int128'), suffix=r'\b'), Keyword.Type)
112
+ ],
113
+ 'keywords': [
114
+ (r'(struct|union)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
115
+ (r'case\b', Keyword, 'case-value'),
116
+ (words(('asm', 'auto', 'break', 'const', 'constexpr', 'continue', 'countof', 'default',
117
+ 'defer', 'do', 'else', 'enum', 'extern', 'for', 'goto', 'if', 'register',
118
+ 'restricted', 'return', 'sizeof', 'struct', 'static', 'switch',
119
+ 'typedef', 'typeof', 'typeof_unqual', 'volatile', 'while', 'union',
120
+ 'thread_local', 'alignas', 'alignof', 'static_assert', '_Pragma', 'fortran'),
121
+ suffix=r'\b'), Keyword),
122
+ (words(('inline', '_inline', '__inline', 'naked', 'restrict',
123
+ 'thread'), suffix=r'\b'), Keyword.Reserved),
124
+ # Vector intrinsics
125
+ (r'(__m(128i|128d|128|64))\b', Keyword.Reserved),
126
+ # Microsoft-isms
127
+ (words((
128
+ 'asm', 'based', 'except', 'stdcall', 'cdecl',
129
+ 'fastcall', 'declspec', 'finally', 'try',
130
+ 'leave', 'w64', 'unaligned', 'raise', 'noop',
131
+ 'identifier', 'forceinline', 'assume', 'null'),
132
+ prefix=r'__', suffix=r'\b'), Keyword.Reserved)
133
+ ],
134
+ 'root': [
135
+ include('whitespace'),
136
+ include('keywords'),
137
+ # functions
138
+ (r'(' + _namespaced_ident + r'(?:[&*\s])+)' # return arguments
139
+ r'(' + _possible_comments + r')'
140
+ r'(' + _namespaced_ident + r')' # method name
141
+ r'(' + _possible_comments + r')'
142
+ r'(\([^;"\')]*?\))' # signature
143
+ r'(' + _possible_comments + r')'
144
+ r'([^;{/"\']*)(\{)',
145
+ bygroups(using(this), using(this, state='whitespace'),
146
+ Name.Function, using(this, state='whitespace'),
147
+ using(this), using(this, state='whitespace'),
148
+ using(this), Punctuation),
149
+ 'function'),
150
+ # function declarations
151
+ (r'(' + _namespaced_ident + r'(?:[&*\s])+)' # return arguments
152
+ r'(' + _possible_comments + r')'
153
+ r'(' + _namespaced_ident + r')' # method name
154
+ r'(' + _possible_comments + r')'
155
+ r'(\([^;"\')]*?\))' # signature
156
+ r'(' + _possible_comments + r')'
157
+ r'([^;/"\']*)(;)',
158
+ bygroups(using(this), using(this, state='whitespace'),
159
+ Name.Function, using(this, state='whitespace'),
160
+ using(this), using(this, state='whitespace'),
161
+ using(this), Punctuation)),
162
+ include('types'),
163
+ default('statement'),
164
+ ],
165
+ 'statement': [
166
+ include('whitespace'),
167
+ include('statements'),
168
+ (r'\}', Punctuation),
169
+ (r'[{;]', Punctuation, '#pop'),
170
+ ],
171
+ 'function': [
172
+ include('whitespace'),
173
+ include('statements'),
174
+ (';', Punctuation),
175
+ (r'\{', Punctuation, '#push'),
176
+ (r'\}', Punctuation, '#pop'),
177
+ ],
178
+ 'string': [
179
+ (r'"', String, '#pop'),
180
+ (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|'
181
+ r'u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})', String.Escape),
182
+ (r'[^\\"\n]+', String), # all other characters
183
+ (r'\\\n', String), # line continuation
184
+ (r'\\', String), # stray backslash
185
+ ],
186
+ 'macro': [
187
+ (r'('+_ws1+r')(include)('+_ws1+r')("[^"]+"|<[^>]+>)([^\S\n]*)([^/\n]*/[*][\s\S]*?[*]/)',
188
+ bygroups(using(this), Comment.Preproc, using(this),
189
+ Comment.PreprocFile, using(this), Comment.Multiline)),
190
+ (r'('+_ws1+r')(include)('+_ws1+r')("[^"]+"|<[^>]+>)([^\S\n]*)([^\n]*)',
191
+ bygroups(using(this), Comment.Preproc, using(this),
192
+ Comment.PreprocFile, using(this), Comment.Single)),
193
+ (r'[^/\n]+', Comment.Preproc),
194
+ (r'/[*][\s\S]*?[*]/', Comment.Multiline),
195
+ (r'//.*?\n', Comment.Single, '#pop'),
196
+ (r'/', Comment.Preproc),
197
+ (r'(?<=\\)\n', Comment.Preproc),
198
+ (r'\n', Comment.Preproc, '#pop'),
199
+ ],
200
+ 'if0': [
201
+ (r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
202
+ (r'^\s*#el(?:se|if).*\n', Comment.Preproc, '#pop'),
203
+ (r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
204
+ (r'.*?\n', Comment),
205
+ ],
206
+ 'classname': [
207
+ include('whitespace'),
208
+ # C/C++ attributes before type name
209
+ (r'\[\[(?=[^\[\]]*\]\])', Punctuation, 'attribute'),
210
+ (_ident, Name.Class, '#pop'),
211
+ # template specification
212
+ (r'\s*(?=>)', Text, '#pop'),
213
+ default('#pop')
214
+ ],
215
+ # Mark identifiers preceded by `case` keyword as constants.
216
+ 'case-value': [
217
+ (r'(?<!:)(:)(?!:)', Punctuation, '#pop'),
218
+ (_ident, Name.Constant),
219
+ include('whitespace'),
220
+ include('statements'),
221
+ ],
222
+ 'attribute': [
223
+ (r'\]\]', Punctuation, '#pop'),
224
+ (_ident, Name.Attribute),
225
+ (r'\(', Punctuation, 'attribute-args'),
226
+ (r'::', Punctuation),
227
+ (r',', Punctuation),
228
+ include('whitespace'),
229
+ ],
230
+ 'attribute-args': [
231
+ (r'\)', Punctuation, '#pop'),
232
+ (r'\(', Punctuation, '#push'),
233
+ include('statements'),
234
+ ],
235
+ }
236
+
237
+ stdlib_types = {
238
+ 'size_t', 'ssize_t', 'off_t', 'wchar_t', 'ptrdiff_t', 'sig_atomic_t', 'fpos_t',
239
+ 'clock_t', 'time_t', 'va_list', 'jmp_buf', 'FILE', 'DIR', 'div_t', 'ldiv_t',
240
+ 'mbstate_t', 'wctrans_t', 'wint_t', 'wctype_t', 'byte'}
241
+ c99_types = {
242
+ 'int8_t', 'int16_t', 'int32_t', 'int64_t', 'uint8_t',
243
+ 'uint16_t', 'uint32_t', 'uint64_t', 'int_least8_t', 'int_least16_t',
244
+ 'int_least32_t', 'int_least64_t', 'uint_least8_t', 'uint_least16_t',
245
+ 'uint_least32_t', 'uint_least64_t', 'int_fast8_t', 'int_fast16_t', 'int_fast32_t',
246
+ 'int_fast64_t', 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t', 'uint_fast64_t',
247
+ 'intptr_t', 'uintptr_t', 'intmax_t', 'uintmax_t'}
248
+ linux_types = {
249
+ 'clockid_t', 'cpu_set_t', 'cpumask_t', 'dev_t', 'gid_t', 'id_t', 'ino_t', 'key_t',
250
+ 'mode_t', 'nfds_t', 'pid_t', 'rlim_t', 'sig_t', 'sighandler_t', 'siginfo_t',
251
+ 'sigset_t', 'sigval_t', 'socklen_t', 'timer_t', 'uid_t'}
252
+ c11_atomic_types = {
253
+ 'atomic_bool', 'atomic_char', 'atomic_schar', 'atomic_uchar', 'atomic_short',
254
+ 'atomic_ushort', 'atomic_int', 'atomic_uint', 'atomic_long', 'atomic_ulong',
255
+ 'atomic_llong', 'atomic_ullong', 'atomic_char16_t', 'atomic_char32_t', 'atomic_wchar_t',
256
+ 'atomic_int_least8_t', 'atomic_uint_least8_t', 'atomic_int_least16_t',
257
+ 'atomic_uint_least16_t', 'atomic_int_least32_t', 'atomic_uint_least32_t',
258
+ 'atomic_int_least64_t', 'atomic_uint_least64_t', 'atomic_int_fast8_t',
259
+ 'atomic_uint_fast8_t', 'atomic_int_fast16_t', 'atomic_uint_fast16_t',
260
+ 'atomic_int_fast32_t', 'atomic_uint_fast32_t', 'atomic_int_fast64_t',
261
+ 'atomic_uint_fast64_t', 'atomic_intptr_t', 'atomic_uintptr_t', 'atomic_size_t',
262
+ 'atomic_ptrdiff_t', 'atomic_intmax_t', 'atomic_uintmax_t'}
263
+
264
+ def __init__(self, **options):
265
+ self.stdlibhighlighting = get_bool_opt(options, 'stdlibhighlighting', True)
266
+ self.c99highlighting = get_bool_opt(options, 'c99highlighting', True)
267
+ self.c11highlighting = get_bool_opt(options, 'c11highlighting', True)
268
+ self.platformhighlighting = get_bool_opt(options, 'platformhighlighting', True)
269
+ RegexLexer.__init__(self, **options)
270
+
271
+ def get_tokens_unprocessed(self, text, stack=('root',)):
272
+ for index, token, value in \
273
+ RegexLexer.get_tokens_unprocessed(self, text, stack):
274
+ if token is Name:
275
+ if self.stdlibhighlighting and value in self.stdlib_types:
276
+ token = Keyword.Type
277
+ elif self.c99highlighting and value in self.c99_types:
278
+ token = Keyword.Type
279
+ elif self.c11highlighting and value in self.c11_atomic_types:
280
+ token = Keyword.Type
281
+ elif self.platformhighlighting and value in self.linux_types:
282
+ token = Keyword.Type
283
+ yield index, token, value
284
+
285
+
286
+ class CLexer(CFamilyLexer):
287
+ """
288
+ For C source code with preprocessor directives.
289
+
290
+ Additional options accepted:
291
+
292
+ `stdlibhighlighting`
293
+ Highlight common types found in the C/C++ standard library (e.g. `size_t`).
294
+ (default: ``True``).
295
+
296
+ `c99highlighting`
297
+ Highlight common types found in the C99 standard library (e.g. `int8_t`).
298
+ Actually, this includes all fixed-width integer types.
299
+ (default: ``True``).
300
+
301
+ `c11highlighting`
302
+ Highlight atomic types found in the C11 standard library (e.g. `atomic_bool`).
303
+ (default: ``True``).
304
+
305
+ `platformhighlighting`
306
+ Highlight common types found in the platform SDK headers (e.g. `clockid_t` on Linux).
307
+ (default: ``True``).
308
+ """
309
+ name = 'C'
310
+ aliases = ['c']
311
+ filenames = ['*.c', '*.h', '*.idc', '*.x[bp]m']
312
+ mimetypes = ['text/x-chdr', 'text/x-csrc', 'image/x-xbitmap', 'image/x-xpixmap']
313
+ url = 'https://en.wikipedia.org/wiki/C_(programming_language)'
314
+ version_added = ''
315
+ priority = 0.1
316
+
317
+ tokens = {
318
+ 'statements': [
319
+ # C23 attributes [[...]] — lookahead to avoid matching ObjC's [[obj msg] msg]
320
+ (r'\[\[(?=[^\[\]]*\]\])', Punctuation, 'attribute'),
321
+ inherit,
322
+ ],
323
+ 'keywords': [
324
+ (words((
325
+ '_Alignas', '_Alignof', '_Noreturn', '_Countof', '_Generic', '_Thread_local',
326
+ '_Static_assert', '_Imaginary', 'noreturn', 'imaginary', 'complex'),
327
+ suffix=r'\b'), Keyword),
328
+ inherit
329
+ ],
330
+ 'types': [
331
+ (words(('_Bool', '_Complex', '_Atomic', '_Decimal32', '_Decimal64', '_Decimal128'), suffix=r'\b'), Keyword.Type),
332
+ inherit
333
+ ]
334
+ }
335
+
336
+ def analyse_text(text):
337
+ if re.search(r'^\s*#include [<"]', text, re.MULTILINE):
338
+ return 0.1
339
+ if re.search(r'^\s*#ifn?def ', text, re.MULTILINE):
340
+ return 0.1
341
+
342
+
343
+ class CppLexer(CFamilyLexer):
344
+ """
345
+ For C++ source code with preprocessor directives.
346
+
347
+ Additional options accepted:
348
+
349
+ `stdlibhighlighting`
350
+ Highlight common types found in the C/C++ standard library (e.g. `size_t`).
351
+ (default: ``True``).
352
+
353
+ `c99highlighting`
354
+ Highlight common types found in the C99 standard library (e.g. `int8_t`).
355
+ Actually, this includes all fixed-width integer types.
356
+ (default: ``True``).
357
+
358
+ `c11highlighting`
359
+ Highlight atomic types found in the C11 standard library (e.g. `atomic_bool`).
360
+ (default: ``True``).
361
+
362
+ `platformhighlighting`
363
+ Highlight common types found in the platform SDK headers (e.g. `clockid_t` on Linux).
364
+ (default: ``True``).
365
+ """
366
+ name = 'C++'
367
+ url = 'https://isocpp.org/'
368
+ aliases = ['cpp', 'c++']
369
+ filenames = ['*.cpp', '*.hpp', '*.c++', '*.h++',
370
+ '*.cc', '*.hh', '*.cxx', '*.hxx',
371
+ '*.C', '*.H', '*.cp', '*.CPP', '*.tpp',
372
+ '*.cppm', '*.ixx', '*.mxx', '*.ipp']
373
+ mimetypes = ['text/x-c++hdr', 'text/x-c++src']
374
+ version_added = ''
375
+ priority = 0.1
376
+
377
+ tokens = {
378
+ 'statements': [
379
+ # C++11 raw strings
380
+ (r'((?:[LuU]|u8)?R)(")([^\\()\s]{,16})(\()([\s\S]*?)(\)\3)(")',
381
+ bygroups(String.Affix, String, String.Delimiter, String.Delimiter,
382
+ String, String.Delimiter, String)),
383
+ # C++26 annotations [[=Annotation]]
384
+ (r'(\[\[)(=)(' + CFamilyLexer._ident + r')',
385
+ bygroups(Punctuation, Punctuation, Name.Decorator), 'annotation'),
386
+ # C++11 attributes [[...]]
387
+ (r'\[\[(?=[^\[\]]*\]\])', Punctuation, 'attribute'),
388
+ inherit,
389
+ ],
390
+ 'root': [
391
+ inherit,
392
+ # C++ Microsoft-isms
393
+ (words(('virtual_inheritance', 'uuidof', 'super', 'extends', 'single_inheritance',
394
+ 'multiple_inheritance', 'interface', 'implements', 'event', 'finally', 'null'),
395
+ prefix=r'__', suffix=r'\b'), Keyword.Reserved),
396
+ # Offload C++ extensions, http://offload.codeplay.com/
397
+ (r'__(offload|blockingoffload|outer)\b', Keyword.Pseudo),
398
+ ],
399
+ 'classname': [
400
+ include('whitespace'),
401
+ # C++26 annotations before type name
402
+ (r'(\[\[)(=)(' + CFamilyLexer._ident + r')',
403
+ bygroups(Punctuation, Punctuation, Name.Decorator), 'annotation'),
404
+ # C++ attributes before type name
405
+ (r'\[\[(?=[^\[\]]*\]\])', Punctuation, 'attribute'),
406
+ (CFamilyLexer._ident, Name.Class, '#pop'),
407
+ # template specification
408
+ (r'\s*(?=>)', Text, '#pop'),
409
+ default('#pop')
410
+ ],
411
+ 'enumname': [
412
+ include('whitespace'),
413
+ # 'enum class' and 'enum struct' C++11 support
414
+ (words(('class', 'struct'), suffix=r'\b'), Keyword),
415
+ # C++26 annotations before enum name
416
+ (r'(\[\[)(=)(' + CFamilyLexer._ident + r')',
417
+ bygroups(Punctuation, Punctuation, Name.Decorator), 'annotation'),
418
+ # C++ attributes before enum name
419
+ (r'\[\[(?=[^\[\]]*\]\])', Punctuation, 'attribute'),
420
+ (CFamilyLexer._ident, Name.Class, '#pop'),
421
+ # template specification
422
+ (r'\s*(?=>)', Text, '#pop'),
423
+ default('#pop')
424
+ ],
425
+ 'attribute': [
426
+ (r'using\b', Keyword),
427
+ (r':', Punctuation),
428
+ inherit,
429
+ ],
430
+ 'keywords': [
431
+ (r'(class|concept|typename)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
432
+ (words((
433
+ 'catch', 'const_cast', 'delete', 'dynamic_cast', 'explicit',
434
+ 'export', 'friend', 'mutable', 'new', 'operator',
435
+ 'private', 'protected', 'public', 'reinterpret_cast', 'class',
436
+ '__restrict', 'static_cast', 'template', 'this', 'throw', 'throws',
437
+ 'try', 'typeid', 'using', 'virtual', 'concept',
438
+ 'decltype', 'noexcept', 'override', 'final', 'constinit', 'consteval',
439
+ 'co_await', 'co_return', 'co_yield', 'requires', 'import', 'module',
440
+ 'typename', 'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not',
441
+ 'not_eq', 'or', 'or_eq', 'xor', 'xor_eq', 'contract_assert', 'pre', 'post'),
442
+ suffix=r'\b'), Keyword),
443
+ (r'namespace\b', Keyword, 'namespace'),
444
+ (r'(enum)(\s+)', bygroups(Keyword, Whitespace), 'enumname'),
445
+ inherit
446
+ ],
447
+ 'types': [
448
+ (r'char(16_t|32_t|8_t)\b', Keyword.Type),
449
+ inherit
450
+ ],
451
+ 'namespace': [
452
+ (r';', Punctuation, ('#pop', 'root')),
453
+ (r'\{', Punctuation, ('#pop', 'namespace-body')),
454
+ (r'inline\b', Keyword.Reserved),
455
+ (CFamilyLexer._ident, Name.Namespace),
456
+ include('statement')
457
+ ],
458
+ 'namespace-body': [
459
+ (r'\}', Punctuation, '#pop'),
460
+ include('root'),
461
+ ],
462
+ 'annotation': [
463
+ (r'\]\]', Punctuation, '#pop'),
464
+ (r'\(', Punctuation, 'annotation-args'),
465
+ (r'::', Punctuation),
466
+ (r',', Punctuation),
467
+ (CFamilyLexer._ident, Name.Decorator),
468
+ include('whitespace'),
469
+ ],
470
+ 'annotation-args': [
471
+ (r'\)', Punctuation, '#pop'),
472
+ (r'\(', Punctuation, '#push'),
473
+ include('statements'),
474
+ ],
475
+ }
476
+
477
+ def analyse_text(text):
478
+ if re.search('#include <[a-z_]+>', text):
479
+ return 0.2
480
+ if re.search('using namespace ', text):
481
+ return 0.4
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/c_like.py ADDED
@@ -0,0 +1,743 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.c_like
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for other C-like languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups, inherit, words, \
14
+ default
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Whitespace
17
+
18
+ from pygments.lexers.c_cpp import CLexer, CppLexer
19
+ from pygments.lexers import _mql_builtins
20
+
21
+ __all__ = ['PikeLexer', 'NesCLexer', 'ClayLexer', 'ECLexer', 'ValaLexer',
22
+ 'CudaLexer', 'SwigLexer', 'MqlLexer', 'ArduinoLexer', 'CharmciLexer',
23
+ 'OmgIdlLexer', 'PromelaLexer']
24
+
25
+
26
+ class PikeLexer(CppLexer):
27
+ """
28
+ For `Pike <http://pike.lysator.liu.se/>`_ source code.
29
+ """
30
+ name = 'Pike'
31
+ aliases = ['pike']
32
+ filenames = ['*.pike', '*.pmod']
33
+ mimetypes = ['text/x-pike']
34
+ version_added = '2.0'
35
+
36
+ tokens = {
37
+ 'statements': [
38
+ (words((
39
+ 'catch', 'new', 'private', 'protected', 'public', 'gauge',
40
+ 'throw', 'throws', 'class', 'interface', 'implement', 'abstract',
41
+ 'extends', 'from', 'this', 'super', 'constant', 'final', 'static',
42
+ 'import', 'use', 'extern', 'inline', 'proto', 'break', 'continue',
43
+ 'if', 'else', 'for', 'while', 'do', 'switch', 'case', 'as', 'in',
44
+ 'version', 'return', 'true', 'false', 'null',
45
+ '__VERSION__', '__MAJOR__', '__MINOR__', '__BUILD__', '__REAL_VERSION__',
46
+ '__REAL_MAJOR__', '__REAL_MINOR__', '__REAL_BUILD__', '__DATE__', '__TIME__',
47
+ '__FILE__', '__DIR__', '__LINE__', '__AUTO_BIGNUM__', '__NT__', '__PIKE__',
48
+ '__amigaos__', '_Pragma', 'static_assert', 'defined', 'sscanf'), suffix=r'\b'),
49
+ Keyword),
50
+ (r'(bool|int|long|float|short|double|char|string|object|void|mapping|'
51
+ r'array|multiset|program|function|lambda|mixed|'
52
+ r'[a-z_][a-z0-9_]*_t)\b',
53
+ Keyword.Type),
54
+ (r'(class)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
55
+ (r'[~!%^&*+=|?:<>/@-]', Operator),
56
+ inherit,
57
+ ],
58
+ 'classname': [
59
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop'),
60
+ # template specification
61
+ (r'\s*(?=>)', Whitespace, '#pop'),
62
+ ],
63
+ }
64
+
65
+
66
+ class NesCLexer(CLexer):
67
+ """
68
+ For `nesC <https://github.com/tinyos/nesc>`_ source code with preprocessor
69
+ directives.
70
+ """
71
+ name = 'nesC'
72
+ aliases = ['nesc']
73
+ filenames = ['*.nc']
74
+ mimetypes = ['text/x-nescsrc']
75
+ version_added = '2.0'
76
+
77
+ tokens = {
78
+ 'statements': [
79
+ (words((
80
+ 'abstract', 'as', 'async', 'atomic', 'call', 'command', 'component',
81
+ 'components', 'configuration', 'event', 'extends', 'generic',
82
+ 'implementation', 'includes', 'interface', 'module', 'new', 'norace',
83
+ 'post', 'provides', 'signal', 'task', 'uses'), suffix=r'\b'),
84
+ Keyword),
85
+ (words(('nx_struct', 'nx_union', 'nx_int8_t', 'nx_int16_t', 'nx_int32_t',
86
+ 'nx_int64_t', 'nx_uint8_t', 'nx_uint16_t', 'nx_uint32_t',
87
+ 'nx_uint64_t'), suffix=r'\b'),
88
+ Keyword.Type),
89
+ inherit,
90
+ ],
91
+ }
92
+
93
+
94
+ class ClayLexer(RegexLexer):
95
+ """
96
+ For Clay source.
97
+ """
98
+ name = 'Clay'
99
+ filenames = ['*.clay']
100
+ aliases = ['clay']
101
+ mimetypes = ['text/x-clay']
102
+ url = 'http://claylabs.com/clay'
103
+ version_added = '2.0'
104
+
105
+ tokens = {
106
+ 'root': [
107
+ (r'\s+', Whitespace),
108
+ (r'//.*?$', Comment.Single),
109
+ (r'/(\\\n)?[*][\s\S]*?[*](\\\n)?/', Comment.Multiline),
110
+ (words(('public', 'private', 'import', 'as', 'record', 'variant',
111
+ 'instance', 'define', 'overload', 'default',
112
+ 'external', 'alias', 'rvalue', 'ref',
113
+ 'forward', 'inline', 'noinline',
114
+ 'forceinline', 'enum', 'var', 'and', 'or',
115
+ 'not', 'if', 'else', 'goto', 'return',
116
+ 'while', 'switch', 'case', 'break',
117
+ 'continue', 'for', 'in', 'true', 'false',
118
+ 'try', 'catch', 'throw', 'finally',
119
+ 'onerror', 'staticassert', 'eval', 'when',
120
+ 'newtype', '__FILE__', '__LINE__',
121
+ '__COLUMN__', '__ARG__'), prefix=r'\b', suffix=r'\b'), Keyword),
122
+ (r'[~!%^&*+=|:<>/-]', Operator),
123
+ (r'[#(){}\[\],;.]', Punctuation),
124
+ (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
125
+ (r'\d+[LlUu]*', Number.Integer),
126
+ (r'\b(true|false)\b', Name.Builtin),
127
+ (r'(?i)[a-z_?][\w?]*', Name),
128
+ (r'"""', String, 'tdqs'),
129
+ (r'"', String, 'dqs'),
130
+ ],
131
+ 'strings': [
132
+ (r'(?i)\\(x[0-9a-f]{2}|.)', String.Escape),
133
+ (r'[^\\"]+', String),
134
+ ],
135
+ 'nl': [
136
+ (r'\n', String),
137
+ ],
138
+ 'dqs': [
139
+ (r'"', String, '#pop'),
140
+ include('strings'),
141
+ ],
142
+ 'tdqs': [
143
+ (r'"""', String, '#pop'),
144
+ include('strings'),
145
+ include('nl'),
146
+ ],
147
+ }
148
+
149
+
150
+ class ECLexer(CLexer):
151
+ """
152
+ For eC source code with preprocessor directives.
153
+ """
154
+ name = 'eC'
155
+ aliases = ['ec']
156
+ filenames = ['*.ec', '*.eh']
157
+ mimetypes = ['text/x-echdr', 'text/x-ecsrc']
158
+ url = 'https://ec-lang.org'
159
+ version_added = '1.5'
160
+
161
+ tokens = {
162
+ 'statements': [
163
+ (words((
164
+ 'virtual', 'class', 'private', 'public', 'property', 'import',
165
+ 'delete', 'new', 'new0', 'renew', 'renew0', 'define', 'get',
166
+ 'set', 'remote', 'dllexport', 'dllimport', 'stdcall', 'subclass',
167
+ '__on_register_module', 'namespace', 'using', 'typed_object',
168
+ 'any_object', 'incref', 'register', 'watch', 'stopwatching', 'firewatchers',
169
+ 'watchable', 'class_designer', 'class_fixed', 'class_no_expansion', 'isset',
170
+ 'class_default_property', 'property_category', 'class_data',
171
+ 'class_property', 'thisclass', 'dbtable', 'dbindex',
172
+ 'database_open', 'dbfield'), suffix=r'\b'), Keyword),
173
+ (words(('uint', 'uint16', 'uint32', 'uint64', 'bool', 'byte',
174
+ 'unichar', 'int64'), suffix=r'\b'),
175
+ Keyword.Type),
176
+ (r'(class)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
177
+ (r'(null|value|this)\b', Name.Builtin),
178
+ inherit,
179
+ ]
180
+ }
181
+
182
+
183
+ class ValaLexer(RegexLexer):
184
+ """
185
+ For Vala source code with preprocessor directives.
186
+ """
187
+ name = 'Vala'
188
+ aliases = ['vala', 'vapi']
189
+ filenames = ['*.vala', '*.vapi']
190
+ mimetypes = ['text/x-vala']
191
+ url = 'https://vala.dev'
192
+ version_added = '1.1'
193
+
194
+ tokens = {
195
+ 'whitespace': [
196
+ (r'^\s*#if\s+0', Comment.Preproc, 'if0'),
197
+ (r'^\s*#(?:if|elif|else|endif)\b[^\n]*', Comment.Preproc),
198
+ (r'\n', Whitespace),
199
+ (r'\s+', Whitespace),
200
+ (r'\\\n', Text), # line continuation
201
+ (r'//(\n|[\s\S]*?[^\\]\n)', Comment.Single),
202
+ (r'/(\\\n)?[*][\s\S]*?[*](\\\n)?/', Comment.Multiline),
203
+ ],
204
+ 'statements': [
205
+ (r'(?s)""".*?"""', String), # verbatim strings
206
+ (r'[L@]?"', String, 'string'),
207
+ (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'",
208
+ String.Char),
209
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
210
+ (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
211
+ (r'0x[0-9a-fA-F]+[Ll]?', Number.Hex),
212
+ (r'0[0-7]+[Ll]?', Number.Oct),
213
+ (r'\d+[Ll]?', Number.Integer),
214
+ (r'[~!%^&*+=|?:<>/-]', Operator),
215
+ (r'(\[)(Compact|Immutable|(?:Boolean|Simple)Type)(\])',
216
+ bygroups(Punctuation, Name.Decorator, Punctuation)),
217
+ # TODO: "correctly" parse complex code attributes
218
+ (r'(\[)(CCode|(?:Integer|Floating)Type)',
219
+ bygroups(Punctuation, Name.Decorator)),
220
+ (r'[()\[\],.]', Punctuation),
221
+ (words((
222
+ 'as', 'base', 'break', 'case', 'catch', 'construct', 'continue',
223
+ 'default', 'delete', 'do', 'else', 'enum', 'finally', 'for',
224
+ 'foreach', 'get', 'if', 'in', 'is', 'lock', 'new', 'out', 'params',
225
+ 'return', 'set', 'sizeof', 'switch', 'this', 'throw', 'try',
226
+ 'typeof', 'while', 'yield'), suffix=r'\b'),
227
+ Keyword),
228
+ (words((
229
+ 'abstract', 'const', 'delegate', 'dynamic', 'ensures', 'extern',
230
+ 'inline', 'internal', 'override', 'owned', 'private', 'protected',
231
+ 'public', 'ref', 'requires', 'signal', 'static', 'throws', 'unowned',
232
+ 'var', 'virtual', 'volatile', 'weak', 'yields'), suffix=r'\b'),
233
+ Keyword.Declaration),
234
+ (r'(namespace|using)(\s+)', bygroups(Keyword.Namespace, Whitespace),
235
+ 'namespace'),
236
+ (r'(class|errordomain|interface|struct)(\s+)',
237
+ bygroups(Keyword.Declaration, Whitespace), 'class'),
238
+ (r'(\.)([a-zA-Z_]\w*)',
239
+ bygroups(Operator, Name.Attribute)),
240
+ # void is an actual keyword, others are in glib-2.0.vapi
241
+ (words((
242
+ 'void', 'bool', 'char', 'double', 'float', 'int', 'int8', 'int16',
243
+ 'int32', 'int64', 'long', 'short', 'size_t', 'ssize_t', 'string',
244
+ 'time_t', 'uchar', 'uint', 'uint8', 'uint16', 'uint32', 'uint64',
245
+ 'ulong', 'unichar', 'ushort'), suffix=r'\b'),
246
+ Keyword.Type),
247
+ (r'(true|false|null)\b', Name.Builtin),
248
+ (r'[a-zA-Z_]\w*', Name),
249
+ ],
250
+ 'root': [
251
+ include('whitespace'),
252
+ default('statement'),
253
+ ],
254
+ 'statement': [
255
+ include('whitespace'),
256
+ include('statements'),
257
+ ('[{}]', Punctuation),
258
+ (';', Punctuation, '#pop'),
259
+ ],
260
+ 'string': [
261
+ (r'"', String, '#pop'),
262
+ (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
263
+ (r'[^\\"\n]+', String), # all other characters
264
+ (r'\\\n', String), # line continuation
265
+ (r'\\', String), # stray backslash
266
+ ],
267
+ 'if0': [
268
+ (r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
269
+ (r'^\s*#el(?:se|if).*\n', Comment.Preproc, '#pop'),
270
+ (r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
271
+ (r'.*?\n', Comment),
272
+ ],
273
+ 'class': [
274
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
275
+ ],
276
+ 'namespace': [
277
+ (r'[a-zA-Z_][\w.]*', Name.Namespace, '#pop')
278
+ ],
279
+ }
280
+
281
+
282
+ class CudaLexer(CppLexer):
283
+ """
284
+ For NVIDIA CUDA™ source.
285
+ """
286
+ name = 'CUDA'
287
+ filenames = ['*.cu', '*.cuh']
288
+ aliases = ['cuda', 'cu']
289
+ mimetypes = ['text/x-cuda']
290
+ url = 'https://developer.nvidia.com/category/zone/cuda-zone'
291
+ version_added = '1.6'
292
+
293
+ function_qualifiers = {'__device__', '__global__', '__host__',
294
+ '__noinline__', '__forceinline__'}
295
+ variable_qualifiers = {'__device__', '__constant__', '__shared__',
296
+ '__restrict__'}
297
+ vector_types = {'char1', 'uchar1', 'char2', 'uchar2', 'char3', 'uchar3',
298
+ 'char4', 'uchar4', 'short1', 'ushort1', 'short2', 'ushort2',
299
+ 'short3', 'ushort3', 'short4', 'ushort4', 'int1', 'uint1',
300
+ 'int2', 'uint2', 'int3', 'uint3', 'int4', 'uint4', 'long1',
301
+ 'ulong1', 'long2', 'ulong2', 'long3', 'ulong3', 'long4',
302
+ 'ulong4', 'longlong1', 'ulonglong1', 'longlong2',
303
+ 'ulonglong2', 'float1', 'float2', 'float3', 'float4',
304
+ 'double1', 'double2', 'dim3'}
305
+ variables = {'gridDim', 'blockIdx', 'blockDim', 'threadIdx', 'warpSize'}
306
+ functions = {'__threadfence_block', '__threadfence', '__threadfence_system',
307
+ '__syncthreads', '__syncthreads_count', '__syncthreads_and',
308
+ '__syncthreads_or'}
309
+ execution_confs = {'<<<', '>>>'}
310
+
311
+ def get_tokens_unprocessed(self, text, stack=('root',)):
312
+ for index, token, value in CppLexer.get_tokens_unprocessed(self, text, stack):
313
+ if token is Name:
314
+ if value in self.variable_qualifiers:
315
+ token = Keyword.Type
316
+ elif value in self.vector_types:
317
+ token = Keyword.Type
318
+ elif value in self.variables:
319
+ token = Name.Builtin
320
+ elif value in self.execution_confs:
321
+ token = Keyword.Pseudo
322
+ elif value in self.function_qualifiers:
323
+ token = Keyword.Reserved
324
+ elif value in self.functions:
325
+ token = Name.Function
326
+ yield index, token, value
327
+
328
+
329
+ class SwigLexer(CppLexer):
330
+ """
331
+ For `SWIG <http://www.swig.org/>`_ source code.
332
+ """
333
+ name = 'SWIG'
334
+ aliases = ['swig']
335
+ filenames = ['*.swg', '*.i']
336
+ mimetypes = ['text/swig']
337
+ version_added = '2.0'
338
+ priority = 0.04 # Lower than C/C++ and Objective C/C++
339
+
340
+ tokens = {
341
+ 'root': [
342
+ # Match it here so it won't be matched as a function in the rest of root
343
+ (r'\$\**\&?\w+', Name),
344
+ inherit
345
+ ],
346
+ 'statements': [
347
+ # SWIG directives
348
+ (r'(%[a-z_][a-z0-9_]*)', Name.Function),
349
+ # Special variables
350
+ (r'\$\**\&?\w+', Name),
351
+ # Stringification / additional preprocessor directives
352
+ (r'##*[a-zA-Z_]\w*', Comment.Preproc),
353
+ inherit,
354
+ ],
355
+ }
356
+
357
+ # This is a far from complete set of SWIG directives
358
+ swig_directives = {
359
+ # Most common directives
360
+ '%apply', '%define', '%director', '%enddef', '%exception', '%extend',
361
+ '%feature', '%fragment', '%ignore', '%immutable', '%import', '%include',
362
+ '%inline', '%insert', '%module', '%newobject', '%nspace', '%pragma',
363
+ '%rename', '%shared_ptr', '%template', '%typecheck', '%typemap',
364
+ # Less common directives
365
+ '%arg', '%attribute', '%bang', '%begin', '%callback', '%catches', '%clear',
366
+ '%constant', '%copyctor', '%csconst', '%csconstvalue', '%csenum',
367
+ '%csmethodmodifiers', '%csnothrowexception', '%default', '%defaultctor',
368
+ '%defaultdtor', '%defined', '%delete', '%delobject', '%descriptor',
369
+ '%exceptionclass', '%exceptionvar', '%extend_smart_pointer', '%fragments',
370
+ '%header', '%ifcplusplus', '%ignorewarn', '%implicit', '%implicitconv',
371
+ '%init', '%javaconst', '%javaconstvalue', '%javaenum', '%javaexception',
372
+ '%javamethodmodifiers', '%kwargs', '%luacode', '%mutable', '%naturalvar',
373
+ '%nestedworkaround', '%perlcode', '%pythonabc', '%pythonappend',
374
+ '%pythoncallback', '%pythoncode', '%pythondynamic', '%pythonmaybecall',
375
+ '%pythonnondynamic', '%pythonprepend', '%refobject', '%shadow', '%sizeof',
376
+ '%trackobjects', '%types', '%unrefobject', '%varargs', '%warn',
377
+ '%warnfilter'}
378
+
379
+ def analyse_text(text):
380
+ rv = 0
381
+ # Search for SWIG directives, which are conventionally at the beginning of
382
+ # a line. The probability of them being within a line is low, so let another
383
+ # lexer win in this case.
384
+ matches = re.findall(r'^\s*(%[a-z_][a-z0-9_]*)', text, re.M)
385
+ for m in matches:
386
+ if m in SwigLexer.swig_directives:
387
+ rv = 0.98
388
+ break
389
+ else:
390
+ rv = 0.91 # Fraction higher than MatlabLexer
391
+ return rv
392
+
393
+
394
+ class MqlLexer(CppLexer):
395
+ """
396
+ For `MQL4 <http://docs.mql4.com/>`_ and
397
+ `MQL5 <http://www.mql5.com/en/docs>`_ source code.
398
+ """
399
+ name = 'MQL'
400
+ aliases = ['mql', 'mq4', 'mq5', 'mql4', 'mql5']
401
+ filenames = ['*.mq4', '*.mq5', '*.mqh']
402
+ mimetypes = ['text/x-mql']
403
+ version_added = '2.0'
404
+
405
+ tokens = {
406
+ 'statements': [
407
+ (words(_mql_builtins.keywords, suffix=r'\b'), Keyword),
408
+ (words(_mql_builtins.c_types, suffix=r'\b'), Keyword.Type),
409
+ (words(_mql_builtins.types, suffix=r'\b'), Name.Function),
410
+ (words(_mql_builtins.constants, suffix=r'\b'), Name.Constant),
411
+ (words(_mql_builtins.colors, prefix='(clr)?', suffix=r'\b'),
412
+ Name.Constant),
413
+ inherit,
414
+ ],
415
+ }
416
+
417
+
418
+ class ArduinoLexer(CppLexer):
419
+ """
420
+ For `Arduino(tm) <https://arduino.cc/>`_ source.
421
+
422
+ This is an extension of the CppLexer, as the Arduino® Language is a superset
423
+ of C++
424
+ """
425
+
426
+ name = 'Arduino'
427
+ aliases = ['arduino']
428
+ filenames = ['*.ino']
429
+ mimetypes = ['text/x-arduino']
430
+ version_added = '2.1'
431
+
432
+ # Language sketch main structure functions
433
+ structure = {'setup', 'loop'}
434
+
435
+ # Language operators
436
+ operators = {'not', 'or', 'and', 'xor'}
437
+
438
+ # Language 'variables'
439
+ variables = {
440
+ 'DIGITAL_MESSAGE', 'FIRMATA_STRING', 'ANALOG_MESSAGE', 'REPORT_DIGITAL',
441
+ 'REPORT_ANALOG', 'INPUT_PULLUP', 'SET_PIN_MODE', 'INTERNAL2V56', 'SYSTEM_RESET',
442
+ 'LED_BUILTIN', 'INTERNAL1V1', 'SYSEX_START', 'INTERNAL', 'EXTERNAL', 'HIGH',
443
+ 'LOW', 'INPUT', 'OUTPUT', 'INPUT_PULLUP', 'LED_BUILTIN', 'true', 'false',
444
+ 'void', 'boolean', 'char', 'unsigned char', 'byte', 'int', 'unsigned int',
445
+ 'word', 'long', 'unsigned long', 'short', 'float', 'double', 'string', 'String',
446
+ 'array', 'static', 'volatile', 'const', 'boolean', 'byte', 'word', 'string',
447
+ 'String', 'array', 'int', 'float', 'private', 'char', 'virtual', 'operator',
448
+ 'sizeof', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t', 'int8_t', 'int16_t',
449
+ 'int32_t', 'int64_t', 'dynamic_cast', 'typedef', 'const_cast', 'const',
450
+ 'struct', 'static_cast', 'union', 'unsigned', 'long', 'volatile', 'static',
451
+ 'protected', 'bool', 'public', 'friend', 'auto', 'void', 'enum', 'extern',
452
+ 'class', 'short', 'reinterpret_cast', 'double', 'register', 'explicit',
453
+ 'signed', 'inline', 'delete', '_Bool', 'complex', '_Complex', '_Imaginary',
454
+ 'atomic_bool', 'atomic_char', 'atomic_schar', 'atomic_uchar', 'atomic_short',
455
+ 'atomic_ushort', 'atomic_int', 'atomic_uint', 'atomic_long', 'atomic_ulong',
456
+ 'atomic_llong', 'atomic_ullong', 'PROGMEM'}
457
+
458
+ # Language shipped functions and class ( )
459
+ functions = {
460
+ 'KeyboardController', 'MouseController', 'SoftwareSerial', 'EthernetServer',
461
+ 'EthernetClient', 'LiquidCrystal', 'RobotControl', 'GSMVoiceCall',
462
+ 'EthernetUDP', 'EsploraTFT', 'HttpClient', 'RobotMotor', 'WiFiClient',
463
+ 'GSMScanner', 'FileSystem', 'Scheduler', 'GSMServer', 'YunClient', 'YunServer',
464
+ 'IPAddress', 'GSMClient', 'GSMModem', 'Keyboard', 'Ethernet', 'Console',
465
+ 'GSMBand', 'Esplora', 'Stepper', 'Process', 'WiFiUDP', 'GSM_SMS', 'Mailbox',
466
+ 'USBHost', 'Firmata', 'PImage', 'Client', 'Server', 'GSMPIN', 'FileIO',
467
+ 'Bridge', 'Serial', 'EEPROM', 'Stream', 'Mouse', 'Audio', 'Servo', 'File',
468
+ 'Task', 'GPRS', 'WiFi', 'Wire', 'TFT', 'GSM', 'SPI', 'SD',
469
+ 'runShellCommandAsynchronously', 'analogWriteResolution',
470
+ 'retrieveCallingNumber', 'printFirmwareVersion', 'analogReadResolution',
471
+ 'sendDigitalPortPair', 'noListenOnLocalhost', 'readJoystickButton',
472
+ 'setFirmwareVersion', 'readJoystickSwitch', 'scrollDisplayRight',
473
+ 'getVoiceCallStatus', 'scrollDisplayLeft', 'writeMicroseconds',
474
+ 'delayMicroseconds', 'beginTransmission', 'getSignalStrength',
475
+ 'runAsynchronously', 'getAsynchronously', 'listenOnLocalhost',
476
+ 'getCurrentCarrier', 'readAccelerometer', 'messageAvailable',
477
+ 'sendDigitalPorts', 'lineFollowConfig', 'countryNameWrite', 'runShellCommand',
478
+ 'readStringUntil', 'rewindDirectory', 'readTemperature', 'setClockDivider',
479
+ 'readLightSensor', 'endTransmission', 'analogReference', 'detachInterrupt',
480
+ 'countryNameRead', 'attachInterrupt', 'encryptionType', 'readBytesUntil',
481
+ 'robotNameWrite', 'readMicrophone', 'robotNameRead', 'cityNameWrite',
482
+ 'userNameWrite', 'readJoystickY', 'readJoystickX', 'mouseReleased',
483
+ 'openNextFile', 'scanNetworks', 'noInterrupts', 'digitalWrite', 'beginSpeaker',
484
+ 'mousePressed', 'isActionDone', 'mouseDragged', 'displayLogos', 'noAutoscroll',
485
+ 'addParameter', 'remoteNumber', 'getModifiers', 'keyboardRead', 'userNameRead',
486
+ 'waitContinue', 'processInput', 'parseCommand', 'printVersion', 'readNetworks',
487
+ 'writeMessage', 'blinkVersion', 'cityNameRead', 'readMessage', 'setDataMode',
488
+ 'parsePacket', 'isListening', 'setBitOrder', 'beginPacket', 'isDirectory',
489
+ 'motorsWrite', 'drawCompass', 'digitalRead', 'clearScreen', 'serialEvent',
490
+ 'rightToLeft', 'setTextSize', 'leftToRight', 'requestFrom', 'keyReleased',
491
+ 'compassRead', 'analogWrite', 'interrupts', 'WiFiServer', 'disconnect',
492
+ 'playMelody', 'parseFloat', 'autoscroll', 'getPINUsed', 'setPINUsed',
493
+ 'setTimeout', 'sendAnalog', 'readSlider', 'analogRead', 'beginWrite',
494
+ 'createChar', 'motorsStop', 'keyPressed', 'tempoWrite', 'readButton',
495
+ 'subnetMask', 'debugPrint', 'macAddress', 'writeGreen', 'randomSeed',
496
+ 'attachGPRS', 'readString', 'sendString', 'remotePort', 'releaseAll',
497
+ 'mouseMoved', 'background', 'getXChange', 'getYChange', 'answerCall',
498
+ 'getResult', 'voiceCall', 'endPacket', 'constrain', 'getSocket', 'writeJSON',
499
+ 'getButton', 'available', 'connected', 'findUntil', 'readBytes', 'exitValue',
500
+ 'readGreen', 'writeBlue', 'startLoop', 'IPAddress', 'isPressed', 'sendSysex',
501
+ 'pauseMode', 'gatewayIP', 'setCursor', 'getOemKey', 'tuneWrite', 'noDisplay',
502
+ 'loadImage', 'switchPIN', 'onRequest', 'onReceive', 'changePIN', 'playFile',
503
+ 'noBuffer', 'parseInt', 'overflow', 'checkPIN', 'knobRead', 'beginTFT',
504
+ 'bitClear', 'updateIR', 'bitWrite', 'position', 'writeRGB', 'highByte',
505
+ 'writeRed', 'setSpeed', 'readBlue', 'noStroke', 'remoteIP', 'transfer',
506
+ 'shutdown', 'hangCall', 'beginSMS', 'endWrite', 'attached', 'maintain',
507
+ 'noCursor', 'checkReg', 'checkPUK', 'shiftOut', 'isValid', 'shiftIn', 'pulseIn',
508
+ 'connect', 'println', 'localIP', 'pinMode', 'getIMEI', 'display', 'noBlink',
509
+ 'process', 'getBand', 'running', 'beginSD', 'drawBMP', 'lowByte', 'setBand',
510
+ 'release', 'bitRead', 'prepare', 'pointTo', 'readRed', 'setMode', 'noFill',
511
+ 'remove', 'listen', 'stroke', 'detach', 'attach', 'noTone', 'exists', 'buffer',
512
+ 'height', 'bitSet', 'circle', 'config', 'cursor', 'random', 'IRread', 'setDNS',
513
+ 'endSMS', 'getKey', 'micros', 'millis', 'begin', 'print', 'write', 'ready',
514
+ 'flush', 'width', 'isPIN', 'blink', 'clear', 'press', 'mkdir', 'rmdir', 'close',
515
+ 'point', 'yield', 'image', 'BSSID', 'click', 'delay', 'read', 'text', 'move',
516
+ 'peek', 'beep', 'rect', 'line', 'open', 'seek', 'fill', 'size', 'turn', 'stop',
517
+ 'home', 'find', 'step', 'tone', 'sqrt', 'RSSI', 'SSID', 'end', 'bit', 'tan',
518
+ 'cos', 'sin', 'pow', 'map', 'abs', 'max', 'min', 'get', 'run', 'put',
519
+ 'isAlphaNumeric', 'isAlpha', 'isAscii', 'isWhitespace', 'isControl', 'isDigit',
520
+ 'isGraph', 'isLowerCase', 'isPrintable', 'isPunct', 'isSpace', 'isUpperCase',
521
+ 'isHexadecimalDigit'}
522
+
523
+ # do not highlight
524
+ suppress_highlight = {
525
+ 'namespace', 'template', 'mutable', 'using', 'asm', 'typeid',
526
+ 'typename', 'this', 'alignof', 'constexpr', 'decltype', 'noexcept',
527
+ 'static_assert', 'thread_local', 'restrict'}
528
+
529
+ def get_tokens_unprocessed(self, text, stack=('root',)):
530
+ for index, token, value in CppLexer.get_tokens_unprocessed(self, text, stack):
531
+ if value in self.structure:
532
+ yield index, Name.Builtin, value
533
+ elif value in self.operators:
534
+ yield index, Operator, value
535
+ elif value in self.variables:
536
+ yield index, Keyword.Reserved, value
537
+ elif value in self.suppress_highlight:
538
+ yield index, Name, value
539
+ elif value in self.functions:
540
+ yield index, Name.Function, value
541
+ else:
542
+ yield index, token, value
543
+
544
+
545
+ class CharmciLexer(CppLexer):
546
+ """
547
+ For `Charm++ <https://charm.cs.illinois.edu>`_ interface files (.ci).
548
+ """
549
+
550
+ name = 'Charmci'
551
+ aliases = ['charmci']
552
+ filenames = ['*.ci']
553
+ version_added = '2.4'
554
+
555
+ mimetypes = []
556
+
557
+ tokens = {
558
+ 'keywords': [
559
+ (r'(module)(\s+)', bygroups(Keyword, Text), 'classname'),
560
+ (words(('mainmodule', 'mainchare', 'chare', 'array', 'group',
561
+ 'nodegroup', 'message', 'conditional')), Keyword),
562
+ (words(('entry', 'aggregate', 'threaded', 'sync', 'exclusive',
563
+ 'nokeep', 'notrace', 'immediate', 'expedited', 'inline',
564
+ 'local', 'python', 'accel', 'readwrite', 'writeonly',
565
+ 'accelblock', 'memcritical', 'packed', 'varsize',
566
+ 'initproc', 'initnode', 'initcall', 'stacksize',
567
+ 'createhere', 'createhome', 'reductiontarget', 'iget',
568
+ 'nocopy', 'mutable', 'migratable', 'readonly')), Keyword),
569
+ inherit,
570
+ ],
571
+ }
572
+
573
+
574
+ class OmgIdlLexer(CLexer):
575
+ """
576
+ Lexer for Object Management Group Interface Definition Language.
577
+ """
578
+
579
+ name = 'OMG Interface Definition Language'
580
+ url = 'https://www.omg.org/spec/IDL/About-IDL/'
581
+ aliases = ['omg-idl']
582
+ filenames = ['*.idl', '*.pidl']
583
+ mimetypes = []
584
+ version_added = '2.9'
585
+
586
+ scoped_name = r'((::)?\w+)+'
587
+
588
+ tokens = {
589
+ 'values': [
590
+ (words(('true', 'false'), prefix=r'(?i)', suffix=r'\b'), Number),
591
+ (r'([Ll]?)(")', bygroups(String.Affix, String.Double), 'string'),
592
+ (r'([Ll]?)(\')(\\[^\']+)(\')',
593
+ bygroups(String.Affix, String.Char, String.Escape, String.Char)),
594
+ (r'([Ll]?)(\')(\\\')(\')',
595
+ bygroups(String.Affix, String.Char, String.Escape, String.Char)),
596
+ (r'([Ll]?)(\'.\')', bygroups(String.Affix, String.Char)),
597
+ (r'[+-]?\d+(\.\d*)?[Ee][+-]?\d+', Number.Float),
598
+ (r'[+-]?(\d+\.\d*)|(\d*\.\d+)([Ee][+-]?\d+)?', Number.Float),
599
+ (r'(?i)[+-]?0x[0-9a-f]+', Number.Hex),
600
+ (r'[+-]?[1-9]\d*', Number.Integer),
601
+ (r'[+-]?0[0-7]*', Number.Oct),
602
+ (r'[\+\-\*\/%^&\|~]', Operator),
603
+ (words(('<<', '>>')), Operator),
604
+ (scoped_name, Name),
605
+ (r'[{};:,<>\[\]]', Punctuation),
606
+ ],
607
+ 'annotation_params': [
608
+ include('whitespace'),
609
+ (r'\(', Punctuation, '#push'),
610
+ include('values'),
611
+ (r'=', Punctuation),
612
+ (r'\)', Punctuation, '#pop'),
613
+ ],
614
+ 'annotation_params_maybe': [
615
+ (r'\(', Punctuation, 'annotation_params'),
616
+ include('whitespace'),
617
+ default('#pop'),
618
+ ],
619
+ 'annotation_appl': [
620
+ (r'@' + scoped_name, Name.Decorator, 'annotation_params_maybe'),
621
+ ],
622
+ 'enum': [
623
+ include('whitespace'),
624
+ (r'[{,]', Punctuation),
625
+ (r'\w+', Name.Constant),
626
+ include('annotation_appl'),
627
+ (r'\}', Punctuation, '#pop'),
628
+ ],
629
+ 'root': [
630
+ include('whitespace'),
631
+ (words((
632
+ 'typedef', 'const',
633
+ 'in', 'out', 'inout', 'local',
634
+ ), prefix=r'(?i)', suffix=r'\b'), Keyword.Declaration),
635
+ (words((
636
+ 'void', 'any', 'native', 'bitfield',
637
+ 'unsigned', 'boolean', 'char', 'wchar', 'octet', 'short', 'long',
638
+ 'int8', 'uint8', 'int16', 'int32', 'int64', 'uint16', 'uint32', 'uint64',
639
+ 'float', 'double', 'fixed',
640
+ 'sequence', 'string', 'wstring', 'map',
641
+ ), prefix=r'(?i)', suffix=r'\b'), Keyword.Type),
642
+ (words((
643
+ '@annotation', 'struct', 'union', 'bitset', 'interface',
644
+ 'exception', 'valuetype', 'eventtype', 'component',
645
+ ), prefix=r'(?i)', suffix=r'(\s+)(\w+)'), bygroups(Keyword, Whitespace, Name.Class)),
646
+ (words((
647
+ 'abstract', 'alias', 'attribute', 'case', 'connector',
648
+ 'consumes', 'context', 'custom', 'default', 'emits', 'factory',
649
+ 'finder', 'getraises', 'home', 'import', 'manages', 'mirrorport',
650
+ 'multiple', 'Object', 'oneway', 'primarykey', 'private', 'port',
651
+ 'porttype', 'provides', 'public', 'publishes', 'raises',
652
+ 'readonly', 'setraises', 'supports', 'switch', 'truncatable',
653
+ 'typeid', 'typename', 'typeprefix', 'uses', 'ValueBase',
654
+ ), prefix=r'(?i)', suffix=r'\b'), Keyword),
655
+ (r'(?i)(enum|bitmask)(\s+)(\w+)',
656
+ bygroups(Keyword, Whitespace, Name.Class), 'enum'),
657
+ (r'(?i)(module)(\s+)(\w+)',
658
+ bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
659
+ (r'(\w+)(\s*)(=)', bygroups(Name.Constant, Whitespace, Operator)),
660
+ (r'[\(\)]', Punctuation),
661
+ include('values'),
662
+ include('annotation_appl'),
663
+ ],
664
+ }
665
+
666
+
667
+ class PromelaLexer(CLexer):
668
+ """
669
+ For the Promela language used with SPIN.
670
+ """
671
+
672
+ name = 'Promela'
673
+ aliases = ['promela']
674
+ filenames = ['*.pml', '*.prom', '*.prm', '*.promela', '*.pr', '*.pm']
675
+ mimetypes = ['text/x-promela']
676
+ url = 'https://spinroot.com/spin/whatispin.html'
677
+ version_added = '2.18'
678
+
679
+ # Promela's language reference:
680
+ # https://spinroot.com/spin/Man/promela.html
681
+ # Promela's grammar definition:
682
+ # https://spinroot.com/spin/Man/grammar.html
683
+
684
+ tokens = {
685
+ 'statements': [
686
+ (r'(\[\]|<>|/\\|\\/)|(U|W|V)\b', Operator), # LTL Operators
687
+ (r'@', Punctuation), #remoterefs
688
+ (r'(\.)([a-zA-Z_]\w*)', bygroups(Operator, Name.Attribute)),
689
+ inherit
690
+ ],
691
+ 'types': [
692
+ # Predefined (data types)
693
+ (words((
694
+ 'bit', 'bool', 'byte', 'pid', 'short', 'int', 'unsigned'),
695
+ suffix=r'\b'),
696
+ Keyword.Type),
697
+ ],
698
+ 'keywords': [
699
+ # ControlFlow
700
+ (words((
701
+ 'atomic', 'break', 'd_step', 'do', 'od', 'for', 'in', 'goto',
702
+ 'if', 'fi', 'unless'), suffix=r'\b'),
703
+ Keyword),
704
+ # BasicStatements
705
+ (words((
706
+ 'assert', 'get_priority', 'printf', 'printm', 'set_priority'),
707
+ suffix=r'\b'),
708
+ Name.Function),
709
+ # Embedded C Code
710
+ (words((
711
+ 'c_code', 'c_decl', 'c_expr', 'c_state', 'c_track'),
712
+ suffix=r'\b'),
713
+ Keyword),
714
+ # Predefined (local/global variables)
715
+ (words((
716
+ '_', '_last', '_nr_pr', '_pid', '_priority', 'else', 'np_',
717
+ 'STDIN'), suffix=r'\b'),
718
+ Name.Builtin),
719
+ # Predefined (functions)
720
+ (words((
721
+ 'empty', 'enabled', 'eval', 'full', 'len', 'nempty', 'nfull',
722
+ 'pc_value'), suffix=r'\b'),
723
+ Name.Function),
724
+ # Predefined (operators)
725
+ (r'run\b', Operator.Word),
726
+ # Declarators
727
+ (words((
728
+ 'active', 'chan', 'D_proctype', 'hidden', 'init', 'local',
729
+ 'mtype', 'never', 'notrace', 'proctype', 'show', 'trace',
730
+ 'typedef', 'xr', 'xs'), suffix=r'\b'),
731
+ Keyword.Declaration),
732
+ # Declarators (suffixes)
733
+ (words((
734
+ 'priority', 'provided'), suffix=r'\b'),
735
+ Keyword),
736
+ # MetaTerms (declarators)
737
+ (words((
738
+ 'inline', 'ltl', 'select'), suffix=r'\b'),
739
+ Keyword.Declaration),
740
+ # MetaTerms (keywords)
741
+ (r'skip\b', Keyword),
742
+ ],
743
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/capnproto.py ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.capnproto
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Cap'n Proto schema language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, default
12
+ from pygments.token import Text, Comment, Keyword, Name, Literal, Whitespace
13
+
14
+ __all__ = ['CapnProtoLexer']
15
+
16
+
17
+ class CapnProtoLexer(RegexLexer):
18
+ """
19
+ For Cap'n Proto source.
20
+ """
21
+ name = 'Cap\'n Proto'
22
+ url = 'https://capnproto.org'
23
+ filenames = ['*.capnp']
24
+ aliases = ['capnp']
25
+ version_added = '2.2'
26
+
27
+ tokens = {
28
+ 'root': [
29
+ (r'#.*?$', Comment.Single),
30
+ (r'@[0-9a-zA-Z]*', Name.Decorator),
31
+ (r'=', Literal, 'expression'),
32
+ (r':', Name.Class, 'type'),
33
+ (r'\$', Name.Attribute, 'annotation'),
34
+ (r'(struct|enum|interface|union|import|using|const|annotation|'
35
+ r'extends|in|of|on|as|with|from|fixed)\b',
36
+ Keyword),
37
+ (r'[\w.]+', Name),
38
+ (r'[^#@=:$\w\s]+', Text),
39
+ (r'\s+', Whitespace),
40
+ ],
41
+ 'type': [
42
+ (r'[^][=;,(){}$]+', Name.Class),
43
+ (r'[\[(]', Name.Class, 'parentype'),
44
+ default('#pop'),
45
+ ],
46
+ 'parentype': [
47
+ (r'[^][;()]+', Name.Class),
48
+ (r'[\[(]', Name.Class, '#push'),
49
+ (r'[])]', Name.Class, '#pop'),
50
+ default('#pop'),
51
+ ],
52
+ 'expression': [
53
+ (r'[^][;,(){}$]+', Literal),
54
+ (r'[\[(]', Literal, 'parenexp'),
55
+ default('#pop'),
56
+ ],
57
+ 'parenexp': [
58
+ (r'[^][;()]+', Literal),
59
+ (r'[\[(]', Literal, '#push'),
60
+ (r'[])]', Literal, '#pop'),
61
+ default('#pop'),
62
+ ],
63
+ 'annotation': [
64
+ (r'[^][;,(){}=:]+', Name.Attribute),
65
+ (r'[\[(]', Name.Attribute, 'annexp'),
66
+ default('#pop'),
67
+ ],
68
+ 'annexp': [
69
+ (r'[^][;()]+', Name.Attribute),
70
+ (r'[\[(]', Name.Attribute, '#push'),
71
+ (r'[])]', Name.Attribute, '#pop'),
72
+ default('#pop'),
73
+ ],
74
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/carbon.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.carbon
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Carbon programming language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+ import re
11
+
12
+ from pygments.lexer import RegexLexer, words
13
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
14
+ Number, Punctuation, Whitespace
15
+
16
+ __all__ = ['CarbonLexer']
17
+
18
+
19
+ class CarbonLexer(RegexLexer):
20
+ """
21
+ For Carbon source.
22
+ """
23
+ name = 'Carbon'
24
+ url = 'https://github.com/carbon-language/carbon-lang'
25
+ filenames = ['*.carbon']
26
+ aliases = ['carbon']
27
+ mimetypes = ['text/x-carbon']
28
+ version_added = '2.15'
29
+
30
+ flags = re.MULTILINE | re.DOTALL
31
+
32
+ tokens = {
33
+ 'root': [
34
+ (r'\n', Whitespace),
35
+ (r'\s+', Whitespace),
36
+ (r'\\\n', Text),
37
+ # comments
38
+ (r'//(.*?)\n', Comment.Single),
39
+ (r'/(\\\n)?[*].*?[*](\\\n)?/', Comment.Multiline),
40
+ # Declaration
41
+ (r'(package|import|api|namespace|library)\b', Keyword.Namespace),
42
+ (r'(abstract|alias|fn|class|interface|let|var|virtual|external|'
43
+ r'base|addr|extends|choice|constraint|impl)\b', Keyword.Declaration),
44
+ # Keywords
45
+ (words(('as', 'or', 'not', 'and', 'break', 'continue', 'case',
46
+ 'default', 'if', 'else', 'destructor', 'for', 'forall',
47
+ 'while', 'where', 'then', 'in', 'is', 'return', 'returned',
48
+ 'friend', 'partial', 'private', 'protected', 'observe', 'Self',
49
+ 'override', 'final', 'match', 'type', 'like'), suffix=r'\b'), Keyword),
50
+ (r'(self)\b', Keyword.Pseudo),
51
+ (r'(true|false)\b', Keyword.Constant),
52
+ (r'(auto|bool|string|i8|i16|i32|i64|u8|u16|u32|u64|'
53
+ r'f8|f16|f32|f64)\b', Keyword.Type),
54
+ # numeric literals
55
+ (r'[0-9]*[.][0-9]+', Number.Double),
56
+ (r'0b[01]+', Number.Bin),
57
+ (r'0o[0-7]+', Number.Oct),
58
+ (r'0x[0-9a-fA-F]+', Number.Hex),
59
+ (r'[0-9]+', Number.Integer),
60
+ # string literal
61
+ (r'"(\\.|[^"\\])*"', String),
62
+ # char literal
63
+ (r'\'(\\.|[^\'\\])\'', String.Char),
64
+ # tokens
65
+ (r'<<=|>>=|<<|>>|<=|>=|\+=|-=|\*=|/=|\%=|\|=|&=|\^=|&&|\|\||&|\||'
66
+ r'\+\+|--|\%|\^|\~|==|!=|::|[.]{3}|->|=>|[+\-*/&]', Operator),
67
+ (r'[|<>=!()\[\]{}.,;:\?]', Punctuation),
68
+ # identifiers
69
+ (r'[^\W\d]\w*', Name.Other),
70
+ ]
71
+ }
72
+
73
+ def analyse_text(text):
74
+ result = 0
75
+ if 'forall' in text:
76
+ result += 0.1
77
+ if 'type' in text:
78
+ result += 0.1
79
+ if 'Self' in text:
80
+ result += 0.1
81
+ if 'observe' in text:
82
+ result += 0.1
83
+ if 'package' in text:
84
+ result += 0.1
85
+ if 'library' in text:
86
+ result += 0.1
87
+ if 'choice' in text:
88
+ result += 0.1
89
+ if 'addr' in text:
90
+ result += 0.1
91
+ if 'constraint' in text:
92
+ result += 0.1
93
+ if 'impl' in text:
94
+ result += 0.1
95
+ return result
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/cddl.py ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.cddl
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Concise data definition language (CDDL), a notational
6
+ convention to express CBOR and JSON data structures.
7
+
8
+ More information:
9
+ https://datatracker.ietf.org/doc/rfc8610/
10
+
11
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
12
+ :license: BSD, see LICENSE for details.
13
+ """
14
+
15
+ from pygments.lexer import RegexLexer, bygroups, include, words
16
+ from pygments.token import Comment, Error, Keyword, Name, Number, Operator, \
17
+ Punctuation, String, Whitespace
18
+
19
+ __all__ = ['CddlLexer']
20
+
21
+
22
+ class CddlLexer(RegexLexer):
23
+ """
24
+ Lexer for CDDL definitions.
25
+ """
26
+ name = "CDDL"
27
+ url = 'https://datatracker.ietf.org/doc/rfc8610/'
28
+ aliases = ["cddl"]
29
+ filenames = ["*.cddl"]
30
+ mimetypes = ["text/x-cddl"]
31
+ version_added = '2.8'
32
+
33
+ _prelude_types = [
34
+ "any",
35
+ "b64legacy",
36
+ "b64url",
37
+ "bigfloat",
38
+ "bigint",
39
+ "bignint",
40
+ "biguint",
41
+ "bool",
42
+ "bstr",
43
+ "bytes",
44
+ "cbor-any",
45
+ "decfrac",
46
+ "eb16",
47
+ "eb64legacy",
48
+ "eb64url",
49
+ "encoded-cbor",
50
+ "false",
51
+ "float",
52
+ "float16",
53
+ "float16-32",
54
+ "float32",
55
+ "float32-64",
56
+ "float64",
57
+ "int",
58
+ "integer",
59
+ "mime-message",
60
+ "nil",
61
+ "nint",
62
+ "null",
63
+ "number",
64
+ "regexp",
65
+ "tdate",
66
+ "text",
67
+ "time",
68
+ "true",
69
+ "tstr",
70
+ "uint",
71
+ "undefined",
72
+ "unsigned",
73
+ "uri",
74
+ ]
75
+
76
+ _controls = [
77
+ ".and",
78
+ ".bits",
79
+ ".cbor",
80
+ ".cborseq",
81
+ ".default",
82
+ ".eq",
83
+ ".ge",
84
+ ".gt",
85
+ ".le",
86
+ ".lt",
87
+ ".ne",
88
+ ".regexp",
89
+ ".size",
90
+ ".within",
91
+ ]
92
+
93
+ _re_id = (
94
+ r"[$@A-Z_a-z]"
95
+ r"(?:[\-\.]+(?=[$@0-9A-Z_a-z])|[$@0-9A-Z_a-z])*"
96
+
97
+ )
98
+
99
+ # While the spec reads more like "an int must not start with 0" we use a
100
+ # lookahead here that says "after a 0 there must be no digit". This makes the
101
+ # '0' the invalid character in '01', which looks nicer when highlighted.
102
+ _re_uint = r"(?:0b[01]+|0x[0-9a-fA-F]+|[1-9]\d*|0(?!\d))"
103
+ _re_int = r"-?" + _re_uint
104
+
105
+ tokens = {
106
+ "commentsandwhitespace": [(r"\s+", Whitespace), (r";.+$", Comment.Single)],
107
+ "root": [
108
+ include("commentsandwhitespace"),
109
+ # tag types
110
+ (rf"#(\d\.{_re_uint})?", Keyword.Type), # type or any
111
+ # occurrence
112
+ (
113
+ rf"({_re_uint})?(\*)({_re_uint})?",
114
+ bygroups(Number, Operator, Number),
115
+ ),
116
+ (r"\?|\+", Operator), # occurrence
117
+ (r"\^", Operator), # cuts
118
+ (r"(\.\.\.|\.\.)", Operator), # rangeop
119
+ (words(_controls, suffix=r"\b"), Operator.Word), # ctlops
120
+ # into choice op
121
+ (rf"&(?=\s*({_re_id}|\())", Operator),
122
+ (rf"~(?=\s*{_re_id})", Operator), # unwrap op
123
+ (r"//|/(?!/)", Operator), # double und single slash
124
+ (r"=>|/==|/=|=", Operator),
125
+ (r"[\[\]{}\(\),<>:]", Punctuation),
126
+ # Bytestrings
127
+ (r"(b64)(')", bygroups(String.Affix, String.Single), "bstrb64url"),
128
+ (r"(h)(')", bygroups(String.Affix, String.Single), "bstrh"),
129
+ (r"'", String.Single, "bstr"),
130
+ # Barewords as member keys (must be matched before values, types, typenames,
131
+ # groupnames).
132
+ # Token type is String as barewords are always interpreted as such.
133
+ (rf"({_re_id})(\s*)(:)",
134
+ bygroups(String, Whitespace, Punctuation)),
135
+ # predefined types
136
+ (words(_prelude_types, prefix=r"(?![\-_$@])\b", suffix=r"\b(?![\-_$@])"),
137
+ Name.Builtin),
138
+ # user-defined groupnames, typenames
139
+ (_re_id, Name.Class),
140
+ # values
141
+ (r"0b[01]+", Number.Bin),
142
+ (r"0o[0-7]+", Number.Oct),
143
+ (r"0x[0-9a-fA-F]+(\.[0-9a-fA-F]+)?p[+-]?\d+", Number.Hex), # hexfloat
144
+ (r"0x[0-9a-fA-F]+", Number.Hex), # hex
145
+ # Float
146
+ (rf"{_re_int}(?=(\.\d|e[+-]?\d))(?:\.\d+)?(?:e[+-]?\d+)?",
147
+ Number.Float),
148
+ # Int
149
+ (_re_int, Number.Integer),
150
+ (r'"(\\\\|\\"|[^"])*"', String.Double),
151
+ ],
152
+ "bstrb64url": [
153
+ (r"'", String.Single, "#pop"),
154
+ include("commentsandwhitespace"),
155
+ (r"\\.", String.Escape),
156
+ (r"[0-9a-zA-Z\-_=]+", String.Single),
157
+ (r".", Error),
158
+ # (r";.+$", Token.Other),
159
+ ],
160
+ "bstrh": [
161
+ (r"'", String.Single, "#pop"),
162
+ include("commentsandwhitespace"),
163
+ (r"\\.", String.Escape),
164
+ (r"[0-9a-fA-F]+", String.Single),
165
+ (r".", Error),
166
+ ],
167
+ "bstr": [
168
+ (r"'", String.Single, "#pop"),
169
+ (r"\\.", String.Escape),
170
+ (r"[^'\\]+", String.Single),
171
+ ],
172
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/cel.py ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.cel
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for CEL (Common Expression Language).
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ __all__ = ['CELLexer']
12
+
13
+ import re
14
+
15
+ from pygments.lexer import RegexLexer, words
16
+ from pygments.token import (
17
+ Comment, Keyword, Name, Number, Operator, Punctuation, String, Whitespace,
18
+ )
19
+
20
+
21
+ class CELLexer(RegexLexer):
22
+ """Lexer for CEL (Common Expression Language)."""
23
+
24
+ name = 'CEL'
25
+ aliases = ['cel']
26
+ filenames = ['*.cel']
27
+ mimetypes = []
28
+ url = 'https://cel.dev'
29
+ version_added = '2.21'
30
+
31
+ flags = re.MULTILINE | re.UNICODE
32
+
33
+ # Escape sequence per the CEL spec:
34
+ # \a \b \f \n \r \t \v \\ \" \' \` \?
35
+ # \xHH or \XHH (exactly 2 hex digits)
36
+ # \uHHHH (exactly 4 hex digits)
37
+ # \UHHHHHHHH (exactly 8 hex digits)
38
+ # \OOO (3-digit octal, first digit 0-3)
39
+ # \. (fallback for unknown escapes)
40
+ _ESCAPE = r"""\\(?:[abfnrtv\\"'`?]|[xX][0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|[0-3][0-7][0-7]|.)"""
41
+
42
+ # Raw prefix: r/R alone, or b/B combined with r/R in either order
43
+ _RAW = r'(?:[bB][rR]|[rR][bB]|[rR])'
44
+
45
+ tokens = {
46
+ 'root': [
47
+ (r'\s+', Whitespace),
48
+ # CEL only has line comments; no block comments.
49
+ (r'//.*$', Comment.Single),
50
+
51
+ # Bytes and string literals.
52
+ # Raw variants (no escape processing) must be tried before
53
+ # non-raw so that br/rb/r prefixes are consumed greedily.
54
+ # Triple-quoted raw (br""", rb""", r""")
55
+ (_RAW + r'"""', String, 'triple-double-raw'),
56
+ (_RAW + r"'''", String, 'triple-single-raw'),
57
+ # Triple-quoted non-raw with optional b prefix (b""" or """)
58
+ (r'[bB]?"""', String, 'triple-double'),
59
+ (r"[bB]?'''", String, 'triple-single'),
60
+ # Single-line raw
61
+ (_RAW + r'"[^"\r\n]*"', String),
62
+ (_RAW + r"'[^'\r\n]*'", String),
63
+ # Single-line non-raw with optional b prefix
64
+ (r'[bB]?"', String, 'double-string'),
65
+ (r"[bB]?'", String, 'single-string'),
66
+
67
+ # Numbers.
68
+ # uint_literal: integer (decimal or hex) followed by u/U suffix.
69
+ (r'(?:0[xX][0-9a-fA-F]+|0|[1-9][0-9]*)[uU]', Number.Integer),
70
+ # float_literal: the grammar requires digits on both sides of the
71
+ # decimal point for the dotted form — `1.` is not valid CEL.
72
+ (r'(?:[0-9]+\.[0-9]+(?:[eE][+-]?[0-9]+)?'
73
+ r'|[0-9]+[eE][+-]?[0-9]+'
74
+ r'|\.[0-9]+(?:[eE][+-]?[0-9]+)?)',
75
+ Number.Float),
76
+ # int_literal: hex or decimal.
77
+ (r'0[xX][0-9a-fA-F]+|0|[1-9][0-9]*', Number.Integer),
78
+
79
+ # Reserved keywords (may not appear as identifiers).
80
+ (words((
81
+ 'as', 'break', 'const', 'continue', 'else', 'for',
82
+ 'function', 'if', 'import', 'let', 'loop', 'namespace',
83
+ 'package', 'return', 'var', 'void', 'while',
84
+ ), suffix=r'\b'), Keyword.Reserved),
85
+ # `in` is a comparison operator keyword.
86
+ (r'in\b', Keyword),
87
+ # Built-in literal constants.
88
+ (words(('true', 'false', 'null'), suffix=r'\b'), Keyword.Constant),
89
+
90
+ # Logical and comparison operators.
91
+ (r'&&|\|\|', Operator),
92
+ (r'==|!=|<=|>=', Operator),
93
+ # Arithmetic, unary, ternary, and remaining comparison operators.
94
+ (r'[+\-*/%<>!?]', Operator),
95
+
96
+ # Punctuation: brackets, comma, dot, colon.
97
+ (r'[(){}\[\]]', Punctuation),
98
+ (r'[,.]', Punctuation),
99
+ (r':', Punctuation),
100
+
101
+ # Identifiers: start with letter or underscore (Unicode-aware).
102
+ (r'[^\W\d]\w*', Name),
103
+ ],
104
+
105
+ # Raw triple-quoted (no escape tokens; content is one big String).
106
+ 'triple-double-raw': [
107
+ (r'"""', String, '#pop'),
108
+ (r'"(?!"")', String),
109
+ (r'[^"]+', String),
110
+ ],
111
+ 'triple-single-raw': [
112
+ (r"'''", String, '#pop'),
113
+ (r"'(?!'')", String),
114
+ (r"[^']+", String),
115
+ ],
116
+
117
+ # Non-raw triple-quoted (escape sequences highlighted separately).
118
+ 'triple-double': [
119
+ (r'"""', String, '#pop'),
120
+ (_ESCAPE, String.Escape),
121
+ (r'"(?!"")', String),
122
+ (r'[^"\\]+', String),
123
+ ],
124
+ 'triple-single': [
125
+ (r"'''", String, '#pop'),
126
+ (_ESCAPE, String.Escape),
127
+ (r"'(?!'')", String),
128
+ (r"[^'\\]+", String),
129
+ ],
130
+
131
+ # Single-line non-raw strings (cannot span lines).
132
+ 'double-string': [
133
+ (r'"', String, '#pop'),
134
+ (_ESCAPE, String.Escape),
135
+ (r'[^"\\\r\n]+', String),
136
+ ],
137
+ 'single-string': [
138
+ (r"'", String, '#pop'),
139
+ (_ESCAPE, String.Escape),
140
+ (r"[^'\\\r\n]+", String),
141
+ ],
142
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/chapel.py ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.chapel
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Chapel language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, words
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation, Whitespace
14
+
15
+ __all__ = ['ChapelLexer']
16
+
17
+
18
+ class ChapelLexer(RegexLexer):
19
+ """
20
+ For Chapel source.
21
+ """
22
+ name = 'Chapel'
23
+ url = 'https://chapel-lang.org/'
24
+ filenames = ['*.chpl']
25
+ aliases = ['chapel', 'chpl']
26
+ version_added = '2.0'
27
+ # mimetypes = ['text/x-chapel']
28
+
29
+ known_types = ('bool', 'bytes', 'complex', 'imag', 'int', 'locale',
30
+ 'nothing', 'opaque', 'range', 'real', 'string', 'uint',
31
+ 'void')
32
+
33
+ type_modifiers_par = ('atomic', 'single', 'sync')
34
+ type_modifiers_mem = ('borrowed', 'owned', 'shared', 'unmanaged')
35
+ type_modifiers = (*type_modifiers_par, *type_modifiers_mem)
36
+
37
+ declarations = ('config', 'const', 'in', 'inout', 'out', 'param', 'ref',
38
+ 'type', 'var')
39
+
40
+ constants = ('false', 'nil', 'none', 'true')
41
+
42
+ other_keywords = ('align', 'as',
43
+ 'begin', 'break', 'by',
44
+ 'catch', 'cobegin', 'coforall', 'continue',
45
+ 'defer', 'delete', 'dmapped', 'do', 'domain',
46
+ 'else', 'enum', 'except', 'export', 'extern',
47
+ 'for', 'forall', 'foreach', 'forwarding',
48
+ 'if', 'implements', 'import', 'index', 'init', 'inline',
49
+ 'label', 'lambda', 'let', 'lifetime', 'local',
50
+ 'new', 'noinit',
51
+ 'on', 'only', 'otherwise', 'override',
52
+ 'pragma', 'primitive', 'private', 'prototype', 'public',
53
+ 'reduce', 'require', 'return',
54
+ 'scan', 'select', 'serial', 'sparse', 'subdomain',
55
+ 'then', 'this', 'throw', 'throws', 'try',
56
+ 'use',
57
+ 'when', 'where', 'while', 'with',
58
+ 'yield',
59
+ 'zip')
60
+
61
+ tokens = {
62
+ 'root': [
63
+ (r'\n', Whitespace),
64
+ (r'\s+', Whitespace),
65
+ (r'\\\n', Text),
66
+
67
+ (r'//(.*?)\n', Comment.Single),
68
+ (r'/(\\\n)?[*][\s\S]*?[*](\\\n)?/', Comment.Multiline),
69
+
70
+ (words(declarations, suffix=r'\b'), Keyword.Declaration),
71
+ (words(constants, suffix=r'\b'), Keyword.Constant),
72
+ (words(known_types, suffix=r'\b'), Keyword.Type),
73
+ (words((*type_modifiers, *other_keywords), suffix=r'\b'), Keyword),
74
+
75
+ (r'@', Keyword, 'attributename'),
76
+ (r'(iter)(\s+)', bygroups(Keyword, Whitespace), 'procname'),
77
+ (r'(proc)(\s+)', bygroups(Keyword, Whitespace), 'procname'),
78
+ (r'(operator)(\s+)', bygroups(Keyword, Whitespace), 'procname'),
79
+ (r'(class|interface|module|record|union)(\s+)', bygroups(Keyword, Whitespace),
80
+ 'classname'),
81
+
82
+ # imaginary integers
83
+ (r'\d+i', Number),
84
+ (r'\d+\.\d*([Ee][-+]\d+)?i', Number),
85
+ (r'\.\d+([Ee][-+]\d+)?i', Number),
86
+ (r'\d+[Ee][-+]\d+i', Number),
87
+
88
+ # reals cannot end with a period due to lexical ambiguity with
89
+ # .. operator. See reference for rationale.
90
+ (r'(\d*\.\d+)([eE][+-]?[0-9]+)?i?', Number.Float),
91
+ (r'\d+[eE][+-]?[0-9]+i?', Number.Float),
92
+
93
+ # integer literals
94
+ # -- binary
95
+ (r'0[bB][01]+', Number.Bin),
96
+ # -- hex
97
+ (r'0[xX][0-9a-fA-F]+', Number.Hex),
98
+ # -- octal
99
+ (r'0[oO][0-7]+', Number.Oct),
100
+ # -- decimal
101
+ (r'[0-9]+', Number.Integer),
102
+
103
+ # strings
104
+ (r'"(\\\\|\\"|[^"])*"', String),
105
+ (r"'(\\\\|\\'|[^'])*'", String),
106
+
107
+ # tokens
108
+ (r'(=|\+=|-=|\*=|/=|\*\*=|%=|&=|\|=|\^=|&&=|\|\|=|<<=|>>=|'
109
+ r'<=>|<~>|\.\.|by|#|\.\.\.|'
110
+ r'&&|\|\||!|&|\||\^|~|<<|>>|'
111
+ r'==|!=|<=|>=|<|>|'
112
+ r'[+\-*/%]|\*\*)', Operator),
113
+ (r'[:;,.?()\[\]{}]', Punctuation),
114
+
115
+ # identifiers
116
+ (r'[a-zA-Z_][\w$]*', Name.Other),
117
+ ],
118
+ 'classname': [
119
+ (r'[a-zA-Z_][\w$]*', Name.Class, '#pop'),
120
+ ],
121
+ 'procname': [
122
+ (r'([a-zA-Z_][.\w$]*|' # regular function name, including secondary
123
+ r'\~[a-zA-Z_][.\w$]*|' # support for legacy destructors
124
+ r'[+*/!~%<>=&^|\-:]{1,2})', # operators
125
+ Name.Function, '#pop'),
126
+
127
+ # allow `proc (atomic T).foo`
128
+ (r'\(', Punctuation, "receivertype"),
129
+ (r'\)+\.', Punctuation),
130
+ ],
131
+ 'receivertype': [
132
+ (words(type_modifiers, suffix=r'\b'), Keyword),
133
+ (words(known_types, suffix=r'\b'), Keyword.Type),
134
+ (r'[^()]*', Name.Other, '#pop'),
135
+ ],
136
+ 'attributename': [
137
+ (r'[a-zA-Z_][.\w$]*', Name.Decorator, '#pop'),
138
+ ],
139
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/clean.py ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.clean
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Clean language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import ExtendedRegexLexer, words, default, include, bygroups
12
+ from pygments.token import Comment, Error, Keyword, Literal, Name, Number, \
13
+ Operator, Punctuation, String, Whitespace
14
+
15
+ __all__ = ['CleanLexer']
16
+
17
+
18
+ class CleanLexer(ExtendedRegexLexer):
19
+ """
20
+ Lexer for the general purpose, state-of-the-art, pure and lazy functional
21
+ programming language Clean.
22
+
23
+ .. versionadded: 2.2
24
+ """
25
+ name = 'Clean'
26
+ url = 'http://clean.cs.ru.nl/Clean'
27
+ aliases = ['clean']
28
+ filenames = ['*.icl', '*.dcl']
29
+ version_added = ''
30
+
31
+ keywords = (
32
+ 'case', 'ccall', 'class', 'code', 'code inline', 'derive', 'export',
33
+ 'foreign', 'generic', 'if', 'in', 'infix', 'infixl', 'infixr',
34
+ 'instance', 'let', 'of', 'otherwise', 'special', 'stdcall', 'where',
35
+ 'with')
36
+
37
+ modulewords = ('implementation', 'definition', 'system')
38
+
39
+ lowerId = r'[a-z`][\w`]*'
40
+ upperId = r'[A-Z`][\w`]*'
41
+ funnyId = r'[~@#$%\^?!+\-*<>\\/|&=:]+'
42
+ scoreUpperId = r'_' + upperId
43
+ scoreLowerId = r'_' + lowerId
44
+ moduleId = r'[a-zA-Z_][a-zA-Z0-9_.`]+'
45
+ classId = '|'.join([lowerId, upperId, funnyId])
46
+
47
+ tokens = {
48
+ 'root': [
49
+ include('comments'),
50
+ include('keywords'),
51
+ include('module'),
52
+ include('import'),
53
+ include('whitespace'),
54
+ include('literals'),
55
+ include('operators'),
56
+ include('delimiters'),
57
+ include('names'),
58
+ ],
59
+ 'whitespace': [
60
+ (r'\s+', Whitespace),
61
+ ],
62
+ 'comments': [
63
+ (r'//.*\n', Comment.Single),
64
+ (r'/\*', Comment.Multiline, 'comments.in'),
65
+ (r'/\*\*', Comment.Special, 'comments.in'),
66
+ ],
67
+ 'comments.in': [
68
+ (r'\*\/', Comment.Multiline, '#pop'),
69
+ (r'/\*', Comment.Multiline, '#push'),
70
+ (r'[^*/]+', Comment.Multiline),
71
+ (r'\*(?!/)', Comment.Multiline),
72
+ (r'/', Comment.Multiline),
73
+ ],
74
+ 'keywords': [
75
+ (words(keywords, prefix=r'\b', suffix=r'\b'), Keyword),
76
+ ],
77
+ 'module': [
78
+ (words(modulewords, prefix=r'\b', suffix=r'\b'), Keyword.Namespace),
79
+ (r'\bmodule\b', Keyword.Namespace, 'module.name'),
80
+ ],
81
+ 'module.name': [
82
+ include('whitespace'),
83
+ (moduleId, Name.Class, '#pop'),
84
+ ],
85
+ 'import': [
86
+ (r'\b(import)\b(\s*)', bygroups(Keyword, Whitespace), 'import.module'),
87
+ (r'\b(from)\b(\s*)\b(' + moduleId + r')\b(\s*)\b(import)\b',
88
+ bygroups(Keyword, Whitespace, Name.Class, Whitespace, Keyword),
89
+ 'import.what'),
90
+ ],
91
+ 'import.module': [
92
+ (r'\b(qualified)\b(\s*)', bygroups(Keyword, Whitespace)),
93
+ (r'(\s*)\b(as)\b', bygroups(Whitespace, Keyword), ('#pop', 'import.module.as')),
94
+ (moduleId, Name.Class),
95
+ (r'(\s*)(,)(\s*)', bygroups(Whitespace, Punctuation, Whitespace)),
96
+ (r'\s+', Whitespace),
97
+ default('#pop'),
98
+ ],
99
+ 'import.module.as': [
100
+ include('whitespace'),
101
+ (lowerId, Name.Class, '#pop'),
102
+ (upperId, Name.Class, '#pop'),
103
+ ],
104
+ 'import.what': [
105
+ (r'\b(class)\b(\s+)(' + classId + r')',
106
+ bygroups(Keyword, Whitespace, Name.Class), 'import.what.class'),
107
+ (r'\b(instance)(\s+)(' + classId + r')(\s+)',
108
+ bygroups(Keyword, Whitespace, Name.Class, Whitespace), 'import.what.instance'),
109
+ (r'(::)(\s*)\b(' + upperId + r')\b',
110
+ bygroups(Punctuation, Whitespace, Name.Class), 'import.what.type'),
111
+ (r'\b(generic)\b(\s+)\b(' + lowerId + '|' + upperId + r')\b',
112
+ bygroups(Keyword, Whitespace, Name)),
113
+ include('names'),
114
+ (r'(,)(\s+)', bygroups(Punctuation, Whitespace)),
115
+ (r'$', Whitespace, '#pop'),
116
+ include('whitespace'),
117
+ ],
118
+ 'import.what.class': [
119
+ (r',', Punctuation, '#pop'),
120
+ (r'\(', Punctuation, 'import.what.class.members'),
121
+ (r'$', Whitespace, '#pop:2'),
122
+ include('whitespace'),
123
+ ],
124
+ 'import.what.class.members': [
125
+ (r',', Punctuation),
126
+ (r'\.\.', Punctuation),
127
+ (r'\)', Punctuation, '#pop'),
128
+ include('names'),
129
+ ],
130
+ 'import.what.instance': [
131
+ (r'[,)]', Punctuation, '#pop'),
132
+ (r'\(', Punctuation, 'import.what.instance'),
133
+ (r'$', Whitespace, '#pop:2'),
134
+ include('whitespace'),
135
+ include('names'),
136
+ ],
137
+ 'import.what.type': [
138
+ (r',', Punctuation, '#pop'),
139
+ (r'[({]', Punctuation, 'import.what.type.consesandfields'),
140
+ (r'$', Whitespace, '#pop:2'),
141
+ include('whitespace'),
142
+ ],
143
+ 'import.what.type.consesandfields': [
144
+ (r',', Punctuation),
145
+ (r'\.\.', Punctuation),
146
+ (r'[)}]', Punctuation, '#pop'),
147
+ include('names'),
148
+ ],
149
+ 'literals': [
150
+ (r'\'([^\'\\]|\\(x[\da-fA-F]+|\d+|.))\'', Literal.Char),
151
+ (r'[+~-]?0[0-7]+\b', Number.Oct),
152
+ (r'[+~-]?\d+\.\d+(E[+-]?\d+)?', Number.Float),
153
+ (r'[+~-]?\d+\b', Number.Integer),
154
+ (r'[+~-]?0x[\da-fA-F]+\b', Number.Hex),
155
+ (r'True|False', Literal),
156
+ (r'"', String.Double, 'literals.stringd'),
157
+ ],
158
+ 'literals.stringd': [
159
+ (r'[^\\"\n]+', String.Double),
160
+ (r'"', String.Double, '#pop'),
161
+ (r'\\.', String.Double),
162
+ (r'[$\n]', Error, '#pop'),
163
+ ],
164
+ 'operators': [
165
+ (r'[-~@#$%\^?!+*<>\\/|&=:.]+', Operator),
166
+ (r'\b_+\b', Operator),
167
+ ],
168
+ 'delimiters': [
169
+ (r'[,;(){}\[\]]', Punctuation),
170
+ (r'(\')([\w`.]+)(\')',
171
+ bygroups(Punctuation, Name.Class, Punctuation)),
172
+ ],
173
+ 'names': [
174
+ (lowerId, Name),
175
+ (scoreLowerId, Name),
176
+ (funnyId, Name.Function),
177
+ (upperId, Name.Class),
178
+ (scoreUpperId, Name.Class),
179
+ ]
180
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/codeql.py ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.codeql
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for CodeQL query language.
6
+
7
+ The grammar is originating from:
8
+ https://github.com/github/vscode-codeql/blob/main/syntaxes/README.md
9
+
10
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
11
+ :license: BSD, see LICENSE for details.
12
+ """
13
+
14
+ __all__ = ['CodeQLLexer']
15
+
16
+ import re
17
+
18
+ from pygments.lexer import RegexLexer, words
19
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
20
+ Number, Punctuation, Whitespace
21
+
22
+ class CodeQLLexer(RegexLexer):
23
+ name = 'CodeQL'
24
+ aliases = ['codeql', 'ql']
25
+ filenames = ['*.ql', '*.qll']
26
+ mimetypes = []
27
+ url = 'https://github.com/github/codeql'
28
+ version_added = '2.19'
29
+
30
+ flags = re.MULTILINE | re.UNICODE
31
+
32
+ tokens = {
33
+ 'root': [
34
+ # Whitespace and comments
35
+ (r'\s+', Whitespace),
36
+ (r'//.*?\n', Comment.Single),
37
+ (r'/\*', Comment.Multiline, 'multiline-comments'),
38
+
39
+ # Keywords
40
+ (words((
41
+ 'module', 'import', 'class', 'extends', 'implements',
42
+ 'predicate', 'select', 'where', 'from', 'as', 'and', 'or', 'not',
43
+ 'in', 'if', 'then', 'else', 'exists', 'forall', 'instanceof',
44
+ 'private', 'predicate', 'abstract', 'cached', 'external',
45
+ 'final', 'library', 'override', 'query'
46
+ ), suffix=r'\b'), Keyword.Builtin),
47
+
48
+ # Special Keywords
49
+ (words(('this'), # class related keywords
50
+ prefix=r'\b', suffix=r'\b\??:?'), Name.Builtin.Pseudo),
51
+
52
+ # Types
53
+ (words((
54
+ 'boolean', 'date', 'float', 'int', 'string'
55
+ ), suffix=r'\b'), Keyword.Type),
56
+
57
+ # Literals
58
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
59
+ (r'[0-9]+\.[0-9]+', Number.Float),
60
+ (r'[0-9]+', Number.Integer),
61
+
62
+ # Operators
63
+ (r'<=|>=|<|>|=|!=|\+|-|\*|/', Operator),
64
+
65
+ # Punctuation
66
+ (r'[.,;:\[\]{}()]+', Punctuation),
67
+
68
+ # Identifiers
69
+ (r'@[a-zA-Z_]\w*', Name.Variable), # Variables with @ prefix
70
+ (r'[A-Z][a-zA-Z0-9_]*', Name.Class), # Types and classes
71
+ (r'[a-z][a-zA-Z0-9_]*', Name.Variable), # Variables and predicates
72
+ ],
73
+ 'multiline-comments': [
74
+ (r'[^*/]+', Comment.Multiline),
75
+ (r'/\*', Comment.Multiline, '#push'),
76
+ (r'\*/', Comment.Multiline, '#pop'),
77
+ (r'[*/]', Comment.Multiline),
78
+ ],
79
+
80
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/comal.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.comal
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for COMAL-80.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, words
14
+ from pygments.token import Comment, Whitespace, Operator, Keyword, String, \
15
+ Number, Name, Punctuation
16
+
17
+ __all__ = ["Comal80Lexer"]
18
+
19
+
20
+ class Comal80Lexer(RegexLexer):
21
+ """
22
+ For COMAL-80 source code.
23
+ """
24
+
25
+ name = 'COMAL-80'
26
+ url = 'https://en.wikipedia.org/wiki/COMAL'
27
+ aliases = ['comal', 'comal80']
28
+ filenames = ['*.cml', '*.comal']
29
+ version_added = ''
30
+ flags = re.IGNORECASE
31
+ #
32
+ # COMAL allows for some strange characters in names which we list here so
33
+ # keywords and word operators will not be recognized at the start of an
34
+ # identifier.
35
+ #
36
+ _suffix = r"\b(?!['\[\]←£\\])"
37
+ _identifier = r"[a-z]['\[\]←£\\\w]*"
38
+
39
+ tokens = {
40
+ 'root': [
41
+ (r'//.*\n', Comment.Single),
42
+ (r'\s+', Whitespace),
43
+ (r':[=+-]|\<\>|[-+*/^↑<>=]', Operator),
44
+ (r'(and +then|or +else)' + _suffix, Operator.Word),
45
+ (words([
46
+ 'and', 'bitand', 'bitor', 'bitxor', 'div', 'in', 'mod', 'not',
47
+ 'or'], suffix=_suffix,), Operator.Word),
48
+ (words([
49
+ 'append', 'at', 'case', 'chain', 'close', 'copy', 'create', 'cursor',
50
+ 'data', 'delete', 'dir', 'do', 'elif', 'else', 'end', 'endcase', 'endif',
51
+ 'endfor', 'endloop', 'endtrap', 'endwhile', 'exec', 'exit', 'file',
52
+ 'for', 'goto', 'handler', 'if', 'input', 'let', 'loop', 'mount', 'null',
53
+ 'of', 'open', 'otherwise', 'output', 'page', 'pass', 'poke', 'print',
54
+ 'random', 'read', 'repeat', 'report', 'return', 'rename', 'restore',
55
+ 'select', 'step', 'stop', 'sys', 'then', 'to', 'trap', 'unit', 'unit$',
56
+ 'until', 'using', 'when', 'while', 'write', 'zone'], suffix=_suffix),
57
+ Keyword.Reserved),
58
+ (words([
59
+ 'closed', 'dim', 'endfunc', 'endproc', 'external', 'func', 'import',
60
+ 'proc', 'ref', 'use'], suffix=_suffix), Keyword.Declaration),
61
+ (words([
62
+ 'abs', 'atn', 'chr$', 'cos', 'eod', 'eof', 'err', 'errfile', 'errtext',
63
+ 'esc', 'exp', 'int', 'key$', 'len', 'log', 'ord', 'peek', 'randomize',
64
+ 'rnd', 'sgn', 'sin', 'spc$', 'sqr', 'status$', 'str$', 'tab', 'tan',
65
+ 'time', 'val'], suffix=_suffix), Name.Builtin),
66
+ (words(['false', 'pi', 'true'], suffix=_suffix), Keyword.Constant),
67
+ (r'"', String, 'string'),
68
+ (_identifier + r":(?=[ \n/])", Name.Label),
69
+ (_identifier + r"[$#]?", Name),
70
+ (r'%[01]+', Number.Bin),
71
+ (r'\$[0-9a-f]+', Number.Hex),
72
+ (r'\d*\.\d*(e[-+]?\d+)?', Number.Float),
73
+ (r'\d+', Number.Integer),
74
+ (r'[(),:;]', Punctuation),
75
+ ],
76
+ 'string': [
77
+ (r'[^"]+', String),
78
+ (r'"[0-9]*"', String.Escape),
79
+ (r'"', String, '#pop'),
80
+ ],
81
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/compiled.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.compiled
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Just export lexer classes previously contained in this module.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ # ruff: noqa: F401
12
+ from pygments.lexers.jvm import JavaLexer, ScalaLexer
13
+ from pygments.lexers.c_cpp import CLexer, CppLexer
14
+ from pygments.lexers.d import DLexer
15
+ from pygments.lexers.objective import ObjectiveCLexer, \
16
+ ObjectiveCppLexer, LogosLexer
17
+ from pygments.lexers.go import GoLexer
18
+ from pygments.lexers.rust import RustLexer
19
+ from pygments.lexers.c_like import ECLexer, ValaLexer, CudaLexer
20
+ from pygments.lexers.pascal import DelphiLexer, PortugolLexer, Modula2Lexer
21
+ from pygments.lexers.ada import AdaLexer
22
+ from pygments.lexers.business import CobolLexer, CobolFreeformatLexer
23
+ from pygments.lexers.fortran import FortranLexer
24
+ from pygments.lexers.prolog import PrologLexer
25
+ from pygments.lexers.python import CythonLexer
26
+ from pygments.lexers.graphics import GLShaderLexer
27
+ from pygments.lexers.ml import OcamlLexer
28
+ from pygments.lexers.basic import BlitzBasicLexer, BlitzMaxLexer, MonkeyLexer
29
+ from pygments.lexers.dylan import DylanLexer, DylanLidLexer, DylanConsoleLexer
30
+ from pygments.lexers.ooc import OocLexer
31
+ from pygments.lexers.felix import FelixLexer
32
+ from pygments.lexers.nimrod import NimrodLexer
33
+ from pygments.lexers.crystal import CrystalLexer
34
+
35
+ __all__ = []
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/configs.py ADDED
@@ -0,0 +1,1499 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.configs
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for configuration file formats.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import ExtendedRegexLexer, RegexLexer, default, words, \
14
+ bygroups, include, using, this, line_re
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Whitespace, Literal, Error, Generic
17
+ from pygments.lexers.shell import BashLexer
18
+ from pygments.lexers.data import JsonLexer
19
+
20
+ __all__ = ['IniLexer', 'SystemdLexer', 'DesktopLexer', 'RegeditLexer', 'PropertiesLexer',
21
+ 'KconfigLexer', 'Cfengine3Lexer', 'ApacheConfLexer', 'SquidConfLexer',
22
+ 'NginxConfLexer', 'LighttpdConfLexer', 'DockerLexer',
23
+ 'TerraformLexer', 'TermcapLexer', 'TerminfoLexer',
24
+ 'PkgConfigLexer', 'PacmanConfLexer', 'AugeasLexer', 'TOMLLexer',
25
+ 'NestedTextLexer', 'SingularityLexer', 'UnixConfigLexer',
26
+ 'CaddyfileLexer']
27
+
28
+
29
+ class IniLexer(RegexLexer):
30
+ """
31
+ Lexer for configuration files in INI style.
32
+ """
33
+
34
+ name = 'INI'
35
+ aliases = ['ini', 'cfg', 'dosini']
36
+ filenames = [
37
+ '*.ini', '*.cfg', '*.inf', '.editorconfig',
38
+ ]
39
+ mimetypes = ['text/x-ini', 'text/inf']
40
+ url = 'https://en.wikipedia.org/wiki/INI_file'
41
+ version_added = ''
42
+
43
+ tokens = {
44
+ 'root': [
45
+ (r'\s+', Whitespace),
46
+ (r'[;#].*', Comment.Single),
47
+ (r'(\[.*?\])([ \t]*)$', bygroups(Keyword, Whitespace)),
48
+ (r'''(.*?)([ \t]*)([=:])([ \t]*)(["'])''',
49
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String),
50
+ "quoted_value"),
51
+ (r'(.*?)([ \t]*)([=:])([ \t]*)([^;#\n]*)(\\)(\s+)',
52
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String,
53
+ Text, Whitespace),
54
+ "value"),
55
+ (r'(.*?)([ \t]*)([=:])([ \t]*)([^ ;#\n]*(?: +[^ ;#\n]+)*)',
56
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String)),
57
+ # standalone option, supported by some INI parsers
58
+ (r'(.+?)$', Name.Attribute),
59
+ ],
60
+ 'quoted_value': [
61
+ (r'''([^"'\n]*)(["'])(\s*)''',
62
+ bygroups(String, String, Whitespace), "#pop"),
63
+ (r'[;#].*', Comment.Single),
64
+ (r'$', String, "#pop"),
65
+ ],
66
+ 'value': [ # line continuation
67
+ (r'\s+', Whitespace),
68
+ (r'(\s*)(.*)(\\)([ \t]*)',
69
+ bygroups(Whitespace, String, Text, Whitespace)),
70
+ (r'.*$', String, "#pop"),
71
+ ],
72
+ }
73
+
74
+ def analyse_text(text):
75
+ npos = text.find('\n')
76
+ if npos < 3:
77
+ return False
78
+ if text[0] == '[' and text[npos-1] == ']':
79
+ return 0.8
80
+ return False
81
+
82
+
83
+ class DesktopLexer(RegexLexer):
84
+ """
85
+ Lexer for .desktop files.
86
+ """
87
+
88
+ name = 'Desktop file'
89
+ url = "https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html"
90
+ aliases = ['desktop']
91
+ filenames = ['*.desktop']
92
+ mimetypes = ['application/x-desktop']
93
+ version_added = '2.16'
94
+
95
+ tokens = {
96
+ 'root': [
97
+ (r'^[ \t]*\n', Whitespace),
98
+ (r'^(#.*)(\n)', bygroups(Comment.Single, Whitespace)),
99
+ (r'(\[[^\]\n]+\])(\n)', bygroups(Keyword, Whitespace)),
100
+ (r'([-A-Za-z0-9]+)(\[[^\] \t=]+\])?([ \t]*)(=)([ \t]*)([^\n]*)([ \t\n]*\n)',
101
+ bygroups(Name.Attribute, Name.Namespace, Whitespace, Operator, Whitespace, String, Whitespace)),
102
+ ],
103
+ }
104
+
105
+ def analyse_text(text):
106
+ if text.startswith("[Desktop Entry]"):
107
+ return 1.0
108
+ if re.search(r"^\[Desktop Entry\][ \t]*$", text[:500], re.MULTILINE) is not None:
109
+ return 0.9
110
+ return 0.0
111
+
112
+
113
+ class SystemdLexer(RegexLexer):
114
+ """
115
+ Lexer for systemd unit files.
116
+ """
117
+
118
+ name = 'Systemd'
119
+ url = "https://www.freedesktop.org/software/systemd/man/systemd.syntax.html"
120
+ aliases = ['systemd']
121
+ filenames = [
122
+ '*.service', '*.socket', '*.device', '*.mount', '*.automount',
123
+ '*.swap', '*.target', '*.path', '*.timer', '*.slice', '*.scope',
124
+ ]
125
+ version_added = '2.16'
126
+
127
+ tokens = {
128
+ 'root': [
129
+ (r'^[ \t]*\n', Whitespace),
130
+ (r'^([;#].*)(\n)', bygroups(Comment.Single, Whitespace)),
131
+ (r'(\[[^\]\n]+\])(\n)', bygroups(Keyword, Whitespace)),
132
+ (r'([^=]+)([ \t]*)(=)([ \t]*)([^\n]*)(\\)(\n)',
133
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String,
134
+ Text, Whitespace),
135
+ "value"),
136
+ (r'([^=]+)([ \t]*)(=)([ \t]*)([^\n]*)(\n)',
137
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String, Whitespace)),
138
+ ],
139
+ 'value': [
140
+ # line continuation
141
+ (r'^([;#].*)(\n)', bygroups(Comment.Single, Whitespace)),
142
+ (r'([ \t]*)([^\n]*)(\\)(\n)',
143
+ bygroups(Whitespace, String, Text, Whitespace)),
144
+ (r'([ \t]*)([^\n]*)(\n)',
145
+ bygroups(Whitespace, String, Whitespace), "#pop"),
146
+ ],
147
+ }
148
+
149
+ def analyse_text(text):
150
+ if text.startswith("[Unit]"):
151
+ return 1.0
152
+ if re.search(r"^\[Unit\][ \t]*$", text[:500], re.MULTILINE) is not None:
153
+ return 0.9
154
+ return 0.0
155
+
156
+
157
+ class RegeditLexer(RegexLexer):
158
+ """
159
+ Lexer for Windows Registry files produced by regedit.
160
+ """
161
+
162
+ name = 'reg'
163
+ url = 'http://en.wikipedia.org/wiki/Windows_Registry#.REG_files'
164
+ aliases = ['registry']
165
+ filenames = ['*.reg']
166
+ mimetypes = ['text/x-windows-registry']
167
+ version_added = '1.6'
168
+
169
+ tokens = {
170
+ 'root': [
171
+ (r'Windows Registry Editor.*', Text),
172
+ (r'\s+', Whitespace),
173
+ (r'[;#].*', Comment.Single),
174
+ (r'(\[)(-?)(HKEY_[A-Z_]+)(.*?\])$',
175
+ bygroups(Keyword, Operator, Name.Builtin, Keyword)),
176
+ # String keys, which obey somewhat normal escaping
177
+ (r'("(?:\\"|\\\\|[^"])+")([ \t]*)(=)([ \t]*)',
178
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace),
179
+ 'value'),
180
+ # Bare keys (includes @)
181
+ (r'(.*?)([ \t]*)(=)([ \t]*)',
182
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace),
183
+ 'value'),
184
+ ],
185
+ 'value': [
186
+ (r'-', Operator, '#pop'), # delete value
187
+ (r'(dword|hex(?:\([0-9a-fA-F]\))?)(:)([0-9a-fA-F,]+)',
188
+ bygroups(Name.Variable, Punctuation, Number), '#pop'),
189
+ # As far as I know, .reg files do not support line continuation.
190
+ (r'.+', String, '#pop'),
191
+ default('#pop'),
192
+ ]
193
+ }
194
+
195
+ def analyse_text(text):
196
+ return text.startswith('Windows Registry Editor')
197
+
198
+
199
+ class PropertiesLexer(RegexLexer):
200
+ """
201
+ Lexer for configuration files in Java's properties format.
202
+
203
+ Note: trailing whitespace counts as part of the value as per spec
204
+ """
205
+
206
+ name = 'Properties'
207
+ aliases = ['properties', 'jproperties']
208
+ filenames = ['*.properties']
209
+ mimetypes = ['text/x-java-properties']
210
+ url = 'https://en.wikipedia.org/wiki/.properties'
211
+ version_added = '1.4'
212
+
213
+ tokens = {
214
+ 'root': [
215
+ # comments
216
+ (r'[!#].*|/{2}.*', Comment.Single),
217
+ # ending a comment or whitespace-only line
218
+ (r'\n', Whitespace),
219
+ # eat whitespace at the beginning of a line
220
+ (r'^[^\S\n]+', Whitespace),
221
+ # start lexing a key
222
+ default('key'),
223
+ ],
224
+ 'key': [
225
+ # non-escaped key characters
226
+ (r'[^\\:=\s]+', Name.Attribute),
227
+ # escapes
228
+ include('escapes'),
229
+ # separator is the first non-escaped whitespace or colon or '=' on the line;
230
+ # if it's whitespace, = and : are gobbled after it
231
+ (r'([^\S\n]*)([:=])([^\S\n]*)',
232
+ bygroups(Whitespace, Operator, Whitespace),
233
+ ('#pop', 'value')),
234
+ (r'[^\S\n]+', Whitespace, ('#pop', 'value')),
235
+ # maybe we got no value after all
236
+ (r'\n', Whitespace, '#pop'),
237
+ ],
238
+ 'value': [
239
+ # non-escaped value characters
240
+ (r'[^\\\n]+', String),
241
+ # escapes
242
+ include('escapes'),
243
+ # end the value on an unescaped newline
244
+ (r'\n', Whitespace, '#pop'),
245
+ ],
246
+ 'escapes': [
247
+ # line continuations; these gobble whitespace at the beginning of the next line
248
+ (r'(\\\n)([^\S\n]*)', bygroups(String.Escape, Whitespace)),
249
+ # other escapes
250
+ (r'\\([\s\S])', String.Escape),
251
+ ],
252
+ }
253
+
254
+
255
+ def _rx_indent(level):
256
+ # Kconfig *always* interprets a tab as 8 spaces, so this is the default.
257
+ # Edit this if you are in an environment where KconfigLexer gets expanded
258
+ # input (tabs expanded to spaces) and the expansion tab width is != 8,
259
+ # e.g. in connection with Trac (trac.ini, [mimeviewer], tab_width).
260
+ # Value range here is 2 <= {tab_width} <= 8.
261
+ tab_width = 8
262
+ # Regex matching a given indentation {level}, assuming that indentation is
263
+ # a multiple of {tab_width}. In other cases there might be problems.
264
+ if tab_width == 2:
265
+ space_repeat = '+'
266
+ else:
267
+ space_repeat = '{1,%d}' % (tab_width - 1)
268
+ if level == 1:
269
+ level_repeat = ''
270
+ else:
271
+ level_repeat = f'{{{level}}}'
272
+ return rf'(?:\t| {space_repeat}\t| {{{tab_width}}}){level_repeat}.*\n'
273
+
274
+
275
+ class KconfigLexer(RegexLexer):
276
+ """
277
+ For Linux-style Kconfig files.
278
+ """
279
+
280
+ name = 'Kconfig'
281
+ aliases = ['kconfig', 'menuconfig', 'linux-config', 'kernel-config']
282
+ version_added = '1.6'
283
+ # Adjust this if new kconfig file names appear in your environment
284
+ filenames = ['Kconfig*', '*Config.in*', 'external.in*',
285
+ 'standard-modules.in']
286
+ mimetypes = ['text/x-kconfig']
287
+ url = 'https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html'
288
+
289
+ # No re.MULTILINE, indentation-aware help text needs line-by-line handling
290
+ flags = 0
291
+
292
+ def call_indent(level):
293
+ # If indentation >= {level} is detected, enter state 'indent{level}'
294
+ return (_rx_indent(level), String.Doc, f'indent{level}')
295
+
296
+ def do_indent(level):
297
+ # Print paragraphs of indentation level >= {level} as String.Doc,
298
+ # ignoring blank lines. Then return to 'root' state.
299
+ return [
300
+ (_rx_indent(level), String.Doc),
301
+ (r'\s*\n', Text),
302
+ default('#pop:2')
303
+ ]
304
+
305
+ tokens = {
306
+ 'root': [
307
+ (r'\s+', Whitespace),
308
+ (r'#.*?\n', Comment.Single),
309
+ (words((
310
+ 'mainmenu', 'config', 'menuconfig', 'choice', 'endchoice',
311
+ 'comment', 'menu', 'endmenu', 'visible if', 'if', 'endif',
312
+ 'source', 'prompt', 'select', 'depends on', 'default',
313
+ 'range', 'option'), suffix=r'\b'),
314
+ Keyword),
315
+ (r'(---help---|help)[\t ]*\n', Keyword, 'help'),
316
+ (r'(bool|tristate|string|hex|int|defconfig_list|modules|env)\b',
317
+ Name.Builtin),
318
+ (r'[!=&|]', Operator),
319
+ (r'[()]', Punctuation),
320
+ (r'[0-9]+', Number.Integer),
321
+ (r"'(''|[^'])*'", String.Single),
322
+ (r'"(""|[^"])*"', String.Double),
323
+ (r'\S+', Text),
324
+ ],
325
+ # Help text is indented, multi-line and ends when a lower indentation
326
+ # level is detected.
327
+ 'help': [
328
+ # Skip blank lines after help token, if any
329
+ (r'\s*\n', Text),
330
+ # Determine the first help line's indentation level heuristically(!).
331
+ # Attention: this is not perfect, but works for 99% of "normal"
332
+ # indentation schemes up to a max. indentation level of 7.
333
+ call_indent(7),
334
+ call_indent(6),
335
+ call_indent(5),
336
+ call_indent(4),
337
+ call_indent(3),
338
+ call_indent(2),
339
+ call_indent(1),
340
+ default('#pop'), # for incomplete help sections without text
341
+ ],
342
+ # Handle text for indentation levels 7 to 1
343
+ 'indent7': do_indent(7),
344
+ 'indent6': do_indent(6),
345
+ 'indent5': do_indent(5),
346
+ 'indent4': do_indent(4),
347
+ 'indent3': do_indent(3),
348
+ 'indent2': do_indent(2),
349
+ 'indent1': do_indent(1),
350
+ }
351
+
352
+
353
+ class Cfengine3Lexer(RegexLexer):
354
+ """
355
+ Lexer for CFEngine3 policy files.
356
+ """
357
+
358
+ name = 'CFEngine3'
359
+ url = 'http://cfengine.org'
360
+ aliases = ['cfengine3', 'cf3']
361
+ filenames = ['*.cf']
362
+ mimetypes = []
363
+ version_added = '1.5'
364
+
365
+ tokens = {
366
+ 'root': [
367
+ (r'#.*?\n', Comment),
368
+ (r'(body)(\s+)(\S+)(\s+)(control)',
369
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword)),
370
+ (r'(body|bundle)(\s+)(\S+)(\s+)(\w+)(\()',
371
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Name.Function, Punctuation),
372
+ 'arglist'),
373
+ (r'(body|bundle)(\s+)(\S+)(\s+)(\w+)',
374
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Name.Function)),
375
+ (r'(")([^"]+)(")(\s+)(string|slist|int|real)(\s*)(=>)(\s*)',
376
+ bygroups(Punctuation, Name.Variable, Punctuation,
377
+ Whitespace, Keyword.Type, Whitespace, Operator, Whitespace)),
378
+ (r'(\S+)(\s*)(=>)(\s*)',
379
+ bygroups(Keyword.Reserved, Whitespace, Operator, Text)),
380
+ (r'"', String, 'string'),
381
+ (r'(\w+)(\()', bygroups(Name.Function, Punctuation)),
382
+ (r'([\w.!&|()]+)(::)', bygroups(Name.Class, Punctuation)),
383
+ (r'(\w+)(:)', bygroups(Keyword.Declaration, Punctuation)),
384
+ (r'@[{(][^)}]+[})]', Name.Variable),
385
+ (r'[(){},;]', Punctuation),
386
+ (r'=>', Operator),
387
+ (r'->', Operator),
388
+ (r'\d+\.\d+', Number.Float),
389
+ (r'\d+', Number.Integer),
390
+ (r'\w+', Name.Function),
391
+ (r'\s+', Whitespace),
392
+ ],
393
+ 'string': [
394
+ (r'\$[{(]', String.Interpol, 'interpol'),
395
+ (r'\\.', String.Escape),
396
+ (r'"', String, '#pop'),
397
+ (r'\n', String),
398
+ (r'.', String),
399
+ ],
400
+ 'interpol': [
401
+ (r'\$[{(]', String.Interpol, '#push'),
402
+ (r'[})]', String.Interpol, '#pop'),
403
+ (r'[^${()}]+', String.Interpol),
404
+ ],
405
+ 'arglist': [
406
+ (r'\)', Punctuation, '#pop'),
407
+ (r',', Punctuation),
408
+ (r'\w+', Name.Variable),
409
+ (r'\s+', Whitespace),
410
+ ],
411
+ }
412
+
413
+
414
+ class ApacheConfLexer(RegexLexer):
415
+ """
416
+ Lexer for configuration files following the Apache config file
417
+ format.
418
+ """
419
+
420
+ name = 'ApacheConf'
421
+ aliases = ['apacheconf', 'aconf', 'apache']
422
+ filenames = ['.htaccess', 'apache.conf', 'apache2.conf']
423
+ mimetypes = ['text/x-apacheconf']
424
+ url = 'https://httpd.apache.org/docs/current/configuring.html'
425
+ version_added = '0.6'
426
+ flags = re.MULTILINE | re.IGNORECASE
427
+
428
+ tokens = {
429
+ 'root': [
430
+ (r'\s+', Whitespace),
431
+ (r'#(.*\\\n)+.*$|(#.*?)$', Comment),
432
+ (r'(<[^\s>/][^\s>]*)(?:(\s+)(.*))?(>)',
433
+ bygroups(Name.Tag, Whitespace, String, Name.Tag)),
434
+ (r'(</[^\s>]+)(>)',
435
+ bygroups(Name.Tag, Name.Tag)),
436
+ (r'[a-z]\w*', Name.Builtin, 'value'),
437
+ (r'\.+', Text),
438
+ ],
439
+ 'value': [
440
+ (r'\\\n', Text),
441
+ (r'\n+', Whitespace, '#pop'),
442
+ (r'\\', Text),
443
+ (r'[^\S\n]+', Whitespace),
444
+ (r'\d+\.\d+\.\d+\.\d+(?:/\d+)?', Number),
445
+ (r'\d+', Number),
446
+ (r'/([*a-z0-9][*\w./-]+)', String.Other),
447
+ (r'(on|off|none|any|all|double|email|dns|min|minimal|'
448
+ r'os|productonly|full|emerg|alert|crit|error|warn|'
449
+ r'notice|info|debug|registry|script|inetd|standalone|'
450
+ r'user|group)\b', Keyword),
451
+ (r'"([^"\\]*(?:\\([\s\S])[^"\\]*)*)"', String.Double),
452
+ (r'[^\s"\\]+', Text)
453
+ ],
454
+ }
455
+
456
+
457
+ class SquidConfLexer(RegexLexer):
458
+ """
459
+ Lexer for squid configuration files.
460
+ """
461
+
462
+ name = 'SquidConf'
463
+ url = 'http://www.squid-cache.org/'
464
+ aliases = ['squidconf', 'squid.conf', 'squid']
465
+ filenames = ['squid.conf']
466
+ mimetypes = ['text/x-squidconf']
467
+ version_added = '0.9'
468
+ flags = re.IGNORECASE
469
+
470
+ keywords = (
471
+ "access_log", "acl", "always_direct", "announce_host",
472
+ "announce_period", "announce_port", "announce_to", "anonymize_headers",
473
+ "append_domain", "as_whois_server", "auth_param_basic",
474
+ "authenticate_children", "authenticate_program", "authenticate_ttl",
475
+ "broken_posts", "buffered_logs", "cache_access_log", "cache_announce",
476
+ "cache_dir", "cache_dns_program", "cache_effective_group",
477
+ "cache_effective_user", "cache_host", "cache_host_acl",
478
+ "cache_host_domain", "cache_log", "cache_mem", "cache_mem_high",
479
+ "cache_mem_low", "cache_mgr", "cachemgr_passwd", "cache_peer",
480
+ "cache_peer_access", "cache_replacement_policy", "cache_stoplist",
481
+ "cache_stoplist_pattern", "cache_store_log", "cache_swap",
482
+ "cache_swap_high", "cache_swap_log", "cache_swap_low", "client_db",
483
+ "client_lifetime", "client_netmask", "connect_timeout", "coredump_dir",
484
+ "dead_peer_timeout", "debug_options", "delay_access", "delay_class",
485
+ "delay_initial_bucket_level", "delay_parameters", "delay_pools",
486
+ "deny_info", "dns_children", "dns_defnames", "dns_nameservers",
487
+ "dns_testnames", "emulate_httpd_log", "err_html_text",
488
+ "fake_user_agent", "firewall_ip", "forwarded_for", "forward_snmpd_port",
489
+ "fqdncache_size", "ftpget_options", "ftpget_program", "ftp_list_width",
490
+ "ftp_passive", "ftp_user", "half_closed_clients", "header_access",
491
+ "header_replace", "hierarchy_stoplist", "high_response_time_warning",
492
+ "high_page_fault_warning", "hosts_file", "htcp_port", "http_access",
493
+ "http_anonymizer", "httpd_accel", "httpd_accel_host",
494
+ "httpd_accel_port", "httpd_accel_uses_host_header",
495
+ "httpd_accel_with_proxy", "http_port", "http_reply_access",
496
+ "icp_access", "icp_hit_stale", "icp_port", "icp_query_timeout",
497
+ "ident_lookup", "ident_lookup_access", "ident_timeout",
498
+ "incoming_http_average", "incoming_icp_average", "inside_firewall",
499
+ "ipcache_high", "ipcache_low", "ipcache_size", "local_domain",
500
+ "local_ip", "logfile_rotate", "log_fqdn", "log_icp_queries",
501
+ "log_mime_hdrs", "maximum_object_size", "maximum_single_addr_tries",
502
+ "mcast_groups", "mcast_icp_query_timeout", "mcast_miss_addr",
503
+ "mcast_miss_encode_key", "mcast_miss_port", "memory_pools",
504
+ "memory_pools_limit", "memory_replacement_policy", "mime_table",
505
+ "min_http_poll_cnt", "min_icp_poll_cnt", "minimum_direct_hops",
506
+ "minimum_object_size", "minimum_retry_timeout", "miss_access",
507
+ "negative_dns_ttl", "negative_ttl", "neighbor_timeout",
508
+ "neighbor_type_domain", "netdb_high", "netdb_low", "netdb_ping_period",
509
+ "netdb_ping_rate", "never_direct", "no_cache", "passthrough_proxy",
510
+ "pconn_timeout", "pid_filename", "pinger_program", "positive_dns_ttl",
511
+ "prefer_direct", "proxy_auth", "proxy_auth_realm", "query_icmp",
512
+ "quick_abort", "quick_abort_max", "quick_abort_min",
513
+ "quick_abort_pct", "range_offset_limit", "read_timeout",
514
+ "redirect_children", "redirect_program",
515
+ "redirect_rewrites_host_header", "reference_age",
516
+ "refresh_pattern", "reload_into_ims", "request_body_max_size",
517
+ "request_size", "request_timeout", "shutdown_lifetime",
518
+ "single_parent_bypass", "siteselect_timeout", "snmp_access",
519
+ "snmp_incoming_address", "snmp_port", "source_ping", "ssl_proxy",
520
+ "store_avg_object_size", "store_objects_per_bucket",
521
+ "strip_query_terms", "swap_level1_dirs", "swap_level2_dirs",
522
+ "tcp_incoming_address", "tcp_outgoing_address", "tcp_recv_bufsize",
523
+ "test_reachability", "udp_hit_obj", "udp_hit_obj_size",
524
+ "udp_incoming_address", "udp_outgoing_address", "unique_hostname",
525
+ "unlinkd_program", "uri_whitespace", "useragent_log",
526
+ "visible_hostname", "wais_relay", "wais_relay_host", "wais_relay_port",
527
+ )
528
+
529
+ opts = (
530
+ "proxy-only", "weight", "ttl", "no-query", "default", "round-robin",
531
+ "multicast-responder", "on", "off", "all", "deny", "allow", "via",
532
+ "parent", "no-digest", "heap", "lru", "realm", "children", "q1", "q2",
533
+ "credentialsttl", "none", "disable", "offline_toggle", "diskd",
534
+ )
535
+
536
+ actions = (
537
+ "shutdown", "info", "parameter", "server_list", "client_list",
538
+ r'squid.conf',
539
+ )
540
+
541
+ actions_stats = (
542
+ "objects", "vm_objects", "utilization", "ipcache", "fqdncache", "dns",
543
+ "redirector", "io", "reply_headers", "filedescriptors", "netdb",
544
+ )
545
+
546
+ actions_log = ("status", "enable", "disable", "clear")
547
+
548
+ acls = (
549
+ "url_regex", "urlpath_regex", "referer_regex", "port", "proto",
550
+ "req_mime_type", "rep_mime_type", "method", "browser", "user", "src",
551
+ "dst", "time", "dstdomain", "ident", "snmp_community",
552
+ )
553
+
554
+ ipv4_group = r'(\d+|0x[0-9a-f]+)'
555
+ ipv4 = rf'({ipv4_group}(\.{ipv4_group}){{3}})'
556
+ ipv6_group = r'([0-9a-f]{0,4})'
557
+ ipv6 = rf'({ipv6_group}(:{ipv6_group}){{1,7}})'
558
+ bare_ip = rf'({ipv4}|{ipv6})'
559
+ # XXX: /integer is a subnet mark, but what is /IP ?
560
+ # There is no test where it is used.
561
+ ip = rf'{bare_ip}(/({bare_ip}|\d+))?'
562
+
563
+ tokens = {
564
+ 'root': [
565
+ (r'\s+', Whitespace),
566
+ (r'#', Comment, 'comment'),
567
+ (words(keywords, prefix=r'\b', suffix=r'\b'), Keyword),
568
+ (words(opts, prefix=r'\b', suffix=r'\b'), Name.Constant),
569
+ # Actions
570
+ (words(actions, prefix=r'\b', suffix=r'\b'), String),
571
+ (words(actions_stats, prefix=r'stats/', suffix=r'\b'), String),
572
+ (words(actions_log, prefix=r'log/', suffix=r'='), String),
573
+ (words(acls, prefix=r'\b', suffix=r'\b'), Keyword),
574
+ (ip, Number.Float),
575
+ (r'(?:\b\d+\b(?:-\b\d+|%)?)', Number),
576
+ (r'\S+', Text),
577
+ ],
578
+ 'comment': [
579
+ (r'\s*TAG:.*', String.Escape, '#pop'),
580
+ (r'.+', Comment, '#pop'),
581
+ default('#pop'),
582
+ ],
583
+ }
584
+
585
+
586
+ class NginxConfLexer(RegexLexer):
587
+ """
588
+ Lexer for Nginx configuration files.
589
+ """
590
+ name = 'Nginx configuration file'
591
+ url = 'http://nginx.net/'
592
+ aliases = ['nginx']
593
+ filenames = ['nginx.conf']
594
+ mimetypes = ['text/x-nginx-conf']
595
+ version_added = '0.11'
596
+
597
+ tokens = {
598
+ 'root': [
599
+ (r'(include)(\s+)([^\s;]+)', bygroups(Keyword, Whitespace, Name)),
600
+ (r'[^\s;#]+', Keyword, 'stmt'),
601
+ include('base'),
602
+ ],
603
+ 'block': [
604
+ (r'\}', Punctuation, '#pop:2'),
605
+ (r'[^\s;#]+', Keyword.Namespace, 'stmt'),
606
+ include('base'),
607
+ ],
608
+ 'stmt': [
609
+ (r'\{', Punctuation, 'block'),
610
+ (r';', Punctuation, '#pop'),
611
+ include('base'),
612
+ ],
613
+ 'base': [
614
+ (r'#.*\n', Comment.Single),
615
+ (r'on|off', Name.Constant),
616
+ (r'\$[^\s;#()]+', Name.Variable),
617
+ (r'([a-z0-9.-]+)(:)([0-9]+)',
618
+ bygroups(Name, Punctuation, Number.Integer)),
619
+ (r'[a-z-]+/[a-z-+]+', String), # mimetype
620
+ # (r'[a-zA-Z._-]+', Keyword),
621
+ (r'[0-9]+[km]?\b', Number.Integer),
622
+ (r'(~)(\s*)([^\s{]+)', bygroups(Punctuation, Whitespace, String.Regex)),
623
+ (r'[:=~]', Punctuation),
624
+ (r'[^\s;#{}$]+', String), # catch all
625
+ (r'/[^\s;#]*', Name), # pathname
626
+ (r'\s+', Whitespace),
627
+ (r'[$;]', Text), # leftover characters
628
+ ],
629
+ }
630
+
631
+
632
+ class LighttpdConfLexer(RegexLexer):
633
+ """
634
+ Lexer for Lighttpd configuration files.
635
+ """
636
+ name = 'Lighttpd configuration file'
637
+ url = 'http://lighttpd.net/'
638
+ aliases = ['lighttpd', 'lighty']
639
+ filenames = ['lighttpd.conf']
640
+ mimetypes = ['text/x-lighttpd-conf']
641
+ version_added = '0.11'
642
+
643
+ tokens = {
644
+ 'root': [
645
+ (r'#.*\n', Comment.Single),
646
+ (r'/\S*', Name), # pathname
647
+ (r'[a-zA-Z._-]+', Keyword),
648
+ (r'\d+\.\d+\.\d+\.\d+(?:/\d+)?', Number),
649
+ (r'[0-9]+', Number),
650
+ (r'=>|=~|\+=|==|=|\+', Operator),
651
+ (r'\$[A-Z]+', Name.Builtin),
652
+ (r'[(){}\[\],]', Punctuation),
653
+ (r'"([^"\\]*(?:\\.[^"\\]*)*)"', String.Double),
654
+ (r'\s+', Whitespace),
655
+ ],
656
+
657
+ }
658
+
659
+
660
+ class DockerLexer(RegexLexer):
661
+ """
662
+ Lexer for Docker configuration files.
663
+ """
664
+ name = 'Docker'
665
+ url = 'http://docker.io'
666
+ aliases = ['docker', 'dockerfile']
667
+ filenames = ['Dockerfile', '*.docker']
668
+ mimetypes = ['text/x-dockerfile-config']
669
+ version_added = '2.0'
670
+
671
+ _keywords = (r'(?:MAINTAINER|EXPOSE|WORKDIR|USER|STOPSIGNAL)')
672
+ _bash_keywords = (r'(?:RUN|CMD|ENTRYPOINT|ENV|ARG|LABEL|ADD|COPY)')
673
+ _lb = r'(?:\s*\\?\s*)' # dockerfile line break regex
674
+ flags = re.IGNORECASE | re.MULTILINE
675
+
676
+ tokens = {
677
+ 'root': [
678
+ (r'#.*', Comment),
679
+ (r'(FROM)([ \t]*)(\S*)([ \t]*)(?:(AS)([ \t]*)(\S*))?',
680
+ bygroups(Keyword, Whitespace, String, Whitespace, Keyword, Whitespace, String)),
681
+ (rf'(ONBUILD)(\s+)({_lb})', bygroups(Keyword, Whitespace, using(BashLexer))),
682
+ (rf'(HEALTHCHECK)(\s+)(({_lb}--\w+=\w+{_lb})*)',
683
+ bygroups(Keyword, Whitespace, using(BashLexer))),
684
+ (rf'(VOLUME|ENTRYPOINT|CMD|SHELL)(\s+)({_lb})(\[.*?\])',
685
+ bygroups(Keyword, Whitespace, using(BashLexer), using(JsonLexer))),
686
+ (rf'(LABEL|ENV|ARG)(\s+)(({_lb}\w+=\w+{_lb})*)',
687
+ bygroups(Keyword, Whitespace, using(BashLexer))),
688
+ (rf'({_keywords}|VOLUME)\b(\s+)(.*)', bygroups(Keyword, Whitespace, String)),
689
+ (rf'({_bash_keywords})(\s+)', bygroups(Keyword, Whitespace)),
690
+ (r'(.*\\\n)*.+', using(BashLexer)),
691
+ ]
692
+ }
693
+
694
+
695
+ class TerraformLexer(ExtendedRegexLexer):
696
+ """
697
+ Lexer for terraformi ``.tf`` files.
698
+ """
699
+
700
+ name = 'Terraform'
701
+ url = 'https://www.terraform.io/'
702
+ aliases = ['terraform', 'tf', 'hcl']
703
+ filenames = ['*.tf', '*.hcl']
704
+ mimetypes = ['application/x-tf', 'application/x-terraform']
705
+ version_added = '2.1'
706
+
707
+ classes = ('backend', 'data', 'module', 'output', 'provider',
708
+ 'provisioner', 'resource', 'variable')
709
+ classes_re = "({})".format(('|').join(classes))
710
+
711
+ types = ('string', 'number', 'bool', 'list', 'tuple', 'map', 'set', 'object', 'null')
712
+
713
+ numeric_functions = ('abs', 'ceil', 'floor', 'log', 'max',
714
+ 'mix', 'parseint', 'pow', 'signum')
715
+
716
+ string_functions = ('chomp', 'format', 'formatlist', 'indent',
717
+ 'join', 'lower', 'regex', 'regexall', 'replace',
718
+ 'split', 'strrev', 'substr', 'title', 'trim',
719
+ 'trimprefix', 'trimsuffix', 'trimspace', 'upper'
720
+ )
721
+
722
+ collection_functions = ('alltrue', 'anytrue', 'chunklist', 'coalesce',
723
+ 'coalescelist', 'compact', 'concat', 'contains',
724
+ 'distinct', 'element', 'flatten', 'index', 'keys',
725
+ 'length', 'list', 'lookup', 'map', 'matchkeys',
726
+ 'merge', 'range', 'reverse', 'setintersection',
727
+ 'setproduct', 'setsubtract', 'setunion', 'slice',
728
+ 'sort', 'sum', 'transpose', 'values', 'zipmap'
729
+ )
730
+
731
+ encoding_functions = ('base64decode', 'base64encode', 'base64gzip',
732
+ 'csvdecode', 'jsondecode', 'jsonencode', 'textdecodebase64',
733
+ 'textencodebase64', 'urlencode', 'yamldecode', 'yamlencode')
734
+
735
+ filesystem_functions = ('abspath', 'dirname', 'pathexpand', 'basename',
736
+ 'file', 'fileexists', 'fileset', 'filebase64', 'templatefile')
737
+
738
+ date_time_functions = ('formatdate', 'timeadd', 'timestamp')
739
+
740
+ hash_crypto_functions = ('base64sha256', 'base64sha512', 'bcrypt', 'filebase64sha256',
741
+ 'filebase64sha512', 'filemd5', 'filesha1', 'filesha256', 'filesha512',
742
+ 'md5', 'rsadecrypt', 'sha1', 'sha256', 'sha512', 'uuid', 'uuidv5')
743
+
744
+ ip_network_functions = ('cidrhost', 'cidrnetmask', 'cidrsubnet', 'cidrsubnets')
745
+
746
+ type_conversion_functions = ('can', 'defaults', 'tobool', 'tolist', 'tomap',
747
+ 'tonumber', 'toset', 'tostring', 'try')
748
+
749
+ builtins = numeric_functions + string_functions + collection_functions + encoding_functions +\
750
+ filesystem_functions + date_time_functions + hash_crypto_functions + ip_network_functions +\
751
+ type_conversion_functions
752
+ builtins_re = "({})".format(('|').join(builtins))
753
+
754
+ def heredoc_callback(self, match, ctx):
755
+ # Parse a terraform heredoc
756
+ # match: 1 = <<[-]?, 2 = name 3 = rest of line
757
+
758
+ start = match.start(1)
759
+ yield start, Operator, match.group(1) # <<[-]?
760
+ yield match.start(2), String.Delimiter, match.group(2) # heredoc name
761
+
762
+ ctx.pos = match.start(3)
763
+ ctx.end = match.end(3)
764
+ yield ctx.pos, String.Heredoc, match.group(3)
765
+ ctx.pos = match.end()
766
+
767
+ hdname = match.group(2)
768
+ tolerant = True # leading whitespace is always accepted
769
+
770
+ lines = []
771
+
772
+ for match in line_re.finditer(ctx.text, ctx.pos):
773
+ if tolerant:
774
+ check = match.group().strip()
775
+ else:
776
+ check = match.group().rstrip()
777
+ if check == hdname:
778
+ for amatch in lines:
779
+ yield amatch.start(), String.Heredoc, amatch.group()
780
+ yield match.start(), String.Delimiter, match.group()
781
+ ctx.pos = match.end()
782
+ break
783
+ else:
784
+ lines.append(match)
785
+ else:
786
+ # end of heredoc not found -- error!
787
+ for amatch in lines:
788
+ yield amatch.start(), Error, amatch.group()
789
+ ctx.end = len(ctx.text)
790
+
791
+ tokens = {
792
+ 'root': [
793
+ include('basic'),
794
+ include('whitespace'),
795
+
796
+ # Strings
797
+ (r'(".*")', bygroups(String.Double)),
798
+
799
+ # Constants
800
+ (words(('true', 'false'), prefix=r'\b', suffix=r'\b'), Name.Constant),
801
+
802
+ # Types
803
+ (words(types, prefix=r'\b', suffix=r'\b'), Keyword.Type),
804
+
805
+ include('identifier'),
806
+ include('punctuation'),
807
+ (r'[0-9]+', Number),
808
+ ],
809
+ 'basic': [
810
+ (r'\s*/\*', Comment.Multiline, 'comment'),
811
+ (r'\s*(#|//).*\n', Comment.Single),
812
+ include('whitespace'),
813
+
814
+ # e.g. terraform {
815
+ # e.g. egress {
816
+ (r'(\s*)([0-9a-zA-Z-_]+)(\s*)(=?)(\s*)(\{)',
817
+ bygroups(Whitespace, Name.Builtin, Whitespace, Operator, Whitespace, Punctuation)),
818
+
819
+ # Assignment with attributes, e.g. something = ...
820
+ (r'(\s*)([0-9a-zA-Z-_]+)(\s*)(=)(\s*)',
821
+ bygroups(Whitespace, Name.Attribute, Whitespace, Operator, Whitespace)),
822
+
823
+ # Assignment with environment variables and similar, e.g. "something" = ...
824
+ # or key value assignment, e.g. "SlotName" : ...
825
+ (r'(\s*)("\S+")(\s*)([=:])(\s*)',
826
+ bygroups(Whitespace, Literal.String.Double, Whitespace, Operator, Whitespace)),
827
+
828
+ # Functions, e.g. jsonencode(element("value"))
829
+ (builtins_re + r'(\()', bygroups(Name.Function, Punctuation)),
830
+
831
+ # List of attributes, e.g. ignore_changes = [last_modified, filename]
832
+ (r'(\[)([a-z_,\s]+)(\])', bygroups(Punctuation, Name.Builtin, Punctuation)),
833
+
834
+ # e.g. resource "aws_security_group" "allow_tls" {
835
+ # e.g. backend "consul" {
836
+ (classes_re + r'(\s+)("[0-9a-zA-Z-_]+")?(\s*)("[0-9a-zA-Z-_]+")(\s+)(\{)',
837
+ bygroups(Keyword.Reserved, Whitespace, Name.Class, Whitespace, Name.Variable, Whitespace, Punctuation)),
838
+
839
+ # here-doc style delimited strings
840
+ (r'(<<-?)\s*([a-zA-Z_]\w*)(.*?\n)', heredoc_callback),
841
+ ],
842
+ 'identifier': [
843
+ (r'\b(var\.[0-9a-zA-Z-_\.\[\]]+)\b', bygroups(Name.Variable)),
844
+ (r'\b([0-9a-zA-Z-_\[\]]+\.[0-9a-zA-Z-_\.\[\]]+)\b',
845
+ bygroups(Name.Variable)),
846
+ ],
847
+ 'punctuation': [
848
+ (r'[\[\]()\{\},.?:!=]', Punctuation),
849
+ ],
850
+ 'comment': [
851
+ (r'[^*/]', Comment.Multiline),
852
+ (r'/\*', Comment.Multiline, '#push'),
853
+ (r'\*/', Comment.Multiline, '#pop'),
854
+ (r'[*/]', Comment.Multiline)
855
+ ],
856
+ 'whitespace': [
857
+ (r'\n', Whitespace),
858
+ (r'\s+', Whitespace),
859
+ (r'(\\)(\n)', bygroups(Text, Whitespace)),
860
+ ],
861
+ }
862
+
863
+
864
+ class TermcapLexer(RegexLexer):
865
+ """
866
+ Lexer for termcap database source.
867
+
868
+ This is very simple and minimal.
869
+ """
870
+ name = 'Termcap'
871
+ aliases = ['termcap']
872
+ filenames = ['termcap', 'termcap.src']
873
+ mimetypes = []
874
+ url = 'https://en.wikipedia.org/wiki/Termcap'
875
+ version_added = '2.1'
876
+
877
+ # NOTE:
878
+ # * multiline with trailing backslash
879
+ # * separator is ':'
880
+ # * to embed colon as data, we must use \072
881
+ # * space after separator is not allowed (mayve)
882
+ tokens = {
883
+ 'root': [
884
+ (r'^#.*', Comment),
885
+ (r'^[^\s#:|]+', Name.Tag, 'names'),
886
+ (r'\s+', Whitespace),
887
+ ],
888
+ 'names': [
889
+ (r'\n', Whitespace, '#pop'),
890
+ (r':', Punctuation, 'defs'),
891
+ (r'\|', Punctuation),
892
+ (r'[^:|]+', Name.Attribute),
893
+ ],
894
+ 'defs': [
895
+ (r'(\\)(\n[ \t]*)', bygroups(Text, Whitespace)),
896
+ (r'\n[ \t]*', Whitespace, '#pop:2'),
897
+ (r'(#)([0-9]+)', bygroups(Operator, Number)),
898
+ (r'=', Operator, 'data'),
899
+ (r':', Punctuation),
900
+ (r'[^\s:=#]+', Name.Class),
901
+ ],
902
+ 'data': [
903
+ (r'\\072', Literal),
904
+ (r':', Punctuation, '#pop'),
905
+ (r'[^:\\]+', Literal), # for performance
906
+ (r'.', Literal),
907
+ ],
908
+ }
909
+
910
+
911
+ class TerminfoLexer(RegexLexer):
912
+ """
913
+ Lexer for terminfo database source.
914
+
915
+ This is very simple and minimal.
916
+ """
917
+ name = 'Terminfo'
918
+ aliases = ['terminfo']
919
+ filenames = ['terminfo', 'terminfo.src']
920
+ mimetypes = []
921
+ url = 'https://en.wikipedia.org/wiki/Terminfo'
922
+ version_added = '2.1'
923
+
924
+ # NOTE:
925
+ # * multiline with leading whitespace
926
+ # * separator is ','
927
+ # * to embed comma as data, we can use \,
928
+ # * space after separator is allowed
929
+ tokens = {
930
+ 'root': [
931
+ (r'^#.*$', Comment),
932
+ (r'^[^\s#,|]+', Name.Tag, 'names'),
933
+ (r'\s+', Whitespace),
934
+ ],
935
+ 'names': [
936
+ (r'\n', Whitespace, '#pop'),
937
+ (r'(,)([ \t]*)', bygroups(Punctuation, Whitespace), 'defs'),
938
+ (r'\|', Punctuation),
939
+ (r'[^,|]+', Name.Attribute),
940
+ ],
941
+ 'defs': [
942
+ (r'\n[ \t]+', Whitespace),
943
+ (r'\n', Whitespace, '#pop:2'),
944
+ (r'(#)([0-9]+)', bygroups(Operator, Number)),
945
+ (r'=', Operator, 'data'),
946
+ (r'(,)([ \t]*)', bygroups(Punctuation, Whitespace)),
947
+ (r'[^\s,=#]+', Name.Class),
948
+ ],
949
+ 'data': [
950
+ (r'\\[,\\]', Literal),
951
+ (r'(,)([ \t]*)', bygroups(Punctuation, Whitespace), '#pop'),
952
+ (r'[^\\,]+', Literal), # for performance
953
+ (r'.', Literal),
954
+ ],
955
+ }
956
+
957
+
958
+ class PkgConfigLexer(RegexLexer):
959
+ """
960
+ Lexer for pkg-config
961
+ (see also `manual page <http://linux.die.net/man/1/pkg-config>`_).
962
+ """
963
+
964
+ name = 'PkgConfig'
965
+ url = 'http://www.freedesktop.org/wiki/Software/pkg-config/'
966
+ aliases = ['pkgconfig']
967
+ filenames = ['*.pc']
968
+ mimetypes = []
969
+ version_added = '2.1'
970
+
971
+ tokens = {
972
+ 'root': [
973
+ (r'#.*$', Comment.Single),
974
+
975
+ # variable definitions
976
+ (r'^(\w+)(=)', bygroups(Name.Attribute, Operator)),
977
+
978
+ # keyword lines
979
+ (r'^([\w.]+)(:)',
980
+ bygroups(Name.Tag, Punctuation), 'spvalue'),
981
+
982
+ # variable references
983
+ include('interp'),
984
+
985
+ # fallback
986
+ (r'\s+', Whitespace),
987
+ (r'[^${}#=:\n.]+', Text),
988
+ (r'.', Text),
989
+ ],
990
+ 'interp': [
991
+ # you can escape literal "$" as "$$"
992
+ (r'\$\$', Text),
993
+
994
+ # variable references
995
+ (r'\$\{', String.Interpol, 'curly'),
996
+ ],
997
+ 'curly': [
998
+ (r'\}', String.Interpol, '#pop'),
999
+ (r'\w+', Name.Attribute),
1000
+ ],
1001
+ 'spvalue': [
1002
+ include('interp'),
1003
+
1004
+ (r'#.*$', Comment.Single, '#pop'),
1005
+ (r'\n', Whitespace, '#pop'),
1006
+
1007
+ # fallback
1008
+ (r'\s+', Whitespace),
1009
+ (r'[^${}#\n\s]+', Text),
1010
+ (r'.', Text),
1011
+ ],
1012
+ }
1013
+
1014
+
1015
+ class PacmanConfLexer(RegexLexer):
1016
+ """
1017
+ Lexer for pacman.conf.
1018
+
1019
+ Actually, IniLexer works almost fine for this format,
1020
+ but it yield error token. It is because pacman.conf has
1021
+ a form without assignment like:
1022
+
1023
+ UseSyslog
1024
+ Color
1025
+ TotalDownload
1026
+ CheckSpace
1027
+ VerbosePkgLists
1028
+
1029
+ These are flags to switch on.
1030
+ """
1031
+
1032
+ name = 'PacmanConf'
1033
+ url = 'https://www.archlinux.org/pacman/pacman.conf.5.html'
1034
+ aliases = ['pacmanconf']
1035
+ filenames = ['pacman.conf']
1036
+ mimetypes = []
1037
+ version_added = '2.1'
1038
+
1039
+ tokens = {
1040
+ 'root': [
1041
+ # comment
1042
+ (r'#.*$', Comment.Single),
1043
+
1044
+ # section header
1045
+ (r'^(\s*)(\[.*?\])(\s*)$', bygroups(Whitespace, Keyword, Whitespace)),
1046
+
1047
+ # variable definitions
1048
+ # (Leading space is allowed...)
1049
+ (r'(\w+)(\s*)(=)',
1050
+ bygroups(Name.Attribute, Whitespace, Operator)),
1051
+
1052
+ # flags to on
1053
+ (r'^(\s*)(\w+)(\s*)$',
1054
+ bygroups(Whitespace, Name.Attribute, Whitespace)),
1055
+
1056
+ # built-in special values
1057
+ (words((
1058
+ '$repo', # repository
1059
+ '$arch', # architecture
1060
+ '%o', # outfile
1061
+ '%u', # url
1062
+ ), suffix=r'\b'),
1063
+ Name.Variable),
1064
+
1065
+ # fallback
1066
+ (r'\s+', Whitespace),
1067
+ (r'.', Text),
1068
+ ],
1069
+ }
1070
+
1071
+
1072
+ class AugeasLexer(RegexLexer):
1073
+ """
1074
+ Lexer for Augeas.
1075
+ """
1076
+ name = 'Augeas'
1077
+ url = 'http://augeas.net'
1078
+ aliases = ['augeas']
1079
+ filenames = ['*.aug']
1080
+ version_added = '2.4'
1081
+
1082
+ tokens = {
1083
+ 'root': [
1084
+ (r'(module)(\s*)([^\s=]+)', bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
1085
+ (r'(let)(\s*)([^\s=]+)', bygroups(Keyword.Declaration, Whitespace, Name.Variable)),
1086
+ (r'(del|store|value|counter|seq|key|label|autoload|incl|excl|transform|test|get|put)(\s+)', bygroups(Name.Builtin, Whitespace)),
1087
+ (r'(\()([^:]+)(\:)(unit|string|regexp|lens|tree|filter)(\))', bygroups(Punctuation, Name.Variable, Punctuation, Keyword.Type, Punctuation)),
1088
+ (r'\(\*', Comment.Multiline, 'comment'),
1089
+ (r'[*+\-.;=?|]', Operator),
1090
+ (r'[()\[\]{}]', Operator),
1091
+ (r'"', String.Double, 'string'),
1092
+ (r'\/', String.Regex, 'regex'),
1093
+ (r'([A-Z]\w*)(\.)(\w+)', bygroups(Name.Namespace, Punctuation, Name.Variable)),
1094
+ (r'.', Name.Variable),
1095
+ (r'\s+', Whitespace),
1096
+ ],
1097
+ 'string': [
1098
+ (r'\\.', String.Escape),
1099
+ (r'[^"]', String.Double),
1100
+ (r'"', String.Double, '#pop'),
1101
+ ],
1102
+ 'regex': [
1103
+ (r'\\.', String.Escape),
1104
+ (r'[^/]', String.Regex),
1105
+ (r'\/', String.Regex, '#pop'),
1106
+ ],
1107
+ 'comment': [
1108
+ (r'[^*)]', Comment.Multiline),
1109
+ (r'\(\*', Comment.Multiline, '#push'),
1110
+ (r'\*\)', Comment.Multiline, '#pop'),
1111
+ (r'[)*]', Comment.Multiline)
1112
+ ],
1113
+ }
1114
+
1115
+
1116
+ class TOMLLexer(RegexLexer):
1117
+ """
1118
+ Lexer for TOML, a simple language for config files.
1119
+ """
1120
+
1121
+ name = 'TOML'
1122
+ aliases = ['toml']
1123
+ filenames = ['*.toml', 'Pipfile', 'poetry.lock']
1124
+ mimetypes = ['application/toml']
1125
+ url = 'https://toml.io'
1126
+ version_added = '2.4'
1127
+
1128
+ # Based on the TOML spec: https://toml.io/en/v1.0.0
1129
+
1130
+ # The following is adapted from CPython's tomllib:
1131
+ _time = r"\d\d:\d\d(:\d\d(\.\d+)?)?"
1132
+ _datetime = rf"""(?x)
1133
+ \d\d\d\d-\d\d-\d\d # date, e.g., 1988-10-27
1134
+ (
1135
+ [Tt ] {_time} # optional time
1136
+ (
1137
+ [Zz]|[+-]\d\d:\d\d # optional time offset
1138
+ )?
1139
+ )?
1140
+ """
1141
+
1142
+ tokens = {
1143
+ 'root': [
1144
+ # Note that we make an effort in order to distinguish
1145
+ # moments at which we're parsing a key and moments at
1146
+ # which we're parsing a value. In the TOML code
1147
+ #
1148
+ # 1234 = 1234
1149
+ #
1150
+ # the first "1234" should be Name, the second Integer.
1151
+
1152
+ # Whitespace
1153
+ (r'\s+', Whitespace),
1154
+
1155
+ # Comment
1156
+ (r'#.*', Comment.Single),
1157
+
1158
+ # Assignment keys
1159
+ include('key'),
1160
+
1161
+ # After "=", find a value
1162
+ (r'(=)(\s*)', bygroups(Operator, Whitespace), 'value'),
1163
+
1164
+ # Table header
1165
+ (r'\[\[?', Keyword, 'table-key'),
1166
+ ],
1167
+ 'key': [
1168
+ # Start of bare key (only ASCII is allowed here).
1169
+ (r'[A-Za-z0-9_-]+', Name),
1170
+ # Quoted key
1171
+ (r'"', String.Double, 'basic-string'),
1172
+ (r"'", String.Single, 'literal-string'),
1173
+ # Dots act as separators in keys
1174
+ (r'\.', Punctuation),
1175
+ ],
1176
+ 'table-key': [
1177
+ # This is like 'key', but highlights the name components
1178
+ # and separating dots as Keyword because it looks better
1179
+ # when the whole table header is Keyword. We do highlight
1180
+ # strings as strings though.
1181
+ # Start of bare key (only ASCII is allowed here).
1182
+ (r'[A-Za-z0-9_-]+', Keyword),
1183
+ (r'"', String.Double, 'basic-string'),
1184
+ (r"'", String.Single, 'literal-string'),
1185
+ (r'\.', Keyword),
1186
+ (r'\]\]?', Keyword, '#pop'),
1187
+
1188
+ # Inline whitespace allowed
1189
+ (r'[ \t]+', Whitespace),
1190
+ ],
1191
+ 'value': [
1192
+ # Datetime, baretime
1193
+ (_datetime, Literal.Date, '#pop'),
1194
+ (_time, Literal.Date, '#pop'),
1195
+
1196
+ # Recognize as float if there is a fractional part
1197
+ # and/or an exponent.
1198
+ (r'[+-]?\d[0-9_]*[eE][+-]?\d[0-9_]*', Number.Float, '#pop'),
1199
+ (r'[+-]?\d[0-9_]*\.\d[0-9_]*([eE][+-]?\d[0-9_]*)?',
1200
+ Number.Float, '#pop'),
1201
+
1202
+ # Infinities and NaN
1203
+ (r'[+-]?(inf|nan)', Number.Float, '#pop'),
1204
+
1205
+ # Integers
1206
+ (r'-?0b[01_]+', Number.Bin, '#pop'),
1207
+ (r'-?0o[0-7_]+', Number.Oct, '#pop'),
1208
+ (r'-?0x[0-9a-fA-F_]+', Number.Hex, '#pop'),
1209
+ (r'[+-]?[0-9_]+', Number.Integer, '#pop'),
1210
+
1211
+ # Strings
1212
+ (r'"""', String.Double, ('#pop', 'multiline-basic-string')),
1213
+ (r'"', String.Double, ('#pop', 'basic-string')),
1214
+ (r"'''", String.Single, ('#pop', 'multiline-literal-string')),
1215
+ (r"'", String.Single, ('#pop', 'literal-string')),
1216
+
1217
+ # Booleans
1218
+ (r'true|false', Keyword.Constant, '#pop'),
1219
+
1220
+ # Start of array
1221
+ (r'\[', Punctuation, ('#pop', 'array')),
1222
+
1223
+ # Start of inline table
1224
+ (r'\{', Punctuation, ('#pop', 'inline-table')),
1225
+ ],
1226
+ 'array': [
1227
+ # Whitespace, including newlines, is ignored inside arrays,
1228
+ # and comments are allowed.
1229
+ (r'\s+', Whitespace),
1230
+ (r'#.*', Comment.Single),
1231
+
1232
+ # Delimiters
1233
+ (r',', Punctuation),
1234
+
1235
+ # End of array
1236
+ (r'\]', Punctuation, '#pop'),
1237
+
1238
+ # Parse a value and come back
1239
+ default('value'),
1240
+ ],
1241
+ 'inline-table': [
1242
+ # Whitespace (since TOML 1.1.0, same as in array)
1243
+ (r'\s+', Whitespace),
1244
+ (r'#.*', Comment.Single),
1245
+
1246
+ # Keys
1247
+ include('key'),
1248
+
1249
+ # Values
1250
+ (r'(=)(\s*)', bygroups(Punctuation, Whitespace), 'value'),
1251
+
1252
+ # Delimiters
1253
+ (r',', Punctuation),
1254
+
1255
+ # End of inline table
1256
+ (r'\}', Punctuation, '#pop'),
1257
+ ],
1258
+ 'basic-string': [
1259
+ (r'"', String.Double, '#pop'),
1260
+ include('escapes'),
1261
+ (r'[^"\\]+', String.Double),
1262
+ ],
1263
+ 'literal-string': [
1264
+ (r".*?'", String.Single, '#pop'),
1265
+ ],
1266
+ 'multiline-basic-string': [
1267
+ (r'"""', String.Double, '#pop'),
1268
+ (r'(\\)(\n)', bygroups(String.Escape, Whitespace)),
1269
+ include('escapes'),
1270
+ (r'[^"\\]+', String.Double),
1271
+ (r'"', String.Double),
1272
+ ],
1273
+ 'multiline-literal-string': [
1274
+ (r"'''", String.Single, '#pop'),
1275
+ (r"[^']+", String.Single),
1276
+ (r"'", String.Single),
1277
+ ],
1278
+ 'escapes': [
1279
+ (r'\\x[0-9a-fA-F]{2}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}', String.Escape),
1280
+ (r'\\.', String.Escape),
1281
+ ],
1282
+ }
1283
+
1284
+ class NestedTextLexer(RegexLexer):
1285
+ """
1286
+ Lexer for *NextedText*, a human-friendly data format.
1287
+
1288
+ .. versionchanged:: 2.16
1289
+ Added support for *NextedText* v3.0.
1290
+ """
1291
+
1292
+ name = 'NestedText'
1293
+ url = 'https://nestedtext.org'
1294
+ aliases = ['nestedtext', 'nt']
1295
+ filenames = ['*.nt']
1296
+ version_added = '2.9'
1297
+
1298
+ tokens = {
1299
+ 'root': [
1300
+ # Comment: # ...
1301
+ (r'^([ ]*)(#.*)$', bygroups(Whitespace, Comment)),
1302
+
1303
+ # Inline dictionary: {...}
1304
+ (r'^([ ]*)(\{)', bygroups(Whitespace, Punctuation), 'inline_dict'),
1305
+
1306
+ # Inline list: [...]
1307
+ (r'^([ ]*)(\[)', bygroups(Whitespace, Punctuation), 'inline_list'),
1308
+
1309
+ # empty multiline string item: >
1310
+ (r'^([ ]*)(>)$', bygroups(Whitespace, Punctuation)),
1311
+
1312
+ # multiline string item: > ...
1313
+ (r'^([ ]*)(>)( )(.*?)([ \t]*)$', bygroups(Whitespace, Punctuation, Whitespace, Text, Whitespace)),
1314
+
1315
+ # empty list item: -
1316
+ (r'^([ ]*)(-)$', bygroups(Whitespace, Punctuation)),
1317
+
1318
+ # list item: - ...
1319
+ (r'^([ ]*)(-)( )(.*?)([ \t]*)$', bygroups(Whitespace, Punctuation, Whitespace, Text, Whitespace)),
1320
+
1321
+ # empty multiline key item: :
1322
+ (r'^([ ]*)(:)$', bygroups(Whitespace, Punctuation)),
1323
+
1324
+ # multiline key item: : ...
1325
+ (r'^([ ]*)(:)( )([^\n]*?)([ \t]*)$', bygroups(Whitespace, Punctuation, Whitespace, Name.Tag, Whitespace)),
1326
+
1327
+ # empty dict key item: ...:
1328
+ (r'^([ ]*)([^\{\[\s].*?)(:)$', bygroups(Whitespace, Name.Tag, Punctuation)),
1329
+
1330
+ # dict key item: ...: ...
1331
+ (r'^([ ]*)([^\{\[\s].*?)(:)( )(.*?)([ \t]*)$', bygroups(Whitespace, Name.Tag, Punctuation, Whitespace, Text, Whitespace)),
1332
+ ],
1333
+ 'inline_list': [
1334
+ include('whitespace'),
1335
+ (r'[^\{\}\[\],\s]+', Text),
1336
+ include('inline_value'),
1337
+ (r',', Punctuation),
1338
+ (r'\]', Punctuation, '#pop'),
1339
+ (r'\n', Error, '#pop'),
1340
+ ],
1341
+ 'inline_dict': [
1342
+ include('whitespace'),
1343
+ (r'[^\{\}\[\],:\s]+', Name.Tag),
1344
+ (r':', Punctuation, 'inline_dict_value'),
1345
+ (r'\}', Punctuation, '#pop'),
1346
+ (r'\n', Error, '#pop'),
1347
+ ],
1348
+ 'inline_dict_value': [
1349
+ include('whitespace'),
1350
+ (r'[^\{\}\[\],:\s]+', Text),
1351
+ include('inline_value'),
1352
+ (r',', Punctuation, '#pop'),
1353
+ (r'\}', Punctuation, '#pop:2'),
1354
+ ],
1355
+ 'inline_value': [
1356
+ include('whitespace'),
1357
+ (r'\{', Punctuation, 'inline_dict'),
1358
+ (r'\[', Punctuation, 'inline_list'),
1359
+ ],
1360
+ 'whitespace': [
1361
+ (r'[ \t]+', Whitespace),
1362
+ ],
1363
+ }
1364
+
1365
+
1366
+ class SingularityLexer(RegexLexer):
1367
+ """
1368
+ Lexer for Singularity definition files.
1369
+ """
1370
+
1371
+ name = 'Singularity'
1372
+ url = 'https://www.sylabs.io/guides/3.0/user-guide/definition_files.html'
1373
+ aliases = ['singularity']
1374
+ filenames = ['*.def', 'Singularity']
1375
+ version_added = '2.6'
1376
+ flags = re.IGNORECASE | re.MULTILINE | re.DOTALL
1377
+
1378
+ _headers = r'^(\s*)(bootstrap|from|osversion|mirrorurl|include|registry|namespace|includecmd)(:)'
1379
+ _section = r'^(%(?:pre|post|setup|environment|help|labels|test|runscript|files|startscript))(\s*)'
1380
+ _appsect = r'^(%app(?:install|help|run|labels|env|test|files))(\s*)'
1381
+
1382
+ tokens = {
1383
+ 'root': [
1384
+ (_section, bygroups(Generic.Heading, Whitespace), 'script'),
1385
+ (_appsect, bygroups(Generic.Heading, Whitespace), 'script'),
1386
+ (_headers, bygroups(Whitespace, Keyword, Text)),
1387
+ (r'\s*#.*?\n', Comment),
1388
+ (r'\b(([0-9]+\.?[0-9]*)|(\.[0-9]+))\b', Number),
1389
+ (r'[ \t]+', Whitespace),
1390
+ (r'(?!^\s*%).', Text),
1391
+ ],
1392
+ 'script': [
1393
+ (r'(.+?(?=^\s*%))|(.*)', using(BashLexer), '#pop'),
1394
+ ],
1395
+ }
1396
+
1397
+ def analyse_text(text):
1398
+ """This is a quite simple script file, but there are a few keywords
1399
+ which seem unique to this language."""
1400
+ result = 0
1401
+ if re.search(r'\b(?:osversion|includecmd|mirrorurl)\b', text, re.IGNORECASE):
1402
+ result += 0.5
1403
+
1404
+ if re.search(SingularityLexer._section[1:], text):
1405
+ result += 0.49
1406
+
1407
+ return result
1408
+
1409
+
1410
+ class UnixConfigLexer(RegexLexer):
1411
+ """
1412
+ Lexer for Unix/Linux config files using colon-separated values, e.g.
1413
+
1414
+ * ``/etc/group``
1415
+ * ``/etc/passwd``
1416
+ * ``/etc/shadow``
1417
+ """
1418
+
1419
+ name = 'Unix/Linux config files'
1420
+ aliases = ['unixconfig', 'linuxconfig']
1421
+ filenames = []
1422
+ url = 'https://en.wikipedia.org/wiki/Configuration_file#Unix_and_Unix-like_operating_systems'
1423
+ version_added = '2.12'
1424
+
1425
+ tokens = {
1426
+ 'root': [
1427
+ (r'^#.*', Comment),
1428
+ (r'\n', Whitespace),
1429
+ (r':', Punctuation),
1430
+ (r'[0-9]+', Number),
1431
+ (r'((?!\n)[a-zA-Z0-9\_\-\s\(\),]){2,}', Text),
1432
+ (r'[^:\n]+', String),
1433
+ ],
1434
+ }
1435
+
1436
+
1437
+ class CaddyfileLexer(RegexLexer):
1438
+ """
1439
+ Lexer for Caddyfile, the configuration file format of the Caddy web server.
1440
+ """
1441
+
1442
+ name = 'Caddyfile'
1443
+ url = 'https://caddyserver.com/docs/caddyfile'
1444
+ aliases = ['caddyfile', 'caddy']
1445
+ filenames = ['Caddyfile']
1446
+ version_added = '2.21'
1447
+
1448
+ # The standard HTTP directives shipped with Caddy.
1449
+ directives = (
1450
+ 'abort', 'acme_server', 'basic_auth', 'bind', 'encode', 'error',
1451
+ 'file_server', 'forward_auth', 'handle', 'handle_errors',
1452
+ 'handle_path', 'header', 'import', 'invoke', 'log', 'map', 'metrics',
1453
+ 'php_fastcgi', 'push', 'redir', 'request_body', 'request_header',
1454
+ 'respond', 'reverse_proxy', 'rewrite', 'root', 'route', 'templates',
1455
+ 'tls', 'tracing', 'try_files', 'uri', 'vars',
1456
+ )
1457
+
1458
+ tokens = {
1459
+ 'root': [
1460
+ # Directives are only keywords as the first token on a line, so
1461
+ # anchor them to the start of the (possibly indented) line. This
1462
+ # consumes the preceding newline(s)/indentation itself, otherwise
1463
+ # the generic whitespace rule below would swallow it first.
1464
+ (r'((?:\A|\s*\n)[ \t]*)(' + '|'.join(directives) + r')\b',
1465
+ bygroups(Whitespace, Keyword)),
1466
+ (r'\s+', Whitespace),
1467
+ (r'#.*', Comment.Single),
1468
+ # Heredoc: <<LABEL <args> ... LABEL. The remainder of the opening
1469
+ # line (e.g. a status code) is not part of the body, so re-lex it;
1470
+ # the closing label must stand alone on its line.
1471
+ (r'(<<)([a-zA-Z_]\w*)(.*\n)((?:.*\n)*?)([ \t]*)(\2)(?=[ \t]*$)',
1472
+ bygroups(Operator, String.Delimiter, using(this),
1473
+ String.Heredoc, Whitespace, String.Delimiter)),
1474
+ # Placeholders: {path}, {http.request.uri}, {$ENV}, {args[0]}, ...
1475
+ (r'\{[^{}\s]+\}', Name.Variable),
1476
+ # Blocks and snippet parentheses
1477
+ (r'[(){}]', Punctuation),
1478
+ # Named matcher, e.g. @api
1479
+ (r'@[\w.-]+', Name.Decorator),
1480
+ (r'"', String.Double, 'string'),
1481
+ (r'`', String.Backtick, 'backtick'),
1482
+ # Numbers, durations and sizes (443, 200, 30s, 1.5m, 10MB); a
1483
+ # trailing dot or more digits/letters means it is an address or
1484
+ # hostname, which must stay Text.
1485
+ (r'\d+(?:\.\d+)?[a-zA-Z]*(?=[\s#{}()"`]|$)', Number),
1486
+ (r'[^\s#{}()"`]+', Text),
1487
+ ],
1488
+ 'string': [
1489
+ (r'\\.', String.Escape),
1490
+ (r'\{[^{}\s]+\}', Name.Variable),
1491
+ (r'[^"\\{]+', String.Double),
1492
+ (r'"', String.Double, '#pop'),
1493
+ (r'.', String.Double),
1494
+ ],
1495
+ 'backtick': [
1496
+ (r'[^`]+', String.Backtick),
1497
+ (r'`', String.Backtick, '#pop'),
1498
+ ],
1499
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/console.py ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.console
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for misc console output.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, include, bygroups, words
12
+ from pygments.token import Generic, Comment, String, Text, Keyword, Name, \
13
+ Punctuation, Number, Whitespace
14
+
15
+ __all__ = ['VCTreeStatusLexer', 'PyPyLogLexer']
16
+
17
+
18
+ class VCTreeStatusLexer(RegexLexer):
19
+ """
20
+ For colorizing output of version control status commands, like "hg
21
+ status" or "svn status".
22
+ """
23
+ name = 'VCTreeStatus'
24
+ aliases = ['vctreestatus']
25
+ filenames = []
26
+ mimetypes = []
27
+ url = ""
28
+ version_added = '2.0'
29
+
30
+ tokens = {
31
+ 'root': [
32
+ (r'^A \+ C\s+', Generic.Error),
33
+ (r'^A\s+\+?\s+', String),
34
+ (r'^M\s+', Generic.Inserted),
35
+ (r'^C\s+', Generic.Error),
36
+ (r'^D\s+', Generic.Deleted),
37
+ (r'^[?!]\s+', Comment.Preproc),
38
+ (r' >\s+.*\n', Comment.Preproc),
39
+ (r'\S+', Text),
40
+ (r'\s+', Whitespace),
41
+ ]
42
+ }
43
+
44
+
45
+ class PyPyLogLexer(RegexLexer):
46
+ """
47
+ Lexer for PyPy log files.
48
+ """
49
+ name = "PyPy Log"
50
+ aliases = ["pypylog", "pypy"]
51
+ filenames = ["*.pypylog"]
52
+ mimetypes = ['application/x-pypylog']
53
+ url = 'pypy.org'
54
+ version_added = '1.5'
55
+
56
+ tokens = {
57
+ "root": [
58
+ (r"\[\w+\] \{jit-log-.*?$", Keyword, "jit-log"),
59
+ (r"\[\w+\] \{jit-backend-counts$", Keyword, "jit-backend-counts"),
60
+ include("extra-stuff"),
61
+ ],
62
+ "jit-log": [
63
+ (r"\[\w+\] jit-log-.*?}$", Keyword, "#pop"),
64
+ (r"^\+\d+: ", Comment),
65
+ (r"--end of the loop--", Comment),
66
+ (r"[ifp]\d+", Name),
67
+ (r"ptr\d+", Name),
68
+ (r"(\()(\w+(?:\.\w+)?)(\))",
69
+ bygroups(Punctuation, Name.Builtin, Punctuation)),
70
+ (r"[\[\]=,()]", Punctuation),
71
+ (r"(\d+\.\d+|inf|-inf)", Number.Float),
72
+ (r"-?\d+", Number.Integer),
73
+ (r"'.*'", String),
74
+ (r"(None|descr|ConstClass|ConstPtr|TargetToken)", Name),
75
+ (r"<.*?>+", Name.Builtin),
76
+ (r"(label|debug_merge_point|jump|finish)", Name.Class),
77
+ (words(('int_add_ovf', 'int_add', 'int_sub_ovf', 'int_sub',
78
+ 'int_mul_ovf', 'int_mul', 'int_floordiv',
79
+ 'int_mod', 'int_lshift', 'int_rshift',
80
+ 'int_and', 'int_or', 'int_xor', 'int_eq',
81
+ 'int_ne', 'int_ge', 'int_gt', 'int_le',
82
+ 'int_lt', 'int_is_zero', 'int_is_true',
83
+ 'uint_floordiv', 'uint_ge', 'uint_lt',
84
+ 'float_add', 'float_sub', 'float_mul',
85
+ 'float_truediv', 'float_neg', 'float_eq',
86
+ 'float_ne', 'float_ge', 'float_gt',
87
+ 'float_le', 'float_lt', 'float_abs',
88
+ 'ptr_eq', 'ptr_ne', 'instance_ptr_eq',
89
+ 'instance_ptr_ne', 'cast_int_to_float',
90
+ 'cast_float_to_int', 'force_token',
91
+ 'quasiimmut_field', 'same_as',
92
+ 'virtual_ref_finish', 'virtual_ref',
93
+ 'mark_opaque_ptr', 'call_may_force',
94
+ 'call_assembler', 'call_loopinvariant',
95
+ 'call_release_gil', 'call_pure', 'call',
96
+ 'new_with_vtable', 'new_array', 'newstr',
97
+ 'newunicode', 'new', 'arraylen_gc',
98
+ 'getarrayitem_gc_pure', 'getarrayitem_gc',
99
+ 'setarrayitem_gc', 'getarrayitem_raw',
100
+ 'setarrayitem_raw', 'getfield_gc_pure',
101
+ 'getfield_gc', 'getinteriorfield_gc',
102
+ 'setinteriorfield_gc', 'getfield_raw',
103
+ 'setfield_gc', 'setfield_raw', 'strgetitem',
104
+ 'strsetitem', 'strlen', 'copystrcontent',
105
+ 'unicodegetitem', 'unicodesetitem',
106
+ 'unicodelen', 'guard_true', 'guard_false',
107
+ 'guard_value', 'guard_isnull',
108
+ 'guard_nonnull_class', 'guard_nonnull',
109
+ 'guard_class', 'guard_no_overflow',
110
+ 'guard_not_forced', 'guard_no_exception',
111
+ 'guard_not_invalidated')),
112
+ Name.Builtin),
113
+ include("extra-stuff"),
114
+ ],
115
+ "jit-backend-counts": [
116
+ (r"\[\w+\] jit-backend-counts}$", Keyword, "#pop"),
117
+ (r":", Punctuation),
118
+ (r"\d+", Number),
119
+ include("extra-stuff"),
120
+ ],
121
+ "extra-stuff": [
122
+ (r"\s+", Whitespace),
123
+ (r"#.*?$", Comment),
124
+ ],
125
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/cplint.py ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.cplint
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the cplint language
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import bygroups, inherit, words
12
+ from pygments.lexers import PrologLexer
13
+ from pygments.token import Operator, Keyword, Name, String, Punctuation
14
+
15
+ __all__ = ['CplintLexer']
16
+
17
+
18
+ class CplintLexer(PrologLexer):
19
+ """
20
+ Lexer for cplint files, including CP-logic, Logic Programs with Annotated
21
+ Disjunctions, Distributional Clauses syntax, ProbLog, DTProbLog.
22
+ """
23
+ name = 'cplint'
24
+ url = 'https://cplint.eu'
25
+ aliases = ['cplint']
26
+ filenames = ['*.ecl', '*.prolog', '*.pro', '*.pl', '*.P', '*.lpad', '*.cpl']
27
+ mimetypes = ['text/x-cplint']
28
+ version_added = '2.12'
29
+
30
+ tokens = {
31
+ 'root': [
32
+ (r'map_query', Keyword),
33
+ (words(('gaussian', 'uniform_dens', 'dirichlet', 'gamma', 'beta',
34
+ 'poisson', 'binomial', 'geometric', 'exponential', 'pascal',
35
+ 'multinomial', 'user', 'val', 'uniform', 'discrete',
36
+ 'finite')), Name.Builtin),
37
+ # annotations of atoms
38
+ (r'([a-z]+)(:)', bygroups(String.Atom, Punctuation)),
39
+ (r':[-=]|::?|~=?|=>', Operator),
40
+ (r'\?', Name.Builtin),
41
+ inherit,
42
+ ],
43
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/crystal.py ADDED
@@ -0,0 +1,364 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.crystal
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Crystal.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import ExtendedRegexLexer, include, bygroups, default, \
14
+ words, line_re
15
+ from pygments.token import Comment, Operator, Keyword, Name, String, Number, \
16
+ Punctuation, Error, Whitespace
17
+
18
+ __all__ = ['CrystalLexer']
19
+
20
+
21
+ CRYSTAL_OPERATORS = [
22
+ '!=', '!~', '!', '%', '&&', '&', '**', '*', '+', '-', '/', '<=>', '<<', '<=', '<',
23
+ '===', '==', '=~', '=', '>=', '>>', '>', '[]=', '[]?', '[]', '^', '||', '|', '~'
24
+ ]
25
+
26
+
27
+ class CrystalLexer(ExtendedRegexLexer):
28
+ """
29
+ For Crystal source code.
30
+ """
31
+
32
+ name = 'Crystal'
33
+ url = 'https://crystal-lang.org'
34
+ aliases = ['cr', 'crystal']
35
+ filenames = ['*.cr']
36
+ mimetypes = ['text/x-crystal']
37
+ version_added = '2.2'
38
+
39
+ flags = re.DOTALL | re.MULTILINE
40
+
41
+ def heredoc_callback(self, match, ctx):
42
+ # okay, this is the hardest part of parsing Crystal...
43
+ # match: 1 = <<-?, 2 = quote? 3 = name 4 = quote? 5 = rest of line
44
+
45
+ start = match.start(1)
46
+ yield start, Operator, match.group(1) # <<-?
47
+ yield match.start(2), String.Heredoc, match.group(2) # quote ", ', `
48
+ yield match.start(3), String.Delimiter, match.group(3) # heredoc name
49
+ yield match.start(4), String.Heredoc, match.group(4) # quote again
50
+
51
+ heredocstack = ctx.__dict__.setdefault('heredocstack', [])
52
+ outermost = not bool(heredocstack)
53
+ heredocstack.append((match.group(1) == '<<-', match.group(3)))
54
+
55
+ ctx.pos = match.start(5)
56
+ ctx.end = match.end(5)
57
+ # this may find other heredocs, so limit the recursion depth
58
+ if len(heredocstack) < 100:
59
+ yield from self.get_tokens_unprocessed(context=ctx)
60
+ else:
61
+ yield ctx.pos, String.Heredoc, match.group(5)
62
+ ctx.pos = match.end()
63
+
64
+ if outermost:
65
+ # this is the outer heredoc again, now we can process them all
66
+ for tolerant, hdname in heredocstack:
67
+ lines = []
68
+ for match in line_re.finditer(ctx.text, ctx.pos):
69
+ if tolerant:
70
+ check = match.group().strip()
71
+ else:
72
+ check = match.group().rstrip()
73
+ if check == hdname:
74
+ for amatch in lines:
75
+ yield amatch.start(), String.Heredoc, amatch.group()
76
+ yield match.start(), String.Delimiter, match.group()
77
+ ctx.pos = match.end()
78
+ break
79
+ else:
80
+ lines.append(match)
81
+ else:
82
+ # end of heredoc not found -- error!
83
+ for amatch in lines:
84
+ yield amatch.start(), Error, amatch.group()
85
+ ctx.end = len(ctx.text)
86
+ del heredocstack[:]
87
+
88
+ def gen_crystalstrings_rules():
89
+ states = {}
90
+ states['strings'] = [
91
+ (r'\:\w+[!?]?', String.Symbol),
92
+ (words(CRYSTAL_OPERATORS, prefix=r'\:'), String.Symbol),
93
+ (r":'(\\\\|\\[^\\]|[^'\\])*'", String.Symbol),
94
+ # This allows arbitrary text after '\ for simplicity
95
+ (r"'(\\\\|\\'|[^']|\\[^'\\]+)'", String.Char),
96
+ (r':"', String.Symbol, 'simple-sym'),
97
+ # Crystal doesn't have "symbol:"s but this simplifies function args
98
+ (r'([a-zA-Z_]\w*)(:)(?!:)', bygroups(String.Symbol, Punctuation)),
99
+ (r'"', String.Double, 'simple-string'),
100
+ (r'(?<!\.)`', String.Backtick, 'simple-backtick'),
101
+ ]
102
+
103
+ # double-quoted string and symbol
104
+ for name, ttype, end in ('string', String.Double, '"'), \
105
+ ('sym', String.Symbol, '"'), \
106
+ ('backtick', String.Backtick, '`'):
107
+ states['simple-'+name] = [
108
+ include('string-escaped' if name == 'sym' else 'string-intp-escaped'),
109
+ (rf'[^\\{end}#]+', ttype),
110
+ (r'[\\#]', ttype),
111
+ (end, ttype, '#pop'),
112
+ ]
113
+
114
+ # https://crystal-lang.org/docs/syntax_and_semantics/literals/string.html#percent-string-literals
115
+ for lbrace, rbrace, bracecc, name in \
116
+ ('\\{', '\\}', '{}', 'cb'), \
117
+ ('\\[', '\\]', '\\[\\]', 'sb'), \
118
+ ('\\(', '\\)', '()', 'pa'), \
119
+ ('<', '>', '<>', 'ab'), \
120
+ ('\\|', '\\|', '\\|', 'pi'):
121
+ states[name+'-intp-string'] = [
122
+ (r'\\' + lbrace, String.Other),
123
+ ] + (lbrace != rbrace) * [
124
+ (lbrace, String.Other, '#push'),
125
+ ] + [
126
+ (rbrace, String.Other, '#pop'),
127
+ include('string-intp-escaped'),
128
+ (r'[\\#' + bracecc + ']', String.Other),
129
+ (r'[^\\#' + bracecc + ']+', String.Other),
130
+ ]
131
+ states['strings'].append((r'%Q?' + lbrace, String.Other,
132
+ name+'-intp-string'))
133
+ states[name+'-string'] = [
134
+ (r'\\[\\' + bracecc + ']', String.Other),
135
+ ] + (lbrace != rbrace) * [
136
+ (lbrace, String.Other, '#push'),
137
+ ] + [
138
+ (rbrace, String.Other, '#pop'),
139
+ (r'[\\#' + bracecc + ']', String.Other),
140
+ (r'[^\\#' + bracecc + ']+', String.Other),
141
+ ]
142
+ # https://crystal-lang.org/docs/syntax_and_semantics/literals/array.html#percent-array-literals
143
+ states['strings'].append((r'%[qwi]' + lbrace, String.Other,
144
+ name+'-string'))
145
+ states[name+'-regex'] = [
146
+ (r'\\[\\' + bracecc + ']', String.Regex),
147
+ ] + (lbrace != rbrace) * [
148
+ (lbrace, String.Regex, '#push'),
149
+ ] + [
150
+ (rbrace + '[imsx]*', String.Regex, '#pop'),
151
+ include('string-intp'),
152
+ (r'[\\#' + bracecc + ']', String.Regex),
153
+ (r'[^\\#' + bracecc + ']+', String.Regex),
154
+ ]
155
+ states['strings'].append((r'%r' + lbrace, String.Regex,
156
+ name+'-regex'))
157
+
158
+ return states
159
+
160
+ tokens = {
161
+ 'root': [
162
+ (r'#.*?$', Comment.Single),
163
+ # keywords
164
+ (words('''
165
+ abstract asm begin break case do else elsif end ensure extend if in
166
+ include next of private protected require rescue return select self super
167
+ then unless until when while with yield
168
+ '''.split(), suffix=r'\b'), Keyword),
169
+ (words('''
170
+ previous_def forall out uninitialized __DIR__ __FILE__ __LINE__
171
+ __END_LINE__
172
+ '''.split(), prefix=r'(?<!\.)', suffix=r'\b'), Keyword.Pseudo),
173
+ # https://crystal-lang.org/docs/syntax_and_semantics/is_a.html
174
+ (r'\.(is_a\?|nil\?|responds_to\?|as\?|as\b)', Keyword.Pseudo),
175
+ (words(['true', 'false', 'nil'], suffix=r'\b'), Keyword.Constant),
176
+ # start of function, class and module names
177
+ (r'(module|lib)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)',
178
+ bygroups(Keyword, Whitespace, Name.Namespace)),
179
+ (r'(def|fun|macro)(\s+)((?:[a-zA-Z_]\w*::)*)',
180
+ bygroups(Keyword, Whitespace, Name.Namespace), 'funcname'),
181
+ (r'def(?=[*%&^`~+-/\[<>=])', Keyword, 'funcname'),
182
+ (r'(annotation|class|struct|union|type|alias|enum)(\s+)((?:[a-zA-Z_]\w*::)*)',
183
+ bygroups(Keyword, Whitespace, Name.Namespace), 'classname'),
184
+ # https://crystal-lang.org/api/toplevel.html
185
+ (words('''
186
+ instance_sizeof offsetof pointerof sizeof typeof
187
+ '''.split(), prefix=r'(?<!\.)', suffix=r'\b'), Keyword.Pseudo),
188
+ # macros
189
+ (r'(?<!\.)(debugger\b|p!|pp!|record\b|spawn\b)', Name.Builtin.Pseudo),
190
+ # builtins
191
+ (words('''
192
+ abort at_exit caller exit gets loop main p pp print printf puts
193
+ raise rand read_line sleep spawn sprintf system
194
+ '''.split(), prefix=r'(?<!\.)', suffix=r'\b'), Name.Builtin),
195
+ # https://crystal-lang.org/api/Object.html#macro-summary
196
+ (r'(?<!\.)(((class_)?((getter|property)\b[!?]?|setter\b))|'
197
+ r'(def_(clone|equals|equals_and_hash|hash)|delegate|forward_missing_to)\b)',
198
+ Name.Builtin.Pseudo),
199
+ # normal heredocs
200
+ (r'(?<!\w)(<<-?)(["`\']?)([a-zA-Z_]\w*)(\2)(.*?\n)',
201
+ heredoc_callback),
202
+ # empty string heredocs
203
+ (r'(<<-?)("|\')()(\2)(.*?\n)', heredoc_callback),
204
+ (r'__END__', Comment.Preproc, 'end-part'),
205
+ # multiline regex (after keywords or assignments)
206
+ (r'(?:^|(?<=[=<>~!:])|'
207
+ r'(?<=(?:\s|;)when\s)|'
208
+ r'(?<=(?:\s|;)or\s)|'
209
+ r'(?<=(?:\s|;)and\s)|'
210
+ r'(?<=\.index\s)|'
211
+ r'(?<=\.scan\s)|'
212
+ r'(?<=\.sub\s)|'
213
+ r'(?<=\.sub!\s)|'
214
+ r'(?<=\.gsub\s)|'
215
+ r'(?<=\.gsub!\s)|'
216
+ r'(?<=\.match\s)|'
217
+ r'(?<=(?:\s|;)if\s)|'
218
+ r'(?<=(?:\s|;)elsif\s)|'
219
+ r'(?<=^when\s)|'
220
+ r'(?<=^index\s)|'
221
+ r'(?<=^scan\s)|'
222
+ r'(?<=^sub\s)|'
223
+ r'(?<=^gsub\s)|'
224
+ r'(?<=^sub!\s)|'
225
+ r'(?<=^gsub!\s)|'
226
+ r'(?<=^match\s)|'
227
+ r'(?<=^if\s)|'
228
+ r'(?<=^elsif\s)'
229
+ r')(\s*)(/)', bygroups(Whitespace, String.Regex), 'multiline-regex'),
230
+ # multiline regex (in method calls or subscripts)
231
+ (r'(?<=\(|,|\[)/', String.Regex, 'multiline-regex'),
232
+ # multiline regex (this time the funny no whitespace rule)
233
+ (r'(\s+)(/)(?![\s=])', bygroups(Whitespace, String.Regex),
234
+ 'multiline-regex'),
235
+ # lex numbers and ignore following regular expressions which
236
+ # are division operators in fact (grrrr. i hate that. any
237
+ # better ideas?)
238
+ # since pygments 0.7 we also eat a "?" operator after numbers
239
+ # so that the char operator does not work. Chars are not allowed
240
+ # there so that you can use the ternary operator.
241
+ # stupid example:
242
+ # x>=0?n[x]:""
243
+ (r'(0o[0-7]+(?:_[0-7]+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?',
244
+ bygroups(Number.Oct, Whitespace, Operator)),
245
+ (r'(0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?',
246
+ bygroups(Number.Hex, Whitespace, Operator)),
247
+ (r'(0b[01]+(?:_[01]+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?',
248
+ bygroups(Number.Bin, Whitespace, Operator)),
249
+ # 3 separate expressions for floats because any of the 3 optional
250
+ # parts makes it a float
251
+ (r'((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)(?:e[+-]?[0-9]+)?'
252
+ r'(?:_?f[0-9]+)?)(\s*)([/?])?',
253
+ bygroups(Number.Float, Whitespace, Operator)),
254
+ (r'((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)?(?:e[+-]?[0-9]+)'
255
+ r'(?:_?f[0-9]+)?)(\s*)([/?])?',
256
+ bygroups(Number.Float, Whitespace, Operator)),
257
+ (r'((?:0(?![0-9])|[1-9][\d_]*)(?:\.\d[\d_]*)?(?:e[+-]?[0-9]+)?'
258
+ r'(?:_?f[0-9]+))(\s*)([/?])?',
259
+ bygroups(Number.Float, Whitespace, Operator)),
260
+ (r'(0\b|[1-9][\d]*(?:_\d+)*(?:_?[iu][0-9]+)?)\b(\s*)([/?])?',
261
+ bygroups(Number.Integer, Whitespace, Operator)),
262
+ # Names
263
+ (r'@@[a-zA-Z_]\w*', Name.Variable.Class),
264
+ (r'@[a-zA-Z_]\w*', Name.Variable.Instance),
265
+ (r'\$\w+', Name.Variable.Global),
266
+ (r'\$[!@&`\'+~=/\\,;.<>_*$?:"^-]', Name.Variable.Global),
267
+ (r'\$-[0adFiIlpvw]', Name.Variable.Global),
268
+ (r'::', Operator),
269
+ include('strings'),
270
+ # https://crystal-lang.org/reference/syntax_and_semantics/literals/char.html
271
+ (r'\?(\\[MC]-)*' # modifiers
272
+ r'(\\([\\abefnrtv#"\']|[0-7]{1,3}|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|u\{[a-fA-F0-9 ]+\})|\S)'
273
+ r'(?!\w)',
274
+ String.Char),
275
+ (r'[A-Z][A-Z_]+\b(?!::|\.)', Name.Constant),
276
+ # macro expansion
277
+ (r'\{%', String.Interpol, 'in-macro-control'),
278
+ (r'\{\{', String.Interpol, 'in-macro-expr'),
279
+ # annotations
280
+ (r'(@\[)(\s*)([A-Z]\w*(::[A-Z]\w*)*)',
281
+ bygroups(Operator, Whitespace, Name.Decorator), 'in-annot'),
282
+ # this is needed because Crystal attributes can look
283
+ # like keywords (class) or like this: ` ?!?
284
+ (words(CRYSTAL_OPERATORS, prefix=r'(\.|::)'),
285
+ bygroups(Operator, Name.Operator)),
286
+ (r'(\.|::)([a-zA-Z_]\w*[!?]?|[*%&^`~+\-/\[<>=])',
287
+ bygroups(Operator, Name)),
288
+ # Names can end with [!?] unless it's "!="
289
+ (r'[a-zA-Z_]\w*(?:[!?](?!=))?', Name),
290
+ (r'(\[|\]\??|\*\*|<=>?|>=|<<?|>>?|=~|===|'
291
+ r'!~|&&?|\|\||\.{1,3})', Operator),
292
+ (r'[-+/*%=<>&!^|~]=?', Operator),
293
+ (r'[(){};,/?:\\]', Punctuation),
294
+ (r'\s+', Whitespace)
295
+ ],
296
+ 'funcname': [
297
+ (r'(?:([a-zA-Z_]\w*)(\.))?'
298
+ r'([a-zA-Z_]\w*[!?]?|\*\*?|[-+]@?|'
299
+ r'[/%&|^`~]|\[\]=?|<<|>>|<=?>|>=?|===?)',
300
+ bygroups(Name.Class, Operator, Name.Function), '#pop'),
301
+ default('#pop')
302
+ ],
303
+ 'classname': [
304
+ (r'[A-Z_]\w*', Name.Class),
305
+ (r'(\()(\s*)([A-Z_]\w*)(\s*)(\))',
306
+ bygroups(Punctuation, Whitespace, Name.Class, Whitespace, Punctuation)),
307
+ default('#pop')
308
+ ],
309
+ 'in-intp': [
310
+ (r'\{', String.Interpol, '#push'),
311
+ (r'\}', String.Interpol, '#pop'),
312
+ include('root'),
313
+ ],
314
+ 'string-intp': [
315
+ (r'#\{', String.Interpol, 'in-intp'),
316
+ ],
317
+ 'string-escaped': [
318
+ # https://crystal-lang.org/reference/syntax_and_semantics/literals/string.html
319
+ (r'\\([\\abefnrtv#"\']|[0-7]{1,3}|x[a-fA-F0-9]{2}|u[a-fA-F0-9]{4}|u\{[a-fA-F0-9 ]+\})',
320
+ String.Escape)
321
+ ],
322
+ 'string-intp-escaped': [
323
+ include('string-intp'),
324
+ include('string-escaped'),
325
+ ],
326
+ 'interpolated-regex': [
327
+ include('string-intp'),
328
+ (r'[\\#]', String.Regex),
329
+ (r'[^\\#]+', String.Regex),
330
+ ],
331
+ 'interpolated-string': [
332
+ include('string-intp'),
333
+ (r'[\\#]', String.Other),
334
+ (r'[^\\#]+', String.Other),
335
+ ],
336
+ 'multiline-regex': [
337
+ include('string-intp'),
338
+ (r'\\\\', String.Regex),
339
+ (r'\\/', String.Regex),
340
+ (r'[\\#]', String.Regex),
341
+ (r'[^\\/#]+', String.Regex),
342
+ (r'/[imsx]*', String.Regex, '#pop'),
343
+ ],
344
+ 'end-part': [
345
+ (r'.+', Comment.Preproc, '#pop')
346
+ ],
347
+ 'in-macro-control': [
348
+ (r'\{%', String.Interpol, '#push'),
349
+ (r'%\}', String.Interpol, '#pop'),
350
+ (r'(for|verbatim)\b', Keyword),
351
+ include('root'),
352
+ ],
353
+ 'in-macro-expr': [
354
+ (r'\{\{', String.Interpol, '#push'),
355
+ (r'\}\}', String.Interpol, '#pop'),
356
+ include('root'),
357
+ ],
358
+ 'in-annot': [
359
+ (r'\[', Operator, '#push'),
360
+ (r'\]', Operator, '#pop'),
361
+ include('root'),
362
+ ],
363
+ }
364
+ tokens.update(gen_crystalstrings_rules())
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/csound.py ADDED
@@ -0,0 +1,466 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.csound
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Csound languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, bygroups, default, include, using, words
14
+ from pygments.token import Comment, Error, Keyword, Name, Number, Operator, Punctuation, \
15
+ String, Text, Whitespace
16
+ from pygments.lexers._csound_builtins import OPCODES, DEPRECATED_OPCODES, REMOVED_OPCODES
17
+ from pygments.lexers.html import HtmlLexer
18
+ from pygments.lexers.python import PythonLexer
19
+ from pygments.lexers.scripting import LuaLexer
20
+
21
+ __all__ = ['CsoundScoreLexer', 'CsoundOrchestraLexer', 'CsoundDocumentLexer']
22
+
23
+ newline = (r'((?:(?:;|//).*)*)(\n)', bygroups(Comment.Single, Text))
24
+
25
+
26
+ class CsoundLexer(RegexLexer):
27
+ url = 'https://csound.com/'
28
+
29
+ tokens = {
30
+ 'whitespace': [
31
+ (r'[ \t]+', Whitespace),
32
+ (r'/[*][\s\S]*?[*]/', Comment.Multiline),
33
+ (r'(?:;|//).*$', Comment.Single),
34
+ (r'(\\)(\n)', bygroups(Text, Whitespace))
35
+ ],
36
+
37
+ 'preprocessor directives': [
38
+ (r'#(?:e(?:nd(?:if)?|lse)\b|##)|@@?[ \t]*\d+', Comment.Preproc),
39
+ (r'#includestr', Comment.Preproc, 'includestr directive'),
40
+ (r'#include', Comment.Preproc, 'include directive'),
41
+ (r'#[ \t]*define', Comment.Preproc, 'define directive'),
42
+ (r'#(?:ifn?def|undef)\b', Comment.Preproc, 'macro directive')
43
+ ],
44
+
45
+ 'include directive': [
46
+ include('whitespace'),
47
+ (r'([^ \t]).*?\1', String, '#pop')
48
+ ],
49
+ 'includestr directive': [
50
+ include('whitespace'),
51
+ (r'"', String, ('#pop', 'quoted string'))
52
+ ],
53
+
54
+ 'define directive': [
55
+ (r'\n', Whitespace),
56
+ include('whitespace'),
57
+ (r'([A-Z_a-z]\w*)(\()', bygroups(Comment.Preproc, Punctuation),
58
+ ('#pop', 'macro parameter name list')),
59
+ (r'[A-Z_a-z]\w*', Comment.Preproc, ('#pop', 'before macro body'))
60
+ ],
61
+ 'macro parameter name list': [
62
+ include('whitespace'),
63
+ (r'[A-Z_a-z]\w*', Comment.Preproc),
64
+ (r"['#]", Punctuation),
65
+ (r'\)', Punctuation, ('#pop', 'before macro body'))
66
+ ],
67
+ 'before macro body': [
68
+ (r'\n', Whitespace),
69
+ include('whitespace'),
70
+ (r'#', Punctuation, ('#pop', 'macro body'))
71
+ ],
72
+ 'macro body': [
73
+ (r'(?:\\(?!#)|[^#\\]|\n)+', Comment.Preproc),
74
+ (r'\\#', Comment.Preproc),
75
+ (r'(?<!\\)#', Punctuation, '#pop')
76
+ ],
77
+
78
+ 'macro directive': [
79
+ include('whitespace'),
80
+ (r'[A-Z_a-z]\w*', Comment.Preproc, '#pop')
81
+ ],
82
+
83
+ 'macro uses': [
84
+ (r'(\$[A-Z_a-z]\w*\.?)(\()', bygroups(Comment.Preproc, Punctuation),
85
+ 'macro parameter value list'),
86
+ (r'\$[A-Z_a-z]\w*(?:\.|\b)', Comment.Preproc)
87
+ ],
88
+ 'macro parameter value list': [
89
+ (r'(?:[^\'#"{()]|\{(?!\{))+', Comment.Preproc),
90
+ (r"['#]", Punctuation),
91
+ (r'"', String, 'macro parameter value quoted string'),
92
+ (r'\{\{', String, 'macro parameter value braced string'),
93
+ (r'\(', Comment.Preproc, 'macro parameter value parenthetical'),
94
+ (r'\)', Punctuation, '#pop')
95
+ ],
96
+ 'macro parameter value quoted string': [
97
+ (r"\\[#'()]", Comment.Preproc),
98
+ (r"[#'()]", Error),
99
+ include('quoted string')
100
+ ],
101
+ 'macro parameter value braced string': [
102
+ (r"\\[#'()]", Comment.Preproc),
103
+ (r"[#'()]", Error),
104
+ include('braced string')
105
+ ],
106
+ 'macro parameter value parenthetical': [
107
+ (r'(?:[^\\()]|\\\))+', Comment.Preproc),
108
+ (r'\(', Comment.Preproc, '#push'),
109
+ (r'\)', Comment.Preproc, '#pop')
110
+ ],
111
+
112
+ 'whitespace and macro uses': [
113
+ include('whitespace'),
114
+ include('macro uses')
115
+ ],
116
+
117
+ 'numbers': [
118
+ (r'\d+[Ee][+-]?\d+|(\d+\.\d*|\d*\.\d+)([Ee][+-]?\d+)?', Number.Float),
119
+ (r'(0[Xx])([0-9A-Fa-f]+)', bygroups(Keyword.Type, Number.Hex)),
120
+ (r'\d+', Number.Integer)
121
+ ],
122
+
123
+ 'quoted string': [
124
+ (r'"', String, '#pop'),
125
+ (r'[^"$]+', String),
126
+ include('macro uses'),
127
+ (r'[$]', String)
128
+ ],
129
+
130
+ 'braced string': [
131
+ # Do nothing. This must be defined in subclasses.
132
+ ]
133
+ }
134
+
135
+
136
+ class CsoundScoreLexer(CsoundLexer):
137
+ """
138
+ For `Csound <https://csound.com>`_ scores.
139
+ """
140
+
141
+ name = 'Csound Score'
142
+ aliases = ['csound-score', 'csound-sco']
143
+ filenames = ['*.sco']
144
+ version_added = '2.1'
145
+
146
+ tokens = {
147
+ 'root': [
148
+ (r'\n', Whitespace),
149
+ include('whitespace and macro uses'),
150
+ include('preprocessor directives'),
151
+
152
+ (r'[aBbCdefiqstvxy]', Keyword),
153
+ # There is also a w statement that is generated internally and should not be
154
+ # used; see https://github.com/csound/csound/issues/750.
155
+
156
+ (r'z', Keyword.Constant),
157
+ # z is a constant equal to 800,000,000,000. 800 billion seconds is about
158
+ # 25,367.8 years. See also
159
+ # https://csound.com/docs/manual/ScoreTop.html and
160
+ # https://github.com/csound/csound/search?q=stof+path%3AEngine+filename%3Asread.c.
161
+
162
+ (r'([nNpP][pP])(\d+)', bygroups(Keyword, Number.Integer)),
163
+
164
+ (r'[mn]', Keyword, 'mark statement'),
165
+
166
+ include('numbers'),
167
+ (r'[!+\-*/^%&|<>#~.]', Operator),
168
+ (r'[()\[\]]', Punctuation),
169
+ (r'"', String, 'quoted string'),
170
+ (r'\{', Comment.Preproc, 'loop after left brace'),
171
+ ],
172
+
173
+ 'mark statement': [
174
+ include('whitespace and macro uses'),
175
+ (r'[A-Z_a-z]\w*', Name.Label),
176
+ (r'\n', Whitespace, '#pop')
177
+ ],
178
+
179
+ 'loop after left brace': [
180
+ include('whitespace and macro uses'),
181
+ (r'\d+', Number.Integer, ('#pop', 'loop after repeat count')),
182
+ ],
183
+ 'loop after repeat count': [
184
+ include('whitespace and macro uses'),
185
+ (r'[A-Z_a-z]\w*', Comment.Preproc, ('#pop', 'loop'))
186
+ ],
187
+ 'loop': [
188
+ (r'\}', Comment.Preproc, '#pop'),
189
+ include('root')
190
+ ],
191
+
192
+ # Braced strings are not allowed in Csound scores, but this is needed because the
193
+ # superclass includes it.
194
+ 'braced string': [
195
+ (r'\}\}', String, '#pop'),
196
+ (r'[^}]|\}(?!\})', String)
197
+ ]
198
+ }
199
+
200
+
201
+ class CsoundOrchestraLexer(CsoundLexer):
202
+ """
203
+ For `Csound <https://csound.com>`_ orchestras.
204
+ """
205
+
206
+ name = 'Csound Orchestra'
207
+ aliases = ['csound', 'csound-orc']
208
+ filenames = ['*.orc', '*.udo']
209
+ version_added = '2.1'
210
+
211
+ user_defined_opcodes = set()
212
+
213
+ def opcode_name_callback(lexer, match):
214
+ opcode = match.group(0)
215
+ lexer.user_defined_opcodes.add(opcode)
216
+ yield match.start(), Name.Function, opcode
217
+
218
+ def name_callback(lexer, match):
219
+ type_annotation_token = Keyword.Type
220
+
221
+ name = match.group(1)
222
+ if name in OPCODES or name in DEPRECATED_OPCODES or name in REMOVED_OPCODES:
223
+ yield match.start(), Name.Builtin, name
224
+ elif name in lexer.user_defined_opcodes:
225
+ yield match.start(), Name.Function, name
226
+ else:
227
+ type_annotation_token = Name
228
+ name_match = re.search(r'^(g?[afikSw])(\w+)', name)
229
+ if name_match:
230
+ yield name_match.start(1), Keyword.Type, name_match.group(1)
231
+ yield name_match.start(2), Name, name_match.group(2)
232
+ else:
233
+ yield match.start(), Name, name
234
+
235
+ if match.group(2):
236
+ yield match.start(2), Punctuation, match.group(2)
237
+ yield match.start(3), type_annotation_token, match.group(3)
238
+
239
+ tokens = {
240
+ 'root': [
241
+ (r'\n', Whitespace),
242
+
243
+ (r'^([ \t]*)(\w+)(:)([ \t]+|$)', bygroups(Whitespace, Name.Label, Punctuation, Whitespace)),
244
+
245
+ include('whitespace and macro uses'),
246
+ include('preprocessor directives'),
247
+
248
+ (r'\binstr\b', Keyword.Declaration, 'instrument numbers and identifiers'),
249
+ (r'\bopcode\b', Keyword.Declaration, 'after opcode keyword'),
250
+ (r'\b(?:end(?:in|op))\b', Keyword.Declaration),
251
+
252
+ include('partial statements')
253
+ ],
254
+
255
+ 'partial statements': [
256
+ (r'\b(?:0dbfs|A4|k(?:r|smps)|nchnls(?:_i)?|sr)\b', Name.Variable.Global),
257
+
258
+ include('numbers'),
259
+
260
+ (r'\+=|-=|\*=|/=|<<|>>|<=|>=|==|!=|&&|\|\||[~¬]|[=!+\-*/^%&|<>#?:]', Operator),
261
+ (r'[(),\[\]]', Punctuation),
262
+
263
+ (r'"', String, 'quoted string'),
264
+ (r'\{\{', String, 'braced string'),
265
+
266
+ (words((
267
+ 'do', 'else', 'elseif', 'endif', 'enduntil', 'fi', 'if', 'ithen', 'kthen',
268
+ 'od', 'then', 'until', 'while',
269
+ ), prefix=r'\b', suffix=r'\b'), Keyword),
270
+ (words(('return', 'rireturn'), prefix=r'\b', suffix=r'\b'), Keyword.Pseudo),
271
+
272
+ (r'\b[ik]?goto\b', Keyword, 'goto label'),
273
+ (r'\b(r(?:einit|igoto)|tigoto)(\(|\b)', bygroups(Keyword.Pseudo, Punctuation),
274
+ 'goto label'),
275
+ (r'\b(c(?:g|in?|k|nk?)goto)(\(|\b)', bygroups(Keyword.Pseudo, Punctuation),
276
+ ('goto label', 'goto argument')),
277
+ (r'\b(timout)(\(|\b)', bygroups(Keyword.Pseudo, Punctuation),
278
+ ('goto label', 'goto argument', 'goto argument')),
279
+ (r'\b(loop_[gl][et])(\(|\b)', bygroups(Keyword.Pseudo, Punctuation),
280
+ ('goto label', 'goto argument', 'goto argument', 'goto argument')),
281
+
282
+ (r'\bprintk?s\b', Name.Builtin, 'prints opcode'),
283
+ (r'\b(?:readscore|scoreline(?:_i)?)\b', Name.Builtin, 'Csound score opcode'),
284
+ (r'\bpyl?run[it]?\b', Name.Builtin, 'Python opcode'),
285
+ (r'\blua_(?:exec|opdef)\b', Name.Builtin, 'Lua opcode'),
286
+ (r'\bp\d+\b', Name.Variable.Instance),
287
+ (r'\b([A-Z_a-z]\w*)(?:(:)([A-Za-z]))?\b', name_callback)
288
+ ],
289
+
290
+ 'instrument numbers and identifiers': [
291
+ include('whitespace and macro uses'),
292
+ (r'\d+|[A-Z_a-z]\w*', Name.Function),
293
+ (r'[+,]', Punctuation),
294
+ (r'\n', Whitespace, '#pop')
295
+ ],
296
+
297
+ 'after opcode keyword': [
298
+ include('whitespace and macro uses'),
299
+ (r'[A-Z_a-z]\w*', opcode_name_callback, ('#pop', 'opcode type signatures')),
300
+ (r'\n', Whitespace, '#pop')
301
+ ],
302
+ 'opcode type signatures': [
303
+ include('whitespace and macro uses'),
304
+
305
+ # https://github.com/csound/csound/search?q=XIDENT+path%3AEngine+filename%3Acsound_orc.lex
306
+ (r'0|[afijJkKoOpPStV\[\]]+', Keyword.Type),
307
+
308
+ (r',', Punctuation),
309
+ (r'\n', Whitespace, '#pop')
310
+ ],
311
+
312
+ 'quoted string': [
313
+ (r'"', String, '#pop'),
314
+ (r'[^\\"$%)]+', String),
315
+ include('macro uses'),
316
+ include('escape sequences'),
317
+ include('format specifiers'),
318
+ (r'[\\$%)]', String)
319
+ ],
320
+ 'braced string': [
321
+ (r'\}\}', String, '#pop'),
322
+ (r'(?:[^\\%)}]|\}(?!\}))+', String),
323
+ include('escape sequences'),
324
+ include('format specifiers'),
325
+ (r'[\\%)]', String)
326
+ ],
327
+ 'escape sequences': [
328
+ # https://github.com/csound/csound/search?q=unquote_string+path%3AEngine+filename%3Acsound_orc_compile.c
329
+ (r'\\(?:[\\abnrt"]|[0-7]{1,3})', String.Escape)
330
+ ],
331
+ # Format specifiers are highlighted in all strings, even though only
332
+ # fprintks https://csound.com/docs/manual/fprintks.html
333
+ # fprints https://csound.com/docs/manual/fprints.html
334
+ # printf/printf_i https://csound.com/docs/manual/printf.html
335
+ # printks https://csound.com/docs/manual/printks.html
336
+ # prints https://csound.com/docs/manual/prints.html
337
+ # sprintf https://csound.com/docs/manual/sprintf.html
338
+ # sprintfk https://csound.com/docs/manual/sprintfk.html
339
+ # work with strings that contain format specifiers. In addition, these opcodes’
340
+ # handling of format specifiers is inconsistent:
341
+ # - fprintks and fprints accept %a and %A specifiers, and accept %s specifiers
342
+ # starting in Csound 6.15.0.
343
+ # - printks and prints accept %a and %A specifiers, but don’t accept %s
344
+ # specifiers.
345
+ # - printf, printf_i, sprintf, and sprintfk don’t accept %a and %A specifiers,
346
+ # but accept %s specifiers.
347
+ # See https://github.com/csound/csound/issues/747 for more information.
348
+ 'format specifiers': [
349
+ (r'%[#0\- +]*\d*(?:\.\d+)?[AE-GXac-giosux]', String.Interpol),
350
+ (r'%%', String.Escape)
351
+ ],
352
+
353
+ 'goto argument': [
354
+ include('whitespace and macro uses'),
355
+ (r',', Punctuation, '#pop'),
356
+ include('partial statements')
357
+ ],
358
+ 'goto label': [
359
+ include('whitespace and macro uses'),
360
+ (r'\w+', Name.Label, '#pop'),
361
+ default('#pop')
362
+ ],
363
+
364
+ 'prints opcode': [
365
+ include('whitespace and macro uses'),
366
+ (r'"', String, 'prints quoted string'),
367
+ default('#pop')
368
+ ],
369
+ 'prints quoted string': [
370
+ (r'\\\\[aAbBnNrRtT]', String.Escape),
371
+ (r'%[!nNrRtT]|[~^]{1,2}', String.Escape),
372
+ include('quoted string')
373
+ ],
374
+
375
+ 'Csound score opcode': [
376
+ include('whitespace and macro uses'),
377
+ (r'"', String, 'quoted string'),
378
+ (r'\{\{', String, 'Csound score'),
379
+ (r'\n', Whitespace, '#pop')
380
+ ],
381
+ 'Csound score': [
382
+ (r'\}\}', String, '#pop'),
383
+ (r'([^}]+)|\}(?!\})', using(CsoundScoreLexer))
384
+ ],
385
+
386
+ 'Python opcode': [
387
+ include('whitespace and macro uses'),
388
+ (r'"', String, 'quoted string'),
389
+ (r'\{\{', String, 'Python'),
390
+ (r'\n', Whitespace, '#pop')
391
+ ],
392
+ 'Python': [
393
+ (r'\}\}', String, '#pop'),
394
+ (r'([^}]+)|\}(?!\})', using(PythonLexer))
395
+ ],
396
+
397
+ 'Lua opcode': [
398
+ include('whitespace and macro uses'),
399
+ (r'"', String, 'quoted string'),
400
+ (r'\{\{', String, 'Lua'),
401
+ (r'\n', Whitespace, '#pop')
402
+ ],
403
+ 'Lua': [
404
+ (r'\}\}', String, '#pop'),
405
+ (r'([^}]+)|\}(?!\})', using(LuaLexer))
406
+ ]
407
+ }
408
+
409
+
410
+ class CsoundDocumentLexer(RegexLexer):
411
+ """
412
+ For Csound documents.
413
+ """
414
+
415
+ name = 'Csound Document'
416
+ aliases = ['csound-document', 'csound-csd']
417
+ filenames = ['*.csd']
418
+ url = 'https://csound.com'
419
+ version_added = '2.1'
420
+
421
+ # These tokens are based on those in XmlLexer in pygments/lexers/html.py. Making
422
+ # CsoundDocumentLexer a subclass of XmlLexer rather than RegexLexer may seem like a
423
+ # better idea, since Csound Document files look like XML files. However, Csound
424
+ # Documents can contain Csound comments (preceded by //, for example) before and
425
+ # after the root element, unescaped bitwise AND & and less than < operators, etc. In
426
+ # other words, while Csound Document files look like XML files, they may not actually
427
+ # be XML files.
428
+ tokens = {
429
+ 'root': [
430
+ (r'/[*][\s\S]*?[*]/', Comment.Multiline),
431
+ (r'(?:;|//).*$', Comment.Single),
432
+ (r'[^/;<]+|/(?!/)', Text),
433
+
434
+ (r'<\s*CsInstruments', Name.Tag, ('orchestra', 'tag')),
435
+ (r'<\s*CsScore', Name.Tag, ('score', 'tag')),
436
+ (r'<\s*[Hh][Tt][Mm][Ll]', Name.Tag, ('HTML', 'tag')),
437
+
438
+ (r'<\s*[\w:.-]+', Name.Tag, 'tag'),
439
+ (r'<\s*/\s*[\w:.-]+\s*>', Name.Tag)
440
+ ],
441
+
442
+ 'orchestra': [
443
+ (r'<\s*/\s*CsInstruments\s*>', Name.Tag, '#pop'),
444
+ (r'([\s\S])+?(?=<\s*/\s*CsInstruments\s*>)', using(CsoundOrchestraLexer))
445
+ ],
446
+ 'score': [
447
+ (r'<\s*/\s*CsScore\s*>', Name.Tag, '#pop'),
448
+ (r'([\s\S])+?(?=<\s*/\s*CsScore\s*>)', using(CsoundScoreLexer))
449
+ ],
450
+ 'HTML': [
451
+ (r'<\s*/\s*[Hh][Tt][Mm][Ll]\s*>', Name.Tag, '#pop'),
452
+ (r'([\s\S])+?(?=<\s*/\s*[Hh][Tt][Mm][Ll]\s*>)', using(HtmlLexer))
453
+ ],
454
+
455
+ 'tag': [
456
+ (r'\s+', Whitespace),
457
+ (r'[\w.:-]+\s*=', Name.Attribute, 'attr'),
458
+ (r'/?\s*>', Name.Tag, '#pop')
459
+ ],
460
+ 'attr': [
461
+ (r'\s+', Whitespace),
462
+ (r'".*?"', String, '#pop'),
463
+ (r"'.*?'", String, '#pop'),
464
+ (r'[^\s>]+', String, '#pop')
465
+ ]
466
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/css.py ADDED
@@ -0,0 +1,633 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.css
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for CSS and related stylesheet formats.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+ import copy
13
+
14
+ from pygments.lexer import ExtendedRegexLexer, RegexLexer, include, bygroups, \
15
+ default, words, inherit
16
+ from pygments.token import Comment, Operator, Keyword, Name, String, Number, \
17
+ Punctuation, Whitespace
18
+ from pygments.lexers._css_builtins import _css_properties
19
+
20
+ __all__ = ['CssLexer', 'SassLexer', 'ScssLexer', 'LessCssLexer']
21
+
22
+
23
+ # List of vendor prefixes obtained from:
24
+ # https://www.w3.org/TR/CSS21/syndata.html#vendor-keyword-history
25
+ _vendor_prefixes = (
26
+ '-ms-', 'mso-', '-moz-', '-o-', '-xv-', '-atsc-', '-wap-', '-khtml-',
27
+ '-webkit-', 'prince-', '-ah-', '-hp-', '-ro-', '-rim-', '-tc-',
28
+ )
29
+
30
+ # List of extended color keywords obtained from:
31
+ # https://drafts.csswg.org/css-color/#named-colors
32
+ _color_keywords = (
33
+ 'aliceblue', 'antiquewhite', 'aqua', 'aquamarine', 'azure', 'beige',
34
+ 'bisque', 'black', 'blanchedalmond', 'blue', 'blueviolet', 'brown',
35
+ 'burlywood', 'cadetblue', 'chartreuse', 'chocolate', 'coral',
36
+ 'cornflowerblue', 'cornsilk', 'crimson', 'cyan', 'darkblue', 'darkcyan',
37
+ 'darkgoldenrod', 'darkgray', 'darkgreen', 'darkgrey', 'darkkhaki',
38
+ 'darkmagenta', 'darkolivegreen', 'darkorange', 'darkorchid', 'darkred',
39
+ 'darksalmon', 'darkseagreen', 'darkslateblue', 'darkslategray',
40
+ 'darkslategrey', 'darkturquoise', 'darkviolet', 'deeppink', 'deepskyblue',
41
+ 'dimgray', 'dimgrey', 'dodgerblue', 'firebrick', 'floralwhite',
42
+ 'forestgreen', 'fuchsia', 'gainsboro', 'ghostwhite', 'gold', 'goldenrod',
43
+ 'gray', 'green', 'greenyellow', 'grey', 'honeydew', 'hotpink', 'indianred',
44
+ 'indigo', 'ivory', 'khaki', 'lavender', 'lavenderblush', 'lawngreen',
45
+ 'lemonchiffon', 'lightblue', 'lightcoral', 'lightcyan',
46
+ 'lightgoldenrodyellow', 'lightgray', 'lightgreen', 'lightgrey',
47
+ 'lightpink', 'lightsalmon', 'lightseagreen', 'lightskyblue',
48
+ 'lightslategray', 'lightslategrey', 'lightsteelblue', 'lightyellow',
49
+ 'lime', 'limegreen', 'linen', 'magenta', 'maroon', 'mediumaquamarine',
50
+ 'mediumblue', 'mediumorchid', 'mediumpurple', 'mediumseagreen',
51
+ 'mediumslateblue', 'mediumspringgreen', 'mediumturquoise',
52
+ 'mediumvioletred', 'midnightblue', 'mintcream', 'mistyrose', 'moccasin',
53
+ 'navajowhite', 'navy', 'oldlace', 'olive', 'olivedrab', 'orange',
54
+ 'orangered', 'orchid', 'palegoldenrod', 'palegreen', 'paleturquoise',
55
+ 'palevioletred', 'papayawhip', 'peachpuff', 'peru', 'pink', 'plum',
56
+ 'powderblue', 'purple', 'rebeccapurple', 'red', 'rosybrown', 'royalblue',
57
+ 'saddlebrown', 'salmon', 'sandybrown', 'seagreen', 'seashell', 'sienna',
58
+ 'silver', 'skyblue', 'slateblue', 'slategray', 'slategrey', 'snow',
59
+ 'springgreen', 'steelblue', 'tan', 'teal', 'thistle', 'tomato', 'turquoise',
60
+ 'violet', 'wheat', 'white', 'whitesmoke', 'yellow', 'yellowgreen',
61
+ ) + ('transparent',)
62
+
63
+ # List of keyword values obtained from:
64
+ # http://cssvalues.com/
65
+ _keyword_values = (
66
+ 'absolute', 'alias', 'all', 'all-petite-caps', 'all-scroll',
67
+ 'all-small-caps', 'allow-end', 'alpha', 'alternate', 'alternate-reverse',
68
+ 'always', 'armenian', 'auto', 'avoid', 'avoid-column', 'avoid-page',
69
+ 'backwards', 'balance', 'baseline', 'below', 'blink', 'block', 'bold',
70
+ 'bolder', 'border-box', 'both', 'bottom', 'box-decoration', 'break-word',
71
+ 'capitalize', 'cell', 'center', 'circle', 'clip', 'clone', 'close-quote',
72
+ 'col-resize', 'collapse', 'color', 'color-burn', 'color-dodge', 'column',
73
+ 'column-reverse', 'compact', 'condensed', 'contain', 'container',
74
+ 'content-box', 'context-menu', 'copy', 'cover', 'crisp-edges', 'crosshair',
75
+ 'currentColor', 'cursive', 'darken', 'dashed', 'decimal',
76
+ 'decimal-leading-zero', 'default', 'descendants', 'difference', 'digits',
77
+ 'disc', 'distribute', 'dot', 'dotted', 'double', 'double-circle', 'e-resize',
78
+ 'each-line', 'ease', 'ease-in', 'ease-in-out', 'ease-out', 'edges',
79
+ 'ellipsis', 'end', 'ew-resize', 'exclusion', 'expanded', 'extra-condensed',
80
+ 'extra-expanded', 'fantasy', 'fill', 'fill-box', 'filled', 'first', 'fixed',
81
+ 'flat', 'flex', 'flex-end', 'flex-start', 'flip', 'force-end', 'forwards',
82
+ 'from-image', 'full-width', 'geometricPrecision', 'georgian', 'groove',
83
+ 'hanging', 'hard-light', 'help', 'hidden', 'hide', 'horizontal', 'hue',
84
+ 'icon', 'infinite', 'inherit', 'initial', 'ink', 'inline', 'inline-block',
85
+ 'inline-flex', 'inline-table', 'inset', 'inside', 'inter-word', 'invert',
86
+ 'isolate', 'italic', 'justify', 'large', 'larger', 'last', 'left',
87
+ 'lighten', 'lighter', 'line-through', 'linear', 'list-item', 'local',
88
+ 'loose', 'lower-alpha', 'lower-greek', 'lower-latin', 'lower-roman',
89
+ 'lowercase', 'ltr', 'luminance', 'luminosity', 'mandatory', 'manipulation',
90
+ 'manual', 'margin-box', 'match-parent', 'medium', 'mixed', 'monospace',
91
+ 'move', 'multiply', 'n-resize', 'ne-resize', 'nesw-resize',
92
+ 'no-close-quote', 'no-drop', 'no-open-quote', 'no-repeat', 'none', 'normal',
93
+ 'not-allowed', 'nowrap', 'ns-resize', 'nw-resize', 'nwse-resize', 'objects',
94
+ 'oblique', 'off', 'on', 'open', 'open-quote', 'optimizeLegibility',
95
+ 'optimizeSpeed', 'outset', 'outside', 'over', 'overlay', 'overline',
96
+ 'padding-box', 'page', 'pan-down', 'pan-left', 'pan-right', 'pan-up',
97
+ 'pan-x', 'pan-y', 'paused', 'petite-caps', 'pixelated', 'pointer',
98
+ 'preserve-3d', 'progress', 'proximity', 'relative', 'repeat',
99
+ 'repeat no-repeat', 'repeat-x', 'repeat-y', 'reverse', 'revert', 'ridge', 'right',
100
+ 'round', 'row', 'row-resize', 'row-reverse', 'rtl', 'ruby', 'ruby-base',
101
+ 'ruby-base-container', 'ruby-text', 'ruby-text-container', 'run-in',
102
+ 'running', 's-resize', 'sans-serif', 'saturation', 'scale-down', 'screen',
103
+ 'scroll', 'se-resize', 'semi-condensed', 'semi-expanded', 'separate',
104
+ 'serif', 'sesame', 'show', 'sideways', 'sideways-left', 'sideways-right',
105
+ 'slice', 'small', 'small-caps', 'smaller', 'smooth', 'snap', 'soft-light',
106
+ 'solid', 'space', 'space-around', 'space-between', 'spaces', 'square',
107
+ 'start', 'static', 'step-end', 'step-start', 'sticky', 'stretch', 'strict',
108
+ 'stroke-box', 'style', 'sw-resize', 'table', 'table-caption', 'table-cell',
109
+ 'table-column', 'table-column-group', 'table-footer-group',
110
+ 'table-header-group', 'table-row', 'table-row-group', 'text', 'thick',
111
+ 'thin', 'titling-caps', 'to', 'top', 'triangle', 'ultra-condensed',
112
+ 'ultra-expanded', 'under', 'underline', 'unicase', 'unset', 'upper-alpha',
113
+ 'upper-latin', 'upper-roman', 'uppercase', 'upright', 'use-glyph-orientation',
114
+ 'vertical', 'vertical-text', 'view-box', 'visible', 'w-resize', 'wait',
115
+ 'wavy', 'weight', 'weight style', 'wrap', 'wrap-reverse', 'x-large',
116
+ 'x-small', 'xx-large', 'xx-small', 'zoom-in', 'zoom-out',
117
+ )
118
+
119
+ # List of other keyword values from other sources:
120
+ _other_keyword_values = (
121
+ 'above', 'aural', 'behind', 'bidi-override', 'center-left', 'center-right',
122
+ 'cjk-ideographic', 'continuous', 'crop', 'cross', 'embed', 'far-left',
123
+ 'far-right', 'fast', 'faster', 'hebrew', 'high', 'higher', 'hiragana',
124
+ 'hiragana-iroha', 'katakana', 'katakana-iroha', 'landscape', 'left-side',
125
+ 'leftwards', 'level', 'loud', 'low', 'lower', 'message-box', 'middle',
126
+ 'mix', 'narrower', 'once', 'portrait', 'right-side', 'rightwards', 'silent',
127
+ 'slow', 'slower', 'small-caption', 'soft', 'spell-out', 'status-bar',
128
+ 'super', 'text-bottom', 'text-top', 'wider', 'x-fast', 'x-high', 'x-loud',
129
+ 'x-low', 'x-soft', 'yes', 'pre', 'pre-wrap', 'pre-line',
130
+ )
131
+
132
+ # List of functional notation and function keyword values:
133
+ _functional_notation_keyword_values = (
134
+ 'attr', 'blackness', 'blend', 'blenda', 'blur', 'brightness', 'calc',
135
+ 'circle', 'color-mod', 'contrast', 'counter', 'cubic-bezier', 'device-cmyk',
136
+ 'drop-shadow', 'ellipse', 'gray', 'grayscale', 'hsl', 'hsla', 'hue',
137
+ 'hue-rotate', 'hwb', 'image', 'inset', 'invert', 'lightness',
138
+ 'linear-gradient', 'matrix', 'matrix3d', 'opacity', 'perspective',
139
+ 'polygon', 'radial-gradient', 'rect', 'repeating-linear-gradient',
140
+ 'repeating-radial-gradient', 'rgb', 'rgba', 'rotate', 'rotate3d', 'rotateX',
141
+ 'rotateY', 'rotateZ', 'saturate', 'saturation', 'scale', 'scale3d',
142
+ 'scaleX', 'scaleY', 'scaleZ', 'sepia', 'shade', 'skewX', 'skewY', 'steps',
143
+ 'tint', 'toggle', 'translate', 'translate3d', 'translateX', 'translateY',
144
+ 'translateZ', 'whiteness',
145
+ )
146
+ # Note! Handle url(...) separately.
147
+
148
+ # List of units obtained from:
149
+ # https://www.w3.org/TR/css3-values/
150
+ _angle_units = (
151
+ 'deg', 'grad', 'rad', 'turn',
152
+ )
153
+ _frequency_units = (
154
+ 'Hz', 'kHz',
155
+ )
156
+ _length_units = (
157
+ 'em', 'ex', 'ch', 'rem',
158
+ 'vh', 'vw', 'vmin', 'vmax',
159
+ 'px', 'mm', 'cm', 'in', 'pt', 'pc', 'q',
160
+ )
161
+ _resolution_units = (
162
+ 'dpi', 'dpcm', 'dppx',
163
+ )
164
+ _time_units = (
165
+ 's', 'ms',
166
+ )
167
+ _all_units = _angle_units + _frequency_units + _length_units + \
168
+ _resolution_units + _time_units
169
+
170
+
171
+ class CssLexer(RegexLexer):
172
+ """
173
+ For CSS (Cascading Style Sheets).
174
+ """
175
+
176
+ name = 'CSS'
177
+ url = 'https://www.w3.org/TR/CSS/#css'
178
+ aliases = ['css']
179
+ filenames = ['*.css']
180
+ mimetypes = ['text/css']
181
+ version_added = ''
182
+
183
+ tokens = {
184
+ 'root': [
185
+ include('basics'),
186
+ ],
187
+ 'basics': [
188
+ (r'\s+', Whitespace),
189
+ (r'/\*[\s\S]*?\*/', Comment),
190
+ (r'\{', Punctuation, 'content'),
191
+ (r'(\:{1,2})([\w-]+)', bygroups(Punctuation, Name.Decorator)),
192
+ (r'(\.)([\w-]+)', bygroups(Punctuation, Name.Class)),
193
+ (r'(\#)([\w-]+)', bygroups(Punctuation, Name.Namespace)),
194
+ (r'(@)([\w-]+)', bygroups(Punctuation, Keyword), 'atrule'),
195
+ (r'[\w-]+', Name.Tag),
196
+ (r'[~^*!%&$\[\]()<>|+=@:;,./?-]', Operator),
197
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
198
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
199
+ ],
200
+ 'atrule': [
201
+ (r'\{', Punctuation, 'atcontent'),
202
+ (r';', Punctuation, '#pop'),
203
+ include('basics'),
204
+ ],
205
+ 'atcontent': [
206
+ include('basics'),
207
+ (r'\}', Punctuation, '#pop:2'),
208
+ ],
209
+ 'content': [
210
+ (r'\s+', Whitespace),
211
+ (r'\}', Punctuation, '#pop'),
212
+ (r';', Punctuation),
213
+ (r'^@.*?$', Comment.Preproc),
214
+
215
+ (words(_vendor_prefixes,), Keyword.Pseudo),
216
+ (r'('+r'|'.join(_css_properties)+r')(\s*)(\:)',
217
+ bygroups(Keyword, Whitespace, Punctuation), 'value-start'),
218
+ (r'([-]+[a-zA-Z_][\w-]*)(\s*)(\:)', bygroups(Name.Variable, Whitespace, Punctuation),
219
+ 'value-start'),
220
+ (r'([a-zA-Z_][\w-]*)(\s*)(\:)', bygroups(Name, Whitespace, Punctuation),
221
+ 'value-start'),
222
+
223
+ (r'/\*[\s\S]*?\*/', Comment),
224
+ ],
225
+ 'value-start': [
226
+ (r'\s+', Whitespace),
227
+ (words(_vendor_prefixes,), Name.Builtin.Pseudo),
228
+ include('urls'),
229
+ (r'('+r'|'.join(_functional_notation_keyword_values)+r')(\()',
230
+ bygroups(Name.Builtin, Punctuation), 'function-start'),
231
+ (r'([a-zA-Z_][\w-]+)(\()',
232
+ bygroups(Name.Function, Punctuation), 'function-start'),
233
+ (words(_keyword_values, suffix=r'\b'), Keyword.Constant),
234
+ (words(_other_keyword_values, suffix=r'\b'), Keyword.Constant),
235
+ (words(_color_keywords, suffix=r'\b'), Keyword.Constant),
236
+ # for transition-property etc.
237
+ (words(_css_properties, suffix=r'\b'), Keyword),
238
+ (r'\!important', Comment.Preproc),
239
+ (r'/\*[\s\S]*?\*/', Comment),
240
+
241
+ include('numeric-values'),
242
+
243
+ (r'[~^*!%&<>|+=@:./?-]+', Operator),
244
+ (r'[\[\](),]+', Punctuation),
245
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
246
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
247
+ (r'[a-zA-Z_][\w-]*', Name),
248
+ (r';', Punctuation, '#pop'),
249
+ (r'\}', Punctuation, '#pop:2'),
250
+ ],
251
+ 'function-start': [
252
+ (r'\s+', Whitespace),
253
+ (r'[-]+([A-Za-z][\w+]*[-]*)+', Name.Variable),
254
+ include('urls'),
255
+ (words(_vendor_prefixes,), Keyword.Pseudo),
256
+ (words(_keyword_values, suffix=r'\b'), Keyword.Constant),
257
+ (words(_other_keyword_values, suffix=r'\b'), Keyword.Constant),
258
+ (words(_color_keywords, suffix=r'\b'), Keyword.Constant),
259
+
260
+ # function-start may be entered recursively
261
+ (r'(' + r'|'.join(_functional_notation_keyword_values) + r')(\()',
262
+ bygroups(Name.Builtin, Punctuation), 'function-start'),
263
+ (r'([a-zA-Z_][\w-]+)(\()',
264
+ bygroups(Name.Function, Punctuation), 'function-start'),
265
+
266
+ (r'/\*[\s\S]*?\*/', Comment),
267
+ include('numeric-values'),
268
+ (r'[*+/-]', Operator),
269
+ (r',', Punctuation),
270
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
271
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
272
+ (r'[a-zA-Z_-]\w*', Name),
273
+ (r'\)', Punctuation, '#pop'),
274
+ ],
275
+ 'urls': [
276
+ (r'(url)(\()(".*?")(\))', bygroups(Name.Builtin, Punctuation,
277
+ String.Double, Punctuation)),
278
+ (r"(url)(\()('.*?')(\))", bygroups(Name.Builtin, Punctuation,
279
+ String.Single, Punctuation)),
280
+ (r'(url)(\()(.*?)(\))', bygroups(Name.Builtin, Punctuation,
281
+ String.Other, Punctuation)),
282
+ ],
283
+ 'numeric-values': [
284
+ (r'\#[a-zA-Z0-9]{1,6}', Number.Hex),
285
+ (r'[+\-]?[0-9]*[.][0-9]+', Number.Float, 'numeric-end'),
286
+ (r'[+\-]?[0-9]+', Number.Integer, 'numeric-end'),
287
+ ],
288
+ 'numeric-end': [
289
+ (words(_all_units, suffix=r'\b'), Keyword.Type),
290
+ (r'%', Keyword.Type),
291
+ default('#pop'),
292
+ ],
293
+ }
294
+
295
+
296
+ common_sass_tokens = {
297
+ 'value': [
298
+ (r'[ \t]+', Whitespace),
299
+ (r'[!$][\w-]+', Name.Variable),
300
+ (r'url\(', String.Other, 'string-url'),
301
+ (r'[a-z_-][\w-]*(?=\()', Name.Function),
302
+ (words(_css_properties + (
303
+ 'above', 'absolute', 'always', 'armenian', 'aural', 'auto', 'avoid', 'baseline',
304
+ 'behind', 'below', 'bidi-override', 'blink', 'block', 'bold', 'bolder', 'both',
305
+ 'capitalize', 'center-left', 'center-right', 'center', 'circle',
306
+ 'cjk-ideographic', 'close-quote', 'collapse', 'condensed', 'continuous',
307
+ 'crosshair', 'cross', 'cursive', 'dashed', 'decimal-leading-zero',
308
+ 'decimal', 'default', 'digits', 'disc', 'dotted', 'double', 'e-resize', 'embed',
309
+ 'extra-condensed', 'extra-expanded', 'expanded', 'fantasy', 'far-left',
310
+ 'far-right', 'faster', 'fast', 'fixed', 'georgian', 'groove', 'hebrew', 'help',
311
+ 'hidden', 'hide', 'higher', 'high', 'hiragana-iroha', 'hiragana', 'icon',
312
+ 'inherit', 'inline-table', 'inline', 'inset', 'inside', 'invert', 'italic',
313
+ 'justify', 'katakana-iroha', 'katakana', 'landscape', 'larger', 'large',
314
+ 'left-side', 'leftwards', 'level', 'lighter', 'line-through', 'list-item',
315
+ 'loud', 'lower-alpha', 'lower-greek', 'lower-roman', 'lowercase', 'ltr',
316
+ 'lower', 'low', 'medium', 'message-box', 'middle', 'mix', 'monospace',
317
+ 'n-resize', 'narrower', 'ne-resize', 'no-close-quote', 'no-open-quote',
318
+ 'no-repeat', 'none', 'normal', 'nowrap', 'nw-resize', 'oblique', 'once',
319
+ 'open-quote', 'outset', 'outside', 'overline', 'pointer', 'portrait', 'px',
320
+ 'relative', 'repeat-x', 'repeat-y', 'repeat', 'rgb', 'ridge', 'right-side',
321
+ 'rightwards', 's-resize', 'sans-serif', 'scroll', 'se-resize',
322
+ 'semi-condensed', 'semi-expanded', 'separate', 'serif', 'show', 'silent',
323
+ 'slow', 'slower', 'small-caps', 'small-caption', 'smaller', 'soft', 'solid',
324
+ 'spell-out', 'square', 'static', 'status-bar', 'super', 'sw-resize',
325
+ 'table-caption', 'table-cell', 'table-column', 'table-column-group',
326
+ 'table-footer-group', 'table-header-group', 'table-row',
327
+ 'table-row-group', 'text', 'text-bottom', 'text-top', 'thick', 'thin',
328
+ 'transparent', 'ultra-condensed', 'ultra-expanded', 'underline',
329
+ 'upper-alpha', 'upper-latin', 'upper-roman', 'uppercase', 'url',
330
+ 'visible', 'w-resize', 'wait', 'wider', 'x-fast', 'x-high', 'x-large', 'x-loud',
331
+ 'x-low', 'x-small', 'x-soft', 'xx-large', 'xx-small', 'yes'), suffix=r'\b'),
332
+ Name.Constant),
333
+ (words(_color_keywords, suffix=r'\b'), Name.Entity),
334
+ (words((
335
+ 'black', 'silver', 'gray', 'white', 'maroon', 'red', 'purple', 'fuchsia', 'green',
336
+ 'lime', 'olive', 'yellow', 'navy', 'blue', 'teal', 'aqua'), suffix=r'\b'),
337
+ Name.Builtin),
338
+ (r'\!(important|default)', Name.Exception),
339
+ (r'(true|false)', Name.Pseudo),
340
+ (r'(and|or|not)', Operator.Word),
341
+ (r'/\*', Comment.Multiline, 'inline-comment'),
342
+ (r'//[^\n]*', Comment.Single),
343
+ (r'\#[a-z0-9]{1,6}', Number.Hex),
344
+ (r'(-?\d+)(\%|[a-z]+)?', bygroups(Number.Integer, Keyword.Type)),
345
+ (r'(-?\d*\.\d+)(\%|[a-z]+)?', bygroups(Number.Float, Keyword.Type)),
346
+ (r'#\{', String.Interpol, 'interpolation'),
347
+ (r'[~^*!&%<>|+=@:,./?-]+', Operator),
348
+ (r'[\[\]()]+', Punctuation),
349
+ (r'"', String.Double, 'string-double'),
350
+ (r"'", String.Single, 'string-single'),
351
+ (r'[a-z_-][\w-]*', Name),
352
+ ],
353
+
354
+ 'interpolation': [
355
+ (r'\}', String.Interpol, '#pop'),
356
+ include('value'),
357
+ ],
358
+
359
+ 'selector': [
360
+ (r'[ \t]+', Whitespace),
361
+ (r'\:', Name.Decorator, 'pseudo-class'),
362
+ (r'\.', Name.Class, 'class'),
363
+ (r'\#', Name.Namespace, 'id'),
364
+ (r'[\w-]+', Name.Tag),
365
+ (r'\$[\w-]+', Name.Variable),
366
+ (r'#\{', String.Interpol, 'interpolation'),
367
+ (r'&', Keyword),
368
+ (r'[~^*!&\[\]()<>|+=@:;,./?-]', Operator),
369
+ (r'"', String.Double, 'string-double'),
370
+ (r"'", String.Single, 'string-single'),
371
+ ],
372
+
373
+ 'string-double': [
374
+ (r'(\\.|#(?=[^\n{])|[^\n"#])+', String.Double),
375
+ (r'#\{', String.Interpol, 'interpolation'),
376
+ (r'"', String.Double, '#pop'),
377
+ ],
378
+
379
+ 'string-single': [
380
+ (r"(\\.|#(?=[^\n{])|[^\n'#])+", String.Single),
381
+ (r'#\{', String.Interpol, 'interpolation'),
382
+ (r"'", String.Single, '#pop'),
383
+ ],
384
+
385
+ 'string-url': [
386
+ (r'(\\#|#(?=[^\n{])|[^\n#)])+', String.Other),
387
+ (r'#\{', String.Interpol, 'interpolation'),
388
+ (r'\)', String.Other, '#pop'),
389
+ ],
390
+
391
+ 'pseudo-class': [
392
+ (r'[\w-]+', Name.Decorator),
393
+ (r'#\{', String.Interpol, 'interpolation'),
394
+ default('#pop'),
395
+ ],
396
+
397
+ 'class': [
398
+ (r'[\w-]+', Name.Class),
399
+ (r'#\{', String.Interpol, 'interpolation'),
400
+ default('#pop'),
401
+ ],
402
+
403
+ 'id': [
404
+ (r'[\w-]+', Name.Namespace),
405
+ (r'#\{', String.Interpol, 'interpolation'),
406
+ default('#pop'),
407
+ ],
408
+
409
+ 'for': [
410
+ (r'(from|to|through)', Operator.Word),
411
+ include('value'),
412
+ ],
413
+ }
414
+
415
+
416
+ def _indentation(lexer, match, ctx):
417
+ indentation = match.group(0)
418
+ yield match.start(), Whitespace, indentation
419
+ ctx.last_indentation = indentation
420
+ ctx.pos = match.end()
421
+
422
+ if hasattr(ctx, 'block_state') and ctx.block_state and \
423
+ indentation.startswith(ctx.block_indentation) and \
424
+ indentation != ctx.block_indentation:
425
+ ctx.stack.append(ctx.block_state)
426
+ else:
427
+ ctx.block_state = None
428
+ ctx.block_indentation = None
429
+ ctx.stack.append('content')
430
+
431
+
432
+ def _starts_block(token, state):
433
+ def callback(lexer, match, ctx):
434
+ yield match.start(), token, match.group(0)
435
+
436
+ if hasattr(ctx, 'last_indentation'):
437
+ ctx.block_indentation = ctx.last_indentation
438
+ else:
439
+ ctx.block_indentation = ''
440
+
441
+ ctx.block_state = state
442
+ ctx.pos = match.end()
443
+
444
+ return callback
445
+
446
+
447
+ class SassLexer(ExtendedRegexLexer):
448
+ """
449
+ For Sass stylesheets.
450
+ """
451
+
452
+ name = 'Sass'
453
+ url = 'https://sass-lang.com/'
454
+ aliases = ['sass']
455
+ filenames = ['*.sass']
456
+ mimetypes = ['text/x-sass']
457
+ version_added = '1.3'
458
+
459
+ flags = re.IGNORECASE | re.MULTILINE
460
+
461
+ tokens = {
462
+ 'root': [
463
+ (r'[ \t]*\n', Whitespace),
464
+ (r'[ \t]*', _indentation),
465
+ ],
466
+
467
+ 'content': [
468
+ (r'//[^\n]*', _starts_block(Comment.Single, 'single-comment'),
469
+ 'root'),
470
+ (r'/\*[^\n]*', _starts_block(Comment.Multiline, 'multi-comment'),
471
+ 'root'),
472
+ (r'@import', Keyword, 'import'),
473
+ (r'@for', Keyword, 'for'),
474
+ (r'@(debug|warn|if|while)', Keyword, 'value'),
475
+ (r'(@mixin)( )([\w-]+)', bygroups(Keyword, Whitespace, Name.Function), 'value'),
476
+ (r'(@include)( )([\w-]+)', bygroups(Keyword, Whitespace, Name.Decorator), 'value'),
477
+ (r'@extend', Keyword, 'selector'),
478
+ (r'@[\w-]+', Keyword, 'selector'),
479
+ (r'=[\w-]+', Name.Function, 'value'),
480
+ (r'\+[\w-]+', Name.Decorator, 'value'),
481
+ (r'([!$][\w-]\w*)([ \t]*(?:(?:\|\|)?=|:))',
482
+ bygroups(Name.Variable, Operator), 'value'),
483
+ (r':', Name.Attribute, 'old-style-attr'),
484
+ (r'(?=.+?[=:]([^a-z]|$))', Name.Attribute, 'new-style-attr'),
485
+ default('selector'),
486
+ ],
487
+
488
+ 'single-comment': [
489
+ (r'.+', Comment.Single),
490
+ (r'\n', Whitespace, 'root'),
491
+ ],
492
+
493
+ 'multi-comment': [
494
+ (r'.+', Comment.Multiline),
495
+ (r'\n', Whitespace, 'root'),
496
+ ],
497
+
498
+ 'import': [
499
+ (r'[ \t]+', Whitespace),
500
+ (r'\S+', String),
501
+ (r'\n', Whitespace, 'root'),
502
+ ],
503
+
504
+ 'old-style-attr': [
505
+ (r'[^\s:="\[]+', Name.Attribute),
506
+ (r'#\{', String.Interpol, 'interpolation'),
507
+ (r'([ \t]*)(=)', bygroups(Whitespace, Operator), 'value'),
508
+ default('value'),
509
+ ],
510
+
511
+ 'new-style-attr': [
512
+ (r'[^\s:="\[]+', Name.Attribute),
513
+ (r'#\{', String.Interpol, 'interpolation'),
514
+ (r'([ \t]*)([=:])', bygroups(Whitespace, Operator), 'value'),
515
+ ],
516
+
517
+ 'inline-comment': [
518
+ (r"(\\#|#(?=[^\n{])|\*(?=[^\n/])|[^\n#*])+", Comment.Multiline),
519
+ (r'#\{', String.Interpol, 'interpolation'),
520
+ (r"\*/", Comment, '#pop'),
521
+ ],
522
+ }
523
+ for group, common in common_sass_tokens.items():
524
+ tokens[group] = copy.copy(common)
525
+ tokens['value'].append((r'\n', Whitespace, 'root'))
526
+ tokens['selector'].append((r'\n', Whitespace, 'root'))
527
+
528
+
529
+ class ScssLexer(RegexLexer):
530
+ """
531
+ For SCSS stylesheets.
532
+ """
533
+
534
+ name = 'SCSS'
535
+ url = 'https://sass-lang.com/'
536
+ aliases = ['scss']
537
+ filenames = ['*.scss']
538
+ mimetypes = ['text/x-scss']
539
+ version_added = ''
540
+
541
+ flags = re.IGNORECASE | re.DOTALL
542
+ tokens = {
543
+ 'root': [
544
+ (r'\s+', Whitespace),
545
+ (r'//.*?\n', Comment.Single),
546
+ (r'/\*.*?\*/', Comment.Multiline),
547
+ (r'@import', Keyword, 'value'),
548
+ (r'@for', Keyword, 'for'),
549
+ (r'@(debug|warn|if|while)', Keyword, 'value'),
550
+ (r'(@mixin)( [\w-]+)', bygroups(Keyword, Name.Function), 'value'),
551
+ (r'(@include)( [\w-]+)', bygroups(Keyword, Name.Decorator), 'value'),
552
+ (r'@extend', Keyword, 'selector'),
553
+ (r'(@media)(\s+)', bygroups(Keyword, Whitespace), 'value'),
554
+ (r'@[\w-]+', Keyword, 'selector'),
555
+ (r'(\$[\w-]*\w)([ \t]*:)', bygroups(Name.Variable, Operator), 'value'),
556
+ # TODO: broken, and prone to infinite loops.
557
+ # (r'(?=[^;{}][;}])', Name.Attribute, 'attr'),
558
+ # (r'(?=[^;{}:]+:[^a-z])', Name.Attribute, 'attr'),
559
+ default('selector'),
560
+ ],
561
+
562
+ 'attr': [
563
+ (r'[^\s:="\[]+', Name.Attribute),
564
+ (r'#\{', String.Interpol, 'interpolation'),
565
+ (r'[ \t]*:', Operator, 'value'),
566
+ default('#pop'),
567
+ ],
568
+
569
+ 'inline-comment': [
570
+ (r"(\\#|#(?=[^{])|\*(?=[^/])|[^#*])+", Comment.Multiline),
571
+ (r'#\{', String.Interpol, 'interpolation'),
572
+ (r"\*/", Comment, '#pop'),
573
+ ],
574
+ }
575
+ for group, common in common_sass_tokens.items():
576
+ tokens[group] = copy.copy(common)
577
+ tokens['value'].extend([(r'\n', Whitespace), (r'[;{}]', Punctuation, '#pop')])
578
+ tokens['selector'].extend([(r'\n', Whitespace), (r'[;{}]', Punctuation, '#pop')])
579
+
580
+
581
+ class LessCssLexer(CssLexer):
582
+ """
583
+ For LESS styleshets.
584
+ """
585
+
586
+ name = 'LessCss'
587
+ url = 'http://lesscss.org/'
588
+ aliases = ['less']
589
+ filenames = ['*.less']
590
+ mimetypes = ['text/x-less-css']
591
+ version_added = '2.1'
592
+
593
+ tokens = {
594
+ # FIXME: It's not currently possible to simply do the following,
595
+ # as `include('basics')` doesn't take overrides into account:
596
+ # 'basics': [
597
+ # (r'//.*\n', Comment.Single),
598
+ # (r'/\*(?:.|\n)*?\*/', Comment.Multiline),
599
+ # inherit,
600
+ # ],
601
+ 'root': [
602
+ (r'@\w+', Name.Variable),
603
+ (r'//.*\n', Comment.Single),
604
+ (r'/\*[\s\S]*?\*/', Comment.Multiline),
605
+ inherit,
606
+ ],
607
+ 'atcontent': [
608
+ (r'//.*\n', Comment.Single),
609
+ (r'/\*[\s\S]*?\*/', Comment.Multiline),
610
+ inherit,
611
+ ],
612
+ 'atrule': [
613
+ (r'//.*\n', Comment.Single),
614
+ (r'/\*[\s\S]*?\*/', Comment.Multiline),
615
+ inherit,
616
+ ],
617
+ 'content': [
618
+ (r'\{', Punctuation, '#push'),
619
+ (r'//.*\n', Comment.Single),
620
+ (r'/\*[\s\S]*?\*/', Comment.Multiline),
621
+ inherit,
622
+ ],
623
+ 'value-start': [
624
+ (r'//.*\n', Comment.Single),
625
+ (r'/\*[\s\S]*?\*/', Comment.Multiline),
626
+ inherit,
627
+ ],
628
+ 'function-start': [
629
+ (r'//.*\n', Comment.Single),
630
+ (r'/\*[\s\S]*?\*/', Comment.Multiline),
631
+ inherit,
632
+ ],
633
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/d.py ADDED
@@ -0,0 +1,259 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.d
3
+ ~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for D languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, include, words, bygroups
12
+ from pygments.token import Comment, Keyword, Name, String, Number, \
13
+ Punctuation, Whitespace
14
+
15
+ __all__ = ['DLexer', 'CrocLexer', 'MiniDLexer']
16
+
17
+
18
+ class DLexer(RegexLexer):
19
+ """
20
+ For D source.
21
+ """
22
+ name = 'D'
23
+ url = 'https://dlang.org/'
24
+ filenames = ['*.d', '*.di']
25
+ aliases = ['d']
26
+ mimetypes = ['text/x-dsrc']
27
+ version_added = '1.2'
28
+
29
+ tokens = {
30
+ 'root': [
31
+ (r'\n', Whitespace),
32
+ (r'\s+', Whitespace),
33
+ # (r'\\\n', Text), # line continuations
34
+ # Comments
35
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
36
+ (r'/(\\\n)?[*][\s\S]*?[*](\\\n)?/', Comment.Multiline),
37
+ (r'/\+', Comment.Multiline, 'nested_comment'),
38
+ # Keywords
39
+ (words((
40
+ 'abstract', 'alias', 'align', 'asm', 'assert', 'auto', 'body',
41
+ 'break', 'case', 'cast', 'catch', 'class', 'const', 'continue',
42
+ 'debug', 'default', 'delegate', 'delete', 'deprecated', 'do', 'else',
43
+ 'enum', 'export', 'extern', 'finally', 'final', 'foreach_reverse',
44
+ 'foreach', 'for', 'function', 'goto', 'if', 'immutable', 'import',
45
+ 'interface', 'invariant', 'inout', 'in', 'is', 'lazy', 'mixin',
46
+ 'module', 'new', 'nothrow', 'out', 'override', 'package', 'pragma',
47
+ 'private', 'protected', 'public', 'pure', 'ref', 'return', 'scope',
48
+ 'shared', 'static', 'struct', 'super', 'switch', 'synchronized',
49
+ 'template', 'this', 'throw', 'try', 'typeid', 'typeof',
50
+ 'union', 'unittest', 'version', 'volatile', 'while', 'with',
51
+ '__gshared', '__traits', '__vector', '__parameters'),
52
+ suffix=r'\b'),
53
+ Keyword),
54
+ (words((
55
+ # Removed in 2.072
56
+ 'typedef', ),
57
+ suffix=r'\b'),
58
+ Keyword.Removed),
59
+ (words((
60
+ 'bool', 'byte', 'cdouble', 'cent', 'cfloat', 'char', 'creal',
61
+ 'dchar', 'double', 'float', 'idouble', 'ifloat', 'int', 'ireal',
62
+ 'long', 'real', 'short', 'ubyte', 'ucent', 'uint', 'ulong',
63
+ 'ushort', 'void', 'wchar'), suffix=r'\b'),
64
+ Keyword.Type),
65
+ (r'(false|true|null)\b', Keyword.Constant),
66
+ (words((
67
+ '__FILE__', '__FILE_FULL_PATH__', '__MODULE__', '__LINE__', '__FUNCTION__',
68
+ '__PRETTY_FUNCTION__', '__DATE__', '__EOF__', '__TIME__', '__TIMESTAMP__',
69
+ '__VENDOR__', '__VERSION__'), suffix=r'\b'),
70
+ Keyword.Pseudo),
71
+ (r'macro\b', Keyword.Reserved),
72
+ (r'(string|wstring|dstring|size_t|ptrdiff_t)\b', Name.Builtin),
73
+ # FloatLiteral
74
+ # -- HexFloat
75
+ (r'0[xX]([0-9a-fA-F_]*\.[0-9a-fA-F_]+|[0-9a-fA-F_]+)'
76
+ r'[pP][+\-]?[0-9_]+[fFL]?[i]?', Number.Float),
77
+ # -- DecimalFloat
78
+ (r'[0-9_]+(\.[0-9_]+[eE][+\-]?[0-9_]+|'
79
+ r'\.[0-9_]*|[eE][+\-]?[0-9_]+)[fFL]?[i]?', Number.Float),
80
+ (r'\.(0|[1-9][0-9_]*)([eE][+\-]?[0-9_]+)?[fFL]?[i]?', Number.Float),
81
+ # IntegerLiteral
82
+ # -- Binary
83
+ (r'0[Bb][01_]+', Number.Bin),
84
+ # -- Octal
85
+ (r'0[0-7_]+', Number.Oct),
86
+ # -- Hexadecimal
87
+ (r'0[xX][0-9a-fA-F_]+', Number.Hex),
88
+ # -- Decimal
89
+ (r'(0|[1-9][0-9_]*)([LUu]|Lu|LU|uL|UL)?', Number.Integer),
90
+ # CharacterLiteral
91
+ (r"""'(\\['"?\\abfnrtv]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}"""
92
+ r"""|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|\\&\w+;|.)'""",
93
+ String.Char),
94
+ # StringLiteral
95
+ # -- WysiwygString
96
+ (r'r"[^"]*"[cwd]?', String),
97
+ # -- AlternateWysiwygString
98
+ (r'`[^`]*`[cwd]?', String),
99
+ # -- DoubleQuotedString
100
+ (r'"(\\\\|\\[^\\]|[^"\\])*"[cwd]?', String),
101
+ # -- EscapeSequence
102
+ (r"\\(['\"?\\abfnrtv]|x[0-9a-fA-F]{2}|[0-7]{1,3}"
103
+ r"|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8}|&\w+;)",
104
+ String),
105
+ # -- HexString
106
+ (r'x"[0-9a-fA-F_\s]*"[cwd]?', String),
107
+ # -- DelimitedString
108
+ (r'q"\[', String, 'delimited_bracket'),
109
+ (r'q"\(', String, 'delimited_parenthesis'),
110
+ (r'q"<', String, 'delimited_angle'),
111
+ (r'q"\{', String, 'delimited_curly'),
112
+ (r'q"([^\W\d]\w*)\n.*?\n\1"', String),
113
+ (r'q"(.).*?\1"', String),
114
+ # -- TokenString
115
+ (r'q\{', String, 'token_string'),
116
+ # Attributes
117
+ (r'@([^\W\d]\w*)?', Name.Decorator),
118
+ # Tokens
119
+ (r'(~=|\^=|%=|\*=|==|!>=|!<=|!<>=|!<>|!<|!>|!=|>>>=|>>>|>>=|>>|>='
120
+ r'|<>=|<>|<<=|<<|<=|\+\+|\+=|--|-=|\|\||\|=|&&|&=|\.\.\.|\.\.|/=)'
121
+ r'|[/.&|\-+<>!()\[\]{}?,;:$=*%^~]', Punctuation),
122
+ # Identifier
123
+ (r'[^\W\d]\w*', Name),
124
+ # Line
125
+ (r'(#line)(\s)(.*)(\n)', bygroups(Comment.Special, Whitespace,
126
+ Comment.Special, Whitespace)),
127
+ ],
128
+ 'nested_comment': [
129
+ (r'[^+/]+', Comment.Multiline),
130
+ (r'/\+', Comment.Multiline, '#push'),
131
+ (r'\+/', Comment.Multiline, '#pop'),
132
+ (r'[+/]', Comment.Multiline),
133
+ ],
134
+ 'token_string': [
135
+ (r'\{', Punctuation, 'token_string_nest'),
136
+ (r'\}', String, '#pop'),
137
+ include('root'),
138
+ ],
139
+ 'token_string_nest': [
140
+ (r'\{', Punctuation, '#push'),
141
+ (r'\}', Punctuation, '#pop'),
142
+ include('root'),
143
+ ],
144
+ 'delimited_bracket': [
145
+ (r'[^\[\]]+', String),
146
+ (r'\[', String, 'delimited_inside_bracket'),
147
+ (r'\]"', String, '#pop'),
148
+ ],
149
+ 'delimited_inside_bracket': [
150
+ (r'[^\[\]]+', String),
151
+ (r'\[', String, '#push'),
152
+ (r'\]', String, '#pop'),
153
+ ],
154
+ 'delimited_parenthesis': [
155
+ (r'[^()]+', String),
156
+ (r'\(', String, 'delimited_inside_parenthesis'),
157
+ (r'\)"', String, '#pop'),
158
+ ],
159
+ 'delimited_inside_parenthesis': [
160
+ (r'[^()]+', String),
161
+ (r'\(', String, '#push'),
162
+ (r'\)', String, '#pop'),
163
+ ],
164
+ 'delimited_angle': [
165
+ (r'[^<>]+', String),
166
+ (r'<', String, 'delimited_inside_angle'),
167
+ (r'>"', String, '#pop'),
168
+ ],
169
+ 'delimited_inside_angle': [
170
+ (r'[^<>]+', String),
171
+ (r'<', String, '#push'),
172
+ (r'>', String, '#pop'),
173
+ ],
174
+ 'delimited_curly': [
175
+ (r'[^{}]+', String),
176
+ (r'\{', String, 'delimited_inside_curly'),
177
+ (r'\}"', String, '#pop'),
178
+ ],
179
+ 'delimited_inside_curly': [
180
+ (r'[^{}]+', String),
181
+ (r'\{', String, '#push'),
182
+ (r'\}', String, '#pop'),
183
+ ],
184
+ }
185
+
186
+
187
+ class CrocLexer(RegexLexer):
188
+ """
189
+ For Croc source.
190
+ """
191
+ name = 'Croc'
192
+ url = 'http://jfbillingsley.com/croc'
193
+ filenames = ['*.croc']
194
+ aliases = ['croc']
195
+ mimetypes = ['text/x-crocsrc']
196
+ version_added = ''
197
+
198
+ tokens = {
199
+ 'root': [
200
+ (r'\n', Whitespace),
201
+ (r'\s+', Whitespace),
202
+ # Comments
203
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
204
+ (r'/\*', Comment.Multiline, 'nestedcomment'),
205
+ # Keywords
206
+ (words((
207
+ 'as', 'assert', 'break', 'case', 'catch', 'class', 'continue',
208
+ 'default', 'do', 'else', 'finally', 'for', 'foreach', 'function',
209
+ 'global', 'namespace', 'if', 'import', 'in', 'is', 'local',
210
+ 'module', 'return', 'scope', 'super', 'switch', 'this', 'throw',
211
+ 'try', 'vararg', 'while', 'with', 'yield'), suffix=r'\b'),
212
+ Keyword),
213
+ (r'(false|true|null)\b', Keyword.Constant),
214
+ # FloatLiteral
215
+ (r'([0-9][0-9_]*)(?=[.eE])(\.[0-9][0-9_]*)?([eE][+\-]?[0-9_]+)?',
216
+ Number.Float),
217
+ # IntegerLiteral
218
+ # -- Binary
219
+ (r'0[bB][01][01_]*', Number.Bin),
220
+ # -- Hexadecimal
221
+ (r'0[xX][0-9a-fA-F][0-9a-fA-F_]*', Number.Hex),
222
+ # -- Decimal
223
+ (r'([0-9][0-9_]*)(?![.eE])', Number.Integer),
224
+ # CharacterLiteral
225
+ (r"""'(\\['"\\nrt]|\\x[0-9a-fA-F]{2}|\\[0-9]{1,3}"""
226
+ r"""|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|.)'""",
227
+ String.Char),
228
+ # StringLiteral
229
+ # -- WysiwygString
230
+ (r'@"(""|[^"])*"', String),
231
+ (r'@`(``|[^`])*`', String),
232
+ (r"@'(''|[^'])*'", String),
233
+ # -- DoubleQuotedString
234
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
235
+ # Tokens
236
+ (r'(~=|\^=|%=|\*=|==|!=|>>>=|>>>|>>=|>>|>=|<=>|\?=|-\>'
237
+ r'|<<=|<<|<=|\+\+|\+=|--|-=|\|\||\|=|&&|&=|\.\.|/=)'
238
+ r'|[-/.&$@|\+<>!()\[\]{}?,;:=*%^~#\\]', Punctuation),
239
+ # Identifier
240
+ (r'[a-zA-Z_]\w*', Name),
241
+ ],
242
+ 'nestedcomment': [
243
+ (r'[^*/]+', Comment.Multiline),
244
+ (r'/\*', Comment.Multiline, '#push'),
245
+ (r'\*/', Comment.Multiline, '#pop'),
246
+ (r'[*/]', Comment.Multiline),
247
+ ],
248
+ }
249
+
250
+
251
+ class MiniDLexer(CrocLexer):
252
+ """
253
+ For MiniD source. MiniD is now known as Croc.
254
+ """
255
+ name = 'MiniD'
256
+ filenames = [] # don't lex .md as MiniD, reserve for Markdown
257
+ aliases = ['minid']
258
+ mimetypes = ['text/x-minidsrc']
259
+ version_added = ''
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/dalvik.py ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.dalvik
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Pygments lexers for Dalvik VM-related languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups
14
+ from pygments.token import Keyword, Text, Comment, Name, String, Number, \
15
+ Punctuation, Whitespace
16
+
17
+ __all__ = ['SmaliLexer']
18
+
19
+
20
+ class SmaliLexer(RegexLexer):
21
+ """
22
+ For Smali (Android/Dalvik) assembly
23
+ code.
24
+ """
25
+ name = 'Smali'
26
+ url = 'http://code.google.com/p/smali/'
27
+ aliases = ['smali']
28
+ filenames = ['*.smali']
29
+ mimetypes = ['text/smali']
30
+ version_added = '1.6'
31
+
32
+ tokens = {
33
+ 'root': [
34
+ include('comment'),
35
+ include('label'),
36
+ include('field'),
37
+ include('method'),
38
+ include('class'),
39
+ include('directive'),
40
+ include('access-modifier'),
41
+ include('instruction'),
42
+ include('literal'),
43
+ include('punctuation'),
44
+ include('type'),
45
+ include('whitespace')
46
+ ],
47
+ 'directive': [
48
+ (r'^([ \t]*)(\.(?:class|super|implements|field|subannotation|annotation|'
49
+ r'enum|method|registers|locals|array-data|packed-switch|'
50
+ r'sparse-switch|catchall|catch|line|parameter|local|prologue|'
51
+ r'epilogue|source))', bygroups(Whitespace, Keyword)),
52
+ (r'^([ \t]*)(\.end)( )(field|subannotation|annotation|method|array-data|'
53
+ 'packed-switch|sparse-switch|parameter|local)',
54
+ bygroups(Whitespace, Keyword, Whitespace, Keyword)),
55
+ (r'^([ \t]*)(\.restart)( )(local)',
56
+ bygroups(Whitespace, Keyword, Whitespace, Keyword)),
57
+ ],
58
+ 'access-modifier': [
59
+ (r'(public|private|protected|static|final|synchronized|bridge|'
60
+ r'varargs|native|abstract|strictfp|synthetic|constructor|'
61
+ r'declared-synchronized|interface|enum|annotation|volatile|'
62
+ r'transient)', Keyword),
63
+ ],
64
+ 'whitespace': [
65
+ (r'\n', Whitespace),
66
+ (r'\s+', Whitespace),
67
+ ],
68
+ 'instruction': [
69
+ (r'\b[vp]\d+\b', Name.Builtin), # registers
70
+ (r'(\b[a-z][A-Za-z0-9/-]+)(\s+)', bygroups(Text, Whitespace)), # instructions
71
+ ],
72
+ 'literal': [
73
+ (r'".*"', String),
74
+ (r'0x[0-9A-Fa-f]+t?', Number.Hex),
75
+ (r'[0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
76
+ (r'[0-9]+L?', Number.Integer),
77
+ ],
78
+ 'field': [
79
+ (r'(\$?\b)([\w$]*)(:)',
80
+ bygroups(Punctuation, Name.Variable, Punctuation)),
81
+ ],
82
+ 'method': [
83
+ (r'<(?:cl)?init>', Name.Function), # constructor
84
+ (r'(\$?\b)([\w$]*)(\()',
85
+ bygroups(Punctuation, Name.Function, Punctuation)),
86
+ ],
87
+ 'label': [
88
+ (r':\w+', Name.Label),
89
+ ],
90
+ 'class': [
91
+ # class names in the form Lcom/namespace/ClassName;
92
+ # I only want to color the ClassName part, so the namespace part is
93
+ # treated as 'Text'
94
+ (r'(L)((?:[\w$]+/)*)([\w$]+)(;)',
95
+ bygroups(Keyword.Type, Text, Name.Class, Text)),
96
+ ],
97
+ 'punctuation': [
98
+ (r'->', Punctuation),
99
+ (r'[{},():=.-]', Punctuation),
100
+ ],
101
+ 'type': [
102
+ (r'[ZBSCIJFDV\[]+', Keyword.Type),
103
+ ],
104
+ 'comment': [
105
+ (r'#.*?\n', Comment),
106
+ ],
107
+ }
108
+
109
+ def analyse_text(text):
110
+ score = 0
111
+ if re.search(r'^\s*\.class\s', text, re.MULTILINE):
112
+ score += 0.5
113
+ if re.search(r'\b((check-cast|instance-of|throw-verification-error'
114
+ r')\b|(-to|add|[ais]get|[ais]put|and|cmpl|const|div|'
115
+ r'if|invoke|move|mul|neg|not|or|rem|return|rsub|shl|'
116
+ r'shr|sub|ushr)[-/])|{|}', text, re.MULTILINE):
117
+ score += 0.3
118
+ if re.search(r'(\.(catchall|epilogue|restart local|prologue)|'
119
+ r'\b(array-data|class-change-error|declared-synchronized|'
120
+ r'(field|inline|vtable)@0x[0-9a-fA-F]|generic-error|'
121
+ r'illegal-class-access|illegal-field-access|'
122
+ r'illegal-method-access|instantiation-error|no-error|'
123
+ r'no-such-class|no-such-field|no-such-method|'
124
+ r'packed-switch|sparse-switch))\b', text, re.MULTILINE):
125
+ score += 0.6
126
+ return score
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/data.py ADDED
@@ -0,0 +1,763 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.data
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for data file format.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import Lexer, ExtendedRegexLexer, LexerContext, \
12
+ include, bygroups
13
+ from pygments.token import Comment, Error, Keyword, Literal, Name, Number, \
14
+ Punctuation, String, Whitespace
15
+
16
+ __all__ = ['YamlLexer', 'JsonLexer', 'JsonBareObjectLexer', 'JsonLdLexer']
17
+
18
+
19
+ class YamlLexerContext(LexerContext):
20
+ """Indentation context for the YAML lexer."""
21
+
22
+ def __init__(self, *args, **kwds):
23
+ super().__init__(*args, **kwds)
24
+ self.indent_stack = []
25
+ self.indent = -1
26
+ self.next_indent = 0
27
+ self.block_scalar_indent = None
28
+
29
+
30
+ class YamlLexer(ExtendedRegexLexer):
31
+ """
32
+ Lexer for YAML, a human-friendly data serialization
33
+ language.
34
+ """
35
+
36
+ name = 'YAML'
37
+ url = 'http://yaml.org/'
38
+ aliases = ['yaml', 'yml']
39
+ filenames = ['*.yaml', '*.yml']
40
+ mimetypes = ['text/x-yaml']
41
+ version_added = '0.11'
42
+
43
+ def something(token_class):
44
+ """Do not produce empty tokens."""
45
+ def callback(lexer, match, context):
46
+ text = match.group()
47
+ if not text:
48
+ return
49
+ yield match.start(), token_class, text
50
+ context.pos = match.end()
51
+ return callback
52
+
53
+ def reset_indent(token_class):
54
+ """Reset the indentation levels."""
55
+ def callback(lexer, match, context):
56
+ text = match.group()
57
+ context.indent_stack = []
58
+ context.indent = -1
59
+ context.next_indent = 0
60
+ context.block_scalar_indent = None
61
+ yield match.start(), token_class, text
62
+ context.pos = match.end()
63
+ return callback
64
+
65
+ def save_indent(token_class, start=False):
66
+ """Save a possible indentation level."""
67
+ def callback(lexer, match, context):
68
+ text = match.group()
69
+ extra = ''
70
+ if start:
71
+ context.next_indent = len(text)
72
+ if context.next_indent < context.indent:
73
+ while context.next_indent < context.indent:
74
+ context.indent = context.indent_stack.pop()
75
+ if context.next_indent > context.indent:
76
+ extra = text[context.indent:]
77
+ text = text[:context.indent]
78
+ else:
79
+ context.next_indent += len(text)
80
+ if text:
81
+ yield match.start(), token_class, text
82
+ if extra:
83
+ yield match.start()+len(text), token_class.Error, extra
84
+ context.pos = match.end()
85
+ return callback
86
+
87
+ def set_indent(token_class, implicit=False):
88
+ """Set the previously saved indentation level."""
89
+ def callback(lexer, match, context):
90
+ text = match.group()
91
+ if context.indent < context.next_indent:
92
+ context.indent_stack.append(context.indent)
93
+ context.indent = context.next_indent
94
+ if not implicit:
95
+ context.next_indent += len(text)
96
+ yield match.start(), token_class, text
97
+ context.pos = match.end()
98
+ return callback
99
+
100
+ def set_block_scalar_indent(token_class):
101
+ """Set an explicit indentation level for a block scalar."""
102
+ def callback(lexer, match, context):
103
+ text = match.group()
104
+ context.block_scalar_indent = None
105
+ if not text:
106
+ return
107
+ increment = match.group(1)
108
+ if increment:
109
+ current_indent = max(context.indent, 0)
110
+ increment = int(increment)
111
+ context.block_scalar_indent = current_indent + increment
112
+ if text:
113
+ yield match.start(), token_class, text
114
+ context.pos = match.end()
115
+ return callback
116
+
117
+ def parse_block_scalar_empty_line(indent_token_class, content_token_class):
118
+ """Process an empty line in a block scalar."""
119
+ def callback(lexer, match, context):
120
+ text = match.group()
121
+ if (context.block_scalar_indent is None or
122
+ len(text) <= context.block_scalar_indent):
123
+ if text:
124
+ yield match.start(), indent_token_class, text
125
+ else:
126
+ indentation = text[:context.block_scalar_indent]
127
+ content = text[context.block_scalar_indent:]
128
+ yield match.start(), indent_token_class, indentation
129
+ yield (match.start()+context.block_scalar_indent,
130
+ content_token_class, content)
131
+ context.pos = match.end()
132
+ return callback
133
+
134
+ def parse_block_scalar_indent(token_class):
135
+ """Process indentation spaces in a block scalar."""
136
+ def callback(lexer, match, context):
137
+ text = match.group()
138
+ if context.block_scalar_indent is None:
139
+ if len(text) <= max(context.indent, 0):
140
+ context.stack.pop()
141
+ context.stack.pop()
142
+ return
143
+ context.block_scalar_indent = len(text)
144
+ else:
145
+ if len(text) < context.block_scalar_indent:
146
+ context.stack.pop()
147
+ context.stack.pop()
148
+ return
149
+ if text:
150
+ yield match.start(), token_class, text
151
+ context.pos = match.end()
152
+ return callback
153
+
154
+ def parse_plain_scalar_indent(token_class):
155
+ """Process indentation spaces in a plain scalar."""
156
+ def callback(lexer, match, context):
157
+ text = match.group()
158
+ if len(text) <= context.indent:
159
+ context.stack.pop()
160
+ context.stack.pop()
161
+ return
162
+ if text:
163
+ yield match.start(), token_class, text
164
+ context.pos = match.end()
165
+ return callback
166
+
167
+ tokens = {
168
+ # the root rules
169
+ 'root': [
170
+ # ignored whitespaces
171
+ (r'[ ]+(?=#|$)', Whitespace),
172
+ # line breaks
173
+ (r'\n+', Whitespace),
174
+ # a comment
175
+ (r'#[^\n]*', Comment.Single),
176
+ # the '%YAML' directive
177
+ (r'^%YAML(?=[ ]|$)', reset_indent(Name.Tag), 'yaml-directive'),
178
+ # the %TAG directive
179
+ (r'^%TAG(?=[ ]|$)', reset_indent(Name.Tag), 'tag-directive'),
180
+ # document start and document end indicators
181
+ (r'^(?:---|\.\.\.)(?=[ ]|$)', reset_indent(Name.Namespace),
182
+ 'block-line'),
183
+ # indentation spaces
184
+ (r'[ ]*(?!\s|$)', save_indent(Whitespace, start=True),
185
+ ('block-line', 'indentation')),
186
+ ],
187
+
188
+ # trailing whitespaces after directives or a block scalar indicator
189
+ 'ignored-line': [
190
+ # ignored whitespaces
191
+ (r'[ ]+(?=#|$)', Whitespace),
192
+ # a comment
193
+ (r'#[^\n]*', Comment.Single),
194
+ # line break
195
+ (r'\n', Whitespace, '#pop:2'),
196
+ ],
197
+
198
+ # the %YAML directive
199
+ 'yaml-directive': [
200
+ # the version number
201
+ (r'([ ]+)([0-9]+\.[0-9]+)',
202
+ bygroups(Whitespace, Number), 'ignored-line'),
203
+ ],
204
+
205
+ # the %TAG directive
206
+ 'tag-directive': [
207
+ # a tag handle and the corresponding prefix
208
+ (r'([ ]+)(!|![\w-]*!)'
209
+ r'([ ]+)(!|!?[\w;/?:@&=+$,.!~*\'()\[\]%-]+)',
210
+ bygroups(Whitespace, Keyword.Type, Whitespace, Keyword.Type),
211
+ 'ignored-line'),
212
+ ],
213
+
214
+ # block scalar indicators and indentation spaces
215
+ 'indentation': [
216
+ # trailing whitespaces are ignored
217
+ (r'[ ]*$', something(Whitespace), '#pop:2'),
218
+ # whitespaces preceding block collection indicators
219
+ (r'[ ]+(?=[?:-](?:[ ]|$))', save_indent(Whitespace)),
220
+ # block collection indicators
221
+ (r'[?:-](?=[ ]|$)', set_indent(Punctuation.Indicator)),
222
+ # the beginning a block line
223
+ (r'[ ]*', save_indent(Whitespace), '#pop'),
224
+ ],
225
+
226
+ # an indented line in the block context
227
+ 'block-line': [
228
+ # the line end
229
+ (r'[ ]*(?=#|$)', something(Whitespace), '#pop'),
230
+ # whitespaces separating tokens
231
+ (r'[ ]+', Whitespace),
232
+ # key with colon
233
+ (r'''([^#,?\[\]{}"'\n]+)(:)(?=[ ]|$)''',
234
+ bygroups(Name.Tag, set_indent(Punctuation, implicit=True))),
235
+ # tags, anchors and aliases,
236
+ include('descriptors'),
237
+ # block collections and scalars
238
+ include('block-nodes'),
239
+ # flow collections and quoted scalars
240
+ include('flow-nodes'),
241
+ # a plain scalar
242
+ (r'(?=[^\s?:,\[\]{}#&*!|>\'"%@`-]|[?:-]\S)',
243
+ something(Name.Variable),
244
+ 'plain-scalar-in-block-context'),
245
+ ],
246
+
247
+ # tags, anchors, aliases
248
+ 'descriptors': [
249
+ # a full-form tag
250
+ (r'!<[\w#;/?:@&=+$,.!~*\'()\[\]%-]+>', Keyword.Type),
251
+ # a tag in the form '!', '!suffix' or '!handle!suffix'
252
+ (r'!(?:[\w-]+!)?'
253
+ r'[\w#;/?:@&=+$,.!~*\'()\[\]%-]*', Keyword.Type),
254
+ # an anchor
255
+ (r'&[\w-]+', Name.Label),
256
+ # an alias
257
+ (r'\*[\w-]+', Name.Variable),
258
+ ],
259
+
260
+ # block collections and scalars
261
+ 'block-nodes': [
262
+ # implicit key
263
+ (r':(?=[ ]|$)', set_indent(Punctuation.Indicator, implicit=True)),
264
+ # literal and folded scalars
265
+ (r'[|>]', Punctuation.Indicator,
266
+ ('block-scalar-content', 'block-scalar-header')),
267
+ ],
268
+
269
+ # flow collections and quoted scalars
270
+ 'flow-nodes': [
271
+ # a flow sequence
272
+ (r'\[', Punctuation.Indicator, 'flow-sequence'),
273
+ # a flow mapping
274
+ (r'\{', Punctuation.Indicator, 'flow-mapping'),
275
+ # a single-quoted scalar
276
+ (r'\'', String, 'single-quoted-scalar'),
277
+ # a double-quoted scalar
278
+ (r'\"', String, 'double-quoted-scalar'),
279
+ ],
280
+
281
+ # the content of a flow collection
282
+ 'flow-collection': [
283
+ # whitespaces
284
+ (r'[ ]+', Whitespace),
285
+ # line breaks
286
+ (r'\n+', Whitespace),
287
+ # a comment
288
+ (r'#[^\n]*', Comment.Single),
289
+ # simple indicators
290
+ (r'[?:,]', Punctuation.Indicator),
291
+ # tags, anchors and aliases
292
+ include('descriptors'),
293
+ # nested collections and quoted scalars
294
+ include('flow-nodes'),
295
+ # a plain scalar
296
+ (r'(?=[^\s?:,\[\]{}#&*!|>\'"%@`])',
297
+ something(Name.Variable),
298
+ 'plain-scalar-in-flow-context'),
299
+ ],
300
+
301
+ # a flow sequence indicated by '[' and ']'
302
+ 'flow-sequence': [
303
+ # include flow collection rules
304
+ include('flow-collection'),
305
+ # the closing indicator
306
+ (r'\]', Punctuation.Indicator, '#pop'),
307
+ ],
308
+
309
+ # a flow mapping indicated by '{' and '}'
310
+ 'flow-mapping': [
311
+ # key with colon
312
+ (r'''([^,:?\[\]{}"'\n]+)(:)(?=[ ]|$)''',
313
+ bygroups(Name.Tag, Punctuation)),
314
+ # include flow collection rules
315
+ include('flow-collection'),
316
+ # the closing indicator
317
+ (r'\}', Punctuation.Indicator, '#pop'),
318
+ ],
319
+
320
+ # block scalar lines
321
+ 'block-scalar-content': [
322
+ # line break
323
+ (r'\n', Whitespace),
324
+ # empty line
325
+ (r'^[ ]+$',
326
+ parse_block_scalar_empty_line(Whitespace, Name.Constant)),
327
+ # indentation spaces (we may leave the state here)
328
+ (r'^[ ]*', parse_block_scalar_indent(Whitespace)),
329
+ # line content
330
+ (r'[\S\t ]+', Name.Constant),
331
+ ],
332
+
333
+ # the content of a literal or folded scalar
334
+ 'block-scalar-header': [
335
+ # indentation indicator followed by chomping flag
336
+ (r'([1-9])?[+-]?(?=[ ]|$)',
337
+ set_block_scalar_indent(Punctuation.Indicator),
338
+ 'ignored-line'),
339
+ # chomping flag followed by indentation indicator
340
+ (r'[+-]?([1-9])?(?=[ ]|$)',
341
+ set_block_scalar_indent(Punctuation.Indicator),
342
+ 'ignored-line'),
343
+ ],
344
+
345
+ # ignored and regular whitespaces in quoted scalars
346
+ 'quoted-scalar-whitespaces': [
347
+ # leading and trailing whitespaces are ignored
348
+ (r'^[ ]+', Whitespace),
349
+ (r'[ ]+$', Whitespace),
350
+ # line breaks are ignored
351
+ (r'\n+', Whitespace),
352
+ # other whitespaces are a part of the value
353
+ (r'[ \xa0]+', Name.Variable),
354
+ ],
355
+
356
+ # single-quoted scalars
357
+ 'single-quoted-scalar': [
358
+ # include whitespace and line break rules
359
+ include('quoted-scalar-whitespaces'),
360
+ # escaping of the quote character
361
+ (r'\'\'', String.Escape),
362
+ # regular non-whitespace characters
363
+ (r'[^\s\']+', String),
364
+ # the closing quote
365
+ (r'\'', String, '#pop'),
366
+ ],
367
+
368
+ # double-quoted scalars
369
+ 'double-quoted-scalar': [
370
+ # include whitespace and line break rules
371
+ include('quoted-scalar-whitespaces'),
372
+ # escaping of special characters
373
+ (r'\\[0abt\tn\nvfre "\\N_LP]', String),
374
+ # escape codes
375
+ (r'\\(?:x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})',
376
+ String.Escape),
377
+ # regular non-whitespace characters
378
+ (r'[^\s"\\]+', String),
379
+ # the closing quote
380
+ (r'"', String, '#pop'),
381
+ ],
382
+
383
+ # the beginning of a new line while scanning a plain scalar
384
+ 'plain-scalar-in-block-context-new-line': [
385
+ # empty lines
386
+ (r'^[ ]+$', Whitespace),
387
+ # line breaks
388
+ (r'\n+', Whitespace),
389
+ # document start and document end indicators
390
+ (r'^(?=---|\.\.\.)', something(Name.Namespace), '#pop:3'),
391
+ # indentation spaces (we may leave the block line state here)
392
+ (r'^[ ]*', parse_plain_scalar_indent(Whitespace), '#pop'),
393
+ ],
394
+
395
+ # a plain scalar in the block context
396
+ 'plain-scalar-in-block-context': [
397
+ # the scalar ends with the ':' indicator
398
+ (r'[ ]*(?=:[ ]|:$)', something(Whitespace), '#pop'),
399
+ # the scalar ends with whitespaces followed by a comment
400
+ (r'[ ]+(?=#)', Whitespace, '#pop'),
401
+ # trailing whitespaces are ignored
402
+ (r'[ ]+$', Whitespace),
403
+ # line breaks are ignored
404
+ (r'\n+', Whitespace, 'plain-scalar-in-block-context-new-line'),
405
+ # other whitespaces are a part of the value
406
+ (r'[ \xa0]+', Literal.Scalar.Plain),
407
+ # regular non-whitespace characters
408
+ (r'(?::(?!\s)|[^\s:])+', Literal.Scalar.Plain),
409
+ ],
410
+
411
+ # a plain scalar is the flow context
412
+ 'plain-scalar-in-flow-context': [
413
+ # the scalar ends with an indicator character
414
+ (r'[ ]*(?=[,:?\[\]{}])', something(Whitespace), '#pop'),
415
+ # the scalar ends with a comment
416
+ (r'[ ]+(?=#)', Whitespace, '#pop'),
417
+ # leading and trailing whitespaces are ignored
418
+ (r'^[ ]+', Whitespace),
419
+ (r'[ ]+$', Whitespace),
420
+ # line breaks are ignored
421
+ (r'\n+', Whitespace),
422
+ # other whitespaces are a part of the value
423
+ (r'[ \xa0]+', Name.Variable),
424
+ # regular non-whitespace characters
425
+ (r'[^\s,:?\[\]{}]+', Name.Variable),
426
+ ],
427
+
428
+ }
429
+
430
+ def get_tokens_unprocessed(self, text=None, context=None):
431
+ if context is None:
432
+ context = YamlLexerContext(text, 0)
433
+ return super().get_tokens_unprocessed(text, context)
434
+
435
+
436
+ class JsonLexer(Lexer):
437
+ """
438
+ For JSON data structures.
439
+
440
+ Javascript-style comments are supported (like ``/* */`` and ``//``),
441
+ though comments are not part of the JSON specification.
442
+ This allows users to highlight JSON as it is used in the wild.
443
+
444
+ No validation is performed on the input JSON document.
445
+ """
446
+
447
+ name = 'JSON'
448
+ url = 'https://www.json.org'
449
+ aliases = ['json', 'json-object']
450
+ filenames = ['*.json', '*.jsonl', '*.ndjson', 'Pipfile.lock', '*.module', '*.xc']
451
+ mimetypes = ['application/json', 'application/json-object', 'application/x-ndjson', 'application/jsonl', 'application/json-seq']
452
+ version_added = '1.5'
453
+
454
+ # No validation of integers, floats, or constants is done.
455
+ # As long as the characters are members of the following
456
+ # sets, the token will be considered valid. For example,
457
+ #
458
+ # "--1--" is parsed as an integer
459
+ # "1...eee" is parsed as a float
460
+ # "trustful" is parsed as a constant
461
+ #
462
+ integers = set('-0123456789')
463
+ floats = set('.eE+')
464
+ constants = set('truefalsenull') # true|false|null
465
+ hexadecimals = set('0123456789abcdefABCDEF')
466
+ punctuations = set('{}[],')
467
+ whitespaces = {'\u0020', '\u000a', '\u000d', '\u0009'}
468
+
469
+ def get_tokens_unprocessed(self, text):
470
+ """Parse JSON data."""
471
+
472
+ in_string = False
473
+ in_escape = False
474
+ in_unicode_escape = 0
475
+ in_whitespace = False
476
+ in_constant = False
477
+ in_number = False
478
+ in_float = False
479
+ in_punctuation = False
480
+ in_comment_single = False
481
+ in_comment_multiline = False
482
+ expecting_second_comment_opener = False # // or /*
483
+ expecting_second_comment_closer = False # */
484
+
485
+ start = 0
486
+
487
+ # The queue is used to store data that may need to be tokenized
488
+ # differently based on what follows. In particular, JSON object
489
+ # keys are tokenized differently than string values, but cannot
490
+ # be distinguished until punctuation is encountered outside the
491
+ # string.
492
+ #
493
+ # A ":" character after the string indicates that the string is
494
+ # an object key; any other character indicates the string is a
495
+ # regular string value.
496
+ #
497
+ # The queue holds tuples that contain the following data:
498
+ #
499
+ # (start_index, token_type, text)
500
+ #
501
+ # By default the token type of text in double quotes is
502
+ # String.Double. The token type will be replaced if a colon
503
+ # is encountered after the string closes.
504
+ #
505
+ queue = []
506
+
507
+ for stop, character in enumerate(text):
508
+ if in_string:
509
+ if in_unicode_escape:
510
+ if character in self.hexadecimals:
511
+ in_unicode_escape -= 1
512
+ if not in_unicode_escape:
513
+ in_escape = False
514
+ else:
515
+ in_unicode_escape = 0
516
+ in_escape = False
517
+
518
+ elif in_escape:
519
+ if character == 'u':
520
+ in_unicode_escape = 4
521
+ else:
522
+ in_escape = False
523
+
524
+ elif character == '\\':
525
+ in_escape = True
526
+
527
+ elif character == '"':
528
+ queue.append((start, String.Double, text[start:stop + 1]))
529
+ in_string = False
530
+ in_escape = False
531
+ in_unicode_escape = 0
532
+
533
+ continue
534
+
535
+ elif in_whitespace:
536
+ if character in self.whitespaces:
537
+ continue
538
+
539
+ if queue:
540
+ queue.append((start, Whitespace, text[start:stop]))
541
+ else:
542
+ yield start, Whitespace, text[start:stop]
543
+ in_whitespace = False
544
+ # Fall through so the new character can be evaluated.
545
+
546
+ elif in_constant:
547
+ if character in self.constants:
548
+ continue
549
+
550
+ yield start, Keyword.Constant, text[start:stop]
551
+ in_constant = False
552
+ # Fall through so the new character can be evaluated.
553
+
554
+ elif in_number:
555
+ if character in self.integers:
556
+ continue
557
+ elif character in self.floats:
558
+ in_float = True
559
+ continue
560
+
561
+ if in_float:
562
+ yield start, Number.Float, text[start:stop]
563
+ else:
564
+ yield start, Number.Integer, text[start:stop]
565
+ in_number = False
566
+ in_float = False
567
+ # Fall through so the new character can be evaluated.
568
+
569
+ elif in_punctuation:
570
+ if character in self.punctuations:
571
+ continue
572
+
573
+ yield start, Punctuation, text[start:stop]
574
+ in_punctuation = False
575
+ # Fall through so the new character can be evaluated.
576
+
577
+ elif in_comment_single:
578
+ if character != '\n':
579
+ continue
580
+
581
+ if queue:
582
+ queue.append((start, Comment.Single, text[start:stop]))
583
+ else:
584
+ yield start, Comment.Single, text[start:stop]
585
+
586
+ in_comment_single = False
587
+ # Fall through so the new character can be evaluated.
588
+
589
+ elif in_comment_multiline:
590
+ if character == '*':
591
+ expecting_second_comment_closer = True
592
+ elif expecting_second_comment_closer:
593
+ expecting_second_comment_closer = False
594
+ if character == '/':
595
+ if queue:
596
+ queue.append((start, Comment.Multiline, text[start:stop + 1]))
597
+ else:
598
+ yield start, Comment.Multiline, text[start:stop + 1]
599
+
600
+ in_comment_multiline = False
601
+
602
+ continue
603
+
604
+ elif expecting_second_comment_opener:
605
+ expecting_second_comment_opener = False
606
+ if character == '/':
607
+ in_comment_single = True
608
+ continue
609
+ elif character == '*':
610
+ in_comment_multiline = True
611
+ continue
612
+
613
+ # Exhaust the queue. Accept the existing token types.
614
+ yield from queue
615
+ queue.clear()
616
+
617
+ yield start, Error, text[start:stop]
618
+ # Fall through so the new character can be evaluated.
619
+
620
+ start = stop
621
+
622
+ if character == '"':
623
+ in_string = True
624
+
625
+ elif character in self.whitespaces:
626
+ in_whitespace = True
627
+
628
+ elif character in {'f', 'n', 't'}: # The first letters of true|false|null
629
+ # Exhaust the queue. Accept the existing token types.
630
+ yield from queue
631
+ queue.clear()
632
+
633
+ in_constant = True
634
+
635
+ elif character in self.integers:
636
+ # Exhaust the queue. Accept the existing token types.
637
+ yield from queue
638
+ queue.clear()
639
+
640
+ in_number = True
641
+
642
+ elif character == ':':
643
+ # Yield from the queue. Replace string token types.
644
+ for _start, _token, _text in queue:
645
+ # There can be only three types of tokens before a ':':
646
+ # Whitespace, Comment, or a quoted string.
647
+ #
648
+ # If it's a quoted string we emit Name.Tag.
649
+ # Otherwise, we yield the original token.
650
+ #
651
+ # In all other cases this would be invalid JSON,
652
+ # but this is not a validating JSON lexer, so it's OK.
653
+ if _token is String.Double:
654
+ yield _start, Name.Tag, _text
655
+ else:
656
+ yield _start, _token, _text
657
+ queue.clear()
658
+
659
+ in_punctuation = True
660
+
661
+ elif character in self.punctuations:
662
+ # Exhaust the queue. Accept the existing token types.
663
+ yield from queue
664
+ queue.clear()
665
+
666
+ in_punctuation = True
667
+
668
+ elif character == '/':
669
+ # This is the beginning of a comment.
670
+ expecting_second_comment_opener = True
671
+
672
+ else:
673
+ # Exhaust the queue. Accept the existing token types.
674
+ yield from queue
675
+ queue.clear()
676
+
677
+ yield start, Error, character
678
+
679
+ # Yield any remaining text.
680
+ yield from queue
681
+ if in_string:
682
+ yield start, Error, text[start:]
683
+ elif in_float:
684
+ yield start, Number.Float, text[start:]
685
+ elif in_number:
686
+ yield start, Number.Integer, text[start:]
687
+ elif in_constant:
688
+ yield start, Keyword.Constant, text[start:]
689
+ elif in_whitespace:
690
+ yield start, Whitespace, text[start:]
691
+ elif in_punctuation:
692
+ yield start, Punctuation, text[start:]
693
+ elif in_comment_single:
694
+ yield start, Comment.Single, text[start:]
695
+ elif in_comment_multiline:
696
+ yield start, Error, text[start:]
697
+ elif expecting_second_comment_opener:
698
+ yield start, Error, text[start:]
699
+
700
+
701
+ class JsonBareObjectLexer(JsonLexer):
702
+ """
703
+ For JSON data structures (with missing object curly braces).
704
+
705
+ .. deprecated:: 2.8.0
706
+
707
+ Behaves the same as `JsonLexer` now.
708
+ """
709
+
710
+ name = 'JSONBareObject'
711
+ aliases = []
712
+ filenames = []
713
+ mimetypes = []
714
+ version_added = '2.2'
715
+
716
+
717
+ class JsonLdLexer(JsonLexer):
718
+ """
719
+ For JSON-LD linked data.
720
+ """
721
+
722
+ name = 'JSON-LD'
723
+ url = 'https://json-ld.org/'
724
+ aliases = ['jsonld', 'json-ld']
725
+ filenames = ['*.jsonld']
726
+ mimetypes = ['application/ld+json']
727
+ version_added = '2.0'
728
+
729
+ json_ld_keywords = {
730
+ f'"@{keyword}"'
731
+ for keyword in (
732
+ 'base',
733
+ 'container',
734
+ 'context',
735
+ 'direction',
736
+ 'graph',
737
+ 'id',
738
+ 'import',
739
+ 'included',
740
+ 'index',
741
+ 'json',
742
+ 'language',
743
+ 'list',
744
+ 'nest',
745
+ 'none',
746
+ 'prefix',
747
+ 'propagate',
748
+ 'protected',
749
+ 'reverse',
750
+ 'set',
751
+ 'type',
752
+ 'value',
753
+ 'version',
754
+ 'vocab',
755
+ )
756
+ }
757
+
758
+ def get_tokens_unprocessed(self, text):
759
+ for start, token, value in super().get_tokens_unprocessed(text):
760
+ if token is Name.Tag and value in self.json_ld_keywords:
761
+ yield start, Name.Decorator, value
762
+ else:
763
+ yield start, token, value
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/dax.py ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.dax
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for LilyPond.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words
12
+ from pygments.token import Comment, Punctuation, Whitespace,\
13
+ Name, Operator, String, Number, Text
14
+
15
+ __all__ = ['DaxLexer']
16
+
17
+
18
+ class DaxLexer(RegexLexer):
19
+ """
20
+ Lexer for Power BI DAX
21
+ Referenced from: https://github.com/sql-bi/SyntaxHighlighterBrushDax
22
+ """
23
+ name = 'Dax'
24
+ aliases = ['dax']
25
+ filenames = ['*.dax']
26
+ url = 'https://learn.microsoft.com/en-us/dax/dax-function-reference'
27
+ mimetypes = []
28
+ version_added = '2.15'
29
+
30
+ tokens = {
31
+ 'root': [
32
+ (r'\s+', Whitespace),
33
+ (r"--.*\n?", Comment.Single), # Comment: Double dash comment
34
+ (r"//.*\n?", Comment.Single), # Comment: Double backslash comment
35
+ (r'/\*', Comment.Multiline, 'multiline-comments'),
36
+ (words(('abs', 'accrint', 'accrintm', 'acos', 'acosh', 'acot', 'acoth',
37
+ 'addcolumns', 'addmissingitems', 'all', 'allcrossfiltered',
38
+ 'allexcept', 'allnoblankrow', 'allselected', 'amordegrc', 'amorlinc',
39
+ 'and','approximatedistinctcount', 'asin', 'asinh', 'atan', 'atanh',
40
+ 'average', 'averagea', 'averagex', 'beta.dist', 'beta.inv',
41
+ 'bitand', 'bitlshift', 'bitor', 'bitrshift', 'bitxor', 'blank',
42
+ 'calculate', 'calculatetable', 'calendar', 'calendarauto', 'ceiling',
43
+ 'chisq.dist', 'chisq.dist.rt', 'chisq.inv', 'chisq.inv.rt',
44
+ 'closingbalancemonth', 'closingbalancequarter', 'closingbalanceyear',
45
+ 'coalesce', 'columnstatistics', 'combin', 'combina', 'combinevalues',
46
+ 'concatenate', 'concatenatex', 'confidence.norm', 'confidence.t',
47
+ 'contains', 'containsrow', 'containsstring', 'containsstringexact',
48
+ 'convert', 'cos', 'cosh', 'cot', 'coth', 'count', 'counta', 'countax',
49
+ 'countblank', 'countrows', 'countx', 'coupdaybs', 'coupdays',
50
+ 'coupdaysnc', 'coupncd', 'coupnum', 'couppcd', 'crossfilter',
51
+ 'crossjoin', 'cumipmt', 'cumprinc', 'currency', 'currentgroup',
52
+ 'customdata', 'datatable', 'date', 'dateadd', 'datediff',
53
+ 'datesbetween', 'datesinperiod', 'datesmtd', 'datesqtd',
54
+ 'datesytd', 'datevalue', 'day', 'db', 'ddb', 'degrees', 'detailrows',
55
+ 'disc', 'distinct', 'distinctcount', 'distinctcountnoblank',
56
+ 'divide', 'dollarde', 'dollarfr', 'duration', 'earlier', 'earliest',
57
+ 'edate', 'effect', 'endofmonth', 'endofquarter', 'endofyear',
58
+ 'eomonth', 'error', 'evaluateandlog', 'even', 'exact', 'except',
59
+ 'exp', 'expon.dist', 'fact', 'false', 'filter', 'filters', 'find',
60
+ 'firstdate', 'firstnonblank', 'firstnonblankvalue', 'fixed', 'floor',
61
+ 'format', 'fv', 'gcd', 'generate', 'generateall', 'generateseries',
62
+ 'geomean', 'geomeanx', 'groupby', 'hash', 'hasonefilter',
63
+ 'hasonevalue', 'hour', 'if', 'if.eager', 'iferror', 'ignore', 'index',
64
+ 'int', 'intersect', 'intrate', 'ipmt', 'isafter', 'isblank',
65
+ 'iscrossfiltered', 'isempty', 'iserror', 'iseven', 'isfiltered',
66
+ 'isinscope', 'islogical', 'isnontext', 'isnumber', 'iso.ceiling',
67
+ 'isodd', 'isonorafter', 'ispmt', 'isselectedmeasure', 'issubtotal',
68
+ 'istext', 'keepfilters', 'keywordmatch', 'lastdate', 'lastnonblank',
69
+ 'lastnonblankvalue', 'lcm', 'left', 'len', 'linest', 'linestx', 'ln',
70
+ 'log', 'log10', 'lookupvalue', 'lower', 'max', 'maxa', 'maxx',
71
+ 'mduration', 'median', 'medianx', 'mid', 'min', 'mina', 'minute',
72
+ 'minx', 'mod', 'month', 'mround', 'nameof', 'naturalinnerjoin',
73
+ 'naturalleftouterjoin', 'networkdays', 'nextday', 'nextmonth',
74
+ 'nextquarter', 'nextyear', 'nominal', 'nonvisual', 'norm.dist',
75
+ 'norm.inv', 'norm.s.dist', 'norm.s.inv', 'not', 'now', 'nper', 'odd',
76
+ 'oddfprice', 'oddfyield', 'oddlprice', 'oddlyield', 'offset',
77
+ 'openingbalancemonth', 'openingbalancequarter', 'openingbalanceyear',
78
+ 'or', 'orderby', 'parallelperiod', 'partitionby', 'path',
79
+ 'pathcontains', 'pathitem', 'pathitemreverse', 'pathlength',
80
+ 'pduration', 'percentile.exc', 'percentile.inc', 'percentilex.exc',
81
+ 'percentilex.inc', 'permut', 'pi', 'pmt', 'poisson.dist', 'power',
82
+ 'ppmt', 'previousday', 'previousmonth', 'previousquarter',
83
+ 'previousyear', 'price', 'pricedisc', 'pricemat', 'product',
84
+ 'productx', 'pv', 'quarter', 'quotient', 'radians', 'rand',
85
+ 'randbetween', 'rank.eq', 'rankx', 'rate', 'received', 'related',
86
+ 'relatedtable', 'removefilters', 'replace', 'rept', 'right',
87
+ 'rollup', 'rollupaddissubtotal', 'rollupgroup', 'rollupissubtotal',
88
+ 'round', 'rounddown', 'roundup', 'row', 'rri', 'sameperiodlastyear',
89
+ 'sample', 'sampleaxiswithlocalminmax', 'search', 'second',
90
+ 'selectcolumns', 'selectedmeasure', 'selectedmeasureformatstring',
91
+ 'selectedmeasurename', 'selectedvalue', 'sign', 'sin', 'sinh', 'sln',
92
+ 'sqrt', 'sqrtpi', 'startofmonth', 'startofquarter', 'startofyear',
93
+ 'stdev.p', 'stdev.s', 'stdevx.p', 'stdevx.s', 'substitute',
94
+ 'substitutewithindex', 'sum', 'summarize', 'summarizecolumns', 'sumx',
95
+ 'switch', 'syd', 't.dist', 't.dist.2t', 't.dist.rt', 't.inv',
96
+ 't.inv.2t', 'tan', 'tanh', 'tbilleq', 'tbillprice', 'tbillyield',
97
+ 'time', 'timevalue', 'tocsv', 'today', 'tojson', 'topn',
98
+ 'topnperlevel', 'topnskip', 'totalmtd', 'totalqtd', 'totalytd',
99
+ 'treatas', 'trim', 'true', 'trunc', 'unichar', 'unicode', 'union',
100
+ 'upper', 'userculture', 'userelationship', 'username', 'userobjectid',
101
+ 'userprincipalname', 'utcnow', 'utctoday', 'value', 'values', 'var.p',
102
+ 'var.s', 'varx.p', 'varx.s', 'vdb', 'weekday', 'weeknum', 'window',
103
+ 'xirr', 'xnpv', 'year', 'yearfrac', 'yield', 'yielddisc', 'yieldmat'),
104
+ prefix=r'(?i)', suffix=r'\b'), Name.Function), #Functions
105
+
106
+ (words(('at','asc','boolean','both','by','create','currency',
107
+ 'datetime','day','define','desc','double',
108
+ 'evaluate','false','integer','measure',
109
+ 'month','none','order','return','single','start','string',
110
+ 'table','true','var','year'),
111
+ prefix=r'(?i)', suffix=r'\b'), Name.Builtin), # Keyword
112
+
113
+ (r':=|[-+*\/=^]', Operator),
114
+ (r'\b(IN|NOT)\b', Operator.Word),
115
+ (r'"', String, 'string'), #StringLiteral
116
+ (r"'(?:[^']|'')*'(?!')(?:\[[ \w]+\])?|\w+\[[ \w]+\]",
117
+ Name.Attribute), # Column reference
118
+ (r"\[[ \w]+\]", Name.Attribute), #Measure reference
119
+ (r'(?<!\w)(\d+\.?\d*|\.\d+\b)', Number),# Number
120
+ (r'[\[\](){}`,.]', Punctuation), #Parenthesis
121
+ (r'.*\n', Text),
122
+
123
+ ],
124
+ 'multiline-comments': [
125
+ (r'/\*', Comment.Multiline, 'multiline-comments'),
126
+ (r'\*/', Comment.Multiline, '#pop'),
127
+ (r'[^/*]+', Comment.Multiline),
128
+ (r'[/*]', Comment.Multiline)
129
+ ],
130
+ 'string': [
131
+ (r'""', String.Escape),
132
+ (r'"', String, '#pop'),
133
+ (r'[^"]+', String),
134
+ ]
135
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/devicetree.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.devicetree
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Devicetree language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, include, default, words
12
+ from pygments.token import Comment, Keyword, Name, Number, Operator, \
13
+ Punctuation, String, Text, Whitespace
14
+
15
+ __all__ = ['DevicetreeLexer']
16
+
17
+
18
+ class DevicetreeLexer(RegexLexer):
19
+ """
20
+ Lexer for Devicetree files.
21
+ """
22
+
23
+ name = 'Devicetree'
24
+ url = 'https://www.devicetree.org/'
25
+ aliases = ['devicetree', 'dts']
26
+ filenames = ['*.dts', '*.dtsi']
27
+ mimetypes = ['text/x-c']
28
+ version_added = '2.7'
29
+
30
+ #: optional Whitespace or /*...*/ style comment
31
+ _ws = r'\s*(?:/[*][^*/]*?[*]/\s*)*'
32
+
33
+ tokens = {
34
+ 'macro': [
35
+ # Include preprocessor directives (C style):
36
+ (r'(#include)(' + _ws + r')([^\n]+)',
37
+ bygroups(Comment.Preproc, Comment.Multiline, Comment.PreprocFile)),
38
+ # Define preprocessor directives (C style):
39
+ (r'(#define)(' + _ws + r')([^\n]+)',
40
+ bygroups(Comment.Preproc, Comment.Multiline, Comment.Preproc)),
41
+ # devicetree style with file:
42
+ (r'(/[^*/{]+/)(' + _ws + r')("[^\n{]+")',
43
+ bygroups(Comment.Preproc, Comment.Multiline, Comment.PreprocFile)),
44
+ # devicetree style with property:
45
+ (r'(/[^*/{]+/)(' + _ws + r')([^\n;{]*)([;]?)',
46
+ bygroups(Comment.Preproc, Comment.Multiline, Comment.Preproc, Punctuation)),
47
+ ],
48
+ 'whitespace': [
49
+ (r'\n', Whitespace),
50
+ (r'\s+', Whitespace),
51
+ (r'\\\n', Text), # line continuation
52
+ (r'//(\n|[\w\W]*?[^\\]\n)', Comment.Single),
53
+ (r'/(\\\n)?[*][\w\W]*?[*](\\\n)?/', Comment.Multiline),
54
+ # Open until EOF, so no ending delimiter
55
+ (r'/(\\\n)?[*][\w\W]*', Comment.Multiline),
56
+ ],
57
+ 'statements': [
58
+ (r'(L?)(")', bygroups(String.Affix, String), 'string'),
59
+ (r'0x[0-9a-fA-F]+', Number.Hex),
60
+ (r'\d+', Number.Integer),
61
+ (r'([^\s{}/*]*)(\s*)(:)', bygroups(Name.Label, Text, Punctuation), '#pop'),
62
+ (words(('compatible', 'model', 'phandle', 'status', '#address-cells',
63
+ '#size-cells', 'reg', 'virtual-reg', 'ranges', 'dma-ranges',
64
+ 'device_type', 'name'), suffix=r'\b'), Keyword.Reserved),
65
+ (r'([~!%^&*+=|?:<>/#-])', Operator),
66
+ (r'[(){},.\]]', Punctuation),
67
+ (r'\[', Punctuation, 'bytestring'),
68
+ (r'[a-zA-Z_][\w-]*(?=(?:\s*,' + _ws + r'[a-zA-Z_][\w-]*)*' + _ws + r'[=;])',
69
+ Name),
70
+ (r'[a-zA-Z_]\w*', Name.Attribute),
71
+ ],
72
+ 'root': [
73
+ include('whitespace'),
74
+ include('macro'),
75
+ # Overlay/fragment: &label { ... } or &{/path/to/node} { ... }
76
+ (r'(&)(?:([A-Za-z_]\w*)|(\{)([^}]+)(\}))(' + _ws + r')(\{)',
77
+ bygroups(Operator, Name.Function, Punctuation, Name.Namespace,
78
+ Punctuation, Comment.Multiline, Punctuation), 'node'),
79
+ # Nodes
80
+ (r'([^/*@\s&]+|/)(@?)((?:0x)?[0-9a-fA-F,]*)(' + _ws + r')(\{)',
81
+ bygroups(Name.Function, Operator, Number.Integer,
82
+ Comment.Multiline, Punctuation), 'node'),
83
+
84
+ default('statement'),
85
+ ],
86
+ 'statement': [
87
+ include('whitespace'),
88
+ include('statements'),
89
+ (';', Punctuation, '#pop'),
90
+ ],
91
+ 'node': [
92
+ include('whitespace'),
93
+ include('macro'),
94
+ # Overlay/fragment: &label { ... } or &{/path/to/node} { ... }
95
+ (r'(&)(?:([A-Za-z_]\w*)|(\{)([^}]+)(\}))(' + _ws + r')(\{)',
96
+ bygroups(Operator, Name.Function, Punctuation, Name.Namespace,
97
+ Punctuation, Comment.Multiline, Punctuation), '#push'),
98
+ (r'([^/*@\s&]+|/)(@?)((?:0x)?[0-9a-fA-F,]*)(' + _ws + r')(\{)',
99
+ bygroups(Name.Function, Operator, Number.Integer,
100
+ Comment.Multiline, Punctuation), '#push'),
101
+
102
+ include('statements'),
103
+
104
+ (r'\};', Punctuation, '#pop'),
105
+ (';', Punctuation),
106
+ ],
107
+ 'string': [
108
+ (r'"', String, '#pop'),
109
+ (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|'
110
+ r'u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})', String.Escape),
111
+ (r'[^\\"\n]+', String), # all other characters
112
+ (r'\\\n', String), # line continuation
113
+ (r'\\', String), # stray backslash
114
+ ],
115
+ 'bytestring': [
116
+ (r'\]', Punctuation, '#pop'),
117
+ (r'[0-9a-fA-F]{2}', Number.Hex),
118
+ (r'\s+', Whitespace),
119
+ ],
120
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/diff.py ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.diff
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for diff/patch formats.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, Generic, \
15
+ Literal, Whitespace
16
+
17
+ __all__ = ['DiffLexer', 'DarcsPatchLexer', 'WDiffLexer']
18
+
19
+
20
+ class DiffLexer(RegexLexer):
21
+ """
22
+ Lexer for unified or context-style diffs or patches.
23
+ """
24
+
25
+ name = 'Diff'
26
+ aliases = ['diff', 'udiff']
27
+ filenames = ['*.diff', '*.patch']
28
+ mimetypes = ['text/x-diff', 'text/x-patch']
29
+ url = 'https://en.wikipedia.org/wiki/Diff'
30
+ version_added = ''
31
+
32
+ tokens = {
33
+ 'root': [
34
+ (r'( )(.*)(\n)', bygroups(Whitespace, Text, Whitespace)),
35
+ (r'(!.*|---)(\n)', bygroups(Generic.Strong, Whitespace)),
36
+ (r'((?:< |-).*)(\n)', bygroups(Generic.Deleted, Whitespace)),
37
+ (r'((?:> |\+).*)(\n)', bygroups(Generic.Inserted, Whitespace)),
38
+ (
39
+ r'(@.*|\d(?:,\d+)?(?:a|c|d)\d+(?:,\d+)?)(\n)',
40
+ bygroups(Generic.Subheading, Whitespace),
41
+ ),
42
+ (r'((?:[Ii]ndex|diff).*)(\n)', bygroups(Generic.Heading, Whitespace)),
43
+ (r'(=.*)(\n)', bygroups(Generic.Heading, Whitespace)),
44
+ (r'(.*)(\n)', bygroups(Text, Whitespace)),
45
+ ]
46
+ }
47
+
48
+ def analyse_text(text):
49
+ if text[:7] == 'Index: ':
50
+ return True
51
+ if text[:5] == 'diff ':
52
+ return True
53
+ if text[:4] == '--- ':
54
+ return 0.9
55
+
56
+
57
+ class DarcsPatchLexer(RegexLexer):
58
+ """
59
+ DarcsPatchLexer is a lexer for the various versions of the darcs patch
60
+ format. Examples of this format are derived by commands such as
61
+ ``darcs annotate --patch`` and ``darcs send``.
62
+ """
63
+
64
+ name = 'Darcs Patch'
65
+ aliases = ['dpatch']
66
+ filenames = ['*.dpatch', '*.darcspatch']
67
+ url = 'https://darcs.net'
68
+ version_added = '0.10'
69
+
70
+ DPATCH_KEYWORDS = ('hunk', 'addfile', 'adddir', 'rmfile', 'rmdir', 'move',
71
+ 'replace')
72
+
73
+ tokens = {
74
+ 'root': [
75
+ (r'<', Operator),
76
+ (r'>', Operator),
77
+ (r'\{', Operator),
78
+ (r'\}', Operator),
79
+ (r'(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)(\])',
80
+ bygroups(Operator, Keyword, Name, Whitespace, Name, Operator,
81
+ Literal.Date, Whitespace, Operator)),
82
+ (r'(\[)((?:TAG )?)(.*)(\n)(.*)(\*\*)(\d+)(\s?)',
83
+ bygroups(Operator, Keyword, Name, Whitespace, Name, Operator,
84
+ Literal.Date, Whitespace), 'comment'),
85
+ (r'New patches:', Generic.Heading),
86
+ (r'Context:', Generic.Heading),
87
+ (r'Patch bundle hash:', Generic.Heading),
88
+ (r'(\s*)({})(.*)(\n)'.format('|'.join(DPATCH_KEYWORDS)),
89
+ bygroups(Whitespace, Keyword, Text, Whitespace)),
90
+ (r'\+', Generic.Inserted, "insert"),
91
+ (r'-', Generic.Deleted, "delete"),
92
+ (r'(.*)(\n)', bygroups(Text, Whitespace)),
93
+ ],
94
+ 'comment': [
95
+ (r'[^\]].*\n', Comment),
96
+ (r'\]', Operator, "#pop"),
97
+ ],
98
+ 'specialText': [ # darcs add [_CODE_] special operators for clarity
99
+ (r'\n', Whitespace, "#pop"), # line-based
100
+ (r'\[_[^_]*_]', Operator),
101
+ ],
102
+ 'insert': [
103
+ include('specialText'),
104
+ (r'\[', Generic.Inserted),
105
+ (r'[^\n\[]+', Generic.Inserted),
106
+ ],
107
+ 'delete': [
108
+ include('specialText'),
109
+ (r'\[', Generic.Deleted),
110
+ (r'[^\n\[]+', Generic.Deleted),
111
+ ],
112
+ }
113
+
114
+
115
+ class WDiffLexer(RegexLexer):
116
+ """
117
+ A wdiff lexer.
118
+
119
+ Note that:
120
+
121
+ * It only works with normal output (without options like ``-l``).
122
+ * If the target files contain "[-", "-]", "{+", or "+}",
123
+ especially they are unbalanced, the lexer will get confused.
124
+ """
125
+
126
+ name = 'WDiff'
127
+ url = 'https://www.gnu.org/software/wdiff/'
128
+ aliases = ['wdiff']
129
+ filenames = ['*.wdiff']
130
+ mimetypes = []
131
+ version_added = '2.2'
132
+
133
+ flags = re.MULTILINE | re.DOTALL
134
+
135
+ # We can only assume "[-" after "[-" before "-]" is `nested`,
136
+ # for instance wdiff to wdiff outputs. We have no way to
137
+ # distinct these marker is of wdiff output from original text.
138
+
139
+ ins_op = r"\{\+"
140
+ ins_cl = r"\+\}"
141
+ del_op = r"\[\-"
142
+ del_cl = r"\-\]"
143
+ normal = r'[^{}[\]+-]+' # for performance
144
+ tokens = {
145
+ 'root': [
146
+ (ins_op, Generic.Inserted, 'inserted'),
147
+ (del_op, Generic.Deleted, 'deleted'),
148
+ (normal, Text),
149
+ (r'.', Text),
150
+ ],
151
+ 'inserted': [
152
+ (ins_op, Generic.Inserted, '#push'),
153
+ (del_op, Generic.Inserted, '#push'),
154
+ (del_cl, Generic.Inserted, '#pop'),
155
+
156
+ (ins_cl, Generic.Inserted, '#pop'),
157
+ (normal, Generic.Inserted),
158
+ (r'.', Generic.Inserted),
159
+ ],
160
+ 'deleted': [
161
+ (del_op, Generic.Deleted, '#push'),
162
+ (ins_op, Generic.Deleted, '#push'),
163
+ (ins_cl, Generic.Deleted, '#pop'),
164
+
165
+ (del_cl, Generic.Deleted, '#pop'),
166
+ (normal, Generic.Deleted),
167
+ (r'.', Generic.Deleted),
168
+ ],
169
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/dns.py ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.dns
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Pygments lexers for DNS
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
14
+ Number, Punctuation, Whitespace, Literal
15
+ from pygments.lexer import RegexLexer, bygroups, include
16
+
17
+ __all__ = ['DnsZoneLexer']
18
+
19
+
20
+ CLASSES = [
21
+ "IN",
22
+ "CS",
23
+ "CH",
24
+ "HS",
25
+ ]
26
+
27
+ CLASSES_RE = "(" + "|".join(CLASSES) + ')'
28
+
29
+
30
+ class DnsZoneLexer(RegexLexer):
31
+
32
+ """
33
+ Lexer for DNS zone file
34
+ """
35
+
36
+ flags = re.MULTILINE
37
+
38
+ name = 'Zone'
39
+ aliases = ['zone']
40
+ filenames = [ "*.zone" ]
41
+ url = "https://datatracker.ietf.org/doc/html/rfc1035"
42
+ mimetypes = ['text/dns']
43
+ version_added = '2.16'
44
+
45
+ tokens = {
46
+ 'root': [
47
+ # Empty/comment line:
48
+ (r'([ \t]*)(;.*)(\n)', bygroups(Whitespace, Comment.Single, Whitespace)),
49
+ # Special directives:
50
+ (r'^\$ORIGIN\b', Keyword, 'values'),
51
+ (r'^\$TTL\b', Keyword, 'values'),
52
+ (r'^\$INCLUDE\b', Comment.Preproc, 'include'),
53
+ # TODO, $GENERATE https://bind9.readthedocs.io/en/v9.18.14/chapter3.html#soa-rr
54
+ (r'^\$[A-Z]+\b', Keyword, 'values'),
55
+ # Records:
56
+ # <domain-name> [<TTL>] [<class>] <type> <RDATA> [<comment>]
57
+ (r'^(@)([ \t]+)(?:([0-9]+[smhdw]?)([ \t]+))?(?:' + CLASSES_RE + "([ \t]+))?([A-Z]+)([ \t]+)",
58
+ bygroups(Operator, Whitespace, Number.Integer, Whitespace, Name.Class, Whitespace, Keyword.Type, Whitespace),
59
+ "values"),
60
+ (r'^([^ \t\n]*)([ \t]+)(?:([0-9]+[smhdw]?)([ \t]+))?(?:' + CLASSES_RE + "([ \t]+))?([A-Z]+)([ \t]+)",
61
+ bygroups(Name, Whitespace, Number.Integer, Whitespace, Name.Class, Whitespace, Keyword.Type, Whitespace),
62
+ "values"),
63
+ # <domain-name> [<class>] [<TTL>] <type> <RDATA> [<comment>]
64
+ (r'^(Operator)([ \t]+)(?:' + CLASSES_RE + "([ \t]+))?(?:([0-9]+[smhdw]?)([ \t]+))?([A-Z]+)([ \t]+)",
65
+ bygroups(Name, Whitespace, Number.Integer, Whitespace, Name.Class, Whitespace, Keyword.Type, Whitespace),
66
+ "values"),
67
+ (r'^([^ \t\n]*)([ \t]+)(?:' + CLASSES_RE + "([ \t]+))?(?:([0-9]+[smhdw]?)([ \t]+))?([A-Z]+)([ \t]+)",
68
+ bygroups(Name, Whitespace, Number.Integer, Whitespace, Name.Class, Whitespace, Keyword.Type, Whitespace),
69
+ "values"),
70
+ ],
71
+ # Parsing values:
72
+ 'values': [
73
+ (r'\n', Whitespace, "#pop"),
74
+ (r'\(', Punctuation, 'nested'),
75
+ include('simple-value'),
76
+ ],
77
+ # Parsing nested values (...):
78
+ 'nested': [
79
+ (r'\)', Punctuation, "#pop"),
80
+ include('multiple-simple-values'),
81
+ ],
82
+ # Parsing values:
83
+ 'simple-value': [
84
+ (r'(;.*)', bygroups(Comment.Single)),
85
+ (r'[ \t]+', Whitespace),
86
+ (r"@\b", Operator),
87
+ ('"', String, 'string'),
88
+ (r'[0-9]+[smhdw]?$', Number.Integer),
89
+ (r'([0-9]+[smhdw]?)([ \t]+)', bygroups(Number.Integer, Whitespace)),
90
+ (r'\S+', Literal),
91
+ ],
92
+ 'multiple-simple-values': [
93
+ include('simple-value'),
94
+ (r'[\n]+', Whitespace),
95
+ ],
96
+ 'include': [
97
+ (r'([ \t]+)([^ \t\n]+)([ \t]+)([-\._a-zA-Z]+)([ \t]+)(;.*)?$',
98
+ bygroups(Whitespace, Comment.PreprocFile, Whitespace, Name, Whitespace, Comment.Single), '#pop'),
99
+ (r'([ \t]+)([^ \t\n]+)([ \t\n]+)$', bygroups(Whitespace, Comment.PreprocFile, Whitespace), '#pop'),
100
+ ],
101
+ "string": [
102
+ (r'\\"', String),
103
+ (r'"', String, "#pop"),
104
+ (r'[^"]+', String),
105
+ ]
106
+ }
107
+
108
+ def analyse_text(text):
109
+ return text.startswith("$ORIGIN")
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/dotnet.py ADDED
@@ -0,0 +1,886 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.dotnet
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for .net languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+ import re
11
+
12
+ from pygments.lexer import RegexLexer, DelegatingLexer, bygroups, include, \
13
+ using, this, default, words
14
+ from pygments.token import Punctuation, Text, Comment, Operator, Keyword, \
15
+ Name, String, Number, Literal, Other, Whitespace
16
+ from pygments.util import get_choice_opt
17
+ from pygments import unistring as uni
18
+
19
+ from pygments.lexers.html import XmlLexer
20
+
21
+ __all__ = ['CSharpLexer', 'NemerleLexer', 'BooLexer', 'VbNetLexer',
22
+ 'CSharpAspxLexer', 'VbNetAspxLexer', 'FSharpLexer', 'XppLexer']
23
+
24
+
25
+ class CSharpLexer(RegexLexer):
26
+ """
27
+ For C# source code.
28
+
29
+ Additional options accepted:
30
+
31
+ `unicodelevel`
32
+ Determines which Unicode characters this lexer allows for identifiers.
33
+ The possible values are:
34
+
35
+ * ``none`` -- only the ASCII letters and numbers are allowed. This
36
+ is the fastest selection.
37
+ * ``basic`` -- all Unicode characters from the specification except
38
+ category ``Lo`` are allowed.
39
+ * ``full`` -- all Unicode characters as specified in the C# specs
40
+ are allowed. Note that this means a considerable slowdown since the
41
+ ``Lo`` category has more than 40,000 characters in it!
42
+
43
+ The default value is ``basic``.
44
+
45
+ .. versionadded:: 0.8
46
+ """
47
+
48
+ name = 'C#'
49
+ url = 'https://docs.microsoft.com/en-us/dotnet/csharp/'
50
+ aliases = ['csharp', 'c#', 'cs']
51
+ filenames = ['*.cs']
52
+ mimetypes = ['text/x-csharp'] # inferred
53
+ version_added = ''
54
+
55
+ flags = re.MULTILINE | re.DOTALL
56
+
57
+ # for the range of allowed unicode characters in identifiers, see
58
+ # http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
59
+
60
+ levels = {
61
+ 'none': r'@?[_a-zA-Z]\w*',
62
+ 'basic': ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' +
63
+ '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc',
64
+ 'Cf', 'Mn', 'Mc') + ']*'),
65
+ 'full': ('@?(?:_|[^' +
66
+ uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])' +
67
+ '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
68
+ 'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*'),
69
+ }
70
+
71
+ tokens = {}
72
+ token_variants = True
73
+
74
+ for levelname, cs_ident in levels.items():
75
+ tokens[levelname] = {
76
+ 'root': [
77
+ include('numbers'),
78
+ # method names
79
+ (r'^([ \t]*)((?:' + cs_ident + r'(?:\[\])?\s+)+?)' # return type
80
+ r'(' + cs_ident + ')' # method name
81
+ r'(\s*)(\()', # signature start
82
+ bygroups(Whitespace, using(this), Name.Function, Whitespace,
83
+ Punctuation)),
84
+ (r'^(\s*)(\[.*?\])', bygroups(Whitespace, Name.Attribute)),
85
+ (r'[^\S\n]+', Whitespace),
86
+ (r'(\\)(\n)', bygroups(Text, Whitespace)), # line continuation
87
+ (r'//.*?\n', Comment.Single),
88
+ (r'/[*].*?[*]/', Comment.Multiline),
89
+ (r'\n', Whitespace),
90
+ (words((
91
+ '>>>=', '>>=', '<<=', '<=', '>=', '+=', '-=', '*=', '/=',
92
+ '%=', '&=', '|=', '^=', '??=', '=>', '??', '?.', '!=', '==',
93
+ '&&', '||', '>>>', '>>', '<<', '++', '--', '+', '-', '*',
94
+ '/', '%', '&', '|', '^', '<', '>', '?', '!', '~', '=',
95
+ )), Operator),
96
+ (r'=~|!=|==|<<|>>|[-+/*%=<>&^|]', Operator),
97
+ (r'[()\[\];:,.]', Punctuation),
98
+ (r'[{}]', Punctuation),
99
+ (r'\$*"{3,}.*?"{3,}', String),
100
+ (r'(?:\$@|@\$)"(""|[^"])*"', String),
101
+ (r'@"(""|[^"])*"', String),
102
+ (r'\$?"(\\\\|\\[^\\]|[^"\\\n])*["\n]', String),
103
+ (r"'\\.'|'[^\\]'", String.Char),
104
+ (r"[0-9]+(\.[0-9]*)?([eE][+-][0-9]+)?"
105
+ r"[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?", Number),
106
+ (r'(#)([ \t]*)(if|endif|else|elif|define|undef|'
107
+ r'line|error|warning|region|endregion|pragma)\b(.*?)(\n)',
108
+ bygroups(Comment.Preproc, Whitespace, Comment.Preproc,
109
+ Comment.Preproc, Whitespace)),
110
+ (r'\b(extern)(\s+)(alias)\b', bygroups(Keyword, Whitespace,
111
+ Keyword)),
112
+ (words((
113
+ 'abstract', 'as', 'async', 'await', 'base', 'break', 'by',
114
+ 'case', 'catch', 'checked', 'const', 'continue', 'default',
115
+ 'delegate', 'do', 'else', 'enum', 'event', 'explicit',
116
+ 'extern', 'false', 'finally', 'fixed', 'for', 'foreach',
117
+ 'goto', 'if', 'implicit', 'in', 'interface', 'internal',
118
+ 'is', 'let', 'lock', 'new', 'null', 'on', 'operator',
119
+ 'out', 'override', 'params', 'private', 'protected',
120
+ 'public', 'readonly', 'ref', 'return', 'sealed', 'sizeof',
121
+ 'stackalloc', 'static', 'switch', 'this', 'throw', 'true',
122
+ 'try', 'typeof', 'unchecked', 'unsafe', 'virtual', 'void',
123
+ 'while', 'get', 'set', 'new', 'partial', 'yield', 'add',
124
+ 'remove', 'value', 'alias', 'ascending', 'descending',
125
+ 'from', 'group', 'into', 'orderby', 'select', 'thenby',
126
+ 'where', 'join', 'equals', 'record', 'allows',
127
+ 'and', 'init', 'managed', 'nameof', 'nint', 'not',
128
+ 'notnull', 'nuint', 'or', 'scoped', 'unmanaged', 'when',
129
+ 'with'
130
+ ), suffix=r'\b'), Keyword),
131
+ # version 1: assumes that 'file' is the only contextual keyword
132
+ # that is a class modifier
133
+ (r'(file)(\s+)(record|class|abstract|enum|new|sealed|static)\b',
134
+ bygroups(Keyword, Whitespace, Keyword)),
135
+ (r'(global)(::)', bygroups(Keyword, Punctuation)),
136
+ (r'(bool|byte|char|decimal|double|dynamic|float|int|long|object|'
137
+ r'sbyte|short|string|uint|ulong|ushort|var)\b\??', Keyword.Type),
138
+ (r'(class|struct|union)(\s+)', bygroups(Keyword, Whitespace), 'class'),
139
+ (r'(namespace|using)(\s+)', bygroups(Keyword, Whitespace), 'namespace'),
140
+ (cs_ident, Name),
141
+ ],
142
+ 'numbers_int': [
143
+ (r"0[xX][0-9a-fA-F]+(([uU][lL]?)|[lL][uU]?)?", Number.Hex),
144
+ (r"0[bB][01]+(([uU][lL]?)|[lL][uU]?)?", Number.Bin),
145
+ (r"[0-9]+(([uU][lL]?)|[lL][uU]?)?", Number.Integer),
146
+ ],
147
+ 'numbers_float': [
148
+ (r"([0-9]+\.[0-9]+([eE][+-]?[0-9]+)?[fFdDmM]?)|"
149
+ r"(\.[0-9]+([eE][+-]?[0-9]+)?[fFdDmM]?)|"
150
+ r"([0-9]+([eE][+-]?[0-9]+)[fFdDmM]?)|"
151
+ r"([0-9]+[fFdDmM])", Number.Float),
152
+ ],
153
+ 'numbers': [
154
+ include('numbers_float'),
155
+ include('numbers_int'),
156
+ ],
157
+ 'class': [
158
+ (cs_ident, Name.Class, '#pop'),
159
+ default('#pop'),
160
+ ],
161
+ 'namespace': [
162
+ (r'(?=\()', Text, '#pop'), # using (resource)
163
+ ('(' + cs_ident + r'|\.)+', Name.Namespace, '#pop'),
164
+ ]
165
+ }
166
+
167
+ def __init__(self, **options):
168
+ level = get_choice_opt(options, 'unicodelevel', list(self.tokens), 'basic')
169
+ if level not in self._all_tokens:
170
+ # compile the regexes now
171
+ self._tokens = self.__class__.process_tokendef(level)
172
+ else:
173
+ self._tokens = self._all_tokens[level]
174
+
175
+ RegexLexer.__init__(self, **options)
176
+
177
+
178
+ class NemerleLexer(RegexLexer):
179
+ """
180
+ For Nemerle source code.
181
+
182
+ Additional options accepted:
183
+
184
+ `unicodelevel`
185
+ Determines which Unicode characters this lexer allows for identifiers.
186
+ The possible values are:
187
+
188
+ * ``none`` -- only the ASCII letters and numbers are allowed. This
189
+ is the fastest selection.
190
+ * ``basic`` -- all Unicode characters from the specification except
191
+ category ``Lo`` are allowed.
192
+ * ``full`` -- all Unicode characters as specified in the C# specs
193
+ are allowed. Note that this means a considerable slowdown since the
194
+ ``Lo`` category has more than 40,000 characters in it!
195
+
196
+ The default value is ``basic``.
197
+ """
198
+
199
+ name = 'Nemerle'
200
+ url = 'http://nemerle.org'
201
+ aliases = ['nemerle']
202
+ filenames = ['*.n']
203
+ mimetypes = ['text/x-nemerle'] # inferred
204
+ version_added = '1.5'
205
+
206
+ flags = re.MULTILINE | re.DOTALL
207
+
208
+ # for the range of allowed unicode characters in identifiers, see
209
+ # http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf
210
+
211
+ levels = {
212
+ 'none': r'@?[_a-zA-Z]\w*',
213
+ 'basic': ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' +
214
+ '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc',
215
+ 'Cf', 'Mn', 'Mc') + ']*'),
216
+ 'full': ('@?(?:_|[^' +
217
+ uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])' +
218
+ '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
219
+ 'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*'),
220
+ }
221
+
222
+ tokens = {}
223
+ token_variants = True
224
+
225
+ for levelname, cs_ident in levels.items():
226
+ tokens[levelname] = {
227
+ 'root': [
228
+ # method names
229
+ (r'^([ \t]*)((?:' + cs_ident + r'(?:\[\])?\s+)+?)' # return type
230
+ r'(' + cs_ident + ')' # method name
231
+ r'(\s*)(\()', # signature start
232
+ bygroups(Whitespace, using(this), Name.Function, Whitespace, \
233
+ Punctuation)),
234
+ (r'^(\s*)(\[.*?\])', bygroups(Whitespace, Name.Attribute)),
235
+ (r'[^\S\n]+', Whitespace),
236
+ (r'(\\)(\n)', bygroups(Text, Whitespace)), # line continuation
237
+ (r'//.*?\n', Comment.Single),
238
+ (r'/[*].*?[*]/', Comment.Multiline),
239
+ (r'\n', Whitespace),
240
+ (r'(\$)(\s*)(")', bygroups(String, Whitespace, String),
241
+ 'splice-string'),
242
+ (r'(\$)(\s*)(<#)', bygroups(String, Whitespace, String),
243
+ 'splice-string2'),
244
+ (r'<#', String, 'recursive-string'),
245
+
246
+ (r'(<\[)(\s*)(' + cs_ident + ':)?',
247
+ bygroups(Keyword, Whitespace, Keyword)),
248
+ (r'\]\>', Keyword),
249
+
250
+ # quasiquotation only
251
+ (r'\$' + cs_ident, Name),
252
+ (r'(\$)(\()', bygroups(Name, Punctuation),
253
+ 'splice-string-content'),
254
+
255
+ (r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation),
256
+ (r'[{}]', Punctuation),
257
+ (r'@"(""|[^"])*"', String),
258
+ (r'"(\\\\|\\[^\\]|[^"\\\n])*["\n]', String),
259
+ (r"'\\.'|'[^\\]'", String.Char),
260
+ (r"0[xX][0-9a-fA-F]+[Ll]?", Number),
261
+ (r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFLdD]?", Number),
262
+ (r'(#)([ \t]*)(if|endif|else|elif|define|undef|'
263
+ r'line|error|warning|region|endregion|pragma)\b',
264
+ bygroups(Comment.Preproc, Whitespace, Comment.Preproc), 'preproc'),
265
+ (r'\b(extern)(\s+)(alias)\b', bygroups(Keyword, Whitespace, Keyword)),
266
+ (words(('abstract', 'and', 'as', 'base', 'catch', 'def', 'delegate',
267
+ 'enum', 'event', 'extern', 'false',
268
+ 'finally', 'fun', 'implements', 'interface',
269
+ 'internal', 'is', 'macro', 'match',
270
+ 'matches', 'module', 'mutable', 'new',
271
+ 'null', 'out', 'override', 'params',
272
+ 'partial', 'private', 'protected', 'public',
273
+ 'ref', 'sealed', 'static', 'syntax', 'this',
274
+ 'throw', 'true', 'try', 'type', 'typeof',
275
+ 'virtual', 'volatile', 'when', 'where',
276
+ 'with', 'assert', 'assert2', 'async',
277
+ 'break', 'checked', 'continue', 'do',
278
+ 'else', 'ensures', 'for', 'foreach', 'if',
279
+ 'late', 'lock', 'new', 'nolate',
280
+ 'otherwise', 'regexp', 'repeat', 'requires',
281
+ 'return', 'surroundwith', 'unchecked',
282
+ 'unless', 'using', 'while', 'yield'), suffix=r'\b'), Keyword),
283
+ (r'(global)(::)', bygroups(Keyword, Punctuation)),
284
+ (r'(bool|byte|char|decimal|double|float|int|long|object|sbyte|'
285
+ r'short|string|uint|ulong|ushort|void|array|list)\b\??',
286
+ Keyword.Type),
287
+ (r'(:>?)(\s*)(' + cs_ident + r'\??)',
288
+ bygroups(Punctuation, Whitespace, Keyword.Type)),
289
+ (r'(class|struct|variant|module)(\s+)',
290
+ bygroups(Keyword, Whitespace), 'class'),
291
+ (r'(namespace|using)(\s+)', bygroups(Keyword, Whitespace),
292
+ 'namespace'),
293
+ (cs_ident, Name),
294
+ ],
295
+ 'class': [
296
+ (cs_ident, Name.Class, '#pop')
297
+ ],
298
+ 'preproc': [
299
+ (r'\w+', Comment.Preproc),
300
+ (r'[ \t]+', Whitespace),
301
+ (r'\n', Whitespace, '#pop')
302
+ ],
303
+ 'namespace': [
304
+ (r'(?=\()', Text, '#pop'), # using (resource)
305
+ ('(' + cs_ident + r'|\.)+', Name.Namespace, '#pop')
306
+ ],
307
+ 'splice-string': [
308
+ (r'[^"$]', String),
309
+ (r'\$' + cs_ident, Name),
310
+ (r'(\$)(\()', bygroups(Name, Punctuation),
311
+ 'splice-string-content'),
312
+ (r'\\"', String),
313
+ (r'"', String, '#pop')
314
+ ],
315
+ 'splice-string2': [
316
+ (r'[^#<>$]', String),
317
+ (r'\$' + cs_ident, Name),
318
+ (r'(\$)(\()', bygroups(Name, Punctuation),
319
+ 'splice-string-content'),
320
+ (r'<#', String, '#push'),
321
+ (r'#>', String, '#pop')
322
+ ],
323
+ 'recursive-string': [
324
+ (r'[^#<>]', String),
325
+ (r'<#', String, '#push'),
326
+ (r'#>', String, '#pop')
327
+ ],
328
+ 'splice-string-content': [
329
+ (r'if|match', Keyword),
330
+ (r'[~!%^&*+=|\[\]:;,.<>/?-\\"$ ]', Punctuation),
331
+ (cs_ident, Name),
332
+ (r'\d+', Number),
333
+ (r'\(', Punctuation, '#push'),
334
+ (r'\)', Punctuation, '#pop')
335
+ ]
336
+ }
337
+
338
+ def __init__(self, **options):
339
+ level = get_choice_opt(options, 'unicodelevel', list(self.tokens),
340
+ 'basic')
341
+ if level not in self._all_tokens:
342
+ # compile the regexes now
343
+ self._tokens = self.__class__.process_tokendef(level)
344
+ else:
345
+ self._tokens = self._all_tokens[level]
346
+
347
+ RegexLexer.__init__(self, **options)
348
+
349
+ def analyse_text(text):
350
+ """Nemerle is quite similar to Python, but @if is relatively uncommon
351
+ elsewhere."""
352
+ result = 0
353
+
354
+ if '@if' in text:
355
+ result += 0.1
356
+
357
+ return result
358
+
359
+
360
+ class BooLexer(RegexLexer):
361
+ """
362
+ For Boo source code.
363
+ """
364
+
365
+ name = 'Boo'
366
+ url = 'https://github.com/boo-lang/boo'
367
+ aliases = ['boo']
368
+ filenames = ['*.boo']
369
+ mimetypes = ['text/x-boo']
370
+ version_added = ''
371
+
372
+ tokens = {
373
+ 'root': [
374
+ (r'\s+', Whitespace),
375
+ (r'(#|//).*$', Comment.Single),
376
+ (r'/[*]', Comment.Multiline, 'comment'),
377
+ (r'[]{}:(),.;[]', Punctuation),
378
+ (r'(\\)(\n)', bygroups(Text, Whitespace)),
379
+ (r'\\', Text),
380
+ (r'(in|is|and|or|not)\b', Operator.Word),
381
+ (r'/(\\\\|\\[^\\]|[^/\\\s])/', String.Regex),
382
+ (r'@/(\\\\|\\[^\\]|[^/\\])*/', String.Regex),
383
+ (r'=~|!=|==|<<|>>|[-+/*%=<>&^|]', Operator),
384
+ (words(('as', 'abstract', 'callable', 'constructor', 'destructor',
385
+ 'do', 'import', 'enum', 'event', 'final',
386
+ 'get', 'interface', 'internal', 'of',
387
+ 'override', 'partial', 'private',
388
+ 'protected', 'public', 'return', 'set',
389
+ 'static', 'struct', 'transient', 'virtual',
390
+ 'yield', 'super', 'and', 'break', 'cast',
391
+ 'continue', 'elif', 'else', 'ensure',
392
+ 'except', 'for', 'given', 'goto', 'if',
393
+ 'in', 'is', 'isa', 'not', 'or', 'otherwise',
394
+ 'pass', 'raise', 'ref', 'try', 'unless',
395
+ 'when', 'while', 'from'), suffix=r'\b'), Keyword),
396
+ (r'def(?=\s+\(.*?\))', Keyword),
397
+ (r'(def)(\s+)', bygroups(Keyword, Whitespace), 'funcname'),
398
+ (r'(class)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
399
+ (r'(namespace)(\s+)', bygroups(Keyword, Whitespace), 'namespace'),
400
+ (r'(?<!\.)(true|false|null|self|__eval__|__switch__|array|'
401
+ r'assert|checked|enumerate|filter|getter|len|lock|map|'
402
+ r'matrix|max|min|normalArrayIndexing|print|property|range|'
403
+ r'rawArrayIndexing|required|typeof|unchecked|using|'
404
+ r'yieldAll|zip)\b', Name.Builtin),
405
+ (r'"""(\\\\|\\"|.*?)"""', String.Double),
406
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
407
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
408
+ (r'[a-zA-Z_]\w*', Name),
409
+ (r'(\d+\.\d*|\d*\.\d+)([fF][+-]?[0-9]+)?', Number.Float),
410
+ (r'[0-9][0-9.]*(ms?|d|h|s)', Number),
411
+ (r'0\d+', Number.Oct),
412
+ (r'0x[a-fA-F0-9]+', Number.Hex),
413
+ (r'\d+L', Number.Integer.Long),
414
+ (r'\d+', Number.Integer),
415
+ ],
416
+ 'comment': [
417
+ ('/[*]', Comment.Multiline, '#push'),
418
+ ('[*]/', Comment.Multiline, '#pop'),
419
+ ('[^/*]', Comment.Multiline),
420
+ ('[*/]', Comment.Multiline)
421
+ ],
422
+ 'funcname': [
423
+ (r'[a-zA-Z_]\w*', Name.Function, '#pop')
424
+ ],
425
+ 'classname': [
426
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
427
+ ],
428
+ 'namespace': [
429
+ (r'[a-zA-Z_][\w.]*', Name.Namespace, '#pop')
430
+ ]
431
+ }
432
+
433
+
434
+ class VbNetLexer(RegexLexer):
435
+ """
436
+ For Visual Basic.NET source code.
437
+ Also LibreOffice Basic, OpenOffice Basic, and StarOffice Basic.
438
+ """
439
+
440
+ name = 'VB.net'
441
+ url = 'https://docs.microsoft.com/en-us/dotnet/visual-basic/'
442
+ aliases = ['vb.net', 'vbnet', 'lobas', 'oobas', 'sobas', 'visual-basic', 'visualbasic']
443
+ filenames = ['*.vb', '*.bas']
444
+ mimetypes = ['text/x-vbnet', 'text/x-vba'] # (?)
445
+ version_added = ''
446
+
447
+ uni_name = '[_' + uni.combine('Ll', 'Lt', 'Lm', 'Nl') + ']' + \
448
+ '[' + uni.combine('Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc',
449
+ 'Cf', 'Mn', 'Mc') + ']*'
450
+
451
+ flags = re.MULTILINE | re.IGNORECASE
452
+ tokens = {
453
+ 'root': [
454
+ (r'^\s*<.*?>', Name.Attribute),
455
+ (r'\s+', Whitespace),
456
+ (r'\n', Whitespace),
457
+ (r'(rem\b.*?)(\n)', bygroups(Comment, Whitespace)),
458
+ (r"('.*?)(\n)", bygroups(Comment, Whitespace)),
459
+ (r'#If\s.*?\sThen|#ElseIf\s.*?\sThen|#Else|#End\s+If|#Const|'
460
+ r'#ExternalSource.*?\n|#End\s+ExternalSource|'
461
+ r'#Region.*?\n|#End\s+Region|#ExternalChecksum',
462
+ Comment.Preproc),
463
+ (r'[(){}!#,.:]', Punctuation),
464
+ (r'(Option)(\s+)(Strict|Explicit|Compare)(\s+)'
465
+ r'(On|Off|Binary|Text)',
466
+ bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration,
467
+ Whitespace, Keyword.Declaration)),
468
+ (words((
469
+ 'AddHandler', 'Alias', 'ByRef', 'ByVal', 'Call', 'Case',
470
+ 'Catch', 'CBool', 'CByte', 'CChar', 'CDate', 'CDec', 'CDbl',
471
+ 'CInt', 'CLng', 'CObj', 'Continue', 'CSByte', 'CShort', 'CSng',
472
+ 'CStr', 'CType', 'CUInt', 'CULng', 'CUShort', 'Declare',
473
+ 'Default', 'Delegate', 'DirectCast', 'Do', 'Each', 'Else',
474
+ 'ElseIf', 'EndIf', 'Erase', 'Error', 'Event', 'Exit', 'False',
475
+ 'Finally', 'For', 'Friend', 'Get', 'Global', 'GoSub', 'GoTo',
476
+ 'Handles', 'If', 'Implements', 'Inherits', 'Interface', 'Let',
477
+ 'Lib', 'Loop', 'Me', 'MustInherit', 'MustOverride', 'MyBase',
478
+ 'MyClass', 'Narrowing', 'New', 'Next', 'Not', 'Nothing',
479
+ 'NotInheritable', 'NotOverridable', 'Of', 'On', 'Operator',
480
+ 'Option', 'Optional', 'Overloads', 'Overridable', 'Overrides',
481
+ 'ParamArray', 'Partial', 'Private', 'Protected', 'Public',
482
+ 'RaiseEvent', 'ReadOnly', 'ReDim', 'RemoveHandler', 'Resume',
483
+ 'Return', 'Select', 'Set', 'Shadows', 'Shared', 'Single',
484
+ 'Static', 'Step', 'Stop', 'SyncLock', 'Then', 'Throw', 'To',
485
+ 'True', 'Try', 'TryCast', 'Wend', 'Using', 'When', 'While',
486
+ 'Widening', 'With', 'WithEvents', 'WriteOnly'),
487
+ prefix=r'(?<!\.)', suffix=r'\b'), Keyword),
488
+ (r'(?<!\.)End\b', Keyword, 'end'),
489
+ (r'(?<!\.)(Dim|Const)\b', Keyword, 'dim'),
490
+ (r'(?<!\.)(Function|Sub|Property)(\s+)',
491
+ bygroups(Keyword, Whitespace), 'funcname'),
492
+ (r'(?<!\.)(Class|Structure|Enum)(\s+)',
493
+ bygroups(Keyword, Whitespace), 'classname'),
494
+ (r'(?<!\.)(Module|Namespace|Imports)(\s+)',
495
+ bygroups(Keyword, Whitespace), 'namespace'),
496
+ (r'(?<!\.)(Boolean|Byte|Char|Date|Decimal|Double|Integer|Long|'
497
+ r'Object|SByte|Short|Single|String|Variant|UInteger|ULong|'
498
+ r'UShort)\b', Keyword.Type),
499
+ (r'(?<!\.)(AddressOf|And|AndAlso|As|GetType|In|Is|IsNot|Like|Mod|'
500
+ r'Or|OrElse|TypeOf|Xor)\b', Operator.Word),
501
+ (r'&=|[*]=|/=|\\=|\^=|\+=|-=|<<=|>>=|<<|>>|:=|'
502
+ r'<=|>=|<>|[-&*/\\^+=<>\[\]]',
503
+ Operator),
504
+ ('"', String, 'string'),
505
+ (r'(_)(\n)', bygroups(Text, Whitespace)), # Line continuation (must be before Name)
506
+ (uni_name + '[%&@!#$]?', Name),
507
+ ('#.*?#', Literal.Date),
508
+ (r'(\d+\.\d*|\d*\.\d+)(F[+-]?[0-9]+)?', Number.Float),
509
+ (r'\d+([SILDFR]|US|UI|UL)?', Number.Integer),
510
+ (r'&H[0-9a-f]+([SILDFR]|US|UI|UL)?', Number.Integer),
511
+ (r'&O[0-7]+([SILDFR]|US|UI|UL)?', Number.Integer),
512
+ ],
513
+ 'string': [
514
+ (r'""', String),
515
+ (r'"C?', String, '#pop'),
516
+ (r'[^"]+', String),
517
+ ],
518
+ 'dim': [
519
+ (uni_name, Name.Variable, '#pop'),
520
+ default('#pop'), # any other syntax
521
+ ],
522
+ 'funcname': [
523
+ (uni_name, Name.Function, '#pop'),
524
+ ],
525
+ 'classname': [
526
+ (uni_name, Name.Class, '#pop'),
527
+ ],
528
+ 'namespace': [
529
+ (uni_name, Name.Namespace),
530
+ (r'\.', Name.Namespace),
531
+ default('#pop'),
532
+ ],
533
+ 'end': [
534
+ (r'\s+', Whitespace),
535
+ (words(('Function', 'Sub', 'Property', 'Class', 'Structure', 'Enum',
536
+ 'Module', 'Namespace'), suffix=r'\b'),
537
+ Keyword, '#pop'),
538
+ default('#pop'),
539
+ ]
540
+ }
541
+
542
+ def analyse_text(text):
543
+ if re.search(r'^\s*(#If|Module|Namespace)', text, re.MULTILINE):
544
+ return 0.5
545
+
546
+
547
+ class GenericAspxLexer(RegexLexer):
548
+ """
549
+ Lexer for ASP.NET pages.
550
+ """
551
+
552
+ name = 'aspx-gen'
553
+ filenames = []
554
+ mimetypes = []
555
+ url = 'https://dotnet.microsoft.com/en-us/apps/aspnet'
556
+
557
+ flags = re.DOTALL
558
+
559
+ tokens = {
560
+ 'root': [
561
+ (r'(<%[@=#]?)(.*?)(%>)', bygroups(Name.Tag, Other, Name.Tag)),
562
+ (r'(<script.*?>)(.*?)(</script>)', bygroups(using(XmlLexer),
563
+ Other,
564
+ using(XmlLexer))),
565
+ (r'(.+?)(?=<)', using(XmlLexer)),
566
+ (r'.+', using(XmlLexer)),
567
+ ],
568
+ }
569
+
570
+
571
+ # TODO support multiple languages within the same source file
572
+ class CSharpAspxLexer(DelegatingLexer):
573
+ """
574
+ Lexer for highlighting C# within ASP.NET pages.
575
+ """
576
+
577
+ name = 'aspx-cs'
578
+ aliases = ['aspx-cs']
579
+ filenames = ['*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd']
580
+ mimetypes = []
581
+ url = 'https://dotnet.microsoft.com/en-us/apps/aspnet'
582
+ version_added = ''
583
+
584
+ def __init__(self, **options):
585
+ super().__init__(CSharpLexer, GenericAspxLexer, **options)
586
+
587
+ def analyse_text(text):
588
+ if re.search(r'Page\s*Language="C#"', text, re.I) is not None:
589
+ return 0.2
590
+ elif re.search(r'script[^>]+language=["\']C#', text, re.I) is not None:
591
+ return 0.15
592
+
593
+
594
+ class VbNetAspxLexer(DelegatingLexer):
595
+ """
596
+ Lexer for highlighting Visual Basic.net within ASP.NET pages.
597
+ """
598
+
599
+ name = 'aspx-vb'
600
+ aliases = ['aspx-vb']
601
+ filenames = ['*.aspx', '*.asax', '*.ascx', '*.ashx', '*.asmx', '*.axd']
602
+ mimetypes = []
603
+ url = 'https://dotnet.microsoft.com/en-us/apps/aspnet'
604
+ version_added = ''
605
+
606
+ def __init__(self, **options):
607
+ super().__init__(VbNetLexer, GenericAspxLexer, **options)
608
+
609
+ def analyse_text(text):
610
+ if re.search(r'Page\s*Language="Vb"', text, re.I) is not None:
611
+ return 0.2
612
+ elif re.search(r'script[^>]+language=["\']vb', text, re.I) is not None:
613
+ return 0.15
614
+
615
+
616
+ # Very close to functional.OcamlLexer
617
+ class FSharpLexer(RegexLexer):
618
+ """
619
+ For the F# language (version 3.0).
620
+ """
621
+
622
+ name = 'F#'
623
+ url = 'https://fsharp.org/'
624
+ aliases = ['fsharp', 'f#']
625
+ filenames = ['*.fs', '*.fsi', '*.fsx']
626
+ mimetypes = ['text/x-fsharp']
627
+ version_added = '1.5'
628
+
629
+ keywords = [
630
+ 'abstract', 'as', 'assert', 'base', 'begin', 'class', 'default',
631
+ 'delegate', 'do!', 'do', 'done', 'downcast', 'downto', 'elif', 'else',
632
+ 'end', 'exception', 'extern', 'false', 'finally', 'for', 'function',
633
+ 'fun', 'global', 'if', 'inherit', 'inline', 'interface', 'internal',
634
+ 'in', 'lazy', 'let!', 'let', 'match', 'member', 'module', 'mutable',
635
+ 'namespace', 'new', 'null', 'of', 'open', 'override', 'private', 'public',
636
+ 'rec', 'return!', 'return', 'select', 'static', 'struct', 'then', 'to',
637
+ 'true', 'try', 'type', 'upcast', 'use!', 'use', 'val', 'void', 'when',
638
+ 'while', 'with', 'yield!', 'yield',
639
+ ]
640
+ # Reserved words; cannot hurt to color them as keywords too.
641
+ keywords += [
642
+ 'atomic', 'break', 'checked', 'component', 'const', 'constraint',
643
+ 'constructor', 'continue', 'eager', 'event', 'external', 'fixed',
644
+ 'functor', 'include', 'method', 'mixin', 'object', 'parallel',
645
+ 'process', 'protected', 'pure', 'sealed', 'tailcall', 'trait',
646
+ 'virtual', 'volatile',
647
+ ]
648
+ keyopts = [
649
+ '!=', '#', '&&', '&', r'\(', r'\)', r'\*', r'\+', ',', r'-\.',
650
+ '->', '-', r'\.\.', r'\.', '::', ':=', ':>', ':', ';;', ';', '<-',
651
+ r'<\]', '<', r'>\]', '>', r'\?\?', r'\?', r'\[<', r'\[\|', r'\[', r'\]',
652
+ '_', '`', r'\{', r'\|\]', r'\|', r'\}', '~', '<@@', '<@', '=', '@>', '@@>',
653
+ ]
654
+
655
+ operators = r'[!$%&*+\./:<=>?@^|~-]'
656
+ word_operators = ['and', 'or', 'not']
657
+ prefix_syms = r'[!?~]'
658
+ infix_syms = r'[=<>@^|&+\*/$%-]'
659
+ primitives = [
660
+ 'sbyte', 'byte', 'char', 'nativeint', 'unativeint', 'float32', 'single',
661
+ 'float', 'double', 'int8', 'uint8', 'int16', 'uint16', 'int32',
662
+ 'uint32', 'int64', 'uint64', 'decimal', 'unit', 'bool', 'string',
663
+ 'list', 'exn', 'obj', 'enum',
664
+ ]
665
+
666
+ # See http://msdn.microsoft.com/en-us/library/dd233181.aspx and/or
667
+ # http://fsharp.org/about/files/spec.pdf for reference. Good luck.
668
+
669
+ tokens = {
670
+ 'escape-sequence': [
671
+ (r'\\[\\"\'ntbrafv]', String.Escape),
672
+ (r'\\[0-9]{3}', String.Escape),
673
+ (r'\\u[0-9a-fA-F]{4}', String.Escape),
674
+ (r'\\U[0-9a-fA-F]{8}', String.Escape),
675
+ ],
676
+ 'root': [
677
+ (r'\s+', Whitespace),
678
+ (r'\(\)|\[\]', Name.Builtin.Pseudo),
679
+ (r'\b(?<!\.)([A-Z][\w\']*)(?=\s*\.)',
680
+ Name.Namespace, 'dotted'),
681
+ (r'\b([A-Z][\w\']*)', Name),
682
+ (r'(///.*?)(\n)', bygroups(String.Doc, Whitespace)),
683
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
684
+ (r'\(\*(?!\))', Comment, 'comment'),
685
+
686
+ (r'@"', String, 'lstring'),
687
+ (r'"""', String, 'tqs'),
688
+ (r'"', String, 'string'),
689
+
690
+ (r'\b(open|module)(\s+)([\w.]+)',
691
+ bygroups(Keyword, Whitespace, Name.Namespace)),
692
+ (r'\b(let!?)(\s+)(\w+)',
693
+ bygroups(Keyword, Whitespace, Name.Variable)),
694
+ (r'\b(type)(\s+)(\w+)',
695
+ bygroups(Keyword, Whitespace, Name.Class)),
696
+ (r'\b(member|override)(\s+)(\w+)(\.)(\w+)',
697
+ bygroups(Keyword, Whitespace, Name, Punctuation, Name.Function)),
698
+ (r'\b({})\b'.format('|'.join(keywords)), Keyword),
699
+ (r'``([^`\n\r\t]|`[^`\n\r\t])+``', Name),
700
+ (r'({})'.format('|'.join(keyopts)), Operator),
701
+ (rf'({infix_syms}|{prefix_syms})?{operators}', Operator),
702
+ (r'\b({})\b'.format('|'.join(word_operators)), Operator.Word),
703
+ (r'\b({})\b'.format('|'.join(primitives)), Keyword.Type),
704
+ (r'(#)([ \t]*)(if|endif|else|line|nowarn|light|\d+)\b(.*?)(\n)',
705
+ bygroups(Comment.Preproc, Whitespace, Comment.Preproc,
706
+ Comment.Preproc, Whitespace)),
707
+
708
+ (r"[^\W\d][\w']*", Name),
709
+
710
+ (r'\d[\d_]*[uU]?[yslLnQRZINGmM]?', Number.Integer),
711
+ (r'0[xX][\da-fA-F][\da-fA-F_]*[uU]?[yslLn]?[fF]?', Number.Hex),
712
+ (r'0[oO][0-7][0-7_]*[uU]?[yslLn]?', Number.Oct),
713
+ (r'0[bB][01][01_]*[uU]?[yslLn]?', Number.Bin),
714
+ (r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)[fFmM]?',
715
+ Number.Float),
716
+
717
+ (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'B?",
718
+ String.Char),
719
+ (r"'.'", String.Char),
720
+ (r"'", Keyword), # a stray quote is another syntax element
721
+
722
+ (r'@?"', String.Double, 'string'),
723
+
724
+ (r'[~?][a-z][\w\']*:', Name.Variable),
725
+ ],
726
+ 'dotted': [
727
+ (r'\s+', Whitespace),
728
+ (r'\.', Punctuation),
729
+ (r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
730
+ (r'[A-Z][\w\']*', Name, '#pop'),
731
+ (r'[a-z_][\w\']*', Name, '#pop'),
732
+ # e.g. dictionary index access
733
+ default('#pop'),
734
+ ],
735
+ 'comment': [
736
+ (r'[^(*)@"]+', Comment),
737
+ (r'\(\*', Comment, '#push'),
738
+ (r'\*\)', Comment, '#pop'),
739
+ # comments cannot be closed within strings in comments
740
+ (r'@"', String, 'lstring'),
741
+ (r'"""', String, 'tqs'),
742
+ (r'"', String, 'string'),
743
+ (r'[(*)@]', Comment),
744
+ ],
745
+ 'string': [
746
+ (r'[^\\"]+', String),
747
+ include('escape-sequence'),
748
+ (r'\\\n', String),
749
+ (r'\n', String), # newlines are allowed in any string
750
+ (r'"B?', String, '#pop'),
751
+ ],
752
+ 'lstring': [
753
+ (r'[^"]+', String),
754
+ (r'\n', String),
755
+ (r'""', String),
756
+ (r'"B?', String, '#pop'),
757
+ ],
758
+ 'tqs': [
759
+ (r'[^"]+', String),
760
+ (r'\n', String),
761
+ (r'"""B?', String, '#pop'),
762
+ (r'"', String),
763
+ ],
764
+ }
765
+
766
+ def analyse_text(text):
767
+ """F# doesn't have that many unique features -- |> and <| are weak
768
+ indicators."""
769
+ result = 0
770
+ if '|>' in text:
771
+ result += 0.05
772
+ if '<|' in text:
773
+ result += 0.05
774
+
775
+ return result
776
+
777
+
778
+ class XppLexer(RegexLexer):
779
+
780
+ """
781
+ For X++ source code. This is based loosely on the CSharpLexer
782
+ """
783
+
784
+ name = 'X++'
785
+ url = 'https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-language-reference'
786
+ aliases = ['xpp', 'x++']
787
+ filenames = ['*.xpp']
788
+ version_added = '2.15'
789
+
790
+ flags = re.MULTILINE
791
+
792
+ XPP_CHARS = ('@?(?:_|[^' +
793
+ uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + '])' +
794
+ '[^' + uni.allexcept('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl',
795
+ 'Nd', 'Pc', 'Cf', 'Mn', 'Mc') + ']*')
796
+ # Temporary, see
797
+ # https://github.com/thatch/regexlint/pull/49
798
+ XPP_CHARS = XPP_CHARS.replace('\x00', '\x01')
799
+
800
+ OPERATORS = (
801
+ '<=', '>=', '+=', '-=', '*=', '/=', '!=', '==',
802
+ '&&', '||', '>>', '<<', '++', '--', '+', '-', '*',
803
+ '/', '%', '&', '|', '^', '<', '>', '?', '!', '~', '=',
804
+ )
805
+ KEYWORDS = ('abstract','anytype','as','async','asc','at','avg','break','breakpoint','by','byref','case','catch',
806
+ 'changecompany','client','container','continue','count','crosscompany','default','delegate',
807
+ 'delete_from','desc','display','div','do','edit','else','element','eventhandler','exists','false','final',
808
+ 'firstfast','firstonly','firstonly10','firstonly100','firstonly1000','flush','for','forceliterals',
809
+ 'forcenestedloop','forceplaceholders','forceselectorder','forupdate','from','group','if','insert_recordset',
810
+ 'interface','is','join','like','maxof','minof','mod','new','next','nofetch','notexists','null','optimisticlock','order',
811
+ 'outer','pause','pessimisticlock','print','private','protected','public','repeatableread','retry','return',
812
+ 'reverse','select','server','setting','static','sum','super','switch','tablelock','this','throw','true','try','ttsabort','ttsbegin',
813
+ 'ttscommit','update_recordset','validtimestate','void','where','while','window')
814
+ RUNTIME_FUNCTIONS = ('_duration','abs','acos','any2Date','any2Enum','any2Guid','any2Int','any2Int64','any2Real','any2Str','anytodate',
815
+ 'anytoenum','anytoguid','anytoint','anytoint64','anytoreal','anytostr','asin','atan','beep','cTerm','char2Num','classIdGet',
816
+ 'corrFlagGet','corrFlagSet','cos','cosh','curExt','curUserId','date2Num','date2Str','datetime2Str','dayName','dayOfMth',
817
+ 'dayOfWk','dayOfYr','ddb','decRound','dg','dimOf','endMth','enum2str','exp','exp10','fV','fieldId2Name','fieldId2PName',
818
+ 'fieldName2Id','frac','funcName','getCurrentPartition','getCurrentPartitionRecId','getPrefix','guid2Str','idg','indexId2Name',
819
+ 'indexName2Id','int2Str','int642Str','intvMax','intvName','intvNo','intvNorm','log10','logN','match','max','min','mkDate','mthName',
820
+ 'mthOfYr','newGuid','nextMth','nextQtr','nextYr','num2Char','num2Date','num2Str','pmt','power','prevMth','prevQtr','prevYr',
821
+ 'prmIsDefault','pt','pv','rate','refPrintAll','round','runAs','sessionId','setPrefix','sin','sinh','sleep','sln','str2Date',
822
+ 'str2Datetime','str2Enum','str2Guid','str2Int','str2Int64','str2Num','str2Time','strAlpha','strCmp','strColSeq','strDel',
823
+ 'strFind','strFmt','strIns','strKeep','strLTrim','strLen','strLine','strLwr','strNFind','strPoke','strPrompt','strRTrim',
824
+ 'strRem','strRep','strScan','strUpr','subStr','syd','systemDateGet','systemDateSet','tableId2Name',
825
+ 'tableId2PName','tableName2Id','tan','tanh','term','time2Str','timeNow','today','trunc','typeOf','uint2Str','wkOfYr','year')
826
+ COMPILE_FUNCTIONS = ('attributeStr','classNum','classStr','configurationKeyNum','configurationKeyStr','dataEntityDataSourceStr','delegateStr',
827
+ 'dimensionHierarchyLevelStr','dimensionHierarchyStr','dimensionReferenceStr','dutyStr','enumCnt','enumLiteralStr','enumNum','enumStr',
828
+ 'extendedTypeNum','extendedTypeStr','fieldNum','fieldPName','fieldStr','formControlStr','formDataFieldStr','formDataSourceStr',
829
+ 'formMethodStr','formStr','identifierStr','indexNum','indexStr','licenseCodeNum','licenseCodeStr','literalStr','maxDate','maxInt',
830
+ 'measureStr','measurementStr','menuItemActionStr','menuItemDisplayStr','menuItemOutputStr','menuStr','methodStr','minInt','privilegeStr',
831
+ 'queryDatasourceStr','queryMethodStr','queryStr','reportStr','resourceStr','roleStr','ssrsReportStr','staticDelegateStr','staticMethodStr',
832
+ 'tableCollectionStr','tableFieldGroupStr','tableMethodStr','tableNum','tablePName','tableStaticMethodStr','tableStr','tileStr','varStr',
833
+ 'webActionItemStr','webDisplayContentItemStr','webFormStr','webMenuStr','webOutputContentItemStr','webReportStr','webSiteTempStr',
834
+ 'webStaticFileStr','webUrlItemStr','webWebPartStr','webletItemStr','webpageDefStr','websiteDefStr','workflowApprovalStr',
835
+ 'workflowCategoryStr','workflowTaskStr','workflowTypeStr')
836
+
837
+ tokens = {}
838
+
839
+ tokens = {
840
+ 'root': [
841
+ # method names
842
+ (r'(\s*)\b(else|if)\b([^\n])', bygroups(Whitespace, Keyword, using(this))), # ensure that if is not treated like a function
843
+ (r'^([ \t]*)((?:' + XPP_CHARS + r'(?:\[\])?\s+)+?)' # return type
844
+ r'(' + XPP_CHARS + ')' # method name
845
+ r'(\s*)(\()', # signature start
846
+ bygroups(Whitespace, using(this), Name.Function, Whitespace,
847
+ Punctuation)),
848
+ (r'^(\s*)(\[)([^\n]*?)(\])', bygroups(Whitespace, Name.Attribute, Name.Variable.Class, Name.Attribute)),
849
+ (r'[^\S\n]+', Whitespace),
850
+ (r'(\\)(\n)', bygroups(Text, Whitespace)), # line continuation
851
+ (r'//[^\n]*?\n', Comment.Single),
852
+ (r'/[*][^\n]*?[*]/', Comment.Multiline),
853
+ (r'\n', Whitespace),
854
+ (words(OPERATORS), Operator),
855
+ (r'=~|!=|==|<<|>>|[-+/*%=<>&^|]', Operator),
856
+ (r'[()\[\];:,.#@]', Punctuation),
857
+ (r'[{}]', Punctuation),
858
+ (r'@"(""|[^"])*"', String),
859
+ (r'\$?"(\\\\|\\[^\\]|[^"\\\n])*["\n]', String),
860
+ (r"'\\.'|'[^\\]'", String.Char),
861
+ (r"[0-9]+(\.[0-9]*)?([eE][+-][0-9]+)?"
862
+ r"[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?", Number),
863
+ (words(KEYWORDS, suffix=r'\b'), Keyword),
864
+ (r'(boolean|int|int64|str|real|guid|date)\b\??', Keyword.Type),
865
+ (r'(class|struct|extends|implements)(\s+)', bygroups(Keyword, Whitespace), 'class'),
866
+ (r'('+XPP_CHARS+')(::)', bygroups(Name.Variable.Class, Punctuation)),
867
+ (r'(\s*)(\w+)(\s+\w+(,|=)?[^\n]*;)', bygroups(Whitespace, Name.Variable.Class, using(this))), # declaration
868
+ # x++ specific function to get field should highlight the classname
869
+ (r'(fieldNum\()('+XPP_CHARS+r')(\s*,\s*)('+XPP_CHARS+r')(\s*\))',
870
+ bygroups(using(this), Name.Variable.Class, using(this), Name.Property, using(this))),
871
+ # x++ specific function to get table should highlight the classname
872
+ (r'(tableNum\()('+XPP_CHARS+r')(\s*\))',
873
+ bygroups(using(this), Name.Variable.Class, using(this))),
874
+ (words(RUNTIME_FUNCTIONS, suffix=r'(?=\()'), Name.Function.Magic),
875
+ (words(COMPILE_FUNCTIONS, suffix=r'(?=\()'), Name.Function.Magic),
876
+ (XPP_CHARS, Name),
877
+ ],
878
+ 'class': [
879
+ (XPP_CHARS, Name.Class, '#pop'),
880
+ default('#pop'),
881
+ ],
882
+ 'namespace': [
883
+ (r'(?=\()', Text, '#pop'), # using (resource)
884
+ ('(' + XPP_CHARS + r'|\.)+', Name.Namespace, '#pop'),
885
+ ]
886
+ }
HAI-Sidecar/.venv/lib/python3.12/site-packages/pygments/lexers/dsls.py ADDED
@@ -0,0 +1,970 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.dsls
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for various domain-specific languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import ExtendedRegexLexer, RegexLexer, bygroups, words, \
14
+ include, default, this, using, combined
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Whitespace
17
+
18
+ __all__ = ['ProtoBufLexer', 'ZeekLexer', 'PuppetLexer', 'RslLexer',
19
+ 'MscgenLexer', 'VGLLexer', 'AlloyLexer', 'PanLexer',
20
+ 'CrmshLexer', 'ThriftLexer', 'FlatlineLexer', 'SnowballLexer']
21
+
22
+
23
+ class ProtoBufLexer(RegexLexer):
24
+ """
25
+ Lexer for Protocol Buffer definition files.
26
+ """
27
+
28
+ name = 'Protocol Buffer'
29
+ url = 'https://developers.google.com/protocol-buffers/'
30
+ aliases = ['protobuf', 'proto']
31
+ filenames = ['*.proto']
32
+ version_added = '1.4'
33
+
34
+ tokens = {
35
+ 'root': [
36
+ (r'[ \t]+', Whitespace),
37
+ (r'[,;{}\[\]()<>]', Punctuation),
38
+ (r'/(\\\n)?/(\n|[\s\S]*?[^\\]\n)', Comment.Single),
39
+ (r'/(\\\n)?\*[\s\S]*?\*(\\\n)?/', Comment.Multiline),
40
+ (words((
41
+ 'import', 'option', 'optional', 'required', 'repeated',
42
+ 'reserved', 'default', 'packed', 'ctype', 'extensions', 'to',
43
+ 'max', 'rpc', 'returns', 'oneof', 'syntax'), prefix=r'\b', suffix=r'\b'),
44
+ Keyword),
45
+ (words((
46
+ 'int32', 'int64', 'uint32', 'uint64', 'sint32', 'sint64',
47
+ 'fixed32', 'fixed64', 'sfixed32', 'sfixed64',
48
+ 'float', 'double', 'bool', 'string', 'bytes'), suffix=r'\b'),
49
+ Keyword.Type),
50
+ (r'(true|false)\b', Keyword.Constant),
51
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Whitespace), 'package'),
52
+ (r'(message|extend)(\s+)',
53
+ bygroups(Keyword.Declaration, Whitespace), 'message'),
54
+ (r'(enum|group|service)(\s+)',
55
+ bygroups(Keyword.Declaration, Whitespace), 'type'),
56
+ (r'\".*?\"', String),
57
+ (r'\'.*?\'', String),
58
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
59
+ (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
60
+ (r'(\-?(inf|nan))\b', Number.Float),
61
+ (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
62
+ (r'0[0-7]+[LlUu]*', Number.Oct),
63
+ (r'\d+[LlUu]*', Number.Integer),
64
+ (r'[+-=]', Operator),
65
+ (r'([a-zA-Z_][\w.]*)([ \t]*)(=)',
66
+ bygroups(Name.Attribute, Whitespace, Operator)),
67
+ (r'[a-zA-Z_][\w.]*', Name),
68
+ ],
69
+ 'package': [
70
+ (r'[a-zA-Z_][\w\.]*', Name.Namespace, '#pop'),
71
+ default('#pop'),
72
+ ],
73
+ 'message': [
74
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop'),
75
+ default('#pop'),
76
+ ],
77
+ 'type': [
78
+ (r'[a-zA-Z_]\w*', Name, '#pop'),
79
+ default('#pop'),
80
+ ],
81
+ }
82
+
83
+
84
+ class ThriftLexer(RegexLexer):
85
+ """
86
+ For Thrift interface definitions.
87
+ """
88
+ name = 'Thrift'
89
+ url = 'https://thrift.apache.org/'
90
+ aliases = ['thrift']
91
+ filenames = ['*.thrift']
92
+ mimetypes = ['application/x-thrift']
93
+ version_added = '2.1'
94
+
95
+ tokens = {
96
+ 'root': [
97
+ include('whitespace'),
98
+ include('comments'),
99
+ (r'"', String.Double, combined('stringescape', 'dqs')),
100
+ (r'\'', String.Single, combined('stringescape', 'sqs')),
101
+ (r'(namespace)(\s+)',
102
+ bygroups(Keyword.Namespace, Whitespace), 'namespace'),
103
+ (r'(enum|union|struct|service|exception)(\s+)',
104
+ bygroups(Keyword.Declaration, Whitespace), 'class'),
105
+ (r'((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)' # return arguments
106
+ r'((?:[^\W\d]|\$)[\w$]*)' # method name
107
+ r'(\s*)(\()', # signature start
108
+ bygroups(using(this), Name.Function, Whitespace, Operator)),
109
+ include('keywords'),
110
+ include('numbers'),
111
+ (r'[&=]', Operator),
112
+ (r'[:;,{}()<>\[\]]', Punctuation),
113
+ (r'[a-zA-Z_](\.\w|\w)*', Name),
114
+ ],
115
+ 'whitespace': [
116
+ (r'\n', Whitespace),
117
+ (r'\s+', Whitespace),
118
+ ],
119
+ 'comments': [
120
+ (r'#.*$', Comment),
121
+ (r'//.*?\n', Comment),
122
+ (r'/\*[\w\W]*?\*/', Comment.Multiline),
123
+ ],
124
+ 'stringescape': [
125
+ (r'\\([\\nrt"\'])', String.Escape),
126
+ ],
127
+ 'dqs': [
128
+ (r'"', String.Double, '#pop'),
129
+ (r'[^\\"\n]+', String.Double),
130
+ ],
131
+ 'sqs': [
132
+ (r"'", String.Single, '#pop'),
133
+ (r'[^\\\'\n]+', String.Single),
134
+ ],
135
+ 'namespace': [
136
+ (r'[a-z*](\.\w|\w)*', Name.Namespace, '#pop'),
137
+ default('#pop'),
138
+ ],
139
+ 'class': [
140
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop'),
141
+ default('#pop'),
142
+ ],
143
+ 'keywords': [
144
+ (r'(async|oneway|extends|throws|required|optional)\b', Keyword),
145
+ (r'(true|false)\b', Keyword.Constant),
146
+ (r'(const|typedef)\b', Keyword.Declaration),
147
+ (words((
148
+ 'cpp_namespace', 'cpp_include', 'cpp_type', 'java_package',
149
+ 'cocoa_prefix', 'csharp_namespace', 'delphi_namespace',
150
+ 'php_namespace', 'py_module', 'perl_package',
151
+ 'ruby_namespace', 'smalltalk_category', 'smalltalk_prefix',
152
+ 'xsd_all', 'xsd_optional', 'xsd_nillable', 'xsd_namespace',
153
+ 'xsd_attrs', 'include'), suffix=r'\b'),
154
+ Keyword.Namespace),
155
+ (words((
156
+ 'void', 'bool', 'byte', 'i16', 'i32', 'i64', 'double',
157
+ 'string', 'binary', 'map', 'list', 'set', 'slist',
158
+ 'senum'), suffix=r'\b'),
159
+ Keyword.Type),
160
+ (words((
161
+ 'BEGIN', 'END', '__CLASS__', '__DIR__', '__FILE__',
162
+ '__FUNCTION__', '__LINE__', '__METHOD__', '__NAMESPACE__',
163
+ 'abstract', 'alias', 'and', 'args', 'as', 'assert', 'begin',
164
+ 'break', 'case', 'catch', 'class', 'clone', 'continue',
165
+ 'declare', 'def', 'default', 'del', 'delete', 'do', 'dynamic',
166
+ 'elif', 'else', 'elseif', 'elsif', 'end', 'enddeclare',
167
+ 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile',
168
+ 'ensure', 'except', 'exec', 'finally', 'float', 'for',
169
+ 'foreach', 'function', 'global', 'goto', 'if', 'implements',
170
+ 'import', 'in', 'inline', 'instanceof', 'interface', 'is',
171
+ 'lambda', 'module', 'native', 'new', 'next', 'nil', 'not',
172
+ 'or', 'pass', 'public', 'print', 'private', 'protected',
173
+ 'raise', 'redo', 'rescue', 'retry', 'register', 'return',
174
+ 'self', 'sizeof', 'static', 'super', 'switch', 'synchronized',
175
+ 'then', 'this', 'throw', 'transient', 'try', 'undef',
176
+ 'unless', 'unsigned', 'until', 'use', 'var', 'virtual',
177
+ 'volatile', 'when', 'while', 'with', 'xor', 'yield'),
178
+ prefix=r'\b', suffix=r'\b'),
179
+ Keyword.Reserved),
180
+ ],
181
+ 'numbers': [
182
+ (r'[+-]?(\d+\.\d+([eE][+-]?\d+)?|\.?\d+[eE][+-]?\d+)', Number.Float),
183
+ (r'[+-]?0x[0-9A-Fa-f]+', Number.Hex),
184
+ (r'[+-]?[0-9]+', Number.Integer),
185
+ ],
186
+ }
187
+
188
+
189
+ class ZeekLexer(RegexLexer):
190
+ """
191
+ For Zeek scripts.
192
+ """
193
+ name = 'Zeek'
194
+ url = 'https://www.zeek.org/'
195
+ aliases = ['zeek', 'bro']
196
+ filenames = ['*.zeek', '*.bro']
197
+ version_added = '2.5'
198
+
199
+ _hex = r'[0-9a-fA-F]'
200
+ _float = r'((\d*\.?\d+)|(\d+\.?\d*))([eE][-+]?\d+)?'
201
+ _h = r'[A-Za-z0-9][-A-Za-z0-9]*'
202
+
203
+ tokens = {
204
+ 'root': [
205
+ include('whitespace'),
206
+ include('comments'),
207
+ include('directives'),
208
+ include('attributes'),
209
+ include('types'),
210
+ include('keywords'),
211
+ include('literals'),
212
+ include('operators'),
213
+ include('punctuation'),
214
+ (r'((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)(?=\s*\()',
215
+ Name.Function),
216
+ include('identifiers'),
217
+ ],
218
+
219
+ 'whitespace': [
220
+ (r'\n', Whitespace),
221
+ (r'\s+', Whitespace),
222
+ (r'(\\)(\n)', bygroups(Text, Whitespace)),
223
+ ],
224
+
225
+ 'comments': [
226
+ (r'#.*$', Comment),
227
+ ],
228
+
229
+ 'directives': [
230
+ (r'@(load-plugin|load-sigs|load|unload)\b.*$', Comment.Preproc),
231
+ (r'@(DEBUG|DIR|FILENAME|deprecated|if|ifdef|ifndef|else|endif)\b', Comment.Preproc),
232
+ (r'(@prefixes)(\s*)((\+?=).*)$', bygroups(Comment.Preproc,
233
+ Whitespace, Comment.Preproc)),
234
+ ],
235
+
236
+ 'attributes': [
237
+ (words(('redef', 'priority', 'log', 'optional', 'default', 'add_func',
238
+ 'delete_func', 'expire_func', 'read_expire', 'write_expire',
239
+ 'create_expire', 'synchronized', 'persistent', 'rotate_interval',
240
+ 'rotate_size', 'encrypt', 'raw_output', 'mergeable', 'error_handler',
241
+ 'type_column', 'deprecated'),
242
+ prefix=r'&', suffix=r'\b'),
243
+ Keyword.Pseudo),
244
+ ],
245
+
246
+ 'types': [
247
+ (words(('any',
248
+ 'enum', 'record', 'set', 'table', 'vector',
249
+ 'function', 'hook', 'event',
250
+ 'addr', 'bool', 'count', 'double', 'file', 'int', 'interval',
251
+ 'pattern', 'port', 'string', 'subnet', 'time'),
252
+ suffix=r'\b'),
253
+ Keyword.Type),
254
+
255
+ (r'(opaque)(\s+)(of)(\s+)((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)\b',
256
+ bygroups(Keyword.Type, Whitespace, Operator.Word, Whitespace, Keyword.Type)),
257
+
258
+ (r'(type)(\s+)((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)(\s*)(:)(\s*)\b(record|enum)\b',
259
+ bygroups(Keyword, Whitespace, Name.Class, Whitespace, Operator, Whitespace, Keyword.Type)),
260
+
261
+ (r'(type)(\s+)((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)(\s*)(:)',
262
+ bygroups(Keyword, Whitespace, Name, Whitespace, Operator)),
263
+
264
+ (r'(redef)(\s+)(record|enum)(\s+)((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)\b',
265
+ bygroups(Keyword, Whitespace, Keyword.Type, Whitespace, Name.Class)),
266
+ ],
267
+
268
+ 'keywords': [
269
+ (words(('redef', 'export', 'if', 'else', 'for', 'while',
270
+ 'return', 'break', 'next', 'continue', 'fallthrough',
271
+ 'switch', 'default', 'case',
272
+ 'add', 'delete',
273
+ 'when', 'timeout', 'schedule'),
274
+ suffix=r'\b'),
275
+ Keyword),
276
+ (r'(print)\b', Keyword),
277
+ (r'(global|local|const|option)\b', Keyword.Declaration),
278
+ (r'(module)(\s+)(([A-Za-z_]\w*)(?:::([A-Za-z_]\w*))*)\b',
279
+ bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
280
+ ],
281
+
282
+ 'literals': [
283
+ (r'"', String, 'string'),
284
+
285
+ # Not the greatest match for patterns, but generally helps
286
+ # disambiguate between start of a pattern and just a division
287
+ # operator.
288
+ (r'/(?=.*/)', String.Regex, 'regex'),
289
+
290
+ (r'[TF]\b', Keyword.Constant),
291
+
292
+ # Port
293
+ (r'\d{1,5}/(udp|tcp|icmp|unknown)\b', Number),
294
+
295
+ # IPv4 Address
296
+ (r'(\d{1,3}.){3}(\d{1,3})\b', Number),
297
+
298
+ # IPv6 Address
299
+ (r'\[([0-9a-fA-F]{0,4}:){2,7}([0-9a-fA-F]{0,4})?((\d{1,3}.){3}(\d{1,3}))?\]', Number),
300
+
301
+ # Numeric
302
+ (r'0[xX]' + _hex + r'+\b', Number.Hex),
303
+ (_float + r'\s*(day|hr|min|sec|msec|usec)s?\b', Number.Float),
304
+ (_float + r'\b', Number.Float),
305
+ (r'(\d+)\b', Number.Integer),
306
+
307
+ # Hostnames
308
+ (_h + r'(\.' + _h + r')+', String),
309
+ ],
310
+
311
+ 'operators': [
312
+ (r'[!%*/+<=>~|&^-]', Operator),
313
+ (r'([-+=&|]{2}|[+=!><-]=)', Operator),
314
+ (r'(in|as|is|of)\b', Operator.Word),
315
+ (r'\??\$', Operator),
316
+ ],
317
+
318
+ 'punctuation': [
319
+ (r'[{}()\[\],;.]', Punctuation),
320
+ # The "ternary if", which uses '?' and ':', could instead be
321
+ # treated as an Operator, but colons are more frequently used to
322
+ # separate field/identifier names from their types, so the (often)
323
+ # less-prominent Punctuation is used even with '?' for consistency.
324
+ (r'[?:]', Punctuation),
325
+ ],
326
+
327
+ 'identifiers': [
328
+ (r'([a-zA-Z_]\w*)(::)', bygroups(Name, Punctuation)),
329
+ (r'[a-zA-Z_]\w*', Name)
330
+ ],
331
+
332
+ 'string': [
333
+ (r'\\.', String.Escape),
334
+ (r'%-?[0-9]*(\.[0-9]+)?[DTd-gsx]', String.Escape),
335
+ (r'"', String, '#pop'),
336
+ (r'.', String),
337
+ ],
338
+
339
+ 'regex': [
340
+ (r'\\.', String.Escape),
341
+ (r'/', String.Regex, '#pop'),
342
+ (r'.', String.Regex),
343
+ ],
344
+ }
345
+
346
+
347
+ BroLexer = ZeekLexer
348
+
349
+
350
+ class PuppetLexer(RegexLexer):
351
+ """
352
+ For Puppet configuration DSL.
353
+ """
354
+ name = 'Puppet'
355
+ url = 'https://puppet.com/'
356
+ aliases = ['puppet']
357
+ filenames = ['*.pp']
358
+ version_added = '1.6'
359
+
360
+ tokens = {
361
+ 'root': [
362
+ include('comments'),
363
+ include('keywords'),
364
+ include('names'),
365
+ include('numbers'),
366
+ include('operators'),
367
+ include('strings'),
368
+
369
+ (r'[]{}:(),;[]', Punctuation),
370
+ (r'\s+', Whitespace),
371
+ ],
372
+
373
+ 'comments': [
374
+ (r'(\s*)(#.*)$', bygroups(Whitespace, Comment)),
375
+ (r'/(\\\n)?[*][\s\S]*?[*](\\\n)?/', Comment.Multiline),
376
+ ],
377
+
378
+ 'operators': [
379
+ (r'(=>|\?|<|>|=|\+|-|/|\*|~|!|\|)', Operator),
380
+ (r'(in|and|or|not)\b', Operator.Word),
381
+ ],
382
+
383
+ 'names': [
384
+ (r'[a-zA-Z_]\w*', Name.Attribute),
385
+ (r'(\$\S+)(\[)(\S+)(\])', bygroups(Name.Variable, Punctuation,
386
+ String, Punctuation)),
387
+ (r'\$\S+', Name.Variable),
388
+ ],
389
+
390
+ 'numbers': [
391
+ # Copypasta from the Python lexer
392
+ (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
393
+ (r'\d+[eE][+-]?[0-9]+j?', Number.Float),
394
+ (r'0[0-7]+j?', Number.Oct),
395
+ (r'0[xX][a-fA-F0-9]+', Number.Hex),
396
+ (r'\d+L', Number.Integer.Long),
397
+ (r'\d+j?', Number.Integer)
398
+ ],
399
+
400
+ 'keywords': [
401
+ # Left out 'group' and 'require'
402
+ # Since they're often used as attributes
403
+ (words((
404
+ 'absent', 'alert', 'alias', 'audit', 'augeas', 'before', 'case',
405
+ 'check', 'class', 'computer', 'configured', 'contained',
406
+ 'create_resources', 'crit', 'cron', 'debug', 'default',
407
+ 'define', 'defined', 'directory', 'else', 'elsif', 'emerg',
408
+ 'err', 'exec', 'extlookup', 'fail', 'false', 'file',
409
+ 'filebucket', 'fqdn_rand', 'generate', 'host', 'if', 'import',
410
+ 'include', 'info', 'inherits', 'inline_template', 'installed',
411
+ 'interface', 'k5login', 'latest', 'link', 'loglevel',
412
+ 'macauthorization', 'mailalias', 'maillist', 'mcx', 'md5',
413
+ 'mount', 'mounted', 'nagios_command', 'nagios_contact',
414
+ 'nagios_contactgroup', 'nagios_host', 'nagios_hostdependency',
415
+ 'nagios_hostescalation', 'nagios_hostextinfo', 'nagios_hostgroup',
416
+ 'nagios_service', 'nagios_servicedependency', 'nagios_serviceescalation',
417
+ 'nagios_serviceextinfo', 'nagios_servicegroup', 'nagios_timeperiod',
418
+ 'node', 'noop', 'notice', 'notify', 'package', 'present', 'purged',
419
+ 'realize', 'regsubst', 'resources', 'role', 'router', 'running',
420
+ 'schedule', 'scheduled_task', 'search', 'selboolean', 'selmodule',
421
+ 'service', 'sha1', 'shellquote', 'split', 'sprintf',
422
+ 'ssh_authorized_key', 'sshkey', 'stage', 'stopped', 'subscribe',
423
+ 'tag', 'tagged', 'template', 'tidy', 'true', 'undef', 'unmounted',
424
+ 'user', 'versioncmp', 'vlan', 'warning', 'yumrepo', 'zfs', 'zone',
425
+ 'zpool'), prefix='(?i)', suffix=r'\b'),
426
+ Keyword),
427
+ ],
428
+
429
+ 'strings': [
430
+ (r'"([^"])*"', String),
431
+ (r"'(\\'|[^'])*'", String),
432
+ ],
433
+
434
+ }
435
+
436
+
437
+ class RslLexer(RegexLexer):
438
+ """
439
+ RSL is the formal specification
440
+ language used in RAISE (Rigorous Approach to Industrial Software Engineering)
441
+ method.
442
+ """
443
+ name = 'RSL'
444
+ url = 'http://en.wikipedia.org/wiki/RAISE'
445
+ aliases = ['rsl']
446
+ filenames = ['*.rsl']
447
+ mimetypes = ['text/rsl']
448
+ version_added = '2.0'
449
+
450
+ flags = re.MULTILINE | re.DOTALL
451
+
452
+ tokens = {
453
+ 'root': [
454
+ (words((
455
+ 'Bool', 'Char', 'Int', 'Nat', 'Real', 'Text', 'Unit', 'abs',
456
+ 'all', 'always', 'any', 'as', 'axiom', 'card', 'case', 'channel',
457
+ 'chaos', 'class', 'devt_relation', 'dom', 'elems', 'else', 'elif',
458
+ 'end', 'exists', 'extend', 'false', 'for', 'hd', 'hide', 'if',
459
+ 'in', 'is', 'inds', 'initialise', 'int', 'inter', 'isin', 'len',
460
+ 'let', 'local', 'ltl_assertion', 'object', 'of', 'out', 'post',
461
+ 'pre', 'read', 'real', 'rng', 'scheme', 'skip', 'stop', 'swap',
462
+ 'then', 'theory', 'test_case', 'tl', 'transition_system', 'true',
463
+ 'type', 'union', 'until', 'use', 'value', 'variable', 'while',
464
+ 'with', 'write', '~isin', '-inflist', '-infset', '-list',
465
+ '-set'), prefix=r'\b', suffix=r'\b'),
466
+ Keyword),
467
+ (r'(variable|value)\b', Keyword.Declaration),
468
+ (r'--.*?\n', Comment),
469
+ (r'<:.*?:>', Comment),
470
+ (r'\{!.*?!\}', Comment),
471
+ (r'/\*.*?\*/', Comment),
472
+ (r'^([ \t]*)([\w]+)([ \t]*)(:[^:])', bygroups(Whitespace,
473
+ Name.Function, Whitespace, Name.Function)),
474
+ (r'(^[ \t]*)([\w]+)([ \t]*)(\([\w\s,]*\))([ \t]*)(is|as)',
475
+ bygroups(Whitespace, Name.Function, Whitespace, Text,
476
+ Whitespace, Keyword)),
477
+ (r'\b[A-Z]\w*\b', Keyword.Type),
478
+ (r'(true|false)\b', Keyword.Constant),
479
+ (r'".*"', String),
480
+ (r'\'.\'', String.Char),
481
+ (r'(><|->|-m->|/\\|<=|<<=|<\.|\|\||\|\^\||-~->|-~m->|\\/|>=|>>|'
482
+ r'\.>|\+\+|-\\|<->|=>|:-|~=|\*\*|<<|>>=|\+>|!!|\|=\||#)',
483
+ Operator),
484
+ (r'[0-9]+\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
485
+ (r'0x[0-9a-f]+', Number.Hex),
486
+ (r'[0-9]+', Number.Integer),
487
+ (r'\s+', Whitespace),
488
+ (r'.', Text),
489
+ ],
490
+ }
491
+
492
+ def analyse_text(text):
493
+ """
494
+ Check for the most common text in the beginning of a RSL file.
495
+ """
496
+ if re.search(r'scheme\s*.*?=\s*class\s*type', text, re.I) is not None:
497
+ return 1.0
498
+
499
+
500
+ class MscgenLexer(RegexLexer):
501
+ """
502
+ For Mscgen files.
503
+ """
504
+ name = 'Mscgen'
505
+ url = 'http://www.mcternan.me.uk/mscgen/'
506
+ aliases = ['mscgen', 'msc']
507
+ filenames = ['*.msc']
508
+ version_added = '1.6'
509
+
510
+ _var = r'(\w+|"(?:\\"|[^"])*")'
511
+
512
+ tokens = {
513
+ 'root': [
514
+ (r'msc\b', Keyword.Type),
515
+ # Options
516
+ (r'(hscale|HSCALE|width|WIDTH|wordwraparcs|WORDWRAPARCS'
517
+ r'|arcgradient|ARCGRADIENT)\b', Name.Property),
518
+ # Operators
519
+ (r'(abox|ABOX|rbox|RBOX|box|BOX|note|NOTE)\b', Operator.Word),
520
+ (r'(\.|-|\|){3}', Keyword),
521
+ (r'(?:-|=|\.|:){2}'
522
+ r'|<<=>>|<->|<=>|<<>>|<:>'
523
+ r'|->|=>>|>>|=>|:>|-x|-X'
524
+ r'|<-|<<=|<<|<=|<:|x-|X-|=', Operator),
525
+ # Names
526
+ (r'\*', Name.Builtin),
527
+ (_var, Name.Variable),
528
+ # Other
529
+ (r'\[', Punctuation, 'attrs'),
530
+ (r'\{|\}|,|;', Punctuation),
531
+ include('comments')
532
+ ],
533
+ 'attrs': [
534
+ (r'\]', Punctuation, '#pop'),
535
+ (_var + r'(\s*)(=)(\s*)' + _var,
536
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace,
537
+ String)),
538
+ (r',', Punctuation),
539
+ include('comments')
540
+ ],
541
+ 'comments': [
542
+ (r'(?://|#).*?\n', Comment.Single),
543
+ (r'/\*[\s\S]*?\*/', Comment.Multiline),
544
+ (r'[ \t\r\n]+', Whitespace)
545
+ ]
546
+ }
547
+
548
+
549
+ class VGLLexer(RegexLexer):
550
+ """
551
+ For SampleManager VGL source code.
552
+ """
553
+ name = 'VGL'
554
+ url = 'http://www.thermoscientific.com/samplemanager'
555
+ aliases = ['vgl']
556
+ filenames = ['*.rpf']
557
+ version_added = '1.6'
558
+
559
+ flags = re.MULTILINE | re.DOTALL | re.IGNORECASE
560
+
561
+ tokens = {
562
+ 'root': [
563
+ (r'\{[^}]*\}', Comment.Multiline),
564
+ (r'declare', Keyword.Constant),
565
+ (r'(if|then|else|endif|while|do|endwhile|and|or|prompt|object'
566
+ r'|create|on|line|with|global|routine|value|endroutine|constant'
567
+ r'|global|set|join|library|compile_option|file|exists|create|copy'
568
+ r'|delete|enable|windows|name|notprotected)(?! *[=<>.,()])',
569
+ Keyword),
570
+ (r'(true|false|null|empty|error|locked)', Keyword.Constant),
571
+ (r'[~^*#!%&\[\]()<>|+=:;,./?-]', Operator),
572
+ (r'"[^"]*"', String),
573
+ (r'(\.)([a-z_$][\w$]*)', bygroups(Operator, Name.Attribute)),
574
+ (r'[0-9][0-9]*(\.[0-9]+(e[+\-]?[0-9]+)?)?', Number),
575
+ (r'[a-z_$][\w$]*', Name),
576
+ (r'[\r\n]+', Whitespace),
577
+ (r'\s+', Whitespace)
578
+ ]
579
+ }
580
+
581
+
582
+ class AlloyLexer(RegexLexer):
583
+ """
584
+ For Alloy source code.
585
+ """
586
+
587
+ name = 'Alloy'
588
+ url = 'http://alloy.mit.edu'
589
+ aliases = ['alloy']
590
+ filenames = ['*.als']
591
+ mimetypes = ['text/x-alloy']
592
+ version_added = '2.0'
593
+
594
+ flags = re.MULTILINE | re.DOTALL
595
+
596
+ iden_rex = r'[a-zA-Z_][\w]*"*'
597
+ string_rex = r'"\b(\\\\|\\[^\\]|[^"\\])*"'
598
+ text_tuple = (r'[^\S\n]+', Whitespace)
599
+
600
+ tokens = {
601
+ 'sig': [
602
+ (r'(extends)\b', Keyword, '#pop'),
603
+ (iden_rex, Name),
604
+ text_tuple,
605
+ (r',', Punctuation),
606
+ (r'\{', Operator, '#pop'),
607
+ ],
608
+ 'module': [
609
+ text_tuple,
610
+ (iden_rex, Name, '#pop'),
611
+ ],
612
+ 'fun': [
613
+ text_tuple,
614
+ (r'\{', Operator, '#pop'),
615
+ (iden_rex, Name, '#pop'),
616
+ ],
617
+ 'fact': [
618
+ include('fun'),
619
+ (string_rex, String, '#pop'),
620
+ ],
621
+ 'root': [
622
+ (r'--.*?$', Comment.Single),
623
+ (r'//.*?$', Comment.Single),
624
+ (r'/\*.*?\*/', Comment.Multiline),
625
+ text_tuple,
626
+ (r'(module|open)(\s+)', bygroups(Keyword.Namespace, Whitespace),
627
+ 'module'),
628
+ (r'(sig|enum)(\s+)', bygroups(Keyword.Declaration, Whitespace), 'sig'),
629
+ (r'(iden|univ|none)\b', Keyword.Constant),
630
+ (r'(int|Int)\b', Keyword.Type),
631
+ (r'(var|this|abstract|extends|set|seq|one|lone|let)\b', Keyword),
632
+ (r'(all|some|no|sum|disj|when|else)\b', Keyword),
633
+ (r'(run|check|for|but|exactly|expect|as|steps)\b', Keyword),
634
+ (r'(always|after|eventually|until|release)\b', Keyword), # future time operators
635
+ (r'(historically|before|once|since|triggered)\b', Keyword), # past time operators
636
+ (r'(and|or|implies|iff|in)\b', Operator.Word),
637
+ (r'(fun|pred|assert)(\s+)', bygroups(Keyword, Whitespace), 'fun'),
638
+ (r'(fact)(\s+)', bygroups(Keyword, Whitespace), 'fact'),
639
+ (r'!|#|&&|\+\+|<<|>>|>=|<=>|<=|\.\.|\.|->', Operator),
640
+ (r'[-+/*%=<>&!^|~{}\[\]().\';]', Operator),
641
+ (iden_rex, Name),
642
+ (r'[:,]', Punctuation),
643
+ (r'[0-9]+', Number.Integer),
644
+ (string_rex, String),
645
+ (r'\n', Whitespace),
646
+ ]
647
+ }
648
+
649
+
650
+ class PanLexer(RegexLexer):
651
+ """
652
+ Lexer for pan source files.
653
+
654
+ Based on tcsh lexer.
655
+ """
656
+
657
+ name = 'Pan'
658
+ url = 'https://github.com/quattor/pan/'
659
+ aliases = ['pan']
660
+ filenames = ['*.pan']
661
+ version_added = '2.0'
662
+
663
+ tokens = {
664
+ 'root': [
665
+ include('basic'),
666
+ (r'\(', Keyword, 'paren'),
667
+ (r'\{', Keyword, 'curly'),
668
+ include('data'),
669
+ ],
670
+ 'basic': [
671
+ (words((
672
+ 'if', 'for', 'with', 'else', 'type', 'bind', 'while', 'valid', 'final',
673
+ 'prefix', 'unique', 'object', 'foreach', 'include', 'template',
674
+ 'function', 'variable', 'structure', 'extensible', 'declaration'),
675
+ prefix=r'\b', suffix=r'\b'),
676
+ Keyword),
677
+ (words((
678
+ 'file_contents', 'format', 'index', 'length', 'match', 'matches',
679
+ 'replace', 'splice', 'split', 'substr', 'to_lowercase', 'to_uppercase',
680
+ 'debug', 'error', 'traceback', 'deprecated', 'base64_decode',
681
+ 'base64_encode', 'digest', 'escape', 'unescape', 'append', 'create',
682
+ 'first', 'nlist', 'key', 'list', 'merge', 'next', 'prepend', 'is_boolean',
683
+ 'is_defined', 'is_double', 'is_list', 'is_long', 'is_nlist', 'is_null',
684
+ 'is_number', 'is_property', 'is_resource', 'is_string', 'to_boolean',
685
+ 'to_double', 'to_long', 'to_string', 'clone', 'delete', 'exists',
686
+ 'path_exists', 'if_exists', 'return', 'value'),
687
+ prefix=r'\b', suffix=r'\b'),
688
+ Name.Builtin),
689
+ (r'#.*', Comment),
690
+ (r'\\[\w\W]', String.Escape),
691
+ (r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Whitespace, Operator)),
692
+ (r'[\[\]{}()=]+', Operator),
693
+ (r'<<\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
694
+ (r';', Punctuation),
695
+ ],
696
+ 'data': [
697
+ (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
698
+ (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
699
+ (r'\s+', Whitespace),
700
+ (r'[^=\s\[\]{}()$"\'`\\;#]+', Text),
701
+ (r'\d+(?= |\Z)', Number),
702
+ ],
703
+ 'curly': [
704
+ (r'\}', Keyword, '#pop'),
705
+ (r':-', Keyword),
706
+ (r'\w+', Name.Variable),
707
+ (r'[^}:"\'`$]+', Punctuation),
708
+ (r':', Punctuation),
709
+ include('root'),
710
+ ],
711
+ 'paren': [
712
+ (r'\)', Keyword, '#pop'),
713
+ include('root'),
714
+ ],
715
+ }
716
+
717
+
718
+ class CrmshLexer(RegexLexer):
719
+ """
720
+ Lexer for crmsh configuration files for Pacemaker clusters.
721
+ """
722
+ name = 'Crmsh'
723
+ url = 'http://crmsh.github.io/'
724
+ aliases = ['crmsh', 'pcmk']
725
+ filenames = ['*.crmsh', '*.pcmk']
726
+ mimetypes = []
727
+ version_added = '2.1'
728
+
729
+ elem = words((
730
+ 'node', 'primitive', 'group', 'clone', 'ms', 'location',
731
+ 'colocation', 'order', 'fencing_topology', 'rsc_ticket',
732
+ 'rsc_template', 'property', 'rsc_defaults',
733
+ 'op_defaults', 'acl_target', 'acl_group', 'user', 'role',
734
+ 'tag'), suffix=r'(?![\w#$-])')
735
+ sub = words((
736
+ 'params', 'meta', 'operations', 'op', 'rule',
737
+ 'attributes', 'utilization'), suffix=r'(?![\w#$-])')
738
+ acl = words(('read', 'write', 'deny'), suffix=r'(?![\w#$-])')
739
+ bin_rel = words(('and', 'or'), suffix=r'(?![\w#$-])')
740
+ un_ops = words(('defined', 'not_defined'), suffix=r'(?![\w#$-])')
741
+ date_exp = words(('in_range', 'date', 'spec', 'in'), suffix=r'(?![\w#$-])')
742
+ acl_mod = (r'(?:tag|ref|reference|attribute|type|xpath)')
743
+ bin_ops = (r'(?:lt|gt|lte|gte|eq|ne)')
744
+ val_qual = (r'(?:string|version|number)')
745
+ rsc_role_action = (r'(?:Master|Started|Slave|Stopped|'
746
+ r'start|promote|demote|stop)')
747
+
748
+ tokens = {
749
+ 'root': [
750
+ (r'^(#.*)(\n)?', bygroups(Comment, Whitespace)),
751
+ # attr=value (nvpair)
752
+ (r'([\w#$-]+)(=)("(?:""|[^"])*"|\S+)',
753
+ bygroups(Name.Attribute, Punctuation, String)),
754
+ # need this construct, otherwise numeric node ids
755
+ # are matched as scores
756
+ # elem id:
757
+ (r'(node)(\s+)([\w#$-]+)(:)',
758
+ bygroups(Keyword, Whitespace, Name, Punctuation)),
759
+ # scores
760
+ (r'([+-]?([0-9]+|inf)):', Number),
761
+ # keywords (elements and other)
762
+ (elem, Keyword),
763
+ (sub, Keyword),
764
+ (acl, Keyword),
765
+ # binary operators
766
+ (rf'(?:{val_qual}:)?({bin_ops})(?![\w#$-])', Operator.Word),
767
+ # other operators
768
+ (bin_rel, Operator.Word),
769
+ (un_ops, Operator.Word),
770
+ (date_exp, Operator.Word),
771
+ # builtin attributes (e.g. #uname)
772
+ (r'#[a-z]+(?![\w#$-])', Name.Builtin),
773
+ # acl_mod:blah
774
+ (rf'({acl_mod})(:)("(?:""|[^"])*"|\S+)',
775
+ bygroups(Keyword, Punctuation, Name)),
776
+ # rsc_id[:(role|action)]
777
+ # NB: this matches all other identifiers
778
+ (rf'([\w#$-]+)(?:(:)({rsc_role_action}))?(?![\w#$-])',
779
+ bygroups(Name, Punctuation, Operator.Word)),
780
+ # punctuation
781
+ (r'(\\(?=\n)|[\[\](){}/:@])', Punctuation),
782
+ (r'\s+|\n', Whitespace),
783
+ ],
784
+ }
785
+
786
+
787
+ class FlatlineLexer(RegexLexer):
788
+ """
789
+ Lexer for Flatline expressions.
790
+ """
791
+ name = 'Flatline'
792
+ url = 'https://github.com/bigmlcom/flatline'
793
+ aliases = ['flatline']
794
+ filenames = []
795
+ mimetypes = ['text/x-flatline']
796
+ version_added = '2.2'
797
+
798
+ special_forms = ('let',)
799
+
800
+ builtins = (
801
+ "!=", "*", "+", "-", "<", "<=", "=", ">", ">=", "abs", "acos", "all",
802
+ "all-but", "all-with-defaults", "all-with-numeric-default", "and",
803
+ "asin", "atan", "avg", "avg-window", "bin-center", "bin-count", "call",
804
+ "category-count", "ceil", "cond", "cond-window", "cons", "cos", "cosh",
805
+ "count", "diff-window", "div", "ensure-value", "ensure-weighted-value",
806
+ "epoch", "epoch-day", "epoch-fields", "epoch-hour", "epoch-millisecond",
807
+ "epoch-minute", "epoch-month", "epoch-second", "epoch-weekday",
808
+ "epoch-year", "exp", "f", "field", "field-prop", "fields", "filter",
809
+ "first", "floor", "head", "if", "in", "integer", "language", "length",
810
+ "levenshtein", "linear-regression", "list", "ln", "log", "log10", "map",
811
+ "matches", "matches?", "max", "maximum", "md5", "mean", "median", "min",
812
+ "minimum", "missing", "missing-count", "missing?", "missing_count",
813
+ "mod", "mode", "normalize", "not", "nth", "occurrences", "or",
814
+ "percentile", "percentile-label", "population", "population-fraction",
815
+ "pow", "preferred", "preferred?", "quantile-label", "rand", "rand-int",
816
+ "random-value", "re-quote", "real", "replace", "replace-first", "rest",
817
+ "round", "row-number", "segment-label", "sha1", "sha256", "sin", "sinh",
818
+ "sqrt", "square", "standard-deviation", "standard_deviation", "str",
819
+ "subs", "sum", "sum-squares", "sum-window", "sum_squares", "summary",
820
+ "summary-no", "summary-str", "tail", "tan", "tanh", "to-degrees",
821
+ "to-radians", "variance", "vectorize", "weighted-random-value", "window",
822
+ "winnow", "within-percentiles?", "z-score",
823
+ )
824
+
825
+ valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+'
826
+
827
+ tokens = {
828
+ 'root': [
829
+ # whitespaces - usually not relevant
830
+ (r'[,]+', Text),
831
+ (r'\s+', Whitespace),
832
+
833
+ # numbers
834
+ (r'-?\d+\.\d+', Number.Float),
835
+ (r'-?\d+', Number.Integer),
836
+ (r'0x-?[a-f\d]+', Number.Hex),
837
+
838
+ # strings, symbols and characters
839
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
840
+ (r"\\(.|[a-z]+)", String.Char),
841
+
842
+ # expression template placeholder
843
+ (r'_', String.Symbol),
844
+
845
+ # highlight the special forms
846
+ (words(special_forms, suffix=' '), Keyword),
847
+
848
+ # highlight the builtins
849
+ (words(builtins, suffix=' '), Name.Builtin),
850
+
851
+ # the remaining functions
852
+ (r'(?<=\()' + valid_name, Name.Function),
853
+
854
+ # find the remaining variables
855
+ (valid_name, Name.Variable),
856
+
857
+ # parentheses
858
+ (r'(\(|\))', Punctuation),
859
+ ],
860
+ }
861
+
862
+
863
+ class SnowballLexer(ExtendedRegexLexer):
864
+ """
865
+ Lexer for Snowball source code.
866
+ """
867
+
868
+ name = 'Snowball'
869
+ url = 'https://snowballstem.org/'
870
+ aliases = ['snowball']
871
+ filenames = ['*.sbl']
872
+ version_added = '2.2'
873
+
874
+ _ws = r'\n\r\t '
875
+
876
+ def __init__(self, **options):
877
+ self._reset_stringescapes()
878
+ ExtendedRegexLexer.__init__(self, **options)
879
+
880
+ def _reset_stringescapes(self):
881
+ self._start = "'"
882
+ self._end = "'"
883
+
884
+ def _string(do_string_first):
885
+ def callback(lexer, match, ctx):
886
+ s = match.start()
887
+ text = match.group()
888
+ string = re.compile(rf'([^{re.escape(lexer._start)}]*)(.)').match
889
+ escape = re.compile(rf'([^{re.escape(lexer._end)}]*)(.)').match
890
+ pos = 0
891
+ do_string = do_string_first
892
+ while pos < len(text):
893
+ if do_string:
894
+ match = string(text, pos)
895
+ yield s + match.start(1), String.Single, match.group(1)
896
+ if match.group(2) == "'":
897
+ yield s + match.start(2), String.Single, match.group(2)
898
+ ctx.stack.pop()
899
+ break
900
+ yield s + match.start(2), String.Escape, match.group(2)
901
+ pos = match.end()
902
+ match = escape(text, pos)
903
+ yield s + match.start(), String.Escape, match.group()
904
+ if match.group(2) != lexer._end:
905
+ ctx.stack[-1] = 'escape'
906
+ break
907
+ pos = match.end()
908
+ do_string = True
909
+ ctx.pos = s + match.end()
910
+ return callback
911
+
912
+ def _stringescapes(lexer, match, ctx):
913
+ lexer._start = match.group(3)
914
+ lexer._end = match.group(5)
915
+ return bygroups(Keyword.Reserved, Whitespace, String.Escape, Whitespace,
916
+ String.Escape)(lexer, match, ctx)
917
+
918
+ tokens = {
919
+ 'root': [
920
+ (r'len\b', Name.Builtin),
921
+ (r'lenof\b', Operator.Word),
922
+ include('root1'),
923
+ ],
924
+ 'root1': [
925
+ (rf'[{_ws}]+', Whitespace),
926
+ (r'\d+', Number.Integer),
927
+ (r"'", String.Single, 'string'),
928
+ (r'[()]', Punctuation),
929
+ (r'/\*[\w\W]*?\*/', Comment.Multiline),
930
+ (r'//.*', Comment.Single),
931
+ (r'[!*+\-/<=>]=|[-=]>|<[+-]|[$*+\-/<=>?\[\]]', Operator),
932
+ (words(('as', 'get', 'hex', 'among', 'define', 'decimal',
933
+ 'backwardmode'), suffix=r'\b'),
934
+ Keyword.Reserved),
935
+ (words(('strings', 'booleans', 'integers', 'routines', 'externals',
936
+ 'groupings'), suffix=r'\b'),
937
+ Keyword.Reserved, 'declaration'),
938
+ (words(('do', 'or', 'and', 'for', 'hop', 'non', 'not', 'set', 'try',
939
+ 'fail', 'goto', 'loop', 'next', 'test', 'true',
940
+ 'false', 'unset', 'atmark', 'attach', 'delete', 'gopast',
941
+ 'insert', 'repeat', 'sizeof', 'tomark', 'atleast',
942
+ 'atlimit', 'reverse', 'setmark', 'tolimit', 'setlimit',
943
+ 'backwards', 'substring'), suffix=r'\b'),
944
+ Operator.Word),
945
+ (words(('size', 'limit', 'cursor', 'maxint', 'minint'),
946
+ suffix=r'\b'),
947
+ Name.Builtin),
948
+ (rf'(stringdef\b)([{_ws}]*)([^{_ws}]+)',
949
+ bygroups(Keyword.Reserved, Whitespace, String.Escape)),
950
+ (rf'(stringescapes\b)([{_ws}]*)(.)([{_ws}]*)(.)',
951
+ _stringescapes),
952
+ (r'[A-Za-z]\w*', Name),
953
+ ],
954
+ 'declaration': [
955
+ (r'\)', Punctuation, '#pop'),
956
+ (words(('len', 'lenof'), suffix=r'\b'), Name,
957
+ ('root1', 'declaration')),
958
+ include('root1'),
959
+ ],
960
+ 'string': [
961
+ (r"[^']*'", _string(True)),
962
+ ],
963
+ 'escape': [
964
+ (r"[^']*'", _string(False)),
965
+ ],
966
+ }
967
+
968
+ def get_tokens_unprocessed(self, text=None, context=None):
969
+ self._reset_stringescapes()
970
+ return ExtendedRegexLexer.get_tokens_unprocessed(self, text, context)