ZTWHHH commited on
Commit
ebe4566
·
verified ·
1 Parent(s): c7bfaf0

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/__init__.cpython-310.pyc +0 -0
  2. evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/cython.cpython-310.pyc +0 -0
  3. evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/dictTools.cpython-310.pyc +0 -0
  4. evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/encodingTools.cpython-310.pyc +0 -0
  5. evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/intTools.cpython-310.pyc +0 -0
  6. evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/macCreatorType.cpython-310.pyc +0 -0
  7. evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/xmlWriter.cpython-310.pyc +0 -0
  8. evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/plistlib/__pycache__/__init__.cpython-310.pyc +0 -0
  9. evalkit_tf437/lib/python3.10/site-packages/fontTools/varLib/avarPlanner.py +1004 -0
  10. evalkit_tf437/lib/python3.10/site-packages/fontTools/varLib/varStore.py +767 -0
  11. evalkit_tf437/lib/python3.10/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/Index.UTvV8BW1.js.gz +3 -0
  12. evalkit_tf437/lib/python3.10/site-packages/httpx/__pycache__/_content.cpython-310.pyc +0 -0
  13. evalkit_tf437/lib/python3.10/site-packages/httpx/__pycache__/_exceptions.cpython-310.pyc +0 -0
  14. evalkit_tf437/lib/python3.10/site-packages/httpx/__pycache__/_main.cpython-310.pyc +0 -0
  15. evalkit_tf437/lib/python3.10/site-packages/httpx/_api.py +479 -0
  16. evalkit_tf437/lib/python3.10/site-packages/httpx/_config.py +372 -0
  17. evalkit_tf437/lib/python3.10/site-packages/httpx/_decoders.py +371 -0
  18. evalkit_tf437/lib/python3.10/site-packages/httpx/_exceptions.py +379 -0
  19. evalkit_tf437/lib/python3.10/site-packages/httpx/_transports/__pycache__/mock.cpython-310.pyc +0 -0
  20. evalkit_tf437/lib/python3.10/site-packages/httpx/_transports/wsgi.py +149 -0
  21. evalkit_tf437/lib/python3.10/site-packages/importlib_metadata-8.5.0.dist-info/REQUESTED +0 -0
  22. evalkit_tf437/lib/python3.10/site-packages/importlib_metadata-8.5.0.dist-info/top_level.txt +1 -0
  23. evalkit_tf437/lib/python3.10/site-packages/markdown2-2.5.1.dist-info/INSTALLER +1 -0
  24. evalkit_tf437/lib/python3.10/site-packages/nvidia_nvjitlink_cu12-12.6.77.dist-info/METADATA +35 -0
  25. evalkit_tf437/lib/python3.10/site-packages/nvidia_nvjitlink_cu12-12.6.77.dist-info/RECORD +17 -0
  26. evalkit_tf437/lib/python3.10/site-packages/oauthlib-3.2.2.dist-info/LICENSE +27 -0
  27. evalkit_tf437/lib/python3.10/site-packages/pygments/cmdline.py +668 -0
  28. evalkit_tf437/lib/python3.10/site-packages/pygments/filters/__init__.py +940 -0
  29. evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/__pycache__/__init__.cpython-310.pyc +0 -0
  30. evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/__pycache__/groff.cpython-310.pyc +0 -0
  31. evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/__pycache__/latex.cpython-310.pyc +0 -0
  32. evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/__pycache__/rtf.cpython-310.pyc +0 -0
  33. evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/__pycache__/terminal.cpython-310.pyc +0 -0
  34. evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/_mapping.py +23 -0
  35. evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/bbcode.py +108 -0
  36. evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/html.py +987 -0
  37. evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/irc.py +154 -0
  38. evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/rtf.py +349 -0
  39. evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/__init__.py +362 -0
  40. evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/_scilab_builtins.py +3093 -0
  41. evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/ambient.py +75 -0
  42. evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/apdlexer.py +593 -0
  43. evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/blueprint.py +173 -0
  44. evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/dalvik.py +126 -0
  45. evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/devicetree.py +108 -0
  46. evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/dsls.py +970 -0
  47. evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/factor.py +363 -0
  48. evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/foxpro.py +427 -0
  49. evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/inferno.py +95 -0
  50. evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/int_fiction.py +1370 -0
evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (253 Bytes). View file
 
evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/cython.cpython-310.pyc ADDED
Binary file (1.03 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/dictTools.cpython-310.pyc ADDED
Binary file (2.74 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/encodingTools.cpython-310.pyc ADDED
Binary file (1.54 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/intTools.cpython-310.pyc ADDED
Binary file (850 Bytes). View file
 
evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/macCreatorType.cpython-310.pyc ADDED
Binary file (1.94 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/__pycache__/xmlWriter.cpython-310.pyc ADDED
Binary file (6.32 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/fontTools/misc/plistlib/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (18.2 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/fontTools/varLib/avarPlanner.py ADDED
@@ -0,0 +1,1004 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fontTools.ttLib import newTable
2
+ from fontTools.ttLib.tables._f_v_a_r import Axis as fvarAxis
3
+ from fontTools.pens.areaPen import AreaPen
4
+ from fontTools.pens.basePen import NullPen
5
+ from fontTools.pens.statisticsPen import StatisticsPen
6
+ from fontTools.varLib.models import piecewiseLinearMap, normalizeValue
7
+ from fontTools.misc.cliTools import makeOutputFileName
8
+ import math
9
+ import logging
10
+ from pprint import pformat
11
+
12
+ __all__ = [
13
+ "planWeightAxis",
14
+ "planWidthAxis",
15
+ "planSlantAxis",
16
+ "planOpticalSizeAxis",
17
+ "planAxis",
18
+ "sanitizeWeight",
19
+ "sanitizeWidth",
20
+ "sanitizeSlant",
21
+ "measureWeight",
22
+ "measureWidth",
23
+ "measureSlant",
24
+ "normalizeLinear",
25
+ "normalizeLog",
26
+ "normalizeDegrees",
27
+ "interpolateLinear",
28
+ "interpolateLog",
29
+ "processAxis",
30
+ "makeDesignspaceSnippet",
31
+ "addEmptyAvar",
32
+ "main",
33
+ ]
34
+
35
+ log = logging.getLogger("fontTools.varLib.avarPlanner")
36
+
37
+ WEIGHTS = [
38
+ 50,
39
+ 100,
40
+ 150,
41
+ 200,
42
+ 250,
43
+ 300,
44
+ 350,
45
+ 400,
46
+ 450,
47
+ 500,
48
+ 550,
49
+ 600,
50
+ 650,
51
+ 700,
52
+ 750,
53
+ 800,
54
+ 850,
55
+ 900,
56
+ 950,
57
+ ]
58
+
59
+ WIDTHS = [
60
+ 25.0,
61
+ 37.5,
62
+ 50.0,
63
+ 62.5,
64
+ 75.0,
65
+ 87.5,
66
+ 100.0,
67
+ 112.5,
68
+ 125.0,
69
+ 137.5,
70
+ 150.0,
71
+ 162.5,
72
+ 175.0,
73
+ 187.5,
74
+ 200.0,
75
+ ]
76
+
77
+ SLANTS = list(math.degrees(math.atan(d / 20.0)) for d in range(-20, 21))
78
+
79
+ SIZES = [
80
+ 5,
81
+ 6,
82
+ 7,
83
+ 8,
84
+ 9,
85
+ 10,
86
+ 11,
87
+ 12,
88
+ 14,
89
+ 18,
90
+ 24,
91
+ 30,
92
+ 36,
93
+ 48,
94
+ 60,
95
+ 72,
96
+ 96,
97
+ 120,
98
+ 144,
99
+ 192,
100
+ 240,
101
+ 288,
102
+ ]
103
+
104
+
105
+ SAMPLES = 8
106
+
107
+
108
+ def normalizeLinear(value, rangeMin, rangeMax):
109
+ """Linearly normalize value in [rangeMin, rangeMax] to [0, 1], with extrapolation."""
110
+ return (value - rangeMin) / (rangeMax - rangeMin)
111
+
112
+
113
+ def interpolateLinear(t, a, b):
114
+ """Linear interpolation between a and b, with t typically in [0, 1]."""
115
+ return a + t * (b - a)
116
+
117
+
118
+ def normalizeLog(value, rangeMin, rangeMax):
119
+ """Logarithmically normalize value in [rangeMin, rangeMax] to [0, 1], with extrapolation."""
120
+ logMin = math.log(rangeMin)
121
+ logMax = math.log(rangeMax)
122
+ return (math.log(value) - logMin) / (logMax - logMin)
123
+
124
+
125
+ def interpolateLog(t, a, b):
126
+ """Logarithmic interpolation between a and b, with t typically in [0, 1]."""
127
+ logA = math.log(a)
128
+ logB = math.log(b)
129
+ return math.exp(logA + t * (logB - logA))
130
+
131
+
132
+ def normalizeDegrees(value, rangeMin, rangeMax):
133
+ """Angularly normalize value in [rangeMin, rangeMax] to [0, 1], with extrapolation."""
134
+ tanMin = math.tan(math.radians(rangeMin))
135
+ tanMax = math.tan(math.radians(rangeMax))
136
+ return (math.tan(math.radians(value)) - tanMin) / (tanMax - tanMin)
137
+
138
+
139
+ def measureWeight(glyphset, glyphs=None):
140
+ """Measure the perceptual average weight of the given glyphs."""
141
+ if isinstance(glyphs, dict):
142
+ frequencies = glyphs
143
+ else:
144
+ frequencies = {g: 1 for g in glyphs}
145
+
146
+ wght_sum = wdth_sum = 0
147
+ for glyph_name in glyphs:
148
+ if frequencies is not None:
149
+ frequency = frequencies.get(glyph_name, 0)
150
+ if frequency == 0:
151
+ continue
152
+ else:
153
+ frequency = 1
154
+
155
+ glyph = glyphset[glyph_name]
156
+
157
+ pen = AreaPen(glyphset=glyphset)
158
+ glyph.draw(pen)
159
+
160
+ mult = glyph.width * frequency
161
+ wght_sum += mult * abs(pen.value)
162
+ wdth_sum += mult
163
+
164
+ return wght_sum / wdth_sum
165
+
166
+
167
+ def measureWidth(glyphset, glyphs=None):
168
+ """Measure the average width of the given glyphs."""
169
+ if isinstance(glyphs, dict):
170
+ frequencies = glyphs
171
+ else:
172
+ frequencies = {g: 1 for g in glyphs}
173
+
174
+ wdth_sum = 0
175
+ freq_sum = 0
176
+ for glyph_name in glyphs:
177
+ if frequencies is not None:
178
+ frequency = frequencies.get(glyph_name, 0)
179
+ if frequency == 0:
180
+ continue
181
+ else:
182
+ frequency = 1
183
+
184
+ glyph = glyphset[glyph_name]
185
+
186
+ pen = NullPen()
187
+ glyph.draw(pen)
188
+
189
+ wdth_sum += glyph.width * frequency
190
+ freq_sum += frequency
191
+
192
+ return wdth_sum / freq_sum
193
+
194
+
195
+ def measureSlant(glyphset, glyphs=None):
196
+ """Measure the perceptual average slant angle of the given glyphs."""
197
+ if isinstance(glyphs, dict):
198
+ frequencies = glyphs
199
+ else:
200
+ frequencies = {g: 1 for g in glyphs}
201
+
202
+ slnt_sum = 0
203
+ freq_sum = 0
204
+ for glyph_name in glyphs:
205
+ if frequencies is not None:
206
+ frequency = frequencies.get(glyph_name, 0)
207
+ if frequency == 0:
208
+ continue
209
+ else:
210
+ frequency = 1
211
+
212
+ glyph = glyphset[glyph_name]
213
+
214
+ pen = StatisticsPen(glyphset=glyphset)
215
+ glyph.draw(pen)
216
+
217
+ mult = glyph.width * frequency
218
+ slnt_sum += mult * pen.slant
219
+ freq_sum += mult
220
+
221
+ return -math.degrees(math.atan(slnt_sum / freq_sum))
222
+
223
+
224
+ def sanitizeWidth(userTriple, designTriple, pins, measurements):
225
+ """Sanitize the width axis limits."""
226
+
227
+ minVal, defaultVal, maxVal = (
228
+ measurements[designTriple[0]],
229
+ measurements[designTriple[1]],
230
+ measurements[designTriple[2]],
231
+ )
232
+
233
+ calculatedMinVal = userTriple[1] * (minVal / defaultVal)
234
+ calculatedMaxVal = userTriple[1] * (maxVal / defaultVal)
235
+
236
+ log.info("Original width axis limits: %g:%g:%g", *userTriple)
237
+ log.info(
238
+ "Calculated width axis limits: %g:%g:%g",
239
+ calculatedMinVal,
240
+ userTriple[1],
241
+ calculatedMaxVal,
242
+ )
243
+
244
+ if (
245
+ abs(calculatedMinVal - userTriple[0]) / userTriple[1] > 0.05
246
+ or abs(calculatedMaxVal - userTriple[2]) / userTriple[1] > 0.05
247
+ ):
248
+ log.warning("Calculated width axis min/max do not match user input.")
249
+ log.warning(
250
+ " Current width axis limits: %g:%g:%g",
251
+ *userTriple,
252
+ )
253
+ log.warning(
254
+ " Suggested width axis limits: %g:%g:%g",
255
+ calculatedMinVal,
256
+ userTriple[1],
257
+ calculatedMaxVal,
258
+ )
259
+
260
+ return False
261
+
262
+ return True
263
+
264
+
265
+ def sanitizeWeight(userTriple, designTriple, pins, measurements):
266
+ """Sanitize the weight axis limits."""
267
+
268
+ if len(set(userTriple)) < 3:
269
+ return True
270
+
271
+ minVal, defaultVal, maxVal = (
272
+ measurements[designTriple[0]],
273
+ measurements[designTriple[1]],
274
+ measurements[designTriple[2]],
275
+ )
276
+
277
+ logMin = math.log(minVal)
278
+ logDefault = math.log(defaultVal)
279
+ logMax = math.log(maxVal)
280
+
281
+ t = (userTriple[1] - userTriple[0]) / (userTriple[2] - userTriple[0])
282
+ y = math.exp(logMin + t * (logMax - logMin))
283
+ t = (y - minVal) / (maxVal - minVal)
284
+ calculatedDefaultVal = userTriple[0] + t * (userTriple[2] - userTriple[0])
285
+
286
+ log.info("Original weight axis limits: %g:%g:%g", *userTriple)
287
+ log.info(
288
+ "Calculated weight axis limits: %g:%g:%g",
289
+ userTriple[0],
290
+ calculatedDefaultVal,
291
+ userTriple[2],
292
+ )
293
+
294
+ if abs(calculatedDefaultVal - userTriple[1]) / userTriple[1] > 0.05:
295
+ log.warning("Calculated weight axis default does not match user input.")
296
+
297
+ log.warning(
298
+ " Current weight axis limits: %g:%g:%g",
299
+ *userTriple,
300
+ )
301
+
302
+ log.warning(
303
+ " Suggested weight axis limits, changing default: %g:%g:%g",
304
+ userTriple[0],
305
+ calculatedDefaultVal,
306
+ userTriple[2],
307
+ )
308
+
309
+ t = (userTriple[2] - userTriple[0]) / (userTriple[1] - userTriple[0])
310
+ y = math.exp(logMin + t * (logDefault - logMin))
311
+ t = (y - minVal) / (defaultVal - minVal)
312
+ calculatedMaxVal = userTriple[0] + t * (userTriple[1] - userTriple[0])
313
+ log.warning(
314
+ " Suggested weight axis limits, changing maximum: %g:%g:%g",
315
+ userTriple[0],
316
+ userTriple[1],
317
+ calculatedMaxVal,
318
+ )
319
+
320
+ t = (userTriple[0] - userTriple[2]) / (userTriple[1] - userTriple[2])
321
+ y = math.exp(logMax + t * (logDefault - logMax))
322
+ t = (y - maxVal) / (defaultVal - maxVal)
323
+ calculatedMinVal = userTriple[2] + t * (userTriple[1] - userTriple[2])
324
+ log.warning(
325
+ " Suggested weight axis limits, changing minimum: %g:%g:%g",
326
+ calculatedMinVal,
327
+ userTriple[1],
328
+ userTriple[2],
329
+ )
330
+
331
+ return False
332
+
333
+ return True
334
+
335
+
336
+ def sanitizeSlant(userTriple, designTriple, pins, measurements):
337
+ """Sanitize the slant axis limits."""
338
+
339
+ log.info("Original slant axis limits: %g:%g:%g", *userTriple)
340
+ log.info(
341
+ "Calculated slant axis limits: %g:%g:%g",
342
+ measurements[designTriple[0]],
343
+ measurements[designTriple[1]],
344
+ measurements[designTriple[2]],
345
+ )
346
+
347
+ if (
348
+ abs(measurements[designTriple[0]] - userTriple[0]) > 1
349
+ or abs(measurements[designTriple[1]] - userTriple[1]) > 1
350
+ or abs(measurements[designTriple[2]] - userTriple[2]) > 1
351
+ ):
352
+ log.warning("Calculated slant axis min/default/max do not match user input.")
353
+ log.warning(
354
+ " Current slant axis limits: %g:%g:%g",
355
+ *userTriple,
356
+ )
357
+ log.warning(
358
+ " Suggested slant axis limits: %g:%g:%g",
359
+ measurements[designTriple[0]],
360
+ measurements[designTriple[1]],
361
+ measurements[designTriple[2]],
362
+ )
363
+
364
+ return False
365
+
366
+ return True
367
+
368
+
369
+ def planAxis(
370
+ measureFunc,
371
+ normalizeFunc,
372
+ interpolateFunc,
373
+ glyphSetFunc,
374
+ axisTag,
375
+ axisLimits,
376
+ values,
377
+ samples=None,
378
+ glyphs=None,
379
+ designLimits=None,
380
+ pins=None,
381
+ sanitizeFunc=None,
382
+ ):
383
+ """Plan an axis.
384
+
385
+ measureFunc: callable that takes a glyphset and an optional
386
+ list of glyphnames, and returns the glyphset-wide measurement
387
+ to be used for the axis.
388
+
389
+ normalizeFunc: callable that takes a measurement and a minimum
390
+ and maximum, and normalizes the measurement into the range 0..1,
391
+ possibly extrapolating too.
392
+
393
+ interpolateFunc: callable that takes a normalized t value, and a
394
+ minimum and maximum, and returns the interpolated value,
395
+ possibly extrapolating too.
396
+
397
+ glyphSetFunc: callable that takes a variations "location" dictionary,
398
+ and returns a glyphset.
399
+
400
+ axisTag: the axis tag string.
401
+
402
+ axisLimits: a triple of minimum, default, and maximum values for
403
+ the axis. Or an `fvar` Axis object.
404
+
405
+ values: a list of output values to map for this axis.
406
+
407
+ samples: the number of samples to use when sampling. Default 8.
408
+
409
+ glyphs: a list of glyph names to use when sampling. Defaults to None,
410
+ which will process all glyphs.
411
+
412
+ designLimits: an optional triple of minimum, default, and maximum values
413
+ represenging the "design" limits for the axis. If not provided, the
414
+ axisLimits will be used.
415
+
416
+ pins: an optional dictionary of before/after mapping entries to pin in
417
+ the output.
418
+
419
+ sanitizeFunc: an optional callable to call to sanitize the axis limits.
420
+ """
421
+
422
+ if isinstance(axisLimits, fvarAxis):
423
+ axisLimits = (axisLimits.minValue, axisLimits.defaultValue, axisLimits.maxValue)
424
+ minValue, defaultValue, maxValue = axisLimits
425
+
426
+ if samples is None:
427
+ samples = SAMPLES
428
+ if glyphs is None:
429
+ glyphs = glyphSetFunc({}).keys()
430
+ if pins is None:
431
+ pins = {}
432
+ else:
433
+ pins = pins.copy()
434
+
435
+ log.info(
436
+ "Axis limits min %g / default %g / max %g", minValue, defaultValue, maxValue
437
+ )
438
+ triple = (minValue, defaultValue, maxValue)
439
+
440
+ if designLimits is not None:
441
+ log.info("Axis design-limits min %g / default %g / max %g", *designLimits)
442
+ else:
443
+ designLimits = triple
444
+
445
+ if pins:
446
+ log.info("Pins %s", sorted(pins.items()))
447
+ pins.update(
448
+ {
449
+ minValue: designLimits[0],
450
+ defaultValue: designLimits[1],
451
+ maxValue: designLimits[2],
452
+ }
453
+ )
454
+
455
+ out = {}
456
+ outNormalized = {}
457
+
458
+ axisMeasurements = {}
459
+ for value in sorted({minValue, defaultValue, maxValue} | set(pins.keys())):
460
+ glyphset = glyphSetFunc(location={axisTag: value})
461
+ designValue = pins[value]
462
+ axisMeasurements[designValue] = measureFunc(glyphset, glyphs)
463
+
464
+ if sanitizeFunc is not None:
465
+ log.info("Sanitizing axis limit values for the `%s` axis.", axisTag)
466
+ sanitizeFunc(triple, designLimits, pins, axisMeasurements)
467
+
468
+ log.debug("Calculated average value:\n%s", pformat(axisMeasurements))
469
+
470
+ for (rangeMin, targetMin), (rangeMax, targetMax) in zip(
471
+ list(sorted(pins.items()))[:-1],
472
+ list(sorted(pins.items()))[1:],
473
+ ):
474
+ targetValues = {w for w in values if rangeMin < w < rangeMax}
475
+ if not targetValues:
476
+ continue
477
+
478
+ normalizedMin = normalizeValue(rangeMin, triple)
479
+ normalizedMax = normalizeValue(rangeMax, triple)
480
+ normalizedTargetMin = normalizeValue(targetMin, designLimits)
481
+ normalizedTargetMax = normalizeValue(targetMax, designLimits)
482
+
483
+ log.info("Planning target values %s.", sorted(targetValues))
484
+ log.info("Sampling %u points in range %g,%g.", samples, rangeMin, rangeMax)
485
+ valueMeasurements = axisMeasurements.copy()
486
+ for sample in range(1, samples + 1):
487
+ value = rangeMin + (rangeMax - rangeMin) * sample / (samples + 1)
488
+ log.debug("Sampling value %g.", value)
489
+ glyphset = glyphSetFunc(location={axisTag: value})
490
+ designValue = piecewiseLinearMap(value, pins)
491
+ valueMeasurements[designValue] = measureFunc(glyphset, glyphs)
492
+ log.debug("Sampled average value:\n%s", pformat(valueMeasurements))
493
+
494
+ measurementValue = {}
495
+ for value in sorted(valueMeasurements):
496
+ measurementValue[valueMeasurements[value]] = value
497
+
498
+ out[rangeMin] = targetMin
499
+ outNormalized[normalizedMin] = normalizedTargetMin
500
+ for value in sorted(targetValues):
501
+ t = normalizeFunc(value, rangeMin, rangeMax)
502
+ targetMeasurement = interpolateFunc(
503
+ t, valueMeasurements[targetMin], valueMeasurements[targetMax]
504
+ )
505
+ targetValue = piecewiseLinearMap(targetMeasurement, measurementValue)
506
+ log.debug("Planned mapping value %g to %g." % (value, targetValue))
507
+ out[value] = targetValue
508
+ valueNormalized = normalizedMin + (value - rangeMin) / (
509
+ rangeMax - rangeMin
510
+ ) * (normalizedMax - normalizedMin)
511
+ outNormalized[valueNormalized] = normalizedTargetMin + (
512
+ targetValue - targetMin
513
+ ) / (targetMax - targetMin) * (normalizedTargetMax - normalizedTargetMin)
514
+ out[rangeMax] = targetMax
515
+ outNormalized[normalizedMax] = normalizedTargetMax
516
+
517
+ log.info("Planned mapping for the `%s` axis:\n%s", axisTag, pformat(out))
518
+ log.info(
519
+ "Planned normalized mapping for the `%s` axis:\n%s",
520
+ axisTag,
521
+ pformat(outNormalized),
522
+ )
523
+
524
+ if all(abs(k - v) < 0.01 for k, v in outNormalized.items()):
525
+ log.info("Detected identity mapping for the `%s` axis. Dropping.", axisTag)
526
+ out = {}
527
+ outNormalized = {}
528
+
529
+ return out, outNormalized
530
+
531
+
532
+ def planWeightAxis(
533
+ glyphSetFunc,
534
+ axisLimits,
535
+ weights=None,
536
+ samples=None,
537
+ glyphs=None,
538
+ designLimits=None,
539
+ pins=None,
540
+ sanitize=False,
541
+ ):
542
+ """Plan a weight (`wght`) axis.
543
+
544
+ weights: A list of weight values to plan for. If None, the default
545
+ values are used.
546
+
547
+ This function simply calls planAxis with values=weights, and the appropriate
548
+ arguments. See documenation for planAxis for more information.
549
+ """
550
+
551
+ if weights is None:
552
+ weights = WEIGHTS
553
+
554
+ return planAxis(
555
+ measureWeight,
556
+ normalizeLinear,
557
+ interpolateLog,
558
+ glyphSetFunc,
559
+ "wght",
560
+ axisLimits,
561
+ values=weights,
562
+ samples=samples,
563
+ glyphs=glyphs,
564
+ designLimits=designLimits,
565
+ pins=pins,
566
+ sanitizeFunc=sanitizeWeight if sanitize else None,
567
+ )
568
+
569
+
570
+ def planWidthAxis(
571
+ glyphSetFunc,
572
+ axisLimits,
573
+ widths=None,
574
+ samples=None,
575
+ glyphs=None,
576
+ designLimits=None,
577
+ pins=None,
578
+ sanitize=False,
579
+ ):
580
+ """Plan a width (`wdth`) axis.
581
+
582
+ widths: A list of width values (percentages) to plan for. If None, the default
583
+ values are used.
584
+
585
+ This function simply calls planAxis with values=widths, and the appropriate
586
+ arguments. See documenation for planAxis for more information.
587
+ """
588
+
589
+ if widths is None:
590
+ widths = WIDTHS
591
+
592
+ return planAxis(
593
+ measureWidth,
594
+ normalizeLinear,
595
+ interpolateLinear,
596
+ glyphSetFunc,
597
+ "wdth",
598
+ axisLimits,
599
+ values=widths,
600
+ samples=samples,
601
+ glyphs=glyphs,
602
+ designLimits=designLimits,
603
+ pins=pins,
604
+ sanitizeFunc=sanitizeWidth if sanitize else None,
605
+ )
606
+
607
+
608
+ def planSlantAxis(
609
+ glyphSetFunc,
610
+ axisLimits,
611
+ slants=None,
612
+ samples=None,
613
+ glyphs=None,
614
+ designLimits=None,
615
+ pins=None,
616
+ sanitize=False,
617
+ ):
618
+ """Plan a slant (`slnt`) axis.
619
+
620
+ slants: A list slant angles to plan for. If None, the default
621
+ values are used.
622
+
623
+ This function simply calls planAxis with values=slants, and the appropriate
624
+ arguments. See documenation for planAxis for more information.
625
+ """
626
+
627
+ if slants is None:
628
+ slants = SLANTS
629
+
630
+ return planAxis(
631
+ measureSlant,
632
+ normalizeDegrees,
633
+ interpolateLinear,
634
+ glyphSetFunc,
635
+ "slnt",
636
+ axisLimits,
637
+ values=slants,
638
+ samples=samples,
639
+ glyphs=glyphs,
640
+ designLimits=designLimits,
641
+ pins=pins,
642
+ sanitizeFunc=sanitizeSlant if sanitize else None,
643
+ )
644
+
645
+
646
+ def planOpticalSizeAxis(
647
+ glyphSetFunc,
648
+ axisLimits,
649
+ sizes=None,
650
+ samples=None,
651
+ glyphs=None,
652
+ designLimits=None,
653
+ pins=None,
654
+ sanitize=False,
655
+ ):
656
+ """Plan a optical-size (`opsz`) axis.
657
+
658
+ sizes: A list of optical size values to plan for. If None, the default
659
+ values are used.
660
+
661
+ This function simply calls planAxis with values=sizes, and the appropriate
662
+ arguments. See documenation for planAxis for more information.
663
+ """
664
+
665
+ if sizes is None:
666
+ sizes = SIZES
667
+
668
+ return planAxis(
669
+ measureWeight,
670
+ normalizeLog,
671
+ interpolateLog,
672
+ glyphSetFunc,
673
+ "opsz",
674
+ axisLimits,
675
+ values=sizes,
676
+ samples=samples,
677
+ glyphs=glyphs,
678
+ designLimits=designLimits,
679
+ pins=pins,
680
+ )
681
+
682
+
683
+ def makeDesignspaceSnippet(axisTag, axisName, axisLimit, mapping):
684
+ """Make a designspace snippet for a single axis."""
685
+
686
+ designspaceSnippet = (
687
+ ' <axis tag="%s" name="%s" minimum="%g" default="%g" maximum="%g"'
688
+ % ((axisTag, axisName) + axisLimit)
689
+ )
690
+ if mapping:
691
+ designspaceSnippet += ">\n"
692
+ else:
693
+ designspaceSnippet += "/>"
694
+
695
+ for key, value in mapping.items():
696
+ designspaceSnippet += ' <map input="%g" output="%g"/>\n' % (key, value)
697
+
698
+ if mapping:
699
+ designspaceSnippet += " </axis>"
700
+
701
+ return designspaceSnippet
702
+
703
+
704
+ def addEmptyAvar(font):
705
+ """Add an empty `avar` table to the font."""
706
+ font["avar"] = avar = newTable("avar")
707
+ for axis in fvar.axes:
708
+ avar.segments[axis.axisTag] = {}
709
+
710
+
711
+ def processAxis(
712
+ font,
713
+ planFunc,
714
+ axisTag,
715
+ axisName,
716
+ values,
717
+ samples=None,
718
+ glyphs=None,
719
+ designLimits=None,
720
+ pins=None,
721
+ sanitize=False,
722
+ plot=False,
723
+ ):
724
+ """Process a single axis."""
725
+
726
+ axisLimits = None
727
+ for axis in font["fvar"].axes:
728
+ if axis.axisTag == axisTag:
729
+ axisLimits = axis
730
+ break
731
+ if axisLimits is None:
732
+ return ""
733
+ axisLimits = (axisLimits.minValue, axisLimits.defaultValue, axisLimits.maxValue)
734
+
735
+ log.info("Planning %s axis.", axisName)
736
+
737
+ if "avar" in font:
738
+ existingMapping = font["avar"].segments[axisTag]
739
+ font["avar"].segments[axisTag] = {}
740
+ else:
741
+ existingMapping = None
742
+
743
+ if values is not None and isinstance(values, str):
744
+ values = [float(w) for w in values.split()]
745
+
746
+ if designLimits is not None and isinstance(designLimits, str):
747
+ designLimits = [float(d) for d in options.designLimits.split(":")]
748
+ assert (
749
+ len(designLimits) == 3
750
+ and designLimits[0] <= designLimits[1] <= designLimits[2]
751
+ )
752
+ else:
753
+ designLimits = None
754
+
755
+ if pins is not None and isinstance(pins, str):
756
+ newPins = {}
757
+ for pin in pins.split():
758
+ before, after = pin.split(":")
759
+ newPins[float(before)] = float(after)
760
+ pins = newPins
761
+ del newPins
762
+
763
+ mapping, mappingNormalized = planFunc(
764
+ font.getGlyphSet,
765
+ axisLimits,
766
+ values,
767
+ samples=samples,
768
+ glyphs=glyphs,
769
+ designLimits=designLimits,
770
+ pins=pins,
771
+ sanitize=sanitize,
772
+ )
773
+
774
+ if plot:
775
+ from matplotlib import pyplot
776
+
777
+ pyplot.plot(
778
+ sorted(mappingNormalized),
779
+ [mappingNormalized[k] for k in sorted(mappingNormalized)],
780
+ )
781
+ pyplot.show()
782
+
783
+ if existingMapping is not None:
784
+ log.info("Existing %s mapping:\n%s", axisName, pformat(existingMapping))
785
+
786
+ if mapping:
787
+ if "avar" not in font:
788
+ addEmptyAvar(font)
789
+ font["avar"].segments[axisTag] = mappingNormalized
790
+ else:
791
+ if "avar" in font:
792
+ font["avar"].segments[axisTag] = {}
793
+
794
+ designspaceSnippet = makeDesignspaceSnippet(
795
+ axisTag,
796
+ axisName,
797
+ axisLimits,
798
+ mapping,
799
+ )
800
+ return designspaceSnippet
801
+
802
+
803
+ def main(args=None):
804
+ """Plan the standard axis mappings for a variable font"""
805
+
806
+ if args is None:
807
+ import sys
808
+
809
+ args = sys.argv[1:]
810
+
811
+ from fontTools import configLogger
812
+ from fontTools.ttLib import TTFont
813
+ import argparse
814
+
815
+ parser = argparse.ArgumentParser(
816
+ "fonttools varLib.avarPlanner",
817
+ description="Plan `avar` table for variable font",
818
+ )
819
+ parser.add_argument("font", metavar="varfont.ttf", help="Variable-font file.")
820
+ parser.add_argument(
821
+ "-o",
822
+ "--output-file",
823
+ type=str,
824
+ help="Output font file name.",
825
+ )
826
+ parser.add_argument(
827
+ "--weights", type=str, help="Space-separate list of weights to generate."
828
+ )
829
+ parser.add_argument(
830
+ "--widths", type=str, help="Space-separate list of widths to generate."
831
+ )
832
+ parser.add_argument(
833
+ "--slants", type=str, help="Space-separate list of slants to generate."
834
+ )
835
+ parser.add_argument(
836
+ "--sizes", type=str, help="Space-separate list of optical-sizes to generate."
837
+ )
838
+ parser.add_argument("--samples", type=int, help="Number of samples.")
839
+ parser.add_argument(
840
+ "-s", "--sanitize", action="store_true", help="Sanitize axis limits"
841
+ )
842
+ parser.add_argument(
843
+ "-g",
844
+ "--glyphs",
845
+ type=str,
846
+ help="Space-separate list of glyphs to use for sampling.",
847
+ )
848
+ parser.add_argument(
849
+ "--weight-design-limits",
850
+ type=str,
851
+ help="min:default:max in design units for the `wght` axis.",
852
+ )
853
+ parser.add_argument(
854
+ "--width-design-limits",
855
+ type=str,
856
+ help="min:default:max in design units for the `wdth` axis.",
857
+ )
858
+ parser.add_argument(
859
+ "--slant-design-limits",
860
+ type=str,
861
+ help="min:default:max in design units for the `slnt` axis.",
862
+ )
863
+ parser.add_argument(
864
+ "--optical-size-design-limits",
865
+ type=str,
866
+ help="min:default:max in design units for the `opsz` axis.",
867
+ )
868
+ parser.add_argument(
869
+ "--weight-pins",
870
+ type=str,
871
+ help="Space-separate list of before:after pins for the `wght` axis.",
872
+ )
873
+ parser.add_argument(
874
+ "--width-pins",
875
+ type=str,
876
+ help="Space-separate list of before:after pins for the `wdth` axis.",
877
+ )
878
+ parser.add_argument(
879
+ "--slant-pins",
880
+ type=str,
881
+ help="Space-separate list of before:after pins for the `slnt` axis.",
882
+ )
883
+ parser.add_argument(
884
+ "--optical-size-pins",
885
+ type=str,
886
+ help="Space-separate list of before:after pins for the `opsz` axis.",
887
+ )
888
+ parser.add_argument(
889
+ "-p", "--plot", action="store_true", help="Plot the resulting mapping."
890
+ )
891
+
892
+ logging_group = parser.add_mutually_exclusive_group(required=False)
893
+ logging_group.add_argument(
894
+ "-v", "--verbose", action="store_true", help="Run more verbosely."
895
+ )
896
+ logging_group.add_argument(
897
+ "-q", "--quiet", action="store_true", help="Turn verbosity off."
898
+ )
899
+
900
+ options = parser.parse_args(args)
901
+
902
+ configLogger(
903
+ level=("DEBUG" if options.verbose else "WARNING" if options.quiet else "INFO")
904
+ )
905
+
906
+ font = TTFont(options.font)
907
+ if not "fvar" in font:
908
+ log.error("Not a variable font.")
909
+ return 1
910
+
911
+ if options.glyphs is not None:
912
+ glyphs = options.glyphs.split()
913
+ if ":" in options.glyphs:
914
+ glyphs = {}
915
+ for g in options.glyphs.split():
916
+ if ":" in g:
917
+ glyph, frequency = g.split(":")
918
+ glyphs[glyph] = float(frequency)
919
+ else:
920
+ glyphs[g] = 1.0
921
+ else:
922
+ glyphs = None
923
+
924
+ designspaceSnippets = []
925
+
926
+ designspaceSnippets.append(
927
+ processAxis(
928
+ font,
929
+ planWeightAxis,
930
+ "wght",
931
+ "Weight",
932
+ values=options.weights,
933
+ samples=options.samples,
934
+ glyphs=glyphs,
935
+ designLimits=options.weight_design_limits,
936
+ pins=options.weight_pins,
937
+ sanitize=options.sanitize,
938
+ plot=options.plot,
939
+ )
940
+ )
941
+ designspaceSnippets.append(
942
+ processAxis(
943
+ font,
944
+ planWidthAxis,
945
+ "wdth",
946
+ "Width",
947
+ values=options.widths,
948
+ samples=options.samples,
949
+ glyphs=glyphs,
950
+ designLimits=options.width_design_limits,
951
+ pins=options.width_pins,
952
+ sanitize=options.sanitize,
953
+ plot=options.plot,
954
+ )
955
+ )
956
+ designspaceSnippets.append(
957
+ processAxis(
958
+ font,
959
+ planSlantAxis,
960
+ "slnt",
961
+ "Slant",
962
+ values=options.slants,
963
+ samples=options.samples,
964
+ glyphs=glyphs,
965
+ designLimits=options.slant_design_limits,
966
+ pins=options.slant_pins,
967
+ sanitize=options.sanitize,
968
+ plot=options.plot,
969
+ )
970
+ )
971
+ designspaceSnippets.append(
972
+ processAxis(
973
+ font,
974
+ planOpticalSizeAxis,
975
+ "opsz",
976
+ "OpticalSize",
977
+ values=options.sizes,
978
+ samples=options.samples,
979
+ glyphs=glyphs,
980
+ designLimits=options.optical_size_design_limits,
981
+ pins=options.optical_size_pins,
982
+ sanitize=options.sanitize,
983
+ plot=options.plot,
984
+ )
985
+ )
986
+
987
+ log.info("Designspace snippet:")
988
+ for snippet in designspaceSnippets:
989
+ if snippet:
990
+ print(snippet)
991
+
992
+ if options.output_file is None:
993
+ outfile = makeOutputFileName(options.font, overWrite=True, suffix=".avar")
994
+ else:
995
+ outfile = options.output_file
996
+ if outfile:
997
+ log.info("Saving %s", outfile)
998
+ font.save(outfile)
999
+
1000
+
1001
+ if __name__ == "__main__":
1002
+ import sys
1003
+
1004
+ sys.exit(main())
evalkit_tf437/lib/python3.10/site-packages/fontTools/varLib/varStore.py ADDED
@@ -0,0 +1,767 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fontTools.misc.roundTools import noRound, otRound
2
+ from fontTools.misc.intTools import bit_count
3
+ from fontTools.ttLib.tables import otTables as ot
4
+ from fontTools.varLib.models import supportScalar
5
+ from fontTools.varLib.builder import (
6
+ buildVarRegionList,
7
+ buildVarStore,
8
+ buildVarRegion,
9
+ buildVarData,
10
+ )
11
+ from functools import partial
12
+ from collections import defaultdict
13
+ from heapq import heappush, heappop
14
+
15
+
16
+ NO_VARIATION_INDEX = ot.NO_VARIATION_INDEX
17
+ ot.VarStore.NO_VARIATION_INDEX = NO_VARIATION_INDEX
18
+
19
+
20
+ def _getLocationKey(loc):
21
+ return tuple(sorted(loc.items(), key=lambda kv: kv[0]))
22
+
23
+
24
+ class OnlineVarStoreBuilder(object):
25
+ def __init__(self, axisTags):
26
+ self._axisTags = axisTags
27
+ self._regionMap = {}
28
+ self._regionList = buildVarRegionList([], axisTags)
29
+ self._store = buildVarStore(self._regionList, [])
30
+ self._data = None
31
+ self._model = None
32
+ self._supports = None
33
+ self._varDataIndices = {}
34
+ self._varDataCaches = {}
35
+ self._cache = None
36
+
37
+ def setModel(self, model):
38
+ self.setSupports(model.supports)
39
+ self._model = model
40
+
41
+ def setSupports(self, supports):
42
+ self._model = None
43
+ self._supports = list(supports)
44
+ if not self._supports[0]:
45
+ del self._supports[0] # Drop base master support
46
+ self._cache = None
47
+ self._data = None
48
+
49
+ def finish(self, optimize=True):
50
+ self._regionList.RegionCount = len(self._regionList.Region)
51
+ self._store.VarDataCount = len(self._store.VarData)
52
+ for data in self._store.VarData:
53
+ data.ItemCount = len(data.Item)
54
+ data.calculateNumShorts(optimize=optimize)
55
+ return self._store
56
+
57
+ def _add_VarData(self, num_items=1):
58
+ regionMap = self._regionMap
59
+ regionList = self._regionList
60
+
61
+ regions = self._supports
62
+ regionIndices = []
63
+ for region in regions:
64
+ key = _getLocationKey(region)
65
+ idx = regionMap.get(key)
66
+ if idx is None:
67
+ varRegion = buildVarRegion(region, self._axisTags)
68
+ idx = regionMap[key] = len(regionList.Region)
69
+ regionList.Region.append(varRegion)
70
+ regionIndices.append(idx)
71
+
72
+ # Check if we have one already...
73
+ key = tuple(regionIndices)
74
+ varDataIdx = self._varDataIndices.get(key)
75
+ if varDataIdx is not None:
76
+ self._outer = varDataIdx
77
+ self._data = self._store.VarData[varDataIdx]
78
+ self._cache = self._varDataCaches[key]
79
+ if len(self._data.Item) + num_items > 0xFFFF:
80
+ # This is full. Need new one.
81
+ varDataIdx = None
82
+
83
+ if varDataIdx is None:
84
+ self._data = buildVarData(regionIndices, [], optimize=False)
85
+ self._outer = len(self._store.VarData)
86
+ self._store.VarData.append(self._data)
87
+ self._varDataIndices[key] = self._outer
88
+ if key not in self._varDataCaches:
89
+ self._varDataCaches[key] = {}
90
+ self._cache = self._varDataCaches[key]
91
+
92
+ def storeMasters(self, master_values, *, round=round):
93
+ deltas = self._model.getDeltas(master_values, round=round)
94
+ base = deltas.pop(0)
95
+ return base, self.storeDeltas(deltas, round=noRound)
96
+
97
+ def storeMastersMany(self, master_values_list, *, round=round):
98
+ deltas_list = [
99
+ self._model.getDeltas(master_values, round=round)
100
+ for master_values in master_values_list
101
+ ]
102
+ base_list = [deltas.pop(0) for deltas in deltas_list]
103
+ return base_list, self.storeDeltasMany(deltas_list, round=noRound)
104
+
105
+ def storeDeltas(self, deltas, *, round=round):
106
+ deltas = [round(d) for d in deltas]
107
+ if len(deltas) == len(self._supports) + 1:
108
+ deltas = tuple(deltas[1:])
109
+ else:
110
+ assert len(deltas) == len(self._supports)
111
+ deltas = tuple(deltas)
112
+
113
+ if not self._data:
114
+ self._add_VarData()
115
+
116
+ varIdx = self._cache.get(deltas)
117
+ if varIdx is not None:
118
+ return varIdx
119
+
120
+ inner = len(self._data.Item)
121
+ if inner == 0xFFFF:
122
+ # Full array. Start new one.
123
+ self._add_VarData()
124
+ return self.storeDeltas(deltas, round=noRound)
125
+ self._data.addItem(deltas, round=noRound)
126
+
127
+ varIdx = (self._outer << 16) + inner
128
+ self._cache[deltas] = varIdx
129
+ return varIdx
130
+
131
+ def storeDeltasMany(self, deltas_list, *, round=round):
132
+ deltas_list = [[round(d) for d in deltas] for deltas in deltas_list]
133
+ deltas_list = tuple(tuple(deltas) for deltas in deltas_list)
134
+
135
+ if not self._data:
136
+ self._add_VarData(len(deltas_list))
137
+
138
+ varIdx = self._cache.get(deltas_list)
139
+ if varIdx is not None:
140
+ return varIdx
141
+
142
+ inner = len(self._data.Item)
143
+ if inner + len(deltas_list) > 0xFFFF:
144
+ # Full array. Start new one.
145
+ self._add_VarData(len(deltas_list))
146
+ return self.storeDeltasMany(deltas_list, round=noRound)
147
+ for i, deltas in enumerate(deltas_list):
148
+ self._data.addItem(deltas, round=noRound)
149
+
150
+ varIdx = (self._outer << 16) + inner + i
151
+ self._cache[deltas] = varIdx
152
+
153
+ varIdx = (self._outer << 16) + inner
154
+ self._cache[deltas_list] = varIdx
155
+
156
+ return varIdx
157
+
158
+
159
+ def VarData_addItem(self, deltas, *, round=round):
160
+ deltas = [round(d) for d in deltas]
161
+
162
+ countUs = self.VarRegionCount
163
+ countThem = len(deltas)
164
+ if countUs + 1 == countThem:
165
+ deltas = list(deltas[1:])
166
+ else:
167
+ assert countUs == countThem, (countUs, countThem)
168
+ deltas = list(deltas)
169
+ self.Item.append(deltas)
170
+ self.ItemCount = len(self.Item)
171
+
172
+
173
+ ot.VarData.addItem = VarData_addItem
174
+
175
+
176
+ def VarRegion_get_support(self, fvar_axes):
177
+ return {
178
+ fvar_axes[i].axisTag: (reg.StartCoord, reg.PeakCoord, reg.EndCoord)
179
+ for i, reg in enumerate(self.VarRegionAxis)
180
+ if reg.PeakCoord != 0
181
+ }
182
+
183
+
184
+ ot.VarRegion.get_support = VarRegion_get_support
185
+
186
+
187
+ def VarStore___bool__(self):
188
+ return bool(self.VarData)
189
+
190
+
191
+ ot.VarStore.__bool__ = VarStore___bool__
192
+
193
+
194
+ class VarStoreInstancer(object):
195
+ def __init__(self, varstore, fvar_axes, location={}):
196
+ self.fvar_axes = fvar_axes
197
+ assert varstore is None or varstore.Format == 1
198
+ self._varData = varstore.VarData if varstore else []
199
+ self._regions = varstore.VarRegionList.Region if varstore else []
200
+ self.setLocation(location)
201
+
202
+ def setLocation(self, location):
203
+ self.location = dict(location)
204
+ self._clearCaches()
205
+
206
+ def _clearCaches(self):
207
+ self._scalars = {}
208
+
209
+ def _getScalar(self, regionIdx):
210
+ scalar = self._scalars.get(regionIdx)
211
+ if scalar is None:
212
+ support = self._regions[regionIdx].get_support(self.fvar_axes)
213
+ scalar = supportScalar(self.location, support)
214
+ self._scalars[regionIdx] = scalar
215
+ return scalar
216
+
217
+ @staticmethod
218
+ def interpolateFromDeltasAndScalars(deltas, scalars):
219
+ delta = 0.0
220
+ for d, s in zip(deltas, scalars):
221
+ if not s:
222
+ continue
223
+ delta += d * s
224
+ return delta
225
+
226
+ def __getitem__(self, varidx):
227
+ major, minor = varidx >> 16, varidx & 0xFFFF
228
+ if varidx == NO_VARIATION_INDEX:
229
+ return 0.0
230
+ varData = self._varData
231
+ scalars = [self._getScalar(ri) for ri in varData[major].VarRegionIndex]
232
+ deltas = varData[major].Item[minor]
233
+ return self.interpolateFromDeltasAndScalars(deltas, scalars)
234
+
235
+ def interpolateFromDeltas(self, varDataIndex, deltas):
236
+ varData = self._varData
237
+ scalars = [self._getScalar(ri) for ri in varData[varDataIndex].VarRegionIndex]
238
+ return self.interpolateFromDeltasAndScalars(deltas, scalars)
239
+
240
+
241
+ #
242
+ # Optimizations
243
+ #
244
+ # retainFirstMap - If true, major 0 mappings are retained. Deltas for unused indices are zeroed
245
+ # advIdxes - Set of major 0 indices for advance deltas to be listed first. Other major 0 indices follow.
246
+
247
+
248
+ def VarStore_subset_varidxes(
249
+ self,
250
+ varIdxes,
251
+ optimize=True,
252
+ retainFirstMap=False,
253
+ advIdxes=set(),
254
+ *,
255
+ VarData="VarData",
256
+ ):
257
+ # Sort out used varIdxes by major/minor.
258
+ used = defaultdict(set)
259
+ for varIdx in varIdxes:
260
+ if varIdx == NO_VARIATION_INDEX:
261
+ continue
262
+ major = varIdx >> 16
263
+ minor = varIdx & 0xFFFF
264
+ used[major].add(minor)
265
+ del varIdxes
266
+
267
+ #
268
+ # Subset VarData
269
+ #
270
+
271
+ varData = getattr(self, VarData)
272
+ newVarData = []
273
+ varDataMap = {NO_VARIATION_INDEX: NO_VARIATION_INDEX}
274
+ for major, data in enumerate(varData):
275
+ usedMinors = used.get(major)
276
+ if usedMinors is None:
277
+ continue
278
+ newMajor = len(newVarData)
279
+ newVarData.append(data)
280
+
281
+ items = data.Item
282
+ newItems = []
283
+ if major == 0 and retainFirstMap:
284
+ for minor in range(len(items)):
285
+ newItems.append(
286
+ items[minor] if minor in usedMinors else [0] * len(items[minor])
287
+ )
288
+ varDataMap[minor] = minor
289
+ else:
290
+ if major == 0:
291
+ minors = sorted(advIdxes) + sorted(usedMinors - advIdxes)
292
+ else:
293
+ minors = sorted(usedMinors)
294
+ for minor in minors:
295
+ newMinor = len(newItems)
296
+ newItems.append(items[minor])
297
+ varDataMap[(major << 16) + minor] = (newMajor << 16) + newMinor
298
+
299
+ data.Item = newItems
300
+ data.ItemCount = len(data.Item)
301
+
302
+ if VarData == "VarData":
303
+ data.calculateNumShorts(optimize=optimize)
304
+
305
+ setattr(self, VarData, newVarData)
306
+ setattr(self, VarData + "Count", len(newVarData))
307
+
308
+ self.prune_regions()
309
+
310
+ return varDataMap
311
+
312
+
313
+ ot.VarStore.subset_varidxes = VarStore_subset_varidxes
314
+
315
+
316
+ def VarStore_prune_regions(self, *, VarData="VarData", VarRegionList="VarRegionList"):
317
+ """Remove unused VarRegions."""
318
+ #
319
+ # Subset VarRegionList
320
+ #
321
+
322
+ # Collect.
323
+ usedRegions = set()
324
+ for data in getattr(self, VarData):
325
+ usedRegions.update(data.VarRegionIndex)
326
+ # Subset.
327
+ regionList = getattr(self, VarRegionList)
328
+ regions = regionList.Region
329
+ newRegions = []
330
+ regionMap = {}
331
+ for i in sorted(usedRegions):
332
+ regionMap[i] = len(newRegions)
333
+ newRegions.append(regions[i])
334
+ regionList.Region = newRegions
335
+ regionList.RegionCount = len(regionList.Region)
336
+ # Map.
337
+ for data in getattr(self, VarData):
338
+ data.VarRegionIndex = [regionMap[i] for i in data.VarRegionIndex]
339
+
340
+
341
+ ot.VarStore.prune_regions = VarStore_prune_regions
342
+
343
+
344
+ def _visit(self, func):
345
+ """Recurse down from self, if type of an object is ot.Device,
346
+ call func() on it. Works on otData-style classes."""
347
+
348
+ if type(self) == ot.Device:
349
+ func(self)
350
+
351
+ elif isinstance(self, list):
352
+ for that in self:
353
+ _visit(that, func)
354
+
355
+ elif hasattr(self, "getConverters") and not hasattr(self, "postRead"):
356
+ for conv in self.getConverters():
357
+ that = getattr(self, conv.name, None)
358
+ if that is not None:
359
+ _visit(that, func)
360
+
361
+ elif isinstance(self, ot.ValueRecord):
362
+ for that in self.__dict__.values():
363
+ _visit(that, func)
364
+
365
+
366
+ def _Device_recordVarIdx(self, s):
367
+ """Add VarIdx in this Device table (if any) to the set s."""
368
+ if self.DeltaFormat == 0x8000:
369
+ s.add((self.StartSize << 16) + self.EndSize)
370
+
371
+
372
+ def Object_collect_device_varidxes(self, varidxes):
373
+ adder = partial(_Device_recordVarIdx, s=varidxes)
374
+ _visit(self, adder)
375
+
376
+
377
+ ot.GDEF.collect_device_varidxes = Object_collect_device_varidxes
378
+ ot.GPOS.collect_device_varidxes = Object_collect_device_varidxes
379
+
380
+
381
+ def _Device_mapVarIdx(self, mapping, done):
382
+ """Map VarIdx in this Device table (if any) through mapping."""
383
+ if id(self) in done:
384
+ return
385
+ done.add(id(self))
386
+ if self.DeltaFormat == 0x8000:
387
+ varIdx = mapping[(self.StartSize << 16) + self.EndSize]
388
+ self.StartSize = varIdx >> 16
389
+ self.EndSize = varIdx & 0xFFFF
390
+
391
+
392
+ def Object_remap_device_varidxes(self, varidxes_map):
393
+ mapper = partial(_Device_mapVarIdx, mapping=varidxes_map, done=set())
394
+ _visit(self, mapper)
395
+
396
+
397
+ ot.GDEF.remap_device_varidxes = Object_remap_device_varidxes
398
+ ot.GPOS.remap_device_varidxes = Object_remap_device_varidxes
399
+
400
+
401
+ class _Encoding(object):
402
+ def __init__(self, chars):
403
+ self.chars = chars
404
+ self.width = bit_count(chars)
405
+ self.columns = self._columns(chars)
406
+ self.overhead = self._characteristic_overhead(self.columns)
407
+ self.items = set()
408
+
409
+ def append(self, row):
410
+ self.items.add(row)
411
+
412
+ def extend(self, lst):
413
+ self.items.update(lst)
414
+
415
+ def get_room(self):
416
+ """Maximum number of bytes that can be added to characteristic
417
+ while still being beneficial to merge it into another one."""
418
+ count = len(self.items)
419
+ return max(0, (self.overhead - 1) // count - self.width)
420
+
421
+ room = property(get_room)
422
+
423
+ def get_gain(self):
424
+ """Maximum possible byte gain from merging this into another
425
+ characteristic."""
426
+ count = len(self.items)
427
+ return max(0, self.overhead - count)
428
+
429
+ gain = property(get_gain)
430
+
431
+ def gain_sort_key(self):
432
+ return self.gain, self.chars
433
+
434
+ def width_sort_key(self):
435
+ return self.width, self.chars
436
+
437
+ @staticmethod
438
+ def _characteristic_overhead(columns):
439
+ """Returns overhead in bytes of encoding this characteristic
440
+ as a VarData."""
441
+ c = 4 + 6 # 4 bytes for LOffset, 6 bytes for VarData header
442
+ c += bit_count(columns) * 2
443
+ return c
444
+
445
+ @staticmethod
446
+ def _columns(chars):
447
+ cols = 0
448
+ i = 1
449
+ while chars:
450
+ if chars & 0b1111:
451
+ cols |= i
452
+ chars >>= 4
453
+ i <<= 1
454
+ return cols
455
+
456
+ def gain_from_merging(self, other_encoding):
457
+ combined_chars = other_encoding.chars | self.chars
458
+ combined_width = bit_count(combined_chars)
459
+ combined_columns = self.columns | other_encoding.columns
460
+ combined_overhead = _Encoding._characteristic_overhead(combined_columns)
461
+ combined_gain = (
462
+ +self.overhead
463
+ + other_encoding.overhead
464
+ - combined_overhead
465
+ - (combined_width - self.width) * len(self.items)
466
+ - (combined_width - other_encoding.width) * len(other_encoding.items)
467
+ )
468
+ return combined_gain
469
+
470
+
471
+ class _EncodingDict(dict):
472
+ def __missing__(self, chars):
473
+ r = self[chars] = _Encoding(chars)
474
+ return r
475
+
476
+ def add_row(self, row):
477
+ chars = self._row_characteristics(row)
478
+ self[chars].append(row)
479
+
480
+ @staticmethod
481
+ def _row_characteristics(row):
482
+ """Returns encoding characteristics for a row."""
483
+ longWords = False
484
+
485
+ chars = 0
486
+ i = 1
487
+ for v in row:
488
+ if v:
489
+ chars += i
490
+ if not (-128 <= v <= 127):
491
+ chars += i * 0b0010
492
+ if not (-32768 <= v <= 32767):
493
+ longWords = True
494
+ break
495
+ i <<= 4
496
+
497
+ if longWords:
498
+ # Redo; only allow 2byte/4byte encoding
499
+ chars = 0
500
+ i = 1
501
+ for v in row:
502
+ if v:
503
+ chars += i * 0b0011
504
+ if not (-32768 <= v <= 32767):
505
+ chars += i * 0b1100
506
+ i <<= 4
507
+
508
+ return chars
509
+
510
+
511
+ def VarStore_optimize(self, use_NO_VARIATION_INDEX=True, quantization=1):
512
+ """Optimize storage. Returns mapping from old VarIdxes to new ones."""
513
+
514
+ # Overview:
515
+ #
516
+ # For each VarData row, we first extend it with zeroes to have
517
+ # one column per region in VarRegionList. We then group the
518
+ # rows into _Encoding objects, by their "characteristic" bitmap.
519
+ # The characteristic bitmap is a binary number representing how
520
+ # many bytes each column of the data takes up to encode. Each
521
+ # column is encoded in four bits. For example, if a column has
522
+ # only values in the range -128..127, it would only have a single
523
+ # bit set in the characteristic bitmap for that column. If it has
524
+ # values in the range -32768..32767, it would have two bits set.
525
+ # The number of ones in the characteristic bitmap is the "width"
526
+ # of the encoding.
527
+ #
528
+ # Each encoding as such has a number of "active" (ie. non-zero)
529
+ # columns. The overhead of encoding the characteristic bitmap
530
+ # is 10 bytes, plus 2 bytes per active column.
531
+ #
532
+ # When an encoding is merged into another one, if the characteristic
533
+ # of the old encoding is a subset of the new one, then the overhead
534
+ # of the old encoding is completely eliminated. However, each row
535
+ # now would require more bytes to encode, to the tune of one byte
536
+ # per characteristic bit that is active in the new encoding but not
537
+ # in the old one. The number of bits that can be added to an encoding
538
+ # while still beneficial to merge it into another encoding is called
539
+ # the "room" for that encoding.
540
+ #
541
+ # The "gain" of an encodings is the maximum number of bytes we can
542
+ # save by merging it into another encoding. The "gain" of merging
543
+ # two encodings is how many bytes we save by doing so.
544
+ #
545
+ # High-level algorithm:
546
+ #
547
+ # - Each encoding has a minimal way to encode it. However, because
548
+ # of the overhead of encoding the characteristic bitmap, it may
549
+ # be beneficial to merge two encodings together, if there is
550
+ # gain in doing so. As such, we need to search for the best
551
+ # such successive merges.
552
+ #
553
+ # Algorithm:
554
+ #
555
+ # - Put all encodings into a "todo" list.
556
+ #
557
+ # - Sort todo list by decreasing gain (for stability).
558
+ #
559
+ # - Make a priority-queue of the gain from combining each two
560
+ # encodings in the todo list. The priority queue is sorted by
561
+ # decreasing gain. Only positive gains are included.
562
+ #
563
+ # - While priority queue is not empty:
564
+ # - Pop the first item from the priority queue,
565
+ # - Merge the two encodings it represents,
566
+ # - Remove the two encodings from the todo list,
567
+ # - Insert positive gains from combining the new encoding with
568
+ # all existing todo list items into the priority queue,
569
+ # - If a todo list item with the same characteristic bitmap as
570
+ # the new encoding exists, remove it from the todo list and
571
+ # merge it into the new encoding.
572
+ # - Insert the new encoding into the todo list,
573
+ #
574
+ # - Encode all remaining items in the todo list.
575
+ #
576
+ # The output is then sorted for stability, in the following way:
577
+ # - The VarRegionList of the input is kept intact.
578
+ # - All encodings are sorted before the main algorithm, by
579
+ # gain_key_sort(), which is a tuple of the following items:
580
+ # * The gain of the encoding.
581
+ # * The characteristic bitmap of the encoding, with higher-numbered
582
+ # columns compared first.
583
+ # - The VarData is sorted by width_sort_key(), which is a tuple
584
+ # of the following items:
585
+ # * The "width" of the encoding.
586
+ # * The characteristic bitmap of the encoding, with higher-numbered
587
+ # columns compared first.
588
+ # - Within each VarData, the items are sorted as vectors of numbers.
589
+ #
590
+ # Finally, each VarData is optimized to remove the empty columns and
591
+ # reorder columns as needed.
592
+
593
+ # TODO
594
+ # Check that no two VarRegions are the same; if they are, fold them.
595
+
596
+ n = len(self.VarRegionList.Region) # Number of columns
597
+ zeroes = [0] * n
598
+
599
+ front_mapping = {} # Map from old VarIdxes to full row tuples
600
+
601
+ encodings = _EncodingDict()
602
+
603
+ # Collect all items into a set of full rows (with lots of zeroes.)
604
+ for major, data in enumerate(self.VarData):
605
+ regionIndices = data.VarRegionIndex
606
+
607
+ for minor, item in enumerate(data.Item):
608
+ row = list(zeroes)
609
+
610
+ if quantization == 1:
611
+ for regionIdx, v in zip(regionIndices, item):
612
+ row[regionIdx] += v
613
+ else:
614
+ for regionIdx, v in zip(regionIndices, item):
615
+ row[regionIdx] += (
616
+ round(v / quantization) * quantization
617
+ ) # TODO https://github.com/fonttools/fonttools/pull/3126#discussion_r1205439785
618
+
619
+ row = tuple(row)
620
+
621
+ if use_NO_VARIATION_INDEX and not any(row):
622
+ front_mapping[(major << 16) + minor] = None
623
+ continue
624
+
625
+ encodings.add_row(row)
626
+ front_mapping[(major << 16) + minor] = row
627
+
628
+ # Prepare for the main algorithm.
629
+ todo = sorted(encodings.values(), key=_Encoding.gain_sort_key)
630
+ del encodings
631
+
632
+ # Repeatedly pick two best encodings to combine, and combine them.
633
+
634
+ heap = []
635
+ for i, encoding in enumerate(todo):
636
+ for j in range(i + 1, len(todo)):
637
+ other_encoding = todo[j]
638
+ combining_gain = encoding.gain_from_merging(other_encoding)
639
+ if combining_gain > 0:
640
+ heappush(heap, (-combining_gain, i, j))
641
+
642
+ while heap:
643
+ _, i, j = heappop(heap)
644
+ if todo[i] is None or todo[j] is None:
645
+ continue
646
+
647
+ encoding, other_encoding = todo[i], todo[j]
648
+ todo[i], todo[j] = None, None
649
+
650
+ # Combine the two encodings
651
+ combined_chars = other_encoding.chars | encoding.chars
652
+ combined_encoding = _Encoding(combined_chars)
653
+ combined_encoding.extend(encoding.items)
654
+ combined_encoding.extend(other_encoding.items)
655
+
656
+ for k, enc in enumerate(todo):
657
+ if enc is None:
658
+ continue
659
+
660
+ # In the unlikely event that the same encoding exists already,
661
+ # combine it.
662
+ if enc.chars == combined_chars:
663
+ combined_encoding.extend(enc.items)
664
+ todo[k] = None
665
+ continue
666
+
667
+ combining_gain = combined_encoding.gain_from_merging(enc)
668
+ if combining_gain > 0:
669
+ heappush(heap, (-combining_gain, k, len(todo)))
670
+
671
+ todo.append(combined_encoding)
672
+
673
+ encodings = [encoding for encoding in todo if encoding is not None]
674
+
675
+ # Assemble final store.
676
+ back_mapping = {} # Mapping from full rows to new VarIdxes
677
+ encodings.sort(key=_Encoding.width_sort_key)
678
+ self.VarData = []
679
+ for encoding in encodings:
680
+ items = sorted(encoding.items)
681
+
682
+ while items:
683
+ major = len(self.VarData)
684
+ data = ot.VarData()
685
+ self.VarData.append(data)
686
+ data.VarRegionIndex = range(n)
687
+ data.VarRegionCount = len(data.VarRegionIndex)
688
+
689
+ # Each major can only encode up to 0xFFFF entries.
690
+ data.Item, items = items[:0xFFFF], items[0xFFFF:]
691
+
692
+ for minor, item in enumerate(data.Item):
693
+ back_mapping[item] = (major << 16) + minor
694
+
695
+ # Compile final mapping.
696
+ varidx_map = {NO_VARIATION_INDEX: NO_VARIATION_INDEX}
697
+ for k, v in front_mapping.items():
698
+ varidx_map[k] = back_mapping[v] if v is not None else NO_VARIATION_INDEX
699
+
700
+ # Recalculate things and go home.
701
+ self.VarRegionList.RegionCount = len(self.VarRegionList.Region)
702
+ self.VarDataCount = len(self.VarData)
703
+ for data in self.VarData:
704
+ data.ItemCount = len(data.Item)
705
+ data.optimize()
706
+
707
+ # Remove unused regions.
708
+ self.prune_regions()
709
+
710
+ return varidx_map
711
+
712
+
713
+ ot.VarStore.optimize = VarStore_optimize
714
+
715
+
716
+ def main(args=None):
717
+ """Optimize a font's GDEF variation store"""
718
+ from argparse import ArgumentParser
719
+ from fontTools import configLogger
720
+ from fontTools.ttLib import TTFont
721
+ from fontTools.ttLib.tables.otBase import OTTableWriter
722
+
723
+ parser = ArgumentParser(prog="varLib.varStore", description=main.__doc__)
724
+ parser.add_argument("--quantization", type=int, default=1)
725
+ parser.add_argument("fontfile")
726
+ parser.add_argument("outfile", nargs="?")
727
+ options = parser.parse_args(args)
728
+
729
+ # TODO: allow user to configure logging via command-line options
730
+ configLogger(level="INFO")
731
+
732
+ quantization = options.quantization
733
+ fontfile = options.fontfile
734
+ outfile = options.outfile
735
+
736
+ font = TTFont(fontfile)
737
+ gdef = font["GDEF"]
738
+ store = gdef.table.VarStore
739
+
740
+ writer = OTTableWriter()
741
+ store.compile(writer, font)
742
+ size = len(writer.getAllData())
743
+ print("Before: %7d bytes" % size)
744
+
745
+ varidx_map = store.optimize(quantization=quantization)
746
+
747
+ writer = OTTableWriter()
748
+ store.compile(writer, font)
749
+ size = len(writer.getAllData())
750
+ print("After: %7d bytes" % size)
751
+
752
+ if outfile is not None:
753
+ gdef.table.remap_device_varidxes(varidx_map)
754
+ if "GPOS" in font:
755
+ font["GPOS"].table.remap_device_varidxes(varidx_map)
756
+
757
+ font.save(outfile)
758
+
759
+
760
+ if __name__ == "__main__":
761
+ import sys
762
+
763
+ if len(sys.argv) > 1:
764
+ sys.exit(main())
765
+ import doctest
766
+
767
+ sys.exit(doctest.testmod().failed)
evalkit_tf437/lib/python3.10/site-packages/gradio/templates/node/build/client/_app/immutable/chunks/Index.UTvV8BW1.js.gz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b34b0ae8ab3dd1b94680e092b5fbe44b0cb18598b250c1e5b5ed8cd1d9814990
3
+ size 173751
evalkit_tf437/lib/python3.10/site-packages/httpx/__pycache__/_content.cpython-310.pyc ADDED
Binary file (7.22 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/httpx/__pycache__/_exceptions.cpython-310.pyc ADDED
Binary file (10.4 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/httpx/__pycache__/_main.cpython-310.pyc ADDED
Binary file (12.4 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/httpx/_api.py ADDED
@@ -0,0 +1,479 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import typing
4
+ from contextlib import contextmanager
5
+
6
+ from ._client import Client
7
+ from ._config import DEFAULT_TIMEOUT_CONFIG
8
+ from ._models import Response
9
+ from ._types import (
10
+ AuthTypes,
11
+ CertTypes,
12
+ CookieTypes,
13
+ HeaderTypes,
14
+ ProxiesTypes,
15
+ ProxyTypes,
16
+ QueryParamTypes,
17
+ RequestContent,
18
+ RequestData,
19
+ RequestFiles,
20
+ TimeoutTypes,
21
+ VerifyTypes,
22
+ )
23
+ from ._urls import URL
24
+
25
+ __all__ = [
26
+ "delete",
27
+ "get",
28
+ "head",
29
+ "options",
30
+ "patch",
31
+ "post",
32
+ "put",
33
+ "request",
34
+ "stream",
35
+ ]
36
+
37
+
38
+ def request(
39
+ method: str,
40
+ url: URL | str,
41
+ *,
42
+ params: QueryParamTypes | None = None,
43
+ content: RequestContent | None = None,
44
+ data: RequestData | None = None,
45
+ files: RequestFiles | None = None,
46
+ json: typing.Any | None = None,
47
+ headers: HeaderTypes | None = None,
48
+ cookies: CookieTypes | None = None,
49
+ auth: AuthTypes | None = None,
50
+ proxy: ProxyTypes | None = None,
51
+ proxies: ProxiesTypes | None = None,
52
+ timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
53
+ follow_redirects: bool = False,
54
+ verify: VerifyTypes = True,
55
+ cert: CertTypes | None = None,
56
+ trust_env: bool = True,
57
+ ) -> Response:
58
+ """
59
+ Sends an HTTP request.
60
+
61
+ **Parameters:**
62
+
63
+ * **method** - HTTP method for the new `Request` object: `GET`, `OPTIONS`,
64
+ `HEAD`, `POST`, `PUT`, `PATCH`, or `DELETE`.
65
+ * **url** - URL for the new `Request` object.
66
+ * **params** - *(optional)* Query parameters to include in the URL, as a
67
+ string, dictionary, or sequence of two-tuples.
68
+ * **content** - *(optional)* Binary content to include in the body of the
69
+ request, as bytes or a byte iterator.
70
+ * **data** - *(optional)* Form data to include in the body of the request,
71
+ as a dictionary.
72
+ * **files** - *(optional)* A dictionary of upload files to include in the
73
+ body of the request.
74
+ * **json** - *(optional)* A JSON serializable object to include in the body
75
+ of the request.
76
+ * **headers** - *(optional)* Dictionary of HTTP headers to include in the
77
+ request.
78
+ * **cookies** - *(optional)* Dictionary of Cookie items to include in the
79
+ request.
80
+ * **auth** - *(optional)* An authentication class to use when sending the
81
+ request.
82
+ * **proxy** - *(optional)* A proxy URL where all the traffic should be routed.
83
+ * **proxies** - *(optional)* A dictionary mapping proxy keys to proxy URLs.
84
+ * **timeout** - *(optional)* The timeout configuration to use when sending
85
+ the request.
86
+ * **follow_redirects** - *(optional)* Enables or disables HTTP redirects.
87
+ * **verify** - *(optional)* SSL certificates (a.k.a CA bundle) used to
88
+ verify the identity of requested hosts. Either `True` (default CA bundle),
89
+ a path to an SSL certificate file, an `ssl.SSLContext`, or `False`
90
+ (which will disable verification).
91
+ * **cert** - *(optional)* An SSL certificate used by the requested host
92
+ to authenticate the client. Either a path to an SSL certificate file, or
93
+ two-tuple of (certificate file, key file), or a three-tuple of (certificate
94
+ file, key file, password).
95
+ * **trust_env** - *(optional)* Enables or disables usage of environment
96
+ variables for configuration.
97
+
98
+ **Returns:** `Response`
99
+
100
+ Usage:
101
+
102
+ ```
103
+ >>> import httpx
104
+ >>> response = httpx.request('GET', 'https://httpbin.org/get')
105
+ >>> response
106
+ <Response [200 OK]>
107
+ ```
108
+ """
109
+ with Client(
110
+ cookies=cookies,
111
+ proxy=proxy,
112
+ proxies=proxies,
113
+ cert=cert,
114
+ verify=verify,
115
+ timeout=timeout,
116
+ trust_env=trust_env,
117
+ ) as client:
118
+ return client.request(
119
+ method=method,
120
+ url=url,
121
+ content=content,
122
+ data=data,
123
+ files=files,
124
+ json=json,
125
+ params=params,
126
+ headers=headers,
127
+ auth=auth,
128
+ follow_redirects=follow_redirects,
129
+ )
130
+
131
+
132
+ @contextmanager
133
+ def stream(
134
+ method: str,
135
+ url: URL | str,
136
+ *,
137
+ params: QueryParamTypes | None = None,
138
+ content: RequestContent | None = None,
139
+ data: RequestData | None = None,
140
+ files: RequestFiles | None = None,
141
+ json: typing.Any | None = None,
142
+ headers: HeaderTypes | None = None,
143
+ cookies: CookieTypes | None = None,
144
+ auth: AuthTypes | None = None,
145
+ proxy: ProxyTypes | None = None,
146
+ proxies: ProxiesTypes | None = None,
147
+ timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
148
+ follow_redirects: bool = False,
149
+ verify: VerifyTypes = True,
150
+ cert: CertTypes | None = None,
151
+ trust_env: bool = True,
152
+ ) -> typing.Iterator[Response]:
153
+ """
154
+ Alternative to `httpx.request()` that streams the response body
155
+ instead of loading it into memory at once.
156
+
157
+ **Parameters**: See `httpx.request`.
158
+
159
+ See also: [Streaming Responses][0]
160
+
161
+ [0]: /quickstart#streaming-responses
162
+ """
163
+ with Client(
164
+ cookies=cookies,
165
+ proxy=proxy,
166
+ proxies=proxies,
167
+ cert=cert,
168
+ verify=verify,
169
+ timeout=timeout,
170
+ trust_env=trust_env,
171
+ ) as client:
172
+ with client.stream(
173
+ method=method,
174
+ url=url,
175
+ content=content,
176
+ data=data,
177
+ files=files,
178
+ json=json,
179
+ params=params,
180
+ headers=headers,
181
+ auth=auth,
182
+ follow_redirects=follow_redirects,
183
+ ) as response:
184
+ yield response
185
+
186
+
187
+ def get(
188
+ url: URL | str,
189
+ *,
190
+ params: QueryParamTypes | None = None,
191
+ headers: HeaderTypes | None = None,
192
+ cookies: CookieTypes | None = None,
193
+ auth: AuthTypes | None = None,
194
+ proxy: ProxyTypes | None = None,
195
+ proxies: ProxiesTypes | None = None,
196
+ follow_redirects: bool = False,
197
+ cert: CertTypes | None = None,
198
+ verify: VerifyTypes = True,
199
+ timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
200
+ trust_env: bool = True,
201
+ ) -> Response:
202
+ """
203
+ Sends a `GET` request.
204
+
205
+ **Parameters**: See `httpx.request`.
206
+
207
+ Note that the `data`, `files`, `json` and `content` parameters are not available
208
+ on this function, as `GET` requests should not include a request body.
209
+ """
210
+ return request(
211
+ "GET",
212
+ url,
213
+ params=params,
214
+ headers=headers,
215
+ cookies=cookies,
216
+ auth=auth,
217
+ proxy=proxy,
218
+ proxies=proxies,
219
+ follow_redirects=follow_redirects,
220
+ cert=cert,
221
+ verify=verify,
222
+ timeout=timeout,
223
+ trust_env=trust_env,
224
+ )
225
+
226
+
227
+ def options(
228
+ url: URL | str,
229
+ *,
230
+ params: QueryParamTypes | None = None,
231
+ headers: HeaderTypes | None = None,
232
+ cookies: CookieTypes | None = None,
233
+ auth: AuthTypes | None = None,
234
+ proxy: ProxyTypes | None = None,
235
+ proxies: ProxiesTypes | None = None,
236
+ follow_redirects: bool = False,
237
+ cert: CertTypes | None = None,
238
+ verify: VerifyTypes = True,
239
+ timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
240
+ trust_env: bool = True,
241
+ ) -> Response:
242
+ """
243
+ Sends an `OPTIONS` request.
244
+
245
+ **Parameters**: See `httpx.request`.
246
+
247
+ Note that the `data`, `files`, `json` and `content` parameters are not available
248
+ on this function, as `OPTIONS` requests should not include a request body.
249
+ """
250
+ return request(
251
+ "OPTIONS",
252
+ url,
253
+ params=params,
254
+ headers=headers,
255
+ cookies=cookies,
256
+ auth=auth,
257
+ proxy=proxy,
258
+ proxies=proxies,
259
+ follow_redirects=follow_redirects,
260
+ cert=cert,
261
+ verify=verify,
262
+ timeout=timeout,
263
+ trust_env=trust_env,
264
+ )
265
+
266
+
267
+ def head(
268
+ url: URL | str,
269
+ *,
270
+ params: QueryParamTypes | None = None,
271
+ headers: HeaderTypes | None = None,
272
+ cookies: CookieTypes | None = None,
273
+ auth: AuthTypes | None = None,
274
+ proxy: ProxyTypes | None = None,
275
+ proxies: ProxiesTypes | None = None,
276
+ follow_redirects: bool = False,
277
+ cert: CertTypes | None = None,
278
+ verify: VerifyTypes = True,
279
+ timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
280
+ trust_env: bool = True,
281
+ ) -> Response:
282
+ """
283
+ Sends a `HEAD` request.
284
+
285
+ **Parameters**: See `httpx.request`.
286
+
287
+ Note that the `data`, `files`, `json` and `content` parameters are not available
288
+ on this function, as `HEAD` requests should not include a request body.
289
+ """
290
+ return request(
291
+ "HEAD",
292
+ url,
293
+ params=params,
294
+ headers=headers,
295
+ cookies=cookies,
296
+ auth=auth,
297
+ proxy=proxy,
298
+ proxies=proxies,
299
+ follow_redirects=follow_redirects,
300
+ cert=cert,
301
+ verify=verify,
302
+ timeout=timeout,
303
+ trust_env=trust_env,
304
+ )
305
+
306
+
307
+ def post(
308
+ url: URL | str,
309
+ *,
310
+ content: RequestContent | None = None,
311
+ data: RequestData | None = None,
312
+ files: RequestFiles | None = None,
313
+ json: typing.Any | None = None,
314
+ params: QueryParamTypes | None = None,
315
+ headers: HeaderTypes | None = None,
316
+ cookies: CookieTypes | None = None,
317
+ auth: AuthTypes | None = None,
318
+ proxy: ProxyTypes | None = None,
319
+ proxies: ProxiesTypes | None = None,
320
+ follow_redirects: bool = False,
321
+ cert: CertTypes | None = None,
322
+ verify: VerifyTypes = True,
323
+ timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
324
+ trust_env: bool = True,
325
+ ) -> Response:
326
+ """
327
+ Sends a `POST` request.
328
+
329
+ **Parameters**: See `httpx.request`.
330
+ """
331
+ return request(
332
+ "POST",
333
+ url,
334
+ content=content,
335
+ data=data,
336
+ files=files,
337
+ json=json,
338
+ params=params,
339
+ headers=headers,
340
+ cookies=cookies,
341
+ auth=auth,
342
+ proxy=proxy,
343
+ proxies=proxies,
344
+ follow_redirects=follow_redirects,
345
+ cert=cert,
346
+ verify=verify,
347
+ timeout=timeout,
348
+ trust_env=trust_env,
349
+ )
350
+
351
+
352
+ def put(
353
+ url: URL | str,
354
+ *,
355
+ content: RequestContent | None = None,
356
+ data: RequestData | None = None,
357
+ files: RequestFiles | None = None,
358
+ json: typing.Any | None = None,
359
+ params: QueryParamTypes | None = None,
360
+ headers: HeaderTypes | None = None,
361
+ cookies: CookieTypes | None = None,
362
+ auth: AuthTypes | None = None,
363
+ proxy: ProxyTypes | None = None,
364
+ proxies: ProxiesTypes | None = None,
365
+ follow_redirects: bool = False,
366
+ cert: CertTypes | None = None,
367
+ verify: VerifyTypes = True,
368
+ timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
369
+ trust_env: bool = True,
370
+ ) -> Response:
371
+ """
372
+ Sends a `PUT` request.
373
+
374
+ **Parameters**: See `httpx.request`.
375
+ """
376
+ return request(
377
+ "PUT",
378
+ url,
379
+ content=content,
380
+ data=data,
381
+ files=files,
382
+ json=json,
383
+ params=params,
384
+ headers=headers,
385
+ cookies=cookies,
386
+ auth=auth,
387
+ proxy=proxy,
388
+ proxies=proxies,
389
+ follow_redirects=follow_redirects,
390
+ cert=cert,
391
+ verify=verify,
392
+ timeout=timeout,
393
+ trust_env=trust_env,
394
+ )
395
+
396
+
397
+ def patch(
398
+ url: URL | str,
399
+ *,
400
+ content: RequestContent | None = None,
401
+ data: RequestData | None = None,
402
+ files: RequestFiles | None = None,
403
+ json: typing.Any | None = None,
404
+ params: QueryParamTypes | None = None,
405
+ headers: HeaderTypes | None = None,
406
+ cookies: CookieTypes | None = None,
407
+ auth: AuthTypes | None = None,
408
+ proxy: ProxyTypes | None = None,
409
+ proxies: ProxiesTypes | None = None,
410
+ follow_redirects: bool = False,
411
+ cert: CertTypes | None = None,
412
+ verify: VerifyTypes = True,
413
+ timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
414
+ trust_env: bool = True,
415
+ ) -> Response:
416
+ """
417
+ Sends a `PATCH` request.
418
+
419
+ **Parameters**: See `httpx.request`.
420
+ """
421
+ return request(
422
+ "PATCH",
423
+ url,
424
+ content=content,
425
+ data=data,
426
+ files=files,
427
+ json=json,
428
+ params=params,
429
+ headers=headers,
430
+ cookies=cookies,
431
+ auth=auth,
432
+ proxy=proxy,
433
+ proxies=proxies,
434
+ follow_redirects=follow_redirects,
435
+ cert=cert,
436
+ verify=verify,
437
+ timeout=timeout,
438
+ trust_env=trust_env,
439
+ )
440
+
441
+
442
+ def delete(
443
+ url: URL | str,
444
+ *,
445
+ params: QueryParamTypes | None = None,
446
+ headers: HeaderTypes | None = None,
447
+ cookies: CookieTypes | None = None,
448
+ auth: AuthTypes | None = None,
449
+ proxy: ProxyTypes | None = None,
450
+ proxies: ProxiesTypes | None = None,
451
+ follow_redirects: bool = False,
452
+ cert: CertTypes | None = None,
453
+ verify: VerifyTypes = True,
454
+ timeout: TimeoutTypes = DEFAULT_TIMEOUT_CONFIG,
455
+ trust_env: bool = True,
456
+ ) -> Response:
457
+ """
458
+ Sends a `DELETE` request.
459
+
460
+ **Parameters**: See `httpx.request`.
461
+
462
+ Note that the `data`, `files`, `json` and `content` parameters are not available
463
+ on this function, as `DELETE` requests should not include a request body.
464
+ """
465
+ return request(
466
+ "DELETE",
467
+ url,
468
+ params=params,
469
+ headers=headers,
470
+ cookies=cookies,
471
+ auth=auth,
472
+ proxy=proxy,
473
+ proxies=proxies,
474
+ follow_redirects=follow_redirects,
475
+ cert=cert,
476
+ verify=verify,
477
+ timeout=timeout,
478
+ trust_env=trust_env,
479
+ )
evalkit_tf437/lib/python3.10/site-packages/httpx/_config.py ADDED
@@ -0,0 +1,372 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import logging
4
+ import os
5
+ import ssl
6
+ import typing
7
+ from pathlib import Path
8
+
9
+ import certifi
10
+
11
+ from ._compat import set_minimum_tls_version_1_2
12
+ from ._models import Headers
13
+ from ._types import CertTypes, HeaderTypes, TimeoutTypes, VerifyTypes
14
+ from ._urls import URL
15
+ from ._utils import get_ca_bundle_from_env
16
+
17
+ __all__ = ["Limits", "Proxy", "Timeout", "create_ssl_context"]
18
+
19
+ DEFAULT_CIPHERS = ":".join(
20
+ [
21
+ "ECDHE+AESGCM",
22
+ "ECDHE+CHACHA20",
23
+ "DHE+AESGCM",
24
+ "DHE+CHACHA20",
25
+ "ECDH+AESGCM",
26
+ "DH+AESGCM",
27
+ "ECDH+AES",
28
+ "DH+AES",
29
+ "RSA+AESGCM",
30
+ "RSA+AES",
31
+ "!aNULL",
32
+ "!eNULL",
33
+ "!MD5",
34
+ "!DSS",
35
+ ]
36
+ )
37
+
38
+
39
+ logger = logging.getLogger("httpx")
40
+
41
+
42
+ class UnsetType:
43
+ pass # pragma: no cover
44
+
45
+
46
+ UNSET = UnsetType()
47
+
48
+
49
+ def create_ssl_context(
50
+ cert: CertTypes | None = None,
51
+ verify: VerifyTypes = True,
52
+ trust_env: bool = True,
53
+ http2: bool = False,
54
+ ) -> ssl.SSLContext:
55
+ return SSLConfig(
56
+ cert=cert, verify=verify, trust_env=trust_env, http2=http2
57
+ ).ssl_context
58
+
59
+
60
+ class SSLConfig:
61
+ """
62
+ SSL Configuration.
63
+ """
64
+
65
+ DEFAULT_CA_BUNDLE_PATH = Path(certifi.where())
66
+
67
+ def __init__(
68
+ self,
69
+ *,
70
+ cert: CertTypes | None = None,
71
+ verify: VerifyTypes = True,
72
+ trust_env: bool = True,
73
+ http2: bool = False,
74
+ ) -> None:
75
+ self.cert = cert
76
+ self.verify = verify
77
+ self.trust_env = trust_env
78
+ self.http2 = http2
79
+ self.ssl_context = self.load_ssl_context()
80
+
81
+ def load_ssl_context(self) -> ssl.SSLContext:
82
+ logger.debug(
83
+ "load_ssl_context verify=%r cert=%r trust_env=%r http2=%r",
84
+ self.verify,
85
+ self.cert,
86
+ self.trust_env,
87
+ self.http2,
88
+ )
89
+
90
+ if self.verify:
91
+ return self.load_ssl_context_verify()
92
+ return self.load_ssl_context_no_verify()
93
+
94
+ def load_ssl_context_no_verify(self) -> ssl.SSLContext:
95
+ """
96
+ Return an SSL context for unverified connections.
97
+ """
98
+ context = self._create_default_ssl_context()
99
+ context.check_hostname = False
100
+ context.verify_mode = ssl.CERT_NONE
101
+ self._load_client_certs(context)
102
+ return context
103
+
104
+ def load_ssl_context_verify(self) -> ssl.SSLContext:
105
+ """
106
+ Return an SSL context for verified connections.
107
+ """
108
+ if self.trust_env and self.verify is True:
109
+ ca_bundle = get_ca_bundle_from_env()
110
+ if ca_bundle is not None:
111
+ self.verify = ca_bundle
112
+
113
+ if isinstance(self.verify, ssl.SSLContext):
114
+ # Allow passing in our own SSLContext object that's pre-configured.
115
+ context = self.verify
116
+ self._load_client_certs(context)
117
+ return context
118
+ elif isinstance(self.verify, bool):
119
+ ca_bundle_path = self.DEFAULT_CA_BUNDLE_PATH
120
+ elif Path(self.verify).exists():
121
+ ca_bundle_path = Path(self.verify)
122
+ else:
123
+ raise IOError(
124
+ "Could not find a suitable TLS CA certificate bundle, "
125
+ "invalid path: {}".format(self.verify)
126
+ )
127
+
128
+ context = self._create_default_ssl_context()
129
+ context.verify_mode = ssl.CERT_REQUIRED
130
+ context.check_hostname = True
131
+
132
+ # Signal to server support for PHA in TLS 1.3. Raises an
133
+ # AttributeError if only read-only access is implemented.
134
+ try:
135
+ context.post_handshake_auth = True
136
+ except AttributeError: # pragma: no cover
137
+ pass
138
+
139
+ # Disable using 'commonName' for SSLContext.check_hostname
140
+ # when the 'subjectAltName' extension isn't available.
141
+ try:
142
+ context.hostname_checks_common_name = False
143
+ except AttributeError: # pragma: no cover
144
+ pass
145
+
146
+ if ca_bundle_path.is_file():
147
+ cafile = str(ca_bundle_path)
148
+ logger.debug("load_verify_locations cafile=%r", cafile)
149
+ context.load_verify_locations(cafile=cafile)
150
+ elif ca_bundle_path.is_dir():
151
+ capath = str(ca_bundle_path)
152
+ logger.debug("load_verify_locations capath=%r", capath)
153
+ context.load_verify_locations(capath=capath)
154
+
155
+ self._load_client_certs(context)
156
+
157
+ return context
158
+
159
+ def _create_default_ssl_context(self) -> ssl.SSLContext:
160
+ """
161
+ Creates the default SSLContext object that's used for both verified
162
+ and unverified connections.
163
+ """
164
+ context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
165
+ set_minimum_tls_version_1_2(context)
166
+ context.options |= ssl.OP_NO_COMPRESSION
167
+ context.set_ciphers(DEFAULT_CIPHERS)
168
+
169
+ if ssl.HAS_ALPN:
170
+ alpn_idents = ["http/1.1", "h2"] if self.http2 else ["http/1.1"]
171
+ context.set_alpn_protocols(alpn_idents)
172
+
173
+ keylogfile = os.environ.get("SSLKEYLOGFILE")
174
+ if keylogfile and self.trust_env:
175
+ context.keylog_filename = keylogfile
176
+
177
+ return context
178
+
179
+ def _load_client_certs(self, ssl_context: ssl.SSLContext) -> None:
180
+ """
181
+ Loads client certificates into our SSLContext object
182
+ """
183
+ if self.cert is not None:
184
+ if isinstance(self.cert, str):
185
+ ssl_context.load_cert_chain(certfile=self.cert)
186
+ elif isinstance(self.cert, tuple) and len(self.cert) == 2:
187
+ ssl_context.load_cert_chain(certfile=self.cert[0], keyfile=self.cert[1])
188
+ elif isinstance(self.cert, tuple) and len(self.cert) == 3:
189
+ ssl_context.load_cert_chain(
190
+ certfile=self.cert[0],
191
+ keyfile=self.cert[1],
192
+ password=self.cert[2],
193
+ )
194
+
195
+
196
+ class Timeout:
197
+ """
198
+ Timeout configuration.
199
+
200
+ **Usage**:
201
+
202
+ Timeout(None) # No timeouts.
203
+ Timeout(5.0) # 5s timeout on all operations.
204
+ Timeout(None, connect=5.0) # 5s timeout on connect, no other timeouts.
205
+ Timeout(5.0, connect=10.0) # 10s timeout on connect. 5s timeout elsewhere.
206
+ Timeout(5.0, pool=None) # No timeout on acquiring connection from pool.
207
+ # 5s timeout elsewhere.
208
+ """
209
+
210
+ def __init__(
211
+ self,
212
+ timeout: TimeoutTypes | UnsetType = UNSET,
213
+ *,
214
+ connect: None | float | UnsetType = UNSET,
215
+ read: None | float | UnsetType = UNSET,
216
+ write: None | float | UnsetType = UNSET,
217
+ pool: None | float | UnsetType = UNSET,
218
+ ) -> None:
219
+ if isinstance(timeout, Timeout):
220
+ # Passed as a single explicit Timeout.
221
+ assert connect is UNSET
222
+ assert read is UNSET
223
+ assert write is UNSET
224
+ assert pool is UNSET
225
+ self.connect = timeout.connect # type: typing.Optional[float]
226
+ self.read = timeout.read # type: typing.Optional[float]
227
+ self.write = timeout.write # type: typing.Optional[float]
228
+ self.pool = timeout.pool # type: typing.Optional[float]
229
+ elif isinstance(timeout, tuple):
230
+ # Passed as a tuple.
231
+ self.connect = timeout[0]
232
+ self.read = timeout[1]
233
+ self.write = None if len(timeout) < 3 else timeout[2]
234
+ self.pool = None if len(timeout) < 4 else timeout[3]
235
+ elif not (
236
+ isinstance(connect, UnsetType)
237
+ or isinstance(read, UnsetType)
238
+ or isinstance(write, UnsetType)
239
+ or isinstance(pool, UnsetType)
240
+ ):
241
+ self.connect = connect
242
+ self.read = read
243
+ self.write = write
244
+ self.pool = pool
245
+ else:
246
+ if isinstance(timeout, UnsetType):
247
+ raise ValueError(
248
+ "httpx.Timeout must either include a default, or set all "
249
+ "four parameters explicitly."
250
+ )
251
+ self.connect = timeout if isinstance(connect, UnsetType) else connect
252
+ self.read = timeout if isinstance(read, UnsetType) else read
253
+ self.write = timeout if isinstance(write, UnsetType) else write
254
+ self.pool = timeout if isinstance(pool, UnsetType) else pool
255
+
256
+ def as_dict(self) -> dict[str, float | None]:
257
+ return {
258
+ "connect": self.connect,
259
+ "read": self.read,
260
+ "write": self.write,
261
+ "pool": self.pool,
262
+ }
263
+
264
+ def __eq__(self, other: typing.Any) -> bool:
265
+ return (
266
+ isinstance(other, self.__class__)
267
+ and self.connect == other.connect
268
+ and self.read == other.read
269
+ and self.write == other.write
270
+ and self.pool == other.pool
271
+ )
272
+
273
+ def __repr__(self) -> str:
274
+ class_name = self.__class__.__name__
275
+ if len({self.connect, self.read, self.write, self.pool}) == 1:
276
+ return f"{class_name}(timeout={self.connect})"
277
+ return (
278
+ f"{class_name}(connect={self.connect}, "
279
+ f"read={self.read}, write={self.write}, pool={self.pool})"
280
+ )
281
+
282
+
283
+ class Limits:
284
+ """
285
+ Configuration for limits to various client behaviors.
286
+
287
+ **Parameters:**
288
+
289
+ * **max_connections** - The maximum number of concurrent connections that may be
290
+ established.
291
+ * **max_keepalive_connections** - Allow the connection pool to maintain
292
+ keep-alive connections below this point. Should be less than or equal
293
+ to `max_connections`.
294
+ * **keepalive_expiry** - Time limit on idle keep-alive connections in seconds.
295
+ """
296
+
297
+ def __init__(
298
+ self,
299
+ *,
300
+ max_connections: int | None = None,
301
+ max_keepalive_connections: int | None = None,
302
+ keepalive_expiry: float | None = 5.0,
303
+ ) -> None:
304
+ self.max_connections = max_connections
305
+ self.max_keepalive_connections = max_keepalive_connections
306
+ self.keepalive_expiry = keepalive_expiry
307
+
308
+ def __eq__(self, other: typing.Any) -> bool:
309
+ return (
310
+ isinstance(other, self.__class__)
311
+ and self.max_connections == other.max_connections
312
+ and self.max_keepalive_connections == other.max_keepalive_connections
313
+ and self.keepalive_expiry == other.keepalive_expiry
314
+ )
315
+
316
+ def __repr__(self) -> str:
317
+ class_name = self.__class__.__name__
318
+ return (
319
+ f"{class_name}(max_connections={self.max_connections}, "
320
+ f"max_keepalive_connections={self.max_keepalive_connections}, "
321
+ f"keepalive_expiry={self.keepalive_expiry})"
322
+ )
323
+
324
+
325
+ class Proxy:
326
+ def __init__(
327
+ self,
328
+ url: URL | str,
329
+ *,
330
+ ssl_context: ssl.SSLContext | None = None,
331
+ auth: tuple[str, str] | None = None,
332
+ headers: HeaderTypes | None = None,
333
+ ) -> None:
334
+ url = URL(url)
335
+ headers = Headers(headers)
336
+
337
+ if url.scheme not in ("http", "https", "socks5"):
338
+ raise ValueError(f"Unknown scheme for proxy URL {url!r}")
339
+
340
+ if url.username or url.password:
341
+ # Remove any auth credentials from the URL.
342
+ auth = (url.username, url.password)
343
+ url = url.copy_with(username=None, password=None)
344
+
345
+ self.url = url
346
+ self.auth = auth
347
+ self.headers = headers
348
+ self.ssl_context = ssl_context
349
+
350
+ @property
351
+ def raw_auth(self) -> tuple[bytes, bytes] | None:
352
+ # The proxy authentication as raw bytes.
353
+ return (
354
+ None
355
+ if self.auth is None
356
+ else (self.auth[0].encode("utf-8"), self.auth[1].encode("utf-8"))
357
+ )
358
+
359
+ def __repr__(self) -> str:
360
+ # The authentication is represented with the password component masked.
361
+ auth = (self.auth[0], "********") if self.auth else None
362
+
363
+ # Build a nice concise representation.
364
+ url_str = f"{str(self.url)!r}"
365
+ auth_str = f", auth={auth!r}" if auth else ""
366
+ headers_str = f", headers={dict(self.headers)!r}" if self.headers else ""
367
+ return f"Proxy({url_str}{auth_str}{headers_str})"
368
+
369
+
370
+ DEFAULT_TIMEOUT_CONFIG = Timeout(timeout=5.0)
371
+ DEFAULT_LIMITS = Limits(max_connections=100, max_keepalive_connections=20)
372
+ DEFAULT_MAX_REDIRECTS = 20
evalkit_tf437/lib/python3.10/site-packages/httpx/_decoders.py ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Handlers for Content-Encoding.
3
+
4
+ See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ import codecs
10
+ import io
11
+ import typing
12
+ import zlib
13
+
14
+ from ._compat import brotli, zstd
15
+ from ._exceptions import DecodingError
16
+
17
+
18
+ class ContentDecoder:
19
+ def decode(self, data: bytes) -> bytes:
20
+ raise NotImplementedError() # pragma: no cover
21
+
22
+ def flush(self) -> bytes:
23
+ raise NotImplementedError() # pragma: no cover
24
+
25
+
26
+ class IdentityDecoder(ContentDecoder):
27
+ """
28
+ Handle unencoded data.
29
+ """
30
+
31
+ def decode(self, data: bytes) -> bytes:
32
+ return data
33
+
34
+ def flush(self) -> bytes:
35
+ return b""
36
+
37
+
38
+ class DeflateDecoder(ContentDecoder):
39
+ """
40
+ Handle 'deflate' decoding.
41
+
42
+ See: https://stackoverflow.com/questions/1838699
43
+ """
44
+
45
+ def __init__(self) -> None:
46
+ self.first_attempt = True
47
+ self.decompressor = zlib.decompressobj()
48
+
49
+ def decode(self, data: bytes) -> bytes:
50
+ was_first_attempt = self.first_attempt
51
+ self.first_attempt = False
52
+ try:
53
+ return self.decompressor.decompress(data)
54
+ except zlib.error as exc:
55
+ if was_first_attempt:
56
+ self.decompressor = zlib.decompressobj(-zlib.MAX_WBITS)
57
+ return self.decode(data)
58
+ raise DecodingError(str(exc)) from exc
59
+
60
+ def flush(self) -> bytes:
61
+ try:
62
+ return self.decompressor.flush()
63
+ except zlib.error as exc: # pragma: no cover
64
+ raise DecodingError(str(exc)) from exc
65
+
66
+
67
+ class GZipDecoder(ContentDecoder):
68
+ """
69
+ Handle 'gzip' decoding.
70
+
71
+ See: https://stackoverflow.com/questions/1838699
72
+ """
73
+
74
+ def __init__(self) -> None:
75
+ self.decompressor = zlib.decompressobj(zlib.MAX_WBITS | 16)
76
+
77
+ def decode(self, data: bytes) -> bytes:
78
+ try:
79
+ return self.decompressor.decompress(data)
80
+ except zlib.error as exc:
81
+ raise DecodingError(str(exc)) from exc
82
+
83
+ def flush(self) -> bytes:
84
+ try:
85
+ return self.decompressor.flush()
86
+ except zlib.error as exc: # pragma: no cover
87
+ raise DecodingError(str(exc)) from exc
88
+
89
+
90
+ class BrotliDecoder(ContentDecoder):
91
+ """
92
+ Handle 'brotli' decoding.
93
+
94
+ Requires `pip install brotlipy`. See: https://brotlipy.readthedocs.io/
95
+ or `pip install brotli`. See https://github.com/google/brotli
96
+ Supports both 'brotlipy' and 'Brotli' packages since they share an import
97
+ name. The top branches are for 'brotlipy' and bottom branches for 'Brotli'
98
+ """
99
+
100
+ def __init__(self) -> None:
101
+ if brotli is None: # pragma: no cover
102
+ raise ImportError(
103
+ "Using 'BrotliDecoder', but neither of the 'brotlicffi' or 'brotli' "
104
+ "packages have been installed. "
105
+ "Make sure to install httpx using `pip install httpx[brotli]`."
106
+ ) from None
107
+
108
+ self.decompressor = brotli.Decompressor()
109
+ self.seen_data = False
110
+ self._decompress: typing.Callable[[bytes], bytes]
111
+ if hasattr(self.decompressor, "decompress"):
112
+ # The 'brotlicffi' package.
113
+ self._decompress = self.decompressor.decompress # pragma: no cover
114
+ else:
115
+ # The 'brotli' package.
116
+ self._decompress = self.decompressor.process # pragma: no cover
117
+
118
+ def decode(self, data: bytes) -> bytes:
119
+ if not data:
120
+ return b""
121
+ self.seen_data = True
122
+ try:
123
+ return self._decompress(data)
124
+ except brotli.error as exc:
125
+ raise DecodingError(str(exc)) from exc
126
+
127
+ def flush(self) -> bytes:
128
+ if not self.seen_data:
129
+ return b""
130
+ try:
131
+ if hasattr(self.decompressor, "finish"):
132
+ # Only available in the 'brotlicffi' package.
133
+
134
+ # As the decompressor decompresses eagerly, this
135
+ # will never actually emit any data. However, it will potentially throw
136
+ # errors if a truncated or damaged data stream has been used.
137
+ self.decompressor.finish() # pragma: no cover
138
+ return b""
139
+ except brotli.error as exc: # pragma: no cover
140
+ raise DecodingError(str(exc)) from exc
141
+
142
+
143
+ class ZStandardDecoder(ContentDecoder):
144
+ """
145
+ Handle 'zstd' RFC 8878 decoding.
146
+
147
+ Requires `pip install zstandard`.
148
+ Can be installed as a dependency of httpx using `pip install httpx[zstd]`.
149
+ """
150
+
151
+ # inspired by the ZstdDecoder implementation in urllib3
152
+ def __init__(self) -> None:
153
+ if zstd is None: # pragma: no cover
154
+ raise ImportError(
155
+ "Using 'ZStandardDecoder', ..."
156
+ "Make sure to install httpx using `pip install httpx[zstd]`."
157
+ ) from None
158
+
159
+ self.decompressor = zstd.ZstdDecompressor().decompressobj()
160
+
161
+ def decode(self, data: bytes) -> bytes:
162
+ assert zstd is not None
163
+ output = io.BytesIO()
164
+ try:
165
+ output.write(self.decompressor.decompress(data))
166
+ while self.decompressor.eof and self.decompressor.unused_data:
167
+ unused_data = self.decompressor.unused_data
168
+ self.decompressor = zstd.ZstdDecompressor().decompressobj()
169
+ output.write(self.decompressor.decompress(unused_data))
170
+ except zstd.ZstdError as exc:
171
+ raise DecodingError(str(exc)) from exc
172
+ return output.getvalue()
173
+
174
+ def flush(self) -> bytes:
175
+ ret = self.decompressor.flush() # note: this is a no-op
176
+ if not self.decompressor.eof:
177
+ raise DecodingError("Zstandard data is incomplete") # pragma: no cover
178
+ return bytes(ret)
179
+
180
+
181
+ class MultiDecoder(ContentDecoder):
182
+ """
183
+ Handle the case where multiple encodings have been applied.
184
+ """
185
+
186
+ def __init__(self, children: typing.Sequence[ContentDecoder]) -> None:
187
+ """
188
+ 'children' should be a sequence of decoders in the order in which
189
+ each was applied.
190
+ """
191
+ # Note that we reverse the order for decoding.
192
+ self.children = list(reversed(children))
193
+
194
+ def decode(self, data: bytes) -> bytes:
195
+ for child in self.children:
196
+ data = child.decode(data)
197
+ return data
198
+
199
+ def flush(self) -> bytes:
200
+ data = b""
201
+ for child in self.children:
202
+ data = child.decode(data) + child.flush()
203
+ return data
204
+
205
+
206
+ class ByteChunker:
207
+ """
208
+ Handles returning byte content in fixed-size chunks.
209
+ """
210
+
211
+ def __init__(self, chunk_size: int | None = None) -> None:
212
+ self._buffer = io.BytesIO()
213
+ self._chunk_size = chunk_size
214
+
215
+ def decode(self, content: bytes) -> list[bytes]:
216
+ if self._chunk_size is None:
217
+ return [content] if content else []
218
+
219
+ self._buffer.write(content)
220
+ if self._buffer.tell() >= self._chunk_size:
221
+ value = self._buffer.getvalue()
222
+ chunks = [
223
+ value[i : i + self._chunk_size]
224
+ for i in range(0, len(value), self._chunk_size)
225
+ ]
226
+ if len(chunks[-1]) == self._chunk_size:
227
+ self._buffer.seek(0)
228
+ self._buffer.truncate()
229
+ return chunks
230
+ else:
231
+ self._buffer.seek(0)
232
+ self._buffer.write(chunks[-1])
233
+ self._buffer.truncate()
234
+ return chunks[:-1]
235
+ else:
236
+ return []
237
+
238
+ def flush(self) -> list[bytes]:
239
+ value = self._buffer.getvalue()
240
+ self._buffer.seek(0)
241
+ self._buffer.truncate()
242
+ return [value] if value else []
243
+
244
+
245
+ class TextChunker:
246
+ """
247
+ Handles returning text content in fixed-size chunks.
248
+ """
249
+
250
+ def __init__(self, chunk_size: int | None = None) -> None:
251
+ self._buffer = io.StringIO()
252
+ self._chunk_size = chunk_size
253
+
254
+ def decode(self, content: str) -> list[str]:
255
+ if self._chunk_size is None:
256
+ return [content] if content else []
257
+
258
+ self._buffer.write(content)
259
+ if self._buffer.tell() >= self._chunk_size:
260
+ value = self._buffer.getvalue()
261
+ chunks = [
262
+ value[i : i + self._chunk_size]
263
+ for i in range(0, len(value), self._chunk_size)
264
+ ]
265
+ if len(chunks[-1]) == self._chunk_size:
266
+ self._buffer.seek(0)
267
+ self._buffer.truncate()
268
+ return chunks
269
+ else:
270
+ self._buffer.seek(0)
271
+ self._buffer.write(chunks[-1])
272
+ self._buffer.truncate()
273
+ return chunks[:-1]
274
+ else:
275
+ return []
276
+
277
+ def flush(self) -> list[str]:
278
+ value = self._buffer.getvalue()
279
+ self._buffer.seek(0)
280
+ self._buffer.truncate()
281
+ return [value] if value else []
282
+
283
+
284
+ class TextDecoder:
285
+ """
286
+ Handles incrementally decoding bytes into text
287
+ """
288
+
289
+ def __init__(self, encoding: str = "utf-8") -> None:
290
+ self.decoder = codecs.getincrementaldecoder(encoding)(errors="replace")
291
+
292
+ def decode(self, data: bytes) -> str:
293
+ return self.decoder.decode(data)
294
+
295
+ def flush(self) -> str:
296
+ return self.decoder.decode(b"", True)
297
+
298
+
299
+ class LineDecoder:
300
+ """
301
+ Handles incrementally reading lines from text.
302
+
303
+ Has the same behaviour as the stdllib splitlines,
304
+ but handling the input iteratively.
305
+ """
306
+
307
+ def __init__(self) -> None:
308
+ self.buffer: list[str] = []
309
+ self.trailing_cr: bool = False
310
+
311
+ def decode(self, text: str) -> list[str]:
312
+ # See https://docs.python.org/3/library/stdtypes.html#str.splitlines
313
+ NEWLINE_CHARS = "\n\r\x0b\x0c\x1c\x1d\x1e\x85\u2028\u2029"
314
+
315
+ # We always push a trailing `\r` into the next decode iteration.
316
+ if self.trailing_cr:
317
+ text = "\r" + text
318
+ self.trailing_cr = False
319
+ if text.endswith("\r"):
320
+ self.trailing_cr = True
321
+ text = text[:-1]
322
+
323
+ if not text:
324
+ # NOTE: the edge case input of empty text doesn't occur in practice,
325
+ # because other httpx internals filter out this value
326
+ return [] # pragma: no cover
327
+
328
+ trailing_newline = text[-1] in NEWLINE_CHARS
329
+ lines = text.splitlines()
330
+
331
+ if len(lines) == 1 and not trailing_newline:
332
+ # No new lines, buffer the input and continue.
333
+ self.buffer.append(lines[0])
334
+ return []
335
+
336
+ if self.buffer:
337
+ # Include any existing buffer in the first portion of the
338
+ # splitlines result.
339
+ lines = ["".join(self.buffer) + lines[0]] + lines[1:]
340
+ self.buffer = []
341
+
342
+ if not trailing_newline:
343
+ # If the last segment of splitlines is not newline terminated,
344
+ # then drop it from our output and start a new buffer.
345
+ self.buffer = [lines.pop()]
346
+
347
+ return lines
348
+
349
+ def flush(self) -> list[str]:
350
+ if not self.buffer and not self.trailing_cr:
351
+ return []
352
+
353
+ lines = ["".join(self.buffer)]
354
+ self.buffer = []
355
+ self.trailing_cr = False
356
+ return lines
357
+
358
+
359
+ SUPPORTED_DECODERS = {
360
+ "identity": IdentityDecoder,
361
+ "gzip": GZipDecoder,
362
+ "deflate": DeflateDecoder,
363
+ "br": BrotliDecoder,
364
+ "zstd": ZStandardDecoder,
365
+ }
366
+
367
+
368
+ if brotli is None:
369
+ SUPPORTED_DECODERS.pop("br") # pragma: no cover
370
+ if zstd is None:
371
+ SUPPORTED_DECODERS.pop("zstd") # pragma: no cover
evalkit_tf437/lib/python3.10/site-packages/httpx/_exceptions.py ADDED
@@ -0,0 +1,379 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Our exception hierarchy:
3
+
4
+ * HTTPError
5
+ x RequestError
6
+ + TransportError
7
+ - TimeoutException
8
+ · ConnectTimeout
9
+ · ReadTimeout
10
+ · WriteTimeout
11
+ · PoolTimeout
12
+ - NetworkError
13
+ · ConnectError
14
+ · ReadError
15
+ · WriteError
16
+ · CloseError
17
+ - ProtocolError
18
+ · LocalProtocolError
19
+ · RemoteProtocolError
20
+ - ProxyError
21
+ - UnsupportedProtocol
22
+ + DecodingError
23
+ + TooManyRedirects
24
+ x HTTPStatusError
25
+ * InvalidURL
26
+ * CookieConflict
27
+ * StreamError
28
+ x StreamConsumed
29
+ x StreamClosed
30
+ x ResponseNotRead
31
+ x RequestNotRead
32
+ """
33
+
34
+ from __future__ import annotations
35
+
36
+ import contextlib
37
+ import typing
38
+
39
+ if typing.TYPE_CHECKING:
40
+ from ._models import Request, Response # pragma: no cover
41
+
42
+ __all__ = [
43
+ "CloseError",
44
+ "ConnectError",
45
+ "ConnectTimeout",
46
+ "CookieConflict",
47
+ "DecodingError",
48
+ "HTTPError",
49
+ "HTTPStatusError",
50
+ "InvalidURL",
51
+ "LocalProtocolError",
52
+ "NetworkError",
53
+ "PoolTimeout",
54
+ "ProtocolError",
55
+ "ProxyError",
56
+ "ReadError",
57
+ "ReadTimeout",
58
+ "RemoteProtocolError",
59
+ "RequestError",
60
+ "RequestNotRead",
61
+ "ResponseNotRead",
62
+ "StreamClosed",
63
+ "StreamConsumed",
64
+ "StreamError",
65
+ "TimeoutException",
66
+ "TooManyRedirects",
67
+ "TransportError",
68
+ "UnsupportedProtocol",
69
+ "WriteError",
70
+ "WriteTimeout",
71
+ ]
72
+
73
+
74
+ class HTTPError(Exception):
75
+ """
76
+ Base class for `RequestError` and `HTTPStatusError`.
77
+
78
+ Useful for `try...except` blocks when issuing a request,
79
+ and then calling `.raise_for_status()`.
80
+
81
+ For example:
82
+
83
+ ```
84
+ try:
85
+ response = httpx.get("https://www.example.com")
86
+ response.raise_for_status()
87
+ except httpx.HTTPError as exc:
88
+ print(f"HTTP Exception for {exc.request.url} - {exc}")
89
+ ```
90
+ """
91
+
92
+ def __init__(self, message: str) -> None:
93
+ super().__init__(message)
94
+ self._request: Request | None = None
95
+
96
+ @property
97
+ def request(self) -> Request:
98
+ if self._request is None:
99
+ raise RuntimeError("The .request property has not been set.")
100
+ return self._request
101
+
102
+ @request.setter
103
+ def request(self, request: Request) -> None:
104
+ self._request = request
105
+
106
+
107
+ class RequestError(HTTPError):
108
+ """
109
+ Base class for all exceptions that may occur when issuing a `.request()`.
110
+ """
111
+
112
+ def __init__(self, message: str, *, request: Request | None = None) -> None:
113
+ super().__init__(message)
114
+ # At the point an exception is raised we won't typically have a request
115
+ # instance to associate it with.
116
+ #
117
+ # The 'request_context' context manager is used within the Client and
118
+ # Response methods in order to ensure that any raised exceptions
119
+ # have a `.request` property set on them.
120
+ self._request = request
121
+
122
+
123
+ class TransportError(RequestError):
124
+ """
125
+ Base class for all exceptions that occur at the level of the Transport API.
126
+ """
127
+
128
+
129
+ # Timeout exceptions...
130
+
131
+
132
+ class TimeoutException(TransportError):
133
+ """
134
+ The base class for timeout errors.
135
+
136
+ An operation has timed out.
137
+ """
138
+
139
+
140
+ class ConnectTimeout(TimeoutException):
141
+ """
142
+ Timed out while connecting to the host.
143
+ """
144
+
145
+
146
+ class ReadTimeout(TimeoutException):
147
+ """
148
+ Timed out while receiving data from the host.
149
+ """
150
+
151
+
152
+ class WriteTimeout(TimeoutException):
153
+ """
154
+ Timed out while sending data to the host.
155
+ """
156
+
157
+
158
+ class PoolTimeout(TimeoutException):
159
+ """
160
+ Timed out waiting to acquire a connection from the pool.
161
+ """
162
+
163
+
164
+ # Core networking exceptions...
165
+
166
+
167
+ class NetworkError(TransportError):
168
+ """
169
+ The base class for network-related errors.
170
+
171
+ An error occurred while interacting with the network.
172
+ """
173
+
174
+
175
+ class ReadError(NetworkError):
176
+ """
177
+ Failed to receive data from the network.
178
+ """
179
+
180
+
181
+ class WriteError(NetworkError):
182
+ """
183
+ Failed to send data through the network.
184
+ """
185
+
186
+
187
+ class ConnectError(NetworkError):
188
+ """
189
+ Failed to establish a connection.
190
+ """
191
+
192
+
193
+ class CloseError(NetworkError):
194
+ """
195
+ Failed to close a connection.
196
+ """
197
+
198
+
199
+ # Other transport exceptions...
200
+
201
+
202
+ class ProxyError(TransportError):
203
+ """
204
+ An error occurred while establishing a proxy connection.
205
+ """
206
+
207
+
208
+ class UnsupportedProtocol(TransportError):
209
+ """
210
+ Attempted to make a request to an unsupported protocol.
211
+
212
+ For example issuing a request to `ftp://www.example.com`.
213
+ """
214
+
215
+
216
+ class ProtocolError(TransportError):
217
+ """
218
+ The protocol was violated.
219
+ """
220
+
221
+
222
+ class LocalProtocolError(ProtocolError):
223
+ """
224
+ A protocol was violated by the client.
225
+
226
+ For example if the user instantiated a `Request` instance explicitly,
227
+ failed to include the mandatory `Host:` header, and then issued it directly
228
+ using `client.send()`.
229
+ """
230
+
231
+
232
+ class RemoteProtocolError(ProtocolError):
233
+ """
234
+ The protocol was violated by the server.
235
+
236
+ For example, returning malformed HTTP.
237
+ """
238
+
239
+
240
+ # Other request exceptions...
241
+
242
+
243
+ class DecodingError(RequestError):
244
+ """
245
+ Decoding of the response failed, due to a malformed encoding.
246
+ """
247
+
248
+
249
+ class TooManyRedirects(RequestError):
250
+ """
251
+ Too many redirects.
252
+ """
253
+
254
+
255
+ # Client errors
256
+
257
+
258
+ class HTTPStatusError(HTTPError):
259
+ """
260
+ The response had an error HTTP status of 4xx or 5xx.
261
+
262
+ May be raised when calling `response.raise_for_status()`
263
+ """
264
+
265
+ def __init__(self, message: str, *, request: Request, response: Response) -> None:
266
+ super().__init__(message)
267
+ self.request = request
268
+ self.response = response
269
+
270
+
271
+ class InvalidURL(Exception):
272
+ """
273
+ URL is improperly formed or cannot be parsed.
274
+ """
275
+
276
+ def __init__(self, message: str) -> None:
277
+ super().__init__(message)
278
+
279
+
280
+ class CookieConflict(Exception):
281
+ """
282
+ Attempted to lookup a cookie by name, but multiple cookies existed.
283
+
284
+ Can occur when calling `response.cookies.get(...)`.
285
+ """
286
+
287
+ def __init__(self, message: str) -> None:
288
+ super().__init__(message)
289
+
290
+
291
+ # Stream exceptions...
292
+
293
+ # These may occur as the result of a programming error, by accessing
294
+ # the request/response stream in an invalid manner.
295
+
296
+
297
+ class StreamError(RuntimeError):
298
+ """
299
+ The base class for stream exceptions.
300
+
301
+ The developer made an error in accessing the request stream in
302
+ an invalid way.
303
+ """
304
+
305
+ def __init__(self, message: str) -> None:
306
+ super().__init__(message)
307
+
308
+
309
+ class StreamConsumed(StreamError):
310
+ """
311
+ Attempted to read or stream content, but the content has already
312
+ been streamed.
313
+ """
314
+
315
+ def __init__(self) -> None:
316
+ message = (
317
+ "Attempted to read or stream some content, but the content has "
318
+ "already been streamed. For requests, this could be due to passing "
319
+ "a generator as request content, and then receiving a redirect "
320
+ "response or a secondary request as part of an authentication flow."
321
+ "For responses, this could be due to attempting to stream the response "
322
+ "content more than once."
323
+ )
324
+ super().__init__(message)
325
+
326
+
327
+ class StreamClosed(StreamError):
328
+ """
329
+ Attempted to read or stream response content, but the request has been
330
+ closed.
331
+ """
332
+
333
+ def __init__(self) -> None:
334
+ message = (
335
+ "Attempted to read or stream content, but the stream has " "been closed."
336
+ )
337
+ super().__init__(message)
338
+
339
+
340
+ class ResponseNotRead(StreamError):
341
+ """
342
+ Attempted to access streaming response content, without having called `read()`.
343
+ """
344
+
345
+ def __init__(self) -> None:
346
+ message = (
347
+ "Attempted to access streaming response content,"
348
+ " without having called `read()`."
349
+ )
350
+ super().__init__(message)
351
+
352
+
353
+ class RequestNotRead(StreamError):
354
+ """
355
+ Attempted to access streaming request content, without having called `read()`.
356
+ """
357
+
358
+ def __init__(self) -> None:
359
+ message = (
360
+ "Attempted to access streaming request content,"
361
+ " without having called `read()`."
362
+ )
363
+ super().__init__(message)
364
+
365
+
366
+ @contextlib.contextmanager
367
+ def request_context(
368
+ request: Request | None = None,
369
+ ) -> typing.Iterator[None]:
370
+ """
371
+ A context manager that can be used to attach the given request context
372
+ to any `RequestError` exceptions that are raised within the block.
373
+ """
374
+ try:
375
+ yield
376
+ except RequestError as exc:
377
+ if request is not None:
378
+ exc.request = request
379
+ raise exc
evalkit_tf437/lib/python3.10/site-packages/httpx/_transports/__pycache__/mock.cpython-310.pyc ADDED
Binary file (1.41 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/httpx/_transports/wsgi.py ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import io
4
+ import itertools
5
+ import sys
6
+ import typing
7
+
8
+ from .._models import Request, Response
9
+ from .._types import SyncByteStream
10
+ from .base import BaseTransport
11
+
12
+ if typing.TYPE_CHECKING:
13
+ from _typeshed import OptExcInfo # pragma: no cover
14
+ from _typeshed.wsgi import WSGIApplication # pragma: no cover
15
+
16
+ _T = typing.TypeVar("_T")
17
+
18
+
19
+ __all__ = ["WSGITransport"]
20
+
21
+
22
+ def _skip_leading_empty_chunks(body: typing.Iterable[_T]) -> typing.Iterable[_T]:
23
+ body = iter(body)
24
+ for chunk in body:
25
+ if chunk:
26
+ return itertools.chain([chunk], body)
27
+ return []
28
+
29
+
30
+ class WSGIByteStream(SyncByteStream):
31
+ def __init__(self, result: typing.Iterable[bytes]) -> None:
32
+ self._close = getattr(result, "close", None)
33
+ self._result = _skip_leading_empty_chunks(result)
34
+
35
+ def __iter__(self) -> typing.Iterator[bytes]:
36
+ for part in self._result:
37
+ yield part
38
+
39
+ def close(self) -> None:
40
+ if self._close is not None:
41
+ self._close()
42
+
43
+
44
+ class WSGITransport(BaseTransport):
45
+ """
46
+ A custom transport that handles sending requests directly to an WSGI app.
47
+ The simplest way to use this functionality is to use the `app` argument.
48
+
49
+ ```
50
+ client = httpx.Client(app=app)
51
+ ```
52
+
53
+ Alternatively, you can setup the transport instance explicitly.
54
+ This allows you to include any additional configuration arguments specific
55
+ to the WSGITransport class:
56
+
57
+ ```
58
+ transport = httpx.WSGITransport(
59
+ app=app,
60
+ script_name="/submount",
61
+ remote_addr="1.2.3.4"
62
+ )
63
+ client = httpx.Client(transport=transport)
64
+ ```
65
+
66
+ Arguments:
67
+
68
+ * `app` - The WSGI application.
69
+ * `raise_app_exceptions` - Boolean indicating if exceptions in the application
70
+ should be raised. Default to `True`. Can be set to `False` for use cases
71
+ such as testing the content of a client 500 response.
72
+ * `script_name` - The root path on which the WSGI application should be mounted.
73
+ * `remote_addr` - A string indicating the client IP of incoming requests.
74
+ ```
75
+ """
76
+
77
+ def __init__(
78
+ self,
79
+ app: WSGIApplication,
80
+ raise_app_exceptions: bool = True,
81
+ script_name: str = "",
82
+ remote_addr: str = "127.0.0.1",
83
+ wsgi_errors: typing.TextIO | None = None,
84
+ ) -> None:
85
+ self.app = app
86
+ self.raise_app_exceptions = raise_app_exceptions
87
+ self.script_name = script_name
88
+ self.remote_addr = remote_addr
89
+ self.wsgi_errors = wsgi_errors
90
+
91
+ def handle_request(self, request: Request) -> Response:
92
+ request.read()
93
+ wsgi_input = io.BytesIO(request.content)
94
+
95
+ port = request.url.port or {"http": 80, "https": 443}[request.url.scheme]
96
+ environ = {
97
+ "wsgi.version": (1, 0),
98
+ "wsgi.url_scheme": request.url.scheme,
99
+ "wsgi.input": wsgi_input,
100
+ "wsgi.errors": self.wsgi_errors or sys.stderr,
101
+ "wsgi.multithread": True,
102
+ "wsgi.multiprocess": False,
103
+ "wsgi.run_once": False,
104
+ "REQUEST_METHOD": request.method,
105
+ "SCRIPT_NAME": self.script_name,
106
+ "PATH_INFO": request.url.path,
107
+ "QUERY_STRING": request.url.query.decode("ascii"),
108
+ "SERVER_NAME": request.url.host,
109
+ "SERVER_PORT": str(port),
110
+ "SERVER_PROTOCOL": "HTTP/1.1",
111
+ "REMOTE_ADDR": self.remote_addr,
112
+ }
113
+ for header_key, header_value in request.headers.raw:
114
+ key = header_key.decode("ascii").upper().replace("-", "_")
115
+ if key not in ("CONTENT_TYPE", "CONTENT_LENGTH"):
116
+ key = "HTTP_" + key
117
+ environ[key] = header_value.decode("ascii")
118
+
119
+ seen_status = None
120
+ seen_response_headers = None
121
+ seen_exc_info = None
122
+
123
+ def start_response(
124
+ status: str,
125
+ response_headers: list[tuple[str, str]],
126
+ exc_info: OptExcInfo | None = None,
127
+ ) -> typing.Callable[[bytes], typing.Any]:
128
+ nonlocal seen_status, seen_response_headers, seen_exc_info
129
+ seen_status = status
130
+ seen_response_headers = response_headers
131
+ seen_exc_info = exc_info
132
+ return lambda _: None
133
+
134
+ result = self.app(environ, start_response)
135
+
136
+ stream = WSGIByteStream(result)
137
+
138
+ assert seen_status is not None
139
+ assert seen_response_headers is not None
140
+ if seen_exc_info and seen_exc_info[0] and self.raise_app_exceptions:
141
+ raise seen_exc_info[1]
142
+
143
+ status_code = int(seen_status.split()[0])
144
+ headers = [
145
+ (key.encode("ascii"), value.encode("ascii"))
146
+ for key, value in seen_response_headers
147
+ ]
148
+
149
+ return Response(status_code, headers=headers, stream=stream)
evalkit_tf437/lib/python3.10/site-packages/importlib_metadata-8.5.0.dist-info/REQUESTED ADDED
File without changes
evalkit_tf437/lib/python3.10/site-packages/importlib_metadata-8.5.0.dist-info/top_level.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ importlib_metadata
evalkit_tf437/lib/python3.10/site-packages/markdown2-2.5.1.dist-info/INSTALLER ADDED
@@ -0,0 +1 @@
 
 
1
+ pip
evalkit_tf437/lib/python3.10/site-packages/nvidia_nvjitlink_cu12-12.6.77.dist-info/METADATA ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Metadata-Version: 2.1
2
+ Name: nvidia-nvjitlink-cu12
3
+ Version: 12.6.77
4
+ Summary: Nvidia JIT LTO Library
5
+ Home-page: https://developer.nvidia.com/cuda-zone
6
+ Author: Nvidia CUDA Installer Team
7
+ Author-email: compute_installer@nvidia.com
8
+ License: NVIDIA Proprietary Software
9
+ Keywords: cuda,nvidia,runtime,machine learning,deep learning
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: License :: Other/Proprietary License
15
+ Classifier: Natural Language :: English
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.5
18
+ Classifier: Programming Language :: Python :: 3.6
19
+ Classifier: Programming Language :: Python :: 3.7
20
+ Classifier: Programming Language :: Python :: 3.8
21
+ Classifier: Programming Language :: Python :: 3.9
22
+ Classifier: Programming Language :: Python :: 3.10
23
+ Classifier: Programming Language :: Python :: 3.11
24
+ Classifier: Programming Language :: Python :: 3 :: Only
25
+ Classifier: Topic :: Scientific/Engineering
26
+ Classifier: Topic :: Scientific/Engineering :: Mathematics
27
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
28
+ Classifier: Topic :: Software Development
29
+ Classifier: Topic :: Software Development :: Libraries
30
+ Classifier: Operating System :: Microsoft :: Windows
31
+ Classifier: Operating System :: POSIX :: Linux
32
+ Requires-Python: >=3
33
+ License-File: License.txt
34
+
35
+ NVIDIA compiler library for JIT LTO functionality.
evalkit_tf437/lib/python3.10/site-packages/nvidia_nvjitlink_cu12-12.6.77.dist-info/RECORD ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ nvidia/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ nvidia/__pycache__/__init__.cpython-310.pyc,,
3
+ nvidia/nvjitlink/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ nvidia/nvjitlink/__pycache__/__init__.cpython-310.pyc,,
5
+ nvidia/nvjitlink/include/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ nvidia/nvjitlink/include/__pycache__/__init__.cpython-310.pyc,,
7
+ nvidia/nvjitlink/include/nvJitLink.h,sha256=HBktNYjM81ZYOXfchzAYroZYwaQbqT9Szn4EtM5uhig,17081
8
+ nvidia/nvjitlink/lib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
+ nvidia/nvjitlink/lib/__pycache__/__init__.cpython-310.pyc,,
10
+ nvidia/nvjitlink/lib/libnvJitLink.so.12,sha256=VAcZvxmxbNIXJeXCwFp_FRXiKeRlIGcO-57L5emdtbE,50418984
11
+ nvidia_nvjitlink_cu12-12.6.77.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
12
+ nvidia_nvjitlink_cu12-12.6.77.dist-info/License.txt,sha256=rW9YU_ugyg0VnQ9Y1JrkmDDC-Mk_epJki5zpCttMbM0,59262
13
+ nvidia_nvjitlink_cu12-12.6.77.dist-info/METADATA,sha256=7GwLiQykHGfe6FSjcq6qVCyNI8eXgrre7H8MyW3Jt_I,1520
14
+ nvidia_nvjitlink_cu12-12.6.77.dist-info/RECORD,,
15
+ nvidia_nvjitlink_cu12-12.6.77.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ nvidia_nvjitlink_cu12-12.6.77.dist-info/WHEEL,sha256=RwQmhh9u1isdcmjtKWUeXWGEq6NgSi-cN5SopFlOUFw,108
17
+ nvidia_nvjitlink_cu12-12.6.77.dist-info/top_level.txt,sha256=fTkAtiFuL16nUrB9ytDDtpytz2t0B4NvYTnRzwAhO14,7
evalkit_tf437/lib/python3.10/site-packages/oauthlib-3.2.2.dist-info/LICENSE ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright (c) 2019 The OAuthlib Community
2
+ All rights reserved.
3
+
4
+ Redistribution and use in source and binary forms, with or without
5
+ modification, are permitted provided that the following conditions are met:
6
+
7
+ 1. Redistributions of source code must retain the above copyright notice,
8
+ this list of conditions and the following disclaimer.
9
+
10
+ 2. Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ 3. Neither the name of this project nor the names of its contributors may
15
+ be used to endorse or promote products derived from this software without
16
+ specific prior written permission.
17
+
18
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
evalkit_tf437/lib/python3.10/site-packages/pygments/cmdline.py ADDED
@@ -0,0 +1,668 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.cmdline
3
+ ~~~~~~~~~~~~~~~~
4
+
5
+ Command line interface.
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import os
12
+ import sys
13
+ import shutil
14
+ import argparse
15
+ from textwrap import dedent
16
+
17
+ from pygments import __version__, highlight
18
+ from pygments.util import ClassNotFound, OptionError, docstring_headline, \
19
+ guess_decode, guess_decode_from_terminal, terminal_encoding, \
20
+ UnclosingTextIOWrapper
21
+ from pygments.lexers import get_all_lexers, get_lexer_by_name, guess_lexer, \
22
+ load_lexer_from_file, get_lexer_for_filename, find_lexer_class_for_filename
23
+ from pygments.lexers.special import TextLexer
24
+ from pygments.formatters.latex import LatexEmbeddedLexer, LatexFormatter
25
+ from pygments.formatters import get_all_formatters, get_formatter_by_name, \
26
+ load_formatter_from_file, get_formatter_for_filename, find_formatter_class
27
+ from pygments.formatters.terminal import TerminalFormatter
28
+ from pygments.formatters.terminal256 import Terminal256Formatter, TerminalTrueColorFormatter
29
+ from pygments.filters import get_all_filters, find_filter_class
30
+ from pygments.styles import get_all_styles, get_style_by_name
31
+
32
+
33
+ def _parse_options(o_strs):
34
+ opts = {}
35
+ if not o_strs:
36
+ return opts
37
+ for o_str in o_strs:
38
+ if not o_str.strip():
39
+ continue
40
+ o_args = o_str.split(',')
41
+ for o_arg in o_args:
42
+ o_arg = o_arg.strip()
43
+ try:
44
+ o_key, o_val = o_arg.split('=', 1)
45
+ o_key = o_key.strip()
46
+ o_val = o_val.strip()
47
+ except ValueError:
48
+ opts[o_arg] = True
49
+ else:
50
+ opts[o_key] = o_val
51
+ return opts
52
+
53
+
54
+ def _parse_filters(f_strs):
55
+ filters = []
56
+ if not f_strs:
57
+ return filters
58
+ for f_str in f_strs:
59
+ if ':' in f_str:
60
+ fname, fopts = f_str.split(':', 1)
61
+ filters.append((fname, _parse_options([fopts])))
62
+ else:
63
+ filters.append((f_str, {}))
64
+ return filters
65
+
66
+
67
+ def _print_help(what, name):
68
+ try:
69
+ if what == 'lexer':
70
+ cls = get_lexer_by_name(name)
71
+ print(f"Help on the {cls.name} lexer:")
72
+ print(dedent(cls.__doc__))
73
+ elif what == 'formatter':
74
+ cls = find_formatter_class(name)
75
+ print(f"Help on the {cls.name} formatter:")
76
+ print(dedent(cls.__doc__))
77
+ elif what == 'filter':
78
+ cls = find_filter_class(name)
79
+ print(f"Help on the {name} filter:")
80
+ print(dedent(cls.__doc__))
81
+ return 0
82
+ except (AttributeError, ValueError):
83
+ print(f"{what} not found!", file=sys.stderr)
84
+ return 1
85
+
86
+
87
+ def _print_list(what):
88
+ if what == 'lexer':
89
+ print()
90
+ print("Lexers:")
91
+ print("~~~~~~~")
92
+
93
+ info = []
94
+ for fullname, names, exts, _ in get_all_lexers():
95
+ tup = (', '.join(names)+':', fullname,
96
+ exts and '(filenames ' + ', '.join(exts) + ')' or '')
97
+ info.append(tup)
98
+ info.sort()
99
+ for i in info:
100
+ print(('* {}\n {} {}').format(*i))
101
+
102
+ elif what == 'formatter':
103
+ print()
104
+ print("Formatters:")
105
+ print("~~~~~~~~~~~")
106
+
107
+ info = []
108
+ for cls in get_all_formatters():
109
+ doc = docstring_headline(cls)
110
+ tup = (', '.join(cls.aliases) + ':', doc, cls.filenames and
111
+ '(filenames ' + ', '.join(cls.filenames) + ')' or '')
112
+ info.append(tup)
113
+ info.sort()
114
+ for i in info:
115
+ print(('* {}\n {} {}').format(*i))
116
+
117
+ elif what == 'filter':
118
+ print()
119
+ print("Filters:")
120
+ print("~~~~~~~~")
121
+
122
+ for name in get_all_filters():
123
+ cls = find_filter_class(name)
124
+ print("* " + name + ':')
125
+ print(f" {docstring_headline(cls)}")
126
+
127
+ elif what == 'style':
128
+ print()
129
+ print("Styles:")
130
+ print("~~~~~~~")
131
+
132
+ for name in get_all_styles():
133
+ cls = get_style_by_name(name)
134
+ print("* " + name + ':')
135
+ print(f" {docstring_headline(cls)}")
136
+
137
+
138
+ def _print_list_as_json(requested_items):
139
+ import json
140
+ result = {}
141
+ if 'lexer' in requested_items:
142
+ info = {}
143
+ for fullname, names, filenames, mimetypes in get_all_lexers():
144
+ info[fullname] = {
145
+ 'aliases': names,
146
+ 'filenames': filenames,
147
+ 'mimetypes': mimetypes
148
+ }
149
+ result['lexers'] = info
150
+
151
+ if 'formatter' in requested_items:
152
+ info = {}
153
+ for cls in get_all_formatters():
154
+ doc = docstring_headline(cls)
155
+ info[cls.name] = {
156
+ 'aliases': cls.aliases,
157
+ 'filenames': cls.filenames,
158
+ 'doc': doc
159
+ }
160
+ result['formatters'] = info
161
+
162
+ if 'filter' in requested_items:
163
+ info = {}
164
+ for name in get_all_filters():
165
+ cls = find_filter_class(name)
166
+ info[name] = {
167
+ 'doc': docstring_headline(cls)
168
+ }
169
+ result['filters'] = info
170
+
171
+ if 'style' in requested_items:
172
+ info = {}
173
+ for name in get_all_styles():
174
+ cls = get_style_by_name(name)
175
+ info[name] = {
176
+ 'doc': docstring_headline(cls)
177
+ }
178
+ result['styles'] = info
179
+
180
+ json.dump(result, sys.stdout)
181
+
182
+ def main_inner(parser, argns):
183
+ if argns.help:
184
+ parser.print_help()
185
+ return 0
186
+
187
+ if argns.V:
188
+ print(f'Pygments version {__version__}, (c) 2006-2024 by Georg Brandl, Matthäus '
189
+ 'Chajdas and contributors.')
190
+ return 0
191
+
192
+ def is_only_option(opt):
193
+ return not any(v for (k, v) in vars(argns).items() if k != opt)
194
+
195
+ # handle ``pygmentize -L``
196
+ if argns.L is not None:
197
+ arg_set = set()
198
+ for k, v in vars(argns).items():
199
+ if v:
200
+ arg_set.add(k)
201
+
202
+ arg_set.discard('L')
203
+ arg_set.discard('json')
204
+
205
+ if arg_set:
206
+ parser.print_help(sys.stderr)
207
+ return 2
208
+
209
+ # print version
210
+ if not argns.json:
211
+ main(['', '-V'])
212
+ allowed_types = {'lexer', 'formatter', 'filter', 'style'}
213
+ largs = [arg.rstrip('s') for arg in argns.L]
214
+ if any(arg not in allowed_types for arg in largs):
215
+ parser.print_help(sys.stderr)
216
+ return 0
217
+ if not largs:
218
+ largs = allowed_types
219
+ if not argns.json:
220
+ for arg in largs:
221
+ _print_list(arg)
222
+ else:
223
+ _print_list_as_json(largs)
224
+ return 0
225
+
226
+ # handle ``pygmentize -H``
227
+ if argns.H:
228
+ if not is_only_option('H'):
229
+ parser.print_help(sys.stderr)
230
+ return 2
231
+ what, name = argns.H
232
+ if what not in ('lexer', 'formatter', 'filter'):
233
+ parser.print_help(sys.stderr)
234
+ return 2
235
+ return _print_help(what, name)
236
+
237
+ # parse -O options
238
+ parsed_opts = _parse_options(argns.O or [])
239
+
240
+ # parse -P options
241
+ for p_opt in argns.P or []:
242
+ try:
243
+ name, value = p_opt.split('=', 1)
244
+ except ValueError:
245
+ parsed_opts[p_opt] = True
246
+ else:
247
+ parsed_opts[name] = value
248
+
249
+ # encodings
250
+ inencoding = parsed_opts.get('inencoding', parsed_opts.get('encoding'))
251
+ outencoding = parsed_opts.get('outencoding', parsed_opts.get('encoding'))
252
+
253
+ # handle ``pygmentize -N``
254
+ if argns.N:
255
+ lexer = find_lexer_class_for_filename(argns.N)
256
+ if lexer is None:
257
+ lexer = TextLexer
258
+
259
+ print(lexer.aliases[0])
260
+ return 0
261
+
262
+ # handle ``pygmentize -C``
263
+ if argns.C:
264
+ inp = sys.stdin.buffer.read()
265
+ try:
266
+ lexer = guess_lexer(inp, inencoding=inencoding)
267
+ except ClassNotFound:
268
+ lexer = TextLexer
269
+
270
+ print(lexer.aliases[0])
271
+ return 0
272
+
273
+ # handle ``pygmentize -S``
274
+ S_opt = argns.S
275
+ a_opt = argns.a
276
+ if S_opt is not None:
277
+ f_opt = argns.f
278
+ if not f_opt:
279
+ parser.print_help(sys.stderr)
280
+ return 2
281
+ if argns.l or argns.INPUTFILE:
282
+ parser.print_help(sys.stderr)
283
+ return 2
284
+
285
+ try:
286
+ parsed_opts['style'] = S_opt
287
+ fmter = get_formatter_by_name(f_opt, **parsed_opts)
288
+ except ClassNotFound as err:
289
+ print(err, file=sys.stderr)
290
+ return 1
291
+
292
+ print(fmter.get_style_defs(a_opt or ''))
293
+ return 0
294
+
295
+ # if no -S is given, -a is not allowed
296
+ if argns.a is not None:
297
+ parser.print_help(sys.stderr)
298
+ return 2
299
+
300
+ # parse -F options
301
+ F_opts = _parse_filters(argns.F or [])
302
+
303
+ # -x: allow custom (eXternal) lexers and formatters
304
+ allow_custom_lexer_formatter = bool(argns.x)
305
+
306
+ # select lexer
307
+ lexer = None
308
+
309
+ # given by name?
310
+ lexername = argns.l
311
+ if lexername:
312
+ # custom lexer, located relative to user's cwd
313
+ if allow_custom_lexer_formatter and '.py' in lexername:
314
+ try:
315
+ filename = None
316
+ name = None
317
+ if ':' in lexername:
318
+ filename, name = lexername.rsplit(':', 1)
319
+
320
+ if '.py' in name:
321
+ # This can happen on Windows: If the lexername is
322
+ # C:\lexer.py -- return to normal load path in that case
323
+ name = None
324
+
325
+ if filename and name:
326
+ lexer = load_lexer_from_file(filename, name,
327
+ **parsed_opts)
328
+ else:
329
+ lexer = load_lexer_from_file(lexername, **parsed_opts)
330
+ except ClassNotFound as err:
331
+ print('Error:', err, file=sys.stderr)
332
+ return 1
333
+ else:
334
+ try:
335
+ lexer = get_lexer_by_name(lexername, **parsed_opts)
336
+ except (OptionError, ClassNotFound) as err:
337
+ print('Error:', err, file=sys.stderr)
338
+ return 1
339
+
340
+ # read input code
341
+ code = None
342
+
343
+ if argns.INPUTFILE:
344
+ if argns.s:
345
+ print('Error: -s option not usable when input file specified',
346
+ file=sys.stderr)
347
+ return 2
348
+
349
+ infn = argns.INPUTFILE
350
+ try:
351
+ with open(infn, 'rb') as infp:
352
+ code = infp.read()
353
+ except Exception as err:
354
+ print('Error: cannot read infile:', err, file=sys.stderr)
355
+ return 1
356
+ if not inencoding:
357
+ code, inencoding = guess_decode(code)
358
+
359
+ # do we have to guess the lexer?
360
+ if not lexer:
361
+ try:
362
+ lexer = get_lexer_for_filename(infn, code, **parsed_opts)
363
+ except ClassNotFound as err:
364
+ if argns.g:
365
+ try:
366
+ lexer = guess_lexer(code, **parsed_opts)
367
+ except ClassNotFound:
368
+ lexer = TextLexer(**parsed_opts)
369
+ else:
370
+ print('Error:', err, file=sys.stderr)
371
+ return 1
372
+ except OptionError as err:
373
+ print('Error:', err, file=sys.stderr)
374
+ return 1
375
+
376
+ elif not argns.s: # treat stdin as full file (-s support is later)
377
+ # read code from terminal, always in binary mode since we want to
378
+ # decode ourselves and be tolerant with it
379
+ code = sys.stdin.buffer.read() # use .buffer to get a binary stream
380
+ if not inencoding:
381
+ code, inencoding = guess_decode_from_terminal(code, sys.stdin)
382
+ # else the lexer will do the decoding
383
+ if not lexer:
384
+ try:
385
+ lexer = guess_lexer(code, **parsed_opts)
386
+ except ClassNotFound:
387
+ lexer = TextLexer(**parsed_opts)
388
+
389
+ else: # -s option needs a lexer with -l
390
+ if not lexer:
391
+ print('Error: when using -s a lexer has to be selected with -l',
392
+ file=sys.stderr)
393
+ return 2
394
+
395
+ # process filters
396
+ for fname, fopts in F_opts:
397
+ try:
398
+ lexer.add_filter(fname, **fopts)
399
+ except ClassNotFound as err:
400
+ print('Error:', err, file=sys.stderr)
401
+ return 1
402
+
403
+ # select formatter
404
+ outfn = argns.o
405
+ fmter = argns.f
406
+ if fmter:
407
+ # custom formatter, located relative to user's cwd
408
+ if allow_custom_lexer_formatter and '.py' in fmter:
409
+ try:
410
+ filename = None
411
+ name = None
412
+ if ':' in fmter:
413
+ # Same logic as above for custom lexer
414
+ filename, name = fmter.rsplit(':', 1)
415
+
416
+ if '.py' in name:
417
+ name = None
418
+
419
+ if filename and name:
420
+ fmter = load_formatter_from_file(filename, name,
421
+ **parsed_opts)
422
+ else:
423
+ fmter = load_formatter_from_file(fmter, **parsed_opts)
424
+ except ClassNotFound as err:
425
+ print('Error:', err, file=sys.stderr)
426
+ return 1
427
+ else:
428
+ try:
429
+ fmter = get_formatter_by_name(fmter, **parsed_opts)
430
+ except (OptionError, ClassNotFound) as err:
431
+ print('Error:', err, file=sys.stderr)
432
+ return 1
433
+
434
+ if outfn:
435
+ if not fmter:
436
+ try:
437
+ fmter = get_formatter_for_filename(outfn, **parsed_opts)
438
+ except (OptionError, ClassNotFound) as err:
439
+ print('Error:', err, file=sys.stderr)
440
+ return 1
441
+ try:
442
+ outfile = open(outfn, 'wb')
443
+ except Exception as err:
444
+ print('Error: cannot open outfile:', err, file=sys.stderr)
445
+ return 1
446
+ else:
447
+ if not fmter:
448
+ if os.environ.get('COLORTERM','') in ('truecolor', '24bit'):
449
+ fmter = TerminalTrueColorFormatter(**parsed_opts)
450
+ elif '256' in os.environ.get('TERM', ''):
451
+ fmter = Terminal256Formatter(**parsed_opts)
452
+ else:
453
+ fmter = TerminalFormatter(**parsed_opts)
454
+ outfile = sys.stdout.buffer
455
+
456
+ # determine output encoding if not explicitly selected
457
+ if not outencoding:
458
+ if outfn:
459
+ # output file? use lexer encoding for now (can still be None)
460
+ fmter.encoding = inencoding
461
+ else:
462
+ # else use terminal encoding
463
+ fmter.encoding = terminal_encoding(sys.stdout)
464
+
465
+ # provide coloring under Windows, if possible
466
+ if not outfn and sys.platform in ('win32', 'cygwin') and \
467
+ fmter.name in ('Terminal', 'Terminal256'): # pragma: no cover
468
+ # unfortunately colorama doesn't support binary streams on Py3
469
+ outfile = UnclosingTextIOWrapper(outfile, encoding=fmter.encoding)
470
+ fmter.encoding = None
471
+ try:
472
+ import colorama.initialise
473
+ except ImportError:
474
+ pass
475
+ else:
476
+ outfile = colorama.initialise.wrap_stream(
477
+ outfile, convert=None, strip=None, autoreset=False, wrap=True)
478
+
479
+ # When using the LaTeX formatter and the option `escapeinside` is
480
+ # specified, we need a special lexer which collects escaped text
481
+ # before running the chosen language lexer.
482
+ escapeinside = parsed_opts.get('escapeinside', '')
483
+ if len(escapeinside) == 2 and isinstance(fmter, LatexFormatter):
484
+ left = escapeinside[0]
485
+ right = escapeinside[1]
486
+ lexer = LatexEmbeddedLexer(left, right, lexer)
487
+
488
+ # ... and do it!
489
+ if not argns.s:
490
+ # process whole input as per normal...
491
+ try:
492
+ highlight(code, lexer, fmter, outfile)
493
+ finally:
494
+ if outfn:
495
+ outfile.close()
496
+ return 0
497
+ else:
498
+ # line by line processing of stdin (eg: for 'tail -f')...
499
+ try:
500
+ while 1:
501
+ line = sys.stdin.buffer.readline()
502
+ if not line:
503
+ break
504
+ if not inencoding:
505
+ line = guess_decode_from_terminal(line, sys.stdin)[0]
506
+ highlight(line, lexer, fmter, outfile)
507
+ if hasattr(outfile, 'flush'):
508
+ outfile.flush()
509
+ return 0
510
+ except KeyboardInterrupt: # pragma: no cover
511
+ return 0
512
+ finally:
513
+ if outfn:
514
+ outfile.close()
515
+
516
+
517
+ class HelpFormatter(argparse.HelpFormatter):
518
+ def __init__(self, prog, indent_increment=2, max_help_position=16, width=None):
519
+ if width is None:
520
+ try:
521
+ width = shutil.get_terminal_size().columns - 2
522
+ except Exception:
523
+ pass
524
+ argparse.HelpFormatter.__init__(self, prog, indent_increment,
525
+ max_help_position, width)
526
+
527
+
528
+ def main(args=sys.argv):
529
+ """
530
+ Main command line entry point.
531
+ """
532
+ desc = "Highlight an input file and write the result to an output file."
533
+ parser = argparse.ArgumentParser(description=desc, add_help=False,
534
+ formatter_class=HelpFormatter)
535
+
536
+ operation = parser.add_argument_group('Main operation')
537
+ lexersel = operation.add_mutually_exclusive_group()
538
+ lexersel.add_argument(
539
+ '-l', metavar='LEXER',
540
+ help='Specify the lexer to use. (Query names with -L.) If not '
541
+ 'given and -g is not present, the lexer is guessed from the filename.')
542
+ lexersel.add_argument(
543
+ '-g', action='store_true',
544
+ help='Guess the lexer from the file contents, or pass through '
545
+ 'as plain text if nothing can be guessed.')
546
+ operation.add_argument(
547
+ '-F', metavar='FILTER[:options]', action='append',
548
+ help='Add a filter to the token stream. (Query names with -L.) '
549
+ 'Filter options are given after a colon if necessary.')
550
+ operation.add_argument(
551
+ '-f', metavar='FORMATTER',
552
+ help='Specify the formatter to use. (Query names with -L.) '
553
+ 'If not given, the formatter is guessed from the output filename, '
554
+ 'and defaults to the terminal formatter if the output is to the '
555
+ 'terminal or an unknown file extension.')
556
+ operation.add_argument(
557
+ '-O', metavar='OPTION=value[,OPTION=value,...]', action='append',
558
+ help='Give options to the lexer and formatter as a comma-separated '
559
+ 'list of key-value pairs. '
560
+ 'Example: `-O bg=light,python=cool`.')
561
+ operation.add_argument(
562
+ '-P', metavar='OPTION=value', action='append',
563
+ help='Give a single option to the lexer and formatter - with this '
564
+ 'you can pass options whose value contains commas and equal signs. '
565
+ 'Example: `-P "heading=Pygments, the Python highlighter"`.')
566
+ operation.add_argument(
567
+ '-o', metavar='OUTPUTFILE',
568
+ help='Where to write the output. Defaults to standard output.')
569
+
570
+ operation.add_argument(
571
+ 'INPUTFILE', nargs='?',
572
+ help='Where to read the input. Defaults to standard input.')
573
+
574
+ flags = parser.add_argument_group('Operation flags')
575
+ flags.add_argument(
576
+ '-v', action='store_true',
577
+ help='Print a detailed traceback on unhandled exceptions, which '
578
+ 'is useful for debugging and bug reports.')
579
+ flags.add_argument(
580
+ '-s', action='store_true',
581
+ help='Process lines one at a time until EOF, rather than waiting to '
582
+ 'process the entire file. This only works for stdin, only for lexers '
583
+ 'with no line-spanning constructs, and is intended for streaming '
584
+ 'input such as you get from `tail -f`. '
585
+ 'Example usage: `tail -f sql.log | pygmentize -s -l sql`.')
586
+ flags.add_argument(
587
+ '-x', action='store_true',
588
+ help='Allow custom lexers and formatters to be loaded from a .py file '
589
+ 'relative to the current working directory. For example, '
590
+ '`-l ./customlexer.py -x`. By default, this option expects a file '
591
+ 'with a class named CustomLexer or CustomFormatter; you can also '
592
+ 'specify your own class name with a colon (`-l ./lexer.py:MyLexer`). '
593
+ 'Users should be very careful not to use this option with untrusted '
594
+ 'files, because it will import and run them.')
595
+ flags.add_argument('--json', help='Output as JSON. This can '
596
+ 'be only used in conjunction with -L.',
597
+ default=False,
598
+ action='store_true')
599
+
600
+ special_modes_group = parser.add_argument_group(
601
+ 'Special modes - do not do any highlighting')
602
+ special_modes = special_modes_group.add_mutually_exclusive_group()
603
+ special_modes.add_argument(
604
+ '-S', metavar='STYLE -f formatter',
605
+ help='Print style definitions for STYLE for a formatter '
606
+ 'given with -f. The argument given by -a is formatter '
607
+ 'dependent.')
608
+ special_modes.add_argument(
609
+ '-L', nargs='*', metavar='WHAT',
610
+ help='List lexers, formatters, styles or filters -- '
611
+ 'give additional arguments for the thing(s) you want to list '
612
+ '(e.g. "styles"), or omit them to list everything.')
613
+ special_modes.add_argument(
614
+ '-N', metavar='FILENAME',
615
+ help='Guess and print out a lexer name based solely on the given '
616
+ 'filename. Does not take input or highlight anything. If no specific '
617
+ 'lexer can be determined, "text" is printed.')
618
+ special_modes.add_argument(
619
+ '-C', action='store_true',
620
+ help='Like -N, but print out a lexer name based solely on '
621
+ 'a given content from standard input.')
622
+ special_modes.add_argument(
623
+ '-H', action='store', nargs=2, metavar=('NAME', 'TYPE'),
624
+ help='Print detailed help for the object <name> of type <type>, '
625
+ 'where <type> is one of "lexer", "formatter" or "filter".')
626
+ special_modes.add_argument(
627
+ '-V', action='store_true',
628
+ help='Print the package version.')
629
+ special_modes.add_argument(
630
+ '-h', '--help', action='store_true',
631
+ help='Print this help.')
632
+ special_modes_group.add_argument(
633
+ '-a', metavar='ARG',
634
+ help='Formatter-specific additional argument for the -S (print '
635
+ 'style sheet) mode.')
636
+
637
+ argns = parser.parse_args(args[1:])
638
+
639
+ try:
640
+ return main_inner(parser, argns)
641
+ except BrokenPipeError:
642
+ # someone closed our stdout, e.g. by quitting a pager.
643
+ return 0
644
+ except Exception:
645
+ if argns.v:
646
+ print(file=sys.stderr)
647
+ print('*' * 65, file=sys.stderr)
648
+ print('An unhandled exception occurred while highlighting.',
649
+ file=sys.stderr)
650
+ print('Please report the whole traceback to the issue tracker at',
651
+ file=sys.stderr)
652
+ print('<https://github.com/pygments/pygments/issues>.',
653
+ file=sys.stderr)
654
+ print('*' * 65, file=sys.stderr)
655
+ print(file=sys.stderr)
656
+ raise
657
+ import traceback
658
+ info = traceback.format_exception(*sys.exc_info())
659
+ msg = info[-1].strip()
660
+ if len(info) >= 3:
661
+ # extract relevant file and position info
662
+ msg += '\n (f{})'.format(info[-2].split('\n')[0].strip()[1:])
663
+ print(file=sys.stderr)
664
+ print('*** Error while highlighting:', file=sys.stderr)
665
+ print(msg, file=sys.stderr)
666
+ print('*** If this is a bug you want to report, please rerun with -v.',
667
+ file=sys.stderr)
668
+ return 1
evalkit_tf437/lib/python3.10/site-packages/pygments/filters/__init__.py ADDED
@@ -0,0 +1,940 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.filters
3
+ ~~~~~~~~~~~~~~~~
4
+
5
+ Module containing filter lookup functions and default
6
+ filters.
7
+
8
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
9
+ :license: BSD, see LICENSE for details.
10
+ """
11
+
12
+ import re
13
+
14
+ from pygments.token import String, Comment, Keyword, Name, Error, Whitespace, \
15
+ string_to_tokentype
16
+ from pygments.filter import Filter
17
+ from pygments.util import get_list_opt, get_int_opt, get_bool_opt, \
18
+ get_choice_opt, ClassNotFound, OptionError
19
+ from pygments.plugin import find_plugin_filters
20
+
21
+
22
+ def find_filter_class(filtername):
23
+ """Lookup a filter by name. Return None if not found."""
24
+ if filtername in FILTERS:
25
+ return FILTERS[filtername]
26
+ for name, cls in find_plugin_filters():
27
+ if name == filtername:
28
+ return cls
29
+ return None
30
+
31
+
32
+ def get_filter_by_name(filtername, **options):
33
+ """Return an instantiated filter.
34
+
35
+ Options are passed to the filter initializer if wanted.
36
+ Raise a ClassNotFound if not found.
37
+ """
38
+ cls = find_filter_class(filtername)
39
+ if cls:
40
+ return cls(**options)
41
+ else:
42
+ raise ClassNotFound(f'filter {filtername!r} not found')
43
+
44
+
45
+ def get_all_filters():
46
+ """Return a generator of all filter names."""
47
+ yield from FILTERS
48
+ for name, _ in find_plugin_filters():
49
+ yield name
50
+
51
+
52
+ def _replace_special(ttype, value, regex, specialttype,
53
+ replacefunc=lambda x: x):
54
+ last = 0
55
+ for match in regex.finditer(value):
56
+ start, end = match.start(), match.end()
57
+ if start != last:
58
+ yield ttype, value[last:start]
59
+ yield specialttype, replacefunc(value[start:end])
60
+ last = end
61
+ if last != len(value):
62
+ yield ttype, value[last:]
63
+
64
+
65
+ class CodeTagFilter(Filter):
66
+ """Highlight special code tags in comments and docstrings.
67
+
68
+ Options accepted:
69
+
70
+ `codetags` : list of strings
71
+ A list of strings that are flagged as code tags. The default is to
72
+ highlight ``XXX``, ``TODO``, ``FIXME``, ``BUG`` and ``NOTE``.
73
+
74
+ .. versionchanged:: 2.13
75
+ Now recognizes ``FIXME`` by default.
76
+ """
77
+
78
+ def __init__(self, **options):
79
+ Filter.__init__(self, **options)
80
+ tags = get_list_opt(options, 'codetags',
81
+ ['XXX', 'TODO', 'FIXME', 'BUG', 'NOTE'])
82
+ self.tag_re = re.compile(r'\b({})\b'.format('|'.join([
83
+ re.escape(tag) for tag in tags if tag
84
+ ])))
85
+
86
+ def filter(self, lexer, stream):
87
+ regex = self.tag_re
88
+ for ttype, value in stream:
89
+ if ttype in String.Doc or \
90
+ ttype in Comment and \
91
+ ttype not in Comment.Preproc:
92
+ yield from _replace_special(ttype, value, regex, Comment.Special)
93
+ else:
94
+ yield ttype, value
95
+
96
+
97
+ class SymbolFilter(Filter):
98
+ """Convert mathematical symbols such as \\<longrightarrow> in Isabelle
99
+ or \\longrightarrow in LaTeX into Unicode characters.
100
+
101
+ This is mostly useful for HTML or console output when you want to
102
+ approximate the source rendering you'd see in an IDE.
103
+
104
+ Options accepted:
105
+
106
+ `lang` : string
107
+ The symbol language. Must be one of ``'isabelle'`` or
108
+ ``'latex'``. The default is ``'isabelle'``.
109
+ """
110
+
111
+ latex_symbols = {
112
+ '\\alpha' : '\U000003b1',
113
+ '\\beta' : '\U000003b2',
114
+ '\\gamma' : '\U000003b3',
115
+ '\\delta' : '\U000003b4',
116
+ '\\varepsilon' : '\U000003b5',
117
+ '\\zeta' : '\U000003b6',
118
+ '\\eta' : '\U000003b7',
119
+ '\\vartheta' : '\U000003b8',
120
+ '\\iota' : '\U000003b9',
121
+ '\\kappa' : '\U000003ba',
122
+ '\\lambda' : '\U000003bb',
123
+ '\\mu' : '\U000003bc',
124
+ '\\nu' : '\U000003bd',
125
+ '\\xi' : '\U000003be',
126
+ '\\pi' : '\U000003c0',
127
+ '\\varrho' : '\U000003c1',
128
+ '\\sigma' : '\U000003c3',
129
+ '\\tau' : '\U000003c4',
130
+ '\\upsilon' : '\U000003c5',
131
+ '\\varphi' : '\U000003c6',
132
+ '\\chi' : '\U000003c7',
133
+ '\\psi' : '\U000003c8',
134
+ '\\omega' : '\U000003c9',
135
+ '\\Gamma' : '\U00000393',
136
+ '\\Delta' : '\U00000394',
137
+ '\\Theta' : '\U00000398',
138
+ '\\Lambda' : '\U0000039b',
139
+ '\\Xi' : '\U0000039e',
140
+ '\\Pi' : '\U000003a0',
141
+ '\\Sigma' : '\U000003a3',
142
+ '\\Upsilon' : '\U000003a5',
143
+ '\\Phi' : '\U000003a6',
144
+ '\\Psi' : '\U000003a8',
145
+ '\\Omega' : '\U000003a9',
146
+ '\\leftarrow' : '\U00002190',
147
+ '\\longleftarrow' : '\U000027f5',
148
+ '\\rightarrow' : '\U00002192',
149
+ '\\longrightarrow' : '\U000027f6',
150
+ '\\Leftarrow' : '\U000021d0',
151
+ '\\Longleftarrow' : '\U000027f8',
152
+ '\\Rightarrow' : '\U000021d2',
153
+ '\\Longrightarrow' : '\U000027f9',
154
+ '\\leftrightarrow' : '\U00002194',
155
+ '\\longleftrightarrow' : '\U000027f7',
156
+ '\\Leftrightarrow' : '\U000021d4',
157
+ '\\Longleftrightarrow' : '\U000027fa',
158
+ '\\mapsto' : '\U000021a6',
159
+ '\\longmapsto' : '\U000027fc',
160
+ '\\relbar' : '\U00002500',
161
+ '\\Relbar' : '\U00002550',
162
+ '\\hookleftarrow' : '\U000021a9',
163
+ '\\hookrightarrow' : '\U000021aa',
164
+ '\\leftharpoondown' : '\U000021bd',
165
+ '\\rightharpoondown' : '\U000021c1',
166
+ '\\leftharpoonup' : '\U000021bc',
167
+ '\\rightharpoonup' : '\U000021c0',
168
+ '\\rightleftharpoons' : '\U000021cc',
169
+ '\\leadsto' : '\U0000219d',
170
+ '\\downharpoonleft' : '\U000021c3',
171
+ '\\downharpoonright' : '\U000021c2',
172
+ '\\upharpoonleft' : '\U000021bf',
173
+ '\\upharpoonright' : '\U000021be',
174
+ '\\restriction' : '\U000021be',
175
+ '\\uparrow' : '\U00002191',
176
+ '\\Uparrow' : '\U000021d1',
177
+ '\\downarrow' : '\U00002193',
178
+ '\\Downarrow' : '\U000021d3',
179
+ '\\updownarrow' : '\U00002195',
180
+ '\\Updownarrow' : '\U000021d5',
181
+ '\\langle' : '\U000027e8',
182
+ '\\rangle' : '\U000027e9',
183
+ '\\lceil' : '\U00002308',
184
+ '\\rceil' : '\U00002309',
185
+ '\\lfloor' : '\U0000230a',
186
+ '\\rfloor' : '\U0000230b',
187
+ '\\flqq' : '\U000000ab',
188
+ '\\frqq' : '\U000000bb',
189
+ '\\bot' : '\U000022a5',
190
+ '\\top' : '\U000022a4',
191
+ '\\wedge' : '\U00002227',
192
+ '\\bigwedge' : '\U000022c0',
193
+ '\\vee' : '\U00002228',
194
+ '\\bigvee' : '\U000022c1',
195
+ '\\forall' : '\U00002200',
196
+ '\\exists' : '\U00002203',
197
+ '\\nexists' : '\U00002204',
198
+ '\\neg' : '\U000000ac',
199
+ '\\Box' : '\U000025a1',
200
+ '\\Diamond' : '\U000025c7',
201
+ '\\vdash' : '\U000022a2',
202
+ '\\models' : '\U000022a8',
203
+ '\\dashv' : '\U000022a3',
204
+ '\\surd' : '\U0000221a',
205
+ '\\le' : '\U00002264',
206
+ '\\ge' : '\U00002265',
207
+ '\\ll' : '\U0000226a',
208
+ '\\gg' : '\U0000226b',
209
+ '\\lesssim' : '\U00002272',
210
+ '\\gtrsim' : '\U00002273',
211
+ '\\lessapprox' : '\U00002a85',
212
+ '\\gtrapprox' : '\U00002a86',
213
+ '\\in' : '\U00002208',
214
+ '\\notin' : '\U00002209',
215
+ '\\subset' : '\U00002282',
216
+ '\\supset' : '\U00002283',
217
+ '\\subseteq' : '\U00002286',
218
+ '\\supseteq' : '\U00002287',
219
+ '\\sqsubset' : '\U0000228f',
220
+ '\\sqsupset' : '\U00002290',
221
+ '\\sqsubseteq' : '\U00002291',
222
+ '\\sqsupseteq' : '\U00002292',
223
+ '\\cap' : '\U00002229',
224
+ '\\bigcap' : '\U000022c2',
225
+ '\\cup' : '\U0000222a',
226
+ '\\bigcup' : '\U000022c3',
227
+ '\\sqcup' : '\U00002294',
228
+ '\\bigsqcup' : '\U00002a06',
229
+ '\\sqcap' : '\U00002293',
230
+ '\\Bigsqcap' : '\U00002a05',
231
+ '\\setminus' : '\U00002216',
232
+ '\\propto' : '\U0000221d',
233
+ '\\uplus' : '\U0000228e',
234
+ '\\bigplus' : '\U00002a04',
235
+ '\\sim' : '\U0000223c',
236
+ '\\doteq' : '\U00002250',
237
+ '\\simeq' : '\U00002243',
238
+ '\\approx' : '\U00002248',
239
+ '\\asymp' : '\U0000224d',
240
+ '\\cong' : '\U00002245',
241
+ '\\equiv' : '\U00002261',
242
+ '\\Join' : '\U000022c8',
243
+ '\\bowtie' : '\U00002a1d',
244
+ '\\prec' : '\U0000227a',
245
+ '\\succ' : '\U0000227b',
246
+ '\\preceq' : '\U0000227c',
247
+ '\\succeq' : '\U0000227d',
248
+ '\\parallel' : '\U00002225',
249
+ '\\mid' : '\U000000a6',
250
+ '\\pm' : '\U000000b1',
251
+ '\\mp' : '\U00002213',
252
+ '\\times' : '\U000000d7',
253
+ '\\div' : '\U000000f7',
254
+ '\\cdot' : '\U000022c5',
255
+ '\\star' : '\U000022c6',
256
+ '\\circ' : '\U00002218',
257
+ '\\dagger' : '\U00002020',
258
+ '\\ddagger' : '\U00002021',
259
+ '\\lhd' : '\U000022b2',
260
+ '\\rhd' : '\U000022b3',
261
+ '\\unlhd' : '\U000022b4',
262
+ '\\unrhd' : '\U000022b5',
263
+ '\\triangleleft' : '\U000025c3',
264
+ '\\triangleright' : '\U000025b9',
265
+ '\\triangle' : '\U000025b3',
266
+ '\\triangleq' : '\U0000225c',
267
+ '\\oplus' : '\U00002295',
268
+ '\\bigoplus' : '\U00002a01',
269
+ '\\otimes' : '\U00002297',
270
+ '\\bigotimes' : '\U00002a02',
271
+ '\\odot' : '\U00002299',
272
+ '\\bigodot' : '\U00002a00',
273
+ '\\ominus' : '\U00002296',
274
+ '\\oslash' : '\U00002298',
275
+ '\\dots' : '\U00002026',
276
+ '\\cdots' : '\U000022ef',
277
+ '\\sum' : '\U00002211',
278
+ '\\prod' : '\U0000220f',
279
+ '\\coprod' : '\U00002210',
280
+ '\\infty' : '\U0000221e',
281
+ '\\int' : '\U0000222b',
282
+ '\\oint' : '\U0000222e',
283
+ '\\clubsuit' : '\U00002663',
284
+ '\\diamondsuit' : '\U00002662',
285
+ '\\heartsuit' : '\U00002661',
286
+ '\\spadesuit' : '\U00002660',
287
+ '\\aleph' : '\U00002135',
288
+ '\\emptyset' : '\U00002205',
289
+ '\\nabla' : '\U00002207',
290
+ '\\partial' : '\U00002202',
291
+ '\\flat' : '\U0000266d',
292
+ '\\natural' : '\U0000266e',
293
+ '\\sharp' : '\U0000266f',
294
+ '\\angle' : '\U00002220',
295
+ '\\copyright' : '\U000000a9',
296
+ '\\textregistered' : '\U000000ae',
297
+ '\\textonequarter' : '\U000000bc',
298
+ '\\textonehalf' : '\U000000bd',
299
+ '\\textthreequarters' : '\U000000be',
300
+ '\\textordfeminine' : '\U000000aa',
301
+ '\\textordmasculine' : '\U000000ba',
302
+ '\\euro' : '\U000020ac',
303
+ '\\pounds' : '\U000000a3',
304
+ '\\yen' : '\U000000a5',
305
+ '\\textcent' : '\U000000a2',
306
+ '\\textcurrency' : '\U000000a4',
307
+ '\\textdegree' : '\U000000b0',
308
+ }
309
+
310
+ isabelle_symbols = {
311
+ '\\<zero>' : '\U0001d7ec',
312
+ '\\<one>' : '\U0001d7ed',
313
+ '\\<two>' : '\U0001d7ee',
314
+ '\\<three>' : '\U0001d7ef',
315
+ '\\<four>' : '\U0001d7f0',
316
+ '\\<five>' : '\U0001d7f1',
317
+ '\\<six>' : '\U0001d7f2',
318
+ '\\<seven>' : '\U0001d7f3',
319
+ '\\<eight>' : '\U0001d7f4',
320
+ '\\<nine>' : '\U0001d7f5',
321
+ '\\<A>' : '\U0001d49c',
322
+ '\\<B>' : '\U0000212c',
323
+ '\\<C>' : '\U0001d49e',
324
+ '\\<D>' : '\U0001d49f',
325
+ '\\<E>' : '\U00002130',
326
+ '\\<F>' : '\U00002131',
327
+ '\\<G>' : '\U0001d4a2',
328
+ '\\<H>' : '\U0000210b',
329
+ '\\<I>' : '\U00002110',
330
+ '\\<J>' : '\U0001d4a5',
331
+ '\\<K>' : '\U0001d4a6',
332
+ '\\<L>' : '\U00002112',
333
+ '\\<M>' : '\U00002133',
334
+ '\\<N>' : '\U0001d4a9',
335
+ '\\<O>' : '\U0001d4aa',
336
+ '\\<P>' : '\U0001d4ab',
337
+ '\\<Q>' : '\U0001d4ac',
338
+ '\\<R>' : '\U0000211b',
339
+ '\\<S>' : '\U0001d4ae',
340
+ '\\<T>' : '\U0001d4af',
341
+ '\\<U>' : '\U0001d4b0',
342
+ '\\<V>' : '\U0001d4b1',
343
+ '\\<W>' : '\U0001d4b2',
344
+ '\\<X>' : '\U0001d4b3',
345
+ '\\<Y>' : '\U0001d4b4',
346
+ '\\<Z>' : '\U0001d4b5',
347
+ '\\<a>' : '\U0001d5ba',
348
+ '\\<b>' : '\U0001d5bb',
349
+ '\\<c>' : '\U0001d5bc',
350
+ '\\<d>' : '\U0001d5bd',
351
+ '\\<e>' : '\U0001d5be',
352
+ '\\<f>' : '\U0001d5bf',
353
+ '\\<g>' : '\U0001d5c0',
354
+ '\\<h>' : '\U0001d5c1',
355
+ '\\<i>' : '\U0001d5c2',
356
+ '\\<j>' : '\U0001d5c3',
357
+ '\\<k>' : '\U0001d5c4',
358
+ '\\<l>' : '\U0001d5c5',
359
+ '\\<m>' : '\U0001d5c6',
360
+ '\\<n>' : '\U0001d5c7',
361
+ '\\<o>' : '\U0001d5c8',
362
+ '\\<p>' : '\U0001d5c9',
363
+ '\\<q>' : '\U0001d5ca',
364
+ '\\<r>' : '\U0001d5cb',
365
+ '\\<s>' : '\U0001d5cc',
366
+ '\\<t>' : '\U0001d5cd',
367
+ '\\<u>' : '\U0001d5ce',
368
+ '\\<v>' : '\U0001d5cf',
369
+ '\\<w>' : '\U0001d5d0',
370
+ '\\<x>' : '\U0001d5d1',
371
+ '\\<y>' : '\U0001d5d2',
372
+ '\\<z>' : '\U0001d5d3',
373
+ '\\<AA>' : '\U0001d504',
374
+ '\\<BB>' : '\U0001d505',
375
+ '\\<CC>' : '\U0000212d',
376
+ '\\<DD>' : '\U0001d507',
377
+ '\\<EE>' : '\U0001d508',
378
+ '\\<FF>' : '\U0001d509',
379
+ '\\<GG>' : '\U0001d50a',
380
+ '\\<HH>' : '\U0000210c',
381
+ '\\<II>' : '\U00002111',
382
+ '\\<JJ>' : '\U0001d50d',
383
+ '\\<KK>' : '\U0001d50e',
384
+ '\\<LL>' : '\U0001d50f',
385
+ '\\<MM>' : '\U0001d510',
386
+ '\\<NN>' : '\U0001d511',
387
+ '\\<OO>' : '\U0001d512',
388
+ '\\<PP>' : '\U0001d513',
389
+ '\\<QQ>' : '\U0001d514',
390
+ '\\<RR>' : '\U0000211c',
391
+ '\\<SS>' : '\U0001d516',
392
+ '\\<TT>' : '\U0001d517',
393
+ '\\<UU>' : '\U0001d518',
394
+ '\\<VV>' : '\U0001d519',
395
+ '\\<WW>' : '\U0001d51a',
396
+ '\\<XX>' : '\U0001d51b',
397
+ '\\<YY>' : '\U0001d51c',
398
+ '\\<ZZ>' : '\U00002128',
399
+ '\\<aa>' : '\U0001d51e',
400
+ '\\<bb>' : '\U0001d51f',
401
+ '\\<cc>' : '\U0001d520',
402
+ '\\<dd>' : '\U0001d521',
403
+ '\\<ee>' : '\U0001d522',
404
+ '\\<ff>' : '\U0001d523',
405
+ '\\<gg>' : '\U0001d524',
406
+ '\\<hh>' : '\U0001d525',
407
+ '\\<ii>' : '\U0001d526',
408
+ '\\<jj>' : '\U0001d527',
409
+ '\\<kk>' : '\U0001d528',
410
+ '\\<ll>' : '\U0001d529',
411
+ '\\<mm>' : '\U0001d52a',
412
+ '\\<nn>' : '\U0001d52b',
413
+ '\\<oo>' : '\U0001d52c',
414
+ '\\<pp>' : '\U0001d52d',
415
+ '\\<qq>' : '\U0001d52e',
416
+ '\\<rr>' : '\U0001d52f',
417
+ '\\<ss>' : '\U0001d530',
418
+ '\\<tt>' : '\U0001d531',
419
+ '\\<uu>' : '\U0001d532',
420
+ '\\<vv>' : '\U0001d533',
421
+ '\\<ww>' : '\U0001d534',
422
+ '\\<xx>' : '\U0001d535',
423
+ '\\<yy>' : '\U0001d536',
424
+ '\\<zz>' : '\U0001d537',
425
+ '\\<alpha>' : '\U000003b1',
426
+ '\\<beta>' : '\U000003b2',
427
+ '\\<gamma>' : '\U000003b3',
428
+ '\\<delta>' : '\U000003b4',
429
+ '\\<epsilon>' : '\U000003b5',
430
+ '\\<zeta>' : '\U000003b6',
431
+ '\\<eta>' : '\U000003b7',
432
+ '\\<theta>' : '\U000003b8',
433
+ '\\<iota>' : '\U000003b9',
434
+ '\\<kappa>' : '\U000003ba',
435
+ '\\<lambda>' : '\U000003bb',
436
+ '\\<mu>' : '\U000003bc',
437
+ '\\<nu>' : '\U000003bd',
438
+ '\\<xi>' : '\U000003be',
439
+ '\\<pi>' : '\U000003c0',
440
+ '\\<rho>' : '\U000003c1',
441
+ '\\<sigma>' : '\U000003c3',
442
+ '\\<tau>' : '\U000003c4',
443
+ '\\<upsilon>' : '\U000003c5',
444
+ '\\<phi>' : '\U000003c6',
445
+ '\\<chi>' : '\U000003c7',
446
+ '\\<psi>' : '\U000003c8',
447
+ '\\<omega>' : '\U000003c9',
448
+ '\\<Gamma>' : '\U00000393',
449
+ '\\<Delta>' : '\U00000394',
450
+ '\\<Theta>' : '\U00000398',
451
+ '\\<Lambda>' : '\U0000039b',
452
+ '\\<Xi>' : '\U0000039e',
453
+ '\\<Pi>' : '\U000003a0',
454
+ '\\<Sigma>' : '\U000003a3',
455
+ '\\<Upsilon>' : '\U000003a5',
456
+ '\\<Phi>' : '\U000003a6',
457
+ '\\<Psi>' : '\U000003a8',
458
+ '\\<Omega>' : '\U000003a9',
459
+ '\\<bool>' : '\U0001d539',
460
+ '\\<complex>' : '\U00002102',
461
+ '\\<nat>' : '\U00002115',
462
+ '\\<rat>' : '\U0000211a',
463
+ '\\<real>' : '\U0000211d',
464
+ '\\<int>' : '\U00002124',
465
+ '\\<leftarrow>' : '\U00002190',
466
+ '\\<longleftarrow>' : '\U000027f5',
467
+ '\\<rightarrow>' : '\U00002192',
468
+ '\\<longrightarrow>' : '\U000027f6',
469
+ '\\<Leftarrow>' : '\U000021d0',
470
+ '\\<Longleftarrow>' : '\U000027f8',
471
+ '\\<Rightarrow>' : '\U000021d2',
472
+ '\\<Longrightarrow>' : '\U000027f9',
473
+ '\\<leftrightarrow>' : '\U00002194',
474
+ '\\<longleftrightarrow>' : '\U000027f7',
475
+ '\\<Leftrightarrow>' : '\U000021d4',
476
+ '\\<Longleftrightarrow>' : '\U000027fa',
477
+ '\\<mapsto>' : '\U000021a6',
478
+ '\\<longmapsto>' : '\U000027fc',
479
+ '\\<midarrow>' : '\U00002500',
480
+ '\\<Midarrow>' : '\U00002550',
481
+ '\\<hookleftarrow>' : '\U000021a9',
482
+ '\\<hookrightarrow>' : '\U000021aa',
483
+ '\\<leftharpoondown>' : '\U000021bd',
484
+ '\\<rightharpoondown>' : '\U000021c1',
485
+ '\\<leftharpoonup>' : '\U000021bc',
486
+ '\\<rightharpoonup>' : '\U000021c0',
487
+ '\\<rightleftharpoons>' : '\U000021cc',
488
+ '\\<leadsto>' : '\U0000219d',
489
+ '\\<downharpoonleft>' : '\U000021c3',
490
+ '\\<downharpoonright>' : '\U000021c2',
491
+ '\\<upharpoonleft>' : '\U000021bf',
492
+ '\\<upharpoonright>' : '\U000021be',
493
+ '\\<restriction>' : '\U000021be',
494
+ '\\<Colon>' : '\U00002237',
495
+ '\\<up>' : '\U00002191',
496
+ '\\<Up>' : '\U000021d1',
497
+ '\\<down>' : '\U00002193',
498
+ '\\<Down>' : '\U000021d3',
499
+ '\\<updown>' : '\U00002195',
500
+ '\\<Updown>' : '\U000021d5',
501
+ '\\<langle>' : '\U000027e8',
502
+ '\\<rangle>' : '\U000027e9',
503
+ '\\<lceil>' : '\U00002308',
504
+ '\\<rceil>' : '\U00002309',
505
+ '\\<lfloor>' : '\U0000230a',
506
+ '\\<rfloor>' : '\U0000230b',
507
+ '\\<lparr>' : '\U00002987',
508
+ '\\<rparr>' : '\U00002988',
509
+ '\\<lbrakk>' : '\U000027e6',
510
+ '\\<rbrakk>' : '\U000027e7',
511
+ '\\<lbrace>' : '\U00002983',
512
+ '\\<rbrace>' : '\U00002984',
513
+ '\\<guillemotleft>' : '\U000000ab',
514
+ '\\<guillemotright>' : '\U000000bb',
515
+ '\\<bottom>' : '\U000022a5',
516
+ '\\<top>' : '\U000022a4',
517
+ '\\<and>' : '\U00002227',
518
+ '\\<And>' : '\U000022c0',
519
+ '\\<or>' : '\U00002228',
520
+ '\\<Or>' : '\U000022c1',
521
+ '\\<forall>' : '\U00002200',
522
+ '\\<exists>' : '\U00002203',
523
+ '\\<nexists>' : '\U00002204',
524
+ '\\<not>' : '\U000000ac',
525
+ '\\<box>' : '\U000025a1',
526
+ '\\<diamond>' : '\U000025c7',
527
+ '\\<turnstile>' : '\U000022a2',
528
+ '\\<Turnstile>' : '\U000022a8',
529
+ '\\<tturnstile>' : '\U000022a9',
530
+ '\\<TTurnstile>' : '\U000022ab',
531
+ '\\<stileturn>' : '\U000022a3',
532
+ '\\<surd>' : '\U0000221a',
533
+ '\\<le>' : '\U00002264',
534
+ '\\<ge>' : '\U00002265',
535
+ '\\<lless>' : '\U0000226a',
536
+ '\\<ggreater>' : '\U0000226b',
537
+ '\\<lesssim>' : '\U00002272',
538
+ '\\<greatersim>' : '\U00002273',
539
+ '\\<lessapprox>' : '\U00002a85',
540
+ '\\<greaterapprox>' : '\U00002a86',
541
+ '\\<in>' : '\U00002208',
542
+ '\\<notin>' : '\U00002209',
543
+ '\\<subset>' : '\U00002282',
544
+ '\\<supset>' : '\U00002283',
545
+ '\\<subseteq>' : '\U00002286',
546
+ '\\<supseteq>' : '\U00002287',
547
+ '\\<sqsubset>' : '\U0000228f',
548
+ '\\<sqsupset>' : '\U00002290',
549
+ '\\<sqsubseteq>' : '\U00002291',
550
+ '\\<sqsupseteq>' : '\U00002292',
551
+ '\\<inter>' : '\U00002229',
552
+ '\\<Inter>' : '\U000022c2',
553
+ '\\<union>' : '\U0000222a',
554
+ '\\<Union>' : '\U000022c3',
555
+ '\\<squnion>' : '\U00002294',
556
+ '\\<Squnion>' : '\U00002a06',
557
+ '\\<sqinter>' : '\U00002293',
558
+ '\\<Sqinter>' : '\U00002a05',
559
+ '\\<setminus>' : '\U00002216',
560
+ '\\<propto>' : '\U0000221d',
561
+ '\\<uplus>' : '\U0000228e',
562
+ '\\<Uplus>' : '\U00002a04',
563
+ '\\<noteq>' : '\U00002260',
564
+ '\\<sim>' : '\U0000223c',
565
+ '\\<doteq>' : '\U00002250',
566
+ '\\<simeq>' : '\U00002243',
567
+ '\\<approx>' : '\U00002248',
568
+ '\\<asymp>' : '\U0000224d',
569
+ '\\<cong>' : '\U00002245',
570
+ '\\<smile>' : '\U00002323',
571
+ '\\<equiv>' : '\U00002261',
572
+ '\\<frown>' : '\U00002322',
573
+ '\\<Join>' : '\U000022c8',
574
+ '\\<bowtie>' : '\U00002a1d',
575
+ '\\<prec>' : '\U0000227a',
576
+ '\\<succ>' : '\U0000227b',
577
+ '\\<preceq>' : '\U0000227c',
578
+ '\\<succeq>' : '\U0000227d',
579
+ '\\<parallel>' : '\U00002225',
580
+ '\\<bar>' : '\U000000a6',
581
+ '\\<plusminus>' : '\U000000b1',
582
+ '\\<minusplus>' : '\U00002213',
583
+ '\\<times>' : '\U000000d7',
584
+ '\\<div>' : '\U000000f7',
585
+ '\\<cdot>' : '\U000022c5',
586
+ '\\<star>' : '\U000022c6',
587
+ '\\<bullet>' : '\U00002219',
588
+ '\\<circ>' : '\U00002218',
589
+ '\\<dagger>' : '\U00002020',
590
+ '\\<ddagger>' : '\U00002021',
591
+ '\\<lhd>' : '\U000022b2',
592
+ '\\<rhd>' : '\U000022b3',
593
+ '\\<unlhd>' : '\U000022b4',
594
+ '\\<unrhd>' : '\U000022b5',
595
+ '\\<triangleleft>' : '\U000025c3',
596
+ '\\<triangleright>' : '\U000025b9',
597
+ '\\<triangle>' : '\U000025b3',
598
+ '\\<triangleq>' : '\U0000225c',
599
+ '\\<oplus>' : '\U00002295',
600
+ '\\<Oplus>' : '\U00002a01',
601
+ '\\<otimes>' : '\U00002297',
602
+ '\\<Otimes>' : '\U00002a02',
603
+ '\\<odot>' : '\U00002299',
604
+ '\\<Odot>' : '\U00002a00',
605
+ '\\<ominus>' : '\U00002296',
606
+ '\\<oslash>' : '\U00002298',
607
+ '\\<dots>' : '\U00002026',
608
+ '\\<cdots>' : '\U000022ef',
609
+ '\\<Sum>' : '\U00002211',
610
+ '\\<Prod>' : '\U0000220f',
611
+ '\\<Coprod>' : '\U00002210',
612
+ '\\<infinity>' : '\U0000221e',
613
+ '\\<integral>' : '\U0000222b',
614
+ '\\<ointegral>' : '\U0000222e',
615
+ '\\<clubsuit>' : '\U00002663',
616
+ '\\<diamondsuit>' : '\U00002662',
617
+ '\\<heartsuit>' : '\U00002661',
618
+ '\\<spadesuit>' : '\U00002660',
619
+ '\\<aleph>' : '\U00002135',
620
+ '\\<emptyset>' : '\U00002205',
621
+ '\\<nabla>' : '\U00002207',
622
+ '\\<partial>' : '\U00002202',
623
+ '\\<flat>' : '\U0000266d',
624
+ '\\<natural>' : '\U0000266e',
625
+ '\\<sharp>' : '\U0000266f',
626
+ '\\<angle>' : '\U00002220',
627
+ '\\<copyright>' : '\U000000a9',
628
+ '\\<registered>' : '\U000000ae',
629
+ '\\<hyphen>' : '\U000000ad',
630
+ '\\<inverse>' : '\U000000af',
631
+ '\\<onequarter>' : '\U000000bc',
632
+ '\\<onehalf>' : '\U000000bd',
633
+ '\\<threequarters>' : '\U000000be',
634
+ '\\<ordfeminine>' : '\U000000aa',
635
+ '\\<ordmasculine>' : '\U000000ba',
636
+ '\\<section>' : '\U000000a7',
637
+ '\\<paragraph>' : '\U000000b6',
638
+ '\\<exclamdown>' : '\U000000a1',
639
+ '\\<questiondown>' : '\U000000bf',
640
+ '\\<euro>' : '\U000020ac',
641
+ '\\<pounds>' : '\U000000a3',
642
+ '\\<yen>' : '\U000000a5',
643
+ '\\<cent>' : '\U000000a2',
644
+ '\\<currency>' : '\U000000a4',
645
+ '\\<degree>' : '\U000000b0',
646
+ '\\<amalg>' : '\U00002a3f',
647
+ '\\<mho>' : '\U00002127',
648
+ '\\<lozenge>' : '\U000025ca',
649
+ '\\<wp>' : '\U00002118',
650
+ '\\<wrong>' : '\U00002240',
651
+ '\\<struct>' : '\U000022c4',
652
+ '\\<acute>' : '\U000000b4',
653
+ '\\<index>' : '\U00000131',
654
+ '\\<dieresis>' : '\U000000a8',
655
+ '\\<cedilla>' : '\U000000b8',
656
+ '\\<hungarumlaut>' : '\U000002dd',
657
+ '\\<some>' : '\U000003f5',
658
+ '\\<newline>' : '\U000023ce',
659
+ '\\<open>' : '\U00002039',
660
+ '\\<close>' : '\U0000203a',
661
+ '\\<here>' : '\U00002302',
662
+ '\\<^sub>' : '\U000021e9',
663
+ '\\<^sup>' : '\U000021e7',
664
+ '\\<^bold>' : '\U00002759',
665
+ '\\<^bsub>' : '\U000021d8',
666
+ '\\<^esub>' : '\U000021d9',
667
+ '\\<^bsup>' : '\U000021d7',
668
+ '\\<^esup>' : '\U000021d6',
669
+ }
670
+
671
+ lang_map = {'isabelle' : isabelle_symbols, 'latex' : latex_symbols}
672
+
673
+ def __init__(self, **options):
674
+ Filter.__init__(self, **options)
675
+ lang = get_choice_opt(options, 'lang',
676
+ ['isabelle', 'latex'], 'isabelle')
677
+ self.symbols = self.lang_map[lang]
678
+
679
+ def filter(self, lexer, stream):
680
+ for ttype, value in stream:
681
+ if value in self.symbols:
682
+ yield ttype, self.symbols[value]
683
+ else:
684
+ yield ttype, value
685
+
686
+
687
+ class KeywordCaseFilter(Filter):
688
+ """Convert keywords to lowercase or uppercase or capitalize them, which
689
+ means first letter uppercase, rest lowercase.
690
+
691
+ This can be useful e.g. if you highlight Pascal code and want to adapt the
692
+ code to your styleguide.
693
+
694
+ Options accepted:
695
+
696
+ `case` : string
697
+ The casing to convert keywords to. Must be one of ``'lower'``,
698
+ ``'upper'`` or ``'capitalize'``. The default is ``'lower'``.
699
+ """
700
+
701
+ def __init__(self, **options):
702
+ Filter.__init__(self, **options)
703
+ case = get_choice_opt(options, 'case',
704
+ ['lower', 'upper', 'capitalize'], 'lower')
705
+ self.convert = getattr(str, case)
706
+
707
+ def filter(self, lexer, stream):
708
+ for ttype, value in stream:
709
+ if ttype in Keyword:
710
+ yield ttype, self.convert(value)
711
+ else:
712
+ yield ttype, value
713
+
714
+
715
+ class NameHighlightFilter(Filter):
716
+ """Highlight a normal Name (and Name.*) token with a different token type.
717
+
718
+ Example::
719
+
720
+ filter = NameHighlightFilter(
721
+ names=['foo', 'bar', 'baz'],
722
+ tokentype=Name.Function,
723
+ )
724
+
725
+ This would highlight the names "foo", "bar" and "baz"
726
+ as functions. `Name.Function` is the default token type.
727
+
728
+ Options accepted:
729
+
730
+ `names` : list of strings
731
+ A list of names that should be given the different token type.
732
+ There is no default.
733
+ `tokentype` : TokenType or string
734
+ A token type or a string containing a token type name that is
735
+ used for highlighting the strings in `names`. The default is
736
+ `Name.Function`.
737
+ """
738
+
739
+ def __init__(self, **options):
740
+ Filter.__init__(self, **options)
741
+ self.names = set(get_list_opt(options, 'names', []))
742
+ tokentype = options.get('tokentype')
743
+ if tokentype:
744
+ self.tokentype = string_to_tokentype(tokentype)
745
+ else:
746
+ self.tokentype = Name.Function
747
+
748
+ def filter(self, lexer, stream):
749
+ for ttype, value in stream:
750
+ if ttype in Name and value in self.names:
751
+ yield self.tokentype, value
752
+ else:
753
+ yield ttype, value
754
+
755
+
756
+ class ErrorToken(Exception):
757
+ pass
758
+
759
+
760
+ class RaiseOnErrorTokenFilter(Filter):
761
+ """Raise an exception when the lexer generates an error token.
762
+
763
+ Options accepted:
764
+
765
+ `excclass` : Exception class
766
+ The exception class to raise.
767
+ The default is `pygments.filters.ErrorToken`.
768
+
769
+ .. versionadded:: 0.8
770
+ """
771
+
772
+ def __init__(self, **options):
773
+ Filter.__init__(self, **options)
774
+ self.exception = options.get('excclass', ErrorToken)
775
+ try:
776
+ # issubclass() will raise TypeError if first argument is not a class
777
+ if not issubclass(self.exception, Exception):
778
+ raise TypeError
779
+ except TypeError:
780
+ raise OptionError('excclass option is not an exception class')
781
+
782
+ def filter(self, lexer, stream):
783
+ for ttype, value in stream:
784
+ if ttype is Error:
785
+ raise self.exception(value)
786
+ yield ttype, value
787
+
788
+
789
+ class VisibleWhitespaceFilter(Filter):
790
+ """Convert tabs, newlines and/or spaces to visible characters.
791
+
792
+ Options accepted:
793
+
794
+ `spaces` : string or bool
795
+ If this is a one-character string, spaces will be replaces by this string.
796
+ If it is another true value, spaces will be replaced by ``·`` (unicode
797
+ MIDDLE DOT). If it is a false value, spaces will not be replaced. The
798
+ default is ``False``.
799
+ `tabs` : string or bool
800
+ The same as for `spaces`, but the default replacement character is ``»``
801
+ (unicode RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK). The default value
802
+ is ``False``. Note: this will not work if the `tabsize` option for the
803
+ lexer is nonzero, as tabs will already have been expanded then.
804
+ `tabsize` : int
805
+ If tabs are to be replaced by this filter (see the `tabs` option), this
806
+ is the total number of characters that a tab should be expanded to.
807
+ The default is ``8``.
808
+ `newlines` : string or bool
809
+ The same as for `spaces`, but the default replacement character is ``¶``
810
+ (unicode PILCROW SIGN). The default value is ``False``.
811
+ `wstokentype` : bool
812
+ If true, give whitespace the special `Whitespace` token type. This allows
813
+ styling the visible whitespace differently (e.g. greyed out), but it can
814
+ disrupt background colors. The default is ``True``.
815
+
816
+ .. versionadded:: 0.8
817
+ """
818
+
819
+ def __init__(self, **options):
820
+ Filter.__init__(self, **options)
821
+ for name, default in [('spaces', '·'),
822
+ ('tabs', '»'),
823
+ ('newlines', '¶')]:
824
+ opt = options.get(name, False)
825
+ if isinstance(opt, str) and len(opt) == 1:
826
+ setattr(self, name, opt)
827
+ else:
828
+ setattr(self, name, (opt and default or ''))
829
+ tabsize = get_int_opt(options, 'tabsize', 8)
830
+ if self.tabs:
831
+ self.tabs += ' ' * (tabsize - 1)
832
+ if self.newlines:
833
+ self.newlines += '\n'
834
+ self.wstt = get_bool_opt(options, 'wstokentype', True)
835
+
836
+ def filter(self, lexer, stream):
837
+ if self.wstt:
838
+ spaces = self.spaces or ' '
839
+ tabs = self.tabs or '\t'
840
+ newlines = self.newlines or '\n'
841
+ regex = re.compile(r'\s')
842
+
843
+ def replacefunc(wschar):
844
+ if wschar == ' ':
845
+ return spaces
846
+ elif wschar == '\t':
847
+ return tabs
848
+ elif wschar == '\n':
849
+ return newlines
850
+ return wschar
851
+
852
+ for ttype, value in stream:
853
+ yield from _replace_special(ttype, value, regex, Whitespace,
854
+ replacefunc)
855
+ else:
856
+ spaces, tabs, newlines = self.spaces, self.tabs, self.newlines
857
+ # simpler processing
858
+ for ttype, value in stream:
859
+ if spaces:
860
+ value = value.replace(' ', spaces)
861
+ if tabs:
862
+ value = value.replace('\t', tabs)
863
+ if newlines:
864
+ value = value.replace('\n', newlines)
865
+ yield ttype, value
866
+
867
+
868
+ class GobbleFilter(Filter):
869
+ """Gobbles source code lines (eats initial characters).
870
+
871
+ This filter drops the first ``n`` characters off every line of code. This
872
+ may be useful when the source code fed to the lexer is indented by a fixed
873
+ amount of space that isn't desired in the output.
874
+
875
+ Options accepted:
876
+
877
+ `n` : int
878
+ The number of characters to gobble.
879
+
880
+ .. versionadded:: 1.2
881
+ """
882
+ def __init__(self, **options):
883
+ Filter.__init__(self, **options)
884
+ self.n = get_int_opt(options, 'n', 0)
885
+
886
+ def gobble(self, value, left):
887
+ if left < len(value):
888
+ return value[left:], 0
889
+ else:
890
+ return '', left - len(value)
891
+
892
+ def filter(self, lexer, stream):
893
+ n = self.n
894
+ left = n # How many characters left to gobble.
895
+ for ttype, value in stream:
896
+ # Remove ``left`` tokens from first line, ``n`` from all others.
897
+ parts = value.split('\n')
898
+ (parts[0], left) = self.gobble(parts[0], left)
899
+ for i in range(1, len(parts)):
900
+ (parts[i], left) = self.gobble(parts[i], n)
901
+ value = '\n'.join(parts)
902
+
903
+ if value != '':
904
+ yield ttype, value
905
+
906
+
907
+ class TokenMergeFilter(Filter):
908
+ """Merges consecutive tokens with the same token type in the output
909
+ stream of a lexer.
910
+
911
+ .. versionadded:: 1.2
912
+ """
913
+ def __init__(self, **options):
914
+ Filter.__init__(self, **options)
915
+
916
+ def filter(self, lexer, stream):
917
+ current_type = None
918
+ current_value = None
919
+ for ttype, value in stream:
920
+ if ttype is current_type:
921
+ current_value += value
922
+ else:
923
+ if current_type is not None:
924
+ yield current_type, current_value
925
+ current_type = ttype
926
+ current_value = value
927
+ if current_type is not None:
928
+ yield current_type, current_value
929
+
930
+
931
+ FILTERS = {
932
+ 'codetagify': CodeTagFilter,
933
+ 'keywordcase': KeywordCaseFilter,
934
+ 'highlight': NameHighlightFilter,
935
+ 'raiseonerror': RaiseOnErrorTokenFilter,
936
+ 'whitespace': VisibleWhitespaceFilter,
937
+ 'gobble': GobbleFilter,
938
+ 'tokenmerge': TokenMergeFilter,
939
+ 'symbols': SymbolFilter,
940
+ }
evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (4.96 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/__pycache__/groff.cpython-310.pyc ADDED
Binary file (4.37 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/__pycache__/latex.cpython-310.pyc ADDED
Binary file (13.8 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/__pycache__/rtf.cpython-310.pyc ADDED
Binary file (8.8 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/__pycache__/terminal.cpython-310.pyc ADDED
Binary file (3.93 kB). View file
 
evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/_mapping.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Automatically generated by scripts/gen_mapfiles.py.
2
+ # DO NOT EDIT BY HAND; run `tox -e mapfiles` instead.
3
+
4
+ FORMATTERS = {
5
+ 'BBCodeFormatter': ('pygments.formatters.bbcode', 'BBCode', ('bbcode', 'bb'), (), 'Format tokens with BBcodes. These formatting codes are used by many bulletin boards, so you can highlight your sourcecode with pygments before posting it there.'),
6
+ 'BmpImageFormatter': ('pygments.formatters.img', 'img_bmp', ('bmp', 'bitmap'), ('*.bmp',), 'Create a bitmap image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'),
7
+ 'GifImageFormatter': ('pygments.formatters.img', 'img_gif', ('gif',), ('*.gif',), 'Create a GIF image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'),
8
+ 'GroffFormatter': ('pygments.formatters.groff', 'groff', ('groff', 'troff', 'roff'), (), 'Format tokens with groff escapes to change their color and font style.'),
9
+ 'HtmlFormatter': ('pygments.formatters.html', 'HTML', ('html',), ('*.html', '*.htm'), "Format tokens as HTML 4 ``<span>`` tags. By default, the content is enclosed in a ``<pre>`` tag, itself wrapped in a ``<div>`` tag (but see the `nowrap` option). The ``<div>``'s CSS class can be set by the `cssclass` option."),
10
+ 'IRCFormatter': ('pygments.formatters.irc', 'IRC', ('irc', 'IRC'), (), 'Format tokens with IRC color sequences'),
11
+ 'ImageFormatter': ('pygments.formatters.img', 'img', ('img', 'IMG', 'png'), ('*.png',), 'Create a PNG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'),
12
+ 'JpgImageFormatter': ('pygments.formatters.img', 'img_jpg', ('jpg', 'jpeg'), ('*.jpg',), 'Create a JPEG image from source code. This uses the Python Imaging Library to generate a pixmap from the source code.'),
13
+ 'LatexFormatter': ('pygments.formatters.latex', 'LaTeX', ('latex', 'tex'), ('*.tex',), 'Format tokens as LaTeX code. This needs the `fancyvrb` and `color` standard packages.'),
14
+ 'NullFormatter': ('pygments.formatters.other', 'Text only', ('text', 'null'), ('*.txt',), 'Output the text unchanged without any formatting.'),
15
+ 'PangoMarkupFormatter': ('pygments.formatters.pangomarkup', 'Pango Markup', ('pango', 'pangomarkup'), (), 'Format tokens as Pango Markup code. It can then be rendered to an SVG.'),
16
+ 'RawTokenFormatter': ('pygments.formatters.other', 'Raw tokens', ('raw', 'tokens'), ('*.raw',), 'Format tokens as a raw representation for storing token streams.'),
17
+ 'RtfFormatter': ('pygments.formatters.rtf', 'RTF', ('rtf',), ('*.rtf',), 'Format tokens as RTF markup. This formatter automatically outputs full RTF documents with color information and other useful stuff. Perfect for Copy and Paste into Microsoft(R) Word(R) documents.'),
18
+ 'SvgFormatter': ('pygments.formatters.svg', 'SVG', ('svg',), ('*.svg',), 'Format tokens as an SVG graphics file. This formatter is still experimental. Each line of code is a ``<text>`` element with explicit ``x`` and ``y`` coordinates containing ``<tspan>`` elements with the individual token styles.'),
19
+ 'Terminal256Formatter': ('pygments.formatters.terminal256', 'Terminal256', ('terminal256', 'console256', '256'), (), 'Format tokens with ANSI color sequences, for output in a 256-color terminal or console. Like in `TerminalFormatter` color sequences are terminated at newlines, so that paging the output works correctly.'),
20
+ 'TerminalFormatter': ('pygments.formatters.terminal', 'Terminal', ('terminal', 'console'), (), 'Format tokens with ANSI color sequences, for output in a text console. Color sequences are terminated at newlines, so that paging the output works correctly.'),
21
+ 'TerminalTrueColorFormatter': ('pygments.formatters.terminal256', 'TerminalTrueColor', ('terminal16m', 'console16m', '16m'), (), 'Format tokens with ANSI color sequences, for output in a true-color terminal or console. Like in `TerminalFormatter` color sequences are terminated at newlines, so that paging the output works correctly.'),
22
+ 'TestcaseFormatter': ('pygments.formatters.other', 'Testcase', ('testcase',), (), 'Format tokens as appropriate for a new testcase.'),
23
+ }
evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/bbcode.py ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.formatters.bbcode
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ BBcode formatter.
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+
12
+ from pygments.formatter import Formatter
13
+ from pygments.util import get_bool_opt
14
+
15
+ __all__ = ['BBCodeFormatter']
16
+
17
+
18
+ class BBCodeFormatter(Formatter):
19
+ """
20
+ Format tokens with BBcodes. These formatting codes are used by many
21
+ bulletin boards, so you can highlight your sourcecode with pygments before
22
+ posting it there.
23
+
24
+ This formatter has no support for background colors and borders, as there
25
+ are no common BBcode tags for that.
26
+
27
+ Some board systems (e.g. phpBB) don't support colors in their [code] tag,
28
+ so you can't use the highlighting together with that tag.
29
+ Text in a [code] tag usually is shown with a monospace font (which this
30
+ formatter can do with the ``monofont`` option) and no spaces (which you
31
+ need for indentation) are removed.
32
+
33
+ Additional options accepted:
34
+
35
+ `style`
36
+ The style to use, can be a string or a Style subclass (default:
37
+ ``'default'``).
38
+
39
+ `codetag`
40
+ If set to true, put the output into ``[code]`` tags (default:
41
+ ``false``)
42
+
43
+ `monofont`
44
+ If set to true, add a tag to show the code with a monospace font
45
+ (default: ``false``).
46
+ """
47
+ name = 'BBCode'
48
+ aliases = ['bbcode', 'bb']
49
+ filenames = []
50
+
51
+ def __init__(self, **options):
52
+ Formatter.__init__(self, **options)
53
+ self._code = get_bool_opt(options, 'codetag', False)
54
+ self._mono = get_bool_opt(options, 'monofont', False)
55
+
56
+ self.styles = {}
57
+ self._make_styles()
58
+
59
+ def _make_styles(self):
60
+ for ttype, ndef in self.style:
61
+ start = end = ''
62
+ if ndef['color']:
63
+ start += '[color=#{}]'.format(ndef['color'])
64
+ end = '[/color]' + end
65
+ if ndef['bold']:
66
+ start += '[b]'
67
+ end = '[/b]' + end
68
+ if ndef['italic']:
69
+ start += '[i]'
70
+ end = '[/i]' + end
71
+ if ndef['underline']:
72
+ start += '[u]'
73
+ end = '[/u]' + end
74
+ # there are no common BBcodes for background-color and border
75
+
76
+ self.styles[ttype] = start, end
77
+
78
+ def format_unencoded(self, tokensource, outfile):
79
+ if self._code:
80
+ outfile.write('[code]')
81
+ if self._mono:
82
+ outfile.write('[font=monospace]')
83
+
84
+ lastval = ''
85
+ lasttype = None
86
+
87
+ for ttype, value in tokensource:
88
+ while ttype not in self.styles:
89
+ ttype = ttype.parent
90
+ if ttype == lasttype:
91
+ lastval += value
92
+ else:
93
+ if lastval:
94
+ start, end = self.styles[lasttype]
95
+ outfile.write(''.join((start, lastval, end)))
96
+ lastval = value
97
+ lasttype = ttype
98
+
99
+ if lastval:
100
+ start, end = self.styles[lasttype]
101
+ outfile.write(''.join((start, lastval, end)))
102
+
103
+ if self._mono:
104
+ outfile.write('[/font]')
105
+ if self._code:
106
+ outfile.write('[/code]')
107
+ if self._code or self._mono:
108
+ outfile.write('\n')
evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/html.py ADDED
@@ -0,0 +1,987 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.formatters.html
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Formatter for HTML output.
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import functools
12
+ import os
13
+ import sys
14
+ import os.path
15
+ from io import StringIO
16
+
17
+ from pygments.formatter import Formatter
18
+ from pygments.token import Token, Text, STANDARD_TYPES
19
+ from pygments.util import get_bool_opt, get_int_opt, get_list_opt
20
+
21
+ try:
22
+ import ctags
23
+ except ImportError:
24
+ ctags = None
25
+
26
+ __all__ = ['HtmlFormatter']
27
+
28
+
29
+ _escape_html_table = {
30
+ ord('&'): '&amp;',
31
+ ord('<'): '&lt;',
32
+ ord('>'): '&gt;',
33
+ ord('"'): '&quot;',
34
+ ord("'"): '&#39;',
35
+ }
36
+
37
+
38
+ def escape_html(text, table=_escape_html_table):
39
+ """Escape &, <, > as well as single and double quotes for HTML."""
40
+ return text.translate(table)
41
+
42
+
43
+ def webify(color):
44
+ if color.startswith('calc') or color.startswith('var'):
45
+ return color
46
+ else:
47
+ return '#' + color
48
+
49
+
50
+ def _get_ttype_class(ttype):
51
+ fname = STANDARD_TYPES.get(ttype)
52
+ if fname:
53
+ return fname
54
+ aname = ''
55
+ while fname is None:
56
+ aname = '-' + ttype[-1] + aname
57
+ ttype = ttype.parent
58
+ fname = STANDARD_TYPES.get(ttype)
59
+ return fname + aname
60
+
61
+
62
+ CSSFILE_TEMPLATE = '''\
63
+ /*
64
+ generated by Pygments <https://pygments.org/>
65
+ Copyright 2006-2024 by the Pygments team.
66
+ Licensed under the BSD license, see LICENSE for details.
67
+ */
68
+ %(styledefs)s
69
+ '''
70
+
71
+ DOC_HEADER = '''\
72
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
73
+ "http://www.w3.org/TR/html4/strict.dtd">
74
+ <!--
75
+ generated by Pygments <https://pygments.org/>
76
+ Copyright 2006-2024 by the Pygments team.
77
+ Licensed under the BSD license, see LICENSE for details.
78
+ -->
79
+ <html>
80
+ <head>
81
+ <title>%(title)s</title>
82
+ <meta http-equiv="content-type" content="text/html; charset=%(encoding)s">
83
+ <style type="text/css">
84
+ ''' + CSSFILE_TEMPLATE + '''
85
+ </style>
86
+ </head>
87
+ <body>
88
+ <h2>%(title)s</h2>
89
+
90
+ '''
91
+
92
+ DOC_HEADER_EXTERNALCSS = '''\
93
+ <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
94
+ "http://www.w3.org/TR/html4/strict.dtd">
95
+
96
+ <html>
97
+ <head>
98
+ <title>%(title)s</title>
99
+ <meta http-equiv="content-type" content="text/html; charset=%(encoding)s">
100
+ <link rel="stylesheet" href="%(cssfile)s" type="text/css">
101
+ </head>
102
+ <body>
103
+ <h2>%(title)s</h2>
104
+
105
+ '''
106
+
107
+ DOC_FOOTER = '''\
108
+ </body>
109
+ </html>
110
+ '''
111
+
112
+
113
+ class HtmlFormatter(Formatter):
114
+ r"""
115
+ Format tokens as HTML 4 ``<span>`` tags. By default, the content is enclosed
116
+ in a ``<pre>`` tag, itself wrapped in a ``<div>`` tag (but see the `nowrap` option).
117
+ The ``<div>``'s CSS class can be set by the `cssclass` option.
118
+
119
+ If the `linenos` option is set to ``"table"``, the ``<pre>`` is
120
+ additionally wrapped inside a ``<table>`` which has one row and two
121
+ cells: one containing the line numbers and one containing the code.
122
+ Example:
123
+
124
+ .. sourcecode:: html
125
+
126
+ <div class="highlight" >
127
+ <table><tr>
128
+ <td class="linenos" title="click to toggle"
129
+ onclick="with (this.firstChild.style)
130
+ { display = (display == '') ? 'none' : '' }">
131
+ <pre>1
132
+ 2</pre>
133
+ </td>
134
+ <td class="code">
135
+ <pre><span class="Ke">def </span><span class="NaFu">foo</span>(bar):
136
+ <span class="Ke">pass</span>
137
+ </pre>
138
+ </td>
139
+ </tr></table></div>
140
+
141
+ (whitespace added to improve clarity).
142
+
143
+ A list of lines can be specified using the `hl_lines` option to make these
144
+ lines highlighted (as of Pygments 0.11).
145
+
146
+ With the `full` option, a complete HTML 4 document is output, including
147
+ the style definitions inside a ``<style>`` tag, or in a separate file if
148
+ the `cssfile` option is given.
149
+
150
+ When `tagsfile` is set to the path of a ctags index file, it is used to
151
+ generate hyperlinks from names to their definition. You must enable
152
+ `lineanchors` and run ctags with the `-n` option for this to work. The
153
+ `python-ctags` module from PyPI must be installed to use this feature;
154
+ otherwise a `RuntimeError` will be raised.
155
+
156
+ The `get_style_defs(arg='')` method of a `HtmlFormatter` returns a string
157
+ containing CSS rules for the CSS classes used by the formatter. The
158
+ argument `arg` can be used to specify additional CSS selectors that
159
+ are prepended to the classes. A call `fmter.get_style_defs('td .code')`
160
+ would result in the following CSS classes:
161
+
162
+ .. sourcecode:: css
163
+
164
+ td .code .kw { font-weight: bold; color: #00FF00 }
165
+ td .code .cm { color: #999999 }
166
+ ...
167
+
168
+ If you have Pygments 0.6 or higher, you can also pass a list or tuple to the
169
+ `get_style_defs()` method to request multiple prefixes for the tokens:
170
+
171
+ .. sourcecode:: python
172
+
173
+ formatter.get_style_defs(['div.syntax pre', 'pre.syntax'])
174
+
175
+ The output would then look like this:
176
+
177
+ .. sourcecode:: css
178
+
179
+ div.syntax pre .kw,
180
+ pre.syntax .kw { font-weight: bold; color: #00FF00 }
181
+ div.syntax pre .cm,
182
+ pre.syntax .cm { color: #999999 }
183
+ ...
184
+
185
+ Additional options accepted:
186
+
187
+ `nowrap`
188
+ If set to ``True``, don't add a ``<pre>`` and a ``<div>`` tag
189
+ around the tokens. This disables most other options (default: ``False``).
190
+
191
+ `full`
192
+ Tells the formatter to output a "full" document, i.e. a complete
193
+ self-contained document (default: ``False``).
194
+
195
+ `title`
196
+ If `full` is true, the title that should be used to caption the
197
+ document (default: ``''``).
198
+
199
+ `style`
200
+ The style to use, can be a string or a Style subclass (default:
201
+ ``'default'``). This option has no effect if the `cssfile`
202
+ and `noclobber_cssfile` option are given and the file specified in
203
+ `cssfile` exists.
204
+
205
+ `noclasses`
206
+ If set to true, token ``<span>`` tags (as well as line number elements)
207
+ will not use CSS classes, but inline styles. This is not recommended
208
+ for larger pieces of code since it increases output size by quite a bit
209
+ (default: ``False``).
210
+
211
+ `classprefix`
212
+ Since the token types use relatively short class names, they may clash
213
+ with some of your own class names. In this case you can use the
214
+ `classprefix` option to give a string to prepend to all Pygments-generated
215
+ CSS class names for token types.
216
+ Note that this option also affects the output of `get_style_defs()`.
217
+
218
+ `cssclass`
219
+ CSS class for the wrapping ``<div>`` tag (default: ``'highlight'``).
220
+ If you set this option, the default selector for `get_style_defs()`
221
+ will be this class.
222
+
223
+ .. versionadded:: 0.9
224
+ If you select the ``'table'`` line numbers, the wrapping table will
225
+ have a CSS class of this string plus ``'table'``, the default is
226
+ accordingly ``'highlighttable'``.
227
+
228
+ `cssstyles`
229
+ Inline CSS styles for the wrapping ``<div>`` tag (default: ``''``).
230
+
231
+ `prestyles`
232
+ Inline CSS styles for the ``<pre>`` tag (default: ``''``).
233
+
234
+ .. versionadded:: 0.11
235
+
236
+ `cssfile`
237
+ If the `full` option is true and this option is given, it must be the
238
+ name of an external file. If the filename does not include an absolute
239
+ path, the file's path will be assumed to be relative to the main output
240
+ file's path, if the latter can be found. The stylesheet is then written
241
+ to this file instead of the HTML file.
242
+
243
+ .. versionadded:: 0.6
244
+
245
+ `noclobber_cssfile`
246
+ If `cssfile` is given and the specified file exists, the css file will
247
+ not be overwritten. This allows the use of the `full` option in
248
+ combination with a user specified css file. Default is ``False``.
249
+
250
+ .. versionadded:: 1.1
251
+
252
+ `linenos`
253
+ If set to ``'table'``, output line numbers as a table with two cells,
254
+ one containing the line numbers, the other the whole code. This is
255
+ copy-and-paste-friendly, but may cause alignment problems with some
256
+ browsers or fonts. If set to ``'inline'``, the line numbers will be
257
+ integrated in the ``<pre>`` tag that contains the code (that setting
258
+ is *new in Pygments 0.8*).
259
+
260
+ For compatibility with Pygments 0.7 and earlier, every true value
261
+ except ``'inline'`` means the same as ``'table'`` (in particular, that
262
+ means also ``True``).
263
+
264
+ The default value is ``False``, which means no line numbers at all.
265
+
266
+ **Note:** with the default ("table") line number mechanism, the line
267
+ numbers and code can have different line heights in Internet Explorer
268
+ unless you give the enclosing ``<pre>`` tags an explicit ``line-height``
269
+ CSS property (you get the default line spacing with ``line-height:
270
+ 125%``).
271
+
272
+ `hl_lines`
273
+ Specify a list of lines to be highlighted. The line numbers are always
274
+ relative to the input (i.e. the first line is line 1) and are
275
+ independent of `linenostart`.
276
+
277
+ .. versionadded:: 0.11
278
+
279
+ `linenostart`
280
+ The line number for the first line (default: ``1``).
281
+
282
+ `linenostep`
283
+ If set to a number n > 1, only every nth line number is printed.
284
+
285
+ `linenospecial`
286
+ If set to a number n > 0, every nth line number is given the CSS
287
+ class ``"special"`` (default: ``0``).
288
+
289
+ `nobackground`
290
+ If set to ``True``, the formatter won't output the background color
291
+ for the wrapping element (this automatically defaults to ``False``
292
+ when there is no wrapping element [eg: no argument for the
293
+ `get_syntax_defs` method given]) (default: ``False``).
294
+
295
+ .. versionadded:: 0.6
296
+
297
+ `lineseparator`
298
+ This string is output between lines of code. It defaults to ``"\n"``,
299
+ which is enough to break a line inside ``<pre>`` tags, but you can
300
+ e.g. set it to ``"<br>"`` to get HTML line breaks.
301
+
302
+ .. versionadded:: 0.7
303
+
304
+ `lineanchors`
305
+ If set to a nonempty string, e.g. ``foo``, the formatter will wrap each
306
+ output line in an anchor tag with an ``id`` (and `name`) of ``foo-linenumber``.
307
+ This allows easy linking to certain lines.
308
+
309
+ .. versionadded:: 0.9
310
+
311
+ `linespans`
312
+ If set to a nonempty string, e.g. ``foo``, the formatter will wrap each
313
+ output line in a span tag with an ``id`` of ``foo-linenumber``.
314
+ This allows easy access to lines via javascript.
315
+
316
+ .. versionadded:: 1.6
317
+
318
+ `anchorlinenos`
319
+ If set to `True`, will wrap line numbers in <a> tags. Used in
320
+ combination with `linenos` and `lineanchors`.
321
+
322
+ `tagsfile`
323
+ If set to the path of a ctags file, wrap names in anchor tags that
324
+ link to their definitions. `lineanchors` should be used, and the
325
+ tags file should specify line numbers (see the `-n` option to ctags).
326
+ The tags file is assumed to be encoded in UTF-8.
327
+
328
+ .. versionadded:: 1.6
329
+
330
+ `tagurlformat`
331
+ A string formatting pattern used to generate links to ctags definitions.
332
+ Available variables are `%(path)s`, `%(fname)s` and `%(fext)s`.
333
+ Defaults to an empty string, resulting in just `#prefix-number` links.
334
+
335
+ .. versionadded:: 1.6
336
+
337
+ `filename`
338
+ A string used to generate a filename when rendering ``<pre>`` blocks,
339
+ for example if displaying source code. If `linenos` is set to
340
+ ``'table'`` then the filename will be rendered in an initial row
341
+ containing a single `<th>` which spans both columns.
342
+
343
+ .. versionadded:: 2.1
344
+
345
+ `wrapcode`
346
+ Wrap the code inside ``<pre>`` blocks using ``<code>``, as recommended
347
+ by the HTML5 specification.
348
+
349
+ .. versionadded:: 2.4
350
+
351
+ `debug_token_types`
352
+ Add ``title`` attributes to all token ``<span>`` tags that show the
353
+ name of the token.
354
+
355
+ .. versionadded:: 2.10
356
+
357
+
358
+ **Subclassing the HTML formatter**
359
+
360
+ .. versionadded:: 0.7
361
+
362
+ The HTML formatter is now built in a way that allows easy subclassing, thus
363
+ customizing the output HTML code. The `format()` method calls
364
+ `self._format_lines()` which returns a generator that yields tuples of ``(1,
365
+ line)``, where the ``1`` indicates that the ``line`` is a line of the
366
+ formatted source code.
367
+
368
+ If the `nowrap` option is set, the generator is the iterated over and the
369
+ resulting HTML is output.
370
+
371
+ Otherwise, `format()` calls `self.wrap()`, which wraps the generator with
372
+ other generators. These may add some HTML code to the one generated by
373
+ `_format_lines()`, either by modifying the lines generated by the latter,
374
+ then yielding them again with ``(1, line)``, and/or by yielding other HTML
375
+ code before or after the lines, with ``(0, html)``. The distinction between
376
+ source lines and other code makes it possible to wrap the generator multiple
377
+ times.
378
+
379
+ The default `wrap()` implementation adds a ``<div>`` and a ``<pre>`` tag.
380
+
381
+ A custom `HtmlFormatter` subclass could look like this:
382
+
383
+ .. sourcecode:: python
384
+
385
+ class CodeHtmlFormatter(HtmlFormatter):
386
+
387
+ def wrap(self, source, *, include_div):
388
+ return self._wrap_code(source)
389
+
390
+ def _wrap_code(self, source):
391
+ yield 0, '<code>'
392
+ for i, t in source:
393
+ if i == 1:
394
+ # it's a line of formatted code
395
+ t += '<br>'
396
+ yield i, t
397
+ yield 0, '</code>'
398
+
399
+ This results in wrapping the formatted lines with a ``<code>`` tag, where the
400
+ source lines are broken using ``<br>`` tags.
401
+
402
+ After calling `wrap()`, the `format()` method also adds the "line numbers"
403
+ and/or "full document" wrappers if the respective options are set. Then, all
404
+ HTML yielded by the wrapped generator is output.
405
+ """
406
+
407
+ name = 'HTML'
408
+ aliases = ['html']
409
+ filenames = ['*.html', '*.htm']
410
+
411
+ def __init__(self, **options):
412
+ Formatter.__init__(self, **options)
413
+ self.title = self._decodeifneeded(self.title)
414
+ self.nowrap = get_bool_opt(options, 'nowrap', False)
415
+ self.noclasses = get_bool_opt(options, 'noclasses', False)
416
+ self.classprefix = options.get('classprefix', '')
417
+ self.cssclass = self._decodeifneeded(options.get('cssclass', 'highlight'))
418
+ self.cssstyles = self._decodeifneeded(options.get('cssstyles', ''))
419
+ self.prestyles = self._decodeifneeded(options.get('prestyles', ''))
420
+ self.cssfile = self._decodeifneeded(options.get('cssfile', ''))
421
+ self.noclobber_cssfile = get_bool_opt(options, 'noclobber_cssfile', False)
422
+ self.tagsfile = self._decodeifneeded(options.get('tagsfile', ''))
423
+ self.tagurlformat = self._decodeifneeded(options.get('tagurlformat', ''))
424
+ self.filename = self._decodeifneeded(options.get('filename', ''))
425
+ self.wrapcode = get_bool_opt(options, 'wrapcode', False)
426
+ self.span_element_openers = {}
427
+ self.debug_token_types = get_bool_opt(options, 'debug_token_types', False)
428
+
429
+ if self.tagsfile:
430
+ if not ctags:
431
+ raise RuntimeError('The "ctags" package must to be installed '
432
+ 'to be able to use the "tagsfile" feature.')
433
+ self._ctags = ctags.CTags(self.tagsfile)
434
+
435
+ linenos = options.get('linenos', False)
436
+ if linenos == 'inline':
437
+ self.linenos = 2
438
+ elif linenos:
439
+ # compatibility with <= 0.7
440
+ self.linenos = 1
441
+ else:
442
+ self.linenos = 0
443
+ self.linenostart = abs(get_int_opt(options, 'linenostart', 1))
444
+ self.linenostep = abs(get_int_opt(options, 'linenostep', 1))
445
+ self.linenospecial = abs(get_int_opt(options, 'linenospecial', 0))
446
+ self.nobackground = get_bool_opt(options, 'nobackground', False)
447
+ self.lineseparator = options.get('lineseparator', '\n')
448
+ self.lineanchors = options.get('lineanchors', '')
449
+ self.linespans = options.get('linespans', '')
450
+ self.anchorlinenos = get_bool_opt(options, 'anchorlinenos', False)
451
+ self.hl_lines = set()
452
+ for lineno in get_list_opt(options, 'hl_lines', []):
453
+ try:
454
+ self.hl_lines.add(int(lineno))
455
+ except ValueError:
456
+ pass
457
+
458
+ self._create_stylesheet()
459
+
460
+ def _get_css_class(self, ttype):
461
+ """Return the css class of this token type prefixed with
462
+ the classprefix option."""
463
+ ttypeclass = _get_ttype_class(ttype)
464
+ if ttypeclass:
465
+ return self.classprefix + ttypeclass
466
+ return ''
467
+
468
+ def _get_css_classes(self, ttype):
469
+ """Return the CSS classes of this token type prefixed with the classprefix option."""
470
+ cls = self._get_css_class(ttype)
471
+ while ttype not in STANDARD_TYPES:
472
+ ttype = ttype.parent
473
+ cls = self._get_css_class(ttype) + ' ' + cls
474
+ return cls or ''
475
+
476
+ def _get_css_inline_styles(self, ttype):
477
+ """Return the inline CSS styles for this token type."""
478
+ cclass = self.ttype2class.get(ttype)
479
+ while cclass is None:
480
+ ttype = ttype.parent
481
+ cclass = self.ttype2class.get(ttype)
482
+ return cclass or ''
483
+
484
+ def _create_stylesheet(self):
485
+ t2c = self.ttype2class = {Token: ''}
486
+ c2s = self.class2style = {}
487
+ for ttype, ndef in self.style:
488
+ name = self._get_css_class(ttype)
489
+ style = ''
490
+ if ndef['color']:
491
+ style += 'color: {}; '.format(webify(ndef['color']))
492
+ if ndef['bold']:
493
+ style += 'font-weight: bold; '
494
+ if ndef['italic']:
495
+ style += 'font-style: italic; '
496
+ if ndef['underline']:
497
+ style += 'text-decoration: underline; '
498
+ if ndef['bgcolor']:
499
+ style += 'background-color: {}; '.format(webify(ndef['bgcolor']))
500
+ if ndef['border']:
501
+ style += 'border: 1px solid {}; '.format(webify(ndef['border']))
502
+ if style:
503
+ t2c[ttype] = name
504
+ # save len(ttype) to enable ordering the styles by
505
+ # hierarchy (necessary for CSS cascading rules!)
506
+ c2s[name] = (style[:-2], ttype, len(ttype))
507
+
508
+ def get_style_defs(self, arg=None):
509
+ """
510
+ Return CSS style definitions for the classes produced by the current
511
+ highlighting style. ``arg`` can be a string or list of selectors to
512
+ insert before the token type classes.
513
+ """
514
+ style_lines = []
515
+
516
+ style_lines.extend(self.get_linenos_style_defs())
517
+ style_lines.extend(self.get_background_style_defs(arg))
518
+ style_lines.extend(self.get_token_style_defs(arg))
519
+
520
+ return '\n'.join(style_lines)
521
+
522
+ def get_token_style_defs(self, arg=None):
523
+ prefix = self.get_css_prefix(arg)
524
+
525
+ styles = [
526
+ (level, ttype, cls, style)
527
+ for cls, (style, ttype, level) in self.class2style.items()
528
+ if cls and style
529
+ ]
530
+ styles.sort()
531
+
532
+ lines = [
533
+ f'{prefix(cls)} {{ {style} }} /* {repr(ttype)[6:]} */'
534
+ for (level, ttype, cls, style) in styles
535
+ ]
536
+
537
+ return lines
538
+
539
+ def get_background_style_defs(self, arg=None):
540
+ prefix = self.get_css_prefix(arg)
541
+ bg_color = self.style.background_color
542
+ hl_color = self.style.highlight_color
543
+
544
+ lines = []
545
+
546
+ if arg and not self.nobackground and bg_color is not None:
547
+ text_style = ''
548
+ if Text in self.ttype2class:
549
+ text_style = ' ' + self.class2style[self.ttype2class[Text]][0]
550
+ lines.insert(
551
+ 0, '{}{{ background: {};{} }}'.format(
552
+ prefix(''), bg_color, text_style
553
+ )
554
+ )
555
+ if hl_color is not None:
556
+ lines.insert(
557
+ 0, '{} {{ background-color: {} }}'.format(prefix('hll'), hl_color)
558
+ )
559
+
560
+ return lines
561
+
562
+ def get_linenos_style_defs(self):
563
+ lines = [
564
+ f'pre {{ {self._pre_style} }}',
565
+ f'td.linenos .normal {{ {self._linenos_style} }}',
566
+ f'span.linenos {{ {self._linenos_style} }}',
567
+ f'td.linenos .special {{ {self._linenos_special_style} }}',
568
+ f'span.linenos.special {{ {self._linenos_special_style} }}',
569
+ ]
570
+
571
+ return lines
572
+
573
+ def get_css_prefix(self, arg):
574
+ if arg is None:
575
+ arg = ('cssclass' in self.options and '.'+self.cssclass or '')
576
+ if isinstance(arg, str):
577
+ args = [arg]
578
+ else:
579
+ args = list(arg)
580
+
581
+ def prefix(cls):
582
+ if cls:
583
+ cls = '.' + cls
584
+ tmp = []
585
+ for arg in args:
586
+ tmp.append((arg and arg + ' ' or '') + cls)
587
+ return ', '.join(tmp)
588
+
589
+ return prefix
590
+
591
+ @property
592
+ def _pre_style(self):
593
+ return 'line-height: 125%;'
594
+
595
+ @property
596
+ def _linenos_style(self):
597
+ color = self.style.line_number_color
598
+ background_color = self.style.line_number_background_color
599
+ return f'color: {color}; background-color: {background_color}; padding-left: 5px; padding-right: 5px;'
600
+
601
+ @property
602
+ def _linenos_special_style(self):
603
+ color = self.style.line_number_special_color
604
+ background_color = self.style.line_number_special_background_color
605
+ return f'color: {color}; background-color: {background_color}; padding-left: 5px; padding-right: 5px;'
606
+
607
+ def _decodeifneeded(self, value):
608
+ if isinstance(value, bytes):
609
+ if self.encoding:
610
+ return value.decode(self.encoding)
611
+ return value.decode()
612
+ return value
613
+
614
+ def _wrap_full(self, inner, outfile):
615
+ if self.cssfile:
616
+ if os.path.isabs(self.cssfile):
617
+ # it's an absolute filename
618
+ cssfilename = self.cssfile
619
+ else:
620
+ try:
621
+ filename = outfile.name
622
+ if not filename or filename[0] == '<':
623
+ # pseudo files, e.g. name == '<fdopen>'
624
+ raise AttributeError
625
+ cssfilename = os.path.join(os.path.dirname(filename),
626
+ self.cssfile)
627
+ except AttributeError:
628
+ print('Note: Cannot determine output file name, '
629
+ 'using current directory as base for the CSS file name',
630
+ file=sys.stderr)
631
+ cssfilename = self.cssfile
632
+ # write CSS file only if noclobber_cssfile isn't given as an option.
633
+ try:
634
+ if not os.path.exists(cssfilename) or not self.noclobber_cssfile:
635
+ with open(cssfilename, "w", encoding="utf-8") as cf:
636
+ cf.write(CSSFILE_TEMPLATE %
637
+ {'styledefs': self.get_style_defs('body')})
638
+ except OSError as err:
639
+ err.strerror = 'Error writing CSS file: ' + err.strerror
640
+ raise
641
+
642
+ yield 0, (DOC_HEADER_EXTERNALCSS %
643
+ dict(title=self.title,
644
+ cssfile=self.cssfile,
645
+ encoding=self.encoding))
646
+ else:
647
+ yield 0, (DOC_HEADER %
648
+ dict(title=self.title,
649
+ styledefs=self.get_style_defs('body'),
650
+ encoding=self.encoding))
651
+
652
+ yield from inner
653
+ yield 0, DOC_FOOTER
654
+
655
+ def _wrap_tablelinenos(self, inner):
656
+ dummyoutfile = StringIO()
657
+ lncount = 0
658
+ for t, line in inner:
659
+ if t:
660
+ lncount += 1
661
+ dummyoutfile.write(line)
662
+
663
+ fl = self.linenostart
664
+ mw = len(str(lncount + fl - 1))
665
+ sp = self.linenospecial
666
+ st = self.linenostep
667
+ anchor_name = self.lineanchors or self.linespans
668
+ aln = self.anchorlinenos
669
+ nocls = self.noclasses
670
+
671
+ lines = []
672
+
673
+ for i in range(fl, fl+lncount):
674
+ print_line = i % st == 0
675
+ special_line = sp and i % sp == 0
676
+
677
+ if print_line:
678
+ line = '%*d' % (mw, i)
679
+ if aln:
680
+ line = '<a href="#%s-%d">%s</a>' % (anchor_name, i, line)
681
+ else:
682
+ line = ' ' * mw
683
+
684
+ if nocls:
685
+ if special_line:
686
+ style = f' style="{self._linenos_special_style}"'
687
+ else:
688
+ style = f' style="{self._linenos_style}"'
689
+ else:
690
+ if special_line:
691
+ style = ' class="special"'
692
+ else:
693
+ style = ' class="normal"'
694
+
695
+ if style:
696
+ line = f'<span{style}>{line}</span>'
697
+
698
+ lines.append(line)
699
+
700
+ ls = '\n'.join(lines)
701
+
702
+ # If a filename was specified, we can't put it into the code table as it
703
+ # would misalign the line numbers. Hence we emit a separate row for it.
704
+ filename_tr = ""
705
+ if self.filename:
706
+ filename_tr = (
707
+ '<tr><th colspan="2" class="filename">'
708
+ '<span class="filename">' + self.filename + '</span>'
709
+ '</th></tr>')
710
+
711
+ # in case you wonder about the seemingly redundant <div> here: since the
712
+ # content in the other cell also is wrapped in a div, some browsers in
713
+ # some configurations seem to mess up the formatting...
714
+ yield 0, (f'<table class="{self.cssclass}table">' + filename_tr +
715
+ '<tr><td class="linenos"><div class="linenodiv"><pre>' +
716
+ ls + '</pre></div></td><td class="code">')
717
+ yield 0, '<div>'
718
+ yield 0, dummyoutfile.getvalue()
719
+ yield 0, '</div>'
720
+ yield 0, '</td></tr></table>'
721
+
722
+
723
+ def _wrap_inlinelinenos(self, inner):
724
+ # need a list of lines since we need the width of a single number :(
725
+ inner_lines = list(inner)
726
+ sp = self.linenospecial
727
+ st = self.linenostep
728
+ num = self.linenostart
729
+ mw = len(str(len(inner_lines) + num - 1))
730
+ anchor_name = self.lineanchors or self.linespans
731
+ aln = self.anchorlinenos
732
+ nocls = self.noclasses
733
+
734
+ for _, inner_line in inner_lines:
735
+ print_line = num % st == 0
736
+ special_line = sp and num % sp == 0
737
+
738
+ if print_line:
739
+ line = '%*d' % (mw, num)
740
+ else:
741
+ line = ' ' * mw
742
+
743
+ if nocls:
744
+ if special_line:
745
+ style = f' style="{self._linenos_special_style}"'
746
+ else:
747
+ style = f' style="{self._linenos_style}"'
748
+ else:
749
+ if special_line:
750
+ style = ' class="linenos special"'
751
+ else:
752
+ style = ' class="linenos"'
753
+
754
+ if style:
755
+ linenos = f'<span{style}>{line}</span>'
756
+ else:
757
+ linenos = line
758
+
759
+ if aln:
760
+ yield 1, ('<a href="#%s-%d">%s</a>' % (anchor_name, num, linenos) +
761
+ inner_line)
762
+ else:
763
+ yield 1, linenos + inner_line
764
+ num += 1
765
+
766
+ def _wrap_lineanchors(self, inner):
767
+ s = self.lineanchors
768
+ # subtract 1 since we have to increment i *before* yielding
769
+ i = self.linenostart - 1
770
+ for t, line in inner:
771
+ if t:
772
+ i += 1
773
+ href = "" if self.linenos else ' href="#%s-%d"' % (s, i)
774
+ yield 1, '<a id="%s-%d" name="%s-%d"%s></a>' % (s, i, s, i, href) + line
775
+ else:
776
+ yield 0, line
777
+
778
+ def _wrap_linespans(self, inner):
779
+ s = self.linespans
780
+ i = self.linenostart - 1
781
+ for t, line in inner:
782
+ if t:
783
+ i += 1
784
+ yield 1, '<span id="%s-%d">%s</span>' % (s, i, line)
785
+ else:
786
+ yield 0, line
787
+
788
+ def _wrap_div(self, inner):
789
+ style = []
790
+ if (self.noclasses and not self.nobackground and
791
+ self.style.background_color is not None):
792
+ style.append(f'background: {self.style.background_color}')
793
+ if self.cssstyles:
794
+ style.append(self.cssstyles)
795
+ style = '; '.join(style)
796
+
797
+ yield 0, ('<div' + (self.cssclass and f' class="{self.cssclass}"') +
798
+ (style and (f' style="{style}"')) + '>')
799
+ yield from inner
800
+ yield 0, '</div>\n'
801
+
802
+ def _wrap_pre(self, inner):
803
+ style = []
804
+ if self.prestyles:
805
+ style.append(self.prestyles)
806
+ if self.noclasses:
807
+ style.append(self._pre_style)
808
+ style = '; '.join(style)
809
+
810
+ if self.filename and self.linenos != 1:
811
+ yield 0, ('<span class="filename">' + self.filename + '</span>')
812
+
813
+ # the empty span here is to keep leading empty lines from being
814
+ # ignored by HTML parsers
815
+ yield 0, ('<pre' + (style and f' style="{style}"') + '><span></span>')
816
+ yield from inner
817
+ yield 0, '</pre>'
818
+
819
+ def _wrap_code(self, inner):
820
+ yield 0, '<code>'
821
+ yield from inner
822
+ yield 0, '</code>'
823
+
824
+ @functools.lru_cache(maxsize=100)
825
+ def _translate_parts(self, value):
826
+ """HTML-escape a value and split it by newlines."""
827
+ return value.translate(_escape_html_table).split('\n')
828
+
829
+ def _format_lines(self, tokensource):
830
+ """
831
+ Just format the tokens, without any wrapping tags.
832
+ Yield individual lines.
833
+ """
834
+ nocls = self.noclasses
835
+ lsep = self.lineseparator
836
+ tagsfile = self.tagsfile
837
+
838
+ lspan = ''
839
+ line = []
840
+ for ttype, value in tokensource:
841
+ try:
842
+ cspan = self.span_element_openers[ttype]
843
+ except KeyError:
844
+ title = ' title="{}"'.format('.'.join(ttype)) if self.debug_token_types else ''
845
+ if nocls:
846
+ css_style = self._get_css_inline_styles(ttype)
847
+ if css_style:
848
+ css_style = self.class2style[css_style][0]
849
+ cspan = f'<span style="{css_style}"{title}>'
850
+ else:
851
+ cspan = ''
852
+ else:
853
+ css_class = self._get_css_classes(ttype)
854
+ if css_class:
855
+ cspan = f'<span class="{css_class}"{title}>'
856
+ else:
857
+ cspan = ''
858
+ self.span_element_openers[ttype] = cspan
859
+
860
+ parts = self._translate_parts(value)
861
+
862
+ if tagsfile and ttype in Token.Name:
863
+ filename, linenumber = self._lookup_ctag(value)
864
+ if linenumber:
865
+ base, filename = os.path.split(filename)
866
+ if base:
867
+ base += '/'
868
+ filename, extension = os.path.splitext(filename)
869
+ url = self.tagurlformat % {'path': base, 'fname': filename,
870
+ 'fext': extension}
871
+ parts[0] = "<a href=\"%s#%s-%d\">%s" % \
872
+ (url, self.lineanchors, linenumber, parts[0])
873
+ parts[-1] = parts[-1] + "</a>"
874
+
875
+ # for all but the last line
876
+ for part in parts[:-1]:
877
+ if line:
878
+ # Also check for part being non-empty, so we avoid creating
879
+ # empty <span> tags
880
+ if lspan != cspan and part:
881
+ line.extend(((lspan and '</span>'), cspan, part,
882
+ (cspan and '</span>'), lsep))
883
+ else: # both are the same, or the current part was empty
884
+ line.extend((part, (lspan and '</span>'), lsep))
885
+ yield 1, ''.join(line)
886
+ line = []
887
+ elif part:
888
+ yield 1, ''.join((cspan, part, (cspan and '</span>'), lsep))
889
+ else:
890
+ yield 1, lsep
891
+ # for the last line
892
+ if line and parts[-1]:
893
+ if lspan != cspan:
894
+ line.extend(((lspan and '</span>'), cspan, parts[-1]))
895
+ lspan = cspan
896
+ else:
897
+ line.append(parts[-1])
898
+ elif parts[-1]:
899
+ line = [cspan, parts[-1]]
900
+ lspan = cspan
901
+ # else we neither have to open a new span nor set lspan
902
+
903
+ if line:
904
+ line.extend(((lspan and '</span>'), lsep))
905
+ yield 1, ''.join(line)
906
+
907
+ def _lookup_ctag(self, token):
908
+ entry = ctags.TagEntry()
909
+ if self._ctags.find(entry, token.encode(), 0):
910
+ return entry['file'].decode(), entry['lineNumber']
911
+ else:
912
+ return None, None
913
+
914
+ def _highlight_lines(self, tokensource):
915
+ """
916
+ Highlighted the lines specified in the `hl_lines` option by
917
+ post-processing the token stream coming from `_format_lines`.
918
+ """
919
+ hls = self.hl_lines
920
+
921
+ for i, (t, value) in enumerate(tokensource):
922
+ if t != 1:
923
+ yield t, value
924
+ if i + 1 in hls: # i + 1 because Python indexes start at 0
925
+ if self.noclasses:
926
+ style = ''
927
+ if self.style.highlight_color is not None:
928
+ style = (f' style="background-color: {self.style.highlight_color}"')
929
+ yield 1, f'<span{style}>{value}</span>'
930
+ else:
931
+ yield 1, f'<span class="hll">{value}</span>'
932
+ else:
933
+ yield 1, value
934
+
935
+ def wrap(self, source):
936
+ """
937
+ Wrap the ``source``, which is a generator yielding
938
+ individual lines, in custom generators. See docstring
939
+ for `format`. Can be overridden.
940
+ """
941
+
942
+ output = source
943
+ if self.wrapcode:
944
+ output = self._wrap_code(output)
945
+
946
+ output = self._wrap_pre(output)
947
+
948
+ return output
949
+
950
+ def format_unencoded(self, tokensource, outfile):
951
+ """
952
+ The formatting process uses several nested generators; which of
953
+ them are used is determined by the user's options.
954
+
955
+ Each generator should take at least one argument, ``inner``,
956
+ and wrap the pieces of text generated by this.
957
+
958
+ Always yield 2-tuples: (code, text). If "code" is 1, the text
959
+ is part of the original tokensource being highlighted, if it's
960
+ 0, the text is some piece of wrapping. This makes it possible to
961
+ use several different wrappers that process the original source
962
+ linewise, e.g. line number generators.
963
+ """
964
+ source = self._format_lines(tokensource)
965
+
966
+ # As a special case, we wrap line numbers before line highlighting
967
+ # so the line numbers get wrapped in the highlighting tag.
968
+ if not self.nowrap and self.linenos == 2:
969
+ source = self._wrap_inlinelinenos(source)
970
+
971
+ if self.hl_lines:
972
+ source = self._highlight_lines(source)
973
+
974
+ if not self.nowrap:
975
+ if self.lineanchors:
976
+ source = self._wrap_lineanchors(source)
977
+ if self.linespans:
978
+ source = self._wrap_linespans(source)
979
+ source = self.wrap(source)
980
+ if self.linenos == 1:
981
+ source = self._wrap_tablelinenos(source)
982
+ source = self._wrap_div(source)
983
+ if self.full:
984
+ source = self._wrap_full(source, outfile)
985
+
986
+ for t, piece in source:
987
+ outfile.write(piece)
evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/irc.py ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.formatters.irc
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Formatter for IRC output
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.formatter import Formatter
12
+ from pygments.token import Keyword, Name, Comment, String, Error, \
13
+ Number, Operator, Generic, Token, Whitespace
14
+ from pygments.util import get_choice_opt
15
+
16
+
17
+ __all__ = ['IRCFormatter']
18
+
19
+
20
+ #: Map token types to a tuple of color values for light and dark
21
+ #: backgrounds.
22
+ IRC_COLORS = {
23
+ Token: ('', ''),
24
+
25
+ Whitespace: ('gray', 'brightblack'),
26
+ Comment: ('gray', 'brightblack'),
27
+ Comment.Preproc: ('cyan', 'brightcyan'),
28
+ Keyword: ('blue', 'brightblue'),
29
+ Keyword.Type: ('cyan', 'brightcyan'),
30
+ Operator.Word: ('magenta', 'brightcyan'),
31
+ Name.Builtin: ('cyan', 'brightcyan'),
32
+ Name.Function: ('green', 'brightgreen'),
33
+ Name.Namespace: ('_cyan_', '_brightcyan_'),
34
+ Name.Class: ('_green_', '_brightgreen_'),
35
+ Name.Exception: ('cyan', 'brightcyan'),
36
+ Name.Decorator: ('brightblack', 'gray'),
37
+ Name.Variable: ('red', 'brightred'),
38
+ Name.Constant: ('red', 'brightred'),
39
+ Name.Attribute: ('cyan', 'brightcyan'),
40
+ Name.Tag: ('brightblue', 'brightblue'),
41
+ String: ('yellow', 'yellow'),
42
+ Number: ('blue', 'brightblue'),
43
+
44
+ Generic.Deleted: ('brightred', 'brightred'),
45
+ Generic.Inserted: ('green', 'brightgreen'),
46
+ Generic.Heading: ('**', '**'),
47
+ Generic.Subheading: ('*magenta*', '*brightmagenta*'),
48
+ Generic.Error: ('brightred', 'brightred'),
49
+
50
+ Error: ('_brightred_', '_brightred_'),
51
+ }
52
+
53
+
54
+ IRC_COLOR_MAP = {
55
+ 'white': 0,
56
+ 'black': 1,
57
+ 'blue': 2,
58
+ 'brightgreen': 3,
59
+ 'brightred': 4,
60
+ 'yellow': 5,
61
+ 'magenta': 6,
62
+ 'orange': 7,
63
+ 'green': 7, #compat w/ ansi
64
+ 'brightyellow': 8,
65
+ 'lightgreen': 9,
66
+ 'brightcyan': 9, # compat w/ ansi
67
+ 'cyan': 10,
68
+ 'lightblue': 11,
69
+ 'red': 11, # compat w/ ansi
70
+ 'brightblue': 12,
71
+ 'brightmagenta': 13,
72
+ 'brightblack': 14,
73
+ 'gray': 15,
74
+ }
75
+
76
+ def ircformat(color, text):
77
+ if len(color) < 1:
78
+ return text
79
+ add = sub = ''
80
+ if '_' in color: # italic
81
+ add += '\x1D'
82
+ sub = '\x1D' + sub
83
+ color = color.strip('_')
84
+ if '*' in color: # bold
85
+ add += '\x02'
86
+ sub = '\x02' + sub
87
+ color = color.strip('*')
88
+ # underline (\x1F) not supported
89
+ # backgrounds (\x03FF,BB) not supported
90
+ if len(color) > 0: # actual color - may have issues with ircformat("red", "blah")+"10" type stuff
91
+ add += '\x03' + str(IRC_COLOR_MAP[color]).zfill(2)
92
+ sub = '\x03' + sub
93
+ return add + text + sub
94
+ return '<'+add+'>'+text+'</'+sub+'>'
95
+
96
+
97
+ class IRCFormatter(Formatter):
98
+ r"""
99
+ Format tokens with IRC color sequences
100
+
101
+ The `get_style_defs()` method doesn't do anything special since there is
102
+ no support for common styles.
103
+
104
+ Options accepted:
105
+
106
+ `bg`
107
+ Set to ``"light"`` or ``"dark"`` depending on the terminal's background
108
+ (default: ``"light"``).
109
+
110
+ `colorscheme`
111
+ A dictionary mapping token types to (lightbg, darkbg) color names or
112
+ ``None`` (default: ``None`` = use builtin colorscheme).
113
+
114
+ `linenos`
115
+ Set to ``True`` to have line numbers in the output as well
116
+ (default: ``False`` = no line numbers).
117
+ """
118
+ name = 'IRC'
119
+ aliases = ['irc', 'IRC']
120
+ filenames = []
121
+
122
+ def __init__(self, **options):
123
+ Formatter.__init__(self, **options)
124
+ self.darkbg = get_choice_opt(options, 'bg',
125
+ ['light', 'dark'], 'light') == 'dark'
126
+ self.colorscheme = options.get('colorscheme', None) or IRC_COLORS
127
+ self.linenos = options.get('linenos', False)
128
+ self._lineno = 0
129
+
130
+ def _write_lineno(self, outfile):
131
+ if self.linenos:
132
+ self._lineno += 1
133
+ outfile.write("%04d: " % self._lineno)
134
+
135
+ def format_unencoded(self, tokensource, outfile):
136
+ self._write_lineno(outfile)
137
+
138
+ for ttype, value in tokensource:
139
+ color = self.colorscheme.get(ttype)
140
+ while color is None:
141
+ ttype = ttype[:-1]
142
+ color = self.colorscheme.get(ttype)
143
+ if color:
144
+ color = color[self.darkbg]
145
+ spl = value.split('\n')
146
+ for line in spl[:-1]:
147
+ if line:
148
+ outfile.write(ircformat(color, line))
149
+ outfile.write('\n')
150
+ self._write_lineno(outfile)
151
+ if spl[-1]:
152
+ outfile.write(ircformat(color, spl[-1]))
153
+ else:
154
+ outfile.write(value)
evalkit_tf437/lib/python3.10/site-packages/pygments/formatters/rtf.py ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.formatters.rtf
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ A formatter that generates RTF files.
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from collections import OrderedDict
12
+ from pygments.formatter import Formatter
13
+ from pygments.style import _ansimap
14
+ from pygments.util import get_bool_opt, get_int_opt, get_list_opt, surrogatepair
15
+
16
+
17
+ __all__ = ['RtfFormatter']
18
+
19
+
20
+ class RtfFormatter(Formatter):
21
+ """
22
+ Format tokens as RTF markup. This formatter automatically outputs full RTF
23
+ documents with color information and other useful stuff. Perfect for Copy and
24
+ Paste into Microsoft(R) Word(R) documents.
25
+
26
+ Please note that ``encoding`` and ``outencoding`` options are ignored.
27
+ The RTF format is ASCII natively, but handles unicode characters correctly
28
+ thanks to escape sequences.
29
+
30
+ .. versionadded:: 0.6
31
+
32
+ Additional options accepted:
33
+
34
+ `style`
35
+ The style to use, can be a string or a Style subclass (default:
36
+ ``'default'``).
37
+
38
+ `fontface`
39
+ The used font family, for example ``Bitstream Vera Sans``. Defaults to
40
+ some generic font which is supposed to have fixed width.
41
+
42
+ `fontsize`
43
+ Size of the font used. Size is specified in half points. The
44
+ default is 24 half-points, giving a size 12 font.
45
+
46
+ .. versionadded:: 2.0
47
+
48
+ `linenos`
49
+ Turn on line numbering (default: ``False``).
50
+
51
+ .. versionadded:: 2.18
52
+
53
+ `lineno_fontsize`
54
+ Font size for line numbers. Size is specified in half points
55
+ (default: `fontsize`).
56
+
57
+ .. versionadded:: 2.18
58
+
59
+ `lineno_padding`
60
+ Number of spaces between the (inline) line numbers and the
61
+ source code (default: ``2``).
62
+
63
+ .. versionadded:: 2.18
64
+
65
+ `linenostart`
66
+ The line number for the first line (default: ``1``).
67
+
68
+ .. versionadded:: 2.18
69
+
70
+ `linenostep`
71
+ If set to a number n > 1, only every nth line number is printed.
72
+
73
+ .. versionadded:: 2.18
74
+
75
+ `lineno_color`
76
+ Color for line numbers specified as a hex triplet, e.g. ``'5e5e5e'``.
77
+ Defaults to the style's line number color if it is a hex triplet,
78
+ otherwise ansi bright black.
79
+
80
+ .. versionadded:: 2.18
81
+
82
+ `hl_lines`
83
+ Specify a list of lines to be highlighted, as line numbers separated by
84
+ spaces, e.g. ``'3 7 8'``. The line numbers are relative to the input
85
+ (i.e. the first line is line 1) unless `hl_linenostart` is set.
86
+
87
+ .. versionadded:: 2.18
88
+
89
+ `hl_color`
90
+ Color for highlighting the lines specified in `hl_lines`, specified as
91
+ a hex triplet (default: style's `highlight_color`).
92
+
93
+ .. versionadded:: 2.18
94
+
95
+ `hl_linenostart`
96
+ If set to ``True`` line numbers in `hl_lines` are specified
97
+ relative to `linenostart` (default ``False``).
98
+
99
+ .. versionadded:: 2.18
100
+ """
101
+ name = 'RTF'
102
+ aliases = ['rtf']
103
+ filenames = ['*.rtf']
104
+
105
+ def __init__(self, **options):
106
+ r"""
107
+ Additional options accepted:
108
+
109
+ ``fontface``
110
+ Name of the font used. Could for example be ``'Courier New'``
111
+ to further specify the default which is ``'\fmodern'``. The RTF
112
+ specification claims that ``\fmodern`` are "Fixed-pitch serif
113
+ and sans serif fonts". Hope every RTF implementation thinks
114
+ the same about modern...
115
+
116
+ """
117
+ Formatter.__init__(self, **options)
118
+ self.fontface = options.get('fontface') or ''
119
+ self.fontsize = get_int_opt(options, 'fontsize', 0)
120
+ self.linenos = get_bool_opt(options, 'linenos', False)
121
+ self.lineno_fontsize = get_int_opt(options, 'lineno_fontsize',
122
+ self.fontsize)
123
+ self.lineno_padding = get_int_opt(options, 'lineno_padding', 2)
124
+ self.linenostart = abs(get_int_opt(options, 'linenostart', 1))
125
+ self.linenostep = abs(get_int_opt(options, 'linenostep', 1))
126
+ self.hl_linenostart = get_bool_opt(options, 'hl_linenostart', False)
127
+
128
+ self.hl_color = options.get('hl_color', '')
129
+ if not self.hl_color:
130
+ self.hl_color = self.style.highlight_color
131
+
132
+ self.hl_lines = []
133
+ for lineno in get_list_opt(options, 'hl_lines', []):
134
+ try:
135
+ lineno = int(lineno)
136
+ if self.hl_linenostart:
137
+ lineno = lineno - self.linenostart + 1
138
+ self.hl_lines.append(lineno)
139
+ except ValueError:
140
+ pass
141
+
142
+ self.lineno_color = options.get('lineno_color', '')
143
+ if not self.lineno_color:
144
+ if self.style.line_number_color == 'inherit':
145
+ # style color is the css value 'inherit'
146
+ # default to ansi bright-black
147
+ self.lineno_color = _ansimap['ansibrightblack']
148
+ else:
149
+ # style color is assumed to be a hex triplet as other
150
+ # colors in pygments/style.py
151
+ self.lineno_color = self.style.line_number_color
152
+
153
+ self.color_mapping = self._create_color_mapping()
154
+
155
+ def _escape(self, text):
156
+ return text.replace('\\', '\\\\') \
157
+ .replace('{', '\\{') \
158
+ .replace('}', '\\}')
159
+
160
+ def _escape_text(self, text):
161
+ # empty strings, should give a small performance improvement
162
+ if not text:
163
+ return ''
164
+
165
+ # escape text
166
+ text = self._escape(text)
167
+
168
+ buf = []
169
+ for c in text:
170
+ cn = ord(c)
171
+ if cn < (2**7):
172
+ # ASCII character
173
+ buf.append(str(c))
174
+ elif (2**7) <= cn < (2**16):
175
+ # single unicode escape sequence
176
+ buf.append('{\\u%d}' % cn)
177
+ elif (2**16) <= cn:
178
+ # RTF limits unicode to 16 bits.
179
+ # Force surrogate pairs
180
+ buf.append('{\\u%d}{\\u%d}' % surrogatepair(cn))
181
+
182
+ return ''.join(buf).replace('\n', '\\par')
183
+
184
+ @staticmethod
185
+ def hex_to_rtf_color(hex_color):
186
+ if hex_color[0] == "#":
187
+ hex_color = hex_color[1:]
188
+
189
+ return '\\red%d\\green%d\\blue%d;' % (
190
+ int(hex_color[0:2], 16),
191
+ int(hex_color[2:4], 16),
192
+ int(hex_color[4:6], 16)
193
+ )
194
+
195
+ def _split_tokens_on_newlines(self, tokensource):
196
+ """
197
+ Split tokens containing newline characters into multiple token
198
+ each representing a line of the input file. Needed for numbering
199
+ lines of e.g. multiline comments.
200
+ """
201
+ for ttype, value in tokensource:
202
+ if value == '\n':
203
+ yield (ttype, value)
204
+ elif "\n" in value:
205
+ lines = value.split("\n")
206
+ for line in lines[:-1]:
207
+ yield (ttype, line+"\n")
208
+ if lines[-1]:
209
+ yield (ttype, lines[-1])
210
+ else:
211
+ yield (ttype, value)
212
+
213
+ def _create_color_mapping(self):
214
+ """
215
+ Create a mapping of style hex colors to index/offset in
216
+ the RTF color table.
217
+ """
218
+ color_mapping = OrderedDict()
219
+ offset = 1
220
+
221
+ if self.linenos:
222
+ color_mapping[self.lineno_color] = offset
223
+ offset += 1
224
+
225
+ if self.hl_lines:
226
+ color_mapping[self.hl_color] = offset
227
+ offset += 1
228
+
229
+ for _, style in self.style:
230
+ for color in style['color'], style['bgcolor'], style['border']:
231
+ if color and color not in color_mapping:
232
+ color_mapping[color] = offset
233
+ offset += 1
234
+
235
+ return color_mapping
236
+
237
+ @property
238
+ def _lineno_template(self):
239
+ if self.lineno_fontsize != self.fontsize:
240
+ return '{{\\fs{} \\cf{} %s{}}}'.format(self.lineno_fontsize,
241
+ self.color_mapping[self.lineno_color],
242
+ " " * self.lineno_padding)
243
+
244
+ return '{{\\cf{} %s{}}}'.format(self.color_mapping[self.lineno_color],
245
+ " " * self.lineno_padding)
246
+
247
+ @property
248
+ def _hl_open_str(self):
249
+ return rf'{{\highlight{self.color_mapping[self.hl_color]} '
250
+
251
+ @property
252
+ def _rtf_header(self):
253
+ lines = []
254
+ # rtf 1.8 header
255
+ lines.append('{\\rtf1\\ansi\\uc0\\deff0'
256
+ '{\\fonttbl{\\f0\\fmodern\\fprq1\\fcharset0%s;}}'
257
+ % (self.fontface and ' '
258
+ + self._escape(self.fontface) or ''))
259
+
260
+ # color table
261
+ lines.append('{\\colortbl;')
262
+ for color, _ in self.color_mapping.items():
263
+ lines.append(self.hex_to_rtf_color(color))
264
+ lines.append('}')
265
+
266
+ # font and fontsize
267
+ lines.append('\\f0\\sa0')
268
+ if self.fontsize:
269
+ lines.append('\\fs%d' % self.fontsize)
270
+
271
+ # ensure Libre Office Writer imports and renders consecutive
272
+ # space characters the same width, needed for line numbering.
273
+ # https://bugs.documentfoundation.org/show_bug.cgi?id=144050
274
+ lines.append('\\dntblnsbdb')
275
+
276
+ return lines
277
+
278
+ def format_unencoded(self, tokensource, outfile):
279
+ for line in self._rtf_header:
280
+ outfile.write(line + "\n")
281
+
282
+ tokensource = self._split_tokens_on_newlines(tokensource)
283
+
284
+ # first pass of tokens to count lines, needed for line numbering
285
+ if self.linenos:
286
+ line_count = 0
287
+ tokens = [] # for copying the token source generator
288
+ for ttype, value in tokensource:
289
+ tokens.append((ttype, value))
290
+ if value.endswith("\n"):
291
+ line_count += 1
292
+
293
+ # width of line number strings (for padding with spaces)
294
+ linenos_width = len(str(line_count+self.linenostart-1))
295
+
296
+ tokensource = tokens
297
+
298
+ # highlight stream
299
+ lineno = 1
300
+ start_new_line = True
301
+ for ttype, value in tokensource:
302
+ if start_new_line and lineno in self.hl_lines:
303
+ outfile.write(self._hl_open_str)
304
+
305
+ if start_new_line and self.linenos:
306
+ if (lineno-self.linenostart+1)%self.linenostep == 0:
307
+ current_lineno = lineno + self.linenostart - 1
308
+ lineno_str = str(current_lineno).rjust(linenos_width)
309
+ else:
310
+ lineno_str = "".rjust(linenos_width)
311
+ outfile.write(self._lineno_template % lineno_str)
312
+
313
+ while not self.style.styles_token(ttype) and ttype.parent:
314
+ ttype = ttype.parent
315
+ style = self.style.style_for_token(ttype)
316
+ buf = []
317
+ if style['bgcolor']:
318
+ buf.append('\\cb%d' % self.color_mapping[style['bgcolor']])
319
+ if style['color']:
320
+ buf.append('\\cf%d' % self.color_mapping[style['color']])
321
+ if style['bold']:
322
+ buf.append('\\b')
323
+ if style['italic']:
324
+ buf.append('\\i')
325
+ if style['underline']:
326
+ buf.append('\\ul')
327
+ if style['border']:
328
+ buf.append('\\chbrdr\\chcfpat%d' %
329
+ self.color_mapping[style['border']])
330
+ start = ''.join(buf)
331
+ if start:
332
+ outfile.write(f'{{{start} ')
333
+ outfile.write(self._escape_text(value))
334
+ if start:
335
+ outfile.write('}')
336
+ start_new_line = False
337
+
338
+ # complete line of input
339
+ if value.endswith("\n"):
340
+ # close line highlighting
341
+ if lineno in self.hl_lines:
342
+ outfile.write('}')
343
+ # newline in RTF file after closing }
344
+ outfile.write("\n")
345
+
346
+ start_new_line = True
347
+ lineno += 1
348
+
349
+ outfile.write('}\n')
evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/__init__.py ADDED
@@ -0,0 +1,362 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers
3
+ ~~~~~~~~~~~~~~~
4
+
5
+ Pygments lexers.
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+ import sys
13
+ import types
14
+ import fnmatch
15
+ from os.path import basename
16
+
17
+ from pygments.lexers._mapping import LEXERS
18
+ from pygments.modeline import get_filetype_from_buffer
19
+ from pygments.plugin import find_plugin_lexers
20
+ from pygments.util import ClassNotFound, guess_decode
21
+
22
+ COMPAT = {
23
+ 'Python3Lexer': 'PythonLexer',
24
+ 'Python3TracebackLexer': 'PythonTracebackLexer',
25
+ 'LeanLexer': 'Lean3Lexer',
26
+ }
27
+
28
+ __all__ = ['get_lexer_by_name', 'get_lexer_for_filename', 'find_lexer_class',
29
+ 'guess_lexer', 'load_lexer_from_file'] + list(LEXERS) + list(COMPAT)
30
+
31
+ _lexer_cache = {}
32
+ _pattern_cache = {}
33
+
34
+
35
+ def _fn_matches(fn, glob):
36
+ """Return whether the supplied file name fn matches pattern filename."""
37
+ if glob not in _pattern_cache:
38
+ pattern = _pattern_cache[glob] = re.compile(fnmatch.translate(glob))
39
+ return pattern.match(fn)
40
+ return _pattern_cache[glob].match(fn)
41
+
42
+
43
+ def _load_lexers(module_name):
44
+ """Load a lexer (and all others in the module too)."""
45
+ mod = __import__(module_name, None, None, ['__all__'])
46
+ for lexer_name in mod.__all__:
47
+ cls = getattr(mod, lexer_name)
48
+ _lexer_cache[cls.name] = cls
49
+
50
+
51
+ def get_all_lexers(plugins=True):
52
+ """Return a generator of tuples in the form ``(name, aliases,
53
+ filenames, mimetypes)`` of all know lexers.
54
+
55
+ If *plugins* is true (the default), plugin lexers supplied by entrypoints
56
+ are also returned. Otherwise, only builtin ones are considered.
57
+ """
58
+ for item in LEXERS.values():
59
+ yield item[1:]
60
+ if plugins:
61
+ for lexer in find_plugin_lexers():
62
+ yield lexer.name, lexer.aliases, lexer.filenames, lexer.mimetypes
63
+
64
+
65
+ def find_lexer_class(name):
66
+ """
67
+ Return the `Lexer` subclass that with the *name* attribute as given by
68
+ the *name* argument.
69
+ """
70
+ if name in _lexer_cache:
71
+ return _lexer_cache[name]
72
+ # lookup builtin lexers
73
+ for module_name, lname, aliases, _, _ in LEXERS.values():
74
+ if name == lname:
75
+ _load_lexers(module_name)
76
+ return _lexer_cache[name]
77
+ # continue with lexers from setuptools entrypoints
78
+ for cls in find_plugin_lexers():
79
+ if cls.name == name:
80
+ return cls
81
+
82
+
83
+ def find_lexer_class_by_name(_alias):
84
+ """
85
+ Return the `Lexer` subclass that has `alias` in its aliases list, without
86
+ instantiating it.
87
+
88
+ Like `get_lexer_by_name`, but does not instantiate the class.
89
+
90
+ Will raise :exc:`pygments.util.ClassNotFound` if no lexer with that alias is
91
+ found.
92
+
93
+ .. versionadded:: 2.2
94
+ """
95
+ if not _alias:
96
+ raise ClassNotFound(f'no lexer for alias {_alias!r} found')
97
+ # lookup builtin lexers
98
+ for module_name, name, aliases, _, _ in LEXERS.values():
99
+ if _alias.lower() in aliases:
100
+ if name not in _lexer_cache:
101
+ _load_lexers(module_name)
102
+ return _lexer_cache[name]
103
+ # continue with lexers from setuptools entrypoints
104
+ for cls in find_plugin_lexers():
105
+ if _alias.lower() in cls.aliases:
106
+ return cls
107
+ raise ClassNotFound(f'no lexer for alias {_alias!r} found')
108
+
109
+
110
+ def get_lexer_by_name(_alias, **options):
111
+ """
112
+ Return an instance of a `Lexer` subclass that has `alias` in its
113
+ aliases list. The lexer is given the `options` at its
114
+ instantiation.
115
+
116
+ Will raise :exc:`pygments.util.ClassNotFound` if no lexer with that alias is
117
+ found.
118
+ """
119
+ if not _alias:
120
+ raise ClassNotFound(f'no lexer for alias {_alias!r} found')
121
+
122
+ # lookup builtin lexers
123
+ for module_name, name, aliases, _, _ in LEXERS.values():
124
+ if _alias.lower() in aliases:
125
+ if name not in _lexer_cache:
126
+ _load_lexers(module_name)
127
+ return _lexer_cache[name](**options)
128
+ # continue with lexers from setuptools entrypoints
129
+ for cls in find_plugin_lexers():
130
+ if _alias.lower() in cls.aliases:
131
+ return cls(**options)
132
+ raise ClassNotFound(f'no lexer for alias {_alias!r} found')
133
+
134
+
135
+ def load_lexer_from_file(filename, lexername="CustomLexer", **options):
136
+ """Load a lexer from a file.
137
+
138
+ This method expects a file located relative to the current working
139
+ directory, which contains a Lexer class. By default, it expects the
140
+ Lexer to be name CustomLexer; you can specify your own class name
141
+ as the second argument to this function.
142
+
143
+ Users should be very careful with the input, because this method
144
+ is equivalent to running eval on the input file.
145
+
146
+ Raises ClassNotFound if there are any problems importing the Lexer.
147
+
148
+ .. versionadded:: 2.2
149
+ """
150
+ try:
151
+ # This empty dict will contain the namespace for the exec'd file
152
+ custom_namespace = {}
153
+ with open(filename, 'rb') as f:
154
+ exec(f.read(), custom_namespace)
155
+ # Retrieve the class `lexername` from that namespace
156
+ if lexername not in custom_namespace:
157
+ raise ClassNotFound(f'no valid {lexername} class found in {filename}')
158
+ lexer_class = custom_namespace[lexername]
159
+ # And finally instantiate it with the options
160
+ return lexer_class(**options)
161
+ except OSError as err:
162
+ raise ClassNotFound(f'cannot read {filename}: {err}')
163
+ except ClassNotFound:
164
+ raise
165
+ except Exception as err:
166
+ raise ClassNotFound(f'error when loading custom lexer: {err}')
167
+
168
+
169
+ def find_lexer_class_for_filename(_fn, code=None):
170
+ """Get a lexer for a filename.
171
+
172
+ If multiple lexers match the filename pattern, use ``analyse_text()`` to
173
+ figure out which one is more appropriate.
174
+
175
+ Returns None if not found.
176
+ """
177
+ matches = []
178
+ fn = basename(_fn)
179
+ for modname, name, _, filenames, _ in LEXERS.values():
180
+ for filename in filenames:
181
+ if _fn_matches(fn, filename):
182
+ if name not in _lexer_cache:
183
+ _load_lexers(modname)
184
+ matches.append((_lexer_cache[name], filename))
185
+ for cls in find_plugin_lexers():
186
+ for filename in cls.filenames:
187
+ if _fn_matches(fn, filename):
188
+ matches.append((cls, filename))
189
+
190
+ if isinstance(code, bytes):
191
+ # decode it, since all analyse_text functions expect unicode
192
+ code = guess_decode(code)
193
+
194
+ def get_rating(info):
195
+ cls, filename = info
196
+ # explicit patterns get a bonus
197
+ bonus = '*' not in filename and 0.5 or 0
198
+ # The class _always_ defines analyse_text because it's included in
199
+ # the Lexer class. The default implementation returns None which
200
+ # gets turned into 0.0. Run scripts/detect_missing_analyse_text.py
201
+ # to find lexers which need it overridden.
202
+ if code:
203
+ return cls.analyse_text(code) + bonus, cls.__name__
204
+ return cls.priority + bonus, cls.__name__
205
+
206
+ if matches:
207
+ matches.sort(key=get_rating)
208
+ # print "Possible lexers, after sort:", matches
209
+ return matches[-1][0]
210
+
211
+
212
+ def get_lexer_for_filename(_fn, code=None, **options):
213
+ """Get a lexer for a filename.
214
+
215
+ Return a `Lexer` subclass instance that has a filename pattern
216
+ matching `fn`. The lexer is given the `options` at its
217
+ instantiation.
218
+
219
+ Raise :exc:`pygments.util.ClassNotFound` if no lexer for that filename
220
+ is found.
221
+
222
+ If multiple lexers match the filename pattern, use their ``analyse_text()``
223
+ methods to figure out which one is more appropriate.
224
+ """
225
+ res = find_lexer_class_for_filename(_fn, code)
226
+ if not res:
227
+ raise ClassNotFound(f'no lexer for filename {_fn!r} found')
228
+ return res(**options)
229
+
230
+
231
+ def get_lexer_for_mimetype(_mime, **options):
232
+ """
233
+ Return a `Lexer` subclass instance that has `mime` in its mimetype
234
+ list. The lexer is given the `options` at its instantiation.
235
+
236
+ Will raise :exc:`pygments.util.ClassNotFound` if not lexer for that mimetype
237
+ is found.
238
+ """
239
+ for modname, name, _, _, mimetypes in LEXERS.values():
240
+ if _mime in mimetypes:
241
+ if name not in _lexer_cache:
242
+ _load_lexers(modname)
243
+ return _lexer_cache[name](**options)
244
+ for cls in find_plugin_lexers():
245
+ if _mime in cls.mimetypes:
246
+ return cls(**options)
247
+ raise ClassNotFound(f'no lexer for mimetype {_mime!r} found')
248
+
249
+
250
+ def _iter_lexerclasses(plugins=True):
251
+ """Return an iterator over all lexer classes."""
252
+ for key in sorted(LEXERS):
253
+ module_name, name = LEXERS[key][:2]
254
+ if name not in _lexer_cache:
255
+ _load_lexers(module_name)
256
+ yield _lexer_cache[name]
257
+ if plugins:
258
+ yield from find_plugin_lexers()
259
+
260
+
261
+ def guess_lexer_for_filename(_fn, _text, **options):
262
+ """
263
+ As :func:`guess_lexer()`, but only lexers which have a pattern in `filenames`
264
+ or `alias_filenames` that matches `filename` are taken into consideration.
265
+
266
+ :exc:`pygments.util.ClassNotFound` is raised if no lexer thinks it can
267
+ handle the content.
268
+ """
269
+ fn = basename(_fn)
270
+ primary = {}
271
+ matching_lexers = set()
272
+ for lexer in _iter_lexerclasses():
273
+ for filename in lexer.filenames:
274
+ if _fn_matches(fn, filename):
275
+ matching_lexers.add(lexer)
276
+ primary[lexer] = True
277
+ for filename in lexer.alias_filenames:
278
+ if _fn_matches(fn, filename):
279
+ matching_lexers.add(lexer)
280
+ primary[lexer] = False
281
+ if not matching_lexers:
282
+ raise ClassNotFound(f'no lexer for filename {fn!r} found')
283
+ if len(matching_lexers) == 1:
284
+ return matching_lexers.pop()(**options)
285
+ result = []
286
+ for lexer in matching_lexers:
287
+ rv = lexer.analyse_text(_text)
288
+ if rv == 1.0:
289
+ return lexer(**options)
290
+ result.append((rv, lexer))
291
+
292
+ def type_sort(t):
293
+ # sort by:
294
+ # - analyse score
295
+ # - is primary filename pattern?
296
+ # - priority
297
+ # - last resort: class name
298
+ return (t[0], primary[t[1]], t[1].priority, t[1].__name__)
299
+ result.sort(key=type_sort)
300
+
301
+ return result[-1][1](**options)
302
+
303
+
304
+ def guess_lexer(_text, **options):
305
+ """
306
+ Return a `Lexer` subclass instance that's guessed from the text in
307
+ `text`. For that, the :meth:`.analyse_text()` method of every known lexer
308
+ class is called with the text as argument, and the lexer which returned the
309
+ highest value will be instantiated and returned.
310
+
311
+ :exc:`pygments.util.ClassNotFound` is raised if no lexer thinks it can
312
+ handle the content.
313
+ """
314
+
315
+ if not isinstance(_text, str):
316
+ inencoding = options.get('inencoding', options.get('encoding'))
317
+ if inencoding:
318
+ _text = _text.decode(inencoding or 'utf8')
319
+ else:
320
+ _text, _ = guess_decode(_text)
321
+
322
+ # try to get a vim modeline first
323
+ ft = get_filetype_from_buffer(_text)
324
+
325
+ if ft is not None:
326
+ try:
327
+ return get_lexer_by_name(ft, **options)
328
+ except ClassNotFound:
329
+ pass
330
+
331
+ best_lexer = [0.0, None]
332
+ for lexer in _iter_lexerclasses():
333
+ rv = lexer.analyse_text(_text)
334
+ if rv == 1.0:
335
+ return lexer(**options)
336
+ if rv > best_lexer[0]:
337
+ best_lexer[:] = (rv, lexer)
338
+ if not best_lexer[0] or best_lexer[1] is None:
339
+ raise ClassNotFound('no lexer matching the text found')
340
+ return best_lexer[1](**options)
341
+
342
+
343
+ class _automodule(types.ModuleType):
344
+ """Automatically import lexers."""
345
+
346
+ def __getattr__(self, name):
347
+ info = LEXERS.get(name)
348
+ if info:
349
+ _load_lexers(info[0])
350
+ cls = _lexer_cache[info[1]]
351
+ setattr(self, name, cls)
352
+ return cls
353
+ if name in COMPAT:
354
+ return getattr(self, COMPAT[name])
355
+ raise AttributeError(name)
356
+
357
+
358
+ oldmod = sys.modules[__name__]
359
+ newmod = _automodule(__name__)
360
+ newmod.__dict__.update(oldmod.__dict__)
361
+ sys.modules[__name__] = newmod
362
+ del newmod.newmod, newmod.oldmod, newmod.sys, newmod.types
evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/_scilab_builtins.py ADDED
@@ -0,0 +1,3093 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers._scilab_builtins
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Builtin list for the ScilabLexer.
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ # Autogenerated
12
+
13
+ commands_kw = (
14
+ 'abort',
15
+ 'apropos',
16
+ 'break',
17
+ 'case',
18
+ 'catch',
19
+ 'continue',
20
+ 'do',
21
+ 'else',
22
+ 'elseif',
23
+ 'end',
24
+ 'endfunction',
25
+ 'for',
26
+ 'function',
27
+ 'help',
28
+ 'if',
29
+ 'pause',
30
+ 'quit',
31
+ 'select',
32
+ 'then',
33
+ 'try',
34
+ 'while',
35
+ )
36
+
37
+ functions_kw = (
38
+ '!!_invoke_',
39
+ '%H5Object_e',
40
+ '%H5Object_fieldnames',
41
+ '%H5Object_p',
42
+ '%XMLAttr_6',
43
+ '%XMLAttr_e',
44
+ '%XMLAttr_i_XMLElem',
45
+ '%XMLAttr_length',
46
+ '%XMLAttr_p',
47
+ '%XMLAttr_size',
48
+ '%XMLDoc_6',
49
+ '%XMLDoc_e',
50
+ '%XMLDoc_i_XMLList',
51
+ '%XMLDoc_p',
52
+ '%XMLElem_6',
53
+ '%XMLElem_e',
54
+ '%XMLElem_i_XMLDoc',
55
+ '%XMLElem_i_XMLElem',
56
+ '%XMLElem_i_XMLList',
57
+ '%XMLElem_p',
58
+ '%XMLList_6',
59
+ '%XMLList_e',
60
+ '%XMLList_i_XMLElem',
61
+ '%XMLList_i_XMLList',
62
+ '%XMLList_length',
63
+ '%XMLList_p',
64
+ '%XMLList_size',
65
+ '%XMLNs_6',
66
+ '%XMLNs_e',
67
+ '%XMLNs_i_XMLElem',
68
+ '%XMLNs_p',
69
+ '%XMLSet_6',
70
+ '%XMLSet_e',
71
+ '%XMLSet_length',
72
+ '%XMLSet_p',
73
+ '%XMLSet_size',
74
+ '%XMLValid_p',
75
+ '%_EClass_6',
76
+ '%_EClass_e',
77
+ '%_EClass_p',
78
+ '%_EObj_0',
79
+ '%_EObj_1__EObj',
80
+ '%_EObj_1_b',
81
+ '%_EObj_1_c',
82
+ '%_EObj_1_i',
83
+ '%_EObj_1_s',
84
+ '%_EObj_2__EObj',
85
+ '%_EObj_2_b',
86
+ '%_EObj_2_c',
87
+ '%_EObj_2_i',
88
+ '%_EObj_2_s',
89
+ '%_EObj_3__EObj',
90
+ '%_EObj_3_b',
91
+ '%_EObj_3_c',
92
+ '%_EObj_3_i',
93
+ '%_EObj_3_s',
94
+ '%_EObj_4__EObj',
95
+ '%_EObj_4_b',
96
+ '%_EObj_4_c',
97
+ '%_EObj_4_i',
98
+ '%_EObj_4_s',
99
+ '%_EObj_5',
100
+ '%_EObj_6',
101
+ '%_EObj_a__EObj',
102
+ '%_EObj_a_b',
103
+ '%_EObj_a_c',
104
+ '%_EObj_a_i',
105
+ '%_EObj_a_s',
106
+ '%_EObj_d__EObj',
107
+ '%_EObj_d_b',
108
+ '%_EObj_d_c',
109
+ '%_EObj_d_i',
110
+ '%_EObj_d_s',
111
+ '%_EObj_disp',
112
+ '%_EObj_e',
113
+ '%_EObj_g__EObj',
114
+ '%_EObj_g_b',
115
+ '%_EObj_g_c',
116
+ '%_EObj_g_i',
117
+ '%_EObj_g_s',
118
+ '%_EObj_h__EObj',
119
+ '%_EObj_h_b',
120
+ '%_EObj_h_c',
121
+ '%_EObj_h_i',
122
+ '%_EObj_h_s',
123
+ '%_EObj_i__EObj',
124
+ '%_EObj_j__EObj',
125
+ '%_EObj_j_b',
126
+ '%_EObj_j_c',
127
+ '%_EObj_j_i',
128
+ '%_EObj_j_s',
129
+ '%_EObj_k__EObj',
130
+ '%_EObj_k_b',
131
+ '%_EObj_k_c',
132
+ '%_EObj_k_i',
133
+ '%_EObj_k_s',
134
+ '%_EObj_l__EObj',
135
+ '%_EObj_l_b',
136
+ '%_EObj_l_c',
137
+ '%_EObj_l_i',
138
+ '%_EObj_l_s',
139
+ '%_EObj_m__EObj',
140
+ '%_EObj_m_b',
141
+ '%_EObj_m_c',
142
+ '%_EObj_m_i',
143
+ '%_EObj_m_s',
144
+ '%_EObj_n__EObj',
145
+ '%_EObj_n_b',
146
+ '%_EObj_n_c',
147
+ '%_EObj_n_i',
148
+ '%_EObj_n_s',
149
+ '%_EObj_o__EObj',
150
+ '%_EObj_o_b',
151
+ '%_EObj_o_c',
152
+ '%_EObj_o_i',
153
+ '%_EObj_o_s',
154
+ '%_EObj_p',
155
+ '%_EObj_p__EObj',
156
+ '%_EObj_p_b',
157
+ '%_EObj_p_c',
158
+ '%_EObj_p_i',
159
+ '%_EObj_p_s',
160
+ '%_EObj_q__EObj',
161
+ '%_EObj_q_b',
162
+ '%_EObj_q_c',
163
+ '%_EObj_q_i',
164
+ '%_EObj_q_s',
165
+ '%_EObj_r__EObj',
166
+ '%_EObj_r_b',
167
+ '%_EObj_r_c',
168
+ '%_EObj_r_i',
169
+ '%_EObj_r_s',
170
+ '%_EObj_s__EObj',
171
+ '%_EObj_s_b',
172
+ '%_EObj_s_c',
173
+ '%_EObj_s_i',
174
+ '%_EObj_s_s',
175
+ '%_EObj_t',
176
+ '%_EObj_x__EObj',
177
+ '%_EObj_x_b',
178
+ '%_EObj_x_c',
179
+ '%_EObj_x_i',
180
+ '%_EObj_x_s',
181
+ '%_EObj_y__EObj',
182
+ '%_EObj_y_b',
183
+ '%_EObj_y_c',
184
+ '%_EObj_y_i',
185
+ '%_EObj_y_s',
186
+ '%_EObj_z__EObj',
187
+ '%_EObj_z_b',
188
+ '%_EObj_z_c',
189
+ '%_EObj_z_i',
190
+ '%_EObj_z_s',
191
+ '%_eigs',
192
+ '%_load',
193
+ '%b_1__EObj',
194
+ '%b_2__EObj',
195
+ '%b_3__EObj',
196
+ '%b_4__EObj',
197
+ '%b_a__EObj',
198
+ '%b_d__EObj',
199
+ '%b_g__EObj',
200
+ '%b_h__EObj',
201
+ '%b_i_XMLList',
202
+ '%b_i__EObj',
203
+ '%b_j__EObj',
204
+ '%b_k__EObj',
205
+ '%b_l__EObj',
206
+ '%b_m__EObj',
207
+ '%b_n__EObj',
208
+ '%b_o__EObj',
209
+ '%b_p__EObj',
210
+ '%b_q__EObj',
211
+ '%b_r__EObj',
212
+ '%b_s__EObj',
213
+ '%b_x__EObj',
214
+ '%b_y__EObj',
215
+ '%b_z__EObj',
216
+ '%c_1__EObj',
217
+ '%c_2__EObj',
218
+ '%c_3__EObj',
219
+ '%c_4__EObj',
220
+ '%c_a__EObj',
221
+ '%c_d__EObj',
222
+ '%c_g__EObj',
223
+ '%c_h__EObj',
224
+ '%c_i_XMLAttr',
225
+ '%c_i_XMLDoc',
226
+ '%c_i_XMLElem',
227
+ '%c_i_XMLList',
228
+ '%c_i__EObj',
229
+ '%c_j__EObj',
230
+ '%c_k__EObj',
231
+ '%c_l__EObj',
232
+ '%c_m__EObj',
233
+ '%c_n__EObj',
234
+ '%c_o__EObj',
235
+ '%c_p__EObj',
236
+ '%c_q__EObj',
237
+ '%c_r__EObj',
238
+ '%c_s__EObj',
239
+ '%c_x__EObj',
240
+ '%c_y__EObj',
241
+ '%c_z__EObj',
242
+ '%ce_i_XMLList',
243
+ '%fptr_i_XMLList',
244
+ '%h_i_XMLList',
245
+ '%hm_i_XMLList',
246
+ '%i_1__EObj',
247
+ '%i_2__EObj',
248
+ '%i_3__EObj',
249
+ '%i_4__EObj',
250
+ '%i_a__EObj',
251
+ '%i_abs',
252
+ '%i_cumprod',
253
+ '%i_cumsum',
254
+ '%i_d__EObj',
255
+ '%i_diag',
256
+ '%i_g__EObj',
257
+ '%i_h__EObj',
258
+ '%i_i_XMLList',
259
+ '%i_i__EObj',
260
+ '%i_j__EObj',
261
+ '%i_k__EObj',
262
+ '%i_l__EObj',
263
+ '%i_m__EObj',
264
+ '%i_matrix',
265
+ '%i_max',
266
+ '%i_maxi',
267
+ '%i_min',
268
+ '%i_mini',
269
+ '%i_mput',
270
+ '%i_n__EObj',
271
+ '%i_o__EObj',
272
+ '%i_p',
273
+ '%i_p__EObj',
274
+ '%i_prod',
275
+ '%i_q__EObj',
276
+ '%i_r__EObj',
277
+ '%i_s__EObj',
278
+ '%i_sum',
279
+ '%i_tril',
280
+ '%i_triu',
281
+ '%i_x__EObj',
282
+ '%i_y__EObj',
283
+ '%i_z__EObj',
284
+ '%ip_i_XMLList',
285
+ '%l_i_XMLList',
286
+ '%l_i__EObj',
287
+ '%lss_i_XMLList',
288
+ '%mc_i_XMLList',
289
+ '%msp_full',
290
+ '%msp_i_XMLList',
291
+ '%msp_spget',
292
+ '%p_i_XMLList',
293
+ '%ptr_i_XMLList',
294
+ '%r_i_XMLList',
295
+ '%s_1__EObj',
296
+ '%s_2__EObj',
297
+ '%s_3__EObj',
298
+ '%s_4__EObj',
299
+ '%s_a__EObj',
300
+ '%s_d__EObj',
301
+ '%s_g__EObj',
302
+ '%s_h__EObj',
303
+ '%s_i_XMLList',
304
+ '%s_i__EObj',
305
+ '%s_j__EObj',
306
+ '%s_k__EObj',
307
+ '%s_l__EObj',
308
+ '%s_m__EObj',
309
+ '%s_n__EObj',
310
+ '%s_o__EObj',
311
+ '%s_p__EObj',
312
+ '%s_q__EObj',
313
+ '%s_r__EObj',
314
+ '%s_s__EObj',
315
+ '%s_x__EObj',
316
+ '%s_y__EObj',
317
+ '%s_z__EObj',
318
+ '%sp_i_XMLList',
319
+ '%spb_i_XMLList',
320
+ '%st_i_XMLList',
321
+ 'Calendar',
322
+ 'ClipBoard',
323
+ 'Matplot',
324
+ 'Matplot1',
325
+ 'PlaySound',
326
+ 'TCL_DeleteInterp',
327
+ 'TCL_DoOneEvent',
328
+ 'TCL_EvalFile',
329
+ 'TCL_EvalStr',
330
+ 'TCL_ExistArray',
331
+ 'TCL_ExistInterp',
332
+ 'TCL_ExistVar',
333
+ 'TCL_GetVar',
334
+ 'TCL_GetVersion',
335
+ 'TCL_SetVar',
336
+ 'TCL_UnsetVar',
337
+ 'TCL_UpVar',
338
+ '_',
339
+ '_code2str',
340
+ '_d',
341
+ '_str2code',
342
+ 'about',
343
+ 'abs',
344
+ 'acos',
345
+ 'addModulePreferences',
346
+ 'addcolor',
347
+ 'addf',
348
+ 'addhistory',
349
+ 'addinter',
350
+ 'addlocalizationdomain',
351
+ 'amell',
352
+ 'and',
353
+ 'argn',
354
+ 'arl2_ius',
355
+ 'ascii',
356
+ 'asin',
357
+ 'atan',
358
+ 'backslash',
359
+ 'balanc',
360
+ 'banner',
361
+ 'base2dec',
362
+ 'basename',
363
+ 'bdiag',
364
+ 'beep',
365
+ 'besselh',
366
+ 'besseli',
367
+ 'besselj',
368
+ 'besselk',
369
+ 'bessely',
370
+ 'beta',
371
+ 'bezout',
372
+ 'bfinit',
373
+ 'blkfc1i',
374
+ 'blkslvi',
375
+ 'bool2s',
376
+ 'browsehistory',
377
+ 'browsevar',
378
+ 'bsplin3val',
379
+ 'buildDoc',
380
+ 'buildouttb',
381
+ 'bvode',
382
+ 'c_link',
383
+ 'call',
384
+ 'callblk',
385
+ 'captions',
386
+ 'cd',
387
+ 'cdfbet',
388
+ 'cdfbin',
389
+ 'cdfchi',
390
+ 'cdfchn',
391
+ 'cdff',
392
+ 'cdffnc',
393
+ 'cdfgam',
394
+ 'cdfnbn',
395
+ 'cdfnor',
396
+ 'cdfpoi',
397
+ 'cdft',
398
+ 'ceil',
399
+ 'champ',
400
+ 'champ1',
401
+ 'chdir',
402
+ 'chol',
403
+ 'clc',
404
+ 'clean',
405
+ 'clear',
406
+ 'clearfun',
407
+ 'clearglobal',
408
+ 'closeEditor',
409
+ 'closeEditvar',
410
+ 'closeXcos',
411
+ 'code2str',
412
+ 'coeff',
413
+ 'color',
414
+ 'comp',
415
+ 'completion',
416
+ 'conj',
417
+ 'contour2di',
418
+ 'contr',
419
+ 'conv2',
420
+ 'convstr',
421
+ 'copy',
422
+ 'copyfile',
423
+ 'corr',
424
+ 'cos',
425
+ 'coserror',
426
+ 'createdir',
427
+ 'cshep2d',
428
+ 'csvDefault',
429
+ 'csvIsnum',
430
+ 'csvRead',
431
+ 'csvStringToDouble',
432
+ 'csvTextScan',
433
+ 'csvWrite',
434
+ 'ctree2',
435
+ 'ctree3',
436
+ 'ctree4',
437
+ 'cumprod',
438
+ 'cumsum',
439
+ 'curblock',
440
+ 'curblockc',
441
+ 'daskr',
442
+ 'dasrt',
443
+ 'dassl',
444
+ 'data2sig',
445
+ 'datatipCreate',
446
+ 'datatipManagerMode',
447
+ 'datatipMove',
448
+ 'datatipRemove',
449
+ 'datatipSetDisplay',
450
+ 'datatipSetInterp',
451
+ 'datatipSetOrientation',
452
+ 'datatipSetStyle',
453
+ 'datatipToggle',
454
+ 'dawson',
455
+ 'dct',
456
+ 'debug',
457
+ 'dec2base',
458
+ 'deff',
459
+ 'definedfields',
460
+ 'degree',
461
+ 'delbpt',
462
+ 'delete',
463
+ 'deletefile',
464
+ 'delip',
465
+ 'delmenu',
466
+ 'det',
467
+ 'dgettext',
468
+ 'dhinf',
469
+ 'diag',
470
+ 'diary',
471
+ 'diffobjs',
472
+ 'disp',
473
+ 'dispbpt',
474
+ 'displayhistory',
475
+ 'disposefftwlibrary',
476
+ 'dlgamma',
477
+ 'dnaupd',
478
+ 'dneupd',
479
+ 'double',
480
+ 'drawaxis',
481
+ 'drawlater',
482
+ 'drawnow',
483
+ 'driver',
484
+ 'dsaupd',
485
+ 'dsearch',
486
+ 'dseupd',
487
+ 'dst',
488
+ 'duplicate',
489
+ 'editvar',
490
+ 'emptystr',
491
+ 'end_scicosim',
492
+ 'ereduc',
493
+ 'erf',
494
+ 'erfc',
495
+ 'erfcx',
496
+ 'erfi',
497
+ 'errcatch',
498
+ 'errclear',
499
+ 'error',
500
+ 'eval_cshep2d',
501
+ 'exec',
502
+ 'execstr',
503
+ 'exists',
504
+ 'exit',
505
+ 'exp',
506
+ 'expm',
507
+ 'exportUI',
508
+ 'export_to_hdf5',
509
+ 'eye',
510
+ 'fadj2sp',
511
+ 'fec',
512
+ 'feval',
513
+ 'fft',
514
+ 'fftw',
515
+ 'fftw_flags',
516
+ 'fftw_forget_wisdom',
517
+ 'fftwlibraryisloaded',
518
+ 'figure',
519
+ 'file',
520
+ 'filebrowser',
521
+ 'fileext',
522
+ 'fileinfo',
523
+ 'fileparts',
524
+ 'filesep',
525
+ 'find',
526
+ 'findBD',
527
+ 'findfiles',
528
+ 'fire_closing_finished',
529
+ 'floor',
530
+ 'format',
531
+ 'fort',
532
+ 'fprintfMat',
533
+ 'freq',
534
+ 'frexp',
535
+ 'fromc',
536
+ 'fromjava',
537
+ 'fscanfMat',
538
+ 'fsolve',
539
+ 'fstair',
540
+ 'full',
541
+ 'fullpath',
542
+ 'funcprot',
543
+ 'funptr',
544
+ 'gamma',
545
+ 'gammaln',
546
+ 'geom3d',
547
+ 'get',
548
+ 'getURL',
549
+ 'get_absolute_file_path',
550
+ 'get_fftw_wisdom',
551
+ 'getblocklabel',
552
+ 'getcallbackobject',
553
+ 'getdate',
554
+ 'getdebuginfo',
555
+ 'getdefaultlanguage',
556
+ 'getdrives',
557
+ 'getdynlibext',
558
+ 'getenv',
559
+ 'getfield',
560
+ 'gethistory',
561
+ 'gethistoryfile',
562
+ 'getinstalledlookandfeels',
563
+ 'getio',
564
+ 'getlanguage',
565
+ 'getlongpathname',
566
+ 'getlookandfeel',
567
+ 'getmd5',
568
+ 'getmemory',
569
+ 'getmodules',
570
+ 'getos',
571
+ 'getpid',
572
+ 'getrelativefilename',
573
+ 'getscicosvars',
574
+ 'getscilabmode',
575
+ 'getshortpathname',
576
+ 'gettext',
577
+ 'getvariablesonstack',
578
+ 'getversion',
579
+ 'glist',
580
+ 'global',
581
+ 'glue',
582
+ 'grand',
583
+ 'graphicfunction',
584
+ 'grayplot',
585
+ 'grep',
586
+ 'gsort',
587
+ 'gstacksize',
588
+ 'h5attr',
589
+ 'h5close',
590
+ 'h5cp',
591
+ 'h5dataset',
592
+ 'h5dump',
593
+ 'h5exists',
594
+ 'h5flush',
595
+ 'h5get',
596
+ 'h5group',
597
+ 'h5isArray',
598
+ 'h5isAttr',
599
+ 'h5isCompound',
600
+ 'h5isFile',
601
+ 'h5isGroup',
602
+ 'h5isList',
603
+ 'h5isRef',
604
+ 'h5isSet',
605
+ 'h5isSpace',
606
+ 'h5isType',
607
+ 'h5isVlen',
608
+ 'h5label',
609
+ 'h5ln',
610
+ 'h5ls',
611
+ 'h5mount',
612
+ 'h5mv',
613
+ 'h5open',
614
+ 'h5read',
615
+ 'h5readattr',
616
+ 'h5rm',
617
+ 'h5umount',
618
+ 'h5write',
619
+ 'h5writeattr',
620
+ 'havewindow',
621
+ 'helpbrowser',
622
+ 'hess',
623
+ 'hinf',
624
+ 'historymanager',
625
+ 'historysize',
626
+ 'host',
627
+ 'htmlDump',
628
+ 'htmlRead',
629
+ 'htmlReadStr',
630
+ 'htmlWrite',
631
+ 'iconvert',
632
+ 'ieee',
633
+ 'ilib_verbose',
634
+ 'imag',
635
+ 'impl',
636
+ 'import_from_hdf5',
637
+ 'imult',
638
+ 'inpnvi',
639
+ 'int',
640
+ 'int16',
641
+ 'int2d',
642
+ 'int32',
643
+ 'int3d',
644
+ 'int8',
645
+ 'interp',
646
+ 'interp2d',
647
+ 'interp3d',
648
+ 'intg',
649
+ 'intppty',
650
+ 'inttype',
651
+ 'inv',
652
+ 'invoke_lu',
653
+ 'is_handle_valid',
654
+ 'is_hdf5_file',
655
+ 'isalphanum',
656
+ 'isascii',
657
+ 'isdef',
658
+ 'isdigit',
659
+ 'isdir',
660
+ 'isequal',
661
+ 'isequalbitwise',
662
+ 'iserror',
663
+ 'isfile',
664
+ 'isglobal',
665
+ 'isletter',
666
+ 'isnum',
667
+ 'isreal',
668
+ 'iswaitingforinput',
669
+ 'jallowClassReloading',
670
+ 'jarray',
671
+ 'jautoTranspose',
672
+ 'jautoUnwrap',
673
+ 'javaclasspath',
674
+ 'javalibrarypath',
675
+ 'jcast',
676
+ 'jcompile',
677
+ 'jconvMatrixMethod',
678
+ 'jcreatejar',
679
+ 'jdeff',
680
+ 'jdisableTrace',
681
+ 'jenableTrace',
682
+ 'jexists',
683
+ 'jgetclassname',
684
+ 'jgetfield',
685
+ 'jgetfields',
686
+ 'jgetinfo',
687
+ 'jgetmethods',
688
+ 'jimport',
689
+ 'jinvoke',
690
+ 'jinvoke_db',
691
+ 'jnewInstance',
692
+ 'jremove',
693
+ 'jsetfield',
694
+ 'junwrap',
695
+ 'junwraprem',
696
+ 'jwrap',
697
+ 'jwrapinfloat',
698
+ 'kron',
699
+ 'lasterror',
700
+ 'ldiv',
701
+ 'ldivf',
702
+ 'legendre',
703
+ 'length',
704
+ 'lib',
705
+ 'librarieslist',
706
+ 'libraryinfo',
707
+ 'light',
708
+ 'linear_interpn',
709
+ 'lines',
710
+ 'link',
711
+ 'linmeq',
712
+ 'list',
713
+ 'listvar_in_hdf5',
714
+ 'load',
715
+ 'loadGui',
716
+ 'loadScicos',
717
+ 'loadXcos',
718
+ 'loadfftwlibrary',
719
+ 'loadhistory',
720
+ 'log',
721
+ 'log1p',
722
+ 'lsq',
723
+ 'lsq_splin',
724
+ 'lsqrsolve',
725
+ 'lsslist',
726
+ 'lstcat',
727
+ 'lstsize',
728
+ 'ltitr',
729
+ 'lu',
730
+ 'ludel',
731
+ 'lufact',
732
+ 'luget',
733
+ 'lusolve',
734
+ 'macr2lst',
735
+ 'macr2tree',
736
+ 'matfile_close',
737
+ 'matfile_listvar',
738
+ 'matfile_open',
739
+ 'matfile_varreadnext',
740
+ 'matfile_varwrite',
741
+ 'matrix',
742
+ 'max',
743
+ 'maxfiles',
744
+ 'mclearerr',
745
+ 'mclose',
746
+ 'meof',
747
+ 'merror',
748
+ 'messagebox',
749
+ 'mfprintf',
750
+ 'mfscanf',
751
+ 'mget',
752
+ 'mgeti',
753
+ 'mgetl',
754
+ 'mgetstr',
755
+ 'min',
756
+ 'mlist',
757
+ 'mode',
758
+ 'model2blk',
759
+ 'mopen',
760
+ 'move',
761
+ 'movefile',
762
+ 'mprintf',
763
+ 'mput',
764
+ 'mputl',
765
+ 'mputstr',
766
+ 'mscanf',
767
+ 'mseek',
768
+ 'msprintf',
769
+ 'msscanf',
770
+ 'mtell',
771
+ 'mtlb_mode',
772
+ 'mtlb_sparse',
773
+ 'mucomp',
774
+ 'mulf',
775
+ 'name2rgb',
776
+ 'nearfloat',
777
+ 'newaxes',
778
+ 'newest',
779
+ 'newfun',
780
+ 'nnz',
781
+ 'norm',
782
+ 'notify',
783
+ 'number_properties',
784
+ 'ode',
785
+ 'odedc',
786
+ 'ones',
787
+ 'openged',
788
+ 'opentk',
789
+ 'optim',
790
+ 'or',
791
+ 'ordmmd',
792
+ 'parallel_concurrency',
793
+ 'parallel_run',
794
+ 'param3d',
795
+ 'param3d1',
796
+ 'part',
797
+ 'pathconvert',
798
+ 'pathsep',
799
+ 'phase_simulation',
800
+ 'plot2d',
801
+ 'plot2d1',
802
+ 'plot2d2',
803
+ 'plot2d3',
804
+ 'plot2d4',
805
+ 'plot3d',
806
+ 'plot3d1',
807
+ 'plotbrowser',
808
+ 'pointer_xproperty',
809
+ 'poly',
810
+ 'ppol',
811
+ 'pppdiv',
812
+ 'predef',
813
+ 'preferences',
814
+ 'print',
815
+ 'printf',
816
+ 'printfigure',
817
+ 'printsetupbox',
818
+ 'prod',
819
+ 'progressionbar',
820
+ 'prompt',
821
+ 'pwd',
822
+ 'qld',
823
+ 'qp_solve',
824
+ 'qr',
825
+ 'raise_window',
826
+ 'rand',
827
+ 'rankqr',
828
+ 'rat',
829
+ 'rcond',
830
+ 'rdivf',
831
+ 'read',
832
+ 'read4b',
833
+ 'read_csv',
834
+ 'readb',
835
+ 'readgateway',
836
+ 'readmps',
837
+ 'real',
838
+ 'realtime',
839
+ 'realtimeinit',
840
+ 'regexp',
841
+ 'relocate_handle',
842
+ 'remez',
843
+ 'removeModulePreferences',
844
+ 'removedir',
845
+ 'removelinehistory',
846
+ 'res_with_prec',
847
+ 'resethistory',
848
+ 'residu',
849
+ 'resume',
850
+ 'return',
851
+ 'ricc',
852
+ 'rlist',
853
+ 'roots',
854
+ 'rotate_axes',
855
+ 'round',
856
+ 'rpem',
857
+ 'rtitr',
858
+ 'rubberbox',
859
+ 'save',
860
+ 'saveGui',
861
+ 'saveafterncommands',
862
+ 'saveconsecutivecommands',
863
+ 'savehistory',
864
+ 'schur',
865
+ 'sci_haltscicos',
866
+ 'sci_tree2',
867
+ 'sci_tree3',
868
+ 'sci_tree4',
869
+ 'sciargs',
870
+ 'scicos_debug',
871
+ 'scicos_debug_count',
872
+ 'scicos_time',
873
+ 'scicosim',
874
+ 'scinotes',
875
+ 'sctree',
876
+ 'semidef',
877
+ 'set',
878
+ 'set_blockerror',
879
+ 'set_fftw_wisdom',
880
+ 'set_xproperty',
881
+ 'setbpt',
882
+ 'setdefaultlanguage',
883
+ 'setenv',
884
+ 'setfield',
885
+ 'sethistoryfile',
886
+ 'setlanguage',
887
+ 'setlookandfeel',
888
+ 'setmenu',
889
+ 'sfact',
890
+ 'sfinit',
891
+ 'show_window',
892
+ 'sident',
893
+ 'sig2data',
894
+ 'sign',
895
+ 'simp',
896
+ 'simp_mode',
897
+ 'sin',
898
+ 'size',
899
+ 'slash',
900
+ 'sleep',
901
+ 'sorder',
902
+ 'sparse',
903
+ 'spchol',
904
+ 'spcompack',
905
+ 'spec',
906
+ 'spget',
907
+ 'splin',
908
+ 'splin2d',
909
+ 'splin3d',
910
+ 'splitURL',
911
+ 'spones',
912
+ 'sprintf',
913
+ 'sqrt',
914
+ 'stacksize',
915
+ 'str2code',
916
+ 'strcat',
917
+ 'strchr',
918
+ 'strcmp',
919
+ 'strcspn',
920
+ 'strindex',
921
+ 'string',
922
+ 'stringbox',
923
+ 'stripblanks',
924
+ 'strncpy',
925
+ 'strrchr',
926
+ 'strrev',
927
+ 'strsplit',
928
+ 'strspn',
929
+ 'strstr',
930
+ 'strsubst',
931
+ 'strtod',
932
+ 'strtok',
933
+ 'subf',
934
+ 'sum',
935
+ 'svd',
936
+ 'swap_handles',
937
+ 'symfcti',
938
+ 'syredi',
939
+ 'system_getproperty',
940
+ 'system_setproperty',
941
+ 'ta2lpd',
942
+ 'tan',
943
+ 'taucs_chdel',
944
+ 'taucs_chfact',
945
+ 'taucs_chget',
946
+ 'taucs_chinfo',
947
+ 'taucs_chsolve',
948
+ 'tempname',
949
+ 'testmatrix',
950
+ 'timer',
951
+ 'tlist',
952
+ 'tohome',
953
+ 'tokens',
954
+ 'toolbar',
955
+ 'toprint',
956
+ 'tr_zer',
957
+ 'tril',
958
+ 'triu',
959
+ 'type',
960
+ 'typename',
961
+ 'uiDisplayTree',
962
+ 'uicontextmenu',
963
+ 'uicontrol',
964
+ 'uigetcolor',
965
+ 'uigetdir',
966
+ 'uigetfile',
967
+ 'uigetfont',
968
+ 'uimenu',
969
+ 'uint16',
970
+ 'uint32',
971
+ 'uint8',
972
+ 'uipopup',
973
+ 'uiputfile',
974
+ 'uiwait',
975
+ 'ulink',
976
+ 'umf_ludel',
977
+ 'umf_lufact',
978
+ 'umf_luget',
979
+ 'umf_luinfo',
980
+ 'umf_lusolve',
981
+ 'umfpack',
982
+ 'unglue',
983
+ 'unix',
984
+ 'unsetmenu',
985
+ 'unzoom',
986
+ 'updatebrowsevar',
987
+ 'usecanvas',
988
+ 'useeditor',
989
+ 'user',
990
+ 'var2vec',
991
+ 'varn',
992
+ 'vec2var',
993
+ 'waitbar',
994
+ 'warnBlockByUID',
995
+ 'warning',
996
+ 'what',
997
+ 'where',
998
+ 'whereis',
999
+ 'who',
1000
+ 'winsid',
1001
+ 'with_module',
1002
+ 'writb',
1003
+ 'write',
1004
+ 'write4b',
1005
+ 'write_csv',
1006
+ 'x_choose',
1007
+ 'x_choose_modeless',
1008
+ 'x_dialog',
1009
+ 'x_mdialog',
1010
+ 'xarc',
1011
+ 'xarcs',
1012
+ 'xarrows',
1013
+ 'xchange',
1014
+ 'xchoicesi',
1015
+ 'xclick',
1016
+ 'xcos',
1017
+ 'xcosAddToolsMenu',
1018
+ 'xcosConfigureXmlFile',
1019
+ 'xcosDiagramToScilab',
1020
+ 'xcosPalCategoryAdd',
1021
+ 'xcosPalDelete',
1022
+ 'xcosPalDisable',
1023
+ 'xcosPalEnable',
1024
+ 'xcosPalGenerateIcon',
1025
+ 'xcosPalGet',
1026
+ 'xcosPalLoad',
1027
+ 'xcosPalMove',
1028
+ 'xcosSimulationStarted',
1029
+ 'xcosUpdateBlock',
1030
+ 'xdel',
1031
+ 'xend',
1032
+ 'xfarc',
1033
+ 'xfarcs',
1034
+ 'xfpoly',
1035
+ 'xfpolys',
1036
+ 'xfrect',
1037
+ 'xget',
1038
+ 'xgetmouse',
1039
+ 'xgraduate',
1040
+ 'xgrid',
1041
+ 'xinit',
1042
+ 'xlfont',
1043
+ 'xls_open',
1044
+ 'xls_read',
1045
+ 'xmlAddNs',
1046
+ 'xmlAppend',
1047
+ 'xmlAsNumber',
1048
+ 'xmlAsText',
1049
+ 'xmlDTD',
1050
+ 'xmlDelete',
1051
+ 'xmlDocument',
1052
+ 'xmlDump',
1053
+ 'xmlElement',
1054
+ 'xmlFormat',
1055
+ 'xmlGetNsByHref',
1056
+ 'xmlGetNsByPrefix',
1057
+ 'xmlGetOpenDocs',
1058
+ 'xmlIsValidObject',
1059
+ 'xmlName',
1060
+ 'xmlNs',
1061
+ 'xmlRead',
1062
+ 'xmlReadStr',
1063
+ 'xmlRelaxNG',
1064
+ 'xmlRemove',
1065
+ 'xmlSchema',
1066
+ 'xmlSetAttributes',
1067
+ 'xmlValidate',
1068
+ 'xmlWrite',
1069
+ 'xmlXPath',
1070
+ 'xname',
1071
+ 'xpause',
1072
+ 'xpoly',
1073
+ 'xpolys',
1074
+ 'xrect',
1075
+ 'xrects',
1076
+ 'xs2bmp',
1077
+ 'xs2emf',
1078
+ 'xs2eps',
1079
+ 'xs2gif',
1080
+ 'xs2jpg',
1081
+ 'xs2pdf',
1082
+ 'xs2png',
1083
+ 'xs2ppm',
1084
+ 'xs2ps',
1085
+ 'xs2svg',
1086
+ 'xsegs',
1087
+ 'xset',
1088
+ 'xstring',
1089
+ 'xstringb',
1090
+ 'xtitle',
1091
+ 'zeros',
1092
+ 'znaupd',
1093
+ 'zneupd',
1094
+ 'zoom_rect',
1095
+ )
1096
+
1097
+ macros_kw = (
1098
+ '!_deff_wrapper',
1099
+ '%0_i_st',
1100
+ '%3d_i_h',
1101
+ '%Block_xcosUpdateBlock',
1102
+ '%TNELDER_p',
1103
+ '%TNELDER_string',
1104
+ '%TNMPLOT_p',
1105
+ '%TNMPLOT_string',
1106
+ '%TOPTIM_p',
1107
+ '%TOPTIM_string',
1108
+ '%TSIMPLEX_p',
1109
+ '%TSIMPLEX_string',
1110
+ '%_EVoid_p',
1111
+ '%_gsort',
1112
+ '%_listvarinfile',
1113
+ '%_rlist',
1114
+ '%_save',
1115
+ '%_sodload',
1116
+ '%_strsplit',
1117
+ '%_unwrap',
1118
+ '%ar_p',
1119
+ '%asn',
1120
+ '%b_a_b',
1121
+ '%b_a_s',
1122
+ '%b_c_s',
1123
+ '%b_c_spb',
1124
+ '%b_cumprod',
1125
+ '%b_cumsum',
1126
+ '%b_d_s',
1127
+ '%b_diag',
1128
+ '%b_e',
1129
+ '%b_f_s',
1130
+ '%b_f_spb',
1131
+ '%b_g_s',
1132
+ '%b_g_spb',
1133
+ '%b_grand',
1134
+ '%b_h_s',
1135
+ '%b_h_spb',
1136
+ '%b_i_b',
1137
+ '%b_i_ce',
1138
+ '%b_i_h',
1139
+ '%b_i_hm',
1140
+ '%b_i_s',
1141
+ '%b_i_sp',
1142
+ '%b_i_spb',
1143
+ '%b_i_st',
1144
+ '%b_iconvert',
1145
+ '%b_l_b',
1146
+ '%b_l_s',
1147
+ '%b_m_b',
1148
+ '%b_m_s',
1149
+ '%b_matrix',
1150
+ '%b_n_hm',
1151
+ '%b_o_hm',
1152
+ '%b_p_s',
1153
+ '%b_prod',
1154
+ '%b_r_b',
1155
+ '%b_r_s',
1156
+ '%b_s_b',
1157
+ '%b_s_s',
1158
+ '%b_string',
1159
+ '%b_sum',
1160
+ '%b_tril',
1161
+ '%b_triu',
1162
+ '%b_x_b',
1163
+ '%b_x_s',
1164
+ '%bicg',
1165
+ '%bicgstab',
1166
+ '%c_a_c',
1167
+ '%c_b_c',
1168
+ '%c_b_s',
1169
+ '%c_diag',
1170
+ '%c_dsearch',
1171
+ '%c_e',
1172
+ '%c_eye',
1173
+ '%c_f_s',
1174
+ '%c_grand',
1175
+ '%c_i_c',
1176
+ '%c_i_ce',
1177
+ '%c_i_h',
1178
+ '%c_i_hm',
1179
+ '%c_i_lss',
1180
+ '%c_i_r',
1181
+ '%c_i_s',
1182
+ '%c_i_st',
1183
+ '%c_matrix',
1184
+ '%c_n_l',
1185
+ '%c_n_st',
1186
+ '%c_o_l',
1187
+ '%c_o_st',
1188
+ '%c_ones',
1189
+ '%c_rand',
1190
+ '%c_tril',
1191
+ '%c_triu',
1192
+ '%cblock_c_cblock',
1193
+ '%cblock_c_s',
1194
+ '%cblock_e',
1195
+ '%cblock_f_cblock',
1196
+ '%cblock_p',
1197
+ '%cblock_size',
1198
+ '%ce_6',
1199
+ '%ce_c_ce',
1200
+ '%ce_e',
1201
+ '%ce_f_ce',
1202
+ '%ce_i_ce',
1203
+ '%ce_i_s',
1204
+ '%ce_i_st',
1205
+ '%ce_matrix',
1206
+ '%ce_p',
1207
+ '%ce_size',
1208
+ '%ce_string',
1209
+ '%ce_t',
1210
+ '%cgs',
1211
+ '%champdat_i_h',
1212
+ '%choose',
1213
+ '%diagram_xcos',
1214
+ '%dir_p',
1215
+ '%fptr_i_st',
1216
+ '%grand_perm',
1217
+ '%grayplot_i_h',
1218
+ '%h_i_st',
1219
+ '%hmS_k_hmS_generic',
1220
+ '%hm_1_hm',
1221
+ '%hm_1_s',
1222
+ '%hm_2_hm',
1223
+ '%hm_2_s',
1224
+ '%hm_3_hm',
1225
+ '%hm_3_s',
1226
+ '%hm_4_hm',
1227
+ '%hm_4_s',
1228
+ '%hm_5',
1229
+ '%hm_a_hm',
1230
+ '%hm_a_r',
1231
+ '%hm_a_s',
1232
+ '%hm_abs',
1233
+ '%hm_and',
1234
+ '%hm_bool2s',
1235
+ '%hm_c_hm',
1236
+ '%hm_ceil',
1237
+ '%hm_conj',
1238
+ '%hm_cos',
1239
+ '%hm_cumprod',
1240
+ '%hm_cumsum',
1241
+ '%hm_d_hm',
1242
+ '%hm_d_s',
1243
+ '%hm_degree',
1244
+ '%hm_dsearch',
1245
+ '%hm_e',
1246
+ '%hm_exp',
1247
+ '%hm_eye',
1248
+ '%hm_f_hm',
1249
+ '%hm_find',
1250
+ '%hm_floor',
1251
+ '%hm_g_hm',
1252
+ '%hm_grand',
1253
+ '%hm_gsort',
1254
+ '%hm_h_hm',
1255
+ '%hm_i_b',
1256
+ '%hm_i_ce',
1257
+ '%hm_i_h',
1258
+ '%hm_i_hm',
1259
+ '%hm_i_i',
1260
+ '%hm_i_p',
1261
+ '%hm_i_r',
1262
+ '%hm_i_s',
1263
+ '%hm_i_st',
1264
+ '%hm_iconvert',
1265
+ '%hm_imag',
1266
+ '%hm_int',
1267
+ '%hm_isnan',
1268
+ '%hm_isreal',
1269
+ '%hm_j_hm',
1270
+ '%hm_j_s',
1271
+ '%hm_k_hm',
1272
+ '%hm_k_s',
1273
+ '%hm_log',
1274
+ '%hm_m_p',
1275
+ '%hm_m_r',
1276
+ '%hm_m_s',
1277
+ '%hm_matrix',
1278
+ '%hm_max',
1279
+ '%hm_mean',
1280
+ '%hm_median',
1281
+ '%hm_min',
1282
+ '%hm_n_b',
1283
+ '%hm_n_c',
1284
+ '%hm_n_hm',
1285
+ '%hm_n_i',
1286
+ '%hm_n_p',
1287
+ '%hm_n_s',
1288
+ '%hm_o_b',
1289
+ '%hm_o_c',
1290
+ '%hm_o_hm',
1291
+ '%hm_o_i',
1292
+ '%hm_o_p',
1293
+ '%hm_o_s',
1294
+ '%hm_ones',
1295
+ '%hm_or',
1296
+ '%hm_p',
1297
+ '%hm_prod',
1298
+ '%hm_q_hm',
1299
+ '%hm_r_s',
1300
+ '%hm_rand',
1301
+ '%hm_real',
1302
+ '%hm_round',
1303
+ '%hm_s',
1304
+ '%hm_s_hm',
1305
+ '%hm_s_r',
1306
+ '%hm_s_s',
1307
+ '%hm_sign',
1308
+ '%hm_sin',
1309
+ '%hm_size',
1310
+ '%hm_sqrt',
1311
+ '%hm_stdev',
1312
+ '%hm_string',
1313
+ '%hm_sum',
1314
+ '%hm_x_hm',
1315
+ '%hm_x_p',
1316
+ '%hm_x_s',
1317
+ '%hm_zeros',
1318
+ '%i_1_s',
1319
+ '%i_2_s',
1320
+ '%i_3_s',
1321
+ '%i_4_s',
1322
+ '%i_Matplot',
1323
+ '%i_a_i',
1324
+ '%i_a_s',
1325
+ '%i_and',
1326
+ '%i_ascii',
1327
+ '%i_b_s',
1328
+ '%i_bezout',
1329
+ '%i_champ',
1330
+ '%i_champ1',
1331
+ '%i_contour',
1332
+ '%i_contour2d',
1333
+ '%i_d_i',
1334
+ '%i_d_s',
1335
+ '%i_dsearch',
1336
+ '%i_e',
1337
+ '%i_fft',
1338
+ '%i_g_i',
1339
+ '%i_gcd',
1340
+ '%i_grand',
1341
+ '%i_h_i',
1342
+ '%i_i_ce',
1343
+ '%i_i_h',
1344
+ '%i_i_hm',
1345
+ '%i_i_i',
1346
+ '%i_i_s',
1347
+ '%i_i_st',
1348
+ '%i_j_i',
1349
+ '%i_j_s',
1350
+ '%i_l_s',
1351
+ '%i_lcm',
1352
+ '%i_length',
1353
+ '%i_m_i',
1354
+ '%i_m_s',
1355
+ '%i_mfprintf',
1356
+ '%i_mprintf',
1357
+ '%i_msprintf',
1358
+ '%i_n_s',
1359
+ '%i_o_s',
1360
+ '%i_or',
1361
+ '%i_p_i',
1362
+ '%i_p_s',
1363
+ '%i_plot2d',
1364
+ '%i_plot2d1',
1365
+ '%i_plot2d2',
1366
+ '%i_q_s',
1367
+ '%i_r_i',
1368
+ '%i_r_s',
1369
+ '%i_round',
1370
+ '%i_s_i',
1371
+ '%i_s_s',
1372
+ '%i_sign',
1373
+ '%i_string',
1374
+ '%i_x_i',
1375
+ '%i_x_s',
1376
+ '%ip_a_s',
1377
+ '%ip_i_st',
1378
+ '%ip_m_s',
1379
+ '%ip_n_ip',
1380
+ '%ip_o_ip',
1381
+ '%ip_p',
1382
+ '%ip_part',
1383
+ '%ip_s_s',
1384
+ '%ip_string',
1385
+ '%k',
1386
+ '%l_i_h',
1387
+ '%l_i_s',
1388
+ '%l_i_st',
1389
+ '%l_isequal',
1390
+ '%l_n_c',
1391
+ '%l_n_l',
1392
+ '%l_n_m',
1393
+ '%l_n_p',
1394
+ '%l_n_s',
1395
+ '%l_n_st',
1396
+ '%l_o_c',
1397
+ '%l_o_l',
1398
+ '%l_o_m',
1399
+ '%l_o_p',
1400
+ '%l_o_s',
1401
+ '%l_o_st',
1402
+ '%lss_a_lss',
1403
+ '%lss_a_p',
1404
+ '%lss_a_r',
1405
+ '%lss_a_s',
1406
+ '%lss_c_lss',
1407
+ '%lss_c_p',
1408
+ '%lss_c_r',
1409
+ '%lss_c_s',
1410
+ '%lss_e',
1411
+ '%lss_eye',
1412
+ '%lss_f_lss',
1413
+ '%lss_f_p',
1414
+ '%lss_f_r',
1415
+ '%lss_f_s',
1416
+ '%lss_i_ce',
1417
+ '%lss_i_lss',
1418
+ '%lss_i_p',
1419
+ '%lss_i_r',
1420
+ '%lss_i_s',
1421
+ '%lss_i_st',
1422
+ '%lss_inv',
1423
+ '%lss_l_lss',
1424
+ '%lss_l_p',
1425
+ '%lss_l_r',
1426
+ '%lss_l_s',
1427
+ '%lss_m_lss',
1428
+ '%lss_m_p',
1429
+ '%lss_m_r',
1430
+ '%lss_m_s',
1431
+ '%lss_n_lss',
1432
+ '%lss_n_p',
1433
+ '%lss_n_r',
1434
+ '%lss_n_s',
1435
+ '%lss_norm',
1436
+ '%lss_o_lss',
1437
+ '%lss_o_p',
1438
+ '%lss_o_r',
1439
+ '%lss_o_s',
1440
+ '%lss_ones',
1441
+ '%lss_r_lss',
1442
+ '%lss_r_p',
1443
+ '%lss_r_r',
1444
+ '%lss_r_s',
1445
+ '%lss_rand',
1446
+ '%lss_s',
1447
+ '%lss_s_lss',
1448
+ '%lss_s_p',
1449
+ '%lss_s_r',
1450
+ '%lss_s_s',
1451
+ '%lss_size',
1452
+ '%lss_t',
1453
+ '%lss_v_lss',
1454
+ '%lss_v_p',
1455
+ '%lss_v_r',
1456
+ '%lss_v_s',
1457
+ '%lt_i_s',
1458
+ '%m_n_l',
1459
+ '%m_o_l',
1460
+ '%mc_i_h',
1461
+ '%mc_i_s',
1462
+ '%mc_i_st',
1463
+ '%mc_n_st',
1464
+ '%mc_o_st',
1465
+ '%mc_string',
1466
+ '%mps_p',
1467
+ '%mps_string',
1468
+ '%msp_a_s',
1469
+ '%msp_abs',
1470
+ '%msp_e',
1471
+ '%msp_find',
1472
+ '%msp_i_s',
1473
+ '%msp_i_st',
1474
+ '%msp_length',
1475
+ '%msp_m_s',
1476
+ '%msp_maxi',
1477
+ '%msp_n_msp',
1478
+ '%msp_nnz',
1479
+ '%msp_o_msp',
1480
+ '%msp_p',
1481
+ '%msp_sparse',
1482
+ '%msp_spones',
1483
+ '%msp_t',
1484
+ '%p_a_lss',
1485
+ '%p_a_r',
1486
+ '%p_c_lss',
1487
+ '%p_c_r',
1488
+ '%p_cumprod',
1489
+ '%p_cumsum',
1490
+ '%p_d_p',
1491
+ '%p_d_r',
1492
+ '%p_d_s',
1493
+ '%p_det',
1494
+ '%p_e',
1495
+ '%p_f_lss',
1496
+ '%p_f_r',
1497
+ '%p_grand',
1498
+ '%p_i_ce',
1499
+ '%p_i_h',
1500
+ '%p_i_hm',
1501
+ '%p_i_lss',
1502
+ '%p_i_p',
1503
+ '%p_i_r',
1504
+ '%p_i_s',
1505
+ '%p_i_st',
1506
+ '%p_inv',
1507
+ '%p_j_s',
1508
+ '%p_k_p',
1509
+ '%p_k_r',
1510
+ '%p_k_s',
1511
+ '%p_l_lss',
1512
+ '%p_l_p',
1513
+ '%p_l_r',
1514
+ '%p_l_s',
1515
+ '%p_m_hm',
1516
+ '%p_m_lss',
1517
+ '%p_m_r',
1518
+ '%p_matrix',
1519
+ '%p_n_l',
1520
+ '%p_n_lss',
1521
+ '%p_n_r',
1522
+ '%p_o_l',
1523
+ '%p_o_lss',
1524
+ '%p_o_r',
1525
+ '%p_o_sp',
1526
+ '%p_p_s',
1527
+ '%p_part',
1528
+ '%p_prod',
1529
+ '%p_q_p',
1530
+ '%p_q_r',
1531
+ '%p_q_s',
1532
+ '%p_r_lss',
1533
+ '%p_r_p',
1534
+ '%p_r_r',
1535
+ '%p_r_s',
1536
+ '%p_s_lss',
1537
+ '%p_s_r',
1538
+ '%p_simp',
1539
+ '%p_string',
1540
+ '%p_sum',
1541
+ '%p_v_lss',
1542
+ '%p_v_p',
1543
+ '%p_v_r',
1544
+ '%p_v_s',
1545
+ '%p_x_hm',
1546
+ '%p_x_r',
1547
+ '%p_y_p',
1548
+ '%p_y_r',
1549
+ '%p_y_s',
1550
+ '%p_z_p',
1551
+ '%p_z_r',
1552
+ '%p_z_s',
1553
+ '%pcg',
1554
+ '%plist_p',
1555
+ '%plist_string',
1556
+ '%r_0',
1557
+ '%r_a_hm',
1558
+ '%r_a_lss',
1559
+ '%r_a_p',
1560
+ '%r_a_r',
1561
+ '%r_a_s',
1562
+ '%r_c_lss',
1563
+ '%r_c_p',
1564
+ '%r_c_r',
1565
+ '%r_c_s',
1566
+ '%r_clean',
1567
+ '%r_cumprod',
1568
+ '%r_cumsum',
1569
+ '%r_d_p',
1570
+ '%r_d_r',
1571
+ '%r_d_s',
1572
+ '%r_det',
1573
+ '%r_diag',
1574
+ '%r_e',
1575
+ '%r_eye',
1576
+ '%r_f_lss',
1577
+ '%r_f_p',
1578
+ '%r_f_r',
1579
+ '%r_f_s',
1580
+ '%r_i_ce',
1581
+ '%r_i_hm',
1582
+ '%r_i_lss',
1583
+ '%r_i_p',
1584
+ '%r_i_r',
1585
+ '%r_i_s',
1586
+ '%r_i_st',
1587
+ '%r_inv',
1588
+ '%r_j_s',
1589
+ '%r_k_p',
1590
+ '%r_k_r',
1591
+ '%r_k_s',
1592
+ '%r_l_lss',
1593
+ '%r_l_p',
1594
+ '%r_l_r',
1595
+ '%r_l_s',
1596
+ '%r_m_hm',
1597
+ '%r_m_lss',
1598
+ '%r_m_p',
1599
+ '%r_m_r',
1600
+ '%r_m_s',
1601
+ '%r_matrix',
1602
+ '%r_n_lss',
1603
+ '%r_n_p',
1604
+ '%r_n_r',
1605
+ '%r_n_s',
1606
+ '%r_norm',
1607
+ '%r_o_lss',
1608
+ '%r_o_p',
1609
+ '%r_o_r',
1610
+ '%r_o_s',
1611
+ '%r_ones',
1612
+ '%r_p',
1613
+ '%r_p_s',
1614
+ '%r_prod',
1615
+ '%r_q_p',
1616
+ '%r_q_r',
1617
+ '%r_q_s',
1618
+ '%r_r_lss',
1619
+ '%r_r_p',
1620
+ '%r_r_r',
1621
+ '%r_r_s',
1622
+ '%r_rand',
1623
+ '%r_s',
1624
+ '%r_s_hm',
1625
+ '%r_s_lss',
1626
+ '%r_s_p',
1627
+ '%r_s_r',
1628
+ '%r_s_s',
1629
+ '%r_simp',
1630
+ '%r_size',
1631
+ '%r_string',
1632
+ '%r_sum',
1633
+ '%r_t',
1634
+ '%r_tril',
1635
+ '%r_triu',
1636
+ '%r_v_lss',
1637
+ '%r_v_p',
1638
+ '%r_v_r',
1639
+ '%r_v_s',
1640
+ '%r_varn',
1641
+ '%r_x_p',
1642
+ '%r_x_r',
1643
+ '%r_x_s',
1644
+ '%r_y_p',
1645
+ '%r_y_r',
1646
+ '%r_y_s',
1647
+ '%r_z_p',
1648
+ '%r_z_r',
1649
+ '%r_z_s',
1650
+ '%s_1_hm',
1651
+ '%s_1_i',
1652
+ '%s_2_hm',
1653
+ '%s_2_i',
1654
+ '%s_3_hm',
1655
+ '%s_3_i',
1656
+ '%s_4_hm',
1657
+ '%s_4_i',
1658
+ '%s_5',
1659
+ '%s_a_b',
1660
+ '%s_a_hm',
1661
+ '%s_a_i',
1662
+ '%s_a_ip',
1663
+ '%s_a_lss',
1664
+ '%s_a_msp',
1665
+ '%s_a_r',
1666
+ '%s_a_sp',
1667
+ '%s_and',
1668
+ '%s_b_i',
1669
+ '%s_b_s',
1670
+ '%s_bezout',
1671
+ '%s_c_b',
1672
+ '%s_c_cblock',
1673
+ '%s_c_lss',
1674
+ '%s_c_r',
1675
+ '%s_c_sp',
1676
+ '%s_d_b',
1677
+ '%s_d_i',
1678
+ '%s_d_p',
1679
+ '%s_d_r',
1680
+ '%s_d_sp',
1681
+ '%s_e',
1682
+ '%s_f_b',
1683
+ '%s_f_cblock',
1684
+ '%s_f_lss',
1685
+ '%s_f_r',
1686
+ '%s_f_sp',
1687
+ '%s_g_b',
1688
+ '%s_g_s',
1689
+ '%s_gcd',
1690
+ '%s_grand',
1691
+ '%s_h_b',
1692
+ '%s_h_s',
1693
+ '%s_i_b',
1694
+ '%s_i_c',
1695
+ '%s_i_ce',
1696
+ '%s_i_h',
1697
+ '%s_i_hm',
1698
+ '%s_i_i',
1699
+ '%s_i_lss',
1700
+ '%s_i_p',
1701
+ '%s_i_r',
1702
+ '%s_i_s',
1703
+ '%s_i_sp',
1704
+ '%s_i_spb',
1705
+ '%s_i_st',
1706
+ '%s_j_i',
1707
+ '%s_k_hm',
1708
+ '%s_k_p',
1709
+ '%s_k_r',
1710
+ '%s_k_sp',
1711
+ '%s_l_b',
1712
+ '%s_l_hm',
1713
+ '%s_l_i',
1714
+ '%s_l_lss',
1715
+ '%s_l_p',
1716
+ '%s_l_r',
1717
+ '%s_l_s',
1718
+ '%s_l_sp',
1719
+ '%s_lcm',
1720
+ '%s_m_b',
1721
+ '%s_m_hm',
1722
+ '%s_m_i',
1723
+ '%s_m_ip',
1724
+ '%s_m_lss',
1725
+ '%s_m_msp',
1726
+ '%s_m_r',
1727
+ '%s_matrix',
1728
+ '%s_n_hm',
1729
+ '%s_n_i',
1730
+ '%s_n_l',
1731
+ '%s_n_lss',
1732
+ '%s_n_r',
1733
+ '%s_n_st',
1734
+ '%s_o_hm',
1735
+ '%s_o_i',
1736
+ '%s_o_l',
1737
+ '%s_o_lss',
1738
+ '%s_o_r',
1739
+ '%s_o_st',
1740
+ '%s_or',
1741
+ '%s_p_b',
1742
+ '%s_p_i',
1743
+ '%s_pow',
1744
+ '%s_q_hm',
1745
+ '%s_q_i',
1746
+ '%s_q_p',
1747
+ '%s_q_r',
1748
+ '%s_q_sp',
1749
+ '%s_r_b',
1750
+ '%s_r_i',
1751
+ '%s_r_lss',
1752
+ '%s_r_p',
1753
+ '%s_r_r',
1754
+ '%s_r_s',
1755
+ '%s_r_sp',
1756
+ '%s_s_b',
1757
+ '%s_s_hm',
1758
+ '%s_s_i',
1759
+ '%s_s_ip',
1760
+ '%s_s_lss',
1761
+ '%s_s_r',
1762
+ '%s_s_sp',
1763
+ '%s_simp',
1764
+ '%s_v_lss',
1765
+ '%s_v_p',
1766
+ '%s_v_r',
1767
+ '%s_v_s',
1768
+ '%s_x_b',
1769
+ '%s_x_hm',
1770
+ '%s_x_i',
1771
+ '%s_x_r',
1772
+ '%s_y_p',
1773
+ '%s_y_r',
1774
+ '%s_y_sp',
1775
+ '%s_z_p',
1776
+ '%s_z_r',
1777
+ '%s_z_sp',
1778
+ '%sn',
1779
+ '%sp_a_s',
1780
+ '%sp_a_sp',
1781
+ '%sp_and',
1782
+ '%sp_c_s',
1783
+ '%sp_ceil',
1784
+ '%sp_conj',
1785
+ '%sp_cos',
1786
+ '%sp_cumprod',
1787
+ '%sp_cumsum',
1788
+ '%sp_d_s',
1789
+ '%sp_d_sp',
1790
+ '%sp_det',
1791
+ '%sp_diag',
1792
+ '%sp_e',
1793
+ '%sp_exp',
1794
+ '%sp_f_s',
1795
+ '%sp_floor',
1796
+ '%sp_grand',
1797
+ '%sp_gsort',
1798
+ '%sp_i_ce',
1799
+ '%sp_i_h',
1800
+ '%sp_i_s',
1801
+ '%sp_i_sp',
1802
+ '%sp_i_st',
1803
+ '%sp_int',
1804
+ '%sp_inv',
1805
+ '%sp_k_s',
1806
+ '%sp_k_sp',
1807
+ '%sp_l_s',
1808
+ '%sp_l_sp',
1809
+ '%sp_length',
1810
+ '%sp_max',
1811
+ '%sp_min',
1812
+ '%sp_norm',
1813
+ '%sp_or',
1814
+ '%sp_p_s',
1815
+ '%sp_prod',
1816
+ '%sp_q_s',
1817
+ '%sp_q_sp',
1818
+ '%sp_r_s',
1819
+ '%sp_r_sp',
1820
+ '%sp_round',
1821
+ '%sp_s_s',
1822
+ '%sp_s_sp',
1823
+ '%sp_sin',
1824
+ '%sp_sqrt',
1825
+ '%sp_string',
1826
+ '%sp_sum',
1827
+ '%sp_tril',
1828
+ '%sp_triu',
1829
+ '%sp_y_s',
1830
+ '%sp_y_sp',
1831
+ '%sp_z_s',
1832
+ '%sp_z_sp',
1833
+ '%spb_and',
1834
+ '%spb_c_b',
1835
+ '%spb_cumprod',
1836
+ '%spb_cumsum',
1837
+ '%spb_diag',
1838
+ '%spb_e',
1839
+ '%spb_f_b',
1840
+ '%spb_g_b',
1841
+ '%spb_g_spb',
1842
+ '%spb_h_b',
1843
+ '%spb_h_spb',
1844
+ '%spb_i_b',
1845
+ '%spb_i_ce',
1846
+ '%spb_i_h',
1847
+ '%spb_i_st',
1848
+ '%spb_or',
1849
+ '%spb_prod',
1850
+ '%spb_sum',
1851
+ '%spb_tril',
1852
+ '%spb_triu',
1853
+ '%st_6',
1854
+ '%st_c_st',
1855
+ '%st_e',
1856
+ '%st_f_st',
1857
+ '%st_i_b',
1858
+ '%st_i_c',
1859
+ '%st_i_fptr',
1860
+ '%st_i_h',
1861
+ '%st_i_i',
1862
+ '%st_i_ip',
1863
+ '%st_i_lss',
1864
+ '%st_i_msp',
1865
+ '%st_i_p',
1866
+ '%st_i_r',
1867
+ '%st_i_s',
1868
+ '%st_i_sp',
1869
+ '%st_i_spb',
1870
+ '%st_i_st',
1871
+ '%st_matrix',
1872
+ '%st_n_c',
1873
+ '%st_n_l',
1874
+ '%st_n_mc',
1875
+ '%st_n_p',
1876
+ '%st_n_s',
1877
+ '%st_o_c',
1878
+ '%st_o_l',
1879
+ '%st_o_mc',
1880
+ '%st_o_p',
1881
+ '%st_o_s',
1882
+ '%st_o_tl',
1883
+ '%st_p',
1884
+ '%st_size',
1885
+ '%st_string',
1886
+ '%st_t',
1887
+ '%ticks_i_h',
1888
+ '%xls_e',
1889
+ '%xls_p',
1890
+ '%xlssheet_e',
1891
+ '%xlssheet_p',
1892
+ '%xlssheet_size',
1893
+ '%xlssheet_string',
1894
+ 'DominationRank',
1895
+ 'G_make',
1896
+ 'IsAScalar',
1897
+ 'NDcost',
1898
+ 'OS_Version',
1899
+ 'PlotSparse',
1900
+ 'ReadHBSparse',
1901
+ 'TCL_CreateSlave',
1902
+ 'abcd',
1903
+ 'abinv',
1904
+ 'accept_func_default',
1905
+ 'accept_func_vfsa',
1906
+ 'acf',
1907
+ 'acosd',
1908
+ 'acosh',
1909
+ 'acoshm',
1910
+ 'acosm',
1911
+ 'acot',
1912
+ 'acotd',
1913
+ 'acoth',
1914
+ 'acsc',
1915
+ 'acscd',
1916
+ 'acsch',
1917
+ 'add_demo',
1918
+ 'add_help_chapter',
1919
+ 'add_module_help_chapter',
1920
+ 'add_param',
1921
+ 'add_profiling',
1922
+ 'adj2sp',
1923
+ 'aff2ab',
1924
+ 'ana_style',
1925
+ 'analpf',
1926
+ 'analyze',
1927
+ 'aplat',
1928
+ 'arhnk',
1929
+ 'arl2',
1930
+ 'arma2p',
1931
+ 'arma2ss',
1932
+ 'armac',
1933
+ 'armax',
1934
+ 'armax1',
1935
+ 'arobasestring2strings',
1936
+ 'arsimul',
1937
+ 'ascii2string',
1938
+ 'asciimat',
1939
+ 'asec',
1940
+ 'asecd',
1941
+ 'asech',
1942
+ 'asind',
1943
+ 'asinh',
1944
+ 'asinhm',
1945
+ 'asinm',
1946
+ 'assert_checkalmostequal',
1947
+ 'assert_checkequal',
1948
+ 'assert_checkerror',
1949
+ 'assert_checkfalse',
1950
+ 'assert_checkfilesequal',
1951
+ 'assert_checktrue',
1952
+ 'assert_comparecomplex',
1953
+ 'assert_computedigits',
1954
+ 'assert_cond2reltol',
1955
+ 'assert_cond2reqdigits',
1956
+ 'assert_generror',
1957
+ 'atand',
1958
+ 'atanh',
1959
+ 'atanhm',
1960
+ 'atanm',
1961
+ 'atomsAutoload',
1962
+ 'atomsAutoloadAdd',
1963
+ 'atomsAutoloadDel',
1964
+ 'atomsAutoloadList',
1965
+ 'atomsCategoryList',
1966
+ 'atomsCheckModule',
1967
+ 'atomsDepTreeShow',
1968
+ 'atomsGetConfig',
1969
+ 'atomsGetInstalled',
1970
+ 'atomsGetInstalledPath',
1971
+ 'atomsGetLoaded',
1972
+ 'atomsGetLoadedPath',
1973
+ 'atomsInstall',
1974
+ 'atomsIsInstalled',
1975
+ 'atomsIsLoaded',
1976
+ 'atomsList',
1977
+ 'atomsLoad',
1978
+ 'atomsQuit',
1979
+ 'atomsRemove',
1980
+ 'atomsRepositoryAdd',
1981
+ 'atomsRepositoryDel',
1982
+ 'atomsRepositoryList',
1983
+ 'atomsRestoreConfig',
1984
+ 'atomsSaveConfig',
1985
+ 'atomsSearch',
1986
+ 'atomsSetConfig',
1987
+ 'atomsShow',
1988
+ 'atomsSystemInit',
1989
+ 'atomsSystemUpdate',
1990
+ 'atomsTest',
1991
+ 'atomsUpdate',
1992
+ 'atomsVersion',
1993
+ 'augment',
1994
+ 'auread',
1995
+ 'auwrite',
1996
+ 'balreal',
1997
+ 'bench_run',
1998
+ 'bilin',
1999
+ 'bilt',
2000
+ 'bin2dec',
2001
+ 'binomial',
2002
+ 'bitand',
2003
+ 'bitcmp',
2004
+ 'bitget',
2005
+ 'bitor',
2006
+ 'bitset',
2007
+ 'bitxor',
2008
+ 'black',
2009
+ 'blanks',
2010
+ 'bloc2exp',
2011
+ 'bloc2ss',
2012
+ 'block_parameter_error',
2013
+ 'bode',
2014
+ 'bode_asymp',
2015
+ 'bstap',
2016
+ 'buttmag',
2017
+ 'bvodeS',
2018
+ 'bytecode',
2019
+ 'bytecodewalk',
2020
+ 'cainv',
2021
+ 'calendar',
2022
+ 'calerf',
2023
+ 'calfrq',
2024
+ 'canon',
2025
+ 'casc',
2026
+ 'cat',
2027
+ 'cat_code',
2028
+ 'cb_m2sci_gui',
2029
+ 'ccontrg',
2030
+ 'cell',
2031
+ 'cell2mat',
2032
+ 'cellstr',
2033
+ 'center',
2034
+ 'cepstrum',
2035
+ 'cfspec',
2036
+ 'char',
2037
+ 'chart',
2038
+ 'cheb1mag',
2039
+ 'cheb2mag',
2040
+ 'check_gateways',
2041
+ 'check_modules_xml',
2042
+ 'check_versions',
2043
+ 'chepol',
2044
+ 'chfact',
2045
+ 'chsolve',
2046
+ 'classmarkov',
2047
+ 'clean_help',
2048
+ 'clock',
2049
+ 'cls2dls',
2050
+ 'cmb_lin',
2051
+ 'cmndred',
2052
+ 'cmoment',
2053
+ 'coding_ga_binary',
2054
+ 'coding_ga_identity',
2055
+ 'coff',
2056
+ 'coffg',
2057
+ 'colcomp',
2058
+ 'colcompr',
2059
+ 'colinout',
2060
+ 'colregul',
2061
+ 'companion',
2062
+ 'complex',
2063
+ 'compute_initial_temp',
2064
+ 'cond',
2065
+ 'cond2sp',
2066
+ 'condestsp',
2067
+ 'configure_msifort',
2068
+ 'configure_msvc',
2069
+ 'conjgrad',
2070
+ 'cont_frm',
2071
+ 'cont_mat',
2072
+ 'contrss',
2073
+ 'conv',
2074
+ 'convert_to_float',
2075
+ 'convertindex',
2076
+ 'convol',
2077
+ 'convol2d',
2078
+ 'copfac',
2079
+ 'correl',
2080
+ 'cosd',
2081
+ 'cosh',
2082
+ 'coshm',
2083
+ 'cosm',
2084
+ 'cotd',
2085
+ 'cotg',
2086
+ 'coth',
2087
+ 'cothm',
2088
+ 'cov',
2089
+ 'covar',
2090
+ 'createXConfiguration',
2091
+ 'createfun',
2092
+ 'createstruct',
2093
+ 'cross',
2094
+ 'crossover_ga_binary',
2095
+ 'crossover_ga_default',
2096
+ 'csc',
2097
+ 'cscd',
2098
+ 'csch',
2099
+ 'csgn',
2100
+ 'csim',
2101
+ 'cspect',
2102
+ 'ctr_gram',
2103
+ 'czt',
2104
+ 'dae',
2105
+ 'daeoptions',
2106
+ 'damp',
2107
+ 'datafit',
2108
+ 'date',
2109
+ 'datenum',
2110
+ 'datevec',
2111
+ 'dbphi',
2112
+ 'dcf',
2113
+ 'ddp',
2114
+ 'dec2bin',
2115
+ 'dec2hex',
2116
+ 'dec2oct',
2117
+ 'del_help_chapter',
2118
+ 'del_module_help_chapter',
2119
+ 'demo_begin',
2120
+ 'demo_choose',
2121
+ 'demo_compiler',
2122
+ 'demo_end',
2123
+ 'demo_file_choice',
2124
+ 'demo_folder_choice',
2125
+ 'demo_function_choice',
2126
+ 'demo_gui',
2127
+ 'demo_run',
2128
+ 'demo_viewCode',
2129
+ 'denom',
2130
+ 'derivat',
2131
+ 'derivative',
2132
+ 'des2ss',
2133
+ 'des2tf',
2134
+ 'detectmsifort64tools',
2135
+ 'detectmsvc64tools',
2136
+ 'determ',
2137
+ 'detr',
2138
+ 'detrend',
2139
+ 'devtools_run_builder',
2140
+ 'dhnorm',
2141
+ 'diff',
2142
+ 'diophant',
2143
+ 'dir',
2144
+ 'dirname',
2145
+ 'dispfiles',
2146
+ 'dllinfo',
2147
+ 'dscr',
2148
+ 'dsimul',
2149
+ 'dt_ility',
2150
+ 'dtsi',
2151
+ 'edit',
2152
+ 'edit_error',
2153
+ 'editor',
2154
+ 'eigenmarkov',
2155
+ 'eigs',
2156
+ 'ell1mag',
2157
+ 'enlarge_shape',
2158
+ 'entropy',
2159
+ 'eomday',
2160
+ 'epred',
2161
+ 'eqfir',
2162
+ 'eqiir',
2163
+ 'equil',
2164
+ 'equil1',
2165
+ 'erfinv',
2166
+ 'etime',
2167
+ 'eval',
2168
+ 'evans',
2169
+ 'evstr',
2170
+ 'example_run',
2171
+ 'expression2code',
2172
+ 'extract_help_examples',
2173
+ 'factor',
2174
+ 'factorial',
2175
+ 'factors',
2176
+ 'faurre',
2177
+ 'ffilt',
2178
+ 'fft2',
2179
+ 'fftshift',
2180
+ 'fieldnames',
2181
+ 'filt_sinc',
2182
+ 'filter',
2183
+ 'findABCD',
2184
+ 'findAC',
2185
+ 'findBDK',
2186
+ 'findR',
2187
+ 'find_freq',
2188
+ 'find_links',
2189
+ 'find_scicos_version',
2190
+ 'findm',
2191
+ 'findmsifortcompiler',
2192
+ 'findmsvccompiler',
2193
+ 'findx0BD',
2194
+ 'firstnonsingleton',
2195
+ 'fix',
2196
+ 'fixedpointgcd',
2197
+ 'flipdim',
2198
+ 'flts',
2199
+ 'fminsearch',
2200
+ 'formatBlackTip',
2201
+ 'formatBodeMagTip',
2202
+ 'formatBodePhaseTip',
2203
+ 'formatGainplotTip',
2204
+ 'formatHallModuleTip',
2205
+ 'formatHallPhaseTip',
2206
+ 'formatNicholsGainTip',
2207
+ 'formatNicholsPhaseTip',
2208
+ 'formatNyquistTip',
2209
+ 'formatPhaseplotTip',
2210
+ 'formatSgridDampingTip',
2211
+ 'formatSgridFreqTip',
2212
+ 'formatZgridDampingTip',
2213
+ 'formatZgridFreqTip',
2214
+ 'format_txt',
2215
+ 'fourplan',
2216
+ 'frep2tf',
2217
+ 'freson',
2218
+ 'frfit',
2219
+ 'frmag',
2220
+ 'fseek_origin',
2221
+ 'fsfirlin',
2222
+ 'fspec',
2223
+ 'fspecg',
2224
+ 'fstabst',
2225
+ 'ftest',
2226
+ 'ftuneq',
2227
+ 'fullfile',
2228
+ 'fullrf',
2229
+ 'fullrfk',
2230
+ 'fun2string',
2231
+ 'g_margin',
2232
+ 'gainplot',
2233
+ 'gamitg',
2234
+ 'gcare',
2235
+ 'gcd',
2236
+ 'gencompilationflags_unix',
2237
+ 'generateBlockImage',
2238
+ 'generateBlockImages',
2239
+ 'generic_i_ce',
2240
+ 'generic_i_h',
2241
+ 'generic_i_hm',
2242
+ 'generic_i_s',
2243
+ 'generic_i_st',
2244
+ 'genlib',
2245
+ 'genmarkov',
2246
+ 'geomean',
2247
+ 'getDiagramVersion',
2248
+ 'getModelicaPath',
2249
+ 'getPreferencesValue',
2250
+ 'get_file_path',
2251
+ 'get_function_path',
2252
+ 'get_param',
2253
+ 'get_profile',
2254
+ 'get_scicos_version',
2255
+ 'getd',
2256
+ 'getscilabkeywords',
2257
+ 'getshell',
2258
+ 'gettklib',
2259
+ 'gfare',
2260
+ 'gfrancis',
2261
+ 'givens',
2262
+ 'glever',
2263
+ 'gmres',
2264
+ 'group',
2265
+ 'gschur',
2266
+ 'gspec',
2267
+ 'gtild',
2268
+ 'h2norm',
2269
+ 'h_cl',
2270
+ 'h_inf',
2271
+ 'h_inf_st',
2272
+ 'h_norm',
2273
+ 'hallchart',
2274
+ 'halt',
2275
+ 'hank',
2276
+ 'hankelsv',
2277
+ 'harmean',
2278
+ 'haveacompiler',
2279
+ 'head_comments',
2280
+ 'help_from_sci',
2281
+ 'help_skeleton',
2282
+ 'hermit',
2283
+ 'hex2dec',
2284
+ 'hilb',
2285
+ 'hilbert',
2286
+ 'histc',
2287
+ 'horner',
2288
+ 'householder',
2289
+ 'hrmt',
2290
+ 'htrianr',
2291
+ 'hypermat',
2292
+ 'idct',
2293
+ 'idst',
2294
+ 'ifft',
2295
+ 'ifftshift',
2296
+ 'iir',
2297
+ 'iirgroup',
2298
+ 'iirlp',
2299
+ 'iirmod',
2300
+ 'ilib_build',
2301
+ 'ilib_build_jar',
2302
+ 'ilib_compile',
2303
+ 'ilib_for_link',
2304
+ 'ilib_gen_Make',
2305
+ 'ilib_gen_Make_unix',
2306
+ 'ilib_gen_cleaner',
2307
+ 'ilib_gen_gateway',
2308
+ 'ilib_gen_loader',
2309
+ 'ilib_include_flag',
2310
+ 'ilib_mex_build',
2311
+ 'im_inv',
2312
+ 'importScicosDiagram',
2313
+ 'importScicosPal',
2314
+ 'importXcosDiagram',
2315
+ 'imrep2ss',
2316
+ 'ind2sub',
2317
+ 'inistate',
2318
+ 'init_ga_default',
2319
+ 'init_param',
2320
+ 'initial_scicos_tables',
2321
+ 'input',
2322
+ 'instruction2code',
2323
+ 'intc',
2324
+ 'intdec',
2325
+ 'integrate',
2326
+ 'interp1',
2327
+ 'interpln',
2328
+ 'intersect',
2329
+ 'intl',
2330
+ 'intsplin',
2331
+ 'inttrap',
2332
+ 'inv_coeff',
2333
+ 'invr',
2334
+ 'invrs',
2335
+ 'invsyslin',
2336
+ 'iqr',
2337
+ 'isLeapYear',
2338
+ 'is_absolute_path',
2339
+ 'is_param',
2340
+ 'iscell',
2341
+ 'iscellstr',
2342
+ 'iscolumn',
2343
+ 'isempty',
2344
+ 'isfield',
2345
+ 'isinf',
2346
+ 'ismatrix',
2347
+ 'isnan',
2348
+ 'isrow',
2349
+ 'isscalar',
2350
+ 'issparse',
2351
+ 'issquare',
2352
+ 'isstruct',
2353
+ 'isvector',
2354
+ 'jmat',
2355
+ 'justify',
2356
+ 'kalm',
2357
+ 'karmarkar',
2358
+ 'kernel',
2359
+ 'kpure',
2360
+ 'krac2',
2361
+ 'kroneck',
2362
+ 'lattn',
2363
+ 'lattp',
2364
+ 'launchtest',
2365
+ 'lcf',
2366
+ 'lcm',
2367
+ 'lcmdiag',
2368
+ 'leastsq',
2369
+ 'leqe',
2370
+ 'leqr',
2371
+ 'lev',
2372
+ 'levin',
2373
+ 'lex_sort',
2374
+ 'lft',
2375
+ 'lin',
2376
+ 'lin2mu',
2377
+ 'lincos',
2378
+ 'lindquist',
2379
+ 'linf',
2380
+ 'linfn',
2381
+ 'linsolve',
2382
+ 'linspace',
2383
+ 'list2vec',
2384
+ 'list_param',
2385
+ 'listfiles',
2386
+ 'listfunctions',
2387
+ 'listvarinfile',
2388
+ 'lmisolver',
2389
+ 'lmitool',
2390
+ 'loadXcosLibs',
2391
+ 'loadmatfile',
2392
+ 'loadwave',
2393
+ 'log10',
2394
+ 'log2',
2395
+ 'logm',
2396
+ 'logspace',
2397
+ 'lqe',
2398
+ 'lqg',
2399
+ 'lqg2stan',
2400
+ 'lqg_ltr',
2401
+ 'lqr',
2402
+ 'ls',
2403
+ 'lyap',
2404
+ 'm2sci_gui',
2405
+ 'm_circle',
2406
+ 'macglov',
2407
+ 'macrovar',
2408
+ 'mad',
2409
+ 'makecell',
2410
+ 'manedit',
2411
+ 'mapsound',
2412
+ 'markp2ss',
2413
+ 'matfile2sci',
2414
+ 'mdelete',
2415
+ 'mean',
2416
+ 'meanf',
2417
+ 'median',
2418
+ 'members',
2419
+ 'mese',
2420
+ 'meshgrid',
2421
+ 'mfft',
2422
+ 'mfile2sci',
2423
+ 'minreal',
2424
+ 'minss',
2425
+ 'mkdir',
2426
+ 'modulo',
2427
+ 'moment',
2428
+ 'mrfit',
2429
+ 'msd',
2430
+ 'mstr2sci',
2431
+ 'mtlb',
2432
+ 'mtlb_0',
2433
+ 'mtlb_a',
2434
+ 'mtlb_all',
2435
+ 'mtlb_any',
2436
+ 'mtlb_axes',
2437
+ 'mtlb_axis',
2438
+ 'mtlb_beta',
2439
+ 'mtlb_box',
2440
+ 'mtlb_choices',
2441
+ 'mtlb_close',
2442
+ 'mtlb_colordef',
2443
+ 'mtlb_cond',
2444
+ 'mtlb_cov',
2445
+ 'mtlb_cumprod',
2446
+ 'mtlb_cumsum',
2447
+ 'mtlb_dec2hex',
2448
+ 'mtlb_delete',
2449
+ 'mtlb_diag',
2450
+ 'mtlb_diff',
2451
+ 'mtlb_dir',
2452
+ 'mtlb_double',
2453
+ 'mtlb_e',
2454
+ 'mtlb_echo',
2455
+ 'mtlb_error',
2456
+ 'mtlb_eval',
2457
+ 'mtlb_exist',
2458
+ 'mtlb_eye',
2459
+ 'mtlb_false',
2460
+ 'mtlb_fft',
2461
+ 'mtlb_fftshift',
2462
+ 'mtlb_filter',
2463
+ 'mtlb_find',
2464
+ 'mtlb_findstr',
2465
+ 'mtlb_fliplr',
2466
+ 'mtlb_fopen',
2467
+ 'mtlb_format',
2468
+ 'mtlb_fprintf',
2469
+ 'mtlb_fread',
2470
+ 'mtlb_fscanf',
2471
+ 'mtlb_full',
2472
+ 'mtlb_fwrite',
2473
+ 'mtlb_get',
2474
+ 'mtlb_grid',
2475
+ 'mtlb_hold',
2476
+ 'mtlb_i',
2477
+ 'mtlb_ifft',
2478
+ 'mtlb_image',
2479
+ 'mtlb_imp',
2480
+ 'mtlb_int16',
2481
+ 'mtlb_int32',
2482
+ 'mtlb_int8',
2483
+ 'mtlb_is',
2484
+ 'mtlb_isa',
2485
+ 'mtlb_isfield',
2486
+ 'mtlb_isletter',
2487
+ 'mtlb_isspace',
2488
+ 'mtlb_l',
2489
+ 'mtlb_legendre',
2490
+ 'mtlb_linspace',
2491
+ 'mtlb_logic',
2492
+ 'mtlb_logical',
2493
+ 'mtlb_loglog',
2494
+ 'mtlb_lower',
2495
+ 'mtlb_max',
2496
+ 'mtlb_mean',
2497
+ 'mtlb_median',
2498
+ 'mtlb_mesh',
2499
+ 'mtlb_meshdom',
2500
+ 'mtlb_min',
2501
+ 'mtlb_more',
2502
+ 'mtlb_num2str',
2503
+ 'mtlb_ones',
2504
+ 'mtlb_pcolor',
2505
+ 'mtlb_plot',
2506
+ 'mtlb_prod',
2507
+ 'mtlb_qr',
2508
+ 'mtlb_qz',
2509
+ 'mtlb_rand',
2510
+ 'mtlb_randn',
2511
+ 'mtlb_rcond',
2512
+ 'mtlb_realmax',
2513
+ 'mtlb_realmin',
2514
+ 'mtlb_s',
2515
+ 'mtlb_semilogx',
2516
+ 'mtlb_semilogy',
2517
+ 'mtlb_setstr',
2518
+ 'mtlb_size',
2519
+ 'mtlb_sort',
2520
+ 'mtlb_sortrows',
2521
+ 'mtlb_sprintf',
2522
+ 'mtlb_sscanf',
2523
+ 'mtlb_std',
2524
+ 'mtlb_strcmp',
2525
+ 'mtlb_strcmpi',
2526
+ 'mtlb_strfind',
2527
+ 'mtlb_strrep',
2528
+ 'mtlb_subplot',
2529
+ 'mtlb_sum',
2530
+ 'mtlb_t',
2531
+ 'mtlb_toeplitz',
2532
+ 'mtlb_tril',
2533
+ 'mtlb_triu',
2534
+ 'mtlb_true',
2535
+ 'mtlb_type',
2536
+ 'mtlb_uint16',
2537
+ 'mtlb_uint32',
2538
+ 'mtlb_uint8',
2539
+ 'mtlb_upper',
2540
+ 'mtlb_var',
2541
+ 'mtlb_zeros',
2542
+ 'mu2lin',
2543
+ 'mutation_ga_binary',
2544
+ 'mutation_ga_default',
2545
+ 'mvcorrel',
2546
+ 'mvvacov',
2547
+ 'nancumsum',
2548
+ 'nand2mean',
2549
+ 'nanmax',
2550
+ 'nanmean',
2551
+ 'nanmeanf',
2552
+ 'nanmedian',
2553
+ 'nanmin',
2554
+ 'nanreglin',
2555
+ 'nanstdev',
2556
+ 'nansum',
2557
+ 'narsimul',
2558
+ 'ndgrid',
2559
+ 'ndims',
2560
+ 'nehari',
2561
+ 'neigh_func_csa',
2562
+ 'neigh_func_default',
2563
+ 'neigh_func_fsa',
2564
+ 'neigh_func_vfsa',
2565
+ 'neldermead_cget',
2566
+ 'neldermead_configure',
2567
+ 'neldermead_costf',
2568
+ 'neldermead_defaultoutput',
2569
+ 'neldermead_destroy',
2570
+ 'neldermead_function',
2571
+ 'neldermead_get',
2572
+ 'neldermead_log',
2573
+ 'neldermead_new',
2574
+ 'neldermead_restart',
2575
+ 'neldermead_search',
2576
+ 'neldermead_updatesimp',
2577
+ 'nextpow2',
2578
+ 'nfreq',
2579
+ 'nicholschart',
2580
+ 'nlev',
2581
+ 'nmplot_cget',
2582
+ 'nmplot_configure',
2583
+ 'nmplot_contour',
2584
+ 'nmplot_destroy',
2585
+ 'nmplot_function',
2586
+ 'nmplot_get',
2587
+ 'nmplot_historyplot',
2588
+ 'nmplot_log',
2589
+ 'nmplot_new',
2590
+ 'nmplot_outputcmd',
2591
+ 'nmplot_restart',
2592
+ 'nmplot_search',
2593
+ 'nmplot_simplexhistory',
2594
+ 'noisegen',
2595
+ 'nonreg_test_run',
2596
+ 'now',
2597
+ 'nthroot',
2598
+ 'null',
2599
+ 'num2cell',
2600
+ 'numderivative',
2601
+ 'numdiff',
2602
+ 'numer',
2603
+ 'nyquist',
2604
+ 'nyquistfrequencybounds',
2605
+ 'obs_gram',
2606
+ 'obscont',
2607
+ 'observer',
2608
+ 'obsv_mat',
2609
+ 'obsvss',
2610
+ 'oct2dec',
2611
+ 'odeoptions',
2612
+ 'optim_ga',
2613
+ 'optim_moga',
2614
+ 'optim_nsga',
2615
+ 'optim_nsga2',
2616
+ 'optim_sa',
2617
+ 'optimbase_cget',
2618
+ 'optimbase_checkbounds',
2619
+ 'optimbase_checkcostfun',
2620
+ 'optimbase_checkx0',
2621
+ 'optimbase_configure',
2622
+ 'optimbase_destroy',
2623
+ 'optimbase_function',
2624
+ 'optimbase_get',
2625
+ 'optimbase_hasbounds',
2626
+ 'optimbase_hasconstraints',
2627
+ 'optimbase_hasnlcons',
2628
+ 'optimbase_histget',
2629
+ 'optimbase_histset',
2630
+ 'optimbase_incriter',
2631
+ 'optimbase_isfeasible',
2632
+ 'optimbase_isinbounds',
2633
+ 'optimbase_isinnonlincons',
2634
+ 'optimbase_log',
2635
+ 'optimbase_logshutdown',
2636
+ 'optimbase_logstartup',
2637
+ 'optimbase_new',
2638
+ 'optimbase_outputcmd',
2639
+ 'optimbase_outstruct',
2640
+ 'optimbase_proj2bnds',
2641
+ 'optimbase_set',
2642
+ 'optimbase_stoplog',
2643
+ 'optimbase_terminate',
2644
+ 'optimget',
2645
+ 'optimplotfunccount',
2646
+ 'optimplotfval',
2647
+ 'optimplotx',
2648
+ 'optimset',
2649
+ 'optimsimplex_center',
2650
+ 'optimsimplex_check',
2651
+ 'optimsimplex_compsomefv',
2652
+ 'optimsimplex_computefv',
2653
+ 'optimsimplex_deltafv',
2654
+ 'optimsimplex_deltafvmax',
2655
+ 'optimsimplex_destroy',
2656
+ 'optimsimplex_dirmat',
2657
+ 'optimsimplex_fvmean',
2658
+ 'optimsimplex_fvstdev',
2659
+ 'optimsimplex_fvvariance',
2660
+ 'optimsimplex_getall',
2661
+ 'optimsimplex_getallfv',
2662
+ 'optimsimplex_getallx',
2663
+ 'optimsimplex_getfv',
2664
+ 'optimsimplex_getn',
2665
+ 'optimsimplex_getnbve',
2666
+ 'optimsimplex_getve',
2667
+ 'optimsimplex_getx',
2668
+ 'optimsimplex_gradientfv',
2669
+ 'optimsimplex_log',
2670
+ 'optimsimplex_new',
2671
+ 'optimsimplex_reflect',
2672
+ 'optimsimplex_setall',
2673
+ 'optimsimplex_setallfv',
2674
+ 'optimsimplex_setallx',
2675
+ 'optimsimplex_setfv',
2676
+ 'optimsimplex_setn',
2677
+ 'optimsimplex_setnbve',
2678
+ 'optimsimplex_setve',
2679
+ 'optimsimplex_setx',
2680
+ 'optimsimplex_shrink',
2681
+ 'optimsimplex_size',
2682
+ 'optimsimplex_sort',
2683
+ 'optimsimplex_xbar',
2684
+ 'orth',
2685
+ 'output_ga_default',
2686
+ 'output_moga_default',
2687
+ 'output_nsga2_default',
2688
+ 'output_nsga_default',
2689
+ 'p_margin',
2690
+ 'pack',
2691
+ 'pareto_filter',
2692
+ 'parrot',
2693
+ 'pbig',
2694
+ 'pca',
2695
+ 'pcg',
2696
+ 'pdiv',
2697
+ 'pen2ea',
2698
+ 'pencan',
2699
+ 'pencost',
2700
+ 'penlaur',
2701
+ 'perctl',
2702
+ 'perl',
2703
+ 'perms',
2704
+ 'permute',
2705
+ 'pertrans',
2706
+ 'pfactors',
2707
+ 'pfss',
2708
+ 'phasemag',
2709
+ 'phaseplot',
2710
+ 'phc',
2711
+ 'pinv',
2712
+ 'playsnd',
2713
+ 'plotprofile',
2714
+ 'plzr',
2715
+ 'pmodulo',
2716
+ 'pol2des',
2717
+ 'pol2str',
2718
+ 'polar',
2719
+ 'polfact',
2720
+ 'prbs_a',
2721
+ 'prettyprint',
2722
+ 'primes',
2723
+ 'princomp',
2724
+ 'profile',
2725
+ 'proj',
2726
+ 'projsl',
2727
+ 'projspec',
2728
+ 'psmall',
2729
+ 'pspect',
2730
+ 'qmr',
2731
+ 'qpsolve',
2732
+ 'quart',
2733
+ 'quaskro',
2734
+ 'rafiter',
2735
+ 'randpencil',
2736
+ 'range',
2737
+ 'rank',
2738
+ 'readxls',
2739
+ 'recompilefunction',
2740
+ 'recons',
2741
+ 'reglin',
2742
+ 'regress',
2743
+ 'remezb',
2744
+ 'remove_param',
2745
+ 'remove_profiling',
2746
+ 'repfreq',
2747
+ 'replace_Ix_by_Fx',
2748
+ 'repmat',
2749
+ 'reset_profiling',
2750
+ 'resize_matrix',
2751
+ 'returntoscilab',
2752
+ 'rhs2code',
2753
+ 'ric_desc',
2754
+ 'riccati',
2755
+ 'rmdir',
2756
+ 'routh_t',
2757
+ 'rowcomp',
2758
+ 'rowcompr',
2759
+ 'rowinout',
2760
+ 'rowregul',
2761
+ 'rowshuff',
2762
+ 'rref',
2763
+ 'sample',
2764
+ 'samplef',
2765
+ 'samwr',
2766
+ 'savematfile',
2767
+ 'savewave',
2768
+ 'scanf',
2769
+ 'sci2exp',
2770
+ 'sciGUI_init',
2771
+ 'sci_sparse',
2772
+ 'scicos_getvalue',
2773
+ 'scicos_simulate',
2774
+ 'scicos_workspace_init',
2775
+ 'scisptdemo',
2776
+ 'scitest',
2777
+ 'sdiff',
2778
+ 'sec',
2779
+ 'secd',
2780
+ 'sech',
2781
+ 'selection_ga_elitist',
2782
+ 'selection_ga_random',
2783
+ 'sensi',
2784
+ 'setPreferencesValue',
2785
+ 'set_param',
2786
+ 'setdiff',
2787
+ 'sgrid',
2788
+ 'show_margins',
2789
+ 'show_pca',
2790
+ 'showprofile',
2791
+ 'signm',
2792
+ 'sinc',
2793
+ 'sincd',
2794
+ 'sind',
2795
+ 'sinh',
2796
+ 'sinhm',
2797
+ 'sinm',
2798
+ 'sm2des',
2799
+ 'sm2ss',
2800
+ 'smga',
2801
+ 'smooth',
2802
+ 'solve',
2803
+ 'sound',
2804
+ 'soundsec',
2805
+ 'sp2adj',
2806
+ 'spaninter',
2807
+ 'spanplus',
2808
+ 'spantwo',
2809
+ 'specfact',
2810
+ 'speye',
2811
+ 'sprand',
2812
+ 'spzeros',
2813
+ 'sqroot',
2814
+ 'sqrtm',
2815
+ 'squarewave',
2816
+ 'squeeze',
2817
+ 'srfaur',
2818
+ 'srkf',
2819
+ 'ss2des',
2820
+ 'ss2ss',
2821
+ 'ss2tf',
2822
+ 'sskf',
2823
+ 'ssprint',
2824
+ 'ssrand',
2825
+ 'st_deviation',
2826
+ 'st_i_generic',
2827
+ 'st_ility',
2828
+ 'stabil',
2829
+ 'statgain',
2830
+ 'stdev',
2831
+ 'stdevf',
2832
+ 'steadycos',
2833
+ 'strange',
2834
+ 'strcmpi',
2835
+ 'struct',
2836
+ 'sub2ind',
2837
+ 'sva',
2838
+ 'svplot',
2839
+ 'sylm',
2840
+ 'sylv',
2841
+ 'sysconv',
2842
+ 'sysdiag',
2843
+ 'sysfact',
2844
+ 'syslin',
2845
+ 'syssize',
2846
+ 'system',
2847
+ 'systmat',
2848
+ 'tabul',
2849
+ 'tand',
2850
+ 'tanh',
2851
+ 'tanhm',
2852
+ 'tanm',
2853
+ 'tbx_build_blocks',
2854
+ 'tbx_build_cleaner',
2855
+ 'tbx_build_gateway',
2856
+ 'tbx_build_gateway_clean',
2857
+ 'tbx_build_gateway_loader',
2858
+ 'tbx_build_help',
2859
+ 'tbx_build_help_loader',
2860
+ 'tbx_build_loader',
2861
+ 'tbx_build_localization',
2862
+ 'tbx_build_macros',
2863
+ 'tbx_build_pal_loader',
2864
+ 'tbx_build_src',
2865
+ 'tbx_builder',
2866
+ 'tbx_builder_gateway',
2867
+ 'tbx_builder_gateway_lang',
2868
+ 'tbx_builder_help',
2869
+ 'tbx_builder_help_lang',
2870
+ 'tbx_builder_macros',
2871
+ 'tbx_builder_src',
2872
+ 'tbx_builder_src_lang',
2873
+ 'tbx_generate_pofile',
2874
+ 'temp_law_csa',
2875
+ 'temp_law_default',
2876
+ 'temp_law_fsa',
2877
+ 'temp_law_huang',
2878
+ 'temp_law_vfsa',
2879
+ 'test_clean',
2880
+ 'test_on_columns',
2881
+ 'test_run',
2882
+ 'test_run_level',
2883
+ 'testexamples',
2884
+ 'tf2des',
2885
+ 'tf2ss',
2886
+ 'thrownan',
2887
+ 'tic',
2888
+ 'time_id',
2889
+ 'toc',
2890
+ 'toeplitz',
2891
+ 'tokenpos',
2892
+ 'toolboxes',
2893
+ 'trace',
2894
+ 'trans',
2895
+ 'translatepaths',
2896
+ 'tree2code',
2897
+ 'trfmod',
2898
+ 'trianfml',
2899
+ 'trimmean',
2900
+ 'trisolve',
2901
+ 'trzeros',
2902
+ 'typeof',
2903
+ 'ui_observer',
2904
+ 'union',
2905
+ 'unique',
2906
+ 'unit_test_run',
2907
+ 'unix_g',
2908
+ 'unix_s',
2909
+ 'unix_w',
2910
+ 'unix_x',
2911
+ 'unobs',
2912
+ 'unpack',
2913
+ 'unwrap',
2914
+ 'variance',
2915
+ 'variancef',
2916
+ 'vec2list',
2917
+ 'vectorfind',
2918
+ 'ver',
2919
+ 'warnobsolete',
2920
+ 'wavread',
2921
+ 'wavwrite',
2922
+ 'wcenter',
2923
+ 'weekday',
2924
+ 'wfir',
2925
+ 'wfir_gui',
2926
+ 'whereami',
2927
+ 'who_user',
2928
+ 'whos',
2929
+ 'wiener',
2930
+ 'wigner',
2931
+ 'window',
2932
+ 'winlist',
2933
+ 'with_javasci',
2934
+ 'with_macros_source',
2935
+ 'with_modelica_compiler',
2936
+ 'with_tk',
2937
+ 'xcorr',
2938
+ 'xcosBlockEval',
2939
+ 'xcosBlockInterface',
2940
+ 'xcosCodeGeneration',
2941
+ 'xcosConfigureModelica',
2942
+ 'xcosPal',
2943
+ 'xcosPalAdd',
2944
+ 'xcosPalAddBlock',
2945
+ 'xcosPalExport',
2946
+ 'xcosPalGenerateAllIcons',
2947
+ 'xcosShowBlockWarning',
2948
+ 'xcosValidateBlockSet',
2949
+ 'xcosValidateCompareBlock',
2950
+ 'xcos_compile',
2951
+ 'xcos_debug_gui',
2952
+ 'xcos_run',
2953
+ 'xcos_simulate',
2954
+ 'xcov',
2955
+ 'xmltochm',
2956
+ 'xmltoformat',
2957
+ 'xmltohtml',
2958
+ 'xmltojar',
2959
+ 'xmltopdf',
2960
+ 'xmltops',
2961
+ 'xmltoweb',
2962
+ 'yulewalk',
2963
+ 'zeropen',
2964
+ 'zgrid',
2965
+ 'zpbutt',
2966
+ 'zpch1',
2967
+ 'zpch2',
2968
+ 'zpell',
2969
+ )
2970
+
2971
+ variables_kw = (
2972
+ '$',
2973
+ '%F',
2974
+ '%T',
2975
+ '%e',
2976
+ '%eps',
2977
+ '%f',
2978
+ '%fftw',
2979
+ '%gui',
2980
+ '%i',
2981
+ '%inf',
2982
+ '%io',
2983
+ '%modalWarning',
2984
+ '%nan',
2985
+ '%pi',
2986
+ '%s',
2987
+ '%t',
2988
+ '%tk',
2989
+ '%toolboxes',
2990
+ '%toolboxes_dir',
2991
+ '%z',
2992
+ 'PWD',
2993
+ 'SCI',
2994
+ 'SCIHOME',
2995
+ 'TMPDIR',
2996
+ 'arnoldilib',
2997
+ 'assertlib',
2998
+ 'atomslib',
2999
+ 'cacsdlib',
3000
+ 'compatibility_functilib',
3001
+ 'corelib',
3002
+ 'data_structureslib',
3003
+ 'demo_toolslib',
3004
+ 'development_toolslib',
3005
+ 'differential_equationlib',
3006
+ 'dynamic_linklib',
3007
+ 'elementary_functionslib',
3008
+ 'enull',
3009
+ 'evoid',
3010
+ 'external_objectslib',
3011
+ 'fd',
3012
+ 'fileiolib',
3013
+ 'functionslib',
3014
+ 'genetic_algorithmslib',
3015
+ 'helptoolslib',
3016
+ 'home',
3017
+ 'integerlib',
3018
+ 'interpolationlib',
3019
+ 'iolib',
3020
+ 'jnull',
3021
+ 'jvoid',
3022
+ 'linear_algebralib',
3023
+ 'm2scilib',
3024
+ 'matiolib',
3025
+ 'modules_managerlib',
3026
+ 'neldermeadlib',
3027
+ 'optimbaselib',
3028
+ 'optimizationlib',
3029
+ 'optimsimplexlib',
3030
+ 'output_streamlib',
3031
+ 'overloadinglib',
3032
+ 'parameterslib',
3033
+ 'polynomialslib',
3034
+ 'preferenceslib',
3035
+ 'randliblib',
3036
+ 'scicos_autolib',
3037
+ 'scicos_utilslib',
3038
+ 'scinoteslib',
3039
+ 'signal_processinglib',
3040
+ 'simulated_annealinglib',
3041
+ 'soundlib',
3042
+ 'sparselib',
3043
+ 'special_functionslib',
3044
+ 'spreadsheetlib',
3045
+ 'statisticslib',
3046
+ 'stringlib',
3047
+ 'tclscilib',
3048
+ 'timelib',
3049
+ 'umfpacklib',
3050
+ 'xcoslib',
3051
+ )
3052
+
3053
+
3054
+ if __name__ == '__main__': # pragma: no cover
3055
+ import subprocess
3056
+ from pygments.util import format_lines, duplicates_removed
3057
+
3058
+ mapping = {'variables': 'builtin'}
3059
+
3060
+ def extract_completion(var_type):
3061
+ s = subprocess.Popen(['scilab', '-nwni'], stdin=subprocess.PIPE,
3062
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
3063
+ output = s.communicate(f'''\
3064
+ fd = mopen("/dev/stderr", "wt");
3065
+ mputl(strcat(completion("", "{var_type}"), "||"), fd);
3066
+ mclose(fd)\n''')
3067
+ if '||' not in output[1]:
3068
+ raise Exception(output[0])
3069
+ # Invalid DISPLAY causes this to be output:
3070
+ text = output[1].strip()
3071
+ if text.startswith('Error: unable to open display \n'):
3072
+ text = text[len('Error: unable to open display \n'):]
3073
+ return text.split('||')
3074
+
3075
+ new_data = {}
3076
+ seen = set() # only keep first type for a given word
3077
+ for t in ('functions', 'commands', 'macros', 'variables'):
3078
+ new_data[t] = duplicates_removed(extract_completion(t), seen)
3079
+ seen.update(set(new_data[t]))
3080
+
3081
+
3082
+ with open(__file__, encoding='utf-8') as f:
3083
+ content = f.read()
3084
+
3085
+ header = content[:content.find('# Autogenerated')]
3086
+ footer = content[content.find("if __name__ == '__main__':"):]
3087
+
3088
+ with open(__file__, 'w', encoding='utf-8') as f:
3089
+ f.write(header)
3090
+ f.write('# Autogenerated\n\n')
3091
+ for k, v in sorted(new_data.items()):
3092
+ f.write(format_lines(k + '_kw', v) + '\n\n')
3093
+ f.write(footer)
evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/ambient.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ambient
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for AmbientTalk language.
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, words, bygroups
14
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Whitespace
16
+
17
+ __all__ = ['AmbientTalkLexer']
18
+
19
+
20
+ class AmbientTalkLexer(RegexLexer):
21
+ """
22
+ Lexer for AmbientTalk source code.
23
+ """
24
+ name = 'AmbientTalk'
25
+ url = 'https://code.google.com/p/ambienttalk'
26
+ filenames = ['*.at']
27
+ aliases = ['ambienttalk', 'ambienttalk/2', 'at']
28
+ mimetypes = ['text/x-ambienttalk']
29
+ version_added = '2.0'
30
+
31
+ flags = re.MULTILINE | re.DOTALL
32
+
33
+ builtin = words(('if:', 'then:', 'else:', 'when:', 'whenever:', 'discovered:',
34
+ 'disconnected:', 'reconnected:', 'takenOffline:', 'becomes:',
35
+ 'export:', 'as:', 'object:', 'actor:', 'mirror:', 'taggedAs:',
36
+ 'mirroredBy:', 'is:'))
37
+ tokens = {
38
+ 'root': [
39
+ (r'\s+', Whitespace),
40
+ (r'//.*?\n', Comment.Single),
41
+ (r'/\*.*?\*/', Comment.Multiline),
42
+ (r'(def|deftype|import|alias|exclude)\b', Keyword),
43
+ (builtin, Name.Builtin),
44
+ (r'(true|false|nil)\b', Keyword.Constant),
45
+ (r'(~|lobby|jlobby|/)\.', Keyword.Constant, 'namespace'),
46
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
47
+ (r'\|', Punctuation, 'arglist'),
48
+ (r'<:|[*^!%&<>+=,./?-]|:=', Operator),
49
+ (r"`[a-zA-Z_]\w*", String.Symbol),
50
+ (r"[a-zA-Z_]\w*:", Name.Function),
51
+ (r"[{}()\[\];`]", Punctuation),
52
+ (r'(self|super)\b', Name.Variable.Instance),
53
+ (r"[a-zA-Z_]\w*", Name.Variable),
54
+ (r"@[a-zA-Z_]\w*", Name.Class),
55
+ (r"@\[", Name.Class, 'annotations'),
56
+ include('numbers'),
57
+ ],
58
+ 'numbers': [
59
+ (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
60
+ (r'\d+', Number.Integer)
61
+ ],
62
+ 'namespace': [
63
+ (r'[a-zA-Z_]\w*\.', Name.Namespace),
64
+ (r'[a-zA-Z_]\w*:', Name.Function, '#pop'),
65
+ (r'[a-zA-Z_]\w*(?!\.)', Name.Function, '#pop')
66
+ ],
67
+ 'annotations': [
68
+ (r"(.*?)\]", Name.Class, '#pop')
69
+ ],
70
+ 'arglist': [
71
+ (r'\|', Punctuation, '#pop'),
72
+ (r'(\s*)(,)(\s*)', bygroups(Whitespace, Punctuation, Whitespace)),
73
+ (r'[a-zA-Z_]\w*', Name.Variable),
74
+ ],
75
+ }
evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/apdlexer.py ADDED
@@ -0,0 +1,593 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.apdlexer
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for ANSYS Parametric Design Language.
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, words, default
14
+ from pygments.token import Comment, Keyword, Name, Number, Operator, \
15
+ String, Generic, Punctuation, Whitespace, Escape
16
+
17
+ __all__ = ['apdlexer']
18
+
19
+
20
+ class apdlexer(RegexLexer):
21
+ """
22
+ For APDL source code.
23
+ """
24
+ name = 'ANSYS parametric design language'
25
+ aliases = ['ansys', 'apdl']
26
+ filenames = ['*.ans']
27
+ url = 'https://www.ansys.com'
28
+ version_added = '2.9'
29
+
30
+ flags = re.IGNORECASE
31
+
32
+ # list of elements
33
+ elafunb = ("SURF152", "SURF153", "SURF154", "SURF156", "SHELL157",
34
+ "SURF159", "LINK160", "BEAM161", "PLANE162",
35
+ "SHELL163", "SOLID164", "COMBI165", "MASS166",
36
+ "LINK167", "SOLID168", "TARGE169", "TARGE170",
37
+ "CONTA171", "CONTA172", "CONTA173", "CONTA174",
38
+ "CONTA175", "CONTA176", "CONTA177", "CONTA178",
39
+ "PRETS179", "LINK180", "SHELL181", "PLANE182",
40
+ "PLANE183", "MPC184", "SOLID185", "SOLID186",
41
+ "SOLID187", "BEAM188", "BEAM189", "SOLSH190",
42
+ "INTER192", "INTER193", "INTER194", "INTER195",
43
+ "MESH200", "FOLLW201", "INTER202", "INTER203",
44
+ "INTER204", "INTER205", "SHELL208", "SHELL209",
45
+ "CPT212", "CPT213", "COMBI214", "CPT215", "CPT216",
46
+ "CPT217", "FLUID220", "FLUID221", "PLANE223",
47
+ "SOLID226", "SOLID227", "PLANE230", "SOLID231",
48
+ "SOLID232", "PLANE233", "SOLID236", "SOLID237",
49
+ "PLANE238", "SOLID239", "SOLID240", "HSFLD241",
50
+ "HSFLD242", "SURF251", "SURF252", "REINF263",
51
+ "REINF264", "REINF265", "SOLID272", "SOLID273",
52
+ "SOLID278", "SOLID279", "SHELL281", "SOLID285",
53
+ "PIPE288", "PIPE289", "ELBOW290", "USER300", "BEAM3",
54
+ "BEAM4", "BEAM23", "BEAM24", "BEAM44", "BEAM54",
55
+ "COMBIN7", "FLUID79", "FLUID80", "FLUID81", "FLUID141",
56
+ "FLUID142", "INFIN9", "INFIN47", "PLANE13", "PLANE25",
57
+ "PLANE42", "PLANE53", "PLANE67", "PLANE82", "PLANE83",
58
+ "PLANE145", "PLANE146", "CONTAC12", "CONTAC52",
59
+ "LINK1", "LINK8", "LINK10", "LINK32", "PIPE16",
60
+ "PIPE17", "PIPE18", "PIPE20", "PIPE59", "PIPE60",
61
+ "SHELL41", "SHELL43", "SHELL57", "SHELL63", "SHELL91",
62
+ "SHELL93", "SHELL99", "SHELL150", "SOLID5", "SOLID45",
63
+ "SOLID46", "SOLID65", "SOLID69", "SOLID92", "SOLID95",
64
+ "SOLID117", "SOLID127", "SOLID128", "SOLID147",
65
+ "SOLID148", "SOLID191", "VISCO88", "VISCO89",
66
+ "VISCO106", "VISCO107", "VISCO108", "TRANS109")
67
+
68
+ elafunc = ("PGRAPH", "/VT", "VTIN", "VTRFIL", "VTTEMP", "PGRSET",
69
+ "VTCLR", "VTMETH", "VTRSLT", "VTVMOD", "PGSELE",
70
+ "VTDISC", "VTMP", "VTSEC", "PGWRITE", "VTEVAL", "VTOP",
71
+ "VTSFE", "POUTRES", "VTFREQ", "VTPOST", "VTSL",
72
+ "FLDATA1-40", "HFPCSWP", "MSDATA", "MSVARY", "QFACT",
73
+ "FLOCHECK", "HFPOWER", "MSMASS", "PERI", "SPADP",
74
+ "FLREAD", "HFPORT", "MSMETH", "PLFSS", "SPARM",
75
+ "FLOTRAN", "HFSCAT", "MSMIR", "PLSCH", "SPFSS",
76
+ "HFADP", "ICE", "MSNOMF", "PLSYZ", "SPICE", "HFARRAY",
77
+ "ICEDELE", "MSPROP", "PLTD", "SPSCAN", "HFDEEM",
78
+ "ICELIST", "MSQUAD", "PLTLINE", "SPSWP", "HFEIGOPT",
79
+ "ICVFRC", "MSRELAX", "PLVFRC", "HFEREFINE", "LPRT",
80
+ "MSSOLU", "/PICE", "HFMODPRT", "MSADV", "MSSPEC",
81
+ "PLWAVE", "HFPA", "MSCAP", "MSTERM", "PRSYZ")
82
+
83
+ elafund = ("*VOPER", "VOVLAP", "*VPLOT", "VPLOT", "VPTN", "*VPUT",
84
+ "VPUT", "*VREAD", "VROTAT", "VSBA", "VSBV", "VSBW",
85
+ "/VSCALE", "*VSCFUN", "VSEL", "VSLA", "*VSTAT", "VSUM",
86
+ "VSWEEP", "VSYMM", "VTRAN", "VTYPE", "/VUP", "*VWRITE",
87
+ "/WAIT", "WAVES", "WERASE", "WFRONT", "/WINDOW",
88
+ "WMID", "WMORE", "WPAVE", "WPCSYS", "WPLANE", "WPOFFS",
89
+ "WPROTA", "WPSTYL", "WRFULL", "WRITE", "WRITEMAP",
90
+ "*WRK", "WSORT", "WSPRINGS", "WSTART", "WTBCREATE",
91
+ "XFDATA", "XFENRICH", "XFLIST", "/XFRM", "/XRANGE",
92
+ "XVAR", "/YRANGE", "/ZOOM", "/WB", "XMLO", "/XML",
93
+ "CNTR", "EBLOCK", "CMBLOCK", "NBLOCK", "/TRACK",
94
+ "CWZPLOT", "~EUI", "NELE", "EALL", "NALL", "FLITEM",
95
+ "LSLN", "PSOLVE", "ASLN", "/VERIFY", "/SSS", "~CFIN",
96
+ "*EVAL", "*MOONEY", "/RUNSTAT", "ALPFILL",
97
+ "ARCOLLAPSE", "ARDETACH", "ARFILL", "ARMERGE",
98
+ "ARSPLIT", "FIPLOT", "GAPFINISH", "GAPLIST",
99
+ "GAPMERGE", "GAPOPT", "GAPPLOT", "LNCOLLAPSE",
100
+ "LNDETACH", "LNFILL", "LNMERGE", "LNSPLIT", "PCONV",
101
+ "PLCONV", "PEMOPTS", "PEXCLUDE", "PINCLUDE", "PMETH",
102
+ "/PMETH", "PMOPTS", "PPLOT", "PPRANGE", "PRCONV",
103
+ "PRECISION", "RALL", "RFILSZ", "RITER", "RMEMRY",
104
+ "RSPEED", "RSTAT", "RTIMST", "/RUNST", "RWFRNT",
105
+ "SARPLOT", "SHSD", "SLPPLOT", "SLSPLOT", "VCVFILL",
106
+ "/OPT", "OPEQN", "OPFACT", "OPFRST", "OPGRAD",
107
+ "OPKEEP", "OPLOOP", "OPPRNT", "OPRAND", "OPSUBP",
108
+ "OPSWEEP", "OPTYPE", "OPUSER", "OPVAR", "OPADD",
109
+ "OPCLR", "OPDEL", "OPMAKE", "OPSEL", "OPANL", "OPDATA",
110
+ "OPRESU", "OPSAVE", "OPEXE", "OPLFA", "OPLGR",
111
+ "OPLIST", "OPLSW", "OPRFA", "OPRGR", "OPRSW",
112
+ "PILECALC", "PILEDISPSET", "PILEGEN", "PILELOAD",
113
+ "PILEMASS", "PILERUN", "PILESEL", "PILESTIF",
114
+ "PLVAROPT", "PRVAROPT", "TOCOMP", "TODEF", "TOFREQ",
115
+ "TOTYPE", "TOVAR", "TOEXE", "TOLOOP", "TOGRAPH",
116
+ "TOLIST", "TOPLOT", "TOPRINT", "TOSTAT", "TZAMESH",
117
+ "TZDELE", "TZEGEN", "XVAROPT", "PGSAVE", "SOLCONTROL",
118
+ "TOTAL", "VTGEOM", "VTREAL", "VTSTAT")
119
+
120
+ elafune = ("/ANUM", "AOFFST", "AOVLAP", "APLOT", "APPEND", "APTN",
121
+ "ARCLEN", "ARCTRM", "AREAS", "AREFINE", "AREMESH",
122
+ "AREVERSE", "AROTAT", "ARSCALE", "ARSYM", "ASBA",
123
+ "ASBL", "ASBV", "ASBW", "ASCRES", "ASEL", "ASIFILE",
124
+ "*ASK", "ASKIN", "ASLL", "ASLV", "ASOL", "/ASSIGN",
125
+ "ASUB", "ASUM", "ATAN", "ATRAN", "ATYPE", "/AUTO",
126
+ "AUTOTS", "/AUX2", "/AUX3", "/AUX12", "/AUX15",
127
+ "AVPRIN", "AVRES", "AWAVE", "/AXLAB", "*AXPY",
128
+ "/BATCH", "BCSOPTION", "BETAD", "BF", "BFA", "BFADELE",
129
+ "BFALIST", "BFCUM", "BFDELE", "BFE", "BFECUM",
130
+ "BFEDELE", "BFELIST", "BFESCAL", "BFINT", "BFK",
131
+ "BFKDELE", "BFKLIST", "BFL", "BFLDELE", "BFLIST",
132
+ "BFLLIST", "BFSCALE", "BFTRAN", "BFUNIF", "BFV",
133
+ "BFVDELE", "BFVLIST", "BIOOPT", "BIOT", "BLC4", "BLC5",
134
+ "BLOCK", "BOOL", "BOPTN", "BSAX", "BSMD", "BSM1",
135
+ "BSM2", "BSPLIN", "BSS1", "BSS2", "BSTE", "BSTQ",
136
+ "BTOL", "BUCOPT", "C", "CALC", "CAMPBELL", "CBDOF",
137
+ "CBMD", "CBMX", "CBTE", "CBTMP", "CDOPT", "CDREAD",
138
+ "CDWRITE", "CE", "CECHECK", "CECMOD", "CECYC",
139
+ "CEDELE", "CEINTF", "CELIST", "CENTER", "CEQN",
140
+ "CERIG", "CESGEN", "CFACT", "*CFCLOS", "*CFOPEN",
141
+ "*CFWRITE", "/CFORMAT", "CGLOC", "CGOMGA", "CGROW",
142
+ "CHECK", "CHKMSH", "CINT", "CIRCLE", "CISOL",
143
+ "/CLABEL", "/CLEAR", "CLOCAL", "CLOG", "/CLOG",
144
+ "CLRMSHLN", "CM", "CMACEL", "/CMAP", "CMATRIX",
145
+ "CMDELE", "CMDOMEGA", "CMEDIT", "CMGRP", "CMLIST",
146
+ "CMMOD", "CMOMEGA", "CMPLOT", "CMROTATE", "CMSEL",
147
+ "CMSFILE", "CMSOPT", "CMWRITE", "CNCHECK", "CNKMOD",
148
+ "CNTR", "CNVTOL", "/COLOR", "*COMP", "COMBINE",
149
+ "COMPRESS", "CON4", "CONE", "/CONFIG", "CONJUG",
150
+ "/CONTOUR", "/COPY", "CORIOLIS", "COUPLE", "COVAL",
151
+ "CP", "CPCYC", "CPDELE", "CPINTF", "/CPLANE", "CPLGEN",
152
+ "CPLIST", "CPMERGE", "CPNGEN", "CPSGEN", "CQC",
153
+ "*CREATE", "CRPLIM", "CS", "CSCIR", "CSDELE", "CSKP",
154
+ "CSLIST", "CSWPLA", "CSYS", "/CTYPE", "CURR2D",
155
+ "CUTCONTROL", "/CVAL", "CVAR", "/CWD", "CYCCALC",
156
+ "/CYCEXPAND", "CYCFILES", "CYCFREQ", "*CYCLE",
157
+ "CYCLIC", "CYCOPT", "CYCPHASE", "CYCSPEC", "CYL4",
158
+ "CYL5", "CYLIND", "CZDEL", "CZMESH", "D", "DA",
159
+ "DADELE", "DALIST", "DAMORPH", "DATA", "DATADEF",
160
+ "DCGOMG", "DCUM", "DCVSWP", "DDASPEC", "DDELE",
161
+ "DDOPTION", "DEACT", "DEFINE", "*DEL", "DELETE",
162
+ "/DELETE", "DELTIM", "DELTIME", "DEMORPH", "DERIV", "DESIZE",
163
+ "DESOL", "DETAB", "/DEVDISP", "/DEVICE", "/DFLAB",
164
+ "DFLX", "DFSWAVE", "DIG", "DIGIT", "*DIM",
165
+ "/DIRECTORY", "DISPLAY", "/DIST", "DJ", "DJDELE",
166
+ "DJLIST", "DK", "DKDELE", "DKLIST", "DL", "DLDELE",
167
+ "DLIST", "DLLIST", "*DMAT", "DMOVE", "DMPEXT",
168
+ "DMPOPTION", "DMPRAT", "DMPSTR", "DNSOL", "*DO", "DOF",
169
+ "DOFSEL", "DOMEGA", "*DOT", "*DOWHILE", "DSCALE",
170
+ "/DSCALE", "DSET", "DSPOPTION", "DSUM", "DSURF",
171
+ "DSYM", "DSYS", "DTRAN", "DUMP", "/DV3D", "DVAL",
172
+ "DVMORPH", "DYNOPT", "E", "EALIVE", "EDADAPT", "EDALE",
173
+ "EDASMP", "EDBOUND", "EDBX", "EDBVIS", "EDCADAPT",
174
+ "EDCGEN", "EDCLIST", "EDCMORE", "EDCNSTR", "EDCONTACT",
175
+ "EDCPU", "EDCRB", "EDCSC", "EDCTS", "EDCURVE",
176
+ "EDDAMP", "EDDBL", "EDDC", "EDDRELAX", "EDDUMP",
177
+ "EDELE", "EDENERGY", "EDFPLOT", "EDGCALE", "/EDGE",
178
+ "EDHGLS", "EDHIST", "EDHTIME", "EDINT", "EDIPART",
179
+ "EDIS", "EDLCS", "EDLOAD", "EDMP", "EDNB", "EDNDTSD",
180
+ "EDNROT", "EDOPT", "EDOUT", "EDPART", "EDPC", "EDPL",
181
+ "EDPVEL", "EDRC", "EDRD", "EDREAD", "EDRI", "EDRST",
182
+ "EDRUN", "EDSHELL", "EDSOLV", "EDSP", "EDSTART",
183
+ "EDTERM", "EDTP", "EDVEL", "EDWELD", "EDWRITE",
184
+ "EEXTRUDE", "/EFACET", "EGEN", "*EIGEN", "EINFIN",
185
+ "EINTF", "EKILL", "ELBOW", "ELEM", "ELIST", "*ELSE",
186
+ "*ELSEIF", "EMAGERR", "EMATWRITE", "EMF", "EMFT",
187
+ "EMID", "EMIS", "EMODIF", "EMORE", "EMSYM", "EMTGEN",
188
+ "EMUNIT", "EN", "*END", "*ENDDO", "*ENDIF",
189
+ "ENDRELEASE", "ENERSOL", "ENGEN", "ENORM", "ENSYM",
190
+ "EORIENT", "EPLOT", "EQSLV", "ERASE", "/ERASE",
191
+ "EREAD", "EREFINE", "EREINF", "ERESX", "ERNORM",
192
+ "ERRANG", "ESCHECK", "ESEL", "/ESHAPE", "ESIZE",
193
+ "ESLA", "ESLL", "ESLN", "ESLV", "ESOL", "ESORT",
194
+ "ESSOLV", "ESTIF", "ESURF", "ESYM", "ESYS", "ET",
195
+ "ETABLE", "ETCHG", "ETCONTROL", "ETDELE", "ETLIST",
196
+ "ETYPE", "EUSORT", "EWRITE", "*EXIT", "/EXIT", "EXP",
197
+ "EXPAND", "/EXPAND", "EXPASS", "*EXPORT", "EXPROFILE",
198
+ "EXPSOL", "EXTOPT", "EXTREM", "EXUNIT", "F", "/FACET",
199
+ "FATIGUE", "FC", "FCCHECK", "FCDELE", "FCLIST", "FCUM",
200
+ "FCTYP", "FDELE", "/FDELE", "FE", "FEBODY", "FECONS",
201
+ "FEFOR", "FELIST", "FESURF", "*FFT", "FILE",
202
+ "FILEAUX2", "FILEAUX3", "FILEDISP", "FILL", "FILLDATA",
203
+ "/FILNAME", "FINISH", "FITEM", "FJ", "FJDELE",
204
+ "FJLIST", "FK", "FKDELE", "FKLIST", "FL", "FLIST",
205
+ "FLLIST", "FLST", "FLUXV", "FLUREAD", "FMAGBC",
206
+ "FMAGSUM", "/FOCUS", "FOR2D", "FORCE", "FORM",
207
+ "/FORMAT", "FP", "FPLIST", "*FREE", "FREQ", "FRQSCL",
208
+ "FS", "FSCALE", "FSDELE", "FSLIST", "FSNODE", "FSPLOT",
209
+ "FSSECT", "FSSPARM", "FSUM", "FTCALC", "FTRAN",
210
+ "FTSIZE", "FTWRITE", "FTYPE", "FVMESH", "GAP", "GAPF",
211
+ "GAUGE", "GCDEF", "GCGEN", "/GCMD", "/GCOLUMN",
212
+ "GENOPT", "GEOM", "GEOMETRY", "*GET", "/GFILE",
213
+ "/GFORMAT", "/GLINE", "/GMARKER", "GMATRIX", "GMFACE",
214
+ "*GO", "/GO", "/GOLIST", "/GOPR", "GP", "GPDELE",
215
+ "GPLIST", "GPLOT", "/GRAPHICS", "/GRESUME", "/GRID",
216
+ "/GROPT", "GRP", "/GRTYP", "/GSAVE", "GSBDATA",
217
+ "GSGDATA", "GSLIST", "GSSOL", "/GST", "GSUM", "/GTHK",
218
+ "/GTYPE", "HARFRQ", "/HBC", "HBMAT", "/HEADER", "HELP",
219
+ "HELPDISP", "HEMIOPT", "HFANG", "HFSYM", "HMAGSOLV",
220
+ "HPGL", "HPTCREATE", "HPTDELETE", "HRCPLX", "HREXP",
221
+ "HROPT", "HROCEAN", "HROUT", "IC", "ICDELE", "ICLIST",
222
+ "/ICLWID", "/ICSCALE", "*IF", "IGESIN", "IGESOUT",
223
+ "/IMAGE", "IMAGIN", "IMESH", "IMMED", "IMPD",
224
+ "INISTATE", "*INIT", "/INPUT", "/INQUIRE", "INRES",
225
+ "INRTIA", "INT1", "INTSRF", "IOPTN", "IRLF", "IRLIST",
226
+ "*ITENGINE", "JPEG", "JSOL", "K", "KATT", "KBC",
227
+ "KBETW", "KCALC", "KCENTER", "KCLEAR", "KDELE",
228
+ "KDIST", "KEEP", "KESIZE", "KEYOPT", "KEYPTS", "KEYW",
229
+ "KFILL", "KGEN", "KL", "KLIST", "KMESH", "KMODIF",
230
+ "KMOVE", "KNODE", "KPLOT", "KPSCALE", "KREFINE",
231
+ "KSCALE", "KSCON", "KSEL", "KSLL", "KSLN", "KSUM",
232
+ "KSYMM", "KTRAN", "KUSE", "KWPAVE", "KWPLAN", "L",
233
+ "L2ANG", "L2TAN", "LANG", "LARC", "/LARC", "LAREA",
234
+ "LARGE", "LATT", "LAYER", "LAYERP26", "LAYLIST",
235
+ "LAYPLOT", "LCABS", "LCASE", "LCCALC", "LCCAT",
236
+ "LCDEF", "LCFACT", "LCFILE", "LCLEAR", "LCOMB",
237
+ "LCOPER", "LCSEL", "LCSL", "LCSUM", "LCWRITE",
238
+ "LCZERO", "LDELE", "LDIV", "LDRAG", "LDREAD", "LESIZE",
239
+ "LEXTND", "LFILLT", "LFSURF", "LGEN", "LGLUE",
240
+ "LGWRITE", "/LIGHT", "LINA", "LINE", "/LINE", "LINES",
241
+ "LINL", "LINP", "LINV", "LIST", "*LIST", "LLIST",
242
+ "LMATRIX", "LMESH", "LNSRCH", "LOCAL", "LOVLAP",
243
+ "LPLOT", "LPTN", "LREFINE", "LREVERSE", "LROTAT",
244
+ "LSBA", "*LSBAC", "LSBL", "LSBV", "LSBW", "LSCLEAR",
245
+ "LSDELE", "*LSDUMP", "LSEL", "*LSENGINE", "*LSFACTOR",
246
+ "LSLA", "LSLK", "LSOPER", "/LSPEC", "LSREAD",
247
+ "*LSRESTORE", "LSSCALE", "LSSOLVE", "LSTR", "LSUM",
248
+ "LSWRITE", "/LSYMBOL", "LSYMM", "LTAN", "LTRAN",
249
+ "LUMPM", "LVSCALE", "LWPLAN", "M", "MADAPT", "MAGOPT",
250
+ "MAGSOLV", "/MAIL", "MAP", "/MAP", "MAP2DTO3D",
251
+ "MAPSOLVE", "MAPVAR", "MASTER", "MAT", "MATER",
252
+ "MCHECK", "MDAMP", "MDELE", "MDPLOT", "MEMM", "/MENU",
253
+ "MESHING", "MFANALYSIS", "MFBUCKET", "MFCALC", "MFCI",
254
+ "MFCLEAR", "MFCMMAND", "MFCONV", "MFDTIME", "MFELEM",
255
+ "MFEM", "MFEXTER", "MFFNAME", "MFFR", "MFIMPORT",
256
+ "MFINTER", "MFITER", "MFLCOMM", "MFLIST", "MFMAP",
257
+ "MFORDER", "MFOUTPUT", "*MFOURI", "MFPSIMUL", "MFRC",
258
+ "MFRELAX", "MFRSTART", "MFSORDER", "MFSURFACE",
259
+ "MFTIME", "MFTOL", "*MFUN", "MFVOLUME", "MFWRITE",
260
+ "MGEN", "MIDTOL", "/MKDIR", "MLIST", "MMASS", "MMF",
261
+ "MODCONT", "MODE", "MODIFY", "MODMSH", "MODSELOPTION",
262
+ "MODOPT", "MONITOR", "*MOPER", "MOPT", "MORPH", "MOVE",
263
+ "MP", "MPAMOD", "MPCHG", "MPCOPY", "MPDATA", "MPDELE",
264
+ "MPDRES", "/MPLIB", "MPLIST", "MPPLOT", "MPREAD",
265
+ "MPRINT", "MPTEMP", "MPTGEN", "MPTRES", "MPWRITE",
266
+ "/MREP", "MSAVE", "*MSG", "MSHAPE", "MSHCOPY",
267
+ "MSHKEY", "MSHMID", "MSHPATTERN", "MSOLVE", "/MSTART",
268
+ "MSTOLE", "*MULT", "*MWRITE", "MXPAND", "N", "NANG",
269
+ "NAXIS", "NCNV", "NDELE", "NDIST", "NDSURF", "NEQIT",
270
+ "/NERR", "NFORCE", "NGEN", "NKPT", "NLADAPTIVE",
271
+ "NLDIAG", "NLDPOST", "NLGEOM", "NLHIST", "NLIST",
272
+ "NLMESH", "NLOG", "NLOPT", "NMODIF", "NOCOLOR",
273
+ "NODES", "/NOERASE", "/NOLIST", "NOOFFSET", "NOORDER",
274
+ "/NOPR", "NORA", "NORL", "/NORMAL", "NPLOT", "NPRINT",
275
+ "NREAD", "NREFINE", "NRLSUM", "*NRM", "NROPT",
276
+ "NROTAT", "NRRANG", "NSCALE", "NSEL", "NSLA", "NSLE",
277
+ "NSLK", "NSLL", "NSLV", "NSMOOTH", "NSOL", "NSORT",
278
+ "NSTORE", "NSUBST", "NSVR", "NSYM", "/NUMBER",
279
+ "NUMCMP", "NUMEXP", "NUMMRG", "NUMOFF", "NUMSTR",
280
+ "NUMVAR", "NUSORT", "NWPAVE", "NWPLAN", "NWRITE",
281
+ "OCDATA", "OCDELETE", "OCLIST", "OCREAD", "OCTABLE",
282
+ "OCTYPE", "OCZONE", "OMEGA", "OPERATE", "OPNCONTROL",
283
+ "OUTAERO", "OUTOPT", "OUTPR", "/OUTPUT", "OUTRES",
284
+ "OVCHECK", "PADELE", "/PAGE", "PAGET", "PAPUT",
285
+ "PARESU", "PARTSEL", "PARRES", "PARSAV", "PASAVE",
286
+ "PATH", "PAUSE", "/PBC", "/PBF", "PCALC", "PCGOPT",
287
+ "PCIRC", "/PCIRCLE", "/PCOPY", "PCROSS", "PDANL",
288
+ "PDCDF", "PDCFLD", "PDCLR", "PDCMAT", "PDCORR",
289
+ "PDDMCS", "PDDOEL", "PDEF", "PDEXE", "PDHIST",
290
+ "PDINQR", "PDLHS", "PDMETH", "PDOT", "PDPINV",
291
+ "PDPLOT", "PDPROB", "PDRESU", "PDROPT", "/PDS",
292
+ "PDSAVE", "PDSCAT", "PDSENS", "PDSHIS", "PDUSER",
293
+ "PDVAR", "PDWRITE", "PERBC2D", "PERTURB", "PFACT",
294
+ "PHYSICS", "PIVCHECK", "PLCAMP", "PLCFREQ", "PLCHIST",
295
+ "PLCINT", "PLCPLX", "PLCRACK", "PLDISP", "PLESOL",
296
+ "PLETAB", "PLFAR", "PLF2D", "PLGEOM", "PLLS", "PLMAP",
297
+ "PLMC", "PLNEAR", "PLNSOL", "/PLOPTS", "PLORB", "PLOT",
298
+ "PLOTTING", "PLPAGM", "PLPATH", "PLSECT", "PLST",
299
+ "PLTIME", "PLTRAC", "PLVAR", "PLVECT", "PLZZ",
300
+ "/PMACRO", "PMAP", "PMGTRAN", "PMLOPT", "PMLSIZE",
301
+ "/PMORE", "PNGR", "/PNUM", "POINT", "POLY", "/POLYGON",
302
+ "/POST1", "/POST26", "POWERH", "PPATH", "PRANGE",
303
+ "PRAS", "PRCAMP", "PRCINT", "PRCPLX", "PRED",
304
+ "PRENERGY", "/PREP7", "PRERR", "PRESOL", "PRETAB",
305
+ "PRFAR", "PRI2", "PRIM", "PRINT", "*PRINT", "PRISM",
306
+ "PRITER", "PRJSOL", "PRNEAR", "PRNLD", "PRNSOL",
307
+ "PROD", "PRORB", "PRPATH", "PRRFOR", "PRRSOL",
308
+ "PRSCONTROL", "PRSECT", "PRTIME", "PRVAR", "PRVECT",
309
+ "PSCONTROL", "PSCR", "PSDCOM", "PSDFRQ", "PSDGRAPH",
310
+ "PSDRES", "PSDSPL", "PSDUNIT", "PSDVAL", "PSDWAV",
311
+ "/PSEARCH", "PSEL", "/PSF", "PSMAT", "PSMESH",
312
+ "/PSPEC", "/PSTATUS", "PSTRES", "/PSYMB", "PTR",
313
+ "PTXY", "PVECT", "/PWEDGE", "QDVAL", "QRDOPT", "QSOPT",
314
+ "QUAD", "/QUIT", "QUOT", "R", "RACE", "RADOPT",
315
+ "RAPPND", "RATE", "/RATIO", "RBE3", "RCON", "RCYC",
316
+ "RDEC", "RDELE", "READ", "REAL", "REALVAR", "RECTNG",
317
+ "REMESH", "/RENAME", "REORDER", "*REPEAT", "/REPLOT",
318
+ "RESCOMBINE", "RESCONTROL", "RESET", "/RESET", "RESP",
319
+ "RESUME", "RESVEC", "RESWRITE", "*RETURN", "REXPORT",
320
+ "REZONE", "RFORCE", "/RGB", "RIGID", "RIGRESP",
321
+ "RIMPORT", "RLIST", "RMALIST", "RMANL", "RMASTER",
322
+ "RMCAP", "RMCLIST", "/RMDIR", "RMFLVEC", "RMLVSCALE",
323
+ "RMMLIST", "RMMRANGE", "RMMSELECT", "RMNDISP",
324
+ "RMNEVEC", "RMODIF", "RMORE", "RMPORDER", "RMRESUME",
325
+ "RMRGENERATE", "RMROPTIONS", "RMRPLOT", "RMRSTATUS",
326
+ "RMSAVE", "RMSMPLE", "RMUSE", "RMXPORT", "ROCK",
327
+ "ROSE", "RPOLY", "RPR4", "RPRISM", "RPSD", "RSFIT",
328
+ "RSOPT", "RSPLIT", "RSPLOT", "RSPRNT", "RSSIMS",
329
+ "RSTMAC", "RSTOFF", "RSURF", "RSYMM", "RSYS", "RTHICK",
330
+ "SABS", "SADD", "SALLOW", "SAVE", "SBCLIST", "SBCTRAN",
331
+ "SDELETE", "SE", "SECCONTROL", "SECDATA",
332
+ "SECFUNCTION", "SECJOINT", "/SECLIB", "SECLOCK",
333
+ "SECMODIF", "SECNUM", "SECOFFSET", "SECPLOT",
334
+ "SECREAD", "SECSTOP", "SECTYPE", "SECWRITE", "SED",
335
+ "SEDLIST", "SEEXP", "/SEG", "SEGEN", "SELIST", "SELM",
336
+ "SELTOL", "SENERGY", "SEOPT", "SESYMM", "*SET", "SET",
337
+ "SETFGAP", "SETRAN", "SEXP", "SF", "SFA", "SFACT",
338
+ "SFADELE", "SFALIST", "SFBEAM", "SFCALC", "SFCUM",
339
+ "SFDELE", "SFE", "SFEDELE", "SFELIST", "SFFUN",
340
+ "SFGRAD", "SFL", "SFLDELE", "SFLEX", "SFLIST",
341
+ "SFLLIST", "SFSCALE", "SFTRAN", "/SHADE", "SHELL",
342
+ "/SHOW", "/SHOWDISP", "SHPP", "/SHRINK", "SLIST",
343
+ "SLOAD", "SMALL", "*SMAT", "SMAX", "/SMBC", "SMBODY",
344
+ "SMCONS", "SMFOR", "SMIN", "SMOOTH", "SMRTSIZE",
345
+ "SMSURF", "SMULT", "SNOPTION", "SOLU", "/SOLU",
346
+ "SOLUOPT", "SOLVE", "SORT", "SOURCE", "SPACE",
347
+ "SPCNOD", "SPCTEMP", "SPDAMP", "SPEC", "SPFREQ",
348
+ "SPGRAPH", "SPH4", "SPH5", "SPHERE", "SPLINE", "SPLOT",
349
+ "SPMWRITE", "SPOINT", "SPOPT", "SPREAD", "SPTOPT",
350
+ "SPOWER", "SPUNIT", "SPVAL", "SQRT", "*SREAD", "SRSS",
351
+ "SSBT", "/SSCALE", "SSLN", "SSMT", "SSPA", "SSPB",
352
+ "SSPD", "SSPE", "SSPM", "SSUM", "SSTATE", "STABILIZE",
353
+ "STAOPT", "STAT", "*STATUS", "/STATUS", "STEF",
354
+ "STORE", "SUBOPT", "SUBSET", "SUCALC",
355
+ "SUCR", "SUDEL", "SUEVAL", "SUGET", "SUMAP", "SUMTYPE",
356
+ "SUPL", "SUPR", "SURESU", "SUSAVE", "SUSEL", "SUVECT",
357
+ "SV", "SVPLOT", "SVTYP", "SWADD", "SWDEL", "SWGEN",
358
+ "SWLIST", "SYNCHRO", "/SYP", "/SYS", "TALLOW",
359
+ "TARGET", "*TAXIS", "TB", "TBCOPY", "TBDATA", "TBDELE",
360
+ "TBEO", "TBIN", "TBFIELD", "TBFT", "TBLE", "TBLIST",
361
+ "TBMODIF", "TBPLOT", "TBPT", "TBTEMP", "TCHG", "/TEE",
362
+ "TERM", "THEXPAND", "THOPT", "TIFF", "TIME",
363
+ "TIMERANGE", "TIMINT", "TIMP", "TINTP",
364
+ "/TLABEL", "TOFFST", "*TOPER", "TORQ2D", "TORQC2D",
365
+ "TORQSUM", "TORUS", "TRANS", "TRANSFER", "*TREAD",
366
+ "TREF", "/TRIAD", "/TRLCY", "TRNOPT", "TRPDEL",
367
+ "TRPLIS", "TRPOIN", "TRTIME", "TSHAP", "/TSPEC",
368
+ "TSRES", "TUNIF", "TVAR", "/TXTRE", "/TYPE", "TYPE",
369
+ "/UCMD", "/UDOC", "/UI", "UIMP", "/UIS", "*ULIB", "/UPF",
370
+ "UNDELETE", "UNDO", "/UNITS", "UNPAUSE", "UPCOORD",
371
+ "UPGEOM", "*USE", "/USER", "USRCAL", "USRDOF",
372
+ "USRELEM", "V", "V2DOPT", "VA", "*VABS", "VADD",
373
+ "VARDEL", "VARNAM", "VATT", "VCLEAR", "*VCOL",
374
+ "/VCONE", "VCROSS", "*VCUM", "VDDAM", "VDELE", "VDGL",
375
+ "VDOT", "VDRAG", "*VEC", "*VEDIT", "VEORIENT", "VEXT",
376
+ "*VFACT", "*VFILL", "VFOPT", "VFQUERY", "VFSM",
377
+ "*VFUN", "VGEN", "*VGET", "VGET", "VGLUE", "/VIEW",
378
+ "VIMP", "VINP", "VINV", "*VITRP", "*VLEN", "VLIST",
379
+ "VLSCALE", "*VMASK", "VMESH", "VOFFST", "VOLUMES")
380
+
381
+ # list of in-built () functions
382
+ elafunf = ("NX()", "NY()", "NZ()", "KX()", "KY()", "KZ()", "LX()",
383
+ "LY()", "LZ()", "LSX()", "LSY()", "LSZ()", "NODE()",
384
+ "KP()", "DISTND()", "DISTKP()", "DISTEN()", "ANGLEN()",
385
+ "ANGLEK()", "NNEAR()", "KNEAR()", "ENEARN()",
386
+ "AREAND()", "AREAKP()", "ARNODE()", "NORMNX()",
387
+ "NORMNY()", "NORMNZ()", "NORMKX()", "NORMKY()",
388
+ "NORMKZ()", "ENEXTN()", "NELEM()", "NODEDOF()",
389
+ "ELADJ()", "NDFACE()", "NMFACE()", "ARFACE()", "UX()",
390
+ "UY()", "UZ()", "ROTX()", "ROTY()", "ROTZ()", "TEMP()",
391
+ "PRES()", "VX()", "VY()", "VZ()", "ENKE()", "ENDS()",
392
+ "VOLT()", "MAG()", "AX()", "AY()", "AZ()",
393
+ "VIRTINQR()", "KWGET()", "VALCHR()", "VALHEX()",
394
+ "CHRHEX()", "STRFILL()", "STRCOMP()", "STRPOS()",
395
+ "STRLENG()", "UPCASE()", "LWCASE()", "JOIN()",
396
+ "SPLIT()", "ABS()", "SIGN()", "CXABS()", "EXP()",
397
+ "LOG()", "LOG10()", "SQRT()", "NINT()", "MOD()",
398
+ "RAND()", "GDIS()", "SIN()", "COS()", "TAN()",
399
+ "SINH()", "COSH()", "TANH()", "ASIN()", "ACOS()",
400
+ "ATAN()", "ATAN2()")
401
+
402
+ elafung = ("NSEL()", "ESEL()", "KSEL()", "LSEL()", "ASEL()",
403
+ "VSEL()", "NDNEXT()", "ELNEXT()", "KPNEXT()",
404
+ "LSNEXT()", "ARNEXT()", "VLNEXT()", "CENTRX()",
405
+ "CENTRY()", "CENTRZ()")
406
+
407
+ elafunh = ("~CAT5IN", "~CATIAIN", "~PARAIN", "~PROEIN", "~SATIN",
408
+ "~UGIN", "A", "AADD", "AATT", "ABEXTRACT", "*ABBR",
409
+ "ABBRES", "ABBSAV", "ABS", "ACCAT", "ACCOPTION",
410
+ "ACEL", "ACLEAR", "ADAMS", "ADAPT", "ADD", "ADDAM",
411
+ "ADELE", "ADGL", "ADRAG", "AESIZE", "AFILLT", "AFLIST",
412
+ "AFSURF", "*AFUN", "AGEN", "AGLUE", "AINA", "AINP",
413
+ "AINV", "AL", "ALIST", "ALLSEL", "ALPHAD", "AMAP",
414
+ "AMESH", "/AN3D", "ANCNTR", "ANCUT", "ANCYC", "ANDATA",
415
+ "ANDSCL", "ANDYNA", "/ANFILE", "ANFLOW", "/ANGLE",
416
+ "ANHARM", "ANIM", "ANISOS", "ANMODE", "ANMRES",
417
+ "/ANNOT", "ANORM", "ANPRES", "ANSOL", "ANSTOAQWA",
418
+ "ANSTOASAS", "ANTIME", "ANTYPE")
419
+
420
+ special = ("/COM", "/TITLE", "STITLE")
421
+
422
+ elements = ("SOLID5",
423
+ "LINK11",
424
+ "PLANE13",
425
+ "COMBIN14",
426
+ "MASS2",
427
+ "PLANE25",
428
+ "MATRIX27",
429
+ "FLUID29",
430
+ "FLUID30",
431
+ "LINK31",
432
+ "LINK33",
433
+ "LINK34",
434
+ "PLANE35",
435
+ "SOURC36",
436
+ "COMBIN37",
437
+ "FLUID38",
438
+ "COMBIN39",
439
+ "COMBIN40",
440
+ "INFIN47",
441
+ "MATRIX50",
442
+ "PLANE55",
443
+ "SHELL61",
444
+ "LINK68",
445
+ "SOLID70",
446
+ "MASS71",
447
+ "PLANE75",
448
+ "PLANE77",
449
+ "PLANE78",
450
+ "PLANE83",
451
+ "SOLID87",
452
+ "SOLID90",
453
+ "CIRCU94",
454
+ "SOLID96",
455
+ "SOLID98",
456
+ "INFIN110",
457
+ "INFIN111",
458
+ "FLUID116",
459
+ "PLANE121",
460
+ "SOLID122",
461
+ "SOLID123",
462
+ "CIRCU124",
463
+ "CIRCU125",
464
+ "TRANS126",
465
+ "FLUID129",
466
+ "FLUID130",
467
+ "SHELL131",
468
+ "SHELL132",
469
+ "FLUID136",
470
+ "FLUID138",
471
+ "FLUID139",
472
+ "SURF151",
473
+ "SURF152",
474
+ "SURF153",
475
+ "SURF154",
476
+ "SURF155",
477
+ "SURF156",
478
+ "SHELL157",
479
+ "SURF159",
480
+ "TARGE169",
481
+ "TARGE170",
482
+ "CONTA172",
483
+ "CONTA174",
484
+ "CONTA175",
485
+ "CONTA177",
486
+ "CONTA178",
487
+ "PRETS179",
488
+ "LINK180",
489
+ "SHELL181",
490
+ "PLANE182",
491
+ "PLANE183",
492
+ "MPC184",
493
+ "SOLID185",
494
+ "SOLID186",
495
+ "SOLID187",
496
+ "BEAM188",
497
+ "BEAM189",
498
+ "SOLSH190",
499
+ "INTER192",
500
+ "INTER193",
501
+ "INTER194",
502
+ "INTER195",
503
+ "MESH200",
504
+ "FOLLW201",
505
+ "INTER202",
506
+ "INTER203",
507
+ "INTER204",
508
+ "INTER205",
509
+ "SHELL208",
510
+ "SHELL209",
511
+ "CPT212",
512
+ "CPT213",
513
+ "COMBI214",
514
+ "CPT215",
515
+ "CPT216",
516
+ "CPT217",
517
+ "FLUID218",
518
+ "FLUID220",
519
+ "FLUID221",
520
+ "PLANE222",
521
+ "PLANE223",
522
+ "SOLID225",
523
+ "SOLID226",
524
+ "SOLID227",
525
+ "PLANE230",
526
+ "SOLID231",
527
+ "SOLID232",
528
+ "PLANE233",
529
+ "SOLID236",
530
+ "SOLID237",
531
+ "PLANE238",
532
+ "SOLID239",
533
+ "SOLID240",
534
+ "HSFLD241",
535
+ "HSFLD242",
536
+ "COMBI250",
537
+ "SURF251",
538
+ "SURF252",
539
+ "INFIN257",
540
+ "REINF263",
541
+ "REINF264",
542
+ "REINF265",
543
+ "SOLID272",
544
+ "SOLID273",
545
+ "SOLID278",
546
+ "SOLID279",
547
+ "CABLE280",
548
+ "SHELL281",
549
+ "SOLID285",
550
+ "PIPE288",
551
+ "PIPE289",
552
+ "ELBOW290",
553
+ "SOLID291",
554
+ "PLANE292",
555
+ "PLANE293",
556
+ "USER300")
557
+
558
+ tokens = {
559
+ 'root': [
560
+ (r'[^\S\n]+', Whitespace),
561
+ (words((elafunb+elafunc+elafund+elafune+elafunh+special), suffix=r'\b'), Keyword, 'non-keyword'),
562
+ default('non-keyword'),
563
+ ],
564
+ 'non-keyword': [
565
+ (r'!.*\n', Comment, '#pop'),
566
+ (r'%.*?%', Escape),
567
+ include('strings'),
568
+ include('nums'),
569
+ (words((elafunf+elafung), suffix=r'\b'), Name.Builtin),
570
+ (words((elements), suffix=r'\b'), Name.Property),
571
+ include('core'),
572
+ (r'AR[0-9]+', Name.Variable.Instance),
573
+ (r'[a-z_][a-z0-9_]*', Name.Variable),
574
+ (r'\n+', Whitespace, '#pop'),
575
+ (r'[^\S\n]+', Whitespace),
576
+ ],
577
+ 'core': [
578
+ # Operators
579
+ (r'(\*\*|\*|\+|-|\/|<|>|<=|>=|==|\/=|=|\(|\))', Operator),
580
+ (r'/EOF', Generic.Emph),
581
+ (r'[\.(),:&;]', Punctuation),
582
+ ],
583
+ 'strings': [
584
+ (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
585
+ (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
586
+ (r'[$%]', String.Symbol),
587
+ ],
588
+ 'nums': [
589
+ (r'[+-]?\d*\.\d+([efEF][-+]?\d+)?', Number.Float), # with dot
590
+ (r'([+-]?\d+([efEF][-+]?\d+))', Number.Float), # With scientific notation
591
+ (r'\b\d+(?![.ef])', Number.Integer), # integer simple
592
+ ]
593
+ }
evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/blueprint.py ADDED
@@ -0,0 +1,173 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.blueprint
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Blueprint UI markup language.
6
+
7
+ :copyright: Copyright 2006-2024 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
+ }
evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/dalvik.py ADDED
@@ -0,0 +1,126 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.dalvik
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Pygments lexers for Dalvik VM-related languages.
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups
14
+ from pygments.token import Keyword, Text, Comment, Name, String, Number, \
15
+ Punctuation, Whitespace
16
+
17
+ __all__ = ['SmaliLexer']
18
+
19
+
20
+ class SmaliLexer(RegexLexer):
21
+ """
22
+ For Smali (Android/Dalvik) assembly
23
+ code.
24
+ """
25
+ name = 'Smali'
26
+ url = 'http://code.google.com/p/smali/'
27
+ aliases = ['smali']
28
+ filenames = ['*.smali']
29
+ mimetypes = ['text/smali']
30
+ version_added = '1.6'
31
+
32
+ tokens = {
33
+ 'root': [
34
+ include('comment'),
35
+ include('label'),
36
+ include('field'),
37
+ include('method'),
38
+ include('class'),
39
+ include('directive'),
40
+ include('access-modifier'),
41
+ include('instruction'),
42
+ include('literal'),
43
+ include('punctuation'),
44
+ include('type'),
45
+ include('whitespace')
46
+ ],
47
+ 'directive': [
48
+ (r'^([ \t]*)(\.(?:class|super|implements|field|subannotation|annotation|'
49
+ r'enum|method|registers|locals|array-data|packed-switch|'
50
+ r'sparse-switch|catchall|catch|line|parameter|local|prologue|'
51
+ r'epilogue|source))', bygroups(Whitespace, Keyword)),
52
+ (r'^([ \t]*)(\.end)( )(field|subannotation|annotation|method|array-data|'
53
+ 'packed-switch|sparse-switch|parameter|local)',
54
+ bygroups(Whitespace, Keyword, Whitespace, Keyword)),
55
+ (r'^([ \t]*)(\.restart)( )(local)',
56
+ bygroups(Whitespace, Keyword, Whitespace, Keyword)),
57
+ ],
58
+ 'access-modifier': [
59
+ (r'(public|private|protected|static|final|synchronized|bridge|'
60
+ r'varargs|native|abstract|strictfp|synthetic|constructor|'
61
+ r'declared-synchronized|interface|enum|annotation|volatile|'
62
+ r'transient)', Keyword),
63
+ ],
64
+ 'whitespace': [
65
+ (r'\n', Whitespace),
66
+ (r'\s+', Whitespace),
67
+ ],
68
+ 'instruction': [
69
+ (r'\b[vp]\d+\b', Name.Builtin), # registers
70
+ (r'(\b[a-z][A-Za-z0-9/-]+)(\s+)', bygroups(Text, Whitespace)), # instructions
71
+ ],
72
+ 'literal': [
73
+ (r'".*"', String),
74
+ (r'0x[0-9A-Fa-f]+t?', Number.Hex),
75
+ (r'[0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
76
+ (r'[0-9]+L?', Number.Integer),
77
+ ],
78
+ 'field': [
79
+ (r'(\$?\b)([\w$]*)(:)',
80
+ bygroups(Punctuation, Name.Variable, Punctuation)),
81
+ ],
82
+ 'method': [
83
+ (r'<(?:cl)?init>', Name.Function), # constructor
84
+ (r'(\$?\b)([\w$]*)(\()',
85
+ bygroups(Punctuation, Name.Function, Punctuation)),
86
+ ],
87
+ 'label': [
88
+ (r':\w+', Name.Label),
89
+ ],
90
+ 'class': [
91
+ # class names in the form Lcom/namespace/ClassName;
92
+ # I only want to color the ClassName part, so the namespace part is
93
+ # treated as 'Text'
94
+ (r'(L)((?:[\w$]+/)*)([\w$]+)(;)',
95
+ bygroups(Keyword.Type, Text, Name.Class, Text)),
96
+ ],
97
+ 'punctuation': [
98
+ (r'->', Punctuation),
99
+ (r'[{},():=.-]', Punctuation),
100
+ ],
101
+ 'type': [
102
+ (r'[ZBSCIJFDV\[]+', Keyword.Type),
103
+ ],
104
+ 'comment': [
105
+ (r'#.*?\n', Comment),
106
+ ],
107
+ }
108
+
109
+ def analyse_text(text):
110
+ score = 0
111
+ if re.search(r'^\s*\.class\s', text, re.MULTILINE):
112
+ score += 0.5
113
+ if re.search(r'\b((check-cast|instance-of|throw-verification-error'
114
+ r')\b|(-to|add|[ais]get|[ais]put|and|cmpl|const|div|'
115
+ r'if|invoke|move|mul|neg|not|or|rem|return|rsub|shl|'
116
+ r'shr|sub|ushr)[-/])|{|}', text, re.MULTILINE):
117
+ score += 0.3
118
+ if re.search(r'(\.(catchall|epilogue|restart local|prologue)|'
119
+ r'\b(array-data|class-change-error|declared-synchronized|'
120
+ r'(field|inline|vtable)@0x[0-9a-fA-F]|generic-error|'
121
+ r'illegal-class-access|illegal-field-access|'
122
+ r'illegal-method-access|instantiation-error|no-error|'
123
+ r'no-such-class|no-such-field|no-such-method|'
124
+ r'packed-switch|sparse-switch))\b', text, re.MULTILINE):
125
+ score += 0.6
126
+ return score
evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/devicetree.py ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.devicetree
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Devicetree language.
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, include, default, words
12
+ from pygments.token import Comment, Keyword, Name, Number, Operator, \
13
+ Punctuation, String, Text, Whitespace
14
+
15
+ __all__ = ['DevicetreeLexer']
16
+
17
+
18
+ class DevicetreeLexer(RegexLexer):
19
+ """
20
+ Lexer for Devicetree files.
21
+ """
22
+
23
+ name = 'Devicetree'
24
+ url = 'https://www.devicetree.org/'
25
+ aliases = ['devicetree', 'dts']
26
+ filenames = ['*.dts', '*.dtsi']
27
+ mimetypes = ['text/x-c']
28
+ version_added = '2.7'
29
+
30
+ #: optional Whitespace or /*...*/ style comment
31
+ _ws = r'\s*(?:/[*][^*/]*?[*]/\s*)*'
32
+
33
+ tokens = {
34
+ 'macro': [
35
+ # Include preprocessor directives (C style):
36
+ (r'(#include)(' + _ws + r')([^\n]+)',
37
+ bygroups(Comment.Preproc, Comment.Multiline, Comment.PreprocFile)),
38
+ # Define preprocessor directives (C style):
39
+ (r'(#define)(' + _ws + r')([^\n]+)',
40
+ bygroups(Comment.Preproc, Comment.Multiline, Comment.Preproc)),
41
+ # devicetree style with file:
42
+ (r'(/[^*/{]+/)(' + _ws + r')("[^\n{]+")',
43
+ bygroups(Comment.Preproc, Comment.Multiline, Comment.PreprocFile)),
44
+ # devicetree style with property:
45
+ (r'(/[^*/{]+/)(' + _ws + r')([^\n;{]*)([;]?)',
46
+ bygroups(Comment.Preproc, Comment.Multiline, Comment.Preproc, Punctuation)),
47
+ ],
48
+ 'whitespace': [
49
+ (r'\n', Whitespace),
50
+ (r'\s+', Whitespace),
51
+ (r'\\\n', Text), # line continuation
52
+ (r'//(\n|[\w\W]*?[^\\]\n)', Comment.Single),
53
+ (r'/(\\\n)?[*][\w\W]*?[*](\\\n)?/', Comment.Multiline),
54
+ # Open until EOF, so no ending delimiter
55
+ (r'/(\\\n)?[*][\w\W]*', Comment.Multiline),
56
+ ],
57
+ 'statements': [
58
+ (r'(L?)(")', bygroups(String.Affix, String), 'string'),
59
+ (r'0x[0-9a-fA-F]+', Number.Hex),
60
+ (r'\d+', Number.Integer),
61
+ (r'([^\s{}/*]*)(\s*)(:)', bygroups(Name.Label, Text, Punctuation), '#pop'),
62
+ (words(('compatible', 'model', 'phandle', 'status', '#address-cells',
63
+ '#size-cells', 'reg', 'virtual-reg', 'ranges', 'dma-ranges',
64
+ 'device_type', 'name'), suffix=r'\b'), Keyword.Reserved),
65
+ (r'([~!%^&*+=|?:<>/#-])', Operator),
66
+ (r'[()\[\]{},.]', Punctuation),
67
+ (r'[a-zA-Z_][\w-]*(?=(?:\s*,\s*[a-zA-Z_][\w-]*|(?:' + _ws + r'))*\s*[=;])',
68
+ Name),
69
+ (r'[a-zA-Z_]\w*', Name.Attribute),
70
+ ],
71
+ 'root': [
72
+ include('whitespace'),
73
+ include('macro'),
74
+
75
+ # Nodes
76
+ (r'([^/*@\s&]+|/)(@?)((?:0x)?[0-9a-fA-F,]*)(' + _ws + r')(\{)',
77
+ bygroups(Name.Function, Operator, Number.Integer,
78
+ Comment.Multiline, Punctuation), 'node'),
79
+
80
+ default('statement'),
81
+ ],
82
+ 'statement': [
83
+ include('whitespace'),
84
+ include('statements'),
85
+ (';', Punctuation, '#pop'),
86
+ ],
87
+ 'node': [
88
+ include('whitespace'),
89
+ include('macro'),
90
+
91
+ (r'([^/*@\s&]+|/)(@?)((?:0x)?[0-9a-fA-F,]*)(' + _ws + r')(\{)',
92
+ bygroups(Name.Function, Operator, Number.Integer,
93
+ Comment.Multiline, Punctuation), '#push'),
94
+
95
+ include('statements'),
96
+
97
+ (r'\};', Punctuation, '#pop'),
98
+ (';', Punctuation),
99
+ ],
100
+ 'string': [
101
+ (r'"', String, '#pop'),
102
+ (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|'
103
+ r'u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})', String.Escape),
104
+ (r'[^\\"\n]+', String), # all other characters
105
+ (r'\\\n', String), # line continuation
106
+ (r'\\', String), # stray backslash
107
+ ],
108
+ }
evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/dsls.py ADDED
@@ -0,0 +1,970 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.dsls
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for various domain-specific languages.
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import ExtendedRegexLexer, RegexLexer, bygroups, words, \
14
+ include, default, this, using, combined
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Whitespace
17
+
18
+ __all__ = ['ProtoBufLexer', 'ZeekLexer', 'PuppetLexer', 'RslLexer',
19
+ 'MscgenLexer', 'VGLLexer', 'AlloyLexer', 'PanLexer',
20
+ 'CrmshLexer', 'ThriftLexer', 'FlatlineLexer', 'SnowballLexer']
21
+
22
+
23
+ class ProtoBufLexer(RegexLexer):
24
+ """
25
+ Lexer for Protocol Buffer definition files.
26
+ """
27
+
28
+ name = 'Protocol Buffer'
29
+ url = 'https://developers.google.com/protocol-buffers/'
30
+ aliases = ['protobuf', 'proto']
31
+ filenames = ['*.proto']
32
+ version_added = '1.4'
33
+
34
+ tokens = {
35
+ 'root': [
36
+ (r'[ \t]+', Whitespace),
37
+ (r'[,;{}\[\]()<>]', Punctuation),
38
+ (r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
39
+ (r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline),
40
+ (words((
41
+ 'import', 'option', 'optional', 'required', 'repeated',
42
+ 'reserved', 'default', 'packed', 'ctype', 'extensions', 'to',
43
+ 'max', 'rpc', 'returns', 'oneof', 'syntax'), prefix=r'\b', suffix=r'\b'),
44
+ Keyword),
45
+ (words((
46
+ 'int32', 'int64', 'uint32', 'uint64', 'sint32', 'sint64',
47
+ 'fixed32', 'fixed64', 'sfixed32', 'sfixed64',
48
+ 'float', 'double', 'bool', 'string', 'bytes'), suffix=r'\b'),
49
+ Keyword.Type),
50
+ (r'(true|false)\b', Keyword.Constant),
51
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Whitespace), 'package'),
52
+ (r'(message|extend)(\s+)',
53
+ bygroups(Keyword.Declaration, Whitespace), 'message'),
54
+ (r'(enum|group|service)(\s+)',
55
+ bygroups(Keyword.Declaration, Whitespace), 'type'),
56
+ (r'\".*?\"', String),
57
+ (r'\'.*?\'', String),
58
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
59
+ (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
60
+ (r'(\-?(inf|nan))\b', Number.Float),
61
+ (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
62
+ (r'0[0-7]+[LlUu]*', Number.Oct),
63
+ (r'\d+[LlUu]*', Number.Integer),
64
+ (r'[+-=]', Operator),
65
+ (r'([a-zA-Z_][\w.]*)([ \t]*)(=)',
66
+ bygroups(Name.Attribute, Whitespace, Operator)),
67
+ (r'[a-zA-Z_][\w.]*', Name),
68
+ ],
69
+ 'package': [
70
+ (r'[a-zA-Z_]\w*', Name.Namespace, '#pop'),
71
+ default('#pop'),
72
+ ],
73
+ 'message': [
74
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop'),
75
+ default('#pop'),
76
+ ],
77
+ 'type': [
78
+ (r'[a-zA-Z_]\w*', Name, '#pop'),
79
+ default('#pop'),
80
+ ],
81
+ }
82
+
83
+
84
+ class ThriftLexer(RegexLexer):
85
+ """
86
+ For Thrift interface definitions.
87
+ """
88
+ name = 'Thrift'
89
+ url = 'https://thrift.apache.org/'
90
+ aliases = ['thrift']
91
+ filenames = ['*.thrift']
92
+ mimetypes = ['application/x-thrift']
93
+ version_added = '2.1'
94
+
95
+ tokens = {
96
+ 'root': [
97
+ include('whitespace'),
98
+ include('comments'),
99
+ (r'"', String.Double, combined('stringescape', 'dqs')),
100
+ (r'\'', String.Single, combined('stringescape', 'sqs')),
101
+ (r'(namespace)(\s+)',
102
+ bygroups(Keyword.Namespace, Whitespace), 'namespace'),
103
+ (r'(enum|union|struct|service|exception)(\s+)',
104
+ bygroups(Keyword.Declaration, Whitespace), 'class'),
105
+ (r'((?:(?:[^\W\d]|\$)[\w.\[\]$<>]*\s+)+?)' # return arguments
106
+ r'((?:[^\W\d]|\$)[\w$]*)' # method name
107
+ r'(\s*)(\()', # signature start
108
+ bygroups(using(this), Name.Function, Whitespace, Operator)),
109
+ include('keywords'),
110
+ include('numbers'),
111
+ (r'[&=]', Operator),
112
+ (r'[:;,{}()<>\[\]]', Punctuation),
113
+ (r'[a-zA-Z_](\.\w|\w)*', Name),
114
+ ],
115
+ 'whitespace': [
116
+ (r'\n', Whitespace),
117
+ (r'\s+', Whitespace),
118
+ ],
119
+ 'comments': [
120
+ (r'#.*$', Comment),
121
+ (r'//.*?\n', Comment),
122
+ (r'/\*[\w\W]*?\*/', Comment.Multiline),
123
+ ],
124
+ 'stringescape': [
125
+ (r'\\([\\nrt"\'])', String.Escape),
126
+ ],
127
+ 'dqs': [
128
+ (r'"', String.Double, '#pop'),
129
+ (r'[^\\"\n]+', String.Double),
130
+ ],
131
+ 'sqs': [
132
+ (r"'", String.Single, '#pop'),
133
+ (r'[^\\\'\n]+', String.Single),
134
+ ],
135
+ 'namespace': [
136
+ (r'[a-z*](\.\w|\w)*', Name.Namespace, '#pop'),
137
+ default('#pop'),
138
+ ],
139
+ 'class': [
140
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop'),
141
+ default('#pop'),
142
+ ],
143
+ 'keywords': [
144
+ (r'(async|oneway|extends|throws|required|optional)\b', Keyword),
145
+ (r'(true|false)\b', Keyword.Constant),
146
+ (r'(const|typedef)\b', Keyword.Declaration),
147
+ (words((
148
+ 'cpp_namespace', 'cpp_include', 'cpp_type', 'java_package',
149
+ 'cocoa_prefix', 'csharp_namespace', 'delphi_namespace',
150
+ 'php_namespace', 'py_module', 'perl_package',
151
+ 'ruby_namespace', 'smalltalk_category', 'smalltalk_prefix',
152
+ 'xsd_all', 'xsd_optional', 'xsd_nillable', 'xsd_namespace',
153
+ 'xsd_attrs', 'include'), suffix=r'\b'),
154
+ Keyword.Namespace),
155
+ (words((
156
+ 'void', 'bool', 'byte', 'i16', 'i32', 'i64', 'double',
157
+ 'string', 'binary', 'map', 'list', 'set', 'slist',
158
+ 'senum'), suffix=r'\b'),
159
+ Keyword.Type),
160
+ (words((
161
+ 'BEGIN', 'END', '__CLASS__', '__DIR__', '__FILE__',
162
+ '__FUNCTION__', '__LINE__', '__METHOD__', '__NAMESPACE__',
163
+ 'abstract', 'alias', 'and', 'args', 'as', 'assert', 'begin',
164
+ 'break', 'case', 'catch', 'class', 'clone', 'continue',
165
+ 'declare', 'def', 'default', 'del', 'delete', 'do', 'dynamic',
166
+ 'elif', 'else', 'elseif', 'elsif', 'end', 'enddeclare',
167
+ 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile',
168
+ 'ensure', 'except', 'exec', 'finally', 'float', 'for',
169
+ 'foreach', 'function', 'global', 'goto', 'if', 'implements',
170
+ 'import', 'in', 'inline', 'instanceof', 'interface', 'is',
171
+ 'lambda', 'module', 'native', 'new', 'next', 'nil', 'not',
172
+ 'or', 'pass', 'public', 'print', 'private', 'protected',
173
+ 'raise', 'redo', 'rescue', 'retry', 'register', 'return',
174
+ 'self', 'sizeof', 'static', 'super', 'switch', 'synchronized',
175
+ 'then', 'this', 'throw', 'transient', 'try', 'undef',
176
+ 'unless', 'unsigned', 'until', 'use', 'var', 'virtual',
177
+ 'volatile', 'when', 'while', 'with', 'xor', 'yield'),
178
+ prefix=r'\b', suffix=r'\b'),
179
+ Keyword.Reserved),
180
+ ],
181
+ 'numbers': [
182
+ (r'[+-]?(\d+\.\d+([eE][+-]?\d+)?|\.?\d+[eE][+-]?\d+)', Number.Float),
183
+ (r'[+-]?0x[0-9A-Fa-f]+', Number.Hex),
184
+ (r'[+-]?[0-9]+', Number.Integer),
185
+ ],
186
+ }
187
+
188
+
189
+ class ZeekLexer(RegexLexer):
190
+ """
191
+ For Zeek scripts.
192
+ """
193
+ name = 'Zeek'
194
+ url = 'https://www.zeek.org/'
195
+ aliases = ['zeek', 'bro']
196
+ filenames = ['*.zeek', '*.bro']
197
+ version_added = '2.5'
198
+
199
+ _hex = r'[0-9a-fA-F]'
200
+ _float = r'((\d*\.?\d+)|(\d+\.?\d*))([eE][-+]?\d+)?'
201
+ _h = r'[A-Za-z0-9][-A-Za-z0-9]*'
202
+
203
+ tokens = {
204
+ 'root': [
205
+ include('whitespace'),
206
+ include('comments'),
207
+ include('directives'),
208
+ include('attributes'),
209
+ include('types'),
210
+ include('keywords'),
211
+ include('literals'),
212
+ include('operators'),
213
+ include('punctuation'),
214
+ (r'((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)(?=\s*\()',
215
+ Name.Function),
216
+ include('identifiers'),
217
+ ],
218
+
219
+ 'whitespace': [
220
+ (r'\n', Whitespace),
221
+ (r'\s+', Whitespace),
222
+ (r'(\\)(\n)', bygroups(Text, Whitespace)),
223
+ ],
224
+
225
+ 'comments': [
226
+ (r'#.*$', Comment),
227
+ ],
228
+
229
+ 'directives': [
230
+ (r'@(load-plugin|load-sigs|load|unload)\b.*$', Comment.Preproc),
231
+ (r'@(DEBUG|DIR|FILENAME|deprecated|if|ifdef|ifndef|else|endif)\b', Comment.Preproc),
232
+ (r'(@prefixes)(\s*)((\+?=).*)$', bygroups(Comment.Preproc,
233
+ Whitespace, Comment.Preproc)),
234
+ ],
235
+
236
+ 'attributes': [
237
+ (words(('redef', 'priority', 'log', 'optional', 'default', 'add_func',
238
+ 'delete_func', 'expire_func', 'read_expire', 'write_expire',
239
+ 'create_expire', 'synchronized', 'persistent', 'rotate_interval',
240
+ 'rotate_size', 'encrypt', 'raw_output', 'mergeable', 'error_handler',
241
+ 'type_column', 'deprecated'),
242
+ prefix=r'&', suffix=r'\b'),
243
+ Keyword.Pseudo),
244
+ ],
245
+
246
+ 'types': [
247
+ (words(('any',
248
+ 'enum', 'record', 'set', 'table', 'vector',
249
+ 'function', 'hook', 'event',
250
+ 'addr', 'bool', 'count', 'double', 'file', 'int', 'interval',
251
+ 'pattern', 'port', 'string', 'subnet', 'time'),
252
+ suffix=r'\b'),
253
+ Keyword.Type),
254
+
255
+ (r'(opaque)(\s+)(of)(\s+)((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)\b',
256
+ bygroups(Keyword.Type, Whitespace, Operator.Word, Whitespace, Keyword.Type)),
257
+
258
+ (r'(type)(\s+)((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)(\s*)(:)(\s*)\b(record|enum)\b',
259
+ bygroups(Keyword, Whitespace, Name.Class, Whitespace, Operator, Whitespace, Keyword.Type)),
260
+
261
+ (r'(type)(\s+)((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)(\s*)(:)',
262
+ bygroups(Keyword, Whitespace, Name, Whitespace, Operator)),
263
+
264
+ (r'(redef)(\s+)(record|enum)(\s+)((?:[A-Za-z_]\w*)(?:::(?:[A-Za-z_]\w*))*)\b',
265
+ bygroups(Keyword, Whitespace, Keyword.Type, Whitespace, Name.Class)),
266
+ ],
267
+
268
+ 'keywords': [
269
+ (words(('redef', 'export', 'if', 'else', 'for', 'while',
270
+ 'return', 'break', 'next', 'continue', 'fallthrough',
271
+ 'switch', 'default', 'case',
272
+ 'add', 'delete',
273
+ 'when', 'timeout', 'schedule'),
274
+ suffix=r'\b'),
275
+ Keyword),
276
+ (r'(print)\b', Keyword),
277
+ (r'(global|local|const|option)\b', Keyword.Declaration),
278
+ (r'(module)(\s+)(([A-Za-z_]\w*)(?:::([A-Za-z_]\w*))*)\b',
279
+ bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
280
+ ],
281
+
282
+ 'literals': [
283
+ (r'"', String, 'string'),
284
+
285
+ # Not the greatest match for patterns, but generally helps
286
+ # disambiguate between start of a pattern and just a division
287
+ # operator.
288
+ (r'/(?=.*/)', String.Regex, 'regex'),
289
+
290
+ (r'(T|F)\b', Keyword.Constant),
291
+
292
+ # Port
293
+ (r'\d{1,5}/(udp|tcp|icmp|unknown)\b', Number),
294
+
295
+ # IPv4 Address
296
+ (r'(\d{1,3}.){3}(\d{1,3})\b', Number),
297
+
298
+ # IPv6 Address
299
+ (r'\[([0-9a-fA-F]{0,4}:){2,7}([0-9a-fA-F]{0,4})?((\d{1,3}.){3}(\d{1,3}))?\]', Number),
300
+
301
+ # Numeric
302
+ (r'0[xX]' + _hex + r'+\b', Number.Hex),
303
+ (_float + r'\s*(day|hr|min|sec|msec|usec)s?\b', Number.Float),
304
+ (_float + r'\b', Number.Float),
305
+ (r'(\d+)\b', Number.Integer),
306
+
307
+ # Hostnames
308
+ (_h + r'(\.' + _h + r')+', String),
309
+ ],
310
+
311
+ 'operators': [
312
+ (r'[!%*/+<=>~|&^-]', Operator),
313
+ (r'([-+=&|]{2}|[+=!><-]=)', Operator),
314
+ (r'(in|as|is|of)\b', Operator.Word),
315
+ (r'\??\$', Operator),
316
+ ],
317
+
318
+ 'punctuation': [
319
+ (r'[{}()\[\],;.]', Punctuation),
320
+ # The "ternary if", which uses '?' and ':', could instead be
321
+ # treated as an Operator, but colons are more frequently used to
322
+ # separate field/identifier names from their types, so the (often)
323
+ # less-prominent Punctuation is used even with '?' for consistency.
324
+ (r'[?:]', Punctuation),
325
+ ],
326
+
327
+ 'identifiers': [
328
+ (r'([a-zA-Z_]\w*)(::)', bygroups(Name, Punctuation)),
329
+ (r'[a-zA-Z_]\w*', Name)
330
+ ],
331
+
332
+ 'string': [
333
+ (r'\\.', String.Escape),
334
+ (r'%-?[0-9]*(\.[0-9]+)?[DTd-gsx]', String.Escape),
335
+ (r'"', String, '#pop'),
336
+ (r'.', String),
337
+ ],
338
+
339
+ 'regex': [
340
+ (r'\\.', String.Escape),
341
+ (r'/', String.Regex, '#pop'),
342
+ (r'.', String.Regex),
343
+ ],
344
+ }
345
+
346
+
347
+ BroLexer = ZeekLexer
348
+
349
+
350
+ class PuppetLexer(RegexLexer):
351
+ """
352
+ For Puppet configuration DSL.
353
+ """
354
+ name = 'Puppet'
355
+ url = 'https://puppet.com/'
356
+ aliases = ['puppet']
357
+ filenames = ['*.pp']
358
+ version_added = '1.6'
359
+
360
+ tokens = {
361
+ 'root': [
362
+ include('comments'),
363
+ include('keywords'),
364
+ include('names'),
365
+ include('numbers'),
366
+ include('operators'),
367
+ include('strings'),
368
+
369
+ (r'[]{}:(),;[]', Punctuation),
370
+ (r'\s+', Whitespace),
371
+ ],
372
+
373
+ 'comments': [
374
+ (r'(\s*)(#.*)$', bygroups(Whitespace, Comment)),
375
+ (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
376
+ ],
377
+
378
+ 'operators': [
379
+ (r'(=>|\?|<|>|=|\+|-|/|\*|~|!|\|)', Operator),
380
+ (r'(in|and|or|not)\b', Operator.Word),
381
+ ],
382
+
383
+ 'names': [
384
+ (r'[a-zA-Z_]\w*', Name.Attribute),
385
+ (r'(\$\S+)(\[)(\S+)(\])', bygroups(Name.Variable, Punctuation,
386
+ String, Punctuation)),
387
+ (r'\$\S+', Name.Variable),
388
+ ],
389
+
390
+ 'numbers': [
391
+ # Copypasta from the Python lexer
392
+ (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
393
+ (r'\d+[eE][+-]?[0-9]+j?', Number.Float),
394
+ (r'0[0-7]+j?', Number.Oct),
395
+ (r'0[xX][a-fA-F0-9]+', Number.Hex),
396
+ (r'\d+L', Number.Integer.Long),
397
+ (r'\d+j?', Number.Integer)
398
+ ],
399
+
400
+ 'keywords': [
401
+ # Left out 'group' and 'require'
402
+ # Since they're often used as attributes
403
+ (words((
404
+ 'absent', 'alert', 'alias', 'audit', 'augeas', 'before', 'case',
405
+ 'check', 'class', 'computer', 'configured', 'contained',
406
+ 'create_resources', 'crit', 'cron', 'debug', 'default',
407
+ 'define', 'defined', 'directory', 'else', 'elsif', 'emerg',
408
+ 'err', 'exec', 'extlookup', 'fail', 'false', 'file',
409
+ 'filebucket', 'fqdn_rand', 'generate', 'host', 'if', 'import',
410
+ 'include', 'info', 'inherits', 'inline_template', 'installed',
411
+ 'interface', 'k5login', 'latest', 'link', 'loglevel',
412
+ 'macauthorization', 'mailalias', 'maillist', 'mcx', 'md5',
413
+ 'mount', 'mounted', 'nagios_command', 'nagios_contact',
414
+ 'nagios_contactgroup', 'nagios_host', 'nagios_hostdependency',
415
+ 'nagios_hostescalation', 'nagios_hostextinfo', 'nagios_hostgroup',
416
+ 'nagios_service', 'nagios_servicedependency', 'nagios_serviceescalation',
417
+ 'nagios_serviceextinfo', 'nagios_servicegroup', 'nagios_timeperiod',
418
+ 'node', 'noop', 'notice', 'notify', 'package', 'present', 'purged',
419
+ 'realize', 'regsubst', 'resources', 'role', 'router', 'running',
420
+ 'schedule', 'scheduled_task', 'search', 'selboolean', 'selmodule',
421
+ 'service', 'sha1', 'shellquote', 'split', 'sprintf',
422
+ 'ssh_authorized_key', 'sshkey', 'stage', 'stopped', 'subscribe',
423
+ 'tag', 'tagged', 'template', 'tidy', 'true', 'undef', 'unmounted',
424
+ 'user', 'versioncmp', 'vlan', 'warning', 'yumrepo', 'zfs', 'zone',
425
+ 'zpool'), prefix='(?i)', suffix=r'\b'),
426
+ Keyword),
427
+ ],
428
+
429
+ 'strings': [
430
+ (r'"([^"])*"', String),
431
+ (r"'(\\'|[^'])*'", String),
432
+ ],
433
+
434
+ }
435
+
436
+
437
+ class RslLexer(RegexLexer):
438
+ """
439
+ RSL is the formal specification
440
+ language used in RAISE (Rigorous Approach to Industrial Software Engineering)
441
+ method.
442
+ """
443
+ name = 'RSL'
444
+ url = 'http://en.wikipedia.org/wiki/RAISE'
445
+ aliases = ['rsl']
446
+ filenames = ['*.rsl']
447
+ mimetypes = ['text/rsl']
448
+ version_added = '2.0'
449
+
450
+ flags = re.MULTILINE | re.DOTALL
451
+
452
+ tokens = {
453
+ 'root': [
454
+ (words((
455
+ 'Bool', 'Char', 'Int', 'Nat', 'Real', 'Text', 'Unit', 'abs',
456
+ 'all', 'always', 'any', 'as', 'axiom', 'card', 'case', 'channel',
457
+ 'chaos', 'class', 'devt_relation', 'dom', 'elems', 'else', 'elif',
458
+ 'end', 'exists', 'extend', 'false', 'for', 'hd', 'hide', 'if',
459
+ 'in', 'is', 'inds', 'initialise', 'int', 'inter', 'isin', 'len',
460
+ 'let', 'local', 'ltl_assertion', 'object', 'of', 'out', 'post',
461
+ 'pre', 'read', 'real', 'rng', 'scheme', 'skip', 'stop', 'swap',
462
+ 'then', 'theory', 'test_case', 'tl', 'transition_system', 'true',
463
+ 'type', 'union', 'until', 'use', 'value', 'variable', 'while',
464
+ 'with', 'write', '~isin', '-inflist', '-infset', '-list',
465
+ '-set'), prefix=r'\b', suffix=r'\b'),
466
+ Keyword),
467
+ (r'(variable|value)\b', Keyword.Declaration),
468
+ (r'--.*?\n', Comment),
469
+ (r'<:.*?:>', Comment),
470
+ (r'\{!.*?!\}', Comment),
471
+ (r'/\*.*?\*/', Comment),
472
+ (r'^([ \t]*)([\w]+)([ \t]*)(:[^:])', bygroups(Whitespace,
473
+ Name.Function, Whitespace, Name.Function)),
474
+ (r'(^[ \t]*)([\w]+)([ \t]*)(\([\w\s,]*\))([ \t]*)(is|as)',
475
+ bygroups(Whitespace, Name.Function, Whitespace, Text,
476
+ Whitespace, Keyword)),
477
+ (r'\b[A-Z]\w*\b', Keyword.Type),
478
+ (r'(true|false)\b', Keyword.Constant),
479
+ (r'".*"', String),
480
+ (r'\'.\'', String.Char),
481
+ (r'(><|->|-m->|/\\|<=|<<=|<\.|\|\||\|\^\||-~->|-~m->|\\/|>=|>>|'
482
+ r'\.>|\+\+|-\\|<->|=>|:-|~=|\*\*|<<|>>=|\+>|!!|\|=\||#)',
483
+ Operator),
484
+ (r'[0-9]+\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
485
+ (r'0x[0-9a-f]+', Number.Hex),
486
+ (r'[0-9]+', Number.Integer),
487
+ (r'\s+', Whitespace),
488
+ (r'.', Text),
489
+ ],
490
+ }
491
+
492
+ def analyse_text(text):
493
+ """
494
+ Check for the most common text in the beginning of a RSL file.
495
+ """
496
+ if re.search(r'scheme\s*.*?=\s*class\s*type', text, re.I) is not None:
497
+ return 1.0
498
+
499
+
500
+ class MscgenLexer(RegexLexer):
501
+ """
502
+ For Mscgen files.
503
+ """
504
+ name = 'Mscgen'
505
+ url = 'http://www.mcternan.me.uk/mscgen/'
506
+ aliases = ['mscgen', 'msc']
507
+ filenames = ['*.msc']
508
+ version_added = '1.6'
509
+
510
+ _var = r'(\w+|"(?:\\"|[^"])*")'
511
+
512
+ tokens = {
513
+ 'root': [
514
+ (r'msc\b', Keyword.Type),
515
+ # Options
516
+ (r'(hscale|HSCALE|width|WIDTH|wordwraparcs|WORDWRAPARCS'
517
+ r'|arcgradient|ARCGRADIENT)\b', Name.Property),
518
+ # Operators
519
+ (r'(abox|ABOX|rbox|RBOX|box|BOX|note|NOTE)\b', Operator.Word),
520
+ (r'(\.|-|\|){3}', Keyword),
521
+ (r'(?:-|=|\.|:){2}'
522
+ r'|<<=>>|<->|<=>|<<>>|<:>'
523
+ r'|->|=>>|>>|=>|:>|-x|-X'
524
+ r'|<-|<<=|<<|<=|<:|x-|X-|=', Operator),
525
+ # Names
526
+ (r'\*', Name.Builtin),
527
+ (_var, Name.Variable),
528
+ # Other
529
+ (r'\[', Punctuation, 'attrs'),
530
+ (r'\{|\}|,|;', Punctuation),
531
+ include('comments')
532
+ ],
533
+ 'attrs': [
534
+ (r'\]', Punctuation, '#pop'),
535
+ (_var + r'(\s*)(=)(\s*)' + _var,
536
+ bygroups(Name.Attribute, Whitespace, Operator, Whitespace,
537
+ String)),
538
+ (r',', Punctuation),
539
+ include('comments')
540
+ ],
541
+ 'comments': [
542
+ (r'(?://|#).*?\n', Comment.Single),
543
+ (r'/\*(?:.|\n)*?\*/', Comment.Multiline),
544
+ (r'[ \t\r\n]+', Whitespace)
545
+ ]
546
+ }
547
+
548
+
549
+ class VGLLexer(RegexLexer):
550
+ """
551
+ For SampleManager VGL source code.
552
+ """
553
+ name = 'VGL'
554
+ url = 'http://www.thermoscientific.com/samplemanager'
555
+ aliases = ['vgl']
556
+ filenames = ['*.rpf']
557
+ version_added = '1.6'
558
+
559
+ flags = re.MULTILINE | re.DOTALL | re.IGNORECASE
560
+
561
+ tokens = {
562
+ 'root': [
563
+ (r'\{[^}]*\}', Comment.Multiline),
564
+ (r'declare', Keyword.Constant),
565
+ (r'(if|then|else|endif|while|do|endwhile|and|or|prompt|object'
566
+ r'|create|on|line|with|global|routine|value|endroutine|constant'
567
+ r'|global|set|join|library|compile_option|file|exists|create|copy'
568
+ r'|delete|enable|windows|name|notprotected)(?! *[=<>.,()])',
569
+ Keyword),
570
+ (r'(true|false|null|empty|error|locked)', Keyword.Constant),
571
+ (r'[~^*#!%&\[\]()<>|+=:;,./?-]', Operator),
572
+ (r'"[^"]*"', String),
573
+ (r'(\.)([a-z_$][\w$]*)', bygroups(Operator, Name.Attribute)),
574
+ (r'[0-9][0-9]*(\.[0-9]+(e[+\-]?[0-9]+)?)?', Number),
575
+ (r'[a-z_$][\w$]*', Name),
576
+ (r'[\r\n]+', Whitespace),
577
+ (r'\s+', Whitespace)
578
+ ]
579
+ }
580
+
581
+
582
+ class AlloyLexer(RegexLexer):
583
+ """
584
+ For Alloy source code.
585
+ """
586
+
587
+ name = 'Alloy'
588
+ url = 'http://alloy.mit.edu'
589
+ aliases = ['alloy']
590
+ filenames = ['*.als']
591
+ mimetypes = ['text/x-alloy']
592
+ version_added = '2.0'
593
+
594
+ flags = re.MULTILINE | re.DOTALL
595
+
596
+ iden_rex = r'[a-zA-Z_][\w]*"*'
597
+ string_rex = r'"\b(\\\\|\\[^\\]|[^"\\])*"'
598
+ text_tuple = (r'[^\S\n]+', Whitespace)
599
+
600
+ tokens = {
601
+ 'sig': [
602
+ (r'(extends)\b', Keyword, '#pop'),
603
+ (iden_rex, Name),
604
+ text_tuple,
605
+ (r',', Punctuation),
606
+ (r'\{', Operator, '#pop'),
607
+ ],
608
+ 'module': [
609
+ text_tuple,
610
+ (iden_rex, Name, '#pop'),
611
+ ],
612
+ 'fun': [
613
+ text_tuple,
614
+ (r'\{', Operator, '#pop'),
615
+ (iden_rex, Name, '#pop'),
616
+ ],
617
+ 'fact': [
618
+ include('fun'),
619
+ (string_rex, String, '#pop'),
620
+ ],
621
+ 'root': [
622
+ (r'--.*?$', Comment.Single),
623
+ (r'//.*?$', Comment.Single),
624
+ (r'/\*.*?\*/', Comment.Multiline),
625
+ text_tuple,
626
+ (r'(module|open)(\s+)', bygroups(Keyword.Namespace, Whitespace),
627
+ 'module'),
628
+ (r'(sig|enum)(\s+)', bygroups(Keyword.Declaration, Whitespace), 'sig'),
629
+ (r'(iden|univ|none)\b', Keyword.Constant),
630
+ (r'(int|Int)\b', Keyword.Type),
631
+ (r'(var|this|abstract|extends|set|seq|one|lone|let)\b', Keyword),
632
+ (r'(all|some|no|sum|disj|when|else)\b', Keyword),
633
+ (r'(run|check|for|but|exactly|expect|as|steps)\b', Keyword),
634
+ (r'(always|after|eventually|until|release)\b', Keyword), # future time operators
635
+ (r'(historically|before|once|since|triggered)\b', Keyword), # past time operators
636
+ (r'(and|or|implies|iff|in)\b', Operator.Word),
637
+ (r'(fun|pred|assert)(\s+)', bygroups(Keyword, Whitespace), 'fun'),
638
+ (r'(fact)(\s+)', bygroups(Keyword, Whitespace), 'fact'),
639
+ (r'!|#|&&|\+\+|<<|>>|>=|<=>|<=|\.\.|\.|->', Operator),
640
+ (r'[-+/*%=<>&!^|~{}\[\]().\';]', Operator),
641
+ (iden_rex, Name),
642
+ (r'[:,]', Punctuation),
643
+ (r'[0-9]+', Number.Integer),
644
+ (string_rex, String),
645
+ (r'\n', Whitespace),
646
+ ]
647
+ }
648
+
649
+
650
+ class PanLexer(RegexLexer):
651
+ """
652
+ Lexer for pan source files.
653
+
654
+ Based on tcsh lexer.
655
+ """
656
+
657
+ name = 'Pan'
658
+ url = 'https://github.com/quattor/pan/'
659
+ aliases = ['pan']
660
+ filenames = ['*.pan']
661
+ version_added = '2.0'
662
+
663
+ tokens = {
664
+ 'root': [
665
+ include('basic'),
666
+ (r'\(', Keyword, 'paren'),
667
+ (r'\{', Keyword, 'curly'),
668
+ include('data'),
669
+ ],
670
+ 'basic': [
671
+ (words((
672
+ 'if', 'for', 'with', 'else', 'type', 'bind', 'while', 'valid', 'final',
673
+ 'prefix', 'unique', 'object', 'foreach', 'include', 'template',
674
+ 'function', 'variable', 'structure', 'extensible', 'declaration'),
675
+ prefix=r'\b', suffix=r'\b'),
676
+ Keyword),
677
+ (words((
678
+ 'file_contents', 'format', 'index', 'length', 'match', 'matches',
679
+ 'replace', 'splice', 'split', 'substr', 'to_lowercase', 'to_uppercase',
680
+ 'debug', 'error', 'traceback', 'deprecated', 'base64_decode',
681
+ 'base64_encode', 'digest', 'escape', 'unescape', 'append', 'create',
682
+ 'first', 'nlist', 'key', 'list', 'merge', 'next', 'prepend', 'is_boolean',
683
+ 'is_defined', 'is_double', 'is_list', 'is_long', 'is_nlist', 'is_null',
684
+ 'is_number', 'is_property', 'is_resource', 'is_string', 'to_boolean',
685
+ 'to_double', 'to_long', 'to_string', 'clone', 'delete', 'exists',
686
+ 'path_exists', 'if_exists', 'return', 'value'),
687
+ prefix=r'\b', suffix=r'\b'),
688
+ Name.Builtin),
689
+ (r'#.*', Comment),
690
+ (r'\\[\w\W]', String.Escape),
691
+ (r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Whitespace, Operator)),
692
+ (r'[\[\]{}()=]+', Operator),
693
+ (r'<<\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
694
+ (r';', Punctuation),
695
+ ],
696
+ 'data': [
697
+ (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
698
+ (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
699
+ (r'\s+', Whitespace),
700
+ (r'[^=\s\[\]{}()$"\'`\\;#]+', Text),
701
+ (r'\d+(?= |\Z)', Number),
702
+ ],
703
+ 'curly': [
704
+ (r'\}', Keyword, '#pop'),
705
+ (r':-', Keyword),
706
+ (r'\w+', Name.Variable),
707
+ (r'[^}:"\'`$]+', Punctuation),
708
+ (r':', Punctuation),
709
+ include('root'),
710
+ ],
711
+ 'paren': [
712
+ (r'\)', Keyword, '#pop'),
713
+ include('root'),
714
+ ],
715
+ }
716
+
717
+
718
+ class CrmshLexer(RegexLexer):
719
+ """
720
+ Lexer for crmsh configuration files for Pacemaker clusters.
721
+ """
722
+ name = 'Crmsh'
723
+ url = 'http://crmsh.github.io/'
724
+ aliases = ['crmsh', 'pcmk']
725
+ filenames = ['*.crmsh', '*.pcmk']
726
+ mimetypes = []
727
+ version_added = '2.1'
728
+
729
+ elem = words((
730
+ 'node', 'primitive', 'group', 'clone', 'ms', 'location',
731
+ 'colocation', 'order', 'fencing_topology', 'rsc_ticket',
732
+ 'rsc_template', 'property', 'rsc_defaults',
733
+ 'op_defaults', 'acl_target', 'acl_group', 'user', 'role',
734
+ 'tag'), suffix=r'(?![\w#$-])')
735
+ sub = words((
736
+ 'params', 'meta', 'operations', 'op', 'rule',
737
+ 'attributes', 'utilization'), suffix=r'(?![\w#$-])')
738
+ acl = words(('read', 'write', 'deny'), suffix=r'(?![\w#$-])')
739
+ bin_rel = words(('and', 'or'), suffix=r'(?![\w#$-])')
740
+ un_ops = words(('defined', 'not_defined'), suffix=r'(?![\w#$-])')
741
+ date_exp = words(('in_range', 'date', 'spec', 'in'), suffix=r'(?![\w#$-])')
742
+ acl_mod = (r'(?:tag|ref|reference|attribute|type|xpath)')
743
+ bin_ops = (r'(?:lt|gt|lte|gte|eq|ne)')
744
+ val_qual = (r'(?:string|version|number)')
745
+ rsc_role_action = (r'(?:Master|Started|Slave|Stopped|'
746
+ r'start|promote|demote|stop)')
747
+
748
+ tokens = {
749
+ 'root': [
750
+ (r'^(#.*)(\n)?', bygroups(Comment, Whitespace)),
751
+ # attr=value (nvpair)
752
+ (r'([\w#$-]+)(=)("(?:""|[^"])*"|\S+)',
753
+ bygroups(Name.Attribute, Punctuation, String)),
754
+ # need this construct, otherwise numeric node ids
755
+ # are matched as scores
756
+ # elem id:
757
+ (r'(node)(\s+)([\w#$-]+)(:)',
758
+ bygroups(Keyword, Whitespace, Name, Punctuation)),
759
+ # scores
760
+ (r'([+-]?([0-9]+|inf)):', Number),
761
+ # keywords (elements and other)
762
+ (elem, Keyword),
763
+ (sub, Keyword),
764
+ (acl, Keyword),
765
+ # binary operators
766
+ (rf'(?:{val_qual}:)?({bin_ops})(?![\w#$-])', Operator.Word),
767
+ # other operators
768
+ (bin_rel, Operator.Word),
769
+ (un_ops, Operator.Word),
770
+ (date_exp, Operator.Word),
771
+ # builtin attributes (e.g. #uname)
772
+ (r'#[a-z]+(?![\w#$-])', Name.Builtin),
773
+ # acl_mod:blah
774
+ (rf'({acl_mod})(:)("(?:""|[^"])*"|\S+)',
775
+ bygroups(Keyword, Punctuation, Name)),
776
+ # rsc_id[:(role|action)]
777
+ # NB: this matches all other identifiers
778
+ (rf'([\w#$-]+)(?:(:)({rsc_role_action}))?(?![\w#$-])',
779
+ bygroups(Name, Punctuation, Operator.Word)),
780
+ # punctuation
781
+ (r'(\\(?=\n)|[\[\](){}/:@])', Punctuation),
782
+ (r'\s+|\n', Whitespace),
783
+ ],
784
+ }
785
+
786
+
787
+ class FlatlineLexer(RegexLexer):
788
+ """
789
+ Lexer for Flatline expressions.
790
+ """
791
+ name = 'Flatline'
792
+ url = 'https://github.com/bigmlcom/flatline'
793
+ aliases = ['flatline']
794
+ filenames = []
795
+ mimetypes = ['text/x-flatline']
796
+ version_added = '2.2'
797
+
798
+ special_forms = ('let',)
799
+
800
+ builtins = (
801
+ "!=", "*", "+", "-", "<", "<=", "=", ">", ">=", "abs", "acos", "all",
802
+ "all-but", "all-with-defaults", "all-with-numeric-default", "and",
803
+ "asin", "atan", "avg", "avg-window", "bin-center", "bin-count", "call",
804
+ "category-count", "ceil", "cond", "cond-window", "cons", "cos", "cosh",
805
+ "count", "diff-window", "div", "ensure-value", "ensure-weighted-value",
806
+ "epoch", "epoch-day", "epoch-fields", "epoch-hour", "epoch-millisecond",
807
+ "epoch-minute", "epoch-month", "epoch-second", "epoch-weekday",
808
+ "epoch-year", "exp", "f", "field", "field-prop", "fields", "filter",
809
+ "first", "floor", "head", "if", "in", "integer", "language", "length",
810
+ "levenshtein", "linear-regression", "list", "ln", "log", "log10", "map",
811
+ "matches", "matches?", "max", "maximum", "md5", "mean", "median", "min",
812
+ "minimum", "missing", "missing-count", "missing?", "missing_count",
813
+ "mod", "mode", "normalize", "not", "nth", "occurrences", "or",
814
+ "percentile", "percentile-label", "population", "population-fraction",
815
+ "pow", "preferred", "preferred?", "quantile-label", "rand", "rand-int",
816
+ "random-value", "re-quote", "real", "replace", "replace-first", "rest",
817
+ "round", "row-number", "segment-label", "sha1", "sha256", "sin", "sinh",
818
+ "sqrt", "square", "standard-deviation", "standard_deviation", "str",
819
+ "subs", "sum", "sum-squares", "sum-window", "sum_squares", "summary",
820
+ "summary-no", "summary-str", "tail", "tan", "tanh", "to-degrees",
821
+ "to-radians", "variance", "vectorize", "weighted-random-value", "window",
822
+ "winnow", "within-percentiles?", "z-score",
823
+ )
824
+
825
+ valid_name = r'(?!#)[\w!$%*+<=>?/.#-]+'
826
+
827
+ tokens = {
828
+ 'root': [
829
+ # whitespaces - usually not relevant
830
+ (r'[,]+', Text),
831
+ (r'\s+', Whitespace),
832
+
833
+ # numbers
834
+ (r'-?\d+\.\d+', Number.Float),
835
+ (r'-?\d+', Number.Integer),
836
+ (r'0x-?[a-f\d]+', Number.Hex),
837
+
838
+ # strings, symbols and characters
839
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
840
+ (r"\\(.|[a-z]+)", String.Char),
841
+
842
+ # expression template placeholder
843
+ (r'_', String.Symbol),
844
+
845
+ # highlight the special forms
846
+ (words(special_forms, suffix=' '), Keyword),
847
+
848
+ # highlight the builtins
849
+ (words(builtins, suffix=' '), Name.Builtin),
850
+
851
+ # the remaining functions
852
+ (r'(?<=\()' + valid_name, Name.Function),
853
+
854
+ # find the remaining variables
855
+ (valid_name, Name.Variable),
856
+
857
+ # parentheses
858
+ (r'(\(|\))', Punctuation),
859
+ ],
860
+ }
861
+
862
+
863
+ class SnowballLexer(ExtendedRegexLexer):
864
+ """
865
+ Lexer for Snowball source code.
866
+ """
867
+
868
+ name = 'Snowball'
869
+ url = 'https://snowballstem.org/'
870
+ aliases = ['snowball']
871
+ filenames = ['*.sbl']
872
+ version_added = '2.2'
873
+
874
+ _ws = r'\n\r\t '
875
+
876
+ def __init__(self, **options):
877
+ self._reset_stringescapes()
878
+ ExtendedRegexLexer.__init__(self, **options)
879
+
880
+ def _reset_stringescapes(self):
881
+ self._start = "'"
882
+ self._end = "'"
883
+
884
+ def _string(do_string_first):
885
+ def callback(lexer, match, ctx):
886
+ s = match.start()
887
+ text = match.group()
888
+ string = re.compile(rf'([^{re.escape(lexer._start)}]*)(.)').match
889
+ escape = re.compile(rf'([^{re.escape(lexer._end)}]*)(.)').match
890
+ pos = 0
891
+ do_string = do_string_first
892
+ while pos < len(text):
893
+ if do_string:
894
+ match = string(text, pos)
895
+ yield s + match.start(1), String.Single, match.group(1)
896
+ if match.group(2) == "'":
897
+ yield s + match.start(2), String.Single, match.group(2)
898
+ ctx.stack.pop()
899
+ break
900
+ yield s + match.start(2), String.Escape, match.group(2)
901
+ pos = match.end()
902
+ match = escape(text, pos)
903
+ yield s + match.start(), String.Escape, match.group()
904
+ if match.group(2) != lexer._end:
905
+ ctx.stack[-1] = 'escape'
906
+ break
907
+ pos = match.end()
908
+ do_string = True
909
+ ctx.pos = s + match.end()
910
+ return callback
911
+
912
+ def _stringescapes(lexer, match, ctx):
913
+ lexer._start = match.group(3)
914
+ lexer._end = match.group(5)
915
+ return bygroups(Keyword.Reserved, Whitespace, String.Escape, Whitespace,
916
+ String.Escape)(lexer, match, ctx)
917
+
918
+ tokens = {
919
+ 'root': [
920
+ (r'len\b', Name.Builtin),
921
+ (r'lenof\b', Operator.Word),
922
+ include('root1'),
923
+ ],
924
+ 'root1': [
925
+ (rf'[{_ws}]+', Whitespace),
926
+ (r'\d+', Number.Integer),
927
+ (r"'", String.Single, 'string'),
928
+ (r'[()]', Punctuation),
929
+ (r'/\*[\w\W]*?\*/', Comment.Multiline),
930
+ (r'//.*', Comment.Single),
931
+ (r'[!*+\-/<=>]=|[-=]>|<[+-]|[$*+\-/<=>?\[\]]', Operator),
932
+ (words(('as', 'get', 'hex', 'among', 'define', 'decimal',
933
+ 'backwardmode'), suffix=r'\b'),
934
+ Keyword.Reserved),
935
+ (words(('strings', 'booleans', 'integers', 'routines', 'externals',
936
+ 'groupings'), suffix=r'\b'),
937
+ Keyword.Reserved, 'declaration'),
938
+ (words(('do', 'or', 'and', 'for', 'hop', 'non', 'not', 'set', 'try',
939
+ 'fail', 'goto', 'loop', 'next', 'test', 'true',
940
+ 'false', 'unset', 'atmark', 'attach', 'delete', 'gopast',
941
+ 'insert', 'repeat', 'sizeof', 'tomark', 'atleast',
942
+ 'atlimit', 'reverse', 'setmark', 'tolimit', 'setlimit',
943
+ 'backwards', 'substring'), suffix=r'\b'),
944
+ Operator.Word),
945
+ (words(('size', 'limit', 'cursor', 'maxint', 'minint'),
946
+ suffix=r'\b'),
947
+ Name.Builtin),
948
+ (rf'(stringdef\b)([{_ws}]*)([^{_ws}]+)',
949
+ bygroups(Keyword.Reserved, Whitespace, String.Escape)),
950
+ (rf'(stringescapes\b)([{_ws}]*)(.)([{_ws}]*)(.)',
951
+ _stringescapes),
952
+ (r'[A-Za-z]\w*', Name),
953
+ ],
954
+ 'declaration': [
955
+ (r'\)', Punctuation, '#pop'),
956
+ (words(('len', 'lenof'), suffix=r'\b'), Name,
957
+ ('root1', 'declaration')),
958
+ include('root1'),
959
+ ],
960
+ 'string': [
961
+ (r"[^']*'", _string(True)),
962
+ ],
963
+ 'escape': [
964
+ (r"[^']*'", _string(False)),
965
+ ],
966
+ }
967
+
968
+ def get_tokens_unprocessed(self, text=None, context=None):
969
+ self._reset_stringescapes()
970
+ return ExtendedRegexLexer.get_tokens_unprocessed(self, text, context)
evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/factor.py ADDED
@@ -0,0 +1,363 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.factor
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Factor language.
6
+
7
+ :copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, default, words
12
+ from pygments.token import Text, Comment, Keyword, Name, String, Number, \
13
+ Whitespace, Punctuation
14
+
15
+ __all__ = ['FactorLexer']
16
+
17
+
18
+ class FactorLexer(RegexLexer):
19
+ """
20
+ Lexer for the Factor language.
21
+ """
22
+ name = 'Factor'
23
+ url = 'http://factorcode.org'
24
+ aliases = ['factor']
25
+ filenames = ['*.factor']
26
+ mimetypes = ['text/x-factor']
27
+ version_added = '1.4'
28
+
29
+ builtin_kernel = words((
30
+ '-rot', '2bi', '2bi@', '2bi*', '2curry', '2dip', '2drop', '2dup', '2keep', '2nip',
31
+ '2over', '2tri', '2tri@', '2tri*', '3bi', '3curry', '3dip', '3drop', '3dup', '3keep',
32
+ '3tri', '4dip', '4drop', '4dup', '4keep', '<wrapper>', '=', '>boolean', 'clone',
33
+ '?', '?execute', '?if', 'and', 'assert', 'assert=', 'assert?', 'bi', 'bi-curry',
34
+ 'bi-curry@', 'bi-curry*', 'bi@', 'bi*', 'boa', 'boolean', 'boolean?', 'both?',
35
+ 'build', 'call', 'callstack', 'callstack>array', 'callstack?', 'clear', '(clone)',
36
+ 'compose', 'compose?', 'curry', 'curry?', 'datastack', 'die', 'dip', 'do', 'drop',
37
+ 'dup', 'dupd', 'either?', 'eq?', 'equal?', 'execute', 'hashcode', 'hashcode*',
38
+ 'identity-hashcode', 'identity-tuple', 'identity-tuple?', 'if', 'if*',
39
+ 'keep', 'loop', 'most', 'new', 'nip', 'not', 'null', 'object', 'or', 'over',
40
+ 'pick', 'prepose', 'retainstack', 'rot', 'same?', 'swap', 'swapd', 'throw',
41
+ 'tri', 'tri-curry', 'tri-curry@', 'tri-curry*', 'tri@', 'tri*', 'tuple',
42
+ 'tuple?', 'unless', 'unless*', 'until', 'when', 'when*', 'while', 'with',
43
+ 'wrapper', 'wrapper?', 'xor'), suffix=r'(\s+)')
44
+
45
+ builtin_assocs = words((
46
+ '2cache', '<enum>', '>alist', '?at', '?of', 'assoc', 'assoc-all?',
47
+ 'assoc-any?', 'assoc-clone-like', 'assoc-combine', 'assoc-diff',
48
+ 'assoc-diff!', 'assoc-differ', 'assoc-each', 'assoc-empty?',
49
+ 'assoc-filter', 'assoc-filter!', 'assoc-filter-as', 'assoc-find',
50
+ 'assoc-hashcode', 'assoc-intersect', 'assoc-like', 'assoc-map',
51
+ 'assoc-map-as', 'assoc-partition', 'assoc-refine', 'assoc-size',
52
+ 'assoc-stack', 'assoc-subset?', 'assoc-union', 'assoc-union!',
53
+ 'assoc=', 'assoc>map', 'assoc?', 'at', 'at+', 'at*', 'cache', 'change-at',
54
+ 'clear-assoc', 'delete-at', 'delete-at*', 'enum', 'enum?', 'extract-keys',
55
+ 'inc-at', 'key?', 'keys', 'map>assoc', 'maybe-set-at', 'new-assoc', 'of',
56
+ 'push-at', 'rename-at', 'set-at', 'sift-keys', 'sift-values', 'substitute',
57
+ 'unzip', 'value-at', 'value-at*', 'value?', 'values', 'zip'), suffix=r'(\s+)')
58
+
59
+ builtin_combinators = words((
60
+ '2cleave', '2cleave>quot', '3cleave', '3cleave>quot', '4cleave',
61
+ '4cleave>quot', 'alist>quot', 'call-effect', 'case', 'case-find',
62
+ 'case>quot', 'cleave', 'cleave>quot', 'cond', 'cond>quot', 'deep-spread>quot',
63
+ 'execute-effect', 'linear-case-quot', 'no-case', 'no-case?', 'no-cond',
64
+ 'no-cond?', 'recursive-hashcode', 'shallow-spread>quot', 'spread',
65
+ 'to-fixed-point', 'wrong-values', 'wrong-values?'), suffix=r'(\s+)')
66
+
67
+ builtin_math = words((
68
+ '-', '/', '/f', '/i', '/mod', '2/', '2^', '<', '<=', '<fp-nan>', '>',
69
+ '>=', '>bignum', '>fixnum', '>float', '>integer', '(all-integers?)',
70
+ '(each-integer)', '(find-integer)', '*', '+', '?1+',
71
+ 'abs', 'align', 'all-integers?', 'bignum', 'bignum?', 'bit?', 'bitand',
72
+ 'bitnot', 'bitor', 'bits>double', 'bits>float', 'bitxor', 'complex',
73
+ 'complex?', 'denominator', 'double>bits', 'each-integer', 'even?',
74
+ 'find-integer', 'find-last-integer', 'fixnum', 'fixnum?', 'float',
75
+ 'float>bits', 'float?', 'fp-bitwise=', 'fp-infinity?', 'fp-nan-payload',
76
+ 'fp-nan?', 'fp-qnan?', 'fp-sign', 'fp-snan?', 'fp-special?',
77
+ 'if-zero', 'imaginary-part', 'integer', 'integer>fixnum',
78
+ 'integer>fixnum-strict', 'integer?', 'log2', 'log2-expects-positive',
79
+ 'log2-expects-positive?', 'mod', 'neg', 'neg?', 'next-float',
80
+ 'next-power-of-2', 'number', 'number=', 'number?', 'numerator', 'odd?',
81
+ 'out-of-fixnum-range', 'out-of-fixnum-range?', 'power-of-2?',
82
+ 'prev-float', 'ratio', 'ratio?', 'rational', 'rational?', 'real',
83
+ 'real-part', 'real?', 'recip', 'rem', 'sgn', 'shift', 'sq', 'times',
84
+ 'u<', 'u<=', 'u>', 'u>=', 'unless-zero', 'unordered?', 'when-zero',
85
+ 'zero?'), suffix=r'(\s+)')
86
+
87
+ builtin_sequences = words((
88
+ '1sequence', '2all?', '2each', '2map', '2map-as', '2map-reduce', '2reduce',
89
+ '2selector', '2sequence', '3append', '3append-as', '3each', '3map', '3map-as',
90
+ '3sequence', '4sequence', '<repetition>', '<reversed>', '<slice>', '?first',
91
+ '?last', '?nth', '?second', '?set-nth', 'accumulate', 'accumulate!',
92
+ 'accumulate-as', 'all?', 'any?', 'append', 'append!', 'append-as',
93
+ 'assert-sequence', 'assert-sequence=', 'assert-sequence?',
94
+ 'binary-reduce', 'bounds-check', 'bounds-check?', 'bounds-error',
95
+ 'bounds-error?', 'but-last', 'but-last-slice', 'cartesian-each',
96
+ 'cartesian-map', 'cartesian-product', 'change-nth', 'check-slice',
97
+ 'check-slice-error', 'clone-like', 'collapse-slice', 'collector',
98
+ 'collector-for', 'concat', 'concat-as', 'copy', 'count', 'cut', 'cut-slice',
99
+ 'cut*', 'delete-all', 'delete-slice', 'drop-prefix', 'each', 'each-from',
100
+ 'each-index', 'empty?', 'exchange', 'filter', 'filter!', 'filter-as', 'find',
101
+ 'find-from', 'find-index', 'find-index-from', 'find-last', 'find-last-from',
102
+ 'first', 'first2', 'first3', 'first4', 'flip', 'follow', 'fourth', 'glue', 'halves',
103
+ 'harvest', 'head', 'head-slice', 'head-slice*', 'head*', 'head?',
104
+ 'if-empty', 'immutable', 'immutable-sequence', 'immutable-sequence?',
105
+ 'immutable?', 'index', 'index-from', 'indices', 'infimum', 'infimum-by',
106
+ 'insert-nth', 'interleave', 'iota', 'iota-tuple', 'iota-tuple?', 'join',
107
+ 'join-as', 'last', 'last-index', 'last-index-from', 'length', 'lengthen',
108
+ 'like', 'longer', 'longer?', 'longest', 'map', 'map!', 'map-as', 'map-find',
109
+ 'map-find-last', 'map-index', 'map-integers', 'map-reduce', 'map-sum',
110
+ 'max-length', 'member-eq?', 'member?', 'midpoint@', 'min-length',
111
+ 'mismatch', 'move', 'new-like', 'new-resizable', 'new-sequence',
112
+ 'non-negative-integer-expected', 'non-negative-integer-expected?',
113
+ 'nth', 'nths', 'pad-head', 'pad-tail', 'padding', 'partition', 'pop', 'pop*',
114
+ 'prefix', 'prepend', 'prepend-as', 'produce', 'produce-as', 'product', 'push',
115
+ 'push-all', 'push-either', 'push-if', 'reduce', 'reduce-index', 'remove',
116
+ 'remove!', 'remove-eq', 'remove-eq!', 'remove-nth', 'remove-nth!', 'repetition',
117
+ 'repetition?', 'replace-slice', 'replicate', 'replicate-as', 'rest',
118
+ 'rest-slice', 'reverse', 'reverse!', 'reversed', 'reversed?', 'second',
119
+ 'selector', 'selector-for', 'sequence', 'sequence-hashcode', 'sequence=',
120
+ 'sequence?', 'set-first', 'set-fourth', 'set-last', 'set-length', 'set-nth',
121
+ 'set-second', 'set-third', 'short', 'shorten', 'shorter', 'shorter?',
122
+ 'shortest', 'sift', 'slice', 'slice-error', 'slice-error?', 'slice?',
123
+ 'snip', 'snip-slice', 'start', 'start*', 'subseq', 'subseq?', 'suffix',
124
+ 'suffix!', 'sum', 'sum-lengths', 'supremum', 'supremum-by', 'surround', 'tail',
125
+ 'tail-slice', 'tail-slice*', 'tail*', 'tail?', 'third', 'trim',
126
+ 'trim-head', 'trim-head-slice', 'trim-slice', 'trim-tail', 'trim-tail-slice',
127
+ 'unclip', 'unclip-last', 'unclip-last-slice', 'unclip-slice', 'unless-empty',
128
+ 'virtual-exemplar', 'virtual-sequence', 'virtual-sequence?', 'virtual@',
129
+ 'when-empty'), suffix=r'(\s+)')
130
+
131
+ builtin_namespaces = words((
132
+ '+@', 'change', 'change-global', 'counter', 'dec', 'get', 'get-global',
133
+ 'global', 'inc', 'init-namespaces', 'initialize', 'is-global', 'make-assoc',
134
+ 'namespace', 'namestack', 'off', 'on', 'set', 'set-global', 'set-namestack',
135
+ 'toggle', 'with-global', 'with-scope', 'with-variable', 'with-variables'),
136
+ suffix=r'(\s+)')
137
+
138
+ builtin_arrays = words((
139
+ '1array', '2array', '3array', '4array', '<array>', '>array', 'array',
140
+ 'array?', 'pair', 'pair?', 'resize-array'), suffix=r'(\s+)')
141
+
142
+ builtin_io = words((
143
+ '(each-stream-block-slice)', '(each-stream-block)',
144
+ '(stream-contents-by-block)', '(stream-contents-by-element)',
145
+ '(stream-contents-by-length-or-block)',
146
+ '(stream-contents-by-length)', '+byte+', '+character+',
147
+ 'bad-seek-type', 'bad-seek-type?', 'bl', 'contents', 'each-block',
148
+ 'each-block-size', 'each-block-slice', 'each-line', 'each-morsel',
149
+ 'each-stream-block', 'each-stream-block-slice', 'each-stream-line',
150
+ 'error-stream', 'flush', 'input-stream', 'input-stream?',
151
+ 'invalid-read-buffer', 'invalid-read-buffer?', 'lines', 'nl',
152
+ 'output-stream', 'output-stream?', 'print', 'read', 'read-into',
153
+ 'read-partial', 'read-partial-into', 'read-until', 'read1', 'readln',
154
+ 'seek-absolute', 'seek-absolute?', 'seek-end', 'seek-end?',
155
+ 'seek-input', 'seek-output', 'seek-relative', 'seek-relative?',
156
+ 'stream-bl', 'stream-contents', 'stream-contents*', 'stream-copy',
157
+ 'stream-copy*', 'stream-element-type', 'stream-flush',
158
+ 'stream-length', 'stream-lines', 'stream-nl', 'stream-print',
159
+ 'stream-read', 'stream-read-into', 'stream-read-partial',
160
+ 'stream-read-partial-into', 'stream-read-partial-unsafe',
161
+ 'stream-read-unsafe', 'stream-read-until', 'stream-read1',
162
+ 'stream-readln', 'stream-seek', 'stream-seekable?', 'stream-tell',
163
+ 'stream-write', 'stream-write1', 'tell-input', 'tell-output',
164
+ 'with-error-stream', 'with-error-stream*', 'with-error>output',
165
+ 'with-input-output+error-streams',
166
+ 'with-input-output+error-streams*', 'with-input-stream',
167
+ 'with-input-stream*', 'with-output-stream', 'with-output-stream*',
168
+ 'with-output>error', 'with-output+error-stream',
169
+ 'with-output+error-stream*', 'with-streams', 'with-streams*',
170
+ 'write', 'write1'), suffix=r'(\s+)')
171
+
172
+ builtin_strings = words((
173
+ '1string', '<string>', '>string', 'resize-string', 'string',
174
+ 'string?'), suffix=r'(\s+)')
175
+
176
+ builtin_vectors = words((
177
+ '1vector', '<vector>', '>vector', '?push', 'vector', 'vector?'),
178
+ suffix=r'(\s+)')
179
+
180
+ builtin_continuations = words((
181
+ '<condition>', '<continuation>', '<restart>', 'attempt-all',
182
+ 'attempt-all-error', 'attempt-all-error?', 'callback-error-hook',
183
+ 'callcc0', 'callcc1', 'cleanup', 'compute-restarts', 'condition',
184
+ 'condition?', 'continuation', 'continuation?', 'continue',
185
+ 'continue-restart', 'continue-with', 'current-continuation',
186
+ 'error', 'error-continuation', 'error-in-thread', 'error-thread',
187
+ 'ifcc', 'ignore-errors', 'in-callback?', 'original-error', 'recover',
188
+ 'restart', 'restart?', 'restarts', 'rethrow', 'rethrow-restarts',
189
+ 'return', 'return-continuation', 'thread-error-hook', 'throw-continue',
190
+ 'throw-restarts', 'with-datastack', 'with-return'), suffix=r'(\s+)')
191
+
192
+ tokens = {
193
+ 'root': [
194
+ # factor allows a file to start with a shebang
195
+ (r'#!.*$', Comment.Preproc),
196
+ default('base'),
197
+ ],
198
+ 'base': [
199
+ (r'\s+', Whitespace),
200
+
201
+ # defining words
202
+ (r'((?:MACRO|MEMO|TYPED)?:[:]?)(\s+)(\S+)',
203
+ bygroups(Keyword, Whitespace, Name.Function)),
204
+ (r'(M:[:]?)(\s+)(\S+)(\s+)(\S+)',
205
+ bygroups(Keyword, Whitespace, Name.Class, Whitespace,
206
+ Name.Function)),
207
+ (r'(C:)(\s+)(\S+)(\s+)(\S+)',
208
+ bygroups(Keyword, Whitespace, Name.Function, Whitespace,
209
+ Name.Class)),
210
+ (r'(GENERIC:)(\s+)(\S+)',
211
+ bygroups(Keyword, Whitespace, Name.Function)),
212
+ (r'(HOOK:|GENERIC#)(\s+)(\S+)(\s+)(\S+)',
213
+ bygroups(Keyword, Whitespace, Name.Function, Whitespace,
214
+ Name.Function)),
215
+ (r'(\()(\s)', bygroups(Name.Function, Whitespace), 'stackeffect'),
216
+ (r'(;)(\s)', bygroups(Keyword, Whitespace)),
217
+
218
+ # imports and namespaces
219
+ (r'(USING:)(\s+)',
220
+ bygroups(Keyword.Namespace, Whitespace), 'vocabs'),
221
+ (r'(USE:|UNUSE:|IN:|QUALIFIED:)(\s+)(\S+)',
222
+ bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
223
+ (r'(QUALIFIED-WITH:)(\s+)(\S+)(\s+)(\S+)',
224
+ bygroups(Keyword.Namespace, Whitespace, Name.Namespace,
225
+ Whitespace, Name.Namespace)),
226
+ (r'(FROM:|EXCLUDE:)(\s+)(\S+)(\s+=>\s)',
227
+ bygroups(Keyword.Namespace, Whitespace, Name.Namespace,
228
+ Whitespace), 'words'),
229
+ (r'(RENAME:)(\s+)(\S+)(\s+)(\S+)(\s+)(=>)(\s+)(\S+)',
230
+ bygroups(Keyword.Namespace, Whitespace, Name.Function, Whitespace,
231
+ Name.Namespace, Whitespace, Punctuation, Whitespace,
232
+ Name.Function)),
233
+ (r'(ALIAS:|TYPEDEF:)(\s+)(\S+)(\s+)(\S+)',
234
+ bygroups(Keyword.Namespace, Whitespace, Name.Function, Whitespace,
235
+ Name.Function)),
236
+ (r'(DEFER:|FORGET:|POSTPONE:)(\s+)(\S+)',
237
+ bygroups(Keyword.Namespace, Whitespace, Name.Function)),
238
+
239
+ # tuples and classes
240
+ (r'(TUPLE:|ERROR:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)',
241
+ bygroups(Keyword, Whitespace, Name.Class, Whitespace, Punctuation,
242
+ Whitespace, Name.Class), 'slots'),
243
+ (r'(TUPLE:|ERROR:|BUILTIN:)(\s+)(\S+)',
244
+ bygroups(Keyword, Whitespace, Name.Class), 'slots'),
245
+ (r'(MIXIN:|UNION:|INTERSECTION:)(\s+)(\S+)',
246
+ bygroups(Keyword, Whitespace, Name.Class)),
247
+ (r'(PREDICATE:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)',
248
+ bygroups(Keyword, Whitespace, Name.Class, Whitespace,
249
+ Punctuation, Whitespace, Name.Class)),
250
+ (r'(C:)(\s+)(\S+)(\s+)(\S+)',
251
+ bygroups(Keyword, Whitespace, Name.Function, Whitespace, Name.Class)),
252
+ (r'(INSTANCE:)(\s+)(\S+)(\s+)(\S+)',
253
+ bygroups(Keyword, Whitespace, Name.Class, Whitespace, Name.Class)),
254
+ (r'(SLOT:)(\s+)(\S+)', bygroups(Keyword, Whitespace, Name.Function)),
255
+ (r'(SINGLETON:)(\s+)(\S+)', bygroups(Keyword, Whitespace, Name.Class)),
256
+ (r'SINGLETONS:', Keyword, 'classes'),
257
+
258
+ # other syntax
259
+ (r'(CONSTANT:|SYMBOL:|MAIN:|HELP:)(\s+)(\S+)',
260
+ bygroups(Keyword, Whitespace, Name.Function)),
261
+ (r'(SYMBOLS:)(\s+)', bygroups(Keyword, Whitespace), 'words'),
262
+ (r'(SYNTAX:)(\s+)', bygroups(Keyword, Whitespace)),
263
+ (r'(ALIEN:)(\s+)', bygroups(Keyword, Whitespace)),
264
+ (r'(STRUCT:)(\s+)(\S+)', bygroups(Keyword, Whitespace, Name.Class)),
265
+ (r'(FUNCTION:)(\s+)'
266
+ r'(\S+)(\s+)(\S+)(\s+)'
267
+ r'(\()(\s+)([^)]+)(\))(\s)',
268
+ bygroups(Keyword.Namespace, Whitespace,
269
+ Text, Whitespace, Name.Function, Whitespace,
270
+ Punctuation, Whitespace, Text, Punctuation, Whitespace)),
271
+ (r'(FUNCTION-ALIAS:)(\s+)'
272
+ r'(\S+)(\s+)(\S+)(\s+)'
273
+ r'(\S+)(\s+)'
274
+ r'(\()(\s+)([^)]+)(\))(\s)',
275
+ bygroups(Keyword.Namespace, Whitespace,
276
+ Text, Whitespace, Name.Function, Whitespace,
277
+ Name.Function, Whitespace,
278
+ Punctuation, Whitespace, Text, Punctuation, Whitespace)),
279
+
280
+ # vocab.private
281
+ (r'(<PRIVATE|PRIVATE>)(\s)', bygroups(Keyword.Namespace, Whitespace)),
282
+
283
+ # strings
284
+ (r'"""\s(?:.|\n)*?\s"""', String),
285
+ (r'"(?:\\\\|\\"|[^"])*"', String),
286
+ (r'(\S+")(\s+)((?:\\\\|\\"|[^"])*")',
287
+ bygroups(String, Whitespace, String)),
288
+ (r'(CHAR:)(\s+)(\\[\\abfnrstv]|[^\\]\S*)(\s)',
289
+ bygroups(String.Char, Whitespace, String.Char, Whitespace)),
290
+
291
+ # comments
292
+ (r'!\s+.*$', Comment),
293
+ (r'#!\s+.*$', Comment),
294
+ (r'/\*\s+(?:.|\n)*?\s\*/', Comment),
295
+
296
+ # boolean constants
297
+ (r'[tf]\b', Name.Constant),
298
+
299
+ # symbols and literals
300
+ (r'[\\$]\s+\S+', Name.Constant),
301
+ (r'M\\\s+\S+\s+\S+', Name.Constant),
302
+
303
+ # numbers
304
+ (r'[+-]?(?:[\d,]*\d)?\.(?:\d([\d,]*\d)?)?(?:[eE][+-]?\d+)?\s', Number),
305
+ (r'[+-]?\d(?:[\d,]*\d)?(?:[eE][+-]?\d+)?\s', Number),
306
+ (r'0x[a-fA-F\d](?:[a-fA-F\d,]*[a-fA-F\d])?(?:p\d([\d,]*\d)?)?\s', Number),
307
+ (r'NAN:\s+[a-fA-F\d](?:[a-fA-F\d,]*[a-fA-F\d])?(?:p\d([\d,]*\d)?)?\s', Number),
308
+ (r'0b[01]+\s', Number.Bin),
309
+ (r'0o[0-7]+\s', Number.Oct),
310
+ (r'(?:\d([\d,]*\d)?)?\+\d(?:[\d,]*\d)?/\d(?:[\d,]*\d)?\s', Number),
311
+ (r'(?:\-\d([\d,]*\d)?)?\-\d(?:[\d,]*\d)?/\d(?:[\d,]*\d)?\s', Number),
312
+
313
+ # keywords
314
+ (r'(?:deprecated|final|foldable|flushable|inline|recursive)\s',
315
+ Keyword),
316
+
317
+ # builtins
318
+ (builtin_kernel, bygroups(Name.Builtin, Whitespace)),
319
+ (builtin_assocs, bygroups(Name.Builtin, Whitespace)),
320
+ (builtin_combinators, bygroups(Name.Builtin, Whitespace)),
321
+ (builtin_math, bygroups(Name.Builtin, Whitespace)),
322
+ (builtin_sequences, bygroups(Name.Builtin, Whitespace)),
323
+ (builtin_namespaces, bygroups(Name.Builtin, Whitespace)),
324
+ (builtin_arrays, bygroups(Name.Builtin, Whitespace)),
325
+ (builtin_io, bygroups(Name.Builtin, Whitespace)),
326
+ (builtin_strings, bygroups(Name.Builtin, Whitespace)),
327
+ (builtin_vectors, bygroups(Name.Builtin, Whitespace)),
328
+ (builtin_continuations, bygroups(Name.Builtin, Whitespace)),
329
+
330
+ # everything else is text
331
+ (r'\S+', Text),
332
+ ],
333
+ 'stackeffect': [
334
+ (r'\s+', Whitespace),
335
+ (r'(\()(\s+)', bygroups(Name.Function, Whitespace), 'stackeffect'),
336
+ (r'(\))(\s+)', bygroups(Name.Function, Whitespace), '#pop'),
337
+ (r'(--)(\s+)', bygroups(Name.Function, Whitespace)),
338
+ (r'\S+', Name.Variable),
339
+ ],
340
+ 'slots': [
341
+ (r'\s+', Whitespace),
342
+ (r'(;)(\s+)', bygroups(Keyword, Whitespace), '#pop'),
343
+ (r'(\{)(\s+)(\S+)(\s+)([^}]+)(\s+)(\})(\s+)',
344
+ bygroups(Text, Whitespace, Name.Variable, Whitespace,
345
+ Text, Whitespace, Text, Whitespace)),
346
+ (r'\S+', Name.Variable),
347
+ ],
348
+ 'vocabs': [
349
+ (r'\s+', Whitespace),
350
+ (r'(;)(\s+)', bygroups(Keyword, Whitespace), '#pop'),
351
+ (r'\S+', Name.Namespace),
352
+ ],
353
+ 'classes': [
354
+ (r'\s+', Whitespace),
355
+ (r'(;)(\s+)', bygroups(Keyword, Whitespace), '#pop'),
356
+ (r'\S+', Name.Class),
357
+ ],
358
+ 'words': [
359
+ (r'\s+', Whitespace),
360
+ (r'(;)(\s+)', bygroups(Keyword, Whitespace), '#pop'),
361
+ (r'\S+', Name.Function),
362
+ ],
363
+ }
evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/foxpro.py ADDED
@@ -0,0 +1,427 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.foxpro
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Simple lexer for Microsoft Visual FoxPro source code.
6
+
7
+ :copyright: Copyright 2006-2024 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
14
+ from pygments.token import Punctuation, Text, Comment, Operator, Keyword, \
15
+ Name, String
16
+
17
+ __all__ = ['FoxProLexer']
18
+
19
+
20
+ class FoxProLexer(RegexLexer):
21
+ """Lexer for Microsoft Visual FoxPro language.
22
+
23
+ FoxPro syntax allows to shorten all keywords and function names
24
+ to 4 characters. Shortened forms are not recognized by this lexer.
25
+ """
26
+
27
+ name = 'FoxPro'
28
+ aliases = ['foxpro', 'vfp', 'clipper', 'xbase']
29
+ filenames = ['*.PRG', '*.prg']
30
+ version_added = '1.6'
31
+ mimetype = []
32
+ url = 'https://learn.microsoft.com/en-us/previous-versions/visualstudio/foxpro'
33
+
34
+ flags = re.IGNORECASE | re.MULTILINE
35
+
36
+ tokens = {
37
+ 'root': [
38
+ (r';\s*\n', Punctuation), # consume newline
39
+ (r'(^|\n)\s*', Text, 'newline'),
40
+
41
+ # Square brackets may be used for array indices
42
+ # and for string literal. Look for arrays
43
+ # before matching string literals.
44
+ (r'(?<=\w)\[[0-9, ]+\]', Text),
45
+ (r'\'[^\'\n]*\'|"[^"\n]*"|\[[^]*]\]', String),
46
+ (r'(^\s*\*|&&|&amp;&amp;).*?\n', Comment.Single),
47
+
48
+ (r'(ABS|ACLASS|ACOPY|ACOS|ADATABASES|ADBOBJECTS|ADDBS|'
49
+ r'ADDPROPERTY|ADEL|ADIR|ADLLS|ADOCKSTATE|AELEMENT|AERROR|'
50
+ r'AEVENTS|AFIELDS|AFONT|AGETCLASS|AGETFILEVERSION|AINS|'
51
+ r'AINSTANCE|ALANGUAGE|ALEN|ALIAS|ALINES|ALLTRIM|'
52
+ r'AMEMBERS|AMOUSEOBJ|ANETRESOURCES|APRINTERS|APROCINFO|'
53
+ r'ASC|ASCAN|ASELOBJ|ASESSIONS|ASIN|ASORT|ASQLHANDLES|'
54
+ r'ASTACKINFO|ASUBSCRIPT|AT|AT_C|ATAGINFO|ATAN|ATC|ATCC|'
55
+ r'ATCLINE|ATLINE|ATN2|AUSED|AVCXCLASSES|BAR|BARCOUNT|'
56
+ r'BARPROMPT|BETWEEN|BINDEVENT|BINTOC|BITAND|BITCLEAR|'
57
+ r'BITLSHIFT|BITNOT|BITOR|BITRSHIFT|BITSET|BITTEST|BITXOR|'
58
+ r'BOF|CANDIDATE|CAPSLOCK|CAST|CDOW|CDX|CEILING|CHR|CHRSAW|'
59
+ r'CHRTRAN|CHRTRANC|CLEARRESULTSET|CMONTH|CNTBAR|CNTPAD|COL|'
60
+ r'COM|Functions|COMARRAY|COMCLASSINFO|COMPOBJ|COMPROP|'
61
+ r'COMRETURNERROR|COS|CPCONVERT|CPCURRENT|CPDBF|CREATEBINARY|'
62
+ r'CREATEOBJECT|CREATEOBJECTEX|CREATEOFFLINE|CTOBIN|CTOD|'
63
+ r'CTOT|CURDIR|CURSORGETPROP|CURSORSETPROP|CURSORTOXML|'
64
+ r'CURVAL|DATE|DATETIME|DAY|DBC|DBF|DBGETPROP|DBSETPROP|'
65
+ r'DBUSED|DDEAbortTrans|DDEAdvise|DDEEnabled|DDEExecute|'
66
+ r'DDEInitiate|DDELastError|DDEPoke|DDERequest|DDESetOption|'
67
+ r'DDESetService|DDESetTopic|DDETerminate|DEFAULTEXT|'
68
+ r'DELETED|DESCENDING|DIFFERENCE|DIRECTORY|DISKSPACE|'
69
+ r'DisplayPath|DMY|DODEFAULT|DOW|DRIVETYPE|DROPOFFLINE|'
70
+ r'DTOC|DTOR|DTOS|DTOT|EDITSOURCE|EMPTY|EOF|ERROR|EVAL(UATE)?|'
71
+ r'EVENTHANDLER|EVL|EXECSCRIPT|EXP|FCHSIZE|FCLOSE|FCOUNT|'
72
+ r'FCREATE|FDATE|FEOF|FERROR|FFLUSH|FGETS|FIELD|FILE|'
73
+ r'FILETOSTR|FILTER|FKLABEL|FKMAX|FLDLIST|FLOCK|FLOOR|'
74
+ r'FONTMETRIC|FOPEN|FOR|FORCEEXT|FORCEPATH|FOUND|FPUTS|'
75
+ r'FREAD|FSEEK|FSIZE|FTIME|FULLPATH|FV|FWRITE|'
76
+ r'GETAUTOINCVALUE|GETBAR|GETCOLOR|GETCP|GETDIR|GETENV|'
77
+ r'GETFILE|GETFLDSTATE|GETFONT|GETINTERFACE|'
78
+ r'GETNEXTMODIFIED|GETOBJECT|GETPAD|GETPEM|GETPICT|'
79
+ r'GETPRINTER|GETRESULTSET|GETWORDCOUNT|GETWORDNUM|'
80
+ r'GETCURSORADAPTER|GOMONTH|HEADER|HOME|HOUR|ICASE|'
81
+ r'IDXCOLLATE|IIF|IMESTATUS|INDBC|INDEXSEEK|INKEY|INLIST|'
82
+ r'INPUTBOX|INSMODE|INT|ISALPHA|ISBLANK|ISCOLOR|ISDIGIT|'
83
+ r'ISEXCLUSIVE|ISFLOCKED|ISLEADBYTE|ISLOWER|ISMEMOFETCHED|'
84
+ r'ISMOUSE|ISNULL|ISPEN|ISREADONLY|ISRLOCKED|'
85
+ r'ISTRANSACTABLE|ISUPPER|JUSTDRIVE|JUSTEXT|JUSTFNAME|'
86
+ r'JUSTPATH|JUSTSTEM|KEY|KEYMATCH|LASTKEY|LEFT|LEFTC|LEN|'
87
+ r'LENC|LIKE|LIKEC|LINENO|LOADPICTURE|LOCFILE|LOCK|LOG|'
88
+ r'LOG10|LOOKUP|LOWER|LTRIM|LUPDATE|MAKETRANSACTABLE|MAX|'
89
+ r'MCOL|MDOWN|MDX|MDY|MEMLINES|MEMORY|MENU|MESSAGE|'
90
+ r'MESSAGEBOX|MIN|MINUTE|MLINE|MOD|MONTH|MRKBAR|MRKPAD|'
91
+ r'MROW|MTON|MWINDOW|NDX|NEWOBJECT|NORMALIZE|NTOM|NUMLOCK|'
92
+ r'NVL|OBJNUM|OBJTOCLIENT|OBJVAR|OCCURS|OEMTOANSI|OLDVAL|'
93
+ r'ON|ORDER|OS|PAD|PADL|PARAMETERS|PAYMENT|PCOL|PCOUNT|'
94
+ r'PEMSTATUS|PI|POPUP|PRIMARY|PRINTSTATUS|PRMBAR|PRMPAD|'
95
+ r'PROGRAM|PROMPT|PROPER|PROW|PRTINFO|PUTFILE|PV|QUARTER|'
96
+ r'RAISEEVENT|RAND|RAT|RATC|RATLINE|RDLEVEL|READKEY|RECCOUNT|'
97
+ r'RECNO|RECSIZE|REFRESH|RELATION|REPLICATE|REQUERY|RGB|'
98
+ r'RGBSCHEME|RIGHT|RIGHTC|RLOCK|ROUND|ROW|RTOD|RTRIM|'
99
+ r'SAVEPICTURE|SCHEME|SCOLS|SEC|SECONDS|SEEK|SELECT|SET|'
100
+ r'SETFLDSTATE|SETRESULTSET|SIGN|SIN|SKPBAR|SKPPAD|SOUNDEX|'
101
+ r'SPACE|SQLCANCEL|SQLCOLUMNS|SQLCOMMIT|SQLCONNECT|'
102
+ r'SQLDISCONNECT|SQLEXEC|SQLGETPROP|SQLIDLEDISCONNECT|'
103
+ r'SQLMORERESULTS|SQLPREPARE|SQLROLLBACK|SQLSETPROP|'
104
+ r'SQLSTRINGCONNECT|SQLTABLES|SQRT|SROWS|STR|STRCONV|'
105
+ r'STREXTRACT|STRTOFILE|STRTRAN|STUFF|STUFFC|SUBSTR|'
106
+ r'SUBSTRC|SYS|SYSMETRIC|TABLEREVERT|TABLEUPDATE|TAG|'
107
+ r'TAGCOUNT|TAGNO|TAN|TARGET|TEXTMERGE|TIME|TRANSFORM|'
108
+ r'TRIM|TTOC|TTOD|TXNLEVEL|TXTWIDTH|TYPE|UNBINDEVENTS|'
109
+ r'UNIQUE|UPDATED|UPPER|USED|VAL|VARREAD|VARTYPE|VERSION|'
110
+ r'WBORDER|WCHILD|WCOLS|WDOCKABLE|WEEK|WEXIST|WFONT|WLAST|'
111
+ r'WLCOL|WLROW|WMAXIMUM|WMINIMUM|WONTOP|WOUTPUT|WPARENT|'
112
+ r'WREAD|WROWS|WTITLE|WVISIBLE|XMLTOCURSOR|XMLUPDATEGRAM|'
113
+ r'YEAR)(?=\s*\()', Name.Function),
114
+
115
+ (r'_ALIGNMENT|_ASCIICOLS|_ASCIIROWS|_ASSIST|_BEAUTIFY|_BOX|'
116
+ r'_BROWSER|_BUILDER|_CALCMEM|_CALCVALUE|_CLIPTEXT|_CONVERTER|'
117
+ r'_COVERAGE|_CUROBJ|_DBLCLICK|_DIARYDATE|_DOS|_FOXDOC|_FOXREF|'
118
+ r'_GALLERY|_GENGRAPH|_GENHTML|_GENMENU|_GENPD|_GENSCRN|'
119
+ r'_GENXTAB|_GETEXPR|_INCLUDE|_INCSEEK|_INDENT|_LMARGIN|_MAC|'
120
+ r'_MENUDESIGNER|_MLINE|_PADVANCE|_PAGENO|_PAGETOTAL|_PBPAGE|'
121
+ r'_PCOLNO|_PCOPIES|_PDRIVER|_PDSETUP|_PECODE|_PEJECT|_PEPAGE|'
122
+ r'_PLENGTH|_PLINENO|_PLOFFSET|_PPITCH|_PQUALITY|_PRETEXT|'
123
+ r'_PSCODE|_PSPACING|_PWAIT|_RMARGIN|_REPORTBUILDER|'
124
+ r'_REPORTOUTPUT|_REPORTPREVIEW|_SAMPLES|_SCCTEXT|_SCREEN|'
125
+ r'_SHELL|_SPELLCHK|_STARTUP|_TABS|_TALLY|_TASKPANE|_TEXT|'
126
+ r'_THROTTLE|_TOOLBOX|_TOOLTIPTIMEOUT|_TRANSPORT|_TRIGGERLEVEL|'
127
+ r'_UNIX|_VFP|_WINDOWS|_WIZARD|_WRAP', Keyword.Pseudo),
128
+
129
+ (r'THISFORMSET|THISFORM|THIS', Name.Builtin),
130
+
131
+ (r'Application|CheckBox|Collection|Column|ComboBox|'
132
+ r'CommandButton|CommandGroup|Container|Control|CursorAdapter|'
133
+ r'Cursor|Custom|DataEnvironment|DataObject|EditBox|'
134
+ r'Empty|Exception|Fields|Files|File|FormSet|Form|FoxCode|'
135
+ r'Grid|Header|Hyperlink|Image|Label|Line|ListBox|Objects|'
136
+ r'OptionButton|OptionGroup|PageFrame|Page|ProjectHook|Projects|'
137
+ r'Project|Relation|ReportListener|Separator|Servers|Server|'
138
+ r'Session|Shape|Spinner|Tables|TextBox|Timer|ToolBar|'
139
+ r'XMLAdapter|XMLField|XMLTable', Name.Class),
140
+
141
+ (r'm\.[a-z_]\w*', Name.Variable),
142
+ (r'\.(F|T|AND|OR|NOT|NULL)\.|\b(AND|OR|NOT|NULL)\b', Operator.Word),
143
+
144
+ (r'\.(ActiveColumn|ActiveControl|ActiveForm|ActivePage|'
145
+ r'ActiveProject|ActiveRow|AddLineFeeds|ADOCodePage|Alias|'
146
+ r'Alignment|Align|AllowAddNew|AllowAutoColumnFit|'
147
+ r'AllowCellSelection|AllowDelete|AllowHeaderSizing|'
148
+ r'AllowInsert|AllowModalMessages|AllowOutput|AllowRowSizing|'
149
+ r'AllowSimultaneousFetch|AllowTabs|AllowUpdate|'
150
+ r'AlwaysOnBottom|AlwaysOnTop|Anchor|Application|'
151
+ r'AutoActivate|AutoCenter|AutoCloseTables|AutoComplete|'
152
+ r'AutoCompSource|AutoCompTable|AutoHideScrollBar|'
153
+ r'AutoIncrement|AutoOpenTables|AutoRelease|AutoSize|'
154
+ r'AutoVerbMenu|AutoYield|BackColor|ForeColor|BackStyle|'
155
+ r'BaseClass|BatchUpdateCount|BindControls|BorderColor|'
156
+ r'BorderStyle|BorderWidth|BoundColumn|BoundTo|Bound|'
157
+ r'BreakOnError|BufferModeOverride|BufferMode|'
158
+ r'BuildDateTime|ButtonCount|Buttons|Cancel|Caption|'
159
+ r'Centered|Century|ChildAlias|ChildOrder|ChildTable|'
160
+ r'ClassLibrary|Class|ClipControls|Closable|CLSID|CodePage|'
161
+ r'ColorScheme|ColorSource|ColumnCount|ColumnLines|'
162
+ r'ColumnOrder|Columns|ColumnWidths|CommandClauses|'
163
+ r'Comment|CompareMemo|ConflictCheckCmd|ConflictCheckType|'
164
+ r'ContinuousScroll|ControlBox|ControlCount|Controls|'
165
+ r'ControlSource|ConversionFunc|Count|CurrentControl|'
166
+ r'CurrentDataSession|CurrentPass|CurrentX|CurrentY|'
167
+ r'CursorSchema|CursorSource|CursorStatus|Curvature|'
168
+ r'Database|DataSessionID|DataSession|DataSourceType|'
169
+ r'DataSource|DataType|DateFormat|DateMark|Debug|'
170
+ r'DeclareXMLPrefix|DEClassLibrary|DEClass|DefaultFilePath|'
171
+ r'Default|DefOLELCID|DeleteCmdDataSourceType|DeleteCmdDataSource|'
172
+ r'DeleteCmd|DeleteMark|Description|Desktop|'
173
+ r'Details|DisabledBackColor|DisabledForeColor|'
174
+ r'DisabledItemBackColor|DisabledItemForeColor|'
175
+ r'DisabledPicture|DisableEncode|DisplayCount|'
176
+ r'DisplayValue|Dockable|Docked|DockPosition|'
177
+ r'DocumentFile|DownPicture|DragIcon|DragMode|DrawMode|'
178
+ r'DrawStyle|DrawWidth|DynamicAlignment|DynamicBackColor|'
179
+ r'DynamicForeColor|DynamicCurrentControl|DynamicFontBold|'
180
+ r'DynamicFontItalic|DynamicFontStrikethru|'
181
+ r'DynamicFontUnderline|DynamicFontName|DynamicFontOutline|'
182
+ r'DynamicFontShadow|DynamicFontSize|DynamicInputMask|'
183
+ r'DynamicLineHeight|EditorOptions|Enabled|'
184
+ r'EnableHyperlinks|Encrypted|ErrorNo|Exclude|Exclusive|'
185
+ r'FetchAsNeeded|FetchMemoCmdList|FetchMemoDataSourceType|'
186
+ r'FetchMemoDataSource|FetchMemo|FetchSize|'
187
+ r'FileClassLibrary|FileClass|FillColor|FillStyle|Filter|'
188
+ r'FirstElement|FirstNestedTable|Flags|FontBold|FontItalic|'
189
+ r'FontStrikethru|FontUnderline|FontCharSet|FontCondense|'
190
+ r'FontExtend|FontName|FontOutline|FontShadow|FontSize|'
191
+ r'ForceCloseTag|Format|FormCount|FormattedOutput|Forms|'
192
+ r'FractionDigits|FRXDataSession|FullName|GDIPlusGraphics|'
193
+ r'GridLineColor|GridLines|GridLineWidth|HalfHeightCaption|'
194
+ r'HeaderClassLibrary|HeaderClass|HeaderHeight|Height|'
195
+ r'HelpContextID|HideSelection|HighlightBackColor|'
196
+ r'HighlightForeColor|HighlightStyle|HighlightRowLineWidth|'
197
+ r'HighlightRow|Highlight|HomeDir|Hours|HostName|'
198
+ r'HScrollSmallChange|hWnd|Icon|IncrementalSearch|Increment|'
199
+ r'InitialSelectedAlias|InputMask|InsertCmdDataSourceType|'
200
+ r'InsertCmdDataSource|InsertCmdRefreshCmd|'
201
+ r'InsertCmdRefreshFieldList|InsertCmdRefreshKeyFieldList|'
202
+ r'InsertCmd|Instancing|IntegralHeight|'
203
+ r'Interval|IMEMode|IsAttribute|IsBase64|IsBinary|IsNull|'
204
+ r'IsDiffGram|IsLoaded|ItemBackColor,|ItemData|ItemIDData|'
205
+ r'ItemTips|IXMLDOMElement|KeyboardHighValue|KeyboardLowValue|'
206
+ r'Keyfield|KeyFieldList|KeyPreview|KeySort|LanguageOptions|'
207
+ r'LeftColumn|Left|LineContents|LineNo|LineSlant|LinkMaster|'
208
+ r'ListCount|ListenerType|ListIndex|ListItemID|ListItem|'
209
+ r'List|LockColumnsLeft|LockColumns|LockScreen|MacDesktop|'
210
+ r'MainFile|MapN19_4ToCurrency|MapBinary|MapVarchar|Margin|'
211
+ r'MaxButton|MaxHeight|MaxLeft|MaxLength|MaxRecords|MaxTop|'
212
+ r'MaxWidth|MDIForm|MemberClassLibrary|MemberClass|'
213
+ r'MemoWindow|Message|MinButton|MinHeight|MinWidth|'
214
+ r'MouseIcon|MousePointer|Movable|MoverBars|MultiSelect|'
215
+ r'Name|NestedInto|NewIndex|NewItemID|NextSiblingTable|'
216
+ r'NoCpTrans|NoDataOnLoad|NoData|NullDisplay|'
217
+ r'NumberOfElements|Object|OLEClass|OLEDragMode|'
218
+ r'OLEDragPicture|OLEDropEffects|OLEDropHasData|'
219
+ r'OLEDropMode|OLEDropTextInsertion|OLELCID|'
220
+ r'OLERequestPendingTimeout|OLEServerBusyRaiseError|'
221
+ r'OLEServerBusyTimeout|OLETypeAllowed|OneToMany|'
222
+ r'OpenViews|OpenWindow|Optimize|OrderDirection|Order|'
223
+ r'OutputPageCount|OutputType|PageCount|PageHeight|'
224
+ r'PageNo|PageOrder|Pages|PageTotal|PageWidth|'
225
+ r'PanelLink|Panel|ParentAlias|ParentClass|ParentTable|'
226
+ r'Parent|Partition|PasswordChar|PictureMargin|'
227
+ r'PicturePosition|PictureSpacing|PictureSelectionDisplay|'
228
+ r'PictureVal|Picture|Prepared|'
229
+ r'PolyPoints|PreserveWhiteSpace|PreviewContainer|'
230
+ r'PrintJobName|Procedure|PROCESSID|ProgID|ProjectHookClass|'
231
+ r'ProjectHookLibrary|ProjectHook|QuietMode|'
232
+ r'ReadCycle|ReadLock|ReadMouse|ReadObject|ReadOnly|'
233
+ r'ReadSave|ReadTimeout|RecordMark|RecordSourceType|'
234
+ r'RecordSource|RefreshAlias|'
235
+ r'RefreshCmdDataSourceType|RefreshCmdDataSource|RefreshCmd|'
236
+ r'RefreshIgnoreFieldList|RefreshTimeStamp|RelationalExpr|'
237
+ r'RelativeColumn|RelativeRow|ReleaseType|Resizable|'
238
+ r'RespectCursorCP|RespectNesting|RightToLeft|RotateFlip|'
239
+ r'Rotation|RowColChange|RowHeight|RowSourceType|'
240
+ r'RowSource|ScaleMode|SCCProvider|SCCStatus|ScrollBars|'
241
+ r'Seconds|SelectCmd|SelectedID|'
242
+ r'SelectedItemBackColor|SelectedItemForeColor|Selected|'
243
+ r'SelectionNamespaces|SelectOnEntry|SelLength|SelStart|'
244
+ r'SelText|SendGDIPlusImage|SendUpdates|ServerClassLibrary|'
245
+ r'ServerClass|ServerHelpFile|ServerName|'
246
+ r'ServerProject|ShowTips|ShowInTaskbar|ShowWindow|'
247
+ r'Sizable|SizeBox|SOM|Sorted|Sparse|SpecialEffect|'
248
+ r'SpinnerHighValue|SpinnerLowValue|SplitBar|StackLevel|'
249
+ r'StartMode|StatusBarText|StatusBar|Stretch|StrictDateEntry|'
250
+ r'Style|TabIndex|Tables|TabOrientation|Tabs|TabStop|'
251
+ r'TabStretch|TabStyle|Tag|TerminateRead|Text|Themes|'
252
+ r'ThreadID|TimestampFieldList|TitleBar|ToolTipText|'
253
+ r'TopIndex|TopItemID|Top|TwoPassProcess|TypeLibCLSID|'
254
+ r'TypeLibDesc|TypeLibName|Type|Unicode|UpdatableFieldList|'
255
+ r'UpdateCmdDataSourceType|UpdateCmdDataSource|'
256
+ r'UpdateCmdRefreshCmd|UpdateCmdRefreshFieldList|'
257
+ r'UpdateCmdRefreshKeyFieldList|UpdateCmd|'
258
+ r'UpdateGramSchemaLocation|UpdateGram|UpdateNameList|UpdateType|'
259
+ r'UseCodePage|UseCursorSchema|UseDeDataSource|UseMemoSize|'
260
+ r'UserValue|UseTransactions|UTF8Encoded|Value|VersionComments|'
261
+ r'VersionCompany|VersionCopyright|VersionDescription|'
262
+ r'VersionNumber|VersionProduct|VersionTrademarks|Version|'
263
+ r'VFPXMLProgID|ViewPortHeight|ViewPortLeft|'
264
+ r'ViewPortTop|ViewPortWidth|VScrollSmallChange|View|Visible|'
265
+ r'VisualEffect|WhatsThisButton|WhatsThisHelpID|WhatsThisHelp|'
266
+ r'WhereType|Width|WindowList|WindowState|WindowType|WordWrap|'
267
+ r'WrapCharInCDATA|WrapInCDATA|WrapMemoInCDATA|XMLAdapter|'
268
+ r'XMLConstraints|XMLNameIsXPath|XMLNamespace|XMLName|'
269
+ r'XMLPrefix|XMLSchemaLocation|XMLTable|XMLType|'
270
+ r'XSDfractionDigits|XSDmaxLength|XSDtotalDigits|'
271
+ r'XSDtype|ZoomBox)', Name.Attribute),
272
+
273
+ (r'\.(ActivateCell|AddColumn|AddItem|AddListItem|AddObject|'
274
+ r'AddProperty|AddTableSchema|AddToSCC|Add|'
275
+ r'ApplyDiffgram|Attach|AutoFit|AutoOpen|Box|Build|'
276
+ r'CancelReport|ChangesToCursor|CheckIn|CheckOut|Circle|'
277
+ r'CleanUp|ClearData|ClearStatus|Clear|CloneObject|CloseTables|'
278
+ r'Close|Cls|CursorAttach|CursorDetach|CursorFill|'
279
+ r'CursorRefresh|DataToClip|DelayedMemoFetch|DeleteColumn|'
280
+ r'Dock|DoMessage|DoScroll|DoStatus|DoVerb|Drag|Draw|Eval|'
281
+ r'GetData|GetDockState|GetFormat|GetKey|GetLatestVersion|'
282
+ r'GetPageHeight|GetPageWidth|Help|Hide|IncludePageInOutput|'
283
+ r'IndexToItemID|ItemIDToIndex|Item|LoadXML|Line|Modify|'
284
+ r'MoveItem|Move|Nest|OLEDrag|OnPreviewClose|OutputPage|'
285
+ r'Point|Print|PSet|Quit|ReadExpression|ReadMethod|'
286
+ r'RecordRefresh|Refresh|ReleaseXML|Release|RemoveFromSCC|'
287
+ r'RemoveItem|RemoveListItem|RemoveObject|Remove|'
288
+ r'Render|Requery|RequestData|ResetToDefault|Reset|Run|'
289
+ r'SaveAsClass|SaveAs|SetAll|SetData|SetFocus|SetFormat|'
290
+ r'SetMain|SetVar|SetViewPort|ShowWhatsThis|Show|'
291
+ r'SupportsListenerType|TextHeight|TextWidth|ToCursor|'
292
+ r'ToXML|UndoCheckOut|Unnest|UpdateStatus|WhatsThisMode|'
293
+ r'WriteExpression|WriteMethod|ZOrder)', Name.Function),
294
+
295
+ (r'\.(Activate|AdjustObjectSize|AfterBand|AfterBuild|'
296
+ r'AfterCloseTables|AfterCursorAttach|AfterCursorClose|'
297
+ r'AfterCursorDetach|AfterCursorFill|AfterCursorRefresh|'
298
+ r'AfterCursorUpdate|AfterDelete|AfterInsert|'
299
+ r'AfterRecordRefresh|AfterUpdate|AfterDock|AfterReport|'
300
+ r'AfterRowColChange|BeforeBand|BeforeCursorAttach|'
301
+ r'BeforeCursorClose|BeforeCursorDetach|BeforeCursorFill|'
302
+ r'BeforeCursorRefresh|BeforeCursorUpdate|BeforeDelete|'
303
+ r'BeforeInsert|BeforeDock|BeforeOpenTables|'
304
+ r'BeforeRecordRefresh|BeforeReport|BeforeRowColChange|'
305
+ r'BeforeUpdate|Click|dbc_Activate|dbc_AfterAddTable|'
306
+ r'dbc_AfterAppendProc|dbc_AfterCloseTable|dbc_AfterCopyProc|'
307
+ r'dbc_AfterCreateConnection|dbc_AfterCreateOffline|'
308
+ r'dbc_AfterCreateTable|dbc_AfterCreateView|dbc_AfterDBGetProp|'
309
+ r'dbc_AfterDBSetProp|dbc_AfterDeleteConnection|'
310
+ r'dbc_AfterDropOffline|dbc_AfterDropTable|'
311
+ r'dbc_AfterModifyConnection|dbc_AfterModifyProc|'
312
+ r'dbc_AfterModifyTable|dbc_AfterModifyView|dbc_AfterOpenTable|'
313
+ r'dbc_AfterRemoveTable|dbc_AfterRenameConnection|'
314
+ r'dbc_AfterRenameTable|dbc_AfterRenameView|'
315
+ r'dbc_AfterValidateData|dbc_BeforeAddTable|'
316
+ r'dbc_BeforeAppendProc|dbc_BeforeCloseTable|'
317
+ r'dbc_BeforeCopyProc|dbc_BeforeCreateConnection|'
318
+ r'dbc_BeforeCreateOffline|dbc_BeforeCreateTable|'
319
+ r'dbc_BeforeCreateView|dbc_BeforeDBGetProp|'
320
+ r'dbc_BeforeDBSetProp|dbc_BeforeDeleteConnection|'
321
+ r'dbc_BeforeDropOffline|dbc_BeforeDropTable|'
322
+ r'dbc_BeforeModifyConnection|dbc_BeforeModifyProc|'
323
+ r'dbc_BeforeModifyTable|dbc_BeforeModifyView|'
324
+ r'dbc_BeforeOpenTable|dbc_BeforeRemoveTable|'
325
+ r'dbc_BeforeRenameConnection|dbc_BeforeRenameTable|'
326
+ r'dbc_BeforeRenameView|dbc_BeforeValidateData|'
327
+ r'dbc_CloseData|dbc_Deactivate|dbc_ModifyData|dbc_OpenData|'
328
+ r'dbc_PackData|DblClick|Deactivate|Deleted|Destroy|DoCmd|'
329
+ r'DownClick|DragDrop|DragOver|DropDown|ErrorMessage|Error|'
330
+ r'EvaluateContents|GotFocus|Init|InteractiveChange|KeyPress|'
331
+ r'LoadReport|Load|LostFocus|Message|MiddleClick|MouseDown|'
332
+ r'MouseEnter|MouseLeave|MouseMove|MouseUp|MouseWheel|Moved|'
333
+ r'OLECompleteDrag|OLEDragOver|OLEGiveFeedback|OLESetData|'
334
+ r'OLEStartDrag|OnMoveItem|Paint|ProgrammaticChange|'
335
+ r'QueryAddFile|QueryModifyFile|QueryNewFile|QueryRemoveFile|'
336
+ r'QueryRunFile|QueryUnload|RangeHigh|RangeLow|ReadActivate|'
337
+ r'ReadDeactivate|ReadShow|ReadValid|ReadWhen|Resize|'
338
+ r'RightClick|SCCInit|SCCDestroy|Scrolled|Timer|UIEnable|'
339
+ r'UnDock|UnloadReport|Unload|UpClick|Valid|When)', Name.Function),
340
+
341
+ (r'\s+', Text),
342
+ # everything else is not colored
343
+ (r'.', Text),
344
+ ],
345
+ 'newline': [
346
+ (r'\*.*?$', Comment.Single, '#pop'),
347
+ (r'(ACCEPT|ACTIVATE\s*MENU|ACTIVATE\s*POPUP|ACTIVATE\s*SCREEN|'
348
+ r'ACTIVATE\s*WINDOW|APPEND|APPEND\s*FROM|APPEND\s*FROM\s*ARRAY|'
349
+ r'APPEND\s*GENERAL|APPEND\s*MEMO|ASSIST|AVERAGE|BLANK|BROWSE|'
350
+ r'BUILD\s*APP|BUILD\s*EXE|BUILD\s*PROJECT|CALCULATE|CALL|'
351
+ r'CANCEL|CHANGE|CLEAR|CLOSE|CLOSE\s*MEMO|COMPILE|CONTINUE|'
352
+ r'COPY\s*FILE|COPY\s*INDEXES|COPY\s*MEMO|COPY\s*STRUCTURE|'
353
+ r'COPY\s*STRUCTURE\s*EXTENDED|COPY\s*TAG|COPY\s*TO|'
354
+ r'COPY\s*TO\s*ARRAY|COUNT|CREATE|CREATE\s*COLOR\s*SET|'
355
+ r'CREATE\s*CURSOR|CREATE\s*FROM|CREATE\s*LABEL|CREATE\s*MENU|'
356
+ r'CREATE\s*PROJECT|CREATE\s*QUERY|CREATE\s*REPORT|'
357
+ r'CREATE\s*SCREEN|CREATE\s*TABLE|CREATE\s*VIEW|DDE|'
358
+ r'DEACTIVATE\s*MENU|DEACTIVATE\s*POPUP|DEACTIVATE\s*WINDOW|'
359
+ r'DECLARE|DEFINE\s*BAR|DEFINE\s*BOX|DEFINE\s*MENU|'
360
+ r'DEFINE\s*PAD|DEFINE\s*POPUP|DEFINE\s*WINDOW|DELETE|'
361
+ r'DELETE\s*FILE|DELETE\s*TAG|DIMENSION|DIRECTORY|DISPLAY|'
362
+ r'DISPLAY\s*FILES|DISPLAY\s*MEMORY|DISPLAY\s*STATUS|'
363
+ r'DISPLAY\s*STRUCTURE|DO|EDIT|EJECT|EJECT\s*PAGE|ERASE|'
364
+ r'EXIT|EXPORT|EXTERNAL|FILER|FIND|FLUSH|FUNCTION|GATHER|'
365
+ r'GETEXPR|GO|GOTO|HELP|HIDE\s*MENU|HIDE\s*POPUP|'
366
+ r'HIDE\s*WINDOW|IMPORT|INDEX|INPUT|INSERT|JOIN|KEYBOARD|'
367
+ r'LABEL|LIST|LOAD|LOCATE|LOOP|MENU|MENU\s*TO|MODIFY\s*COMMAND|'
368
+ r'MODIFY\s*FILE|MODIFY\s*GENERAL|MODIFY\s*LABEL|MODIFY\s*MEMO|'
369
+ r'MODIFY\s*MENU|MODIFY\s*PROJECT|MODIFY\s*QUERY|'
370
+ r'MODIFY\s*REPORT|MODIFY\s*SCREEN|MODIFY\s*STRUCTURE|'
371
+ r'MODIFY\s*WINDOW|MOVE\s*POPUP|MOVE\s*WINDOW|NOTE|'
372
+ r'ON\s*APLABOUT|ON\s*BAR|ON\s*ERROR|ON\s*ESCAPE|'
373
+ r'ON\s*EXIT\s*BAR|ON\s*EXIT\s*MENU|ON\s*EXIT\s*PAD|'
374
+ r'ON\s*EXIT\s*POPUP|ON\s*KEY|ON\s*KEY\s*=|ON\s*KEY\s*LABEL|'
375
+ r'ON\s*MACHELP|ON\s*PAD|ON\s*PAGE|ON\s*READERROR|'
376
+ r'ON\s*SELECTION\s*BAR|ON\s*SELECTION\s*MENU|'
377
+ r'ON\s*SELECTION\s*PAD|ON\s*SELECTION\s*POPUP|ON\s*SHUTDOWN|'
378
+ r'PACK|PARAMETERS|PLAY\s*MACRO|POP\s*KEY|POP\s*MENU|'
379
+ r'POP\s*POPUP|PRIVATE|PROCEDURE|PUBLIC|PUSH\s*KEY|'
380
+ r'PUSH\s*MENU|PUSH\s*POPUP|QUIT|READ|READ\s*MENU|RECALL|'
381
+ r'REINDEX|RELEASE|RELEASE\s*MODULE|RENAME|REPLACE|'
382
+ r'REPLACE\s*FROM\s*ARRAY|REPORT|RESTORE\s*FROM|'
383
+ r'RESTORE\s*MACROS|RESTORE\s*SCREEN|RESTORE\s*WINDOW|'
384
+ r'RESUME|RETRY|RETURN|RUN|RUN\s*\/N"|RUNSCRIPT|'
385
+ r'SAVE\s*MACROS|SAVE\s*SCREEN|SAVE\s*TO|SAVE\s*WINDOWS|'
386
+ r'SCATTER|SCROLL|SEEK|SELECT|SET|SET\s*ALTERNATE|'
387
+ r'SET\s*ANSI|SET\s*APLABOUT|SET\s*AUTOSAVE|SET\s*BELL|'
388
+ r'SET\s*BLINK|SET\s*BLOCKSIZE|SET\s*BORDER|SET\s*BRSTATUS|'
389
+ r'SET\s*CARRY|SET\s*CENTURY|SET\s*CLEAR|SET\s*CLOCK|'
390
+ r'SET\s*COLLATE|SET\s*COLOR\s*OF|SET\s*COLOR\s*OF\s*SCHEME|'
391
+ r'SET\s*COLOR\s*SET|SET\s*COLOR\s*TO|SET\s*COMPATIBLE|'
392
+ r'SET\s*CONFIRM|SET\s*CONSOLE|SET\s*CURRENCY|SET\s*CURSOR|'
393
+ r'SET\s*DATE|SET\s*DEBUG|SET\s*DECIMALS|SET\s*DEFAULT|'
394
+ r'SET\s*DELETED|SET\s*DELIMITERS|SET\s*DEVELOPMENT|'
395
+ r'SET\s*DEVICE|SET\s*DISPLAY|SET\s*DOHISTORY|SET\s*ECHO|'
396
+ r'SET\s*ESCAPE|SET\s*EXACT|SET\s*EXCLUSIVE|SET\s*FIELDS|'
397
+ r'SET\s*FILTER|SET\s*FIXED|SET\s*FORMAT|SET\s*FULLPATH|'
398
+ r'SET\s*FUNCTION|SET\s*HEADINGS|SET\s*HELP|SET\s*HELPFILTER|'
399
+ r'SET\s*HOURS|SET\s*INDEX|SET\s*INTENSITY|SET\s*KEY|'
400
+ r'SET\s*KEYCOMP|SET\s*LIBRARY|SET\s*LOCK|SET\s*LOGERRORS|'
401
+ r'SET\s*MACDESKTOP|SET\s*MACHELP|SET\s*MACKEY|SET\s*MARGIN|'
402
+ r'SET\s*MARK\s*OF|SET\s*MARK\s*TO|SET\s*MEMOWIDTH|'
403
+ r'SET\s*MESSAGE|SET\s*MOUSE|SET\s*MULTILOCKS|SET\s*NEAR|'
404
+ r'SET\s*NOCPTRANS|SET\s*NOTIFY|SET\s*ODOMETER|SET\s*OPTIMIZE|'
405
+ r'SET\s*ORDER|SET\s*PALETTE|SET\s*PATH|SET\s*PDSETUP|'
406
+ r'SET\s*POINT|SET\s*PRINTER|SET\s*PROCEDURE|SET\s*READBORDER|'
407
+ r'SET\s*REFRESH|SET\s*RELATION|SET\s*RELATION\s*OFF|'
408
+ r'SET\s*REPROCESS|SET\s*RESOURCE|SET\s*SAFETY|SET\s*SCOREBOARD|'
409
+ r'SET\s*SEPARATOR|SET\s*SHADOWS|SET\s*SKIP|SET\s*SKIP\s*OF|'
410
+ r'SET\s*SPACE|SET\s*STATUS|SET\s*STATUS\s*BAR|SET\s*STEP|'
411
+ r'SET\s*STICKY|SET\s*SYSMENU|SET\s*TALK|SET\s*TEXTMERGE|'
412
+ r'SET\s*TEXTMERGE\s*DELIMITERS|SET\s*TOPIC|SET\s*TRBETWEEN|'
413
+ r'SET\s*TYPEAHEAD|SET\s*UDFPARMS|SET\s*UNIQUE|SET\s*VIEW|'
414
+ r'SET\s*VOLUME|SET\s*WINDOW\s*OF\s*MEMO|SET\s*XCMDFILE|'
415
+ r'SHOW\s*GET|SHOW\s*GETS|SHOW\s*MENU|SHOW\s*OBJECT|'
416
+ r'SHOW\s*POPUP|SHOW\s*WINDOW|SIZE\s*POPUP|SKIP|SORT|'
417
+ r'STORE|SUM|SUSPEND|TOTAL|TYPE|UNLOCK|UPDATE|USE|WAIT|'
418
+ r'ZAP|ZOOM\s*WINDOW|DO\s*CASE|CASE|OTHERWISE|ENDCASE|'
419
+ r'DO\s*WHILE|ENDDO|FOR|ENDFOR|NEXT|IF|ELSE|ENDIF|PRINTJOB|'
420
+ r'ENDPRINTJOB|SCAN|ENDSCAN|TEXT|ENDTEXT|=)',
421
+ Keyword.Reserved, '#pop'),
422
+ (r'#\s*(IF|ELIF|ELSE|ENDIF|DEFINE|IFDEF|IFNDEF|INCLUDE)',
423
+ Comment.Preproc, '#pop'),
424
+ (r'(m\.)?[a-z_]\w*', Name.Variable, '#pop'),
425
+ (r'.', Text, '#pop'),
426
+ ],
427
+ }
evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/inferno.py ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.inferno
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Inferno os and all the related stuff.
6
+
7
+ :copyright: Copyright 2006-2024 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, default
14
+ from pygments.token import Punctuation, Comment, Operator, Keyword, \
15
+ Name, String, Number, Whitespace
16
+
17
+ __all__ = ['LimboLexer']
18
+
19
+
20
+ class LimboLexer(RegexLexer):
21
+ """
22
+ Lexer for Limbo programming language
23
+
24
+ TODO:
25
+ - maybe implement better var declaration highlighting
26
+ - some simple syntax error highlighting
27
+ """
28
+ name = 'Limbo'
29
+ url = 'http://www.vitanuova.com/inferno/limbo.html'
30
+ aliases = ['limbo']
31
+ filenames = ['*.b']
32
+ mimetypes = ['text/limbo']
33
+ version_added = '2.0'
34
+
35
+ tokens = {
36
+ 'whitespace': [
37
+ (r'^(\s*)([a-zA-Z_]\w*:)(\s*\n)',
38
+ bygroups(Whitespace, Name.Label, Whitespace)),
39
+ (r'\n', Whitespace),
40
+ (r'\s+', Whitespace),
41
+ (r'#(\n|(.|\n)*?[^\\]\n)', Comment.Single),
42
+ ],
43
+ 'string': [
44
+ (r'"', String, '#pop'),
45
+ (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|'
46
+ r'u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8}|[0-7]{1,3})', String.Escape),
47
+ (r'[^\\"\n]+', String), # all other characters
48
+ (r'\\', String), # stray backslash
49
+ ],
50
+ 'statements': [
51
+ (r'"', String, 'string'),
52
+ (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
53
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+', Number.Float),
54
+ (r'(\d+\.\d*|\.\d+|\d+[fF])', Number.Float),
55
+ (r'16r[0-9a-fA-F]+', Number.Hex),
56
+ (r'8r[0-7]+', Number.Oct),
57
+ (r'((([1-3]\d)|([2-9]))r)?(\d+)', Number.Integer),
58
+ (r'[()\[\],.]', Punctuation),
59
+ (r'[~!%^&*+=|?:<>/-]|(->)|(<-)|(=>)|(::)', Operator),
60
+ (r'(alt|break|case|continue|cyclic|do|else|exit'
61
+ r'for|hd|if|implement|import|include|len|load|or'
62
+ r'pick|return|spawn|tagof|tl|to|while)\b', Keyword),
63
+ (r'(byte|int|big|real|string|array|chan|list|adt'
64
+ r'|fn|ref|of|module|self|type)\b', Keyword.Type),
65
+ (r'(con|iota|nil)\b', Keyword.Constant),
66
+ (r'[a-zA-Z_]\w*', Name),
67
+ ],
68
+ 'statement' : [
69
+ include('whitespace'),
70
+ include('statements'),
71
+ ('[{}]', Punctuation),
72
+ (';', Punctuation, '#pop'),
73
+ ],
74
+ 'root': [
75
+ include('whitespace'),
76
+ default('statement'),
77
+ ],
78
+ }
79
+
80
+ def analyse_text(text):
81
+ # Any limbo module implements something
82
+ if re.search(r'^implement \w+;', text, re.MULTILINE):
83
+ return 0.7
84
+
85
+ # TODO:
86
+ # - Make lexers for:
87
+ # - asm sources
88
+ # - man pages
89
+ # - mkfiles
90
+ # - module definitions
91
+ # - namespace definitions
92
+ # - shell scripts
93
+ # - maybe keyfiles and fonts
94
+ # they all seem to be quite similar to their equivalents
95
+ # from unix world, so there should not be a lot of problems
evalkit_tf437/lib/python3.10/site-packages/pygments/lexers/int_fiction.py ADDED
@@ -0,0 +1,1370 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.int_fiction
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for interactive fiction languages.
6
+
7
+ :copyright: Copyright 2006-2024 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, default, words
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Error, Generic
17
+
18
+ __all__ = ['Inform6Lexer', 'Inform6TemplateLexer', 'Inform7Lexer',
19
+ 'Tads3Lexer']
20
+
21
+
22
+ class Inform6Lexer(RegexLexer):
23
+ """
24
+ For Inform 6 source code.
25
+ """
26
+
27
+ name = 'Inform 6'
28
+ url = 'http://inform-fiction.org/'
29
+ aliases = ['inform6', 'i6']
30
+ filenames = ['*.inf']
31
+ version_added = '2.0'
32
+
33
+ flags = re.MULTILINE | re.DOTALL
34
+
35
+ _name = r'[a-zA-Z_]\w*'
36
+
37
+ # Inform 7 maps these four character classes to their ASCII
38
+ # equivalents. To support Inform 6 inclusions within Inform 7,
39
+ # Inform6Lexer maps them too.
40
+ _dash = '\\-\u2010-\u2014'
41
+ _dquote = '"\u201c\u201d'
42
+ _squote = "'\u2018\u2019"
43
+ _newline = '\\n\u0085\u2028\u2029'
44
+
45
+ tokens = {
46
+ 'root': [
47
+ (rf'\A(!%[^{_newline}]*[{_newline}])+', Comment.Preproc,
48
+ 'directive'),
49
+ default('directive')
50
+ ],
51
+ '_whitespace': [
52
+ (r'\s+', Text),
53
+ (rf'![^{_newline}]*', Comment.Single)
54
+ ],
55
+ 'default': [
56
+ include('_whitespace'),
57
+ (r'\[', Punctuation, 'many-values'), # Array initialization
58
+ (r':|(?=;)', Punctuation, '#pop'),
59
+ (r'<', Punctuation), # Second angle bracket in an action statement
60
+ default(('expression', '_expression'))
61
+ ],
62
+
63
+ # Expressions
64
+ '_expression': [
65
+ include('_whitespace'),
66
+ (r'(?=sp\b)', Text, '#pop'),
67
+ (rf'(?=[{_dquote}{_squote}$0-9#a-zA-Z_])', Text,
68
+ ('#pop', 'value')),
69
+ (rf'\+\+|[{_dash}]{{1,2}}(?!>)|~~?', Operator),
70
+ (rf'(?=[()\[{_dash},?@{{:;])', Text, '#pop')
71
+ ],
72
+ 'expression': [
73
+ include('_whitespace'),
74
+ (r'\(', Punctuation, ('expression', '_expression')),
75
+ (r'\)', Punctuation, '#pop'),
76
+ (r'\[', Punctuation, ('#pop', 'statements', 'locals')),
77
+ (rf'>(?=(\s+|(![^{_newline}]*))*[>;])', Punctuation),
78
+ (rf'\+\+|[{_dash}]{{2}}(?!>)', Operator),
79
+ (r',', Punctuation, '_expression'),
80
+ (rf'&&?|\|\|?|[=~><]?=|[{_dash}]{{1,2}}>?|\.\.?[&#]?|::|[<>+*/%]',
81
+ Operator, '_expression'),
82
+ (r'(has|hasnt|in|notin|ofclass|or|provides)\b', Operator.Word,
83
+ '_expression'),
84
+ (r'sp\b', Name),
85
+ (r'\?~?', Name.Label, 'label?'),
86
+ (r'[@{]', Error),
87
+ default('#pop')
88
+ ],
89
+ '_assembly-expression': [
90
+ (r'\(', Punctuation, ('#push', '_expression')),
91
+ (r'[\[\]]', Punctuation),
92
+ (rf'[{_dash}]>', Punctuation, '_expression'),
93
+ (r'sp\b', Keyword.Pseudo),
94
+ (r';', Punctuation, '#pop:3'),
95
+ include('expression')
96
+ ],
97
+ '_for-expression': [
98
+ (r'\)', Punctuation, '#pop:2'),
99
+ (r':', Punctuation, '#pop'),
100
+ include('expression')
101
+ ],
102
+ '_keyword-expression': [
103
+ (r'(from|near|to)\b', Keyword, '_expression'),
104
+ include('expression')
105
+ ],
106
+ '_list-expression': [
107
+ (r',', Punctuation, '#pop'),
108
+ include('expression')
109
+ ],
110
+ '_object-expression': [
111
+ (r'has\b', Keyword.Declaration, '#pop'),
112
+ include('_list-expression')
113
+ ],
114
+
115
+ # Values
116
+ 'value': [
117
+ include('_whitespace'),
118
+ # Strings
119
+ (rf'[{_squote}][^@][{_squote}]', String.Char, '#pop'),
120
+ (rf'([{_squote}])(@\{{[0-9a-fA-F]*\}})([{_squote}])',
121
+ bygroups(String.Char, String.Escape, String.Char), '#pop'),
122
+ (rf'([{_squote}])(@.{{2}})([{_squote}])',
123
+ bygroups(String.Char, String.Escape, String.Char), '#pop'),
124
+ (rf'[{_squote}]', String.Single, ('#pop', 'dictionary-word')),
125
+ (rf'[{_dquote}]', String.Double, ('#pop', 'string')),
126
+ # Numbers
127
+ (rf'\$[<>]?[+{_dash}][0-9]*\.?[0-9]*([eE][+{_dash}]?[0-9]+)?',
128
+ Number.Float, '#pop'),
129
+ (r'\$[0-9a-fA-F]+', Number.Hex, '#pop'),
130
+ (r'\$\$[01]+', Number.Bin, '#pop'),
131
+ (r'[0-9]+', Number.Integer, '#pop'),
132
+ # Values prefixed by hashes
133
+ (rf'(##|#a\$)({_name})', bygroups(Operator, Name), '#pop'),
134
+ (rf'(#g\$)({_name})',
135
+ bygroups(Operator, Name.Variable.Global), '#pop'),
136
+ (r'#[nw]\$', Operator, ('#pop', 'obsolete-dictionary-word')),
137
+ (rf'(#r\$)({_name})', bygroups(Operator, Name.Function), '#pop'),
138
+ (r'#', Name.Builtin, ('#pop', 'system-constant')),
139
+ # System functions
140
+ (words((
141
+ 'child', 'children', 'elder', 'eldest', 'glk', 'indirect', 'metaclass',
142
+ 'parent', 'random', 'sibling', 'younger', 'youngest'), suffix=r'\b'),
143
+ Name.Builtin, '#pop'),
144
+ # Metaclasses
145
+ (r'(?i)(Class|Object|Routine|String)\b', Name.Builtin, '#pop'),
146
+ # Veneer routines
147
+ (words((
148
+ 'Box__Routine', 'CA__Pr', 'CDefArt', 'CInDefArt', 'Cl__Ms',
149
+ 'Copy__Primitive', 'CP__Tab', 'DA__Pr', 'DB__Pr', 'DefArt', 'Dynam__String',
150
+ 'EnglishNumber', 'Glk__Wrap', 'IA__Pr', 'IB__Pr', 'InDefArt', 'Main__',
151
+ 'Meta__class', 'OB__Move', 'OB__Remove', 'OC__Cl', 'OP__Pr', 'Print__Addr',
152
+ 'Print__PName', 'PrintShortName', 'RA__Pr', 'RA__Sc', 'RL__Pr', 'R_Process',
153
+ 'RT__ChG', 'RT__ChGt', 'RT__ChLDB', 'RT__ChLDW', 'RT__ChPR', 'RT__ChPrintA',
154
+ 'RT__ChPrintC', 'RT__ChPrintO', 'RT__ChPrintS', 'RT__ChPS', 'RT__ChR',
155
+ 'RT__ChSTB', 'RT__ChSTW', 'RT__ChT', 'RT__Err', 'RT__TrPS', 'RV__Pr',
156
+ 'Symb__Tab', 'Unsigned__Compare', 'WV__Pr', 'Z__Region'),
157
+ prefix='(?i)', suffix=r'\b'),
158
+ Name.Builtin, '#pop'),
159
+ # Other built-in symbols
160
+ (words((
161
+ 'call', 'copy', 'create', 'DEBUG', 'destroy', 'DICT_CHAR_SIZE',
162
+ 'DICT_ENTRY_BYTES', 'DICT_IS_UNICODE', 'DICT_WORD_SIZE', 'DOUBLE_HI_INFINITY',
163
+ 'DOUBLE_HI_NAN', 'DOUBLE_HI_NINFINITY', 'DOUBLE_LO_INFINITY', 'DOUBLE_LO_NAN',
164
+ 'DOUBLE_LO_NINFINITY', 'false', 'FLOAT_INFINITY', 'FLOAT_NAN', 'FLOAT_NINFINITY',
165
+ 'GOBJFIELD_CHAIN', 'GOBJFIELD_CHILD', 'GOBJFIELD_NAME', 'GOBJFIELD_PARENT',
166
+ 'GOBJFIELD_PROPTAB', 'GOBJFIELD_SIBLING', 'GOBJ_EXT_START',
167
+ 'GOBJ_TOTAL_LENGTH', 'Grammar__Version', 'INDIV_PROP_START', 'INFIX',
168
+ 'infix__watching', 'MODULE_MODE', 'name', 'nothing', 'NUM_ATTR_BYTES', 'print',
169
+ 'print_to_array', 'recreate', 'remaining', 'self', 'sender', 'STRICT_MODE',
170
+ 'sw__var', 'sys__glob0', 'sys__glob1', 'sys__glob2', 'sys_statusline_flag',
171
+ 'TARGET_GLULX', 'TARGET_ZCODE', 'temp__global2', 'temp__global3',
172
+ 'temp__global4', 'temp_global', 'true', 'USE_MODULES', 'WORDSIZE'),
173
+ prefix='(?i)', suffix=r'\b'),
174
+ Name.Builtin, '#pop'),
175
+ # Other values
176
+ (_name, Name, '#pop')
177
+ ],
178
+ 'value?': [
179
+ include('value'),
180
+ default('#pop')
181
+ ],
182
+ # Strings
183
+ 'dictionary-word': [
184
+ (rf'[~^]+|//[^{_squote}]*', String.Escape),
185
+ (rf'[^~^/\\@({{{_squote}]+', String.Single),
186
+ (r'[/({]', String.Single),
187
+ (r'@\{[0-9a-fA-F]*\}', String.Escape),
188
+ (r'@.{2}', String.Escape),
189
+ (rf'[{_squote}]', String.Single, '#pop')
190
+ ],
191
+ 'string': [
192
+ (r'[~^]+', String.Escape),
193
+ (rf'[^~^\\@({{{_dquote}]+', String.Double),
194
+ (r'[({]', String.Double),
195
+ (r'\\', String.Escape),
196
+ (rf'@(\\\s*[{_newline}]\s*)*@((\\\s*[{_newline}]\s*)*[0-9])*', String.Escape),
197
+ (rf'@(\\\s*[{_newline}]\s*)*[({{]((\\\s*[{_newline}]\s*)*[0-9a-zA-Z_])*'
198
+ rf'(\\\s*[{_newline}]\s*)*[)}}]',
199
+ String.Escape),
200
+ (rf'@(\\\s*[{_newline}]\s*)*.(\\\s*[{_newline}]\s*)*.',
201
+ String.Escape),
202
+ (rf'[{_dquote}]', String.Double, '#pop')
203
+ ],
204
+ 'plain-string': [
205
+ (rf'[^~^\\({{\[\]{_dquote}]+', String.Double),
206
+ (r'[~^({\[\]]', String.Double),
207
+ (r'\\', String.Escape),
208
+ (rf'[{_dquote}]', String.Double, '#pop')
209
+ ],
210
+ # Names
211
+ '_constant': [
212
+ include('_whitespace'),
213
+ (_name, Name.Constant, '#pop'),
214
+ include('value')
215
+ ],
216
+ 'constant*': [
217
+ include('_whitespace'),
218
+ (r',', Punctuation),
219
+ (r'=', Punctuation, 'value?'),
220
+ (_name, Name.Constant, 'value?'),
221
+ default('#pop')
222
+ ],
223
+ '_global': [
224
+ include('_whitespace'),
225
+ (_name, Name.Variable.Global, '#pop'),
226
+ include('value')
227
+ ],
228
+ 'label?': [
229
+ include('_whitespace'),
230
+ (_name, Name.Label, '#pop'),
231
+ default('#pop')
232
+ ],
233
+ 'variable?': [
234
+ include('_whitespace'),
235
+ (_name, Name.Variable, '#pop'),
236
+ default('#pop')
237
+ ],
238
+ # Values after hashes
239
+ 'obsolete-dictionary-word': [
240
+ (r'\S\w*', String.Other, '#pop')
241
+ ],
242
+ 'system-constant': [
243
+ include('_whitespace'),
244
+ (_name, Name.Builtin, '#pop')
245
+ ],
246
+
247
+ # Directives
248
+ 'directive': [
249
+ include('_whitespace'),
250
+ (r'#', Punctuation),
251
+ (r';', Punctuation, '#pop'),
252
+ (r'\[', Punctuation,
253
+ ('default', 'statements', 'locals', 'routine-name?')),
254
+ (words((
255
+ 'abbreviate', 'endif', 'dictionary', 'ifdef', 'iffalse', 'ifndef', 'ifnot',
256
+ 'iftrue', 'ifv3', 'ifv5', 'release', 'serial', 'switches', 'system_file',
257
+ 'version'), prefix='(?i)', suffix=r'\b'),
258
+ Keyword, 'default'),
259
+ (r'(?i)(array|global)\b', Keyword,
260
+ ('default', 'directive-keyword?', '_global')),
261
+ (r'(?i)attribute\b', Keyword, ('default', 'alias?', '_constant')),
262
+ (r'(?i)class\b', Keyword,
263
+ ('object-body', 'duplicates', 'class-name')),
264
+ (r'(?i)(constant|default)\b', Keyword,
265
+ ('default', 'constant*')),
266
+ (r'(?i)(end\b)(.*)', bygroups(Keyword, Text)),
267
+ (r'(?i)(extend|verb)\b', Keyword, 'grammar'),
268
+ (r'(?i)fake_action\b', Keyword, ('default', '_constant')),
269
+ (r'(?i)import\b', Keyword, 'manifest'),
270
+ (r'(?i)(include|link|origsource)\b', Keyword,
271
+ ('default', 'before-plain-string?')),
272
+ (r'(?i)(lowstring|undef)\b', Keyword, ('default', '_constant')),
273
+ (r'(?i)message\b', Keyword, ('default', 'diagnostic')),
274
+ (r'(?i)(nearby|object)\b', Keyword,
275
+ ('object-body', '_object-head')),
276
+ (r'(?i)property\b', Keyword,
277
+ ('default', 'alias?', '_constant', 'property-keyword*')),
278
+ (r'(?i)replace\b', Keyword,
279
+ ('default', 'routine-name?', 'routine-name?')),
280
+ (r'(?i)statusline\b', Keyword, ('default', 'directive-keyword?')),
281
+ (r'(?i)stub\b', Keyword, ('default', 'routine-name?')),
282
+ (r'(?i)trace\b', Keyword,
283
+ ('default', 'trace-keyword?', 'trace-keyword?')),
284
+ (r'(?i)zcharacter\b', Keyword,
285
+ ('default', 'directive-keyword?', 'directive-keyword?')),
286
+ (_name, Name.Class, ('object-body', '_object-head'))
287
+ ],
288
+ # [, Replace, Stub
289
+ 'routine-name?': [
290
+ include('_whitespace'),
291
+ (_name, Name.Function, '#pop'),
292
+ default('#pop')
293
+ ],
294
+ 'locals': [
295
+ include('_whitespace'),
296
+ (r';', Punctuation, '#pop'),
297
+ (r'\*', Punctuation),
298
+ (r'"', String.Double, 'plain-string'),
299
+ (_name, Name.Variable)
300
+ ],
301
+ # Array
302
+ 'many-values': [
303
+ include('_whitespace'),
304
+ (r';', Punctuation),
305
+ (r'\]', Punctuation, '#pop'),
306
+ (r':', Error),
307
+ default(('expression', '_expression'))
308
+ ],
309
+ # Attribute, Property
310
+ 'alias?': [
311
+ include('_whitespace'),
312
+ (r'alias\b', Keyword, ('#pop', '_constant')),
313
+ default('#pop')
314
+ ],
315
+ # Class, Object, Nearby
316
+ 'class-name': [
317
+ include('_whitespace'),
318
+ (r'(?=[,;]|(class|has|private|with)\b)', Text, '#pop'),
319
+ (_name, Name.Class, '#pop')
320
+ ],
321
+ 'duplicates': [
322
+ include('_whitespace'),
323
+ (r'\(', Punctuation, ('#pop', 'expression', '_expression')),
324
+ default('#pop')
325
+ ],
326
+ '_object-head': [
327
+ (rf'[{_dash}]>', Punctuation),
328
+ (r'(class|has|private|with)\b', Keyword.Declaration, '#pop'),
329
+ include('_global')
330
+ ],
331
+ 'object-body': [
332
+ include('_whitespace'),
333
+ (r';', Punctuation, '#pop:2'),
334
+ (r',', Punctuation),
335
+ (r'class\b', Keyword.Declaration, 'class-segment'),
336
+ (r'(has|private|with)\b', Keyword.Declaration),
337
+ (r':', Error),
338
+ default(('_object-expression', '_expression'))
339
+ ],
340
+ 'class-segment': [
341
+ include('_whitespace'),
342
+ (r'(?=[,;]|(class|has|private|with)\b)', Text, '#pop'),
343
+ (_name, Name.Class),
344
+ default('value')
345
+ ],
346
+ # Extend, Verb
347
+ 'grammar': [
348
+ include('_whitespace'),
349
+ (r'=', Punctuation, ('#pop', 'default')),
350
+ (r'\*', Punctuation, ('#pop', 'grammar-line')),
351
+ default('_directive-keyword')
352
+ ],
353
+ 'grammar-line': [
354
+ include('_whitespace'),
355
+ (r';', Punctuation, '#pop'),
356
+ (r'[/*]', Punctuation),
357
+ (rf'[{_dash}]>', Punctuation, 'value'),
358
+ (r'(noun|scope)\b', Keyword, '=routine'),
359
+ default('_directive-keyword')
360
+ ],
361
+ '=routine': [
362
+ include('_whitespace'),
363
+ (r'=', Punctuation, 'routine-name?'),
364
+ default('#pop')
365
+ ],
366
+ # Import
367
+ 'manifest': [
368
+ include('_whitespace'),
369
+ (r';', Punctuation, '#pop'),
370
+ (r',', Punctuation),
371
+ (r'(?i)global\b', Keyword, '_global'),
372
+ default('_global')
373
+ ],
374
+ # Include, Link, Message
375
+ 'diagnostic': [
376
+ include('_whitespace'),
377
+ (rf'[{_dquote}]', String.Double, ('#pop', 'message-string')),
378
+ default(('#pop', 'before-plain-string?', 'directive-keyword?'))
379
+ ],
380
+ 'before-plain-string?': [
381
+ include('_whitespace'),
382
+ (rf'[{_dquote}]', String.Double, ('#pop', 'plain-string')),
383
+ default('#pop')
384
+ ],
385
+ 'message-string': [
386
+ (r'[~^]+', String.Escape),
387
+ include('plain-string')
388
+ ],
389
+
390
+ # Keywords used in directives
391
+ '_directive-keyword!': [
392
+ include('_whitespace'),
393
+ (words((
394
+ 'additive', 'alias', 'buffer', 'class', 'creature', 'data', 'error', 'fatalerror',
395
+ 'first', 'has', 'held', 'individual', 'initial', 'initstr', 'last', 'long', 'meta',
396
+ 'multi', 'multiexcept', 'multiheld', 'multiinside', 'noun', 'number', 'only',
397
+ 'private', 'replace', 'reverse', 'scope', 'score', 'special', 'string', 'table',
398
+ 'terminating', 'time', 'topic', 'warning', 'with'), suffix=r'\b'),
399
+ Keyword, '#pop'),
400
+ (r'static\b', Keyword),
401
+ (rf'[{_dash}]{{1,2}}>|[+=]', Punctuation, '#pop')
402
+ ],
403
+ '_directive-keyword': [
404
+ include('_directive-keyword!'),
405
+ include('value')
406
+ ],
407
+ 'directive-keyword?': [
408
+ include('_directive-keyword!'),
409
+ default('#pop')
410
+ ],
411
+ 'property-keyword*': [
412
+ include('_whitespace'),
413
+ (words(('additive', 'individual', 'long'),
414
+ suffix=rf'\b(?=(\s*|(![^{_newline}]*[{_newline}]))*[_a-zA-Z])'),
415
+ Keyword),
416
+ default('#pop')
417
+ ],
418
+ 'trace-keyword?': [
419
+ include('_whitespace'),
420
+ (words((
421
+ 'assembly', 'dictionary', 'expressions', 'lines', 'linker',
422
+ 'objects', 'off', 'on', 'symbols', 'tokens', 'verbs'), suffix=r'\b'),
423
+ Keyword, '#pop'),
424
+ default('#pop')
425
+ ],
426
+
427
+ # Statements
428
+ 'statements': [
429
+ include('_whitespace'),
430
+ (r'\]', Punctuation, '#pop'),
431
+ (r'[;{}]', Punctuation),
432
+ (words((
433
+ 'box', 'break', 'continue', 'default', 'give', 'inversion',
434
+ 'new_line', 'quit', 'read', 'remove', 'return', 'rfalse', 'rtrue',
435
+ 'spaces', 'string', 'until'), suffix=r'\b'),
436
+ Keyword, 'default'),
437
+ (r'(do|else)\b', Keyword),
438
+ (r'(font|style)\b', Keyword,
439
+ ('default', 'miscellaneous-keyword?')),
440
+ (r'for\b', Keyword, ('for', '(?')),
441
+ (r'(if|switch|while)', Keyword,
442
+ ('expression', '_expression', '(?')),
443
+ (r'(jump|save|restore)\b', Keyword, ('default', 'label?')),
444
+ (r'objectloop\b', Keyword,
445
+ ('_keyword-expression', 'variable?', '(?')),
446
+ (rf'print(_ret)?\b|(?=[{_dquote}])', Keyword, 'print-list'),
447
+ (r'\.', Name.Label, 'label?'),
448
+ (r'@', Keyword, 'opcode'),
449
+ (r'#(?![agrnw]\$|#)', Punctuation, 'directive'),
450
+ (r'<', Punctuation, 'default'),
451
+ (r'move\b', Keyword,
452
+ ('default', '_keyword-expression', '_expression')),
453
+ default(('default', '_keyword-expression', '_expression'))
454
+ ],
455
+ 'miscellaneous-keyword?': [
456
+ include('_whitespace'),
457
+ (r'(bold|fixed|from|near|off|on|reverse|roman|to|underline)\b',
458
+ Keyword, '#pop'),
459
+ (r'(a|A|an|address|char|name|number|object|property|string|the|'
460
+ rf'The)\b(?=(\s+|(![^{_newline}]*))*\))', Keyword.Pseudo,
461
+ '#pop'),
462
+ (rf'{_name}(?=(\s+|(![^{_newline}]*))*\))', Name.Function,
463
+ '#pop'),
464
+ default('#pop')
465
+ ],
466
+ '(?': [
467
+ include('_whitespace'),
468
+ (r'\(', Punctuation, '#pop'),
469
+ default('#pop')
470
+ ],
471
+ 'for': [
472
+ include('_whitespace'),
473
+ (r';', Punctuation, ('_for-expression', '_expression')),
474
+ default(('_for-expression', '_expression'))
475
+ ],
476
+ 'print-list': [
477
+ include('_whitespace'),
478
+ (r';', Punctuation, '#pop'),
479
+ (r':', Error),
480
+ default(('_list-expression', '_expression', '_list-expression', 'form'))
481
+ ],
482
+ 'form': [
483
+ include('_whitespace'),
484
+ (r'\(', Punctuation, ('#pop', 'miscellaneous-keyword?')),
485
+ default('#pop')
486
+ ],
487
+
488
+ # Assembly
489
+ 'opcode': [
490
+ include('_whitespace'),
491
+ (rf'[{_dquote}]', String.Double, ('operands', 'plain-string')),
492
+ (rf'[{_dash}]{{1,2}}>', Punctuation, 'operands'),
493
+ (_name, Keyword, 'operands')
494
+ ],
495
+ 'operands': [
496
+ (r':', Error),
497
+ default(('_assembly-expression', '_expression'))
498
+ ]
499
+ }
500
+
501
+ def get_tokens_unprocessed(self, text):
502
+ # 'in' is either a keyword or an operator.
503
+ # If the token two tokens after 'in' is ')', 'in' is a keyword:
504
+ # objectloop(a in b)
505
+ # Otherwise, it is an operator:
506
+ # objectloop(a in b && true)
507
+ objectloop_queue = []
508
+ objectloop_token_count = -1
509
+ previous_token = None
510
+ for index, token, value in RegexLexer.get_tokens_unprocessed(self,
511
+ text):
512
+ if previous_token is Name.Variable and value == 'in':
513
+ objectloop_queue = [[index, token, value]]
514
+ objectloop_token_count = 2
515
+ elif objectloop_token_count > 0:
516
+ if token not in Comment and token not in Text:
517
+ objectloop_token_count -= 1
518
+ objectloop_queue.append((index, token, value))
519
+ else:
520
+ if objectloop_token_count == 0:
521
+ if objectloop_queue[-1][2] == ')':
522
+ objectloop_queue[0][1] = Keyword
523
+ while objectloop_queue:
524
+ yield objectloop_queue.pop(0)
525
+ objectloop_token_count = -1
526
+ yield index, token, value
527
+ if token not in Comment and token not in Text:
528
+ previous_token = token
529
+ while objectloop_queue:
530
+ yield objectloop_queue.pop(0)
531
+
532
+ def analyse_text(text):
533
+ """We try to find a keyword which seem relatively common, unfortunately
534
+ there is a decent overlap with Smalltalk keywords otherwise here.."""
535
+ result = 0
536
+ if re.search('\borigsource\b', text, re.IGNORECASE):
537
+ result += 0.05
538
+
539
+ return result
540
+
541
+
542
+ class Inform7Lexer(RegexLexer):
543
+ """
544
+ For Inform 7 source code.
545
+ """
546
+
547
+ name = 'Inform 7'
548
+ url = 'http://inform7.com/'
549
+ aliases = ['inform7', 'i7']
550
+ filenames = ['*.ni', '*.i7x']
551
+ version_added = '2.0'
552
+
553
+ flags = re.MULTILINE | re.DOTALL
554
+
555
+ _dash = Inform6Lexer._dash
556
+ _dquote = Inform6Lexer._dquote
557
+ _newline = Inform6Lexer._newline
558
+ _start = rf'\A|(?<=[{_newline}])'
559
+
560
+ # There are three variants of Inform 7, differing in how to
561
+ # interpret at signs and braces in I6T. In top-level inclusions, at
562
+ # signs in the first column are inweb syntax. In phrase definitions
563
+ # and use options, tokens in braces are treated as I7. Use options
564
+ # also interpret "{N}".
565
+ tokens = {}
566
+ token_variants = ['+i6t-not-inline', '+i6t-inline', '+i6t-use-option']
567
+
568
+ for level in token_variants:
569
+ tokens[level] = {
570
+ '+i6-root': list(Inform6Lexer.tokens['root']),
571
+ '+i6t-root': [ # For Inform6TemplateLexer
572
+ (rf'[^{Inform6Lexer._newline}]*', Comment.Preproc,
573
+ ('directive', '+p'))
574
+ ],
575
+ 'root': [
576
+ (r'(\|?\s)+', Text),
577
+ (r'\[', Comment.Multiline, '+comment'),
578
+ (rf'[{_dquote}]', Generic.Heading,
579
+ ('+main', '+titling', '+titling-string')),
580
+ default(('+main', '+heading?'))
581
+ ],
582
+ '+titling-string': [
583
+ (rf'[^{_dquote}]+', Generic.Heading),
584
+ (rf'[{_dquote}]', Generic.Heading, '#pop')
585
+ ],
586
+ '+titling': [
587
+ (r'\[', Comment.Multiline, '+comment'),
588
+ (rf'[^{_dquote}.;:|{_newline}]+', Generic.Heading),
589
+ (rf'[{_dquote}]', Generic.Heading, '+titling-string'),
590
+ (rf'[{_newline}]{{2}}|(?<=[\s{_dquote}])\|[\s{_dquote}]',
591
+ Text, ('#pop', '+heading?')),
592
+ (rf'[.;:]|(?<=[\s{_dquote}])\|', Text, '#pop'),
593
+ (rf'[|{_newline}]', Generic.Heading)
594
+ ],
595
+ '+main': [
596
+ (rf'(?i)[^{_dquote}:a\[(|{_newline}]+', Text),
597
+ (rf'[{_dquote}]', String.Double, '+text'),
598
+ (r':', Text, '+phrase-definition'),
599
+ (r'(?i)\bas\b', Text, '+use-option'),
600
+ (r'\[', Comment.Multiline, '+comment'),
601
+ (rf'(\([{_dash}])(.*?)([{_dash}]\))',
602
+ bygroups(Punctuation,
603
+ using(this, state=('+i6-root', 'directive'),
604
+ i6t='+i6t-not-inline'), Punctuation)),
605
+ (rf'({_start}|(?<=[\s;:.{_dquote}]))\|\s|[{_newline}]{{2,}}', Text, '+heading?'),
606
+ (rf'(?i)[a(|{_newline}]', Text)
607
+ ],
608
+ '+phrase-definition': [
609
+ (r'\s+', Text),
610
+ (r'\[', Comment.Multiline, '+comment'),
611
+ (rf'(\([{_dash}])(.*?)([{_dash}]\))',
612
+ bygroups(Punctuation,
613
+ using(this, state=('+i6-root', 'directive',
614
+ 'default', 'statements'),
615
+ i6t='+i6t-inline'), Punctuation), '#pop'),
616
+ default('#pop')
617
+ ],
618
+ '+use-option': [
619
+ (r'\s+', Text),
620
+ (r'\[', Comment.Multiline, '+comment'),
621
+ (rf'(\([{_dash}])(.*?)([{_dash}]\))',
622
+ bygroups(Punctuation,
623
+ using(this, state=('+i6-root', 'directive'),
624
+ i6t='+i6t-use-option'), Punctuation), '#pop'),
625
+ default('#pop')
626
+ ],
627
+ '+comment': [
628
+ (r'[^\[\]]+', Comment.Multiline),
629
+ (r'\[', Comment.Multiline, '#push'),
630
+ (r'\]', Comment.Multiline, '#pop')
631
+ ],
632
+ '+text': [
633
+ (rf'[^\[{_dquote}]+', String.Double),
634
+ (r'\[.*?\]', String.Interpol),
635
+ (rf'[{_dquote}]', String.Double, '#pop')
636
+ ],
637
+ '+heading?': [
638
+ (r'(\|?\s)+', Text),
639
+ (r'\[', Comment.Multiline, '+comment'),
640
+ (rf'[{_dash}]{{4}}\s+', Text, '+documentation-heading'),
641
+ (rf'[{_dash}]{{1,3}}', Text),
642
+ (rf'(?i)(volume|book|part|chapter|section)\b[^{_newline}]*',
643
+ Generic.Heading, '#pop'),
644
+ default('#pop')
645
+ ],
646
+ '+documentation-heading': [
647
+ (r'\s+', Text),
648
+ (r'\[', Comment.Multiline, '+comment'),
649
+ (r'(?i)documentation\s+', Text, '+documentation-heading2'),
650
+ default('#pop')
651
+ ],
652
+ '+documentation-heading2': [
653
+ (r'\s+', Text),
654
+ (r'\[', Comment.Multiline, '+comment'),
655
+ (rf'[{_dash}]{{4}}\s', Text, '+documentation'),
656
+ default('#pop:2')
657
+ ],
658
+ '+documentation': [
659
+ (rf'(?i)({_start})\s*(chapter|example)\s*:[^{_newline}]*', Generic.Heading),
660
+ (rf'(?i)({_start})\s*section\s*:[^{_newline}]*',
661
+ Generic.Subheading),
662
+ (rf'(({_start})\t.*?[{_newline}])+',
663
+ using(this, state='+main')),
664
+ (rf'[^{_newline}\[]+|[{_newline}\[]', Text),
665
+ (r'\[', Comment.Multiline, '+comment'),
666
+ ],
667
+ '+i6t-not-inline': [
668
+ (rf'({_start})@c( .*?)?([{_newline}]|\Z)',
669
+ Comment.Preproc),
670
+ (rf'({_start})@([{_dash}]+|Purpose:)[^{_newline}]*',
671
+ Comment.Preproc),
672
+ (rf'({_start})@p( .*?)?([{_newline}]|\Z)',
673
+ Generic.Heading, '+p')
674
+ ],
675
+ '+i6t-use-option': [
676
+ include('+i6t-not-inline'),
677
+ (r'(\{)(N)(\})', bygroups(Punctuation, Text, Punctuation))
678
+ ],
679
+ '+i6t-inline': [
680
+ (r'(\{)(\S[^}]*)?(\})',
681
+ bygroups(Punctuation, using(this, state='+main'),
682
+ Punctuation))
683
+ ],
684
+ '+i6t': [
685
+ (rf'(\{{[{_dash}])(![^}}]*)(\}}?)',
686
+ bygroups(Punctuation, Comment.Single, Punctuation)),
687
+ (rf'(\{{[{_dash}])(lines)(:)([^}}]*)(\}}?)',
688
+ bygroups(Punctuation, Keyword, Punctuation, Text,
689
+ Punctuation), '+lines'),
690
+ (rf'(\{{[{_dash}])([^:}}]*)(:?)([^}}]*)(\}}?)',
691
+ bygroups(Punctuation, Keyword, Punctuation, Text,
692
+ Punctuation)),
693
+ (r'(\(\+)(.*?)(\+\)|\Z)',
694
+ bygroups(Punctuation, using(this, state='+main'),
695
+ Punctuation))
696
+ ],
697
+ '+p': [
698
+ (r'[^@]+', Comment.Preproc),
699
+ (rf'({_start})@c( .*?)?([{_newline}]|\Z)',
700
+ Comment.Preproc, '#pop'),
701
+ (rf'({_start})@([{_dash}]|Purpose:)', Comment.Preproc),
702
+ (rf'({_start})@p( .*?)?([{_newline}]|\Z)',
703
+ Generic.Heading),
704
+ (r'@', Comment.Preproc)
705
+ ],
706
+ '+lines': [
707
+ (rf'({_start})@c( .*?)?([{_newline}]|\Z)',
708
+ Comment.Preproc),
709
+ (rf'({_start})@([{_dash}]|Purpose:)[^{_newline}]*',
710
+ Comment.Preproc),
711
+ (rf'({_start})@p( .*?)?([{_newline}]|\Z)',
712
+ Generic.Heading, '+p'),
713
+ (rf'({_start})@\w*[ {_newline}]', Keyword),
714
+ (rf'![^{_newline}]*', Comment.Single),
715
+ (rf'(\{{)([{_dash}]endlines)(\}})',
716
+ bygroups(Punctuation, Keyword, Punctuation), '#pop'),
717
+ (rf'[^@!{{]+?([{_newline}]|\Z)|.', Text)
718
+ ]
719
+ }
720
+ # Inform 7 can include snippets of Inform 6 template language,
721
+ # so all of Inform6Lexer's states are copied here, with
722
+ # modifications to account for template syntax. Inform7Lexer's
723
+ # own states begin with '+' to avoid name conflicts. Some of
724
+ # Inform6Lexer's states begin with '_': these are not modified.
725
+ # They deal with template syntax either by including modified
726
+ # states, or by matching r'' then pushing to modified states.
727
+ for token in Inform6Lexer.tokens:
728
+ if token == 'root':
729
+ continue
730
+ tokens[level][token] = list(Inform6Lexer.tokens[token])
731
+ if not token.startswith('_'):
732
+ tokens[level][token][:0] = [include('+i6t'), include(level)]
733
+
734
+ def __init__(self, **options):
735
+ level = options.get('i6t', '+i6t-not-inline')
736
+ if level not in self._all_tokens:
737
+ self._tokens = self.__class__.process_tokendef(level)
738
+ else:
739
+ self._tokens = self._all_tokens[level]
740
+ RegexLexer.__init__(self, **options)
741
+
742
+
743
+ class Inform6TemplateLexer(Inform7Lexer):
744
+ """
745
+ For Inform 6 template code.
746
+ """
747
+
748
+ name = 'Inform 6 template'
749
+ aliases = ['i6t']
750
+ filenames = ['*.i6t']
751
+ version_added = '2.0'
752
+
753
+ def get_tokens_unprocessed(self, text, stack=('+i6t-root',)):
754
+ return Inform7Lexer.get_tokens_unprocessed(self, text, stack)
755
+
756
+
757
+ class Tads3Lexer(RegexLexer):
758
+ """
759
+ For TADS 3 source code.
760
+ """
761
+
762
+ name = 'TADS 3'
763
+ aliases = ['tads3']
764
+ filenames = ['*.t']
765
+ url = 'https://www.tads.org'
766
+ version_added = ''
767
+
768
+ flags = re.DOTALL | re.MULTILINE
769
+
770
+ _comment_single = r'(?://(?:[^\\\n]|\\+[\w\W])*$)'
771
+ _comment_multiline = r'(?:/\*(?:[^*]|\*(?!/))*\*/)'
772
+ _escape = (r'(?:\\(?:[\n\\<>"\'^v bnrt]|u[\da-fA-F]{,4}|x[\da-fA-F]{,2}|'
773
+ r'[0-3]?[0-7]{1,2}))')
774
+ _name = r'(?:[_a-zA-Z]\w*)'
775
+ _no_quote = r'(?=\s|\\?>)'
776
+ _operator = (r'(?:&&|\|\||\+\+|--|\?\?|::|[.,@\[\]~]|'
777
+ r'(?:[=+\-*/%!&|^]|<<?|>>?>?)=?)')
778
+ _ws = rf'(?:\\|\s|{_comment_single}|{_comment_multiline})'
779
+ _ws_pp = rf'(?:\\\n|[^\S\n]|{_comment_single}|{_comment_multiline})'
780
+
781
+ def _make_string_state(triple, double, verbatim=None, _escape=_escape):
782
+ if verbatim:
783
+ verbatim = ''.join([f'(?:{re.escape(c.lower())}|{re.escape(c.upper())})'
784
+ for c in verbatim])
785
+ char = r'"' if double else r"'"
786
+ token = String.Double if double else String.Single
787
+ escaped_quotes = rf'+|{char}(?!{char}{{2}})' if triple else r''
788
+ prefix = '{}{}'.format('t' if triple else '', 'd' if double else 's')
789
+ tag_state_name = f'{prefix}qt'
790
+ state = []
791
+ if triple:
792
+ state += [
793
+ (rf'{char}{{3,}}', token, '#pop'),
794
+ (rf'\\{char}+', String.Escape),
795
+ (char, token)
796
+ ]
797
+ else:
798
+ state.append((char, token, '#pop'))
799
+ state += [
800
+ include('s/verbatim'),
801
+ (rf'[^\\<&{{}}{char}]+', token)
802
+ ]
803
+ if verbatim:
804
+ # This regex can't use `(?i)` because escape sequences are
805
+ # case-sensitive. `<\XMP>` works; `<\xmp>` doesn't.
806
+ state.append((rf'\\?<(/|\\\\|(?!{_escape})\\){verbatim}(?=[\s=>])',
807
+ Name.Tag, ('#pop', f'{prefix}qs', tag_state_name)))
808
+ else:
809
+ state += [
810
+ (rf'\\?<!([^><\\{char}]|<(?!<)|\\{char}{escaped_quotes}|{_escape}|\\.)*>?', Comment.Multiline),
811
+ (r'(?i)\\?<listing(?=[\s=>]|\\>)', Name.Tag,
812
+ ('#pop', f'{prefix}qs/listing', tag_state_name)),
813
+ (r'(?i)\\?<xmp(?=[\s=>]|\\>)', Name.Tag,
814
+ ('#pop', f'{prefix}qs/xmp', tag_state_name)),
815
+ (rf'\\?<([^\s=><\\{char}]|<(?!<)|\\{char}{escaped_quotes}|{_escape}|\\.)*', Name.Tag,
816
+ tag_state_name),
817
+ include('s/entity')
818
+ ]
819
+ state += [
820
+ include('s/escape'),
821
+ (rf'\{{([^}}<\\{char}]|<(?!<)|\\{char}{escaped_quotes}|{_escape}|\\.)*\}}', String.Interpol),
822
+ (r'[\\&{}<]', token)
823
+ ]
824
+ return state
825
+
826
+ def _make_tag_state(triple, double, _escape=_escape):
827
+ char = r'"' if double else r"'"
828
+ quantifier = r'{3,}' if triple else r''
829
+ state_name = '{}{}qt'.format('t' if triple else '', 'd' if double else 's')
830
+ token = String.Double if double else String.Single
831
+ escaped_quotes = rf'+|{char}(?!{char}{{2}})' if triple else r''
832
+ return [
833
+ (rf'{char}{quantifier}', token, '#pop:2'),
834
+ (r'(\s|\\\n)+', Text),
835
+ (r'(=)(\\?")', bygroups(Punctuation, String.Double),
836
+ f'dqs/{state_name}'),
837
+ (r"(=)(\\?')", bygroups(Punctuation, String.Single),
838
+ f'sqs/{state_name}'),
839
+ (r'=', Punctuation, f'uqs/{state_name}'),
840
+ (r'\\?>', Name.Tag, '#pop'),
841
+ (rf'\{{([^}}<\\{char}]|<(?!<)|\\{char}{escaped_quotes}|{_escape}|\\.)*\}}', String.Interpol),
842
+ (rf'([^\s=><\\{char}]|<(?!<)|\\{char}{escaped_quotes}|{_escape}|\\.)+', Name.Attribute),
843
+ include('s/escape'),
844
+ include('s/verbatim'),
845
+ include('s/entity'),
846
+ (r'[\\{}&]', Name.Attribute)
847
+ ]
848
+
849
+ def _make_attribute_value_state(terminator, host_triple, host_double,
850
+ _escape=_escape):
851
+ token = (String.Double if terminator == r'"' else
852
+ String.Single if terminator == r"'" else String.Other)
853
+ host_char = r'"' if host_double else r"'"
854
+ host_quantifier = r'{3,}' if host_triple else r''
855
+ host_token = String.Double if host_double else String.Single
856
+ escaped_quotes = (rf'+|{host_char}(?!{host_char}{{2}})'
857
+ if host_triple else r'')
858
+ return [
859
+ (rf'{host_char}{host_quantifier}', host_token, '#pop:3'),
860
+ (r'{}{}'.format(r'' if token is String.Other else r'\\?', terminator),
861
+ token, '#pop'),
862
+ include('s/verbatim'),
863
+ include('s/entity'),
864
+ (rf'\{{([^}}<\\{host_char}]|<(?!<)|\\{host_char}{escaped_quotes}|{_escape}|\\.)*\}}', String.Interpol),
865
+ (r'([^\s"\'<%s{}\\&])+' % (r'>' if token is String.Other else r''),
866
+ token),
867
+ include('s/escape'),
868
+ (r'["\'\s&{<}\\]', token)
869
+ ]
870
+
871
+ tokens = {
872
+ 'root': [
873
+ ('\ufeff', Text),
874
+ (r'\{', Punctuation, 'object-body'),
875
+ (r';+', Punctuation),
876
+ (r'(?=(argcount|break|case|catch|continue|default|definingobj|'
877
+ r'delegated|do|else|for|foreach|finally|goto|if|inherited|'
878
+ r'invokee|local|nil|new|operator|replaced|return|self|switch|'
879
+ r'targetobj|targetprop|throw|true|try|while)\b)', Text, 'block'),
880
+ (rf'({_name})({_ws}*)(\()',
881
+ bygroups(Name.Function, using(this, state='whitespace'),
882
+ Punctuation),
883
+ ('block?/root', 'more/parameters', 'main/parameters')),
884
+ include('whitespace'),
885
+ (r'\++', Punctuation),
886
+ (r'[^\s!"%-(*->@-_a-z{-~]+', Error), # Averts an infinite loop
887
+ (r'(?!\Z)', Text, 'main/root')
888
+ ],
889
+ 'main/root': [
890
+ include('main/basic'),
891
+ default(('#pop', 'object-body/no-braces', 'classes', 'class'))
892
+ ],
893
+ 'object-body/no-braces': [
894
+ (r';', Punctuation, '#pop'),
895
+ (r'\{', Punctuation, ('#pop', 'object-body')),
896
+ include('object-body')
897
+ ],
898
+ 'object-body': [
899
+ (r';', Punctuation),
900
+ (r'\{', Punctuation, '#push'),
901
+ (r'\}', Punctuation, '#pop'),
902
+ (r':', Punctuation, ('classes', 'class')),
903
+ (rf'({_name}?)({_ws}*)(\()',
904
+ bygroups(Name.Function, using(this, state='whitespace'),
905
+ Punctuation),
906
+ ('block?', 'more/parameters', 'main/parameters')),
907
+ (rf'({_name})({_ws}*)(\{{)',
908
+ bygroups(Name.Function, using(this, state='whitespace'),
909
+ Punctuation), 'block'),
910
+ (rf'({_name})({_ws}*)(:)',
911
+ bygroups(Name.Variable, using(this, state='whitespace'),
912
+ Punctuation),
913
+ ('object-body/no-braces', 'classes', 'class')),
914
+ include('whitespace'),
915
+ (rf'->|{_operator}', Punctuation, 'main'),
916
+ default('main/object-body')
917
+ ],
918
+ 'main/object-body': [
919
+ include('main/basic'),
920
+ (rf'({_name})({_ws}*)(=?)',
921
+ bygroups(Name.Variable, using(this, state='whitespace'),
922
+ Punctuation), ('#pop', 'more', 'main')),
923
+ default('#pop:2')
924
+ ],
925
+ 'block?/root': [
926
+ (r'\{', Punctuation, ('#pop', 'block')),
927
+ include('whitespace'),
928
+ (r'(?=[\[\'"<(:])', Text, # It might be a VerbRule macro.
929
+ ('#pop', 'object-body/no-braces', 'grammar', 'grammar-rules')),
930
+ # It might be a macro like DefineAction.
931
+ default(('#pop', 'object-body/no-braces'))
932
+ ],
933
+ 'block?': [
934
+ (r'\{', Punctuation, ('#pop', 'block')),
935
+ include('whitespace'),
936
+ default('#pop')
937
+ ],
938
+ 'block/basic': [
939
+ (r'[;:]+', Punctuation),
940
+ (r'\{', Punctuation, '#push'),
941
+ (r'\}', Punctuation, '#pop'),
942
+ (r'default\b', Keyword.Reserved),
943
+ (rf'({_name})({_ws}*)(:)',
944
+ bygroups(Name.Label, using(this, state='whitespace'),
945
+ Punctuation)),
946
+ include('whitespace')
947
+ ],
948
+ 'block': [
949
+ include('block/basic'),
950
+ (r'(?!\Z)', Text, ('more', 'main'))
951
+ ],
952
+ 'block/embed': [
953
+ (r'>>', String.Interpol, '#pop'),
954
+ include('block/basic'),
955
+ (r'(?!\Z)', Text, ('more/embed', 'main'))
956
+ ],
957
+ 'main/basic': [
958
+ include('whitespace'),
959
+ (r'\(', Punctuation, ('#pop', 'more', 'main')),
960
+ (r'\[', Punctuation, ('#pop', 'more/list', 'main')),
961
+ (r'\{', Punctuation, ('#pop', 'more/inner', 'main/inner',
962
+ 'more/parameters', 'main/parameters')),
963
+ (r'\*|\.{3}', Punctuation, '#pop'),
964
+ (r'(?i)0x[\da-f]+', Number.Hex, '#pop'),
965
+ (r'(\d+\.(?!\.)\d*|\.\d+)([eE][-+]?\d+)?|\d+[eE][-+]?\d+',
966
+ Number.Float, '#pop'),
967
+ (r'0[0-7]+', Number.Oct, '#pop'),
968
+ (r'\d+', Number.Integer, '#pop'),
969
+ (r'"""', String.Double, ('#pop', 'tdqs')),
970
+ (r"'''", String.Single, ('#pop', 'tsqs')),
971
+ (r'"', String.Double, ('#pop', 'dqs')),
972
+ (r"'", String.Single, ('#pop', 'sqs')),
973
+ (r'R"""', String.Regex, ('#pop', 'tdqr')),
974
+ (r"R'''", String.Regex, ('#pop', 'tsqr')),
975
+ (r'R"', String.Regex, ('#pop', 'dqr')),
976
+ (r"R'", String.Regex, ('#pop', 'sqr')),
977
+ # Two-token keywords
978
+ (rf'(extern)({_ws}+)(object\b)',
979
+ bygroups(Keyword.Reserved, using(this, state='whitespace'),
980
+ Keyword.Reserved)),
981
+ (rf'(function|method)({_ws}*)(\()',
982
+ bygroups(Keyword.Reserved, using(this, state='whitespace'),
983
+ Punctuation),
984
+ ('#pop', 'block?', 'more/parameters', 'main/parameters')),
985
+ (rf'(modify)({_ws}+)(grammar\b)',
986
+ bygroups(Keyword.Reserved, using(this, state='whitespace'),
987
+ Keyword.Reserved),
988
+ ('#pop', 'object-body/no-braces', ':', 'grammar')),
989
+ (rf'(new)({_ws}+(?=(?:function|method)\b))',
990
+ bygroups(Keyword.Reserved, using(this, state='whitespace'))),
991
+ (rf'(object)({_ws}+)(template\b)',
992
+ bygroups(Keyword.Reserved, using(this, state='whitespace'),
993
+ Keyword.Reserved), ('#pop', 'template')),
994
+ (rf'(string)({_ws}+)(template\b)',
995
+ bygroups(Keyword, using(this, state='whitespace'),
996
+ Keyword.Reserved), ('#pop', 'function-name')),
997
+ # Keywords
998
+ (r'(argcount|definingobj|invokee|replaced|targetobj|targetprop)\b',
999
+ Name.Builtin, '#pop'),
1000
+ (r'(break|continue|goto)\b', Keyword.Reserved, ('#pop', 'label')),
1001
+ (r'(case|extern|if|intrinsic|return|static|while)\b',
1002
+ Keyword.Reserved),
1003
+ (r'catch\b', Keyword.Reserved, ('#pop', 'catch')),
1004
+ (r'class\b', Keyword.Reserved,
1005
+ ('#pop', 'object-body/no-braces', 'class')),
1006
+ (r'(default|do|else|finally|try)\b', Keyword.Reserved, '#pop'),
1007
+ (r'(dictionary|property)\b', Keyword.Reserved,
1008
+ ('#pop', 'constants')),
1009
+ (r'enum\b', Keyword.Reserved, ('#pop', 'enum')),
1010
+ (r'export\b', Keyword.Reserved, ('#pop', 'main')),
1011
+ (r'(for|foreach)\b', Keyword.Reserved,
1012
+ ('#pop', 'more/inner', 'main/inner')),
1013
+ (r'(function|method)\b', Keyword.Reserved,
1014
+ ('#pop', 'block?', 'function-name')),
1015
+ (r'grammar\b', Keyword.Reserved,
1016
+ ('#pop', 'object-body/no-braces', 'grammar')),
1017
+ (r'inherited\b', Keyword.Reserved, ('#pop', 'inherited')),
1018
+ (r'local\b', Keyword.Reserved,
1019
+ ('#pop', 'more/local', 'main/local')),
1020
+ (r'(modify|replace|switch|throw|transient)\b', Keyword.Reserved,
1021
+ '#pop'),
1022
+ (r'new\b', Keyword.Reserved, ('#pop', 'class')),
1023
+ (r'(nil|true)\b', Keyword.Constant, '#pop'),
1024
+ (r'object\b', Keyword.Reserved, ('#pop', 'object-body/no-braces')),
1025
+ (r'operator\b', Keyword.Reserved, ('#pop', 'operator')),
1026
+ (r'propertyset\b', Keyword.Reserved,
1027
+ ('#pop', 'propertyset', 'main')),
1028
+ (r'self\b', Name.Builtin.Pseudo, '#pop'),
1029
+ (r'template\b', Keyword.Reserved, ('#pop', 'template')),
1030
+ # Operators
1031
+ (rf'(__objref|defined)({_ws}*)(\()',
1032
+ bygroups(Operator.Word, using(this, state='whitespace'),
1033
+ Operator), ('#pop', 'more/__objref', 'main')),
1034
+ (r'delegated\b', Operator.Word),
1035
+ # Compiler-defined macros and built-in properties
1036
+ (r'(__DATE__|__DEBUG|__LINE__|__FILE__|'
1037
+ r'__TADS_MACRO_FORMAT_VERSION|__TADS_SYS_\w*|__TADS_SYSTEM_NAME|'
1038
+ r'__TADS_VERSION_MAJOR|__TADS_VERSION_MINOR|__TADS3|__TIME__|'
1039
+ r'construct|finalize|grammarInfo|grammarTag|lexicalParent|'
1040
+ r'miscVocab|sourceTextGroup|sourceTextGroupName|'
1041
+ r'sourceTextGroupOrder|sourceTextOrder)\b', Name.Builtin, '#pop')
1042
+ ],
1043
+ 'main': [
1044
+ include('main/basic'),
1045
+ (_name, Name, '#pop'),
1046
+ default('#pop')
1047
+ ],
1048
+ 'more/basic': [
1049
+ (r'\(', Punctuation, ('more/list', 'main')),
1050
+ (r'\[', Punctuation, ('more', 'main')),
1051
+ (r'\.{3}', Punctuation),
1052
+ (r'->|\.\.', Punctuation, 'main'),
1053
+ (r'(?=;)|[:)\]]', Punctuation, '#pop'),
1054
+ include('whitespace'),
1055
+ (_operator, Operator, 'main'),
1056
+ (r'\?', Operator, ('main', 'more/conditional', 'main')),
1057
+ (rf'(is|not)({_ws}+)(in\b)',
1058
+ bygroups(Operator.Word, using(this, state='whitespace'),
1059
+ Operator.Word)),
1060
+ (r'[^\s!"%-_a-z{-~]+', Error) # Averts an infinite loop
1061
+ ],
1062
+ 'more': [
1063
+ include('more/basic'),
1064
+ default('#pop')
1065
+ ],
1066
+ # Then expression (conditional operator)
1067
+ 'more/conditional': [
1068
+ (r':(?!:)', Operator, '#pop'),
1069
+ include('more')
1070
+ ],
1071
+ # Embedded expressions
1072
+ 'more/embed': [
1073
+ (r'>>', String.Interpol, '#pop:2'),
1074
+ include('more')
1075
+ ],
1076
+ # For/foreach loop initializer or short-form anonymous function
1077
+ 'main/inner': [
1078
+ (r'\(', Punctuation, ('#pop', 'more/inner', 'main/inner')),
1079
+ (r'local\b', Keyword.Reserved, ('#pop', 'main/local')),
1080
+ include('main')
1081
+ ],
1082
+ 'more/inner': [
1083
+ (r'\}', Punctuation, '#pop'),
1084
+ (r',', Punctuation, 'main/inner'),
1085
+ (r'(in|step)\b', Keyword, 'main/inner'),
1086
+ include('more')
1087
+ ],
1088
+ # Local
1089
+ 'main/local': [
1090
+ (_name, Name.Variable, '#pop'),
1091
+ include('whitespace')
1092
+ ],
1093
+ 'more/local': [
1094
+ (r',', Punctuation, 'main/local'),
1095
+ include('more')
1096
+ ],
1097
+ # List
1098
+ 'more/list': [
1099
+ (r'[,:]', Punctuation, 'main'),
1100
+ include('more')
1101
+ ],
1102
+ # Parameter list
1103
+ 'main/parameters': [
1104
+ (rf'({_name})({_ws}*)(?=:)',
1105
+ bygroups(Name.Variable, using(this, state='whitespace')), '#pop'),
1106
+ (rf'({_name})({_ws}+)({_name})',
1107
+ bygroups(Name.Class, using(this, state='whitespace'),
1108
+ Name.Variable), '#pop'),
1109
+ (r'\[+', Punctuation),
1110
+ include('main/basic'),
1111
+ (_name, Name.Variable, '#pop'),
1112
+ default('#pop')
1113
+ ],
1114
+ 'more/parameters': [
1115
+ (rf'(:)({_ws}*(?=[?=,:)]))',
1116
+ bygroups(Punctuation, using(this, state='whitespace'))),
1117
+ (r'[?\]]+', Punctuation),
1118
+ (r'[:)]', Punctuation, ('#pop', 'multimethod?')),
1119
+ (r',', Punctuation, 'main/parameters'),
1120
+ (r'=', Punctuation, ('more/parameter', 'main')),
1121
+ include('more')
1122
+ ],
1123
+ 'more/parameter': [
1124
+ (r'(?=[,)])', Text, '#pop'),
1125
+ include('more')
1126
+ ],
1127
+ 'multimethod?': [
1128
+ (r'multimethod\b', Keyword, '#pop'),
1129
+ include('whitespace'),
1130
+ default('#pop')
1131
+ ],
1132
+
1133
+ # Statements and expressions
1134
+ 'more/__objref': [
1135
+ (r',', Punctuation, 'mode'),
1136
+ (r'\)', Operator, '#pop'),
1137
+ include('more')
1138
+ ],
1139
+ 'mode': [
1140
+ (r'(error|warn)\b', Keyword, '#pop'),
1141
+ include('whitespace')
1142
+ ],
1143
+ 'catch': [
1144
+ (r'\(+', Punctuation),
1145
+ (_name, Name.Exception, ('#pop', 'variables')),
1146
+ include('whitespace')
1147
+ ],
1148
+ 'enum': [
1149
+ include('whitespace'),
1150
+ (r'token\b', Keyword, ('#pop', 'constants')),
1151
+ default(('#pop', 'constants'))
1152
+ ],
1153
+ 'grammar': [
1154
+ (r'\)+', Punctuation),
1155
+ (r'\(', Punctuation, 'grammar-tag'),
1156
+ (r':', Punctuation, 'grammar-rules'),
1157
+ (_name, Name.Class),
1158
+ include('whitespace')
1159
+ ],
1160
+ 'grammar-tag': [
1161
+ include('whitespace'),
1162
+ (r'"""([^\\"<]|""?(?!")|\\"+|\\.|<(?!<))+("{3,}|<<)|'
1163
+ r'R"""([^\\"]|""?(?!")|\\"+|\\.)+"{3,}|'
1164
+ r"'''([^\\'<]|''?(?!')|\\'+|\\.|<(?!<))+('{3,}|<<)|"
1165
+ r"R'''([^\\']|''?(?!')|\\'+|\\.)+'{3,}|"
1166
+ r'"([^\\"<]|\\.|<(?!<))+("|<<)|R"([^\\"]|\\.)+"|'
1167
+ r"'([^\\'<]|\\.|<(?!<))+('|<<)|R'([^\\']|\\.)+'|"
1168
+ r"([^)\s\\/]|/(?![/*]))+|\)", String.Other, '#pop')
1169
+ ],
1170
+ 'grammar-rules': [
1171
+ include('string'),
1172
+ include('whitespace'),
1173
+ (rf'(\[)({_ws}*)(badness)',
1174
+ bygroups(Punctuation, using(this, state='whitespace'), Keyword),
1175
+ 'main'),
1176
+ (rf'->|{_operator}|[()]', Punctuation),
1177
+ (_name, Name.Constant),
1178
+ default('#pop:2')
1179
+ ],
1180
+ ':': [
1181
+ (r':', Punctuation, '#pop')
1182
+ ],
1183
+ 'function-name': [
1184
+ (r'(<<([^>]|>>>|>(?!>))*>>)+', String.Interpol),
1185
+ (rf'(?={_name}?{_ws}*[({{])', Text, '#pop'),
1186
+ (_name, Name.Function, '#pop'),
1187
+ include('whitespace')
1188
+ ],
1189
+ 'inherited': [
1190
+ (r'<', Punctuation, ('#pop', 'classes', 'class')),
1191
+ include('whitespace'),
1192
+ (_name, Name.Class, '#pop'),
1193
+ default('#pop')
1194
+ ],
1195
+ 'operator': [
1196
+ (r'negate\b', Operator.Word, '#pop'),
1197
+ include('whitespace'),
1198
+ (_operator, Operator),
1199
+ default('#pop')
1200
+ ],
1201
+ 'propertyset': [
1202
+ (r'\(', Punctuation, ('more/parameters', 'main/parameters')),
1203
+ (r'\{', Punctuation, ('#pop', 'object-body')),
1204
+ include('whitespace')
1205
+ ],
1206
+ 'template': [
1207
+ (r'(?=;)', Text, '#pop'),
1208
+ include('string'),
1209
+ (r'inherited\b', Keyword.Reserved),
1210
+ include('whitespace'),
1211
+ (rf'->|\?|{_operator}', Punctuation),
1212
+ (_name, Name.Variable)
1213
+ ],
1214
+
1215
+ # Identifiers
1216
+ 'class': [
1217
+ (r'\*|\.{3}', Punctuation, '#pop'),
1218
+ (r'object\b', Keyword.Reserved, '#pop'),
1219
+ (r'transient\b', Keyword.Reserved),
1220
+ (_name, Name.Class, '#pop'),
1221
+ include('whitespace'),
1222
+ default('#pop')
1223
+ ],
1224
+ 'classes': [
1225
+ (r'[:,]', Punctuation, 'class'),
1226
+ include('whitespace'),
1227
+ (r'>', Punctuation, '#pop'),
1228
+ default('#pop')
1229
+ ],
1230
+ 'constants': [
1231
+ (r',+', Punctuation),
1232
+ (r';', Punctuation, '#pop'),
1233
+ (r'property\b', Keyword.Reserved),
1234
+ (_name, Name.Constant),
1235
+ include('whitespace')
1236
+ ],
1237
+ 'label': [
1238
+ (_name, Name.Label, '#pop'),
1239
+ include('whitespace'),
1240
+ default('#pop')
1241
+ ],
1242
+ 'variables': [
1243
+ (r',+', Punctuation),
1244
+ (r'\)', Punctuation, '#pop'),
1245
+ include('whitespace'),
1246
+ (_name, Name.Variable)
1247
+ ],
1248
+
1249
+ # Whitespace and comments
1250
+ 'whitespace': [
1251
+ (rf'^{_ws_pp}*#({_comment_multiline}|[^\n]|(?<=\\)\n)*\n?',
1252
+ Comment.Preproc),
1253
+ (_comment_single, Comment.Single),
1254
+ (_comment_multiline, Comment.Multiline),
1255
+ (rf'\\+\n+{_ws_pp}*#?|\n+|([^\S\n]|\\)+', Text)
1256
+ ],
1257
+
1258
+ # Strings
1259
+ 'string': [
1260
+ (r'"""', String.Double, 'tdqs'),
1261
+ (r"'''", String.Single, 'tsqs'),
1262
+ (r'"', String.Double, 'dqs'),
1263
+ (r"'", String.Single, 'sqs')
1264
+ ],
1265
+ 's/escape': [
1266
+ (rf'\{{\{{|\}}\}}|{_escape}', String.Escape)
1267
+ ],
1268
+ 's/verbatim': [
1269
+ (r'<<\s*(as\s+decreasingly\s+likely\s+outcomes|cycling|else|end|'
1270
+ r'first\s+time|one\s+of|only|or|otherwise|'
1271
+ r'(sticky|(then\s+)?(purely\s+)?at)\s+random|stopping|'
1272
+ r'(then\s+)?(half\s+)?shuffled|\|\|)\s*>>', String.Interpol),
1273
+ (rf'<<(%(_({_escape}|\\?.)|[\-+ ,#]|\[\d*\]?)*\d*\.?\d*({_escape}|\\?.)|'
1274
+ r'\s*((else|otherwise)\s+)?(if|unless)\b)?',
1275
+ String.Interpol, ('block/embed', 'more/embed', 'main'))
1276
+ ],
1277
+ 's/entity': [
1278
+ (r'(?i)&(#(x[\da-f]+|\d+)|[a-z][\da-z]*);?', Name.Entity)
1279
+ ],
1280
+ 'tdqs': _make_string_state(True, True),
1281
+ 'tsqs': _make_string_state(True, False),
1282
+ 'dqs': _make_string_state(False, True),
1283
+ 'sqs': _make_string_state(False, False),
1284
+ 'tdqs/listing': _make_string_state(True, True, 'listing'),
1285
+ 'tsqs/listing': _make_string_state(True, False, 'listing'),
1286
+ 'dqs/listing': _make_string_state(False, True, 'listing'),
1287
+ 'sqs/listing': _make_string_state(False, False, 'listing'),
1288
+ 'tdqs/xmp': _make_string_state(True, True, 'xmp'),
1289
+ 'tsqs/xmp': _make_string_state(True, False, 'xmp'),
1290
+ 'dqs/xmp': _make_string_state(False, True, 'xmp'),
1291
+ 'sqs/xmp': _make_string_state(False, False, 'xmp'),
1292
+
1293
+ # Tags
1294
+ 'tdqt': _make_tag_state(True, True),
1295
+ 'tsqt': _make_tag_state(True, False),
1296
+ 'dqt': _make_tag_state(False, True),
1297
+ 'sqt': _make_tag_state(False, False),
1298
+ 'dqs/tdqt': _make_attribute_value_state(r'"', True, True),
1299
+ 'dqs/tsqt': _make_attribute_value_state(r'"', True, False),
1300
+ 'dqs/dqt': _make_attribute_value_state(r'"', False, True),
1301
+ 'dqs/sqt': _make_attribute_value_state(r'"', False, False),
1302
+ 'sqs/tdqt': _make_attribute_value_state(r"'", True, True),
1303
+ 'sqs/tsqt': _make_attribute_value_state(r"'", True, False),
1304
+ 'sqs/dqt': _make_attribute_value_state(r"'", False, True),
1305
+ 'sqs/sqt': _make_attribute_value_state(r"'", False, False),
1306
+ 'uqs/tdqt': _make_attribute_value_state(_no_quote, True, True),
1307
+ 'uqs/tsqt': _make_attribute_value_state(_no_quote, True, False),
1308
+ 'uqs/dqt': _make_attribute_value_state(_no_quote, False, True),
1309
+ 'uqs/sqt': _make_attribute_value_state(_no_quote, False, False),
1310
+
1311
+ # Regular expressions
1312
+ 'tdqr': [
1313
+ (r'[^\\"]+', String.Regex),
1314
+ (r'\\"*', String.Regex),
1315
+ (r'"{3,}', String.Regex, '#pop'),
1316
+ (r'"', String.Regex)
1317
+ ],
1318
+ 'tsqr': [
1319
+ (r"[^\\']+", String.Regex),
1320
+ (r"\\'*", String.Regex),
1321
+ (r"'{3,}", String.Regex, '#pop'),
1322
+ (r"'", String.Regex)
1323
+ ],
1324
+ 'dqr': [
1325
+ (r'[^\\"]+', String.Regex),
1326
+ (r'\\"?', String.Regex),
1327
+ (r'"', String.Regex, '#pop')
1328
+ ],
1329
+ 'sqr': [
1330
+ (r"[^\\']+", String.Regex),
1331
+ (r"\\'?", String.Regex),
1332
+ (r"'", String.Regex, '#pop')
1333
+ ]
1334
+ }
1335
+
1336
+ def get_tokens_unprocessed(self, text, **kwargs):
1337
+ pp = rf'^{self._ws_pp}*#{self._ws_pp}*'
1338
+ if_false_level = 0
1339
+ for index, token, value in (
1340
+ RegexLexer.get_tokens_unprocessed(self, text, **kwargs)):
1341
+ if if_false_level == 0: # Not in a false #if
1342
+ if (token is Comment.Preproc and
1343
+ re.match(rf'{pp}if{self._ws_pp}+(0|nil){self._ws_pp}*$\n?', value)):
1344
+ if_false_level = 1
1345
+ else: # In a false #if
1346
+ if token is Comment.Preproc:
1347
+ if (if_false_level == 1 and
1348
+ re.match(rf'{pp}el(if|se)\b', value)):
1349
+ if_false_level = 0
1350
+ elif re.match(rf'{pp}if', value):
1351
+ if_false_level += 1
1352
+ elif re.match(rf'{pp}endif\b', value):
1353
+ if_false_level -= 1
1354
+ else:
1355
+ token = Comment
1356
+ yield index, token, value
1357
+
1358
+ def analyse_text(text):
1359
+ """This is a rather generic descriptive language without strong
1360
+ identifiers. It looks like a 'GameMainDef' has to be present,
1361
+ and/or a 'versionInfo' with an 'IFID' field."""
1362
+ result = 0
1363
+ if '__TADS' in text or 'GameMainDef' in text:
1364
+ result += 0.2
1365
+
1366
+ # This is a fairly unique keyword which is likely used in source as well
1367
+ if 'versionInfo' in text and 'IFID' in text:
1368
+ result += 0.1
1369
+
1370
+ return result