Amar-Aly commited on
Commit
9577b22
·
verified ·
1 Parent(s): 51dc00c

Add files using upload-large-folder tool

Browse files
Files changed (20) hide show
  1. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/archetype.py +315 -0
  2. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/arrow.py +116 -0
  3. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/arturo.py +249 -0
  4. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/asc.py +55 -0
  5. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/asm.py +1058 -0
  6. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/asn1.py +178 -0
  7. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/automation.py +379 -0
  8. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/bare.py +101 -0
  9. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/basic.py +656 -0
  10. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/bdd.py +57 -0
  11. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/berry.py +99 -0
  12. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/bibtex.py +159 -0
  13. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/blueprint.py +173 -0
  14. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/boa.py +97 -0
  15. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/bqn.py +112 -0
  16. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/business.py +625 -0
  17. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/c_cpp.py +415 -0
  18. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/c_like.py +738 -0
  19. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/capnproto.py +74 -0
  20. .cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/carbon.py +95 -0
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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((h|H)[0-9a-fA-F]{4}|(f|F)[0-9a-fA-F]{8}|(d|D)[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'(\n|\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'(\n|\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'((?:.|\n)+?)(?=(\.\.\.|---))', 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'((?:.|\n)+?)(?=\.\.\.|---)', 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'(?!\.\.\.|---)((?:.|\n)+)', 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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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)(.|\n)*?(#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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/basic.py ADDED
@@ -0,0 +1,656 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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(\n|.)*?\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'\-?\d+#?', Number.Integer),
461
+ (r'!=|==|:=|\.=|<<|>>|[-~+/\\*%=<>&^|?:!.]', Operator),
462
+ (r'[\[\]{}(),;]', Punctuation),
463
+ (r'[\w]+', Name.Variable.Global),
464
+ ],
465
+ # can't use regular \b because of X$()
466
+ # XXX: use words() here
467
+ 'declarations': [
468
+ (r'\b({})(?=\(|\b)'.format('|'.join(map(re.escape, declarations))),
469
+ Keyword.Declaration),
470
+ ],
471
+ 'functions': [
472
+ (r'\b({})(?=\(|\b)'.format('|'.join(map(re.escape, functions))),
473
+ Keyword.Reserved),
474
+ ],
475
+ 'metacommands': [
476
+ (r'\b({})(?=\(|\b)'.format('|'.join(map(re.escape, metacommands))),
477
+ Keyword.Constant),
478
+ ],
479
+ 'operators': [
480
+ (r'\b({})(?=\(|\b)'.format('|'.join(map(re.escape, operators))), Operator.Word),
481
+ ],
482
+ 'statements': [
483
+ (r'\b({})\b'.format('|'.join(map(re.escape, statements))),
484
+ Keyword.Reserved),
485
+ ],
486
+ 'keywords': [
487
+ (r'\b({})\b'.format('|'.join(keywords)), Keyword),
488
+ ],
489
+ }
490
+
491
+ def analyse_text(text):
492
+ if '$DYNAMIC' in text or '$STATIC' in text:
493
+ return 0.9
494
+
495
+
496
+ class VBScriptLexer(RegexLexer):
497
+ """
498
+ VBScript is scripting language that is modeled on Visual Basic.
499
+ """
500
+ name = 'VBScript'
501
+ aliases = ['vbscript']
502
+ filenames = ['*.vbs', '*.VBS']
503
+ url = 'https://learn.microsoft.com/en-us/previous-versions/t0aew7h6(v=vs.85)'
504
+ version_added = '2.4'
505
+
506
+ flags = re.IGNORECASE
507
+
508
+ tokens = {
509
+ 'root': [
510
+ (r"'[^\n]*", Comment.Single),
511
+ (r'\s+', Whitespace),
512
+ ('"', String.Double, 'string'),
513
+ ('&h[0-9a-f]+', Number.Hex),
514
+ # Float variant 1, for example: 1., 1.e2, 1.2e3
515
+ (r'[0-9]+\.[0-9]*(e[+-]?[0-9]+)?', Number.Float),
516
+ (r'\.[0-9]+(e[+-]?[0-9]+)?', Number.Float), # Float variant 2, for example: .1, .1e2
517
+ (r'[0-9]+e[+-]?[0-9]+', Number.Float), # Float variant 3, for example: 123e45
518
+ (r'[0-9]+', Number.Integer),
519
+ ('#.+#', String), # date or time value
520
+ (r'(dim)(\s+)([a-z_][a-z0-9_]*)',
521
+ bygroups(Keyword.Declaration, Whitespace, Name.Variable), 'dim_more'),
522
+ (r'(function|sub)(\s+)([a-z_][a-z0-9_]*)',
523
+ bygroups(Keyword.Declaration, Whitespace, Name.Function)),
524
+ (r'(class)(\s+)([a-z_][a-z0-9_]*)',
525
+ bygroups(Keyword.Declaration, Whitespace, Name.Class)),
526
+ (r'(const)(\s+)([a-z_][a-z0-9_]*)',
527
+ bygroups(Keyword.Declaration, Whitespace, Name.Constant)),
528
+ (r'(end)(\s+)(class|function|if|property|sub|with)',
529
+ bygroups(Keyword, Whitespace, Keyword)),
530
+ (r'(on)(\s+)(error)(\s+)(goto)(\s+)(0)',
531
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword, Whitespace, Number.Integer)),
532
+ (r'(on)(\s+)(error)(\s+)(resume)(\s+)(next)',
533
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword, Whitespace, Keyword)),
534
+ (r'(option)(\s+)(explicit)', bygroups(Keyword, Whitespace, Keyword)),
535
+ (r'(property)(\s+)(get|let|set)(\s+)([a-z_][a-z0-9_]*)',
536
+ bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration, Whitespace, Name.Property)),
537
+ (r'rem\s.*[^\n]*', Comment.Single),
538
+ (words(_vbscript_builtins.KEYWORDS, suffix=r'\b'), Keyword),
539
+ (words(_vbscript_builtins.OPERATORS), Operator),
540
+ (words(_vbscript_builtins.OPERATOR_WORDS, suffix=r'\b'), Operator.Word),
541
+ (words(_vbscript_builtins.BUILTIN_CONSTANTS, suffix=r'\b'), Name.Constant),
542
+ (words(_vbscript_builtins.BUILTIN_FUNCTIONS, suffix=r'\b'), Name.Builtin),
543
+ (words(_vbscript_builtins.BUILTIN_VARIABLES, suffix=r'\b'), Name.Builtin),
544
+ (r'[a-z_][a-z0-9_]*', Name),
545
+ (r'\b_\n', Operator),
546
+ (words(r'(),.:'), Punctuation),
547
+ (r'.+(\n)?', Error)
548
+ ],
549
+ 'dim_more': [
550
+ (r'(\s*)(,)(\s*)([a-z_][a-z0-9]*)',
551
+ bygroups(Whitespace, Punctuation, Whitespace, Name.Variable)),
552
+ default('#pop'),
553
+ ],
554
+ 'string': [
555
+ (r'[^"\n]+', String.Double),
556
+ (r'\"\"', String.Double),
557
+ (r'"', String.Double, '#pop'),
558
+ (r'\n', Error, '#pop'), # Unterminated string
559
+ ],
560
+ }
561
+
562
+
563
+ class BBCBasicLexer(RegexLexer):
564
+ """
565
+ BBC Basic was supplied on the BBC Micro, and later Acorn RISC OS.
566
+ It is also used by BBC Basic For Windows.
567
+ """
568
+ base_keywords = ['OTHERWISE', 'AND', 'DIV', 'EOR', 'MOD', 'OR', 'ERROR',
569
+ 'LINE', 'OFF', 'STEP', 'SPC', 'TAB', 'ELSE', 'THEN',
570
+ 'OPENIN', 'PTR', 'PAGE', 'TIME', 'LOMEM', 'HIMEM', 'ABS',
571
+ 'ACS', 'ADVAL', 'ASC', 'ASN', 'ATN', 'BGET', 'COS', 'COUNT',
572
+ 'DEG', 'ERL', 'ERR', 'EVAL', 'EXP', 'EXT', 'FALSE', 'FN',
573
+ 'GET', 'INKEY', 'INSTR', 'INT', 'LEN', 'LN', 'LOG', 'NOT',
574
+ 'OPENUP', 'OPENOUT', 'PI', 'POINT', 'POS', 'RAD', 'RND',
575
+ 'SGN', 'SIN', 'SQR', 'TAN', 'TO', 'TRUE', 'USR', 'VAL',
576
+ 'VPOS', 'CHR$', 'GET$', 'INKEY$', 'LEFT$', 'MID$',
577
+ 'RIGHT$', 'STR$', 'STRING$', 'EOF', 'PTR', 'PAGE', 'TIME',
578
+ 'LOMEM', 'HIMEM', 'SOUND', 'BPUT', 'CALL', 'CHAIN', 'CLEAR',
579
+ 'CLOSE', 'CLG', 'CLS', 'DATA', 'DEF', 'DIM', 'DRAW', 'END',
580
+ 'ENDPROC', 'ENVELOPE', 'FOR', 'GOSUB', 'GOTO', 'GCOL', 'IF',
581
+ 'INPUT', 'LET', 'LOCAL', 'MODE', 'MOVE', 'NEXT', 'ON',
582
+ 'VDU', 'PLOT', 'PRINT', 'PROC', 'READ', 'REM', 'REPEAT',
583
+ 'REPORT', 'RESTORE', 'RETURN', 'RUN', 'STOP', 'COLOUR',
584
+ 'TRACE', 'UNTIL', 'WIDTH', 'OSCLI']
585
+
586
+ basic5_keywords = ['WHEN', 'OF', 'ENDCASE', 'ENDIF', 'ENDWHILE', 'CASE',
587
+ 'CIRCLE', 'FILL', 'ORIGIN', 'POINT', 'RECTANGLE', 'SWAP',
588
+ 'WHILE', 'WAIT', 'MOUSE', 'QUIT', 'SYS', 'INSTALL',
589
+ 'LIBRARY', 'TINT', 'ELLIPSE', 'BEATS', 'TEMPO', 'VOICES',
590
+ 'VOICE', 'STEREO', 'OVERLAY', 'APPEND', 'AUTO', 'CRUNCH',
591
+ 'DELETE', 'EDIT', 'HELP', 'LIST', 'LOAD', 'LVAR', 'NEW',
592
+ 'OLD', 'RENUMBER', 'SAVE', 'TEXTLOAD', 'TEXTSAVE',
593
+ 'TWIN', 'TWINO', 'INSTALL', 'SUM', 'BEAT']
594
+
595
+
596
+ name = 'BBC Basic'
597
+ aliases = ['bbcbasic']
598
+ filenames = ['*.bbc']
599
+ url = 'https://www.bbcbasic.co.uk/bbcbasic.html'
600
+ version_added = '2.4'
601
+
602
+ tokens = {
603
+ 'root': [
604
+ (r"[0-9]+", Name.Label),
605
+ (r"(\*)([^\n]*)",
606
+ bygroups(Keyword.Pseudo, Comment.Special)),
607
+ default('code'),
608
+ ],
609
+
610
+ 'code': [
611
+ (r"(REM)([^\n]*)",
612
+ bygroups(Keyword.Declaration, Comment.Single)),
613
+ (r'\n', Whitespace, 'root'),
614
+ (r'\s+', Whitespace),
615
+ (r':', Comment.Preproc),
616
+
617
+ # Some special cases to make functions come out nicer
618
+ (r'(DEF)(\s*)(FN|PROC)([A-Za-z_@][\w@]*)',
619
+ bygroups(Keyword.Declaration, Whitespace,
620
+ Keyword.Declaration, Name.Function)),
621
+ (r'(FN|PROC)([A-Za-z_@][\w@]*)',
622
+ bygroups(Keyword, Name.Function)),
623
+
624
+ (r'(GOTO|GOSUB|THEN|RESTORE)(\s*)(\d+)',
625
+ bygroups(Keyword, Whitespace, Name.Label)),
626
+
627
+ (r'(TRUE|FALSE)', Keyword.Constant),
628
+ (r'(PAGE|LOMEM|HIMEM|TIME|WIDTH|ERL|ERR|REPORT\$|POS|VPOS|VOICES)',
629
+ Keyword.Pseudo),
630
+
631
+ (words(base_keywords), Keyword),
632
+ (words(basic5_keywords), Keyword),
633
+
634
+ ('"', String.Double, 'string'),
635
+
636
+ ('%[01]{1,32}', Number.Bin),
637
+ ('&[0-9a-f]{1,8}', Number.Hex),
638
+
639
+ (r'[+-]?[0-9]+\.[0-9]*(E[+-]?[0-9]+)?', Number.Float),
640
+ (r'[+-]?\.[0-9]+(E[+-]?[0-9]+)?', Number.Float),
641
+ (r'[+-]?[0-9]+E[+-]?[0-9]+', Number.Float),
642
+ (r'[+-]?\d+', Number.Integer),
643
+
644
+ (r'([A-Za-z_@][\w@]*[%$]?)', Name.Variable),
645
+ (r'([+\-]=|[$!|?+\-*/%^=><();]|>=|<=|<>|<<|>>|>>>|,)', Operator),
646
+ ],
647
+ 'string': [
648
+ (r'[^"\n]+', String.Double),
649
+ (r'"', String.Double, '#pop'),
650
+ (r'\n', Error, 'root'), # Unterminated string
651
+ ],
652
+ }
653
+
654
+ def analyse_text(text):
655
+ if text.startswith('10REM >') or text.startswith('REM >'):
656
+ return 0.9
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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'#-(.|\n)*?-#', 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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/c_cpp.py ADDED
@@ -0,0 +1,415 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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', 'default',
117
+ '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')("[^"]+")([^\n]*)',
188
+ bygroups(using(this), Comment.Preproc, using(this),
189
+ Comment.PreprocFile, Comment.Single)),
190
+ (r'('+_ws1+r')(include)('+_ws1+r')(<[^>]+>)([^\n]*)',
191
+ bygroups(using(this), Comment.Preproc, using(this),
192
+ Comment.PreprocFile, Comment.Single)),
193
+ (r'[^/\n]+', Comment.Preproc),
194
+ (r'/[*](.|\n)*?[*]/', 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
+ (_ident, Name.Class, '#pop'),
208
+ # template specification
209
+ (r'\s*(?=>)', Text, '#pop'),
210
+ default('#pop')
211
+ ],
212
+ # Mark identifiers preceded by `case` keyword as constants.
213
+ 'case-value': [
214
+ (r'(?<!:)(:)(?!:)', Punctuation, '#pop'),
215
+ (_ident, Name.Constant),
216
+ include('whitespace'),
217
+ include('statements'),
218
+ ]
219
+ }
220
+
221
+ stdlib_types = {
222
+ 'size_t', 'ssize_t', 'off_t', 'wchar_t', 'ptrdiff_t', 'sig_atomic_t', 'fpos_t',
223
+ 'clock_t', 'time_t', 'va_list', 'jmp_buf', 'FILE', 'DIR', 'div_t', 'ldiv_t',
224
+ 'mbstate_t', 'wctrans_t', 'wint_t', 'wctype_t'}
225
+ c99_types = {
226
+ 'int8_t', 'int16_t', 'int32_t', 'int64_t', 'uint8_t',
227
+ 'uint16_t', 'uint32_t', 'uint64_t', 'int_least8_t', 'int_least16_t',
228
+ 'int_least32_t', 'int_least64_t', 'uint_least8_t', 'uint_least16_t',
229
+ 'uint_least32_t', 'uint_least64_t', 'int_fast8_t', 'int_fast16_t', 'int_fast32_t',
230
+ 'int_fast64_t', 'uint_fast8_t', 'uint_fast16_t', 'uint_fast32_t', 'uint_fast64_t',
231
+ 'intptr_t', 'uintptr_t', 'intmax_t', 'uintmax_t'}
232
+ linux_types = {
233
+ 'clockid_t', 'cpu_set_t', 'cpumask_t', 'dev_t', 'gid_t', 'id_t', 'ino_t', 'key_t',
234
+ 'mode_t', 'nfds_t', 'pid_t', 'rlim_t', 'sig_t', 'sighandler_t', 'siginfo_t',
235
+ 'sigset_t', 'sigval_t', 'socklen_t', 'timer_t', 'uid_t'}
236
+ c11_atomic_types = {
237
+ 'atomic_bool', 'atomic_char', 'atomic_schar', 'atomic_uchar', 'atomic_short',
238
+ 'atomic_ushort', 'atomic_int', 'atomic_uint', 'atomic_long', 'atomic_ulong',
239
+ 'atomic_llong', 'atomic_ullong', 'atomic_char16_t', 'atomic_char32_t', 'atomic_wchar_t',
240
+ 'atomic_int_least8_t', 'atomic_uint_least8_t', 'atomic_int_least16_t',
241
+ 'atomic_uint_least16_t', 'atomic_int_least32_t', 'atomic_uint_least32_t',
242
+ 'atomic_int_least64_t', 'atomic_uint_least64_t', 'atomic_int_fast8_t',
243
+ 'atomic_uint_fast8_t', 'atomic_int_fast16_t', 'atomic_uint_fast16_t',
244
+ 'atomic_int_fast32_t', 'atomic_uint_fast32_t', 'atomic_int_fast64_t',
245
+ 'atomic_uint_fast64_t', 'atomic_intptr_t', 'atomic_uintptr_t', 'atomic_size_t',
246
+ 'atomic_ptrdiff_t', 'atomic_intmax_t', 'atomic_uintmax_t'}
247
+
248
+ def __init__(self, **options):
249
+ self.stdlibhighlighting = get_bool_opt(options, 'stdlibhighlighting', True)
250
+ self.c99highlighting = get_bool_opt(options, 'c99highlighting', True)
251
+ self.c11highlighting = get_bool_opt(options, 'c11highlighting', True)
252
+ self.platformhighlighting = get_bool_opt(options, 'platformhighlighting', True)
253
+ RegexLexer.__init__(self, **options)
254
+
255
+ def get_tokens_unprocessed(self, text, stack=('root',)):
256
+ for index, token, value in \
257
+ RegexLexer.get_tokens_unprocessed(self, text, stack):
258
+ if token is Name:
259
+ if self.stdlibhighlighting and value in self.stdlib_types:
260
+ token = Keyword.Type
261
+ elif self.c99highlighting and value in self.c99_types:
262
+ token = Keyword.Type
263
+ elif self.c11highlighting and value in self.c11_atomic_types:
264
+ token = Keyword.Type
265
+ elif self.platformhighlighting and value in self.linux_types:
266
+ token = Keyword.Type
267
+ yield index, token, value
268
+
269
+
270
+ class CLexer(CFamilyLexer):
271
+ """
272
+ For C source code with preprocessor directives.
273
+
274
+ Additional options accepted:
275
+
276
+ `stdlibhighlighting`
277
+ Highlight common types found in the C/C++ standard library (e.g. `size_t`).
278
+ (default: ``True``).
279
+
280
+ `c99highlighting`
281
+ Highlight common types found in the C99 standard library (e.g. `int8_t`).
282
+ Actually, this includes all fixed-width integer types.
283
+ (default: ``True``).
284
+
285
+ `c11highlighting`
286
+ Highlight atomic types found in the C11 standard library (e.g. `atomic_bool`).
287
+ (default: ``True``).
288
+
289
+ `platformhighlighting`
290
+ Highlight common types found in the platform SDK headers (e.g. `clockid_t` on Linux).
291
+ (default: ``True``).
292
+ """
293
+ name = 'C'
294
+ aliases = ['c']
295
+ filenames = ['*.c', '*.h', '*.idc', '*.x[bp]m']
296
+ mimetypes = ['text/x-chdr', 'text/x-csrc', 'image/x-xbitmap', 'image/x-xpixmap']
297
+ url = 'https://en.wikipedia.org/wiki/C_(programming_language)'
298
+ version_added = ''
299
+ priority = 0.1
300
+
301
+ tokens = {
302
+ 'keywords': [
303
+ (words((
304
+ '_Alignas', '_Alignof', '_Noreturn', '_Countof', '_Generic', '_Thread_local',
305
+ '_Static_assert', '_Imaginary', 'countof', 'noreturn', 'imaginary', 'complex'),
306
+ suffix=r'\b'), Keyword),
307
+ inherit
308
+ ],
309
+ 'types': [
310
+ (words(('_Bool', '_Complex', '_Atomic', '_Decimal32', '_Decimal64', '_Decimal128'), suffix=r'\b'), Keyword.Type),
311
+ inherit
312
+ ]
313
+ }
314
+
315
+ def analyse_text(text):
316
+ if re.search(r'^\s*#include [<"]', text, re.MULTILINE):
317
+ return 0.1
318
+ if re.search(r'^\s*#ifn?def ', text, re.MULTILINE):
319
+ return 0.1
320
+
321
+
322
+ class CppLexer(CFamilyLexer):
323
+ """
324
+ For C++ source code with preprocessor directives.
325
+
326
+ Additional options accepted:
327
+
328
+ `stdlibhighlighting`
329
+ Highlight common types found in the C/C++ standard library (e.g. `size_t`).
330
+ (default: ``True``).
331
+
332
+ `c99highlighting`
333
+ Highlight common types found in the C99 standard library (e.g. `int8_t`).
334
+ Actually, this includes all fixed-width integer types.
335
+ (default: ``True``).
336
+
337
+ `c11highlighting`
338
+ Highlight atomic types found in the C11 standard library (e.g. `atomic_bool`).
339
+ (default: ``True``).
340
+
341
+ `platformhighlighting`
342
+ Highlight common types found in the platform SDK headers (e.g. `clockid_t` on Linux).
343
+ (default: ``True``).
344
+ """
345
+ name = 'C++'
346
+ url = 'https://isocpp.org/'
347
+ aliases = ['cpp', 'c++']
348
+ filenames = ['*.cpp', '*.hpp', '*.c++', '*.h++',
349
+ '*.cc', '*.hh', '*.cxx', '*.hxx',
350
+ '*.C', '*.H', '*.cp', '*.CPP', '*.tpp',
351
+ '*.cppm', '*.ixx', '*.mxx']
352
+ mimetypes = ['text/x-c++hdr', 'text/x-c++src']
353
+ version_added = ''
354
+ priority = 0.1
355
+
356
+ tokens = {
357
+ 'statements': [
358
+ # C++11 raw strings
359
+ (r'((?:[LuU]|u8)?R)(")([^\\()\s]{,16})(\()((?:.|\n)*?)(\)\3)(")',
360
+ bygroups(String.Affix, String, String.Delimiter, String.Delimiter,
361
+ String, String.Delimiter, String)),
362
+ inherit,
363
+ ],
364
+ 'root': [
365
+ inherit,
366
+ # C++ Microsoft-isms
367
+ (words(('virtual_inheritance', 'uuidof', 'super', 'extends', 'single_inheritance',
368
+ 'multiple_inheritance', 'interface', 'implements', 'event', 'finally', 'null'),
369
+ prefix=r'__', suffix=r'\b'), Keyword.Reserved),
370
+ # Offload C++ extensions, http://offload.codeplay.com/
371
+ (r'__(offload|blockingoffload|outer)\b', Keyword.Pseudo),
372
+ ],
373
+ 'enumname': [
374
+ include('whitespace'),
375
+ # 'enum class' and 'enum struct' C++11 support
376
+ (words(('class', 'struct'), suffix=r'\b'), Keyword),
377
+ (CFamilyLexer._ident, Name.Class, '#pop'),
378
+ # template specification
379
+ (r'\s*(?=>)', Text, '#pop'),
380
+ default('#pop')
381
+ ],
382
+ 'keywords': [
383
+ (r'(class|concept|typename)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
384
+ (words((
385
+ 'catch', 'const_cast', 'delete', 'dynamic_cast', 'explicit',
386
+ 'export', 'friend', 'mutable', 'new', 'operator',
387
+ 'private', 'protected', 'public', 'reinterpret_cast', 'class',
388
+ '__restrict', 'static_cast', 'template', 'this', 'throw', 'throws',
389
+ 'try', 'typeid', 'using', 'virtual', 'concept',
390
+ 'decltype', 'noexcept', 'override', 'final', 'constinit', 'consteval',
391
+ 'co_await', 'co_return', 'co_yield', 'requires', 'import', 'module',
392
+ 'typename', 'and', 'and_eq', 'bitand', 'bitor', 'compl', 'not',
393
+ 'not_eq', 'or', 'or_eq', 'xor', 'xor_eq', 'contract_assert', 'pre', 'post'),
394
+ suffix=r'\b'), Keyword),
395
+ (r'namespace\b', Keyword, 'namespace'),
396
+ (r'(enum)(\s+)', bygroups(Keyword, Whitespace), 'enumname'),
397
+ inherit
398
+ ],
399
+ 'types': [
400
+ (r'char(16_t|32_t|8_t)\b', Keyword.Type),
401
+ inherit
402
+ ],
403
+ 'namespace': [
404
+ (r'[;{]', Punctuation, ('#pop', 'root')),
405
+ (r'inline\b', Keyword.Reserved),
406
+ (CFamilyLexer._ident, Name.Namespace),
407
+ include('statement')
408
+ ]
409
+ }
410
+
411
+ def analyse_text(text):
412
+ if re.search('#include <[a-z_]+>', text):
413
+ return 0.2
414
+ if re.search('using namespace ', text):
415
+ return 0.4
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/pygments/lexers/c_like.py ADDED
@@ -0,0 +1,738 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
110
+ (r'\b(public|private|import|as|record|variant|instance'
111
+ r'|define|overload|default|external|alias'
112
+ r'|rvalue|ref|forward|inline|noinline|forceinline'
113
+ r'|enum|var|and|or|not|if|else|goto|return|while'
114
+ r'|switch|case|break|continue|for|in|true|false|try|catch|throw'
115
+ r'|finally|onerror|staticassert|eval|when|newtype'
116
+ r'|__FILE__|__LINE__|__COLUMN__|__ARG__'
117
+ r')\b', Keyword),
118
+ (r'[~!%^&*+=|:<>/-]', Operator),
119
+ (r'[#(){}\[\],;.]', Punctuation),
120
+ (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
121
+ (r'\d+[LlUu]*', Number.Integer),
122
+ (r'\b(true|false)\b', Name.Builtin),
123
+ (r'(?i)[a-z_?][\w?]*', Name),
124
+ (r'"""', String, 'tdqs'),
125
+ (r'"', String, 'dqs'),
126
+ ],
127
+ 'strings': [
128
+ (r'(?i)\\(x[0-9a-f]{2}|.)', String.Escape),
129
+ (r'[^\\"]+', String),
130
+ ],
131
+ 'nl': [
132
+ (r'\n', String),
133
+ ],
134
+ 'dqs': [
135
+ (r'"', String, '#pop'),
136
+ include('strings'),
137
+ ],
138
+ 'tdqs': [
139
+ (r'"""', String, '#pop'),
140
+ include('strings'),
141
+ include('nl'),
142
+ ],
143
+ }
144
+
145
+
146
+ class ECLexer(CLexer):
147
+ """
148
+ For eC source code with preprocessor directives.
149
+ """
150
+ name = 'eC'
151
+ aliases = ['ec']
152
+ filenames = ['*.ec', '*.eh']
153
+ mimetypes = ['text/x-echdr', 'text/x-ecsrc']
154
+ url = 'https://ec-lang.org'
155
+ version_added = '1.5'
156
+
157
+ tokens = {
158
+ 'statements': [
159
+ (words((
160
+ 'virtual', 'class', 'private', 'public', 'property', 'import',
161
+ 'delete', 'new', 'new0', 'renew', 'renew0', 'define', 'get',
162
+ 'set', 'remote', 'dllexport', 'dllimport', 'stdcall', 'subclass',
163
+ '__on_register_module', 'namespace', 'using', 'typed_object',
164
+ 'any_object', 'incref', 'register', 'watch', 'stopwatching', 'firewatchers',
165
+ 'watchable', 'class_designer', 'class_fixed', 'class_no_expansion', 'isset',
166
+ 'class_default_property', 'property_category', 'class_data',
167
+ 'class_property', 'thisclass', 'dbtable', 'dbindex',
168
+ 'database_open', 'dbfield'), suffix=r'\b'), Keyword),
169
+ (words(('uint', 'uint16', 'uint32', 'uint64', 'bool', 'byte',
170
+ 'unichar', 'int64'), suffix=r'\b'),
171
+ Keyword.Type),
172
+ (r'(class)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
173
+ (r'(null|value|this)\b', Name.Builtin),
174
+ inherit,
175
+ ]
176
+ }
177
+
178
+
179
+ class ValaLexer(RegexLexer):
180
+ """
181
+ For Vala source code with preprocessor directives.
182
+ """
183
+ name = 'Vala'
184
+ aliases = ['vala', 'vapi']
185
+ filenames = ['*.vala', '*.vapi']
186
+ mimetypes = ['text/x-vala']
187
+ url = 'https://vala.dev'
188
+ version_added = '1.1'
189
+
190
+ tokens = {
191
+ 'whitespace': [
192
+ (r'^\s*#if\s+0', Comment.Preproc, 'if0'),
193
+ (r'\n', Whitespace),
194
+ (r'\s+', Whitespace),
195
+ (r'\\\n', Text), # line continuation
196
+ (r'//(\n|(.|\n)*?[^\\]\n)', Comment.Single),
197
+ (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
198
+ ],
199
+ 'statements': [
200
+ (r'[L@]?"', String, 'string'),
201
+ (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'",
202
+ String.Char),
203
+ (r'(?s)""".*?"""', String), # verbatim strings
204
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
205
+ (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
206
+ (r'0x[0-9a-fA-F]+[Ll]?', Number.Hex),
207
+ (r'0[0-7]+[Ll]?', Number.Oct),
208
+ (r'\d+[Ll]?', Number.Integer),
209
+ (r'[~!%^&*+=|?:<>/-]', Operator),
210
+ (r'(\[)(Compact|Immutable|(?:Boolean|Simple)Type)(\])',
211
+ bygroups(Punctuation, Name.Decorator, Punctuation)),
212
+ # TODO: "correctly" parse complex code attributes
213
+ (r'(\[)(CCode|(?:Integer|Floating)Type)',
214
+ bygroups(Punctuation, Name.Decorator)),
215
+ (r'[()\[\],.]', Punctuation),
216
+ (words((
217
+ 'as', 'base', 'break', 'case', 'catch', 'construct', 'continue',
218
+ 'default', 'delete', 'do', 'else', 'enum', 'finally', 'for',
219
+ 'foreach', 'get', 'if', 'in', 'is', 'lock', 'new', 'out', 'params',
220
+ 'return', 'set', 'sizeof', 'switch', 'this', 'throw', 'try',
221
+ 'typeof', 'while', 'yield'), suffix=r'\b'),
222
+ Keyword),
223
+ (words((
224
+ 'abstract', 'const', 'delegate', 'dynamic', 'ensures', 'extern',
225
+ 'inline', 'internal', 'override', 'owned', 'private', 'protected',
226
+ 'public', 'ref', 'requires', 'signal', 'static', 'throws', 'unowned',
227
+ 'var', 'virtual', 'volatile', 'weak', 'yields'), suffix=r'\b'),
228
+ Keyword.Declaration),
229
+ (r'(namespace|using)(\s+)', bygroups(Keyword.Namespace, Whitespace),
230
+ 'namespace'),
231
+ (r'(class|errordomain|interface|struct)(\s+)',
232
+ bygroups(Keyword.Declaration, Whitespace), 'class'),
233
+ (r'(\.)([a-zA-Z_]\w*)',
234
+ bygroups(Operator, Name.Attribute)),
235
+ # void is an actual keyword, others are in glib-2.0.vapi
236
+ (words((
237
+ 'void', 'bool', 'char', 'double', 'float', 'int', 'int8', 'int16',
238
+ 'int32', 'int64', 'long', 'short', 'size_t', 'ssize_t', 'string',
239
+ 'time_t', 'uchar', 'uint', 'uint8', 'uint16', 'uint32', 'uint64',
240
+ 'ulong', 'unichar', 'ushort'), suffix=r'\b'),
241
+ Keyword.Type),
242
+ (r'(true|false|null)\b', Name.Builtin),
243
+ (r'[a-zA-Z_]\w*', Name),
244
+ ],
245
+ 'root': [
246
+ include('whitespace'),
247
+ default('statement'),
248
+ ],
249
+ 'statement': [
250
+ include('whitespace'),
251
+ include('statements'),
252
+ ('[{}]', Punctuation),
253
+ (';', Punctuation, '#pop'),
254
+ ],
255
+ 'string': [
256
+ (r'"', String, '#pop'),
257
+ (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
258
+ (r'[^\\"\n]+', String), # all other characters
259
+ (r'\\\n', String), # line continuation
260
+ (r'\\', String), # stray backslash
261
+ ],
262
+ 'if0': [
263
+ (r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
264
+ (r'^\s*#el(?:se|if).*\n', Comment.Preproc, '#pop'),
265
+ (r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
266
+ (r'.*?\n', Comment),
267
+ ],
268
+ 'class': [
269
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
270
+ ],
271
+ 'namespace': [
272
+ (r'[a-zA-Z_][\w.]*', Name.Namespace, '#pop')
273
+ ],
274
+ }
275
+
276
+
277
+ class CudaLexer(CLexer):
278
+ """
279
+ For NVIDIA CUDA™ source.
280
+ """
281
+ name = 'CUDA'
282
+ filenames = ['*.cu', '*.cuh']
283
+ aliases = ['cuda', 'cu']
284
+ mimetypes = ['text/x-cuda']
285
+ url = 'https://developer.nvidia.com/category/zone/cuda-zone'
286
+ version_added = '1.6'
287
+
288
+ function_qualifiers = {'__device__', '__global__', '__host__',
289
+ '__noinline__', '__forceinline__'}
290
+ variable_qualifiers = {'__device__', '__constant__', '__shared__',
291
+ '__restrict__'}
292
+ vector_types = {'char1', 'uchar1', 'char2', 'uchar2', 'char3', 'uchar3',
293
+ 'char4', 'uchar4', 'short1', 'ushort1', 'short2', 'ushort2',
294
+ 'short3', 'ushort3', 'short4', 'ushort4', 'int1', 'uint1',
295
+ 'int2', 'uint2', 'int3', 'uint3', 'int4', 'uint4', 'long1',
296
+ 'ulong1', 'long2', 'ulong2', 'long3', 'ulong3', 'long4',
297
+ 'ulong4', 'longlong1', 'ulonglong1', 'longlong2',
298
+ 'ulonglong2', 'float1', 'float2', 'float3', 'float4',
299
+ 'double1', 'double2', 'dim3'}
300
+ variables = {'gridDim', 'blockIdx', 'blockDim', 'threadIdx', 'warpSize'}
301
+ functions = {'__threadfence_block', '__threadfence', '__threadfence_system',
302
+ '__syncthreads', '__syncthreads_count', '__syncthreads_and',
303
+ '__syncthreads_or'}
304
+ execution_confs = {'<<<', '>>>'}
305
+
306
+ def get_tokens_unprocessed(self, text, stack=('root',)):
307
+ for index, token, value in CLexer.get_tokens_unprocessed(self, text, stack):
308
+ if token is Name:
309
+ if value in self.variable_qualifiers:
310
+ token = Keyword.Type
311
+ elif value in self.vector_types:
312
+ token = Keyword.Type
313
+ elif value in self.variables:
314
+ token = Name.Builtin
315
+ elif value in self.execution_confs:
316
+ token = Keyword.Pseudo
317
+ elif value in self.function_qualifiers:
318
+ token = Keyword.Reserved
319
+ elif value in self.functions:
320
+ token = Name.Function
321
+ yield index, token, value
322
+
323
+
324
+ class SwigLexer(CppLexer):
325
+ """
326
+ For `SWIG <http://www.swig.org/>`_ source code.
327
+ """
328
+ name = 'SWIG'
329
+ aliases = ['swig']
330
+ filenames = ['*.swg', '*.i']
331
+ mimetypes = ['text/swig']
332
+ version_added = '2.0'
333
+ priority = 0.04 # Lower than C/C++ and Objective C/C++
334
+
335
+ tokens = {
336
+ 'root': [
337
+ # Match it here so it won't be matched as a function in the rest of root
338
+ (r'\$\**\&?\w+', Name),
339
+ inherit
340
+ ],
341
+ 'statements': [
342
+ # SWIG directives
343
+ (r'(%[a-z_][a-z0-9_]*)', Name.Function),
344
+ # Special variables
345
+ (r'\$\**\&?\w+', Name),
346
+ # Stringification / additional preprocessor directives
347
+ (r'##*[a-zA-Z_]\w*', Comment.Preproc),
348
+ inherit,
349
+ ],
350
+ }
351
+
352
+ # This is a far from complete set of SWIG directives
353
+ swig_directives = {
354
+ # Most common directives
355
+ '%apply', '%define', '%director', '%enddef', '%exception', '%extend',
356
+ '%feature', '%fragment', '%ignore', '%immutable', '%import', '%include',
357
+ '%inline', '%insert', '%module', '%newobject', '%nspace', '%pragma',
358
+ '%rename', '%shared_ptr', '%template', '%typecheck', '%typemap',
359
+ # Less common directives
360
+ '%arg', '%attribute', '%bang', '%begin', '%callback', '%catches', '%clear',
361
+ '%constant', '%copyctor', '%csconst', '%csconstvalue', '%csenum',
362
+ '%csmethodmodifiers', '%csnothrowexception', '%default', '%defaultctor',
363
+ '%defaultdtor', '%defined', '%delete', '%delobject', '%descriptor',
364
+ '%exceptionclass', '%exceptionvar', '%extend_smart_pointer', '%fragments',
365
+ '%header', '%ifcplusplus', '%ignorewarn', '%implicit', '%implicitconv',
366
+ '%init', '%javaconst', '%javaconstvalue', '%javaenum', '%javaexception',
367
+ '%javamethodmodifiers', '%kwargs', '%luacode', '%mutable', '%naturalvar',
368
+ '%nestedworkaround', '%perlcode', '%pythonabc', '%pythonappend',
369
+ '%pythoncallback', '%pythoncode', '%pythondynamic', '%pythonmaybecall',
370
+ '%pythonnondynamic', '%pythonprepend', '%refobject', '%shadow', '%sizeof',
371
+ '%trackobjects', '%types', '%unrefobject', '%varargs', '%warn',
372
+ '%warnfilter'}
373
+
374
+ def analyse_text(text):
375
+ rv = 0
376
+ # Search for SWIG directives, which are conventionally at the beginning of
377
+ # a line. The probability of them being within a line is low, so let another
378
+ # lexer win in this case.
379
+ matches = re.findall(r'^\s*(%[a-z_][a-z0-9_]*)', text, re.M)
380
+ for m in matches:
381
+ if m in SwigLexer.swig_directives:
382
+ rv = 0.98
383
+ break
384
+ else:
385
+ rv = 0.91 # Fraction higher than MatlabLexer
386
+ return rv
387
+
388
+
389
+ class MqlLexer(CppLexer):
390
+ """
391
+ For `MQL4 <http://docs.mql4.com/>`_ and
392
+ `MQL5 <http://www.mql5.com/en/docs>`_ source code.
393
+ """
394
+ name = 'MQL'
395
+ aliases = ['mql', 'mq4', 'mq5', 'mql4', 'mql5']
396
+ filenames = ['*.mq4', '*.mq5', '*.mqh']
397
+ mimetypes = ['text/x-mql']
398
+ version_added = '2.0'
399
+
400
+ tokens = {
401
+ 'statements': [
402
+ (words(_mql_builtins.keywords, suffix=r'\b'), Keyword),
403
+ (words(_mql_builtins.c_types, suffix=r'\b'), Keyword.Type),
404
+ (words(_mql_builtins.types, suffix=r'\b'), Name.Function),
405
+ (words(_mql_builtins.constants, suffix=r'\b'), Name.Constant),
406
+ (words(_mql_builtins.colors, prefix='(clr)?', suffix=r'\b'),
407
+ Name.Constant),
408
+ inherit,
409
+ ],
410
+ }
411
+
412
+
413
+ class ArduinoLexer(CppLexer):
414
+ """
415
+ For `Arduino(tm) <https://arduino.cc/>`_ source.
416
+
417
+ This is an extension of the CppLexer, as the Arduino® Language is a superset
418
+ of C++
419
+ """
420
+
421
+ name = 'Arduino'
422
+ aliases = ['arduino']
423
+ filenames = ['*.ino']
424
+ mimetypes = ['text/x-arduino']
425
+ version_added = '2.1'
426
+
427
+ # Language sketch main structure functions
428
+ structure = {'setup', 'loop'}
429
+
430
+ # Language operators
431
+ operators = {'not', 'or', 'and', 'xor'}
432
+
433
+ # Language 'variables'
434
+ variables = {
435
+ 'DIGITAL_MESSAGE', 'FIRMATA_STRING', 'ANALOG_MESSAGE', 'REPORT_DIGITAL',
436
+ 'REPORT_ANALOG', 'INPUT_PULLUP', 'SET_PIN_MODE', 'INTERNAL2V56', 'SYSTEM_RESET',
437
+ 'LED_BUILTIN', 'INTERNAL1V1', 'SYSEX_START', 'INTERNAL', 'EXTERNAL', 'HIGH',
438
+ 'LOW', 'INPUT', 'OUTPUT', 'INPUT_PULLUP', 'LED_BUILTIN', 'true', 'false',
439
+ 'void', 'boolean', 'char', 'unsigned char', 'byte', 'int', 'unsigned int',
440
+ 'word', 'long', 'unsigned long', 'short', 'float', 'double', 'string', 'String',
441
+ 'array', 'static', 'volatile', 'const', 'boolean', 'byte', 'word', 'string',
442
+ 'String', 'array', 'int', 'float', 'private', 'char', 'virtual', 'operator',
443
+ 'sizeof', 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t', 'int8_t', 'int16_t',
444
+ 'int32_t', 'int64_t', 'dynamic_cast', 'typedef', 'const_cast', 'const',
445
+ 'struct', 'static_cast', 'union', 'unsigned', 'long', 'volatile', 'static',
446
+ 'protected', 'bool', 'public', 'friend', 'auto', 'void', 'enum', 'extern',
447
+ 'class', 'short', 'reinterpret_cast', 'double', 'register', 'explicit',
448
+ 'signed', 'inline', 'delete', '_Bool', 'complex', '_Complex', '_Imaginary',
449
+ 'atomic_bool', 'atomic_char', 'atomic_schar', 'atomic_uchar', 'atomic_short',
450
+ 'atomic_ushort', 'atomic_int', 'atomic_uint', 'atomic_long', 'atomic_ulong',
451
+ 'atomic_llong', 'atomic_ullong', 'PROGMEM'}
452
+
453
+ # Language shipped functions and class ( )
454
+ functions = {
455
+ 'KeyboardController', 'MouseController', 'SoftwareSerial', 'EthernetServer',
456
+ 'EthernetClient', 'LiquidCrystal', 'RobotControl', 'GSMVoiceCall',
457
+ 'EthernetUDP', 'EsploraTFT', 'HttpClient', 'RobotMotor', 'WiFiClient',
458
+ 'GSMScanner', 'FileSystem', 'Scheduler', 'GSMServer', 'YunClient', 'YunServer',
459
+ 'IPAddress', 'GSMClient', 'GSMModem', 'Keyboard', 'Ethernet', 'Console',
460
+ 'GSMBand', 'Esplora', 'Stepper', 'Process', 'WiFiUDP', 'GSM_SMS', 'Mailbox',
461
+ 'USBHost', 'Firmata', 'PImage', 'Client', 'Server', 'GSMPIN', 'FileIO',
462
+ 'Bridge', 'Serial', 'EEPROM', 'Stream', 'Mouse', 'Audio', 'Servo', 'File',
463
+ 'Task', 'GPRS', 'WiFi', 'Wire', 'TFT', 'GSM', 'SPI', 'SD',
464
+ 'runShellCommandAsynchronously', 'analogWriteResolution',
465
+ 'retrieveCallingNumber', 'printFirmwareVersion', 'analogReadResolution',
466
+ 'sendDigitalPortPair', 'noListenOnLocalhost', 'readJoystickButton',
467
+ 'setFirmwareVersion', 'readJoystickSwitch', 'scrollDisplayRight',
468
+ 'getVoiceCallStatus', 'scrollDisplayLeft', 'writeMicroseconds',
469
+ 'delayMicroseconds', 'beginTransmission', 'getSignalStrength',
470
+ 'runAsynchronously', 'getAsynchronously', 'listenOnLocalhost',
471
+ 'getCurrentCarrier', 'readAccelerometer', 'messageAvailable',
472
+ 'sendDigitalPorts', 'lineFollowConfig', 'countryNameWrite', 'runShellCommand',
473
+ 'readStringUntil', 'rewindDirectory', 'readTemperature', 'setClockDivider',
474
+ 'readLightSensor', 'endTransmission', 'analogReference', 'detachInterrupt',
475
+ 'countryNameRead', 'attachInterrupt', 'encryptionType', 'readBytesUntil',
476
+ 'robotNameWrite', 'readMicrophone', 'robotNameRead', 'cityNameWrite',
477
+ 'userNameWrite', 'readJoystickY', 'readJoystickX', 'mouseReleased',
478
+ 'openNextFile', 'scanNetworks', 'noInterrupts', 'digitalWrite', 'beginSpeaker',
479
+ 'mousePressed', 'isActionDone', 'mouseDragged', 'displayLogos', 'noAutoscroll',
480
+ 'addParameter', 'remoteNumber', 'getModifiers', 'keyboardRead', 'userNameRead',
481
+ 'waitContinue', 'processInput', 'parseCommand', 'printVersion', 'readNetworks',
482
+ 'writeMessage', 'blinkVersion', 'cityNameRead', 'readMessage', 'setDataMode',
483
+ 'parsePacket', 'isListening', 'setBitOrder', 'beginPacket', 'isDirectory',
484
+ 'motorsWrite', 'drawCompass', 'digitalRead', 'clearScreen', 'serialEvent',
485
+ 'rightToLeft', 'setTextSize', 'leftToRight', 'requestFrom', 'keyReleased',
486
+ 'compassRead', 'analogWrite', 'interrupts', 'WiFiServer', 'disconnect',
487
+ 'playMelody', 'parseFloat', 'autoscroll', 'getPINUsed', 'setPINUsed',
488
+ 'setTimeout', 'sendAnalog', 'readSlider', 'analogRead', 'beginWrite',
489
+ 'createChar', 'motorsStop', 'keyPressed', 'tempoWrite', 'readButton',
490
+ 'subnetMask', 'debugPrint', 'macAddress', 'writeGreen', 'randomSeed',
491
+ 'attachGPRS', 'readString', 'sendString', 'remotePort', 'releaseAll',
492
+ 'mouseMoved', 'background', 'getXChange', 'getYChange', 'answerCall',
493
+ 'getResult', 'voiceCall', 'endPacket', 'constrain', 'getSocket', 'writeJSON',
494
+ 'getButton', 'available', 'connected', 'findUntil', 'readBytes', 'exitValue',
495
+ 'readGreen', 'writeBlue', 'startLoop', 'IPAddress', 'isPressed', 'sendSysex',
496
+ 'pauseMode', 'gatewayIP', 'setCursor', 'getOemKey', 'tuneWrite', 'noDisplay',
497
+ 'loadImage', 'switchPIN', 'onRequest', 'onReceive', 'changePIN', 'playFile',
498
+ 'noBuffer', 'parseInt', 'overflow', 'checkPIN', 'knobRead', 'beginTFT',
499
+ 'bitClear', 'updateIR', 'bitWrite', 'position', 'writeRGB', 'highByte',
500
+ 'writeRed', 'setSpeed', 'readBlue', 'noStroke', 'remoteIP', 'transfer',
501
+ 'shutdown', 'hangCall', 'beginSMS', 'endWrite', 'attached', 'maintain',
502
+ 'noCursor', 'checkReg', 'checkPUK', 'shiftOut', 'isValid', 'shiftIn', 'pulseIn',
503
+ 'connect', 'println', 'localIP', 'pinMode', 'getIMEI', 'display', 'noBlink',
504
+ 'process', 'getBand', 'running', 'beginSD', 'drawBMP', 'lowByte', 'setBand',
505
+ 'release', 'bitRead', 'prepare', 'pointTo', 'readRed', 'setMode', 'noFill',
506
+ 'remove', 'listen', 'stroke', 'detach', 'attach', 'noTone', 'exists', 'buffer',
507
+ 'height', 'bitSet', 'circle', 'config', 'cursor', 'random', 'IRread', 'setDNS',
508
+ 'endSMS', 'getKey', 'micros', 'millis', 'begin', 'print', 'write', 'ready',
509
+ 'flush', 'width', 'isPIN', 'blink', 'clear', 'press', 'mkdir', 'rmdir', 'close',
510
+ 'point', 'yield', 'image', 'BSSID', 'click', 'delay', 'read', 'text', 'move',
511
+ 'peek', 'beep', 'rect', 'line', 'open', 'seek', 'fill', 'size', 'turn', 'stop',
512
+ 'home', 'find', 'step', 'tone', 'sqrt', 'RSSI', 'SSID', 'end', 'bit', 'tan',
513
+ 'cos', 'sin', 'pow', 'map', 'abs', 'max', 'min', 'get', 'run', 'put',
514
+ 'isAlphaNumeric', 'isAlpha', 'isAscii', 'isWhitespace', 'isControl', 'isDigit',
515
+ 'isGraph', 'isLowerCase', 'isPrintable', 'isPunct', 'isSpace', 'isUpperCase',
516
+ 'isHexadecimalDigit'}
517
+
518
+ # do not highlight
519
+ suppress_highlight = {
520
+ 'namespace', 'template', 'mutable', 'using', 'asm', 'typeid',
521
+ 'typename', 'this', 'alignof', 'constexpr', 'decltype', 'noexcept',
522
+ 'static_assert', 'thread_local', 'restrict'}
523
+
524
+ def get_tokens_unprocessed(self, text, stack=('root',)):
525
+ for index, token, value in CppLexer.get_tokens_unprocessed(self, text, stack):
526
+ if value in self.structure:
527
+ yield index, Name.Builtin, value
528
+ elif value in self.operators:
529
+ yield index, Operator, value
530
+ elif value in self.variables:
531
+ yield index, Keyword.Reserved, value
532
+ elif value in self.suppress_highlight:
533
+ yield index, Name, value
534
+ elif value in self.functions:
535
+ yield index, Name.Function, value
536
+ else:
537
+ yield index, token, value
538
+
539
+
540
+ class CharmciLexer(CppLexer):
541
+ """
542
+ For `Charm++ <https://charm.cs.illinois.edu>`_ interface files (.ci).
543
+ """
544
+
545
+ name = 'Charmci'
546
+ aliases = ['charmci']
547
+ filenames = ['*.ci']
548
+ version_added = '2.4'
549
+
550
+ mimetypes = []
551
+
552
+ tokens = {
553
+ 'keywords': [
554
+ (r'(module)(\s+)', bygroups(Keyword, Text), 'classname'),
555
+ (words(('mainmodule', 'mainchare', 'chare', 'array', 'group',
556
+ 'nodegroup', 'message', 'conditional')), Keyword),
557
+ (words(('entry', 'aggregate', 'threaded', 'sync', 'exclusive',
558
+ 'nokeep', 'notrace', 'immediate', 'expedited', 'inline',
559
+ 'local', 'python', 'accel', 'readwrite', 'writeonly',
560
+ 'accelblock', 'memcritical', 'packed', 'varsize',
561
+ 'initproc', 'initnode', 'initcall', 'stacksize',
562
+ 'createhere', 'createhome', 'reductiontarget', 'iget',
563
+ 'nocopy', 'mutable', 'migratable', 'readonly')), Keyword),
564
+ inherit,
565
+ ],
566
+ }
567
+
568
+
569
+ class OmgIdlLexer(CLexer):
570
+ """
571
+ Lexer for Object Management Group Interface Definition Language.
572
+ """
573
+
574
+ name = 'OMG Interface Definition Language'
575
+ url = 'https://www.omg.org/spec/IDL/About-IDL/'
576
+ aliases = ['omg-idl']
577
+ filenames = ['*.idl', '*.pidl']
578
+ mimetypes = []
579
+ version_added = '2.9'
580
+
581
+ scoped_name = r'((::)?\w+)+'
582
+
583
+ tokens = {
584
+ 'values': [
585
+ (words(('true', 'false'), prefix=r'(?i)', suffix=r'\b'), Number),
586
+ (r'([Ll]?)(")', bygroups(String.Affix, String.Double), 'string'),
587
+ (r'([Ll]?)(\')(\\[^\']+)(\')',
588
+ bygroups(String.Affix, String.Char, String.Escape, String.Char)),
589
+ (r'([Ll]?)(\')(\\\')(\')',
590
+ bygroups(String.Affix, String.Char, String.Escape, String.Char)),
591
+ (r'([Ll]?)(\'.\')', bygroups(String.Affix, String.Char)),
592
+ (r'[+-]?\d+(\.\d*)?[Ee][+-]?\d+', Number.Float),
593
+ (r'[+-]?(\d+\.\d*)|(\d*\.\d+)([Ee][+-]?\d+)?', Number.Float),
594
+ (r'(?i)[+-]?0x[0-9a-f]+', Number.Hex),
595
+ (r'[+-]?[1-9]\d*', Number.Integer),
596
+ (r'[+-]?0[0-7]*', Number.Oct),
597
+ (r'[\+\-\*\/%^&\|~]', Operator),
598
+ (words(('<<', '>>')), Operator),
599
+ (scoped_name, Name),
600
+ (r'[{};:,<>\[\]]', Punctuation),
601
+ ],
602
+ 'annotation_params': [
603
+ include('whitespace'),
604
+ (r'\(', Punctuation, '#push'),
605
+ include('values'),
606
+ (r'=', Punctuation),
607
+ (r'\)', Punctuation, '#pop'),
608
+ ],
609
+ 'annotation_params_maybe': [
610
+ (r'\(', Punctuation, 'annotation_params'),
611
+ include('whitespace'),
612
+ default('#pop'),
613
+ ],
614
+ 'annotation_appl': [
615
+ (r'@' + scoped_name, Name.Decorator, 'annotation_params_maybe'),
616
+ ],
617
+ 'enum': [
618
+ include('whitespace'),
619
+ (r'[{,]', Punctuation),
620
+ (r'\w+', Name.Constant),
621
+ include('annotation_appl'),
622
+ (r'\}', Punctuation, '#pop'),
623
+ ],
624
+ 'root': [
625
+ include('whitespace'),
626
+ (words((
627
+ 'typedef', 'const',
628
+ 'in', 'out', 'inout', 'local',
629
+ ), prefix=r'(?i)', suffix=r'\b'), Keyword.Declaration),
630
+ (words((
631
+ 'void', 'any', 'native', 'bitfield',
632
+ 'unsigned', 'boolean', 'char', 'wchar', 'octet', 'short', 'long',
633
+ 'int8', 'uint8', 'int16', 'int32', 'int64', 'uint16', 'uint32', 'uint64',
634
+ 'float', 'double', 'fixed',
635
+ 'sequence', 'string', 'wstring', 'map',
636
+ ), prefix=r'(?i)', suffix=r'\b'), Keyword.Type),
637
+ (words((
638
+ '@annotation', 'struct', 'union', 'bitset', 'interface',
639
+ 'exception', 'valuetype', 'eventtype', 'component',
640
+ ), prefix=r'(?i)', suffix=r'(\s+)(\w+)'), bygroups(Keyword, Whitespace, Name.Class)),
641
+ (words((
642
+ 'abstract', 'alias', 'attribute', 'case', 'connector',
643
+ 'consumes', 'context', 'custom', 'default', 'emits', 'factory',
644
+ 'finder', 'getraises', 'home', 'import', 'manages', 'mirrorport',
645
+ 'multiple', 'Object', 'oneway', 'primarykey', 'private', 'port',
646
+ 'porttype', 'provides', 'public', 'publishes', 'raises',
647
+ 'readonly', 'setraises', 'supports', 'switch', 'truncatable',
648
+ 'typeid', 'typename', 'typeprefix', 'uses', 'ValueBase',
649
+ ), prefix=r'(?i)', suffix=r'\b'), Keyword),
650
+ (r'(?i)(enum|bitmask)(\s+)(\w+)',
651
+ bygroups(Keyword, Whitespace, Name.Class), 'enum'),
652
+ (r'(?i)(module)(\s+)(\w+)',
653
+ bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
654
+ (r'(\w+)(\s*)(=)', bygroups(Name.Constant, Whitespace, Operator)),
655
+ (r'[\(\)]', Punctuation),
656
+ include('values'),
657
+ include('annotation_appl'),
658
+ ],
659
+ }
660
+
661
+
662
+ class PromelaLexer(CLexer):
663
+ """
664
+ For the Promela language used with SPIN.
665
+ """
666
+
667
+ name = 'Promela'
668
+ aliases = ['promela']
669
+ filenames = ['*.pml', '*.prom', '*.prm', '*.promela', '*.pr', '*.pm']
670
+ mimetypes = ['text/x-promela']
671
+ url = 'https://spinroot.com/spin/whatispin.html'
672
+ version_added = '2.18'
673
+
674
+ # Promela's language reference:
675
+ # https://spinroot.com/spin/Man/promela.html
676
+ # Promela's grammar definition:
677
+ # https://spinroot.com/spin/Man/grammar.html
678
+
679
+ tokens = {
680
+ 'statements': [
681
+ (r'(\[\]|<>|/\\|\\/)|(U|W|V)\b', Operator), # LTL Operators
682
+ (r'@', Punctuation), #remoterefs
683
+ (r'(\.)([a-zA-Z_]\w*)', bygroups(Operator, Name.Attribute)),
684
+ inherit
685
+ ],
686
+ 'types': [
687
+ # Predefined (data types)
688
+ (words((
689
+ 'bit', 'bool', 'byte', 'pid', 'short', 'int', 'unsigned'),
690
+ suffix=r'\b'),
691
+ Keyword.Type),
692
+ ],
693
+ 'keywords': [
694
+ # ControlFlow
695
+ (words((
696
+ 'atomic', 'break', 'd_step', 'do', 'od', 'for', 'in', 'goto',
697
+ 'if', 'fi', 'unless'), suffix=r'\b'),
698
+ Keyword),
699
+ # BasicStatements
700
+ (words((
701
+ 'assert', 'get_priority', 'printf', 'printm', 'set_priority'),
702
+ suffix=r'\b'),
703
+ Name.Function),
704
+ # Embedded C Code
705
+ (words((
706
+ 'c_code', 'c_decl', 'c_expr', 'c_state', 'c_track'),
707
+ suffix=r'\b'),
708
+ Keyword),
709
+ # Predefined (local/global variables)
710
+ (words((
711
+ '_', '_last', '_nr_pr', '_pid', '_priority', 'else', 'np_',
712
+ 'STDIN'), suffix=r'\b'),
713
+ Name.Builtin),
714
+ # Predefined (functions)
715
+ (words((
716
+ 'empty', 'enabled', 'eval', 'full', 'len', 'nempty', 'nfull',
717
+ 'pc_value'), suffix=r'\b'),
718
+ Name.Function),
719
+ # Predefined (operators)
720
+ (r'run\b', Operator.Word),
721
+ # Declarators
722
+ (words((
723
+ 'active', 'chan', 'D_proctype', 'hidden', 'init', 'local',
724
+ 'mtype', 'never', 'notrace', 'proctype', 'show', 'trace',
725
+ 'typedef', 'xr', 'xs'), suffix=r'\b'),
726
+ Keyword.Declaration),
727
+ # Declarators (suffixes)
728
+ (words((
729
+ 'priority', 'provided'), suffix=r'\b'),
730
+ Keyword),
731
+ # MetaTerms (declarators)
732
+ (words((
733
+ 'inline', 'ltl', 'select'), suffix=r'\b'),
734
+ Keyword.Declaration),
735
+ # MetaTerms (keywords)
736
+ (r'skip\b', Keyword),
737
+ ],
738
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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
+ }
.cache/uv/archive-v0/RMeM3AGJKqUJ7n75un4yi/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