Amar-Aly commited on
Commit
de7d262
·
verified ·
1 Parent(s): 8b2b6f0

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. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/jsx.py +100 -0
  2. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/julia.py +294 -0
  3. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/jvm.py +1807 -0
  4. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/kuin.py +332 -0
  5. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/kusto.py +93 -0
  6. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/ldap.py +155 -0
  7. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/lean.py +241 -0
  8. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/lilypond.py +225 -0
  9. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/lisp.py +0 -0
  10. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/macaulay2.py +1847 -0
  11. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/make.py +212 -0
  12. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/maple.py +291 -0
  13. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/markup.py +1659 -0
  14. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/math.py +21 -0
  15. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/matlab.py +0 -0
  16. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/maxima.py +84 -0
  17. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/meson.py +139 -0
  18. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/mime.py +210 -0
  19. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/minecraft.py +392 -0
  20. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/mips.py +130 -0
  21. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/ml.py +958 -0
  22. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/modeling.py +368 -0
  23. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/modula2.py +1579 -0
  24. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/mojo.py +707 -0
  25. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/monte.py +203 -0
  26. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/mosel.py +447 -0
  27. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/ncl.py +894 -0
  28. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/nimrod.py +199 -0
  29. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/nit.py +63 -0
  30. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/nix.py +144 -0
  31. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/numbair.py +63 -0
  32. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/oberon.py +120 -0
  33. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/objective.py +513 -0
  34. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/ooc.py +84 -0
  35. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/openscad.py +96 -0
  36. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/other.py +41 -0
  37. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/parasail.py +78 -0
  38. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/parsers.py +798 -0
  39. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/pascal.py +644 -0
  40. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/pawn.py +202 -0
  41. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/pddl.py +82 -0
  42. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/perl.py +733 -0
  43. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/phix.py +363 -0
  44. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/php.py +335 -0
  45. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/pointless.py +70 -0
  46. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/pony.py +93 -0
  47. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/praat.py +303 -0
  48. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/procfile.py +41 -0
  49. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/prolog.py +318 -0
  50. .cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/promql.py +176 -0
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/jsx.py ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.jsx
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for JSX (React) and TSX (TypeScript flavor).
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import bygroups, default, include, inherit
14
+ from pygments.lexers.javascript import JavascriptLexer, TypeScriptLexer
15
+ from pygments.token import Name, Operator, Punctuation, String, Text, \
16
+ Whitespace
17
+
18
+ __all__ = ['JsxLexer', 'TsxLexer']
19
+
20
+ _JSX_RULES = {
21
+ "jsx": [
22
+ (r"</?>", Punctuation), # JSXFragment <>|</>
23
+ (r"(<)(\w+)(\.?)", bygroups(Punctuation, Name.Tag, Punctuation), "tag"),
24
+ (
25
+ r"(</)(\w+)(>)",
26
+ bygroups(Punctuation, Name.Tag, Punctuation),
27
+ ),
28
+ (
29
+ r"(</)(\w+)",
30
+ bygroups(Punctuation, Name.Tag),
31
+ "fragment",
32
+ ), # Same for React.Context
33
+ ],
34
+ "tag": [
35
+ (r"\s+", Whitespace),
36
+ (r"([\w-]+)(\s*)(=)(\s*)", bygroups(Name.Attribute, Whitespace, Operator, Whitespace), "attr"),
37
+ (r"[{}]+", Punctuation),
38
+ (r"[\w\.]+", Name.Attribute),
39
+ (r"(/?)(\s*)(>)", bygroups(Punctuation, Text, Punctuation), "#pop"),
40
+ ],
41
+ "fragment": [
42
+ (r"(.)(\w+)", bygroups(Punctuation, Name.Attribute)),
43
+ (r"(>)", bygroups(Punctuation), "#pop"),
44
+ ],
45
+ "attr": [
46
+ (r"\{", Punctuation, "expression"),
47
+ (r'".*?"', String, "#pop"),
48
+ (r"'.*?'", String, "#pop"),
49
+ default("#pop"),
50
+ ],
51
+ "expression": [
52
+ (r"\{", Punctuation, "#push"),
53
+ (r"\}", Punctuation, "#pop"),
54
+ include("root"),
55
+ ],
56
+ }
57
+
58
+
59
+ class JsxLexer(JavascriptLexer):
60
+ """For JavaScript Syntax Extension (JSX).
61
+ """
62
+
63
+ name = "JSX"
64
+ aliases = ["jsx", "react"]
65
+ filenames = ["*.jsx", "*.react"]
66
+ mimetypes = ["text/jsx", "text/typescript-jsx"]
67
+ url = "https://facebook.github.io/jsx/"
68
+ version_added = '2.17'
69
+
70
+ flags = re.MULTILINE | re.DOTALL
71
+
72
+ # Use same tokens as `JavascriptLexer`, but with tags and attributes support
73
+ tokens = {
74
+ "root": [
75
+ include("jsx"),
76
+ inherit,
77
+ ],
78
+ **_JSX_RULES}
79
+
80
+
81
+ class TsxLexer(TypeScriptLexer):
82
+ """For TypeScript with embedded JSX
83
+ """
84
+
85
+ name = "TSX"
86
+ aliases = ["tsx"]
87
+ filenames = ["*.tsx"]
88
+ mimetypes = ["text/typescript-tsx"]
89
+ url = "https://www.typescriptlang.org/docs/handbook/jsx.html"
90
+ version_added = '2.19'
91
+
92
+ flags = re.MULTILINE | re.DOTALL
93
+
94
+ # Use same tokens as `TypescriptLexer`, but with tags and attributes support
95
+ tokens = {
96
+ "root": [
97
+ include("jsx"),
98
+ inherit,
99
+ ],
100
+ **_JSX_RULES}
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/julia.py ADDED
@@ -0,0 +1,294 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.julia
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Julia language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, \
12
+ words, include
13
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
14
+ Number, Punctuation, Generic, Whitespace
15
+ from pygments.util import shebang_matches
16
+ from pygments.lexers._julia_builtins import OPERATORS_LIST, DOTTED_OPERATORS_LIST, \
17
+ KEYWORD_LIST, BUILTIN_LIST, LITERAL_LIST
18
+
19
+ __all__ = ['JuliaLexer', 'JuliaConsoleLexer']
20
+
21
+ # see https://docs.julialang.org/en/v1/manual/variables/#Allowed-Variable-Names
22
+ allowed_variable = \
23
+ '(?:[a-zA-Z_\u00A1-\U0010ffff][a-zA-Z_0-9!\u00A1-\U0010ffff]*)'
24
+ # see https://github.com/JuliaLang/julia/blob/master/src/flisp/julia_opsuffs.h
25
+ operator_suffixes = r'[²³¹ʰʲʳʷʸˡˢˣᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁᵂᵃᵇᵈᵉᵍᵏᵐᵒᵖᵗᵘᵛᵝᵞᵟᵠᵡᵢᵣᵤᵥᵦᵧᵨᵩᵪᶜᶠᶥᶦᶫᶰᶸᶻᶿ′″‴‵‶‷⁗⁰ⁱ⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ₐₑₒₓₕₖₗₘₙₚₛₜⱼⱽ]*'
26
+
27
+ class JuliaLexer(RegexLexer):
28
+ """
29
+ For Julia source code.
30
+ """
31
+
32
+ name = 'Julia'
33
+ url = 'https://julialang.org/'
34
+ aliases = ['julia', 'jl']
35
+ filenames = ['*.jl']
36
+ mimetypes = ['text/x-julia', 'application/x-julia']
37
+ version_added = '1.6'
38
+
39
+ tokens = {
40
+ 'root': [
41
+ (r'\n', Whitespace),
42
+ (r'[^\S\n]+', Whitespace),
43
+ (r'#=', Comment.Multiline, "blockcomment"),
44
+ (r'#.*$', Comment),
45
+ (r'[\[\](),;]', Punctuation),
46
+
47
+ # symbols
48
+ # intercept range expressions first
49
+ (r'(' + allowed_variable + r')(\s*)(:)(' + allowed_variable + ')',
50
+ bygroups(Name, Whitespace, Operator, Name)),
51
+ # then match :name which does not follow closing brackets, digits, or the
52
+ # ::, <:, and :> operators
53
+ (r'(?<![\]):<>\d.])(:' + allowed_variable + ')', String.Symbol),
54
+
55
+ # type assertions - excludes expressions like ::typeof(sin) and ::avec[1]
56
+ (r'(?<=::)(\s*)(' + allowed_variable + r')\b(?![(\[])',
57
+ bygroups(Whitespace, Keyword.Type)),
58
+ # type comparisons
59
+ # - MyType <: A or MyType >: A
60
+ ('(' + allowed_variable + r')(\s*)([<>]:)(\s*)(' + allowed_variable + r')\b(?![(\[])',
61
+ bygroups(Keyword.Type, Whitespace, Operator, Whitespace, Keyword.Type)),
62
+ # - <: B or >: B
63
+ (r'([<>]:)(\s*)(' + allowed_variable + r')\b(?![(\[])',
64
+ bygroups(Operator, Whitespace, Keyword.Type)),
65
+ # - A <: or A >:
66
+ (r'\b(' + allowed_variable + r')(\s*)([<>]:)',
67
+ bygroups(Keyword.Type, Whitespace, Operator)),
68
+
69
+ # operators
70
+ # Suffixes aren't actually allowed on all operators, but we'll ignore that
71
+ # since those cases are invalid Julia code.
72
+ (words([*OPERATORS_LIST, *DOTTED_OPERATORS_LIST],
73
+ suffix=operator_suffixes), Operator),
74
+ (words(['.' + o for o in DOTTED_OPERATORS_LIST],
75
+ suffix=operator_suffixes), Operator),
76
+ (words(['...', '..']), Operator),
77
+
78
+ # NOTE
79
+ # Patterns below work only for definition sites and thus hardly reliable.
80
+ #
81
+ # functions
82
+ # (r'(function)(\s+)(' + allowed_variable + ')',
83
+ # bygroups(Keyword, Text, Name.Function)),
84
+
85
+ # chars
86
+ (r"'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,3}|\\u[a-fA-F0-9]{1,4}|"
87
+ r"\\U[a-fA-F0-9]{1,6}|[^\\\'\n])'", String.Char),
88
+
89
+ # try to match trailing transpose
90
+ (r'(?<=[.\w)\]])(\'' + operator_suffixes + ')+', Operator),
91
+
92
+ # raw strings
93
+ (r'(raw)(""")', bygroups(String.Affix, String), 'tqrawstring'),
94
+ (r'(raw)(")', bygroups(String.Affix, String), 'rawstring'),
95
+ # regular expressions
96
+ (r'(r)(""")', bygroups(String.Affix, String.Regex), 'tqregex'),
97
+ (r'(r)(")', bygroups(String.Affix, String.Regex), 'regex'),
98
+ # other strings
99
+ (r'(' + allowed_variable + ')?(""")',
100
+ bygroups(String.Affix, String), 'tqstring'),
101
+ (r'(' + allowed_variable + ')?(")',
102
+ bygroups(String.Affix, String), 'string'),
103
+
104
+ # backticks
105
+ (r'(' + allowed_variable + ')?(```)',
106
+ bygroups(String.Affix, String.Backtick), 'tqcommand'),
107
+ (r'(' + allowed_variable + ')?(`)',
108
+ bygroups(String.Affix, String.Backtick), 'command'),
109
+
110
+ # type names
111
+ # - names that begin a curly expression
112
+ ('(' + allowed_variable + r')(\{)',
113
+ bygroups(Keyword.Type, Punctuation), 'curly'),
114
+ # - names as part of bare 'where'
115
+ (r'(where)(\s+)(' + allowed_variable + ')',
116
+ bygroups(Keyword, Whitespace, Keyword.Type)),
117
+ # - curly expressions in general
118
+ (r'(\{)', Punctuation, 'curly'),
119
+ # - names as part of type declaration
120
+ (r'(abstract|primitive)([ \t]+)(type\b)([\s()]+)(' +
121
+ allowed_variable + r')',
122
+ bygroups(Keyword, Whitespace, Keyword, Text, Keyword.Type)),
123
+ (r'(mutable(?=[ \t]))?([ \t]+)?(struct\b)([\s()]+)(' +
124
+ allowed_variable + r')',
125
+ bygroups(Keyword, Whitespace, Keyword, Text, Keyword.Type)),
126
+
127
+ # macros
128
+ (r'@' + allowed_variable, Name.Decorator),
129
+ (words([*OPERATORS_LIST, '..', '.', *DOTTED_OPERATORS_LIST],
130
+ prefix='@', suffix=operator_suffixes), Name.Decorator),
131
+
132
+ # keywords
133
+ (words(KEYWORD_LIST, suffix=r'\b'), Keyword),
134
+ # builtin types
135
+ (words(BUILTIN_LIST, suffix=r'\b'), Keyword.Type),
136
+ # builtin literals
137
+ (words(LITERAL_LIST, suffix=r'\b'), Name.Builtin),
138
+
139
+ # names
140
+ (allowed_variable, Name),
141
+
142
+ # numbers
143
+ (r'(\d+((_\d+)+)?\.(?!\.)(\d+((_\d+)+)?)?|\.\d+((_\d+)+)?)([eEf][+-]?[0-9]+)?', Number.Float),
144
+ (r'\d+((_\d+)+)?[eEf][+-]?[0-9]+', Number.Float),
145
+ (r'0x[a-fA-F0-9]+((_[a-fA-F0-9]+)+)?(\.([a-fA-F0-9]+((_[a-fA-F0-9]+)+)?)?)?p[+-]?\d+', Number.Float),
146
+ (r'0b[01]+((_[01]+)+)?', Number.Bin),
147
+ (r'0o[0-7]+((_[0-7]+)+)?', Number.Oct),
148
+ (r'0x[a-fA-F0-9]+((_[a-fA-F0-9]+)+)?', Number.Hex),
149
+ (r'\d+((_\d+)+)?', Number.Integer),
150
+
151
+ # single dot operator matched last to permit e.g. ".1" as a float
152
+ (words(['.']), Operator),
153
+ ],
154
+
155
+ "blockcomment": [
156
+ (r'[^=#]', Comment.Multiline),
157
+ (r'#=', Comment.Multiline, '#push'),
158
+ (r'=#', Comment.Multiline, '#pop'),
159
+ (r'[=#]', Comment.Multiline),
160
+ ],
161
+
162
+ 'curly': [
163
+ (r'\{', Punctuation, '#push'),
164
+ (r'\}', Punctuation, '#pop'),
165
+ (allowed_variable, Keyword.Type),
166
+ include('root'),
167
+ ],
168
+
169
+ 'tqrawstring': [
170
+ (r'"""', String, '#pop'),
171
+ (r'([^"]|"[^"][^"])+', String),
172
+ ],
173
+ 'rawstring': [
174
+ (r'"', String, '#pop'),
175
+ (r'\\"', String.Escape),
176
+ (r'([^"\\]|\\[^"])+', String),
177
+ ],
178
+
179
+ # Interpolation is defined as "$" followed by the shortest full
180
+ # expression, which is something we can't parse. Include the most
181
+ # common cases here: $word, and $(paren'd expr).
182
+ 'interp': [
183
+ (r'\$' + allowed_variable, String.Interpol),
184
+ (r'(\$)(\()', bygroups(String.Interpol, Punctuation), 'in-intp'),
185
+ ],
186
+ 'in-intp': [
187
+ (r'\(', Punctuation, '#push'),
188
+ (r'\)', Punctuation, '#pop'),
189
+ include('root'),
190
+ ],
191
+
192
+ 'string': [
193
+ (r'(")(' + allowed_variable + r'|\d+)?',
194
+ bygroups(String, String.Affix), '#pop'),
195
+ # FIXME: This escape pattern is not perfect.
196
+ (r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape),
197
+ include('interp'),
198
+ # @printf and @sprintf formats
199
+ (r'%[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?[hlL]?[E-GXc-giorsux%]',
200
+ String.Interpol),
201
+ (r'[^"$%\\]+', String),
202
+ (r'.', String),
203
+ ],
204
+ 'tqstring': [
205
+ (r'(""")(' + allowed_variable + r'|\d+)?',
206
+ bygroups(String, String.Affix), '#pop'),
207
+ (r'\\([\\"\'$nrbtfav]|(x|u|U)[a-fA-F0-9]+|\d+)', String.Escape),
208
+ include('interp'),
209
+ (r'[^"$%\\]+', String),
210
+ (r'.', String),
211
+ ],
212
+
213
+ 'regex': [
214
+ (r'(")([imsxa]*)?', bygroups(String.Regex, String.Affix), '#pop'),
215
+ (r'\\"', String.Regex),
216
+ (r'[^\\"]+', String.Regex),
217
+ ],
218
+
219
+ 'tqregex': [
220
+ (r'(""")([imsxa]*)?', bygroups(String.Regex, String.Affix), '#pop'),
221
+ (r'[^"]+', String.Regex),
222
+ ],
223
+
224
+ 'command': [
225
+ (r'(`)(' + allowed_variable + r'|\d+)?',
226
+ bygroups(String.Backtick, String.Affix), '#pop'),
227
+ (r'\\[`$]', String.Escape),
228
+ include('interp'),
229
+ (r'[^\\`$]+', String.Backtick),
230
+ (r'.', String.Backtick),
231
+ ],
232
+ 'tqcommand': [
233
+ (r'(```)(' + allowed_variable + r'|\d+)?',
234
+ bygroups(String.Backtick, String.Affix), '#pop'),
235
+ (r'\\\$', String.Escape),
236
+ include('interp'),
237
+ (r'[^\\`$]+', String.Backtick),
238
+ (r'.', String.Backtick),
239
+ ],
240
+ }
241
+
242
+ def analyse_text(text):
243
+ return shebang_matches(text, r'julia')
244
+
245
+
246
+ class JuliaConsoleLexer(Lexer):
247
+ """
248
+ For Julia console sessions. Modeled after MatlabSessionLexer.
249
+ """
250
+ name = 'Julia console'
251
+ aliases = ['jlcon', 'julia-repl']
252
+ url = 'https://julialang.org/'
253
+ version_added = '1.6'
254
+ _example = "jlcon/console"
255
+
256
+ def get_tokens_unprocessed(self, text):
257
+ jllexer = JuliaLexer(**self.options)
258
+ start = 0
259
+ curcode = ''
260
+ insertions = []
261
+ output = False
262
+ error = False
263
+
264
+ for line in text.splitlines(keepends=True):
265
+ if line.startswith('julia>'):
266
+ insertions.append((len(curcode), [(0, Generic.Prompt, line[:6])]))
267
+ curcode += line[6:]
268
+ output = False
269
+ error = False
270
+ elif line.startswith('help?>') or line.startswith('shell>'):
271
+ yield start, Generic.Prompt, line[:6]
272
+ yield start + 6, Text, line[6:]
273
+ output = False
274
+ error = False
275
+ elif line.startswith(' ') and not output:
276
+ insertions.append((len(curcode), [(0, Whitespace, line[:6])]))
277
+ curcode += line[6:]
278
+ else:
279
+ if curcode:
280
+ yield from do_insertions(
281
+ insertions, jllexer.get_tokens_unprocessed(curcode))
282
+ curcode = ''
283
+ insertions = []
284
+ if line.startswith('ERROR: ') or error:
285
+ yield start, Generic.Error, line
286
+ error = True
287
+ else:
288
+ yield start, Generic.Output, line
289
+ output = True
290
+ start += len(line)
291
+
292
+ if curcode:
293
+ yield from do_insertions(
294
+ insertions, jllexer.get_tokens_unprocessed(curcode))
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/jvm.py ADDED
@@ -0,0 +1,1807 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.jvm
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Pygments lexers for JVM languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import Lexer, RegexLexer, include, bygroups, using, \
14
+ this, combined, default, words
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Whitespace
17
+ from pygments.util import shebang_matches
18
+ from pygments import unistring as uni
19
+
20
+ __all__ = ['JavaLexer', 'ScalaLexer', 'GosuLexer', 'GosuTemplateLexer',
21
+ 'GroovyLexer', 'IokeLexer', 'ClojureLexer', 'ClojureScriptLexer',
22
+ 'KotlinLexer', 'XtendLexer', 'AspectJLexer', 'CeylonLexer',
23
+ 'PigLexer', 'GoloLexer', 'JasminLexer', 'SarlLexer']
24
+
25
+
26
+ class JavaLexer(RegexLexer):
27
+ """
28
+ For Java source code.
29
+ """
30
+
31
+ name = 'Java'
32
+ url = 'https://www.oracle.com/technetwork/java/'
33
+ aliases = ['java']
34
+ filenames = ['*.java']
35
+ mimetypes = ['text/x-java']
36
+ version_added = ''
37
+
38
+ flags = re.MULTILINE | re.DOTALL
39
+
40
+ tokens = {
41
+ 'root': [
42
+ (r'(^\s*)((?:(?:public|private|protected|static|strictfp)(?:\s+))*)(record)\b',
43
+ bygroups(Whitespace, using(this), Keyword.Declaration), 'class'),
44
+ (r'[^\S\n]+', Whitespace),
45
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
46
+ (r'/\*.*?\*/', Comment.Multiline),
47
+ # keywords: go before method names to avoid lexing "throw new XYZ"
48
+ # as a method signature
49
+ (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
50
+ r'if|goto|instanceof|new|return|switch|this|throw|try|while)\b',
51
+ Keyword),
52
+ # method names
53
+ (r'((?:(?:[^\W\d]|\$)[\w.\[\]$<>?]*\s+)+?)' # return arguments
54
+ r'((?:[^\W\d]|\$)[\w$]*)' # method name
55
+ r'(\s*)(\()', # signature start
56
+ bygroups(using(this), Name.Function, Whitespace, Punctuation)),
57
+ (r'@[^\W\d][\w.]*', Name.Decorator),
58
+ (r'(abstract|const|enum|exports|extends|final|implements|native|non-sealed|'
59
+ r'open|opens|permits|private|protected|provides|public|requires|sealed|static|strictfp|'
60
+ r'super|synchronized|throws|to|transient|transitive|uses|volatile|with|yield)\b', Keyword.Declaration),
61
+ (r'(boolean|byte|char|double|float|int|long|short|void)\b',
62
+ Keyword.Type),
63
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Whitespace), 'import'),
64
+ (r'(true|false|null)\b', Keyword.Constant),
65
+ (r'(class|interface)\b', Keyword.Declaration, 'class'),
66
+ (r'(module)\b', Keyword.Declaration, 'module'),
67
+ (r'(var)(\s+)', bygroups(Keyword.Declaration, Whitespace), 'var'),
68
+ (r'(import(?:\s+(?:static|module))?)(\s+)', bygroups(Keyword.Namespace, Whitespace),
69
+ 'import'),
70
+ (r'"""\n', String, 'multiline_string'),
71
+ (r'"', String, 'string'),
72
+ (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
73
+ (r'(\.)((?:[^\W\d]|\$)[\w$]*)', bygroups(Punctuation,
74
+ Name.Attribute)),
75
+ (r'^(\s*)(default)(:)', bygroups(Whitespace, Keyword, Punctuation)),
76
+ (r'^(\s*)((?:[^\W\d]|\$)[\w$]*)(:)', bygroups(Whitespace, Name.Label,
77
+ Punctuation)),
78
+ (r'([^\W\d]|\$)[\w$]*', Name),
79
+ (r'([0-9][0-9_]*\.([0-9][0-9_]*)?|'
80
+ r'\.[0-9][0-9_]*)'
81
+ r'([eE][+\-]?[0-9][0-9_]*)?[fFdD]?|'
82
+ r'[0-9][eE][+\-]?[0-9][0-9_]*[fFdD]?|'
83
+ r'[0-9]([eE][+\-]?[0-9][0-9_]*)?[fFdD]|'
84
+ r'0[xX]([0-9a-fA-F][0-9a-fA-F_]*\.?|'
85
+ r'([0-9a-fA-F][0-9a-fA-F_]*)?\.[0-9a-fA-F][0-9a-fA-F_]*)'
86
+ r'[pP][+\-]?[0-9][0-9_]*[fFdD]?', Number.Float),
87
+ (r'0[xX][0-9a-fA-F][0-9a-fA-F_]*[lL]?', Number.Hex),
88
+ (r'0[bB][01][01_]*[lL]?', Number.Bin),
89
+ (r'0[0-7_]+[lL]?', Number.Oct),
90
+ (r'0|[1-9][0-9_]*[lL]?', Number.Integer),
91
+ (r'[~^*!%&\[\]<>|+=/?-]', Operator),
92
+ (r'[{}();:.,]', Punctuation),
93
+ (r'\n', Whitespace)
94
+ ],
95
+ 'class': [
96
+ (r'\s+', Text),
97
+ (r'([^\W\d]|\$)[\w$]*', Name.Class, '#pop')
98
+ ],
99
+ 'module': [
100
+ (r'\s+', Text),
101
+ (r'([^\W\d]|\$)[\w$]*', Name.Class, '#pop')
102
+ ],
103
+ 'var': [
104
+ (r'([^\W\d]|\$)[\w$]*', Name, '#pop')
105
+ ],
106
+ 'import': [
107
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
108
+ ],
109
+ 'multiline_string': [
110
+ (r'"""', String, '#pop'),
111
+ (r'"', String),
112
+ include('string')
113
+ ],
114
+ 'string': [
115
+ (r'[^\\"]+', String),
116
+ (r'\\\\', String), # Escaped backslash
117
+ (r'\\"', String), # Escaped quote
118
+ (r'\\', String), # Bare backslash
119
+ (r'"', String, '#pop'), # Closing quote
120
+ ],
121
+ }
122
+
123
+
124
+ class AspectJLexer(JavaLexer):
125
+ """
126
+ For AspectJ source code.
127
+ """
128
+
129
+ name = 'AspectJ'
130
+ url = 'http://www.eclipse.org/aspectj/'
131
+ aliases = ['aspectj']
132
+ filenames = ['*.aj']
133
+ mimetypes = ['text/x-aspectj']
134
+ version_added = '1.6'
135
+
136
+ aj_keywords = {
137
+ 'aspect', 'pointcut', 'privileged', 'call', 'execution',
138
+ 'initialization', 'preinitialization', 'handler', 'get', 'set',
139
+ 'staticinitialization', 'target', 'args', 'within', 'withincode',
140
+ 'cflow', 'cflowbelow', 'annotation', 'before', 'after', 'around',
141
+ 'proceed', 'throwing', 'returning', 'adviceexecution', 'declare',
142
+ 'parents', 'warning', 'error', 'soft', 'precedence', 'thisJoinPoint',
143
+ 'thisJoinPointStaticPart', 'thisEnclosingJoinPointStaticPart',
144
+ 'issingleton', 'perthis', 'pertarget', 'percflow', 'percflowbelow',
145
+ 'pertypewithin', 'lock', 'unlock', 'thisAspectInstance'
146
+ }
147
+ aj_inter_type = {'parents:', 'warning:', 'error:', 'soft:', 'precedence:'}
148
+ aj_inter_type_annotation = {'@type', '@method', '@constructor', '@field'}
149
+
150
+ def get_tokens_unprocessed(self, text):
151
+ for index, token, value in JavaLexer.get_tokens_unprocessed(self, text):
152
+ if token is Name and value in self.aj_keywords:
153
+ yield index, Keyword, value
154
+ elif token is Name.Label and value in self.aj_inter_type:
155
+ yield index, Keyword, value[:-1]
156
+ yield index, Operator, value[-1]
157
+ elif token is Name.Decorator and value in self.aj_inter_type_annotation:
158
+ yield index, Keyword, value
159
+ else:
160
+ yield index, token, value
161
+
162
+
163
+ class ScalaLexer(RegexLexer):
164
+ """
165
+ For Scala source code.
166
+ """
167
+
168
+ name = 'Scala'
169
+ url = 'http://www.scala-lang.org'
170
+ aliases = ['scala']
171
+ filenames = ['*.scala']
172
+ mimetypes = ['text/x-scala']
173
+ version_added = ''
174
+
175
+ flags = re.MULTILINE | re.DOTALL
176
+
177
+ opchar = '[!#%&*\\-\\/:?@^' + uni.combine('Sm', 'So') + ']'
178
+ letter = '[_\\$' + uni.combine('Ll', 'Lu', 'Lo', 'Nl', 'Lt') + ']'
179
+ upperLetter = '[' + uni.combine('Lu', 'Lt') + ']'
180
+ letterOrDigit = f'(?:{letter}|[0-9])'
181
+ letterOrDigitNoDollarSign = '(?:{}|[0-9])'.format(letter.replace('\\$', ''))
182
+ alphaId = f'{letter}+'
183
+ simpleInterpolatedVariable = f'{letter}{letterOrDigitNoDollarSign}*'
184
+ idrest = f'{letter}{letterOrDigit}*(?:(?<=_){opchar}+)?'
185
+ idUpper = f'{upperLetter}{letterOrDigit}*(?:(?<=_){opchar}+)?'
186
+ plainid = f'(?:{idrest}|{opchar}+)'
187
+ backQuotedId = r'`[^`]+`'
188
+ anyId = rf'(?:{plainid}|{backQuotedId})'
189
+ notStartOfComment = r'(?!//|/\*)'
190
+ endOfLineMaybeWithComment = r'(?=\s*(//|$))'
191
+
192
+ keywords = (
193
+ 'new', 'return', 'throw', 'classOf', 'isInstanceOf', 'asInstanceOf',
194
+ 'else', 'if', 'then', 'do', 'while', 'for', 'yield', 'match', 'case',
195
+ 'catch', 'finally', 'try'
196
+ )
197
+
198
+ operators = (
199
+ '<%', '=:=', '<:<', '<%<', '>:', '<:', '=', '==', '!=', '<=', '>=',
200
+ '<>', '<', '>', '<-', '←', '->', '→', '=>', '⇒', '?', '@', '|', '-',
201
+ '+', '*', '%', '~', '\\'
202
+ )
203
+
204
+ storage_modifiers = (
205
+ 'private', 'protected', 'synchronized', '@volatile', 'abstract',
206
+ 'final', 'lazy', 'sealed', 'implicit', 'override', '@transient',
207
+ '@native'
208
+ )
209
+
210
+ tokens = {
211
+ 'root': [
212
+ include('whitespace'),
213
+ include('comments'),
214
+ include('script-header'),
215
+ include('imports'),
216
+ include('exports'),
217
+ include('storage-modifiers'),
218
+ include('annotations'),
219
+ include('using'),
220
+ include('declarations'),
221
+ include('inheritance'),
222
+ include('extension'),
223
+ include('end'),
224
+ include('constants'),
225
+ include('strings'),
226
+ include('symbols'),
227
+ include('singleton-type'),
228
+ include('inline'),
229
+ include('quoted'),
230
+ include('keywords'),
231
+ include('operators'),
232
+ include('punctuation'),
233
+ include('names'),
234
+ ],
235
+
236
+ # Includes:
237
+ 'whitespace': [
238
+ (r'\s+', Whitespace),
239
+ ],
240
+ 'comments': [
241
+ (r'//.*?\n', Comment.Single),
242
+ (r'/\*', Comment.Multiline, 'comment'),
243
+ ],
244
+ 'script-header': [
245
+ (r'^#!([^\n]*)$', Comment.Hashbang),
246
+ ],
247
+ 'imports': [
248
+ (r'\b(import)(\s+)', bygroups(Keyword, Whitespace), 'import-path'),
249
+ ],
250
+ 'exports': [
251
+ (r'\b(export)(\s+)(given)(\s+)',
252
+ bygroups(Keyword, Whitespace, Keyword, Whitespace), 'export-path'),
253
+ (r'\b(export)(\s+)', bygroups(Keyword, Whitespace), 'export-path'),
254
+ ],
255
+ 'storage-modifiers': [
256
+ (words(storage_modifiers, prefix=r'\b', suffix=r'\b'), Keyword),
257
+ # Only highlight soft modifiers if they are eventually followed by
258
+ # the correct keyword. Note that soft modifiers can be followed by a
259
+ # sequence of regular modifiers; [a-z\s]* skips those, and we just
260
+ # check that the soft modifier is applied to a supported statement.
261
+ (r'\b(transparent|opaque|infix|open|inline)\b(?=[a-z\s]*\b'
262
+ r'(def|val|var|given|type|class|trait|object|enum)\b)', Keyword),
263
+ ],
264
+ 'annotations': [
265
+ (rf'@{idrest}', Name.Decorator),
266
+ ],
267
+ 'using': [
268
+ # using is a soft keyword, can only be used in the first position of
269
+ # a parameter or argument list.
270
+ (r'(\()(\s*)(using)(\s)', bygroups(Punctuation, Whitespace, Keyword, Whitespace)),
271
+ ],
272
+ 'declarations': [
273
+ (rf'\b(def)\b(\s*){notStartOfComment}({anyId})?',
274
+ bygroups(Keyword, Whitespace, Name.Function)),
275
+ (rf'\b(trait)\b(\s*){notStartOfComment}({anyId})?',
276
+ bygroups(Keyword, Whitespace, Name.Class)),
277
+ (rf'\b(?:(case)(\s+))?(class|object|enum)\b(\s*){notStartOfComment}({anyId})?',
278
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Name.Class)),
279
+ (rf'(?<!\.)\b(type)\b(\s*){notStartOfComment}({anyId})?',
280
+ bygroups(Keyword, Whitespace, Name.Class)),
281
+ (r'\b(val|var)\b', Keyword.Declaration),
282
+ (rf'\b(package)(\s+)(object)\b(\s*){notStartOfComment}({anyId})?',
283
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Name.Namespace)),
284
+ (r'\b(package)(\s+)', bygroups(Keyword, Whitespace), 'package'),
285
+ (rf'\b(given)\b(\s*)({idUpper})',
286
+ bygroups(Keyword, Whitespace, Name.Class)),
287
+ (rf'\b(given)\b(\s*)({anyId})?',
288
+ bygroups(Keyword, Whitespace, Name)),
289
+ ],
290
+ 'inheritance': [
291
+ (r'\b(extends|with|derives)\b(\s*)'
292
+ rf'({idUpper}|{backQuotedId}|(?=\([^\)]+=>)|(?={plainid})|(?="))?',
293
+ bygroups(Keyword, Whitespace, Name.Class)),
294
+ ],
295
+ 'extension': [
296
+ (r'\b(extension)(\s+)(?=[\[\(])', bygroups(Keyword, Whitespace)),
297
+ ],
298
+ 'end': [
299
+ # end is a soft keyword, should only be highlighted in certain cases
300
+ (r'\b(end)(\s+)(if|while|for|match|new|extension|val|var)\b',
301
+ bygroups(Keyword, Whitespace, Keyword)),
302
+ (rf'\b(end)(\s+)({idUpper}){endOfLineMaybeWithComment}',
303
+ bygroups(Keyword, Whitespace, Name.Class)),
304
+ (rf'\b(end)(\s+)({backQuotedId}|{plainid})?{endOfLineMaybeWithComment}',
305
+ bygroups(Keyword, Whitespace, Name.Namespace)),
306
+ ],
307
+ 'punctuation': [
308
+ (r'[{}()\[\];,.]', Punctuation),
309
+ (r'(?<!:):(?!:)', Punctuation),
310
+ ],
311
+ 'keywords': [
312
+ (words(keywords, prefix=r'\b', suffix=r'\b'), Keyword),
313
+ ],
314
+ 'operators': [
315
+ (rf'({opchar}{{2,}})(\s+)', bygroups(Operator, Whitespace)),
316
+ (r'/(?![/*])', Operator),
317
+ (words(operators), Operator),
318
+ (rf'(?<!{opchar})(!|&&|\|\|)(?!{opchar})', Operator),
319
+ ],
320
+ 'constants': [
321
+ (r'\b(this|super)\b', Name.Builtin.Pseudo),
322
+ (r'(true|false|null)\b', Keyword.Constant),
323
+ (r'0[xX][0-9a-fA-F_]*', Number.Hex),
324
+ (r'([0-9][0-9_]*\.[0-9][0-9_]*|\.[0-9][0-9_]*)'
325
+ r'([eE][+-]?[0-9][0-9_]*)?[fFdD]?', Number.Float),
326
+ (r'[0-9]+([eE][+-]?[0-9]+)?[fFdD]', Number.Float),
327
+ (r'[0-9]+([eE][+-]?[0-9]+)[fFdD]?', Number.Float),
328
+ (r'[0-9]+[lL]', Number.Integer.Long),
329
+ (r'[0-9]+', Number.Integer),
330
+ (r'""".*?"""(?!")', String),
331
+ (r'"(\\\\|\\"|[^"])*"', String),
332
+ (r"(')(\\.)(')", bygroups(String.Char, String.Escape, String.Char)),
333
+ (r"'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
334
+ ],
335
+ "strings": [
336
+ (r'[fs]"""', String, 'interpolated-string-triple'),
337
+ (r'[fs]"', String, 'interpolated-string'),
338
+ (r'raw"(\\\\|\\"|[^"])*"', String),
339
+ ],
340
+ 'symbols': [
341
+ (rf"('{plainid})(?!')", String.Symbol),
342
+ ],
343
+ 'singleton-type': [
344
+ (r'(\.)(type)\b', bygroups(Punctuation, Keyword)),
345
+ ],
346
+ 'inline': [
347
+ # inline is a soft modifier, only highlighted if followed by if,
348
+ # match or parameters.
349
+ (rf'\b(inline)(?=\s+({plainid}|{backQuotedId})\s*:)',
350
+ Keyword),
351
+ (r'\b(inline)\b(?=(?:.(?!\b(?:val|def|given)\b))*\b(if|match)\b)',
352
+ Keyword),
353
+ ],
354
+ 'quoted': [
355
+ # '{...} or ${...}
356
+ (r"['$]\{(?!')", Punctuation),
357
+ # '[...]
358
+ (r"'\[(?!')", Punctuation),
359
+ ],
360
+ 'names': [
361
+ (idUpper, Name.Class),
362
+ (anyId, Name),
363
+ ],
364
+
365
+ # States
366
+ 'comment': [
367
+ (r'[^/*]+', Comment.Multiline),
368
+ (r'/\*', Comment.Multiline, '#push'),
369
+ (r'\*/', Comment.Multiline, '#pop'),
370
+ (r'[*/]', Comment.Multiline),
371
+ ],
372
+ 'import-path': [
373
+ (r'(?<=[\n;:])', Text, '#pop'),
374
+ include('comments'),
375
+ (r'\b(given)\b', Keyword),
376
+ include('qualified-name'),
377
+ (r'\{', Punctuation, 'import-path-curly-brace'),
378
+ ],
379
+ 'import-path-curly-brace': [
380
+ include('whitespace'),
381
+ include('comments'),
382
+ (r'\b(given)\b', Keyword),
383
+ (r'=>', Operator),
384
+ (r'\}', Punctuation, '#pop'),
385
+ (r',', Punctuation),
386
+ (r'[\[\]]', Punctuation),
387
+ include('qualified-name'),
388
+ ],
389
+ 'export-path': [
390
+ (r'(?<=[\n;:])', Text, '#pop'),
391
+ include('comments'),
392
+ include('qualified-name'),
393
+ (r'\{', Punctuation, 'export-path-curly-brace'),
394
+ ],
395
+ 'export-path-curly-brace': [
396
+ include('whitespace'),
397
+ include('comments'),
398
+ (r'=>', Operator),
399
+ (r'\}', Punctuation, '#pop'),
400
+ (r',', Punctuation),
401
+ include('qualified-name'),
402
+ ],
403
+ 'package': [
404
+ (r'(?<=[\n;])', Text, '#pop'),
405
+ (r':', Punctuation, '#pop'),
406
+ include('comments'),
407
+ include('qualified-name'),
408
+ ],
409
+ 'interpolated-string-triple': [
410
+ (r'"""(?!")', String, '#pop'),
411
+ (r'"', String),
412
+ include('interpolated-string-common'),
413
+ ],
414
+ 'interpolated-string': [
415
+ (r'"', String, '#pop'),
416
+ include('interpolated-string-common'),
417
+ ],
418
+ 'interpolated-string-brace': [
419
+ (r'\}', String.Interpol, '#pop'),
420
+ (r'\{', Punctuation, 'interpolated-string-nested-brace'),
421
+ include('root'),
422
+ ],
423
+ 'interpolated-string-nested-brace': [
424
+ (r'\{', Punctuation, '#push'),
425
+ (r'\}', Punctuation, '#pop'),
426
+ include('root'),
427
+ ],
428
+
429
+ # Helpers
430
+ 'qualified-name': [
431
+ (idUpper, Name.Class),
432
+ (rf'({anyId})(\.)', bygroups(Name.Namespace, Punctuation)),
433
+ (r'\.', Punctuation),
434
+ (anyId, Name),
435
+ (r'[^\S\n]+', Whitespace),
436
+ ],
437
+ 'interpolated-string-common': [
438
+ (r'[^"$\\]+', String),
439
+ (r'\$\$', String.Escape),
440
+ (rf'(\$)({simpleInterpolatedVariable})',
441
+ bygroups(String.Interpol, Name)),
442
+ (r'\$\{', String.Interpol, 'interpolated-string-brace'),
443
+ (r'\\.', String),
444
+ ],
445
+ }
446
+
447
+
448
+ class GosuLexer(RegexLexer):
449
+ """
450
+ For Gosu source code.
451
+ """
452
+
453
+ name = 'Gosu'
454
+ aliases = ['gosu']
455
+ filenames = ['*.gs', '*.gsx', '*.gsp', '*.vark']
456
+ mimetypes = ['text/x-gosu']
457
+ url = 'https://gosu-lang.github.io'
458
+ version_added = '1.5'
459
+
460
+ flags = re.MULTILINE | re.DOTALL
461
+
462
+ tokens = {
463
+ 'root': [
464
+ # method names
465
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # modifiers etc.
466
+ r'([a-zA-Z_]\w*)' # method name
467
+ r'(\s*)(\()', # signature start
468
+ bygroups(using(this), Name.Function, Whitespace, Operator)),
469
+ (r'[^\S\n]+', Whitespace),
470
+ (r'//.*?\n', Comment.Single),
471
+ (r'/\*.*?\*/', Comment.Multiline),
472
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
473
+ (r'(in|as|typeof|statictypeof|typeis|typeas|if|else|foreach|for|'
474
+ r'index|while|do|continue|break|return|try|catch|finally|this|'
475
+ r'throw|new|switch|case|default|eval|super|outer|classpath|'
476
+ r'using)\b', Keyword),
477
+ (r'(var|delegate|construct|function|private|internal|protected|'
478
+ r'public|abstract|override|final|static|extends|transient|'
479
+ r'implements|represents|readonly)\b', Keyword.Declaration),
480
+ (r'(property)(\s+)(get|set)?', bygroups(Keyword.Declaration, Whitespace, Keyword.Declaration)),
481
+ (r'(boolean|byte|char|double|float|int|long|short|void|block)\b',
482
+ Keyword.Type),
483
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Whitespace)),
484
+ (r'(true|false|null|NaN|Infinity)\b', Keyword.Constant),
485
+ (r'(class|interface|enhancement|enum)(\s+)([a-zA-Z_]\w*)',
486
+ bygroups(Keyword.Declaration, Whitespace, Name.Class)),
487
+ (r'(uses)(\s+)([\w.]+\*?)',
488
+ bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
489
+ (r'"', String, 'string'),
490
+ (r'(\??[.#])([a-zA-Z_]\w*)',
491
+ bygroups(Operator, Name.Attribute)),
492
+ (r'(:)([a-zA-Z_]\w*)',
493
+ bygroups(Operator, Name.Attribute)),
494
+ (r'[a-zA-Z_$]\w*', Name),
495
+ (r'and|or|not|[\\~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
496
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
497
+ (r'[0-9]+', Number.Integer),
498
+ (r'\n', Whitespace)
499
+ ],
500
+ 'templateText': [
501
+ (r'(\\<)|(\\\$)', String),
502
+ (r'(<%@\s+)(extends|params)',
503
+ bygroups(Operator, Name.Decorator), 'stringTemplate'),
504
+ (r'<%!--.*?--%>', Comment.Multiline),
505
+ (r'(<%)|(<%=)', Operator, 'stringTemplate'),
506
+ (r'\$\{', Operator, 'stringTemplateShorthand'),
507
+ (r'.', String)
508
+ ],
509
+ 'string': [
510
+ (r'"', String, '#pop'),
511
+ include('templateText')
512
+ ],
513
+ 'stringTemplate': [
514
+ (r'"', String, 'string'),
515
+ (r'%>', Operator, '#pop'),
516
+ include('root')
517
+ ],
518
+ 'stringTemplateShorthand': [
519
+ (r'"', String, 'string'),
520
+ (r'\{', Operator, 'stringTemplateShorthand'),
521
+ (r'\}', Operator, '#pop'),
522
+ include('root')
523
+ ],
524
+ }
525
+
526
+
527
+ class GosuTemplateLexer(Lexer):
528
+ """
529
+ For Gosu templates.
530
+ """
531
+
532
+ name = 'Gosu Template'
533
+ aliases = ['gst']
534
+ filenames = ['*.gst']
535
+ mimetypes = ['text/x-gosu-template']
536
+ url = 'https://gosu-lang.github.io'
537
+ version_added = '1.5'
538
+
539
+ def get_tokens_unprocessed(self, text):
540
+ lexer = GosuLexer()
541
+ stack = ['templateText']
542
+ yield from lexer.get_tokens_unprocessed(text, stack)
543
+
544
+
545
+ class GroovyLexer(RegexLexer):
546
+ """
547
+ For Groovy source code.
548
+ """
549
+
550
+ name = 'Groovy'
551
+ url = 'https://groovy-lang.org/'
552
+ aliases = ['groovy']
553
+ filenames = ['*.groovy','*.gradle']
554
+ mimetypes = ['text/x-groovy']
555
+ version_added = '1.5'
556
+
557
+ flags = re.MULTILINE | re.DOTALL
558
+
559
+ tokens = {
560
+ 'root': [
561
+ # Groovy allows a file to start with a shebang
562
+ (r'#!(.*?)$', Comment.Preproc, 'base'),
563
+ default('base'),
564
+ ],
565
+ 'base': [
566
+ (r'[^\S\n]+', Whitespace),
567
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
568
+ (r'/\*.*?\*/', Comment.Multiline),
569
+ # keywords: go before method names to avoid lexing "throw new XYZ"
570
+ # as a method signature
571
+ (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
572
+ r'if|goto|instanceof|new|return|switch|this|throw|try|while|in|as)\b',
573
+ Keyword),
574
+ # method names
575
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
576
+ r'('
577
+ r'[a-zA-Z_]\w*' # method name
578
+ r'|"(?:\\\\|\\[^\\]|[^"\\])*"' # or double-quoted method name
579
+ r"|'(?:\\\\|\\[^\\]|[^'\\])*'" # or single-quoted method name
580
+ r')'
581
+ r'(\s*)(\()', # signature start
582
+ bygroups(using(this), Name.Function, Whitespace, Operator)),
583
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
584
+ (r'(abstract|const|enum|extends|final|implements|native|private|'
585
+ r'protected|public|static|strictfp|super|synchronized|throws|'
586
+ r'transient|volatile)\b', Keyword.Declaration),
587
+ (r'(def|boolean|byte|char|double|float|int|long|short|void)\b',
588
+ Keyword.Type),
589
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Whitespace)),
590
+ (r'(true|false|null)\b', Keyword.Constant),
591
+ (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Whitespace),
592
+ 'class'),
593
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Whitespace), 'import'),
594
+ (r'""".*?"""', String.Double),
595
+ (r"'''.*?'''", String.Single),
596
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
597
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
598
+ (r'\$/((?!/\$).)*/\$', String),
599
+ (r'/(\\\\|\\[^\\]|[^/\\])*/', String),
600
+ (r"'\\.'|'[^\\]'|'\\u[0-9a-fA-F]{4}'", String.Char),
601
+ (r'(\.)([a-zA-Z_]\w*)', bygroups(Operator, Name.Attribute)),
602
+ (r'[a-zA-Z_]\w*:', Name.Label),
603
+ (r'[a-zA-Z_$]\w*', Name),
604
+ (r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
605
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
606
+ (r'0x[0-9a-fA-F]+', Number.Hex),
607
+ (r'[0-9]+L?', Number.Integer),
608
+ (r'\n', Whitespace)
609
+ ],
610
+ 'class': [
611
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
612
+ ],
613
+ 'import': [
614
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
615
+ ],
616
+ }
617
+
618
+ def analyse_text(text):
619
+ return shebang_matches(text, r'groovy')
620
+
621
+
622
+ class IokeLexer(RegexLexer):
623
+ """
624
+ For Ioke (a strongly typed, dynamic,
625
+ prototype based programming language) source.
626
+ """
627
+ name = 'Ioke'
628
+ url = 'https://ioke.org/'
629
+ filenames = ['*.ik']
630
+ aliases = ['ioke', 'ik']
631
+ mimetypes = ['text/x-iokesrc']
632
+ version_added = '1.4'
633
+ tokens = {
634
+ 'interpolatableText': [
635
+ (r'(\\b|\\e|\\t|\\n|\\f|\\r|\\"|\\\\|\\#|\\\Z|\\u[0-9a-fA-F]{1,4}'
636
+ r'|\\[0-3]?[0-7]?[0-7])', String.Escape),
637
+ (r'#\{', Punctuation, 'textInterpolationRoot')
638
+ ],
639
+
640
+ 'text': [
641
+ (r'(?<!\\)"', String, '#pop'),
642
+ include('interpolatableText'),
643
+ (r'[^"]', String)
644
+ ],
645
+
646
+ 'documentation': [
647
+ (r'(?<!\\)"', String.Doc, '#pop'),
648
+ include('interpolatableText'),
649
+ (r'[^"]', String.Doc)
650
+ ],
651
+
652
+ 'textInterpolationRoot': [
653
+ (r'\}', Punctuation, '#pop'),
654
+ include('root')
655
+ ],
656
+
657
+ 'slashRegexp': [
658
+ (r'(?<!\\)/[im-psux]*', String.Regex, '#pop'),
659
+ include('interpolatableText'),
660
+ (r'\\/', String.Regex),
661
+ (r'[^/]', String.Regex)
662
+ ],
663
+
664
+ 'squareRegexp': [
665
+ (r'(?<!\\)][im-psux]*', String.Regex, '#pop'),
666
+ include('interpolatableText'),
667
+ (r'\\]', String.Regex),
668
+ (r'[^\]]', String.Regex)
669
+ ],
670
+
671
+ 'squareText': [
672
+ (r'(?<!\\)]', String, '#pop'),
673
+ include('interpolatableText'),
674
+ (r'[^\]]', String)
675
+ ],
676
+
677
+ 'root': [
678
+ (r'\n', Whitespace),
679
+ (r'\s+', Whitespace),
680
+
681
+ # Comments
682
+ (r';(.*?)\n', Comment),
683
+ (r'\A#!(.*?)\n', Comment),
684
+
685
+ # Regexps
686
+ (r'#/', String.Regex, 'slashRegexp'),
687
+ (r'#r\[', String.Regex, 'squareRegexp'),
688
+
689
+ # Symbols
690
+ (r':[\w!:?]+', String.Symbol),
691
+ (r'[\w!:?]+:(?![\w!?])', String.Other),
692
+ (r':"(\\\\|\\[^\\]|[^"\\])*"', String.Symbol),
693
+
694
+ # Documentation
695
+ (r'((?<=fn\()|(?<=fnx\()|(?<=method\()|(?<=macro\()|(?<=lecro\()'
696
+ r'|(?<=syntax\()|(?<=dmacro\()|(?<=dlecro\()|(?<=dlecrox\()'
697
+ r'|(?<=dsyntax\())(\s*)"', String.Doc, 'documentation'),
698
+
699
+ # Text
700
+ (r'"', String, 'text'),
701
+ (r'#\[', String, 'squareText'),
702
+
703
+ # Mimic
704
+ (r'\w[\w!:?]+(?=\s*=.*mimic\s)', Name.Entity),
705
+
706
+ # Assignment
707
+ (r'[a-zA-Z_][\w!:?]*(?=[\s]*[+*/-]?=[^=].*($|\.))',
708
+ Name.Variable),
709
+
710
+ # keywords
711
+ (r'(break|cond|continue|do|ensure|for|for:dict|for:set|if|let|'
712
+ r'loop|p:for|p:for:dict|p:for:set|return|unless|until|while|'
713
+ r'with)(?![\w!:?])', Keyword.Reserved),
714
+
715
+ # Origin
716
+ (r'(eval|mimic|print|println)(?![\w!:?])', Keyword),
717
+
718
+ # Base
719
+ (r'(cell\?|cellNames|cellOwner\?|cellOwner|cells|cell|'
720
+ r'documentation|hash|identity|mimic|removeCell\!|undefineCell\!)'
721
+ r'(?![\w!:?])', Keyword),
722
+
723
+ # Ground
724
+ (r'(stackTraceAsText)(?![\w!:?])', Keyword),
725
+
726
+ # DefaultBehaviour Literals
727
+ (r'(dict|list|message|set)(?![\w!:?])', Keyword.Reserved),
728
+
729
+ # DefaultBehaviour Case
730
+ (r'(case|case:and|case:else|case:nand|case:nor|case:not|case:or|'
731
+ r'case:otherwise|case:xor)(?![\w!:?])', Keyword.Reserved),
732
+
733
+ # DefaultBehaviour Reflection
734
+ (r'(asText|become\!|derive|freeze\!|frozen\?|in\?|is\?|kind\?|'
735
+ r'mimic\!|mimics|mimics\?|prependMimic\!|removeAllMimics\!|'
736
+ r'removeMimic\!|same\?|send|thaw\!|uniqueHexId)'
737
+ r'(?![\w!:?])', Keyword),
738
+
739
+ # DefaultBehaviour Aspects
740
+ (r'(after|around|before)(?![\w!:?])', Keyword.Reserved),
741
+
742
+ # DefaultBehaviour
743
+ (r'(kind|cellDescriptionDict|cellSummary|genSym|inspect|notice)'
744
+ r'(?![\w!:?])', Keyword),
745
+ (r'(use|destructuring)', Keyword.Reserved),
746
+
747
+ # DefaultBehavior BaseBehavior
748
+ (r'(cell\?|cellOwner\?|cellOwner|cellNames|cells|cell|'
749
+ r'documentation|identity|removeCell!|undefineCell)'
750
+ r'(?![\w!:?])', Keyword),
751
+
752
+ # DefaultBehavior Internal
753
+ (r'(internal:compositeRegexp|internal:concatenateText|'
754
+ r'internal:createDecimal|internal:createNumber|'
755
+ r'internal:createRegexp|internal:createText)'
756
+ r'(?![\w!:?])', Keyword.Reserved),
757
+
758
+ # DefaultBehaviour Conditions
759
+ (r'(availableRestarts|bind|error\!|findRestart|handle|'
760
+ r'invokeRestart|rescue|restart|signal\!|warn\!)'
761
+ r'(?![\w!:?])', Keyword.Reserved),
762
+
763
+ # constants
764
+ (r'(nil|false|true)(?![\w!:?])', Name.Constant),
765
+
766
+ # names
767
+ (r'(Arity|Base|Call|Condition|DateTime|Aspects|Pointcut|'
768
+ r'Assignment|BaseBehavior|Boolean|Case|AndCombiner|Else|'
769
+ r'NAndCombiner|NOrCombiner|NotCombiner|OrCombiner|XOrCombiner|'
770
+ r'Conditions|Definitions|FlowControl|Internal|Literals|'
771
+ r'Reflection|DefaultMacro|DefaultMethod|DefaultSyntax|Dict|'
772
+ r'FileSystem|Ground|Handler|Hook|IO|IokeGround|Struct|'
773
+ r'LexicalBlock|LexicalMacro|List|Message|Method|Mixins|'
774
+ r'NativeMethod|Number|Origin|Pair|Range|Reflector|Regexp Match|'
775
+ r'Regexp|Rescue|Restart|Runtime|Sequence|Set|Symbol|'
776
+ r'System|Text|Tuple)(?![\w!:?])', Name.Builtin),
777
+
778
+ # functions
779
+ ('(generateMatchMethod|aliasMethod|\u03bb|\u028E|fnx|fn|method|'
780
+ 'dmacro|dlecro|syntax|macro|dlecrox|lecrox|lecro|syntax)'
781
+ '(?![\\w!:?])', Name.Function),
782
+
783
+ # Numbers
784
+ (r'-?0[xX][0-9a-fA-F]+', Number.Hex),
785
+ (r'-?(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
786
+ (r'-?\d+', Number.Integer),
787
+
788
+ (r'#\(', Punctuation),
789
+
790
+ # Operators
791
+ (r'(&&>>|\|\|>>|\*\*>>|:::|::|\.\.\.|===|\*\*>|\*\*=|&&>|&&=|'
792
+ r'\|\|>|\|\|=|\->>|\+>>|!>>|<>>>|<>>|&>>|%>>|#>>|@>>|/>>|\*>>|'
793
+ r'\?>>|\|>>|\^>>|~>>|\$>>|=>>|<<=|>>=|<=>|<\->|=~|!~|=>|\+\+|'
794
+ r'\-\-|<=|>=|==|!=|&&|\.\.|\+=|\-=|\*=|\/=|%=|&=|\^=|\|=|<\-|'
795
+ r'\+>|!>|<>|&>|%>|#>|\@>|\/>|\*>|\?>|\|>|\^>|~>|\$>|<\->|\->|'
796
+ r'<<|>>|\*\*|\?\||\?&|\|\||>|<|\*|\/|%|\+|\-|&|\^|\||=|\$|!|~|'
797
+ r'\?|#|\u2260|\u2218|\u2208|\u2209)', Operator),
798
+ (r'(and|nand|or|xor|nor|return|import)(?![\w!?])',
799
+ Operator),
800
+
801
+ # Punctuation
802
+ (r'(\`\`|\`|\'\'|\'|\.|\,|@@|@|\[|\]|\(|\)|\{|\})', Punctuation),
803
+
804
+ # kinds
805
+ (r'[A-Z][\w!:?]*', Name.Class),
806
+
807
+ # default cellnames
808
+ (r'[a-z_][\w!:?]*', Name)
809
+ ]
810
+ }
811
+
812
+
813
+ class ClojureLexer(RegexLexer):
814
+ """
815
+ Lexer for Clojure source code.
816
+ """
817
+ name = 'Clojure'
818
+ url = 'http://clojure.org/'
819
+ aliases = ['clojure', 'clj']
820
+ filenames = ['*.clj', '*.cljc']
821
+ mimetypes = ['text/x-clojure', 'application/x-clojure']
822
+ version_added = '0.11'
823
+
824
+ special_forms = (
825
+ '.', 'def', 'do', 'fn', 'if', 'let', 'new', 'quote', 'var', 'loop'
826
+ )
827
+
828
+ # It's safe to consider 'ns' a declaration thing because it defines a new
829
+ # namespace.
830
+ declarations = (
831
+ 'def-', 'defn', 'defn-', 'defmacro', 'defmulti', 'defmethod',
832
+ 'defstruct', 'defonce', 'declare', 'definline', 'definterface',
833
+ 'defprotocol', 'defrecord', 'deftype', 'defproject', 'ns'
834
+ )
835
+
836
+ builtins = (
837
+ '*', '+', '-', '->', '/', '<', '<=', '=', '==', '>', '>=', '..',
838
+ 'accessor', 'agent', 'agent-errors', 'aget', 'alength', 'all-ns',
839
+ 'alter', 'and', 'append-child', 'apply', 'array-map', 'aset',
840
+ 'aset-boolean', 'aset-byte', 'aset-char', 'aset-double', 'aset-float',
841
+ 'aset-int', 'aset-long', 'aset-short', 'assert', 'assoc', 'await',
842
+ 'await-for', 'bean', 'binding', 'bit-and', 'bit-not', 'bit-or',
843
+ 'bit-shift-left', 'bit-shift-right', 'bit-xor', 'boolean', 'branch?',
844
+ 'butlast', 'byte', 'cast', 'char', 'children', 'class',
845
+ 'clear-agent-errors', 'comment', 'commute', 'comp', 'comparator',
846
+ 'complement', 'concat', 'conj', 'cons', 'constantly', 'cond', 'if-not',
847
+ 'construct-proxy', 'contains?', 'count', 'create-ns', 'create-struct',
848
+ 'cycle', 'dec', 'deref', 'difference', 'disj', 'dissoc', 'distinct',
849
+ 'doall', 'doc', 'dorun', 'doseq', 'dosync', 'dotimes', 'doto',
850
+ 'double', 'down', 'drop', 'drop-while', 'edit', 'end?', 'ensure',
851
+ 'eval', 'every?', 'false?', 'ffirst', 'file-seq', 'filter', 'find',
852
+ 'find-doc', 'find-ns', 'find-var', 'first', 'float', 'flush', 'for',
853
+ 'fnseq', 'frest', 'gensym', 'get-proxy-class', 'get',
854
+ 'hash-map', 'hash-set', 'identical?', 'identity', 'if-let', 'import',
855
+ 'in-ns', 'inc', 'index', 'insert-child', 'insert-left', 'insert-right',
856
+ 'inspect-table', 'inspect-tree', 'instance?', 'int', 'interleave',
857
+ 'intersection', 'into', 'into-array', 'iterate', 'join', 'key', 'keys',
858
+ 'keyword', 'keyword?', 'last', 'lazy-cat', 'lazy-cons', 'left',
859
+ 'lefts', 'line-seq', 'list*', 'list', 'load', 'load-file',
860
+ 'locking', 'long', 'loop', 'macroexpand', 'macroexpand-1',
861
+ 'make-array', 'make-node', 'map', 'map-invert', 'map?', 'mapcat',
862
+ 'max', 'max-key', 'memfn', 'merge', 'merge-with', 'meta', 'min',
863
+ 'min-key', 'name', 'namespace', 'neg?', 'new', 'newline', 'next',
864
+ 'nil?', 'node', 'not', 'not-any?', 'not-every?', 'not=', 'ns-imports',
865
+ 'ns-interns', 'ns-map', 'ns-name', 'ns-publics', 'ns-refers',
866
+ 'ns-resolve', 'ns-unmap', 'nth', 'nthrest', 'or', 'parse', 'partial',
867
+ 'path', 'peek', 'pop', 'pos?', 'pr', 'pr-str', 'print', 'print-str',
868
+ 'println', 'println-str', 'prn', 'prn-str', 'project', 'proxy',
869
+ 'proxy-mappings', 'quot', 'rand', 'rand-int', 'range', 're-find',
870
+ 're-groups', 're-matcher', 're-matches', 're-pattern', 're-seq',
871
+ 'read', 'read-line', 'reduce', 'ref', 'ref-set', 'refer', 'rem',
872
+ 'remove', 'remove-method', 'remove-ns', 'rename', 'rename-keys',
873
+ 'repeat', 'replace', 'replicate', 'resolve', 'rest', 'resultset-seq',
874
+ 'reverse', 'rfirst', 'right', 'rights', 'root', 'rrest', 'rseq',
875
+ 'second', 'select', 'select-keys', 'send', 'send-off', 'seq',
876
+ 'seq-zip', 'seq?', 'set', 'short', 'slurp', 'some', 'sort',
877
+ 'sort-by', 'sorted-map', 'sorted-map-by', 'sorted-set',
878
+ 'special-symbol?', 'split-at', 'split-with', 'str', 'string?',
879
+ 'struct', 'struct-map', 'subs', 'subvec', 'symbol', 'symbol?',
880
+ 'sync', 'take', 'take-nth', 'take-while', 'test', 'time', 'to-array',
881
+ 'to-array-2d', 'tree-seq', 'true?', 'union', 'up', 'update-proxy',
882
+ 'val', 'vals', 'var-get', 'var-set', 'var?', 'vector', 'vector-zip',
883
+ 'vector?', 'when', 'when-first', 'when-let', 'when-not',
884
+ 'with-local-vars', 'with-meta', 'with-open', 'with-out-str',
885
+ 'xml-seq', 'xml-zip', 'zero?', 'zipmap', 'zipper')
886
+
887
+ # valid names for identifiers
888
+ # well, names can only not consist fully of numbers
889
+ # but this should be good enough for now
890
+
891
+ # TODO / should divide keywords/symbols into namespace/rest
892
+ # but that's hard, so just pretend / is part of the name
893
+ valid_name = r'(?!#)[\w!$%*+<=>?/.#|-]+'
894
+
895
+ tokens = {
896
+ 'root': [
897
+ # the comments - always starting with semicolon
898
+ # and going to the end of the line
899
+ (r';.*$', Comment.Single),
900
+
901
+ # whitespaces - usually not relevant
902
+ (r',+', Text),
903
+ (r'\s+', Whitespace),
904
+
905
+ # numbers
906
+ (r'-?\d+\.\d+', Number.Float),
907
+ (r'-?\d+/\d+', Number),
908
+ (r'-?\d+', Number.Integer),
909
+ (r'0x-?[abcdef\d]+', Number.Hex),
910
+
911
+ # strings, symbols and characters
912
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
913
+ (r"'" + valid_name, String.Symbol),
914
+ (r"\\(.|[a-z]+)", String.Char),
915
+
916
+ # keywords
917
+ (r'::?#?' + valid_name, String.Symbol),
918
+
919
+ # special operators
920
+ (r'~@|[`\'#^~&@]', Operator),
921
+
922
+ # highlight the special forms
923
+ (words(special_forms, suffix=' '), Keyword),
924
+
925
+ # Technically, only the special forms are 'keywords'. The problem
926
+ # is that only treating them as keywords means that things like
927
+ # 'defn' and 'ns' need to be highlighted as builtins. This is ugly
928
+ # and weird for most styles. So, as a compromise we're going to
929
+ # highlight them as Keyword.Declarations.
930
+ (words(declarations, suffix=' '), Keyword.Declaration),
931
+
932
+ # highlight the builtins
933
+ (words(builtins, suffix=' '), Name.Builtin),
934
+
935
+ # the remaining functions
936
+ (r'(?<=\()' + valid_name, Name.Function),
937
+
938
+ # find the remaining variables
939
+ (valid_name, Name.Variable),
940
+
941
+ # Clojure accepts vector notation
942
+ (r'(\[|\])', Punctuation),
943
+
944
+ # Clojure accepts map notation
945
+ (r'(\{|\})', Punctuation),
946
+
947
+ # the famous parentheses!
948
+ (r'(\(|\))', Punctuation),
949
+ ],
950
+ }
951
+
952
+
953
+ class ClojureScriptLexer(ClojureLexer):
954
+ """
955
+ Lexer for ClojureScript source code.
956
+ """
957
+ name = 'ClojureScript'
958
+ url = 'http://clojure.org/clojurescript'
959
+ aliases = ['clojurescript', 'cljs']
960
+ filenames = ['*.cljs']
961
+ mimetypes = ['text/x-clojurescript', 'application/x-clojurescript']
962
+ version_added = '2.0'
963
+
964
+
965
+ class TeaLangLexer(RegexLexer):
966
+ """
967
+ For Tea source code. Only used within a
968
+ TeaTemplateLexer.
969
+
970
+ .. versionadded:: 1.5
971
+ """
972
+
973
+ flags = re.MULTILINE | re.DOTALL
974
+
975
+ tokens = {
976
+ 'root': [
977
+ # method names
978
+ (r'^(\s*(?:[a-zA-Z_][\w\.\[\]]*\s+)+?)' # return arguments
979
+ r'([a-zA-Z_]\w*)' # method name
980
+ r'(\s*)(\()', # signature start
981
+ bygroups(using(this), Name.Function, Whitespace, Operator)),
982
+ (r'[^\S\n]+', Whitespace),
983
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
984
+ (r'/\*.*?\*/', Comment.Multiline),
985
+ (r'@[a-zA-Z_][\w\.]*', Name.Decorator),
986
+ (r'(and|break|else|foreach|if|in|not|or|reverse)\b',
987
+ Keyword),
988
+ (r'(as|call|define)\b', Keyword.Declaration),
989
+ (r'(true|false|null)\b', Keyword.Constant),
990
+ (r'(template)(\s+)', bygroups(Keyword.Declaration, Whitespace), 'template'),
991
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Whitespace), 'import'),
992
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
993
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
994
+ (r'(\.)([a-zA-Z_]\w*)', bygroups(Operator, Name.Attribute)),
995
+ (r'[a-zA-Z_]\w*:', Name.Label),
996
+ (r'[a-zA-Z_\$]\w*', Name),
997
+ (r'(isa|[.]{3}|[.]{2}|[=#!<>+-/%&;,.\*\\\(\)\[\]\{\}])', Operator),
998
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
999
+ (r'0x[0-9a-fA-F]+', Number.Hex),
1000
+ (r'[0-9]+L?', Number.Integer),
1001
+ (r'\n', Whitespace)
1002
+ ],
1003
+ 'template': [
1004
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
1005
+ ],
1006
+ 'import': [
1007
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
1008
+ ],
1009
+ }
1010
+
1011
+
1012
+ class CeylonLexer(RegexLexer):
1013
+ """
1014
+ For Ceylon source code.
1015
+ """
1016
+
1017
+ name = 'Ceylon'
1018
+ url = 'http://ceylon-lang.org/'
1019
+ aliases = ['ceylon']
1020
+ filenames = ['*.ceylon']
1021
+ mimetypes = ['text/x-ceylon']
1022
+ version_added = '1.6'
1023
+
1024
+ flags = re.MULTILINE | re.DOTALL
1025
+
1026
+ #: optional Comment or Whitespace
1027
+ _ws = r'(?:\s|//.*?\n|/[*].*?[*]/)+'
1028
+
1029
+ tokens = {
1030
+ 'root': [
1031
+ # method names
1032
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
1033
+ r'([a-zA-Z_]\w*)' # method name
1034
+ r'(\s*)(\()', # signature start
1035
+ bygroups(using(this), Name.Function, Whitespace, Operator)),
1036
+ (r'[^\S\n]+', Whitespace),
1037
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
1038
+ (r'/\*', Comment.Multiline, 'comment'),
1039
+ (r'(shared|abstract|formal|default|actual|variable|deprecated|small|'
1040
+ r'late|literal|doc|by|see|throws|optional|license|tagged|final|native|'
1041
+ r'annotation|sealed)\b', Name.Decorator),
1042
+ (r'(break|case|catch|continue|else|finally|for|in|'
1043
+ r'if|return|switch|this|throw|try|while|is|exists|dynamic|'
1044
+ r'nonempty|then|outer|assert|let)\b', Keyword),
1045
+ (r'(abstracts|extends|satisfies|'
1046
+ r'super|given|of|out|assign)\b', Keyword.Declaration),
1047
+ (r'(function|value|void|new)\b',
1048
+ Keyword.Type),
1049
+ (r'(assembly|module|package)(\s+)', bygroups(Keyword.Namespace, Whitespace)),
1050
+ (r'(true|false|null)\b', Keyword.Constant),
1051
+ (r'(class|interface|object|alias)(\s+)',
1052
+ bygroups(Keyword.Declaration, Whitespace), 'class'),
1053
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Whitespace), 'import'),
1054
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
1055
+ (r"'\\.'|'[^\\]'|'\\\{#[0-9a-fA-F]{4}\}'", String.Char),
1056
+ (r'(\.)([a-z_]\w*)',
1057
+ bygroups(Operator, Name.Attribute)),
1058
+ (r'[a-zA-Z_]\w*:', Name.Label),
1059
+ (r'[a-zA-Z_]\w*', Name),
1060
+ (r'[~^*!%&\[\](){}<>|+=:;,./?-]', Operator),
1061
+ (r'\d{1,3}(_\d{3})+\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
1062
+ (r'\d{1,3}(_\d{3})+\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
1063
+ Number.Float),
1064
+ (r'[0-9][0-9]*\.\d{1,3}(_\d{3})+[kMGTPmunpf]?', Number.Float),
1065
+ (r'[0-9][0-9]*\.[0-9]+([eE][+-]?[0-9]+)?[kMGTPmunpf]?',
1066
+ Number.Float),
1067
+ (r'#([0-9a-fA-F]{4})(_[0-9a-fA-F]{4})+', Number.Hex),
1068
+ (r'#[0-9a-fA-F]+', Number.Hex),
1069
+ (r'\$([01]{4})(_[01]{4})+', Number.Bin),
1070
+ (r'\$[01]+', Number.Bin),
1071
+ (r'\d{1,3}(_\d{3})+[kMGTP]?', Number.Integer),
1072
+ (r'[0-9]+[kMGTP]?', Number.Integer),
1073
+ (r'\n', Whitespace)
1074
+ ],
1075
+ 'class': [
1076
+ (r'[A-Za-z_]\w*', Name.Class, '#pop')
1077
+ ],
1078
+ 'import': [
1079
+ (r'[a-z][\w.]*',
1080
+ Name.Namespace, '#pop')
1081
+ ],
1082
+ 'comment': [
1083
+ (r'[^*/]', Comment.Multiline),
1084
+ (r'/\*', Comment.Multiline, '#push'),
1085
+ (r'\*/', Comment.Multiline, '#pop'),
1086
+ (r'[*/]', Comment.Multiline)
1087
+ ],
1088
+ }
1089
+
1090
+
1091
+ class KotlinLexer(RegexLexer):
1092
+ """
1093
+ For Kotlin source code.
1094
+ """
1095
+
1096
+ name = 'Kotlin'
1097
+ url = 'http://kotlinlang.org/'
1098
+ aliases = ['kotlin']
1099
+ filenames = ['*.kt', '*.kts']
1100
+ mimetypes = ['text/x-kotlin']
1101
+ version_added = '1.5'
1102
+
1103
+ flags = re.MULTILINE | re.DOTALL
1104
+
1105
+ kt_name = ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' +
1106
+ '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc', 'Cf',
1107
+ 'Mn', 'Mc') + ']*')
1108
+
1109
+ kt_space_name = ('@?[_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl') + ']' +
1110
+ '[' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Nl', 'Nd', 'Pc', 'Cf',
1111
+ 'Mn', 'Mc', 'Zs')
1112
+ + r'\'~!%^&*()+=|\[\]:;,.<>/\?-]*')
1113
+
1114
+ kt_id = '(' + kt_name + '|`' + kt_space_name + '`)'
1115
+
1116
+ modifiers = (r'actual|abstract|annotation|companion|const|crossinline|'
1117
+ r'data|enum|expect|external|final|infix|inline|inner|'
1118
+ r'internal|lateinit|noinline|open|operator|override|private|'
1119
+ r'protected|public|sealed|suspend|tailrec|value')
1120
+
1121
+ tokens = {
1122
+ 'root': [
1123
+ # Whitespaces
1124
+ (r'[^\S\n]+', Whitespace),
1125
+ (r'\s+', Whitespace),
1126
+ (r'\\$', String.Escape), # line continuation
1127
+ (r'\n', Whitespace),
1128
+ # Comments
1129
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
1130
+ (r'^(#!/.+?)(\n)', bygroups(Comment.Single, Whitespace)), # shebang for kotlin scripts
1131
+ (r'/[*].*?[*]/', Comment.Multiline),
1132
+ # Keywords
1133
+ (r'as\?', Keyword),
1134
+ (r'(as|break|by|catch|constructor|continue|do|dynamic|else|finally|'
1135
+ r'get|for|if|init|[!]*in|[!]*is|out|reified|return|set|super|this|'
1136
+ r'throw|try|typealias|typeof|vararg|when|where|while)\b', Keyword),
1137
+ (r'it\b', Name.Builtin),
1138
+ # Built-in types
1139
+ (words(('Boolean?', 'Byte?', 'Char?', 'Double?', 'Float?',
1140
+ 'Int?', 'Long?', 'Short?', 'String?', 'Any?', 'Unit?')), Keyword.Type),
1141
+ (words(('Boolean', 'Byte', 'Char', 'Double', 'Float',
1142
+ 'Int', 'Long', 'Short', 'String', 'Any', 'Unit'), suffix=r'\b'), Keyword.Type),
1143
+ # Constants
1144
+ (r'(true|false|null)\b', Keyword.Constant),
1145
+ # Imports
1146
+ (r'(package|import)(\s+)(\S+)', bygroups(Keyword, Whitespace, Name.Namespace)),
1147
+ # Dot access
1148
+ (r'(\?\.)((?:[^\W\d]|\$)[\w$]*)', bygroups(Operator, Name.Attribute)),
1149
+ (r'(\.)((?:[^\W\d]|\$)[\w$]*)', bygroups(Punctuation, Name.Attribute)),
1150
+ # Annotations
1151
+ (r'@[^\W\d][\w.]*', Name.Decorator),
1152
+ # Labels
1153
+ (r'[^\W\d][\w.]+@', Name.Decorator),
1154
+ # Object expression
1155
+ (r'(object)(\s+)(:)(\s+)', bygroups(Keyword, Whitespace, Punctuation, Whitespace), 'class'),
1156
+ # Types
1157
+ (r'((?:(?:' + modifiers + r'|fun)\s+)*)(class|interface|object)(\s+)',
1158
+ bygroups(using(this, state='modifiers'), Keyword.Declaration, Whitespace), 'class'),
1159
+ # Variables
1160
+ (r'(var|val)(\s+)(\()', bygroups(Keyword.Declaration, Whitespace, Punctuation),
1161
+ 'destructuring_assignment'),
1162
+ (r'((?:(?:' + modifiers + r')\s+)*)(var|val)(\s+)',
1163
+ bygroups(using(this, state='modifiers'), Keyword.Declaration, Whitespace), 'variable'),
1164
+ # Functions
1165
+ (r'((?:(?:' + modifiers + r')\s+)*)(fun)(\s+)',
1166
+ bygroups(using(this, state='modifiers'), Keyword.Declaration, Whitespace), 'function'),
1167
+ # Operators
1168
+ (r'::|!!|\?[:.]', Operator),
1169
+ (r'[~^*!%&\[\]<>|+=/?-]', Operator),
1170
+ # Punctuation
1171
+ (r'[{}();:.,]', Punctuation),
1172
+ # Strings
1173
+ (r'"""', String, 'multiline_string'),
1174
+ (r'"', String, 'string'),
1175
+ (r"'\\.'|'[^\\]'", String.Char),
1176
+ # Numbers
1177
+ (r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?[flFL]?|"
1178
+ r"0[xX][0-9a-fA-F]+[Ll]?", Number),
1179
+ # Identifiers
1180
+ (r'' + kt_id + r'((\?[^.])?)', Name) # additionally handle nullable types
1181
+ ],
1182
+ 'class': [
1183
+ (kt_id, Name.Class, '#pop')
1184
+ ],
1185
+ 'variable': [
1186
+ (kt_id, Name.Variable, '#pop')
1187
+ ],
1188
+ 'destructuring_assignment': [
1189
+ (r',', Punctuation),
1190
+ (r'\s+', Whitespace),
1191
+ (kt_id, Name.Variable),
1192
+ (r'(:)(\s+)(' + kt_id + ')', bygroups(Punctuation, Whitespace, Name)),
1193
+ (r'<', Operator, 'generic'),
1194
+ (r'\)', Punctuation, '#pop')
1195
+ ],
1196
+ 'function': [
1197
+ (r'<', Operator, 'generic'),
1198
+ (r'' + kt_id + r'(\.)' + kt_id, bygroups(Name, Punctuation, Name.Function), '#pop'),
1199
+ (kt_id, Name.Function, '#pop')
1200
+ ],
1201
+ 'generic': [
1202
+ (r'(>)(\s*)', bygroups(Operator, Whitespace), '#pop'),
1203
+ (r':', Punctuation),
1204
+ (r'(reified|out|in)\b', Keyword),
1205
+ (r',', Punctuation),
1206
+ (r'\s+', Whitespace),
1207
+ (kt_id, Name)
1208
+ ],
1209
+ 'modifiers': [
1210
+ (r'\w+', Keyword.Declaration),
1211
+ (r'\s+', Whitespace),
1212
+ default('#pop')
1213
+ ],
1214
+ 'string': [
1215
+ (r'"', String, '#pop'),
1216
+ include('string_common')
1217
+ ],
1218
+ 'multiline_string': [
1219
+ (r'"""', String, '#pop'),
1220
+ (r'"', String),
1221
+ include('string_common')
1222
+ ],
1223
+ 'string_common': [
1224
+ (r'\\\\', String), # escaped backslash
1225
+ (r'\\"', String), # escaped quote
1226
+ (r'\\', String), # bare backslash
1227
+ (r'\$\{', String.Interpol, 'interpolation'),
1228
+ (r'(\$)(\w+)', bygroups(String.Interpol, Name)),
1229
+ (r'[^\\"$]+', String)
1230
+ ],
1231
+ 'interpolation': [
1232
+ (r'"', String),
1233
+ (r'\$\{', String.Interpol, 'interpolation'),
1234
+ (r'\{', Punctuation, 'scope'),
1235
+ (r'\}', String.Interpol, '#pop'),
1236
+ include('root')
1237
+ ],
1238
+ 'scope': [
1239
+ (r'\{', Punctuation, 'scope'),
1240
+ (r'\}', Punctuation, '#pop'),
1241
+ include('root')
1242
+ ]
1243
+ }
1244
+
1245
+
1246
+ class XtendLexer(RegexLexer):
1247
+ """
1248
+ For Xtend source code.
1249
+ """
1250
+
1251
+ name = 'Xtend'
1252
+ url = 'https://www.eclipse.org/xtend/'
1253
+ aliases = ['xtend']
1254
+ filenames = ['*.xtend']
1255
+ mimetypes = ['text/x-xtend']
1256
+ version_added = '1.6'
1257
+
1258
+ flags = re.MULTILINE | re.DOTALL
1259
+
1260
+ tokens = {
1261
+ 'root': [
1262
+ # method names
1263
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
1264
+ r'([a-zA-Z_$][\w$]*)' # method name
1265
+ r'(\s*)(\()', # signature start
1266
+ bygroups(using(this), Name.Function, Whitespace, Operator)),
1267
+ (r'[^\S\n]+', Whitespace),
1268
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
1269
+ (r'/\*.*?\*/', Comment.Multiline),
1270
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
1271
+ (r'(assert|break|case|catch|continue|default|do|else|finally|for|'
1272
+ r'if|goto|instanceof|new|return|switch|this|throw|try|while|IF|'
1273
+ r'ELSE|ELSEIF|ENDIF|FOR|ENDFOR|SEPARATOR|BEFORE|AFTER)\b',
1274
+ Keyword),
1275
+ (r'(def|abstract|const|enum|extends|final|implements|native|private|'
1276
+ r'protected|public|static|strictfp|super|synchronized|throws|'
1277
+ r'transient|volatile|val|var)\b', Keyword.Declaration),
1278
+ (r'(boolean|byte|char|double|float|int|long|short|void)\b',
1279
+ Keyword.Type),
1280
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Whitespace)),
1281
+ (r'(true|false|null)\b', Keyword.Constant),
1282
+ (r'(class|interface)(\s+)', bygroups(Keyword.Declaration, Whitespace),
1283
+ 'class'),
1284
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Whitespace), 'import'),
1285
+ (r"(''')", String, 'template'),
1286
+ (r'(\u00BB)', String, 'template'),
1287
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
1288
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
1289
+ (r'[a-zA-Z_]\w*:', Name.Label),
1290
+ (r'[a-zA-Z_$]\w*', Name),
1291
+ (r'[~^*!%&\[\](){}<>\|+=:;,./?-]', Operator),
1292
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
1293
+ (r'0x[0-9a-fA-F]+', Number.Hex),
1294
+ (r'[0-9]+L?', Number.Integer),
1295
+ (r'\n', Whitespace)
1296
+ ],
1297
+ 'class': [
1298
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
1299
+ ],
1300
+ 'import': [
1301
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
1302
+ ],
1303
+ 'template': [
1304
+ (r"'''", String, '#pop'),
1305
+ (r'\u00AB', String, '#pop'),
1306
+ (r'.', String)
1307
+ ],
1308
+ }
1309
+
1310
+
1311
+ class PigLexer(RegexLexer):
1312
+ """
1313
+ For Pig Latin source code.
1314
+ """
1315
+
1316
+ name = 'Pig'
1317
+ url = 'https://pig.apache.org/'
1318
+ aliases = ['pig']
1319
+ filenames = ['*.pig']
1320
+ mimetypes = ['text/x-pig']
1321
+ version_added = '2.0'
1322
+
1323
+ flags = re.MULTILINE | re.IGNORECASE
1324
+
1325
+ tokens = {
1326
+ 'root': [
1327
+ (r'\s+', Whitespace),
1328
+ (r'--.*', Comment),
1329
+ (r'/\*[\w\W]*?\*/', Comment.Multiline),
1330
+ (r'\\$', String.Escape),
1331
+ (r'\\', Text),
1332
+ (r'\'(?:\\[ntbrf\\\']|\\u[0-9a-f]{4}|[^\'\\\n\r])*\'', String),
1333
+ include('keywords'),
1334
+ include('types'),
1335
+ include('builtins'),
1336
+ include('punct'),
1337
+ include('operators'),
1338
+ (r'[0-9]*\.[0-9]+(e[0-9]+)?[fd]?', Number.Float),
1339
+ (r'0x[0-9a-f]+', Number.Hex),
1340
+ (r'[0-9]+L?', Number.Integer),
1341
+ (r'\n', Whitespace),
1342
+ (r'([a-z_]\w*)(\s*)(\()',
1343
+ bygroups(Name.Function, Whitespace, Punctuation)),
1344
+ (r'[()#:]', Text),
1345
+ (r'[^(:#\'")\s]+', Text),
1346
+ (r'\S+\s+', Text) # TODO: make tests pass without \s+
1347
+ ],
1348
+ 'keywords': [
1349
+ (r'(assert|and|any|all|arrange|as|asc|bag|by|cache|CASE|cat|cd|cp|'
1350
+ r'%declare|%default|define|dense|desc|describe|distinct|du|dump|'
1351
+ r'eval|exex|explain|filter|flatten|foreach|full|generate|group|'
1352
+ r'help|if|illustrate|import|inner|input|into|is|join|kill|left|'
1353
+ r'limit|load|ls|map|matches|mkdir|mv|not|null|onschema|or|order|'
1354
+ r'outer|output|parallel|pig|pwd|quit|register|returns|right|rm|'
1355
+ r'rmf|rollup|run|sample|set|ship|split|stderr|stdin|stdout|store|'
1356
+ r'stream|through|union|using|void)\b', Keyword)
1357
+ ],
1358
+ 'builtins': [
1359
+ (r'(AVG|BinStorage|cogroup|CONCAT|copyFromLocal|copyToLocal|COUNT|'
1360
+ r'cross|DIFF|MAX|MIN|PigDump|PigStorage|SIZE|SUM|TextLoader|'
1361
+ r'TOKENIZE)\b', Name.Builtin)
1362
+ ],
1363
+ 'types': [
1364
+ (r'(bytearray|BIGINTEGER|BIGDECIMAL|chararray|datetime|double|float|'
1365
+ r'int|long|tuple)\b', Keyword.Type)
1366
+ ],
1367
+ 'punct': [
1368
+ (r'[;(){}\[\]]', Punctuation),
1369
+ ],
1370
+ 'operators': [
1371
+ (r'[#=,./%+\-?]', Operator),
1372
+ (r'(eq|gt|lt|gte|lte|neq|matches)\b', Operator),
1373
+ (r'(==|<=|<|>=|>|!=)', Operator),
1374
+ ],
1375
+ }
1376
+
1377
+
1378
+ class GoloLexer(RegexLexer):
1379
+ """
1380
+ For Golo source code.
1381
+ """
1382
+
1383
+ name = 'Golo'
1384
+ url = 'http://golo-lang.org/'
1385
+ filenames = ['*.golo']
1386
+ aliases = ['golo']
1387
+ version_added = '2.0'
1388
+
1389
+ tokens = {
1390
+ 'root': [
1391
+ (r'[^\S\n]+', Whitespace),
1392
+
1393
+ (r'#.*$', Comment),
1394
+
1395
+ (r'(\^|\.\.\.|:|\?:|->|==|!=|=|\+|\*|%|/|<=|<|>=|>|=|\.)',
1396
+ Operator),
1397
+ (r'(?<=[^-])(-)(?=[^-])', Operator),
1398
+
1399
+ (r'(?<=[^`])(is|isnt|and|or|not|oftype|in|orIfNull)\b', Operator.Word),
1400
+ (r'[]{}|(),[]', Punctuation),
1401
+
1402
+ (r'(module|import)(\s+)',
1403
+ bygroups(Keyword.Namespace, Whitespace),
1404
+ 'modname'),
1405
+ (r'\b([a-zA-Z_][\w$.]*)(::)', bygroups(Name.Namespace, Punctuation)),
1406
+ (r'\b([a-zA-Z_][\w$]*(?:\.[a-zA-Z_][\w$]*)+)\b', Name.Namespace),
1407
+
1408
+ (r'(let|var)(\s+)',
1409
+ bygroups(Keyword.Declaration, Whitespace),
1410
+ 'varname'),
1411
+ (r'(struct)(\s+)',
1412
+ bygroups(Keyword.Declaration, Whitespace),
1413
+ 'structname'),
1414
+ (r'(function)(\s+)',
1415
+ bygroups(Keyword.Declaration, Whitespace),
1416
+ 'funcname'),
1417
+
1418
+ (r'(null|true|false)\b', Keyword.Constant),
1419
+ (r'(augment|pimp'
1420
+ r'|if|else|case|match|return'
1421
+ r'|case|when|then|otherwise'
1422
+ r'|while|for|foreach'
1423
+ r'|try|catch|finally|throw'
1424
+ r'|local'
1425
+ r'|continue|break)\b', Keyword),
1426
+
1427
+ (r'(map|array|list|set|vector|tuple)(\[)',
1428
+ bygroups(Name.Builtin, Punctuation)),
1429
+ (r'(print|println|readln|raise|fun'
1430
+ r'|asInterfaceInstance)\b', Name.Builtin),
1431
+ (r'(`?[a-zA-Z_][\w$]*)(\()',
1432
+ bygroups(Name.Function, Punctuation)),
1433
+
1434
+ (r'-?[\d_]*\.[\d_]*([eE][+-]?\d[\d_]*)?F?', Number.Float),
1435
+ (r'0[0-7]+j?', Number.Oct),
1436
+ (r'0[xX][a-fA-F0-9]+', Number.Hex),
1437
+ (r'-?\d[\d_]*L', Number.Integer.Long),
1438
+ (r'-?\d[\d_]*', Number.Integer),
1439
+
1440
+ (r'`?[a-zA-Z_][\w$]*', Name),
1441
+ (r'@[a-zA-Z_][\w$.]*', Name.Decorator),
1442
+
1443
+ (r'"""', String, combined('stringescape', 'triplestring')),
1444
+ (r'"', String, combined('stringescape', 'doublestring')),
1445
+ (r"'", String, combined('stringescape', 'singlestring')),
1446
+ (r'----((.|\n)*?)----', String.Doc)
1447
+
1448
+ ],
1449
+
1450
+ 'funcname': [
1451
+ (r'`?[a-zA-Z_][\w$]*', Name.Function, '#pop'),
1452
+ ],
1453
+ 'modname': [
1454
+ (r'[a-zA-Z_][\w$.]*\*?', Name.Namespace, '#pop')
1455
+ ],
1456
+ 'structname': [
1457
+ (r'`?[\w.]+\*?', Name.Class, '#pop')
1458
+ ],
1459
+ 'varname': [
1460
+ (r'`?[a-zA-Z_][\w$]*', Name.Variable, '#pop'),
1461
+ ],
1462
+ 'string': [
1463
+ (r'[^\\\'"\n]+', String),
1464
+ (r'[\'"\\]', String)
1465
+ ],
1466
+ 'stringescape': [
1467
+ (r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
1468
+ r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
1469
+ ],
1470
+ 'triplestring': [
1471
+ (r'"""', String, '#pop'),
1472
+ include('string'),
1473
+ (r'\n', String),
1474
+ ],
1475
+ 'doublestring': [
1476
+ (r'"', String.Double, '#pop'),
1477
+ include('string'),
1478
+ ],
1479
+ 'singlestring': [
1480
+ (r"'", String, '#pop'),
1481
+ include('string'),
1482
+ ],
1483
+ 'operators': [
1484
+ (r'[#=,./%+\-?]', Operator),
1485
+ (r'(eq|gt|lt|gte|lte|neq|matches)\b', Operator),
1486
+ (r'(==|<=|<|>=|>|!=)', Operator),
1487
+ ],
1488
+ }
1489
+
1490
+
1491
+ class JasminLexer(RegexLexer):
1492
+ """
1493
+ For Jasmin assembly code.
1494
+ """
1495
+
1496
+ name = 'Jasmin'
1497
+ url = 'http://jasmin.sourceforge.net/'
1498
+ aliases = ['jasmin', 'jasminxt']
1499
+ filenames = ['*.j']
1500
+ version_added = '2.0'
1501
+
1502
+ _whitespace = r' \n\t\r'
1503
+ _ws = rf'(?:[{_whitespace}]+)'
1504
+ _separator = rf'{_whitespace}:='
1505
+ _break = rf'(?=[{_separator}]|$)'
1506
+ _name = rf'[^{_separator}]+'
1507
+ _unqualified_name = rf'(?:[^{_separator}.;\[/]+)'
1508
+
1509
+ tokens = {
1510
+ 'default': [
1511
+ (r'\n', Whitespace, '#pop'),
1512
+ (r"'", String.Single, ('#pop', 'quote')),
1513
+ (r'"', String.Double, 'string'),
1514
+ (r'=', Punctuation),
1515
+ (r':', Punctuation, 'label'),
1516
+ (_ws, Whitespace),
1517
+ (r';.*', Comment.Single),
1518
+ (rf'(\$[-+])?0x-?[\da-fA-F]+{_break}', Number.Hex),
1519
+ (rf'(\$[-+]|\+)?-?\d+{_break}', Number.Integer),
1520
+ (r'-?(\d+\.\d*|\.\d+)([eE][-+]?\d+)?[fFdD]?'
1521
+ rf'[\x00-\x08\x0b\x0c\x0e-\x1f]*{_break}', Number.Float),
1522
+ (rf'\${_name}', Name.Variable),
1523
+
1524
+ # Directives
1525
+ (rf'\.annotation{_break}', Keyword.Reserved, 'annotation'),
1526
+ (r'(\.attribute|\.bytecode|\.debug|\.deprecated|\.enclosing|'
1527
+ r'\.interface|\.line|\.signature|\.source|\.stack|\.var|abstract|'
1528
+ r'annotation|bridge|class|default|enum|field|final|fpstrict|'
1529
+ r'interface|native|private|protected|public|signature|static|'
1530
+ rf'synchronized|synthetic|transient|varargs|volatile){_break}',
1531
+ Keyword.Reserved),
1532
+ (rf'\.catch{_break}', Keyword.Reserved, 'caught-exception'),
1533
+ (r'(\.class|\.implements|\.inner|\.super|inner|invisible|'
1534
+ rf'invisibleparam|outer|visible|visibleparam){_break}',
1535
+ Keyword.Reserved, 'class/convert-dots'),
1536
+ (rf'\.field{_break}', Keyword.Reserved,
1537
+ ('descriptor/convert-dots', 'field')),
1538
+ (rf'(\.end|\.limit|use){_break}', Keyword.Reserved,
1539
+ 'no-verification'),
1540
+ (rf'\.method{_break}', Keyword.Reserved, 'method'),
1541
+ (rf'\.set{_break}', Keyword.Reserved, 'var'),
1542
+ (rf'\.throws{_break}', Keyword.Reserved, 'exception'),
1543
+ (rf'(from|offset|to|using){_break}', Keyword.Reserved, 'label'),
1544
+ (rf'is{_break}', Keyword.Reserved,
1545
+ ('descriptor/convert-dots', 'var')),
1546
+ (rf'(locals|stack){_break}', Keyword.Reserved, 'verification'),
1547
+ (rf'method{_break}', Keyword.Reserved, 'enclosing-method'),
1548
+
1549
+ # Instructions
1550
+ (words((
1551
+ 'aaload', 'aastore', 'aconst_null', 'aload', 'aload_0', 'aload_1', 'aload_2',
1552
+ 'aload_3', 'aload_w', 'areturn', 'arraylength', 'astore', 'astore_0', 'astore_1',
1553
+ 'astore_2', 'astore_3', 'astore_w', 'athrow', 'baload', 'bastore', 'bipush',
1554
+ 'breakpoint', 'caload', 'castore', 'd2f', 'd2i', 'd2l', 'dadd', 'daload', 'dastore',
1555
+ 'dcmpg', 'dcmpl', 'dconst_0', 'dconst_1', 'ddiv', 'dload', 'dload_0', 'dload_1',
1556
+ 'dload_2', 'dload_3', 'dload_w', 'dmul', 'dneg', 'drem', 'dreturn', 'dstore', 'dstore_0',
1557
+ 'dstore_1', 'dstore_2', 'dstore_3', 'dstore_w', 'dsub', 'dup', 'dup2', 'dup2_x1',
1558
+ 'dup2_x2', 'dup_x1', 'dup_x2', 'f2d', 'f2i', 'f2l', 'fadd', 'faload', 'fastore', 'fcmpg',
1559
+ 'fcmpl', 'fconst_0', 'fconst_1', 'fconst_2', 'fdiv', 'fload', 'fload_0', 'fload_1',
1560
+ 'fload_2', 'fload_3', 'fload_w', 'fmul', 'fneg', 'frem', 'freturn', 'fstore', 'fstore_0',
1561
+ 'fstore_1', 'fstore_2', 'fstore_3', 'fstore_w', 'fsub', 'i2b', 'i2c', 'i2d', 'i2f', 'i2l',
1562
+ 'i2s', 'iadd', 'iaload', 'iand', 'iastore', 'iconst_0', 'iconst_1', 'iconst_2',
1563
+ 'iconst_3', 'iconst_4', 'iconst_5', 'iconst_m1', 'idiv', 'iinc', 'iinc_w', 'iload',
1564
+ 'iload_0', 'iload_1', 'iload_2', 'iload_3', 'iload_w', 'imul', 'ineg', 'int2byte',
1565
+ 'int2char', 'int2short', 'ior', 'irem', 'ireturn', 'ishl', 'ishr', 'istore', 'istore_0',
1566
+ 'istore_1', 'istore_2', 'istore_3', 'istore_w', 'isub', 'iushr', 'ixor', 'l2d', 'l2f',
1567
+ 'l2i', 'ladd', 'laload', 'land', 'lastore', 'lcmp', 'lconst_0', 'lconst_1', 'ldc2_w',
1568
+ 'ldiv', 'lload', 'lload_0', 'lload_1', 'lload_2', 'lload_3', 'lload_w', 'lmul', 'lneg',
1569
+ 'lookupswitch', 'lor', 'lrem', 'lreturn', 'lshl', 'lshr', 'lstore', 'lstore_0',
1570
+ 'lstore_1', 'lstore_2', 'lstore_3', 'lstore_w', 'lsub', 'lushr', 'lxor',
1571
+ 'monitorenter', 'monitorexit', 'nop', 'pop', 'pop2', 'ret', 'ret_w', 'return', 'saload',
1572
+ 'sastore', 'sipush', 'swap'), suffix=_break), Keyword.Reserved),
1573
+ (rf'(anewarray|checkcast|instanceof|ldc|ldc_w|new){_break}',
1574
+ Keyword.Reserved, 'class/no-dots'),
1575
+ (r'invoke(dynamic|interface|nonvirtual|special|'
1576
+ rf'static|virtual){_break}', Keyword.Reserved,
1577
+ 'invocation'),
1578
+ (rf'(getfield|putfield){_break}', Keyword.Reserved,
1579
+ ('descriptor/no-dots', 'field')),
1580
+ (rf'(getstatic|putstatic){_break}', Keyword.Reserved,
1581
+ ('descriptor/no-dots', 'static')),
1582
+ (words((
1583
+ 'goto', 'goto_w', 'if_acmpeq', 'if_acmpne', 'if_icmpeq',
1584
+ 'if_icmpge', 'if_icmpgt', 'if_icmple', 'if_icmplt', 'if_icmpne',
1585
+ 'ifeq', 'ifge', 'ifgt', 'ifle', 'iflt', 'ifne', 'ifnonnull',
1586
+ 'ifnull', 'jsr', 'jsr_w'), suffix=_break),
1587
+ Keyword.Reserved, 'label'),
1588
+ (rf'(multianewarray|newarray){_break}', Keyword.Reserved,
1589
+ 'descriptor/convert-dots'),
1590
+ (rf'tableswitch{_break}', Keyword.Reserved, 'table')
1591
+ ],
1592
+ 'quote': [
1593
+ (r"'", String.Single, '#pop'),
1594
+ (r'\\u[\da-fA-F]{4}', String.Escape),
1595
+ (r"[^'\\]+", String.Single)
1596
+ ],
1597
+ 'string': [
1598
+ (r'"', String.Double, '#pop'),
1599
+ (r'\\([nrtfb"\'\\]|u[\da-fA-F]{4}|[0-3]?[0-7]{1,2})',
1600
+ String.Escape),
1601
+ (r'[^"\\]+', String.Double)
1602
+ ],
1603
+ 'root': [
1604
+ (r'\n+', Whitespace),
1605
+ (r"'", String.Single, 'quote'),
1606
+ include('default'),
1607
+ (rf'({_name})([ \t\r]*)(:)',
1608
+ bygroups(Name.Label, Whitespace, Punctuation)),
1609
+ (_name, String.Other)
1610
+ ],
1611
+ 'annotation': [
1612
+ (r'\n', Whitespace, ('#pop', 'annotation-body')),
1613
+ (rf'default{_break}', Keyword.Reserved,
1614
+ ('#pop', 'annotation-default')),
1615
+ include('default')
1616
+ ],
1617
+ 'annotation-body': [
1618
+ (r'\n+', Whitespace),
1619
+ (rf'\.end{_break}', Keyword.Reserved, '#pop'),
1620
+ include('default'),
1621
+ (_name, String.Other, ('annotation-items', 'descriptor/no-dots'))
1622
+ ],
1623
+ 'annotation-default': [
1624
+ (r'\n+', Whitespace),
1625
+ (rf'\.end{_break}', Keyword.Reserved, '#pop'),
1626
+ include('default'),
1627
+ default(('annotation-items', 'descriptor/no-dots'))
1628
+ ],
1629
+ 'annotation-items': [
1630
+ (r"'", String.Single, 'quote'),
1631
+ include('default'),
1632
+ (_name, String.Other)
1633
+ ],
1634
+ 'caught-exception': [
1635
+ (rf'all{_break}', Keyword, '#pop'),
1636
+ include('exception')
1637
+ ],
1638
+ 'class/convert-dots': [
1639
+ include('default'),
1640
+ (rf'(L)((?:{_unqualified_name}[/.])*)({_name})(;)',
1641
+ bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
1642
+ '#pop'),
1643
+ (rf'((?:{_unqualified_name}[/.])*)({_name})',
1644
+ bygroups(Name.Namespace, Name.Class), '#pop')
1645
+ ],
1646
+ 'class/no-dots': [
1647
+ include('default'),
1648
+ (r'\[+', Punctuation, ('#pop', 'descriptor/no-dots')),
1649
+ (rf'(L)((?:{_unqualified_name}/)*)({_name})(;)',
1650
+ bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
1651
+ '#pop'),
1652
+ (rf'((?:{_unqualified_name}/)*)({_name})',
1653
+ bygroups(Name.Namespace, Name.Class), '#pop')
1654
+ ],
1655
+ 'descriptor/convert-dots': [
1656
+ include('default'),
1657
+ (r'\[+', Punctuation),
1658
+ (rf'(L)((?:{_unqualified_name}[/.])*)({_name}?)(;)',
1659
+ bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
1660
+ '#pop'),
1661
+ (rf'[^{_separator}\[)L]+', Keyword.Type, '#pop'),
1662
+ default('#pop')
1663
+ ],
1664
+ 'descriptor/no-dots': [
1665
+ include('default'),
1666
+ (r'\[+', Punctuation),
1667
+ (rf'(L)((?:{_unqualified_name}/)*)({_name})(;)',
1668
+ bygroups(Keyword.Type, Name.Namespace, Name.Class, Punctuation),
1669
+ '#pop'),
1670
+ (rf'[^{_separator}\[)L]+', Keyword.Type, '#pop'),
1671
+ default('#pop')
1672
+ ],
1673
+ 'descriptors/convert-dots': [
1674
+ (r'\)', Punctuation, '#pop'),
1675
+ default('descriptor/convert-dots')
1676
+ ],
1677
+ 'enclosing-method': [
1678
+ (_ws, Whitespace),
1679
+ (rf'(?=[^{_separator}]*\()', Text, ('#pop', 'invocation')),
1680
+ default(('#pop', 'class/convert-dots'))
1681
+ ],
1682
+ 'exception': [
1683
+ include('default'),
1684
+ (rf'((?:{_unqualified_name}[/.])*)({_name})',
1685
+ bygroups(Name.Namespace, Name.Exception), '#pop')
1686
+ ],
1687
+ 'field': [
1688
+ (rf'static{_break}', Keyword.Reserved, ('#pop', 'static')),
1689
+ include('default'),
1690
+ (rf'((?:{_unqualified_name}[/.](?=[^{_separator}]*[/.]))*)({_unqualified_name}[/.])?({_name})',
1691
+ bygroups(Name.Namespace, Name.Class, Name.Variable.Instance),
1692
+ '#pop')
1693
+ ],
1694
+ 'invocation': [
1695
+ include('default'),
1696
+ (rf'((?:{_unqualified_name}[/.](?=[^{_separator}(]*[/.]))*)({_unqualified_name}[/.])?({_name})(\()',
1697
+ bygroups(Name.Namespace, Name.Class, Name.Function, Punctuation),
1698
+ ('#pop', 'descriptor/convert-dots', 'descriptors/convert-dots',
1699
+ 'descriptor/convert-dots'))
1700
+ ],
1701
+ 'label': [
1702
+ include('default'),
1703
+ (_name, Name.Label, '#pop')
1704
+ ],
1705
+ 'method': [
1706
+ include('default'),
1707
+ (rf'({_name})(\()', bygroups(Name.Function, Punctuation),
1708
+ ('#pop', 'descriptor/convert-dots', 'descriptors/convert-dots',
1709
+ 'descriptor/convert-dots'))
1710
+ ],
1711
+ 'no-verification': [
1712
+ (rf'(locals|method|stack){_break}', Keyword.Reserved, '#pop'),
1713
+ include('default')
1714
+ ],
1715
+ 'static': [
1716
+ include('default'),
1717
+ (rf'((?:{_unqualified_name}[/.](?=[^{_separator}]*[/.]))*)({_unqualified_name}[/.])?({_name})',
1718
+ bygroups(Name.Namespace, Name.Class, Name.Variable.Class), '#pop')
1719
+ ],
1720
+ 'table': [
1721
+ (r'\n+', Whitespace),
1722
+ (rf'default{_break}', Keyword.Reserved, '#pop'),
1723
+ include('default'),
1724
+ (_name, Name.Label)
1725
+ ],
1726
+ 'var': [
1727
+ include('default'),
1728
+ (_name, Name.Variable, '#pop')
1729
+ ],
1730
+ 'verification': [
1731
+ include('default'),
1732
+ (rf'(Double|Float|Integer|Long|Null|Top|UninitializedThis){_break}', Keyword, '#pop'),
1733
+ (rf'Object{_break}', Keyword, ('#pop', 'class/no-dots')),
1734
+ (rf'Uninitialized{_break}', Keyword, ('#pop', 'label'))
1735
+ ]
1736
+ }
1737
+
1738
+ def analyse_text(text):
1739
+ score = 0
1740
+ if re.search(r'^\s*\.class\s', text, re.MULTILINE):
1741
+ score += 0.5
1742
+ if re.search(r'^\s*[a-z]+_[a-z]+\b', text, re.MULTILINE):
1743
+ score += 0.3
1744
+ if re.search(r'^\s*\.(attribute|bytecode|debug|deprecated|enclosing|'
1745
+ r'inner|interface|limit|set|signature|stack)\b', text,
1746
+ re.MULTILINE):
1747
+ score += 0.6
1748
+ return min(score, 1.0)
1749
+
1750
+
1751
+ class SarlLexer(RegexLexer):
1752
+ """
1753
+ For SARL source code.
1754
+ """
1755
+
1756
+ name = 'SARL'
1757
+ url = 'http://www.sarl.io'
1758
+ aliases = ['sarl']
1759
+ filenames = ['*.sarl']
1760
+ mimetypes = ['text/x-sarl']
1761
+ version_added = '2.4'
1762
+
1763
+ flags = re.MULTILINE | re.DOTALL
1764
+
1765
+ tokens = {
1766
+ 'root': [
1767
+ # method names
1768
+ (r'^(\s*(?:[a-zA-Z_][\w.\[\]]*\s+)+?)' # return arguments
1769
+ r'([a-zA-Z_$][\w$]*)' # method name
1770
+ r'(\s*)(\()', # signature start
1771
+ bygroups(using(this), Name.Function, Whitespace, Operator)),
1772
+ (r'[^\S\n]+', Whitespace),
1773
+ (r'(//.*?)(\n)', bygroups(Comment.Single, Whitespace)),
1774
+ (r'/\*.*?\*/', Comment.Multiline),
1775
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
1776
+ (r'(as|break|case|catch|default|do|else|extends|extension|finally|'
1777
+ r'fires|for|if|implements|instanceof|new|on|requires|return|super|'
1778
+ r'switch|throw|throws|try|typeof|uses|while|with)\b',
1779
+ Keyword),
1780
+ (r'(abstract|def|dispatch|final|native|override|private|protected|'
1781
+ r'public|static|strictfp|synchronized|transient|val|var|volatile)\b',
1782
+ Keyword.Declaration),
1783
+ (r'(boolean|byte|char|double|float|int|long|short|void)\b',
1784
+ Keyword.Type),
1785
+ (r'(package)(\s+)', bygroups(Keyword.Namespace, Whitespace)),
1786
+ (r'(false|it|null|occurrence|this|true|void)\b', Keyword.Constant),
1787
+ (r'(agent|annotation|artifact|behavior|capacity|class|enum|event|'
1788
+ r'interface|skill|space)(\s+)', bygroups(Keyword.Declaration, Whitespace),
1789
+ 'class'),
1790
+ (r'(import)(\s+)', bygroups(Keyword.Namespace, Whitespace), 'import'),
1791
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
1792
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
1793
+ (r'[a-zA-Z_]\w*:', Name.Label),
1794
+ (r'[a-zA-Z_$]\w*', Name),
1795
+ (r'[~^*!%&\[\](){}<>\|+=:;,./?-]', Operator),
1796
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
1797
+ (r'0x[0-9a-fA-F]+', Number.Hex),
1798
+ (r'[0-9]+L?', Number.Integer),
1799
+ (r'\n', Whitespace)
1800
+ ],
1801
+ 'class': [
1802
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
1803
+ ],
1804
+ 'import': [
1805
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
1806
+ ],
1807
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/kuin.py ADDED
@@ -0,0 +1,332 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.kuin
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Kuin language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, include, using, this, bygroups, words
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation, Whitespace
14
+
15
+ __all__ = ['KuinLexer']
16
+
17
+
18
+ class KuinLexer(RegexLexer):
19
+ """
20
+ For Kuin source code.
21
+ """
22
+ name = 'Kuin'
23
+ url = 'https://github.com/kuina/Kuin'
24
+ aliases = ['kuin']
25
+ filenames = ['*.kn']
26
+ version_added = '2.9'
27
+
28
+ tokens = {
29
+ 'root': [
30
+ include('statement'),
31
+ ],
32
+ 'statement': [
33
+ # Whitespace / Comment
34
+ include('whitespace'),
35
+
36
+ # Block-statement
37
+ (r'(\+?)([ \t]*)(\*?)([ \t]*)(\bfunc)([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*)',
38
+ bygroups(Keyword,Whitespace, Keyword, Whitespace, Keyword,
39
+ using(this), Name.Function), 'func_'),
40
+ (r'\b(class)([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*)',
41
+ bygroups(Keyword, using(this), Name.Class), 'class_'),
42
+ (r'\b(enum)([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*)',
43
+ bygroups(Keyword, using(this), Name.Constant), 'enum_'),
44
+ (r'\b(block)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?',
45
+ bygroups(Keyword, using(this), Name.Other), 'block_'),
46
+ (r'\b(ifdef)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?',
47
+ bygroups(Keyword, using(this), Name.Other), 'ifdef_'),
48
+ (r'\b(if)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?',
49
+ bygroups(Keyword, using(this), Name.Other), 'if_'),
50
+ (r'\b(switch)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?',
51
+ bygroups(Keyword, using(this), Name.Other), 'switch_'),
52
+ (r'\b(while)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?',
53
+ bygroups(Keyword, using(this), Name.Other), 'while_'),
54
+ (r'\b(for)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?',
55
+ bygroups(Keyword, using(this), Name.Other), 'for_'),
56
+ (r'\b(foreach)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?',
57
+ bygroups(Keyword, using(this), Name.Other), 'foreach_'),
58
+ (r'\b(try)\b(?:([ \t]+(?:\n\s*\|)*[ \t]*)([a-zA-Z_][0-9a-zA-Z_]*))?',
59
+ bygroups(Keyword, using(this), Name.Other), 'try_'),
60
+
61
+ # Line-statement
62
+ (r'\b(do)\b', Keyword, 'do'),
63
+ (r'(\+?[ \t]*\bvar)\b', Keyword, 'var'),
64
+ (r'\b(const)\b', Keyword, 'const'),
65
+ (r'\b(ret)\b', Keyword, 'ret'),
66
+ (r'\b(throw)\b', Keyword, 'throw'),
67
+ (r'\b(alias)\b', Keyword, 'alias'),
68
+ (r'\b(assert)\b', Keyword, 'assert'),
69
+ (r'\|', Text, 'continued_line'),
70
+ (r'[ \t]*\n', Whitespace),
71
+ ],
72
+
73
+ # Whitespace / Comment
74
+ 'whitespace': [
75
+ (r'^([ \t]*)(;.*)', bygroups(Comment.Single, Whitespace)),
76
+ (r'[ \t]+(?![; \t])', Whitespace),
77
+ (r'\{', Comment.Multiline, 'multiline_comment'),
78
+ ],
79
+ 'multiline_comment': [
80
+ (r'\{', Comment.Multiline, 'multiline_comment'),
81
+ (r'(?:\s*;.*|[^{}\n]+)', Comment.Multiline),
82
+ (r'\n', Comment.Multiline),
83
+ (r'\}', Comment.Multiline, '#pop'),
84
+ ],
85
+
86
+ # Block-statement
87
+ 'func_': [
88
+ include('expr'),
89
+ (r'\n', Whitespace, 'func'),
90
+ ],
91
+ 'func': [
92
+ (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(func)\b',
93
+ bygroups(Keyword, using(this), Keyword), '#pop:2'),
94
+ include('statement'),
95
+ ],
96
+ 'class_': [
97
+ include('expr'),
98
+ (r'\n', Whitespace, 'class'),
99
+ ],
100
+ 'class': [
101
+ (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(class)\b',
102
+ bygroups(Keyword, using(this), Keyword), '#pop:2'),
103
+ include('statement'),
104
+ ],
105
+ 'enum_': [
106
+ include('expr'),
107
+ (r'\n', Whitespace, 'enum'),
108
+ ],
109
+ 'enum': [
110
+ (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(enum)\b',
111
+ bygroups(Keyword, using(this), Keyword), '#pop:2'),
112
+ include('expr'),
113
+ (r'\n', Whitespace),
114
+ ],
115
+ 'block_': [
116
+ include('expr'),
117
+ (r'\n', Whitespace, 'block'),
118
+ ],
119
+ 'block': [
120
+ (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(block)\b',
121
+ bygroups(Keyword, using(this), Keyword), '#pop:2'),
122
+ include('statement'),
123
+ include('break'),
124
+ include('skip'),
125
+ ],
126
+ 'ifdef_': [
127
+ include('expr'),
128
+ (r'\n', Whitespace, 'ifdef'),
129
+ ],
130
+ 'ifdef': [
131
+ (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(ifdef)\b',
132
+ bygroups(Keyword, using(this), Keyword), '#pop:2'),
133
+ (words(('rls', 'dbg'), prefix=r'\b', suffix=r'\b'),
134
+ Keyword.Constant, 'ifdef_sp'),
135
+ include('statement'),
136
+ include('break'),
137
+ include('skip'),
138
+ ],
139
+ 'ifdef_sp': [
140
+ include('expr'),
141
+ (r'\n', Whitespace, '#pop'),
142
+ ],
143
+ 'if_': [
144
+ include('expr'),
145
+ (r'\n', Whitespace, 'if'),
146
+ ],
147
+ 'if': [
148
+ (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(if)\b',
149
+ bygroups(Keyword, using(this), Keyword), '#pop:2'),
150
+ (words(('elif', 'else'), prefix=r'\b', suffix=r'\b'), Keyword, 'if_sp'),
151
+ include('statement'),
152
+ include('break'),
153
+ include('skip'),
154
+ ],
155
+ 'if_sp': [
156
+ include('expr'),
157
+ (r'\n', Whitespace, '#pop'),
158
+ ],
159
+ 'switch_': [
160
+ include('expr'),
161
+ (r'\n', Whitespace, 'switch'),
162
+ ],
163
+ 'switch': [
164
+ (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(switch)\b',
165
+ bygroups(Keyword, using(this), Keyword), '#pop:2'),
166
+ (words(('case', 'default', 'to'), prefix=r'\b', suffix=r'\b'),
167
+ Keyword, 'switch_sp'),
168
+ include('statement'),
169
+ include('break'),
170
+ include('skip'),
171
+ ],
172
+ 'switch_sp': [
173
+ include('expr'),
174
+ (r'\n', Whitespace, '#pop'),
175
+ ],
176
+ 'while_': [
177
+ include('expr'),
178
+ (r'\n', Whitespace, 'while'),
179
+ ],
180
+ 'while': [
181
+ (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(while)\b',
182
+ bygroups(Keyword, using(this), Keyword), '#pop:2'),
183
+ include('statement'),
184
+ include('break'),
185
+ include('skip'),
186
+ ],
187
+ 'for_': [
188
+ include('expr'),
189
+ (r'\n', Whitespace, 'for'),
190
+ ],
191
+ 'for': [
192
+ (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(for)\b',
193
+ bygroups(Keyword, using(this), Keyword), '#pop:2'),
194
+ include('statement'),
195
+ include('break'),
196
+ include('skip'),
197
+ ],
198
+ 'foreach_': [
199
+ include('expr'),
200
+ (r'\n', Whitespace, 'foreach'),
201
+ ],
202
+ 'foreach': [
203
+ (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(foreach)\b',
204
+ bygroups(Keyword, using(this), Keyword), '#pop:2'),
205
+ include('statement'),
206
+ include('break'),
207
+ include('skip'),
208
+ ],
209
+ 'try_': [
210
+ include('expr'),
211
+ (r'\n', Whitespace, 'try'),
212
+ ],
213
+ 'try': [
214
+ (r'\b(end)([ \t]+(?:\n\s*\|)*[ \t]*)(try)\b',
215
+ bygroups(Keyword, using(this), Keyword), '#pop:2'),
216
+ (words(('catch', 'finally', 'to'), prefix=r'\b', suffix=r'\b'),
217
+ Keyword, 'try_sp'),
218
+ include('statement'),
219
+ include('break'),
220
+ include('skip'),
221
+ ],
222
+ 'try_sp': [
223
+ include('expr'),
224
+ (r'\n', Whitespace, '#pop'),
225
+ ],
226
+
227
+ # Line-statement
228
+ 'break': [
229
+ (r'\b(break)\b([ \t]+)([a-zA-Z_][0-9a-zA-Z_]*)',
230
+ bygroups(Keyword, using(this), Name.Other)),
231
+ ],
232
+ 'skip': [
233
+ (r'\b(skip)\b([ \t]+)([a-zA-Z_][0-9a-zA-Z_]*)',
234
+ bygroups(Keyword, using(this), Name.Other)),
235
+ ],
236
+ 'alias': [
237
+ include('expr'),
238
+ (r'\n', Whitespace, '#pop'),
239
+ ],
240
+ 'assert': [
241
+ include('expr'),
242
+ (r'\n', Whitespace, '#pop'),
243
+ ],
244
+ 'const': [
245
+ include('expr'),
246
+ (r'\n', Whitespace, '#pop'),
247
+ ],
248
+ 'do': [
249
+ include('expr'),
250
+ (r'\n', Whitespace, '#pop'),
251
+ ],
252
+ 'ret': [
253
+ include('expr'),
254
+ (r'\n', Whitespace, '#pop'),
255
+ ],
256
+ 'throw': [
257
+ include('expr'),
258
+ (r'\n', Whitespace, '#pop'),
259
+ ],
260
+ 'var': [
261
+ include('expr'),
262
+ (r'\n', Whitespace, '#pop'),
263
+ ],
264
+ 'continued_line': [
265
+ include('expr'),
266
+ (r'\n', Whitespace, '#pop'),
267
+ ],
268
+
269
+ 'expr': [
270
+ # Whitespace / Comment
271
+ include('whitespace'),
272
+
273
+ # Punctuation
274
+ (r'\(', Punctuation,),
275
+ (r'\)', Punctuation,),
276
+ (r'\[', Punctuation,),
277
+ (r'\]', Punctuation,),
278
+ (r',', Punctuation),
279
+
280
+ # Keyword
281
+ (words((
282
+ 'true', 'false', 'null', 'inf'
283
+ ), prefix=r'\b', suffix=r'\b'), Keyword.Constant),
284
+ (words((
285
+ 'me'
286
+ ), prefix=r'\b', suffix=r'\b'), Keyword),
287
+ (words((
288
+ 'bit16', 'bit32', 'bit64', 'bit8', 'bool',
289
+ 'char', 'class', 'dict', 'enum', 'float', 'func',
290
+ 'int', 'list', 'queue', 'stack'
291
+ ), prefix=r'\b', suffix=r'\b'), Keyword.Type),
292
+
293
+ # Number
294
+ (r'\b[0-9]\.[0-9]+(?!\.)(:?e[\+-][0-9]+)?\b', Number.Float),
295
+ (r'\b2#[01]+(?:b(?:8|16|32|64))?\b', Number.Bin),
296
+ (r'\b8#[0-7]+(?:b(?:8|16|32|64))?\b', Number.Oct),
297
+ (r'\b16#[0-9A-F]+(?:b(?:8|16|32|64))?\b', Number.Hex),
298
+ (r'\b[0-9]+(?:b(?:8|16|32|64))?\b', Number.Decimal),
299
+
300
+ # String / Char
301
+ (r'"', String.Double, 'string'),
302
+ (r"'(?:\\.|.)+?'", String.Char),
303
+
304
+ # Operator
305
+ (r'(?:\.|\$(?:>|<)?)', Operator),
306
+ (r'(?:\^)', Operator),
307
+ (r'(?:\+|-|!|##?)', Operator),
308
+ (r'(?:\*|/|%)', Operator),
309
+ (r'(?:~)', Operator),
310
+ (r'(?:(?:=|<>)(?:&|\$)?|<=?|>=?)', Operator),
311
+ (r'(?:&)', Operator),
312
+ (r'(?:\|)', Operator),
313
+ (r'(?:\?)', Operator),
314
+ (r'(?::(?::|\+|-|\*|/|%|\^|~)?)', Operator),
315
+
316
+ # Identifier
317
+ (r"\b([a-zA-Z_][0-9a-zA-Z_]*)(?=@)\b", Name),
318
+ (r"(@)?\b([a-zA-Z_][0-9a-zA-Z_]*)\b",
319
+ bygroups(Name.Other, Name.Variable)),
320
+ ],
321
+
322
+ # String
323
+ 'string': [
324
+ (r'(?:\\[^{\n]|[^"\\])+', String.Double),
325
+ (r'\\\{', String.Double, 'toStrInString'),
326
+ (r'"', String.Double, '#pop'),
327
+ ],
328
+ 'toStrInString': [
329
+ include('expr'),
330
+ (r'\}', String.Double, '#pop'),
331
+ ],
332
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/kusto.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.kusto
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Kusto Query Language (KQL).
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words
12
+ from pygments.token import (Comment, Keyword, Name, Number, Punctuation,
13
+ String, Whitespace)
14
+
15
+ __all__ = ["KustoLexer"]
16
+
17
+ # Although these all seem to be keywords
18
+ # https://github.com/microsoft/Kusto-Query-Language/blob/master/src/Kusto.Language/Syntax/SyntaxFacts.cs
19
+ # it appears that only the ones with tags here
20
+ # https://github.com/microsoft/Kusto-Query-Language/blob/master/src/Kusto.Language/Parser/QueryGrammar.cs
21
+ # are highlighted in the Azure portal log query editor.
22
+ KUSTO_KEYWORDS = [
23
+ 'and', 'as', 'between', 'by', 'consume', 'contains', 'containscs', 'count',
24
+ 'distinct', 'evaluate', 'extend', 'facet', 'filter', 'find', 'fork',
25
+ 'getschema', 'has', 'invoke', 'join', 'limit', 'lookup', 'make-series',
26
+ 'matches regex', 'mv-apply', 'mv-expand', 'notcontains', 'notcontainscs',
27
+ '!contains', '!has', '!startswith', 'on', 'or', 'order', 'parse', 'parse-where',
28
+ 'parse-kv', 'partition', 'print', 'project', 'project-away', 'project-keep',
29
+ 'project-rename', 'project-reorder', 'range', 'reduce', 'regex', 'render',
30
+ 'sample', 'sample-distinct', 'scan', 'search', 'serialize', 'sort', 'startswith',
31
+ 'summarize', 'take', 'top', 'top-hitters', 'top-nested', 'typeof', 'union',
32
+ 'where', 'bool', 'date', 'datetime', 'int', 'long', 'real', 'string', 'time'
33
+ ]
34
+
35
+ # From
36
+ # https://github.com/microsoft/Kusto-Query-Language/blob/master/src/Kusto.Language/Syntax/SyntaxFacts.cs
37
+ KUSTO_PUNCTUATION = [
38
+ "(", ")", "[", "]", "{", "}", "|", "<|", "+", "-", "*", "/",
39
+ "%", ".." "!", "<", "<=", ">", ">=", "=", "==", "!=", "<>",
40
+ ":", ";", ",", "=~", "!~", "?", "=>",
41
+ ]
42
+
43
+
44
+ class KustoLexer(RegexLexer):
45
+ """For Kusto Query Language source code.
46
+ """
47
+
48
+ name = "Kusto"
49
+ aliases = ["kql", "kusto"]
50
+ filenames = ["*.kql", "*.kusto", ".csl"]
51
+ url = "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query"
52
+ version_added = '2.17'
53
+
54
+ tokens = {
55
+ "root": [
56
+ (r"\s+", Whitespace),
57
+ (words(KUSTO_KEYWORDS, suffix=r"\b"), Keyword),
58
+ (r"//.*", Comment),
59
+ (words(KUSTO_PUNCTUATION), Punctuation),
60
+ (r"[^\W\d]\w*", Name),
61
+ # Numbers can take the form 1, .1, 1., 1.1, 1.1111, etc.
62
+ (r"\d+[.]\d*|[.]\d+", Number.Float),
63
+ (r"\d+", Number.Integer),
64
+ (r"'", String, "single_string"),
65
+ (r'"', String, "double_string"),
66
+ (r"@'", String, "single_verbatim"),
67
+ (r'@"', String, "double_verbatim"),
68
+ (r"```", String, "multi_string"),
69
+ ],
70
+ "single_string": [
71
+ (r"'", String, "#pop"),
72
+ (r"\\.", String.Escape),
73
+ (r"[^'\\]+", String),
74
+ ],
75
+ "double_string": [
76
+ (r'"', String, "#pop"),
77
+ (r"\\.", String.Escape),
78
+ (r'[^"\\]+', String),
79
+ ],
80
+ "single_verbatim": [
81
+ (r"'", String, "#pop"),
82
+ (r"[^']+", String),
83
+ ],
84
+ "double_verbatim": [
85
+ (r'"', String, "#pop"),
86
+ (r'[^"]+', String),
87
+ ],
88
+ "multi_string": [
89
+ (r"[^`]+", String),
90
+ (r"```", String, "#pop"),
91
+ (r"`", String),
92
+ ],
93
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/ldap.py ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ldap
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Pygments lexers for LDAP.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+
14
+ from pygments.lexer import RegexLexer, bygroups, default
15
+ from pygments.token import Operator, Comment, Keyword, Literal, Name, String, \
16
+ Number, Punctuation, Whitespace, Escape
17
+
18
+ __all__ = ['LdifLexer', 'LdaprcLexer']
19
+
20
+
21
+ class LdifLexer(RegexLexer):
22
+
23
+ """
24
+ Lexer for LDIF
25
+ """
26
+
27
+ name = 'LDIF'
28
+ aliases = ['ldif']
29
+ filenames = ['*.ldif']
30
+ mimetypes = ["text/x-ldif"]
31
+ url = "https://datatracker.ietf.org/doc/html/rfc2849"
32
+ version_added = '2.17'
33
+
34
+ tokens = {
35
+ 'root': [
36
+ (r'\s*\n', Whitespace),
37
+ (r'(-)(\n)', bygroups(Punctuation, Whitespace)),
38
+ (r'(#.*)(\n)', bygroups(Comment.Single, Whitespace)),
39
+ (r'(version)(:)([ \t]*)(.*)([ \t]*\n)', bygroups(Keyword,
40
+ Punctuation, Whitespace, Number.Integer, Whitespace)),
41
+ (r'(control)(:)([ \t]*)([\.0-9]+)([ \t]+)((?:true|false)?)([ \t]*)',
42
+ bygroups(Keyword, Punctuation, Whitespace, Name.Other, Whitespace, Keyword, Whitespace), "after-control"),
43
+ (r'(deleteoldrdn)(:)([ \n]*)([0-1]+)([ \t]*\n)',
44
+ bygroups(Keyword, Punctuation, Whitespace, Number, Whitespace)),
45
+ (r'(add|delete|replace)(::?)(\s*)(.*)([ \t]*\n)', bygroups(
46
+ Keyword, Punctuation, Whitespace, Name.Attribute, Whitespace)),
47
+ (r'(changetype)(:)([ \t]*)([a-z]*)([ \t]*\n)',
48
+ bygroups(Keyword, Punctuation, Whitespace, Keyword, Whitespace)),
49
+ (r'(dn|newrdn)(::)', bygroups(Keyword, Punctuation), "base64-dn"),
50
+ (r'(dn|newrdn)(:)', bygroups(Keyword, Punctuation), "dn"),
51
+ (r'(objectclass)(:)([ \t]*)([^ \t\n]*)([ \t]*\n)', bygroups(
52
+ Keyword, Punctuation, Whitespace, Name.Class, Whitespace)),
53
+ (r'([a-zA-Z]*|[0-9][0-9\.]*[0-9])(;)',
54
+ bygroups(Name.Attribute, Punctuation), "property"),
55
+ (r'([a-zA-Z]*|[0-9][0-9\.]*[0-9])(:<)',
56
+ bygroups(Name.Attribute, Punctuation), "url"),
57
+ (r'([a-zA-Z]*|[0-9][0-9\.]*[0-9])(::?)',
58
+ bygroups(Name.Attribute, Punctuation), "value"),
59
+ ],
60
+ "after-control": [
61
+ (r":<", Punctuation, ("#pop", "url")),
62
+ (r"::?", Punctuation, ("#pop", "value")),
63
+ default("#pop"),
64
+ ],
65
+ 'property': [
66
+ (r'([-a-zA-Z0-9]*)(;)', bygroups(Name.Property, Punctuation)),
67
+ (r'([-a-zA-Z0-9]*)(:<)',
68
+ bygroups(Name.Property, Punctuation), ("#pop", "url")),
69
+ (r'([-a-zA-Z0-9]*)(::?)',
70
+ bygroups(Name.Property, Punctuation), ("#pop", "value")),
71
+ ],
72
+ 'value': [
73
+ (r'(\s*)([^\n]+\S)(\n )',
74
+ bygroups(Whitespace, String, Whitespace)),
75
+ (r'(\s*)([^\n]+\S)(\n)',
76
+ bygroups(Whitespace, String, Whitespace), "#pop"),
77
+ ],
78
+ 'url': [
79
+ (r'([ \t]*)(\S*)([ \t]*\n )',
80
+ bygroups(Whitespace, Comment.PreprocFile, Whitespace)),
81
+ (r'([ \t]*)(\S*)([ \t]*\n)', bygroups(Whitespace,
82
+ Comment.PreprocFile, Whitespace), "#pop"),
83
+ ],
84
+ "dn": [
85
+ (r'([ \t]*)([-a-zA-Z0-9\.]+)(=)', bygroups(Whitespace,
86
+ Name.Attribute, Operator), ("#pop", "dn-value")),
87
+ ],
88
+ "dn-value": [
89
+ (r'\\[^\n]', Escape),
90
+ (r',', Punctuation, ("#pop", "dn")),
91
+ (r'\+', Operator, ("#pop", "dn")),
92
+ (r'[^,\+\n]+', String),
93
+ (r'\n ', Whitespace),
94
+ (r'\n', Whitespace, "#pop"),
95
+ ],
96
+ "base64-dn": [
97
+ (r'([ \t]*)([^ \t\n][^ \t\n]*[^\n])([ \t]*\n )',
98
+ bygroups(Whitespace, Name, Whitespace)),
99
+ (r'([ \t]*)([^ \t\n][^ \t\n]*[^\n])([ \t]*\n)',
100
+ bygroups(Whitespace, Name, Whitespace), "#pop"),
101
+ ]
102
+ }
103
+
104
+
105
+ class LdaprcLexer(RegexLexer):
106
+ """
107
+ Lexer for OpenLDAP configuration files.
108
+ """
109
+
110
+ name = 'LDAP configuration file'
111
+ aliases = ['ldapconf', 'ldaprc']
112
+ filenames = ['.ldaprc', 'ldaprc', 'ldap.conf']
113
+ mimetypes = ["text/x-ldapconf"]
114
+ url = 'https://www.openldap.org/software//man.cgi?query=ldap.conf&sektion=5&apropos=0&manpath=OpenLDAP+2.4-Release'
115
+ version_added = '2.17'
116
+
117
+ _sasl_keywords = r'SASL_(?:MECH|REALM|AUTHCID|AUTHZID|CBINDING)'
118
+ _tls_keywords = r'TLS_(?:CACERT|CACERTDIR|CERT|ECNAME|KEY|CIPHER_SUITE|PROTOCOL_MIN|RANDFILE|CRLFILE)'
119
+ _literal_keywords = rf'(?:URI|SOCKET_BIND_ADDRESSES|{_sasl_keywords}|{_tls_keywords})'
120
+ _boolean_keywords = r'GSSAPI_(?:ALLOW_REMOTE_PRINCIPAL|ENCRYPT|SIGN)|REFERRALS|SASL_NOCANON'
121
+ _integer_keywords = r'KEEPALIVE_(?:IDLE|PROBES|INTERVAL)|NETWORK_TIMEOUT|PORT|SIZELIMIT|TIMELIMIT|TIMEOUT'
122
+ _secprops = r'none|noanonymous|noplain|noactive|nodict|forwardsec|passcred|(?:minssf|maxssf|maxbufsize)=\d+'
123
+
124
+ flags = re.IGNORECASE | re.MULTILINE
125
+
126
+ tokens = {
127
+ 'root': [
128
+ (r'#.*', Comment.Single),
129
+ (r'\s+', Whitespace),
130
+ (rf'({_boolean_keywords})(\s+)(on|true|yes|off|false|no)$',
131
+ bygroups(Keyword, Whitespace, Keyword.Constant)),
132
+ (rf'({_integer_keywords})(\s+)(\d+)',
133
+ bygroups(Keyword, Whitespace, Number.Integer)),
134
+ (r'(VERSION)(\s+)(2|3)', bygroups(Keyword, Whitespace, Number.Integer)),
135
+ # Constants
136
+ (r'(DEREF)(\s+)(never|searching|finding|always)',
137
+ bygroups(Keyword, Whitespace, Keyword.Constant)),
138
+ (rf'(SASL_SECPROPS)(\s+)((?:{_secprops})(?:,{_secprops})*)',
139
+ bygroups(Keyword, Whitespace, Keyword.Constant)),
140
+ (r'(SASL_CBINDING)(\s+)(none|tls-unique|tls-endpoint)',
141
+ bygroups(Keyword, Whitespace, Keyword.Constant)),
142
+ (r'(TLS_REQ(?:CERT|SAN))(\s+)(allow|demand|hard|never|try)',
143
+ bygroups(Keyword, Whitespace, Keyword.Constant)),
144
+ (r'(TLS_CRLCHECK)(\s+)(none|peer|all)',
145
+ bygroups(Keyword, Whitespace, Keyword.Constant)),
146
+ # Literals
147
+ (r'(BASE|BINDDN)(\s+)(\S+)$',
148
+ bygroups(Keyword, Whitespace, Literal)),
149
+ # Accepts hostname with or without port.
150
+ (r'(HOST)(\s+)([a-z0-9]+)((?::(\d+))?)',
151
+ bygroups(Keyword, Whitespace, Literal, Number.Integer)),
152
+ (rf'({_literal_keywords})(\s+)(\S+)$',
153
+ bygroups(Keyword, Whitespace, Literal)),
154
+ ],
155
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/lean.py ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.lean
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Lean theorem prover.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, words, include
14
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
15
+ Number, Generic, Whitespace
16
+
17
+ __all__ = ['Lean3Lexer', 'Lean4Lexer']
18
+
19
+ class Lean3Lexer(RegexLexer):
20
+ """
21
+ For the Lean 3 theorem prover.
22
+ """
23
+ name = 'Lean'
24
+ url = 'https://leanprover-community.github.io/lean3'
25
+ aliases = ['lean', 'lean3']
26
+ filenames = ['*.lean']
27
+ mimetypes = ['text/x-lean', 'text/x-lean3']
28
+ version_added = '2.0'
29
+
30
+ # from https://github.com/leanprover/vscode-lean/blob/1589ca3a65e394b3789409707febbd2d166c9344/syntaxes/lean.json#L186C20-L186C217
31
+ _name_segment = (
32
+ "(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟]"
33
+ "(?:(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟0-9'ⁿ-₉ₐ-ₜᵢ-ᵪ])*")
34
+ _name = _name_segment + r"(\." + _name_segment + r")*"
35
+
36
+ tokens = {
37
+ 'expression': [
38
+ (r'\s+', Whitespace),
39
+ (r'/--', String.Doc, 'docstring'),
40
+ (r'/-', Comment, 'comment'),
41
+ (r'--.*?$', Comment.Single),
42
+ (words((
43
+ 'forall', 'fun', 'Pi', 'from', 'have', 'show', 'assume', 'suffices',
44
+ 'let', 'if', 'else', 'then', 'in', 'with', 'calc', 'match',
45
+ 'do'
46
+ ), prefix=r'\b', suffix=r'\b'), Keyword),
47
+ (words(('sorry', 'admit'), prefix=r'\b', suffix=r'\b'), Generic.Error),
48
+ (words(('Sort', 'Prop', 'Type'), prefix=r'\b', suffix=r'\b'), Keyword.Type),
49
+ (words((
50
+ '(', ')', ':', '{', '}', '[', ']', '⟨', '⟩', '‹', '›', '⦃', '⦄', ':=', ',',
51
+ )), Operator),
52
+ (_name, Name),
53
+ (r'``?' + _name, String.Symbol),
54
+ (r'0x[A-Za-z0-9]+', Number.Integer),
55
+ (r'0b[01]+', Number.Integer),
56
+ (r'\d+', Number.Integer),
57
+ (r'"', String.Double, 'string'),
58
+ (r"'(?:(\\[\\\"'nt])|(\\x[0-9a-fA-F]{2})|(\\u[0-9a-fA-F]{4})|.)'", String.Char),
59
+ (r'[~?][a-z][\w\']*:', Name.Variable),
60
+ (r'\S', Name.Builtin.Pseudo),
61
+ ],
62
+ 'root': [
63
+ (words((
64
+ 'import', 'renaming', 'hiding',
65
+ 'namespace',
66
+ 'local',
67
+ 'private', 'protected', 'section',
68
+ 'include', 'omit', 'section',
69
+ 'protected', 'export',
70
+ 'open',
71
+ 'attribute',
72
+ ), prefix=r'\b', suffix=r'\b'), Keyword.Namespace),
73
+ (words((
74
+ 'lemma', 'theorem', 'def', 'definition', 'example',
75
+ 'axiom', 'axioms', 'constant', 'constants',
76
+ 'universe', 'universes',
77
+ 'inductive', 'coinductive', 'structure', 'extends',
78
+ 'class', 'instance',
79
+ 'abbreviation',
80
+
81
+ 'noncomputable theory',
82
+
83
+ 'noncomputable', 'mutual', 'meta',
84
+
85
+ 'attribute',
86
+
87
+ 'parameter', 'parameters',
88
+ 'variable', 'variables',
89
+
90
+ 'reserve', 'precedence',
91
+ 'postfix', 'prefix', 'notation', 'infix', 'infixl', 'infixr',
92
+
93
+ 'begin', 'by', 'end',
94
+
95
+ 'set_option',
96
+ 'run_cmd',
97
+ ), prefix=r'\b', suffix=r'\b'), Keyword.Declaration),
98
+ (r'@\[', Keyword.Declaration, 'attribute'),
99
+ (words((
100
+ '#eval', '#check', '#reduce', '#exit',
101
+ '#print', '#help',
102
+ ), suffix=r'\b'), Keyword),
103
+ include('expression')
104
+ ],
105
+ 'attribute': [
106
+ (r'\]', Keyword.Declaration, '#pop'),
107
+ include('expression'),
108
+ ],
109
+ 'comment': [
110
+ (r'[^/-]+', Comment.Multiline),
111
+ (r'/-', Comment.Multiline, '#push'),
112
+ (r'-/', Comment.Multiline, '#pop'),
113
+ (r'[/-]', Comment.Multiline)
114
+ ],
115
+ 'docstring': [
116
+ (r'[^/-]+', String.Doc),
117
+ (r'-/', String.Doc, '#pop'),
118
+ (r'[/-]', String.Doc)
119
+ ],
120
+ 'string': [
121
+ (r'[^\\"]+', String.Double),
122
+ (r"(?:(\\[\\\"'nt])|(\\x[0-9a-fA-F]{2})|(\\u[0-9a-fA-F]{4}))", String.Escape),
123
+ ('"', String.Double, '#pop'),
124
+ ],
125
+ }
126
+
127
+ def analyse_text(text):
128
+ if re.search(r'^import [a-z]', text, re.MULTILINE):
129
+ return 0.1
130
+
131
+
132
+ LeanLexer = Lean3Lexer
133
+
134
+
135
+ class Lean4Lexer(RegexLexer):
136
+ """
137
+ For the Lean 4 theorem prover.
138
+ """
139
+
140
+ name = 'Lean4'
141
+ url = 'https://github.com/leanprover/lean4'
142
+ aliases = ['lean4']
143
+ filenames = ['*.lean']
144
+ mimetypes = ['text/x-lean4']
145
+ version_added = '2.18'
146
+
147
+ # same as Lean3Lexer, with `!` and `?` allowed
148
+ _name_segment = (
149
+ "(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟]"
150
+ "(?:(?![λΠΣ])[_a-zA-Zα-ωΑ-Ωϊ-ϻἀ-῾℀-⅏𝒜-𝖟0-9'ⁿ-₉ₐ-ₜᵢ-ᵪ!?])*")
151
+ _name = _name_segment + r"(\." + _name_segment + r")*"
152
+
153
+ keywords1 = (
154
+ 'import', 'unif_hint',
155
+ 'renaming', 'inline', 'hiding', 'lemma', 'variable',
156
+ 'theorem', 'axiom', 'inductive', 'structure', 'universe', 'alias',
157
+ '#help', 'precedence', 'postfix', 'prefix',
158
+ 'infix', 'infixl', 'infixr', 'notation', '#eval',
159
+ '#check', '#reduce', '#exit', 'end', 'private', 'using', 'namespace',
160
+ 'instance', 'section', 'protected',
161
+ 'export', 'set_option', 'extends', 'open', 'example',
162
+ '#print', 'opaque',
163
+ 'def', 'macro', 'elab', 'syntax', 'macro_rules', '#reduce', 'where',
164
+ 'abbrev', 'noncomputable', 'class', 'attribute', '#synth', 'mutual',
165
+ 'scoped', 'local',
166
+ )
167
+
168
+ keywords2 = (
169
+ 'forall', 'fun', 'obtain', 'from', 'have', 'show', 'assume',
170
+ 'let', 'if', 'else', 'then', 'by', 'in', 'with',
171
+ 'calc', 'match', 'nomatch', 'do', 'at',
172
+ )
173
+
174
+ keywords3 = (
175
+ # Sorts
176
+ 'Type', 'Prop', 'Sort',
177
+ )
178
+
179
+ operators = (
180
+ '!=', '#', '&', '&&', '*', '+', '-', '/', '@', '!',
181
+ '-.', '->', '.', '..', '...', '::', ':>', ';', ';;', '<',
182
+ '<-', '=', '==', '>', '_', '|', '||', '~', '=>', '<=', '>=',
183
+ '/\\', '\\/', '∀', 'Π', 'λ', '↔', '∧', '∨', '≠', '≤', '≥',
184
+ '¬', '⁻¹', '⬝', '▸', '→', '∃', '≈', '×', '⌞',
185
+ '⌟', '≡', '⟨', '⟩', "↦",
186
+ )
187
+
188
+ punctuation = ('(', ')', ':', '{', '}', '[', ']', '⦃', '⦄',
189
+ ':=', ',', ']\'', ']?', ']!')
190
+
191
+ tokens = {
192
+ 'expression': [
193
+ (r'\s+', Whitespace),
194
+ (r'/--', String.Doc, 'docstring'),
195
+ (r'/-', Comment, 'comment'),
196
+ (r'--.*$', Comment.Single),
197
+ (words(keywords3, prefix=r'\b', suffix=r'\b'), Keyword.Type),
198
+ (words(('sorry', 'admit'), prefix=r'\b', suffix=r'\b'), Generic.Error),
199
+ (words(operators), Name.Builtin.Pseudo),
200
+ (words(punctuation), Operator),
201
+ (_name_segment, Name),
202
+ (r'``?' + _name, String.Symbol),
203
+ (r'(?<=\.)\d+', Number),
204
+ (r'(\d+\.\d*)([eE][+-]?[0-9]+)?', Number.Float),
205
+ (r'\d+', Number.Integer),
206
+ (r'"', String.Double, 'string'),
207
+ (r'[~?][a-z][\w\']*:', Name.Variable),
208
+ (r'\S', Name.Builtin.Pseudo),
209
+ ],
210
+ 'root': [
211
+ (words(keywords1, prefix=r'\b', suffix=r'\b'), Keyword.Namespace),
212
+ (words(keywords2, prefix=r'\b', suffix=r'\b'), Keyword),
213
+ (r'@\[', Keyword.Declaration, 'attribute'),
214
+ include('expression')
215
+ ],
216
+ 'attribute': [
217
+ (r'\]', Keyword.Declaration, '#pop'),
218
+ include('expression'),
219
+ ],
220
+ 'comment': [
221
+ # Multiline Comments
222
+ (r'[^/-]+', Comment.Multiline),
223
+ (r'/-', Comment.Multiline, '#push'),
224
+ (r'-/', Comment.Multiline, '#pop'),
225
+ (r'[/-]', Comment.Multiline)
226
+ ],
227
+ 'docstring': [
228
+ (r'[^/-]+', String.Doc),
229
+ (r'-/', String.Doc, '#pop'),
230
+ (r'[/-]', String.Doc)
231
+ ],
232
+ 'string': [
233
+ (r'[^\\"]+', String.Double),
234
+ (r'\\[n"\\\n]', String.Escape),
235
+ ('"', String.Double, '#pop'),
236
+ ],
237
+ }
238
+
239
+ def analyse_text(text):
240
+ if re.search(r'^import [A-Z]', text, re.MULTILINE):
241
+ return 0.1
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/lilypond.py ADDED
@@ -0,0 +1,225 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.lilypond
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for LilyPond.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import bygroups, default, inherit, words
14
+ from pygments.lexers.lisp import SchemeLexer
15
+ from pygments.lexers._lilypond_builtins import (
16
+ keywords, pitch_language_names, clefs, scales, repeat_types, units,
17
+ chord_modifiers, pitches, music_functions, dynamics, articulations,
18
+ music_commands, markup_commands, grobs, translators, contexts,
19
+ context_properties, grob_properties, scheme_functions, paper_variables,
20
+ header_variables
21
+ )
22
+ from pygments.token import Token
23
+
24
+ __all__ = ["LilyPondLexer"]
25
+
26
+ # In LilyPond, (unquoted) name tokens only contain letters, hyphens,
27
+ # and underscores, where hyphens and underscores must not start or end
28
+ # a name token.
29
+ #
30
+ # Note that many of the entities listed as LilyPond built-in keywords
31
+ # (in file `_lilypond_builtins.py`) are only valid if surrounded by
32
+ # double quotes, for example, 'hufnagel-fa1'. This means that
33
+ # `NAME_END_RE` doesn't apply to such entities in valid LilyPond code.
34
+ NAME_END_RE = r"(?=\d|[^\w\-]|[\-_][\W\d])"
35
+
36
+ def builtin_words(names, backslash, suffix=NAME_END_RE):
37
+ prefix = r"[\-_^]?"
38
+ if backslash == "mandatory":
39
+ prefix += r"\\"
40
+ elif backslash == "optional":
41
+ prefix += r"\\?"
42
+ else:
43
+ assert backslash == "disallowed"
44
+ return words(names, prefix, suffix)
45
+
46
+
47
+ class LilyPondLexer(SchemeLexer):
48
+ """
49
+ Lexer for input to LilyPond, a text-based music typesetter.
50
+
51
+ .. important::
52
+
53
+ This lexer is meant to be used in conjunction with the ``lilypond`` style.
54
+ """
55
+ name = 'LilyPond'
56
+ url = 'https://lilypond.org'
57
+ aliases = ['lilypond']
58
+ filenames = ['*.ly']
59
+ mimetypes = []
60
+ version_added = '2.11'
61
+
62
+ flags = re.DOTALL | re.MULTILINE
63
+
64
+ # Because parsing LilyPond input is very tricky (and in fact
65
+ # impossible without executing LilyPond when there is Scheme
66
+ # code in the file), this lexer does not try to recognize
67
+ # lexical modes. Instead, it catches the most frequent pieces
68
+ # of syntax, and, above all, knows about many kinds of builtins.
69
+
70
+ # In order to parse embedded Scheme, this lexer subclasses the SchemeLexer.
71
+ # It redefines the 'root' state entirely, and adds a rule for #{ #}
72
+ # to the 'value' state. The latter is used to parse a Scheme expression
73
+ # after #.
74
+
75
+ def get_tokens_unprocessed(self, text):
76
+ """Highlight Scheme variables as LilyPond builtins when applicable."""
77
+ for index, token, value in super().get_tokens_unprocessed(text):
78
+ if token is Token.Name.Function or token is Token.Name.Variable:
79
+ if value in scheme_functions:
80
+ token = Token.Name.Builtin.SchemeFunction
81
+ elif token is Token.Name.Builtin:
82
+ token = Token.Name.Builtin.SchemeBuiltin
83
+ yield index, token, value
84
+
85
+ tokens = {
86
+ "root": [
87
+ # Whitespace.
88
+ (r"\s+", Token.Text.Whitespace),
89
+
90
+ # Multi-line comments. These are non-nestable.
91
+ (r"%\{.*?%\}", Token.Comment.Multiline),
92
+
93
+ # Simple comments.
94
+ (r"%.*?$", Token.Comment.Single),
95
+
96
+ # End of embedded LilyPond in Scheme.
97
+ (r"#\}", Token.Punctuation, "#pop"),
98
+
99
+ # Embedded Scheme, starting with # ("delayed"),
100
+ # or $ (immediate). #@ and and $@ are the lesser known
101
+ # "list splicing operators".
102
+ (r"[#$]@?", Token.Punctuation, "value"),
103
+
104
+ # Any kind of punctuation:
105
+ # - sequential music: { },
106
+ # - parallel music: << >>,
107
+ # - voice separator: << \\ >>,
108
+ # - chord: < >,
109
+ # - bar check: |,
110
+ # - dot in nested properties: \revert NoteHead.color,
111
+ # - equals sign in assignments and lists for various commands:
112
+ # \override Stem.color = red,
113
+ # - comma as alternative syntax for lists: \time 3,3,2 4/4,
114
+ # - colon in tremolos: c:32,
115
+ # - double hyphen and underscore in lyrics: li -- ly -- pond __
116
+ # (which must be preceded by ASCII whitespace)
117
+ (r"""(?x)
118
+ \\\\
119
+ | (?<= \s ) (?: -- | __ )
120
+ | [{}<>=.,:|]
121
+ """, Token.Punctuation),
122
+
123
+ # Pitches, with optional octavation marks, octave check,
124
+ # and forced or cautionary accidental.
125
+ (words(pitches, suffix=r"=?[',]*!?\??" + NAME_END_RE), Token.Pitch),
126
+
127
+ # Strings, optionally with direction specifier.
128
+ (r'[\-_^]?"', Token.String, "string"),
129
+
130
+ # Numbers.
131
+ (r"-?\d+\.\d+", Token.Number.Float), # 5. and .5 are not allowed
132
+ (r"-?\d+/\d+", Token.Number.Fraction),
133
+ # Integers, or durations with optional augmentation dots.
134
+ # We have no way to distinguish these, so we highlight
135
+ # them all as numbers.
136
+ #
137
+ # Normally, there is a space before the integer (being an
138
+ # argument to a music function), which we check here. The
139
+ # case without a space is handled below (as a fingering
140
+ # number).
141
+ (r"""(?x)
142
+ (?<= \s ) -\d+
143
+ | (?: (?: \d+ | \\breve | \\longa | \\maxima )
144
+ \.* )
145
+ """, Token.Number),
146
+ # Separates duration and duration multiplier highlighted as fraction.
147
+ (r"\*", Token.Number),
148
+
149
+ # Ties, slurs, manual beams.
150
+ (r"[~()[\]]", Token.Name.Builtin.Articulation),
151
+
152
+ # Predefined articulation shortcuts. A direction specifier is
153
+ # required here.
154
+ (r"[\-_^][>^_!.\-+]", Token.Name.Builtin.Articulation),
155
+
156
+ # Fingering numbers, string numbers.
157
+ (r"[\-_^]?\\?\d+", Token.Name.Builtin.Articulation),
158
+
159
+ # Builtins.
160
+ (builtin_words(keywords, "mandatory"), Token.Keyword),
161
+ (builtin_words(pitch_language_names, "disallowed"), Token.Name.PitchLanguage),
162
+ (builtin_words(clefs, "disallowed"), Token.Name.Builtin.Clef),
163
+ (builtin_words(scales, "mandatory"), Token.Name.Builtin.Scale),
164
+ (builtin_words(repeat_types, "disallowed"), Token.Name.Builtin.RepeatType),
165
+ (builtin_words(units, "mandatory"), Token.Number),
166
+ (builtin_words(chord_modifiers, "disallowed"), Token.ChordModifier),
167
+ (builtin_words(music_functions, "mandatory"), Token.Name.Builtin.MusicFunction),
168
+ (builtin_words(dynamics, "mandatory"), Token.Name.Builtin.Dynamic),
169
+ # Those like slurs that don't take a backslash are covered above.
170
+ (builtin_words(articulations, "mandatory"), Token.Name.Builtin.Articulation),
171
+ (builtin_words(music_commands, "mandatory"), Token.Name.Builtin.MusicCommand),
172
+ (builtin_words(markup_commands, "mandatory"), Token.Name.Builtin.MarkupCommand),
173
+ (builtin_words(grobs, "disallowed"), Token.Name.Builtin.Grob),
174
+ (builtin_words(translators, "disallowed"), Token.Name.Builtin.Translator),
175
+ # Optional backslash because of \layout { \context { \Score ... } }.
176
+ (builtin_words(contexts, "optional"), Token.Name.Builtin.Context),
177
+ (builtin_words(context_properties, "disallowed"), Token.Name.Builtin.ContextProperty),
178
+ (builtin_words(grob_properties, "disallowed"),
179
+ Token.Name.Builtin.GrobProperty,
180
+ "maybe-subproperties"),
181
+ # Optional backslashes here because output definitions are wrappers
182
+ # around modules. Concretely, you can do, e.g.,
183
+ # \paper { oddHeaderMarkup = \evenHeaderMarkup }
184
+ (builtin_words(paper_variables, "optional"), Token.Name.Builtin.PaperVariable),
185
+ (builtin_words(header_variables, "optional"), Token.Name.Builtin.HeaderVariable),
186
+
187
+ # Other backslashed-escaped names (like dereferencing a
188
+ # music variable), possibly with a direction specifier.
189
+ (r"[\-_^]?\\.+?" + NAME_END_RE, Token.Name.BackslashReference),
190
+
191
+ # Definition of a variable. Support assignments to alist keys
192
+ # (myAlist.my-key.my-nested-key = \markup \spam \eggs).
193
+ (r"""(?x)
194
+ (?: [^\W\d] | - )+
195
+ (?= (?: [^\W\d] | [\-.] )* \s* = )
196
+ """, Token.Name.Lvalue),
197
+
198
+ # Virtually everything can appear in markup mode, so we highlight
199
+ # as text. Try to get a complete word, or we might wrongly lex
200
+ # a suffix that happens to be a builtin as a builtin (e.g., "myStaff").
201
+ (r"([^\W\d]|-)+?" + NAME_END_RE, Token.Text),
202
+ (r".", Token.Text),
203
+ ],
204
+ "string": [
205
+ (r'"', Token.String, "#pop"),
206
+ (r'\\.', Token.String.Escape),
207
+ (r'[^\\"]+', Token.String),
208
+ ],
209
+ "value": [
210
+ # Scan a LilyPond value, then pop back since we had a
211
+ # complete expression.
212
+ (r"#\{", Token.Punctuation, ("#pop", "root")),
213
+ inherit,
214
+ ],
215
+ # Grob subproperties are undeclared and it would be tedious
216
+ # to maintain them by hand. Instead, this state allows recognizing
217
+ # everything that looks like a-known-property.foo.bar-baz as
218
+ # one single property name.
219
+ "maybe-subproperties": [
220
+ (r"\s+", Token.Text.Whitespace),
221
+ (r"(\.)((?:[^\W\d]|-)+?)" + NAME_END_RE,
222
+ bygroups(Token.Punctuation, Token.Name.Builtin.GrobProperty)),
223
+ default("#pop"),
224
+ ]
225
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/lisp.py ADDED
The diff for this file is too large to render. See raw diff
 
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/macaulay2.py ADDED
@@ -0,0 +1,1847 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.macaulay2
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Macaulay2.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words
12
+ from pygments.token import Comment, Keyword, Name, String, Text
13
+
14
+ __all__ = ['Macaulay2Lexer']
15
+
16
+ # Auto-generated for Macaulay2-1.25.11. Do not modify this file manually.
17
+
18
+ M2KEYWORDS = (
19
+ "SPACE",
20
+ "TEST",
21
+ "and",
22
+ "break",
23
+ "breakpoint",
24
+ "catch",
25
+ "continue",
26
+ "do",
27
+ "elapsedTime",
28
+ "elapsedTiming",
29
+ "else",
30
+ "for",
31
+ "from",
32
+ "global",
33
+ "if",
34
+ "in",
35
+ "list",
36
+ "local",
37
+ "new",
38
+ "not",
39
+ "of",
40
+ "or",
41
+ "profile",
42
+ "return",
43
+ "shield",
44
+ "step",
45
+ "symbol",
46
+ "then",
47
+ "threadLocal",
48
+ "threadVariable",
49
+ "throw",
50
+ "time",
51
+ "timing",
52
+ "to",
53
+ "try",
54
+ "when",
55
+ "while",
56
+ "xor"
57
+ )
58
+
59
+ M2DATATYPES = (
60
+ "ANCHOR",
61
+ "Adjacent",
62
+ "AffineVariety",
63
+ "Analyzer",
64
+ "AngleBarList",
65
+ "Array",
66
+ "AssociativeExpression",
67
+ "AtomicInt",
68
+ "BLOCKQUOTE",
69
+ "BODY",
70
+ "BOLD",
71
+ "BR",
72
+ "BUTTON",
73
+ "Bag",
74
+ "BasicList",
75
+ "BettiTally",
76
+ "BinaryOperation",
77
+ "Boolean",
78
+ "CC",
79
+ "CDATA",
80
+ "CODE",
81
+ "COMMENT",
82
+ "CacheTable",
83
+ "ChainComplex",
84
+ "ChainComplexMap",
85
+ "CoherentSheaf",
86
+ "Command",
87
+ "CompiledFunction",
88
+ "CompiledFunctionBody",
89
+ "CompiledFunctionClosure",
90
+ "ComplexField",
91
+ "Constant",
92
+ "DD",
93
+ "DIV",
94
+ "DL",
95
+ "DT",
96
+ "Database",
97
+ "Descent",
98
+ "Describe",
99
+ "Dictionary",
100
+ "DirectSum",
101
+ "Divide",
102
+ "DocumentTag",
103
+ "EM",
104
+ "Eliminate",
105
+ "EngineRing",
106
+ "Equation",
107
+ "ExampleItem",
108
+ "Expression",
109
+ "File",
110
+ "FilePosition",
111
+ "FractionField",
112
+ "Function",
113
+ "FunctionApplication",
114
+ "FunctionBody",
115
+ "FunctionClosure",
116
+ "GaloisField",
117
+ "GeneralOrderedMonoid",
118
+ "GlobalDictionary",
119
+ "GradedModule",
120
+ "GradedModuleMap",
121
+ "GroebnerBasis",
122
+ "GroebnerBasisOptions",
123
+ "HEAD",
124
+ "HEADER1",
125
+ "HEADER2",
126
+ "HEADER3",
127
+ "HEADER4",
128
+ "HEADER5",
129
+ "HEADER6",
130
+ "HR",
131
+ "HREF",
132
+ "HTML",
133
+ "HashTable",
134
+ "HeaderType",
135
+ "Holder",
136
+ "Hybrid",
137
+ "Hypertext",
138
+ "HypertextContainer",
139
+ "HypertextParagraph",
140
+ "HypertextVoid",
141
+ "IFRAME",
142
+ "IMG",
143
+ "INDENT",
144
+ "INPUT",
145
+ "ITALIC",
146
+ "Ideal",
147
+ "ImmutableType",
148
+ "IndeterminateNumber",
149
+ "IndexedVariable",
150
+ "IndexedVariableTable",
151
+ "InexactField",
152
+ "InexactFieldFamily",
153
+ "InexactNumber",
154
+ "InfiniteNumber",
155
+ "IntermediateMarkUpType",
156
+ "Iterator",
157
+ "KBD",
158
+ "Keyword",
159
+ "LABEL",
160
+ "LATER",
161
+ "LI",
162
+ "LINK",
163
+ "LITERAL",
164
+ "List",
165
+ "LocalDictionary",
166
+ "LowerBound",
167
+ "MENU",
168
+ "META",
169
+ "Manipulator",
170
+ "MapExpression",
171
+ "MarkUpType",
172
+ "Matrix",
173
+ "MatrixExpression",
174
+ "MethodFunction",
175
+ "MethodFunctionBinary",
176
+ "MethodFunctionSingle",
177
+ "MethodFunctionWithOptions",
178
+ "Minus",
179
+ "Module",
180
+ "Monoid",
181
+ "MonoidElement",
182
+ "MonomialIdeal",
183
+ "MultigradedBettiTally",
184
+ "MutableHashTable",
185
+ "MutableList",
186
+ "MutableMatrix",
187
+ "Net",
188
+ "NetFile",
189
+ "Nothing",
190
+ "Number",
191
+ "NumberedVerticalList",
192
+ "OL",
193
+ "OneExpression",
194
+ "Option",
195
+ "OptionTable",
196
+ "OrderedMonoid",
197
+ "PARA",
198
+ "PRE",
199
+ "Package",
200
+ "Parenthesize",
201
+ "Parser",
202
+ "Partition",
203
+ "PolynomialRing",
204
+ "Power",
205
+ "Product",
206
+ "ProductOrder",
207
+ "Program",
208
+ "ProgramRun",
209
+ "ProjectiveHilbertPolynomial",
210
+ "ProjectiveVariety",
211
+ "Pseudocode",
212
+ "PseudocodeClosure",
213
+ "QQ",
214
+ "QuotientRing",
215
+ "RR",
216
+ "RRi",
217
+ "RealField",
218
+ "Resolution",
219
+ "Ring",
220
+ "RingElement",
221
+ "RingFamily",
222
+ "RingMap",
223
+ "RowExpression",
224
+ "SAMP",
225
+ "SCRIPT",
226
+ "SMALL",
227
+ "SPAN",
228
+ "STRONG",
229
+ "STYLE",
230
+ "SUB",
231
+ "SUBSECTION",
232
+ "SUP",
233
+ "ScriptedFunctor",
234
+ "SelfInitializingType",
235
+ "Sequence",
236
+ "Set",
237
+ "SheafExpression",
238
+ "SheafMap",
239
+ "SheafOfRings",
240
+ "SparseMonomialVectorExpression",
241
+ "SparseVectorExpression",
242
+ "String",
243
+ "Subscript",
244
+ "Sum",
245
+ "SumOfTwists",
246
+ "Superscript",
247
+ "Symbol",
248
+ "SymbolBody",
249
+ "TABLE",
250
+ "TD",
251
+ "TEX",
252
+ "TH",
253
+ "TITLE",
254
+ "TO",
255
+ "TO2",
256
+ "TOH",
257
+ "TR",
258
+ "TT",
259
+ "Table",
260
+ "Tally",
261
+ "Task",
262
+ "TensorProduct",
263
+ "TestInput",
264
+ "Thing",
265
+ "Time",
266
+ "Type",
267
+ "UL",
268
+ "URL",
269
+ "VAR",
270
+ "Variety",
271
+ "Vector",
272
+ "VectorExpression",
273
+ "VerticalList",
274
+ "VirtualTally",
275
+ "VisibleList",
276
+ "WrapperType",
277
+ "ZZ",
278
+ "ZeroExpression"
279
+ )
280
+
281
+ M2FUNCTIONS = (
282
+ "BesselJ",
283
+ "BesselY",
284
+ "Beta",
285
+ "Digamma",
286
+ "EXAMPLE",
287
+ "End",
288
+ "Fano",
289
+ "GCstats",
290
+ "GF",
291
+ "Gamma",
292
+ "Grassmannian",
293
+ "Hom",
294
+ "LLL",
295
+ "LUdecomposition",
296
+ "M2CODE",
297
+ "NNParser",
298
+ "Proj",
299
+ "QQParser",
300
+ "QRDecomposition",
301
+ "SVD",
302
+ "SYNOPSIS",
303
+ "Schubert",
304
+ "Spec",
305
+ "ZZParser",
306
+ "about",
307
+ "abs",
308
+ "accumulate",
309
+ "acos",
310
+ "acosh",
311
+ "acot",
312
+ "acoth",
313
+ "addCancelTask",
314
+ "addDependencyTask",
315
+ "addEndFunction",
316
+ "addHook",
317
+ "addStartTask",
318
+ "adjoint",
319
+ "agm",
320
+ "alarm",
321
+ "all",
322
+ "ambient",
323
+ "analyticSpread",
324
+ "ancestor",
325
+ "ancestors",
326
+ "andP",
327
+ "ann",
328
+ "annihilator",
329
+ "antipode",
330
+ "any",
331
+ "append",
332
+ "applicationDirectory",
333
+ "apply",
334
+ "applyKeys",
335
+ "applyPairs",
336
+ "applyTable",
337
+ "applyValues",
338
+ "apropos",
339
+ "arXiv",
340
+ "ascii",
341
+ "asin",
342
+ "asinh",
343
+ "ass",
344
+ "assert",
345
+ "associatedGradedRing",
346
+ "associatedPrimes",
347
+ "atEndOfFile",
348
+ "atan",
349
+ "atan2",
350
+ "atanh",
351
+ "autoload",
352
+ "baseFilename",
353
+ "baseName",
354
+ "baseRing",
355
+ "basis",
356
+ "beginDocumentation",
357
+ "benchmark",
358
+ "betti",
359
+ "between",
360
+ "binomial",
361
+ "borel",
362
+ "cacheValue",
363
+ "cancelTask",
364
+ "canonicalBundle",
365
+ "capture",
366
+ "ceiling",
367
+ "centerString",
368
+ "chainComplex",
369
+ "changeBase",
370
+ "changeDirectory",
371
+ "char",
372
+ "charAnalyzer",
373
+ "characters",
374
+ "check",
375
+ "checkDegrees",
376
+ "chi",
377
+ "class",
378
+ "clean",
379
+ "clearEcho",
380
+ "code",
381
+ "codim",
382
+ "coefficient",
383
+ "coefficientRing",
384
+ "coefficients",
385
+ "cohomology",
386
+ "coimage",
387
+ "coker",
388
+ "cokernel",
389
+ "collectGarbage",
390
+ "columnAdd",
391
+ "columnMult",
392
+ "columnPermute",
393
+ "columnRankProfile",
394
+ "columnSwap",
395
+ "columnate",
396
+ "combine",
397
+ "commandInterpreter",
398
+ "commonRing",
399
+ "commonest",
400
+ "comodule",
401
+ "compareExchange",
402
+ "complement",
403
+ "complete",
404
+ "components",
405
+ "compose",
406
+ "compositions",
407
+ "compress",
408
+ "concatenate",
409
+ "conductor",
410
+ "cone",
411
+ "conjugate",
412
+ "connectionCount",
413
+ "constParser",
414
+ "content",
415
+ "contract",
416
+ "conwayPolynomial",
417
+ "copy",
418
+ "copyDirectory",
419
+ "copyFile",
420
+ "cos",
421
+ "cosh",
422
+ "cot",
423
+ "cotangentSheaf",
424
+ "coth",
425
+ "cover",
426
+ "coverMap",
427
+ "cpuTime",
428
+ "createTask",
429
+ "csc",
430
+ "csch",
431
+ "currentColumnNumber",
432
+ "currentDirectory",
433
+ "currentPosition",
434
+ "currentRowNumber",
435
+ "currentTime",
436
+ "deadParser",
437
+ "debug",
438
+ "debugError",
439
+ "decompose",
440
+ "deepSplice",
441
+ "default",
442
+ "degree",
443
+ "degreeGroup",
444
+ "degreeLength",
445
+ "degrees",
446
+ "degreesMonoid",
447
+ "degreesRing",
448
+ "delete",
449
+ "demark",
450
+ "denominator",
451
+ "depth",
452
+ "describe",
453
+ "det",
454
+ "determinant",
455
+ "diagonalMatrix",
456
+ "diameter",
457
+ "dictionary",
458
+ "diff",
459
+ "difference",
460
+ "dim",
461
+ "directProduct",
462
+ "directSum",
463
+ "disassemble",
464
+ "discriminant",
465
+ "dismiss",
466
+ "distinguished",
467
+ "divideByVariable",
468
+ "doc",
469
+ "document",
470
+ "drop",
471
+ "dual",
472
+ "eagonNorthcott",
473
+ "echoOff",
474
+ "echoOn",
475
+ "eigenvalues",
476
+ "eigenvectors",
477
+ "eint",
478
+ "elements",
479
+ "eliminate",
480
+ "endPackage",
481
+ "entries",
482
+ "erase",
483
+ "erf",
484
+ "erfc",
485
+ "error",
486
+ "euler",
487
+ "eulers",
488
+ "even",
489
+ "examples",
490
+ "exchange",
491
+ "exec",
492
+ "exp",
493
+ "expectedReesIdeal",
494
+ "expm1",
495
+ "exponents",
496
+ "export",
497
+ "exportFrom",
498
+ "exportMutable",
499
+ "expression",
500
+ "extend",
501
+ "exteriorPower",
502
+ "factor",
503
+ "fileExecutable",
504
+ "fileExists",
505
+ "fileLength",
506
+ "fileMode",
507
+ "fileReadable",
508
+ "fileTime",
509
+ "fileWritable",
510
+ "fillMatrix",
511
+ "findFiles",
512
+ "findHeft",
513
+ "findProgram",
514
+ "findSynonyms",
515
+ "first",
516
+ "firstkey",
517
+ "fittingIdeal",
518
+ "flagLookup",
519
+ "flatten",
520
+ "flattenRing",
521
+ "flip",
522
+ "floor",
523
+ "fold",
524
+ "forceGB",
525
+ "fork",
526
+ "format",
527
+ "formation",
528
+ "frac",
529
+ "fraction",
530
+ "frames",
531
+ "fromDividedPowers",
532
+ "fromDual",
533
+ "functionBody",
534
+ "futureParser",
535
+ "gb",
536
+ "gbRemove",
537
+ "gbSnapshot",
538
+ "gcd",
539
+ "gcdCoefficients",
540
+ "gcdLLL",
541
+ "genera",
542
+ "generateAssertions",
543
+ "generator",
544
+ "generators",
545
+ "genericMatrix",
546
+ "genericSkewMatrix",
547
+ "genericSymmetricMatrix",
548
+ "gens",
549
+ "genus",
550
+ "get",
551
+ "getChangeMatrix",
552
+ "getGlobalSymbol",
553
+ "getIOThreadMode",
554
+ "getNetFile",
555
+ "getNonUnit",
556
+ "getPrimeWithRootOfUnity",
557
+ "getSymbol",
558
+ "getWWW",
559
+ "getc",
560
+ "getenv",
561
+ "globalAssign",
562
+ "globalAssignFunction",
563
+ "globalAssignment",
564
+ "globalReleaseFunction",
565
+ "gradedModule",
566
+ "gradedModuleMap",
567
+ "gramm",
568
+ "graphIdeal",
569
+ "graphRing",
570
+ "groebnerBasis",
571
+ "groupID",
572
+ "hash",
573
+ "hashTable",
574
+ "headlines",
575
+ "heft",
576
+ "height",
577
+ "hermite",
578
+ "hilbertFunction",
579
+ "hilbertPolynomial",
580
+ "hilbertSeries",
581
+ "hold",
582
+ "homogenize",
583
+ "homology",
584
+ "homomorphism",
585
+ "hooks",
586
+ "horizontalJoin",
587
+ "html",
588
+ "httpHeaders",
589
+ "hypertext",
590
+ "icFracP",
591
+ "icFractions",
592
+ "icMap",
593
+ "icPIdeal",
594
+ "ideal",
595
+ "idealSheaf",
596
+ "idealizer",
597
+ "identity",
598
+ "image",
599
+ "imaginaryPart",
600
+ "importFrom",
601
+ "independentSets",
602
+ "index",
603
+ "indices",
604
+ "inducedMap",
605
+ "inducesWellDefinedMap",
606
+ "info",
607
+ "input",
608
+ "insert",
609
+ "installAssignmentMethod",
610
+ "installHilbertFunction",
611
+ "installMethod",
612
+ "installMinprimes",
613
+ "installPackage",
614
+ "installedPackages",
615
+ "instance",
616
+ "instances",
617
+ "integralClosure",
618
+ "integrate",
619
+ "intersect",
620
+ "intersectInP",
621
+ "intersection",
622
+ "interval",
623
+ "inverse",
624
+ "inverseErf",
625
+ "inversePermutation",
626
+ "inverseRegularizedBeta",
627
+ "inverseRegularizedGamma",
628
+ "inverseSystem",
629
+ "irreducibleCharacteristicSeries",
630
+ "irreducibleDecomposition",
631
+ "isANumber",
632
+ "isAffineRing",
633
+ "isBorel",
634
+ "isCanceled",
635
+ "isCommutative",
636
+ "isConstant",
637
+ "isDirectSum",
638
+ "isDirectory",
639
+ "isEmpty",
640
+ "isExact",
641
+ "isField",
642
+ "isFinite",
643
+ "isFinitePrimeField",
644
+ "isFreeModule",
645
+ "isGlobalSymbol",
646
+ "isHomogeneous",
647
+ "isIdeal",
648
+ "isInfinite",
649
+ "isInjective",
650
+ "isInputFile",
651
+ "isIsomorphic",
652
+ "isIsomorphism",
653
+ "isLLL",
654
+ "isLinearType",
655
+ "isListener",
656
+ "isLocallyFree",
657
+ "isMember",
658
+ "isModule",
659
+ "isMonomialIdeal",
660
+ "isMutable",
661
+ "isNormal",
662
+ "isOpen",
663
+ "isOutputFile",
664
+ "isPolynomialRing",
665
+ "isPrimary",
666
+ "isPrime",
667
+ "isPrimitive",
668
+ "isProjective",
669
+ "isPseudoprime",
670
+ "isQuotientModule",
671
+ "isQuotientOf",
672
+ "isQuotientRing",
673
+ "isReady",
674
+ "isReal",
675
+ "isReduction",
676
+ "isRegularFile",
677
+ "isRing",
678
+ "isSkewCommutative",
679
+ "isSmooth",
680
+ "isSorted",
681
+ "isSquareFree",
682
+ "isStandardGradedPolynomialRing",
683
+ "isSubmodule",
684
+ "isSubquotient",
685
+ "isSubset",
686
+ "isSupportedInZeroLocus",
687
+ "isSurjective",
688
+ "isTable",
689
+ "isUnit",
690
+ "isVeryAmple",
691
+ "isWellDefined",
692
+ "isWeylAlgebra",
693
+ "isc",
694
+ "isomorphism",
695
+ "iterator",
696
+ "jacobian",
697
+ "jacobianDual",
698
+ "join",
699
+ "ker",
700
+ "kernel",
701
+ "kernelLLL",
702
+ "kernelOfLocalization",
703
+ "keys",
704
+ "kill",
705
+ "koszul",
706
+ "last",
707
+ "lcm",
708
+ "leadCoefficient",
709
+ "leadComponent",
710
+ "leadMonomial",
711
+ "leadTerm",
712
+ "left",
713
+ "length",
714
+ "letterParser",
715
+ "lift",
716
+ "liftable",
717
+ "limitFiles",
718
+ "limitProcesses",
719
+ "lines",
720
+ "linkFile",
721
+ "listForm",
722
+ "listSymbols",
723
+ "lngamma",
724
+ "load",
725
+ "loadPackage",
726
+ "localDictionaries",
727
+ "localize",
728
+ "locate",
729
+ "log",
730
+ "log1p",
731
+ "lookup",
732
+ "lookupCount",
733
+ "makeDirectory",
734
+ "makeDocumentTag",
735
+ "makePackageIndex",
736
+ "makeS2",
737
+ "map",
738
+ "markedGB",
739
+ "match",
740
+ "mathML",
741
+ "matrix",
742
+ "max",
743
+ "maxPosition",
744
+ "member",
745
+ "memoize",
746
+ "memoizeClear",
747
+ "memoizeValues",
748
+ "merge",
749
+ "mergePairs",
750
+ "method",
751
+ "methodOptions",
752
+ "methods",
753
+ "midpoint",
754
+ "min",
755
+ "minPosition",
756
+ "minPres",
757
+ "mingens",
758
+ "mingle",
759
+ "minimalBetti",
760
+ "minimalPresentation",
761
+ "minimalPrimes",
762
+ "minimalReduction",
763
+ "minimize",
764
+ "minimizeFilename",
765
+ "minors",
766
+ "minprimes",
767
+ "minus",
768
+ "mkdir",
769
+ "mod",
770
+ "module",
771
+ "modulo",
772
+ "monoid",
773
+ "monomialCurveIdeal",
774
+ "monomialIdeal",
775
+ "monomialSubideal",
776
+ "monomials",
777
+ "moveFile",
778
+ "multidegree",
779
+ "multidoc",
780
+ "multigraded",
781
+ "multiplicity",
782
+ "mutable",
783
+ "mutableIdentity",
784
+ "mutableMatrix",
785
+ "nanosleep",
786
+ "needs",
787
+ "needsPackage",
788
+ "net",
789
+ "netList",
790
+ "newClass",
791
+ "newCoordinateSystem",
792
+ "newNetFile",
793
+ "newPackage",
794
+ "newRing",
795
+ "next",
796
+ "nextPrime",
797
+ "nextkey",
798
+ "nonspaceAnalyzer",
799
+ "norm",
800
+ "normalCone",
801
+ "notImplemented",
802
+ "nullParser",
803
+ "nullSpace",
804
+ "nullhomotopy",
805
+ "numColumns",
806
+ "numRows",
807
+ "number",
808
+ "numcols",
809
+ "numerator",
810
+ "numeric",
811
+ "numericInterval",
812
+ "numgens",
813
+ "numrows",
814
+ "odd",
815
+ "oeis",
816
+ "ofClass",
817
+ "on",
818
+ "openDatabase",
819
+ "openDatabaseOut",
820
+ "openFiles",
821
+ "openIn",
822
+ "openInOut",
823
+ "openListener",
824
+ "openOut",
825
+ "openOutAppend",
826
+ "optP",
827
+ "optionalSignParser",
828
+ "options",
829
+ "orP",
830
+ "override",
831
+ "pack",
832
+ "package",
833
+ "packageTemplate",
834
+ "pad",
835
+ "pager",
836
+ "pairs",
837
+ "parallelApply",
838
+ "parent",
839
+ "part",
840
+ "partition",
841
+ "partitions",
842
+ "parts",
843
+ "pdim",
844
+ "peek",
845
+ "permanents",
846
+ "permutations",
847
+ "pfaffian",
848
+ "pfaffians",
849
+ "pivots",
850
+ "plus",
851
+ "poincare",
852
+ "poincareN",
853
+ "polarize",
854
+ "poly",
855
+ "position",
856
+ "positions",
857
+ "power",
858
+ "powermod",
859
+ "precision",
860
+ "preimage",
861
+ "prepend",
862
+ "presentation",
863
+ "pretty",
864
+ "primaryComponent",
865
+ "primaryDecomposition",
866
+ "print",
867
+ "printString",
868
+ "printerr",
869
+ "processID",
870
+ "product",
871
+ "projectiveHilbertPolynomial",
872
+ "promote",
873
+ "protect",
874
+ "prune",
875
+ "pseudoRemainder",
876
+ "pseudocode",
877
+ "pullback",
878
+ "pushForward",
879
+ "pushout",
880
+ "quotient",
881
+ "quotientRemainder",
882
+ "radical",
883
+ "radicalContainment",
884
+ "random",
885
+ "randomKRationalPoint",
886
+ "randomMutableMatrix",
887
+ "randomSubset",
888
+ "rank",
889
+ "rays",
890
+ "read",
891
+ "readDirectory",
892
+ "readPackage",
893
+ "readlink",
894
+ "realPart",
895
+ "realpath",
896
+ "recursionDepth",
897
+ "reduceHilbert",
898
+ "reducedRowEchelonForm",
899
+ "reductionNumber",
900
+ "reesAlgebra",
901
+ "reesAlgebraIdeal",
902
+ "reesIdeal",
903
+ "regSeqInIdeal",
904
+ "regex",
905
+ "regexQuote",
906
+ "registerFinalizer",
907
+ "regularity",
908
+ "regularizedBeta",
909
+ "regularizedGamma",
910
+ "relations",
911
+ "relativizeFilename",
912
+ "remainder",
913
+ "remove",
914
+ "removeDirectory",
915
+ "removeFile",
916
+ "removeLowestDimension",
917
+ "reorganize",
918
+ "replace",
919
+ "res",
920
+ "reshape",
921
+ "resolution",
922
+ "resultant",
923
+ "reverse",
924
+ "right",
925
+ "ring",
926
+ "ringFromFractions",
927
+ "roots",
928
+ "rotate",
929
+ "round",
930
+ "rowAdd",
931
+ "rowMult",
932
+ "rowPermute",
933
+ "rowRankProfile",
934
+ "rowSwap",
935
+ "rsort",
936
+ "run",
937
+ "runHooks",
938
+ "runLengthEncode",
939
+ "runProgram",
940
+ "same",
941
+ "saturate",
942
+ "scan",
943
+ "scanKeys",
944
+ "scanLines",
945
+ "scanPairs",
946
+ "scanValues",
947
+ "schedule",
948
+ "schreyerOrder",
949
+ "searchPath",
950
+ "sec",
951
+ "sech",
952
+ "seeParsing",
953
+ "select",
954
+ "selectInSubring",
955
+ "selectKeys",
956
+ "selectPairs",
957
+ "selectValues",
958
+ "selectVariables",
959
+ "separate",
960
+ "separateRegexp",
961
+ "sequence",
962
+ "serialNumber",
963
+ "set",
964
+ "setEcho",
965
+ "setGroupID",
966
+ "setIOExclusive",
967
+ "setIOSynchronized",
968
+ "setIOUnSynchronized",
969
+ "setRandomSeed",
970
+ "setup",
971
+ "setupEmacs",
972
+ "setupLift",
973
+ "setupPromote",
974
+ "sheaf",
975
+ "sheafHom",
976
+ "sheafMap",
977
+ "show",
978
+ "showHtml",
979
+ "showTex",
980
+ "sign",
981
+ "simpleDocFrob",
982
+ "sin",
983
+ "singularLocus",
984
+ "sinh",
985
+ "size",
986
+ "size2",
987
+ "sleep",
988
+ "smithNormalForm",
989
+ "solve",
990
+ "someTerms",
991
+ "sort",
992
+ "sortColumns",
993
+ "source",
994
+ "span",
995
+ "specialFiber",
996
+ "specialFiberIdeal",
997
+ "splice",
998
+ "splitWWW",
999
+ "sqrt",
1000
+ "stack",
1001
+ "stacksProject",
1002
+ "stacktrace",
1003
+ "standardForm",
1004
+ "standardPairs",
1005
+ "stashValue",
1006
+ "status",
1007
+ "store",
1008
+ "style",
1009
+ "sub",
1010
+ "sublists",
1011
+ "submatrix",
1012
+ "submatrixByDegrees",
1013
+ "subquotient",
1014
+ "subsets",
1015
+ "substitute",
1016
+ "substring",
1017
+ "subtable",
1018
+ "sum",
1019
+ "super",
1020
+ "support",
1021
+ "switch",
1022
+ "sylvesterMatrix",
1023
+ "symbolBody",
1024
+ "symlinkDirectory",
1025
+ "symlinkFile",
1026
+ "symmetricAlgebra",
1027
+ "symmetricAlgebraIdeal",
1028
+ "symmetricKernel",
1029
+ "symmetricPower",
1030
+ "synonym",
1031
+ "syz",
1032
+ "syzygyScheme",
1033
+ "table",
1034
+ "take",
1035
+ "tally",
1036
+ "tan",
1037
+ "tangentCone",
1038
+ "tangentSheaf",
1039
+ "tanh",
1040
+ "target",
1041
+ "taskResult",
1042
+ "temporaryFileName",
1043
+ "tensor",
1044
+ "tensorAssociativity",
1045
+ "terminalParser",
1046
+ "terms",
1047
+ "testHunekeQuestion",
1048
+ "tests",
1049
+ "tex",
1050
+ "texMath",
1051
+ "times",
1052
+ "toAbsolutePath",
1053
+ "toCC",
1054
+ "toDividedPowers",
1055
+ "toDual",
1056
+ "toExternalString",
1057
+ "toField",
1058
+ "toList",
1059
+ "toLower",
1060
+ "toRR",
1061
+ "toRRi",
1062
+ "toSequence",
1063
+ "toString",
1064
+ "toUpper",
1065
+ "top",
1066
+ "topCoefficients",
1067
+ "topComponents",
1068
+ "trace",
1069
+ "transpose",
1070
+ "trim",
1071
+ "truncate",
1072
+ "truncateOutput",
1073
+ "tutorial",
1074
+ "ultimate",
1075
+ "unbag",
1076
+ "uncurry",
1077
+ "undocumented",
1078
+ "uniform",
1079
+ "uninstallAllPackages",
1080
+ "uninstallPackage",
1081
+ "union",
1082
+ "unique",
1083
+ "uniquePermutations",
1084
+ "unsequence",
1085
+ "unstack",
1086
+ "urlEncode",
1087
+ "use",
1088
+ "userSymbols",
1089
+ "utf8",
1090
+ "utf8check",
1091
+ "utf8substring",
1092
+ "validate",
1093
+ "value",
1094
+ "values",
1095
+ "variety",
1096
+ "vars",
1097
+ "vector",
1098
+ "versalEmbedding",
1099
+ "wait",
1100
+ "wedgeProduct",
1101
+ "weightRange",
1102
+ "whichGm",
1103
+ "width",
1104
+ "wikipedia",
1105
+ "wrap",
1106
+ "youngest",
1107
+ "zero",
1108
+ "zeta"
1109
+ )
1110
+
1111
+ M2CONSTANTS = (
1112
+ "A1BrouwerDegrees",
1113
+ "AbstractSimplicialComplexes",
1114
+ "AbstractToricVarieties",
1115
+ "Acknowledgement",
1116
+ "AdditionalPaths",
1117
+ "AdjointIdeal",
1118
+ "AdjunctionForSurfaces",
1119
+ "AfterEval",
1120
+ "AfterNoPrint",
1121
+ "AfterPrint",
1122
+ "AInfinity",
1123
+ "AlgebraicSplines",
1124
+ "Algorithm",
1125
+ "Alignment",
1126
+ "AllCodimensions",
1127
+ "AllMarkovBases",
1128
+ "allowableThreads",
1129
+ "AnalyzeSheafOnP1",
1130
+ "applicationDirectorySuffix",
1131
+ "argument",
1132
+ "Ascending",
1133
+ "AssociativeAlgebras",
1134
+ "Authors",
1135
+ "AuxiliaryFiles",
1136
+ "backtrace",
1137
+ "Bareiss",
1138
+ "Base",
1139
+ "BaseFunction",
1140
+ "baseRings",
1141
+ "BaseRow",
1142
+ "BasisElementLimit",
1143
+ "Bayer",
1144
+ "BeforePrint",
1145
+ "BeginningMacaulay2",
1146
+ "Benchmark",
1147
+ "BernsteinSato",
1148
+ "Bertini",
1149
+ "BettiCharacters",
1150
+ "BGG",
1151
+ "BIBasis",
1152
+ "Binary",
1153
+ "Binomial",
1154
+ "BinomialEdgeIdeals",
1155
+ "Binomials",
1156
+ "BKZ",
1157
+ "blockMatrixForm",
1158
+ "Body",
1159
+ "BoijSoederberg",
1160
+ "Book3264Examples",
1161
+ "BooleanGB",
1162
+ "Boxes",
1163
+ "Brackets",
1164
+ "Browse",
1165
+ "Bruns",
1166
+ "cache",
1167
+ "CacheExampleOutput",
1168
+ "CallLimit",
1169
+ "CannedExample",
1170
+ "CatalanConstant",
1171
+ "Caveat",
1172
+ "CellularResolutions",
1173
+ "Center",
1174
+ "Certification",
1175
+ "ChainComplexExtras",
1176
+ "ChainComplexOperations",
1177
+ "ChangeMatrix",
1178
+ "CharacteristicClasses",
1179
+ "CheckDocumentation",
1180
+ "Chordal",
1181
+ "Citation",
1182
+ "cite",
1183
+ "Classic",
1184
+ "clearAll",
1185
+ "clearOutput",
1186
+ "close",
1187
+ "closeIn",
1188
+ "closeOut",
1189
+ "ClosestFit",
1190
+ "Code",
1191
+ "CodimensionLimit",
1192
+ "CodingTheory",
1193
+ "CoefficientRing",
1194
+ "Cofactor",
1195
+ "CohenEngine",
1196
+ "CohenTopLevel",
1197
+ "CohomCalg",
1198
+ "CoincidentRootLoci",
1199
+ "commandLine",
1200
+ "compactMatrixForm",
1201
+ "Complement",
1202
+ "CompleteIntersection",
1203
+ "CompleteIntersectionResolutions",
1204
+ "Complexes",
1205
+ "ConductorElement",
1206
+ "Configuration",
1207
+ "ConformalBlocks",
1208
+ "ConnectionMatrices",
1209
+ "Consequences",
1210
+ "Constants",
1211
+ "Contributors",
1212
+ "ConvexInterface",
1213
+ "ConwayPolynomials",
1214
+ "copyright",
1215
+ "Core",
1216
+ "CorrespondenceScrolls",
1217
+ "CotangentSchubert",
1218
+ "cotangentSurjection",
1219
+ "coverageSummary",
1220
+ "CpMackeyFunctors",
1221
+ "Cremona",
1222
+ "currentFileDirectory",
1223
+ "currentFileName",
1224
+ "currentLayout",
1225
+ "currentPackage",
1226
+ "Cyclotomic",
1227
+ "Date",
1228
+ "dd",
1229
+ "DebuggingMode",
1230
+ "debuggingMode",
1231
+ "debugLevel",
1232
+ "DecomposableSparseSystems",
1233
+ "Decompose",
1234
+ "Default",
1235
+ "defaultPrecision",
1236
+ "Degree",
1237
+ "DegreeGroup",
1238
+ "DegreeLift",
1239
+ "DegreeLimit",
1240
+ "DegreeMap",
1241
+ "DegreeOrder",
1242
+ "DegreeRank",
1243
+ "Degrees",
1244
+ "Dense",
1245
+ "Density",
1246
+ "Depth",
1247
+ "Descending",
1248
+ "Description",
1249
+ "DeterminantalRepresentations",
1250
+ "DGAlgebras",
1251
+ "dictionaryPath",
1252
+ "DiffAlg",
1253
+ "Dispatch",
1254
+ "DivideConquer",
1255
+ "DividedPowers",
1256
+ "Dmodules",
1257
+ "docExample",
1258
+ "docTemplate",
1259
+ "Down",
1260
+ "Dynamic",
1261
+ "EagonResolution",
1262
+ "EdgeIdeals",
1263
+ "edit",
1264
+ "EigenSolver",
1265
+ "EisenbudHunekeVasconcelos",
1266
+ "Elimination",
1267
+ "EliminationMatrices",
1268
+ "EllipticCurves",
1269
+ "EllipticIntegrals",
1270
+ "Email",
1271
+ "embeddedToAbstract",
1272
+ "end",
1273
+ "endl",
1274
+ "Engine",
1275
+ "engineDebugLevel",
1276
+ "EngineTests",
1277
+ "EnumerationCurves",
1278
+ "environment",
1279
+ "EquivariantGB",
1280
+ "errorDepth",
1281
+ "EulerConstant",
1282
+ "eulerSequence",
1283
+ "Example",
1284
+ "ExampleFiles",
1285
+ "ExampleSystems",
1286
+ "Exclude",
1287
+ "exit",
1288
+ "Ext",
1289
+ "ExteriorExtensions",
1290
+ "ExteriorIdeals",
1291
+ "ExteriorModules",
1292
+ "ExtLongExactSequence",
1293
+ "false",
1294
+ "FastMinors",
1295
+ "FastNonminimal",
1296
+ "FGLM",
1297
+ "fileDictionaries",
1298
+ "fileExitHooks",
1299
+ "FileName",
1300
+ "FindOne",
1301
+ "FiniteFittingIdeals",
1302
+ "First",
1303
+ "FirstPackage",
1304
+ "FlatMonoid",
1305
+ "Flexible",
1306
+ "flush",
1307
+ "FollowLinks",
1308
+ "ForeignFunctions",
1309
+ "FormalGroupLaws",
1310
+ "Format",
1311
+ "FourierMotzkin",
1312
+ "FourTiTwo",
1313
+ "fpLLL",
1314
+ "FrobeniusThresholds",
1315
+ "FunctionFieldDesingularization",
1316
+ "GameTheory",
1317
+ "GBDegrees",
1318
+ "gbTrace",
1319
+ "GenerateAssertions",
1320
+ "Generic",
1321
+ "GenericInitialIdeal",
1322
+ "GeometricDecomposability",
1323
+ "gfanInterface",
1324
+ "Givens",
1325
+ "GKMVarieties",
1326
+ "GLex",
1327
+ "Global",
1328
+ "GlobalAssignHook",
1329
+ "globalAssignmentHooks",
1330
+ "GlobalHookStore",
1331
+ "GlobalReleaseHook",
1332
+ "GlobalSectionLimit",
1333
+ "Gorenstein",
1334
+ "GradedLieAlgebras",
1335
+ "GraphicalModels",
1336
+ "GraphicalModelsMLE",
1337
+ "Graphics",
1338
+ "Graphs",
1339
+ "GRevLex",
1340
+ "GroebnerStrata",
1341
+ "GroebnerWalk",
1342
+ "GroupLex",
1343
+ "GroupRevLex",
1344
+ "GTZ",
1345
+ "Hadamard",
1346
+ "handleInterrupts",
1347
+ "HardDegreeLimit",
1348
+ "Heading",
1349
+ "Headline",
1350
+ "Heft",
1351
+ "Height",
1352
+ "help",
1353
+ "Hermite",
1354
+ "Hermitian",
1355
+ "HH",
1356
+ "hh",
1357
+ "HigherCIOperators",
1358
+ "HighestWeights",
1359
+ "Hilbert",
1360
+ "HodgeIntegrals",
1361
+ "HolonomicSystems",
1362
+ "homeDirectory",
1363
+ "HomePage",
1364
+ "Homogeneous",
1365
+ "Homogeneous2",
1366
+ "HomologicalAlgebraPackage",
1367
+ "HomotopyLieAlgebra",
1368
+ "HorizontalSpace",
1369
+ "HyperplaneArrangements",
1370
+ "id",
1371
+ "idealSheafSequence",
1372
+ "IgnoreExampleErrors",
1373
+ "ii",
1374
+ "IncidenceCorrespondenceCohomology",
1375
+ "incomparable",
1376
+ "Increment",
1377
+ "indeterminate",
1378
+ "Index",
1379
+ "indexComponents",
1380
+ "infinity",
1381
+ "InfoDirSection",
1382
+ "infoHelp",
1383
+ "Inhomogeneous",
1384
+ "Inputs",
1385
+ "InstallPrefix",
1386
+ "IntegerProgramming",
1387
+ "IntegralClosure",
1388
+ "interpreterDepth",
1389
+ "Intersection",
1390
+ "InvariantRing",
1391
+ "InverseMethod",
1392
+ "Inverses",
1393
+ "InverseSystems",
1394
+ "Invertible",
1395
+ "InvolutiveBases",
1396
+ "Isomorphism",
1397
+ "Item",
1398
+ "Iterate",
1399
+ "Jacobian",
1400
+ "Jets",
1401
+ "Join",
1402
+ "JSON",
1403
+ "JSONRPC",
1404
+ "K3Carpets",
1405
+ "K3Surfaces",
1406
+ "Keep",
1407
+ "KeepFiles",
1408
+ "KeepZeroes",
1409
+ "Key",
1410
+ "Keywords",
1411
+ "Kronecker",
1412
+ "KustinMiller",
1413
+ "lastMatch",
1414
+ "LatticePolytopes",
1415
+ "Layout",
1416
+ "Left",
1417
+ "LengthLimit",
1418
+ "Lex",
1419
+ "LexIdeals",
1420
+ "LieAlgebraRepresentations",
1421
+ "Limit",
1422
+ "Linear",
1423
+ "LinearAlgebra",
1424
+ "LinearTruncations",
1425
+ "lineNumber",
1426
+ "listLocalSymbols",
1427
+ "listUserSymbols",
1428
+ "LLLBases",
1429
+ "loadDepth",
1430
+ "LoadDocumentation",
1431
+ "loadedFiles",
1432
+ "loadedPackages",
1433
+ "Local",
1434
+ "LocalRings",
1435
+ "LongPolynomial",
1436
+ "M0nbar",
1437
+ "Macaulay2Doc",
1438
+ "Maintainer",
1439
+ "MakeDocumentation",
1440
+ "MakeHTML",
1441
+ "MakeInfo",
1442
+ "MakePDF",
1443
+ "MapleInterface",
1444
+ "Markov",
1445
+ "MatchingFields",
1446
+ "MatrixFactorizations",
1447
+ "MatrixSchubert",
1448
+ "Matroids",
1449
+ "maxAllowableThreads",
1450
+ "maxExponent",
1451
+ "MaximalRank",
1452
+ "MaxReductionCount",
1453
+ "MCMApproximations",
1454
+ "MergeTeX",
1455
+ "minExponent",
1456
+ "MinimalGenerators",
1457
+ "MinimalMatrix",
1458
+ "minimalPresentationMap",
1459
+ "minimalPresentationMapInv",
1460
+ "MinimalPrimes",
1461
+ "Minimize",
1462
+ "MinimumVersion",
1463
+ "Miura",
1464
+ "MixedMultiplicity",
1465
+ "ModuleDeformations",
1466
+ "MonodromySolver",
1467
+ "Monomial",
1468
+ "MonomialAlgebras",
1469
+ "MonomialIntegerPrograms",
1470
+ "MonomialOrbits",
1471
+ "MonomialOrder",
1472
+ "Monomials",
1473
+ "MonomialSize",
1474
+ "Msolve",
1475
+ "MultigradedBGG",
1476
+ "MultigradedImplicitization",
1477
+ "MultiGradedRationalMap",
1478
+ "MultiplicitySequence",
1479
+ "MultiplierIdeals",
1480
+ "MultiplierIdealsDim2",
1481
+ "MultiprojectiveVarieties",
1482
+ "NAGtypes",
1483
+ "Name",
1484
+ "Nauty",
1485
+ "NautyGraphs",
1486
+ "NCAlgebra",
1487
+ "NCLex",
1488
+ "NewFromMethod",
1489
+ "newline",
1490
+ "NewMethod",
1491
+ "NewOfFromMethod",
1492
+ "NewOfMethod",
1493
+ "nil",
1494
+ "Node",
1495
+ "NoetherianOperators",
1496
+ "NoetherNormalization",
1497
+ "NonminimalComplexes",
1498
+ "NonPrincipalTestIdeals",
1499
+ "NoPrint",
1500
+ "Normaliz",
1501
+ "NormalToricVarieties",
1502
+ "NotANumber",
1503
+ "notify",
1504
+ "NTL",
1505
+ "null",
1506
+ "nullaryMethods",
1507
+ "NumericalAlgebraicGeometry",
1508
+ "NumericalCertification",
1509
+ "NumericalImplicitization",
1510
+ "NumericalLinearAlgebra",
1511
+ "NumericalSchubertCalculus",
1512
+ "NumericalSemigroups",
1513
+ "NumericSolutions",
1514
+ "numTBBThreads",
1515
+ "OIGroebnerBases",
1516
+ "OldChainComplexes",
1517
+ "OldPolyhedra",
1518
+ "OldToricVectorBundles",
1519
+ "OnlineLookup",
1520
+ "OO",
1521
+ "oo",
1522
+ "ooo",
1523
+ "oooo",
1524
+ "OpenMath",
1525
+ "operatorAttributes",
1526
+ "OptionalComponentsPresent",
1527
+ "Options",
1528
+ "Order",
1529
+ "order",
1530
+ "Oscillators",
1531
+ "OutputDictionary",
1532
+ "Outputs",
1533
+ "PackageCitations",
1534
+ "PackageDictionary",
1535
+ "PackageExports",
1536
+ "PackageImports",
1537
+ "PackageTemplate",
1538
+ "PairLimit",
1539
+ "PairsRemaining",
1540
+ "ParallelF4",
1541
+ "ParallelizeByDegree",
1542
+ "Parametrization",
1543
+ "Parsing",
1544
+ "path",
1545
+ "PathSignatures",
1546
+ "PencilsOfQuadrics",
1547
+ "Permanents",
1548
+ "Permutations",
1549
+ "PHCpack",
1550
+ "PhylogeneticTrees",
1551
+ "pi",
1552
+ "PieriMaps",
1553
+ "PlaneCurveLinearSeries",
1554
+ "PlaneCurveSingularities",
1555
+ "Points",
1556
+ "Polyhedra",
1557
+ "Polymake",
1558
+ "PolyominoIdeals",
1559
+ "Posets",
1560
+ "Position",
1561
+ "PositivityToricBundles",
1562
+ "POSIX",
1563
+ "Postfix",
1564
+ "Pre",
1565
+ "Precision",
1566
+ "Prefix",
1567
+ "prefixDirectory",
1568
+ "prefixPath",
1569
+ "PrimaryDecomposition",
1570
+ "PrimaryTag",
1571
+ "PrimitiveElement",
1572
+ "Print",
1573
+ "printingAccuracy",
1574
+ "printingLeadLimit",
1575
+ "printingPrecision",
1576
+ "printingSeparator",
1577
+ "printingTimeLimit",
1578
+ "printingTrailLimit",
1579
+ "printWidth",
1580
+ "Probability",
1581
+ "profileSummary",
1582
+ "programPaths",
1583
+ "Projective",
1584
+ "Prune",
1585
+ "PruneComplex",
1586
+ "pruningMap",
1587
+ "PseudomonomialPrimaryDecomposition",
1588
+ "Pullback",
1589
+ "pullbackMaps",
1590
+ "PushForward",
1591
+ "pushoutMaps",
1592
+ "Python",
1593
+ "QthPower",
1594
+ "QuadraticIdealExamplesByRoos",
1595
+ "Quasidegrees",
1596
+ "QuaternaryQuartics",
1597
+ "QuillenSuslin",
1598
+ "quit",
1599
+ "Quotient",
1600
+ "Radical",
1601
+ "RadicalCodim1",
1602
+ "RaiseError",
1603
+ "RandomCanonicalCurves",
1604
+ "RandomComplexes",
1605
+ "RandomCurves",
1606
+ "RandomCurvesOverVerySmallFiniteFields",
1607
+ "RandomGenus14Curves",
1608
+ "RandomIdeals",
1609
+ "RandomMonomialIdeals",
1610
+ "RandomObjects",
1611
+ "RandomPlaneCurves",
1612
+ "RandomPoints",
1613
+ "RandomSpaceCurves",
1614
+ "Range",
1615
+ "RationalMaps",
1616
+ "RationalPoints",
1617
+ "RationalPoints2",
1618
+ "ReactionNetworks",
1619
+ "RealFP",
1620
+ "RealQP",
1621
+ "RealQP1",
1622
+ "RealRoots",
1623
+ "RealRR",
1624
+ "RealXD",
1625
+ "recursionLimit",
1626
+ "Reduce",
1627
+ "ReesAlgebra",
1628
+ "References",
1629
+ "ReflexivePolytopesDB",
1630
+ "Regularity",
1631
+ "RelativeCanonicalResolution",
1632
+ "Reload",
1633
+ "RemakeAllDocumentation",
1634
+ "RerunExamples",
1635
+ "ResidualIntersections",
1636
+ "ResLengthThree",
1637
+ "ResolutionsOfStanleyReisnerRings",
1638
+ "restart",
1639
+ "Result",
1640
+ "Resultants",
1641
+ "returnCode",
1642
+ "Reverse",
1643
+ "RevLex",
1644
+ "RHom",
1645
+ "Right",
1646
+ "RInterface",
1647
+ "rootPath",
1648
+ "rootURI",
1649
+ "RunDirectory",
1650
+ "RunExamples",
1651
+ "RunExternalM2",
1652
+ "SagbiGbDetection",
1653
+ "Saturation",
1654
+ "SaturationMap",
1655
+ "Schubert2",
1656
+ "SchurComplexes",
1657
+ "SchurFunctors",
1658
+ "SchurRings",
1659
+ "SchurVeronese",
1660
+ "SCMAlgebras",
1661
+ "scriptCommandLine",
1662
+ "SCSCP",
1663
+ "SectionRing",
1664
+ "SeeAlso",
1665
+ "SegreClasses",
1666
+ "SemidefiniteProgramming",
1667
+ "Seminormalization",
1668
+ "SeparateExec",
1669
+ "Serialization",
1670
+ "sheafExt",
1671
+ "ShimoyamaYokoyama",
1672
+ "showClassStructure",
1673
+ "showStructure",
1674
+ "showUserStructure",
1675
+ "SimpleDoc",
1676
+ "SimplicialComplexes",
1677
+ "SimplicialDecomposability",
1678
+ "SimplicialPosets",
1679
+ "SimplifyFractions",
1680
+ "SizeLimit",
1681
+ "SkewCommutative",
1682
+ "SlackIdeals",
1683
+ "SLnEquivariantMatrices",
1684
+ "SLPexpressions",
1685
+ "Sort",
1686
+ "SortStrategy",
1687
+ "SourceCode",
1688
+ "SourceRing",
1689
+ "SpaceCurves",
1690
+ "SparseResultants",
1691
+ "SpechtModule",
1692
+ "SpecialFanoFourfolds",
1693
+ "SpectralSequences",
1694
+ "SRdeformations",
1695
+ "Standard",
1696
+ "StartWithOneMinor",
1697
+ "StatePolytope",
1698
+ "StatGraphs",
1699
+ "stderr",
1700
+ "stdio",
1701
+ "StopBeforeComputation",
1702
+ "stopIfError",
1703
+ "StopIteration",
1704
+ "StopWithMinimalGenerators",
1705
+ "Strategy",
1706
+ "Strict",
1707
+ "StronglyStableIdeals",
1708
+ "Style",
1709
+ "SubalgebraBases",
1710
+ "Subnodes",
1711
+ "SubringLimit",
1712
+ "subscript",
1713
+ "Sugarless",
1714
+ "SumsOfSquares",
1715
+ "SuperLinearAlgebra",
1716
+ "superscript",
1717
+ "SVDComplexes",
1718
+ "SwitchingFields",
1719
+ "SymbolicPowers",
1720
+ "SymmetricPolynomials",
1721
+ "Synopsis",
1722
+ "Syzygies",
1723
+ "SyzygyLimit",
1724
+ "SyzygyMatrix",
1725
+ "SyzygyRows",
1726
+ "Tableaux",
1727
+ "TangentCone",
1728
+ "TateOnProducts",
1729
+ "TensorComplexes",
1730
+ "TerraciniLoci",
1731
+ "Test",
1732
+ "testExample",
1733
+ "TestIdeals",
1734
+ "TeXmacs",
1735
+ "Text",
1736
+ "ThinSincereQuivers",
1737
+ "ThreadedGB",
1738
+ "Threads",
1739
+ "Threshold",
1740
+ "Topcom",
1741
+ "topLevelMode",
1742
+ "Tor",
1743
+ "TorAlgebra",
1744
+ "Toric",
1745
+ "ToricHigherDirectImages",
1746
+ "ToricInvariants",
1747
+ "ToricTopology",
1748
+ "ToricVectorBundles",
1749
+ "Torsion",
1750
+ "TorsionFree",
1751
+ "TotalPairs",
1752
+ "Tree",
1753
+ "TriangularSets",
1754
+ "Triangulations",
1755
+ "Tries",
1756
+ "Trim",
1757
+ "Triplets",
1758
+ "Tropical",
1759
+ "TropicalToric",
1760
+ "true",
1761
+ "Truncate",
1762
+ "Truncations",
1763
+ "TSpreadIdeals",
1764
+ "TypicalValue",
1765
+ "typicalValues",
1766
+ "Undo",
1767
+ "Unique",
1768
+ "Units",
1769
+ "Unmixed",
1770
+ "Up",
1771
+ "UpdateOnly",
1772
+ "UpperTriangular",
1773
+ "Usage",
1774
+ "UseCachedExampleOutput",
1775
+ "UseHilbertFunction",
1776
+ "UserMode",
1777
+ "UseSyzygies",
1778
+ "Valuations",
1779
+ "Variable",
1780
+ "VariableBaseName",
1781
+ "Variables",
1782
+ "Varieties",
1783
+ "Vasconcelos",
1784
+ "VectorFields",
1785
+ "VectorGraphics",
1786
+ "Verbose",
1787
+ "Verbosity",
1788
+ "Verify",
1789
+ "VersalDeformations",
1790
+ "Version",
1791
+ "version",
1792
+ "VerticalSpace",
1793
+ "viewHelp",
1794
+ "VirtualResolutions",
1795
+ "Visualize",
1796
+ "VNumber",
1797
+ "WebApp",
1798
+ "Weights",
1799
+ "WeilDivisors",
1800
+ "WeylAlgebra",
1801
+ "WeylAlgebras",
1802
+ "WeylGroups",
1803
+ "WhitneyStratifications",
1804
+ "Wrap",
1805
+ "XML",
1806
+ "yonedaSheafExtension"
1807
+ )
1808
+
1809
+ class Macaulay2Lexer(RegexLexer):
1810
+ """Lexer for Macaulay2, a software system for research in algebraic geometry."""
1811
+
1812
+ name = 'Macaulay2'
1813
+ url = 'https://macaulay2.com/'
1814
+ aliases = ['macaulay2']
1815
+ filenames = ['*.m2']
1816
+ version_added = '2.12'
1817
+
1818
+ tokens = {
1819
+ 'root': [
1820
+ (r'--.*$', Comment.Single),
1821
+ (r'-\*', Comment.Multiline, 'block comment'),
1822
+ (r'"', String, 'quote string'),
1823
+ (r'///', String, 'slash string'),
1824
+ (words(M2KEYWORDS, prefix=r'\b', suffix=r'\b'), Keyword),
1825
+ (words(M2DATATYPES, prefix=r'\b', suffix=r'\b'), Name.Builtin),
1826
+ (words(M2FUNCTIONS, prefix=r'\b', suffix=r'\b'), Name.Function),
1827
+ (words(M2CONSTANTS, prefix=r'\b', suffix=r'\b'), Name.Constant),
1828
+ (r'\s+', Text.Whitespace),
1829
+ (r'.', Text)
1830
+ ],
1831
+ 'block comment' : [
1832
+ (r'[^*-]+', Comment.Multiline),
1833
+ (r'\*-', Comment.Multiline, '#pop'),
1834
+ (r'[*-]', Comment.Multiline)
1835
+ ],
1836
+ 'quote string' : [
1837
+ (r'[^\\"]+', String),
1838
+ (r'"', String, '#pop'),
1839
+ (r'\\"?', String),
1840
+ ],
1841
+ 'slash string' : [
1842
+ (r'[^/]+', String),
1843
+ (r'(//)+(?!/)', String),
1844
+ (r'/(//)+(?!/)', String, '#pop'),
1845
+ (r'/', String)
1846
+ ]
1847
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/make.py ADDED
@@ -0,0 +1,212 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.make
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Makefiles and similar.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import Lexer, RegexLexer, include, bygroups, \
14
+ do_insertions, using
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Punctuation, Whitespace
17
+ from pygments.lexers.shell import BashLexer
18
+
19
+ __all__ = ['MakefileLexer', 'BaseMakefileLexer', 'CMakeLexer']
20
+
21
+
22
+ class MakefileLexer(Lexer):
23
+ """
24
+ Lexer for BSD and GNU make extensions (lenient enough to handle both in
25
+ the same file even).
26
+
27
+ *Rewritten in Pygments 0.10.*
28
+ """
29
+
30
+ name = 'Makefile'
31
+ aliases = ['make', 'makefile', 'mf', 'bsdmake']
32
+ filenames = ['*.mak', '*.mk', 'Makefile', 'makefile', 'Makefile.*', 'GNUmakefile']
33
+ mimetypes = ['text/x-makefile']
34
+ url = 'https://en.wikipedia.org/wiki/Make_(software)'
35
+ version_added = ''
36
+
37
+ r_special = re.compile(
38
+ r'^(?:'
39
+ # BSD Make
40
+ r'\.\s*(include|undef|error|warning|if|else|elif|endif|for|endfor)|'
41
+ # GNU Make
42
+ r'\s*(ifeq|ifneq|ifdef|ifndef|else|endif|-?include|define|endef|:|vpath)|'
43
+ # GNU Automake
44
+ r'\s*(if|else|endif))(?=\s)')
45
+ r_comment = re.compile(r'^\s*@?#')
46
+
47
+ def get_tokens_unprocessed(self, text):
48
+ ins = []
49
+ lines = text.splitlines(keepends=True)
50
+ done = ''
51
+ lex = BaseMakefileLexer(**self.options)
52
+ backslashflag = False
53
+ for line in lines:
54
+ if self.r_special.match(line) or backslashflag:
55
+ ins.append((len(done), [(0, Comment.Preproc, line)]))
56
+ backslashflag = line.strip().endswith('\\')
57
+ elif self.r_comment.match(line):
58
+ ins.append((len(done), [(0, Comment, line)]))
59
+ else:
60
+ done += line
61
+ yield from do_insertions(ins, lex.get_tokens_unprocessed(done))
62
+
63
+ def analyse_text(text):
64
+ # Many makefiles have $(BIG_CAPS) style variables
65
+ if re.search(r'\$\([A-Z_]+\)', text):
66
+ return 0.1
67
+
68
+
69
+ class BaseMakefileLexer(RegexLexer):
70
+ """
71
+ Lexer for simple Makefiles (no preprocessing).
72
+ """
73
+
74
+ name = 'Base Makefile'
75
+ aliases = ['basemake']
76
+ filenames = []
77
+ mimetypes = []
78
+ url = 'https://en.wikipedia.org/wiki/Make_(software)'
79
+ version_added = '0.10'
80
+
81
+ tokens = {
82
+ 'root': [
83
+ # recipes (need to allow spaces because of expandtabs)
84
+ (r'^(?:[\t ]+.*\n|\n)+', using(BashLexer)),
85
+ # special variables
86
+ (r'\$[<@$+%?|*]', Keyword),
87
+ (r'\s+', Whitespace),
88
+ (r'#.*?\n', Comment),
89
+ (r'((?:un)?export)(\s+)(?=[\w${}\t -]+\n)',
90
+ bygroups(Keyword, Whitespace), 'export'),
91
+ (r'(?:un)?export\s+', Keyword),
92
+ # assignment
93
+ (r'([\w${}().-]+)(\s*)([!?:+]?=)([ \t]*)((?:.*\\\n)+|.*\n)',
94
+ bygroups(
95
+ Name.Variable, Whitespace, Operator, Whitespace,
96
+ using(BashLexer))),
97
+ # strings
98
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
99
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
100
+ # targets
101
+ (r'([^\n:]+)(:+)([ \t]*)', bygroups(
102
+ Name.Function, Operator, Whitespace),
103
+ 'block-header'),
104
+ # expansions
105
+ (r'\$\(', Keyword, 'expansion'),
106
+ ],
107
+ 'expansion': [
108
+ (r'[^\w$().-]+', Text),
109
+ (r'[\w.-]+', Name.Variable),
110
+ (r'\$', Keyword),
111
+ (r'\(', Keyword, '#push'),
112
+ (r'\)', Keyword, '#pop'),
113
+ ],
114
+ 'export': [
115
+ (r'[\w${}-]+', Name.Variable),
116
+ (r'\n', Text, '#pop'),
117
+ (r'\s+', Whitespace),
118
+ ],
119
+ 'block-header': [
120
+ (r'[,|]', Punctuation),
121
+ (r'#.*?\n', Comment, '#pop'),
122
+ (r'\\\n', Text), # line continuation
123
+ (r'\$\(', Keyword, 'expansion'),
124
+ (r'[a-zA-Z_]+', Name),
125
+ (r'\n', Whitespace, '#pop'),
126
+ (r'.', Text),
127
+ ],
128
+ }
129
+
130
+
131
+ class CMakeLexer(RegexLexer):
132
+ """
133
+ Lexer for CMake files.
134
+ """
135
+ name = 'CMake'
136
+ url = 'https://cmake.org/documentation/'
137
+ aliases = ['cmake']
138
+ filenames = ['*.cmake', 'CMakeLists.txt']
139
+ mimetypes = ['text/x-cmake']
140
+ version_added = '1.2'
141
+
142
+ tokens = {
143
+ 'root': [
144
+ # (r'(ADD_CUSTOM_COMMAND|ADD_CUSTOM_TARGET|ADD_DEFINITIONS|'
145
+ # r'ADD_DEPENDENCIES|ADD_EXECUTABLE|ADD_LIBRARY|ADD_SUBDIRECTORY|'
146
+ # r'ADD_TEST|AUX_SOURCE_DIRECTORY|BUILD_COMMAND|BUILD_NAME|'
147
+ # r'CMAKE_MINIMUM_REQUIRED|CONFIGURE_FILE|CREATE_TEST_SOURCELIST|'
148
+ # r'ELSE|ELSEIF|ENABLE_LANGUAGE|ENABLE_TESTING|ENDFOREACH|'
149
+ # r'ENDFUNCTION|ENDIF|ENDMACRO|ENDWHILE|EXEC_PROGRAM|'
150
+ # r'EXECUTE_PROCESS|EXPORT_LIBRARY_DEPENDENCIES|FILE|FIND_FILE|'
151
+ # r'FIND_LIBRARY|FIND_PACKAGE|FIND_PATH|FIND_PROGRAM|FLTK_WRAP_UI|'
152
+ # r'FOREACH|FUNCTION|GET_CMAKE_PROPERTY|GET_DIRECTORY_PROPERTY|'
153
+ # r'GET_FILENAME_COMPONENT|GET_SOURCE_FILE_PROPERTY|'
154
+ # r'GET_TARGET_PROPERTY|GET_TEST_PROPERTY|IF|INCLUDE|'
155
+ # r'INCLUDE_DIRECTORIES|INCLUDE_EXTERNAL_MSPROJECT|'
156
+ # r'INCLUDE_REGULAR_EXPRESSION|INSTALL|INSTALL_FILES|'
157
+ # r'INSTALL_PROGRAMS|INSTALL_TARGETS|LINK_DIRECTORIES|'
158
+ # r'LINK_LIBRARIES|LIST|LOAD_CACHE|LOAD_COMMAND|MACRO|'
159
+ # r'MAKE_DIRECTORY|MARK_AS_ADVANCED|MATH|MESSAGE|OPTION|'
160
+ # r'OUTPUT_REQUIRED_FILES|PROJECT|QT_WRAP_CPP|QT_WRAP_UI|REMOVE|'
161
+ # r'REMOVE_DEFINITIONS|SEPARATE_ARGUMENTS|SET|'
162
+ # r'SET_DIRECTORY_PROPERTIES|SET_SOURCE_FILES_PROPERTIES|'
163
+ # r'SET_TARGET_PROPERTIES|SET_TESTS_PROPERTIES|SITE_NAME|'
164
+ # r'SOURCE_GROUP|STRING|SUBDIR_DEPENDS|SUBDIRS|'
165
+ # r'TARGET_LINK_LIBRARIES|TRY_COMPILE|TRY_RUN|UNSET|'
166
+ # r'USE_MANGLED_MESA|UTILITY_SOURCE|VARIABLE_REQUIRES|'
167
+ # r'VTK_MAKE_INSTANTIATOR|VTK_WRAP_JAVA|VTK_WRAP_PYTHON|'
168
+ # r'VTK_WRAP_TCL|WHILE|WRITE_FILE|'
169
+ # r'COUNTARGS)\b', Name.Builtin, 'args'),
170
+ (r'\b(\w+)([ \t]*)(\()', bygroups(Name.Builtin, Whitespace,
171
+ Punctuation), 'args'),
172
+ include('keywords'),
173
+ include('ws')
174
+ ],
175
+ 'args': [
176
+ (r'\(', Punctuation, '#push'),
177
+ (r'\)', Punctuation, '#pop'),
178
+ (r'(\$\{)(.+?)(\})', bygroups(Operator, Name.Variable, Operator)),
179
+ (r'(\$ENV\{)(.+?)(\})', bygroups(Operator, Name.Variable, Operator)),
180
+ (r'(\$<)(.+?)(>)', bygroups(Operator, Name.Variable, Operator)),
181
+ (r'(?s)".*?"', String.Double),
182
+ (r'\\\S+', String),
183
+ (r'\[(?P<level>=*)\[[\w\W]*?\](?P=level)\]', String.Multiline),
184
+ (r'[^)$"# \t\n]+', String),
185
+ (r'\n', Whitespace), # explicitly legal
186
+ include('keywords'),
187
+ include('ws')
188
+ ],
189
+ 'string': [
190
+
191
+ ],
192
+ 'keywords': [
193
+ (r'\b(WIN32|UNIX|APPLE|CYGWIN|BORLAND|MINGW|MSVC|MSVC_IDE|MSVC60|'
194
+ r'MSVC70|MSVC71|MSVC80|MSVC90)\b', Keyword),
195
+ ],
196
+ 'ws': [
197
+ (r'[ \t]+', Whitespace),
198
+ (r'#\[(?P<level>=*)\[[\w\W]*?\](?P=level)\]', Comment),
199
+ (r'#.*\n', Comment),
200
+ ]
201
+ }
202
+
203
+ def analyse_text(text):
204
+ exp = (
205
+ r'^[ \t]*CMAKE_MINIMUM_REQUIRED[ \t]*'
206
+ r'\([ \t]*VERSION[ \t]*\d+(\.\d+)*[ \t]*'
207
+ r'([ \t]FATAL_ERROR)?[ \t]*\)[ \t]*'
208
+ r'(#[^\n]*)?$'
209
+ )
210
+ if re.search(exp, text, flags=re.MULTILINE | re.IGNORECASE):
211
+ return 0.8
212
+ return 0.0
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/maple.py ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.maple
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Maple.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import words, bygroups, ExtendedRegexLexer
12
+ from pygments.token import Comment, Name, String, Whitespace, Operator, Punctuation, Number, Keyword
13
+
14
+ __all__ = ['MapleLexer']
15
+
16
+
17
+ class MapleLexer(ExtendedRegexLexer):
18
+ """
19
+ Lexer for Maple.
20
+ """
21
+
22
+ name = 'Maple'
23
+ aliases = ['maple']
24
+ filenames = ['*.mpl', '*.mi', '*.mm']
25
+ mimetypes = ['text/x-maple']
26
+ url = 'https://www.maplesoft.com/products/Maple/'
27
+ version_added = '2.19'
28
+
29
+ keywords = ('and',
30
+ 'assuming',
31
+ 'break',
32
+ 'by',
33
+ 'catch',
34
+ 'description',
35
+ 'do',
36
+ 'done',
37
+ 'elif',
38
+ 'else',
39
+ 'end',
40
+ 'error',
41
+ 'export',
42
+ 'fi',
43
+ 'finally',
44
+ 'for',
45
+ 'from',
46
+ 'global',
47
+ 'if',
48
+ 'implies',
49
+ 'in',
50
+ 'intersect',
51
+ 'local',
52
+ 'minus',
53
+ 'mod',
54
+ 'module',
55
+ 'next',
56
+ 'not',
57
+ 'od',
58
+ 'option',
59
+ 'options',
60
+ 'or',
61
+ 'proc',
62
+ 'quit',
63
+ 'read',
64
+ 'return',
65
+ 'save',
66
+ 'stop',
67
+ 'subset',
68
+ 'then',
69
+ 'to',
70
+ 'try',
71
+ 'union',
72
+ 'use',
73
+ 'uses',
74
+ 'while',
75
+ 'xor')
76
+
77
+ builtins = ('abs',
78
+ 'add',
79
+ 'addressof',
80
+ 'anames',
81
+ 'and',
82
+ 'andmap',
83
+ 'andseq',
84
+ 'appendto',
85
+ 'Array',
86
+ 'array',
87
+ 'ArrayOptions',
88
+ 'assemble',
89
+ 'ASSERT',
90
+ 'assign',
91
+ 'assigned',
92
+ 'attributes',
93
+ 'cat',
94
+ 'ceil',
95
+ 'coeff',
96
+ 'coeffs',
97
+ 'conjugate',
98
+ 'convert',
99
+ 'CopySign',
100
+ 'DEBUG',
101
+ 'debugopts',
102
+ 'Default0',
103
+ 'DefaultOverflow',
104
+ 'DefaultUnderflow',
105
+ 'degree',
106
+ 'denom',
107
+ 'diff',
108
+ 'disassemble',
109
+ 'divide',
110
+ 'done',
111
+ 'entries',
112
+ 'EqualEntries',
113
+ 'eval',
114
+ 'evalb',
115
+ 'evalf',
116
+ 'evalhf',
117
+ 'evalindets',
118
+ 'evaln',
119
+ 'expand',
120
+ 'exports',
121
+ 'factorial',
122
+ 'floor',
123
+ 'frac',
124
+ 'frem',
125
+ 'FromInert',
126
+ 'frontend',
127
+ 'gc',
128
+ 'genpoly',
129
+ 'has',
130
+ 'hastype',
131
+ 'hfarray',
132
+ 'icontent',
133
+ 'igcd',
134
+ 'ilcm',
135
+ 'ilog10',
136
+ 'Im',
137
+ 'implies',
138
+ 'indets',
139
+ 'indices',
140
+ 'intersect',
141
+ 'iolib',
142
+ 'iquo',
143
+ 'irem',
144
+ 'iroot',
145
+ 'iroot',
146
+ 'isqrt',
147
+ 'kernelopts',
148
+ 'lcoeff',
149
+ 'ldegree',
150
+ 'length',
151
+ 'lexorder',
152
+ 'lhs',
153
+ 'lowerbound',
154
+ 'lprint',
155
+ 'macro',
156
+ 'map',
157
+ 'max',
158
+ 'maxnorm',
159
+ 'member',
160
+ 'membertype',
161
+ 'min',
162
+ 'minus',
163
+ 'mod',
164
+ 'modp',
165
+ 'modp1',
166
+ 'modp2',
167
+ 'mods',
168
+ 'mul',
169
+ 'NextAfter',
170
+ 'nops',
171
+ 'normal',
172
+ 'not',
173
+ 'numboccur',
174
+ 'numelems',
175
+ 'numer',
176
+ 'NumericClass',
177
+ 'NumericEvent',
178
+ 'NumericEventHandler',
179
+ 'NumericStatus',
180
+ 'op',
181
+ 'or',
182
+ 'order',
183
+ 'OrderedNE',
184
+ 'ormap',
185
+ 'orseq',
186
+ 'parse',
187
+ 'piecewise',
188
+ 'pointto',
189
+ 'print',
190
+ 'quit',
191
+ 'Re',
192
+ 'readlib',
193
+ 'Record',
194
+ 'remove',
195
+ 'rhs',
196
+ 'round',
197
+ 'rtable',
198
+ 'rtable_elems',
199
+ 'rtable_eval',
200
+ 'rtable_indfns',
201
+ 'rtable_num_elems',
202
+ 'rtable_options',
203
+ 'rtable_redim',
204
+ 'rtable_scanblock',
205
+ 'rtable_set_indfn',
206
+ 'rtable_split_unit',
207
+ 'savelib',
208
+ 'Scale10',
209
+ 'Scale2',
210
+ 'SDMPolynom',
211
+ 'searchtext',
212
+ 'SearchText',
213
+ 'select',
214
+ 'selectremove',
215
+ 'seq',
216
+ 'series',
217
+ 'setattribute',
218
+ 'SFloatExponent',
219
+ 'SFloatMantissa',
220
+ 'sign',
221
+ 'sort',
222
+ 'ssystem',
223
+ 'stop',
224
+ 'String',
225
+ 'subs',
226
+ 'subset',
227
+ 'subsindets',
228
+ 'subsop',
229
+ 'substring',
230
+ 'system',
231
+ 'table',
232
+ 'taylor',
233
+ 'tcoeff',
234
+ 'time',
235
+ 'timelimit',
236
+ 'ToInert',
237
+ 'traperror',
238
+ 'trunc',
239
+ 'type',
240
+ 'typematch',
241
+ 'unames',
242
+ 'unassign',
243
+ 'union',
244
+ 'Unordered',
245
+ 'upperbound',
246
+ 'userinfo',
247
+ 'writeto',
248
+ 'xor',
249
+ 'xormap',
250
+ 'xorseq')
251
+
252
+ def delayed_callback(self, match, ctx):
253
+ yield match.start(1), Punctuation, match.group(1) # quote
254
+
255
+ ctx.pos = match.start(2)
256
+ orig_end = ctx.end
257
+ ctx.end = match.end(2)
258
+
259
+ yield from self.get_tokens_unprocessed(context=ctx)
260
+ yield match.end(2), Punctuation, match.group(1) # quote
261
+
262
+ ctx.pos = match.end()
263
+ ctx.end = orig_end
264
+
265
+ tokens = {
266
+ 'root': [
267
+ (r'#.*\n', Comment.Single),
268
+ (r'\(\*', Comment.Multiline, 'comment'),
269
+ (r'"(\\.|.|\s)*?"', String),
270
+ (r"('+)((.|\n)*?)\1", delayed_callback),
271
+ (r'`(\\`|.)*?`', Name),
272
+ (words(keywords, prefix=r'\b', suffix=r'\b'), Keyword),
273
+ (words(builtins, prefix=r'\b', suffix=r'\b'), Name.Builtin),
274
+ (r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
275
+ (r'(:=|\*\*|@@|<=|>=|<>|->|::|\.\.|&\+|[\+\-\*\.\^\$/@&,:=<>%~])', Operator),
276
+ (r'[;^!@$\(\)\[\]{}|_\\#?]+', Punctuation),
277
+ (r'(\d+)(\.\.)', bygroups(Number.Integer, Punctuation)),
278
+ (r'(\d*\.\d+|\d+\.\d*)([eE][+-]?\d+)?', Number.Float),
279
+ (r'\d+', Number.Integer),
280
+ (r'\s+', Whitespace),
281
+ ],
282
+ 'comment': [
283
+ (r'.*\(\*', Comment.Multiline, '#push'),
284
+ (r'.*\*\)', Comment.Multiline, '#pop'),
285
+ (r'.*\n', Comment.Multiline),
286
+ ]
287
+ }
288
+
289
+ def analyse_text(text):
290
+ if ':=' in text:
291
+ return 0.1
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/markup.py ADDED
@@ -0,0 +1,1659 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.markup
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for non-HTML markup languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexers.html import XmlLexer
14
+ from pygments.lexers.javascript import JavascriptLexer
15
+ from pygments.lexers.css import CssLexer
16
+ from pygments.lexers.lilypond import LilyPondLexer
17
+ from pygments.lexers.data import JsonLexer
18
+
19
+ from pygments.lexer import RegexLexer, DelegatingLexer, include, bygroups, \
20
+ using, this, do_insertions, default, words
21
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
22
+ Number, Punctuation, Generic, Other, Whitespace, Literal
23
+ from pygments.util import get_bool_opt, ClassNotFound
24
+
25
+ __all__ = ['BBCodeLexer', 'MoinWikiLexer', 'RstLexer', 'TexLexer', 'GroffLexer',
26
+ 'MozPreprocHashLexer', 'MozPreprocPercentLexer',
27
+ 'MozPreprocXulLexer', 'MozPreprocJavascriptLexer',
28
+ 'MozPreprocCssLexer', 'MarkdownLexer', 'OrgLexer', 'TiddlyWiki5Lexer',
29
+ 'WikitextLexer']
30
+
31
+
32
+ class BBCodeLexer(RegexLexer):
33
+ """
34
+ A lexer that highlights BBCode(-like) syntax.
35
+ """
36
+
37
+ name = 'BBCode'
38
+ aliases = ['bbcode']
39
+ mimetypes = ['text/x-bbcode']
40
+ url = 'https://www.bbcode.org/'
41
+ version_added = '0.6'
42
+
43
+ tokens = {
44
+ 'root': [
45
+ (r'[^[]+', Text),
46
+ # tag/end tag begin
47
+ (r'\[/?\w+', Keyword, 'tag'),
48
+ # stray bracket
49
+ (r'\[', Text),
50
+ ],
51
+ 'tag': [
52
+ (r'\s+', Text),
53
+ # attribute with value
54
+ (r'(\w+)(=)("?[^\s"\]]+"?)',
55
+ bygroups(Name.Attribute, Operator, String)),
56
+ # tag argument (a la [color=green])
57
+ (r'(=)("?[^\s"\]]+"?)',
58
+ bygroups(Operator, String)),
59
+ # tag end
60
+ (r'\]', Keyword, '#pop'),
61
+ ],
62
+ }
63
+
64
+
65
+ class MoinWikiLexer(RegexLexer):
66
+ """
67
+ For MoinMoin (and Trac) Wiki markup.
68
+ """
69
+
70
+ name = 'MoinMoin/Trac Wiki markup'
71
+ aliases = ['trac-wiki', 'moin']
72
+ filenames = []
73
+ mimetypes = ['text/x-trac-wiki']
74
+ url = 'https://moinmo.in'
75
+ version_added = '0.7'
76
+
77
+ flags = re.MULTILINE | re.IGNORECASE
78
+
79
+ tokens = {
80
+ 'root': [
81
+ (r'^#.*$', Comment),
82
+ (r'(!)(\S+)', bygroups(Keyword, Text)), # Ignore-next
83
+ # Titles
84
+ (r'^(=+)([^=]+)(=+)(\s*#.+)?$',
85
+ bygroups(Generic.Heading, using(this), Generic.Heading, String)),
86
+ # Literal code blocks, with optional shebang
87
+ (r'(\{\{\{)(\n#!.+)?', bygroups(Name.Builtin, Name.Namespace), 'codeblock'),
88
+ (r'(\'\'\'?|\|\||`|__|~~|\^|,,|::)', Comment), # Formatting
89
+ # Lists
90
+ (r'^( +)([.*-])( )', bygroups(Text, Name.Builtin, Text)),
91
+ (r'^( +)([a-z]{1,5}\.)( )', bygroups(Text, Name.Builtin, Text)),
92
+ # Other Formatting
93
+ (r'\[\[\w+.*?\]\]', Keyword), # Macro
94
+ (r'(\[[^\s\]]+)(\s+[^\]]+?)?(\])',
95
+ bygroups(Keyword, String, Keyword)), # Link
96
+ (r'^----+$', Keyword), # Horizontal rules
97
+ (r'[^\n\'\[{!_~^,|]+', Text),
98
+ (r'\n', Text),
99
+ (r'.', Text),
100
+ ],
101
+ 'codeblock': [
102
+ (r'\}\}\}', Name.Builtin, '#pop'),
103
+ # these blocks are allowed to be nested in Trac, but not MoinMoin
104
+ (r'\{\{\{', Text, '#push'),
105
+ (r'[^{}]+', Comment.Preproc), # slurp boring text
106
+ (r'.', Comment.Preproc), # allow loose { or }
107
+ ],
108
+ }
109
+
110
+
111
+ class RstLexer(RegexLexer):
112
+ """
113
+ For reStructuredText markup.
114
+
115
+ Additional options accepted:
116
+
117
+ `handlecodeblocks`
118
+ Highlight the contents of ``.. sourcecode:: language``,
119
+ ``.. code:: language`` and ``.. code-block:: language``
120
+ directives with a lexer for the given language (default:
121
+ ``True``).
122
+
123
+ .. versionadded:: 0.8
124
+ """
125
+ name = 'reStructuredText'
126
+ url = 'https://docutils.sourceforge.io/rst.html'
127
+ aliases = ['restructuredtext', 'rst', 'rest']
128
+ filenames = ['*.rst', '*.rest']
129
+ mimetypes = ["text/x-rst", "text/prs.fallenstein.rst"]
130
+ version_added = '0.7'
131
+ flags = re.MULTILINE
132
+
133
+ def _handle_sourcecode(self, match):
134
+ from pygments.lexers import get_lexer_by_name
135
+
136
+ # section header
137
+ yield match.start(1), Punctuation, match.group(1)
138
+ yield match.start(2), Text, match.group(2)
139
+ yield match.start(3), Operator.Word, match.group(3)
140
+ yield match.start(4), Punctuation, match.group(4)
141
+ yield match.start(5), Text, match.group(5)
142
+ yield match.start(6), Keyword, match.group(6)
143
+ yield match.start(7), Text, match.group(7)
144
+
145
+ # lookup lexer if wanted and existing
146
+ lexer = None
147
+ if self.handlecodeblocks:
148
+ try:
149
+ lexer = get_lexer_by_name(match.group(6).strip())
150
+ except ClassNotFound:
151
+ pass
152
+ indention = match.group(8)
153
+ indention_size = len(indention)
154
+ code = (indention + match.group(9) + match.group(10) + match.group(11))
155
+
156
+ # no lexer for this language. handle it like it was a code block
157
+ if lexer is None:
158
+ yield match.start(8), String, code
159
+ return
160
+
161
+ # highlight the lines with the lexer.
162
+ ins = []
163
+ codelines = code.splitlines(True)
164
+ code = ''
165
+ for line in codelines:
166
+ if len(line) > indention_size:
167
+ ins.append((len(code), [(0, Text, line[:indention_size])]))
168
+ code += line[indention_size:]
169
+ else:
170
+ code += line
171
+ yield from do_insertions(ins, lexer.get_tokens_unprocessed(code))
172
+
173
+ # from docutils.parsers.rst.states
174
+ closers = '\'")]}>\u2019\u201d\xbb!?'
175
+ unicode_delimiters = '\u2010\u2011\u2012\u2013\u2014\u00a0'
176
+ end_string_suffix = (rf'((?=$)|(?=[-/:.,; \n\x00{re.escape(unicode_delimiters)}{re.escape(closers)}]))')
177
+
178
+ tokens = {
179
+ 'root': [
180
+ # Heading with overline
181
+ (r'^(=+|-+|`+|:+|\.+|\'+|"+|~+|\^+|_+|\*+|\++|#+)([ \t]*\n)'
182
+ r'(.+)(\n)(\1)(\n)',
183
+ bygroups(Generic.Heading, Text, Generic.Heading,
184
+ Text, Generic.Heading, Text)),
185
+ # Plain heading
186
+ (r'^(\S.*)(\n)(={3,}|-{3,}|`{3,}|:{3,}|\.{3,}|\'{3,}|"{3,}|'
187
+ r'~{3,}|\^{3,}|_{3,}|\*{3,}|\+{3,}|#{3,})(\n)',
188
+ bygroups(Generic.Heading, Text, Generic.Heading, Text)),
189
+ # Bulleted lists
190
+ (r'^(\s*)([-*+])( .+\n(?:\1 .+\n)*)',
191
+ bygroups(Text, Number, using(this, state='inline'))),
192
+ # Numbered lists
193
+ (r'^(\s*)([0-9#ivxlcmIVXLCM]+\.)( .+\n(?:\1 .+\n)*)',
194
+ bygroups(Text, Number, using(this, state='inline'))),
195
+ (r'^(\s*)(\(?[0-9#ivxlcmIVXLCM]+\))( .+\n(?:\1 .+\n)*)',
196
+ bygroups(Text, Number, using(this, state='inline'))),
197
+ # Numbered, but keep words at BOL from becoming lists
198
+ (r'^(\s*)([A-Z]+\.)( .+\n(?:\1 .+\n)+)',
199
+ bygroups(Text, Number, using(this, state='inline'))),
200
+ (r'^(\s*)(\(?[A-Za-z]+\))( .+\n(?:\1 .+\n)+)',
201
+ bygroups(Text, Number, using(this, state='inline'))),
202
+ # Line blocks
203
+ (r'^(\s*)(\|)( .+\n(?:\| .+\n)*)',
204
+ bygroups(Text, Operator, using(this, state='inline'))),
205
+ # Sourcecode directives
206
+ (r'^( *\.\.)(\s*)((?:source)?code(?:-block)?)(::)([ \t]*)([^\n]+)'
207
+ r'(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\8.*)?\n)+)',
208
+ _handle_sourcecode),
209
+ # A directive
210
+ (r'^( *\.\.)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))',
211
+ bygroups(Punctuation, Text, Operator.Word, Punctuation, Text,
212
+ using(this, state='inline'))),
213
+ # A reference target
214
+ (r'^( *\.\.)(\s*)(_(?:[^:\\]|\\.)+:)(.*?)$',
215
+ bygroups(Punctuation, Text, Name.Tag, using(this, state='inline'))),
216
+ # A footnote/citation target
217
+ (r'^( *\.\.)(\s*)(\[.+\])(.*?)$',
218
+ bygroups(Punctuation, Text, Name.Tag, using(this, state='inline'))),
219
+ # A substitution def
220
+ (r'^( *\.\.)(\s*)(\|.+\|)(\s*)([\w:-]+?)(::)(?:([ \t]*)(.*))',
221
+ bygroups(Punctuation, Text, Name.Tag, Text, Operator.Word,
222
+ Punctuation, Text, using(this, state='inline'))),
223
+ # Comments
224
+ (r'^ *\.\..*(\n( +.*\n|\n)+)?', Comment),
225
+ # Field list marker
226
+ (r'^( *)(:(?:\\\\|\\:|[^:\n])+:(?=\s))([ \t]*)',
227
+ bygroups(Text, Name.Class, Text)),
228
+ # Definition list
229
+ (r'^(\S.*(?<!::)\n)((?:(?: +.*)\n)+)',
230
+ bygroups(using(this, state='inline'), using(this, state='inline'))),
231
+ # Code blocks
232
+ (r'(::)(\n[ \t]*\n)([ \t]+)(.*)(\n)((?:(?:\3.*)?\n)+)',
233
+ bygroups(String.Escape, Text, String, String, Text, String)),
234
+ include('inline'),
235
+ ],
236
+ 'inline': [
237
+ (r'\\.', Text), # escape
238
+ (r'``', String, 'literal'), # code
239
+ (r'(`.+?)(<.+?>)(`__?)', # reference with inline target
240
+ bygroups(String, String.Interpol, String)),
241
+ (r'`.+?`__?', String), # reference
242
+ (r'(`.+?`)(:[a-zA-Z0-9:-]+?:)?',
243
+ bygroups(Name.Variable, Name.Attribute)), # role
244
+ (r'(:[a-zA-Z0-9:-]+?:)(`.+?`)',
245
+ bygroups(Name.Attribute, Name.Variable)), # role (content first)
246
+ (r'\*\*.+?\*\*', Generic.Strong), # Strong emphasis
247
+ (r'\*.+?\*', Generic.Emph), # Emphasis
248
+ (r'\[.*?\]_', String), # Footnote or citation
249
+ (r'<.+?>', Name.Tag), # Hyperlink
250
+ (r'[^\\\n\[*`:]+', Text),
251
+ (r'.', Text),
252
+ ],
253
+ 'literal': [
254
+ (r'[^`]+', String),
255
+ (r'``' + end_string_suffix, String, '#pop'),
256
+ (r'`', String),
257
+ ]
258
+ }
259
+
260
+ def __init__(self, **options):
261
+ self.handlecodeblocks = get_bool_opt(options, 'handlecodeblocks', True)
262
+ RegexLexer.__init__(self, **options)
263
+
264
+ def analyse_text(text):
265
+ if text[:2] == '..' and text[2:3] != '.':
266
+ return 0.3
267
+ p1 = text.find("\n")
268
+ p2 = text.find("\n", p1 + 1)
269
+ if (p2 > -1 and # has two lines
270
+ p1 * 2 + 1 == p2 and # they are the same length
271
+ text[p1+1] in '-=' and # the next line both starts and ends with
272
+ text[p1+1] == text[p2-1]): # ...a sufficiently high header
273
+ return 0.5
274
+
275
+
276
+ class TexLexer(RegexLexer):
277
+ """
278
+ Lexer for the TeX and LaTeX typesetting languages.
279
+ """
280
+
281
+ name = 'TeX'
282
+ aliases = ['tex', 'latex']
283
+ filenames = ['*.tex', '*.aux', '*.toc']
284
+ mimetypes = ['text/x-tex', 'text/x-latex']
285
+ url = 'https://tug.org'
286
+ version_added = ''
287
+
288
+ tokens = {
289
+ 'general': [
290
+ (r'%.*?\n', Comment),
291
+ (r'[{}]', Name.Builtin),
292
+ (r'[&_^]', Name.Builtin),
293
+ ],
294
+ 'root': [
295
+ (r'\\\[', String.Backtick, 'displaymath'),
296
+ (r'\\\(', String, 'inlinemath'),
297
+ (r'\$\$', String.Backtick, 'displaymath'),
298
+ (r'\$', String, 'inlinemath'),
299
+ (r'\\([a-zA-Z@_:]+|\S?)', Keyword, 'command'),
300
+ (r'\\$', Keyword),
301
+ include('general'),
302
+ (r'[^\\$%&_^{}]+', Text),
303
+ ],
304
+ 'math': [
305
+ (r'\\([a-zA-Z]+|\S?)', Name.Variable),
306
+ include('general'),
307
+ (r'[0-9]+', Number),
308
+ (r'[-=!+*/()\[\]]', Operator),
309
+ (r'[^=!+*/()\[\]\\$%&_^{}0-9-]+', Name.Builtin),
310
+ ],
311
+ 'inlinemath': [
312
+ (r'\\\)', String, '#pop'),
313
+ (r'\$', String, '#pop'),
314
+ include('math'),
315
+ ],
316
+ 'displaymath': [
317
+ (r'\\\]', String, '#pop'),
318
+ (r'\$\$', String, '#pop'),
319
+ (r'\$', Name.Builtin),
320
+ include('math'),
321
+ ],
322
+ 'command': [
323
+ (r'\[.*?\]', Name.Attribute),
324
+ (r'\*', Keyword),
325
+ default('#pop'),
326
+ ],
327
+ }
328
+
329
+ def analyse_text(text):
330
+ for start in ("\\documentclass", "\\input", "\\documentstyle",
331
+ "\\relax"):
332
+ if text[:len(start)] == start:
333
+ return True
334
+
335
+
336
+ class GroffLexer(RegexLexer):
337
+ """
338
+ Lexer for the (g)roff typesetting language, supporting groff
339
+ extensions. Mainly useful for highlighting manpage sources.
340
+ """
341
+
342
+ name = 'Groff'
343
+ aliases = ['groff', 'nroff', 'man']
344
+ filenames = ['*.[1-9]', '*.man', '*.1p', '*.3pm']
345
+ mimetypes = ['application/x-troff', 'text/troff']
346
+ url = 'https://www.gnu.org/software/groff'
347
+ version_added = '0.6'
348
+
349
+ tokens = {
350
+ 'root': [
351
+ (r'(\.)(\w+)', bygroups(Text, Keyword), 'request'),
352
+ (r'\.', Punctuation, 'request'),
353
+ # Regular characters, slurp till we find a backslash or newline
354
+ (r'[^\\\n]+', Text, 'textline'),
355
+ default('textline'),
356
+ ],
357
+ 'textline': [
358
+ include('escapes'),
359
+ (r'[^\\\n]+', Text),
360
+ (r'\n', Text, '#pop'),
361
+ ],
362
+ 'escapes': [
363
+ # groff has many ways to write escapes.
364
+ (r'\\"[^\n]*', Comment),
365
+ (r'\\[fn]\w', String.Escape),
366
+ (r'\\\(.{2}', String.Escape),
367
+ (r'\\.\[.*\]', String.Escape),
368
+ (r'\\.', String.Escape),
369
+ (r'\\\n', Text, 'request'),
370
+ ],
371
+ 'request': [
372
+ (r'\n', Text, '#pop'),
373
+ include('escapes'),
374
+ (r'"[^\n"]+"', String.Double),
375
+ (r'\d+', Number),
376
+ (r'\S+', String),
377
+ (r'\s+', Text),
378
+ ],
379
+ }
380
+
381
+ def analyse_text(text):
382
+ if text[:1] != '.':
383
+ return False
384
+ if text[:3] == '.\\"':
385
+ return True
386
+ if text[:4] == '.TH ':
387
+ return True
388
+ if text[1:3].isalnum() and text[3].isspace():
389
+ return 0.9
390
+
391
+
392
+ class MozPreprocHashLexer(RegexLexer):
393
+ """
394
+ Lexer for Mozilla Preprocessor files (with '#' as the marker).
395
+
396
+ Other data is left untouched.
397
+ """
398
+ name = 'mozhashpreproc'
399
+ aliases = [name]
400
+ filenames = []
401
+ mimetypes = []
402
+ url = 'https://firefox-source-docs.mozilla.org/build/buildsystem/preprocessor.html'
403
+ version_added = '2.0'
404
+
405
+ tokens = {
406
+ 'root': [
407
+ (r'^#', Comment.Preproc, ('expr', 'exprstart')),
408
+ (r'.+', Other),
409
+ ],
410
+ 'exprstart': [
411
+ (r'(literal)(.*)', bygroups(Comment.Preproc, Text), '#pop:2'),
412
+ (words((
413
+ 'define', 'undef', 'if', 'ifdef', 'ifndef', 'else', 'elif',
414
+ 'elifdef', 'elifndef', 'endif', 'expand', 'filter', 'unfilter',
415
+ 'include', 'includesubst', 'error')),
416
+ Comment.Preproc, '#pop'),
417
+ ],
418
+ 'expr': [
419
+ (words(('!', '!=', '==', '&&', '||')), Operator),
420
+ (r'(defined)(\()', bygroups(Keyword, Punctuation)),
421
+ (r'\)', Punctuation),
422
+ (r'[0-9]+', Number.Decimal),
423
+ (r'__\w+?__', Name.Variable),
424
+ (r'@\w+?@', Name.Class),
425
+ (r'\w+', Name),
426
+ (r'\n', Text, '#pop'),
427
+ (r'\s+', Text),
428
+ (r'\S', Punctuation),
429
+ ],
430
+ }
431
+
432
+
433
+ class MozPreprocPercentLexer(MozPreprocHashLexer):
434
+ """
435
+ Lexer for Mozilla Preprocessor files (with '%' as the marker).
436
+
437
+ Other data is left untouched.
438
+ """
439
+ name = 'mozpercentpreproc'
440
+ aliases = [name]
441
+ filenames = []
442
+ mimetypes = []
443
+ url = 'https://firefox-source-docs.mozilla.org/build/buildsystem/preprocessor.html'
444
+ version_added = '2.0'
445
+
446
+ tokens = {
447
+ 'root': [
448
+ (r'^%', Comment.Preproc, ('expr', 'exprstart')),
449
+ (r'.+', Other),
450
+ ],
451
+ }
452
+
453
+
454
+ class MozPreprocXulLexer(DelegatingLexer):
455
+ """
456
+ Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
457
+ `XmlLexer`.
458
+ """
459
+ name = "XUL+mozpreproc"
460
+ aliases = ['xul+mozpreproc']
461
+ filenames = ['*.xul.in']
462
+ mimetypes = []
463
+ url = 'https://firefox-source-docs.mozilla.org/build/buildsystem/preprocessor.html'
464
+ version_added = '2.0'
465
+
466
+ def __init__(self, **options):
467
+ super().__init__(XmlLexer, MozPreprocHashLexer, **options)
468
+
469
+
470
+ class MozPreprocJavascriptLexer(DelegatingLexer):
471
+ """
472
+ Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
473
+ `JavascriptLexer`.
474
+ """
475
+ name = "Javascript+mozpreproc"
476
+ aliases = ['javascript+mozpreproc']
477
+ filenames = ['*.js.in']
478
+ mimetypes = []
479
+ url = 'https://firefox-source-docs.mozilla.org/build/buildsystem/preprocessor.html'
480
+ version_added = '2.0'
481
+
482
+ def __init__(self, **options):
483
+ super().__init__(JavascriptLexer, MozPreprocHashLexer, **options)
484
+
485
+
486
+ class MozPreprocCssLexer(DelegatingLexer):
487
+ """
488
+ Subclass of the `MozPreprocHashLexer` that highlights unlexed data with the
489
+ `CssLexer`.
490
+ """
491
+ name = "CSS+mozpreproc"
492
+ aliases = ['css+mozpreproc']
493
+ filenames = ['*.css.in']
494
+ mimetypes = []
495
+ url = 'https://firefox-source-docs.mozilla.org/build/buildsystem/preprocessor.html'
496
+ version_added = '2.0'
497
+
498
+ def __init__(self, **options):
499
+ super().__init__(CssLexer, MozPreprocPercentLexer, **options)
500
+
501
+
502
+ class MarkdownLexer(RegexLexer):
503
+ """
504
+ For Markdown markup.
505
+ """
506
+ name = 'Markdown'
507
+ url = 'https://daringfireball.net/projects/markdown/'
508
+ aliases = ['markdown', 'md']
509
+ filenames = ['*.md', '*.markdown']
510
+ mimetypes = ["text/x-markdown"]
511
+ version_added = '2.2'
512
+ flags = re.MULTILINE
513
+
514
+ def _handle_codeblock(self, match):
515
+ from pygments.lexers import get_lexer_by_name
516
+
517
+ yield match.start('initial'), String.Backtick, match.group('initial')
518
+ yield match.start('lang'), String.Backtick, match.group('lang')
519
+ if match.group('afterlang') is not None:
520
+ yield match.start('whitespace'), Whitespace, match.group('whitespace')
521
+ yield match.start('extra'), Text, match.group('extra')
522
+ yield match.start('newline'), Whitespace, match.group('newline')
523
+
524
+ # lookup lexer if wanted and existing
525
+ lexer = None
526
+ if self.handlecodeblocks:
527
+ try:
528
+ lexer = get_lexer_by_name(match.group('lang').strip())
529
+ except ClassNotFound:
530
+ pass
531
+ code = match.group('code')
532
+ # no lexer for this language. handle it like it was a code block
533
+ if lexer is None:
534
+ yield match.start('code'), String, code
535
+ else:
536
+ # FIXME: aren't the offsets wrong?
537
+ yield from do_insertions([], lexer.get_tokens_unprocessed(code))
538
+
539
+ yield match.start('terminator'), String.Backtick, match.group('terminator')
540
+
541
+ tokens = {
542
+ 'root': [
543
+ # heading with '#' prefix (atx-style)
544
+ (r'(^#[^#].+)(\n)', bygroups(Generic.Heading, Text)),
545
+ # subheading with '#' prefix (atx-style)
546
+ (r'(^#{2,6}[^#].+)(\n)', bygroups(Generic.Subheading, Text)),
547
+ # heading with '=' underlines (Setext-style)
548
+ (r'^(.+)(\n)(=+)(\n)', bygroups(Generic.Heading, Text, Generic.Heading, Text)),
549
+ # subheading with '-' underlines (Setext-style)
550
+ (r'^(.+)(\n)(-+)(\n)', bygroups(Generic.Subheading, Text, Generic.Subheading, Text)),
551
+ # task list
552
+ (r'^(\s*)([*-] )(\[[ xX]\])( .+\n)',
553
+ bygroups(Whitespace, Keyword, Keyword, using(this, state='inline'))),
554
+ # bulleted list
555
+ (r'^(\s*)([*-])(\s)(.+\n)',
556
+ bygroups(Whitespace, Keyword, Whitespace, using(this, state='inline'))),
557
+ # numbered list
558
+ (r'^(\s*)([0-9]+\.)( .+\n)',
559
+ bygroups(Whitespace, Keyword, using(this, state='inline'))),
560
+ # quote
561
+ (r'^(\s*>\s)(.+\n)', bygroups(Keyword, Generic.Emph)),
562
+ # code block fenced by 3 backticks
563
+ (r'^(\s*```\n[\w\W]*?^\s*```$\n)', String.Backtick),
564
+ # code block with language
565
+ # Some tools include extra stuff after the language name, just
566
+ # highlight that as text. For example: https://docs.enola.dev/use/execmd
567
+ (r'''(?x)
568
+ ^(?P<initial>\s*```)
569
+ (?P<lang>[\w\-]+)
570
+ (?P<afterlang>
571
+ (?P<whitespace>[^\S\n]+)
572
+ (?P<extra>.*))?
573
+ (?P<newline>\n)
574
+ (?P<code>(.|\n)*?)
575
+ (?P<terminator>^\s*```$\n)
576
+ ''',
577
+ _handle_codeblock),
578
+
579
+ include('inline'),
580
+ ],
581
+ 'inline': [
582
+ # escape
583
+ (r'\\.', Text),
584
+ # inline code
585
+ (r'([^`]?)(`[^`\n]+`)', bygroups(Text, String.Backtick)),
586
+ # warning: the following rules eat outer tags.
587
+ # eg. **foo _bar_ baz** => foo and baz are not recognized as bold
588
+ # bold fenced by '**'
589
+ (r'([^\*]?)(\*\*[^* \n][^*\n]*\*\*)', bygroups(Text, Generic.Strong)),
590
+ # bold fenced by '__'
591
+ (r'([^_]?)(__[^_ \n][^_\n]*__)', bygroups(Text, Generic.Strong)),
592
+ # italics fenced by '*'
593
+ (r'([^\*]?)(\*[^* \n][^*\n]*\*)', bygroups(Text, Generic.Emph)),
594
+ # italics fenced by '_'
595
+ (r'([^_]?)(_[^_ \n][^_\n]*_)', bygroups(Text, Generic.Emph)),
596
+ # strikethrough
597
+ (r'([^~]?)(~~[^~ \n][^~\n]*~~)', bygroups(Text, Generic.Deleted)),
598
+ # mentions and topics (twitter and github stuff)
599
+ (r'[@#][\w/:]+', Name.Entity),
600
+ # (image?) links eg: ![Image of Yaktocat](https://octodex.github.com/images/yaktocat.png)
601
+ (r'(!?\[)([^]]+)(\])(\()([^)]+)(\))',
602
+ bygroups(Text, Name.Tag, Text, Text, Name.Attribute, Text)),
603
+ # reference-style links, e.g.:
604
+ # [an example][id]
605
+ # [id]: http://example.com/
606
+ (r'(\[)([^]]+)(\])(\[)([^]]*)(\])',
607
+ bygroups(Text, Name.Tag, Text, Text, Name.Label, Text)),
608
+ (r'^(\s*\[)([^]]*)(\]:\s*)(.+)',
609
+ bygroups(Text, Name.Label, Text, Name.Attribute)),
610
+
611
+ # general text, must come last!
612
+ (r'[^\\\s]+', Text),
613
+ (r'.', Text),
614
+ ],
615
+ }
616
+
617
+ def __init__(self, **options):
618
+ self.handlecodeblocks = get_bool_opt(options, 'handlecodeblocks', True)
619
+ RegexLexer.__init__(self, **options)
620
+
621
+ class OrgLexer(RegexLexer):
622
+ """
623
+ For Org Mode markup.
624
+ """
625
+ name = 'Org Mode'
626
+ url = 'https://orgmode.org'
627
+ aliases = ['org', 'orgmode', 'org-mode']
628
+ filenames = ['*.org']
629
+ mimetypes = ["text/org"]
630
+ version_added = '2.18'
631
+
632
+ def _inline(start, end):
633
+ return rf'(?<!\w){start}(.|\n(?!\n))+?{end}(?!\w)'
634
+
635
+ tokens = {
636
+ 'root': [
637
+ (r'^# .*', Comment.Single),
638
+
639
+ # Headings
640
+ (r'^(\* )(COMMENT)( .*)',
641
+ bygroups(Generic.Heading, Comment.Preproc, Generic.Heading)),
642
+ (r'^(\*\*+ )(COMMENT)( .*)',
643
+ bygroups(Generic.Subheading, Comment.Preproc, Generic.Subheading)),
644
+ (r'^(\* )(DONE)( .*)',
645
+ bygroups(Generic.Heading, Generic.Deleted, Generic.Heading)),
646
+ (r'^(\*\*+ )(DONE)( .*)',
647
+ bygroups(Generic.Subheading, Generic.Deleted, Generic.Subheading)),
648
+ (r'^(\* )(TODO)( .*)',
649
+ bygroups(Generic.Heading, Generic.Error, Generic.Heading)),
650
+ (r'^(\*\*+ )(TODO)( .*)',
651
+ bygroups(Generic.Subheading, Generic.Error, Generic.Subheading)),
652
+
653
+ (r'^(\* .+?)( :[a-zA-Z0-9_@:]+:)?$', bygroups(Generic.Heading, Generic.Emph)),
654
+ (r'^(\*\*+ .+?)( :[a-zA-Z0-9_@:]+:)?$', bygroups(Generic.Subheading, Generic.Emph)),
655
+
656
+ # Unordered lists items, including TODO items and description items
657
+ (r'^(?:( *)([+-] )|( +)(\* ))(\[[ X-]\])?(.+ ::)?',
658
+ bygroups(Whitespace, Keyword, Whitespace, Keyword, Generic.Prompt, Name.Label)),
659
+
660
+ # Ordered list items
661
+ (r'^( *)([0-9]+[.)])( \[@[0-9]+\])?', bygroups(Whitespace, Keyword, Generic.Emph)),
662
+
663
+ # Dynamic blocks
664
+ (r'(?i)^( *#\+begin: *)((?:.|\n)*?)(^ *#\+end: *$)',
665
+ bygroups(Operator.Word, using(this), Operator.Word)),
666
+
667
+ # Comment blocks
668
+ (r'(?i)^( *#\+begin_comment *\n)((?:.|\n)*?)(^ *#\+end_comment *$)',
669
+ bygroups(Operator.Word, Comment.Multiline, Operator.Word)),
670
+
671
+ # Source code blocks
672
+ # TODO: language-dependent syntax highlighting (see Markdown lexer)
673
+ (r'(?i)^( *#\+begin_src .*)((?:.|\n)*?)(^ *#\+end_src *$)',
674
+ bygroups(Operator.Word, Text, Operator.Word)),
675
+
676
+ # Other blocks
677
+ (r'(?i)^( *#\+begin_\w+)( *\n)((?:.|\n)*?)(^ *#\+end_\w+)( *$)',
678
+ bygroups(Operator.Word, Whitespace, Text, Operator.Word, Whitespace)),
679
+
680
+ # Keywords
681
+ (r'^(#\+\w+:)(.*)$', bygroups(Name.Namespace, Text)),
682
+
683
+ # Properties and drawers
684
+ (r'(?i)^( *:\w+: *\n)((?:.|\n)*?)(^ *:end: *$)',
685
+ bygroups(Name.Decorator, Comment.Special, Name.Decorator)),
686
+
687
+ # Line break operator
688
+ (r'\\\\$', Operator),
689
+
690
+ (r'^\s*CLOSED:\s+', Generic.Deleted, 'dateline'),
691
+ (r'^\s*(?:DEADLINE:|SCHEDULED:)\s+', Generic.Error, 'dateline'),
692
+
693
+ # Bold
694
+ (_inline(r'\*', r'\*+'), Generic.Strong),
695
+ # Italic
696
+ (_inline(r'/', r'/'), Generic.Emph),
697
+ # Verbatim
698
+ (_inline(r'=', r'='), String), # TODO token
699
+ # Code
700
+ (_inline(r'~', r'~'), String),
701
+ # Strikethrough
702
+ (_inline(r'\+', r'\+'), Generic.Deleted),
703
+ # Underline
704
+ (_inline(r'_', r'_+'), Generic.EmphStrong),
705
+
706
+ # Dates
707
+ (r'<.+?>', Literal.Date),
708
+ # Macros
709
+ (r'\{\{\{.+?\}\}\}', Comment.Preproc),
710
+ # Footnotes
711
+ (r'(?<!\[)\[fn:.+?\]', Name.Tag),
712
+ # Links
713
+ (r'(?s)(\[\[)(.*?)(\]\[)(.*?)(\]\])',
714
+ bygroups(Punctuation, Name.Attribute, Punctuation, Name.Tag, Punctuation)),
715
+ (r'(?s)(\[\[)(.+?)(\]\])', bygroups(Punctuation, Name.Attribute, Punctuation)),
716
+ (r'(<<)(.+?)(>>)', bygroups(Punctuation, Name.Attribute, Punctuation)),
717
+
718
+ # Tables
719
+ (r'^( *)(\|[ -].*?[ -]\|)$', bygroups(Whitespace, String)),
720
+
721
+ # Any other text
722
+ (r'[^#*+\-0-9:\\/=~_<{\[|\n]+', Text),
723
+ (r'[#*+\-0-9:\\/=~_<{\[|\n]', Text),
724
+ ],
725
+ 'dateline': [
726
+ (r'\s*CLOSED:\s+', Generic.Deleted),
727
+ (r'\s*(?:DEADLINE:|SCHEDULED:)\s+', Generic.Error),
728
+ (r'\[.+?\]', Literal.Date),
729
+ (r'<[^>]+?>', Literal.Date),
730
+ (r'(\s*)$', Text, '#pop'),
731
+ (r'.', Text),
732
+ ],
733
+ }
734
+
735
+ class TiddlyWiki5Lexer(RegexLexer):
736
+ """
737
+ For TiddlyWiki5 markup.
738
+ """
739
+ name = 'tiddler'
740
+ url = 'https://tiddlywiki.com/#TiddlerFiles'
741
+ aliases = ['tid']
742
+ filenames = ['*.tid']
743
+ mimetypes = ["text/vnd.tiddlywiki"]
744
+ version_added = '2.7'
745
+ flags = re.MULTILINE
746
+
747
+ def _handle_codeblock(self, match):
748
+ """
749
+ match args: 1:backticks, 2:lang_name, 3:newline, 4:code, 5:backticks
750
+ """
751
+ from pygments.lexers import get_lexer_by_name
752
+
753
+ # section header
754
+ yield match.start(1), String, match.group(1)
755
+ yield match.start(2), String, match.group(2)
756
+ yield match.start(3), Text, match.group(3)
757
+
758
+ # lookup lexer if wanted and existing
759
+ lexer = None
760
+ if self.handlecodeblocks:
761
+ try:
762
+ lexer = get_lexer_by_name(match.group(2).strip())
763
+ except ClassNotFound:
764
+ pass
765
+ code = match.group(4)
766
+
767
+ # no lexer for this language. handle it like it was a code block
768
+ if lexer is None:
769
+ yield match.start(4), String, code
770
+ return
771
+
772
+ yield from do_insertions([], lexer.get_tokens_unprocessed(code))
773
+
774
+ yield match.start(5), String, match.group(5)
775
+
776
+ def _handle_cssblock(self, match):
777
+ """
778
+ match args: 1:style tag 2:newline, 3:code, 4:closing style tag
779
+ """
780
+ from pygments.lexers import get_lexer_by_name
781
+
782
+ # section header
783
+ yield match.start(1), String, match.group(1)
784
+ yield match.start(2), String, match.group(2)
785
+
786
+ lexer = None
787
+ if self.handlecodeblocks:
788
+ try:
789
+ lexer = get_lexer_by_name('css')
790
+ except ClassNotFound:
791
+ pass
792
+ code = match.group(3)
793
+
794
+ # no lexer for this language. handle it like it was a code block
795
+ if lexer is None:
796
+ yield match.start(3), String, code
797
+ return
798
+
799
+ yield from do_insertions([], lexer.get_tokens_unprocessed(code))
800
+
801
+ yield match.start(4), String, match.group(4)
802
+
803
+ tokens = {
804
+ 'root': [
805
+ # title in metadata section
806
+ (r'^(title)(:\s)(.+\n)', bygroups(Keyword, Text, Generic.Heading)),
807
+ # headings
808
+ (r'^(!)([^!].+\n)', bygroups(Generic.Heading, Text)),
809
+ (r'^(!{2,6})(.+\n)', bygroups(Generic.Subheading, Text)),
810
+ # bulleted or numbered lists or single-line block quotes
811
+ # (can be mixed)
812
+ (r'^(\s*)([*#>]+)(\s*)(.+\n)',
813
+ bygroups(Text, Keyword, Text, using(this, state='inline'))),
814
+ # multi-line block quotes
815
+ (r'^(<<<.*\n)([\w\W]*?)(^<<<.*$)', bygroups(String, Text, String)),
816
+ # table header
817
+ (r'^(\|.*?\|h)$', bygroups(Generic.Strong)),
818
+ # table footer or caption
819
+ (r'^(\|.*?\|[cf])$', bygroups(Generic.Emph)),
820
+ # table class
821
+ (r'^(\|.*?\|k)$', bygroups(Name.Tag)),
822
+ # definitions
823
+ (r'^(;.*)$', bygroups(Generic.Strong)),
824
+ # text block
825
+ (r'^(```\n)([\w\W]*?)(^```$)', bygroups(String, Text, String)),
826
+ # code block with language
827
+ (r'^(```)(\w+)(\n)([\w\W]*?)(^```$)', _handle_codeblock),
828
+ # CSS style block
829
+ (r'^(<style>)(\n)([\w\W]*?)(^</style>$)', _handle_cssblock),
830
+
831
+ include('keywords'),
832
+ include('inline'),
833
+ ],
834
+ 'keywords': [
835
+ (words((
836
+ '\\define', '\\end', 'caption', 'created', 'modified', 'tags',
837
+ 'title', 'type'), prefix=r'^', suffix=r'\b'),
838
+ Keyword),
839
+ ],
840
+ 'inline': [
841
+ # escape
842
+ (r'\\.', Text),
843
+ # created or modified date
844
+ (r'\d{17}', Number.Integer),
845
+ # italics
846
+ (r'(\s)(//[^/]+//)((?=\W|\n))',
847
+ bygroups(Text, Generic.Emph, Text)),
848
+ # superscript
849
+ (r'(\s)(\^\^[^\^]+\^\^)', bygroups(Text, Generic.Emph)),
850
+ # subscript
851
+ (r'(\s)(,,[^,]+,,)', bygroups(Text, Generic.Emph)),
852
+ # underscore
853
+ (r'(\s)(__[^_]+__)', bygroups(Text, Generic.Strong)),
854
+ # bold
855
+ (r"(\s)(''[^']+'')((?=\W|\n))",
856
+ bygroups(Text, Generic.Strong, Text)),
857
+ # strikethrough
858
+ (r'(\s)(~~[^~]+~~)((?=\W|\n))',
859
+ bygroups(Text, Generic.Deleted, Text)),
860
+ # TiddlyWiki variables
861
+ (r'<<[^>]+>>', Name.Tag),
862
+ (r'\$\$[^$]+\$\$', Name.Tag),
863
+ (r'\$\([^)]+\)\$', Name.Tag),
864
+ # TiddlyWiki style or class
865
+ (r'^@@.*$', Name.Tag),
866
+ # HTML tags
867
+ (r'</?[^>]+>', Name.Tag),
868
+ # inline code
869
+ (r'`[^`]+`', String.Backtick),
870
+ # HTML escaped symbols
871
+ (r'&\S*?;', String.Regex),
872
+ # Wiki links
873
+ (r'(\[{2})([^]\|]+)(\]{2})', bygroups(Text, Name.Tag, Text)),
874
+ # External links
875
+ (r'(\[{2})([^]\|]+)(\|)([^]\|]+)(\]{2})',
876
+ bygroups(Text, Name.Tag, Text, Name.Attribute, Text)),
877
+ # Transclusion
878
+ (r'(\{{2})([^}]+)(\}{2})', bygroups(Text, Name.Tag, Text)),
879
+ # URLs
880
+ (r'(\b.?.?tps?://[^\s"]+)', bygroups(Name.Attribute)),
881
+
882
+ # general text, must come last!
883
+ (r'[\w]+', Text),
884
+ (r'.', Text)
885
+ ],
886
+ }
887
+
888
+ def __init__(self, **options):
889
+ self.handlecodeblocks = get_bool_opt(options, 'handlecodeblocks', True)
890
+ RegexLexer.__init__(self, **options)
891
+
892
+
893
+ class WikitextLexer(RegexLexer):
894
+ """
895
+ For MediaWiki Wikitext.
896
+
897
+ Parsing Wikitext is tricky, and results vary between different MediaWiki
898
+ installations, so we only highlight common syntaxes (built-in or from
899
+ popular extensions), and also assume templates produce no unbalanced
900
+ syntaxes.
901
+ """
902
+ name = 'Wikitext'
903
+ url = 'https://www.mediawiki.org/wiki/Wikitext'
904
+ aliases = ['wikitext', 'mediawiki']
905
+ filenames = []
906
+ mimetypes = ['text/x-wiki']
907
+ version_added = '2.15'
908
+ flags = re.MULTILINE
909
+
910
+ def nowiki_tag_rules(tag_name):
911
+ return [
912
+ (rf'(?i)(</)({tag_name})(\s*)(>)', bygroups(Punctuation,
913
+ Name.Tag, Whitespace, Punctuation), '#pop'),
914
+ include('entity'),
915
+ include('text'),
916
+ ]
917
+
918
+ def plaintext_tag_rules(tag_name):
919
+ return [
920
+ (rf'(?si)(.*?)(</)({tag_name})(\s*)(>)', bygroups(Text,
921
+ Punctuation, Name.Tag, Whitespace, Punctuation), '#pop'),
922
+ ]
923
+
924
+ def delegate_tag_rules(tag_name, lexer, **lexer_kwargs):
925
+ return [
926
+ (rf'(?i)(</)({tag_name})(\s*)(>)', bygroups(Punctuation,
927
+ Name.Tag, Whitespace, Punctuation), '#pop'),
928
+ (rf'(?si).+?(?=</{tag_name}\s*>)', using(lexer, **lexer_kwargs)),
929
+ ]
930
+
931
+ def text_rules(token):
932
+ return [
933
+ (r'\w+', token),
934
+ (r'[^\S\n]+', token),
935
+ (r'(?s).', token),
936
+ ]
937
+
938
+ def handle_syntaxhighlight(self, match, ctx):
939
+ from pygments.lexers import get_lexer_by_name
940
+
941
+ attr_content = match.group()
942
+ start = 0
943
+ index = 0
944
+ while True:
945
+ index = attr_content.find('>', start)
946
+ # Exclude comment end (-->)
947
+ if attr_content[index-2:index] != '--':
948
+ break
949
+ start = index + 1
950
+
951
+ if index == -1:
952
+ # No tag end
953
+ yield from self.get_tokens_unprocessed(attr_content, stack=['root', 'attr'])
954
+ return
955
+ attr = attr_content[:index]
956
+ yield from self.get_tokens_unprocessed(attr, stack=['root', 'attr'])
957
+ yield match.start(3) + index, Punctuation, '>'
958
+
959
+ lexer = None
960
+ content = attr_content[index+1:]
961
+ lang_match = re.findall(r'\blang=("|\'|)(\w+)(\1)', attr)
962
+
963
+ if len(lang_match) >= 1:
964
+ # Pick the last match in case of multiple matches
965
+ lang = lang_match[-1][1]
966
+ try:
967
+ lexer = get_lexer_by_name(lang)
968
+ except ClassNotFound:
969
+ pass
970
+
971
+ if lexer is None:
972
+ yield match.start() + index + 1, Text, content
973
+ else:
974
+ yield from lexer.get_tokens_unprocessed(content)
975
+
976
+ def handle_score(self, match, ctx):
977
+ attr_content = match.group()
978
+ start = 0
979
+ index = 0
980
+ while True:
981
+ index = attr_content.find('>', start)
982
+ # Exclude comment end (-->)
983
+ if attr_content[index-2:index] != '--':
984
+ break
985
+ start = index + 1
986
+
987
+ if index == -1:
988
+ # No tag end
989
+ yield from self.get_tokens_unprocessed(attr_content, stack=['root', 'attr'])
990
+ return
991
+ attr = attr_content[:index]
992
+ content = attr_content[index+1:]
993
+ yield from self.get_tokens_unprocessed(attr, stack=['root', 'attr'])
994
+ yield match.start(3) + index, Punctuation, '>'
995
+
996
+ lang_match = re.findall(r'\blang=("|\'|)(\w+)(\1)', attr)
997
+ # Pick the last match in case of multiple matches
998
+ lang = lang_match[-1][1] if len(lang_match) >= 1 else 'lilypond'
999
+
1000
+ if lang == 'lilypond': # Case sensitive
1001
+ yield from LilyPondLexer().get_tokens_unprocessed(content)
1002
+ else: # ABC
1003
+ # FIXME: Use ABC lexer in the future
1004
+ yield match.start() + index + 1, Text, content
1005
+
1006
+ # a-z removed to prevent linter from complaining, REMEMBER to use (?i)
1007
+ title_char = r' %!"$&\'()*,\-./0-9:;=?@A-Z\\\^_`~+\u0080-\uFFFF'
1008
+ nbsp_char = r'(?:\t|&nbsp;|&\#0*160;|&\#[Xx]0*[Aa]0;|[ \xA0\u1680\u2000-\u200A\u202F\u205F\u3000])'
1009
+ link_address = r'(?:[0-9.]+|\[[0-9a-f:.]+\]|[^\x00-\x20"<>\[\]\x7F\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFFFD])'
1010
+ link_char_class = r'[^\x00-\x20"<>\[\]\x7F\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFFFD]'
1011
+ double_slashes_i = {
1012
+ '__FORCETOC__', '__NOCONTENTCONVERT__', '__NOCC__', '__NOEDITSECTION__', '__NOGALLERY__',
1013
+ '__NOTITLECONVERT__', '__NOTC__', '__NOTOC__', '__TOC__',
1014
+ }
1015
+ double_slashes = {
1016
+ '__EXPECTUNUSEDCATEGORY__', '__HIDDENCAT__', '__INDEX__', '__NEWSECTIONLINK__',
1017
+ '__NOINDEX__', '__NONEWSECTIONLINK__', '__STATICREDIRECT__', '__NOGLOBAL__',
1018
+ '__DISAMBIG__', '__EXPECTED_UNCONNECTED_PAGE__',
1019
+ }
1020
+ protocols = {
1021
+ 'bitcoin:', 'ftp://', 'ftps://', 'geo:', 'git://', 'gopher://', 'http://', 'https://',
1022
+ 'irc://', 'ircs://', 'magnet:', 'mailto:', 'mms://', 'news:', 'nntp://', 'redis://',
1023
+ 'sftp://', 'sip:', 'sips:', 'sms:', 'ssh://', 'svn://', 'tel:', 'telnet://', 'urn:',
1024
+ 'worldwind://', 'xmpp:', '//',
1025
+ }
1026
+ non_relative_protocols = protocols - {'//'}
1027
+ html_tags = {
1028
+ 'abbr', 'b', 'bdi', 'bdo', 'big', 'blockquote', 'br', 'caption', 'center', 'cite', 'code',
1029
+ 'data', 'dd', 'del', 'dfn', 'div', 'dl', 'dt', 'em', 'font', 'h1', 'h2', 'h3', 'h4', 'h5',
1030
+ 'h6', 'hr', 'i', 'ins', 'kbd', 'li', 'link', 'mark', 'meta', 'ol', 'p', 'q', 'rb', 'rp',
1031
+ 'rt', 'rtc', 'ruby', 's', 'samp', 'small', 'span', 'strike', 'strong', 'sub', 'sup',
1032
+ 'table', 'td', 'th', 'time', 'tr', 'tt', 'u', 'ul', 'var', 'wbr',
1033
+ }
1034
+ parser_tags = {
1035
+ 'graph', 'charinsert', 'rss', 'chem', 'categorytree', 'nowiki', 'inputbox', 'math',
1036
+ 'hiero', 'score', 'pre', 'ref', 'translate', 'imagemap', 'templatestyles', 'languages',
1037
+ 'noinclude', 'mapframe', 'section', 'poem', 'syntaxhighlight', 'includeonly', 'tvar',
1038
+ 'onlyinclude', 'templatedata', 'langconvert', 'timeline', 'dynamicpagelist', 'gallery',
1039
+ 'maplink', 'ce', 'references',
1040
+ }
1041
+ variant_langs = {
1042
+ # ZhConverter.php
1043
+ 'zh', 'zh-hans', 'zh-hant', 'zh-cn', 'zh-hk', 'zh-mo', 'zh-my', 'zh-sg', 'zh-tw',
1044
+ # WuuConverter.php
1045
+ 'wuu', 'wuu-hans', 'wuu-hant',
1046
+ # UzConverter.php
1047
+ 'uz', 'uz-latn', 'uz-cyrl',
1048
+ # TlyConverter.php
1049
+ 'tly', 'tly-cyrl',
1050
+ # TgConverter.php
1051
+ 'tg', 'tg-latn',
1052
+ # SrConverter.php
1053
+ 'sr', 'sr-ec', 'sr-el',
1054
+ # ShiConverter.php
1055
+ 'shi', 'shi-tfng', 'shi-latn',
1056
+ # ShConverter.php
1057
+ 'sh-latn', 'sh-cyrl',
1058
+ # KuConverter.php
1059
+ 'ku', 'ku-arab', 'ku-latn',
1060
+ # IuConverter.php
1061
+ 'iu', 'ike-cans', 'ike-latn',
1062
+ # GanConverter.php
1063
+ 'gan', 'gan-hans', 'gan-hant',
1064
+ # EnConverter.php
1065
+ 'en', 'en-x-piglatin',
1066
+ # CrhConverter.php
1067
+ 'crh', 'crh-cyrl', 'crh-latn',
1068
+ # BanConverter.php
1069
+ 'ban', 'ban-bali', 'ban-x-dharma', 'ban-x-palmleaf', 'ban-x-pku',
1070
+ }
1071
+ magic_vars_i = {
1072
+ 'ARTICLEPATH', 'INT', 'PAGEID', 'SCRIPTPATH', 'SERVER', 'SERVERNAME', 'STYLEPATH',
1073
+ }
1074
+ magic_vars = {
1075
+ '!', '=', 'BASEPAGENAME', 'BASEPAGENAMEE', 'CASCADINGSOURCES', 'CONTENTLANGUAGE',
1076
+ 'CONTENTLANG', 'CURRENTDAY', 'CURRENTDAY2', 'CURRENTDAYNAME', 'CURRENTDOW', 'CURRENTHOUR',
1077
+ 'CURRENTMONTH', 'CURRENTMONTH2', 'CURRENTMONTH1', 'CURRENTMONTHABBREV', 'CURRENTMONTHNAME',
1078
+ 'CURRENTMONTHNAMEGEN', 'CURRENTTIME', 'CURRENTTIMESTAMP', 'CURRENTVERSION', 'CURRENTWEEK',
1079
+ 'CURRENTYEAR', 'DIRECTIONMARK', 'DIRMARK', 'FULLPAGENAME', 'FULLPAGENAMEE', 'LOCALDAY',
1080
+ 'LOCALDAY2', 'LOCALDAYNAME', 'LOCALDOW', 'LOCALHOUR', 'LOCALMONTH', 'LOCALMONTH2',
1081
+ 'LOCALMONTH1', 'LOCALMONTHABBREV', 'LOCALMONTHNAME', 'LOCALMONTHNAMEGEN', 'LOCALTIME',
1082
+ 'LOCALTIMESTAMP', 'LOCALWEEK', 'LOCALYEAR', 'NAMESPACE', 'NAMESPACEE', 'NAMESPACENUMBER',
1083
+ 'NUMBEROFACTIVEUSERS', 'NUMBEROFADMINS', 'NUMBEROFARTICLES', 'NUMBEROFEDITS',
1084
+ 'NUMBEROFFILES', 'NUMBEROFPAGES', 'NUMBEROFUSERS', 'PAGELANGUAGE', 'PAGENAME', 'PAGENAMEE',
1085
+ 'REVISIONDAY', 'REVISIONDAY2', 'REVISIONID', 'REVISIONMONTH', 'REVISIONMONTH1',
1086
+ 'REVISIONSIZE', 'REVISIONTIMESTAMP', 'REVISIONUSER', 'REVISIONYEAR', 'ROOTPAGENAME',
1087
+ 'ROOTPAGENAMEE', 'SITENAME', 'SUBJECTPAGENAME', 'ARTICLEPAGENAME', 'SUBJECTPAGENAMEE',
1088
+ 'ARTICLEPAGENAMEE', 'SUBJECTSPACE', 'ARTICLESPACE', 'SUBJECTSPACEE', 'ARTICLESPACEE',
1089
+ 'SUBPAGENAME', 'SUBPAGENAMEE', 'TALKPAGENAME', 'TALKPAGENAMEE', 'TALKSPACE', 'TALKSPACEE',
1090
+ }
1091
+ parser_functions_i = {
1092
+ 'ANCHORENCODE', 'BIDI', 'CANONICALURL', 'CANONICALURLE', 'FILEPATH', 'FORMATNUM',
1093
+ 'FULLURL', 'FULLURLE', 'GENDER', 'GRAMMAR', 'INT', r'\#LANGUAGE', 'LC', 'LCFIRST', 'LOCALURL',
1094
+ 'LOCALURLE', 'NS', 'NSE', 'PADLEFT', 'PADRIGHT', 'PAGEID', 'PLURAL', 'UC', 'UCFIRST',
1095
+ 'URLENCODE',
1096
+ }
1097
+ parser_functions = {
1098
+ 'BASEPAGENAME', 'BASEPAGENAMEE', 'CASCADINGSOURCES', 'DEFAULTSORT', 'DEFAULTSORTKEY',
1099
+ 'DEFAULTCATEGORYSORT', 'FULLPAGENAME', 'FULLPAGENAMEE', 'NAMESPACE', 'NAMESPACEE',
1100
+ 'NAMESPACENUMBER', 'NUMBERINGROUP', 'NUMINGROUP', 'NUMBEROFACTIVEUSERS', 'NUMBEROFADMINS',
1101
+ 'NUMBEROFARTICLES', 'NUMBEROFEDITS', 'NUMBEROFFILES', 'NUMBEROFPAGES', 'NUMBEROFUSERS',
1102
+ 'PAGENAME', 'PAGENAMEE', 'PAGESINCATEGORY', 'PAGESINCAT', 'PAGESIZE', 'PROTECTIONEXPIRY',
1103
+ 'PROTECTIONLEVEL', 'REVISIONDAY', 'REVISIONDAY2', 'REVISIONID', 'REVISIONMONTH',
1104
+ 'REVISIONMONTH1', 'REVISIONTIMESTAMP', 'REVISIONUSER', 'REVISIONYEAR', 'ROOTPAGENAME',
1105
+ 'ROOTPAGENAMEE', 'SUBJECTPAGENAME', 'ARTICLEPAGENAME', 'SUBJECTPAGENAMEE',
1106
+ 'ARTICLEPAGENAMEE', 'SUBJECTSPACE', 'ARTICLESPACE', 'SUBJECTSPACEE', 'ARTICLESPACEE',
1107
+ 'SUBPAGENAME', 'SUBPAGENAMEE', 'TALKPAGENAME', 'TALKPAGENAMEE', 'TALKSPACE', 'TALKSPACEE',
1108
+ 'INT', 'DISPLAYTITLE', 'PAGESINNAMESPACE', 'PAGESINNS',
1109
+ }
1110
+
1111
+ tokens = {
1112
+ 'root': [
1113
+ # Redirects
1114
+ (r"""(?xi)
1115
+ (\A\s*?)(\#REDIRECT:?) # may contain a colon
1116
+ (\s+)(\[\[) (?=[^\]\n]* \]\]$)
1117
+ """,
1118
+ bygroups(Whitespace, Keyword, Whitespace, Punctuation), 'redirect-inner'),
1119
+ # Subheadings
1120
+ (r'^(={2,6})(.+?)(\1)(\s*$\n)',
1121
+ bygroups(Generic.Subheading, Generic.Subheading, Generic.Subheading, Whitespace)),
1122
+ # Headings
1123
+ (r'^(=.+?=)(\s*$\n)',
1124
+ bygroups(Generic.Heading, Whitespace)),
1125
+ # Double-slashed magic words
1126
+ (words(double_slashes_i, prefix=r'(?i)'), Name.Function.Magic),
1127
+ (words(double_slashes), Name.Function.Magic),
1128
+ # Raw URLs
1129
+ (r'(?i)\b(?:{}){}{}*'.format('|'.join(protocols),
1130
+ link_address, link_char_class), Name.Label),
1131
+ # Magic links
1132
+ (rf'\b(?:RFC|PMID){nbsp_char}+[0-9]+\b',
1133
+ Name.Function.Magic),
1134
+ (r"""(?x)
1135
+ \bISBN {nbsp_char}
1136
+ (?: 97[89] {nbsp_dash}? )?
1137
+ (?: [0-9] {nbsp_dash}? ){{9}} # escape format()
1138
+ [0-9Xx]\b
1139
+ """.format(nbsp_char=nbsp_char, nbsp_dash=f'(?:-|{nbsp_char})'), Name.Function.Magic),
1140
+ include('list'),
1141
+ include('inline'),
1142
+ include('text'),
1143
+ ],
1144
+ 'redirect-inner': [
1145
+ (r'(\]\])(\s*?\n)', bygroups(Punctuation, Whitespace), '#pop'),
1146
+ (r'(\#)([^#]*?)', bygroups(Punctuation, Name.Label)),
1147
+ (rf'(?i)[{title_char}]+', Name.Tag),
1148
+ ],
1149
+ 'list': [
1150
+ # Description lists
1151
+ (r'^;', Keyword, 'dt'),
1152
+ # Ordered lists, unordered lists and indents
1153
+ (r'^[#:*]+', Keyword),
1154
+ # Horizontal rules
1155
+ (r'^-{4,}', Keyword),
1156
+ ],
1157
+ 'inline': [
1158
+ # Signatures
1159
+ (r'~{3,5}', Keyword),
1160
+ # Entities
1161
+ include('entity'),
1162
+ # Bold & italic
1163
+ (r"('')(''')(?!')", bygroups(Generic.Emph,
1164
+ Generic.EmphStrong), 'inline-italic-bold'),
1165
+ (r"'''(?!')", Generic.Strong, 'inline-bold'),
1166
+ (r"''(?!')", Generic.Emph, 'inline-italic'),
1167
+ # Comments & parameters & templates
1168
+ include('replaceable'),
1169
+ # Media links
1170
+ (
1171
+ r"""(?xi)
1172
+ (\[\[)
1173
+ (File|Image) (:)
1174
+ ((?: [{}] | \{{{{2,3}}[^{{}}]*?\}}{{2,3}} | <!--[\s\S]*?--> )*)
1175
+ (?: (\#) ([{}]*?) )?
1176
+ """.format(title_char, f'{title_char}#'),
1177
+ bygroups(Punctuation, Name.Namespace, Punctuation,
1178
+ using(this, state=['wikilink-name']), Punctuation, Name.Label),
1179
+ 'medialink-inner'
1180
+ ),
1181
+ # Wikilinks
1182
+ (
1183
+ r"""(?xi)
1184
+ (\[\[)(?!{}) # Should not contain URLs
1185
+ (?: ([{}]*) (:))?
1186
+ ((?: [{}] | \{{{{2,3}}[^{{}}]*?\}}{{2,3}} | <!--[\s\S]*?--> )*?)
1187
+ (?: (\#) ([{}]*?) )?
1188
+ (\]\])
1189
+ """.format('|'.join(protocols), title_char.replace('/', ''),
1190
+ title_char, f'{title_char}#'),
1191
+ bygroups(Punctuation, Name.Namespace, Punctuation,
1192
+ using(this, state=['wikilink-name']), Punctuation, Name.Label, Punctuation)
1193
+ ),
1194
+ (
1195
+ r"""(?xi)
1196
+ (\[\[)(?!{})
1197
+ (?: ([{}]*) (:))?
1198
+ ((?: [{}] | \{{{{2,3}}[^{{}}]*?\}}{{2,3}} | <!--[\s\S]*?--> )*?)
1199
+ (?: (\#) ([{}]*?) )?
1200
+ (\|)
1201
+ """.format('|'.join(protocols), title_char.replace('/', ''),
1202
+ title_char, f'{title_char}#'),
1203
+ bygroups(Punctuation, Name.Namespace, Punctuation,
1204
+ using(this, state=['wikilink-name']), Punctuation, Name.Label, Punctuation),
1205
+ 'wikilink-inner'
1206
+ ),
1207
+ # External links
1208
+ (
1209
+ r"""(?xi)
1210
+ (\[)
1211
+ ((?:{}) {} {}*)
1212
+ (\s*)
1213
+ """.format('|'.join(protocols), link_address, link_char_class),
1214
+ bygroups(Punctuation, Name.Label, Whitespace),
1215
+ 'extlink-inner'
1216
+ ),
1217
+ # Tables
1218
+ (r'^(:*)(\s*?)(\{\|)([^\n]*)$', bygroups(Keyword,
1219
+ Whitespace, Punctuation, using(this, state=['root', 'attr'])), 'table'),
1220
+ # HTML tags
1221
+ (r'(?i)(<)({})\b'.format('|'.join(html_tags)),
1222
+ bygroups(Punctuation, Name.Tag), 'tag-inner-ordinary'),
1223
+ (r'(?i)(</)({})\b(\s*)(>)'.format('|'.join(html_tags)),
1224
+ bygroups(Punctuation, Name.Tag, Whitespace, Punctuation)),
1225
+ # <nowiki>
1226
+ (r'(?i)(<)(nowiki)\b', bygroups(Punctuation,
1227
+ Name.Tag), ('tag-nowiki', 'tag-inner')),
1228
+ # <pre>
1229
+ (r'(?i)(<)(pre)\b', bygroups(Punctuation,
1230
+ Name.Tag), ('tag-pre', 'tag-inner')),
1231
+ # <categorytree>
1232
+ (r'(?i)(<)(categorytree)\b', bygroups(
1233
+ Punctuation, Name.Tag), ('tag-categorytree', 'tag-inner')),
1234
+ # <hiero>
1235
+ (r'(?i)(<)(hiero)\b', bygroups(Punctuation,
1236
+ Name.Tag), ('tag-hiero', 'tag-inner')),
1237
+ # <math>
1238
+ (r'(?i)(<)(math)\b', bygroups(Punctuation,
1239
+ Name.Tag), ('tag-math', 'tag-inner')),
1240
+ # <chem>
1241
+ (r'(?i)(<)(chem)\b', bygroups(Punctuation,
1242
+ Name.Tag), ('tag-chem', 'tag-inner')),
1243
+ # <ce>
1244
+ (r'(?i)(<)(ce)\b', bygroups(Punctuation,
1245
+ Name.Tag), ('tag-ce', 'tag-inner')),
1246
+ # <charinsert>
1247
+ (r'(?i)(<)(charinsert)\b', bygroups(
1248
+ Punctuation, Name.Tag), ('tag-charinsert', 'tag-inner')),
1249
+ # <templatedata>
1250
+ (r'(?i)(<)(templatedata)\b', bygroups(
1251
+ Punctuation, Name.Tag), ('tag-templatedata', 'tag-inner')),
1252
+ # <gallery>
1253
+ (r'(?i)(<)(gallery)\b', bygroups(
1254
+ Punctuation, Name.Tag), ('tag-gallery', 'tag-inner')),
1255
+ # <graph>
1256
+ (r'(?i)(<)(gallery)\b', bygroups(
1257
+ Punctuation, Name.Tag), ('tag-graph', 'tag-inner')),
1258
+ # <dynamicpagelist>
1259
+ (r'(?i)(<)(dynamicpagelist)\b', bygroups(
1260
+ Punctuation, Name.Tag), ('tag-dynamicpagelist', 'tag-inner')),
1261
+ # <inputbox>
1262
+ (r'(?i)(<)(inputbox)\b', bygroups(
1263
+ Punctuation, Name.Tag), ('tag-inputbox', 'tag-inner')),
1264
+ # <rss>
1265
+ (r'(?i)(<)(rss)\b', bygroups(
1266
+ Punctuation, Name.Tag), ('tag-rss', 'tag-inner')),
1267
+ # <imagemap>
1268
+ (r'(?i)(<)(imagemap)\b', bygroups(
1269
+ Punctuation, Name.Tag), ('tag-imagemap', 'tag-inner')),
1270
+ # <syntaxhighlight>
1271
+ (r'(?i)(</)(syntaxhighlight)\b(\s*)(>)',
1272
+ bygroups(Punctuation, Name.Tag, Whitespace, Punctuation)),
1273
+ (r'(?si)(<)(syntaxhighlight)\b([^>]*?(?<!/)>.*?)(?=</\2\s*>)',
1274
+ bygroups(Punctuation, Name.Tag, handle_syntaxhighlight)),
1275
+ # <syntaxhighlight>: Fallback case for self-closing tags
1276
+ (r'(?i)(<)(syntaxhighlight)\b(\s*?)((?:[^>]|-->)*?)(/\s*?(?<!--)>)', bygroups(
1277
+ Punctuation, Name.Tag, Whitespace, using(this, state=['root', 'attr']), Punctuation)),
1278
+ # <source>
1279
+ (r'(?i)(</)(source)\b(\s*)(>)',
1280
+ bygroups(Punctuation, Name.Tag, Whitespace, Punctuation)),
1281
+ (r'(?si)(<)(source)\b([^>]*?(?<!/)>.*?)(?=</\2\s*>)',
1282
+ bygroups(Punctuation, Name.Tag, handle_syntaxhighlight)),
1283
+ # <source>: Fallback case for self-closing tags
1284
+ (r'(?i)(<)(source)\b(\s*?)((?:[^>]|-->)*?)(/\s*?(?<!--)>)', bygroups(
1285
+ Punctuation, Name.Tag, Whitespace, using(this, state=['root', 'attr']), Punctuation)),
1286
+ # <score>
1287
+ (r'(?i)(</)(score)\b(\s*)(>)',
1288
+ bygroups(Punctuation, Name.Tag, Whitespace, Punctuation)),
1289
+ (r'(?si)(<)(score)\b([^>]*?(?<!/)>.*?)(?=</\2\s*>)',
1290
+ bygroups(Punctuation, Name.Tag, handle_score)),
1291
+ # <score>: Fallback case for self-closing tags
1292
+ (r'(?i)(<)(score)\b(\s*?)((?:[^>]|-->)*?)(/\s*?(?<!--)>)', bygroups(
1293
+ Punctuation, Name.Tag, Whitespace, using(this, state=['root', 'attr']), Punctuation)),
1294
+ # Other parser tags
1295
+ (r'(?i)(<)({})\b'.format('|'.join(parser_tags)),
1296
+ bygroups(Punctuation, Name.Tag), 'tag-inner-ordinary'),
1297
+ (r'(?i)(</)({})\b(\s*)(>)'.format('|'.join(parser_tags)),
1298
+ bygroups(Punctuation, Name.Tag, Whitespace, Punctuation)),
1299
+ # LanguageConverter markups
1300
+ (
1301
+ r"""(?xi)
1302
+ (-\{{) # Use {{ to escape format()
1303
+ ([^|]) (\|)
1304
+ (?:
1305
+ (?: ([^;]*?) (=>))?
1306
+ (\s* (?:{variants}) \s*) (:)
1307
+ )?
1308
+ """.format(variants='|'.join(variant_langs)),
1309
+ bygroups(Punctuation, Keyword, Punctuation,
1310
+ using(this, state=['root', 'lc-raw']),
1311
+ Operator, Name.Label, Punctuation),
1312
+ 'lc-inner'
1313
+ ),
1314
+ # LanguageConverter markups: composite conversion grammar
1315
+ (
1316
+ r"""(?xi)
1317
+ (-\{)
1318
+ ([a-z\s;-]*?) (\|)
1319
+ """,
1320
+ bygroups(Punctuation,
1321
+ using(this, state=['root', 'lc-flag']),
1322
+ Punctuation),
1323
+ 'lc-raw'
1324
+ ),
1325
+ # LanguageConverter markups: fallbacks
1326
+ (
1327
+ r"""(?xi)
1328
+ (-\{{) (?!\{{) # Use {{ to escape format()
1329
+ (?: (\s* (?:{variants}) \s*) (:))?
1330
+ """.format(variants='|'.join(variant_langs)),
1331
+ bygroups(Punctuation, Name.Label, Punctuation),
1332
+ 'lc-inner'
1333
+ ),
1334
+ ],
1335
+ 'wikilink-name': [
1336
+ include('replaceable'),
1337
+ (r'[^{<]+', Name.Tag),
1338
+ (r'(?s).', Name.Tag),
1339
+ ],
1340
+ 'wikilink-inner': [
1341
+ # Quit in case of another wikilink
1342
+ (r'(?=\[\[)', Punctuation, '#pop'),
1343
+ (r'\]\]', Punctuation, '#pop'),
1344
+ include('inline'),
1345
+ include('text'),
1346
+ ],
1347
+ 'medialink-inner': [
1348
+ (r'\]\]', Punctuation, '#pop'),
1349
+ (r'(\|)([^\n=|]*)(=)',
1350
+ bygroups(Punctuation, Name.Attribute, Operator)),
1351
+ (r'\|', Punctuation),
1352
+ include('inline'),
1353
+ include('text'),
1354
+ ],
1355
+ 'quote-common': [
1356
+ # Quit in case of link/template endings
1357
+ (r'(?=\]\]|\{\{|\}\})', Punctuation, '#pop'),
1358
+ (r'\n', Text, '#pop'),
1359
+ ],
1360
+ 'inline-italic': [
1361
+ include('quote-common'),
1362
+ (r"('')(''')(?!')", bygroups(Generic.Emph,
1363
+ Generic.Strong), ('#pop', 'inline-bold')),
1364
+ (r"'''(?!')", Generic.EmphStrong, ('#pop', 'inline-italic-bold')),
1365
+ (r"''(?!')", Generic.Emph, '#pop'),
1366
+ include('inline'),
1367
+ include('text-italic'),
1368
+ ],
1369
+ 'inline-bold': [
1370
+ include('quote-common'),
1371
+ (r"(''')('')(?!')", bygroups(
1372
+ Generic.Strong, Generic.Emph), ('#pop', 'inline-italic')),
1373
+ (r"'''(?!')", Generic.Strong, '#pop'),
1374
+ (r"''(?!')", Generic.EmphStrong, ('#pop', 'inline-bold-italic')),
1375
+ include('inline'),
1376
+ include('text-bold'),
1377
+ ],
1378
+ 'inline-bold-italic': [
1379
+ include('quote-common'),
1380
+ (r"('')(''')(?!')", bygroups(Generic.EmphStrong,
1381
+ Generic.Strong), '#pop'),
1382
+ (r"'''(?!')", Generic.EmphStrong, ('#pop', 'inline-italic')),
1383
+ (r"''(?!')", Generic.EmphStrong, ('#pop', 'inline-bold')),
1384
+ include('inline'),
1385
+ include('text-bold-italic'),
1386
+ ],
1387
+ 'inline-italic-bold': [
1388
+ include('quote-common'),
1389
+ (r"(''')('')(?!')", bygroups(
1390
+ Generic.EmphStrong, Generic.Emph), '#pop'),
1391
+ (r"'''(?!')", Generic.EmphStrong, ('#pop', 'inline-italic')),
1392
+ (r"''(?!')", Generic.EmphStrong, ('#pop', 'inline-bold')),
1393
+ include('inline'),
1394
+ include('text-bold-italic'),
1395
+ ],
1396
+ 'lc-flag': [
1397
+ (r'\s+', Whitespace),
1398
+ (r';', Punctuation),
1399
+ *text_rules(Keyword),
1400
+ ],
1401
+ 'lc-inner': [
1402
+ (
1403
+ r"""(?xi)
1404
+ (;)
1405
+ (?: ([^;]*?) (=>))?
1406
+ (\s* (?:{variants}) \s*) (:)
1407
+ """.format(variants='|'.join(variant_langs)),
1408
+ bygroups(Punctuation, using(this, state=['root', 'lc-raw']),
1409
+ Operator, Name.Label, Punctuation)
1410
+ ),
1411
+ (r';?\s*?\}-', Punctuation, '#pop'),
1412
+ include('inline'),
1413
+ include('text'),
1414
+ ],
1415
+ 'lc-raw': [
1416
+ (r'\}-', Punctuation, '#pop'),
1417
+ include('inline'),
1418
+ include('text'),
1419
+ ],
1420
+ 'replaceable': [
1421
+ # Comments
1422
+ (r'<!--[\s\S]*?(?:-->|\Z)', Comment.Multiline),
1423
+ # Parameters
1424
+ (
1425
+ r"""(?x)
1426
+ (\{{3})
1427
+ ([^|]*?)
1428
+ (?=\}{3}|\|)
1429
+ """,
1430
+ bygroups(Punctuation, Name.Variable),
1431
+ 'parameter-inner',
1432
+ ),
1433
+ # Magic variables
1434
+ (r'(?i)(\{{\{{)(\s*)({})(\s*)(\}}\}})'.format('|'.join(magic_vars_i)),
1435
+ bygroups(Punctuation, Whitespace, Name.Function, Whitespace, Punctuation)),
1436
+ (r'(\{{\{{)(\s*)({})(\s*)(\}}\}})'.format('|'.join(magic_vars)),
1437
+ bygroups(Punctuation, Whitespace, Name.Function, Whitespace, Punctuation)),
1438
+ # Parser functions & templates
1439
+ (r'\{\{', Punctuation, 'template-begin-space'),
1440
+ # <tvar> legacy syntax
1441
+ (r'(?i)(<)(tvar)\b(\|)([^>]*?)(>)', bygroups(Punctuation,
1442
+ Name.Tag, Punctuation, String, Punctuation)),
1443
+ (r'</>', Punctuation, '#pop'),
1444
+ # <tvar>
1445
+ (r'(?i)(<)(tvar)\b', bygroups(Punctuation, Name.Tag), 'tag-inner-ordinary'),
1446
+ (r'(?i)(</)(tvar)\b(\s*)(>)',
1447
+ bygroups(Punctuation, Name.Tag, Whitespace, Punctuation)),
1448
+ ],
1449
+ 'parameter-inner': [
1450
+ (r'\}{3}', Punctuation, '#pop'),
1451
+ (r'\|', Punctuation),
1452
+ include('inline'),
1453
+ include('text'),
1454
+ ],
1455
+ 'template-begin-space': [
1456
+ # Templates allow line breaks at the beginning, and due to how MediaWiki handles
1457
+ # comments, an extra state is required to handle things like {{\n<!---->\n name}}
1458
+ (r'<!--[\s\S]*?(?:-->|\Z)', Comment.Multiline),
1459
+ (r'\s+', Whitespace),
1460
+ # Parser functions
1461
+ (
1462
+ r'(?i)(\#[{}]*?|{})(:)'.format(title_char,
1463
+ '|'.join(parser_functions_i)),
1464
+ bygroups(Name.Function, Punctuation), ('#pop', 'template-inner')
1465
+ ),
1466
+ (
1467
+ r'({})(:)'.format('|'.join(parser_functions)),
1468
+ bygroups(Name.Function, Punctuation), ('#pop', 'template-inner')
1469
+ ),
1470
+ # Templates
1471
+ (
1472
+ rf'(?i)([{title_char}]*?)(:)',
1473
+ bygroups(Name.Namespace, Punctuation), ('#pop', 'template-name')
1474
+ ),
1475
+ default(('#pop', 'template-name'),),
1476
+ ],
1477
+ 'template-name': [
1478
+ (r'(\s*?)(\|)', bygroups(Text, Punctuation), ('#pop', 'template-inner')),
1479
+ (r'\}\}', Punctuation, '#pop'),
1480
+ (r'\n', Text, '#pop'),
1481
+ include('replaceable'),
1482
+ *text_rules(Name.Tag),
1483
+ ],
1484
+ 'template-inner': [
1485
+ (r'\}\}', Punctuation, '#pop'),
1486
+ (r'\|', Punctuation),
1487
+ (
1488
+ r"""(?x)
1489
+ (?<=\|)
1490
+ ( (?: (?! \{\{ | \}\} )[^=\|<])*? ) # Exclude templates and tags
1491
+ (=)
1492
+ """,
1493
+ bygroups(Name.Label, Operator)
1494
+ ),
1495
+ include('inline'),
1496
+ include('text'),
1497
+ ],
1498
+ 'table': [
1499
+ # Use [ \t\n\r\0\x0B] instead of \s to follow PHP trim() behavior
1500
+ # Endings
1501
+ (r'^([ \t\n\r\0\x0B]*?)(\|\})',
1502
+ bygroups(Whitespace, Punctuation), '#pop'),
1503
+ # Table rows
1504
+ (r'^([ \t\n\r\0\x0B]*?)(\|-+)(.*)$', bygroups(Whitespace, Punctuation,
1505
+ using(this, state=['root', 'attr']))),
1506
+ # Captions
1507
+ (
1508
+ r"""(?x)
1509
+ ^([ \t\n\r\0\x0B]*?)(\|\+)
1510
+ # Exclude links, template and tags
1511
+ (?: ( (?: (?! \[\[ | \{\{ )[^|\n<] )*? )(\|) )?
1512
+ (.*?)$
1513
+ """,
1514
+ bygroups(Whitespace, Punctuation, using(this, state=[
1515
+ 'root', 'attr']), Punctuation, Generic.Heading),
1516
+ ),
1517
+ # Table data
1518
+ (
1519
+ r"""(?x)
1520
+ ( ^(?:[ \t\n\r\0\x0B]*?)\| | \|\| )
1521
+ (?: ( (?: (?! \[\[ | \{\{ )[^|\n<] )*? )(\|)(?!\|) )?
1522
+ """,
1523
+ bygroups(Punctuation, using(this, state=[
1524
+ 'root', 'attr']), Punctuation),
1525
+ ),
1526
+ # Table headers
1527
+ (
1528
+ r"""(?x)
1529
+ ( ^(?:[ \t\n\r\0\x0B]*?)! )
1530
+ (?: ( (?: (?! \[\[ | \{\{ )[^|\n<] )*? )(\|)(?!\|) )?
1531
+ """,
1532
+ bygroups(Punctuation, using(this, state=[
1533
+ 'root', 'attr']), Punctuation),
1534
+ 'table-header',
1535
+ ),
1536
+ include('list'),
1537
+ include('inline'),
1538
+ include('text'),
1539
+ ],
1540
+ 'table-header': [
1541
+ # Requires another state for || handling inside headers
1542
+ (r'\n', Text, '#pop'),
1543
+ (
1544
+ r"""(?x)
1545
+ (!!|\|\|)
1546
+ (?:
1547
+ ( (?: (?! \[\[ | \{\{ )[^|\n<] )*? )
1548
+ (\|)(?!\|)
1549
+ )?
1550
+ """,
1551
+ bygroups(Punctuation, using(this, state=[
1552
+ 'root', 'attr']), Punctuation)
1553
+ ),
1554
+ *text_rules(Generic.Subheading),
1555
+ ],
1556
+ 'entity': [
1557
+ (r'&\S*?;', Name.Entity),
1558
+ ],
1559
+ 'dt': [
1560
+ (r'\n', Text, '#pop'),
1561
+ include('inline'),
1562
+ (r':', Keyword, '#pop'),
1563
+ include('text'),
1564
+ ],
1565
+ 'extlink-inner': [
1566
+ (r'\]', Punctuation, '#pop'),
1567
+ include('inline'),
1568
+ include('text'),
1569
+ ],
1570
+ 'nowiki-ish': [
1571
+ include('entity'),
1572
+ include('text'),
1573
+ ],
1574
+ 'attr': [
1575
+ include('replaceable'),
1576
+ (r'\s+', Whitespace),
1577
+ (r'(=)(\s*)(")', bygroups(Operator, Whitespace, String.Double), 'attr-val-2'),
1578
+ (r"(=)(\s*)(')", bygroups(Operator, Whitespace, String.Single), 'attr-val-1'),
1579
+ (r'(=)(\s*)', bygroups(Operator, Whitespace), 'attr-val-0'),
1580
+ (r'[\w:-]+', Name.Attribute),
1581
+
1582
+ ],
1583
+ 'attr-val-0': [
1584
+ (r'\s', Whitespace, '#pop'),
1585
+ include('replaceable'),
1586
+ *text_rules(String),
1587
+ ],
1588
+ 'attr-val-1': [
1589
+ (r"'", String.Single, '#pop'),
1590
+ include('replaceable'),
1591
+ *text_rules(String.Single),
1592
+ ],
1593
+ 'attr-val-2': [
1594
+ (r'"', String.Double, '#pop'),
1595
+ include('replaceable'),
1596
+ *text_rules(String.Double),
1597
+ ],
1598
+ 'tag-inner-ordinary': [
1599
+ (r'/?\s*>', Punctuation, '#pop'),
1600
+ include('tag-attr'),
1601
+ ],
1602
+ 'tag-inner': [
1603
+ # Return to root state for self-closing tags
1604
+ (r'/\s*>', Punctuation, '#pop:2'),
1605
+ (r'\s*>', Punctuation, '#pop'),
1606
+ include('tag-attr'),
1607
+ ],
1608
+ # There states below are just like their non-tag variants, the key difference is
1609
+ # they forcibly quit when encountering tag closing markup
1610
+ 'tag-attr': [
1611
+ include('replaceable'),
1612
+ (r'\s+', Whitespace),
1613
+ (r'(=)(\s*)(")', bygroups(Operator,
1614
+ Whitespace, String.Double), 'tag-attr-val-2'),
1615
+ (r"(=)(\s*)(')", bygroups(Operator,
1616
+ Whitespace, String.Single), 'tag-attr-val-1'),
1617
+ (r'(=)(\s*)', bygroups(Operator, Whitespace), 'tag-attr-val-0'),
1618
+ (r'[\w:-]+', Name.Attribute),
1619
+
1620
+ ],
1621
+ 'tag-attr-val-0': [
1622
+ (r'\s', Whitespace, '#pop'),
1623
+ (r'/?>', Punctuation, '#pop:2'),
1624
+ include('replaceable'),
1625
+ *text_rules(String),
1626
+ ],
1627
+ 'tag-attr-val-1': [
1628
+ (r"'", String.Single, '#pop'),
1629
+ (r'/?>', Punctuation, '#pop:2'),
1630
+ include('replaceable'),
1631
+ *text_rules(String.Single),
1632
+ ],
1633
+ 'tag-attr-val-2': [
1634
+ (r'"', String.Double, '#pop'),
1635
+ (r'/?>', Punctuation, '#pop:2'),
1636
+ include('replaceable'),
1637
+ *text_rules(String.Double),
1638
+ ],
1639
+ 'tag-nowiki': nowiki_tag_rules('nowiki'),
1640
+ 'tag-pre': nowiki_tag_rules('pre'),
1641
+ 'tag-categorytree': plaintext_tag_rules('categorytree'),
1642
+ 'tag-dynamicpagelist': plaintext_tag_rules('dynamicpagelist'),
1643
+ 'tag-hiero': plaintext_tag_rules('hiero'),
1644
+ 'tag-inputbox': plaintext_tag_rules('inputbox'),
1645
+ 'tag-imagemap': plaintext_tag_rules('imagemap'),
1646
+ 'tag-charinsert': plaintext_tag_rules('charinsert'),
1647
+ 'tag-timeline': plaintext_tag_rules('timeline'),
1648
+ 'tag-gallery': plaintext_tag_rules('gallery'),
1649
+ 'tag-graph': plaintext_tag_rules('graph'),
1650
+ 'tag-rss': plaintext_tag_rules('rss'),
1651
+ 'tag-math': delegate_tag_rules('math', TexLexer, state='math'),
1652
+ 'tag-chem': delegate_tag_rules('chem', TexLexer, state='math'),
1653
+ 'tag-ce': delegate_tag_rules('ce', TexLexer, state='math'),
1654
+ 'tag-templatedata': delegate_tag_rules('templatedata', JsonLexer),
1655
+ 'text-italic': text_rules(Generic.Emph),
1656
+ 'text-bold': text_rules(Generic.Strong),
1657
+ 'text-bold-italic': text_rules(Generic.EmphStrong),
1658
+ 'text': text_rules(Text),
1659
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/math.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.math
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Just export lexers that were contained in this module.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ # ruff: noqa: F401
12
+ from pygments.lexers.python import NumPyLexer
13
+ from pygments.lexers.matlab import MatlabLexer, MatlabSessionLexer, \
14
+ OctaveLexer, ScilabLexer
15
+ from pygments.lexers.julia import JuliaLexer, JuliaConsoleLexer
16
+ from pygments.lexers.r import RConsoleLexer, SLexer, RdLexer
17
+ from pygments.lexers.modeling import BugsLexer, JagsLexer, StanLexer
18
+ from pygments.lexers.idl import IDLLexer
19
+ from pygments.lexers.algebra import MuPADLexer
20
+
21
+ __all__ = []
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/matlab.py ADDED
The diff for this file is too large to render. See raw diff
 
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/maxima.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.maxima
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the computer algebra system Maxima.
6
+
7
+ Derived from pygments/lexers/algebra.py.
8
+
9
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
10
+ :license: BSD, see LICENSE for details.
11
+ """
12
+
13
+ import re
14
+
15
+ from pygments.lexer import RegexLexer, bygroups, words
16
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
17
+ Number, Punctuation
18
+
19
+ __all__ = ['MaximaLexer']
20
+
21
+ class MaximaLexer(RegexLexer):
22
+ """
23
+ A Maxima lexer.
24
+ Derived from pygments.lexers.MuPADLexer.
25
+ """
26
+ name = 'Maxima'
27
+ url = 'http://maxima.sourceforge.net'
28
+ aliases = ['maxima', 'macsyma']
29
+ filenames = ['*.mac', '*.max']
30
+ version_added = '2.11'
31
+
32
+ keywords = ('if', 'then', 'else', 'elseif',
33
+ 'do', 'while', 'repeat', 'until',
34
+ 'for', 'from', 'to', 'downto', 'step', 'thru')
35
+
36
+ constants = ('%pi', '%e', '%phi', '%gamma', '%i',
37
+ 'und', 'ind', 'infinity', 'inf', 'minf',
38
+ 'true', 'false', 'unknown', 'done')
39
+
40
+ operators = (r'.', r':', r'=', r'#',
41
+ r'+', r'-', r'*', r'/', r'^',
42
+ r'@', r'>', r'<', r'|', r'!', r"'")
43
+
44
+ operator_words = ('and', 'or', 'not')
45
+
46
+ tokens = {
47
+ 'root': [
48
+ (r'/\*', Comment.Multiline, 'comment'),
49
+ (r'"(?:[^"\\]|\\.)*"', String),
50
+ (r'\(|\)|\[|\]|\{|\}', Punctuation),
51
+ (r'[,;$]', Punctuation),
52
+ (words (constants), Name.Constant),
53
+ (words (keywords), Keyword),
54
+ (words (operators), Operator),
55
+ (words (operator_words), Operator.Word),
56
+ (r'''(?x)
57
+ ((?:[a-zA-Z_#][\w#]*|`[^`]*`)
58
+ (?:::[a-zA-Z_#][\w#]*|`[^`]*`)*)(\s*)([(])''',
59
+ bygroups(Name.Function, Text.Whitespace, Punctuation)),
60
+ (r'''(?x)
61
+ (?:[a-zA-Z_#%][\w#%]*|`[^`]*`)
62
+ (?:::[a-zA-Z_#%][\w#%]*|`[^`]*`)*''', Name.Variable),
63
+ (r'[-+]?(\d*\.\d+([bdefls][-+]?\d+)?|\d+(\.\d*)?[bdefls][-+]?\d+)', Number.Float),
64
+ (r'[-+]?\d+', Number.Integer),
65
+ (r'\s+', Text.Whitespace),
66
+ (r'.', Text)
67
+ ],
68
+ 'comment': [
69
+ (r'[^*/]+', Comment.Multiline),
70
+ (r'/\*', Comment.Multiline, '#push'),
71
+ (r'\*/', Comment.Multiline, '#pop'),
72
+ (r'[*/]', Comment.Multiline)
73
+ ]
74
+ }
75
+
76
+ def analyse_text (text):
77
+ strength = 0.0
78
+ # Input expression terminator.
79
+ if re.search (r'\$\s*$', text, re.MULTILINE):
80
+ strength += 0.05
81
+ # Function definition operator.
82
+ if ':=' in text:
83
+ strength += 0.02
84
+ return strength
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/meson.py ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.meson
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Pygments lexer for the Meson build system
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words, include
12
+ from pygments.token import Comment, Name, Number, Punctuation, Operator, \
13
+ Keyword, String, Whitespace
14
+
15
+ __all__ = ['MesonLexer']
16
+
17
+
18
+ class MesonLexer(RegexLexer):
19
+ """Meson language lexer.
20
+
21
+ The grammar definition use to transcribe the syntax was retrieved from
22
+ https://mesonbuild.com/Syntax.html#grammar for version 0.58.
23
+ Some of those definitions are improperly transcribed, so the Meson++
24
+ implementation was also checked: https://github.com/dcbaker/meson-plus-plus.
25
+ """
26
+
27
+ # TODO String interpolation @VARNAME@ inner matches
28
+ # TODO keyword_arg: value inner matches
29
+
30
+ name = 'Meson'
31
+ url = 'https://mesonbuild.com/'
32
+ aliases = ['meson', 'meson.build']
33
+ filenames = ['meson.build', 'meson.options', 'meson_options.txt']
34
+ mimetypes = ['text/x-meson']
35
+ version_added = '2.10'
36
+
37
+ tokens = {
38
+ 'root': [
39
+ (r'#.*?$', Comment),
40
+ (r"'''.*'''", String.Single),
41
+ (r'[1-9][0-9]*', Number.Integer),
42
+ (r'0o[0-7]+', Number.Oct),
43
+ (r'0x[a-fA-F0-9]+', Number.Hex),
44
+ include('string'),
45
+ include('keywords'),
46
+ include('expr'),
47
+ (r'[a-zA-Z_][a-zA-Z_0-9]*', Name),
48
+ (r'\s+', Whitespace),
49
+ ],
50
+ 'string': [
51
+ (r"[']{3}([']{0,2}([^\\']|\\(.|\n)))*[']{3}", String),
52
+ (r"'.*?(?<!\\)(\\\\)*?'", String),
53
+ ],
54
+ 'keywords': [
55
+ (words((
56
+ 'if',
57
+ 'elif',
58
+ 'else',
59
+ 'endif',
60
+ 'foreach',
61
+ 'endforeach',
62
+ 'break',
63
+ 'continue',
64
+ ),
65
+ suffix=r'\b'), Keyword),
66
+ ],
67
+ 'expr': [
68
+ (r'(in|and|or|not)\b', Operator.Word),
69
+ (r'([\*/%\+-]=?|==|!=|=)', Operator),
70
+ (r'[\[\]{}:().,?]', Punctuation),
71
+ (words(('true', 'false'), suffix=r'\b'), Keyword.Constant),
72
+ include('builtins'),
73
+ (words((
74
+ 'meson',
75
+ 'build_machine',
76
+ 'host_machine',
77
+ 'target_machine',
78
+ ),
79
+ suffix=r'\b'), Name.Variable.Magic),
80
+ ],
81
+ 'builtins': [
82
+ # This list was extracted from the v0.58 reference manual
83
+ (words((
84
+ 'add_global_arguments',
85
+ 'add_global_link_arguments',
86
+ 'add_languages',
87
+ 'add_project_arguments',
88
+ 'add_project_link_arguments',
89
+ 'add_test_setup',
90
+ 'assert',
91
+ 'benchmark',
92
+ 'both_libraries',
93
+ 'build_target',
94
+ 'configuration_data',
95
+ 'configure_file',
96
+ 'custom_target',
97
+ 'declare_dependency',
98
+ 'dependency',
99
+ 'disabler',
100
+ 'environment',
101
+ 'error',
102
+ 'executable',
103
+ 'files',
104
+ 'find_library',
105
+ 'find_program',
106
+ 'generator',
107
+ 'get_option',
108
+ 'get_variable',
109
+ 'include_directories',
110
+ 'install_data',
111
+ 'install_headers',
112
+ 'install_man',
113
+ 'install_subdir',
114
+ 'is_disabler',
115
+ 'is_variable',
116
+ 'jar',
117
+ 'join_paths',
118
+ 'library',
119
+ 'message',
120
+ 'project',
121
+ 'range',
122
+ 'run_command',
123
+ 'set_variable',
124
+ 'shared_library',
125
+ 'shared_module',
126
+ 'static_library',
127
+ 'subdir',
128
+ 'subdir_done',
129
+ 'subproject',
130
+ 'summary',
131
+ 'test',
132
+ 'vcs_tag',
133
+ 'warning',
134
+ ),
135
+ prefix=r'(?<!\.)',
136
+ suffix=r'\b'), Name.Builtin),
137
+ (r'(?<!\.)import\b', Name.Namespace),
138
+ ],
139
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/mime.py ADDED
@@ -0,0 +1,210 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.mime
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Multipurpose Internet Mail Extensions (MIME) data.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include
14
+ from pygments.lexers import get_lexer_for_mimetype
15
+ from pygments.token import Text, Name, String, Operator, Comment, Other
16
+ from pygments.util import get_int_opt, ClassNotFound
17
+
18
+ __all__ = ["MIMELexer"]
19
+
20
+
21
+ class MIMELexer(RegexLexer):
22
+ """
23
+ Lexer for Multipurpose Internet Mail Extensions (MIME) data. This lexer is
24
+ designed to process nested multipart data.
25
+
26
+ It assumes that the given data contains both header and body (and is
27
+ split at an empty line). If no valid header is found, then the entire data
28
+ will be treated as body.
29
+
30
+ Additional options accepted:
31
+
32
+ `MIME-max-level`
33
+ Max recursion level for nested MIME structure. Any negative number
34
+ would treated as unlimited. (default: -1)
35
+
36
+ `Content-Type`
37
+ Treat the data as a specific content type. Useful when header is
38
+ missing, or this lexer would try to parse from header. (default:
39
+ `text/plain`)
40
+
41
+ `Multipart-Boundary`
42
+ Set the default multipart boundary delimiter. This option is only used
43
+ when `Content-Type` is `multipart` and header is missing. This lexer
44
+ would try to parse from header by default. (default: None)
45
+
46
+ `Content-Transfer-Encoding`
47
+ Treat the data as a specific encoding. Or this lexer would try to parse
48
+ from header by default. (default: None)
49
+ """
50
+
51
+ name = "MIME"
52
+ aliases = ["mime"]
53
+ mimetypes = ["multipart/mixed",
54
+ "multipart/related",
55
+ "multipart/alternative"]
56
+ url = 'https://en.wikipedia.org/wiki/MIME'
57
+ version_added = '2.5'
58
+
59
+ def __init__(self, **options):
60
+ super().__init__(**options)
61
+ self.boundary = options.get("Multipart-Boundary")
62
+ self.content_transfer_encoding = options.get("Content_Transfer_Encoding")
63
+ self.content_type = options.get("Content_Type", "text/plain")
64
+ self.max_nested_level = get_int_opt(options, "MIME-max-level", -1)
65
+
66
+ def get_header_tokens(self, match):
67
+ field = match.group(1)
68
+
69
+ if field.lower() in self.attention_headers:
70
+ yield match.start(1), Name.Tag, field + ":"
71
+ yield match.start(2), Text.Whitespace, match.group(2)
72
+
73
+ pos = match.end(2)
74
+ body = match.group(3)
75
+ for i, t, v in self.get_tokens_unprocessed(body, ("root", field.lower())):
76
+ yield pos + i, t, v
77
+
78
+ else:
79
+ yield match.start(), Comment, match.group()
80
+
81
+ def get_body_tokens(self, match):
82
+ pos_body_start = match.start()
83
+ entire_body = match.group()
84
+
85
+ # skip first newline
86
+ if entire_body[0] == '\n':
87
+ yield pos_body_start, Text.Whitespace, '\n'
88
+ pos_body_start = pos_body_start + 1
89
+ entire_body = entire_body[1:]
90
+
91
+ # if it is not a multipart
92
+ if not self.content_type.startswith("multipart") or not self.boundary:
93
+ for i, t, v in self.get_bodypart_tokens(entire_body):
94
+ yield pos_body_start + i, t, v
95
+ return
96
+
97
+ # find boundary
98
+ bdry_pattern = rf"^--{re.escape(self.boundary)}(--)?\n"
99
+ bdry_matcher = re.compile(bdry_pattern, re.MULTILINE)
100
+
101
+ # some data has prefix text before first boundary
102
+ m = bdry_matcher.search(entire_body)
103
+ if m:
104
+ pos_part_start = pos_body_start + m.end()
105
+ pos_iter_start = lpos_end = m.end()
106
+ yield pos_body_start, Text, entire_body[:m.start()]
107
+ yield pos_body_start + lpos_end, String.Delimiter, m.group()
108
+ else:
109
+ pos_part_start = pos_body_start
110
+ pos_iter_start = 0
111
+
112
+ # process tokens of each body part
113
+ for m in bdry_matcher.finditer(entire_body, pos_iter_start):
114
+ # bodypart
115
+ lpos_start = pos_part_start - pos_body_start
116
+ lpos_end = m.start()
117
+ part = entire_body[lpos_start:lpos_end]
118
+ for i, t, v in self.get_bodypart_tokens(part):
119
+ yield pos_part_start + i, t, v
120
+
121
+ # boundary
122
+ yield pos_body_start + lpos_end, String.Delimiter, m.group()
123
+ pos_part_start = pos_body_start + m.end()
124
+
125
+ # some data has suffix text after last boundary
126
+ lpos_start = pos_part_start - pos_body_start
127
+ if lpos_start != len(entire_body):
128
+ yield pos_part_start, Text, entire_body[lpos_start:]
129
+
130
+ def get_bodypart_tokens(self, text):
131
+ # return if:
132
+ # * no content
133
+ # * no content type specific
134
+ # * content encoding is not readable
135
+ # * max recurrsion exceed
136
+ if not text.strip() or not self.content_type:
137
+ return [(0, Other, text)]
138
+
139
+ cte = self.content_transfer_encoding
140
+ if cte and cte not in {"8bit", "7bit", "quoted-printable"}:
141
+ return [(0, Other, text)]
142
+
143
+ if self.max_nested_level == 0:
144
+ return [(0, Other, text)]
145
+
146
+ # get lexer
147
+ try:
148
+ lexer = get_lexer_for_mimetype(self.content_type)
149
+ except ClassNotFound:
150
+ return [(0, Other, text)]
151
+
152
+ if isinstance(lexer, type(self)):
153
+ lexer.max_nested_level = self.max_nested_level - 1
154
+
155
+ return lexer.get_tokens_unprocessed(text)
156
+
157
+ def store_content_type(self, match):
158
+ self.content_type = match.group(1)
159
+
160
+ prefix_len = match.start(1) - match.start(0)
161
+ yield match.start(0), Text.Whitespace, match.group(0)[:prefix_len]
162
+ yield match.start(1), Name.Label, match.group(2)
163
+ yield match.end(2), String.Delimiter, '/'
164
+ yield match.start(3), Name.Label, match.group(3)
165
+
166
+ def get_content_type_subtokens(self, match):
167
+ yield match.start(1), Text, match.group(1)
168
+ yield match.start(2), Text.Whitespace, match.group(2)
169
+ yield match.start(3), Name.Attribute, match.group(3)
170
+ yield match.start(4), Operator, match.group(4)
171
+ yield match.start(5), String, match.group(5)
172
+
173
+ if match.group(3).lower() == "boundary":
174
+ boundary = match.group(5).strip()
175
+ if boundary[0] == '"' and boundary[-1] == '"':
176
+ boundary = boundary[1:-1]
177
+ self.boundary = boundary
178
+
179
+ def store_content_transfer_encoding(self, match):
180
+ self.content_transfer_encoding = match.group(0).lower()
181
+ yield match.start(0), Name.Constant, match.group(0)
182
+
183
+ attention_headers = {"content-type", "content-transfer-encoding"}
184
+
185
+ tokens = {
186
+ "root": [
187
+ (r"^([\w-]+):( *)([\s\S]*?\n)(?![ \t])", get_header_tokens),
188
+ (r"^$[\s\S]+", get_body_tokens),
189
+ ],
190
+ "header": [
191
+ # folding
192
+ (r"\n[ \t]", Text.Whitespace),
193
+ (r"\n(?![ \t])", Text.Whitespace, "#pop"),
194
+ ],
195
+ "content-type": [
196
+ include("header"),
197
+ (
198
+ r"^\s*((multipart|application|audio|font|image|model|text|video"
199
+ r"|message)/([\w-]+))",
200
+ store_content_type,
201
+ ),
202
+ (r'(;)((?:[ \t]|\n[ \t])*)([\w:-]+)(=)([\s\S]*?)(?=;|\n(?![ \t]))',
203
+ get_content_type_subtokens),
204
+ (r';[ \t]*\n(?![ \t])', Text, '#pop'),
205
+ ],
206
+ "content-transfer-encoding": [
207
+ include("header"),
208
+ (r"([\w-]+)", store_content_transfer_encoding),
209
+ ],
210
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/minecraft.py ADDED
@@ -0,0 +1,392 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.minecraft
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Minecraft related languages.
6
+
7
+ SNBT. A data communication format used in Minecraft.
8
+ wiki: https://minecraft.wiki/w/NBT_format
9
+
10
+ MCFunction. The Function file for Minecraft Data packs and Add-ons.
11
+ official: https://learn.microsoft.com/en-us/minecraft/creator/documents/functionsintroduction
12
+ wiki: https://minecraft.wiki/w/Function
13
+
14
+ MCSchema. A kind of data Schema for Minecraft Add-on Development.
15
+ official: https://learn.microsoft.com/en-us/minecraft/creator/reference/content/schemasreference/
16
+ community example: https://www.mcbe-dev.net/addons/data-driven/manifest.html
17
+
18
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
19
+ :license: BSD, see LICENSE for details.
20
+ """
21
+
22
+ from pygments.lexer import RegexLexer, default, include, bygroups
23
+ from pygments.token import Comment, Keyword, Literal, Name, Number, Operator, \
24
+ Punctuation, String, Text, Whitespace
25
+
26
+ __all__ = ['SNBTLexer', 'MCFunctionLexer', 'MCSchemaLexer']
27
+
28
+
29
+ class SNBTLexer(RegexLexer):
30
+ """Lexer for stringified NBT, a data format used in Minecraft
31
+ """
32
+
33
+ name = "SNBT"
34
+ url = "https://minecraft.wiki/w/NBT_format"
35
+ aliases = ["snbt"]
36
+ filenames = ["*.snbt"]
37
+ mimetypes = ["text/snbt"]
38
+ version_added = '2.12'
39
+
40
+ tokens = {
41
+ "root": [
42
+ # We only look for the open bracket here since square bracket
43
+ # is only valid in NBT pathing (which is a mcfunction idea).
44
+ (r"\{", Punctuation, "compound"),
45
+ (r"[^\{]+", Text),
46
+ ],
47
+
48
+ "whitespace": [
49
+ (r"\s+", Whitespace),
50
+ ],
51
+
52
+ "operators": [
53
+ (r"[,:;]", Punctuation),
54
+ ],
55
+
56
+ "literals": [
57
+ (r"(true|false)", Keyword.Constant),
58
+ (r"-?\d+[eE]-?\d+", Number.Float),
59
+ (r"-?\d*\.\d+[fFdD]?", Number.Float),
60
+ (r"-?\d+[bBsSlLfFdD]?", Number.Integer),
61
+
62
+ # Separate states for both types of strings so they don't entangle
63
+ (r'"', String.Double, "literals.string_double"),
64
+ (r"'", String.Single, "literals.string_single"),
65
+ ],
66
+ "literals.string_double": [
67
+ (r"\\.", String.Escape),
68
+ (r'[^\\"\n]+', String.Double),
69
+ (r'"', String.Double, "#pop"),
70
+ ],
71
+ "literals.string_single": [
72
+ (r"\\.", String.Escape),
73
+ (r"[^\\'\n]+", String.Single),
74
+ (r"'", String.Single, "#pop"),
75
+ ],
76
+
77
+ "compound": [
78
+ # this handles the unquoted snbt keys
79
+ # note: stringified keys still work
80
+ (r"[A-Z_a-z]+", Name.Attribute),
81
+ include("operators"),
82
+ include("whitespace"),
83
+ include("literals"),
84
+ (r"\{", Punctuation, "#push"),
85
+ (r"\[", Punctuation, "list"),
86
+ (r"\}", Punctuation, "#pop"),
87
+ ],
88
+
89
+ "list": [
90
+ (r"[A-Z_a-z]+", Name.Attribute),
91
+ include("literals"),
92
+ include("operators"),
93
+ include("whitespace"),
94
+ (r"\[", Punctuation, "#push"),
95
+ (r"\{", Punctuation, "compound"),
96
+ (r"\]", Punctuation, "#pop"),
97
+ ],
98
+ }
99
+
100
+
101
+ class MCFunctionLexer(RegexLexer):
102
+ """Lexer for the mcfunction scripting language used in Minecraft.
103
+
104
+ Modelled somewhat after the `GitHub mcfunction grammar <https://github.com/Arcensoth/language-mcfunction>`_.
105
+ """
106
+
107
+ name = "MCFunction"
108
+ url = "https://minecraft.wiki/w/Commands"
109
+ aliases = ["mcfunction", "mcf"]
110
+ filenames = ["*.mcfunction"]
111
+ mimetypes = ["text/mcfunction"]
112
+ version_added = '2.12'
113
+
114
+ # Used to denotate the start of a block comment, borrowed from Github's mcfunction
115
+ _block_comment_prefix = "[>!]"
116
+
117
+ tokens = {
118
+ "root": [
119
+ include("names"),
120
+ include("comments"),
121
+ include("literals"),
122
+ include("whitespace"),
123
+ include("property"),
124
+ include("operators"),
125
+ include("selectors"),
126
+ ],
127
+
128
+ "names": [
129
+ # The start of a command (either beginning of line OR after the run keyword)
130
+ # We don't encode a list of keywords since mods, plugins, or even pre-processors
131
+ # may add new commands, so we have a 'close-enough' regex which catches them.
132
+ (r"^(\s*)([a-z_]+)", bygroups(Whitespace, Name.Builtin)),
133
+ (r"(?<=run)\s+[a-z_]+", Name.Builtin),
134
+
135
+ # UUID
136
+ (r"\b[0-9a-fA-F]+(?:-[0-9a-fA-F]+){4}\b", Name.Variable),
137
+ include("resource-name"),
138
+ # normal command names and scoreboards
139
+ # there's no way to know the differences unfortuntely
140
+ (r"[A-Za-z_][\w.#%$]+", Keyword.Constant),
141
+ (r"[#%$][\w.#%$]+", Name.Variable.Magic),
142
+ ],
143
+
144
+ "resource-name": [
145
+ # resource names have to be lowercase
146
+ (r"#?[a-z_][a-z_.-]*:[a-z0-9_./-]+", Name.Function),
147
+ # similar to above except optional `:``
148
+ # a `/` must be present "somewhere"
149
+ (r"#?[a-z0-9_\.\-]+\/[a-z0-9_\.\-\/]+", Name.Function),
150
+ ],
151
+
152
+ "whitespace": [
153
+ (r"\s+", Whitespace),
154
+ ],
155
+
156
+ "comments": [
157
+ (rf"^\s*(#{_block_comment_prefix})", Comment.Multiline,
158
+ ("comments.block", "comments.block.emphasized")),
159
+ (r"#.*$", Comment.Single),
160
+ ],
161
+ "comments.block": [
162
+ (rf"^\s*#{_block_comment_prefix}", Comment.Multiline,
163
+ "comments.block.emphasized"),
164
+ (r"^\s*#", Comment.Multiline, "comments.block.normal"),
165
+ default("#pop"),
166
+ ],
167
+ "comments.block.normal": [
168
+ include("comments.block.special"),
169
+ (r"\S+", Comment.Multiline),
170
+ (r"\n", Text, "#pop"),
171
+ include("whitespace"),
172
+ ],
173
+ "comments.block.emphasized": [
174
+ include("comments.block.special"),
175
+ (r"\S+", String.Doc),
176
+ (r"\n", Text, "#pop"),
177
+ include("whitespace"),
178
+ ],
179
+ "comments.block.special": [
180
+ # Params
181
+ (r"@\S+", Name.Decorator),
182
+
183
+ include("resource-name"),
184
+
185
+ # Scoreboard player names
186
+ (r"[#%$][\w.#%$]+", Name.Variable.Magic),
187
+ ],
188
+
189
+ "operators": [
190
+ (r"[\-~%^?!+*<>\\/|&=.]", Operator),
191
+ ],
192
+
193
+ "literals": [
194
+ (r"\.\.", Literal),
195
+ (r"(true|false)", Keyword.Pseudo),
196
+
197
+ # these are like unquoted strings and appear in many places
198
+ (r"[A-Za-z_]+", Name.Variable.Class),
199
+
200
+ (r"[0-7]b", Number.Byte),
201
+ (r"[+-]?\d*\.?\d+([eE]?[+-]?\d+)?[df]?\b", Number.Float),
202
+ (r"[+-]?\d+\b", Number.Integer),
203
+ (r'"', String.Double, "literals.string-double"),
204
+ (r"'", String.Single, "literals.string-single"),
205
+ ],
206
+ "literals.string-double": [
207
+ (r"\\.", String.Escape),
208
+ (r'[^\\"\n]+', String.Double),
209
+ (r'"', String.Double, "#pop"),
210
+ ],
211
+ "literals.string-single": [
212
+ (r"\\.", String.Escape),
213
+ (r"[^\\'\n]+", String.Single),
214
+ (r"'", String.Single, "#pop"),
215
+ ],
216
+
217
+ "selectors": [
218
+ (r"@[a-z]", Name.Variable),
219
+ ],
220
+
221
+
222
+ ## Generic Property Container
223
+ # There are several, differing instances where the language accepts
224
+ # specific contained keys or contained key, value pairings.
225
+ #
226
+ # Property Maps:
227
+ # - Starts with either `[` or `{`
228
+ # - Key separated by `:` or `=`
229
+ # - Deliminated by `,`
230
+ #
231
+ # Property Lists:
232
+ # - Starts with `[`
233
+ # - Deliminated by `,`
234
+ #
235
+ # For simplicity, these patterns match a generic, nestable structure
236
+ # which follow a key, value pattern. For normal lists, there's only keys.
237
+ # This allow some "illegal" structures, but we'll accept those for
238
+ # sake of simplicity
239
+ #
240
+ # Examples:
241
+ # - `[facing=up, powered=true]` (blockstate)
242
+ # - `[name="hello world", nbt={key: 1b}]` (selector + nbt)
243
+ # - `[{"text": "value"}, "literal"]` (json)
244
+ ##
245
+ "property": [
246
+ # This state gets included in root and also several substates
247
+ # We do this to shortcut the starting of new properties
248
+ # within other properties. Lists can have sublists and compounds
249
+ # and values can start a new property (see the `difficult_1.txt`
250
+ # snippet).
251
+ (r"\{", Punctuation, ("property.curly", "property.key")),
252
+ (r"\[", Punctuation, ("property.square", "property.key")),
253
+ ],
254
+ "property.curly": [
255
+ include("whitespace"),
256
+ include("property"),
257
+ (r"\}", Punctuation, "#pop"),
258
+ ],
259
+ "property.square": [
260
+ include("whitespace"),
261
+ include("property"),
262
+ (r"\]", Punctuation, "#pop"),
263
+
264
+ # lists can have sequences of items
265
+ (r",", Punctuation),
266
+ ],
267
+ "property.key": [
268
+ include("whitespace"),
269
+
270
+ # resource names (for advancements)
271
+ # can omit `:` to default `minecraft:`
272
+ # must check if there is a future equals sign if `:` is in the name
273
+ (r"#?[a-z_][a-z_\.\-]*\:[a-z0-9_\.\-/]+(?=\s*\=)", Name.Attribute, "property.delimiter"),
274
+ (r"#?[a-z_][a-z0-9_\.\-/]+", Name.Attribute, "property.delimiter"),
275
+
276
+ # unquoted NBT key
277
+ (r"[A-Za-z_\-\+]+", Name.Attribute, "property.delimiter"),
278
+
279
+ # quoted JSON or NBT key
280
+ (r'"', Name.Attribute, "property.delimiter", "literals.string-double"),
281
+ (r"'", Name.Attribute, "property.delimiter", "literals.string-single"),
282
+
283
+ # index for a list
284
+ (r"-?\d+", Number.Integer, "property.delimiter"),
285
+
286
+ default("#pop"),
287
+ ],
288
+ "property.key.string-double": [
289
+ (r"\\.", String.Escape),
290
+ (r'[^\\"\n]+', Name.Attribute),
291
+ (r'"', Name.Attribute, "#pop"),
292
+ ],
293
+ "property.key.string-single": [
294
+ (r"\\.", String.Escape),
295
+ (r"[^\\'\n]+", Name.Attribute),
296
+ (r"'", Name.Attribute, "#pop"),
297
+ ],
298
+ "property.delimiter": [
299
+ include("whitespace"),
300
+
301
+ (r"[:=]!?", Punctuation, "property.value"),
302
+ (r",", Punctuation),
303
+
304
+ default("#pop"),
305
+ ],
306
+ "property.value": [
307
+ include("whitespace"),
308
+
309
+ # unquoted resource names are valid literals here
310
+ (r"#?[a-z_][a-z_\.\-]*\:[a-z0-9_\.\-/]+", Name.Tag),
311
+ (r"#?[a-z_][a-z0-9_\.\-/]+", Name.Tag),
312
+
313
+ include("literals"),
314
+ include("property"),
315
+
316
+ default("#pop"),
317
+ ],
318
+ }
319
+
320
+
321
+ class MCSchemaLexer(RegexLexer):
322
+ """Lexer for Minecraft Add-ons data Schemas, an interface structure standard used in Minecraft
323
+ """
324
+
325
+ name = 'MCSchema'
326
+ url = 'https://learn.microsoft.com/en-us/minecraft/creator/reference/content/schemasreference/'
327
+ aliases = ['mcschema']
328
+ filenames = ['*.mcschema']
329
+ mimetypes = ['text/mcschema']
330
+ version_added = '2.14'
331
+
332
+ tokens = {
333
+ 'commentsandwhitespace': [
334
+ (r'\s+', Whitespace),
335
+ (r'//.*?$', Comment.Single),
336
+ (r'/\*.*?\*/', Comment.Multiline)
337
+ ],
338
+ 'slashstartsregex': [
339
+ include('commentsandwhitespace'),
340
+ (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
341
+ r'([gimuysd]+\b|\B)', String.Regex, '#pop'),
342
+ (r'(?=/)', Text, ('#pop', 'badregex')),
343
+ default('#pop')
344
+ ],
345
+ 'badregex': [
346
+ (r'\n', Whitespace, '#pop')
347
+ ],
348
+ 'singlestring': [
349
+ (r'\\.', String.Escape),
350
+ (r"'", String.Single, '#pop'),
351
+ (r"[^\\']+", String.Single),
352
+ ],
353
+ 'doublestring': [
354
+ (r'\\.', String.Escape),
355
+ (r'"', String.Double, '#pop'),
356
+ (r'[^\\"]+', String.Double),
357
+ ],
358
+ 'root': [
359
+ (r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
360
+ include('commentsandwhitespace'),
361
+
362
+ # keywords for optional word and field types
363
+ (r'(?<=: )opt', Operator.Word),
364
+ (r'(?<=\s)[\w-]*(?=(\s+"|\n))', Keyword.Declaration),
365
+
366
+ # numeric literals
367
+ (r'0[bB][01]+', Number.Bin),
368
+ (r'0[oO]?[0-7]+', Number.Oct),
369
+ (r'0[xX][0-9a-fA-F]+', Number.Hex),
370
+ (r'\d+', Number.Integer),
371
+ (r'(\.\d+|\d+\.\d*|\d+)([eE][-+]?\d+)?', Number.Float),
372
+
373
+ # possible punctuations
374
+ (r'\.\.\.|=>', Punctuation),
375
+ (r'\+\+|--|~|\?\?=?|\?|:|\\(?=\n)|'
376
+ r'(<<|>>>?|==?|!=?|(?:\*\*|\|\||&&|[-<>+*%&|^/]))=?', Operator, 'slashstartsregex'),
377
+ (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
378
+ (r'[})\].]', Punctuation),
379
+
380
+ # strings
381
+ (r"'", String.Single, 'singlestring'),
382
+ (r'"', String.Double, 'doublestring'),
383
+
384
+ # title line
385
+ (r'[\w-]*?(?=:\{?\n)', String.Symbol),
386
+ # title line with a version code, formatted
387
+ # `major.minor.patch-prerelease+buildmeta`
388
+ (r'([\w-]*?)(:)(\d+)(?:(\.)(\d+)(?:(\.)(\d+)(?:(\-)((?:[^\W_]|-)*(?:\.(?:[^\W_]|-)*)*))?(?:(\+)((?:[^\W_]|-)+(?:\.(?:[^\W_]|-)+)*))?)?)?(?=:\{?\n)', bygroups(String.Symbol, Operator, Number.Integer, Operator, Number.Integer, Operator, Number.Integer, Operator, String, Operator, String)),
389
+
390
+ (r'.*\n', Text),
391
+ ]
392
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/mips.py ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.mips
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for MIPS assembly.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words
12
+ from pygments.token import Whitespace, Comment, String, Keyword, Name, Text
13
+
14
+ __all__ = ["MIPSLexer"]
15
+
16
+
17
+ class MIPSLexer(RegexLexer):
18
+ """
19
+ A MIPS Assembly Lexer.
20
+
21
+ Based on the Emacs major mode by hlissner:
22
+ https://github.com/hlissner/emacs-mips-mode
23
+ """
24
+
25
+ name = 'MIPS'
26
+ aliases = ['mips']
27
+ version_added = ''
28
+ # TODO: add '*.s' and '*.asm', which will require designing an analyse_text
29
+ # method for this lexer and refactoring those from Gas and Nasm in order to
30
+ # have relatively reliable detection
31
+ filenames = ['*.mips', '*.MIPS']
32
+ url = 'https://mips.com'
33
+
34
+ keywords = [
35
+ # Arithmetic insturctions
36
+ "add", "sub", "subu", "addi", "subi", "addu", "addiu",
37
+ # Multiplication/division
38
+ "mul", "mult", "multu", "mulu", "madd", "maddu", "msub", "msubu", "div", "divu",
39
+ # Bitwise operations
40
+ "and", "or", "nor", "xor", "andi", "ori", "xori", "clo", "clz",
41
+ # Shifts
42
+ "sll", "srl", "sllv", "srlv", "sra", "srav",
43
+ # Comparisons
44
+ "slt", "sltu", "slti", "sltiu",
45
+ # Move data
46
+ "mfhi", "mthi", "mflo", "mtlo", "movn", "movz", "movf", "movt",
47
+ # Jump
48
+ "j", "jal", "jalr", "jr",
49
+ # branch
50
+ "bc1f", "bc1t", "beq", "bgez", "bgezal", "bgtz", "blez", "bltzal", "bltz", "bne",
51
+ # Load
52
+ "lui", "lb", "lbu", "lh", "lhu", "lw", "lwcl", "lwl", "lwr",
53
+ # Store
54
+ "sb", "sh", "sw", "swl", "swr", # coproc: swc1 sdc1
55
+ # Concurrent load/store
56
+ "ll", "sc",
57
+ # Trap handling
58
+ "teq", "teqi", "tne", "tneqi", "tge", "tgeu", "tgei", "tgeiu", "tlt", "tltu", "tlti",
59
+ "tltiu",
60
+ # Exception / Interrupt
61
+ "eret", "break", "bop", "syscall",
62
+ # --- Floats -----------------------------------------------------
63
+ # Arithmetic
64
+ "add.s", "add.d", "sub.s", "sub.d", "mul.s", "mul.d", "div.s", "div.d", "neg.d",
65
+ "neg.s",
66
+ # Comparison
67
+ "c.e.d", "c.e.s", "c.le.d", "c.le.s", "c.lt.s", "c.lt.d", # "c.gt.s", "c.gt.d",
68
+ "madd.s", "madd.d", "msub.s", "msub.d",
69
+ # Move Floats
70
+ "mov.d", "move.s", "movf.d", "movf.s", "movt.d", "movt.s", "movn.d", "movn.s",
71
+ "movnzd", "movz.s", "movz.d",
72
+ # Conversion
73
+ "cvt.d.s", "cvt.d.w", "cvt.s.d", "cvt.s.w", "cvt.w.d", "cvt.w.s", "trunc.w.d",
74
+ "trunc.w.s",
75
+ # Math
76
+ "abs.s", "abs.d", "sqrt.s", "sqrt.d", "ceil.w.d", "ceil.w.s", "floor.w.d",
77
+ "floor.w.s", "round.w.d", "round.w.s",
78
+ ]
79
+
80
+ pseudoinstructions = [
81
+ # Arithmetic & logical
82
+ "rem", "remu", "mulo", "mulou", "abs", "neg", "negu", "not", "rol", "ror",
83
+ # branches
84
+ "b", "beqz", "bge", "bgeu", "bgt", "bgtu", "ble", "bleu", "blt", "bltu", "bnez",
85
+ # loads
86
+ "la", "li", "ld", "ulh", "ulhu", "ulw",
87
+ # Store
88
+ "sd", "ush", "usw",
89
+ # move
90
+ "move", # coproc: "mfc1.d",
91
+ # comparisons
92
+ "sgt", "sgtu", "sge", "sgeu", "sle", "sleu", "sne", "seq",
93
+ # --- Floats -----------------------------------------------------
94
+ # load-store
95
+ "l.d", "l.s", "s.d", "s.s",
96
+ ]
97
+
98
+ directives = [
99
+ ".align", ".ascii", ".asciiz", ".byte", ".data", ".double", ".extern", ".float",
100
+ ".globl", ".half", ".kdata", ".ktext", ".space", ".text", ".word",
101
+ ]
102
+
103
+ deprecated = [
104
+ "beql", "bnel", "bgtzl", "bgezl", "bltzl", "blezl", "bltzall", "bgezall",
105
+ ]
106
+
107
+ tokens = {
108
+ 'root': [
109
+ (r'\s+', Whitespace),
110
+ (r'#.*', Comment),
111
+ (r'"', String, 'string'),
112
+ (r'-?[0-9]+?', Keyword.Constant),
113
+ (r'\w*:', Name.Function),
114
+ (words(deprecated, suffix=r'\b'), Keyword.Pseudo), # need warning face
115
+ (words(pseudoinstructions, suffix=r'\b'), Name.Variable),
116
+ (words(keywords, suffix=r'\b'), Keyword),
117
+ (r'[slm][ftwd]c[0-9]([.]d)?', Keyword),
118
+ (r'\$(f?[0-2][0-9]|f?3[01]|[ft]?[0-9]|[vk][01]|a[0-3]|s[0-7]|[gsf]p|ra|at|zero)',
119
+ Keyword.Type),
120
+ (words(directives, suffix=r'\b'), Name.Entity), # Preprocessor?
121
+ (r':|,|;|\{|\}|=>|@|\$|=', Name.Builtin),
122
+ (r'\w+', Text),
123
+ (r'.', Text),
124
+ ],
125
+ 'string': [
126
+ (r'\\.', String.Escape),
127
+ (r'"', String, '#pop'),
128
+ (r'[^\\"]+', String),
129
+ ],
130
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/ml.py ADDED
@@ -0,0 +1,958 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ml
3
+ ~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for ML family languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups, default, words
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Error
16
+
17
+ __all__ = ['SMLLexer', 'OcamlLexer', 'OpaLexer', 'ReasonLexer', 'FStarLexer']
18
+
19
+
20
+ class SMLLexer(RegexLexer):
21
+ """
22
+ For the Standard ML language.
23
+ """
24
+
25
+ name = 'Standard ML'
26
+ aliases = ['sml']
27
+ filenames = ['*.sml', '*.sig', '*.fun']
28
+ mimetypes = ['text/x-standardml', 'application/x-standardml']
29
+ url = 'https://en.wikipedia.org/wiki/Standard_ML'
30
+ version_added = '1.5'
31
+
32
+ alphanumid_reserved = {
33
+ # Core
34
+ 'abstype', 'and', 'andalso', 'as', 'case', 'datatype', 'do', 'else',
35
+ 'end', 'exception', 'fn', 'fun', 'handle', 'if', 'in', 'infix',
36
+ 'infixr', 'let', 'local', 'nonfix', 'of', 'op', 'open', 'orelse',
37
+ 'raise', 'rec', 'then', 'type', 'val', 'with', 'withtype', 'while',
38
+ # Modules
39
+ 'eqtype', 'functor', 'include', 'sharing', 'sig', 'signature',
40
+ 'struct', 'structure', 'where',
41
+ }
42
+
43
+ symbolicid_reserved = {
44
+ # Core
45
+ ':', r'\|', '=', '=>', '->', '#',
46
+ # Modules
47
+ ':>',
48
+ }
49
+
50
+ nonid_reserved = {'(', ')', '[', ']', '{', '}', ',', ';', '...', '_'}
51
+
52
+ alphanumid_re = r"[a-zA-Z][\w']*"
53
+ symbolicid_re = r"[!%&$#+\-/:<=>?@\\~`^|*]+"
54
+
55
+ # A character constant is a sequence of the form #s, where s is a string
56
+ # constant denoting a string of size one character. This setup just parses
57
+ # the entire string as either a String.Double or a String.Char (depending
58
+ # on the argument), even if the String.Char is an erroneous
59
+ # multiple-character string.
60
+ def stringy(whatkind):
61
+ return [
62
+ (r'[^"\\]', whatkind),
63
+ (r'\\[\\"abtnvfr]', String.Escape),
64
+ # Control-character notation is used for codes < 32,
65
+ # where \^@ == \000
66
+ (r'\\\^[\x40-\x5e]', String.Escape),
67
+ # Docs say 'decimal digits'
68
+ (r'\\[0-9]{3}', String.Escape),
69
+ (r'\\u[0-9a-fA-F]{4}', String.Escape),
70
+ (r'\\\s+\\', String.Interpol),
71
+ (r'"', whatkind, '#pop'),
72
+ ]
73
+
74
+ # Callbacks for distinguishing tokens and reserved words
75
+ def long_id_callback(self, match):
76
+ if match.group(1) in self.alphanumid_reserved:
77
+ token = Error
78
+ else:
79
+ token = Name.Namespace
80
+ yield match.start(1), token, match.group(1)
81
+ yield match.start(2), Punctuation, match.group(2)
82
+
83
+ def end_id_callback(self, match):
84
+ if match.group(1) in self.alphanumid_reserved:
85
+ token = Error
86
+ elif match.group(1) in self.symbolicid_reserved:
87
+ token = Error
88
+ else:
89
+ token = Name
90
+ yield match.start(1), token, match.group(1)
91
+
92
+ def id_callback(self, match):
93
+ str = match.group(1)
94
+ if str in self.alphanumid_reserved:
95
+ token = Keyword.Reserved
96
+ elif str in self.symbolicid_reserved:
97
+ token = Punctuation
98
+ else:
99
+ token = Name
100
+ yield match.start(1), token, str
101
+
102
+ tokens = {
103
+ # Whitespace and comments are (almost) everywhere
104
+ 'whitespace': [
105
+ (r'\s+', Text),
106
+ (r'\(\*', Comment.Multiline, 'comment'),
107
+ ],
108
+
109
+ 'delimiters': [
110
+ # This lexer treats these delimiters specially:
111
+ # Delimiters define scopes, and the scope is how the meaning of
112
+ # the `|' is resolved - is it a case/handle expression, or function
113
+ # definition by cases? (This is not how the Definition works, but
114
+ # it's how MLton behaves, see http://mlton.org/SMLNJDeviations)
115
+ (r'\(|\[|\{', Punctuation, 'main'),
116
+ (r'\)|\]|\}', Punctuation, '#pop'),
117
+ (r'\b(let|if|local)\b(?!\')', Keyword.Reserved, ('main', 'main')),
118
+ (r'\b(struct|sig|while)\b(?!\')', Keyword.Reserved, 'main'),
119
+ (r'\b(do|else|end|in|then)\b(?!\')', Keyword.Reserved, '#pop'),
120
+ ],
121
+
122
+ 'core': [
123
+ # Punctuation that doesn't overlap symbolic identifiers
124
+ (r'({})'.format('|'.join(re.escape(z) for z in nonid_reserved)),
125
+ Punctuation),
126
+
127
+ # Special constants: strings, floats, numbers in decimal and hex
128
+ (r'#"', String.Char, 'char'),
129
+ (r'"', String.Double, 'string'),
130
+ (r'~?0x[0-9a-fA-F]+', Number.Hex),
131
+ (r'0wx[0-9a-fA-F]+', Number.Hex),
132
+ (r'0w\d+', Number.Integer),
133
+ (r'~?\d+\.\d+[eE]~?\d+', Number.Float),
134
+ (r'~?\d+\.\d+', Number.Float),
135
+ (r'~?\d+[eE]~?\d+', Number.Float),
136
+ (r'~?\d+', Number.Integer),
137
+
138
+ # Labels
139
+ (r'#\s*[1-9][0-9]*', Name.Label),
140
+ (rf'#\s*({alphanumid_re})', Name.Label),
141
+ (rf'#\s+({symbolicid_re})', Name.Label),
142
+ # Some reserved words trigger a special, local lexer state change
143
+ (r'\b(datatype|abstype)\b(?!\')', Keyword.Reserved, 'dname'),
144
+ (r'\b(exception)\b(?!\')', Keyword.Reserved, 'ename'),
145
+ (r'\b(functor|include|open|signature|structure)\b(?!\')',
146
+ Keyword.Reserved, 'sname'),
147
+ (r'\b(type|eqtype)\b(?!\')', Keyword.Reserved, 'tname'),
148
+
149
+ # Regular identifiers, long and otherwise
150
+ (r'\'[\w\']*', Name.Decorator),
151
+ (rf'({alphanumid_re})(\.)', long_id_callback, "dotted"),
152
+ (rf'({alphanumid_re})', id_callback),
153
+ (rf'({symbolicid_re})', id_callback),
154
+ ],
155
+ 'dotted': [
156
+ (rf'({alphanumid_re})(\.)', long_id_callback),
157
+ (rf'({alphanumid_re})', end_id_callback, "#pop"),
158
+ (rf'({symbolicid_re})', end_id_callback, "#pop"),
159
+ (r'\s+', Error),
160
+ (r'\S+', Error),
161
+ ],
162
+
163
+
164
+ # Main parser (prevents errors in files that have scoping errors)
165
+ 'root': [
166
+ default('main')
167
+ ],
168
+
169
+ # In this scope, I expect '|' to not be followed by a function name,
170
+ # and I expect 'and' to be followed by a binding site
171
+ 'main': [
172
+ include('whitespace'),
173
+
174
+ # Special behavior of val/and/fun
175
+ (r'\b(val|and)\b(?!\')', Keyword.Reserved, 'vname'),
176
+ (r'\b(fun)\b(?!\')', Keyword.Reserved,
177
+ ('#pop', 'main-fun', 'fname')),
178
+
179
+ include('delimiters'),
180
+ include('core'),
181
+ (r'\S+', Error),
182
+ ],
183
+
184
+ # In this scope, I expect '|' and 'and' to be followed by a function
185
+ 'main-fun': [
186
+ include('whitespace'),
187
+
188
+ (r'\s', Text),
189
+ (r'\(\*', Comment.Multiline, 'comment'),
190
+
191
+ # Special behavior of val/and/fun
192
+ (r'\b(fun|and)\b(?!\')', Keyword.Reserved, 'fname'),
193
+ (r'\b(val)\b(?!\')', Keyword.Reserved,
194
+ ('#pop', 'main', 'vname')),
195
+
196
+ # Special behavior of '|' and '|'-manipulating keywords
197
+ (r'\|', Punctuation, 'fname'),
198
+ (r'\b(case|handle)\b(?!\')', Keyword.Reserved,
199
+ ('#pop', 'main')),
200
+
201
+ include('delimiters'),
202
+ include('core'),
203
+ (r'\S+', Error),
204
+ ],
205
+
206
+ # Character and string parsers
207
+ 'char': stringy(String.Char),
208
+ 'string': stringy(String.Double),
209
+
210
+ 'breakout': [
211
+ (r'(?=\b({})\b(?!\'))'.format('|'.join(alphanumid_reserved)), Text, '#pop'),
212
+ ],
213
+
214
+ # Dealing with what comes after module system keywords
215
+ 'sname': [
216
+ include('whitespace'),
217
+ include('breakout'),
218
+
219
+ (rf'({alphanumid_re})', Name.Namespace),
220
+ default('#pop'),
221
+ ],
222
+
223
+ # Dealing with what comes after the 'fun' (or 'and' or '|') keyword
224
+ 'fname': [
225
+ include('whitespace'),
226
+ (r'\'[\w\']*', Name.Decorator),
227
+ (r'\(', Punctuation, 'tyvarseq'),
228
+
229
+ (rf'({alphanumid_re})', Name.Function, '#pop'),
230
+ (rf'({symbolicid_re})', Name.Function, '#pop'),
231
+
232
+ # Ignore interesting function declarations like "fun (x + y) = ..."
233
+ default('#pop'),
234
+ ],
235
+
236
+ # Dealing with what comes after the 'val' (or 'and') keyword
237
+ 'vname': [
238
+ include('whitespace'),
239
+ (r'\'[\w\']*', Name.Decorator),
240
+ (r'\(', Punctuation, 'tyvarseq'),
241
+
242
+ (rf'({alphanumid_re})(\s*)(=(?!{symbolicid_re}))',
243
+ bygroups(Name.Variable, Text, Punctuation), '#pop'),
244
+ (rf'({symbolicid_re})(\s*)(=(?!{symbolicid_re}))',
245
+ bygroups(Name.Variable, Text, Punctuation), '#pop'),
246
+ (rf'({alphanumid_re})', Name.Variable, '#pop'),
247
+ (rf'({symbolicid_re})', Name.Variable, '#pop'),
248
+
249
+ # Ignore interesting patterns like 'val (x, y)'
250
+ default('#pop'),
251
+ ],
252
+
253
+ # Dealing with what comes after the 'type' (or 'and') keyword
254
+ 'tname': [
255
+ include('whitespace'),
256
+ include('breakout'),
257
+
258
+ (r'\'[\w\']*', Name.Decorator),
259
+ (r'\(', Punctuation, 'tyvarseq'),
260
+ (rf'=(?!{symbolicid_re})', Punctuation, ('#pop', 'typbind')),
261
+
262
+ (rf'({alphanumid_re})', Keyword.Type),
263
+ (rf'({symbolicid_re})', Keyword.Type),
264
+ (r'\S+', Error, '#pop'),
265
+ ],
266
+
267
+ # A type binding includes most identifiers
268
+ 'typbind': [
269
+ include('whitespace'),
270
+
271
+ (r'\b(and)\b(?!\')', Keyword.Reserved, ('#pop', 'tname')),
272
+
273
+ include('breakout'),
274
+ include('core'),
275
+ (r'\S+', Error, '#pop'),
276
+ ],
277
+
278
+ # Dealing with what comes after the 'datatype' (or 'and') keyword
279
+ 'dname': [
280
+ include('whitespace'),
281
+ include('breakout'),
282
+
283
+ (r'\'[\w\']*', Name.Decorator),
284
+ (r'\(', Punctuation, 'tyvarseq'),
285
+ (r'(=)(\s*)(datatype)',
286
+ bygroups(Punctuation, Text, Keyword.Reserved), '#pop'),
287
+ (rf'=(?!{symbolicid_re})', Punctuation,
288
+ ('#pop', 'datbind', 'datcon')),
289
+
290
+ (rf'({alphanumid_re})', Keyword.Type),
291
+ (rf'({symbolicid_re})', Keyword.Type),
292
+ (r'\S+', Error, '#pop'),
293
+ ],
294
+
295
+ # common case - A | B | C of int
296
+ 'datbind': [
297
+ include('whitespace'),
298
+
299
+ (r'\b(and)\b(?!\')', Keyword.Reserved, ('#pop', 'dname')),
300
+ (r'\b(withtype)\b(?!\')', Keyword.Reserved, ('#pop', 'tname')),
301
+ (r'\b(of)\b(?!\')', Keyword.Reserved),
302
+
303
+ (rf'(\|)(\s*)({alphanumid_re})',
304
+ bygroups(Punctuation, Text, Name.Class)),
305
+ (rf'(\|)(\s+)({symbolicid_re})',
306
+ bygroups(Punctuation, Text, Name.Class)),
307
+
308
+ include('breakout'),
309
+ include('core'),
310
+ (r'\S+', Error),
311
+ ],
312
+
313
+ # Dealing with what comes after an exception
314
+ 'ename': [
315
+ include('whitespace'),
316
+
317
+ (rf'(and\b)(\s+)({alphanumid_re})',
318
+ bygroups(Keyword.Reserved, Text, Name.Class)),
319
+ (rf'(and\b)(\s*)({symbolicid_re})',
320
+ bygroups(Keyword.Reserved, Text, Name.Class)),
321
+ (r'\b(of)\b(?!\')', Keyword.Reserved),
322
+ (rf'({alphanumid_re})|({symbolicid_re})', Name.Class),
323
+
324
+ default('#pop'),
325
+ ],
326
+
327
+ 'datcon': [
328
+ include('whitespace'),
329
+ (rf'({alphanumid_re})', Name.Class, '#pop'),
330
+ (rf'({symbolicid_re})', Name.Class, '#pop'),
331
+ (r'\S+', Error, '#pop'),
332
+ ],
333
+
334
+ # Series of type variables
335
+ 'tyvarseq': [
336
+ (r'\s', Text),
337
+ (r'\(\*', Comment.Multiline, 'comment'),
338
+
339
+ (r'\'[\w\']*', Name.Decorator),
340
+ (alphanumid_re, Name),
341
+ (r',', Punctuation),
342
+ (r'\)', Punctuation, '#pop'),
343
+ (symbolicid_re, Name),
344
+ ],
345
+
346
+ 'comment': [
347
+ (r'[^(*)]', Comment.Multiline),
348
+ (r'\(\*', Comment.Multiline, '#push'),
349
+ (r'\*\)', Comment.Multiline, '#pop'),
350
+ (r'[(*)]', Comment.Multiline),
351
+ ],
352
+ }
353
+
354
+
355
+ class OcamlLexer(RegexLexer):
356
+ """
357
+ For the OCaml language.
358
+ """
359
+
360
+ name = 'OCaml'
361
+ url = 'https://ocaml.org/'
362
+ aliases = ['ocaml']
363
+ filenames = ['*.ml', '*.mli', '*.mll', '*.mly']
364
+ mimetypes = ['text/x-ocaml']
365
+ version_added = '0.7'
366
+
367
+ keywords = (
368
+ 'and', 'as', 'assert', 'begin', 'class', 'constraint', 'do', 'done',
369
+ 'downto', 'else', 'end', 'exception', 'external', 'false',
370
+ 'for', 'fun', 'function', 'functor', 'if', 'in', 'include',
371
+ 'inherit', 'initializer', 'lazy', 'let', 'match', 'method',
372
+ 'module', 'mutable', 'new', 'object', 'of', 'open', 'private',
373
+ 'raise', 'rec', 'sig', 'struct', 'then', 'to', 'true', 'try',
374
+ 'type', 'val', 'virtual', 'when', 'while', 'with',
375
+ )
376
+ keyopts = (
377
+ '!=', '#', '&', '&&', r'\(', r'\)', r'\*', r'\+', ',', '-',
378
+ r'-\.', '->', r'\.', r'\.\.', ':', '::', ':=', ':>', ';', ';;', '<',
379
+ '<-', '=', '>', '>]', r'>\}', r'\?', r'\?\?', r'\[', r'\[<', r'\[>',
380
+ r'\[\|', ']', '_', '`', r'\{', r'\{<', r'\|', r'\|]', r'\}', '~'
381
+ )
382
+
383
+ operators = r'[!$%&*+\./:<=>?@^|~-]'
384
+ word_operators = ('asr', 'land', 'lor', 'lsl', 'lxor', 'mod', 'or')
385
+ prefix_syms = r'[!?~]'
386
+ infix_syms = r'[=<>@^|&+\*/$%-]'
387
+ primitives = ('unit', 'int', 'float', 'bool', 'string', 'char', 'list', 'array')
388
+
389
+ tokens = {
390
+ 'escape-sequence': [
391
+ (r'\\[\\"\'ntbr]', String.Escape),
392
+ (r'\\[0-9]{3}', String.Escape),
393
+ (r'\\x[0-9a-fA-F]{2}', String.Escape),
394
+ ],
395
+ 'root': [
396
+ (r'\s+', Text),
397
+ (r'false|true|\(\)|\[\]', Name.Builtin.Pseudo),
398
+ (r'\b([A-Z][\w\']*)(?=\s*\.)', Name.Namespace, 'dotted'),
399
+ (r'\b([A-Z][\w\']*)', Name.Class),
400
+ (r'\(\*(?![)])', Comment, 'comment'),
401
+ (r'\b({})\b'.format('|'.join(keywords)), Keyword),
402
+ (r'({})'.format('|'.join(keyopts[::-1])), Operator),
403
+ (rf'({infix_syms}|{prefix_syms})?{operators}', Operator),
404
+ (r'\b({})\b'.format('|'.join(word_operators)), Operator.Word),
405
+ (r'\b({})\b'.format('|'.join(primitives)), Keyword.Type),
406
+
407
+ (r"[^\W\d][\w']*", Name),
408
+
409
+ (r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float),
410
+ (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
411
+ (r'0[oO][0-7][0-7_]*', Number.Oct),
412
+ (r'0[bB][01][01_]*', Number.Bin),
413
+ (r'\d[\d_]*', Number.Integer),
414
+
415
+ (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'",
416
+ String.Char),
417
+ (r"'.'", String.Char),
418
+ (r"'", Keyword), # a stray quote is another syntax element
419
+
420
+ (r'"', String.Double, 'string'),
421
+
422
+ (r'[~?][a-z][\w\']*:', Name.Variable),
423
+ ],
424
+ 'comment': [
425
+ (r'[^(*)]+', Comment),
426
+ (r'\(\*', Comment, '#push'),
427
+ (r'\*\)', Comment, '#pop'),
428
+ (r'[(*)]', Comment),
429
+ ],
430
+ 'string': [
431
+ (r'[^\\"]+', String.Double),
432
+ include('escape-sequence'),
433
+ (r'\\\n', String.Double),
434
+ (r'"', String.Double, '#pop'),
435
+ ],
436
+ 'dotted': [
437
+ (r'\s+', Text),
438
+ (r'\.', Punctuation),
439
+ (r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
440
+ (r'[A-Z][\w\']*', Name.Class, '#pop'),
441
+ (r'[a-z_][\w\']*', Name, '#pop'),
442
+ default('#pop'),
443
+ ],
444
+ }
445
+
446
+
447
+ class OpaLexer(RegexLexer):
448
+ """
449
+ Lexer for the Opa language.
450
+ """
451
+
452
+ name = 'Opa'
453
+ aliases = ['opa']
454
+ filenames = ['*.opa']
455
+ mimetypes = ['text/x-opa']
456
+ url = 'http://opalang.org'
457
+ version_added = '1.5'
458
+
459
+ # most of these aren't strictly keywords
460
+ # but if you color only real keywords, you might just
461
+ # as well not color anything
462
+ keywords = (
463
+ 'and', 'as', 'begin', 'case', 'client', 'css', 'database', 'db', 'do',
464
+ 'else', 'end', 'external', 'forall', 'function', 'if', 'import',
465
+ 'match', 'module', 'or', 'package', 'parser', 'rec', 'server', 'then',
466
+ 'type', 'val', 'with', 'xml_parser',
467
+ )
468
+
469
+ # matches both stuff and `stuff`
470
+ ident_re = r'(([a-zA-Z_]\w*)|(`[^`]*`))'
471
+
472
+ op_re = r'[.=\-<>,@~%/+?*&^!]'
473
+ punc_re = r'[()\[\],;|]' # '{' and '}' are treated elsewhere
474
+ # because they are also used for inserts
475
+
476
+ tokens = {
477
+ # copied from the caml lexer, should be adapted
478
+ 'escape-sequence': [
479
+ (r'\\[\\"\'ntr}]', String.Escape),
480
+ (r'\\[0-9]{3}', String.Escape),
481
+ (r'\\x[0-9a-fA-F]{2}', String.Escape),
482
+ ],
483
+
484
+ # factorizing these rules, because they are inserted many times
485
+ 'comments': [
486
+ (r'/\*', Comment, 'nested-comment'),
487
+ (r'//.*?$', Comment),
488
+ ],
489
+ 'comments-and-spaces': [
490
+ include('comments'),
491
+ (r'\s+', Text),
492
+ ],
493
+
494
+ 'root': [
495
+ include('comments-and-spaces'),
496
+ # keywords
497
+ (words(keywords, prefix=r'\b', suffix=r'\b'), Keyword),
498
+ # directives
499
+ # we could parse the actual set of directives instead of anything
500
+ # starting with @, but this is troublesome
501
+ # because it needs to be adjusted all the time
502
+ # and assuming we parse only sources that compile, it is useless
503
+ (r'@' + ident_re + r'\b', Name.Builtin.Pseudo),
504
+
505
+ # number literals
506
+ (r'-?.[\d]+([eE][+\-]?\d+)', Number.Float),
507
+ (r'-?\d+.\d*([eE][+\-]?\d+)', Number.Float),
508
+ (r'-?\d+[eE][+\-]?\d+', Number.Float),
509
+ (r'0[xX][\da-fA-F]+', Number.Hex),
510
+ (r'0[oO][0-7]+', Number.Oct),
511
+ (r'0[bB][01]+', Number.Bin),
512
+ (r'\d+', Number.Integer),
513
+ # color literals
514
+ (r'#[\da-fA-F]{3,6}', Number.Integer),
515
+
516
+ # string literals
517
+ (r'"', String.Double, 'string'),
518
+ # char literal, should be checked because this is the regexp from
519
+ # the caml lexer
520
+ (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2})|.)'",
521
+ String.Char),
522
+
523
+ # this is meant to deal with embedded exprs in strings
524
+ # every time we find a '}' we pop a state so that if we were
525
+ # inside a string, we are back in the string state
526
+ # as a consequence, we must also push a state every time we find a
527
+ # '{' or else we will have errors when parsing {} for instance
528
+ (r'\{', Operator, '#push'),
529
+ (r'\}', Operator, '#pop'),
530
+
531
+ # html literals
532
+ # this is a much more strict that the actual parser,
533
+ # since a<b would not be parsed as html
534
+ # but then again, the parser is way too lax, and we can't hope
535
+ # to have something as tolerant
536
+ (r'<(?=[a-zA-Z>])', String.Single, 'html-open-tag'),
537
+
538
+ # db path
539
+ # matching the '[_]' in '/a[_]' because it is a part
540
+ # of the syntax of the db path definition
541
+ # unfortunately, i don't know how to match the ']' in
542
+ # /a[1], so this is somewhat inconsistent
543
+ (r'[@?!]?(/\w+)+(\[_\])?', Name.Variable),
544
+ # putting the same color on <- as on db path, since
545
+ # it can be used only to mean Db.write
546
+ (r'<-(?!'+op_re+r')', Name.Variable),
547
+
548
+ # 'modules'
549
+ # although modules are not distinguished by their names as in caml
550
+ # the standard library seems to follow the convention that modules
551
+ # only area capitalized
552
+ (r'\b([A-Z]\w*)(?=\.)', Name.Namespace),
553
+
554
+ # operators
555
+ # = has a special role because this is the only
556
+ # way to syntactic distinguish binding constructions
557
+ # unfortunately, this colors the equal in {x=2} too
558
+ (r'=(?!'+op_re+r')', Keyword),
559
+ (rf'({op_re})+', Operator),
560
+ (rf'({punc_re})+', Operator),
561
+
562
+ # coercions
563
+ (r':', Operator, 'type'),
564
+ # type variables
565
+ # we need this rule because we don't parse specially type
566
+ # definitions so in "type t('a) = ...", "'a" is parsed by 'root'
567
+ ("'"+ident_re, Keyword.Type),
568
+
569
+ # id literal, #something, or #{expr}
570
+ (r'#'+ident_re, String.Single),
571
+ (r'#(?=\{)', String.Single),
572
+
573
+ # identifiers
574
+ # this avoids to color '2' in 'a2' as an integer
575
+ (ident_re, Text),
576
+
577
+ # default, not sure if that is needed or not
578
+ # (r'.', Text),
579
+ ],
580
+
581
+ # it is quite painful to have to parse types to know where they end
582
+ # this is the general rule for a type
583
+ # a type is either:
584
+ # * -> ty
585
+ # * type-with-slash
586
+ # * type-with-slash -> ty
587
+ # * type-with-slash (, type-with-slash)+ -> ty
588
+ #
589
+ # the code is pretty funky in here, but this code would roughly
590
+ # translate in caml to:
591
+ # let rec type stream =
592
+ # match stream with
593
+ # | [< "->"; stream >] -> type stream
594
+ # | [< ""; stream >] ->
595
+ # type_with_slash stream
596
+ # type_lhs_1 stream;
597
+ # and type_1 stream = ...
598
+ 'type': [
599
+ include('comments-and-spaces'),
600
+ (r'->', Keyword.Type),
601
+ default(('#pop', 'type-lhs-1', 'type-with-slash')),
602
+ ],
603
+
604
+ # parses all the atomic or closed constructions in the syntax of type
605
+ # expressions: record types, tuple types, type constructors, basic type
606
+ # and type variables
607
+ 'type-1': [
608
+ include('comments-and-spaces'),
609
+ (r'\(', Keyword.Type, ('#pop', 'type-tuple')),
610
+ (r'~?\{', Keyword.Type, ('#pop', 'type-record')),
611
+ (ident_re+r'\(', Keyword.Type, ('#pop', 'type-tuple')),
612
+ (ident_re, Keyword.Type, '#pop'),
613
+ ("'"+ident_re, Keyword.Type),
614
+ # this case is not in the syntax but sometimes
615
+ # we think we are parsing types when in fact we are parsing
616
+ # some css, so we just pop the states until we get back into
617
+ # the root state
618
+ default('#pop'),
619
+ ],
620
+
621
+ # type-with-slash is either:
622
+ # * type-1
623
+ # * type-1 (/ type-1)+
624
+ 'type-with-slash': [
625
+ include('comments-and-spaces'),
626
+ default(('#pop', 'slash-type-1', 'type-1')),
627
+ ],
628
+ 'slash-type-1': [
629
+ include('comments-and-spaces'),
630
+ ('/', Keyword.Type, ('#pop', 'type-1')),
631
+ # same remark as above
632
+ default('#pop'),
633
+ ],
634
+
635
+ # we go in this state after having parsed a type-with-slash
636
+ # while trying to parse a type
637
+ # and at this point we must determine if we are parsing an arrow
638
+ # type (in which case we must continue parsing) or not (in which
639
+ # case we stop)
640
+ 'type-lhs-1': [
641
+ include('comments-and-spaces'),
642
+ (r'->', Keyword.Type, ('#pop', 'type')),
643
+ (r'(?=,)', Keyword.Type, ('#pop', 'type-arrow')),
644
+ default('#pop'),
645
+ ],
646
+ 'type-arrow': [
647
+ include('comments-and-spaces'),
648
+ # the look ahead here allows to parse f(x : int, y : float -> truc)
649
+ # correctly
650
+ (r',(?=[^:]*?->)', Keyword.Type, 'type-with-slash'),
651
+ (r'->', Keyword.Type, ('#pop', 'type')),
652
+ # same remark as above
653
+ default('#pop'),
654
+ ],
655
+
656
+ # no need to do precise parsing for tuples and records
657
+ # because they are closed constructions, so we can simply
658
+ # find the closing delimiter
659
+ # note that this function would be not work if the source
660
+ # contained identifiers like `{)` (although it could be patched
661
+ # to support it)
662
+ 'type-tuple': [
663
+ include('comments-and-spaces'),
664
+ (r'[^()/*]+', Keyword.Type),
665
+ (r'[/*]', Keyword.Type),
666
+ (r'\(', Keyword.Type, '#push'),
667
+ (r'\)', Keyword.Type, '#pop'),
668
+ ],
669
+ 'type-record': [
670
+ include('comments-and-spaces'),
671
+ (r'[^{}/*]+', Keyword.Type),
672
+ (r'[/*]', Keyword.Type),
673
+ (r'\{', Keyword.Type, '#push'),
674
+ (r'\}', Keyword.Type, '#pop'),
675
+ ],
676
+
677
+ # 'type-tuple': [
678
+ # include('comments-and-spaces'),
679
+ # (r'\)', Keyword.Type, '#pop'),
680
+ # default(('#pop', 'type-tuple-1', 'type-1')),
681
+ # ],
682
+ # 'type-tuple-1': [
683
+ # include('comments-and-spaces'),
684
+ # (r',?\s*\)', Keyword.Type, '#pop'), # ,) is a valid end of tuple, in (1,)
685
+ # (r',', Keyword.Type, 'type-1'),
686
+ # ],
687
+ # 'type-record':[
688
+ # include('comments-and-spaces'),
689
+ # (r'\}', Keyword.Type, '#pop'),
690
+ # (r'~?(?:\w+|`[^`]*`)', Keyword.Type, 'type-record-field-expr'),
691
+ # ],
692
+ # 'type-record-field-expr': [
693
+ #
694
+ # ],
695
+
696
+ 'nested-comment': [
697
+ (r'[^/*]+', Comment),
698
+ (r'/\*', Comment, '#push'),
699
+ (r'\*/', Comment, '#pop'),
700
+ (r'[/*]', Comment),
701
+ ],
702
+
703
+ # the copy pasting between string and single-string
704
+ # is kinda sad. Is there a way to avoid that??
705
+ 'string': [
706
+ (r'[^\\"{]+', String.Double),
707
+ (r'"', String.Double, '#pop'),
708
+ (r'\{', Operator, 'root'),
709
+ include('escape-sequence'),
710
+ ],
711
+ 'single-string': [
712
+ (r'[^\\\'{]+', String.Double),
713
+ (r'\'', String.Double, '#pop'),
714
+ (r'\{', Operator, 'root'),
715
+ include('escape-sequence'),
716
+ ],
717
+
718
+ # all the html stuff
719
+ # can't really reuse some existing html parser
720
+ # because we must be able to parse embedded expressions
721
+
722
+ # we are in this state after someone parsed the '<' that
723
+ # started the html literal
724
+ 'html-open-tag': [
725
+ (r'[\w\-:]+', String.Single, ('#pop', 'html-attr')),
726
+ (r'>', String.Single, ('#pop', 'html-content')),
727
+ ],
728
+
729
+ # we are in this state after someone parsed the '</' that
730
+ # started the end of the closing tag
731
+ 'html-end-tag': [
732
+ # this is a star, because </> is allowed
733
+ (r'[\w\-:]*>', String.Single, '#pop'),
734
+ ],
735
+
736
+ # we are in this state after having parsed '<ident(:ident)?'
737
+ # we thus parse a possibly empty list of attributes
738
+ 'html-attr': [
739
+ (r'\s+', Text),
740
+ (r'[\w\-:]+=', String.Single, 'html-attr-value'),
741
+ (r'/>', String.Single, '#pop'),
742
+ (r'>', String.Single, ('#pop', 'html-content')),
743
+ ],
744
+
745
+ 'html-attr-value': [
746
+ (r"'", String.Single, ('#pop', 'single-string')),
747
+ (r'"', String.Single, ('#pop', 'string')),
748
+ (r'#'+ident_re, String.Single, '#pop'),
749
+ (r'#(?=\{)', String.Single, ('#pop', 'root')),
750
+ (r'[^"\'{`=<>]+', String.Single, '#pop'),
751
+ (r'\{', Operator, ('#pop', 'root')), # this is a tail call!
752
+ ],
753
+
754
+ # we should probably deal with '\' escapes here
755
+ 'html-content': [
756
+ (r'<!--', Comment, 'html-comment'),
757
+ (r'</', String.Single, ('#pop', 'html-end-tag')),
758
+ (r'<', String.Single, 'html-open-tag'),
759
+ (r'\{', Operator, 'root'),
760
+ (r'[^<{]+', String.Single),
761
+ ],
762
+
763
+ 'html-comment': [
764
+ (r'-->', Comment, '#pop'),
765
+ (r'[^\-]+|-', Comment),
766
+ ],
767
+ }
768
+
769
+
770
+ class ReasonLexer(RegexLexer):
771
+ """
772
+ For the ReasonML language.
773
+ """
774
+
775
+ name = 'ReasonML'
776
+ url = 'https://reasonml.github.io/'
777
+ aliases = ['reasonml', 'reason']
778
+ filenames = ['*.re', '*.rei']
779
+ mimetypes = ['text/x-reasonml']
780
+ version_added = '2.6'
781
+
782
+ keywords = (
783
+ 'as', 'assert', 'begin', 'class', 'constraint', 'do', 'done', 'downto',
784
+ 'else', 'end', 'exception', 'external', 'false', 'for', 'fun', 'esfun',
785
+ 'function', 'functor', 'if', 'in', 'include', 'inherit', 'initializer', 'lazy',
786
+ 'let', 'switch', 'module', 'pub', 'mutable', 'new', 'nonrec', 'object', 'of',
787
+ 'open', 'pri', 'rec', 'sig', 'struct', 'then', 'to', 'true', 'try',
788
+ 'type', 'val', 'virtual', 'when', 'while', 'with',
789
+ )
790
+ keyopts = (
791
+ '!=', '#', '&', '&&', r'\(', r'\)', r'\*', r'\+', ',', '-',
792
+ r'-\.', '=>', r'\.', r'\.\.', r'\.\.\.', ':', '::', ':=', ':>', ';', ';;', '<',
793
+ '<-', '=', '>', '>]', r'>\}', r'\?', r'\?\?', r'\[', r'\[<', r'\[>',
794
+ r'\[\|', ']', '_', '`', r'\{', r'\{<', r'\|', r'\|\|', r'\|]', r'\}', '~'
795
+ )
796
+
797
+ operators = r'[!$%&*+\./:<=>?@^|~-]'
798
+ word_operators = ('and', 'asr', 'land', 'lor', 'lsl', 'lsr', 'lxor', 'mod', 'or')
799
+ prefix_syms = r'[!?~]'
800
+ infix_syms = r'[=<>@^|&+\*/$%-]'
801
+ primitives = ('unit', 'int', 'float', 'bool', 'string', 'char', 'list', 'array')
802
+
803
+ tokens = {
804
+ 'escape-sequence': [
805
+ (r'\\[\\"\'ntbr]', String.Escape),
806
+ (r'\\[0-9]{3}', String.Escape),
807
+ (r'\\x[0-9a-fA-F]{2}', String.Escape),
808
+ ],
809
+ 'root': [
810
+ (r'\s+', Text),
811
+ (r'false|true|\(\)|\[\]', Name.Builtin.Pseudo),
812
+ (r'\b([A-Z][\w\']*)(?=\s*\.)', Name.Namespace, 'dotted'),
813
+ (r'\b([A-Z][\w\']*)', Name.Class),
814
+ (r'//.*?\n', Comment.Single),
815
+ (r'\/\*(?!/)', Comment.Multiline, 'comment'),
816
+ (r'\b({})\b'.format('|'.join(keywords)), Keyword),
817
+ (r'({})'.format('|'.join(keyopts[::-1])), Operator.Word),
818
+ (rf'({infix_syms}|{prefix_syms})?{operators}', Operator),
819
+ (r'\b({})\b'.format('|'.join(word_operators)), Operator.Word),
820
+ (r'\b({})\b'.format('|'.join(primitives)), Keyword.Type),
821
+
822
+ (r"[^\W\d][\w']*", Name),
823
+
824
+ (r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float),
825
+ (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
826
+ (r'0[oO][0-7][0-7_]*', Number.Oct),
827
+ (r'0[bB][01][01_]*', Number.Bin),
828
+ (r'\d[\d_]*', Number.Integer),
829
+
830
+ (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'",
831
+ String.Char),
832
+ (r"'.'", String.Char),
833
+ (r"'", Keyword),
834
+
835
+ (r'"', String.Double, 'string'),
836
+
837
+ (r'[~?][a-z][\w\']*:', Name.Variable),
838
+ ],
839
+ 'comment': [
840
+ (r'[^/*]+', Comment.Multiline),
841
+ (r'\/\*', Comment.Multiline, '#push'),
842
+ (r'\*\/', Comment.Multiline, '#pop'),
843
+ (r'\*', Comment.Multiline),
844
+ ],
845
+ 'string': [
846
+ (r'[^\\"]+', String.Double),
847
+ include('escape-sequence'),
848
+ (r'\\\n', String.Double),
849
+ (r'"', String.Double, '#pop'),
850
+ ],
851
+ 'dotted': [
852
+ (r'\s+', Text),
853
+ (r'\.', Punctuation),
854
+ (r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
855
+ (r'[A-Z][\w\']*', Name.Class, '#pop'),
856
+ (r'[a-z_][\w\']*', Name, '#pop'),
857
+ default('#pop'),
858
+ ],
859
+ }
860
+
861
+
862
+ class FStarLexer(RegexLexer):
863
+ """
864
+ For the F* language.
865
+ """
866
+
867
+ name = 'FStar'
868
+ url = 'https://www.fstar-lang.org/'
869
+ aliases = ['fstar']
870
+ filenames = ['*.fst', '*.fsti']
871
+ mimetypes = ['text/x-fstar']
872
+ version_added = '2.7'
873
+
874
+ keywords = (
875
+ 'abstract', 'attributes', 'noeq', 'unopteq', 'and'
876
+ 'begin', 'by', 'default', 'effect', 'else', 'end', 'ensures',
877
+ 'exception', 'exists', 'false', 'forall', 'fun', 'function', 'if',
878
+ 'in', 'include', 'inline', 'inline_for_extraction', 'irreducible',
879
+ 'logic', 'match', 'module', 'mutable', 'new', 'new_effect', 'noextract',
880
+ 'of', 'open', 'opaque', 'private', 'range_of', 'reifiable',
881
+ 'reify', 'reflectable', 'requires', 'set_range_of', 'sub_effect',
882
+ 'synth', 'then', 'total', 'true', 'try', 'type', 'unfold', 'unfoldable',
883
+ 'val', 'when', 'with', 'not'
884
+ )
885
+ decl_keywords = ('let', 'rec')
886
+ assume_keywords = ('assume', 'admit', 'assert', 'calc')
887
+ keyopts = (
888
+ r'~', r'-', r'/\\', r'\\/', r'<:', r'<@', r'\(\|', r'\|\)', r'#', r'u#',
889
+ r'&', r'\(', r'\)', r'\(\)', r',', r'~>', r'->', r'<-', r'<--', r'<==>',
890
+ r'==>', r'\.', r'\?', r'\?\.', r'\.\[', r'\.\(', r'\.\(\|', r'\.\[\|',
891
+ r'\{:pattern', r':', r'::', r':=', r';', r';;', r'=', r'%\[', r'!\{',
892
+ r'\[', r'\[@', r'\[\|', r'\|>', r'\]', r'\|\]', r'\{', r'\|', r'\}', r'\$'
893
+ )
894
+
895
+ operators = r'[!$%&*+\./:<=>?@^|~-]'
896
+ prefix_syms = r'[!?~]'
897
+ infix_syms = r'[=<>@^|&+\*/$%-]'
898
+ primitives = ('unit', 'int', 'float', 'bool', 'string', 'char', 'list', 'array')
899
+
900
+ tokens = {
901
+ 'escape-sequence': [
902
+ (r'\\[\\"\'ntbr]', String.Escape),
903
+ (r'\\[0-9]{3}', String.Escape),
904
+ (r'\\x[0-9a-fA-F]{2}', String.Escape),
905
+ ],
906
+ 'root': [
907
+ (r'\s+', Text),
908
+ (r'false|true|False|True|\(\)|\[\]', Name.Builtin.Pseudo),
909
+ (r'\b([A-Z][\w\']*)(?=\s*\.)', Name.Namespace, 'dotted'),
910
+ (r'\b([A-Z][\w\']*)', Name.Class),
911
+ (r'\(\*(?![)])', Comment, 'comment'),
912
+ (r'\/\/.+$', Comment),
913
+ (r'\b({})\b'.format('|'.join(keywords)), Keyword),
914
+ (r'\b({})\b'.format('|'.join(assume_keywords)), Name.Exception),
915
+ (r'\b({})\b'.format('|'.join(decl_keywords)), Keyword.Declaration),
916
+ (r'({})'.format('|'.join(keyopts[::-1])), Operator),
917
+ (rf'({infix_syms}|{prefix_syms})?{operators}', Operator),
918
+ (r'\b({})\b'.format('|'.join(primitives)), Keyword.Type),
919
+
920
+ (r"[^\W\d][\w']*", Name),
921
+
922
+ (r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float),
923
+ (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
924
+ (r'0[oO][0-7][0-7_]*', Number.Oct),
925
+ (r'0[bB][01][01_]*', Number.Bin),
926
+ (r'\d[\d_]*', Number.Integer),
927
+
928
+ (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'",
929
+ String.Char),
930
+ (r"'.'", String.Char),
931
+ (r"'", Keyword), # a stray quote is another syntax element
932
+ (r"\`([\w\'.]+)\`", Operator.Word), # for infix applications
933
+ (r"\`", Keyword), # for quoting
934
+ (r'"', String.Double, 'string'),
935
+
936
+ (r'[~?][a-z][\w\']*:', Name.Variable),
937
+ ],
938
+ 'comment': [
939
+ (r'[^(*)]+', Comment),
940
+ (r'\(\*', Comment, '#push'),
941
+ (r'\*\)', Comment, '#pop'),
942
+ (r'[(*)]', Comment),
943
+ ],
944
+ 'string': [
945
+ (r'[^\\"]+', String.Double),
946
+ include('escape-sequence'),
947
+ (r'\\\n', String.Double),
948
+ (r'"', String.Double, '#pop'),
949
+ ],
950
+ 'dotted': [
951
+ (r'\s+', Text),
952
+ (r'\.', Punctuation),
953
+ (r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
954
+ (r'[A-Z][\w\']*', Name.Class, '#pop'),
955
+ (r'[a-z_][\w\']*', Name, '#pop'),
956
+ default('#pop'),
957
+ ],
958
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/modeling.py ADDED
@@ -0,0 +1,368 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.modeling
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for modeling languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups, using, default
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Whitespace
16
+
17
+ from pygments.lexers.html import HtmlLexer
18
+ from pygments.lexers import _stan_builtins
19
+
20
+ __all__ = ['ModelicaLexer', 'BugsLexer', 'JagsLexer', 'StanLexer']
21
+
22
+
23
+ class ModelicaLexer(RegexLexer):
24
+ """
25
+ For Modelica source code.
26
+ """
27
+ name = 'Modelica'
28
+ url = 'http://www.modelica.org/'
29
+ aliases = ['modelica']
30
+ filenames = ['*.mo']
31
+ mimetypes = ['text/x-modelica']
32
+ version_added = '1.1'
33
+
34
+ flags = re.DOTALL | re.MULTILINE
35
+
36
+ _name = r"(?:'(?:[^\\']|\\.)+'|[a-zA-Z_]\w*)"
37
+
38
+ tokens = {
39
+ 'whitespace': [
40
+ (r'[\s\ufeff]+', Text),
41
+ (r'//[^\n]*\n?', Comment.Single),
42
+ (r'/\*.*?\*/', Comment.Multiline)
43
+ ],
44
+ 'root': [
45
+ include('whitespace'),
46
+ (r'"', String.Double, 'string'),
47
+ (r'[()\[\]{},;]+', Punctuation),
48
+ (r'\.?[*^/+-]|\.|<>|[<>:=]=?', Operator),
49
+ (r'\d+(\.?\d*[eE][-+]?\d+|\.\d*)', Number.Float),
50
+ (r'\d+', Number.Integer),
51
+ (r'(abs|acos|actualStream|array|asin|assert|AssertionLevel|atan|'
52
+ r'atan2|backSample|Boolean|cardinality|cat|ceil|change|Clock|'
53
+ r'Connections|cos|cosh|cross|delay|diagonal|div|edge|exp|'
54
+ r'ExternalObject|fill|floor|getInstanceName|hold|homotopy|'
55
+ r'identity|inStream|integer|Integer|interval|inverse|isPresent|'
56
+ r'linspace|log|log10|matrix|max|min|mod|ndims|noClock|noEvent|'
57
+ r'ones|outerProduct|pre|previous|product|Real|reinit|rem|rooted|'
58
+ r'sample|scalar|semiLinear|shiftSample|sign|sin|sinh|size|skew|'
59
+ r'smooth|spatialDistribution|sqrt|StateSelect|String|subSample|'
60
+ r'sum|superSample|symmetric|tan|tanh|terminal|terminate|time|'
61
+ r'transpose|vector|zeros)\b', Name.Builtin),
62
+ (r'(algorithm|annotation|break|connect|constant|constrainedby|der|'
63
+ r'discrete|each|else|elseif|elsewhen|encapsulated|enumeration|'
64
+ r'equation|exit|expandable|extends|external|firstTick|final|flow|for|if|'
65
+ r'import|impure|in|initial|inner|input|interval|loop|nondiscrete|outer|'
66
+ r'output|parameter|partial|protected|public|pure|redeclare|'
67
+ r'replaceable|return|stream|then|when|while)\b',
68
+ Keyword.Reserved),
69
+ (r'(and|not|or)\b', Operator.Word),
70
+ (r'(block|class|connector|end|function|model|operator|package|'
71
+ r'record|type)\b', Keyword.Reserved, 'class'),
72
+ (r'(false|true)\b', Keyword.Constant),
73
+ (r'within\b', Keyword.Reserved, 'package-prefix'),
74
+ (_name, Name)
75
+ ],
76
+ 'class': [
77
+ include('whitespace'),
78
+ (r'(function|record)\b', Keyword.Reserved),
79
+ (r'(if|for|when|while)\b', Keyword.Reserved, '#pop'),
80
+ (_name, Name.Class, '#pop'),
81
+ default('#pop')
82
+ ],
83
+ 'package-prefix': [
84
+ include('whitespace'),
85
+ (_name, Name.Namespace, '#pop'),
86
+ default('#pop')
87
+ ],
88
+ 'string': [
89
+ (r'"', String.Double, '#pop'),
90
+ (r'\\[\'"?\\abfnrtv]', String.Escape),
91
+ (r'(?i)<\s*html\s*>([^\\"]|\\.)+?(<\s*/\s*html\s*>|(?="))',
92
+ using(HtmlLexer)),
93
+ (r'<|\\?[^"\\<]+', String.Double)
94
+ ]
95
+ }
96
+
97
+
98
+ class BugsLexer(RegexLexer):
99
+ """
100
+ Pygments Lexer for OpenBugs and WinBugs
101
+ models.
102
+ """
103
+
104
+ name = 'BUGS'
105
+ aliases = ['bugs', 'winbugs', 'openbugs']
106
+ filenames = ['*.bug']
107
+ url = 'https://www.mrc-bsu.cam.ac.uk/software/bugs/openbugs'
108
+ version_added = '1.6'
109
+
110
+ _FUNCTIONS = (
111
+ # Scalar functions
112
+ 'abs', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh',
113
+ 'cloglog', 'cos', 'cosh', 'cumulative', 'cut', 'density', 'deviance',
114
+ 'equals', 'expr', 'gammap', 'ilogit', 'icloglog', 'integral', 'log',
115
+ 'logfact', 'loggam', 'logit', 'max', 'min', 'phi', 'post.p.value',
116
+ 'pow', 'prior.p.value', 'probit', 'replicate.post', 'replicate.prior',
117
+ 'round', 'sin', 'sinh', 'solution', 'sqrt', 'step', 'tan', 'tanh',
118
+ 'trunc',
119
+ # Vector functions
120
+ 'inprod', 'interp.lin', 'inverse', 'logdet', 'mean', 'eigen.vals',
121
+ 'ode', 'prod', 'p.valueM', 'rank', 'ranked', 'replicate.postM',
122
+ 'sd', 'sort', 'sum',
123
+ # Special
124
+ 'D', 'I', 'F', 'T', 'C')
125
+ """ OpenBUGS built-in functions
126
+
127
+ From http://www.openbugs.info/Manuals/ModelSpecification.html#ContentsAII
128
+
129
+ This also includes
130
+
131
+ - T, C, I : Truncation and censoring.
132
+ ``T`` and ``C`` are in OpenBUGS. ``I`` in WinBUGS.
133
+ - D : ODE
134
+ - F : Functional http://www.openbugs.info/Examples/Functionals.html
135
+
136
+ """
137
+
138
+ _DISTRIBUTIONS = ('dbern', 'dbin', 'dcat', 'dnegbin', 'dpois',
139
+ 'dhyper', 'dbeta', 'dchisqr', 'ddexp', 'dexp',
140
+ 'dflat', 'dgamma', 'dgev', 'df', 'dggamma', 'dgpar',
141
+ 'dloglik', 'dlnorm', 'dlogis', 'dnorm', 'dpar',
142
+ 'dt', 'dunif', 'dweib', 'dmulti', 'ddirch', 'dmnorm',
143
+ 'dmt', 'dwish')
144
+ """ OpenBUGS built-in distributions
145
+
146
+ Functions from
147
+ http://www.openbugs.info/Manuals/ModelSpecification.html#ContentsAI
148
+ """
149
+
150
+ tokens = {
151
+ 'whitespace': [
152
+ (r"\s+", Text),
153
+ ],
154
+ 'comments': [
155
+ # Comments
156
+ (r'#.*$', Comment.Single),
157
+ ],
158
+ 'root': [
159
+ # Comments
160
+ include('comments'),
161
+ include('whitespace'),
162
+ # Block start
163
+ (r'(model)(\s+)(\{)',
164
+ bygroups(Keyword.Namespace, Text, Punctuation)),
165
+ # Reserved Words
166
+ (r'(for|in)(?![\w.])', Keyword.Reserved),
167
+ # Built-in Functions
168
+ (r'({})(?=\s*\()'.format(r'|'.join(_FUNCTIONS + _DISTRIBUTIONS)),
169
+ Name.Builtin),
170
+ # Regular variable names
171
+ (r'[A-Za-z][\w.]*', Name),
172
+ # Number Literals
173
+ (r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?', Number),
174
+ # Punctuation
175
+ (r'\[|\]|\(|\)|:|,|;', Punctuation),
176
+ # Assignment operators
177
+ # SLexer makes these tokens Operators.
178
+ (r'<-|~', Operator),
179
+ # Infix and prefix operators
180
+ (r'\+|-|\*|/', Operator),
181
+ # Block
182
+ (r'[{}]', Punctuation),
183
+ ]
184
+ }
185
+
186
+ def analyse_text(text):
187
+ if re.search(r"^\s*model\s*{", text, re.M):
188
+ return 0.7
189
+ else:
190
+ return 0.0
191
+
192
+
193
+ class JagsLexer(RegexLexer):
194
+ """
195
+ Pygments Lexer for JAGS.
196
+ """
197
+
198
+ name = 'JAGS'
199
+ aliases = ['jags']
200
+ filenames = ['*.jag', '*.bug']
201
+ url = 'https://mcmc-jags.sourceforge.io'
202
+ version_added = '1.6'
203
+
204
+ # JAGS
205
+ _FUNCTIONS = (
206
+ 'abs', 'arccos', 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctanh',
207
+ 'cos', 'cosh', 'cloglog',
208
+ 'equals', 'exp', 'icloglog', 'ifelse', 'ilogit', 'log', 'logfact',
209
+ 'loggam', 'logit', 'phi', 'pow', 'probit', 'round', 'sin', 'sinh',
210
+ 'sqrt', 'step', 'tan', 'tanh', 'trunc', 'inprod', 'interp.lin',
211
+ 'logdet', 'max', 'mean', 'min', 'prod', 'sum', 'sd', 'inverse',
212
+ 'rank', 'sort', 't', 'acos', 'acosh', 'asin', 'asinh', 'atan',
213
+ # Truncation/Censoring (should I include)
214
+ 'T', 'I')
215
+ # Distributions with density, probability and quartile functions
216
+ _DISTRIBUTIONS = tuple(f'[dpq]{x}' for x in
217
+ ('bern', 'beta', 'dchiqsqr', 'ddexp', 'dexp',
218
+ 'df', 'gamma', 'gen.gamma', 'logis', 'lnorm',
219
+ 'negbin', 'nchisqr', 'norm', 'par', 'pois', 'weib'))
220
+ # Other distributions without density and probability
221
+ _OTHER_DISTRIBUTIONS = (
222
+ 'dt', 'dunif', 'dbetabin', 'dbern', 'dbin', 'dcat', 'dhyper',
223
+ 'ddirch', 'dmnorm', 'dwish', 'dmt', 'dmulti', 'dbinom', 'dchisq',
224
+ 'dnbinom', 'dweibull', 'ddirich')
225
+
226
+ tokens = {
227
+ 'whitespace': [
228
+ (r"\s+", Text),
229
+ ],
230
+ 'names': [
231
+ # Regular variable names
232
+ (r'[a-zA-Z][\w.]*\b', Name),
233
+ ],
234
+ 'comments': [
235
+ # do not use stateful comments
236
+ (r'(?s)/\*.*?\*/', Comment.Multiline),
237
+ # Comments
238
+ (r'#.*$', Comment.Single),
239
+ ],
240
+ 'root': [
241
+ # Comments
242
+ include('comments'),
243
+ include('whitespace'),
244
+ # Block start
245
+ (r'(model|data)(\s+)(\{)',
246
+ bygroups(Keyword.Namespace, Text, Punctuation)),
247
+ (r'var(?![\w.])', Keyword.Declaration),
248
+ # Reserved Words
249
+ (r'(for|in)(?![\w.])', Keyword.Reserved),
250
+ # Builtins
251
+ # Need to use lookahead because . is a valid char
252
+ (r'({})(?=\s*\()'.format(r'|'.join(_FUNCTIONS
253
+ + _DISTRIBUTIONS
254
+ + _OTHER_DISTRIBUTIONS)),
255
+ Name.Builtin),
256
+ # Names
257
+ include('names'),
258
+ # Number Literals
259
+ (r'[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?', Number),
260
+ (r'\[|\]|\(|\)|:|,|;', Punctuation),
261
+ # Assignment operators
262
+ (r'<-|~', Operator),
263
+ # # JAGS includes many more than OpenBUGS
264
+ (r'\+|-|\*|\/|\|\|[&]{2}|[<>=]=?|\^|%.*?%', Operator),
265
+ (r'[{}]', Punctuation),
266
+ ]
267
+ }
268
+
269
+ def analyse_text(text):
270
+ if re.search(r'^\s*model\s*\{', text, re.M):
271
+ if re.search(r'^\s*data\s*\{', text, re.M):
272
+ return 0.9
273
+ elif re.search(r'^\s*var', text, re.M):
274
+ return 0.9
275
+ else:
276
+ return 0.3
277
+ else:
278
+ return 0
279
+
280
+
281
+ class StanLexer(RegexLexer):
282
+ """Pygments Lexer for Stan models.
283
+
284
+ The Stan modeling language is specified in the *Stan Modeling Language
285
+ User's Guide and Reference Manual, v2.17.0*,
286
+ `pdf <https://github.com/stan-dev/stan/releases/download/v2.17.0/stan-reference-2.17.0.pdf>`__.
287
+ """
288
+
289
+ name = 'Stan'
290
+ aliases = ['stan']
291
+ filenames = ['*.stan']
292
+ url = 'https://mc-stan.org'
293
+ version_added = '1.6'
294
+
295
+ tokens = {
296
+ 'whitespace': [
297
+ (r"\s+", Text),
298
+ ],
299
+ 'comments': [
300
+ (r'(?s)/\*.*?\*/', Comment.Multiline),
301
+ # Comments
302
+ (r'(//|#).*$', Comment.Single),
303
+ ],
304
+ 'root': [
305
+ (r'"[^"]*"', String),
306
+ # Comments
307
+ include('comments'),
308
+ # block start
309
+ include('whitespace'),
310
+ # Block start
311
+ (r'({})(\s*)(\{{)'.format(r'|'.join(('functions', 'data', r'transformed\s+?data',
312
+ 'parameters', r'transformed\s+parameters',
313
+ 'model', r'generated\s+quantities'))),
314
+ bygroups(Keyword.Namespace, Text, Punctuation)),
315
+ # target keyword
316
+ (r'target\s*\+=', Keyword),
317
+ # jacobian += statement
318
+ (r'jacobian\s*\+=', Keyword),
319
+ # Reserved Words
320
+ (r'({})\b'.format(r'|'.join(_stan_builtins.KEYWORDS)), Keyword),
321
+ # Truncation
322
+ (r'T(?=\s*\[)', Keyword),
323
+ # Data types
324
+ (r'({})\b'.format(r'|'.join(_stan_builtins.TYPES)), Keyword.Type),
325
+ # < should be punctuation, but elsewhere I can't tell if it is in
326
+ # a range constraint
327
+ (r'(<)(\s*)(upper|lower|offset|multiplier)(\s*)(=)',
328
+ bygroups(Operator, Whitespace, Keyword, Whitespace, Punctuation)),
329
+ (r'(,)(\s*)(upper)(\s*)(=)',
330
+ bygroups(Punctuation, Whitespace, Keyword, Whitespace, Punctuation)),
331
+ # Punctuation
332
+ (r"[;,\[\]()]", Punctuation),
333
+ # Builtin
334
+ (r'({})(?=\s*\()'.format('|'.join(_stan_builtins.FUNCTIONS)), Name.Builtin),
335
+ (r'(~)(\s*)({})(?=\s*\()'.format('|'.join(_stan_builtins.DISTRIBUTIONS)),
336
+ bygroups(Operator, Whitespace, Name.Builtin)),
337
+ # Special names ending in __, like lp__
338
+ (r'[A-Za-z]\w*__\b', Name.Builtin.Pseudo),
339
+ (r'({})\b'.format(r'|'.join(_stan_builtins.RESERVED)), Keyword.Reserved),
340
+ # user-defined functions
341
+ (r'[A-Za-z]\w*(?=\s*\()]', Name.Function),
342
+ # Imaginary Literals
343
+ (r'[0-9]+(\.[0-9]*)?([eE][+-]?[0-9]+)?i', Number.Float),
344
+ (r'\.[0-9]+([eE][+-]?[0-9]+)?i', Number.Float),
345
+ (r'[0-9]+i', Number.Float),
346
+ # Real Literals
347
+ (r'[0-9]+(\.[0-9]*)?([eE][+-]?[0-9]+)?', Number.Float),
348
+ (r'\.[0-9]+([eE][+-]?[0-9]+)?', Number.Float),
349
+ # Integer Literals
350
+ (r'[0-9]+', Number.Integer),
351
+ # Regular variable names
352
+ (r'[A-Za-z]\w*\b', Name),
353
+ # Assignment operators
354
+ (r'<-|(?:\+|-|\.?/|\.?\*|=)?=|~', Operator),
355
+ # Infix, prefix and postfix operators (and = )
356
+ (r"\+|-|\.?\*|\.?/|\\|'|\.?\^|!=?|<=?|>=?|\|\||&&|%|\?|:|%/%|!", Operator),
357
+ # Block delimiters
358
+ (r'[{}]', Punctuation),
359
+ # Distribution |
360
+ (r'\|', Punctuation)
361
+ ]
362
+ }
363
+
364
+ def analyse_text(text):
365
+ if re.search(r'^\s*parameters\s*\{', text, re.M):
366
+ return 1.0
367
+ else:
368
+ return 0.0
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/modula2.py ADDED
@@ -0,0 +1,1579 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.modula2
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Multi-Dialect Lexer for Modula-2.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include
14
+ from pygments.util import get_bool_opt, get_list_opt
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, \
16
+ String, Number, Punctuation, Error
17
+
18
+ __all__ = ['Modula2Lexer']
19
+
20
+
21
+ # Multi-Dialect Modula-2 Lexer
22
+ class Modula2Lexer(RegexLexer):
23
+ """
24
+ For Modula-2 source code.
25
+
26
+ The Modula-2 lexer supports several dialects. By default, it operates in
27
+ fallback mode, recognising the *combined* literals, punctuation symbols
28
+ and operators of all supported dialects, and the *combined* reserved words
29
+ and builtins of PIM Modula-2, ISO Modula-2 and Modula-2 R10, while not
30
+ differentiating between library defined identifiers.
31
+
32
+ To select a specific dialect, a dialect option may be passed
33
+ or a dialect tag may be embedded into a source file.
34
+
35
+ Dialect Options:
36
+
37
+ `m2pim`
38
+ Select PIM Modula-2 dialect.
39
+ `m2iso`
40
+ Select ISO Modula-2 dialect.
41
+ `m2r10`
42
+ Select Modula-2 R10 dialect.
43
+ `objm2`
44
+ Select Objective Modula-2 dialect.
45
+
46
+ The PIM and ISO dialect options may be qualified with a language extension.
47
+
48
+ Language Extensions:
49
+
50
+ `+aglet`
51
+ Select Aglet Modula-2 extensions, available with m2iso.
52
+ `+gm2`
53
+ Select GNU Modula-2 extensions, available with m2pim.
54
+ `+p1`
55
+ Select p1 Modula-2 extensions, available with m2iso.
56
+ `+xds`
57
+ Select XDS Modula-2 extensions, available with m2iso.
58
+
59
+
60
+ Passing a Dialect Option via Unix Commandline Interface
61
+
62
+ Dialect options may be passed to the lexer using the `dialect` key.
63
+ Only one such option should be passed. If multiple dialect options are
64
+ passed, the first valid option is used, any subsequent options are ignored.
65
+
66
+ Examples:
67
+
68
+ `$ pygmentize -O full,dialect=m2iso -f html -o /path/to/output /path/to/input`
69
+ Use ISO dialect to render input to HTML output
70
+ `$ pygmentize -O full,dialect=m2iso+p1 -f rtf -o /path/to/output /path/to/input`
71
+ Use ISO dialect with p1 extensions to render input to RTF output
72
+
73
+
74
+ Embedding a Dialect Option within a source file
75
+
76
+ A dialect option may be embedded in a source file in form of a dialect
77
+ tag, a specially formatted comment that specifies a dialect option.
78
+
79
+ Dialect Tag EBNF::
80
+
81
+ dialectTag :
82
+ OpeningCommentDelim Prefix dialectOption ClosingCommentDelim ;
83
+
84
+ dialectOption :
85
+ 'm2pim' | 'm2iso' | 'm2r10' | 'objm2' |
86
+ 'm2iso+aglet' | 'm2pim+gm2' | 'm2iso+p1' | 'm2iso+xds' ;
87
+
88
+ Prefix : '!' ;
89
+
90
+ OpeningCommentDelim : '(*' ;
91
+
92
+ ClosingCommentDelim : '*)' ;
93
+
94
+ No whitespace is permitted between the tokens of a dialect tag.
95
+
96
+ In the event that a source file contains multiple dialect tags, the first
97
+ tag that contains a valid dialect option will be used and any subsequent
98
+ dialect tags will be ignored. Ideally, a dialect tag should be placed
99
+ at the beginning of a source file.
100
+
101
+ An embedded dialect tag overrides a dialect option set via command line.
102
+
103
+ Examples:
104
+
105
+ ``(*!m2r10*) DEFINITION MODULE Foobar; ...``
106
+ Use Modula2 R10 dialect to render this source file.
107
+ ``(*!m2pim+gm2*) DEFINITION MODULE Bazbam; ...``
108
+ Use PIM dialect with GNU extensions to render this source file.
109
+
110
+
111
+ Algol Publication Mode:
112
+
113
+ In Algol publication mode, source text is rendered for publication of
114
+ algorithms in scientific papers and academic texts, following the format
115
+ of the Revised Algol-60 Language Report. It is activated by passing
116
+ one of two corresponding styles as an option:
117
+
118
+ `algol`
119
+ render reserved words lowercase underline boldface
120
+ and builtins lowercase boldface italic
121
+ `algol_nu`
122
+ render reserved words lowercase boldface (no underlining)
123
+ and builtins lowercase boldface italic
124
+
125
+ The lexer automatically performs the required lowercase conversion when
126
+ this mode is activated.
127
+
128
+ Example:
129
+
130
+ ``$ pygmentize -O full,style=algol -f latex -o /path/to/output /path/to/input``
131
+ Render input file in Algol publication mode to LaTeX output.
132
+
133
+
134
+ Rendering Mode of First Class ADT Identifiers:
135
+
136
+ The rendering of standard library first class ADT identifiers is controlled
137
+ by option flag "treat_stdlib_adts_as_builtins".
138
+
139
+ When this option is turned on, standard library ADT identifiers are rendered
140
+ as builtins. When it is turned off, they are rendered as ordinary library
141
+ identifiers.
142
+
143
+ `treat_stdlib_adts_as_builtins` (default: On)
144
+
145
+ The option is useful for dialects that support ADTs as first class objects
146
+ and provide ADTs in the standard library that would otherwise be built-in.
147
+
148
+ At present, only Modula-2 R10 supports library ADTs as first class objects
149
+ and therefore, no ADT identifiers are defined for any other dialects.
150
+
151
+ Example:
152
+
153
+ ``$ pygmentize -O full,dialect=m2r10,treat_stdlib_adts_as_builtins=Off ...``
154
+ Render standard library ADTs as ordinary library types.
155
+
156
+ .. versionchanged:: 2.1
157
+ Added multi-dialect support.
158
+ """
159
+ name = 'Modula-2'
160
+ url = 'http://www.modula2.org/'
161
+ aliases = ['modula2', 'm2']
162
+ filenames = ['*.def', '*.mod']
163
+ mimetypes = ['text/x-modula2']
164
+ version_added = '1.3'
165
+
166
+ flags = re.MULTILINE | re.DOTALL
167
+
168
+ tokens = {
169
+ 'whitespace': [
170
+ (r'\n+', Text), # blank lines
171
+ (r'\s+', Text), # whitespace
172
+ ],
173
+ 'dialecttags': [
174
+ # PIM Dialect Tag
175
+ (r'\(\*!m2pim\*\)', Comment.Special),
176
+ # ISO Dialect Tag
177
+ (r'\(\*!m2iso\*\)', Comment.Special),
178
+ # M2R10 Dialect Tag
179
+ (r'\(\*!m2r10\*\)', Comment.Special),
180
+ # ObjM2 Dialect Tag
181
+ (r'\(\*!objm2\*\)', Comment.Special),
182
+ # Aglet Extensions Dialect Tag
183
+ (r'\(\*!m2iso\+aglet\*\)', Comment.Special),
184
+ # GNU Extensions Dialect Tag
185
+ (r'\(\*!m2pim\+gm2\*\)', Comment.Special),
186
+ # p1 Extensions Dialect Tag
187
+ (r'\(\*!m2iso\+p1\*\)', Comment.Special),
188
+ # XDS Extensions Dialect Tag
189
+ (r'\(\*!m2iso\+xds\*\)', Comment.Special),
190
+ ],
191
+ 'identifiers': [
192
+ (r'([a-zA-Z_$][\w$]*)', Name),
193
+ ],
194
+ 'prefixed_number_literals': [
195
+ #
196
+ # Base-2, whole number
197
+ (r'0b[01]+(\'[01]+)*', Number.Bin),
198
+ #
199
+ # Base-16, whole number
200
+ (r'0[ux][0-9A-F]+(\'[0-9A-F]+)*', Number.Hex),
201
+ ],
202
+ 'plain_number_literals': [
203
+ #
204
+ # Base-10, real number with exponent
205
+ (r'[0-9]+(\'[0-9]+)*' # integral part
206
+ r'\.[0-9]+(\'[0-9]+)*' # fractional part
207
+ r'[eE][+-]?[0-9]+(\'[0-9]+)*', # exponent
208
+ Number.Float),
209
+ #
210
+ # Base-10, real number without exponent
211
+ (r'[0-9]+(\'[0-9]+)*' # integral part
212
+ r'\.[0-9]+(\'[0-9]+)*', # fractional part
213
+ Number.Float),
214
+ #
215
+ # Base-10, whole number
216
+ (r'[0-9]+(\'[0-9]+)*', Number.Integer),
217
+ ],
218
+ 'suffixed_number_literals': [
219
+ #
220
+ # Base-8, whole number
221
+ (r'[0-7]+B', Number.Oct),
222
+ #
223
+ # Base-8, character code
224
+ (r'[0-7]+C', Number.Oct),
225
+ #
226
+ # Base-16, number
227
+ (r'[0-9A-F]+H', Number.Hex),
228
+ ],
229
+ 'string_literals': [
230
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
231
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
232
+ ],
233
+ 'digraph_operators': [
234
+ # Dot Product Operator
235
+ (r'\*\.', Operator),
236
+ # Array Concatenation Operator
237
+ (r'\+>', Operator), # M2R10 + ObjM2
238
+ # Inequality Operator
239
+ (r'<>', Operator), # ISO + PIM
240
+ # Less-Or-Equal, Subset
241
+ (r'<=', Operator),
242
+ # Greater-Or-Equal, Superset
243
+ (r'>=', Operator),
244
+ # Identity Operator
245
+ (r'==', Operator), # M2R10 + ObjM2
246
+ # Type Conversion Operator
247
+ (r'::', Operator), # M2R10 + ObjM2
248
+ # Assignment Symbol
249
+ (r':=', Operator),
250
+ # Postfix Increment Mutator
251
+ (r'\+\+', Operator), # M2R10 + ObjM2
252
+ # Postfix Decrement Mutator
253
+ (r'--', Operator), # M2R10 + ObjM2
254
+ ],
255
+ 'unigraph_operators': [
256
+ # Arithmetic Operators
257
+ (r'[+-]', Operator),
258
+ (r'[*/]', Operator),
259
+ # ISO 80000-2 compliant Set Difference Operator
260
+ (r'\\', Operator), # M2R10 + ObjM2
261
+ # Relational Operators
262
+ (r'[=#<>]', Operator),
263
+ # Dereferencing Operator
264
+ (r'\^', Operator),
265
+ # Dereferencing Operator Synonym
266
+ (r'@', Operator), # ISO
267
+ # Logical AND Operator Synonym
268
+ (r'&', Operator), # PIM + ISO
269
+ # Logical NOT Operator Synonym
270
+ (r'~', Operator), # PIM + ISO
271
+ # Smalltalk Message Prefix
272
+ (r'`', Operator), # ObjM2
273
+ ],
274
+ 'digraph_punctuation': [
275
+ # Range Constructor
276
+ (r'\.\.', Punctuation),
277
+ # Opening Chevron Bracket
278
+ (r'<<', Punctuation), # M2R10 + ISO
279
+ # Closing Chevron Bracket
280
+ (r'>>', Punctuation), # M2R10 + ISO
281
+ # Blueprint Punctuation
282
+ (r'->', Punctuation), # M2R10 + ISO
283
+ # Distinguish |# and # in M2 R10
284
+ (r'\|#', Punctuation),
285
+ # Distinguish ## and # in M2 R10
286
+ (r'##', Punctuation),
287
+ # Distinguish |* and * in M2 R10
288
+ (r'\|\*', Punctuation),
289
+ ],
290
+ 'unigraph_punctuation': [
291
+ # Common Punctuation
292
+ (r'[()\[\]{},.:;|]', Punctuation),
293
+ # Case Label Separator Synonym
294
+ (r'!', Punctuation), # ISO
295
+ # Blueprint Punctuation
296
+ (r'\?', Punctuation), # M2R10 + ObjM2
297
+ ],
298
+ 'comments': [
299
+ # Single Line Comment
300
+ (r'^//.*?\n', Comment.Single), # M2R10 + ObjM2
301
+ # Block Comment
302
+ (r'\(\*([^$].*?)\*\)', Comment.Multiline),
303
+ # Template Block Comment
304
+ (r'/\*(.*?)\*/', Comment.Multiline), # M2R10 + ObjM2
305
+ ],
306
+ 'pragmas': [
307
+ # ISO Style Pragmas
308
+ (r'<\*.*?\*>', Comment.Preproc), # ISO, M2R10 + ObjM2
309
+ # Pascal Style Pragmas
310
+ (r'\(\*\$.*?\*\)', Comment.Preproc), # PIM
311
+ ],
312
+ 'root': [
313
+ include('whitespace'),
314
+ include('dialecttags'),
315
+ include('pragmas'),
316
+ include('comments'),
317
+ include('identifiers'),
318
+ include('suffixed_number_literals'), # PIM + ISO
319
+ include('prefixed_number_literals'), # M2R10 + ObjM2
320
+ include('plain_number_literals'),
321
+ include('string_literals'),
322
+ include('digraph_punctuation'),
323
+ include('digraph_operators'),
324
+ include('unigraph_punctuation'),
325
+ include('unigraph_operators'),
326
+ ]
327
+ }
328
+
329
+ # C o m m o n D a t a s e t s
330
+
331
+ # Common Reserved Words Dataset
332
+ common_reserved_words = (
333
+ # 37 common reserved words
334
+ 'AND', 'ARRAY', 'BEGIN', 'BY', 'CASE', 'CONST', 'DEFINITION', 'DIV',
335
+ 'DO', 'ELSE', 'ELSIF', 'END', 'EXIT', 'FOR', 'FROM', 'IF',
336
+ 'IMPLEMENTATION', 'IMPORT', 'IN', 'LOOP', 'MOD', 'MODULE', 'NOT',
337
+ 'OF', 'OR', 'POINTER', 'PROCEDURE', 'RECORD', 'REPEAT', 'RETURN',
338
+ 'SET', 'THEN', 'TO', 'TYPE', 'UNTIL', 'VAR', 'WHILE',
339
+ )
340
+
341
+ # Common Builtins Dataset
342
+ common_builtins = (
343
+ # 16 common builtins
344
+ 'ABS', 'BOOLEAN', 'CARDINAL', 'CHAR', 'CHR', 'FALSE', 'INTEGER',
345
+ 'LONGINT', 'LONGREAL', 'MAX', 'MIN', 'NIL', 'ODD', 'ORD', 'REAL',
346
+ 'TRUE',
347
+ )
348
+
349
+ # Common Pseudo-Module Builtins Dataset
350
+ common_pseudo_builtins = (
351
+ # 4 common pseudo builtins
352
+ 'ADDRESS', 'BYTE', 'WORD', 'ADR'
353
+ )
354
+
355
+ # P I M M o d u l a - 2 D a t a s e t s
356
+
357
+ # Lexemes to Mark as Error Tokens for PIM Modula-2
358
+ pim_lexemes_to_reject = (
359
+ '!', '`', '@', '$', '%', '?', '\\', '==', '++', '--', '::', '*.',
360
+ '+>', '->', '<<', '>>', '|#', '##',
361
+ )
362
+
363
+ # PIM Modula-2 Additional Reserved Words Dataset
364
+ pim_additional_reserved_words = (
365
+ # 3 additional reserved words
366
+ 'EXPORT', 'QUALIFIED', 'WITH',
367
+ )
368
+
369
+ # PIM Modula-2 Additional Builtins Dataset
370
+ pim_additional_builtins = (
371
+ # 16 additional builtins
372
+ 'BITSET', 'CAP', 'DEC', 'DISPOSE', 'EXCL', 'FLOAT', 'HALT', 'HIGH',
373
+ 'INC', 'INCL', 'NEW', 'NIL', 'PROC', 'SIZE', 'TRUNC', 'VAL',
374
+ )
375
+
376
+ # PIM Modula-2 Additional Pseudo-Module Builtins Dataset
377
+ pim_additional_pseudo_builtins = (
378
+ # 5 additional pseudo builtins
379
+ 'SYSTEM', 'PROCESS', 'TSIZE', 'NEWPROCESS', 'TRANSFER',
380
+ )
381
+
382
+ # I S O M o d u l a - 2 D a t a s e t s
383
+
384
+ # Lexemes to Mark as Error Tokens for ISO Modula-2
385
+ iso_lexemes_to_reject = (
386
+ '`', '$', '%', '?', '\\', '==', '++', '--', '::', '*.', '+>', '->',
387
+ '<<', '>>', '|#', '##',
388
+ )
389
+
390
+ # ISO Modula-2 Additional Reserved Words Dataset
391
+ iso_additional_reserved_words = (
392
+ # 9 additional reserved words (ISO 10514-1)
393
+ 'EXCEPT', 'EXPORT', 'FINALLY', 'FORWARD', 'PACKEDSET', 'QUALIFIED',
394
+ 'REM', 'RETRY', 'WITH',
395
+ # 10 additional reserved words (ISO 10514-2 & ISO 10514-3)
396
+ 'ABSTRACT', 'AS', 'CLASS', 'GUARD', 'INHERIT', 'OVERRIDE', 'READONLY',
397
+ 'REVEAL', 'TRACED', 'UNSAFEGUARDED',
398
+ )
399
+
400
+ # ISO Modula-2 Additional Builtins Dataset
401
+ iso_additional_builtins = (
402
+ # 26 additional builtins (ISO 10514-1)
403
+ 'BITSET', 'CAP', 'CMPLX', 'COMPLEX', 'DEC', 'DISPOSE', 'EXCL', 'FLOAT',
404
+ 'HALT', 'HIGH', 'IM', 'INC', 'INCL', 'INT', 'INTERRUPTIBLE', 'LENGTH',
405
+ 'LFLOAT', 'LONGCOMPLEX', 'NEW', 'PROC', 'PROTECTION', 'RE', 'SIZE',
406
+ 'TRUNC', 'UNINTERRUBTIBLE', 'VAL',
407
+ # 5 additional builtins (ISO 10514-2 & ISO 10514-3)
408
+ 'CREATE', 'DESTROY', 'EMPTY', 'ISMEMBER', 'SELF',
409
+ )
410
+
411
+ # ISO Modula-2 Additional Pseudo-Module Builtins Dataset
412
+ iso_additional_pseudo_builtins = (
413
+ # 14 additional builtins (SYSTEM)
414
+ 'SYSTEM', 'BITSPERLOC', 'LOCSPERBYTE', 'LOCSPERWORD', 'LOC',
415
+ 'ADDADR', 'SUBADR', 'DIFADR', 'MAKEADR', 'ADR',
416
+ 'ROTATE', 'SHIFT', 'CAST', 'TSIZE',
417
+ # 13 additional builtins (COROUTINES)
418
+ 'COROUTINES', 'ATTACH', 'COROUTINE', 'CURRENT', 'DETACH', 'HANDLER',
419
+ 'INTERRUPTSOURCE', 'IOTRANSFER', 'IsATTACHED', 'LISTEN',
420
+ 'NEWCOROUTINE', 'PROT', 'TRANSFER',
421
+ # 9 additional builtins (EXCEPTIONS)
422
+ 'EXCEPTIONS', 'AllocateSource', 'CurrentNumber', 'ExceptionNumber',
423
+ 'ExceptionSource', 'GetMessage', 'IsCurrentSource',
424
+ 'IsExceptionalExecution', 'RAISE',
425
+ # 3 additional builtins (TERMINATION)
426
+ 'TERMINATION', 'IsTerminating', 'HasHalted',
427
+ # 4 additional builtins (M2EXCEPTION)
428
+ 'M2EXCEPTION', 'M2Exceptions', 'M2Exception', 'IsM2Exception',
429
+ 'indexException', 'rangeException', 'caseSelectException',
430
+ 'invalidLocation', 'functionException', 'wholeValueException',
431
+ 'wholeDivException', 'realValueException', 'realDivException',
432
+ 'complexValueException', 'complexDivException', 'protException',
433
+ 'sysException', 'coException', 'exException',
434
+ )
435
+
436
+ # M o d u l a - 2 R 1 0 D a t a s e t s
437
+
438
+ # Lexemes to Mark as Error Tokens for Modula-2 R10
439
+ m2r10_lexemes_to_reject = (
440
+ '!', '`', '@', '$', '%', '&', '<>',
441
+ )
442
+
443
+ # Modula-2 R10 reserved words in addition to the common set
444
+ m2r10_additional_reserved_words = (
445
+ # 12 additional reserved words
446
+ 'ALIAS', 'ARGLIST', 'BLUEPRINT', 'COPY', 'GENLIB', 'INDETERMINATE',
447
+ 'NEW', 'NONE', 'OPAQUE', 'REFERENTIAL', 'RELEASE', 'RETAIN',
448
+ # 2 additional reserved words with symbolic assembly option
449
+ 'ASM', 'REG',
450
+ )
451
+
452
+ # Modula-2 R10 builtins in addition to the common set
453
+ m2r10_additional_builtins = (
454
+ # 26 additional builtins
455
+ 'CARDINAL', 'COUNT', 'EMPTY', 'EXISTS', 'INSERT', 'LENGTH', 'LONGCARD',
456
+ 'OCTET', 'PTR', 'PRED', 'READ', 'READNEW', 'REMOVE', 'RETRIEVE', 'SORT',
457
+ 'STORE', 'SUBSET', 'SUCC', 'TLIMIT', 'TMAX', 'TMIN', 'TRUE', 'TSIZE',
458
+ 'UNICHAR', 'WRITE', 'WRITEF',
459
+ )
460
+
461
+ # Modula-2 R10 Additional Pseudo-Module Builtins Dataset
462
+ m2r10_additional_pseudo_builtins = (
463
+ # 13 additional builtins (TPROPERTIES)
464
+ 'TPROPERTIES', 'PROPERTY', 'LITERAL', 'TPROPERTY', 'TLITERAL',
465
+ 'TBUILTIN', 'TDYN', 'TREFC', 'TNIL', 'TBASE', 'TPRECISION',
466
+ 'TMAXEXP', 'TMINEXP',
467
+ # 4 additional builtins (CONVERSION)
468
+ 'CONVERSION', 'TSXFSIZE', 'SXF', 'VAL',
469
+ # 35 additional builtins (UNSAFE)
470
+ 'UNSAFE', 'CAST', 'INTRINSIC', 'AVAIL', 'ADD', 'SUB', 'ADDC', 'SUBC',
471
+ 'FETCHADD', 'FETCHSUB', 'SHL', 'SHR', 'ASHR', 'ROTL', 'ROTR', 'ROTLC',
472
+ 'ROTRC', 'BWNOT', 'BWAND', 'BWOR', 'BWXOR', 'BWNAND', 'BWNOR',
473
+ 'SETBIT', 'TESTBIT', 'LSBIT', 'MSBIT', 'CSBITS', 'BAIL', 'HALT',
474
+ 'TODO', 'FFI', 'ADDR', 'VARGLIST', 'VARGC',
475
+ # 11 additional builtins (ATOMIC)
476
+ 'ATOMIC', 'INTRINSIC', 'AVAIL', 'SWAP', 'CAS', 'INC', 'DEC', 'BWAND',
477
+ 'BWNAND', 'BWOR', 'BWXOR',
478
+ # 7 additional builtins (COMPILER)
479
+ 'COMPILER', 'DEBUG', 'MODNAME', 'PROCNAME', 'LINENUM', 'DEFAULT',
480
+ 'HASH',
481
+ # 5 additional builtins (ASSEMBLER)
482
+ 'ASSEMBLER', 'REGISTER', 'SETREG', 'GETREG', 'CODE',
483
+ )
484
+
485
+ # O b j e c t i v e M o d u l a - 2 D a t a s e t s
486
+
487
+ # Lexemes to Mark as Error Tokens for Objective Modula-2
488
+ objm2_lexemes_to_reject = (
489
+ '!', '$', '%', '&', '<>',
490
+ )
491
+
492
+ # Objective Modula-2 Extensions
493
+ # reserved words in addition to Modula-2 R10
494
+ objm2_additional_reserved_words = (
495
+ # 16 additional reserved words
496
+ 'BYCOPY', 'BYREF', 'CLASS', 'CONTINUE', 'CRITICAL', 'INOUT', 'METHOD',
497
+ 'ON', 'OPTIONAL', 'OUT', 'PRIVATE', 'PROTECTED', 'PROTOCOL', 'PUBLIC',
498
+ 'SUPER', 'TRY',
499
+ )
500
+
501
+ # Objective Modula-2 Extensions
502
+ # builtins in addition to Modula-2 R10
503
+ objm2_additional_builtins = (
504
+ # 3 additional builtins
505
+ 'OBJECT', 'NO', 'YES',
506
+ )
507
+
508
+ # Objective Modula-2 Extensions
509
+ # pseudo-module builtins in addition to Modula-2 R10
510
+ objm2_additional_pseudo_builtins = (
511
+ # None
512
+ )
513
+
514
+ # A g l e t M o d u l a - 2 D a t a s e t s
515
+
516
+ # Aglet Extensions
517
+ # reserved words in addition to ISO Modula-2
518
+ aglet_additional_reserved_words = (
519
+ # None
520
+ )
521
+
522
+ # Aglet Extensions
523
+ # builtins in addition to ISO Modula-2
524
+ aglet_additional_builtins = (
525
+ # 9 additional builtins
526
+ 'BITSET8', 'BITSET16', 'BITSET32', 'CARDINAL8', 'CARDINAL16',
527
+ 'CARDINAL32', 'INTEGER8', 'INTEGER16', 'INTEGER32',
528
+ )
529
+
530
+ # Aglet Modula-2 Extensions
531
+ # pseudo-module builtins in addition to ISO Modula-2
532
+ aglet_additional_pseudo_builtins = (
533
+ # None
534
+ )
535
+
536
+ # G N U M o d u l a - 2 D a t a s e t s
537
+
538
+ # GNU Extensions
539
+ # reserved words in addition to PIM Modula-2
540
+ gm2_additional_reserved_words = (
541
+ # 10 additional reserved words
542
+ 'ASM', '__ATTRIBUTE__', '__BUILTIN__', '__COLUMN__', '__DATE__',
543
+ '__FILE__', '__FUNCTION__', '__LINE__', '__MODULE__', 'VOLATILE',
544
+ )
545
+
546
+ # GNU Extensions
547
+ # builtins in addition to PIM Modula-2
548
+ gm2_additional_builtins = (
549
+ # 21 additional builtins
550
+ 'BITSET8', 'BITSET16', 'BITSET32', 'CARDINAL8', 'CARDINAL16',
551
+ 'CARDINAL32', 'CARDINAL64', 'COMPLEX32', 'COMPLEX64', 'COMPLEX96',
552
+ 'COMPLEX128', 'INTEGER8', 'INTEGER16', 'INTEGER32', 'INTEGER64',
553
+ 'REAL8', 'REAL16', 'REAL32', 'REAL96', 'REAL128', 'THROW',
554
+ )
555
+
556
+ # GNU Extensions
557
+ # pseudo-module builtins in addition to PIM Modula-2
558
+ gm2_additional_pseudo_builtins = (
559
+ # None
560
+ )
561
+
562
+ # p 1 M o d u l a - 2 D a t a s e t s
563
+
564
+ # p1 Extensions
565
+ # reserved words in addition to ISO Modula-2
566
+ p1_additional_reserved_words = (
567
+ # None
568
+ )
569
+
570
+ # p1 Extensions
571
+ # builtins in addition to ISO Modula-2
572
+ p1_additional_builtins = (
573
+ # None
574
+ )
575
+
576
+ # p1 Modula-2 Extensions
577
+ # pseudo-module builtins in addition to ISO Modula-2
578
+ p1_additional_pseudo_builtins = (
579
+ # 1 additional builtin
580
+ 'BCD',
581
+ )
582
+
583
+ # X D S M o d u l a - 2 D a t a s e t s
584
+
585
+ # XDS Extensions
586
+ # reserved words in addition to ISO Modula-2
587
+ xds_additional_reserved_words = (
588
+ # 1 additional reserved word
589
+ 'SEQ',
590
+ )
591
+
592
+ # XDS Extensions
593
+ # builtins in addition to ISO Modula-2
594
+ xds_additional_builtins = (
595
+ # 9 additional builtins
596
+ 'ASH', 'ASSERT', 'DIFFADR_TYPE', 'ENTIER', 'INDEX', 'LEN',
597
+ 'LONGCARD', 'SHORTCARD', 'SHORTINT',
598
+ )
599
+
600
+ # XDS Modula-2 Extensions
601
+ # pseudo-module builtins in addition to ISO Modula-2
602
+ xds_additional_pseudo_builtins = (
603
+ # 22 additional builtins (SYSTEM)
604
+ 'PROCESS', 'NEWPROCESS', 'BOOL8', 'BOOL16', 'BOOL32', 'CARD8',
605
+ 'CARD16', 'CARD32', 'INT8', 'INT16', 'INT32', 'REF', 'MOVE',
606
+ 'FILL', 'GET', 'PUT', 'CC', 'int', 'unsigned', 'size_t', 'void'
607
+ # 3 additional builtins (COMPILER)
608
+ 'COMPILER', 'OPTION', 'EQUATION'
609
+ )
610
+
611
+ # P I M S t a n d a r d L i b r a r y D a t a s e t s
612
+
613
+ # PIM Modula-2 Standard Library Modules Dataset
614
+ pim_stdlib_module_identifiers = (
615
+ 'Terminal', 'FileSystem', 'InOut', 'RealInOut', 'MathLib0', 'Storage',
616
+ )
617
+
618
+ # PIM Modula-2 Standard Library Types Dataset
619
+ pim_stdlib_type_identifiers = (
620
+ 'Flag', 'FlagSet', 'Response', 'Command', 'Lock', 'Permission',
621
+ 'MediumType', 'File', 'FileProc', 'DirectoryProc', 'FileCommand',
622
+ 'DirectoryCommand',
623
+ )
624
+
625
+ # PIM Modula-2 Standard Library Procedures Dataset
626
+ pim_stdlib_proc_identifiers = (
627
+ 'Read', 'BusyRead', 'ReadAgain', 'Write', 'WriteString', 'WriteLn',
628
+ 'Create', 'Lookup', 'Close', 'Delete', 'Rename', 'SetRead', 'SetWrite',
629
+ 'SetModify', 'SetOpen', 'Doio', 'SetPos', 'GetPos', 'Length', 'Reset',
630
+ 'Again', 'ReadWord', 'WriteWord', 'ReadChar', 'WriteChar',
631
+ 'CreateMedium', 'DeleteMedium', 'AssignName', 'DeassignName',
632
+ 'ReadMedium', 'LookupMedium', 'OpenInput', 'OpenOutput', 'CloseInput',
633
+ 'CloseOutput', 'ReadString', 'ReadInt', 'ReadCard', 'ReadWrd',
634
+ 'WriteInt', 'WriteCard', 'WriteOct', 'WriteHex', 'WriteWrd',
635
+ 'ReadReal', 'WriteReal', 'WriteFixPt', 'WriteRealOct', 'sqrt', 'exp',
636
+ 'ln', 'sin', 'cos', 'arctan', 'entier', 'ALLOCATE', 'DEALLOCATE',
637
+ )
638
+
639
+ # PIM Modula-2 Standard Library Variables Dataset
640
+ pim_stdlib_var_identifiers = (
641
+ 'Done', 'termCH', 'in', 'out'
642
+ )
643
+
644
+ # PIM Modula-2 Standard Library Constants Dataset
645
+ pim_stdlib_const_identifiers = (
646
+ 'EOL',
647
+ )
648
+
649
+ # I S O S t a n d a r d L i b r a r y D a t a s e t s
650
+
651
+ # ISO Modula-2 Standard Library Modules Dataset
652
+ iso_stdlib_module_identifiers = (
653
+ # TO DO
654
+ )
655
+
656
+ # ISO Modula-2 Standard Library Types Dataset
657
+ iso_stdlib_type_identifiers = (
658
+ # TO DO
659
+ )
660
+
661
+ # ISO Modula-2 Standard Library Procedures Dataset
662
+ iso_stdlib_proc_identifiers = (
663
+ # TO DO
664
+ )
665
+
666
+ # ISO Modula-2 Standard Library Variables Dataset
667
+ iso_stdlib_var_identifiers = (
668
+ # TO DO
669
+ )
670
+
671
+ # ISO Modula-2 Standard Library Constants Dataset
672
+ iso_stdlib_const_identifiers = (
673
+ # TO DO
674
+ )
675
+
676
+ # M 2 R 1 0 S t a n d a r d L i b r a r y D a t a s e t s
677
+
678
+ # Modula-2 R10 Standard Library ADTs Dataset
679
+ m2r10_stdlib_adt_identifiers = (
680
+ 'BCD', 'LONGBCD', 'BITSET', 'SHORTBITSET', 'LONGBITSET',
681
+ 'LONGLONGBITSET', 'COMPLEX', 'LONGCOMPLEX', 'SHORTCARD', 'LONGLONGCARD',
682
+ 'SHORTINT', 'LONGLONGINT', 'POSINT', 'SHORTPOSINT', 'LONGPOSINT',
683
+ 'LONGLONGPOSINT', 'BITSET8', 'BITSET16', 'BITSET32', 'BITSET64',
684
+ 'BITSET128', 'BS8', 'BS16', 'BS32', 'BS64', 'BS128', 'CARDINAL8',
685
+ 'CARDINAL16', 'CARDINAL32', 'CARDINAL64', 'CARDINAL128', 'CARD8',
686
+ 'CARD16', 'CARD32', 'CARD64', 'CARD128', 'INTEGER8', 'INTEGER16',
687
+ 'INTEGER32', 'INTEGER64', 'INTEGER128', 'INT8', 'INT16', 'INT32',
688
+ 'INT64', 'INT128', 'STRING', 'UNISTRING',
689
+ )
690
+
691
+ # Modula-2 R10 Standard Library Blueprints Dataset
692
+ m2r10_stdlib_blueprint_identifiers = (
693
+ 'ProtoRoot', 'ProtoComputational', 'ProtoNumeric', 'ProtoScalar',
694
+ 'ProtoNonScalar', 'ProtoCardinal', 'ProtoInteger', 'ProtoReal',
695
+ 'ProtoComplex', 'ProtoVector', 'ProtoTuple', 'ProtoCompArray',
696
+ 'ProtoCollection', 'ProtoStaticArray', 'ProtoStaticSet',
697
+ 'ProtoStaticString', 'ProtoArray', 'ProtoString', 'ProtoSet',
698
+ 'ProtoMultiSet', 'ProtoDictionary', 'ProtoMultiDict', 'ProtoExtension',
699
+ 'ProtoIO', 'ProtoCardMath', 'ProtoIntMath', 'ProtoRealMath',
700
+ )
701
+
702
+ # Modula-2 R10 Standard Library Modules Dataset
703
+ m2r10_stdlib_module_identifiers = (
704
+ 'ASCII', 'BooleanIO', 'CharIO', 'UnicharIO', 'OctetIO',
705
+ 'CardinalIO', 'LongCardIO', 'IntegerIO', 'LongIntIO', 'RealIO',
706
+ 'LongRealIO', 'BCDIO', 'LongBCDIO', 'CardMath', 'LongCardMath',
707
+ 'IntMath', 'LongIntMath', 'RealMath', 'LongRealMath', 'BCDMath',
708
+ 'LongBCDMath', 'FileIO', 'FileSystem', 'Storage', 'IOSupport',
709
+ )
710
+
711
+ # Modula-2 R10 Standard Library Types Dataset
712
+ m2r10_stdlib_type_identifiers = (
713
+ 'File', 'Status',
714
+ # TO BE COMPLETED
715
+ )
716
+
717
+ # Modula-2 R10 Standard Library Procedures Dataset
718
+ m2r10_stdlib_proc_identifiers = (
719
+ 'ALLOCATE', 'DEALLOCATE', 'SIZE',
720
+ # TO BE COMPLETED
721
+ )
722
+
723
+ # Modula-2 R10 Standard Library Variables Dataset
724
+ m2r10_stdlib_var_identifiers = (
725
+ 'stdIn', 'stdOut', 'stdErr',
726
+ )
727
+
728
+ # Modula-2 R10 Standard Library Constants Dataset
729
+ m2r10_stdlib_const_identifiers = (
730
+ 'pi', 'tau',
731
+ )
732
+
733
+ # D i a l e c t s
734
+
735
+ # Dialect modes
736
+ dialects = (
737
+ 'unknown',
738
+ 'm2pim', 'm2iso', 'm2r10', 'objm2',
739
+ 'm2iso+aglet', 'm2pim+gm2', 'm2iso+p1', 'm2iso+xds',
740
+ )
741
+
742
+ # D a t a b a s e s
743
+
744
+ # Lexemes to Mark as Errors Database
745
+ lexemes_to_reject_db = {
746
+ # Lexemes to reject for unknown dialect
747
+ 'unknown': (
748
+ # LEAVE THIS EMPTY
749
+ ),
750
+ # Lexemes to reject for PIM Modula-2
751
+ 'm2pim': (
752
+ pim_lexemes_to_reject,
753
+ ),
754
+ # Lexemes to reject for ISO Modula-2
755
+ 'm2iso': (
756
+ iso_lexemes_to_reject,
757
+ ),
758
+ # Lexemes to reject for Modula-2 R10
759
+ 'm2r10': (
760
+ m2r10_lexemes_to_reject,
761
+ ),
762
+ # Lexemes to reject for Objective Modula-2
763
+ 'objm2': (
764
+ objm2_lexemes_to_reject,
765
+ ),
766
+ # Lexemes to reject for Aglet Modula-2
767
+ 'm2iso+aglet': (
768
+ iso_lexemes_to_reject,
769
+ ),
770
+ # Lexemes to reject for GNU Modula-2
771
+ 'm2pim+gm2': (
772
+ pim_lexemes_to_reject,
773
+ ),
774
+ # Lexemes to reject for p1 Modula-2
775
+ 'm2iso+p1': (
776
+ iso_lexemes_to_reject,
777
+ ),
778
+ # Lexemes to reject for XDS Modula-2
779
+ 'm2iso+xds': (
780
+ iso_lexemes_to_reject,
781
+ ),
782
+ }
783
+
784
+ # Reserved Words Database
785
+ reserved_words_db = {
786
+ # Reserved words for unknown dialect
787
+ 'unknown': (
788
+ common_reserved_words,
789
+ pim_additional_reserved_words,
790
+ iso_additional_reserved_words,
791
+ m2r10_additional_reserved_words,
792
+ ),
793
+
794
+ # Reserved words for PIM Modula-2
795
+ 'm2pim': (
796
+ common_reserved_words,
797
+ pim_additional_reserved_words,
798
+ ),
799
+
800
+ # Reserved words for Modula-2 R10
801
+ 'm2iso': (
802
+ common_reserved_words,
803
+ iso_additional_reserved_words,
804
+ ),
805
+
806
+ # Reserved words for ISO Modula-2
807
+ 'm2r10': (
808
+ common_reserved_words,
809
+ m2r10_additional_reserved_words,
810
+ ),
811
+
812
+ # Reserved words for Objective Modula-2
813
+ 'objm2': (
814
+ common_reserved_words,
815
+ m2r10_additional_reserved_words,
816
+ objm2_additional_reserved_words,
817
+ ),
818
+
819
+ # Reserved words for Aglet Modula-2 Extensions
820
+ 'm2iso+aglet': (
821
+ common_reserved_words,
822
+ iso_additional_reserved_words,
823
+ aglet_additional_reserved_words,
824
+ ),
825
+
826
+ # Reserved words for GNU Modula-2 Extensions
827
+ 'm2pim+gm2': (
828
+ common_reserved_words,
829
+ pim_additional_reserved_words,
830
+ gm2_additional_reserved_words,
831
+ ),
832
+
833
+ # Reserved words for p1 Modula-2 Extensions
834
+ 'm2iso+p1': (
835
+ common_reserved_words,
836
+ iso_additional_reserved_words,
837
+ p1_additional_reserved_words,
838
+ ),
839
+
840
+ # Reserved words for XDS Modula-2 Extensions
841
+ 'm2iso+xds': (
842
+ common_reserved_words,
843
+ iso_additional_reserved_words,
844
+ xds_additional_reserved_words,
845
+ ),
846
+ }
847
+
848
+ # Builtins Database
849
+ builtins_db = {
850
+ # Builtins for unknown dialect
851
+ 'unknown': (
852
+ common_builtins,
853
+ pim_additional_builtins,
854
+ iso_additional_builtins,
855
+ m2r10_additional_builtins,
856
+ ),
857
+
858
+ # Builtins for PIM Modula-2
859
+ 'm2pim': (
860
+ common_builtins,
861
+ pim_additional_builtins,
862
+ ),
863
+
864
+ # Builtins for ISO Modula-2
865
+ 'm2iso': (
866
+ common_builtins,
867
+ iso_additional_builtins,
868
+ ),
869
+
870
+ # Builtins for ISO Modula-2
871
+ 'm2r10': (
872
+ common_builtins,
873
+ m2r10_additional_builtins,
874
+ ),
875
+
876
+ # Builtins for Objective Modula-2
877
+ 'objm2': (
878
+ common_builtins,
879
+ m2r10_additional_builtins,
880
+ objm2_additional_builtins,
881
+ ),
882
+
883
+ # Builtins for Aglet Modula-2 Extensions
884
+ 'm2iso+aglet': (
885
+ common_builtins,
886
+ iso_additional_builtins,
887
+ aglet_additional_builtins,
888
+ ),
889
+
890
+ # Builtins for GNU Modula-2 Extensions
891
+ 'm2pim+gm2': (
892
+ common_builtins,
893
+ pim_additional_builtins,
894
+ gm2_additional_builtins,
895
+ ),
896
+
897
+ # Builtins for p1 Modula-2 Extensions
898
+ 'm2iso+p1': (
899
+ common_builtins,
900
+ iso_additional_builtins,
901
+ p1_additional_builtins,
902
+ ),
903
+
904
+ # Builtins for XDS Modula-2 Extensions
905
+ 'm2iso+xds': (
906
+ common_builtins,
907
+ iso_additional_builtins,
908
+ xds_additional_builtins,
909
+ ),
910
+ }
911
+
912
+ # Pseudo-Module Builtins Database
913
+ pseudo_builtins_db = {
914
+ # Builtins for unknown dialect
915
+ 'unknown': (
916
+ common_pseudo_builtins,
917
+ pim_additional_pseudo_builtins,
918
+ iso_additional_pseudo_builtins,
919
+ m2r10_additional_pseudo_builtins,
920
+ ),
921
+
922
+ # Builtins for PIM Modula-2
923
+ 'm2pim': (
924
+ common_pseudo_builtins,
925
+ pim_additional_pseudo_builtins,
926
+ ),
927
+
928
+ # Builtins for ISO Modula-2
929
+ 'm2iso': (
930
+ common_pseudo_builtins,
931
+ iso_additional_pseudo_builtins,
932
+ ),
933
+
934
+ # Builtins for ISO Modula-2
935
+ 'm2r10': (
936
+ common_pseudo_builtins,
937
+ m2r10_additional_pseudo_builtins,
938
+ ),
939
+
940
+ # Builtins for Objective Modula-2
941
+ 'objm2': (
942
+ common_pseudo_builtins,
943
+ m2r10_additional_pseudo_builtins,
944
+ objm2_additional_pseudo_builtins,
945
+ ),
946
+
947
+ # Builtins for Aglet Modula-2 Extensions
948
+ 'm2iso+aglet': (
949
+ common_pseudo_builtins,
950
+ iso_additional_pseudo_builtins,
951
+ aglet_additional_pseudo_builtins,
952
+ ),
953
+
954
+ # Builtins for GNU Modula-2 Extensions
955
+ 'm2pim+gm2': (
956
+ common_pseudo_builtins,
957
+ pim_additional_pseudo_builtins,
958
+ gm2_additional_pseudo_builtins,
959
+ ),
960
+
961
+ # Builtins for p1 Modula-2 Extensions
962
+ 'm2iso+p1': (
963
+ common_pseudo_builtins,
964
+ iso_additional_pseudo_builtins,
965
+ p1_additional_pseudo_builtins,
966
+ ),
967
+
968
+ # Builtins for XDS Modula-2 Extensions
969
+ 'm2iso+xds': (
970
+ common_pseudo_builtins,
971
+ iso_additional_pseudo_builtins,
972
+ xds_additional_pseudo_builtins,
973
+ ),
974
+ }
975
+
976
+ # Standard Library ADTs Database
977
+ stdlib_adts_db = {
978
+ # Empty entry for unknown dialect
979
+ 'unknown': (
980
+ # LEAVE THIS EMPTY
981
+ ),
982
+ # Standard Library ADTs for PIM Modula-2
983
+ 'm2pim': (
984
+ # No first class library types
985
+ ),
986
+
987
+ # Standard Library ADTs for ISO Modula-2
988
+ 'm2iso': (
989
+ # No first class library types
990
+ ),
991
+
992
+ # Standard Library ADTs for Modula-2 R10
993
+ 'm2r10': (
994
+ m2r10_stdlib_adt_identifiers,
995
+ ),
996
+
997
+ # Standard Library ADTs for Objective Modula-2
998
+ 'objm2': (
999
+ m2r10_stdlib_adt_identifiers,
1000
+ ),
1001
+
1002
+ # Standard Library ADTs for Aglet Modula-2
1003
+ 'm2iso+aglet': (
1004
+ # No first class library types
1005
+ ),
1006
+
1007
+ # Standard Library ADTs for GNU Modula-2
1008
+ 'm2pim+gm2': (
1009
+ # No first class library types
1010
+ ),
1011
+
1012
+ # Standard Library ADTs for p1 Modula-2
1013
+ 'm2iso+p1': (
1014
+ # No first class library types
1015
+ ),
1016
+
1017
+ # Standard Library ADTs for XDS Modula-2
1018
+ 'm2iso+xds': (
1019
+ # No first class library types
1020
+ ),
1021
+ }
1022
+
1023
+ # Standard Library Modules Database
1024
+ stdlib_modules_db = {
1025
+ # Empty entry for unknown dialect
1026
+ 'unknown': (
1027
+ # LEAVE THIS EMPTY
1028
+ ),
1029
+ # Standard Library Modules for PIM Modula-2
1030
+ 'm2pim': (
1031
+ pim_stdlib_module_identifiers,
1032
+ ),
1033
+
1034
+ # Standard Library Modules for ISO Modula-2
1035
+ 'm2iso': (
1036
+ iso_stdlib_module_identifiers,
1037
+ ),
1038
+
1039
+ # Standard Library Modules for Modula-2 R10
1040
+ 'm2r10': (
1041
+ m2r10_stdlib_blueprint_identifiers,
1042
+ m2r10_stdlib_module_identifiers,
1043
+ m2r10_stdlib_adt_identifiers,
1044
+ ),
1045
+
1046
+ # Standard Library Modules for Objective Modula-2
1047
+ 'objm2': (
1048
+ m2r10_stdlib_blueprint_identifiers,
1049
+ m2r10_stdlib_module_identifiers,
1050
+ ),
1051
+
1052
+ # Standard Library Modules for Aglet Modula-2
1053
+ 'm2iso+aglet': (
1054
+ iso_stdlib_module_identifiers,
1055
+ ),
1056
+
1057
+ # Standard Library Modules for GNU Modula-2
1058
+ 'm2pim+gm2': (
1059
+ pim_stdlib_module_identifiers,
1060
+ ),
1061
+
1062
+ # Standard Library Modules for p1 Modula-2
1063
+ 'm2iso+p1': (
1064
+ iso_stdlib_module_identifiers,
1065
+ ),
1066
+
1067
+ # Standard Library Modules for XDS Modula-2
1068
+ 'm2iso+xds': (
1069
+ iso_stdlib_module_identifiers,
1070
+ ),
1071
+ }
1072
+
1073
+ # Standard Library Types Database
1074
+ stdlib_types_db = {
1075
+ # Empty entry for unknown dialect
1076
+ 'unknown': (
1077
+ # LEAVE THIS EMPTY
1078
+ ),
1079
+ # Standard Library Types for PIM Modula-2
1080
+ 'm2pim': (
1081
+ pim_stdlib_type_identifiers,
1082
+ ),
1083
+
1084
+ # Standard Library Types for ISO Modula-2
1085
+ 'm2iso': (
1086
+ iso_stdlib_type_identifiers,
1087
+ ),
1088
+
1089
+ # Standard Library Types for Modula-2 R10
1090
+ 'm2r10': (
1091
+ m2r10_stdlib_type_identifiers,
1092
+ ),
1093
+
1094
+ # Standard Library Types for Objective Modula-2
1095
+ 'objm2': (
1096
+ m2r10_stdlib_type_identifiers,
1097
+ ),
1098
+
1099
+ # Standard Library Types for Aglet Modula-2
1100
+ 'm2iso+aglet': (
1101
+ iso_stdlib_type_identifiers,
1102
+ ),
1103
+
1104
+ # Standard Library Types for GNU Modula-2
1105
+ 'm2pim+gm2': (
1106
+ pim_stdlib_type_identifiers,
1107
+ ),
1108
+
1109
+ # Standard Library Types for p1 Modula-2
1110
+ 'm2iso+p1': (
1111
+ iso_stdlib_type_identifiers,
1112
+ ),
1113
+
1114
+ # Standard Library Types for XDS Modula-2
1115
+ 'm2iso+xds': (
1116
+ iso_stdlib_type_identifiers,
1117
+ ),
1118
+ }
1119
+
1120
+ # Standard Library Procedures Database
1121
+ stdlib_procedures_db = {
1122
+ # Empty entry for unknown dialect
1123
+ 'unknown': (
1124
+ # LEAVE THIS EMPTY
1125
+ ),
1126
+ # Standard Library Procedures for PIM Modula-2
1127
+ 'm2pim': (
1128
+ pim_stdlib_proc_identifiers,
1129
+ ),
1130
+
1131
+ # Standard Library Procedures for ISO Modula-2
1132
+ 'm2iso': (
1133
+ iso_stdlib_proc_identifiers,
1134
+ ),
1135
+
1136
+ # Standard Library Procedures for Modula-2 R10
1137
+ 'm2r10': (
1138
+ m2r10_stdlib_proc_identifiers,
1139
+ ),
1140
+
1141
+ # Standard Library Procedures for Objective Modula-2
1142
+ 'objm2': (
1143
+ m2r10_stdlib_proc_identifiers,
1144
+ ),
1145
+
1146
+ # Standard Library Procedures for Aglet Modula-2
1147
+ 'm2iso+aglet': (
1148
+ iso_stdlib_proc_identifiers,
1149
+ ),
1150
+
1151
+ # Standard Library Procedures for GNU Modula-2
1152
+ 'm2pim+gm2': (
1153
+ pim_stdlib_proc_identifiers,
1154
+ ),
1155
+
1156
+ # Standard Library Procedures for p1 Modula-2
1157
+ 'm2iso+p1': (
1158
+ iso_stdlib_proc_identifiers,
1159
+ ),
1160
+
1161
+ # Standard Library Procedures for XDS Modula-2
1162
+ 'm2iso+xds': (
1163
+ iso_stdlib_proc_identifiers,
1164
+ ),
1165
+ }
1166
+
1167
+ # Standard Library Variables Database
1168
+ stdlib_variables_db = {
1169
+ # Empty entry for unknown dialect
1170
+ 'unknown': (
1171
+ # LEAVE THIS EMPTY
1172
+ ),
1173
+ # Standard Library Variables for PIM Modula-2
1174
+ 'm2pim': (
1175
+ pim_stdlib_var_identifiers,
1176
+ ),
1177
+
1178
+ # Standard Library Variables for ISO Modula-2
1179
+ 'm2iso': (
1180
+ iso_stdlib_var_identifiers,
1181
+ ),
1182
+
1183
+ # Standard Library Variables for Modula-2 R10
1184
+ 'm2r10': (
1185
+ m2r10_stdlib_var_identifiers,
1186
+ ),
1187
+
1188
+ # Standard Library Variables for Objective Modula-2
1189
+ 'objm2': (
1190
+ m2r10_stdlib_var_identifiers,
1191
+ ),
1192
+
1193
+ # Standard Library Variables for Aglet Modula-2
1194
+ 'm2iso+aglet': (
1195
+ iso_stdlib_var_identifiers,
1196
+ ),
1197
+
1198
+ # Standard Library Variables for GNU Modula-2
1199
+ 'm2pim+gm2': (
1200
+ pim_stdlib_var_identifiers,
1201
+ ),
1202
+
1203
+ # Standard Library Variables for p1 Modula-2
1204
+ 'm2iso+p1': (
1205
+ iso_stdlib_var_identifiers,
1206
+ ),
1207
+
1208
+ # Standard Library Variables for XDS Modula-2
1209
+ 'm2iso+xds': (
1210
+ iso_stdlib_var_identifiers,
1211
+ ),
1212
+ }
1213
+
1214
+ # Standard Library Constants Database
1215
+ stdlib_constants_db = {
1216
+ # Empty entry for unknown dialect
1217
+ 'unknown': (
1218
+ # LEAVE THIS EMPTY
1219
+ ),
1220
+ # Standard Library Constants for PIM Modula-2
1221
+ 'm2pim': (
1222
+ pim_stdlib_const_identifiers,
1223
+ ),
1224
+
1225
+ # Standard Library Constants for ISO Modula-2
1226
+ 'm2iso': (
1227
+ iso_stdlib_const_identifiers,
1228
+ ),
1229
+
1230
+ # Standard Library Constants for Modula-2 R10
1231
+ 'm2r10': (
1232
+ m2r10_stdlib_const_identifiers,
1233
+ ),
1234
+
1235
+ # Standard Library Constants for Objective Modula-2
1236
+ 'objm2': (
1237
+ m2r10_stdlib_const_identifiers,
1238
+ ),
1239
+
1240
+ # Standard Library Constants for Aglet Modula-2
1241
+ 'm2iso+aglet': (
1242
+ iso_stdlib_const_identifiers,
1243
+ ),
1244
+
1245
+ # Standard Library Constants for GNU Modula-2
1246
+ 'm2pim+gm2': (
1247
+ pim_stdlib_const_identifiers,
1248
+ ),
1249
+
1250
+ # Standard Library Constants for p1 Modula-2
1251
+ 'm2iso+p1': (
1252
+ iso_stdlib_const_identifiers,
1253
+ ),
1254
+
1255
+ # Standard Library Constants for XDS Modula-2
1256
+ 'm2iso+xds': (
1257
+ iso_stdlib_const_identifiers,
1258
+ ),
1259
+ }
1260
+
1261
+ # M e t h o d s
1262
+
1263
+ # initialise a lexer instance
1264
+ def __init__(self, **options):
1265
+ #
1266
+ # check dialect options
1267
+ #
1268
+ dialects = get_list_opt(options, 'dialect', [])
1269
+ #
1270
+ for dialect_option in dialects:
1271
+ if dialect_option in self.dialects[1:-1]:
1272
+ # valid dialect option found
1273
+ self.set_dialect(dialect_option)
1274
+ break
1275
+ #
1276
+ # Fallback Mode (DEFAULT)
1277
+ else:
1278
+ # no valid dialect option
1279
+ self.set_dialect('unknown')
1280
+ #
1281
+ self.dialect_set_by_tag = False
1282
+ #
1283
+ # check style options
1284
+ #
1285
+ styles = get_list_opt(options, 'style', [])
1286
+ #
1287
+ # use lowercase mode for Algol style
1288
+ if 'algol' in styles or 'algol_nu' in styles:
1289
+ self.algol_publication_mode = True
1290
+ else:
1291
+ self.algol_publication_mode = False
1292
+ #
1293
+ # Check option flags
1294
+ #
1295
+ self.treat_stdlib_adts_as_builtins = get_bool_opt(
1296
+ options, 'treat_stdlib_adts_as_builtins', True)
1297
+ #
1298
+ # call superclass initialiser
1299
+ RegexLexer.__init__(self, **options)
1300
+
1301
+ # Set lexer to a specified dialect
1302
+ def set_dialect(self, dialect_id):
1303
+ #
1304
+ # if __debug__:
1305
+ # print 'entered set_dialect with arg: ', dialect_id
1306
+ #
1307
+ # check dialect name against known dialects
1308
+ if dialect_id not in self.dialects:
1309
+ dialect = 'unknown' # default
1310
+ else:
1311
+ dialect = dialect_id
1312
+ #
1313
+ # compose lexemes to reject set
1314
+ lexemes_to_reject_set = set()
1315
+ # add each list of reject lexemes for this dialect
1316
+ for list in self.lexemes_to_reject_db[dialect]:
1317
+ lexemes_to_reject_set.update(set(list))
1318
+ #
1319
+ # compose reserved words set
1320
+ reswords_set = set()
1321
+ # add each list of reserved words for this dialect
1322
+ for list in self.reserved_words_db[dialect]:
1323
+ reswords_set.update(set(list))
1324
+ #
1325
+ # compose builtins set
1326
+ builtins_set = set()
1327
+ # add each list of builtins for this dialect excluding reserved words
1328
+ for list in self.builtins_db[dialect]:
1329
+ builtins_set.update(set(list).difference(reswords_set))
1330
+ #
1331
+ # compose pseudo-builtins set
1332
+ pseudo_builtins_set = set()
1333
+ # add each list of builtins for this dialect excluding reserved words
1334
+ for list in self.pseudo_builtins_db[dialect]:
1335
+ pseudo_builtins_set.update(set(list).difference(reswords_set))
1336
+ #
1337
+ # compose ADTs set
1338
+ adts_set = set()
1339
+ # add each list of ADTs for this dialect excluding reserved words
1340
+ for list in self.stdlib_adts_db[dialect]:
1341
+ adts_set.update(set(list).difference(reswords_set))
1342
+ #
1343
+ # compose modules set
1344
+ modules_set = set()
1345
+ # add each list of builtins for this dialect excluding builtins
1346
+ for list in self.stdlib_modules_db[dialect]:
1347
+ modules_set.update(set(list).difference(builtins_set))
1348
+ #
1349
+ # compose types set
1350
+ types_set = set()
1351
+ # add each list of types for this dialect excluding builtins
1352
+ for list in self.stdlib_types_db[dialect]:
1353
+ types_set.update(set(list).difference(builtins_set))
1354
+ #
1355
+ # compose procedures set
1356
+ procedures_set = set()
1357
+ # add each list of procedures for this dialect excluding builtins
1358
+ for list in self.stdlib_procedures_db[dialect]:
1359
+ procedures_set.update(set(list).difference(builtins_set))
1360
+ #
1361
+ # compose variables set
1362
+ variables_set = set()
1363
+ # add each list of variables for this dialect excluding builtins
1364
+ for list in self.stdlib_variables_db[dialect]:
1365
+ variables_set.update(set(list).difference(builtins_set))
1366
+ #
1367
+ # compose constants set
1368
+ constants_set = set()
1369
+ # add each list of constants for this dialect excluding builtins
1370
+ for list in self.stdlib_constants_db[dialect]:
1371
+ constants_set.update(set(list).difference(builtins_set))
1372
+ #
1373
+ # update lexer state
1374
+ self.dialect = dialect
1375
+ self.lexemes_to_reject = lexemes_to_reject_set
1376
+ self.reserved_words = reswords_set
1377
+ self.builtins = builtins_set
1378
+ self.pseudo_builtins = pseudo_builtins_set
1379
+ self.adts = adts_set
1380
+ self.modules = modules_set
1381
+ self.types = types_set
1382
+ self.procedures = procedures_set
1383
+ self.variables = variables_set
1384
+ self.constants = constants_set
1385
+ #
1386
+ # if __debug__:
1387
+ # print 'exiting set_dialect'
1388
+ # print ' self.dialect: ', self.dialect
1389
+ # print ' self.lexemes_to_reject: ', self.lexemes_to_reject
1390
+ # print ' self.reserved_words: ', self.reserved_words
1391
+ # print ' self.builtins: ', self.builtins
1392
+ # print ' self.pseudo_builtins: ', self.pseudo_builtins
1393
+ # print ' self.adts: ', self.adts
1394
+ # print ' self.modules: ', self.modules
1395
+ # print ' self.types: ', self.types
1396
+ # print ' self.procedures: ', self.procedures
1397
+ # print ' self.variables: ', self.variables
1398
+ # print ' self.types: ', self.types
1399
+ # print ' self.constants: ', self.constants
1400
+
1401
+ # Extracts a dialect name from a dialect tag comment string and checks
1402
+ # the extracted name against known dialects. If a match is found, the
1403
+ # matching name is returned, otherwise dialect id 'unknown' is returned
1404
+ def get_dialect_from_dialect_tag(self, dialect_tag):
1405
+ #
1406
+ # if __debug__:
1407
+ # print 'entered get_dialect_from_dialect_tag with arg: ', dialect_tag
1408
+ #
1409
+ # constants
1410
+ left_tag_delim = '(*!'
1411
+ right_tag_delim = '*)'
1412
+ left_tag_delim_len = len(left_tag_delim)
1413
+ right_tag_delim_len = len(right_tag_delim)
1414
+ indicator_start = left_tag_delim_len
1415
+ indicator_end = -(right_tag_delim_len)
1416
+ #
1417
+ # check comment string for dialect indicator
1418
+ if len(dialect_tag) > (left_tag_delim_len + right_tag_delim_len) \
1419
+ and dialect_tag.startswith(left_tag_delim) \
1420
+ and dialect_tag.endswith(right_tag_delim):
1421
+ #
1422
+ # if __debug__:
1423
+ # print 'dialect tag found'
1424
+ #
1425
+ # extract dialect indicator
1426
+ indicator = dialect_tag[indicator_start:indicator_end]
1427
+ #
1428
+ # if __debug__:
1429
+ # print 'extracted: ', indicator
1430
+ #
1431
+ # check against known dialects
1432
+ for index in range(1, len(self.dialects)):
1433
+ #
1434
+ # if __debug__:
1435
+ # print 'dialects[', index, ']: ', self.dialects[index]
1436
+ #
1437
+ if indicator == self.dialects[index]:
1438
+ #
1439
+ # if __debug__:
1440
+ # print 'matching dialect found'
1441
+ #
1442
+ # indicator matches known dialect
1443
+ return indicator
1444
+ else:
1445
+ # indicator does not match any dialect
1446
+ return 'unknown' # default
1447
+ else:
1448
+ # invalid indicator string
1449
+ return 'unknown' # default
1450
+
1451
+ # intercept the token stream, modify token attributes and return them
1452
+ def get_tokens_unprocessed(self, text):
1453
+ for index, token, value in RegexLexer.get_tokens_unprocessed(self, text):
1454
+ #
1455
+ # check for dialect tag if dialect has not been set by tag
1456
+ if not self.dialect_set_by_tag and token == Comment.Special:
1457
+ indicated_dialect = self.get_dialect_from_dialect_tag(value)
1458
+ if indicated_dialect != 'unknown':
1459
+ # token is a dialect indicator
1460
+ # reset reserved words and builtins
1461
+ self.set_dialect(indicated_dialect)
1462
+ self.dialect_set_by_tag = True
1463
+ #
1464
+ # check for reserved words, predefined and stdlib identifiers
1465
+ if token is Name:
1466
+ if value in self.reserved_words:
1467
+ token = Keyword.Reserved
1468
+ if self.algol_publication_mode:
1469
+ value = value.lower()
1470
+ #
1471
+ elif value in self.builtins:
1472
+ token = Name.Builtin
1473
+ if self.algol_publication_mode:
1474
+ value = value.lower()
1475
+ #
1476
+ elif value in self.pseudo_builtins:
1477
+ token = Name.Builtin.Pseudo
1478
+ if self.algol_publication_mode:
1479
+ value = value.lower()
1480
+ #
1481
+ elif value in self.adts:
1482
+ if not self.treat_stdlib_adts_as_builtins:
1483
+ token = Name.Namespace
1484
+ else:
1485
+ token = Name.Builtin.Pseudo
1486
+ if self.algol_publication_mode:
1487
+ value = value.lower()
1488
+ #
1489
+ elif value in self.modules:
1490
+ token = Name.Namespace
1491
+ #
1492
+ elif value in self.types:
1493
+ token = Name.Class
1494
+ #
1495
+ elif value in self.procedures:
1496
+ token = Name.Function
1497
+ #
1498
+ elif value in self.variables:
1499
+ token = Name.Variable
1500
+ #
1501
+ elif value in self.constants:
1502
+ token = Name.Constant
1503
+ #
1504
+ elif token in Number:
1505
+ #
1506
+ # mark prefix number literals as error for PIM and ISO dialects
1507
+ if self.dialect not in ('unknown', 'm2r10', 'objm2'):
1508
+ if "'" in value or value[0:2] in ('0b', '0x', '0u'):
1509
+ token = Error
1510
+ #
1511
+ elif self.dialect in ('m2r10', 'objm2'):
1512
+ # mark base-8 number literals as errors for M2 R10 and ObjM2
1513
+ if token is Number.Oct:
1514
+ token = Error
1515
+ # mark suffix base-16 literals as errors for M2 R10 and ObjM2
1516
+ elif token is Number.Hex and 'H' in value:
1517
+ token = Error
1518
+ # mark real numbers with E as errors for M2 R10 and ObjM2
1519
+ elif token is Number.Float and 'E' in value:
1520
+ token = Error
1521
+ #
1522
+ elif token in Comment:
1523
+ #
1524
+ # mark single line comment as error for PIM and ISO dialects
1525
+ if token is Comment.Single:
1526
+ if self.dialect not in ('unknown', 'm2r10', 'objm2'):
1527
+ token = Error
1528
+ #
1529
+ if token is Comment.Preproc:
1530
+ # mark ISO pragma as error for PIM dialects
1531
+ if value.startswith('<*') and \
1532
+ self.dialect.startswith('m2pim'):
1533
+ token = Error
1534
+ # mark PIM pragma as comment for other dialects
1535
+ elif value.startswith('(*$') and \
1536
+ self.dialect != 'unknown' and \
1537
+ not self.dialect.startswith('m2pim'):
1538
+ token = Comment.Multiline
1539
+ #
1540
+ else: # token is neither Name nor Comment
1541
+ #
1542
+ # mark lexemes matching the dialect's error token set as errors
1543
+ if value in self.lexemes_to_reject:
1544
+ token = Error
1545
+ #
1546
+ # substitute lexemes when in Algol mode
1547
+ if self.algol_publication_mode:
1548
+ if value == '#':
1549
+ value = '≠'
1550
+ elif value == '<=':
1551
+ value = '≤'
1552
+ elif value == '>=':
1553
+ value = '≥'
1554
+ elif value == '==':
1555
+ value = '≡'
1556
+ elif value == '*.':
1557
+ value = '•'
1558
+
1559
+ # return result
1560
+ yield index, token, value
1561
+
1562
+ def analyse_text(text):
1563
+ """It's Pascal-like, but does not use FUNCTION -- uses PROCEDURE
1564
+ instead."""
1565
+
1566
+ # Check if this looks like Pascal, if not, bail out early
1567
+ if not ('(*' in text and '*)' in text and ':=' in text):
1568
+ return
1569
+
1570
+ result = 0
1571
+ # Procedure is in Modula2
1572
+ if re.search(r'\bPROCEDURE\b', text):
1573
+ result += 0.6
1574
+
1575
+ # FUNCTION is only valid in Pascal, but not in Modula2
1576
+ if re.search(r'\bFUNCTION\b', text):
1577
+ result = 0.0
1578
+
1579
+ return result
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/mojo.py ADDED
@@ -0,0 +1,707 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.mojo
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Mojo and related languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import keyword
12
+
13
+ from pygments import unistring as uni
14
+ from pygments.lexer import (
15
+ RegexLexer,
16
+ bygroups,
17
+ combined,
18
+ default,
19
+ include,
20
+ this,
21
+ using,
22
+ words,
23
+ )
24
+ from pygments.token import (
25
+ Comment,
26
+ # Error,
27
+ Keyword,
28
+ Name,
29
+ Number,
30
+ Operator,
31
+ Punctuation,
32
+ String,
33
+ Text,
34
+ Whitespace,
35
+ )
36
+ from pygments.util import shebang_matches
37
+
38
+ __all__ = ["MojoLexer"]
39
+
40
+
41
+ class MojoLexer(RegexLexer):
42
+ """
43
+ For Mojo source code (version 24.2.1).
44
+ """
45
+
46
+ name = "Mojo"
47
+ url = "https://docs.modular.com/mojo/"
48
+ aliases = ["mojo", "🔥"]
49
+ filenames = [
50
+ "*.mojo",
51
+ "*.🔥",
52
+ ]
53
+ mimetypes = [
54
+ "text/x-mojo",
55
+ "application/x-mojo",
56
+ ]
57
+ version_added = "2.18"
58
+
59
+ uni_name = f"[{uni.xid_start}][{uni.xid_continue}]*"
60
+
61
+ def innerstring_rules(ttype):
62
+ return [
63
+ # the old style '%s' % (...) string formatting (still valid in Py3)
64
+ (
65
+ r"%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?"
66
+ "[hlL]?[E-GXc-giorsaux%]",
67
+ String.Interpol,
68
+ ),
69
+ # the new style '{}'.format(...) string formatting
70
+ (
71
+ r"\{"
72
+ r"((\w+)((\.\w+)|(\[[^\]]+\]))*)?" # field name
73
+ r"(\![sra])?" # conversion
74
+ r"(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?"
75
+ r"\}",
76
+ String.Interpol,
77
+ ),
78
+ # backslashes, quotes and formatting signs must be parsed one at a time
79
+ (r'[^\\\'"%{\n]+', ttype),
80
+ (r'[\'"\\]', ttype),
81
+ # unhandled string formatting sign
82
+ (r"%|(\{{1,2})", ttype),
83
+ # newlines are an error (use "nl" state)
84
+ ]
85
+
86
+ def fstring_rules(ttype):
87
+ return [
88
+ # Assuming that a '}' is the closing brace after format specifier.
89
+ # Sadly, this means that we won't detect syntax error. But it's
90
+ # more important to parse correct syntax correctly, than to
91
+ # highlight invalid syntax.
92
+ (r"\}", String.Interpol),
93
+ (r"\{", String.Interpol, "expr-inside-fstring"),
94
+ # backslashes, quotes and formatting signs must be parsed one at a time
95
+ (r'[^\\\'"{}\n]+', ttype),
96
+ (r'[\'"\\]', ttype),
97
+ # newlines are an error (use "nl" state)
98
+ ]
99
+
100
+ tokens = {
101
+ "root": [
102
+ (r"\s+", Whitespace),
103
+ (
104
+ r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")',
105
+ bygroups(Whitespace, String.Affix, String.Doc),
106
+ ),
107
+ (
108
+ r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')",
109
+ bygroups(Whitespace, String.Affix, String.Doc),
110
+ ),
111
+ (r"\A#!.+$", Comment.Hashbang),
112
+ (r"#.*$", Comment.Single),
113
+ (r"\\\n", Whitespace),
114
+ (r"\\", Whitespace),
115
+ include("keywords"),
116
+ include("soft-keywords"),
117
+ # In the original PR, all the below here used ((?:\s|\\\s)+) to
118
+ # designate whitespace, but I can't find any example of this being
119
+ # needed in the example file, so we're replacing it with `\s+`.
120
+ (
121
+ r"(alias)(\s+)",
122
+ bygroups(Keyword, Whitespace),
123
+ "varname", # TODO varname the right fit?
124
+ ),
125
+ (r"(var)(\s+)", bygroups(Keyword, Whitespace), "varname"),
126
+ (r"(def)(\s+)", bygroups(Keyword, Whitespace), "funcname"),
127
+ (r"(fn)(\s+)", bygroups(Keyword, Whitespace), "funcname"),
128
+ (
129
+ r"(class)(\s+)",
130
+ bygroups(Keyword, Whitespace),
131
+ "classname",
132
+ ), # not implemented yet
133
+ (r"(struct)(\s+)", bygroups(Keyword, Whitespace), "structname"),
134
+ (r"(trait)(\s+)", bygroups(Keyword, Whitespace), "structname"),
135
+ (r"(from)(\s+)", bygroups(Keyword.Namespace, Whitespace), "fromimport"),
136
+ (r"(import)(\s+)", bygroups(Keyword.Namespace, Whitespace), "import"),
137
+ include("expr"),
138
+ ],
139
+ "expr": [
140
+ # raw f-strings
141
+ (
142
+ '(?i)(rf|fr)(""")',
143
+ bygroups(String.Affix, String.Double),
144
+ combined("rfstringescape", "tdqf"),
145
+ ),
146
+ (
147
+ "(?i)(rf|fr)(''')",
148
+ bygroups(String.Affix, String.Single),
149
+ combined("rfstringescape", "tsqf"),
150
+ ),
151
+ (
152
+ '(?i)(rf|fr)(")',
153
+ bygroups(String.Affix, String.Double),
154
+ combined("rfstringescape", "dqf"),
155
+ ),
156
+ (
157
+ "(?i)(rf|fr)(')",
158
+ bygroups(String.Affix, String.Single),
159
+ combined("rfstringescape", "sqf"),
160
+ ),
161
+ # non-raw f-strings
162
+ (
163
+ '([fF])(""")',
164
+ bygroups(String.Affix, String.Double),
165
+ combined("fstringescape", "tdqf"),
166
+ ),
167
+ (
168
+ "([fF])(''')",
169
+ bygroups(String.Affix, String.Single),
170
+ combined("fstringescape", "tsqf"),
171
+ ),
172
+ (
173
+ '([fF])(")',
174
+ bygroups(String.Affix, String.Double),
175
+ combined("fstringescape", "dqf"),
176
+ ),
177
+ (
178
+ "([fF])(')",
179
+ bygroups(String.Affix, String.Single),
180
+ combined("fstringescape", "sqf"),
181
+ ),
182
+ # raw bytes and strings
183
+ ('(?i)(rb|br|r)(""")', bygroups(String.Affix, String.Double), "tdqs"),
184
+ ("(?i)(rb|br|r)(''')", bygroups(String.Affix, String.Single), "tsqs"),
185
+ ('(?i)(rb|br|r)(")', bygroups(String.Affix, String.Double), "dqs"),
186
+ ("(?i)(rb|br|r)(')", bygroups(String.Affix, String.Single), "sqs"),
187
+ # non-raw strings
188
+ (
189
+ '([uU]?)(""")',
190
+ bygroups(String.Affix, String.Double),
191
+ combined("stringescape", "tdqs"),
192
+ ),
193
+ (
194
+ "([uU]?)(''')",
195
+ bygroups(String.Affix, String.Single),
196
+ combined("stringescape", "tsqs"),
197
+ ),
198
+ (
199
+ '([uU]?)(")',
200
+ bygroups(String.Affix, String.Double),
201
+ combined("stringescape", "dqs"),
202
+ ),
203
+ (
204
+ "([uU]?)(')",
205
+ bygroups(String.Affix, String.Single),
206
+ combined("stringescape", "sqs"),
207
+ ),
208
+ # non-raw bytes
209
+ (
210
+ '([bB])(""")',
211
+ bygroups(String.Affix, String.Double),
212
+ combined("bytesescape", "tdqs"),
213
+ ),
214
+ (
215
+ "([bB])(''')",
216
+ bygroups(String.Affix, String.Single),
217
+ combined("bytesescape", "tsqs"),
218
+ ),
219
+ (
220
+ '([bB])(")',
221
+ bygroups(String.Affix, String.Double),
222
+ combined("bytesescape", "dqs"),
223
+ ),
224
+ (
225
+ "([bB])(')",
226
+ bygroups(String.Affix, String.Single),
227
+ combined("bytesescape", "sqs"),
228
+ ),
229
+ (r"[^\S\n]+", Text),
230
+ include("numbers"),
231
+ (r"!=|==|<<|>>|:=|[-~+/*%=<>&^|.]", Operator),
232
+ (r"([]{}:\(\),;[])+", Punctuation),
233
+ (r"(in|is|and|or|not)\b", Operator.Word),
234
+ include("expr-keywords"),
235
+ include("builtins"),
236
+ include("magicfuncs"),
237
+ include("magicvars"),
238
+ include("name"),
239
+ ],
240
+ "expr-inside-fstring": [
241
+ (r"[{([]", Punctuation, "expr-inside-fstring-inner"),
242
+ # without format specifier
243
+ (
244
+ r"(=\s*)?" # debug (https://bugs.python.org/issue36817)
245
+ r"(\![sraf])?" # conversion
246
+ r"\}",
247
+ String.Interpol,
248
+ "#pop",
249
+ ),
250
+ # with format specifier
251
+ # we'll catch the remaining '}' in the outer scope
252
+ (
253
+ r"(=\s*)?" # debug (https://bugs.python.org/issue36817)
254
+ r"(\![sraf])?" # conversion
255
+ r":",
256
+ String.Interpol,
257
+ "#pop",
258
+ ),
259
+ (r"\s+", Whitespace), # allow new lines
260
+ include("expr"),
261
+ ],
262
+ "expr-inside-fstring-inner": [
263
+ (r"[{([]", Punctuation, "expr-inside-fstring-inner"),
264
+ (r"[])}]", Punctuation, "#pop"),
265
+ (r"\s+", Whitespace), # allow new lines
266
+ include("expr"),
267
+ ],
268
+ "expr-keywords": [
269
+ # Based on https://docs.python.org/3/reference/expressions.html
270
+ (
271
+ words(
272
+ (
273
+ "async for", # TODO https://docs.modular.com/mojo/roadmap#no-async-for-or-async-with
274
+ "async with", # TODO https://docs.modular.com/mojo/roadmap#no-async-for-or-async-with
275
+ "await",
276
+ "else",
277
+ "for",
278
+ "if",
279
+ "lambda",
280
+ "yield",
281
+ "yield from",
282
+ ),
283
+ suffix=r"\b",
284
+ ),
285
+ Keyword,
286
+ ),
287
+ (words(("True", "False", "None"), suffix=r"\b"), Keyword.Constant),
288
+ ],
289
+ "keywords": [
290
+ (
291
+ words(
292
+ (
293
+ "assert",
294
+ "async",
295
+ "await",
296
+ "borrowed",
297
+ "break",
298
+ "continue",
299
+ "del",
300
+ "elif",
301
+ "else",
302
+ "except",
303
+ "finally",
304
+ "for",
305
+ "global",
306
+ "if",
307
+ "lambda",
308
+ "pass",
309
+ "raise",
310
+ "nonlocal",
311
+ "return",
312
+ "try",
313
+ "while",
314
+ "yield",
315
+ "yield from",
316
+ "as",
317
+ "with",
318
+ ),
319
+ suffix=r"\b",
320
+ ),
321
+ Keyword,
322
+ ),
323
+ (words(("True", "False", "None"), suffix=r"\b"), Keyword.Constant),
324
+ ],
325
+ "soft-keywords": [
326
+ # `match`, `case` and `_` soft keywords
327
+ (
328
+ r"(^[ \t]*)" # at beginning of line + possible indentation
329
+ r"(match|case)\b" # a possible keyword
330
+ r"(?![ \t]*(?:" # not followed by...
331
+ r"[:,;=^&|@~)\]}]|(?:" + # characters and keywords that mean this isn't
332
+ # pattern matching (but None/True/False is ok)
333
+ r"|".join(k for k in keyword.kwlist if k[0].islower())
334
+ + r")\b))",
335
+ bygroups(Whitespace, Keyword),
336
+ "soft-keywords-inner",
337
+ ),
338
+ ],
339
+ "soft-keywords-inner": [
340
+ # optional `_` keyword
341
+ (r"(\s+)([^\n_]*)(_\b)", bygroups(Whitespace, using(this), Keyword)),
342
+ default("#pop"),
343
+ ],
344
+ "builtins": [
345
+ (
346
+ words(
347
+ (
348
+ "__import__",
349
+ "abs",
350
+ "aiter",
351
+ "all",
352
+ "any",
353
+ "bin",
354
+ "bool",
355
+ "bytearray",
356
+ "breakpoint",
357
+ "bytes",
358
+ "callable",
359
+ "chr",
360
+ "classmethod",
361
+ "compile",
362
+ "complex",
363
+ "delattr",
364
+ "dict",
365
+ "dir",
366
+ "divmod",
367
+ "enumerate",
368
+ "eval",
369
+ "filter",
370
+ "float",
371
+ "format",
372
+ "frozenset",
373
+ "getattr",
374
+ "globals",
375
+ "hasattr",
376
+ "hash",
377
+ "hex",
378
+ "id",
379
+ "input",
380
+ "int",
381
+ "isinstance",
382
+ "issubclass",
383
+ "iter",
384
+ "len",
385
+ "list",
386
+ "locals",
387
+ "map",
388
+ "max",
389
+ "memoryview",
390
+ "min",
391
+ "next",
392
+ "object",
393
+ "oct",
394
+ "open",
395
+ "ord",
396
+ "pow",
397
+ "print",
398
+ "property",
399
+ "range",
400
+ "repr",
401
+ "reversed",
402
+ "round",
403
+ "set",
404
+ "setattr",
405
+ "slice",
406
+ "sorted",
407
+ "staticmethod",
408
+ "str",
409
+ "sum",
410
+ "super",
411
+ "tuple",
412
+ "type",
413
+ "vars",
414
+ "zip",
415
+ # Mojo builtin types: https://docs.modular.com/mojo/stdlib/builtin/
416
+ "AnyType",
417
+ "Coroutine",
418
+ "DType",
419
+ "Error",
420
+ "Int",
421
+ "List",
422
+ "ListLiteral",
423
+ "Scalar",
424
+ "Int8",
425
+ "UInt8",
426
+ "Int16",
427
+ "UInt16",
428
+ "Int32",
429
+ "UInt32",
430
+ "Int64",
431
+ "UInt64",
432
+ "BFloat16",
433
+ "Float16",
434
+ "Float32",
435
+ "Float64",
436
+ "SIMD",
437
+ "String",
438
+ "Tensor",
439
+ "Tuple",
440
+ "Movable",
441
+ "Copyable",
442
+ "CollectionElement",
443
+ ),
444
+ prefix=r"(?<!\.)",
445
+ suffix=r"\b",
446
+ ),
447
+ Name.Builtin,
448
+ ),
449
+ (r"(?<!\.)(self|Ellipsis|NotImplemented|cls)\b", Name.Builtin.Pseudo),
450
+ (
451
+ words(
452
+ ("Error",),
453
+ prefix=r"(?<!\.)",
454
+ suffix=r"\b",
455
+ ),
456
+ Name.Exception,
457
+ ),
458
+ ],
459
+ "magicfuncs": [
460
+ (
461
+ words(
462
+ (
463
+ "__abs__",
464
+ "__add__",
465
+ "__aenter__",
466
+ "__aexit__",
467
+ "__aiter__",
468
+ "__and__",
469
+ "__anext__",
470
+ "__await__",
471
+ "__bool__",
472
+ "__bytes__",
473
+ "__call__",
474
+ "__complex__",
475
+ "__contains__",
476
+ "__del__",
477
+ "__delattr__",
478
+ "__delete__",
479
+ "__delitem__",
480
+ "__dir__",
481
+ "__divmod__",
482
+ "__enter__",
483
+ "__eq__",
484
+ "__exit__",
485
+ "__float__",
486
+ "__floordiv__",
487
+ "__format__",
488
+ "__ge__",
489
+ "__get__",
490
+ "__getattr__",
491
+ "__getattribute__",
492
+ "__getitem__",
493
+ "__gt__",
494
+ "__hash__",
495
+ "__iadd__",
496
+ "__iand__",
497
+ "__ifloordiv__",
498
+ "__ilshift__",
499
+ "__imatmul__",
500
+ "__imod__",
501
+ "__imul__",
502
+ "__index__",
503
+ "__init__",
504
+ "__instancecheck__",
505
+ "__int__",
506
+ "__invert__",
507
+ "__ior__",
508
+ "__ipow__",
509
+ "__irshift__",
510
+ "__isub__",
511
+ "__iter__",
512
+ "__itruediv__",
513
+ "__ixor__",
514
+ "__le__",
515
+ "__len__",
516
+ "__length_hint__",
517
+ "__lshift__",
518
+ "__lt__",
519
+ "__matmul__",
520
+ "__missing__",
521
+ "__mod__",
522
+ "__mul__",
523
+ "__ne__",
524
+ "__neg__",
525
+ "__new__",
526
+ "__next__",
527
+ "__or__",
528
+ "__pos__",
529
+ "__pow__",
530
+ "__prepare__",
531
+ "__radd__",
532
+ "__rand__",
533
+ "__rdivmod__",
534
+ "__repr__",
535
+ "__reversed__",
536
+ "__rfloordiv__",
537
+ "__rlshift__",
538
+ "__rmatmul__",
539
+ "__rmod__",
540
+ "__rmul__",
541
+ "__ror__",
542
+ "__round__",
543
+ "__rpow__",
544
+ "__rrshift__",
545
+ "__rshift__",
546
+ "__rsub__",
547
+ "__rtruediv__",
548
+ "__rxor__",
549
+ "__set__",
550
+ "__setattr__",
551
+ "__setitem__",
552
+ "__str__",
553
+ "__sub__",
554
+ "__subclasscheck__",
555
+ "__truediv__",
556
+ "__xor__",
557
+ ),
558
+ suffix=r"\b",
559
+ ),
560
+ Name.Function.Magic,
561
+ ),
562
+ ],
563
+ "magicvars": [
564
+ (
565
+ words(
566
+ (
567
+ "__annotations__",
568
+ "__bases__",
569
+ "__class__",
570
+ "__closure__",
571
+ "__code__",
572
+ "__defaults__",
573
+ "__dict__",
574
+ "__doc__",
575
+ "__file__",
576
+ "__func__",
577
+ "__globals__",
578
+ "__kwdefaults__",
579
+ "__module__",
580
+ "__mro__",
581
+ "__name__",
582
+ "__objclass__",
583
+ "__qualname__",
584
+ "__self__",
585
+ "__slots__",
586
+ "__weakref__",
587
+ ),
588
+ suffix=r"\b",
589
+ ),
590
+ Name.Variable.Magic,
591
+ ),
592
+ ],
593
+ "numbers": [
594
+ (
595
+ r"(\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|(?:\d(?:_?\d)*)?\.\d(?:_?\d)*)"
596
+ r"([eE][+-]?\d(?:_?\d)*)?",
597
+ Number.Float,
598
+ ),
599
+ (r"\d(?:_?\d)*[eE][+-]?\d(?:_?\d)*j?", Number.Float),
600
+ (r"0[oO](?:_?[0-7])+", Number.Oct),
601
+ (r"0[bB](?:_?[01])+", Number.Bin),
602
+ (r"0[xX](?:_?[a-fA-F0-9])+", Number.Hex),
603
+ (r"\d(?:_?\d)*", Number.Integer),
604
+ ],
605
+ "name": [
606
+ (r"@" + uni_name, Name.Decorator),
607
+ (r"@", Operator), # new matrix multiplication operator
608
+ (uni_name, Name),
609
+ ],
610
+ "varname": [
611
+ (uni_name, Name.Variable, "#pop"),
612
+ ],
613
+ "funcname": [
614
+ include("magicfuncs"),
615
+ (uni_name, Name.Function, "#pop"),
616
+ default("#pop"),
617
+ ],
618
+ "classname": [
619
+ (uni_name, Name.Class, "#pop"),
620
+ ],
621
+ "structname": [
622
+ (uni_name, Name.Struct, "#pop"),
623
+ ],
624
+ "import": [
625
+ (r"(\s+)(as)(\s+)", bygroups(Whitespace, Keyword, Whitespace)),
626
+ (r"\.", Name.Namespace),
627
+ (uni_name, Name.Namespace),
628
+ (r"(\s*)(,)(\s*)", bygroups(Whitespace, Operator, Whitespace)),
629
+ default("#pop"), # all else: go back
630
+ ],
631
+ "fromimport": [
632
+ (r"(\s+)(import)\b", bygroups(Whitespace, Keyword.Namespace), "#pop"),
633
+ (r"\.", Name.Namespace),
634
+ # if None occurs here, it's "raise x from None", since None can
635
+ # never be a module name
636
+ (r"None\b", Keyword.Constant, "#pop"),
637
+ (uni_name, Name.Namespace),
638
+ default("#pop"),
639
+ ],
640
+ "rfstringescape": [
641
+ (r"\{\{", String.Escape),
642
+ (r"\}\}", String.Escape),
643
+ ],
644
+ "fstringescape": [
645
+ include("rfstringescape"),
646
+ include("stringescape"),
647
+ ],
648
+ "bytesescape": [
649
+ (r'\\([\\abfnrtv"\']|\n|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
650
+ ],
651
+ "stringescape": [
652
+ (r"\\(N\{.*?\}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8})", String.Escape),
653
+ include("bytesescape"),
654
+ ],
655
+ "fstrings-single": fstring_rules(String.Single),
656
+ "fstrings-double": fstring_rules(String.Double),
657
+ "strings-single": innerstring_rules(String.Single),
658
+ "strings-double": innerstring_rules(String.Double),
659
+ "dqf": [
660
+ (r'"', String.Double, "#pop"),
661
+ (r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
662
+ include("fstrings-double"),
663
+ ],
664
+ "sqf": [
665
+ (r"'", String.Single, "#pop"),
666
+ (r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings
667
+ include("fstrings-single"),
668
+ ],
669
+ "dqs": [
670
+ (r'"', String.Double, "#pop"),
671
+ (r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
672
+ include("strings-double"),
673
+ ],
674
+ "sqs": [
675
+ (r"'", String.Single, "#pop"),
676
+ (r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings
677
+ include("strings-single"),
678
+ ],
679
+ "tdqf": [
680
+ (r'"""', String.Double, "#pop"),
681
+ include("fstrings-double"),
682
+ (r"\n", String.Double),
683
+ ],
684
+ "tsqf": [
685
+ (r"'''", String.Single, "#pop"),
686
+ include("fstrings-single"),
687
+ (r"\n", String.Single),
688
+ ],
689
+ "tdqs": [
690
+ (r'"""', String.Double, "#pop"),
691
+ include("strings-double"),
692
+ (r"\n", String.Double),
693
+ ],
694
+ "tsqs": [
695
+ (r"'''", String.Single, "#pop"),
696
+ include("strings-single"),
697
+ (r"\n", String.Single),
698
+ ],
699
+ }
700
+
701
+ def analyse_text(text):
702
+ # TODO supported?
703
+ if shebang_matches(text, r"mojo?"):
704
+ return 1.0
705
+ if "import " in text[:1000]:
706
+ return 0.9
707
+ return 0
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/monte.py ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.monte
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Monte programming language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.token import Comment, Error, Keyword, Name, Number, Operator, \
12
+ Punctuation, String, Whitespace
13
+ from pygments.lexer import RegexLexer, include, words
14
+
15
+ __all__ = ['MonteLexer']
16
+
17
+
18
+ # `var` handled separately
19
+ # `interface` handled separately
20
+ _declarations = ['bind', 'def', 'fn', 'object']
21
+ _methods = ['method', 'to']
22
+ _keywords = [
23
+ 'as', 'break', 'catch', 'continue', 'else', 'escape', 'exit', 'exports',
24
+ 'extends', 'finally', 'for', 'guards', 'if', 'implements', 'import',
25
+ 'in', 'match', 'meta', 'pass', 'return', 'switch', 'try', 'via', 'when',
26
+ 'while',
27
+ ]
28
+ _operators = [
29
+ # Unary
30
+ '~', '!',
31
+ # Binary
32
+ '+', '-', '*', '/', '%', '**', '&', '|', '^', '<<', '>>',
33
+ # Binary augmented
34
+ '+=', '-=', '*=', '/=', '%=', '**=', '&=', '|=', '^=', '<<=', '>>=',
35
+ # Comparison
36
+ '==', '!=', '<', '<=', '>', '>=', '<=>',
37
+ # Patterns and assignment
38
+ ':=', '?', '=~', '!~', '=>',
39
+ # Calls and sends
40
+ '.', '<-', '->',
41
+ ]
42
+ _escape_pattern = (
43
+ r'(?:\\x[0-9a-fA-F]{2}|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|'
44
+ r'\\["\'\\bftnr])')
45
+ # _char = _escape_chars + [('.', String.Char)]
46
+ _identifier = r'[_a-zA-Z]\w*'
47
+
48
+ _constants = [
49
+ # Void constants
50
+ 'null',
51
+ # Bool constants
52
+ 'false', 'true',
53
+ # Double constants
54
+ 'Infinity', 'NaN',
55
+ # Special objects
56
+ 'M', 'Ref', 'throw', 'traceln',
57
+ ]
58
+
59
+ _guards = [
60
+ 'Any', 'Binding', 'Bool', 'Bytes', 'Char', 'DeepFrozen', 'Double',
61
+ 'Empty', 'Int', 'List', 'Map', 'Near', 'NullOk', 'Same', 'Selfless',
62
+ 'Set', 'Str', 'SubrangeGuard', 'Transparent', 'Void',
63
+ ]
64
+
65
+ _safeScope = [
66
+ '_accumulateList', '_accumulateMap', '_auditedBy', '_bind',
67
+ '_booleanFlow', '_comparer', '_equalizer', '_iterForever', '_loop',
68
+ '_makeBytes', '_makeDouble', '_makeFinalSlot', '_makeInt', '_makeList',
69
+ '_makeMap', '_makeMessageDesc', '_makeOrderedSpace', '_makeParamDesc',
70
+ '_makeProtocolDesc', '_makeSourceSpan', '_makeString', '_makeVarSlot',
71
+ '_makeVerbFacet', '_mapExtract', '_matchSame', '_quasiMatcher',
72
+ '_slotToBinding', '_splitList', '_suchThat', '_switchFailed',
73
+ '_validateFor', 'b__quasiParser', 'eval', 'import', 'm__quasiParser',
74
+ 'makeBrandPair', 'makeLazySlot', 'safeScope', 'simple__quasiParser',
75
+ ]
76
+
77
+
78
+ class MonteLexer(RegexLexer):
79
+ """
80
+ Lexer for the Monte programming language.
81
+ """
82
+ name = 'Monte'
83
+ url = 'https://monte.readthedocs.io/'
84
+ aliases = ['monte']
85
+ filenames = ['*.mt']
86
+ version_added = '2.2'
87
+
88
+ tokens = {
89
+ 'root': [
90
+ # Comments
91
+ (r'#[^\n]*\n', Comment),
92
+
93
+ # Docstrings
94
+ # Apologies for the non-greedy matcher here.
95
+ (r'/\*\*.*?\*/', String.Doc),
96
+
97
+ # `var` declarations
98
+ (r'\bvar\b', Keyword.Declaration, 'var'),
99
+
100
+ # `interface` declarations
101
+ (r'\binterface\b', Keyword.Declaration, 'interface'),
102
+
103
+ # method declarations
104
+ (words(_methods, prefix='\\b', suffix='\\b'),
105
+ Keyword, 'method'),
106
+
107
+ # All other declarations
108
+ (words(_declarations, prefix='\\b', suffix='\\b'),
109
+ Keyword.Declaration),
110
+
111
+ # Keywords
112
+ (words(_keywords, prefix='\\b', suffix='\\b'), Keyword),
113
+
114
+ # Literals
115
+ ('[+-]?0x[_0-9a-fA-F]+', Number.Hex),
116
+ (r'[+-]?[_0-9]+\.[_0-9]*([eE][+-]?[_0-9]+)?', Number.Float),
117
+ ('[+-]?[_0-9]+', Number.Integer),
118
+ ("'", String.Double, 'char'),
119
+ ('"', String.Double, 'string'),
120
+
121
+ # Quasiliterals
122
+ ('`', String.Backtick, 'ql'),
123
+
124
+ # Operators
125
+ (words(_operators), Operator),
126
+
127
+ # Verb operators
128
+ (_identifier + '=', Operator.Word),
129
+
130
+ # Safe scope constants
131
+ (words(_constants, prefix='\\b', suffix='\\b'),
132
+ Keyword.Pseudo),
133
+
134
+ # Safe scope guards
135
+ (words(_guards, prefix='\\b', suffix='\\b'), Keyword.Type),
136
+
137
+ # All other safe scope names
138
+ (words(_safeScope, prefix='\\b', suffix='\\b'),
139
+ Name.Builtin),
140
+
141
+ # Identifiers
142
+ (_identifier, Name),
143
+
144
+ # Punctuation
145
+ (r'\(|\)|\{|\}|\[|\]|:|,', Punctuation),
146
+
147
+ # Whitespace
148
+ (' +', Whitespace),
149
+
150
+ # Definite lexer errors
151
+ ('=', Error),
152
+ ],
153
+ 'char': [
154
+ # It is definitely an error to have a char of width == 0.
155
+ ("'", Error, 'root'),
156
+ (_escape_pattern, String.Escape, 'charEnd'),
157
+ ('.', String.Char, 'charEnd'),
158
+ ],
159
+ 'charEnd': [
160
+ ("'", String.Char, '#pop:2'),
161
+ # It is definitely an error to have a char of width > 1.
162
+ ('.', Error),
163
+ ],
164
+ # The state of things coming into an interface.
165
+ 'interface': [
166
+ (' +', Whitespace),
167
+ (_identifier, Name.Class, '#pop'),
168
+ include('root'),
169
+ ],
170
+ # The state of things coming into a method.
171
+ 'method': [
172
+ (' +', Whitespace),
173
+ (_identifier, Name.Function, '#pop'),
174
+ include('root'),
175
+ ],
176
+ 'string': [
177
+ ('"', String.Double, 'root'),
178
+ (_escape_pattern, String.Escape),
179
+ (r'\n', String.Double),
180
+ ('.', String.Double),
181
+ ],
182
+ 'ql': [
183
+ ('`', String.Backtick, 'root'),
184
+ (r'\$' + _escape_pattern, String.Escape),
185
+ (r'\$\$', String.Escape),
186
+ (r'@@', String.Escape),
187
+ (r'\$\{', String.Interpol, 'qlNest'),
188
+ (r'@\{', String.Interpol, 'qlNest'),
189
+ (r'\$' + _identifier, Name),
190
+ ('@' + _identifier, Name),
191
+ ('.', String.Backtick),
192
+ ],
193
+ 'qlNest': [
194
+ (r'\}', String.Interpol, '#pop'),
195
+ include('root'),
196
+ ],
197
+ # The state of things immediately following `var`.
198
+ 'var': [
199
+ (' +', Whitespace),
200
+ (_identifier, Name.Variable, '#pop'),
201
+ include('root'),
202
+ ],
203
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/mosel.py ADDED
@@ -0,0 +1,447 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.mosel
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the mosel language.
6
+ http://www.fico.com/en/products/fico-xpress-optimization
7
+
8
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
9
+ :license: BSD, see LICENSE for details.
10
+ """
11
+
12
+ from pygments.lexer import RegexLexer, words
13
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
14
+ Number, Punctuation
15
+
16
+ __all__ = ['MoselLexer']
17
+
18
+ FUNCTIONS = (
19
+ # core functions
20
+ '_',
21
+ 'abs',
22
+ 'arctan',
23
+ 'asproc',
24
+ 'assert',
25
+ 'bitflip',
26
+ 'bitneg',
27
+ 'bitset',
28
+ 'bitshift',
29
+ 'bittest',
30
+ 'bitval',
31
+ 'ceil',
32
+ 'cos',
33
+ 'create',
34
+ 'currentdate',
35
+ 'currenttime',
36
+ 'cutelt',
37
+ 'cutfirst',
38
+ 'cuthead',
39
+ 'cutlast',
40
+ 'cuttail',
41
+ 'datablock',
42
+ 'delcell',
43
+ 'exists',
44
+ 'exit',
45
+ 'exp',
46
+ 'exportprob',
47
+ 'fclose',
48
+ 'fflush',
49
+ 'finalize',
50
+ 'findfirst',
51
+ 'findlast',
52
+ 'floor',
53
+ 'fopen',
54
+ 'fselect',
55
+ 'fskipline',
56
+ 'fwrite',
57
+ 'fwrite_',
58
+ 'fwriteln',
59
+ 'fwriteln_',
60
+ 'getact',
61
+ 'getcoeff',
62
+ 'getcoeffs',
63
+ 'getdual',
64
+ 'getelt',
65
+ 'getfid',
66
+ 'getfirst',
67
+ 'getfname',
68
+ 'gethead',
69
+ 'getlast',
70
+ 'getobjval',
71
+ 'getparam',
72
+ 'getrcost',
73
+ 'getreadcnt',
74
+ 'getreverse',
75
+ 'getsize',
76
+ 'getslack',
77
+ 'getsol',
78
+ 'gettail',
79
+ 'gettype',
80
+ 'getvars',
81
+ 'isdynamic',
82
+ 'iseof',
83
+ 'isfinite',
84
+ 'ishidden',
85
+ 'isinf',
86
+ 'isnan',
87
+ 'isodd',
88
+ 'ln',
89
+ 'localsetparam',
90
+ 'log',
91
+ 'makesos1',
92
+ 'makesos2',
93
+ 'maxlist',
94
+ 'memoryuse',
95
+ 'minlist',
96
+ 'newmuid',
97
+ 'publish',
98
+ 'random',
99
+ 'read',
100
+ 'readln',
101
+ 'reset',
102
+ 'restoreparam',
103
+ 'reverse',
104
+ 'round',
105
+ 'setcoeff',
106
+ 'sethidden',
107
+ 'setioerr',
108
+ 'setmatherr',
109
+ 'setname',
110
+ 'setparam',
111
+ 'setrandseed',
112
+ 'setrange',
113
+ 'settype',
114
+ 'sin',
115
+ 'splithead',
116
+ 'splittail',
117
+ 'sqrt',
118
+ 'strfmt',
119
+ 'substr',
120
+ 'timestamp',
121
+ 'unpublish',
122
+ 'versionnum',
123
+ 'versionstr',
124
+ 'write',
125
+ 'write_',
126
+ 'writeln',
127
+ 'writeln_',
128
+
129
+ # mosel exam mmxprs | sed -n -e "s/ [pf][a-z]* \([a-zA-Z0-9_]*\).*/'\1',/p" | sort -u
130
+ 'addcut',
131
+ 'addcuts',
132
+ 'addmipsol',
133
+ 'basisstability',
134
+ 'calcsolinfo',
135
+ 'clearmipdir',
136
+ 'clearmodcut',
137
+ 'command',
138
+ 'copysoltoinit',
139
+ 'crossoverlpsol',
140
+ 'defdelayedrows',
141
+ 'defsecurevecs',
142
+ 'delcuts',
143
+ 'dropcuts',
144
+ 'estimatemarginals',
145
+ 'fixglobal',
146
+ 'flushmsgq',
147
+ 'getbstat',
148
+ 'getcnlist',
149
+ 'getcplist',
150
+ 'getdualray',
151
+ 'getiis',
152
+ 'getiissense',
153
+ 'getiistype',
154
+ 'getinfcause',
155
+ 'getinfeas',
156
+ 'getlb',
157
+ 'getlct',
158
+ 'getleft',
159
+ 'getloadedlinctrs',
160
+ 'getloadedmpvars',
161
+ 'getname',
162
+ 'getprimalray',
163
+ 'getprobstat',
164
+ 'getrange',
165
+ 'getright',
166
+ 'getsensrng',
167
+ 'getsize',
168
+ 'getsol',
169
+ 'gettype',
170
+ 'getub',
171
+ 'getvars',
172
+ 'gety',
173
+ 'hasfeature',
174
+ 'implies',
175
+ 'indicator',
176
+ 'initglobal',
177
+ 'ishidden',
178
+ 'isiisvalid',
179
+ 'isintegral',
180
+ 'loadbasis',
181
+ 'loadcuts',
182
+ 'loadlpsol',
183
+ 'loadmipsol',
184
+ 'loadprob',
185
+ 'maximise',
186
+ 'maximize',
187
+ 'minimise',
188
+ 'minimize',
189
+ 'postsolve',
190
+ 'readbasis',
191
+ 'readdirs',
192
+ 'readsol',
193
+ 'refinemipsol',
194
+ 'rejectintsol',
195
+ 'repairinfeas',
196
+ 'repairinfeas_deprec',
197
+ 'resetbasis',
198
+ 'resetiis',
199
+ 'resetsol',
200
+ 'savebasis',
201
+ 'savemipsol',
202
+ 'savesol',
203
+ 'savestate',
204
+ 'selectsol',
205
+ 'setarchconsistency',
206
+ 'setbstat',
207
+ 'setcallback',
208
+ 'setcbcutoff',
209
+ 'setgndata',
210
+ 'sethidden',
211
+ 'setlb',
212
+ 'setmipdir',
213
+ 'setmodcut',
214
+ 'setsol',
215
+ 'setub',
216
+ 'setucbdata',
217
+ 'stopoptimise',
218
+ 'stopoptimize',
219
+ 'storecut',
220
+ 'storecuts',
221
+ 'unloadprob',
222
+ 'uselastbarsol',
223
+ 'writebasis',
224
+ 'writedirs',
225
+ 'writeprob',
226
+ 'writesol',
227
+ 'xor',
228
+ 'xprs_addctr',
229
+ 'xprs_addindic',
230
+
231
+ # mosel exam mmsystem | sed -n -e "s/ [pf][a-z]* \([a-zA-Z0-9_]*\).*/'\1',/p" | sort -u
232
+ 'addmonths',
233
+ 'copytext',
234
+ 'cuttext',
235
+ 'deltext',
236
+ 'endswith',
237
+ 'erase',
238
+ 'expandpath',
239
+ 'fcopy',
240
+ 'fdelete',
241
+ 'findfiles',
242
+ 'findtext',
243
+ 'fmove',
244
+ 'formattext',
245
+ 'getasnumber',
246
+ 'getchar',
247
+ 'getcwd',
248
+ 'getdate',
249
+ 'getday',
250
+ 'getdaynum',
251
+ 'getdays',
252
+ 'getdirsep',
253
+ 'getdsoparam',
254
+ 'getendparse',
255
+ 'getenv',
256
+ 'getfsize',
257
+ 'getfstat',
258
+ 'getftime',
259
+ 'gethour',
260
+ 'getminute',
261
+ 'getmonth',
262
+ 'getmsec',
263
+ 'getoserrmsg',
264
+ 'getoserror',
265
+ 'getpathsep',
266
+ 'getqtype',
267
+ 'getsecond',
268
+ 'getsepchar',
269
+ 'getsize',
270
+ 'getstart',
271
+ 'getsucc',
272
+ 'getsysinfo',
273
+ 'getsysstat',
274
+ 'gettime',
275
+ 'gettmpdir',
276
+ 'gettrim',
277
+ 'getweekday',
278
+ 'getyear',
279
+ 'inserttext',
280
+ 'isvalid',
281
+ 'jointext',
282
+ 'makedir',
283
+ 'makepath',
284
+ 'newtar',
285
+ 'newzip',
286
+ 'nextfield',
287
+ 'openpipe',
288
+ 'parseextn',
289
+ 'parseint',
290
+ 'parsereal',
291
+ 'parsetext',
292
+ 'pastetext',
293
+ 'pathmatch',
294
+ 'pathsplit',
295
+ 'qsort',
296
+ 'quote',
297
+ 'readtextline',
298
+ 'regmatch',
299
+ 'regreplace',
300
+ 'removedir',
301
+ 'removefiles',
302
+ 'setchar',
303
+ 'setdate',
304
+ 'setday',
305
+ 'setdsoparam',
306
+ 'setendparse',
307
+ 'setenv',
308
+ 'sethour',
309
+ 'setminute',
310
+ 'setmonth',
311
+ 'setmsec',
312
+ 'setoserror',
313
+ 'setqtype',
314
+ 'setsecond',
315
+ 'setsepchar',
316
+ 'setstart',
317
+ 'setsucc',
318
+ 'settime',
319
+ 'settrim',
320
+ 'setyear',
321
+ 'sleep',
322
+ 'splittext',
323
+ 'startswith',
324
+ 'system',
325
+ 'tarlist',
326
+ 'textfmt',
327
+ 'tolower',
328
+ 'toupper',
329
+ 'trim',
330
+ 'untar',
331
+ 'unzip',
332
+ 'ziplist',
333
+
334
+ # mosel exam mmjobs | sed -n -e "s/ [pf][a-z]* \([a-zA-Z0-9_]*\).*/'\1',/p" | sort -u
335
+ 'canceltimer',
336
+ 'clearaliases',
337
+ 'compile',
338
+ 'connect',
339
+ 'detach',
340
+ 'disconnect',
341
+ 'dropnextevent',
342
+ 'findxsrvs',
343
+ 'getaliases',
344
+ 'getannidents',
345
+ 'getannotations',
346
+ 'getbanner',
347
+ 'getclass',
348
+ 'getdsoprop',
349
+ 'getdsopropnum',
350
+ 'getexitcode',
351
+ 'getfromgid',
352
+ 'getfromid',
353
+ 'getfromuid',
354
+ 'getgid',
355
+ 'gethostalias',
356
+ 'getid',
357
+ 'getmodprop',
358
+ 'getmodpropnum',
359
+ 'getnextevent',
360
+ 'getnode',
361
+ 'getrmtid',
362
+ 'getstatus',
363
+ 'getsysinfo',
364
+ 'gettimer',
365
+ 'getuid',
366
+ 'getvalue',
367
+ 'isqueueempty',
368
+ 'load',
369
+ 'nullevent',
370
+ 'peeknextevent',
371
+ 'resetmodpar',
372
+ 'run',
373
+ 'send',
374
+ 'setcontrol',
375
+ 'setdefstream',
376
+ 'setgid',
377
+ 'sethostalias',
378
+ 'setmodpar',
379
+ 'settimer',
380
+ 'setuid',
381
+ 'setworkdir',
382
+ 'stop',
383
+ 'unload',
384
+ 'wait',
385
+ 'waitexpired',
386
+ 'waitfor',
387
+ 'waitforend',
388
+ )
389
+
390
+
391
+ class MoselLexer(RegexLexer):
392
+ """
393
+ For the Mosel optimization language.
394
+ """
395
+ name = 'Mosel'
396
+ aliases = ['mosel']
397
+ filenames = ['*.mos']
398
+ url = 'https://www.fico.com/fico-xpress-optimization/docs/latest/mosel/mosel_lang/dhtml/moselreflang.html'
399
+ version_added = '2.6'
400
+
401
+ tokens = {
402
+ 'root': [
403
+ (r'\n', Text),
404
+ (r'\s+', Text.Whitespace),
405
+ (r'!.*?\n', Comment.Single),
406
+ (r'\(!(.|\n)*?!\)', Comment.Multiline),
407
+ (words((
408
+ 'and', 'as', 'break', 'case', 'count', 'declarations', 'do',
409
+ 'dynamic', 'elif', 'else', 'end-', 'end', 'evaluation', 'false',
410
+ 'forall', 'forward', 'from', 'function', 'hashmap', 'if',
411
+ 'imports', 'include', 'initialisations', 'initializations', 'inter',
412
+ 'max', 'min', 'model', 'namespace', 'next', 'not', 'nsgroup',
413
+ 'nssearch', 'of', 'options', 'or', 'package', 'parameters',
414
+ 'procedure', 'public', 'prod', 'record', 'repeat', 'requirements',
415
+ 'return', 'sum', 'then', 'to', 'true', 'union', 'until', 'uses',
416
+ 'version', 'while', 'with'), prefix=r'\b', suffix=r'\b'),
417
+ Keyword.Builtin),
418
+ (words((
419
+ 'range', 'array', 'set', 'list', 'mpvar', 'mpproblem', 'linctr',
420
+ 'nlctr', 'integer', 'string', 'real', 'boolean', 'text', 'time',
421
+ 'date', 'datetime', 'returned', 'Model', 'Mosel', 'counter',
422
+ 'xmldoc', 'is_sos1', 'is_sos2', 'is_integer', 'is_binary',
423
+ 'is_continuous', 'is_free', 'is_semcont', 'is_semint',
424
+ 'is_partint'), prefix=r'\b', suffix=r'\b'),
425
+ Keyword.Type),
426
+ (r'(\+|\-|\*|/|=|<=|>=|\||\^|<|>|<>|\.\.|\.|:=|::|:|in|mod|div)',
427
+ Operator),
428
+ (r'[()\[\]{},;]+', Punctuation),
429
+ (words(FUNCTIONS, prefix=r'\b', suffix=r'\b'), Name.Function),
430
+ (r'(\d+\.(?!\.)\d*|\.(?!.)\d+)([eE][+-]?\d+)?', Number.Float),
431
+ (r'\d+([eE][+-]?\d+)?', Number.Integer),
432
+ (r'[+-]?Infinity', Number.Integer),
433
+ (r'0[xX][0-9a-fA-F]+', Number),
434
+ (r'"', String.Double, 'double_quote'),
435
+ (r'\'', String.Single, 'single_quote'),
436
+ (r'(\w+|(\.(?!\.)))', Text),
437
+ ],
438
+ 'single_quote': [
439
+ (r'\'', String.Single, '#pop'),
440
+ (r'[^\']+', String.Single),
441
+ ],
442
+ 'double_quote': [
443
+ (r'(\\"|\\[0-7]{1,3}\D|\\[abfnrtv]|\\\\)', String.Escape),
444
+ (r'\"', String.Double, '#pop'),
445
+ (r'[^"\\]+', String.Double),
446
+ ],
447
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/ncl.py ADDED
@@ -0,0 +1,894 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ncl
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for NCAR Command Language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, words
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation
16
+
17
+ __all__ = ['NCLLexer']
18
+
19
+
20
+ class NCLLexer(RegexLexer):
21
+ """
22
+ Lexer for NCL code.
23
+ """
24
+ name = 'NCL'
25
+ aliases = ['ncl']
26
+ filenames = ['*.ncl']
27
+ mimetypes = ['text/ncl']
28
+ url = 'https://www.ncl.ucar.edu'
29
+ version_added = '2.2'
30
+
31
+ flags = re.MULTILINE
32
+
33
+ tokens = {
34
+ 'root': [
35
+ (r';.*\n', Comment),
36
+ include('strings'),
37
+ include('core'),
38
+ (r'[a-zA-Z_]\w*', Name),
39
+ include('nums'),
40
+ (r'[\s]+', Text),
41
+ ],
42
+ 'core': [
43
+ # Statements
44
+ (words((
45
+ 'begin', 'break', 'continue', 'create', 'defaultapp', 'do',
46
+ 'else', 'end', 'external', 'exit', 'True', 'False', 'file', 'function',
47
+ 'getvalues', 'graphic', 'group', 'if', 'list', 'load', 'local',
48
+ 'new', '_Missing', 'Missing', 'noparent', 'procedure',
49
+ 'quit', 'QUIT', 'Quit', 'record', 'return', 'setvalues', 'stop',
50
+ 'then', 'while'), prefix=r'\b', suffix=r'\s*\b'),
51
+ Keyword),
52
+
53
+ # Data Types
54
+ (words((
55
+ 'ubyte', 'uint', 'uint64', 'ulong', 'string', 'byte',
56
+ 'character', 'double', 'float', 'integer', 'int64', 'logical',
57
+ 'long', 'short', 'ushort', 'enumeric', 'numeric', 'snumeric'),
58
+ prefix=r'\b', suffix=r'\s*\b'),
59
+ Keyword.Type),
60
+
61
+ # Operators
62
+ (r'[\%^*+\-/<>]', Operator),
63
+
64
+ # punctuation:
65
+ (r'[\[\]():@$!&|.,\\{}]', Punctuation),
66
+ (r'[=:]', Punctuation),
67
+
68
+ # Intrinsics
69
+ (words((
70
+ 'abs', 'acos', 'addfile', 'addfiles', 'all', 'angmom_atm', 'any',
71
+ 'area_conserve_remap', 'area_hi2lores', 'area_poly_sphere',
72
+ 'asciiread', 'asciiwrite', 'asin', 'atan', 'atan2', 'attsetvalues',
73
+ 'avg', 'betainc', 'bin_avg', 'bin_sum', 'bw_bandpass_filter',
74
+ 'cancor', 'cbinread', 'cbinwrite', 'cd_calendar', 'cd_inv_calendar',
75
+ 'cdfbin_p', 'cdfbin_pr', 'cdfbin_s', 'cdfbin_xn', 'cdfchi_p',
76
+ 'cdfchi_x', 'cdfgam_p', 'cdfgam_x', 'cdfnor_p', 'cdfnor_x',
77
+ 'cdft_p', 'cdft_t', 'ceil', 'center_finite_diff',
78
+ 'center_finite_diff_n', 'cfftb', 'cfftf', 'cfftf_frq_reorder',
79
+ 'charactertodouble', 'charactertofloat', 'charactertointeger',
80
+ 'charactertolong', 'charactertoshort', 'charactertostring',
81
+ 'chartodouble', 'chartofloat', 'chartoint', 'chartointeger',
82
+ 'chartolong', 'chartoshort', 'chartostring', 'chiinv', 'clear',
83
+ 'color_index_to_rgba', 'conform', 'conform_dims', 'cos', 'cosh',
84
+ 'count_unique_values', 'covcorm', 'covcorm_xy', 'craybinnumrec',
85
+ 'craybinrecread', 'create_graphic', 'csa1', 'csa1d', 'csa1s',
86
+ 'csa1x', 'csa1xd', 'csa1xs', 'csa2', 'csa2d', 'csa2l', 'csa2ld',
87
+ 'csa2ls', 'csa2lx', 'csa2lxd', 'csa2lxs', 'csa2s', 'csa2x',
88
+ 'csa2xd', 'csa2xs', 'csa3', 'csa3d', 'csa3l', 'csa3ld', 'csa3ls',
89
+ 'csa3lx', 'csa3lxd', 'csa3lxs', 'csa3s', 'csa3x', 'csa3xd',
90
+ 'csa3xs', 'csc2s', 'csgetp', 'css2c', 'cssetp', 'cssgrid', 'csstri',
91
+ 'csvoro', 'cumsum', 'cz2ccm', 'datatondc', 'day_of_week',
92
+ 'day_of_year', 'days_in_month', 'default_fillvalue', 'delete',
93
+ 'depth_to_pres', 'destroy', 'determinant', 'dewtemp_trh',
94
+ 'dgeevx_lapack', 'dim_acumrun_n', 'dim_avg', 'dim_avg_n',
95
+ 'dim_avg_wgt', 'dim_avg_wgt_n', 'dim_cumsum', 'dim_cumsum_n',
96
+ 'dim_gamfit_n', 'dim_gbits', 'dim_max', 'dim_max_n', 'dim_median',
97
+ 'dim_median_n', 'dim_min', 'dim_min_n', 'dim_num', 'dim_num_n',
98
+ 'dim_numrun_n', 'dim_pqsort', 'dim_pqsort_n', 'dim_product',
99
+ 'dim_product_n', 'dim_rmsd', 'dim_rmsd_n', 'dim_rmvmean',
100
+ 'dim_rmvmean_n', 'dim_rmvmed', 'dim_rmvmed_n', 'dim_spi_n',
101
+ 'dim_standardize', 'dim_standardize_n', 'dim_stat4', 'dim_stat4_n',
102
+ 'dim_stddev', 'dim_stddev_n', 'dim_sum', 'dim_sum_n', 'dim_sum_wgt',
103
+ 'dim_sum_wgt_n', 'dim_variance', 'dim_variance_n', 'dimsizes',
104
+ 'doubletobyte', 'doubletochar', 'doubletocharacter',
105
+ 'doubletofloat', 'doubletoint', 'doubletointeger', 'doubletolong',
106
+ 'doubletoshort', 'dpres_hybrid_ccm', 'dpres_plevel', 'draw',
107
+ 'draw_color_palette', 'dsgetp', 'dsgrid2', 'dsgrid2d', 'dsgrid2s',
108
+ 'dsgrid3', 'dsgrid3d', 'dsgrid3s', 'dspnt2', 'dspnt2d', 'dspnt2s',
109
+ 'dspnt3', 'dspnt3d', 'dspnt3s', 'dssetp', 'dtrend', 'dtrend_msg',
110
+ 'dtrend_msg_n', 'dtrend_n', 'dtrend_quadratic',
111
+ 'dtrend_quadratic_msg_n', 'dv2uvf', 'dv2uvg', 'dz_height',
112
+ 'echo_off', 'echo_on', 'eof2data', 'eof_varimax', 'eofcor',
113
+ 'eofcor_pcmsg', 'eofcor_ts', 'eofcov', 'eofcov_pcmsg', 'eofcov_ts',
114
+ 'eofunc', 'eofunc_ts', 'eofunc_varimax', 'equiv_sample_size', 'erf',
115
+ 'erfc', 'esacr', 'esacv', 'esccr', 'esccv', 'escorc', 'escorc_n',
116
+ 'escovc', 'exit', 'exp', 'exp_tapersh', 'exp_tapersh_wgts',
117
+ 'exp_tapershC', 'ezfftb', 'ezfftb_n', 'ezfftf', 'ezfftf_n',
118
+ 'f2fosh', 'f2foshv', 'f2fsh', 'f2fshv', 'f2gsh', 'f2gshv', 'fabs',
119
+ 'fbindirread', 'fbindirwrite', 'fbinnumrec', 'fbinread',
120
+ 'fbinrecread', 'fbinrecwrite', 'fbinwrite', 'fft2db', 'fft2df',
121
+ 'fftshift', 'fileattdef', 'filechunkdimdef', 'filedimdef',
122
+ 'fileexists', 'filegrpdef', 'filevarattdef', 'filevarchunkdef',
123
+ 'filevarcompressleveldef', 'filevardef', 'filevardimsizes',
124
+ 'filwgts_lancos', 'filwgts_lanczos', 'filwgts_normal',
125
+ 'floattobyte', 'floattochar', 'floattocharacter', 'floattoint',
126
+ 'floattointeger', 'floattolong', 'floattoshort', 'floor',
127
+ 'fluxEddy', 'fo2fsh', 'fo2fshv', 'fourier_info', 'frame', 'fspan',
128
+ 'ftcurv', 'ftcurvd', 'ftcurvi', 'ftcurvp', 'ftcurvpi', 'ftcurvps',
129
+ 'ftcurvs', 'ftest', 'ftgetp', 'ftkurv', 'ftkurvd', 'ftkurvp',
130
+ 'ftkurvpd', 'ftsetp', 'ftsurf', 'g2fsh', 'g2fshv', 'g2gsh',
131
+ 'g2gshv', 'gamma', 'gammainc', 'gaus', 'gaus_lobat',
132
+ 'gaus_lobat_wgt', 'gc_aangle', 'gc_clkwise', 'gc_dangle',
133
+ 'gc_inout', 'gc_latlon', 'gc_onarc', 'gc_pnt2gc', 'gc_qarea',
134
+ 'gc_tarea', 'generate_2d_array', 'get_color_index',
135
+ 'get_color_rgba', 'get_cpu_time', 'get_isolines', 'get_ncl_version',
136
+ 'get_script_name', 'get_script_prefix_name', 'get_sphere_radius',
137
+ 'get_unique_values', 'getbitsone', 'getenv', 'getfiledimsizes',
138
+ 'getfilegrpnames', 'getfilepath', 'getfilevaratts',
139
+ 'getfilevarchunkdimsizes', 'getfilevardims', 'getfilevardimsizes',
140
+ 'getfilevarnames', 'getfilevartypes', 'getvaratts', 'getvardims',
141
+ 'gradsf', 'gradsg', 'greg2jul', 'grid2triple', 'hlsrgb', 'hsvrgb',
142
+ 'hydro', 'hyi2hyo', 'idsfft', 'igradsf', 'igradsg', 'ilapsf',
143
+ 'ilapsg', 'ilapvf', 'ilapvg', 'ind', 'ind_resolve', 'int2p',
144
+ 'int2p_n', 'integertobyte', 'integertochar', 'integertocharacter',
145
+ 'integertoshort', 'inttobyte', 'inttochar', 'inttoshort',
146
+ 'inverse_matrix', 'isatt', 'isbigendian', 'isbyte', 'ischar',
147
+ 'iscoord', 'isdefined', 'isdim', 'isdimnamed', 'isdouble',
148
+ 'isenumeric', 'isfile', 'isfilepresent', 'isfilevar',
149
+ 'isfilevaratt', 'isfilevarcoord', 'isfilevardim', 'isfloat',
150
+ 'isfunc', 'isgraphic', 'isint', 'isint64', 'isinteger',
151
+ 'isleapyear', 'islogical', 'islong', 'ismissing', 'isnan_ieee',
152
+ 'isnumeric', 'ispan', 'isproc', 'isshort', 'issnumeric', 'isstring',
153
+ 'isubyte', 'isuint', 'isuint64', 'isulong', 'isunlimited',
154
+ 'isunsigned', 'isushort', 'isvar', 'jul2greg', 'kmeans_as136',
155
+ 'kolsm2_n', 'kron_product', 'lapsf', 'lapsg', 'lapvf', 'lapvg',
156
+ 'latlon2utm', 'lclvl', 'lderuvf', 'lderuvg', 'linint1', 'linint1_n',
157
+ 'linint2', 'linint2_points', 'linmsg', 'linmsg_n', 'linrood_latwgt',
158
+ 'linrood_wgt', 'list_files', 'list_filevars', 'list_hlus',
159
+ 'list_procfuncs', 'list_vars', 'ListAppend', 'ListCount',
160
+ 'ListGetType', 'ListIndex', 'ListIndexFromName', 'ListPop',
161
+ 'ListPush', 'ListSetType', 'loadscript', 'local_max', 'local_min',
162
+ 'log', 'log10', 'longtobyte', 'longtochar', 'longtocharacter',
163
+ 'longtoint', 'longtointeger', 'longtoshort', 'lspoly', 'lspoly_n',
164
+ 'mask', 'max', 'maxind', 'min', 'minind', 'mixed_layer_depth',
165
+ 'mixhum_ptd', 'mixhum_ptrh', 'mjo_cross_coh2pha',
166
+ 'mjo_cross_segment', 'moc_globe_atl', 'monthday', 'natgrid',
167
+ 'natgridd', 'natgrids', 'ncargpath', 'ncargversion', 'ndctodata',
168
+ 'ndtooned', 'new', 'NewList', 'ngezlogo', 'nggcog', 'nggetp',
169
+ 'nglogo', 'ngsetp', 'NhlAddAnnotation', 'NhlAddData',
170
+ 'NhlAddOverlay', 'NhlAddPrimitive', 'NhlAppGetDefaultParentId',
171
+ 'NhlChangeWorkstation', 'NhlClassName', 'NhlClearWorkstation',
172
+ 'NhlDataPolygon', 'NhlDataPolyline', 'NhlDataPolymarker',
173
+ 'NhlDataToNDC', 'NhlDestroy', 'NhlDraw', 'NhlFrame', 'NhlFreeColor',
174
+ 'NhlGetBB', 'NhlGetClassResources', 'NhlGetErrorObjectId',
175
+ 'NhlGetNamedColorIndex', 'NhlGetParentId',
176
+ 'NhlGetParentWorkstation', 'NhlGetWorkspaceObjectId',
177
+ 'NhlIsAllocatedColor', 'NhlIsApp', 'NhlIsDataComm', 'NhlIsDataItem',
178
+ 'NhlIsDataSpec', 'NhlIsTransform', 'NhlIsView', 'NhlIsWorkstation',
179
+ 'NhlName', 'NhlNDCPolygon', 'NhlNDCPolyline', 'NhlNDCPolymarker',
180
+ 'NhlNDCToData', 'NhlNewColor', 'NhlNewDashPattern', 'NhlNewMarker',
181
+ 'NhlPalGetDefined', 'NhlRemoveAnnotation', 'NhlRemoveData',
182
+ 'NhlRemoveOverlay', 'NhlRemovePrimitive', 'NhlSetColor',
183
+ 'NhlSetDashPattern', 'NhlSetMarker', 'NhlUpdateData',
184
+ 'NhlUpdateWorkstation', 'nice_mnmxintvl', 'nngetaspectd',
185
+ 'nngetaspects', 'nngetp', 'nngetsloped', 'nngetslopes', 'nngetwts',
186
+ 'nngetwtsd', 'nnpnt', 'nnpntd', 'nnpntend', 'nnpntendd',
187
+ 'nnpntinit', 'nnpntinitd', 'nnpntinits', 'nnpnts', 'nnsetp', 'num',
188
+ 'obj_anal_ic', 'omega_ccm', 'onedtond', 'overlay', 'paleo_outline',
189
+ 'pdfxy_bin', 'poisson_grid_fill', 'pop_remap', 'potmp_insitu_ocn',
190
+ 'prcwater_dp', 'pres2hybrid', 'pres_hybrid_ccm', 'pres_sigma',
191
+ 'print', 'print_table', 'printFileVarSummary', 'printVarSummary',
192
+ 'product', 'pslec', 'pslhor', 'pslhyp', 'qsort', 'rand',
193
+ 'random_chi', 'random_gamma', 'random_normal', 'random_setallseed',
194
+ 'random_uniform', 'rcm2points', 'rcm2rgrid', 'rdsstoi',
195
+ 'read_colormap_file', 'reg_multlin', 'regcoef', 'regCoef_n',
196
+ 'regline', 'relhum', 'replace_ieeenan', 'reshape', 'reshape_ind',
197
+ 'rgba_to_color_index', 'rgbhls', 'rgbhsv', 'rgbyiq', 'rgrid2rcm',
198
+ 'rhomb_trunc', 'rip_cape_2d', 'rip_cape_3d', 'round', 'rtest',
199
+ 'runave', 'runave_n', 'set_default_fillvalue', 'set_sphere_radius',
200
+ 'setfileoption', 'sfvp2uvf', 'sfvp2uvg', 'shaec', 'shagc',
201
+ 'shgetnp', 'shgetp', 'shgrid', 'shorttobyte', 'shorttochar',
202
+ 'shorttocharacter', 'show_ascii', 'shsec', 'shsetp', 'shsgc',
203
+ 'shsgc_R42', 'sigma2hybrid', 'simpeq', 'simpne', 'sin',
204
+ 'sindex_yrmo', 'sinh', 'sizeof', 'sleep', 'smth9', 'snindex_yrmo',
205
+ 'solve_linsys', 'span_color_indexes', 'span_color_rgba',
206
+ 'sparse_matrix_mult', 'spcorr', 'spcorr_n', 'specx_anal',
207
+ 'specxy_anal', 'spei', 'sprintf', 'sprinti', 'sqrt', 'sqsort',
208
+ 'srand', 'stat2', 'stat4', 'stat_medrng', 'stat_trim',
209
+ 'status_exit', 'stdatmus_p2tdz', 'stdatmus_z2tdp', 'stddev',
210
+ 'str_capital', 'str_concat', 'str_fields_count', 'str_get_cols',
211
+ 'str_get_dq', 'str_get_field', 'str_get_nl', 'str_get_sq',
212
+ 'str_get_tab', 'str_index_of_substr', 'str_insert', 'str_is_blank',
213
+ 'str_join', 'str_left_strip', 'str_lower', 'str_match',
214
+ 'str_match_ic', 'str_match_ic_regex', 'str_match_ind',
215
+ 'str_match_ind_ic', 'str_match_ind_ic_regex', 'str_match_ind_regex',
216
+ 'str_match_regex', 'str_right_strip', 'str_split',
217
+ 'str_split_by_length', 'str_split_csv', 'str_squeeze', 'str_strip',
218
+ 'str_sub_str', 'str_switch', 'str_upper', 'stringtochar',
219
+ 'stringtocharacter', 'stringtodouble', 'stringtofloat',
220
+ 'stringtoint', 'stringtointeger', 'stringtolong', 'stringtoshort',
221
+ 'strlen', 'student_t', 'sum', 'svd_lapack', 'svdcov', 'svdcov_sv',
222
+ 'svdstd', 'svdstd_sv', 'system', 'systemfunc', 'tan', 'tanh',
223
+ 'taper', 'taper_n', 'tdclrs', 'tdctri', 'tdcudp', 'tdcurv',
224
+ 'tddtri', 'tdez2d', 'tdez3d', 'tdgetp', 'tdgrds', 'tdgrid',
225
+ 'tdgtrs', 'tdinit', 'tditri', 'tdlbla', 'tdlblp', 'tdlbls',
226
+ 'tdline', 'tdlndp', 'tdlnpa', 'tdlpdp', 'tdmtri', 'tdotri',
227
+ 'tdpara', 'tdplch', 'tdprpa', 'tdprpi', 'tdprpt', 'tdsetp',
228
+ 'tdsort', 'tdstri', 'tdstrs', 'tdttri', 'thornthwaite', 'tobyte',
229
+ 'tochar', 'todouble', 'tofloat', 'toint', 'toint64', 'tointeger',
230
+ 'tolong', 'toshort', 'tosigned', 'tostring', 'tostring_with_format',
231
+ 'totype', 'toubyte', 'touint', 'touint64', 'toulong', 'tounsigned',
232
+ 'toushort', 'trend_manken', 'tri_trunc', 'triple2grid',
233
+ 'triple2grid2d', 'trop_wmo', 'ttest', 'typeof', 'undef',
234
+ 'unique_string', 'update', 'ushorttoint', 'ut_calendar',
235
+ 'ut_inv_calendar', 'utm2latlon', 'uv2dv_cfd', 'uv2dvf', 'uv2dvg',
236
+ 'uv2sfvpf', 'uv2sfvpg', 'uv2vr_cfd', 'uv2vrdvf', 'uv2vrdvg',
237
+ 'uv2vrf', 'uv2vrg', 'v5d_close', 'v5d_create', 'v5d_setLowLev',
238
+ 'v5d_setUnits', 'v5d_write', 'v5d_write_var', 'variance', 'vhaec',
239
+ 'vhagc', 'vhsec', 'vhsgc', 'vibeta', 'vinth2p', 'vinth2p_ecmwf',
240
+ 'vinth2p_ecmwf_nodes', 'vinth2p_nodes', 'vintp2p_ecmwf', 'vr2uvf',
241
+ 'vr2uvg', 'vrdv2uvf', 'vrdv2uvg', 'wavelet', 'wavelet_default',
242
+ 'weibull', 'wgt_area_smooth', 'wgt_areaave', 'wgt_areaave2',
243
+ 'wgt_arearmse', 'wgt_arearmse2', 'wgt_areasum2', 'wgt_runave',
244
+ 'wgt_runave_n', 'wgt_vert_avg_beta', 'wgt_volave', 'wgt_volave_ccm',
245
+ 'wgt_volrmse', 'wgt_volrmse_ccm', 'where', 'wk_smooth121', 'wmbarb',
246
+ 'wmbarbmap', 'wmdrft', 'wmgetp', 'wmlabs', 'wmsetp', 'wmstnm',
247
+ 'wmvect', 'wmvectmap', 'wmvlbl', 'wrf_avo', 'wrf_cape_2d',
248
+ 'wrf_cape_3d', 'wrf_dbz', 'wrf_eth', 'wrf_helicity', 'wrf_ij_to_ll',
249
+ 'wrf_interp_1d', 'wrf_interp_2d_xy', 'wrf_interp_3d_z',
250
+ 'wrf_latlon_to_ij', 'wrf_ll_to_ij', 'wrf_omega', 'wrf_pvo',
251
+ 'wrf_rh', 'wrf_slp', 'wrf_smooth_2d', 'wrf_td', 'wrf_tk',
252
+ 'wrf_updraft_helicity', 'wrf_uvmet', 'wrf_virtual_temp',
253
+ 'wrf_wetbulb', 'wrf_wps_close_int', 'wrf_wps_open_int',
254
+ 'wrf_wps_rddata_int', 'wrf_wps_rdhead_int', 'wrf_wps_read_int',
255
+ 'wrf_wps_write_int', 'write_matrix', 'write_table', 'yiqrgb',
256
+ 'z2geouv', 'zonal_mpsi', 'addfiles_GetVar', 'advect_variable',
257
+ 'area_conserve_remap_Wrap', 'area_hi2lores_Wrap',
258
+ 'array_append_record', 'assignFillValue', 'byte2flt',
259
+ 'byte2flt_hdf', 'calcDayAnomTLL', 'calcMonAnomLLLT',
260
+ 'calcMonAnomLLT', 'calcMonAnomTLL', 'calcMonAnomTLLL',
261
+ 'calculate_monthly_values', 'cd_convert', 'changeCase',
262
+ 'changeCaseChar', 'clmDayTLL', 'clmDayTLLL', 'clmMon2clmDay',
263
+ 'clmMonLLLT', 'clmMonLLT', 'clmMonTLL', 'clmMonTLLL', 'closest_val',
264
+ 'copy_VarAtts', 'copy_VarCoords', 'copy_VarCoords_1',
265
+ 'copy_VarCoords_2', 'copy_VarMeta', 'copyatt', 'crossp3',
266
+ 'cshstringtolist', 'cssgrid_Wrap', 'dble2flt', 'decimalPlaces',
267
+ 'delete_VarAtts', 'dim_avg_n_Wrap', 'dim_avg_wgt_n_Wrap',
268
+ 'dim_avg_wgt_Wrap', 'dim_avg_Wrap', 'dim_cumsum_n_Wrap',
269
+ 'dim_cumsum_Wrap', 'dim_max_n_Wrap', 'dim_min_n_Wrap',
270
+ 'dim_rmsd_n_Wrap', 'dim_rmsd_Wrap', 'dim_rmvmean_n_Wrap',
271
+ 'dim_rmvmean_Wrap', 'dim_rmvmed_n_Wrap', 'dim_rmvmed_Wrap',
272
+ 'dim_standardize_n_Wrap', 'dim_standardize_Wrap',
273
+ 'dim_stddev_n_Wrap', 'dim_stddev_Wrap', 'dim_sum_n_Wrap',
274
+ 'dim_sum_wgt_n_Wrap', 'dim_sum_wgt_Wrap', 'dim_sum_Wrap',
275
+ 'dim_variance_n_Wrap', 'dim_variance_Wrap', 'dpres_plevel_Wrap',
276
+ 'dtrend_leftdim', 'dv2uvF_Wrap', 'dv2uvG_Wrap', 'eof_north',
277
+ 'eofcor_Wrap', 'eofcov_Wrap', 'eofunc_north', 'eofunc_ts_Wrap',
278
+ 'eofunc_varimax_reorder', 'eofunc_varimax_Wrap', 'eofunc_Wrap',
279
+ 'epsZero', 'f2fosh_Wrap', 'f2foshv_Wrap', 'f2fsh_Wrap',
280
+ 'f2fshv_Wrap', 'f2gsh_Wrap', 'f2gshv_Wrap', 'fbindirSwap',
281
+ 'fbinseqSwap1', 'fbinseqSwap2', 'flt2dble', 'flt2string',
282
+ 'fo2fsh_Wrap', 'fo2fshv_Wrap', 'g2fsh_Wrap', 'g2fshv_Wrap',
283
+ 'g2gsh_Wrap', 'g2gshv_Wrap', 'generate_resample_indices',
284
+ 'generate_sample_indices', 'generate_unique_indices',
285
+ 'genNormalDist', 'get1Dindex', 'get1Dindex_Collapse',
286
+ 'get1Dindex_Exclude', 'get_file_suffix', 'GetFillColor',
287
+ 'GetFillColorIndex', 'getFillValue', 'getind_latlon2d',
288
+ 'getVarDimNames', 'getVarFillValue', 'grib_stime2itime',
289
+ 'hyi2hyo_Wrap', 'ilapsF_Wrap', 'ilapsG_Wrap', 'ind_nearest_coord',
290
+ 'indStrSubset', 'int2dble', 'int2flt', 'int2p_n_Wrap', 'int2p_Wrap',
291
+ 'isMonotonic', 'isStrSubset', 'latGau', 'latGauWgt', 'latGlobeF',
292
+ 'latGlobeFo', 'latRegWgt', 'linint1_n_Wrap', 'linint1_Wrap',
293
+ 'linint2_points_Wrap', 'linint2_Wrap', 'local_max_1d',
294
+ 'local_min_1d', 'lonFlip', 'lonGlobeF', 'lonGlobeFo', 'lonPivot',
295
+ 'merge_levels_sfc', 'mod', 'month_to_annual',
296
+ 'month_to_annual_weighted', 'month_to_season', 'month_to_season12',
297
+ 'month_to_seasonN', 'monthly_total_to_daily_mean', 'nameDim',
298
+ 'natgrid_Wrap', 'NewCosWeight', 'niceLatLon2D', 'NormCosWgtGlobe',
299
+ 'numAsciiCol', 'numAsciiRow', 'numeric2int',
300
+ 'obj_anal_ic_deprecated', 'obj_anal_ic_Wrap', 'omega_ccm_driver',
301
+ 'omega_to_w', 'oneDtostring', 'pack_values', 'pattern_cor', 'pdfx',
302
+ 'pdfxy', 'pdfxy_conform', 'pot_temp', 'pot_vort_hybrid',
303
+ 'pot_vort_isobaric', 'pres2hybrid_Wrap', 'print_clock',
304
+ 'printMinMax', 'quadroots', 'rcm2points_Wrap', 'rcm2rgrid_Wrap',
305
+ 'readAsciiHead', 'readAsciiTable', 'reg_multlin_stats',
306
+ 'region_ind', 'regline_stats', 'relhum_ttd', 'replaceSingleChar',
307
+ 'RGBtoCmap', 'rgrid2rcm_Wrap', 'rho_mwjf', 'rm_single_dims',
308
+ 'rmAnnCycle1D', 'rmInsufData', 'rmMonAnnCycLLLT', 'rmMonAnnCycLLT',
309
+ 'rmMonAnnCycTLL', 'runave_n_Wrap', 'runave_Wrap', 'short2flt',
310
+ 'short2flt_hdf', 'shsgc_R42_Wrap', 'sign_f90', 'sign_matlab',
311
+ 'smth9_Wrap', 'smthClmDayTLL', 'smthClmDayTLLL', 'SqrtCosWeight',
312
+ 'stat_dispersion', 'static_stability', 'stdMonLLLT', 'stdMonLLT',
313
+ 'stdMonTLL', 'stdMonTLLL', 'symMinMaxPlt', 'table_attach_columns',
314
+ 'table_attach_rows', 'time_to_newtime', 'transpose',
315
+ 'triple2grid_Wrap', 'ut_convert', 'uv2dvF_Wrap', 'uv2dvG_Wrap',
316
+ 'uv2vrF_Wrap', 'uv2vrG_Wrap', 'vr2uvF_Wrap', 'vr2uvG_Wrap',
317
+ 'w_to_omega', 'wallClockElapseTime', 'wave_number_spc',
318
+ 'wgt_areaave_Wrap', 'wgt_runave_leftdim', 'wgt_runave_n_Wrap',
319
+ 'wgt_runave_Wrap', 'wgt_vertical_n', 'wind_component',
320
+ 'wind_direction', 'yyyyddd_to_yyyymmdd', 'yyyymm_time',
321
+ 'yyyymm_to_yyyyfrac', 'yyyymmdd_time', 'yyyymmdd_to_yyyyddd',
322
+ 'yyyymmdd_to_yyyyfrac', 'yyyymmddhh_time', 'yyyymmddhh_to_yyyyfrac',
323
+ 'zonal_mpsi_Wrap', 'zonalAve', 'calendar_decode2', 'cd_string',
324
+ 'kf_filter', 'run_cor', 'time_axis_labels', 'ut_string',
325
+ 'wrf_contour', 'wrf_map', 'wrf_map_overlay', 'wrf_map_overlays',
326
+ 'wrf_map_resources', 'wrf_map_zoom', 'wrf_overlay', 'wrf_overlays',
327
+ 'wrf_user_getvar', 'wrf_user_ij_to_ll', 'wrf_user_intrp2d',
328
+ 'wrf_user_intrp3d', 'wrf_user_latlon_to_ij', 'wrf_user_list_times',
329
+ 'wrf_user_ll_to_ij', 'wrf_user_unstagger', 'wrf_user_vert_interp',
330
+ 'wrf_vector', 'gsn_add_annotation', 'gsn_add_polygon',
331
+ 'gsn_add_polyline', 'gsn_add_polymarker',
332
+ 'gsn_add_shapefile_polygons', 'gsn_add_shapefile_polylines',
333
+ 'gsn_add_shapefile_polymarkers', 'gsn_add_text', 'gsn_attach_plots',
334
+ 'gsn_blank_plot', 'gsn_contour', 'gsn_contour_map',
335
+ 'gsn_contour_shade', 'gsn_coordinates', 'gsn_create_labelbar',
336
+ 'gsn_create_legend', 'gsn_create_text',
337
+ 'gsn_csm_attach_zonal_means', 'gsn_csm_blank_plot',
338
+ 'gsn_csm_contour', 'gsn_csm_contour_map', 'gsn_csm_contour_map_ce',
339
+ 'gsn_csm_contour_map_overlay', 'gsn_csm_contour_map_polar',
340
+ 'gsn_csm_hov', 'gsn_csm_lat_time', 'gsn_csm_map', 'gsn_csm_map_ce',
341
+ 'gsn_csm_map_polar', 'gsn_csm_pres_hgt',
342
+ 'gsn_csm_pres_hgt_streamline', 'gsn_csm_pres_hgt_vector',
343
+ 'gsn_csm_streamline', 'gsn_csm_streamline_contour_map',
344
+ 'gsn_csm_streamline_contour_map_ce',
345
+ 'gsn_csm_streamline_contour_map_polar', 'gsn_csm_streamline_map',
346
+ 'gsn_csm_streamline_map_ce', 'gsn_csm_streamline_map_polar',
347
+ 'gsn_csm_streamline_scalar', 'gsn_csm_streamline_scalar_map',
348
+ 'gsn_csm_streamline_scalar_map_ce',
349
+ 'gsn_csm_streamline_scalar_map_polar', 'gsn_csm_time_lat',
350
+ 'gsn_csm_vector', 'gsn_csm_vector_map', 'gsn_csm_vector_map_ce',
351
+ 'gsn_csm_vector_map_polar', 'gsn_csm_vector_scalar',
352
+ 'gsn_csm_vector_scalar_map', 'gsn_csm_vector_scalar_map_ce',
353
+ 'gsn_csm_vector_scalar_map_polar', 'gsn_csm_x2y', 'gsn_csm_x2y2',
354
+ 'gsn_csm_xy', 'gsn_csm_xy2', 'gsn_csm_xy3', 'gsn_csm_y',
355
+ 'gsn_define_colormap', 'gsn_draw_colormap', 'gsn_draw_named_colors',
356
+ 'gsn_histogram', 'gsn_labelbar_ndc', 'gsn_legend_ndc', 'gsn_map',
357
+ 'gsn_merge_colormaps', 'gsn_open_wks', 'gsn_panel', 'gsn_polygon',
358
+ 'gsn_polygon_ndc', 'gsn_polyline', 'gsn_polyline_ndc',
359
+ 'gsn_polymarker', 'gsn_polymarker_ndc', 'gsn_retrieve_colormap',
360
+ 'gsn_reverse_colormap', 'gsn_streamline', 'gsn_streamline_map',
361
+ 'gsn_streamline_scalar', 'gsn_streamline_scalar_map', 'gsn_table',
362
+ 'gsn_text', 'gsn_text_ndc', 'gsn_vector', 'gsn_vector_map',
363
+ 'gsn_vector_scalar', 'gsn_vector_scalar_map', 'gsn_xy', 'gsn_y',
364
+ 'hsv2rgb', 'maximize_output', 'namedcolor2rgb', 'namedcolor2rgba',
365
+ 'reset_device_coordinates', 'span_named_colors'), prefix=r'\b'),
366
+ Name.Builtin),
367
+
368
+ # Resources
369
+ (words((
370
+ 'amDataXF', 'amDataYF', 'amJust', 'amOn', 'amOrthogonalPosF',
371
+ 'amParallelPosF', 'amResizeNotify', 'amSide', 'amTrackData',
372
+ 'amViewId', 'amZone', 'appDefaultParent', 'appFileSuffix',
373
+ 'appResources', 'appSysDir', 'appUsrDir', 'caCopyArrays',
374
+ 'caXArray', 'caXCast', 'caXMaxV', 'caXMinV', 'caXMissingV',
375
+ 'caYArray', 'caYCast', 'caYMaxV', 'caYMinV', 'caYMissingV',
376
+ 'cnCellFillEdgeColor', 'cnCellFillMissingValEdgeColor',
377
+ 'cnConpackParams', 'cnConstFEnableFill', 'cnConstFLabelAngleF',
378
+ 'cnConstFLabelBackgroundColor', 'cnConstFLabelConstantSpacingF',
379
+ 'cnConstFLabelFont', 'cnConstFLabelFontAspectF',
380
+ 'cnConstFLabelFontColor', 'cnConstFLabelFontHeightF',
381
+ 'cnConstFLabelFontQuality', 'cnConstFLabelFontThicknessF',
382
+ 'cnConstFLabelFormat', 'cnConstFLabelFuncCode', 'cnConstFLabelJust',
383
+ 'cnConstFLabelOn', 'cnConstFLabelOrthogonalPosF',
384
+ 'cnConstFLabelParallelPosF', 'cnConstFLabelPerimColor',
385
+ 'cnConstFLabelPerimOn', 'cnConstFLabelPerimSpaceF',
386
+ 'cnConstFLabelPerimThicknessF', 'cnConstFLabelSide',
387
+ 'cnConstFLabelString', 'cnConstFLabelTextDirection',
388
+ 'cnConstFLabelZone', 'cnConstFUseInfoLabelRes',
389
+ 'cnExplicitLabelBarLabelsOn', 'cnExplicitLegendLabelsOn',
390
+ 'cnExplicitLineLabelsOn', 'cnFillBackgroundColor', 'cnFillColor',
391
+ 'cnFillColors', 'cnFillDotSizeF', 'cnFillDrawOrder', 'cnFillMode',
392
+ 'cnFillOn', 'cnFillOpacityF', 'cnFillPalette', 'cnFillPattern',
393
+ 'cnFillPatterns', 'cnFillScaleF', 'cnFillScales', 'cnFixFillBleed',
394
+ 'cnGridBoundFillColor', 'cnGridBoundFillPattern',
395
+ 'cnGridBoundFillScaleF', 'cnGridBoundPerimColor',
396
+ 'cnGridBoundPerimDashPattern', 'cnGridBoundPerimOn',
397
+ 'cnGridBoundPerimThicknessF', 'cnHighLabelAngleF',
398
+ 'cnHighLabelBackgroundColor', 'cnHighLabelConstantSpacingF',
399
+ 'cnHighLabelCount', 'cnHighLabelFont', 'cnHighLabelFontAspectF',
400
+ 'cnHighLabelFontColor', 'cnHighLabelFontHeightF',
401
+ 'cnHighLabelFontQuality', 'cnHighLabelFontThicknessF',
402
+ 'cnHighLabelFormat', 'cnHighLabelFuncCode', 'cnHighLabelPerimColor',
403
+ 'cnHighLabelPerimOn', 'cnHighLabelPerimSpaceF',
404
+ 'cnHighLabelPerimThicknessF', 'cnHighLabelString', 'cnHighLabelsOn',
405
+ 'cnHighLowLabelOverlapMode', 'cnHighUseLineLabelRes',
406
+ 'cnInfoLabelAngleF', 'cnInfoLabelBackgroundColor',
407
+ 'cnInfoLabelConstantSpacingF', 'cnInfoLabelFont',
408
+ 'cnInfoLabelFontAspectF', 'cnInfoLabelFontColor',
409
+ 'cnInfoLabelFontHeightF', 'cnInfoLabelFontQuality',
410
+ 'cnInfoLabelFontThicknessF', 'cnInfoLabelFormat',
411
+ 'cnInfoLabelFuncCode', 'cnInfoLabelJust', 'cnInfoLabelOn',
412
+ 'cnInfoLabelOrthogonalPosF', 'cnInfoLabelParallelPosF',
413
+ 'cnInfoLabelPerimColor', 'cnInfoLabelPerimOn',
414
+ 'cnInfoLabelPerimSpaceF', 'cnInfoLabelPerimThicknessF',
415
+ 'cnInfoLabelSide', 'cnInfoLabelString', 'cnInfoLabelTextDirection',
416
+ 'cnInfoLabelZone', 'cnLabelBarEndLabelsOn', 'cnLabelBarEndStyle',
417
+ 'cnLabelDrawOrder', 'cnLabelMasking', 'cnLabelScaleFactorF',
418
+ 'cnLabelScaleValueF', 'cnLabelScalingMode', 'cnLegendLevelFlags',
419
+ 'cnLevelCount', 'cnLevelFlag', 'cnLevelFlags', 'cnLevelSelectionMode',
420
+ 'cnLevelSpacingF', 'cnLevels', 'cnLineColor', 'cnLineColors',
421
+ 'cnLineDashPattern', 'cnLineDashPatterns', 'cnLineDashSegLenF',
422
+ 'cnLineDrawOrder', 'cnLineLabelAngleF', 'cnLineLabelBackgroundColor',
423
+ 'cnLineLabelConstantSpacingF', 'cnLineLabelCount',
424
+ 'cnLineLabelDensityF', 'cnLineLabelFont', 'cnLineLabelFontAspectF',
425
+ 'cnLineLabelFontColor', 'cnLineLabelFontColors',
426
+ 'cnLineLabelFontHeightF', 'cnLineLabelFontQuality',
427
+ 'cnLineLabelFontThicknessF', 'cnLineLabelFormat',
428
+ 'cnLineLabelFuncCode', 'cnLineLabelInterval', 'cnLineLabelPerimColor',
429
+ 'cnLineLabelPerimOn', 'cnLineLabelPerimSpaceF',
430
+ 'cnLineLabelPerimThicknessF', 'cnLineLabelPlacementMode',
431
+ 'cnLineLabelStrings', 'cnLineLabelsOn', 'cnLinePalette',
432
+ 'cnLineThicknessF', 'cnLineThicknesses', 'cnLinesOn',
433
+ 'cnLowLabelAngleF', 'cnLowLabelBackgroundColor',
434
+ 'cnLowLabelConstantSpacingF', 'cnLowLabelCount', 'cnLowLabelFont',
435
+ 'cnLowLabelFontAspectF', 'cnLowLabelFontColor',
436
+ 'cnLowLabelFontHeightF', 'cnLowLabelFontQuality',
437
+ 'cnLowLabelFontThicknessF', 'cnLowLabelFormat', 'cnLowLabelFuncCode',
438
+ 'cnLowLabelPerimColor', 'cnLowLabelPerimOn', 'cnLowLabelPerimSpaceF',
439
+ 'cnLowLabelPerimThicknessF', 'cnLowLabelString', 'cnLowLabelsOn',
440
+ 'cnLowUseHighLabelRes', 'cnMaxDataValueFormat', 'cnMaxLevelCount',
441
+ 'cnMaxLevelValF', 'cnMaxPointDistanceF', 'cnMinLevelValF',
442
+ 'cnMissingValFillColor', 'cnMissingValFillPattern',
443
+ 'cnMissingValFillScaleF', 'cnMissingValPerimColor',
444
+ 'cnMissingValPerimDashPattern', 'cnMissingValPerimGridBoundOn',
445
+ 'cnMissingValPerimOn', 'cnMissingValPerimThicknessF',
446
+ 'cnMonoFillColor', 'cnMonoFillPattern', 'cnMonoFillScale',
447
+ 'cnMonoLevelFlag', 'cnMonoLineColor', 'cnMonoLineDashPattern',
448
+ 'cnMonoLineLabelFontColor', 'cnMonoLineThickness', 'cnNoDataLabelOn',
449
+ 'cnNoDataLabelString', 'cnOutOfRangeFillColor',
450
+ 'cnOutOfRangeFillPattern', 'cnOutOfRangeFillScaleF',
451
+ 'cnOutOfRangePerimColor', 'cnOutOfRangePerimDashPattern',
452
+ 'cnOutOfRangePerimOn', 'cnOutOfRangePerimThicknessF',
453
+ 'cnRasterCellSizeF', 'cnRasterMinCellSizeF', 'cnRasterModeOn',
454
+ 'cnRasterSampleFactorF', 'cnRasterSmoothingOn', 'cnScalarFieldData',
455
+ 'cnSmoothingDistanceF', 'cnSmoothingOn', 'cnSmoothingTensionF',
456
+ 'cnSpanFillPalette', 'cnSpanLinePalette', 'ctCopyTables',
457
+ 'ctXElementSize', 'ctXMaxV', 'ctXMinV', 'ctXMissingV', 'ctXTable',
458
+ 'ctXTableLengths', 'ctXTableType', 'ctYElementSize', 'ctYMaxV',
459
+ 'ctYMinV', 'ctYMissingV', 'ctYTable', 'ctYTableLengths',
460
+ 'ctYTableType', 'dcDelayCompute', 'errBuffer',
461
+ 'errFileName', 'errFilePtr', 'errLevel', 'errPrint', 'errUnitNumber',
462
+ 'gsClipOn', 'gsColors', 'gsEdgeColor', 'gsEdgeDashPattern',
463
+ 'gsEdgeDashSegLenF', 'gsEdgeThicknessF', 'gsEdgesOn',
464
+ 'gsFillBackgroundColor', 'gsFillColor', 'gsFillDotSizeF',
465
+ 'gsFillIndex', 'gsFillLineThicknessF', 'gsFillOpacityF',
466
+ 'gsFillScaleF', 'gsFont', 'gsFontAspectF', 'gsFontColor',
467
+ 'gsFontHeightF', 'gsFontOpacityF', 'gsFontQuality',
468
+ 'gsFontThicknessF', 'gsLineColor', 'gsLineDashPattern',
469
+ 'gsLineDashSegLenF', 'gsLineLabelConstantSpacingF', 'gsLineLabelFont',
470
+ 'gsLineLabelFontAspectF', 'gsLineLabelFontColor',
471
+ 'gsLineLabelFontHeightF', 'gsLineLabelFontQuality',
472
+ 'gsLineLabelFontThicknessF', 'gsLineLabelFuncCode',
473
+ 'gsLineLabelString', 'gsLineOpacityF', 'gsLineThicknessF',
474
+ 'gsMarkerColor', 'gsMarkerIndex', 'gsMarkerOpacityF', 'gsMarkerSizeF',
475
+ 'gsMarkerThicknessF', 'gsSegments', 'gsTextAngleF',
476
+ 'gsTextConstantSpacingF', 'gsTextDirection', 'gsTextFuncCode',
477
+ 'gsTextJustification', 'gsnAboveYRefLineBarColors',
478
+ 'gsnAboveYRefLineBarFillScales', 'gsnAboveYRefLineBarPatterns',
479
+ 'gsnAboveYRefLineColor', 'gsnAddCyclic', 'gsnAttachBorderOn',
480
+ 'gsnAttachPlotsXAxis', 'gsnBelowYRefLineBarColors',
481
+ 'gsnBelowYRefLineBarFillScales', 'gsnBelowYRefLineBarPatterns',
482
+ 'gsnBelowYRefLineColor', 'gsnBoxMargin', 'gsnCenterString',
483
+ 'gsnCenterStringFontColor', 'gsnCenterStringFontHeightF',
484
+ 'gsnCenterStringFuncCode', 'gsnCenterStringOrthogonalPosF',
485
+ 'gsnCenterStringParallelPosF', 'gsnContourLineThicknessesScale',
486
+ 'gsnContourNegLineDashPattern', 'gsnContourPosLineDashPattern',
487
+ 'gsnContourZeroLineThicknessF', 'gsnDebugWriteFileName', 'gsnDraw',
488
+ 'gsnFrame', 'gsnHistogramBarWidthPercent', 'gsnHistogramBinIntervals',
489
+ 'gsnHistogramBinMissing', 'gsnHistogramBinWidth',
490
+ 'gsnHistogramClassIntervals', 'gsnHistogramCompare',
491
+ 'gsnHistogramComputePercentages',
492
+ 'gsnHistogramComputePercentagesNoMissing',
493
+ 'gsnHistogramDiscreteBinValues', 'gsnHistogramDiscreteClassValues',
494
+ 'gsnHistogramHorizontal', 'gsnHistogramMinMaxBinsOn',
495
+ 'gsnHistogramNumberOfBins', 'gsnHistogramPercentSign',
496
+ 'gsnHistogramSelectNiceIntervals', 'gsnLeftString',
497
+ 'gsnLeftStringFontColor', 'gsnLeftStringFontHeightF',
498
+ 'gsnLeftStringFuncCode', 'gsnLeftStringOrthogonalPosF',
499
+ 'gsnLeftStringParallelPosF', 'gsnMajorLatSpacing',
500
+ 'gsnMajorLonSpacing', 'gsnMaskLambertConformal',
501
+ 'gsnMaskLambertConformalOutlineOn', 'gsnMaximize',
502
+ 'gsnMinorLatSpacing', 'gsnMinorLonSpacing', 'gsnPanelBottom',
503
+ 'gsnPanelCenter', 'gsnPanelDebug', 'gsnPanelFigureStrings',
504
+ 'gsnPanelFigureStringsBackgroundFillColor',
505
+ 'gsnPanelFigureStringsFontHeightF', 'gsnPanelFigureStringsJust',
506
+ 'gsnPanelFigureStringsPerimOn', 'gsnPanelLabelBar', 'gsnPanelLeft',
507
+ 'gsnPanelMainFont', 'gsnPanelMainFontColor',
508
+ 'gsnPanelMainFontHeightF', 'gsnPanelMainString', 'gsnPanelRight',
509
+ 'gsnPanelRowSpec', 'gsnPanelScalePlotIndex', 'gsnPanelTop',
510
+ 'gsnPanelXF', 'gsnPanelXWhiteSpacePercent', 'gsnPanelYF',
511
+ 'gsnPanelYWhiteSpacePercent', 'gsnPaperHeight', 'gsnPaperMargin',
512
+ 'gsnPaperOrientation', 'gsnPaperWidth', 'gsnPolar',
513
+ 'gsnPolarLabelDistance', 'gsnPolarLabelFont',
514
+ 'gsnPolarLabelFontHeightF', 'gsnPolarLabelSpacing', 'gsnPolarTime',
515
+ 'gsnPolarUT', 'gsnRightString', 'gsnRightStringFontColor',
516
+ 'gsnRightStringFontHeightF', 'gsnRightStringFuncCode',
517
+ 'gsnRightStringOrthogonalPosF', 'gsnRightStringParallelPosF',
518
+ 'gsnScalarContour', 'gsnScale', 'gsnShape', 'gsnSpreadColorEnd',
519
+ 'gsnSpreadColorStart', 'gsnSpreadColors', 'gsnStringFont',
520
+ 'gsnStringFontColor', 'gsnStringFontHeightF', 'gsnStringFuncCode',
521
+ 'gsnTickMarksOn', 'gsnXAxisIrregular2Linear', 'gsnXAxisIrregular2Log',
522
+ 'gsnXRefLine', 'gsnXRefLineColor', 'gsnXRefLineDashPattern',
523
+ 'gsnXRefLineThicknessF', 'gsnXYAboveFillColors', 'gsnXYBarChart',
524
+ 'gsnXYBarChartBarWidth', 'gsnXYBarChartColors',
525
+ 'gsnXYBarChartColors2', 'gsnXYBarChartFillDotSizeF',
526
+ 'gsnXYBarChartFillLineThicknessF', 'gsnXYBarChartFillOpacityF',
527
+ 'gsnXYBarChartFillScaleF', 'gsnXYBarChartOutlineOnly',
528
+ 'gsnXYBarChartOutlineThicknessF', 'gsnXYBarChartPatterns',
529
+ 'gsnXYBarChartPatterns2', 'gsnXYBelowFillColors', 'gsnXYFillColors',
530
+ 'gsnXYFillOpacities', 'gsnXYLeftFillColors', 'gsnXYRightFillColors',
531
+ 'gsnYAxisIrregular2Linear', 'gsnYAxisIrregular2Log', 'gsnYRefLine',
532
+ 'gsnYRefLineColor', 'gsnYRefLineColors', 'gsnYRefLineDashPattern',
533
+ 'gsnYRefLineDashPatterns', 'gsnYRefLineThicknessF',
534
+ 'gsnYRefLineThicknesses', 'gsnZonalMean', 'gsnZonalMeanXMaxF',
535
+ 'gsnZonalMeanXMinF', 'gsnZonalMeanYRefLine', 'lbAutoManage',
536
+ 'lbBottomMarginF', 'lbBoxCount', 'lbBoxEndCapStyle', 'lbBoxFractions',
537
+ 'lbBoxLineColor', 'lbBoxLineDashPattern', 'lbBoxLineDashSegLenF',
538
+ 'lbBoxLineThicknessF', 'lbBoxLinesOn', 'lbBoxMajorExtentF',
539
+ 'lbBoxMinorExtentF', 'lbBoxSeparatorLinesOn', 'lbBoxSizing',
540
+ 'lbFillBackground', 'lbFillColor', 'lbFillColors', 'lbFillDotSizeF',
541
+ 'lbFillLineThicknessF', 'lbFillPattern', 'lbFillPatterns',
542
+ 'lbFillScaleF', 'lbFillScales', 'lbJustification', 'lbLabelAlignment',
543
+ 'lbLabelAngleF', 'lbLabelAutoStride', 'lbLabelBarOn',
544
+ 'lbLabelConstantSpacingF', 'lbLabelDirection', 'lbLabelFont',
545
+ 'lbLabelFontAspectF', 'lbLabelFontColor', 'lbLabelFontHeightF',
546
+ 'lbLabelFontQuality', 'lbLabelFontThicknessF', 'lbLabelFuncCode',
547
+ 'lbLabelJust', 'lbLabelOffsetF', 'lbLabelPosition', 'lbLabelStride',
548
+ 'lbLabelStrings', 'lbLabelsOn', 'lbLeftMarginF', 'lbMaxLabelLenF',
549
+ 'lbMinLabelSpacingF', 'lbMonoFillColor', 'lbMonoFillPattern',
550
+ 'lbMonoFillScale', 'lbOrientation', 'lbPerimColor',
551
+ 'lbPerimDashPattern', 'lbPerimDashSegLenF', 'lbPerimFill',
552
+ 'lbPerimFillColor', 'lbPerimOn', 'lbPerimThicknessF',
553
+ 'lbRasterFillOn', 'lbRightMarginF', 'lbTitleAngleF',
554
+ 'lbTitleConstantSpacingF', 'lbTitleDirection', 'lbTitleExtentF',
555
+ 'lbTitleFont', 'lbTitleFontAspectF', 'lbTitleFontColor',
556
+ 'lbTitleFontHeightF', 'lbTitleFontQuality', 'lbTitleFontThicknessF',
557
+ 'lbTitleFuncCode', 'lbTitleJust', 'lbTitleOffsetF', 'lbTitleOn',
558
+ 'lbTitlePosition', 'lbTitleString', 'lbTopMarginF', 'lgAutoManage',
559
+ 'lgBottomMarginF', 'lgBoxBackground', 'lgBoxLineColor',
560
+ 'lgBoxLineDashPattern', 'lgBoxLineDashSegLenF', 'lgBoxLineThicknessF',
561
+ 'lgBoxLinesOn', 'lgBoxMajorExtentF', 'lgBoxMinorExtentF',
562
+ 'lgDashIndex', 'lgDashIndexes', 'lgItemCount', 'lgItemOrder',
563
+ 'lgItemPlacement', 'lgItemPositions', 'lgItemType', 'lgItemTypes',
564
+ 'lgJustification', 'lgLabelAlignment', 'lgLabelAngleF',
565
+ 'lgLabelAutoStride', 'lgLabelConstantSpacingF', 'lgLabelDirection',
566
+ 'lgLabelFont', 'lgLabelFontAspectF', 'lgLabelFontColor',
567
+ 'lgLabelFontHeightF', 'lgLabelFontQuality', 'lgLabelFontThicknessF',
568
+ 'lgLabelFuncCode', 'lgLabelJust', 'lgLabelOffsetF', 'lgLabelPosition',
569
+ 'lgLabelStride', 'lgLabelStrings', 'lgLabelsOn', 'lgLeftMarginF',
570
+ 'lgLegendOn', 'lgLineColor', 'lgLineColors', 'lgLineDashSegLenF',
571
+ 'lgLineDashSegLens', 'lgLineLabelConstantSpacingF', 'lgLineLabelFont',
572
+ 'lgLineLabelFontAspectF', 'lgLineLabelFontColor',
573
+ 'lgLineLabelFontColors', 'lgLineLabelFontHeightF',
574
+ 'lgLineLabelFontHeights', 'lgLineLabelFontQuality',
575
+ 'lgLineLabelFontThicknessF', 'lgLineLabelFuncCode',
576
+ 'lgLineLabelStrings', 'lgLineLabelsOn', 'lgLineThicknessF',
577
+ 'lgLineThicknesses', 'lgMarkerColor', 'lgMarkerColors',
578
+ 'lgMarkerIndex', 'lgMarkerIndexes', 'lgMarkerSizeF', 'lgMarkerSizes',
579
+ 'lgMarkerThicknessF', 'lgMarkerThicknesses', 'lgMonoDashIndex',
580
+ 'lgMonoItemType', 'lgMonoLineColor', 'lgMonoLineDashSegLen',
581
+ 'lgMonoLineLabelFontColor', 'lgMonoLineLabelFontHeight',
582
+ 'lgMonoLineThickness', 'lgMonoMarkerColor', 'lgMonoMarkerIndex',
583
+ 'lgMonoMarkerSize', 'lgMonoMarkerThickness', 'lgOrientation',
584
+ 'lgPerimColor', 'lgPerimDashPattern', 'lgPerimDashSegLenF',
585
+ 'lgPerimFill', 'lgPerimFillColor', 'lgPerimOn', 'lgPerimThicknessF',
586
+ 'lgRightMarginF', 'lgTitleAngleF', 'lgTitleConstantSpacingF',
587
+ 'lgTitleDirection', 'lgTitleExtentF', 'lgTitleFont',
588
+ 'lgTitleFontAspectF', 'lgTitleFontColor', 'lgTitleFontHeightF',
589
+ 'lgTitleFontQuality', 'lgTitleFontThicknessF', 'lgTitleFuncCode',
590
+ 'lgTitleJust', 'lgTitleOffsetF', 'lgTitleOn', 'lgTitlePosition',
591
+ 'lgTitleString', 'lgTopMarginF', 'mpAreaGroupCount',
592
+ 'mpAreaMaskingOn', 'mpAreaNames', 'mpAreaTypes', 'mpBottomAngleF',
593
+ 'mpBottomMapPosF', 'mpBottomNDCF', 'mpBottomNPCF',
594
+ 'mpBottomPointLatF', 'mpBottomPointLonF', 'mpBottomWindowF',
595
+ 'mpCenterLatF', 'mpCenterLonF', 'mpCenterRotF', 'mpCountyLineColor',
596
+ 'mpCountyLineDashPattern', 'mpCountyLineDashSegLenF',
597
+ 'mpCountyLineThicknessF', 'mpDataBaseVersion', 'mpDataResolution',
598
+ 'mpDataSetName', 'mpDefaultFillColor', 'mpDefaultFillPattern',
599
+ 'mpDefaultFillScaleF', 'mpDynamicAreaGroups', 'mpEllipticalBoundary',
600
+ 'mpFillAreaSpecifiers', 'mpFillBoundarySets', 'mpFillColor',
601
+ 'mpFillColors', 'mpFillColors-default', 'mpFillDotSizeF',
602
+ 'mpFillDrawOrder', 'mpFillOn', 'mpFillPatternBackground',
603
+ 'mpFillPattern', 'mpFillPatterns', 'mpFillPatterns-default',
604
+ 'mpFillScaleF', 'mpFillScales', 'mpFillScales-default',
605
+ 'mpFixedAreaGroups', 'mpGeophysicalLineColor',
606
+ 'mpGeophysicalLineDashPattern', 'mpGeophysicalLineDashSegLenF',
607
+ 'mpGeophysicalLineThicknessF', 'mpGreatCircleLinesOn',
608
+ 'mpGridAndLimbDrawOrder', 'mpGridAndLimbOn', 'mpGridLatSpacingF',
609
+ 'mpGridLineColor', 'mpGridLineDashPattern', 'mpGridLineDashSegLenF',
610
+ 'mpGridLineThicknessF', 'mpGridLonSpacingF', 'mpGridMaskMode',
611
+ 'mpGridMaxLatF', 'mpGridPolarLonSpacingF', 'mpGridSpacingF',
612
+ 'mpInlandWaterFillColor', 'mpInlandWaterFillPattern',
613
+ 'mpInlandWaterFillScaleF', 'mpLabelDrawOrder', 'mpLabelFontColor',
614
+ 'mpLabelFontHeightF', 'mpLabelsOn', 'mpLambertMeridianF',
615
+ 'mpLambertParallel1F', 'mpLambertParallel2F', 'mpLandFillColor',
616
+ 'mpLandFillPattern', 'mpLandFillScaleF', 'mpLeftAngleF',
617
+ 'mpLeftCornerLatF', 'mpLeftCornerLonF', 'mpLeftMapPosF',
618
+ 'mpLeftNDCF', 'mpLeftNPCF', 'mpLeftPointLatF',
619
+ 'mpLeftPointLonF', 'mpLeftWindowF', 'mpLimbLineColor',
620
+ 'mpLimbLineDashPattern', 'mpLimbLineDashSegLenF',
621
+ 'mpLimbLineThicknessF', 'mpLimitMode', 'mpMaskAreaSpecifiers',
622
+ 'mpMaskOutlineSpecifiers', 'mpMaxLatF', 'mpMaxLonF',
623
+ 'mpMinLatF', 'mpMinLonF', 'mpMonoFillColor', 'mpMonoFillPattern',
624
+ 'mpMonoFillScale', 'mpNationalLineColor', 'mpNationalLineDashPattern',
625
+ 'mpNationalLineThicknessF', 'mpOceanFillColor', 'mpOceanFillPattern',
626
+ 'mpOceanFillScaleF', 'mpOutlineBoundarySets', 'mpOutlineDrawOrder',
627
+ 'mpOutlineMaskingOn', 'mpOutlineOn', 'mpOutlineSpecifiers',
628
+ 'mpPerimDrawOrder', 'mpPerimLineColor', 'mpPerimLineDashPattern',
629
+ 'mpPerimLineDashSegLenF', 'mpPerimLineThicknessF', 'mpPerimOn',
630
+ 'mpPolyMode', 'mpProjection', 'mpProvincialLineColor',
631
+ 'mpProvincialLineDashPattern', 'mpProvincialLineDashSegLenF',
632
+ 'mpProvincialLineThicknessF', 'mpRelativeCenterLat',
633
+ 'mpRelativeCenterLon', 'mpRightAngleF', 'mpRightCornerLatF',
634
+ 'mpRightCornerLonF', 'mpRightMapPosF', 'mpRightNDCF',
635
+ 'mpRightNPCF', 'mpRightPointLatF', 'mpRightPointLonF',
636
+ 'mpRightWindowF', 'mpSatelliteAngle1F', 'mpSatelliteAngle2F',
637
+ 'mpSatelliteDistF', 'mpShapeMode', 'mpSpecifiedFillColors',
638
+ 'mpSpecifiedFillDirectIndexing', 'mpSpecifiedFillPatterns',
639
+ 'mpSpecifiedFillPriority', 'mpSpecifiedFillScales',
640
+ 'mpTopAngleF', 'mpTopMapPosF', 'mpTopNDCF', 'mpTopNPCF',
641
+ 'mpTopPointLatF', 'mpTopPointLonF', 'mpTopWindowF',
642
+ 'mpUSStateLineColor', 'mpUSStateLineDashPattern',
643
+ 'mpUSStateLineDashSegLenF', 'mpUSStateLineThicknessF',
644
+ 'pmAnnoManagers', 'pmAnnoViews', 'pmLabelBarDisplayMode',
645
+ 'pmLabelBarHeightF', 'pmLabelBarKeepAspect', 'pmLabelBarOrthogonalPosF',
646
+ 'pmLabelBarParallelPosF', 'pmLabelBarSide', 'pmLabelBarWidthF',
647
+ 'pmLabelBarZone', 'pmLegendDisplayMode', 'pmLegendHeightF',
648
+ 'pmLegendKeepAspect', 'pmLegendOrthogonalPosF',
649
+ 'pmLegendParallelPosF', 'pmLegendSide', 'pmLegendWidthF',
650
+ 'pmLegendZone', 'pmOverlaySequenceIds', 'pmTickMarkDisplayMode',
651
+ 'pmTickMarkZone', 'pmTitleDisplayMode', 'pmTitleZone',
652
+ 'prGraphicStyle', 'prPolyType', 'prXArray', 'prYArray',
653
+ 'sfCopyData', 'sfDataArray', 'sfDataMaxV', 'sfDataMinV',
654
+ 'sfElementNodes', 'sfExchangeDimensions', 'sfFirstNodeIndex',
655
+ 'sfMissingValueV', 'sfXArray', 'sfXCActualEndF', 'sfXCActualStartF',
656
+ 'sfXCEndIndex', 'sfXCEndSubsetV', 'sfXCEndV', 'sfXCStartIndex',
657
+ 'sfXCStartSubsetV', 'sfXCStartV', 'sfXCStride', 'sfXCellBounds',
658
+ 'sfYArray', 'sfYCActualEndF', 'sfYCActualStartF', 'sfYCEndIndex',
659
+ 'sfYCEndSubsetV', 'sfYCEndV', 'sfYCStartIndex', 'sfYCStartSubsetV',
660
+ 'sfYCStartV', 'sfYCStride', 'sfYCellBounds', 'stArrowLengthF',
661
+ 'stArrowStride', 'stCrossoverCheckCount',
662
+ 'stExplicitLabelBarLabelsOn', 'stLabelBarEndLabelsOn',
663
+ 'stLabelFormat', 'stLengthCheckCount', 'stLevelColors',
664
+ 'stLevelCount', 'stLevelPalette', 'stLevelSelectionMode',
665
+ 'stLevelSpacingF', 'stLevels', 'stLineColor', 'stLineOpacityF',
666
+ 'stLineStartStride', 'stLineThicknessF', 'stMapDirection',
667
+ 'stMaxLevelCount', 'stMaxLevelValF', 'stMinArrowSpacingF',
668
+ 'stMinDistanceF', 'stMinLevelValF', 'stMinLineSpacingF',
669
+ 'stMinStepFactorF', 'stMonoLineColor', 'stNoDataLabelOn',
670
+ 'stNoDataLabelString', 'stScalarFieldData', 'stScalarMissingValColor',
671
+ 'stSpanLevelPalette', 'stStepSizeF', 'stStreamlineDrawOrder',
672
+ 'stUseScalarArray', 'stVectorFieldData', 'stZeroFLabelAngleF',
673
+ 'stZeroFLabelBackgroundColor', 'stZeroFLabelConstantSpacingF',
674
+ 'stZeroFLabelFont', 'stZeroFLabelFontAspectF',
675
+ 'stZeroFLabelFontColor', 'stZeroFLabelFontHeightF',
676
+ 'stZeroFLabelFontQuality', 'stZeroFLabelFontThicknessF',
677
+ 'stZeroFLabelFuncCode', 'stZeroFLabelJust', 'stZeroFLabelOn',
678
+ 'stZeroFLabelOrthogonalPosF', 'stZeroFLabelParallelPosF',
679
+ 'stZeroFLabelPerimColor', 'stZeroFLabelPerimOn',
680
+ 'stZeroFLabelPerimSpaceF', 'stZeroFLabelPerimThicknessF',
681
+ 'stZeroFLabelSide', 'stZeroFLabelString', 'stZeroFLabelTextDirection',
682
+ 'stZeroFLabelZone', 'tfDoNDCOverlay', 'tfPlotManagerOn',
683
+ 'tfPolyDrawList', 'tfPolyDrawOrder', 'tiDeltaF', 'tiMainAngleF',
684
+ 'tiMainConstantSpacingF', 'tiMainDirection', 'tiMainFont',
685
+ 'tiMainFontAspectF', 'tiMainFontColor', 'tiMainFontHeightF',
686
+ 'tiMainFontQuality', 'tiMainFontThicknessF', 'tiMainFuncCode',
687
+ 'tiMainJust', 'tiMainOffsetXF', 'tiMainOffsetYF', 'tiMainOn',
688
+ 'tiMainPosition', 'tiMainSide', 'tiMainString', 'tiUseMainAttributes',
689
+ 'tiXAxisAngleF', 'tiXAxisConstantSpacingF', 'tiXAxisDirection',
690
+ 'tiXAxisFont', 'tiXAxisFontAspectF', 'tiXAxisFontColor',
691
+ 'tiXAxisFontHeightF', 'tiXAxisFontQuality', 'tiXAxisFontThicknessF',
692
+ 'tiXAxisFuncCode', 'tiXAxisJust', 'tiXAxisOffsetXF',
693
+ 'tiXAxisOffsetYF', 'tiXAxisOn', 'tiXAxisPosition', 'tiXAxisSide',
694
+ 'tiXAxisString', 'tiYAxisAngleF', 'tiYAxisConstantSpacingF',
695
+ 'tiYAxisDirection', 'tiYAxisFont', 'tiYAxisFontAspectF',
696
+ 'tiYAxisFontColor', 'tiYAxisFontHeightF', 'tiYAxisFontQuality',
697
+ 'tiYAxisFontThicknessF', 'tiYAxisFuncCode', 'tiYAxisJust',
698
+ 'tiYAxisOffsetXF', 'tiYAxisOffsetYF', 'tiYAxisOn', 'tiYAxisPosition',
699
+ 'tiYAxisSide', 'tiYAxisString', 'tmBorderLineColor',
700
+ 'tmBorderThicknessF', 'tmEqualizeXYSizes', 'tmLabelAutoStride',
701
+ 'tmSciNoteCutoff', 'tmXBAutoPrecision', 'tmXBBorderOn',
702
+ 'tmXBDataLeftF', 'tmXBDataRightF', 'tmXBFormat', 'tmXBIrrTensionF',
703
+ 'tmXBIrregularPoints', 'tmXBLabelAngleF', 'tmXBLabelConstantSpacingF',
704
+ 'tmXBLabelDeltaF', 'tmXBLabelDirection', 'tmXBLabelFont',
705
+ 'tmXBLabelFontAspectF', 'tmXBLabelFontColor', 'tmXBLabelFontHeightF',
706
+ 'tmXBLabelFontQuality', 'tmXBLabelFontThicknessF',
707
+ 'tmXBLabelFuncCode', 'tmXBLabelJust', 'tmXBLabelStride', 'tmXBLabels',
708
+ 'tmXBLabelsOn', 'tmXBMajorLengthF', 'tmXBMajorLineColor',
709
+ 'tmXBMajorOutwardLengthF', 'tmXBMajorThicknessF', 'tmXBMaxLabelLenF',
710
+ 'tmXBMaxTicks', 'tmXBMinLabelSpacingF', 'tmXBMinorLengthF',
711
+ 'tmXBMinorLineColor', 'tmXBMinorOn', 'tmXBMinorOutwardLengthF',
712
+ 'tmXBMinorPerMajor', 'tmXBMinorThicknessF', 'tmXBMinorValues',
713
+ 'tmXBMode', 'tmXBOn', 'tmXBPrecision', 'tmXBStyle', 'tmXBTickEndF',
714
+ 'tmXBTickSpacingF', 'tmXBTickStartF', 'tmXBValues', 'tmXMajorGrid',
715
+ 'tmXMajorGridLineColor', 'tmXMajorGridLineDashPattern',
716
+ 'tmXMajorGridThicknessF', 'tmXMinorGrid', 'tmXMinorGridLineColor',
717
+ 'tmXMinorGridLineDashPattern', 'tmXMinorGridThicknessF',
718
+ 'tmXTAutoPrecision', 'tmXTBorderOn', 'tmXTDataLeftF',
719
+ 'tmXTDataRightF', 'tmXTFormat', 'tmXTIrrTensionF',
720
+ 'tmXTIrregularPoints', 'tmXTLabelAngleF', 'tmXTLabelConstantSpacingF',
721
+ 'tmXTLabelDeltaF', 'tmXTLabelDirection', 'tmXTLabelFont',
722
+ 'tmXTLabelFontAspectF', 'tmXTLabelFontColor', 'tmXTLabelFontHeightF',
723
+ 'tmXTLabelFontQuality', 'tmXTLabelFontThicknessF',
724
+ 'tmXTLabelFuncCode', 'tmXTLabelJust', 'tmXTLabelStride', 'tmXTLabels',
725
+ 'tmXTLabelsOn', 'tmXTMajorLengthF', 'tmXTMajorLineColor',
726
+ 'tmXTMajorOutwardLengthF', 'tmXTMajorThicknessF', 'tmXTMaxLabelLenF',
727
+ 'tmXTMaxTicks', 'tmXTMinLabelSpacingF', 'tmXTMinorLengthF',
728
+ 'tmXTMinorLineColor', 'tmXTMinorOn', 'tmXTMinorOutwardLengthF',
729
+ 'tmXTMinorPerMajor', 'tmXTMinorThicknessF', 'tmXTMinorValues',
730
+ 'tmXTMode', 'tmXTOn', 'tmXTPrecision', 'tmXTStyle', 'tmXTTickEndF',
731
+ 'tmXTTickSpacingF', 'tmXTTickStartF', 'tmXTValues', 'tmXUseBottom',
732
+ 'tmYLAutoPrecision', 'tmYLBorderOn', 'tmYLDataBottomF',
733
+ 'tmYLDataTopF', 'tmYLFormat', 'tmYLIrrTensionF',
734
+ 'tmYLIrregularPoints', 'tmYLLabelAngleF', 'tmYLLabelConstantSpacingF',
735
+ 'tmYLLabelDeltaF', 'tmYLLabelDirection', 'tmYLLabelFont',
736
+ 'tmYLLabelFontAspectF', 'tmYLLabelFontColor', 'tmYLLabelFontHeightF',
737
+ 'tmYLLabelFontQuality', 'tmYLLabelFontThicknessF',
738
+ 'tmYLLabelFuncCode', 'tmYLLabelJust', 'tmYLLabelStride', 'tmYLLabels',
739
+ 'tmYLLabelsOn', 'tmYLMajorLengthF', 'tmYLMajorLineColor',
740
+ 'tmYLMajorOutwardLengthF', 'tmYLMajorThicknessF', 'tmYLMaxLabelLenF',
741
+ 'tmYLMaxTicks', 'tmYLMinLabelSpacingF', 'tmYLMinorLengthF',
742
+ 'tmYLMinorLineColor', 'tmYLMinorOn', 'tmYLMinorOutwardLengthF',
743
+ 'tmYLMinorPerMajor', 'tmYLMinorThicknessF', 'tmYLMinorValues',
744
+ 'tmYLMode', 'tmYLOn', 'tmYLPrecision', 'tmYLStyle', 'tmYLTickEndF',
745
+ 'tmYLTickSpacingF', 'tmYLTickStartF', 'tmYLValues', 'tmYMajorGrid',
746
+ 'tmYMajorGridLineColor', 'tmYMajorGridLineDashPattern',
747
+ 'tmYMajorGridThicknessF', 'tmYMinorGrid', 'tmYMinorGridLineColor',
748
+ 'tmYMinorGridLineDashPattern', 'tmYMinorGridThicknessF',
749
+ 'tmYRAutoPrecision', 'tmYRBorderOn', 'tmYRDataBottomF',
750
+ 'tmYRDataTopF', 'tmYRFormat', 'tmYRIrrTensionF',
751
+ 'tmYRIrregularPoints', 'tmYRLabelAngleF', 'tmYRLabelConstantSpacingF',
752
+ 'tmYRLabelDeltaF', 'tmYRLabelDirection', 'tmYRLabelFont',
753
+ 'tmYRLabelFontAspectF', 'tmYRLabelFontColor', 'tmYRLabelFontHeightF',
754
+ 'tmYRLabelFontQuality', 'tmYRLabelFontThicknessF',
755
+ 'tmYRLabelFuncCode', 'tmYRLabelJust', 'tmYRLabelStride', 'tmYRLabels',
756
+ 'tmYRLabelsOn', 'tmYRMajorLengthF', 'tmYRMajorLineColor',
757
+ 'tmYRMajorOutwardLengthF', 'tmYRMajorThicknessF', 'tmYRMaxLabelLenF',
758
+ 'tmYRMaxTicks', 'tmYRMinLabelSpacingF', 'tmYRMinorLengthF',
759
+ 'tmYRMinorLineColor', 'tmYRMinorOn', 'tmYRMinorOutwardLengthF',
760
+ 'tmYRMinorPerMajor', 'tmYRMinorThicknessF', 'tmYRMinorValues',
761
+ 'tmYRMode', 'tmYROn', 'tmYRPrecision', 'tmYRStyle', 'tmYRTickEndF',
762
+ 'tmYRTickSpacingF', 'tmYRTickStartF', 'tmYRValues', 'tmYUseLeft',
763
+ 'trGridType', 'trLineInterpolationOn',
764
+ 'trXAxisType', 'trXCoordPoints', 'trXInterPoints', 'trXLog',
765
+ 'trXMaxF', 'trXMinF', 'trXReverse', 'trXSamples', 'trXTensionF',
766
+ 'trYAxisType', 'trYCoordPoints', 'trYInterPoints', 'trYLog',
767
+ 'trYMaxF', 'trYMinF', 'trYReverse', 'trYSamples', 'trYTensionF',
768
+ 'txAngleF', 'txBackgroundFillColor', 'txConstantSpacingF', 'txDirection',
769
+ 'txFont', 'HLU-Fonts', 'txFontAspectF', 'txFontColor',
770
+ 'txFontHeightF', 'txFontOpacityF', 'txFontQuality',
771
+ 'txFontThicknessF', 'txFuncCode', 'txJust', 'txPerimColor',
772
+ 'txPerimDashLengthF', 'txPerimDashPattern', 'txPerimOn',
773
+ 'txPerimSpaceF', 'txPerimThicknessF', 'txPosXF', 'txPosYF',
774
+ 'txString', 'vcExplicitLabelBarLabelsOn', 'vcFillArrowEdgeColor',
775
+ 'vcFillArrowEdgeThicknessF', 'vcFillArrowFillColor',
776
+ 'vcFillArrowHeadInteriorXF', 'vcFillArrowHeadMinFracXF',
777
+ 'vcFillArrowHeadMinFracYF', 'vcFillArrowHeadXF', 'vcFillArrowHeadYF',
778
+ 'vcFillArrowMinFracWidthF', 'vcFillArrowWidthF', 'vcFillArrowsOn',
779
+ 'vcFillOverEdge', 'vcGlyphOpacityF', 'vcGlyphStyle',
780
+ 'vcLabelBarEndLabelsOn', 'vcLabelFontColor', 'vcLabelFontHeightF',
781
+ 'vcLabelsOn', 'vcLabelsUseVectorColor', 'vcLevelColors',
782
+ 'vcLevelCount', 'vcLevelPalette', 'vcLevelSelectionMode',
783
+ 'vcLevelSpacingF', 'vcLevels', 'vcLineArrowColor',
784
+ 'vcLineArrowHeadMaxSizeF', 'vcLineArrowHeadMinSizeF',
785
+ 'vcLineArrowThicknessF', 'vcMagnitudeFormat',
786
+ 'vcMagnitudeScaleFactorF', 'vcMagnitudeScaleValueF',
787
+ 'vcMagnitudeScalingMode', 'vcMapDirection', 'vcMaxLevelCount',
788
+ 'vcMaxLevelValF', 'vcMaxMagnitudeF', 'vcMinAnnoAngleF',
789
+ 'vcMinAnnoArrowAngleF', 'vcMinAnnoArrowEdgeColor',
790
+ 'vcMinAnnoArrowFillColor', 'vcMinAnnoArrowLineColor',
791
+ 'vcMinAnnoArrowMinOffsetF', 'vcMinAnnoArrowSpaceF',
792
+ 'vcMinAnnoArrowUseVecColor', 'vcMinAnnoBackgroundColor',
793
+ 'vcMinAnnoConstantSpacingF', 'vcMinAnnoExplicitMagnitudeF',
794
+ 'vcMinAnnoFont', 'vcMinAnnoFontAspectF', 'vcMinAnnoFontColor',
795
+ 'vcMinAnnoFontHeightF', 'vcMinAnnoFontQuality',
796
+ 'vcMinAnnoFontThicknessF', 'vcMinAnnoFuncCode', 'vcMinAnnoJust',
797
+ 'vcMinAnnoOn', 'vcMinAnnoOrientation', 'vcMinAnnoOrthogonalPosF',
798
+ 'vcMinAnnoParallelPosF', 'vcMinAnnoPerimColor', 'vcMinAnnoPerimOn',
799
+ 'vcMinAnnoPerimSpaceF', 'vcMinAnnoPerimThicknessF', 'vcMinAnnoSide',
800
+ 'vcMinAnnoString1', 'vcMinAnnoString1On', 'vcMinAnnoString2',
801
+ 'vcMinAnnoString2On', 'vcMinAnnoTextDirection', 'vcMinAnnoZone',
802
+ 'vcMinDistanceF', 'vcMinFracLengthF', 'vcMinLevelValF',
803
+ 'vcMinMagnitudeF', 'vcMonoFillArrowEdgeColor',
804
+ 'vcMonoFillArrowFillColor', 'vcMonoLineArrowColor',
805
+ 'vcMonoWindBarbColor', 'vcNoDataLabelOn', 'vcNoDataLabelString',
806
+ 'vcPositionMode', 'vcRefAnnoAngleF', 'vcRefAnnoArrowAngleF',
807
+ 'vcRefAnnoArrowEdgeColor', 'vcRefAnnoArrowFillColor',
808
+ 'vcRefAnnoArrowLineColor', 'vcRefAnnoArrowMinOffsetF',
809
+ 'vcRefAnnoArrowSpaceF', 'vcRefAnnoArrowUseVecColor',
810
+ 'vcRefAnnoBackgroundColor', 'vcRefAnnoConstantSpacingF',
811
+ 'vcRefAnnoExplicitMagnitudeF', 'vcRefAnnoFont',
812
+ 'vcRefAnnoFontAspectF', 'vcRefAnnoFontColor', 'vcRefAnnoFontHeightF',
813
+ 'vcRefAnnoFontQuality', 'vcRefAnnoFontThicknessF',
814
+ 'vcRefAnnoFuncCode', 'vcRefAnnoJust', 'vcRefAnnoOn',
815
+ 'vcRefAnnoOrientation', 'vcRefAnnoOrthogonalPosF',
816
+ 'vcRefAnnoParallelPosF', 'vcRefAnnoPerimColor', 'vcRefAnnoPerimOn',
817
+ 'vcRefAnnoPerimSpaceF', 'vcRefAnnoPerimThicknessF', 'vcRefAnnoSide',
818
+ 'vcRefAnnoString1', 'vcRefAnnoString1On', 'vcRefAnnoString2',
819
+ 'vcRefAnnoString2On', 'vcRefAnnoTextDirection', 'vcRefAnnoZone',
820
+ 'vcRefLengthF', 'vcRefMagnitudeF', 'vcScalarFieldData',
821
+ 'vcScalarMissingValColor', 'vcScalarValueFormat',
822
+ 'vcScalarValueScaleFactorF', 'vcScalarValueScaleValueF',
823
+ 'vcScalarValueScalingMode', 'vcSpanLevelPalette', 'vcUseRefAnnoRes',
824
+ 'vcUseScalarArray', 'vcVectorDrawOrder', 'vcVectorFieldData',
825
+ 'vcWindBarbCalmCircleSizeF', 'vcWindBarbColor',
826
+ 'vcWindBarbLineThicknessF', 'vcWindBarbScaleFactorF',
827
+ 'vcWindBarbTickAngleF', 'vcWindBarbTickLengthF',
828
+ 'vcWindBarbTickSpacingF', 'vcZeroFLabelAngleF',
829
+ 'vcZeroFLabelBackgroundColor', 'vcZeroFLabelConstantSpacingF',
830
+ 'vcZeroFLabelFont', 'vcZeroFLabelFontAspectF',
831
+ 'vcZeroFLabelFontColor', 'vcZeroFLabelFontHeightF',
832
+ 'vcZeroFLabelFontQuality', 'vcZeroFLabelFontThicknessF',
833
+ 'vcZeroFLabelFuncCode', 'vcZeroFLabelJust', 'vcZeroFLabelOn',
834
+ 'vcZeroFLabelOrthogonalPosF', 'vcZeroFLabelParallelPosF',
835
+ 'vcZeroFLabelPerimColor', 'vcZeroFLabelPerimOn',
836
+ 'vcZeroFLabelPerimSpaceF', 'vcZeroFLabelPerimThicknessF',
837
+ 'vcZeroFLabelSide', 'vcZeroFLabelString', 'vcZeroFLabelTextDirection',
838
+ 'vcZeroFLabelZone', 'vfCopyData', 'vfDataArray',
839
+ 'vfExchangeDimensions', 'vfExchangeUVData', 'vfMagMaxV', 'vfMagMinV',
840
+ 'vfMissingUValueV', 'vfMissingVValueV', 'vfPolarData',
841
+ 'vfSingleMissingValue', 'vfUDataArray', 'vfUMaxV', 'vfUMinV',
842
+ 'vfVDataArray', 'vfVMaxV', 'vfVMinV', 'vfXArray', 'vfXCActualEndF',
843
+ 'vfXCActualStartF', 'vfXCEndIndex', 'vfXCEndSubsetV', 'vfXCEndV',
844
+ 'vfXCStartIndex', 'vfXCStartSubsetV', 'vfXCStartV', 'vfXCStride',
845
+ 'vfYArray', 'vfYCActualEndF', 'vfYCActualStartF', 'vfYCEndIndex',
846
+ 'vfYCEndSubsetV', 'vfYCEndV', 'vfYCStartIndex', 'vfYCStartSubsetV',
847
+ 'vfYCStartV', 'vfYCStride', 'vpAnnoManagerId', 'vpClipOn',
848
+ 'vpHeightF', 'vpKeepAspect', 'vpOn', 'vpUseSegments', 'vpWidthF',
849
+ 'vpXF', 'vpYF', 'wkAntiAlias', 'wkBackgroundColor', 'wkBackgroundOpacityF',
850
+ 'wkColorMapLen', 'wkColorMap', 'wkColorModel', 'wkDashTableLength',
851
+ 'wkDefGraphicStyleId', 'wkDeviceLowerX', 'wkDeviceLowerY',
852
+ 'wkDeviceUpperX', 'wkDeviceUpperY', 'wkFileName', 'wkFillTableLength',
853
+ 'wkForegroundColor', 'wkFormat', 'wkFullBackground', 'wkGksWorkId',
854
+ 'wkHeight', 'wkMarkerTableLength', 'wkMetaName', 'wkOrientation',
855
+ 'wkPDFFileName', 'wkPDFFormat', 'wkPDFResolution', 'wkPSFileName',
856
+ 'wkPSFormat', 'wkPSResolution', 'wkPaperHeightF', 'wkPaperSize',
857
+ 'wkPaperWidthF', 'wkPause', 'wkTopLevelViews', 'wkViews',
858
+ 'wkVisualType', 'wkWidth', 'wkWindowId', 'wkXColorMode', 'wsCurrentSize',
859
+ 'wsMaximumSize', 'wsThresholdSize', 'xyComputeXMax',
860
+ 'xyComputeXMin', 'xyComputeYMax', 'xyComputeYMin', 'xyCoordData',
861
+ 'xyCoordDataSpec', 'xyCurveDrawOrder', 'xyDashPattern',
862
+ 'xyDashPatterns', 'xyExplicitLabels', 'xyExplicitLegendLabels',
863
+ 'xyLabelMode', 'xyLineColor', 'xyLineColors', 'xyLineDashSegLenF',
864
+ 'xyLineLabelConstantSpacingF', 'xyLineLabelFont',
865
+ 'xyLineLabelFontAspectF', 'xyLineLabelFontColor',
866
+ 'xyLineLabelFontColors', 'xyLineLabelFontHeightF',
867
+ 'xyLineLabelFontQuality', 'xyLineLabelFontThicknessF',
868
+ 'xyLineLabelFuncCode', 'xyLineThicknessF', 'xyLineThicknesses',
869
+ 'xyMarkLineMode', 'xyMarkLineModes', 'xyMarker', 'xyMarkerColor',
870
+ 'xyMarkerColors', 'xyMarkerSizeF', 'xyMarkerSizes',
871
+ 'xyMarkerThicknessF', 'xyMarkerThicknesses', 'xyMarkers',
872
+ 'xyMonoDashPattern', 'xyMonoLineColor', 'xyMonoLineLabelFontColor',
873
+ 'xyMonoLineThickness', 'xyMonoMarkLineMode', 'xyMonoMarker',
874
+ 'xyMonoMarkerColor', 'xyMonoMarkerSize', 'xyMonoMarkerThickness',
875
+ 'xyXIrrTensionF', 'xyXIrregularPoints', 'xyXStyle', 'xyYIrrTensionF',
876
+ 'xyYIrregularPoints', 'xyYStyle'), prefix=r'\b'),
877
+ Name.Builtin),
878
+
879
+ # Booleans
880
+ (r'\.(True|False)\.', Name.Builtin),
881
+ # Comparing Operators
882
+ (r'\.(eq|ne|lt|le|gt|ge|not|and|or|xor)\.', Operator.Word),
883
+ ],
884
+
885
+ 'strings': [
886
+ (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
887
+ ],
888
+
889
+ 'nums': [
890
+ (r'\d+(?![.e])(_[a-z]\w+)?', Number.Integer),
891
+ (r'[+-]?\d*\.\d+(e[-+]?\d+)?(_[a-z]\w+)?', Number.Float),
892
+ (r'[+-]?\d+\.\d*(e[-+]?\d+)?(_[a-z]\w+)?', Number.Float),
893
+ ],
894
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/nimrod.py ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.nimrod
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Nim language (formerly known as Nimrod).
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, default, bygroups
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Error
16
+
17
+ __all__ = ['NimrodLexer']
18
+
19
+
20
+ class NimrodLexer(RegexLexer):
21
+ """
22
+ For Nim source code.
23
+ """
24
+
25
+ name = 'Nimrod'
26
+ url = 'http://nim-lang.org/'
27
+ aliases = ['nimrod', 'nim']
28
+ filenames = ['*.nim', '*.nimrod']
29
+ mimetypes = ['text/x-nim']
30
+ version_added = '1.5'
31
+
32
+ flags = re.MULTILINE | re.IGNORECASE
33
+
34
+ def underscorize(words):
35
+ newWords = []
36
+ new = []
37
+ for word in words:
38
+ for ch in word:
39
+ new.append(ch)
40
+ new.append("_?")
41
+ newWords.append(''.join(new))
42
+ new = []
43
+ return "|".join(newWords)
44
+
45
+ keywords = [
46
+ 'addr', 'and', 'as', 'asm', 'bind', 'block', 'break', 'case',
47
+ 'cast', 'concept', 'const', 'continue', 'converter', 'defer', 'discard',
48
+ 'distinct', 'div', 'do', 'elif', 'else', 'end', 'enum', 'except',
49
+ 'export', 'finally', 'for', 'if', 'in', 'yield', 'interface',
50
+ 'is', 'isnot', 'iterator', 'let', 'mixin', 'mod',
51
+ 'not', 'notin', 'object', 'of', 'or', 'out', 'ptr', 'raise',
52
+ 'ref', 'return', 'shl', 'shr', 'static', 'try',
53
+ 'tuple', 'type', 'using', 'when', 'while', 'xor'
54
+ ]
55
+
56
+ keywordsPseudo = [
57
+ 'nil', 'true', 'false'
58
+ ]
59
+
60
+ opWords = [
61
+ 'and', 'or', 'not', 'xor', 'shl', 'shr', 'div', 'mod', 'in',
62
+ 'notin', 'is', 'isnot'
63
+ ]
64
+
65
+ types = [
66
+ 'int', 'int8', 'int16', 'int32', 'int64', 'float', 'float32', 'float64',
67
+ 'bool', 'char', 'range', 'array', 'seq', 'set', 'string'
68
+ ]
69
+
70
+ tokens = {
71
+ 'root': [
72
+ # Comments
73
+ (r'##\[', String.Doc, 'doccomment'),
74
+ (r'##.*$', String.Doc),
75
+ (r'#\[', Comment.Multiline, 'comment'),
76
+ (r'#.*$', Comment),
77
+
78
+ # Pragmas
79
+ (r'\{\.', String.Other, 'pragma'),
80
+
81
+ # Operators
82
+ (r'[*=><+\-/@$~&%!?|\\\[\]]', Operator),
83
+ (r'\.\.|\.|,|\[\.|\.\]|\{\.|\.\}|\(\.|\.\)|\{|\}|\(|\)|:|\^|`|;',
84
+ Punctuation),
85
+
86
+ # Case statement branch
87
+ (r'(\n\s*)(of)(\s)', bygroups(Text.Whitespace, Keyword,
88
+ Text.Whitespace), 'casebranch'),
89
+
90
+ # Strings
91
+ (r'(?:[\w]+)"', String, 'rdqs'),
92
+ (r'"""', String.Double, 'tdqs'),
93
+ ('"', String, 'dqs'),
94
+
95
+ # Char
96
+ ("'", String.Char, 'chars'),
97
+
98
+ # Keywords
99
+ (rf'({underscorize(opWords)})\b', Operator.Word),
100
+ (r'(proc|func|method|macro|template)(\s)(?![(\[\]])',
101
+ bygroups(Keyword, Text.Whitespace), 'funcname'),
102
+ (rf'({underscorize(keywords)})\b', Keyword),
103
+ (r'({})\b'.format(underscorize(['from', 'import', 'include', 'export'])),
104
+ Keyword.Namespace),
105
+ (r'(v_?a_?r)\b', Keyword.Declaration),
106
+ (rf'({underscorize(types)})\b', Name.Builtin),
107
+ (rf'({underscorize(keywordsPseudo)})\b', Keyword.Pseudo),
108
+
109
+ # Identifiers
110
+ (r'\b((?![_\d])\w)(((?!_)\w)|(_(?!_)\w))*', Name),
111
+
112
+ # Numbers
113
+ (r'[0-9][0-9_]*(?=([e.]|\'f(32|64)))',
114
+ Number.Float, ('float-suffix', 'float-number')),
115
+ (r'0x[a-f0-9][a-f0-9_]*', Number.Hex, 'int-suffix'),
116
+ (r'0b[01][01_]*', Number.Bin, 'int-suffix'),
117
+ (r'0o[0-7][0-7_]*', Number.Oct, 'int-suffix'),
118
+ (r'[0-9][0-9_]*', Number.Integer, 'int-suffix'),
119
+
120
+ # Whitespace
121
+ (r'\s+', Text.Whitespace),
122
+ (r'.+$', Error),
123
+ ],
124
+ 'chars': [
125
+ (r'\\([\\abcefnrtvl"\']|x[a-f0-9]{2}|[0-9]{1,3})', String.Escape),
126
+ (r"'", String.Char, '#pop'),
127
+ (r".", String.Char)
128
+ ],
129
+ 'strings': [
130
+ (r'(?<!\$)\$(\d+|#|\w+)+', String.Interpol),
131
+ (r'[^\\\'"$\n]+', String),
132
+ # quotes, dollars and backslashes must be parsed one at a time
133
+ (r'[\'"\\]', String),
134
+ # unhandled string formatting sign
135
+ (r'\$', String)
136
+ # newlines are an error (use "nl" state)
137
+ ],
138
+ 'doccomment': [
139
+ (r'[^\]#]+', String.Doc),
140
+ (r'##\[', String.Doc, '#push'),
141
+ (r'\]##', String.Doc, '#pop'),
142
+ (r'[\]#]', String.Doc),
143
+ ],
144
+ 'comment': [
145
+ (r'[^\]#]+', Comment.Multiline),
146
+ (r'#\[', Comment.Multiline, '#push'),
147
+ (r'\]#', Comment.Multiline, '#pop'),
148
+ (r'[\]#]', Comment.Multiline),
149
+ ],
150
+ 'dqs': [
151
+ (r'\\([\\abcefnrtvl"\']|\n|x[a-f0-9]{2}|[0-9]{1,3})',
152
+ String.Escape),
153
+ (r'"', String, '#pop'),
154
+ include('strings')
155
+ ],
156
+ 'rdqs': [
157
+ (r'"(?!")', String, '#pop'),
158
+ (r'""', String.Escape),
159
+ include('strings')
160
+ ],
161
+ 'tdqs': [
162
+ (r'"""', String.Double, '#pop'),
163
+ include('strings'),
164
+ (r'\n', String.Double)
165
+ ],
166
+ 'funcname': [
167
+ (r'((?![\d_])\w)(((?!_)\w)|(_(?!_)\w))*', Name.Function, '#pop'),
168
+ (r'`.+`', Name.Function, '#pop')
169
+ ],
170
+ 'nl': [
171
+ (r'\n', String)
172
+ ],
173
+ 'float-number': [
174
+ (r'\.(?!\.)[0-9_]*[f]*', Number.Float),
175
+ (r'e[+-]?[0-9][0-9_]*', Number.Float),
176
+ default('#pop')
177
+ ],
178
+ 'float-suffix': [
179
+ (r'\'f(32|64)', Number.Float),
180
+ default('#pop')
181
+ ],
182
+ 'int-suffix': [
183
+ (r'\'i(32|64)', Number.Integer.Long),
184
+ (r'\'i(8|16)', Number.Integer),
185
+ default('#pop')
186
+ ],
187
+ 'casebranch': [
188
+ (r',', Punctuation),
189
+ (r'[\n ]+', Text.Whitespace),
190
+ (r':', Operator, '#pop'),
191
+ (r'\w+|[^:]', Name.Label),
192
+ ],
193
+ 'pragma': [
194
+ (r'[:,]', Text),
195
+ (r'[\n ]+', Text.Whitespace),
196
+ (r'\.\}', String.Other, '#pop'),
197
+ (r'\w+|\W+|[^.}]', String.Other),
198
+ ],
199
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/nit.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.nit
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Nit language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation
14
+
15
+ __all__ = ['NitLexer']
16
+
17
+
18
+ class NitLexer(RegexLexer):
19
+ """
20
+ For nit source.
21
+ """
22
+
23
+ name = 'Nit'
24
+ url = 'http://nitlanguage.org'
25
+ aliases = ['nit']
26
+ filenames = ['*.nit']
27
+ version_added = '2.0'
28
+ tokens = {
29
+ 'root': [
30
+ (r'#.*?$', Comment.Single),
31
+ (words((
32
+ 'package', 'module', 'import', 'class', 'abstract', 'interface',
33
+ 'universal', 'enum', 'end', 'fun', 'type', 'init', 'redef',
34
+ 'isa', 'do', 'readable', 'writable', 'var', 'intern', 'extern',
35
+ 'public', 'protected', 'private', 'intrude', 'if', 'then',
36
+ 'else', 'while', 'loop', 'for', 'in', 'and', 'or', 'not',
37
+ 'implies', 'return', 'continue', 'break', 'abort', 'assert',
38
+ 'new', 'is', 'once', 'super', 'self', 'true', 'false', 'nullable',
39
+ 'null', 'as', 'isset', 'label', '__debug__'), suffix=r'(?=[\r\n\t( ])'),
40
+ Keyword),
41
+ (r'[A-Z]\w*', Name.Class),
42
+ (r'"""(([^\'\\]|\\.)|\\r|\\n)*((\{\{?)?(""?\{\{?)*""""*)', String), # Simple long string
43
+ (r'\'\'\'(((\\.|[^\'\\])|\\r|\\n)|\'((\\.|[^\'\\])|\\r|\\n)|'
44
+ r'\'\'((\\.|[^\'\\])|\\r|\\n))*\'\'\'', String), # Simple long string alt
45
+ (r'"""(([^\'\\]|\\.)|\\r|\\n)*((""?)?(\{\{?""?)*\{\{\{\{*)', String), # Start long string
46
+ (r'\}\}\}(((\\.|[^\'\\])|\\r|\\n))*(""?)?(\{\{?""?)*\{\{\{\{*', String), # Mid long string
47
+ (r'\}\}\}(((\\.|[^\'\\])|\\r|\\n))*(\{\{?)?(""?\{\{?)*""""*', String), # End long string
48
+ (r'"(\\.|([^"}{\\]))*"', String), # Simple String
49
+ (r'"(\\.|([^"}{\\]))*\{', String), # Start string
50
+ (r'\}(\\.|([^"}{\\]))*\{', String), # Mid String
51
+ (r'\}(\\.|([^"}{\\]))*"', String), # End String
52
+ (r'(\'[^\'\\]\')|(\'\\.\')', String.Char),
53
+ (r'[0-9]+', Number.Integer),
54
+ (r'[0-9]*.[0-9]+', Number.Float),
55
+ (r'0(x|X)[0-9A-Fa-f]+', Number.Hex),
56
+ (r'[a-z]\w*', Name),
57
+ (r'_\w+', Name.Variable.Instance),
58
+ (r'==|!=|<==>|>=|>>|>|<=|<<|<|\+|-|=|/|\*|%|\+=|-=|!|@', Operator),
59
+ (r'\(|\)|\[|\]|,|\.\.\.|\.\.|\.|::|:', Punctuation),
60
+ (r'`\{[^`]*`\}', Text), # Extern blocks won't be Lexed by Nit
61
+ (r'[\r\n\t ]+', Text),
62
+ ],
63
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/nix.py ADDED
@@ -0,0 +1,144 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.nix
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the NixOS Nix language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Literal
16
+
17
+ __all__ = ['NixLexer']
18
+
19
+
20
+ class NixLexer(RegexLexer):
21
+ """
22
+ For the Nix language.
23
+ """
24
+
25
+ name = 'Nix'
26
+ url = 'http://nixos.org/nix/'
27
+ aliases = ['nixos', 'nix']
28
+ filenames = ['*.nix']
29
+ mimetypes = ['text/x-nix']
30
+ version_added = '2.0'
31
+
32
+ keywords = ['rec', 'with', 'let', 'in', 'inherit', 'assert', 'if',
33
+ 'else', 'then', '...']
34
+ builtins = ['import', 'abort', 'baseNameOf', 'dirOf', 'isNull', 'builtins',
35
+ 'map', 'removeAttrs', 'throw', 'toString', 'derivation']
36
+ operators = ['++', '+', '?', '.', '!', '//', '==', '/',
37
+ '!=', '&&', '||', '->', '=', '<', '>', '*', '-']
38
+
39
+ punctuations = ["(", ")", "[", "]", ";", "{", "}", ":", ",", "@"]
40
+
41
+ tokens = {
42
+ 'root': [
43
+ # comments starting with #
44
+ (r'#.*$', Comment.Single),
45
+
46
+ # multiline comments
47
+ (r'/\*', Comment.Multiline, 'comment'),
48
+
49
+ # whitespace
50
+ (r'\s+', Text),
51
+
52
+ # keywords
53
+ ('({})'.format('|'.join(re.escape(entry) + '\\b' for entry in keywords)), Keyword),
54
+
55
+ # highlight the builtins
56
+ ('({})'.format('|'.join(re.escape(entry) + '\\b' for entry in builtins)),
57
+ Name.Builtin),
58
+
59
+ (r'\b(true|false|null)\b', Name.Constant),
60
+
61
+ # floats
62
+ (r'-?(\d+\.\d*|\.\d+)([eE][-+]?\d+)?', Number.Float),
63
+
64
+ # integers
65
+ (r'-?[0-9]+', Number.Integer),
66
+
67
+ # paths
68
+ (r'[\w.+-]*(\/[\w.+-]+)+', Literal),
69
+ (r'~(\/[\w.+-]+)+', Literal),
70
+ (r'\<[\w.+-]+(\/[\w.+-]+)*\>', Literal),
71
+
72
+ # operators
73
+ ('({})'.format('|'.join(re.escape(entry) for entry in operators)),
74
+ Operator),
75
+
76
+ # word operators
77
+ (r'\b(or|and)\b', Operator.Word),
78
+
79
+ (r'\{', Punctuation, 'block'),
80
+
81
+ # punctuations
82
+ ('({})'.format('|'.join(re.escape(entry) for entry in punctuations)), Punctuation),
83
+
84
+ # strings
85
+ (r'"', String.Double, 'doublequote'),
86
+ (r"''", String.Multiline, 'multiline'),
87
+
88
+ # urls
89
+ (r'[a-zA-Z][a-zA-Z0-9\+\-\.]*\:[\w%/?:@&=+$,\\.!~*\'-]+', Literal),
90
+
91
+ # names of variables
92
+ (r'[\w-]+(?=\s*=)', String.Symbol),
93
+ (r'[a-zA-Z_][\w\'-]*', Text),
94
+
95
+ (r"\$\{", String.Interpol, 'antiquote'),
96
+ ],
97
+ 'comment': [
98
+ (r'[^/*]+', Comment.Multiline),
99
+ (r'/\*', Comment.Multiline, '#push'),
100
+ (r'\*/', Comment.Multiline, '#pop'),
101
+ (r'[*/]', Comment.Multiline),
102
+ ],
103
+ 'multiline': [
104
+ (r"''(\$|'|\\n|\\r|\\t|\\)", String.Escape),
105
+ (r"''", String.Multiline, '#pop'),
106
+ (r'\$\{', String.Interpol, 'antiquote'),
107
+ (r"[^'\$]+", String.Multiline),
108
+ (r"\$[^\{']", String.Multiline),
109
+ (r"'[^']", String.Multiline),
110
+ (r"\$(?=')", String.Multiline),
111
+ ],
112
+ 'doublequote': [
113
+ (r'\\(\\|"|\$|n)', String.Escape),
114
+ (r'"', String.Double, '#pop'),
115
+ (r'\$\{', String.Interpol, 'antiquote'),
116
+ (r'[^"\\\$]+', String.Double),
117
+ (r'\$[^\{"]', String.Double),
118
+ (r'\$(?=")', String.Double),
119
+ (r'\\', String.Double),
120
+ ],
121
+ 'antiquote': [
122
+ (r"\}", String.Interpol, '#pop'),
123
+ # TODO: we should probably escape also here ''${ \${
124
+ (r"\$\{", String.Interpol, '#push'),
125
+ include('root'),
126
+ ],
127
+ 'block': [
128
+ (r"\}", Punctuation, '#pop'),
129
+ include('root'),
130
+ ],
131
+ }
132
+
133
+ def analyse_text(text):
134
+ rv = 0.0
135
+ # TODO: let/in
136
+ if re.search(r'import.+?<[^>]+>', text):
137
+ rv += 0.4
138
+ if re.search(r'mkDerivation\s+(\(|\{|rec)', text):
139
+ rv += 0.4
140
+ if re.search(r'=\s+mkIf\s+', text):
141
+ rv += 0.4
142
+ if re.search(r'\{[a-zA-Z,\s]+\}:', text):
143
+ rv += 0.1
144
+ return rv
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/numbair.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.numbair
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for other Numba Intermediate Representation.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, include, bygroups, words
12
+ from pygments.token import Whitespace, Name, String, Punctuation, Keyword, \
13
+ Operator, Number
14
+
15
+ __all__ = ["NumbaIRLexer"]
16
+
17
+ class NumbaIRLexer(RegexLexer):
18
+ """
19
+ Lexer for Numba IR
20
+ """
21
+ name = 'Numba_IR'
22
+ url = "https://numba.readthedocs.io/en/stable/developer/architecture.html#stage-2-generate-the-numba-ir"
23
+ aliases = ['numba_ir', 'numbair']
24
+ filenames = ['*.numba_ir']
25
+ mimetypes = ['text/x-numba_ir', 'text/x-numbair']
26
+ version_added = '2.19'
27
+
28
+ identifier = r'\$[a-zA-Z0-9._]+'
29
+ fun_or_var = r'([a-zA-Z_]+[a-zA-Z0-9]*)'
30
+
31
+ tokens = {
32
+ 'root' : [
33
+ (r'(label)(\ [0-9]+)(:)$',
34
+ bygroups(Keyword, Name.Label, Punctuation)),
35
+
36
+ (r'=', Operator),
37
+ include('whitespace'),
38
+ include('keyword'),
39
+
40
+ (identifier, Name.Variable),
41
+ (fun_or_var + r'(\()',
42
+ bygroups(Name.Function, Punctuation)),
43
+ (fun_or_var + r'(\=)',
44
+ bygroups(Name.Attribute, Punctuation)),
45
+ (fun_or_var, Name.Constant),
46
+ (r'[0-9]+', Number),
47
+
48
+ # <built-in function some>
49
+ (r'<[^>\n]*>', String),
50
+
51
+ (r'[=<>{}\[\]()*.,!\':]|x\b', Punctuation)
52
+ ],
53
+
54
+ 'keyword':[
55
+ (words((
56
+ 'del', 'jump', 'call', 'branch',
57
+ ), suffix=' '), Keyword),
58
+ ],
59
+
60
+ 'whitespace': [
61
+ (r'(\n|\s)+', Whitespace),
62
+ ],
63
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/oberon.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.oberon
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Oberon family languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, words
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation
16
+
17
+ __all__ = ['ComponentPascalLexer']
18
+
19
+
20
+ class ComponentPascalLexer(RegexLexer):
21
+ """
22
+ For Component Pascal source code.
23
+ """
24
+ name = 'Component Pascal'
25
+ aliases = ['componentpascal', 'cp']
26
+ filenames = ['*.cp', '*.cps']
27
+ mimetypes = ['text/x-component-pascal']
28
+ url = 'https://blackboxframework.org'
29
+ version_added = '2.1'
30
+
31
+ flags = re.MULTILINE | re.DOTALL
32
+
33
+ tokens = {
34
+ 'root': [
35
+ include('whitespace'),
36
+ include('comments'),
37
+ include('punctuation'),
38
+ include('numliterals'),
39
+ include('strings'),
40
+ include('operators'),
41
+ include('builtins'),
42
+ include('identifiers'),
43
+ ],
44
+ 'whitespace': [
45
+ (r'\n+', Text), # blank lines
46
+ (r'\s+', Text), # whitespace
47
+ ],
48
+ 'comments': [
49
+ (r'\(\*([^$].*?)\*\)', Comment.Multiline),
50
+ # TODO: nested comments (* (* ... *) ... (* ... *) *) not supported!
51
+ ],
52
+ 'punctuation': [
53
+ (r'[()\[\]{},.:;|]', Punctuation),
54
+ ],
55
+ 'numliterals': [
56
+ (r'[0-9A-F]+X\b', Number.Hex), # char code
57
+ (r'[0-9A-F]+[HL]\b', Number.Hex), # hexadecimal number
58
+ (r'[0-9]+\.[0-9]+E[+-][0-9]+', Number.Float), # real number
59
+ (r'[0-9]+\.[0-9]+', Number.Float), # real number
60
+ (r'[0-9]+', Number.Integer), # decimal whole number
61
+ ],
62
+ 'strings': [
63
+ (r"'[^\n']*'", String), # single quoted string
64
+ (r'"[^\n"]*"', String), # double quoted string
65
+ ],
66
+ 'operators': [
67
+ # Arithmetic Operators
68
+ (r'[+-]', Operator),
69
+ (r'[*/]', Operator),
70
+ # Relational Operators
71
+ (r'[=#<>]', Operator),
72
+ # Dereferencing Operator
73
+ (r'\^', Operator),
74
+ # Logical AND Operator
75
+ (r'&', Operator),
76
+ # Logical NOT Operator
77
+ (r'~', Operator),
78
+ # Assignment Symbol
79
+ (r':=', Operator),
80
+ # Range Constructor
81
+ (r'\.\.', Operator),
82
+ (r'\$', Operator),
83
+ ],
84
+ 'identifiers': [
85
+ (r'([a-zA-Z_$][\w$]*)', Name),
86
+ ],
87
+ 'builtins': [
88
+ (words((
89
+ 'ANYPTR', 'ANYREC', 'BOOLEAN', 'BYTE', 'CHAR', 'INTEGER', 'LONGINT',
90
+ 'REAL', 'SET', 'SHORTCHAR', 'SHORTINT', 'SHORTREAL'
91
+ ), suffix=r'\b'), Keyword.Type),
92
+ (words((
93
+ 'ABS', 'ABSTRACT', 'ARRAY', 'ASH', 'ASSERT', 'BEGIN', 'BITS', 'BY',
94
+ 'CAP', 'CASE', 'CHR', 'CLOSE', 'CONST', 'DEC', 'DIV', 'DO', 'ELSE',
95
+ 'ELSIF', 'EMPTY', 'END', 'ENTIER', 'EXCL', 'EXIT', 'EXTENSIBLE', 'FOR',
96
+ 'HALT', 'IF', 'IMPORT', 'IN', 'INC', 'INCL', 'IS', 'LEN', 'LIMITED',
97
+ 'LONG', 'LOOP', 'MAX', 'MIN', 'MOD', 'MODULE', 'NEW', 'ODD', 'OF',
98
+ 'OR', 'ORD', 'OUT', 'POINTER', 'PROCEDURE', 'RECORD', 'REPEAT', 'RETURN',
99
+ 'SHORT', 'SHORTCHAR', 'SHORTINT', 'SIZE', 'THEN', 'TYPE', 'TO', 'UNTIL',
100
+ 'VAR', 'WHILE', 'WITH'
101
+ ), suffix=r'\b'), Keyword.Reserved),
102
+ (r'(TRUE|FALSE|NIL|INF)\b', Keyword.Constant),
103
+ ]
104
+ }
105
+
106
+ def analyse_text(text):
107
+ """The only other lexer using .cp is the C++ one, so we check if for
108
+ a few common Pascal keywords here. Those are unfortunately quite
109
+ common across various business languages as well."""
110
+ result = 0
111
+ if 'BEGIN' in text:
112
+ result += 0.01
113
+ if 'END' in text:
114
+ result += 0.01
115
+ if 'PROCEDURE' in text:
116
+ result += 0.01
117
+ if 'MODULE' in text:
118
+ result += 0.01
119
+
120
+ return result
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/objective.py ADDED
@@ -0,0 +1,513 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.objective
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Objective-C family languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups, using, this, words, \
14
+ inherit, default
15
+ from pygments.token import Text, Keyword, Name, String, Operator, \
16
+ Number, Punctuation, Literal, Comment, Whitespace
17
+
18
+ from pygments.lexers.c_cpp import CLexer, CppLexer
19
+
20
+ __all__ = ['ObjectiveCLexer', 'ObjectiveCppLexer', 'LogosLexer', 'SwiftLexer']
21
+
22
+
23
+ def objective(baselexer):
24
+ """
25
+ Generate a subclass of baselexer that accepts the Objective-C syntax
26
+ extensions.
27
+ """
28
+
29
+ # Have to be careful not to accidentally match JavaDoc/Doxygen syntax here,
30
+ # since that's quite common in ordinary C/C++ files. It's OK to match
31
+ # JavaDoc/Doxygen keywords that only apply to Objective-C, mind.
32
+ #
33
+ # The upshot of this is that we CANNOT match @class or @interface
34
+ _oc_keywords = re.compile(r'@(?:end|implementation|protocol)')
35
+
36
+ # Matches [ <ws>? identifier <ws> ( identifier <ws>? ] | identifier? : )
37
+ # (note the identifier is *optional* when there is a ':'!)
38
+ _oc_message = re.compile(r'\[\s*[a-zA-Z_]\w*\s+'
39
+ r'(?:[a-zA-Z_]\w*\s*\]|'
40
+ r'(?:[a-zA-Z_]\w*)?:)')
41
+
42
+ class GeneratedObjectiveCVariant(baselexer):
43
+ """
44
+ Implements Objective-C syntax on top of an existing C family lexer.
45
+ """
46
+
47
+ tokens = {
48
+ 'statements': [
49
+ (r'@"', String, 'string'),
50
+ (r'@(YES|NO)', Number),
51
+ (r"@'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
52
+ (r'@(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
53
+ (r'@(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
54
+ (r'@0x[0-9a-fA-F]+[Ll]?', Number.Hex),
55
+ (r'@0[0-7]+[Ll]?', Number.Oct),
56
+ (r'@\d+[Ll]?', Number.Integer),
57
+ (r'@\(', Literal, 'literal_number'),
58
+ (r'@\[', Literal, 'literal_array'),
59
+ (r'@\{', Literal, 'literal_dictionary'),
60
+ (words((
61
+ '@selector', '@private', '@protected', '@public', '@encode',
62
+ '@synchronized', '@try', '@throw', '@catch', '@finally',
63
+ '@end', '@property', '@synthesize', '__bridge', '__bridge_transfer',
64
+ '__autoreleasing', '__block', '__weak', '__strong', 'weak', 'strong',
65
+ 'copy', 'retain', 'assign', 'unsafe_unretained', 'atomic', 'nonatomic',
66
+ 'readonly', 'readwrite', 'setter', 'getter', 'typeof', 'in',
67
+ 'out', 'inout', 'release', 'class', '@dynamic', '@optional',
68
+ '@required', '@autoreleasepool', '@import'), suffix=r'\b'),
69
+ Keyword),
70
+ (words(('id', 'instancetype', 'Class', 'IMP', 'SEL', 'BOOL',
71
+ 'IBOutlet', 'IBAction', 'unichar'), suffix=r'\b'),
72
+ Keyword.Type),
73
+ (r'@(true|false|YES|NO)\n', Name.Builtin),
74
+ (r'(YES|NO|nil|self|super)\b', Name.Builtin),
75
+ # Carbon types
76
+ (r'(Boolean|UInt8|SInt8|UInt16|SInt16|UInt32|SInt32)\b', Keyword.Type),
77
+ # Carbon built-ins
78
+ (r'(TRUE|FALSE)\b', Name.Builtin),
79
+ (r'(@interface|@implementation)(\s+)', bygroups(Keyword, Text),
80
+ ('#pop', 'oc_classname')),
81
+ (r'(@class|@protocol)(\s+)', bygroups(Keyword, Text),
82
+ ('#pop', 'oc_forward_classname')),
83
+ # @ can also prefix other expressions like @{...} or @(...)
84
+ (r'@', Punctuation),
85
+ inherit,
86
+ ],
87
+ 'oc_classname': [
88
+ # interface definition that inherits
89
+ (r'([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?(\s*)(\{)',
90
+ bygroups(Name.Class, Text, Name.Class, Text, Punctuation),
91
+ ('#pop', 'oc_ivars')),
92
+ (r'([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?',
93
+ bygroups(Name.Class, Text, Name.Class), '#pop'),
94
+ # interface definition for a category
95
+ (r'([a-zA-Z$_][\w$]*)(\s*)(\([a-zA-Z$_][\w$]*\))(\s*)(\{)',
96
+ bygroups(Name.Class, Text, Name.Label, Text, Punctuation),
97
+ ('#pop', 'oc_ivars')),
98
+ (r'([a-zA-Z$_][\w$]*)(\s*)(\([a-zA-Z$_][\w$]*\))',
99
+ bygroups(Name.Class, Text, Name.Label), '#pop'),
100
+ # simple interface / implementation
101
+ (r'([a-zA-Z$_][\w$]*)(\s*)(\{)',
102
+ bygroups(Name.Class, Text, Punctuation), ('#pop', 'oc_ivars')),
103
+ (r'([a-zA-Z$_][\w$]*)', Name.Class, '#pop')
104
+ ],
105
+ 'oc_forward_classname': [
106
+ (r'([a-zA-Z$_][\w$]*)(\s*,\s*)',
107
+ bygroups(Name.Class, Text), 'oc_forward_classname'),
108
+ (r'([a-zA-Z$_][\w$]*)(\s*;?)',
109
+ bygroups(Name.Class, Text), '#pop')
110
+ ],
111
+ 'oc_ivars': [
112
+ include('whitespace'),
113
+ include('statements'),
114
+ (';', Punctuation),
115
+ (r'\{', Punctuation, '#push'),
116
+ (r'\}', Punctuation, '#pop'),
117
+ ],
118
+ 'root': [
119
+ # methods
120
+ (r'^([-+])(\s*)' # method marker
121
+ r'(\(.*?\))?(\s*)' # return type
122
+ r'([a-zA-Z$_][\w$]*:?)', # begin of method name
123
+ bygroups(Punctuation, Text, using(this),
124
+ Text, Name.Function),
125
+ 'method'),
126
+ inherit,
127
+ ],
128
+ 'method': [
129
+ include('whitespace'),
130
+ # TODO unsure if ellipses are allowed elsewhere, see
131
+ # discussion in Issue 789
132
+ (r',', Punctuation),
133
+ (r'\.\.\.', Punctuation),
134
+ (r'(\(.*?\))(\s*)([a-zA-Z$_][\w$]*)',
135
+ bygroups(using(this), Text, Name.Variable)),
136
+ (r'[a-zA-Z$_][\w$]*:', Name.Function),
137
+ (';', Punctuation, '#pop'),
138
+ (r'\{', Punctuation, 'function'),
139
+ default('#pop'),
140
+ ],
141
+ 'literal_number': [
142
+ (r'\(', Punctuation, 'literal_number_inner'),
143
+ (r'\)', Literal, '#pop'),
144
+ include('statement'),
145
+ ],
146
+ 'literal_number_inner': [
147
+ (r'\(', Punctuation, '#push'),
148
+ (r'\)', Punctuation, '#pop'),
149
+ include('statement'),
150
+ ],
151
+ 'literal_array': [
152
+ (r'\[', Punctuation, 'literal_array_inner'),
153
+ (r'\]', Literal, '#pop'),
154
+ include('statement'),
155
+ ],
156
+ 'literal_array_inner': [
157
+ (r'\[', Punctuation, '#push'),
158
+ (r'\]', Punctuation, '#pop'),
159
+ include('statement'),
160
+ ],
161
+ 'literal_dictionary': [
162
+ (r'\}', Literal, '#pop'),
163
+ include('statement'),
164
+ ],
165
+ }
166
+
167
+ def analyse_text(text):
168
+ if _oc_keywords.search(text):
169
+ return 1.0
170
+ elif '@"' in text: # strings
171
+ return 0.8
172
+ elif re.search('@[0-9]+', text):
173
+ return 0.7
174
+ elif _oc_message.search(text):
175
+ return 0.8
176
+ return 0
177
+
178
+ def get_tokens_unprocessed(self, text, stack=('root',)):
179
+ from pygments.lexers._cocoa_builtins import COCOA_INTERFACES, \
180
+ COCOA_PROTOCOLS, COCOA_PRIMITIVES
181
+
182
+ for index, token, value in \
183
+ baselexer.get_tokens_unprocessed(self, text, stack):
184
+ if token is Name or token is Name.Class:
185
+ if value in COCOA_INTERFACES or value in COCOA_PROTOCOLS \
186
+ or value in COCOA_PRIMITIVES:
187
+ token = Name.Builtin.Pseudo
188
+
189
+ yield index, token, value
190
+
191
+ return GeneratedObjectiveCVariant
192
+
193
+
194
+ class ObjectiveCLexer(objective(CLexer)):
195
+ """
196
+ For Objective-C source code with preprocessor directives.
197
+ """
198
+
199
+ name = 'Objective-C'
200
+ url = 'https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html'
201
+ aliases = ['objective-c', 'objectivec', 'obj-c', 'objc']
202
+ filenames = ['*.m', '*.h']
203
+ mimetypes = ['text/x-objective-c']
204
+ version_added = ''
205
+ priority = 0.05 # Lower than C
206
+
207
+
208
+ class ObjectiveCppLexer(objective(CppLexer)):
209
+ """
210
+ For Objective-C++ source code with preprocessor directives.
211
+ """
212
+
213
+ name = 'Objective-C++'
214
+ aliases = ['objective-c++', 'objectivec++', 'obj-c++', 'objc++']
215
+ filenames = ['*.mm', '*.hh']
216
+ mimetypes = ['text/x-objective-c++']
217
+ version_added = ''
218
+ priority = 0.05 # Lower than C++
219
+
220
+
221
+ class LogosLexer(ObjectiveCppLexer):
222
+ """
223
+ For Logos + Objective-C source code with preprocessor directives.
224
+ """
225
+
226
+ name = 'Logos'
227
+ aliases = ['logos']
228
+ filenames = ['*.x', '*.xi', '*.xm', '*.xmi']
229
+ mimetypes = ['text/x-logos']
230
+ version_added = '1.6'
231
+ priority = 0.25
232
+
233
+ tokens = {
234
+ 'statements': [
235
+ (r'(%orig|%log)\b', Keyword),
236
+ (r'(%c)\b(\()(\s*)([a-zA-Z$_][\w$]*)(\s*)(\))',
237
+ bygroups(Keyword, Punctuation, Text, Name.Class, Text, Punctuation)),
238
+ (r'(%init)\b(\()',
239
+ bygroups(Keyword, Punctuation), 'logos_init_directive'),
240
+ (r'(%init)(?=\s*;)', bygroups(Keyword)),
241
+ (r'(%hook|%group)(\s+)([a-zA-Z$_][\w$]+)',
242
+ bygroups(Keyword, Text, Name.Class), '#pop'),
243
+ (r'(%subclass)(\s+)', bygroups(Keyword, Text),
244
+ ('#pop', 'logos_classname')),
245
+ inherit,
246
+ ],
247
+ 'logos_init_directive': [
248
+ (r'\s+', Text),
249
+ (',', Punctuation, ('logos_init_directive', '#pop')),
250
+ (r'([a-zA-Z$_][\w$]*)(\s*)(=)(\s*)([^);]*)',
251
+ bygroups(Name.Class, Text, Punctuation, Text, Text)),
252
+ (r'([a-zA-Z$_][\w$]*)', Name.Class),
253
+ (r'\)', Punctuation, '#pop'),
254
+ ],
255
+ 'logos_classname': [
256
+ (r'([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?',
257
+ bygroups(Name.Class, Text, Name.Class), '#pop'),
258
+ (r'([a-zA-Z$_][\w$]*)', Name.Class, '#pop')
259
+ ],
260
+ 'root': [
261
+ (r'(%subclass)(\s+)', bygroups(Keyword, Text),
262
+ 'logos_classname'),
263
+ (r'(%hook|%group)(\s+)([a-zA-Z$_][\w$]+)',
264
+ bygroups(Keyword, Text, Name.Class)),
265
+ (r'(%config)(\s*\(\s*)(\w+)(\s*=)(.*?)(\)\s*)',
266
+ bygroups(Keyword, Text, Name.Variable, Text, String, Text)),
267
+ (r'(%ctor)(\s*)(\{)', bygroups(Keyword, Text, Punctuation),
268
+ 'function'),
269
+ (r'(%new)(\s*)(\()(.*?)(\))',
270
+ bygroups(Keyword, Text, Keyword, String, Keyword)),
271
+ (r'(\s*)(%end)(\s*)', bygroups(Text, Keyword, Text)),
272
+ inherit,
273
+ ],
274
+ }
275
+
276
+ _logos_keywords = re.compile(r'%(?:hook|ctor|init|c\()')
277
+
278
+ def analyse_text(text):
279
+ if LogosLexer._logos_keywords.search(text):
280
+ return 1.0
281
+ return 0
282
+
283
+
284
+ class SwiftLexer(RegexLexer):
285
+ """
286
+ For Swift source.
287
+ """
288
+ name = 'Swift'
289
+ url = 'https://www.swift.org/'
290
+ filenames = ['*.swift']
291
+ aliases = ['swift']
292
+ mimetypes = ['text/x-swift']
293
+ version_added = '2.0'
294
+
295
+ tokens = {
296
+ 'root': [
297
+ # Whitespace and Comments
298
+ (r'\n', Text),
299
+ (r'\s+', Whitespace),
300
+ (r'//', Comment.Single, 'comment-single'),
301
+ (r'/\*', Comment.Multiline, 'comment-multi'),
302
+ (r'#(if|elseif|else|endif|available)\b', Comment.Preproc, 'preproc'),
303
+
304
+ # Keywords
305
+ include('keywords'),
306
+
307
+ # Global Types
308
+ (words((
309
+ 'Array', 'AutoreleasingUnsafeMutablePointer', 'BidirectionalReverseView',
310
+ 'Bit', 'Bool', 'CFunctionPointer', 'COpaquePointer', 'CVaListPointer',
311
+ 'Character', 'ClosedInterval', 'CollectionOfOne', 'ContiguousArray',
312
+ 'Dictionary', 'DictionaryGenerator', 'DictionaryIndex', 'Double',
313
+ 'EmptyCollection', 'EmptyGenerator', 'EnumerateGenerator',
314
+ 'EnumerateSequence', 'FilterCollectionView',
315
+ 'FilterCollectionViewIndex', 'FilterGenerator', 'FilterSequenceView',
316
+ 'Float', 'Float80', 'FloatingPointClassification', 'GeneratorOf',
317
+ 'GeneratorOfOne', 'GeneratorSequence', 'HalfOpenInterval', 'HeapBuffer',
318
+ 'HeapBufferStorage', 'ImplicitlyUnwrappedOptional', 'IndexingGenerator',
319
+ 'Int', 'Int16', 'Int32', 'Int64', 'Int8', 'LazyBidirectionalCollection',
320
+ 'LazyForwardCollection', 'LazyRandomAccessCollection',
321
+ 'LazySequence', 'MapCollectionView', 'MapSequenceGenerator',
322
+ 'MapSequenceView', 'MirrorDisposition', 'ObjectIdentifier', 'OnHeap',
323
+ 'Optional', 'PermutationGenerator', 'QuickLookObject',
324
+ 'RandomAccessReverseView', 'Range', 'RangeGenerator', 'RawByte', 'Repeat',
325
+ 'ReverseBidirectionalIndex', 'ReverseRandomAccessIndex', 'SequenceOf',
326
+ 'SinkOf', 'Slice', 'StaticString', 'StrideThrough', 'StrideThroughGenerator',
327
+ 'StrideTo', 'StrideToGenerator', 'String', 'UInt', 'UInt16', 'UInt32',
328
+ 'UInt64', 'UInt8', 'UTF16', 'UTF32', 'UTF8', 'UnicodeDecodingResult',
329
+ 'UnicodeScalar', 'Unmanaged', 'UnsafeBufferPointer',
330
+ 'UnsafeBufferPointerGenerator', 'UnsafeMutableBufferPointer',
331
+ 'UnsafeMutablePointer', 'UnsafePointer', 'Zip2', 'ZipGenerator2',
332
+ # Protocols
333
+ 'AbsoluteValuable', 'AnyObject', 'ArrayLiteralConvertible',
334
+ 'BidirectionalIndexType', 'BitwiseOperationsType',
335
+ 'BooleanLiteralConvertible', 'BooleanType', 'CVarArgType',
336
+ 'CollectionType', 'Comparable', 'DebugPrintable',
337
+ 'DictionaryLiteralConvertible', 'Equatable',
338
+ 'ExtendedGraphemeClusterLiteralConvertible',
339
+ 'ExtensibleCollectionType', 'FloatLiteralConvertible',
340
+ 'FloatingPointType', 'ForwardIndexType', 'GeneratorType', 'Hashable',
341
+ 'IntegerArithmeticType', 'IntegerLiteralConvertible', 'IntegerType',
342
+ 'IntervalType', 'MirrorType', 'MutableCollectionType', 'MutableSliceable',
343
+ 'NilLiteralConvertible', 'OutputStreamType', 'Printable',
344
+ 'RandomAccessIndexType', 'RangeReplaceableCollectionType',
345
+ 'RawOptionSetType', 'RawRepresentable', 'Reflectable', 'SequenceType',
346
+ 'SignedIntegerType', 'SignedNumberType', 'SinkType', 'Sliceable',
347
+ 'Streamable', 'Strideable', 'StringInterpolationConvertible',
348
+ 'StringLiteralConvertible', 'UnicodeCodecType',
349
+ 'UnicodeScalarLiteralConvertible', 'UnsignedIntegerType',
350
+ '_ArrayBufferType', '_BidirectionalIndexType', '_CocoaStringType',
351
+ '_CollectionType', '_Comparable', '_ExtensibleCollectionType',
352
+ '_ForwardIndexType', '_Incrementable', '_IntegerArithmeticType',
353
+ '_IntegerType', '_ObjectiveCBridgeable', '_RandomAccessIndexType',
354
+ '_RawOptionSetType', '_SequenceType', '_Sequence_Type',
355
+ '_SignedIntegerType', '_SignedNumberType', '_Sliceable', '_Strideable',
356
+ '_SwiftNSArrayRequiredOverridesType', '_SwiftNSArrayType',
357
+ '_SwiftNSCopyingType', '_SwiftNSDictionaryRequiredOverridesType',
358
+ '_SwiftNSDictionaryType', '_SwiftNSEnumeratorType',
359
+ '_SwiftNSFastEnumerationType', '_SwiftNSStringRequiredOverridesType',
360
+ '_SwiftNSStringType', '_UnsignedIntegerType',
361
+ # Variables
362
+ 'C_ARGC', 'C_ARGV', 'Process',
363
+ # Typealiases
364
+ 'Any', 'AnyClass', 'BooleanLiteralType', 'CBool', 'CChar', 'CChar16',
365
+ 'CChar32', 'CDouble', 'CFloat', 'CInt', 'CLong', 'CLongLong', 'CShort',
366
+ 'CSignedChar', 'CUnsignedInt', 'CUnsignedLong', 'CUnsignedShort',
367
+ 'CWideChar', 'ExtendedGraphemeClusterType', 'Float32', 'Float64',
368
+ 'FloatLiteralType', 'IntMax', 'IntegerLiteralType', 'StringLiteralType',
369
+ 'UIntMax', 'UWord', 'UnicodeScalarType', 'Void', 'Word',
370
+ # Foundation/Cocoa
371
+ 'NSErrorPointer', 'NSObjectProtocol', 'Selector'), suffix=r'\b'),
372
+ Name.Builtin),
373
+ # Functions
374
+ (words((
375
+ 'abs', 'advance', 'alignof', 'alignofValue', 'assert', 'assertionFailure',
376
+ 'contains', 'count', 'countElements', 'debugPrint', 'debugPrintln',
377
+ 'distance', 'dropFirst', 'dropLast', 'dump', 'enumerate', 'equal',
378
+ 'extend', 'fatalError', 'filter', 'find', 'first', 'getVaList', 'indices',
379
+ 'insert', 'isEmpty', 'join', 'last', 'lazy', 'lexicographicalCompare',
380
+ 'map', 'max', 'maxElement', 'min', 'minElement', 'numericCast', 'overlaps',
381
+ 'partition', 'precondition', 'preconditionFailure', 'prefix', 'print',
382
+ 'println', 'reduce', 'reflect', 'removeAll', 'removeAtIndex', 'removeLast',
383
+ 'removeRange', 'reverse', 'sizeof', 'sizeofValue', 'sort', 'sorted',
384
+ 'splice', 'split', 'startsWith', 'stride', 'strideof', 'strideofValue',
385
+ 'suffix', 'swap', 'toDebugString', 'toString', 'transcode',
386
+ 'underestimateCount', 'unsafeAddressOf', 'unsafeBitCast', 'unsafeDowncast',
387
+ 'withExtendedLifetime', 'withUnsafeMutablePointer',
388
+ 'withUnsafeMutablePointers', 'withUnsafePointer', 'withUnsafePointers',
389
+ 'withVaList'), suffix=r'\b'),
390
+ Name.Builtin.Pseudo),
391
+
392
+ # Implicit Block Variables
393
+ (r'\$\d+', Name.Variable),
394
+
395
+ # Binary Literal
396
+ (r'0b[01_]+', Number.Bin),
397
+ # Octal Literal
398
+ (r'0o[0-7_]+', Number.Oct),
399
+ # Hexadecimal Literal
400
+ (r'0x[0-9a-fA-F_]+', Number.Hex),
401
+ # Decimal Literal
402
+ (r'[0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|'
403
+ r'\.[0-9_]*|[eE][+\-]?[0-9_]+)', Number.Float),
404
+ (r'[0-9][0-9_]*', Number.Integer),
405
+ # String Literal
406
+ (r'"""', String, 'string-multi'),
407
+ (r'"', String, 'string'),
408
+
409
+ # Operators and Punctuation
410
+ (r'[(){}\[\].,:;=@#`?]|->|[<&?](?=\w)|(?<=\w)[>!?]', Punctuation),
411
+ (r'[/=\-+!*%<>&|^?~]+', Operator),
412
+
413
+ # Identifier
414
+ (r'[a-zA-Z_]\w*', Name)
415
+ ],
416
+ 'keywords': [
417
+ (words((
418
+ 'as', 'async', 'await', 'break', 'case', 'catch', 'continue', 'default', 'defer',
419
+ 'do', 'else', 'fallthrough', 'for', 'guard', 'if', 'in', 'is',
420
+ 'repeat', 'return', '#selector', 'switch', 'throw', 'try',
421
+ 'where', 'while'), suffix=r'\b'),
422
+ Keyword),
423
+ (r'@availability\([^)]+\)', Keyword.Reserved),
424
+ (words((
425
+ 'associativity', 'convenience', 'dynamic', 'didSet', 'final',
426
+ 'get', 'indirect', 'infix', 'inout', 'lazy', 'left', 'mutating',
427
+ 'none', 'nonmutating', 'optional', 'override', 'postfix',
428
+ 'precedence', 'prefix', 'Protocol', 'required', 'rethrows',
429
+ 'right', 'set', 'throws', 'Type', 'unowned', 'weak', 'willSet',
430
+ '@availability', '@autoclosure', '@noreturn',
431
+ '@NSApplicationMain', '@NSCopying', '@NSManaged', '@objc',
432
+ '@UIApplicationMain', '@IBAction', '@IBDesignable',
433
+ '@IBInspectable', '@IBOutlet'), suffix=r'\b'),
434
+ Keyword.Reserved),
435
+ (r'(as|dynamicType|false|is|nil|self|Self|super|true|__COLUMN__'
436
+ r'|__FILE__|__FUNCTION__|__LINE__|_'
437
+ r'|#(?:file|line|column|function))\b', Keyword.Constant),
438
+ (r'import\b', Keyword.Declaration, 'module'),
439
+ (r'(class|enum|extension|struct|protocol)(\s+)([a-zA-Z_]\w*)',
440
+ bygroups(Keyword.Declaration, Whitespace, Name.Class)),
441
+ (r'(func)(\s+)([a-zA-Z_]\w*)',
442
+ bygroups(Keyword.Declaration, Whitespace, Name.Function)),
443
+ (r'(var|let)(\s+)([a-zA-Z_]\w*)', bygroups(Keyword.Declaration,
444
+ Whitespace, Name.Variable)),
445
+ (words((
446
+ 'actor', 'associatedtype', 'class', 'deinit', 'enum', 'extension', 'func', 'import',
447
+ 'init', 'internal', 'let', 'operator', 'private', 'protocol', 'public',
448
+ 'static', 'struct', 'subscript', 'typealias', 'var'), suffix=r'\b'),
449
+ Keyword.Declaration)
450
+ ],
451
+ 'comment': [
452
+ (r':param: [a-zA-Z_]\w*|:returns?:|(FIXME|MARK|TODO):',
453
+ Comment.Special)
454
+ ],
455
+
456
+ # Nested
457
+ 'comment-single': [
458
+ (r'\n', Whitespace, '#pop'),
459
+ include('comment'),
460
+ (r'[^\n]+', Comment.Single)
461
+ ],
462
+ 'comment-multi': [
463
+ include('comment'),
464
+ (r'[^*/]+', Comment.Multiline),
465
+ (r'/\*', Comment.Multiline, '#push'),
466
+ (r'\*/', Comment.Multiline, '#pop'),
467
+ (r'[*/]+', Comment.Multiline)
468
+ ],
469
+ 'module': [
470
+ (r'\n', Whitespace, '#pop'),
471
+ (r'[a-zA-Z_]\w*', Name.Class),
472
+ include('root')
473
+ ],
474
+ 'preproc': [
475
+ (r'\n', Whitespace, '#pop'),
476
+ include('keywords'),
477
+ (r'[A-Za-z]\w*', Comment.Preproc),
478
+ include('root')
479
+ ],
480
+ 'string': [
481
+ (r'"', String, '#pop'),
482
+ include("string-common"),
483
+ ],
484
+ 'string-multi': [
485
+ (r'"""', String, '#pop'),
486
+ include("string-common"),
487
+ ],
488
+ 'string-common': [
489
+ (r'\\\(', String.Interpol, 'string-intp'),
490
+ (r"""\\['"\\nrt]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}"""
491
+ r"""|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}""", String.Escape),
492
+ (r'[^\\"]+', String),
493
+ (r'\\', String)
494
+ ],
495
+ 'string-intp': [
496
+ (r'\(', String.Interpol, '#push'),
497
+ (r'\)', String.Interpol, '#pop'),
498
+ include('root')
499
+ ]
500
+ }
501
+
502
+ def get_tokens_unprocessed(self, text):
503
+ from pygments.lexers._cocoa_builtins import COCOA_INTERFACES, \
504
+ COCOA_PROTOCOLS, COCOA_PRIMITIVES
505
+
506
+ for index, token, value in \
507
+ RegexLexer.get_tokens_unprocessed(self, text):
508
+ if token is Name or token is Name.Class:
509
+ if value in COCOA_INTERFACES or value in COCOA_PROTOCOLS \
510
+ or value in COCOA_PRIMITIVES:
511
+ token = Name.Builtin.Pseudo
512
+
513
+ yield index, token, value
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/ooc.py ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ooc
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Ooc language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, words
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation
14
+
15
+ __all__ = ['OocLexer']
16
+
17
+
18
+ class OocLexer(RegexLexer):
19
+ """
20
+ For Ooc source code
21
+ """
22
+ name = 'Ooc'
23
+ url = 'https://ooc-lang.github.io/'
24
+ aliases = ['ooc']
25
+ filenames = ['*.ooc']
26
+ mimetypes = ['text/x-ooc']
27
+ version_added = '1.2'
28
+
29
+ tokens = {
30
+ 'root': [
31
+ (words((
32
+ 'class', 'interface', 'implement', 'abstract', 'extends', 'from',
33
+ 'this', 'super', 'new', 'const', 'final', 'static', 'import',
34
+ 'use', 'extern', 'inline', 'proto', 'break', 'continue',
35
+ 'fallthrough', 'operator', 'if', 'else', 'for', 'while', 'do',
36
+ 'switch', 'case', 'as', 'in', 'version', 'return', 'true',
37
+ 'false', 'null'), prefix=r'\b', suffix=r'\b'),
38
+ Keyword),
39
+ (r'include\b', Keyword, 'include'),
40
+ (r'(cover)([ \t]+)(from)([ \t]+)(\w+[*@]?)',
41
+ bygroups(Keyword, Text, Keyword, Text, Name.Class)),
42
+ (r'(func)((?:[ \t]|\\\n)+)(~[a-z_]\w*)',
43
+ bygroups(Keyword, Text, Name.Function)),
44
+ (r'\bfunc\b', Keyword),
45
+ # Note: %= not listed on https://ooc-lang.github.io/docs/lang/operators/
46
+ (r'//.*', Comment),
47
+ (r'(?s)/\*.*?\*/', Comment.Multiline),
48
+ (r'(==?|\+=?|-[=>]?|\*=?|/=?|:=|!=?|%=?|\?|>{1,3}=?|<{1,3}=?|\.\.|'
49
+ r'&&?|\|\|?|\^=?)', Operator),
50
+ (r'(\.)([ \t]*)([a-z]\w*)', bygroups(Operator, Text,
51
+ Name.Function)),
52
+ (r'[A-Z][A-Z0-9_]+', Name.Constant),
53
+ (r'[A-Z]\w*([@*]|\[[ \t]*\])?', Name.Class),
54
+
55
+ (r'([a-z]\w*(?:~[a-z]\w*)?)((?:[ \t]|\\\n)*)(?=\()',
56
+ bygroups(Name.Function, Text)),
57
+ (r'[a-z]\w*', Name.Variable),
58
+
59
+ # : introduces types
60
+ (r'[:(){}\[\];,]', Punctuation),
61
+
62
+ (r'0x[0-9a-fA-F]+', Number.Hex),
63
+ (r'0c[0-9]+', Number.Oct),
64
+ (r'0b[01]+', Number.Bin),
65
+ (r'[0-9_]\.[0-9_]*(?!\.)', Number.Float),
66
+ (r'[0-9_]+', Number.Decimal),
67
+
68
+ (r'"(?:\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\"])*"',
69
+ String.Double),
70
+ (r"'(?:\\.|\\[0-9]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'",
71
+ String.Char),
72
+ (r'@', Punctuation), # pointer dereference
73
+ (r'\.', Punctuation), # imports or chain operator
74
+
75
+ (r'\\[ \t\n]', Text),
76
+ (r'[ \t]+', Text),
77
+ ],
78
+ 'include': [
79
+ (r'[\w/]+', Name),
80
+ (r',', Punctuation),
81
+ (r'[ \t]', Text),
82
+ (r'[;\n]', Text, '#pop'),
83
+ ],
84
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/openscad.py ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.openscad
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the OpenSCAD languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, words, include
12
+ from pygments.token import Text, Comment, Punctuation, Operator, Keyword, Name, Number, Whitespace, Literal, String
13
+
14
+ __all__ = ['OpenScadLexer']
15
+
16
+
17
+ class OpenScadLexer(RegexLexer):
18
+ """For openSCAD code.
19
+ """
20
+ name = "OpenSCAD"
21
+ url = "https://openscad.org/"
22
+ aliases = ["openscad"]
23
+ filenames = ["*.scad"]
24
+ mimetypes = ["application/x-openscad"]
25
+ version_added = '2.16'
26
+
27
+ tokens = {
28
+ "root": [
29
+ (r"[^\S\n]+", Whitespace),
30
+ (r'//', Comment.Single, 'comment-single'),
31
+ (r'/\*', Comment.Multiline, 'comment-multi'),
32
+ (r"[{}\[\]\(\),;:]", Punctuation),
33
+ (r"[*!#%\-+=?/]", Operator),
34
+ (r"<=|<|==|!=|>=|>|&&|\|\|", Operator),
35
+ (r"\$(f[asn]|t|vp[rtd]|children)", Operator),
36
+ (r"(undef|PI)\b", Keyword.Constant),
37
+ (
38
+ r"(use|include)((?:\s|\\\\s)+)",
39
+ bygroups(Keyword.Namespace, Text),
40
+ "includes",
41
+ ),
42
+ (r"(module)(\s*)([^\s\(]+)",
43
+ bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
44
+ (r"(function)(\s*)([^\s\(]+)",
45
+ bygroups(Keyword.Declaration, Whitespace, Name.Function)),
46
+ (words(("true", "false"), prefix=r"\b", suffix=r"\b"), Literal),
47
+ (words((
48
+ "function", "module", "include", "use", "for",
49
+ "intersection_for", "if", "else", "return"
50
+ ), prefix=r"\b", suffix=r"\b"), Keyword
51
+ ),
52
+ (words((
53
+ "circle", "square", "polygon", "text", "sphere", "cube",
54
+ "cylinder", "polyhedron", "translate", "rotate", "scale",
55
+ "resize", "mirror", "multmatrix", "color", "offset", "hull",
56
+ "minkowski", "union", "difference", "intersection", "abs",
57
+ "sign", "sin", "cos", "tan", "acos", "asin", "atan", "atan2",
58
+ "floor", "round", "ceil", "ln", "log", "pow", "sqrt", "exp",
59
+ "rands", "min", "max", "concat", "lookup", "str", "chr",
60
+ "search", "version", "version_num", "norm", "cross",
61
+ "parent_module", "echo", "import", "import_dxf",
62
+ "dxf_linear_extrude", "linear_extrude", "rotate_extrude",
63
+ "surface", "projection", "render", "dxf_cross",
64
+ "dxf_dim", "let", "assign", "len"
65
+ ), prefix=r"\b", suffix=r"\b"),
66
+ Name.Builtin
67
+ ),
68
+ (r"\bchildren\b", Name.Builtin.Pseudo),
69
+ (r'""".*?"""', String.Double),
70
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
71
+ (r"-?\d+(\.\d+)?(e[+-]?\d+)?", Number),
72
+ (r"\w+", Name),
73
+ ],
74
+ "includes": [
75
+ (
76
+ r"(<)([^>]*)(>)",
77
+ bygroups(Punctuation, Comment.PreprocFile, Punctuation),
78
+ ),
79
+ ],
80
+ 'comment': [
81
+ (r':param: [a-zA-Z_]\w*|:returns?:|(FIXME|MARK|TODO):',
82
+ Comment.Special)
83
+ ],
84
+ 'comment-single': [
85
+ (r'\n', Text, '#pop'),
86
+ include('comment'),
87
+ (r'[^\n]+', Comment.Single)
88
+ ],
89
+ 'comment-multi': [
90
+ include('comment'),
91
+ (r'[^*/]+', Comment.Multiline),
92
+ (r'/\*', Comment.Multiline, '#push'),
93
+ (r'\*/', Comment.Multiline, '#pop'),
94
+ (r'[*/]', Comment.Multiline)
95
+ ],
96
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/other.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.other
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Just export lexer classes previously contained in this module.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ # ruff: noqa: F401
12
+ from pygments.lexers.sql import SqlLexer, MySqlLexer, SqliteConsoleLexer
13
+ from pygments.lexers.shell import BashLexer, BashSessionLexer, BatchLexer, \
14
+ TcshLexer
15
+ from pygments.lexers.robotframework import RobotFrameworkLexer
16
+ from pygments.lexers.testing import GherkinLexer
17
+ from pygments.lexers.esoteric import BrainfuckLexer, BefungeLexer, RedcodeLexer
18
+ from pygments.lexers.prolog import LogtalkLexer
19
+ from pygments.lexers.snobol import SnobolLexer
20
+ from pygments.lexers.rebol import RebolLexer
21
+ from pygments.lexers.configs import KconfigLexer, Cfengine3Lexer
22
+ from pygments.lexers.modeling import ModelicaLexer
23
+ from pygments.lexers.scripting import AppleScriptLexer, MOOCodeLexer, \
24
+ HybrisLexer
25
+ from pygments.lexers.graphics import PostScriptLexer, GnuplotLexer, \
26
+ AsymptoteLexer, PovrayLexer
27
+ from pygments.lexers.business import ABAPLexer, OpenEdgeLexer, \
28
+ GoodDataCLLexer, MaqlLexer
29
+ from pygments.lexers.automation import AutoItLexer, AutohotkeyLexer
30
+ from pygments.lexers.dsls import ProtoBufLexer, BroLexer, PuppetLexer, \
31
+ MscgenLexer, VGLLexer
32
+ from pygments.lexers.basic import CbmBasicV2Lexer
33
+ from pygments.lexers.pawn import SourcePawnLexer, PawnLexer
34
+ from pygments.lexers.ecl import ECLLexer
35
+ from pygments.lexers.urbi import UrbiscriptLexer
36
+ from pygments.lexers.smalltalk import SmalltalkLexer, NewspeakLexer
37
+ from pygments.lexers.installers import NSISLexer, RPMSpecLexer
38
+ from pygments.lexers.textedit import AwkLexer
39
+ from pygments.lexers.smv import NuSMVLexer
40
+
41
+ __all__ = []
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/parasail.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.parasail
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for ParaSail.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Literal
16
+
17
+ __all__ = ['ParaSailLexer']
18
+
19
+
20
+ class ParaSailLexer(RegexLexer):
21
+ """
22
+ For ParaSail source code.
23
+ """
24
+
25
+ name = 'ParaSail'
26
+ url = 'http://www.parasail-lang.org'
27
+ aliases = ['parasail']
28
+ filenames = ['*.psi', '*.psl']
29
+ mimetypes = ['text/x-parasail']
30
+ version_added = '2.1'
31
+
32
+ flags = re.MULTILINE
33
+
34
+ tokens = {
35
+ 'root': [
36
+ (r'[^\S\n]+', Text),
37
+ (r'//.*?\n', Comment.Single),
38
+ (r'\b(and|or|xor)=', Operator.Word),
39
+ (r'\b(and(\s+then)?|or(\s+else)?|xor|rem|mod|'
40
+ r'(is|not)\s+null)\b',
41
+ Operator.Word),
42
+ # Keywords
43
+ (r'\b(abs|abstract|all|block|class|concurrent|const|continue|'
44
+ r'each|end|exit|extends|exports|forward|func|global|implements|'
45
+ r'import|in|interface|is|lambda|locked|new|not|null|of|op|'
46
+ r'optional|private|queued|ref|return|reverse|separate|some|'
47
+ r'type|until|var|with|'
48
+ # Control flow
49
+ r'if|then|else|elsif|case|for|while|loop)\b',
50
+ Keyword.Reserved),
51
+ (r'(abstract\s+)?(interface|class|op|func|type)',
52
+ Keyword.Declaration),
53
+ # Literals
54
+ (r'"[^"]*"', String),
55
+ (r'\\[\'ntrf"0]', String.Escape),
56
+ (r'#[a-zA-Z]\w*', Literal), # Enumeration
57
+ include('numbers'),
58
+ (r"'[^']'", String.Char),
59
+ (r'[a-zA-Z]\w*', Name),
60
+ # Operators and Punctuation
61
+ (r'(<==|==>|<=>|\*\*=|<\|=|<<=|>>=|==|!=|=\?|<=|>=|'
62
+ r'\*\*|<<|>>|=>|:=|\+=|-=|\*=|\|=|\||/=|\+|-|\*|/|'
63
+ r'\.\.|<\.\.|\.\.<|<\.\.<)',
64
+ Operator),
65
+ (r'(<|>|\[|\]|\(|\)|\||:|;|,|.|\{|\}|->)',
66
+ Punctuation),
67
+ (r'\n+', Text),
68
+ ],
69
+ 'numbers': [
70
+ (r'\d[0-9_]*#[0-9a-fA-F][0-9a-fA-F_]*#', Number.Hex), # any base
71
+ (r'0[xX][0-9a-fA-F][0-9a-fA-F_]*', Number.Hex), # C-like hex
72
+ (r'0[bB][01][01_]*', Number.Bin), # C-like bin
73
+ (r'\d[0-9_]*\.\d[0-9_]*[eE][+-]\d[0-9_]*', # float exp
74
+ Number.Float),
75
+ (r'\d[0-9_]*\.\d[0-9_]*', Number.Float), # float
76
+ (r'\d[0-9_]*', Number.Integer), # integer
77
+ ],
78
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/parsers.py ADDED
@@ -0,0 +1,798 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.parsers
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for parser generators.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, DelegatingLexer, \
14
+ include, bygroups, using
15
+ from pygments.token import Punctuation, Other, Text, Comment, Operator, \
16
+ Keyword, Name, String, Number, Whitespace
17
+ from pygments.lexers.jvm import JavaLexer
18
+ from pygments.lexers.c_cpp import CLexer, CppLexer
19
+ from pygments.lexers.objective import ObjectiveCLexer
20
+ from pygments.lexers.d import DLexer
21
+ from pygments.lexers.dotnet import CSharpLexer
22
+ from pygments.lexers.ruby import RubyLexer
23
+ from pygments.lexers.python import PythonLexer
24
+ from pygments.lexers.perl import PerlLexer
25
+
26
+ __all__ = ['RagelLexer', 'RagelEmbeddedLexer', 'RagelCLexer', 'RagelDLexer',
27
+ 'RagelCppLexer', 'RagelObjectiveCLexer', 'RagelRubyLexer',
28
+ 'RagelJavaLexer', 'AntlrLexer', 'AntlrPythonLexer',
29
+ 'AntlrPerlLexer', 'AntlrRubyLexer', 'AntlrCppLexer',
30
+ 'AntlrCSharpLexer', 'AntlrObjectiveCLexer',
31
+ 'AntlrJavaLexer', 'AntlrActionScriptLexer',
32
+ 'TreetopLexer', 'EbnfLexer']
33
+
34
+
35
+ class RagelLexer(RegexLexer):
36
+ """A pure `Ragel <www.colm.net/open-source/ragel>`_ lexer.
37
+
38
+ Use this for fragments of Ragel. For ``.rl`` files, use
39
+ :class:`RagelEmbeddedLexer` instead (or one of the language-specific
40
+ subclasses).
41
+ """
42
+
43
+ name = 'Ragel'
44
+ url = 'http://www.colm.net/open-source/ragel/'
45
+ aliases = ['ragel']
46
+ filenames = []
47
+ version_added = '1.1'
48
+
49
+ tokens = {
50
+ 'whitespace': [
51
+ (r'\s+', Whitespace)
52
+ ],
53
+ 'comments': [
54
+ (r'\#.*$', Comment),
55
+ ],
56
+ 'keywords': [
57
+ (r'(access|action|alphtype)\b', Keyword),
58
+ (r'(getkey|write|machine|include)\b', Keyword),
59
+ (r'(any|ascii|extend|alpha|digit|alnum|lower|upper)\b', Keyword),
60
+ (r'(xdigit|cntrl|graph|print|punct|space|zlen|empty)\b', Keyword)
61
+ ],
62
+ 'numbers': [
63
+ (r'0x[0-9A-Fa-f]+', Number.Hex),
64
+ (r'[+-]?[0-9]+', Number.Integer),
65
+ ],
66
+ 'literals': [
67
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
68
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
69
+ (r'\[(\\\\|\\[^\\]|[^\\\]])*\]', String), # square bracket literals
70
+ (r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', String.Regex), # regular expressions
71
+ ],
72
+ 'identifiers': [
73
+ (r'[a-zA-Z_]\w*', Name.Variable),
74
+ ],
75
+ 'operators': [
76
+ (r',', Operator), # Join
77
+ (r'\||&|--?', Operator), # Union, Intersection and Subtraction
78
+ (r'\.|<:|:>>?', Operator), # Concatention
79
+ (r':', Operator), # Label
80
+ (r'->', Operator), # Epsilon Transition
81
+ (r'(>|\$|%|<|@|<>)(/|eof\b)', Operator), # EOF Actions
82
+ (r'(>|\$|%|<|@|<>)(!|err\b)', Operator), # Global Error Actions
83
+ (r'(>|\$|%|<|@|<>)(\^|lerr\b)', Operator), # Local Error Actions
84
+ (r'(>|\$|%|<|@|<>)(~|to\b)', Operator), # To-State Actions
85
+ (r'(>|\$|%|<|@|<>)(\*|from\b)', Operator), # From-State Actions
86
+ (r'>|@|\$|%', Operator), # Transition Actions and Priorities
87
+ (r'\*|\?|\+|\{[0-9]*,[0-9]*\}', Operator), # Repetition
88
+ (r'!|\^', Operator), # Negation
89
+ (r'\(|\)', Operator), # Grouping
90
+ ],
91
+ 'root': [
92
+ include('literals'),
93
+ include('whitespace'),
94
+ include('comments'),
95
+ include('keywords'),
96
+ include('numbers'),
97
+ include('identifiers'),
98
+ include('operators'),
99
+ (r'\{', Punctuation, 'host'),
100
+ (r'=', Operator),
101
+ (r';', Punctuation),
102
+ ],
103
+ 'host': [
104
+ (r'(' + r'|'.join(( # keep host code in largest possible chunks
105
+ r'[^{}\'"/#]+', # exclude unsafe characters
106
+ r'[^\\]\\[{}]', # allow escaped { or }
107
+
108
+ # strings and comments may safely contain unsafe characters
109
+ r'"(\\\\|\\[^\\]|[^"\\])*"',
110
+ r"'(\\\\|\\[^\\]|[^'\\])*'",
111
+ r'//.*$\n?', # single line comment
112
+ r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
113
+ r'\#.*$\n?', # ruby comment
114
+
115
+ # regular expression: There's no reason for it to start
116
+ # with a * and this stops confusion with comments.
117
+ r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/',
118
+
119
+ # / is safe now that we've handled regex and javadoc comments
120
+ r'/',
121
+ )) + r')+', Other),
122
+
123
+ (r'\{', Punctuation, '#push'),
124
+ (r'\}', Punctuation, '#pop'),
125
+ ],
126
+ }
127
+
128
+
129
+ class RagelEmbeddedLexer(RegexLexer):
130
+ """
131
+ A lexer for Ragel embedded in a host language file.
132
+
133
+ This will only highlight Ragel statements. If you want host language
134
+ highlighting then call the language-specific Ragel lexer.
135
+ """
136
+
137
+ name = 'Embedded Ragel'
138
+ aliases = ['ragel-em']
139
+ filenames = ['*.rl']
140
+ url = 'http://www.colm.net/open-source/ragel/'
141
+ version_added = '1.1'
142
+
143
+ tokens = {
144
+ 'root': [
145
+ (r'(' + r'|'.join(( # keep host code in largest possible chunks
146
+ r'[^%\'"/#]+', # exclude unsafe characters
147
+ r'%(?=[^%]|$)', # a single % sign is okay, just not 2 of them
148
+
149
+ # strings and comments may safely contain unsafe characters
150
+ r'"(\\\\|\\[^\\]|[^"\\])*"',
151
+ r"'(\\\\|\\[^\\]|[^'\\])*'",
152
+ r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
153
+ r'//.*$\n?', # single line comment
154
+ r'\#.*$\n?', # ruby/ragel comment
155
+ r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', # regular expression
156
+
157
+ # / is safe now that we've handled regex and javadoc comments
158
+ r'/',
159
+ )) + r')+', Other),
160
+
161
+ # Single Line FSM.
162
+ # Please don't put a quoted newline in a single line FSM.
163
+ # That's just mean. It will break this.
164
+ (r'(%%)(?![{%])(.*)($|;)(\n?)', bygroups(Punctuation,
165
+ using(RagelLexer),
166
+ Punctuation, Text)),
167
+
168
+ # Multi Line FSM.
169
+ (r'(%%%%|%%)\{', Punctuation, 'multi-line-fsm'),
170
+ ],
171
+ 'multi-line-fsm': [
172
+ (r'(' + r'|'.join(( # keep ragel code in largest possible chunks.
173
+ r'(' + r'|'.join((
174
+ r'[^}\'"\[/#]', # exclude unsafe characters
175
+ r'\}(?=[^%]|$)', # } is okay as long as it's not followed by %
176
+ r'\}%(?=[^%]|$)', # ...well, one %'s okay, just not two...
177
+ r'[^\\]\\[{}]', # ...and } is okay if it's escaped
178
+
179
+ # allow / if it's preceded with one of these symbols
180
+ # (ragel EOF actions)
181
+ r'(>|\$|%|<|@|<>)/',
182
+
183
+ # specifically allow regex followed immediately by *
184
+ # so it doesn't get mistaken for a comment
185
+ r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/\*',
186
+
187
+ # allow / as long as it's not followed by another / or by a *
188
+ r'/(?=[^/*]|$)',
189
+
190
+ # We want to match as many of these as we can in one block.
191
+ # Not sure if we need the + sign here,
192
+ # does it help performance?
193
+ )) + r')+',
194
+
195
+ # strings and comments may safely contain unsafe characters
196
+ r'"(\\\\|\\[^\\]|[^"\\])*"',
197
+ r"'(\\\\|\\[^\\]|[^'\\])*'",
198
+ r"\[(\\\\|\\[^\\]|[^\]\\])*\]", # square bracket literal
199
+ r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
200
+ r'//.*$\n?', # single line comment
201
+ r'\#.*$\n?', # ruby/ragel comment
202
+ )) + r')+', using(RagelLexer)),
203
+
204
+ (r'\}%%', Punctuation, '#pop'),
205
+ ]
206
+ }
207
+
208
+ def analyse_text(text):
209
+ return '@LANG: indep' in text
210
+
211
+
212
+ class RagelRubyLexer(DelegatingLexer):
213
+ """
214
+ A lexer for Ragel in a Ruby host file.
215
+ """
216
+
217
+ name = 'Ragel in Ruby Host'
218
+ aliases = ['ragel-ruby', 'ragel-rb']
219
+ filenames = ['*.rl']
220
+ url = 'http://www.colm.net/open-source/ragel/'
221
+ version_added = '1.1'
222
+
223
+ def __init__(self, **options):
224
+ super().__init__(RubyLexer, RagelEmbeddedLexer, **options)
225
+
226
+ def analyse_text(text):
227
+ return '@LANG: ruby' in text
228
+
229
+
230
+ class RagelCLexer(DelegatingLexer):
231
+ """
232
+ A lexer for Ragel in a C host file.
233
+ """
234
+
235
+ name = 'Ragel in C Host'
236
+ aliases = ['ragel-c']
237
+ filenames = ['*.rl']
238
+ url = 'http://www.colm.net/open-source/ragel/'
239
+ version_added = '1.1'
240
+
241
+ def __init__(self, **options):
242
+ super().__init__(CLexer, RagelEmbeddedLexer, **options)
243
+
244
+ def analyse_text(text):
245
+ return '@LANG: c' in text
246
+
247
+
248
+ class RagelDLexer(DelegatingLexer):
249
+ """
250
+ A lexer for Ragel in a D host file.
251
+ """
252
+
253
+ name = 'Ragel in D Host'
254
+ aliases = ['ragel-d']
255
+ filenames = ['*.rl']
256
+ url = 'http://www.colm.net/open-source/ragel/'
257
+ version_added = '1.1'
258
+
259
+ def __init__(self, **options):
260
+ super().__init__(DLexer, RagelEmbeddedLexer, **options)
261
+
262
+ def analyse_text(text):
263
+ return '@LANG: d' in text
264
+
265
+
266
+ class RagelCppLexer(DelegatingLexer):
267
+ """
268
+ A lexer for Ragel in a C++ host file.
269
+ """
270
+
271
+ name = 'Ragel in CPP Host'
272
+ aliases = ['ragel-cpp']
273
+ filenames = ['*.rl']
274
+ url = 'http://www.colm.net/open-source/ragel/'
275
+ version_added = '1.1'
276
+
277
+ def __init__(self, **options):
278
+ super().__init__(CppLexer, RagelEmbeddedLexer, **options)
279
+
280
+ def analyse_text(text):
281
+ return '@LANG: c++' in text
282
+
283
+
284
+ class RagelObjectiveCLexer(DelegatingLexer):
285
+ """
286
+ A lexer for Ragel in an Objective C host file.
287
+ """
288
+
289
+ name = 'Ragel in Objective C Host'
290
+ aliases = ['ragel-objc']
291
+ filenames = ['*.rl']
292
+ url = 'http://www.colm.net/open-source/ragel/'
293
+ version_added = '1.1'
294
+
295
+ def __init__(self, **options):
296
+ super().__init__(ObjectiveCLexer, RagelEmbeddedLexer, **options)
297
+
298
+ def analyse_text(text):
299
+ return '@LANG: objc' in text
300
+
301
+
302
+ class RagelJavaLexer(DelegatingLexer):
303
+ """
304
+ A lexer for Ragel in a Java host file.
305
+ """
306
+
307
+ name = 'Ragel in Java Host'
308
+ aliases = ['ragel-java']
309
+ filenames = ['*.rl']
310
+ url = 'http://www.colm.net/open-source/ragel/'
311
+ version_added = '1.1'
312
+
313
+ def __init__(self, **options):
314
+ super().__init__(JavaLexer, RagelEmbeddedLexer, **options)
315
+
316
+ def analyse_text(text):
317
+ return '@LANG: java' in text
318
+
319
+
320
+ class AntlrLexer(RegexLexer):
321
+ """
322
+ Generic ANTLR Lexer.
323
+ Should not be called directly, instead
324
+ use DelegatingLexer for your target language.
325
+ """
326
+
327
+ name = 'ANTLR'
328
+ aliases = ['antlr']
329
+ filenames = []
330
+ url = 'https://www.antlr.org'
331
+ version_added = '1.1'
332
+
333
+ _id = r'[A-Za-z]\w*'
334
+ _TOKEN_REF = r'[A-Z]\w*'
335
+ _RULE_REF = r'[a-z]\w*'
336
+ _STRING_LITERAL = r'\'(?:\\\\|\\\'|[^\']*)\''
337
+ _INT = r'[0-9]+'
338
+
339
+ tokens = {
340
+ 'whitespace': [
341
+ (r'\s+', Whitespace),
342
+ ],
343
+ 'comments': [
344
+ (r'//.*$', Comment),
345
+ (r'/\*(.|\n)*?\*/', Comment),
346
+ ],
347
+ 'root': [
348
+ include('whitespace'),
349
+ include('comments'),
350
+
351
+ (r'(lexer|parser|tree)?(\s*)(grammar\b)(\s*)(' + _id + ')(;)',
352
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Name.Class,
353
+ Punctuation)),
354
+ # optionsSpec
355
+ (r'options\b', Keyword, 'options'),
356
+ # tokensSpec
357
+ (r'tokens\b', Keyword, 'tokens'),
358
+ # attrScope
359
+ (r'(scope)(\s*)(' + _id + r')(\s*)(\{)',
360
+ bygroups(Keyword, Whitespace, Name.Variable, Whitespace,
361
+ Punctuation), 'action'),
362
+ # exception
363
+ (r'(catch|finally)\b', Keyword, 'exception'),
364
+ # action
365
+ (r'(@' + _id + r')(\s*)(::)?(\s*)(' + _id + r')(\s*)(\{)',
366
+ bygroups(Name.Label, Whitespace, Punctuation, Whitespace,
367
+ Name.Label, Whitespace, Punctuation), 'action'),
368
+ # rule
369
+ (r'((?:protected|private|public|fragment)\b)?(\s*)(' + _id + ')(!)?',
370
+ bygroups(Keyword, Whitespace, Name.Label, Punctuation),
371
+ ('rule-alts', 'rule-prelims')),
372
+ ],
373
+ 'exception': [
374
+ (r'\n', Whitespace, '#pop'),
375
+ (r'\s', Whitespace),
376
+ include('comments'),
377
+
378
+ (r'\[', Punctuation, 'nested-arg-action'),
379
+ (r'\{', Punctuation, 'action'),
380
+ ],
381
+ 'rule-prelims': [
382
+ include('whitespace'),
383
+ include('comments'),
384
+
385
+ (r'returns\b', Keyword),
386
+ (r'\[', Punctuation, 'nested-arg-action'),
387
+ (r'\{', Punctuation, 'action'),
388
+ # throwsSpec
389
+ (r'(throws)(\s+)(' + _id + ')',
390
+ bygroups(Keyword, Whitespace, Name.Label)),
391
+ (r'(,)(\s*)(' + _id + ')',
392
+ bygroups(Punctuation, Whitespace, Name.Label)), # Additional throws
393
+ # optionsSpec
394
+ (r'options\b', Keyword, 'options'),
395
+ # ruleScopeSpec - scope followed by target language code or name of action
396
+ # TODO finish implementing other possibilities for scope
397
+ # L173 ANTLRv3.g from ANTLR book
398
+ (r'(scope)(\s+)(\{)', bygroups(Keyword, Whitespace, Punctuation),
399
+ 'action'),
400
+ (r'(scope)(\s+)(' + _id + r')(\s*)(;)',
401
+ bygroups(Keyword, Whitespace, Name.Label, Whitespace, Punctuation)),
402
+ # ruleAction
403
+ (r'(@' + _id + r')(\s*)(\{)',
404
+ bygroups(Name.Label, Whitespace, Punctuation), 'action'),
405
+ # finished prelims, go to rule alts!
406
+ (r':', Punctuation, '#pop')
407
+ ],
408
+ 'rule-alts': [
409
+ include('whitespace'),
410
+ include('comments'),
411
+
412
+ # These might need to go in a separate 'block' state triggered by (
413
+ (r'options\b', Keyword, 'options'),
414
+ (r':', Punctuation),
415
+
416
+ # literals
417
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
418
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
419
+ (r'<<([^>]|>[^>])>>', String),
420
+ # identifiers
421
+ # Tokens start with capital letter.
422
+ (r'\$?[A-Z_]\w*', Name.Constant),
423
+ # Rules start with small letter.
424
+ (r'\$?[a-z_]\w*', Name.Variable),
425
+ # operators
426
+ (r'(\+|\||->|=>|=|\(|\)|\.\.|\.|\?|\*|\^|!|\#|~)', Operator),
427
+ (r',', Punctuation),
428
+ (r'\[', Punctuation, 'nested-arg-action'),
429
+ (r'\{', Punctuation, 'action'),
430
+ (r';', Punctuation, '#pop')
431
+ ],
432
+ 'tokens': [
433
+ include('whitespace'),
434
+ include('comments'),
435
+ (r'\{', Punctuation),
436
+ (r'(' + _TOKEN_REF + r')(\s*)(=)?(\s*)(' + _STRING_LITERAL
437
+ + r')?(\s*)(;)',
438
+ bygroups(Name.Label, Whitespace, Punctuation, Whitespace,
439
+ String, Whitespace, Punctuation)),
440
+ (r'\}', Punctuation, '#pop'),
441
+ ],
442
+ 'options': [
443
+ include('whitespace'),
444
+ include('comments'),
445
+ (r'\{', Punctuation),
446
+ (r'(' + _id + r')(\s*)(=)(\s*)(' +
447
+ '|'.join((_id, _STRING_LITERAL, _INT, r'\*')) + r')(\s*)(;)',
448
+ bygroups(Name.Variable, Whitespace, Punctuation, Whitespace,
449
+ Text, Whitespace, Punctuation)),
450
+ (r'\}', Punctuation, '#pop'),
451
+ ],
452
+ 'action': [
453
+ (r'(' + r'|'.join(( # keep host code in largest possible chunks
454
+ r'[^${}\'"/\\]+', # exclude unsafe characters
455
+
456
+ # strings and comments may safely contain unsafe characters
457
+ r'"(\\\\|\\[^\\]|[^"\\])*"',
458
+ r"'(\\\\|\\[^\\]|[^'\\])*'",
459
+ r'//.*$\n?', # single line comment
460
+ r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
461
+
462
+ # regular expression: There's no reason for it to start
463
+ # with a * and this stops confusion with comments.
464
+ r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/',
465
+
466
+ # backslashes are okay, as long as we are not backslashing a %
467
+ r'\\(?!%)',
468
+
469
+ # Now that we've handled regex and javadoc comments
470
+ # it's safe to let / through.
471
+ r'/',
472
+ )) + r')+', Other),
473
+ (r'(\\)(%)', bygroups(Punctuation, Other)),
474
+ (r'(\$[a-zA-Z]+)(\.?)(text|value)?',
475
+ bygroups(Name.Variable, Punctuation, Name.Property)),
476
+ (r'\{', Punctuation, '#push'),
477
+ (r'\}', Punctuation, '#pop'),
478
+ ],
479
+ 'nested-arg-action': [
480
+ (r'(' + r'|'.join(( # keep host code in largest possible chunks.
481
+ r'[^$\[\]\'"/]+', # exclude unsafe characters
482
+
483
+ # strings and comments may safely contain unsafe characters
484
+ r'"(\\\\|\\[^\\]|[^"\\])*"',
485
+ r"'(\\\\|\\[^\\]|[^'\\])*'",
486
+ r'//.*$\n?', # single line comment
487
+ r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
488
+
489
+ # regular expression: There's no reason for it to start
490
+ # with a * and this stops confusion with comments.
491
+ r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/',
492
+
493
+ # Now that we've handled regex and javadoc comments
494
+ # it's safe to let / through.
495
+ r'/',
496
+ )) + r')+', Other),
497
+
498
+
499
+ (r'\[', Punctuation, '#push'),
500
+ (r'\]', Punctuation, '#pop'),
501
+ (r'(\$[a-zA-Z]+)(\.?)(text|value)?',
502
+ bygroups(Name.Variable, Punctuation, Name.Property)),
503
+ (r'(\\\\|\\\]|\\\[|[^\[\]])+', Other),
504
+ ]
505
+ }
506
+
507
+ def analyse_text(text):
508
+ return re.search(r'^\s*grammar\s+[a-zA-Z0-9]+\s*;', text, re.M)
509
+
510
+
511
+ # http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets
512
+
513
+ class AntlrCppLexer(DelegatingLexer):
514
+ """
515
+ ANTLR with C++ Target
516
+ """
517
+
518
+ name = 'ANTLR With CPP Target'
519
+ aliases = ['antlr-cpp']
520
+ filenames = ['*.G', '*.g']
521
+ url = 'https://www.antlr.org'
522
+ version_added = '1.1'
523
+
524
+ def __init__(self, **options):
525
+ super().__init__(CppLexer, AntlrLexer, **options)
526
+
527
+ def analyse_text(text):
528
+ return AntlrLexer.analyse_text(text) and \
529
+ re.search(r'^\s*language\s*=\s*C\s*;', text, re.M)
530
+
531
+
532
+ class AntlrObjectiveCLexer(DelegatingLexer):
533
+ """
534
+ ANTLR with Objective-C Target
535
+ """
536
+
537
+ name = 'ANTLR With ObjectiveC Target'
538
+ aliases = ['antlr-objc']
539
+ filenames = ['*.G', '*.g']
540
+ url = 'https://www.antlr.org'
541
+ version_added = '1.1'
542
+
543
+ def __init__(self, **options):
544
+ super().__init__(ObjectiveCLexer, AntlrLexer, **options)
545
+
546
+ def analyse_text(text):
547
+ return AntlrLexer.analyse_text(text) and \
548
+ re.search(r'^\s*language\s*=\s*ObjC\s*;', text)
549
+
550
+
551
+ class AntlrCSharpLexer(DelegatingLexer):
552
+ """
553
+ ANTLR with C# Target
554
+ """
555
+
556
+ name = 'ANTLR With C# Target'
557
+ aliases = ['antlr-csharp', 'antlr-c#']
558
+ filenames = ['*.G', '*.g']
559
+ url = 'https://www.antlr.org'
560
+ version_added = '1.1'
561
+
562
+ def __init__(self, **options):
563
+ super().__init__(CSharpLexer, AntlrLexer, **options)
564
+
565
+ def analyse_text(text):
566
+ return AntlrLexer.analyse_text(text) and \
567
+ re.search(r'^\s*language\s*=\s*CSharp2\s*;', text, re.M)
568
+
569
+
570
+ class AntlrPythonLexer(DelegatingLexer):
571
+ """
572
+ ANTLR with Python Target
573
+ """
574
+
575
+ name = 'ANTLR With Python Target'
576
+ aliases = ['antlr-python']
577
+ filenames = ['*.G', '*.g']
578
+ url = 'https://www.antlr.org'
579
+ version_added = '1.1'
580
+
581
+ def __init__(self, **options):
582
+ super().__init__(PythonLexer, AntlrLexer, **options)
583
+
584
+ def analyse_text(text):
585
+ return AntlrLexer.analyse_text(text) and \
586
+ re.search(r'^\s*language\s*=\s*Python\s*;', text, re.M)
587
+
588
+
589
+ class AntlrJavaLexer(DelegatingLexer):
590
+ """
591
+ ANTLR with Java Target
592
+ """
593
+
594
+ name = 'ANTLR With Java Target'
595
+ aliases = ['antlr-java']
596
+ filenames = ['*.G', '*.g']
597
+ url = 'https://www.antlr.org'
598
+ version_added = '1.1'
599
+
600
+ def __init__(self, **options):
601
+ super().__init__(JavaLexer, AntlrLexer, **options)
602
+
603
+ def analyse_text(text):
604
+ # Antlr language is Java by default
605
+ return AntlrLexer.analyse_text(text) and 0.9
606
+
607
+
608
+ class AntlrRubyLexer(DelegatingLexer):
609
+ """
610
+ ANTLR with Ruby Target
611
+ """
612
+
613
+ name = 'ANTLR With Ruby Target'
614
+ aliases = ['antlr-ruby', 'antlr-rb']
615
+ filenames = ['*.G', '*.g']
616
+ url = 'https://www.antlr.org'
617
+ version_added = '1.1'
618
+
619
+ def __init__(self, **options):
620
+ super().__init__(RubyLexer, AntlrLexer, **options)
621
+
622
+ def analyse_text(text):
623
+ return AntlrLexer.analyse_text(text) and \
624
+ re.search(r'^\s*language\s*=\s*Ruby\s*;', text, re.M)
625
+
626
+
627
+ class AntlrPerlLexer(DelegatingLexer):
628
+ """
629
+ ANTLR with Perl Target
630
+ """
631
+
632
+ name = 'ANTLR With Perl Target'
633
+ aliases = ['antlr-perl']
634
+ filenames = ['*.G', '*.g']
635
+ url = 'https://www.antlr.org'
636
+ version_added = '1.1'
637
+
638
+ def __init__(self, **options):
639
+ super().__init__(PerlLexer, AntlrLexer, **options)
640
+
641
+ def analyse_text(text):
642
+ return AntlrLexer.analyse_text(text) and \
643
+ re.search(r'^\s*language\s*=\s*Perl5\s*;', text, re.M)
644
+
645
+
646
+ class AntlrActionScriptLexer(DelegatingLexer):
647
+ """
648
+ ANTLR with ActionScript Target
649
+ """
650
+
651
+ name = 'ANTLR With ActionScript Target'
652
+ aliases = ['antlr-actionscript', 'antlr-as']
653
+ filenames = ['*.G', '*.g']
654
+ url = 'https://www.antlr.org'
655
+ version_added = '1.1'
656
+
657
+ def __init__(self, **options):
658
+ from pygments.lexers.actionscript import ActionScriptLexer
659
+ super().__init__(ActionScriptLexer, AntlrLexer, **options)
660
+
661
+ def analyse_text(text):
662
+ return AntlrLexer.analyse_text(text) and \
663
+ re.search(r'^\s*language\s*=\s*ActionScript\s*;', text, re.M)
664
+
665
+
666
+ class TreetopBaseLexer(RegexLexer):
667
+ """
668
+ A base lexer for `Treetop <http://treetop.rubyforge.org/>`_ grammars.
669
+ Not for direct use; use :class:`TreetopLexer` instead.
670
+
671
+ .. versionadded:: 1.6
672
+ """
673
+
674
+ tokens = {
675
+ 'root': [
676
+ include('space'),
677
+ (r'require[ \t]+[^\n\r]+[\n\r]', Other),
678
+ (r'module\b', Keyword.Namespace, 'module'),
679
+ (r'grammar\b', Keyword, 'grammar'),
680
+ ],
681
+ 'module': [
682
+ include('space'),
683
+ include('end'),
684
+ (r'module\b', Keyword, '#push'),
685
+ (r'grammar\b', Keyword, 'grammar'),
686
+ (r'[A-Z]\w*(?:::[A-Z]\w*)*', Name.Namespace),
687
+ ],
688
+ 'grammar': [
689
+ include('space'),
690
+ include('end'),
691
+ (r'rule\b', Keyword, 'rule'),
692
+ (r'include\b', Keyword, 'include'),
693
+ (r'[A-Z]\w*', Name),
694
+ ],
695
+ 'include': [
696
+ include('space'),
697
+ (r'[A-Z]\w*(?:::[A-Z]\w*)*', Name.Class, '#pop'),
698
+ ],
699
+ 'rule': [
700
+ include('space'),
701
+ include('end'),
702
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
703
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
704
+ (r'([A-Za-z_]\w*)(:)', bygroups(Name.Label, Punctuation)),
705
+ (r'[A-Za-z_]\w*', Name),
706
+ (r'[()]', Punctuation),
707
+ (r'[?+*/&!~]', Operator),
708
+ (r'\[(?:\\.|\[:\^?[a-z]+:\]|[^\\\]])+\]', String.Regex),
709
+ (r'([0-9]*)(\.\.)([0-9]*)',
710
+ bygroups(Number.Integer, Operator, Number.Integer)),
711
+ (r'(<)([^>]+)(>)', bygroups(Punctuation, Name.Class, Punctuation)),
712
+ (r'\{', Punctuation, 'inline_module'),
713
+ (r'\.', String.Regex),
714
+ ],
715
+ 'inline_module': [
716
+ (r'\{', Other, 'ruby'),
717
+ (r'\}', Punctuation, '#pop'),
718
+ (r'[^{}]+', Other),
719
+ ],
720
+ 'ruby': [
721
+ (r'\{', Other, '#push'),
722
+ (r'\}', Other, '#pop'),
723
+ (r'[^{}]+', Other),
724
+ ],
725
+ 'space': [
726
+ (r'[ \t\n\r]+', Whitespace),
727
+ (r'#[^\n]*', Comment.Single),
728
+ ],
729
+ 'end': [
730
+ (r'end\b', Keyword, '#pop'),
731
+ ],
732
+ }
733
+
734
+
735
+ class TreetopLexer(DelegatingLexer):
736
+ """
737
+ A lexer for Treetop grammars.
738
+ """
739
+
740
+ name = 'Treetop'
741
+ aliases = ['treetop']
742
+ filenames = ['*.treetop', '*.tt']
743
+ url = 'https://cjheath.github.io/treetop'
744
+ version_added = '1.6'
745
+
746
+ def __init__(self, **options):
747
+ super().__init__(RubyLexer, TreetopBaseLexer, **options)
748
+
749
+
750
+ class EbnfLexer(RegexLexer):
751
+ """
752
+ Lexer for `ISO/IEC 14977 EBNF
753
+ <https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form>`_
754
+ grammars.
755
+ """
756
+
757
+ name = 'EBNF'
758
+ aliases = ['ebnf']
759
+ filenames = ['*.ebnf']
760
+ mimetypes = ['text/x-ebnf']
761
+ url = 'https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form'
762
+ version_added = '2.0'
763
+
764
+ tokens = {
765
+ 'root': [
766
+ include('whitespace'),
767
+ include('comment_start'),
768
+ include('identifier'),
769
+ (r'=', Operator, 'production'),
770
+ ],
771
+ 'production': [
772
+ include('whitespace'),
773
+ include('comment_start'),
774
+ include('identifier'),
775
+ (r'"[^"]*"', String.Double),
776
+ (r"'[^']*'", String.Single),
777
+ (r'(\?[^?]*\?)', Name.Entity),
778
+ (r'[\[\]{}(),|]', Punctuation),
779
+ (r'-', Operator),
780
+ (r';', Punctuation, '#pop'),
781
+ (r'\.', Punctuation, '#pop'),
782
+ ],
783
+ 'whitespace': [
784
+ (r'\s+', Text),
785
+ ],
786
+ 'comment_start': [
787
+ (r'\(\*', Comment.Multiline, 'comment'),
788
+ ],
789
+ 'comment': [
790
+ (r'[^*)]', Comment.Multiline),
791
+ include('comment_start'),
792
+ (r'\*\)', Comment.Multiline, '#pop'),
793
+ (r'[*)]', Comment.Multiline),
794
+ ],
795
+ 'identifier': [
796
+ (r'([a-zA-Z][\w \-]*)', Keyword),
797
+ ],
798
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/pascal.py ADDED
@@ -0,0 +1,644 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.pascal
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Pascal family languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import Lexer
14
+ from pygments.util import get_bool_opt, get_list_opt
15
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Error, Whitespace
17
+ from pygments.scanner import Scanner
18
+
19
+ # compatibility import
20
+ from pygments.lexers.modula2 import Modula2Lexer # noqa: F401
21
+
22
+ __all__ = ['DelphiLexer', 'PortugolLexer']
23
+
24
+
25
+ class PortugolLexer(Lexer):
26
+ """For Portugol, a Pascal dialect with keywords in Portuguese."""
27
+ name = 'Portugol'
28
+ aliases = ['portugol']
29
+ filenames = ['*.alg', '*.portugol']
30
+ mimetypes = []
31
+ url = "https://www.apoioinformatica.inf.br/produtos/visualg/linguagem"
32
+ version_added = ''
33
+
34
+ def __init__(self, **options):
35
+ Lexer.__init__(self, **options)
36
+ self.lexer = DelphiLexer(**options, portugol=True)
37
+
38
+ def get_tokens_unprocessed(self, text):
39
+ return self.lexer.get_tokens_unprocessed(text)
40
+
41
+
42
+ class DelphiLexer(Lexer):
43
+ """
44
+ For Delphi (Borland Object Pascal),
45
+ Turbo Pascal and Free Pascal source code.
46
+
47
+ Additional options accepted:
48
+
49
+ `turbopascal`
50
+ Highlight Turbo Pascal specific keywords (default: ``True``).
51
+ `delphi`
52
+ Highlight Borland Delphi specific keywords (default: ``True``).
53
+ `freepascal`
54
+ Highlight Free Pascal specific keywords (default: ``True``).
55
+ `units`
56
+ A list of units that should be considered builtin, supported are
57
+ ``System``, ``SysUtils``, ``Classes`` and ``Math``.
58
+ Default is to consider all of them builtin.
59
+ """
60
+ name = 'Delphi'
61
+ aliases = ['delphi', 'pas', 'pascal', 'objectpascal']
62
+ filenames = ['*.pas', '*.dpr']
63
+ mimetypes = ['text/x-pascal']
64
+ url = 'https://www.embarcadero.com/products/delphi'
65
+ version_added = ''
66
+
67
+ TURBO_PASCAL_KEYWORDS = (
68
+ 'absolute', 'and', 'array', 'asm', 'begin', 'break', 'case',
69
+ 'const', 'constructor', 'continue', 'destructor', 'div', 'do',
70
+ 'downto', 'else', 'end', 'file', 'for', 'function', 'goto',
71
+ 'if', 'implementation', 'in', 'inherited', 'inline', 'interface',
72
+ 'label', 'mod', 'nil', 'not', 'object', 'of', 'on', 'operator',
73
+ 'or', 'packed', 'procedure', 'program', 'record', 'reintroduce',
74
+ 'repeat', 'self', 'set', 'shl', 'shr', 'string', 'then', 'to',
75
+ 'type', 'unit', 'until', 'uses', 'var', 'while', 'with', 'xor'
76
+ )
77
+
78
+ DELPHI_KEYWORDS = (
79
+ 'as', 'class', 'except', 'exports', 'finalization', 'finally',
80
+ 'initialization', 'is', 'library', 'on', 'property', 'raise',
81
+ 'threadvar', 'try'
82
+ )
83
+
84
+ FREE_PASCAL_KEYWORDS = (
85
+ 'dispose', 'exit', 'false', 'new', 'true'
86
+ )
87
+
88
+ BLOCK_KEYWORDS = {
89
+ 'begin', 'class', 'const', 'constructor', 'destructor', 'end',
90
+ 'finalization', 'function', 'implementation', 'initialization',
91
+ 'label', 'library', 'operator', 'procedure', 'program', 'property',
92
+ 'record', 'threadvar', 'type', 'unit', 'uses', 'var'
93
+ }
94
+
95
+ FUNCTION_MODIFIERS = {
96
+ 'alias', 'cdecl', 'export', 'inline', 'interrupt', 'nostackframe',
97
+ 'pascal', 'register', 'safecall', 'softfloat', 'stdcall',
98
+ 'varargs', 'name', 'dynamic', 'near', 'virtual', 'external',
99
+ 'override', 'assembler'
100
+ }
101
+
102
+ # XXX: those aren't global. but currently we know no way for defining
103
+ # them just for the type context.
104
+ DIRECTIVES = {
105
+ 'absolute', 'abstract', 'assembler', 'cppdecl', 'default', 'far',
106
+ 'far16', 'forward', 'index', 'oldfpccall', 'private', 'protected',
107
+ 'published', 'public'
108
+ }
109
+
110
+ BUILTIN_TYPES = {
111
+ 'ansichar', 'ansistring', 'bool', 'boolean', 'byte', 'bytebool',
112
+ 'cardinal', 'char', 'comp', 'currency', 'double', 'dword',
113
+ 'extended', 'int64', 'integer', 'iunknown', 'longbool', 'longint',
114
+ 'longword', 'pansichar', 'pansistring', 'pbool', 'pboolean',
115
+ 'pbyte', 'pbytearray', 'pcardinal', 'pchar', 'pcomp', 'pcurrency',
116
+ 'pdate', 'pdatetime', 'pdouble', 'pdword', 'pextended', 'phandle',
117
+ 'pint64', 'pinteger', 'plongint', 'plongword', 'pointer',
118
+ 'ppointer', 'pshortint', 'pshortstring', 'psingle', 'psmallint',
119
+ 'pstring', 'pvariant', 'pwidechar', 'pwidestring', 'pword',
120
+ 'pwordarray', 'pwordbool', 'real', 'real48', 'shortint',
121
+ 'shortstring', 'single', 'smallint', 'string', 'tclass', 'tdate',
122
+ 'tdatetime', 'textfile', 'thandle', 'tobject', 'ttime', 'variant',
123
+ 'widechar', 'widestring', 'word', 'wordbool'
124
+ }
125
+
126
+ BUILTIN_UNITS = {
127
+ 'System': (
128
+ 'abs', 'acquireexceptionobject', 'addr', 'ansitoutf8',
129
+ 'append', 'arctan', 'assert', 'assigned', 'assignfile',
130
+ 'beginthread', 'blockread', 'blockwrite', 'break', 'chdir',
131
+ 'chr', 'close', 'closefile', 'comptocurrency', 'comptodouble',
132
+ 'concat', 'continue', 'copy', 'cos', 'dec', 'delete',
133
+ 'dispose', 'doubletocomp', 'endthread', 'enummodules',
134
+ 'enumresourcemodules', 'eof', 'eoln', 'erase', 'exceptaddr',
135
+ 'exceptobject', 'exclude', 'exit', 'exp', 'filepos', 'filesize',
136
+ 'fillchar', 'finalize', 'findclasshinstance', 'findhinstance',
137
+ 'findresourcehinstance', 'flush', 'frac', 'freemem',
138
+ 'get8087cw', 'getdir', 'getlasterror', 'getmem',
139
+ 'getmemorymanager', 'getmodulefilename', 'getvariantmanager',
140
+ 'halt', 'hi', 'high', 'inc', 'include', 'initialize', 'insert',
141
+ 'int', 'ioresult', 'ismemorymanagerset', 'isvariantmanagerset',
142
+ 'length', 'ln', 'lo', 'low', 'mkdir', 'move', 'new', 'odd',
143
+ 'olestrtostring', 'olestrtostrvar', 'ord', 'paramcount',
144
+ 'paramstr', 'pi', 'pos', 'pred', 'ptr', 'pucs4chars', 'random',
145
+ 'randomize', 'read', 'readln', 'reallocmem',
146
+ 'releaseexceptionobject', 'rename', 'reset', 'rewrite', 'rmdir',
147
+ 'round', 'runerror', 'seek', 'seekeof', 'seekeoln',
148
+ 'set8087cw', 'setlength', 'setlinebreakstyle',
149
+ 'setmemorymanager', 'setstring', 'settextbuf',
150
+ 'setvariantmanager', 'sin', 'sizeof', 'slice', 'sqr', 'sqrt',
151
+ 'str', 'stringofchar', 'stringtoolestr', 'stringtowidechar',
152
+ 'succ', 'swap', 'trunc', 'truncate', 'typeinfo',
153
+ 'ucs4stringtowidestring', 'unicodetoutf8', 'uniquestring',
154
+ 'upcase', 'utf8decode', 'utf8encode', 'utf8toansi',
155
+ 'utf8tounicode', 'val', 'vararrayredim', 'varclear',
156
+ 'widecharlentostring', 'widecharlentostrvar',
157
+ 'widechartostring', 'widechartostrvar',
158
+ 'widestringtoucs4string', 'write', 'writeln'
159
+ ),
160
+ 'SysUtils': (
161
+ 'abort', 'addexitproc', 'addterminateproc', 'adjustlinebreaks',
162
+ 'allocmem', 'ansicomparefilename', 'ansicomparestr',
163
+ 'ansicomparetext', 'ansidequotedstr', 'ansiextractquotedstr',
164
+ 'ansilastchar', 'ansilowercase', 'ansilowercasefilename',
165
+ 'ansipos', 'ansiquotedstr', 'ansisamestr', 'ansisametext',
166
+ 'ansistrcomp', 'ansistricomp', 'ansistrlastchar', 'ansistrlcomp',
167
+ 'ansistrlicomp', 'ansistrlower', 'ansistrpos', 'ansistrrscan',
168
+ 'ansistrscan', 'ansistrupper', 'ansiuppercase',
169
+ 'ansiuppercasefilename', 'appendstr', 'assignstr', 'beep',
170
+ 'booltostr', 'bytetocharindex', 'bytetocharlen', 'bytetype',
171
+ 'callterminateprocs', 'changefileext', 'charlength',
172
+ 'chartobyteindex', 'chartobytelen', 'comparemem', 'comparestr',
173
+ 'comparetext', 'createdir', 'createguid', 'currentyear',
174
+ 'currtostr', 'currtostrf', 'date', 'datetimetofiledate',
175
+ 'datetimetostr', 'datetimetostring', 'datetimetosystemtime',
176
+ 'datetimetotimestamp', 'datetostr', 'dayofweek', 'decodedate',
177
+ 'decodedatefully', 'decodetime', 'deletefile', 'directoryexists',
178
+ 'diskfree', 'disksize', 'disposestr', 'encodedate', 'encodetime',
179
+ 'exceptionerrormessage', 'excludetrailingbackslash',
180
+ 'excludetrailingpathdelimiter', 'expandfilename',
181
+ 'expandfilenamecase', 'expanduncfilename', 'extractfiledir',
182
+ 'extractfiledrive', 'extractfileext', 'extractfilename',
183
+ 'extractfilepath', 'extractrelativepath', 'extractshortpathname',
184
+ 'fileage', 'fileclose', 'filecreate', 'filedatetodatetime',
185
+ 'fileexists', 'filegetattr', 'filegetdate', 'fileisreadonly',
186
+ 'fileopen', 'fileread', 'filesearch', 'fileseek', 'filesetattr',
187
+ 'filesetdate', 'filesetreadonly', 'filewrite', 'finalizepackage',
188
+ 'findclose', 'findcmdlineswitch', 'findfirst', 'findnext',
189
+ 'floattocurr', 'floattodatetime', 'floattodecimal', 'floattostr',
190
+ 'floattostrf', 'floattotext', 'floattotextfmt', 'fmtloadstr',
191
+ 'fmtstr', 'forcedirectories', 'format', 'formatbuf', 'formatcurr',
192
+ 'formatdatetime', 'formatfloat', 'freeandnil', 'getcurrentdir',
193
+ 'getenvironmentvariable', 'getfileversion', 'getformatsettings',
194
+ 'getlocaleformatsettings', 'getmodulename', 'getpackagedescription',
195
+ 'getpackageinfo', 'gettime', 'guidtostring', 'incamonth',
196
+ 'includetrailingbackslash', 'includetrailingpathdelimiter',
197
+ 'incmonth', 'initializepackage', 'interlockeddecrement',
198
+ 'interlockedexchange', 'interlockedexchangeadd',
199
+ 'interlockedincrement', 'inttohex', 'inttostr', 'isdelimiter',
200
+ 'isequalguid', 'isleapyear', 'ispathdelimiter', 'isvalidident',
201
+ 'languages', 'lastdelimiter', 'loadpackage', 'loadstr',
202
+ 'lowercase', 'msecstotimestamp', 'newstr', 'nextcharindex', 'now',
203
+ 'outofmemoryerror', 'quotedstr', 'raiselastoserror',
204
+ 'raiselastwin32error', 'removedir', 'renamefile', 'replacedate',
205
+ 'replacetime', 'safeloadlibrary', 'samefilename', 'sametext',
206
+ 'setcurrentdir', 'showexception', 'sleep', 'stralloc', 'strbufsize',
207
+ 'strbytetype', 'strcat', 'strcharlength', 'strcomp', 'strcopy',
208
+ 'strdispose', 'strecopy', 'strend', 'strfmt', 'stricomp',
209
+ 'stringreplace', 'stringtoguid', 'strlcat', 'strlcomp', 'strlcopy',
210
+ 'strlen', 'strlfmt', 'strlicomp', 'strlower', 'strmove', 'strnew',
211
+ 'strnextchar', 'strpas', 'strpcopy', 'strplcopy', 'strpos',
212
+ 'strrscan', 'strscan', 'strtobool', 'strtobooldef', 'strtocurr',
213
+ 'strtocurrdef', 'strtodate', 'strtodatedef', 'strtodatetime',
214
+ 'strtodatetimedef', 'strtofloat', 'strtofloatdef', 'strtoint',
215
+ 'strtoint64', 'strtoint64def', 'strtointdef', 'strtotime',
216
+ 'strtotimedef', 'strupper', 'supports', 'syserrormessage',
217
+ 'systemtimetodatetime', 'texttofloat', 'time', 'timestamptodatetime',
218
+ 'timestamptomsecs', 'timetostr', 'trim', 'trimleft', 'trimright',
219
+ 'tryencodedate', 'tryencodetime', 'tryfloattocurr', 'tryfloattodatetime',
220
+ 'trystrtobool', 'trystrtocurr', 'trystrtodate', 'trystrtodatetime',
221
+ 'trystrtofloat', 'trystrtoint', 'trystrtoint64', 'trystrtotime',
222
+ 'unloadpackage', 'uppercase', 'widecomparestr', 'widecomparetext',
223
+ 'widefmtstr', 'wideformat', 'wideformatbuf', 'widelowercase',
224
+ 'widesamestr', 'widesametext', 'wideuppercase', 'win32check',
225
+ 'wraptext'
226
+ ),
227
+ 'Classes': (
228
+ 'activateclassgroup', 'allocatehwnd', 'bintohex', 'checksynchronize',
229
+ 'collectionsequal', 'countgenerations', 'deallocatehwnd', 'equalrect',
230
+ 'extractstrings', 'findclass', 'findglobalcomponent', 'getclass',
231
+ 'groupdescendantswith', 'hextobin', 'identtoint',
232
+ 'initinheritedcomponent', 'inttoident', 'invalidpoint',
233
+ 'isuniqueglobalcomponentname', 'linestart', 'objectbinarytotext',
234
+ 'objectresourcetotext', 'objecttexttobinary', 'objecttexttoresource',
235
+ 'pointsequal', 'readcomponentres', 'readcomponentresex',
236
+ 'readcomponentresfile', 'rect', 'registerclass', 'registerclassalias',
237
+ 'registerclasses', 'registercomponents', 'registerintegerconsts',
238
+ 'registernoicon', 'registernonactivex', 'smallpoint', 'startclassgroup',
239
+ 'teststreamformat', 'unregisterclass', 'unregisterclasses',
240
+ 'unregisterintegerconsts', 'unregistermoduleclasses',
241
+ 'writecomponentresfile'
242
+ ),
243
+ 'Math': (
244
+ 'arccos', 'arccosh', 'arccot', 'arccoth', 'arccsc', 'arccsch', 'arcsec',
245
+ 'arcsech', 'arcsin', 'arcsinh', 'arctan2', 'arctanh', 'ceil',
246
+ 'comparevalue', 'cosecant', 'cosh', 'cot', 'cotan', 'coth', 'csc',
247
+ 'csch', 'cycletodeg', 'cycletograd', 'cycletorad', 'degtocycle',
248
+ 'degtograd', 'degtorad', 'divmod', 'doubledecliningbalance',
249
+ 'ensurerange', 'floor', 'frexp', 'futurevalue', 'getexceptionmask',
250
+ 'getprecisionmode', 'getroundmode', 'gradtocycle', 'gradtodeg',
251
+ 'gradtorad', 'hypot', 'inrange', 'interestpayment', 'interestrate',
252
+ 'internalrateofreturn', 'intpower', 'isinfinite', 'isnan', 'iszero',
253
+ 'ldexp', 'lnxp1', 'log10', 'log2', 'logn', 'max', 'maxintvalue',
254
+ 'maxvalue', 'mean', 'meanandstddev', 'min', 'minintvalue', 'minvalue',
255
+ 'momentskewkurtosis', 'netpresentvalue', 'norm', 'numberofperiods',
256
+ 'payment', 'periodpayment', 'poly', 'popnstddev', 'popnvariance',
257
+ 'power', 'presentvalue', 'radtocycle', 'radtodeg', 'radtograd',
258
+ 'randg', 'randomrange', 'roundto', 'samevalue', 'sec', 'secant',
259
+ 'sech', 'setexceptionmask', 'setprecisionmode', 'setroundmode',
260
+ 'sign', 'simpleroundto', 'sincos', 'sinh', 'slndepreciation', 'stddev',
261
+ 'sum', 'sumint', 'sumofsquares', 'sumsandsquares', 'syddepreciation',
262
+ 'tan', 'tanh', 'totalvariance', 'variance'
263
+ )
264
+ }
265
+
266
+ ASM_REGISTERS = {
267
+ 'ah', 'al', 'ax', 'bh', 'bl', 'bp', 'bx', 'ch', 'cl', 'cr0',
268
+ 'cr1', 'cr2', 'cr3', 'cr4', 'cs', 'cx', 'dh', 'di', 'dl', 'dr0',
269
+ 'dr1', 'dr2', 'dr3', 'dr4', 'dr5', 'dr6', 'dr7', 'ds', 'dx',
270
+ 'eax', 'ebp', 'ebx', 'ecx', 'edi', 'edx', 'es', 'esi', 'esp',
271
+ 'fs', 'gs', 'mm0', 'mm1', 'mm2', 'mm3', 'mm4', 'mm5', 'mm6',
272
+ 'mm7', 'si', 'sp', 'ss', 'st0', 'st1', 'st2', 'st3', 'st4', 'st5',
273
+ 'st6', 'st7', 'xmm0', 'xmm1', 'xmm2', 'xmm3', 'xmm4', 'xmm5',
274
+ 'xmm6', 'xmm7'
275
+ }
276
+
277
+ ASM_INSTRUCTIONS = {
278
+ 'aaa', 'aad', 'aam', 'aas', 'adc', 'add', 'and', 'arpl', 'bound',
279
+ 'bsf', 'bsr', 'bswap', 'bt', 'btc', 'btr', 'bts', 'call', 'cbw',
280
+ 'cdq', 'clc', 'cld', 'cli', 'clts', 'cmc', 'cmova', 'cmovae',
281
+ 'cmovb', 'cmovbe', 'cmovc', 'cmovcxz', 'cmove', 'cmovg',
282
+ 'cmovge', 'cmovl', 'cmovle', 'cmovna', 'cmovnae', 'cmovnb',
283
+ 'cmovnbe', 'cmovnc', 'cmovne', 'cmovng', 'cmovnge', 'cmovnl',
284
+ 'cmovnle', 'cmovno', 'cmovnp', 'cmovns', 'cmovnz', 'cmovo',
285
+ 'cmovp', 'cmovpe', 'cmovpo', 'cmovs', 'cmovz', 'cmp', 'cmpsb',
286
+ 'cmpsd', 'cmpsw', 'cmpxchg', 'cmpxchg486', 'cmpxchg8b', 'cpuid',
287
+ 'cwd', 'cwde', 'daa', 'das', 'dec', 'div', 'emms', 'enter', 'hlt',
288
+ 'ibts', 'icebp', 'idiv', 'imul', 'in', 'inc', 'insb', 'insd',
289
+ 'insw', 'int', 'int01', 'int03', 'int1', 'int3', 'into', 'invd',
290
+ 'invlpg', 'iret', 'iretd', 'iretw', 'ja', 'jae', 'jb', 'jbe',
291
+ 'jc', 'jcxz', 'jcxz', 'je', 'jecxz', 'jg', 'jge', 'jl', 'jle',
292
+ 'jmp', 'jna', 'jnae', 'jnb', 'jnbe', 'jnc', 'jne', 'jng', 'jnge',
293
+ 'jnl', 'jnle', 'jno', 'jnp', 'jns', 'jnz', 'jo', 'jp', 'jpe',
294
+ 'jpo', 'js', 'jz', 'lahf', 'lar', 'lcall', 'lds', 'lea', 'leave',
295
+ 'les', 'lfs', 'lgdt', 'lgs', 'lidt', 'ljmp', 'lldt', 'lmsw',
296
+ 'loadall', 'loadall286', 'lock', 'lodsb', 'lodsd', 'lodsw',
297
+ 'loop', 'loope', 'loopne', 'loopnz', 'loopz', 'lsl', 'lss', 'ltr',
298
+ 'mov', 'movd', 'movq', 'movsb', 'movsd', 'movsw', 'movsx',
299
+ 'movzx', 'mul', 'neg', 'nop', 'not', 'or', 'out', 'outsb', 'outsd',
300
+ 'outsw', 'pop', 'popa', 'popad', 'popaw', 'popf', 'popfd', 'popfw',
301
+ 'push', 'pusha', 'pushad', 'pushaw', 'pushf', 'pushfd', 'pushfw',
302
+ 'rcl', 'rcr', 'rdmsr', 'rdpmc', 'rdshr', 'rdtsc', 'rep', 'repe',
303
+ 'repne', 'repnz', 'repz', 'ret', 'retf', 'retn', 'rol', 'ror',
304
+ 'rsdc', 'rsldt', 'rsm', 'sahf', 'sal', 'salc', 'sar', 'sbb',
305
+ 'scasb', 'scasd', 'scasw', 'seta', 'setae', 'setb', 'setbe',
306
+ 'setc', 'setcxz', 'sete', 'setg', 'setge', 'setl', 'setle',
307
+ 'setna', 'setnae', 'setnb', 'setnbe', 'setnc', 'setne', 'setng',
308
+ 'setnge', 'setnl', 'setnle', 'setno', 'setnp', 'setns', 'setnz',
309
+ 'seto', 'setp', 'setpe', 'setpo', 'sets', 'setz', 'sgdt', 'shl',
310
+ 'shld', 'shr', 'shrd', 'sidt', 'sldt', 'smi', 'smint', 'smintold',
311
+ 'smsw', 'stc', 'std', 'sti', 'stosb', 'stosd', 'stosw', 'str',
312
+ 'sub', 'svdc', 'svldt', 'svts', 'syscall', 'sysenter', 'sysexit',
313
+ 'sysret', 'test', 'ud1', 'ud2', 'umov', 'verr', 'verw', 'wait',
314
+ 'wbinvd', 'wrmsr', 'wrshr', 'xadd', 'xbts', 'xchg', 'xlat',
315
+ 'xlatb', 'xor'
316
+ }
317
+
318
+ PORTUGOL_KEYWORDS = (
319
+ 'aleatorio',
320
+ 'algoritmo',
321
+ 'arquivo',
322
+ 'ate',
323
+ 'caso',
324
+ 'cronometro',
325
+ 'debug',
326
+ 'e',
327
+ 'eco',
328
+ 'enquanto',
329
+ 'entao',
330
+ 'escolha',
331
+ 'escreva',
332
+ 'escreval',
333
+ 'faca',
334
+ 'falso',
335
+ 'fimalgoritmo',
336
+ 'fimenquanto',
337
+ 'fimescolha',
338
+ 'fimfuncao',
339
+ 'fimpara',
340
+ 'fimprocedimento',
341
+ 'fimrepita',
342
+ 'fimse',
343
+ 'funcao',
344
+ 'inicio',
345
+ 'int',
346
+ 'interrompa',
347
+ 'leia',
348
+ 'limpatela',
349
+ 'mod',
350
+ 'nao',
351
+ 'ou',
352
+ 'outrocaso',
353
+ 'para',
354
+ 'passo',
355
+ 'pausa',
356
+ 'procedimento',
357
+ 'repita',
358
+ 'retorne',
359
+ 'se',
360
+ 'senao',
361
+ 'timer',
362
+ 'var',
363
+ 'vetor',
364
+ 'verdadeiro',
365
+ 'xou',
366
+ 'div',
367
+ 'mod',
368
+ 'abs',
369
+ 'arccos',
370
+ 'arcsen',
371
+ 'arctan',
372
+ 'cos',
373
+ 'cotan',
374
+ 'Exp',
375
+ 'grauprad',
376
+ 'int',
377
+ 'log',
378
+ 'logn',
379
+ 'pi',
380
+ 'quad',
381
+ 'radpgrau',
382
+ 'raizq',
383
+ 'rand',
384
+ 'randi',
385
+ 'sen',
386
+ 'Tan',
387
+ 'asc',
388
+ 'carac',
389
+ 'caracpnum',
390
+ 'compr',
391
+ 'copia',
392
+ 'maiusc',
393
+ 'minusc',
394
+ 'numpcarac',
395
+ 'pos',
396
+ )
397
+
398
+ PORTUGOL_BUILTIN_TYPES = {
399
+ 'inteiro', 'real', 'caractere', 'logico'
400
+ }
401
+
402
+ def __init__(self, **options):
403
+ Lexer.__init__(self, **options)
404
+ self.keywords = set()
405
+ self.builtins = set()
406
+ if get_bool_opt(options, 'portugol', False):
407
+ self.keywords.update(self.PORTUGOL_KEYWORDS)
408
+ self.builtins.update(self.PORTUGOL_BUILTIN_TYPES)
409
+ self.is_portugol = True
410
+ else:
411
+ self.is_portugol = False
412
+
413
+ if get_bool_opt(options, 'turbopascal', True):
414
+ self.keywords.update(self.TURBO_PASCAL_KEYWORDS)
415
+ if get_bool_opt(options, 'delphi', True):
416
+ self.keywords.update(self.DELPHI_KEYWORDS)
417
+ if get_bool_opt(options, 'freepascal', True):
418
+ self.keywords.update(self.FREE_PASCAL_KEYWORDS)
419
+ for unit in get_list_opt(options, 'units', list(self.BUILTIN_UNITS)):
420
+ self.builtins.update(self.BUILTIN_UNITS[unit])
421
+
422
+ def get_tokens_unprocessed(self, text):
423
+ scanner = Scanner(text, re.DOTALL | re.MULTILINE | re.IGNORECASE)
424
+ stack = ['initial']
425
+ in_function_block = False
426
+ in_property_block = False
427
+ was_dot = False
428
+ next_token_is_function = False
429
+ next_token_is_property = False
430
+ collect_labels = False
431
+ block_labels = set()
432
+ brace_balance = [0, 0]
433
+
434
+ while not scanner.eos:
435
+ token = Error
436
+
437
+ if stack[-1] == 'initial':
438
+ if scanner.scan(r'\s+'):
439
+ token = Whitespace
440
+ elif not self.is_portugol and scanner.scan(r'\{.*?\}|\(\*.*?\*\)'):
441
+ if scanner.match.startswith('$'):
442
+ token = Comment.Preproc
443
+ else:
444
+ token = Comment.Multiline
445
+ elif scanner.scan(r'//.*?$'):
446
+ token = Comment.Single
447
+ elif self.is_portugol and scanner.scan(r'(<\-)|(>=)|(<=)|%|<|>|-|\+|\*|\=|(<>)|\/|\.|:|,'):
448
+ token = Operator
449
+ elif not self.is_portugol and scanner.scan(r'[-+*\/=<>:;,.@\^]'):
450
+ token = Operator
451
+ # stop label highlighting on next ";"
452
+ if collect_labels and scanner.match == ';':
453
+ collect_labels = False
454
+ elif scanner.scan(r'[\(\)\[\]]+'):
455
+ token = Punctuation
456
+ # abort function naming ``foo = Function(...)``
457
+ next_token_is_function = False
458
+ # if we are in a function block we count the open
459
+ # braces because ootherwise it's impossible to
460
+ # determine the end of the modifier context
461
+ if in_function_block or in_property_block:
462
+ if scanner.match == '(':
463
+ brace_balance[0] += 1
464
+ elif scanner.match == ')':
465
+ brace_balance[0] -= 1
466
+ elif scanner.match == '[':
467
+ brace_balance[1] += 1
468
+ elif scanner.match == ']':
469
+ brace_balance[1] -= 1
470
+ elif scanner.scan(r'[A-Za-z_][A-Za-z_0-9]*'):
471
+ lowercase_name = scanner.match.lower()
472
+ if lowercase_name == 'result':
473
+ token = Name.Builtin.Pseudo
474
+ elif lowercase_name in self.keywords:
475
+ token = Keyword
476
+ # if we are in a special block and a
477
+ # block ending keyword occurs (and the parenthesis
478
+ # is balanced) we end the current block context
479
+ if self.is_portugol:
480
+ if lowercase_name in ('funcao', 'procedimento'):
481
+ in_function_block = True
482
+ next_token_is_function = True
483
+ else:
484
+ if (in_function_block or in_property_block) and \
485
+ lowercase_name in self.BLOCK_KEYWORDS and \
486
+ brace_balance[0] <= 0 and \
487
+ brace_balance[1] <= 0:
488
+ in_function_block = False
489
+ in_property_block = False
490
+ brace_balance = [0, 0]
491
+ block_labels = set()
492
+ if lowercase_name in ('label', 'goto'):
493
+ collect_labels = True
494
+ elif lowercase_name == 'asm':
495
+ stack.append('asm')
496
+ elif lowercase_name == 'property':
497
+ in_property_block = True
498
+ next_token_is_property = True
499
+ elif lowercase_name in ('procedure', 'operator',
500
+ 'function', 'constructor',
501
+ 'destructor'):
502
+ in_function_block = True
503
+ next_token_is_function = True
504
+ # we are in a function block and the current name
505
+ # is in the set of registered modifiers. highlight
506
+ # it as pseudo keyword
507
+ elif not self.is_portugol and in_function_block and \
508
+ lowercase_name in self.FUNCTION_MODIFIERS:
509
+ token = Keyword.Pseudo
510
+ # if we are in a property highlight some more
511
+ # modifiers
512
+ elif not self.is_portugol and in_property_block and \
513
+ lowercase_name in ('read', 'write'):
514
+ token = Keyword.Pseudo
515
+ next_token_is_function = True
516
+ # if the last iteration set next_token_is_function
517
+ # to true we now want this name highlighted as
518
+ # function. so do that and reset the state
519
+ elif next_token_is_function:
520
+ # Look if the next token is a dot. If yes it's
521
+ # not a function, but a class name and the
522
+ # part after the dot a function name
523
+ if not self.is_portugol and scanner.test(r'\s*\.\s*'):
524
+ token = Name.Class
525
+ # it's not a dot, our job is done
526
+ else:
527
+ token = Name.Function
528
+ next_token_is_function = False
529
+
530
+ if self.is_portugol:
531
+ block_labels.add(scanner.match.lower())
532
+
533
+ # same for properties
534
+ elif not self.is_portugol and next_token_is_property:
535
+ token = Name.Property
536
+ next_token_is_property = False
537
+ # Highlight this token as label and add it
538
+ # to the list of known labels
539
+ elif not self.is_portugol and collect_labels:
540
+ token = Name.Label
541
+ block_labels.add(scanner.match.lower())
542
+ # name is in list of known labels
543
+ elif lowercase_name in block_labels:
544
+ token = Name.Label
545
+ elif self.is_portugol and lowercase_name in self.PORTUGOL_BUILTIN_TYPES:
546
+ token = Keyword.Type
547
+ elif not self.is_portugol and lowercase_name in self.BUILTIN_TYPES:
548
+ token = Keyword.Type
549
+ elif not self.is_portugol and lowercase_name in self.DIRECTIVES:
550
+ token = Keyword.Pseudo
551
+ # builtins are just builtins if the token
552
+ # before isn't a dot
553
+ elif not self.is_portugol and not was_dot and lowercase_name in self.builtins:
554
+ token = Name.Builtin
555
+ else:
556
+ token = Name
557
+ elif self.is_portugol and scanner.scan(r"\""):
558
+ token = String
559
+ stack.append('string')
560
+ elif not self.is_portugol and scanner.scan(r"'"):
561
+ token = String
562
+ stack.append('string')
563
+ elif not self.is_portugol and scanner.scan(r'\#(\d+|\$[0-9A-Fa-f]+)'):
564
+ token = String.Char
565
+ elif not self.is_portugol and scanner.scan(r'\$[0-9A-Fa-f]+'):
566
+ token = Number.Hex
567
+ elif scanner.scan(r'\d+(?![eE]|\.[^.])'):
568
+ token = Number.Integer
569
+ elif scanner.scan(r'\d+(\.\d+([eE][+-]?\d+)?|[eE][+-]?\d+)'):
570
+ token = Number.Float
571
+ else:
572
+ # if the stack depth is deeper than once, pop
573
+ if len(stack) > 1:
574
+ stack.pop()
575
+ scanner.get_char()
576
+
577
+ elif stack[-1] == 'string':
578
+ if self.is_portugol:
579
+ if scanner.scan(r"''"):
580
+ token = String.Escape
581
+ elif scanner.scan(r"\""):
582
+ token = String
583
+ stack.pop()
584
+ elif scanner.scan(r"[^\"]*"):
585
+ token = String
586
+ else:
587
+ scanner.get_char()
588
+ stack.pop()
589
+ else:
590
+ if scanner.scan(r"''"):
591
+ token = String.Escape
592
+ elif scanner.scan(r"'"):
593
+ token = String
594
+ stack.pop()
595
+ elif scanner.scan(r"[^']*"):
596
+ token = String
597
+ else:
598
+ scanner.get_char()
599
+ stack.pop()
600
+ elif not self.is_portugol and stack[-1] == 'asm':
601
+ if scanner.scan(r'\s+'):
602
+ token = Whitespace
603
+ elif scanner.scan(r'end'):
604
+ token = Keyword
605
+ stack.pop()
606
+ elif scanner.scan(r'\{.*?\}|\(\*.*?\*\)'):
607
+ if scanner.match.startswith('$'):
608
+ token = Comment.Preproc
609
+ else:
610
+ token = Comment.Multiline
611
+ elif scanner.scan(r'//.*?$'):
612
+ token = Comment.Single
613
+ elif scanner.scan(r"'"):
614
+ token = String
615
+ stack.append('string')
616
+ elif scanner.scan(r'@@[A-Za-z_][A-Za-z_0-9]*'):
617
+ token = Name.Label
618
+ elif scanner.scan(r'[A-Za-z_][A-Za-z_0-9]*'):
619
+ lowercase_name = scanner.match.lower()
620
+ if lowercase_name in self.ASM_INSTRUCTIONS:
621
+ token = Keyword
622
+ elif lowercase_name in self.ASM_REGISTERS:
623
+ token = Name.Builtin
624
+ else:
625
+ token = Name
626
+ elif scanner.scan(r'[-+*\/=<>:;,.@\^]+'):
627
+ token = Operator
628
+ elif scanner.scan(r'[\(\)\[\]]+'):
629
+ token = Punctuation
630
+ elif scanner.scan(r'\$[0-9A-Fa-f]+'):
631
+ token = Number.Hex
632
+ elif scanner.scan(r'\d+(?![eE]|\.[^.])'):
633
+ token = Number.Integer
634
+ elif scanner.scan(r'\d+(\.\d+([eE][+-]?\d+)?|[eE][+-]?\d+)'):
635
+ token = Number.Float
636
+ else:
637
+ scanner.get_char()
638
+ stack.pop()
639
+
640
+ # save the dot!!!11
641
+ if not self.is_portugol and scanner.match.strip():
642
+ was_dot = scanner.match == '.'
643
+
644
+ yield scanner.start_pos, token, scanner.match or ''
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/pawn.py ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.pawn
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Pawn languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation
14
+ from pygments.util import get_bool_opt
15
+
16
+ __all__ = ['SourcePawnLexer', 'PawnLexer']
17
+
18
+
19
+ class SourcePawnLexer(RegexLexer):
20
+ """
21
+ For SourcePawn source code with preprocessor directives.
22
+ """
23
+ name = 'SourcePawn'
24
+ aliases = ['sp']
25
+ filenames = ['*.sp']
26
+ mimetypes = ['text/x-sourcepawn']
27
+ url = 'https://github.com/alliedmodders/sourcepawn'
28
+ version_added = '1.6'
29
+
30
+ #: optional Comment or Whitespace
31
+ _ws = r'(?:\s|//.*?\n|/\*.*?\*/)+'
32
+ #: only one /* */ style comment
33
+ _ws1 = r'\s*(?:/[*].*?[*]/\s*)*'
34
+
35
+ tokens = {
36
+ 'root': [
37
+ # preprocessor directives: without whitespace
38
+ (r'^#if\s+0', Comment.Preproc, 'if0'),
39
+ ('^#', Comment.Preproc, 'macro'),
40
+ # or with whitespace
41
+ ('^' + _ws1 + r'#if\s+0', Comment.Preproc, 'if0'),
42
+ ('^' + _ws1 + '#', Comment.Preproc, 'macro'),
43
+ (r'\n', Text),
44
+ (r'\s+', Text),
45
+ (r'\\\n', Text), # line continuation
46
+ (r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
47
+ (r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline),
48
+ (r'[{}]', Punctuation),
49
+ (r'L?"', String, 'string'),
50
+ (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
51
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
52
+ (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
53
+ (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
54
+ (r'0[0-7]+[LlUu]*', Number.Oct),
55
+ (r'\d+[LlUu]*', Number.Integer),
56
+ (r'[~!%^&*+=|?:<>/-]', Operator),
57
+ (r'[()\[\],.;]', Punctuation),
58
+ (r'(case|const|continue|native|'
59
+ r'default|else|enum|for|if|new|operator|'
60
+ r'public|return|sizeof|static|decl|struct|switch)\b', Keyword),
61
+ (r'(bool|Float)\b', Keyword.Type),
62
+ (r'(true|false)\b', Keyword.Constant),
63
+ (r'[a-zA-Z_]\w*', Name),
64
+ ],
65
+ 'string': [
66
+ (r'"', String, '#pop'),
67
+ (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
68
+ (r'[^\\"\n]+', String), # all other characters
69
+ (r'\\\n', String), # line continuation
70
+ (r'\\', String), # stray backslash
71
+ ],
72
+ 'macro': [
73
+ (r'[^/\n]+', Comment.Preproc),
74
+ (r'/\*(.|\n)*?\*/', Comment.Multiline),
75
+ (r'//.*?\n', Comment.Single, '#pop'),
76
+ (r'/', Comment.Preproc),
77
+ (r'(?<=\\)\n', Comment.Preproc),
78
+ (r'\n', Comment.Preproc, '#pop'),
79
+ ],
80
+ 'if0': [
81
+ (r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
82
+ (r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
83
+ (r'.*?\n', Comment),
84
+ ]
85
+ }
86
+
87
+ SM_TYPES = {'Action', 'bool', 'Float', 'Plugin', 'String', 'any',
88
+ 'AdminFlag', 'OverrideType', 'OverrideRule', 'ImmunityType',
89
+ 'GroupId', 'AdminId', 'AdmAccessMode', 'AdminCachePart',
90
+ 'CookieAccess', 'CookieMenu', 'CookieMenuAction', 'NetFlow',
91
+ 'ConVarBounds', 'QueryCookie', 'ReplySource',
92
+ 'ConVarQueryResult', 'ConVarQueryFinished', 'Function',
93
+ 'Action', 'Identity', 'PluginStatus', 'PluginInfo', 'DBResult',
94
+ 'DBBindType', 'DBPriority', 'PropType', 'PropFieldType',
95
+ 'MoveType', 'RenderMode', 'RenderFx', 'EventHookMode',
96
+ 'EventHook', 'FileType', 'FileTimeMode', 'PathType',
97
+ 'ParamType', 'ExecType', 'DialogType', 'Handle', 'KvDataTypes',
98
+ 'NominateResult', 'MapChange', 'MenuStyle', 'MenuAction',
99
+ 'MenuSource', 'RegexError', 'SDKCallType', 'SDKLibrary',
100
+ 'SDKFuncConfSource', 'SDKType', 'SDKPassMethod', 'RayType',
101
+ 'TraceEntityFilter', 'ListenOverride', 'SortOrder', 'SortType',
102
+ 'SortFunc2D', 'APLRes', 'FeatureType', 'FeatureStatus',
103
+ 'SMCResult', 'SMCError', 'TFClassType', 'TFTeam', 'TFCond',
104
+ 'TFResourceType', 'Timer', 'TopMenuAction', 'TopMenuObjectType',
105
+ 'TopMenuPosition', 'TopMenuObject', 'UserMsg'}
106
+
107
+ def __init__(self, **options):
108
+ self.smhighlighting = get_bool_opt(options,
109
+ 'sourcemod', True)
110
+
111
+ self._functions = set()
112
+ if self.smhighlighting:
113
+ from pygments.lexers._sourcemod_builtins import FUNCTIONS
114
+ self._functions.update(FUNCTIONS)
115
+ RegexLexer.__init__(self, **options)
116
+
117
+ def get_tokens_unprocessed(self, text):
118
+ for index, token, value in \
119
+ RegexLexer.get_tokens_unprocessed(self, text):
120
+ if token is Name:
121
+ if self.smhighlighting:
122
+ if value in self.SM_TYPES:
123
+ token = Keyword.Type
124
+ elif value in self._functions:
125
+ token = Name.Builtin
126
+ yield index, token, value
127
+
128
+
129
+ class PawnLexer(RegexLexer):
130
+ """
131
+ For Pawn source code.
132
+ """
133
+
134
+ name = 'Pawn'
135
+ aliases = ['pawn']
136
+ filenames = ['*.p', '*.pwn', '*.inc']
137
+ mimetypes = ['text/x-pawn']
138
+ url = 'https://www.compuphase.com/pawn/pawn.htm'
139
+ version_added = '2.0'
140
+
141
+ #: optional Comment or Whitespace
142
+ _ws = r'(?:\s|//.*?\n|/[*][\w\W]*?[*]/)+'
143
+ #: only one /* */ style comment
144
+ _ws1 = r'\s*(?:/[*].*?[*]/\s*)*'
145
+
146
+ tokens = {
147
+ 'root': [
148
+ # preprocessor directives: without whitespace
149
+ (r'^#if\s+0', Comment.Preproc, 'if0'),
150
+ ('^#', Comment.Preproc, 'macro'),
151
+ # or with whitespace
152
+ ('^' + _ws1 + r'#if\s+0', Comment.Preproc, 'if0'),
153
+ ('^' + _ws1 + '#', Comment.Preproc, 'macro'),
154
+ (r'\n', Text),
155
+ (r'\s+', Text),
156
+ (r'\\\n', Text), # line continuation
157
+ (r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
158
+ (r'/(\\\n)?\*[\w\W]*?\*(\\\n)?/', Comment.Multiline),
159
+ (r'[{}]', Punctuation),
160
+ (r'L?"', String, 'string'),
161
+ (r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
162
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
163
+ (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
164
+ (r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
165
+ (r'0[0-7]+[LlUu]*', Number.Oct),
166
+ (r'\d+[LlUu]*', Number.Integer),
167
+ (r'[~!%^&*+=|?:<>/-]', Operator),
168
+ (r'[()\[\],.;]', Punctuation),
169
+ (r'(switch|case|default|const|new|static|char|continue|break|'
170
+ r'if|else|for|while|do|operator|enum|'
171
+ r'public|return|sizeof|tagof|state|goto)\b', Keyword),
172
+ (r'(bool|Float)\b', Keyword.Type),
173
+ (r'(true|false)\b', Keyword.Constant),
174
+ (r'[a-zA-Z_]\w*', Name),
175
+ ],
176
+ 'string': [
177
+ (r'"', String, '#pop'),
178
+ (r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
179
+ (r'[^\\"\n]+', String), # all other characters
180
+ (r'\\\n', String), # line continuation
181
+ (r'\\', String), # stray backslash
182
+ ],
183
+ 'macro': [
184
+ (r'[^/\n]+', Comment.Preproc),
185
+ (r'/\*(.|\n)*?\*/', Comment.Multiline),
186
+ (r'//.*?\n', Comment.Single, '#pop'),
187
+ (r'/', Comment.Preproc),
188
+ (r'(?<=\\)\n', Comment.Preproc),
189
+ (r'\n', Comment.Preproc, '#pop'),
190
+ ],
191
+ 'if0': [
192
+ (r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
193
+ (r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
194
+ (r'.*?\n', Comment),
195
+ ]
196
+ }
197
+
198
+ def analyse_text(text):
199
+ """This is basically C. There is a keyword which doesn't exist in C
200
+ though and is nearly unique to this language."""
201
+ if 'tagof' in text:
202
+ return 0.01
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/pddl.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.pddl
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Planning Domain Definition Language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+
12
+ from pygments.lexer import RegexLexer, words, include
13
+ from pygments.token import Punctuation, Keyword, Whitespace, Name, Comment, \
14
+ Operator, Number
15
+
16
+
17
+ __all__ = ['PddlLexer']
18
+
19
+
20
+ class PddlLexer(RegexLexer):
21
+ """
22
+ A PDDL lexer.
23
+
24
+ It should support up to PDDL 3.1.
25
+ """
26
+
27
+ name = 'PDDL'
28
+ aliases = ['pddl']
29
+ filenames = ['*.pddl']
30
+ # there doesn't really seem to be a PDDL homepage.
31
+ url = 'https://en.wikipedia.org/wiki/Planning_Domain_Definition_Language'
32
+ version_added = '2.19'
33
+
34
+ tokens = {
35
+ 'root': [
36
+ (r'\s+', Whitespace),
37
+ (r';.*$', Comment.Singleline),
38
+ include('keywords'),
39
+ include('builtins'),
40
+ (r'[()]', Punctuation),
41
+ (r'[=/*+><-]', Operator),
42
+ (r'[a-zA-Z][a-zA-Z0-9_-]*', Name),
43
+ (r'\?[a-zA-Z][a-zA-Z0-9_-]*', Name.Variable),
44
+ (r'[0-9]+\.[0-9]+', Number.Float),
45
+ (r'[0-9]+', Number.Integer),
46
+ ],
47
+ 'keywords': [
48
+ (words((
49
+ ':requirements', ':types', ':constants',
50
+ ':predicates', ':functions', ':action', ':agent',
51
+ ':parameters', ':precondition', ':effect',
52
+ ':durative-action', ':duration', ':condition',
53
+ ':derived', ':domain', ':objects', ':init',
54
+ ':goal', ':metric', ':length', ':serial', ':parallel',
55
+ # the following are requirements
56
+ ':strips', ':typing', ':negative-preconditions',
57
+ ':disjunctive-preconditions', ':equality',
58
+ ':existential-preconditions', ':universal-preconditions',
59
+ ':conditional-effects', ':fluents', ':numeric-fluents',
60
+ ':object-fluents', ':adl', ':durative-actions',
61
+ ':continuous-effects', ':derived-predicates',
62
+ ':time-intial-literals', ':preferences',
63
+ ':constraints', ':action-costs', ':multi-agent',
64
+ ':unfactored-privacy', ':factored-privacy',
65
+ ':non-deterministic'
66
+ ), suffix=r'\b'), Keyword)
67
+ ],
68
+ 'builtins': [
69
+ (words((
70
+ 'define', 'domain', 'object', 'either', 'and',
71
+ 'forall', 'preference', 'imply', 'or', 'exists',
72
+ 'not', 'when', 'assign', 'scale-up', 'scale-down',
73
+ 'increase', 'decrease', 'at', 'over', 'start',
74
+ 'end', 'all', 'problem', 'always', 'sometime',
75
+ 'within', 'at-most-once', 'sometime-after',
76
+ 'sometime-before', 'always-within', 'hold-during',
77
+ 'hold-after', 'minimize', 'maximize',
78
+ 'total-time', 'is-violated'), suffix=r'\b'),
79
+ Name.Builtin)
80
+ ]
81
+ }
82
+
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/perl.py ADDED
@@ -0,0 +1,733 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.perl
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Perl, Raku and related languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, bygroups, \
14
+ using, this, default, words
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Whitespace
17
+ from pygments.util import shebang_matches
18
+
19
+ __all__ = ['PerlLexer', 'Perl6Lexer']
20
+
21
+
22
+ class PerlLexer(RegexLexer):
23
+ """
24
+ For Perl source code.
25
+ """
26
+
27
+ name = 'Perl'
28
+ url = 'https://www.perl.org'
29
+ aliases = ['perl', 'pl']
30
+ filenames = ['*.pl', '*.pm', '*.t', '*.perl']
31
+ mimetypes = ['text/x-perl', 'application/x-perl']
32
+ version_added = ''
33
+
34
+ flags = re.DOTALL | re.MULTILINE
35
+ # TODO: give this to a perl guy who knows how to parse perl...
36
+ tokens = {
37
+ 'balanced-regex': [
38
+ (r'/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*', String.Regex, '#pop'),
39
+ (r'!(\\\\|\\[^\\]|[^\\!])*![egimosx]*', String.Regex, '#pop'),
40
+ (r'\\(\\\\|[^\\])*\\[egimosx]*', String.Regex, '#pop'),
41
+ (r'\{(\\\\|\\[^\\]|[^\\}])*\}[egimosx]*', String.Regex, '#pop'),
42
+ (r'<(\\\\|\\[^\\]|[^\\>])*>[egimosx]*', String.Regex, '#pop'),
43
+ (r'\[(\\\\|\\[^\\]|[^\\\]])*\][egimosx]*', String.Regex, '#pop'),
44
+ (r'\((\\\\|\\[^\\]|[^\\)])*\)[egimosx]*', String.Regex, '#pop'),
45
+ (r'@(\\\\|\\[^\\]|[^\\@])*@[egimosx]*', String.Regex, '#pop'),
46
+ (r'%(\\\\|\\[^\\]|[^\\%])*%[egimosx]*', String.Regex, '#pop'),
47
+ (r'\$(\\\\|\\[^\\]|[^\\$])*\$[egimosx]*', String.Regex, '#pop'),
48
+ ],
49
+ 'root': [
50
+ (r'\A\#!.+?$', Comment.Hashbang),
51
+ (r'\#.*?$', Comment.Single),
52
+ (r'^=[a-zA-Z0-9]+\s+.*?\n=cut', Comment.Multiline),
53
+ (words((
54
+ 'case', 'continue', 'do', 'else', 'elsif', 'for', 'foreach',
55
+ 'if', 'last', 'my', 'next', 'our', 'redo', 'reset', 'then',
56
+ 'unless', 'until', 'while', 'print', 'new', 'BEGIN',
57
+ 'CHECK', 'INIT', 'END', 'return'), suffix=r'\b'),
58
+ Keyword),
59
+ (r'(format)(\s+)(\w+)(\s*)(=)(\s*\n)',
60
+ bygroups(Keyword, Whitespace, Name, Whitespace, Punctuation, Whitespace), 'format'),
61
+ (r'(eq|lt|gt|le|ge|ne|not|and|or|cmp)\b', Operator.Word),
62
+ # common delimiters
63
+ (r's/(\\\\|\\[^\\]|[^\\/])*/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*',
64
+ String.Regex),
65
+ (r's!(\\\\|\\!|[^!])*!(\\\\|\\!|[^!])*![egimosx]*', String.Regex),
66
+ (r's\\(\\\\|[^\\])*\\(\\\\|[^\\])*\\[egimosx]*', String.Regex),
67
+ (r's@(\\\\|\\[^\\]|[^\\@])*@(\\\\|\\[^\\]|[^\\@])*@[egimosx]*',
68
+ String.Regex),
69
+ (r's%(\\\\|\\[^\\]|[^\\%])*%(\\\\|\\[^\\]|[^\\%])*%[egimosx]*',
70
+ String.Regex),
71
+ # balanced delimiters
72
+ (r's\{(\\\\|\\[^\\]|[^\\}])*\}\s*', String.Regex, 'balanced-regex'),
73
+ (r's<(\\\\|\\[^\\]|[^\\>])*>\s*', String.Regex, 'balanced-regex'),
74
+ (r's\[(\\\\|\\[^\\]|[^\\\]])*\]\s*', String.Regex,
75
+ 'balanced-regex'),
76
+ (r's\((\\\\|\\[^\\]|[^\\)])*\)\s*', String.Regex,
77
+ 'balanced-regex'),
78
+
79
+ (r'm?/(\\\\|\\[^\\]|[^\\/\n])*/[gcimosx]*', String.Regex),
80
+ (r'm(?=[/!\\{<\[(@%$])', String.Regex, 'balanced-regex'),
81
+ (r'((?<==~)|(?<=\())\s*/(\\\\|\\[^\\]|[^\\/])*/[gcimosx]*',
82
+ String.Regex),
83
+ (r'\s+', Whitespace),
84
+ (words((
85
+ 'abs', 'accept', 'alarm', 'atan2', 'bind', 'binmode', 'bless', 'caller', 'chdir',
86
+ 'chmod', 'chomp', 'chop', 'chown', 'chr', 'chroot', 'close', 'closedir', 'connect',
87
+ 'continue', 'cos', 'crypt', 'dbmclose', 'dbmopen', 'defined', 'delete', 'die',
88
+ 'dump', 'each', 'endgrent', 'endhostent', 'endnetent', 'endprotoent',
89
+ 'endpwent', 'endservent', 'eof', 'eval', 'exec', 'exists', 'exit', 'exp', 'fcntl',
90
+ 'fileno', 'flock', 'fork', 'format', 'formline', 'getc', 'getgrent', 'getgrgid',
91
+ 'getgrnam', 'gethostbyaddr', 'gethostbyname', 'gethostent', 'getlogin',
92
+ 'getnetbyaddr', 'getnetbyname', 'getnetent', 'getpeername', 'getpgrp',
93
+ 'getppid', 'getpriority', 'getprotobyname', 'getprotobynumber',
94
+ 'getprotoent', 'getpwent', 'getpwnam', 'getpwuid', 'getservbyname',
95
+ 'getservbyport', 'getservent', 'getsockname', 'getsockopt', 'glob', 'gmtime',
96
+ 'goto', 'grep', 'hex', 'import', 'index', 'int', 'ioctl', 'join', 'keys', 'kill', 'last',
97
+ 'lc', 'lcfirst', 'length', 'link', 'listen', 'local', 'localtime', 'log', 'lstat',
98
+ 'map', 'mkdir', 'msgctl', 'msgget', 'msgrcv', 'msgsnd', 'my', 'next', 'oct', 'open',
99
+ 'opendir', 'ord', 'our', 'pack', 'pipe', 'pop', 'pos', 'printf',
100
+ 'prototype', 'push', 'quotemeta', 'rand', 'read', 'readdir',
101
+ 'readline', 'readlink', 'readpipe', 'recv', 'redo', 'ref', 'rename',
102
+ 'reverse', 'rewinddir', 'rindex', 'rmdir', 'scalar', 'seek', 'seekdir',
103
+ 'select', 'semctl', 'semget', 'semop', 'send', 'setgrent', 'sethostent', 'setnetent',
104
+ 'setpgrp', 'setpriority', 'setprotoent', 'setpwent', 'setservent',
105
+ 'setsockopt', 'shift', 'shmctl', 'shmget', 'shmread', 'shmwrite', 'shutdown',
106
+ 'sin', 'sleep', 'socket', 'socketpair', 'sort', 'splice', 'split', 'sprintf', 'sqrt',
107
+ 'srand', 'stat', 'study', 'substr', 'symlink', 'syscall', 'sysopen', 'sysread',
108
+ 'sysseek', 'system', 'syswrite', 'tell', 'telldir', 'tie', 'tied', 'time', 'times', 'tr',
109
+ 'truncate', 'uc', 'ucfirst', 'umask', 'undef', 'unlink', 'unpack', 'unshift', 'untie',
110
+ 'utime', 'values', 'vec', 'wait', 'waitpid', 'wantarray', 'warn', 'write'), suffix=r'\b'),
111
+ Name.Builtin),
112
+ (r'((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b', Name.Builtin.Pseudo),
113
+ (r'(<<)([\'"]?)([a-zA-Z_]\w*)(\2;?\n.*?\n)(\3)(\n)',
114
+ bygroups(String, String, String.Delimiter, String, String.Delimiter, Whitespace)),
115
+ (r'__END__', Comment.Preproc, 'end-part'),
116
+ (r'\$\^[ADEFHILMOPSTWX]', Name.Variable.Global),
117
+ (r"\$[\\\"\[\]'&`+*.,;=%~?@$!<>(^|/-](?!\w)", Name.Variable.Global),
118
+ (r'[$@%#]+', Name.Variable, 'varname'),
119
+ (r'0_?[0-7]+(_[0-7]+)*', Number.Oct),
120
+ (r'0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*', Number.Hex),
121
+ (r'0b[01]+(_[01]+)*', Number.Bin),
122
+ (r'(?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?',
123
+ Number.Float),
124
+ (r'(?i)\d+(_\d*)*e[+-]?\d+(_\d*)*', Number.Float),
125
+ (r'\d+(_\d+)*', Number.Integer),
126
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String),
127
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
128
+ (r'`(\\\\|\\[^\\]|[^`\\])*`', String.Backtick),
129
+ (r'<([^\s>]+)>', String.Regex),
130
+ (r'(q|qq|qw|qr|qx)\{', String.Other, 'cb-string'),
131
+ (r'(q|qq|qw|qr|qx)\(', String.Other, 'rb-string'),
132
+ (r'(q|qq|qw|qr|qx)\[', String.Other, 'sb-string'),
133
+ (r'(q|qq|qw|qr|qx)\<', String.Other, 'lt-string'),
134
+ (r'(q|qq|qw|qr|qx)([\W_])(.|\n)*?\2', String.Other),
135
+ (r'(package)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)',
136
+ bygroups(Keyword, Whitespace, Name.Namespace)),
137
+ (r'(use|require|no)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)',
138
+ bygroups(Keyword, Whitespace, Name.Namespace)),
139
+ (r'(sub)(\s+)', bygroups(Keyword, Whitespace), 'funcname'),
140
+ (words((
141
+ 'no', 'package', 'require', 'use'), suffix=r'\b'),
142
+ Keyword),
143
+ (r'(\[\]|\*\*|::|<<|>>|>=|<=>|<=|={3}|!=|=~|'
144
+ r'!~|&&?|\|\||\.{1,3})', Operator),
145
+ (r'[-+/*%=<>&^|!\\~]=?', Operator),
146
+ (r'[()\[\]:;,<>/?{}]', Punctuation), # yes, there's no shortage
147
+ # of punctuation in Perl!
148
+ (r'(?=\w)', Name, 'name'),
149
+ ],
150
+ 'format': [
151
+ (r'\.\n', String.Interpol, '#pop'),
152
+ (r'[^\n]*\n', String.Interpol),
153
+ ],
154
+ 'varname': [
155
+ (r'\s+', Whitespace),
156
+ (r'\{', Punctuation, '#pop'), # hash syntax?
157
+ (r'\)|,', Punctuation, '#pop'), # argument specifier
158
+ (r'\w+::', Name.Namespace),
159
+ (r'[\w:]+', Name.Variable, '#pop'),
160
+ ],
161
+ 'name': [
162
+ (r'[a-zA-Z_]\w*(::[a-zA-Z_]\w*)*(::)?(?=\s*->)', Name.Namespace, '#pop'),
163
+ (r'[a-zA-Z_]\w*(::[a-zA-Z_]\w*)*::', Name.Namespace, '#pop'),
164
+ (r'[\w:]+', Name, '#pop'),
165
+ (r'[A-Z_]+(?=\W)', Name.Constant, '#pop'),
166
+ (r'(?=\W)', Text, '#pop'),
167
+ ],
168
+ 'funcname': [
169
+ (r'[a-zA-Z_]\w*[!?]?', Name.Function),
170
+ (r'\s+', Whitespace),
171
+ # argument declaration
172
+ (r'(\([$@%]*\))(\s*)', bygroups(Punctuation, Whitespace)),
173
+ (r';', Punctuation, '#pop'),
174
+ (r'.*?\{', Punctuation, '#pop'),
175
+ ],
176
+ 'cb-string': [
177
+ (r'\\[{}\\]', String.Other),
178
+ (r'\\', String.Other),
179
+ (r'\{', String.Other, 'cb-string'),
180
+ (r'\}', String.Other, '#pop'),
181
+ (r'[^{}\\]+', String.Other)
182
+ ],
183
+ 'rb-string': [
184
+ (r'\\[()\\]', String.Other),
185
+ (r'\\', String.Other),
186
+ (r'\(', String.Other, 'rb-string'),
187
+ (r'\)', String.Other, '#pop'),
188
+ (r'[^()]+', String.Other)
189
+ ],
190
+ 'sb-string': [
191
+ (r'\\[\[\]\\]', String.Other),
192
+ (r'\\', String.Other),
193
+ (r'\[', String.Other, 'sb-string'),
194
+ (r'\]', String.Other, '#pop'),
195
+ (r'[^\[\]]+', String.Other)
196
+ ],
197
+ 'lt-string': [
198
+ (r'\\[<>\\]', String.Other),
199
+ (r'\\', String.Other),
200
+ (r'\<', String.Other, 'lt-string'),
201
+ (r'\>', String.Other, '#pop'),
202
+ (r'[^<>]+', String.Other)
203
+ ],
204
+ 'end-part': [
205
+ (r'.+', Comment.Preproc, '#pop')
206
+ ]
207
+ }
208
+
209
+ def analyse_text(text):
210
+ if shebang_matches(text, r'perl'):
211
+ return True
212
+
213
+ result = 0
214
+
215
+ if re.search(r'(?:my|our)\s+[$@%(]', text):
216
+ result += 0.9
217
+
218
+ if ':=' in text:
219
+ # := is not valid Perl, but it appears in unicon, so we should
220
+ # become less confident if we think we found Perl with :=
221
+ result /= 2
222
+
223
+ return result
224
+
225
+
226
+ class Perl6Lexer(ExtendedRegexLexer):
227
+ """
228
+ For Raku (a.k.a. Perl 6) source code.
229
+ """
230
+
231
+ name = 'Perl6'
232
+ url = 'https://www.raku.org'
233
+ aliases = ['perl6', 'pl6', 'raku']
234
+ filenames = ['*.pl', '*.pm', '*.nqp', '*.p6', '*.6pl', '*.p6l', '*.pl6',
235
+ '*.6pm', '*.p6m', '*.pm6', '*.t', '*.raku', '*.rakumod',
236
+ '*.rakutest', '*.rakudoc']
237
+ mimetypes = ['text/x-perl6', 'application/x-perl6']
238
+ version_added = '2.0'
239
+ flags = re.MULTILINE | re.DOTALL
240
+
241
+ PERL6_IDENTIFIER_RANGE = r"['\w:-]"
242
+
243
+ PERL6_KEYWORDS = (
244
+ #Phasers
245
+ 'BEGIN','CATCH','CHECK','CLOSE','CONTROL','DOC','END','ENTER','FIRST',
246
+ 'INIT','KEEP','LAST','LEAVE','NEXT','POST','PRE','QUIT','UNDO',
247
+ #Keywords
248
+ 'anon','augment','but','class','constant','default','does','else',
249
+ 'elsif','enum','for','gather','given','grammar','has','if','import',
250
+ 'is','let','loop','made','make','method','module','multi','my','need',
251
+ 'orwith','our','proceed','proto','repeat','require','return',
252
+ 'return-rw','returns','role','rule','state','sub','submethod','subset',
253
+ 'succeed','supersede','token','try','unit','unless','until','use',
254
+ 'when','while','with','without',
255
+ #Traits
256
+ 'export','native','repr','required','rw','symbol',
257
+ )
258
+
259
+ PERL6_BUILTINS = (
260
+ 'ACCEPTS','abs','abs2rel','absolute','accept','accessed','acos',
261
+ 'acosec','acosech','acosh','acotan','acotanh','acquire','act','action',
262
+ 'actions','add','add_attribute','add_enum_value','add_fallback',
263
+ 'add_method','add_parent','add_private_method','add_role','add_trustee',
264
+ 'adverb','after','all','allocate','allof','allowed','alternative-names',
265
+ 'annotations','antipair','antipairs','any','anyof','app_lifetime',
266
+ 'append','arch','archname','args','arity','Array','asec','asech','asin',
267
+ 'asinh','ASSIGN-KEY','ASSIGN-POS','assuming','ast','at','atan','atan2',
268
+ 'atanh','AT-KEY','atomic-assign','atomic-dec-fetch','atomic-fetch',
269
+ 'atomic-fetch-add','atomic-fetch-dec','atomic-fetch-inc',
270
+ 'atomic-fetch-sub','atomic-inc-fetch','AT-POS','attributes','auth',
271
+ 'await','backtrace','Bag','BagHash','bail-out','base','basename',
272
+ 'base-repeating','batch','BIND-KEY','BIND-POS','bind-stderr',
273
+ 'bind-stdin','bind-stdout','bind-udp','bits','bless','block','Bool',
274
+ 'bool-only','bounds','break','Bridge','broken','BUILD','build-date',
275
+ 'bytes','cache','callframe','calling-package','CALL-ME','callsame',
276
+ 'callwith','can','cancel','candidates','cando','can-ok','canonpath',
277
+ 'caps','caption','Capture','cas','catdir','categorize','categorize-list',
278
+ 'catfile','catpath','cause','ceiling','cglobal','changed','Channel',
279
+ 'chars','chdir','child','child-name','child-typename','chmod','chomp',
280
+ 'chop','chr','chrs','chunks','cis','classify','classify-list','cleanup',
281
+ 'clone','close','closed','close-stdin','cmp-ok','code','codes','collate',
282
+ 'column','comb','combinations','command','comment','compiler','Complex',
283
+ 'compose','compose_type','composer','condition','config',
284
+ 'configure_destroy','configure_type_checking','conj','connect',
285
+ 'constraints','construct','contains','contents','copy','cos','cosec',
286
+ 'cosech','cosh','cotan','cotanh','count','count-only','cpu-cores',
287
+ 'cpu-usage','CREATE','create_type','cross','cue','curdir','curupdir','d',
288
+ 'Date','DateTime','day','daycount','day-of-month','day-of-week',
289
+ 'day-of-year','days-in-month','declaration','decode','decoder','deepmap',
290
+ 'default','defined','DEFINITE','delayed','DELETE-KEY','DELETE-POS',
291
+ 'denominator','desc','DESTROY','destroyers','devnull','diag',
292
+ 'did-you-mean','die','dies-ok','dir','dirname','dir-sep','DISTROnames',
293
+ 'do','does','does-ok','done','done-testing','duckmap','dynamic','e',
294
+ 'eager','earlier','elems','emit','enclosing','encode','encoder',
295
+ 'encoding','end','ends-with','enum_from_value','enum_value_list',
296
+ 'enum_values','enums','eof','EVAL','eval-dies-ok','EVALFILE',
297
+ 'eval-lives-ok','exception','excludes-max','excludes-min','EXISTS-KEY',
298
+ 'EXISTS-POS','exit','exitcode','exp','expected','explicitly-manage',
299
+ 'expmod','extension','f','fail','fails-like','fc','feature','file',
300
+ 'filename','find_method','find_method_qualified','finish','first','flat',
301
+ 'flatmap','flip','floor','flunk','flush','fmt','format','formatter',
302
+ 'freeze','from','from-list','from-loop','from-posix','full',
303
+ 'full-barrier','get','get_value','getc','gist','got','grab','grabpairs',
304
+ 'grep','handle','handled','handles','hardware','has_accessor','Hash',
305
+ 'head','headers','hh-mm-ss','hidden','hides','hour','how','hyper','id',
306
+ 'illegal','im','in','indent','index','indices','indir','infinite',
307
+ 'infix','infix:<+>','infix:<->','install_method_cache','Instant',
308
+ 'instead','Int','int-bounds','interval','in-timezone','invalid-str',
309
+ 'invert','invocant','IO','IO::Notification.watch-path','is_trusted',
310
+ 'is_type','isa','is-absolute','isa-ok','is-approx','is-deeply',
311
+ 'is-hidden','is-initial-thread','is-int','is-lazy','is-leap-year',
312
+ 'isNaN','isnt','is-prime','is-relative','is-routine','is-setting',
313
+ 'is-win','item','iterator','join','keep','kept','KERNELnames','key',
314
+ 'keyof','keys','kill','kv','kxxv','l','lang','last','lastcall','later',
315
+ 'lazy','lc','leading','level','like','line','lines','link','List',
316
+ 'listen','live','lives-ok','local','lock','log','log10','lookup','lsb',
317
+ 'made','MAIN','make','Map','match','max','maxpairs','merge','message',
318
+ 'method','method_table','methods','migrate','min','minmax','minpairs',
319
+ 'minute','misplaced','Mix','MixHash','mkdir','mode','modified','month',
320
+ 'move','mro','msb','multi','multiness','my','name','named','named_names',
321
+ 'narrow','nativecast','native-descriptor','nativesizeof','new','new_type',
322
+ 'new-from-daycount','new-from-pairs','next','nextcallee','next-handle',
323
+ 'nextsame','nextwith','NFC','NFD','NFKC','NFKD','nl-in','nl-out',
324
+ 'nodemap','nok','none','norm','not','note','now','nude','Num',
325
+ 'numerator','Numeric','of','offset','offset-in-hours','offset-in-minutes',
326
+ 'ok','old','on-close','one','on-switch','open','opened','operation',
327
+ 'optional','ord','ords','orig','os-error','osname','out-buffer','pack',
328
+ 'package','package-kind','package-name','packages','pair','pairs',
329
+ 'pairup','parameter','params','parent','parent-name','parents','parse',
330
+ 'parse-base','parsefile','parse-names','parts','pass','path','path-sep',
331
+ 'payload','peer-host','peer-port','periods','perl','permutations','phaser',
332
+ 'pick','pickpairs','pid','placeholder','plan','plus','polar','poll',
333
+ 'polymod','pop','pos','positional','posix','postfix','postmatch',
334
+ 'precomp-ext','precomp-target','pred','prefix','prematch','prepend',
335
+ 'print','printf','print-nl','print-to','private','private_method_table',
336
+ 'proc','produce','Promise','prompt','protect','pull-one','push',
337
+ 'push-all','push-at-least','push-exactly','push-until-lazy','put',
338
+ 'qualifier-type','quit','r','race','radix','rand','range','Rat','raw',
339
+ 're','read','readchars','readonly','ready','Real','reallocate','reals',
340
+ 'reason','rebless','receive','recv','redispatcher','redo','reduce',
341
+ 'rel2abs','relative','release','rename','repeated','replacement',
342
+ 'report','reserved','resolve','restore','result','resume','rethrow',
343
+ 'reverse','right','rindex','rmdir','role','roles_to_compose','rolish',
344
+ 'roll','rootdir','roots','rotate','rotor','round','roundrobin',
345
+ 'routine-type','run','rwx','s','samecase','samemark','samewith','say',
346
+ 'schedule-on','scheduler','scope','sec','sech','second','seek','self',
347
+ 'send','Set','set_hidden','set_name','set_package','set_rw','set_value',
348
+ 'SetHash','set-instruments','setup_finalization','shape','share','shell',
349
+ 'shift','sibling','sigil','sign','signal','signals','signature','sin',
350
+ 'sinh','sink','sink-all','skip','skip-at-least','skip-at-least-pull-one',
351
+ 'skip-one','skip-rest','sleep','sleep-timer','sleep-until','Slip','slurp',
352
+ 'slurp-rest','slurpy','snap','snapper','so','socket-host','socket-port',
353
+ 'sort','source','source-package','spawn','SPEC','splice','split',
354
+ 'splitdir','splitpath','sprintf','spurt','sqrt','squish','srand','stable',
355
+ 'start','started','starts-with','status','stderr','stdout','Str',
356
+ 'sub_signature','subbuf','subbuf-rw','subname','subparse','subst',
357
+ 'subst-mutate','substr','substr-eq','substr-rw','subtest','succ','sum',
358
+ 'Supply','symlink','t','tail','take','take-rw','tan','tanh','tap',
359
+ 'target','target-name','tc','tclc','tell','then','throttle','throw',
360
+ 'throws-like','timezone','tmpdir','to','today','todo','toggle','to-posix',
361
+ 'total','trailing','trans','tree','trim','trim-leading','trim-trailing',
362
+ 'truncate','truncated-to','trusts','try_acquire','trying','twigil','type',
363
+ 'type_captures','typename','uc','udp','uncaught_handler','unimatch',
364
+ 'uniname','uninames','uniparse','uniprop','uniprops','unique','unival',
365
+ 'univals','unlike','unlink','unlock','unpack','unpolar','unshift',
366
+ 'unwrap','updir','USAGE','use-ok','utc','val','value','values','VAR',
367
+ 'variable','verbose-config','version','VMnames','volume','vow','w','wait',
368
+ 'warn','watch','watch-path','week','weekday-of-month','week-number',
369
+ 'week-year','WHAT','when','WHERE','WHEREFORE','WHICH','WHO',
370
+ 'whole-second','WHY','wordcase','words','workaround','wrap','write',
371
+ 'write-to','x','yada','year','yield','yyyy-mm-dd','z','zip','zip-latest',
372
+
373
+ )
374
+
375
+ PERL6_BUILTIN_CLASSES = (
376
+ #Booleans
377
+ 'False','True',
378
+ #Classes
379
+ 'Any','Array','Associative','AST','atomicint','Attribute','Backtrace',
380
+ 'Backtrace::Frame','Bag','Baggy','BagHash','Blob','Block','Bool','Buf',
381
+ 'Callable','CallFrame','Cancellation','Capture','CArray','Channel','Code',
382
+ 'compiler','Complex','ComplexStr','Cool','CurrentThreadScheduler',
383
+ 'Cursor','Date','Dateish','DateTime','Distro','Duration','Encoding',
384
+ 'Exception','Failure','FatRat','Grammar','Hash','HyperWhatever','Instant',
385
+ 'Int','int16','int32','int64','int8','IntStr','IO','IO::ArgFiles',
386
+ 'IO::CatHandle','IO::Handle','IO::Notification','IO::Path',
387
+ 'IO::Path::Cygwin','IO::Path::QNX','IO::Path::Unix','IO::Path::Win32',
388
+ 'IO::Pipe','IO::Socket','IO::Socket::Async','IO::Socket::INET','IO::Spec',
389
+ 'IO::Spec::Cygwin','IO::Spec::QNX','IO::Spec::Unix','IO::Spec::Win32',
390
+ 'IO::Special','Iterable','Iterator','Junction','Kernel','Label','List',
391
+ 'Lock','Lock::Async','long','longlong','Macro','Map','Match',
392
+ 'Metamodel::AttributeContainer','Metamodel::C3MRO','Metamodel::ClassHOW',
393
+ 'Metamodel::EnumHOW','Metamodel::Finalization','Metamodel::MethodContainer',
394
+ 'Metamodel::MROBasedMethodDispatch','Metamodel::MultipleInheritance',
395
+ 'Metamodel::Naming','Metamodel::Primitives','Metamodel::PrivateMethodContainer',
396
+ 'Metamodel::RoleContainer','Metamodel::Trusting','Method','Mix','MixHash',
397
+ 'Mixy','Mu','NFC','NFD','NFKC','NFKD','Nil','Num','num32','num64',
398
+ 'Numeric','NumStr','ObjAt','Order','Pair','Parameter','Perl','Pod::Block',
399
+ 'Pod::Block::Code','Pod::Block::Comment','Pod::Block::Declarator',
400
+ 'Pod::Block::Named','Pod::Block::Para','Pod::Block::Table','Pod::Heading',
401
+ 'Pod::Item','Pointer','Positional','PositionalBindFailover','Proc',
402
+ 'Proc::Async','Promise','Proxy','PseudoStash','QuantHash','Range','Rat',
403
+ 'Rational','RatStr','Real','Regex','Routine','Scalar','Scheduler',
404
+ 'Semaphore','Seq','Set','SetHash','Setty','Signature','size_t','Slip',
405
+ 'Stash','Str','StrDistance','Stringy','Sub','Submethod','Supplier',
406
+ 'Supplier::Preserving','Supply','Systemic','Tap','Telemetry',
407
+ 'Telemetry::Instrument::Thread','Telemetry::Instrument::Usage',
408
+ 'Telemetry::Period','Telemetry::Sampler','Thread','ThreadPoolScheduler',
409
+ 'UInt','uint16','uint32','uint64','uint8','Uni','utf8','Variable',
410
+ 'Version','VM','Whatever','WhateverCode','WrapHandle'
411
+ )
412
+
413
+ PERL6_OPERATORS = (
414
+ 'X', 'Z', 'after', 'also', 'and', 'andthen', 'before', 'cmp', 'div',
415
+ 'eq', 'eqv', 'extra', 'ff', 'fff', 'ge', 'gt', 'le', 'leg', 'lt', 'm',
416
+ 'mm', 'mod', 'ne', 'or', 'orelse', 'rx', 's', 'tr', 'x', 'xor', 'xx',
417
+ '++', '--', '**', '!', '+', '-', '~', '?', '|', '||', '+^', '~^', '?^',
418
+ '^', '*', '/', '%', '%%', '+&', '+<', '+>', '~&', '~<', '~>', '?&',
419
+ 'gcd', 'lcm', '+', '-', '+|', '+^', '~|', '~^', '?|', '?^',
420
+ '~', '&', '^', 'but', 'does', '<=>', '..', '..^', '^..', '^..^',
421
+ '!=', '==', '<', '<=', '>', '>=', '~~', '===', '!eqv',
422
+ '&&', '||', '^^', '//', 'min', 'max', '??', '!!', 'ff', 'fff', 'so',
423
+ 'not', '<==', '==>', '<<==', '==>>','unicmp',
424
+ )
425
+
426
+ # Perl 6 has a *lot* of possible bracketing characters
427
+ # this list was lifted from STD.pm6 (https://github.com/perl6/std)
428
+ PERL6_BRACKETS = {
429
+ '\u0028': '\u0029', '\u003c': '\u003e', '\u005b': '\u005d',
430
+ '\u007b': '\u007d', '\u00ab': '\u00bb', '\u0f3a': '\u0f3b',
431
+ '\u0f3c': '\u0f3d', '\u169b': '\u169c', '\u2018': '\u2019',
432
+ '\u201a': '\u2019', '\u201b': '\u2019', '\u201c': '\u201d',
433
+ '\u201e': '\u201d', '\u201f': '\u201d', '\u2039': '\u203a',
434
+ '\u2045': '\u2046', '\u207d': '\u207e', '\u208d': '\u208e',
435
+ '\u2208': '\u220b', '\u2209': '\u220c', '\u220a': '\u220d',
436
+ '\u2215': '\u29f5', '\u223c': '\u223d', '\u2243': '\u22cd',
437
+ '\u2252': '\u2253', '\u2254': '\u2255', '\u2264': '\u2265',
438
+ '\u2266': '\u2267', '\u2268': '\u2269', '\u226a': '\u226b',
439
+ '\u226e': '\u226f', '\u2270': '\u2271', '\u2272': '\u2273',
440
+ '\u2274': '\u2275', '\u2276': '\u2277', '\u2278': '\u2279',
441
+ '\u227a': '\u227b', '\u227c': '\u227d', '\u227e': '\u227f',
442
+ '\u2280': '\u2281', '\u2282': '\u2283', '\u2284': '\u2285',
443
+ '\u2286': '\u2287', '\u2288': '\u2289', '\u228a': '\u228b',
444
+ '\u228f': '\u2290', '\u2291': '\u2292', '\u2298': '\u29b8',
445
+ '\u22a2': '\u22a3', '\u22a6': '\u2ade', '\u22a8': '\u2ae4',
446
+ '\u22a9': '\u2ae3', '\u22ab': '\u2ae5', '\u22b0': '\u22b1',
447
+ '\u22b2': '\u22b3', '\u22b4': '\u22b5', '\u22b6': '\u22b7',
448
+ '\u22c9': '\u22ca', '\u22cb': '\u22cc', '\u22d0': '\u22d1',
449
+ '\u22d6': '\u22d7', '\u22d8': '\u22d9', '\u22da': '\u22db',
450
+ '\u22dc': '\u22dd', '\u22de': '\u22df', '\u22e0': '\u22e1',
451
+ '\u22e2': '\u22e3', '\u22e4': '\u22e5', '\u22e6': '\u22e7',
452
+ '\u22e8': '\u22e9', '\u22ea': '\u22eb', '\u22ec': '\u22ed',
453
+ '\u22f0': '\u22f1', '\u22f2': '\u22fa', '\u22f3': '\u22fb',
454
+ '\u22f4': '\u22fc', '\u22f6': '\u22fd', '\u22f7': '\u22fe',
455
+ '\u2308': '\u2309', '\u230a': '\u230b', '\u2329': '\u232a',
456
+ '\u23b4': '\u23b5', '\u2768': '\u2769', '\u276a': '\u276b',
457
+ '\u276c': '\u276d', '\u276e': '\u276f', '\u2770': '\u2771',
458
+ '\u2772': '\u2773', '\u2774': '\u2775', '\u27c3': '\u27c4',
459
+ '\u27c5': '\u27c6', '\u27d5': '\u27d6', '\u27dd': '\u27de',
460
+ '\u27e2': '\u27e3', '\u27e4': '\u27e5', '\u27e6': '\u27e7',
461
+ '\u27e8': '\u27e9', '\u27ea': '\u27eb', '\u2983': '\u2984',
462
+ '\u2985': '\u2986', '\u2987': '\u2988', '\u2989': '\u298a',
463
+ '\u298b': '\u298c', '\u298d': '\u298e', '\u298f': '\u2990',
464
+ '\u2991': '\u2992', '\u2993': '\u2994', '\u2995': '\u2996',
465
+ '\u2997': '\u2998', '\u29c0': '\u29c1', '\u29c4': '\u29c5',
466
+ '\u29cf': '\u29d0', '\u29d1': '\u29d2', '\u29d4': '\u29d5',
467
+ '\u29d8': '\u29d9', '\u29da': '\u29db', '\u29f8': '\u29f9',
468
+ '\u29fc': '\u29fd', '\u2a2b': '\u2a2c', '\u2a2d': '\u2a2e',
469
+ '\u2a34': '\u2a35', '\u2a3c': '\u2a3d', '\u2a64': '\u2a65',
470
+ '\u2a79': '\u2a7a', '\u2a7d': '\u2a7e', '\u2a7f': '\u2a80',
471
+ '\u2a81': '\u2a82', '\u2a83': '\u2a84', '\u2a8b': '\u2a8c',
472
+ '\u2a91': '\u2a92', '\u2a93': '\u2a94', '\u2a95': '\u2a96',
473
+ '\u2a97': '\u2a98', '\u2a99': '\u2a9a', '\u2a9b': '\u2a9c',
474
+ '\u2aa1': '\u2aa2', '\u2aa6': '\u2aa7', '\u2aa8': '\u2aa9',
475
+ '\u2aaa': '\u2aab', '\u2aac': '\u2aad', '\u2aaf': '\u2ab0',
476
+ '\u2ab3': '\u2ab4', '\u2abb': '\u2abc', '\u2abd': '\u2abe',
477
+ '\u2abf': '\u2ac0', '\u2ac1': '\u2ac2', '\u2ac3': '\u2ac4',
478
+ '\u2ac5': '\u2ac6', '\u2acd': '\u2ace', '\u2acf': '\u2ad0',
479
+ '\u2ad1': '\u2ad2', '\u2ad3': '\u2ad4', '\u2ad5': '\u2ad6',
480
+ '\u2aec': '\u2aed', '\u2af7': '\u2af8', '\u2af9': '\u2afa',
481
+ '\u2e02': '\u2e03', '\u2e04': '\u2e05', '\u2e09': '\u2e0a',
482
+ '\u2e0c': '\u2e0d', '\u2e1c': '\u2e1d', '\u2e20': '\u2e21',
483
+ '\u3008': '\u3009', '\u300a': '\u300b', '\u300c': '\u300d',
484
+ '\u300e': '\u300f', '\u3010': '\u3011', '\u3014': '\u3015',
485
+ '\u3016': '\u3017', '\u3018': '\u3019', '\u301a': '\u301b',
486
+ '\u301d': '\u301e', '\ufd3e': '\ufd3f', '\ufe17': '\ufe18',
487
+ '\ufe35': '\ufe36', '\ufe37': '\ufe38', '\ufe39': '\ufe3a',
488
+ '\ufe3b': '\ufe3c', '\ufe3d': '\ufe3e', '\ufe3f': '\ufe40',
489
+ '\ufe41': '\ufe42', '\ufe43': '\ufe44', '\ufe47': '\ufe48',
490
+ '\ufe59': '\ufe5a', '\ufe5b': '\ufe5c', '\ufe5d': '\ufe5e',
491
+ '\uff08': '\uff09', '\uff1c': '\uff1e', '\uff3b': '\uff3d',
492
+ '\uff5b': '\uff5d', '\uff5f': '\uff60', '\uff62': '\uff63',
493
+ }
494
+
495
+ def _build_word_match(words, boundary_regex_fragment=None, prefix='', suffix=''):
496
+ if boundary_regex_fragment is None:
497
+ return r'\b(' + prefix + r'|'.join(re.escape(x) for x in words) + \
498
+ suffix + r')\b'
499
+ else:
500
+ return r'(?<!' + boundary_regex_fragment + r')' + prefix + r'(' + \
501
+ r'|'.join(re.escape(x) for x in words) + r')' + suffix + r'(?!' + \
502
+ boundary_regex_fragment + r')'
503
+
504
+ def brackets_callback(token_class):
505
+ def callback(lexer, match, context):
506
+ groups = match.groupdict()
507
+ opening_chars = groups['delimiter']
508
+ n_chars = len(opening_chars)
509
+ adverbs = groups.get('adverbs')
510
+
511
+ closer = Perl6Lexer.PERL6_BRACKETS.get(opening_chars[0])
512
+ text = context.text
513
+
514
+ if closer is None: # it's not a mirrored character, which means we
515
+ # just need to look for the next occurrence
516
+
517
+ end_pos = text.find(opening_chars, match.start('delimiter') + n_chars)
518
+ else: # we need to look for the corresponding closing character,
519
+ # keep nesting in mind
520
+ closing_chars = closer * n_chars
521
+ nesting_level = 1
522
+
523
+ search_pos = match.start('delimiter')
524
+
525
+ while nesting_level > 0:
526
+ next_open_pos = text.find(opening_chars, search_pos + n_chars)
527
+ next_close_pos = text.find(closing_chars, search_pos + n_chars)
528
+
529
+ if next_close_pos == -1:
530
+ next_close_pos = len(text)
531
+ nesting_level = 0
532
+ elif next_open_pos != -1 and next_open_pos < next_close_pos:
533
+ nesting_level += 1
534
+ search_pos = next_open_pos
535
+ else: # next_close_pos < next_open_pos
536
+ nesting_level -= 1
537
+ search_pos = next_close_pos
538
+
539
+ end_pos = next_close_pos
540
+
541
+ if end_pos < 0: # if we didn't find a closer, just highlight the
542
+ # rest of the text in this class
543
+ end_pos = len(text)
544
+
545
+ if adverbs is not None and re.search(r':to\b', adverbs):
546
+ heredoc_terminator = text[match.start('delimiter') + n_chars:end_pos]
547
+ end_heredoc = re.search(r'^\s*' + re.escape(heredoc_terminator) +
548
+ r'\s*$', text[end_pos:], re.MULTILINE)
549
+
550
+ if end_heredoc:
551
+ end_pos += end_heredoc.end()
552
+ else:
553
+ end_pos = len(text)
554
+
555
+ yield match.start(), token_class, text[match.start():end_pos + n_chars]
556
+ context.pos = end_pos + n_chars
557
+
558
+ return callback
559
+
560
+ def opening_brace_callback(lexer, match, context):
561
+ stack = context.stack
562
+
563
+ yield match.start(), Text, context.text[match.start():match.end()]
564
+ context.pos = match.end()
565
+
566
+ # if we encounter an opening brace and we're one level
567
+ # below a token state, it means we need to increment
568
+ # the nesting level for braces so we know later when
569
+ # we should return to the token rules.
570
+ if len(stack) > 2 and stack[-2] == 'token':
571
+ context.perl6_token_nesting_level += 1
572
+
573
+ def closing_brace_callback(lexer, match, context):
574
+ stack = context.stack
575
+
576
+ yield match.start(), Text, context.text[match.start():match.end()]
577
+ context.pos = match.end()
578
+
579
+ # if we encounter a free closing brace and we're one level
580
+ # below a token state, it means we need to check the nesting
581
+ # level to see if we need to return to the token state.
582
+ if len(stack) > 2 and stack[-2] == 'token':
583
+ context.perl6_token_nesting_level -= 1
584
+ if context.perl6_token_nesting_level == 0:
585
+ stack.pop()
586
+
587
+ def embedded_perl6_callback(lexer, match, context):
588
+ context.perl6_token_nesting_level = 1
589
+ yield match.start(), Text, context.text[match.start():match.end()]
590
+ context.pos = match.end()
591
+ context.stack.append('root')
592
+
593
+ # If you're modifying these rules, be careful if you need to process '{' or '}'
594
+ # characters. We have special logic for processing these characters (due to the fact
595
+ # that you can nest Perl 6 code in regex blocks), so if you need to process one of
596
+ # them, make sure you also process the corresponding one!
597
+ tokens = {
598
+ 'common': [
599
+ (r'#[`|=](?P<delimiter>(?P<first_char>[' + ''.join(PERL6_BRACKETS) + r'])(?P=first_char)*)',
600
+ brackets_callback(Comment.Multiline)),
601
+ (r'#[^\n]*$', Comment.Single),
602
+ (r'^(\s*)=begin\s+(\w+)\b.*?^\1=end\s+\2', Comment.Multiline),
603
+ (r'^(\s*)=for.*?\n\s*?\n', Comment.Multiline),
604
+ (r'^=.*?\n\s*?\n', Comment.Multiline),
605
+ (r'(regex|token|rule)(\s*' + PERL6_IDENTIFIER_RANGE + '+:sym)',
606
+ bygroups(Keyword, Name), 'token-sym-brackets'),
607
+ (r'(regex|token|rule)(?!' + PERL6_IDENTIFIER_RANGE + r')(\s*' + PERL6_IDENTIFIER_RANGE + '+)?',
608
+ bygroups(Keyword, Name), 'pre-token'),
609
+ # deal with a special case in the Perl 6 grammar (role q { ... })
610
+ (r'(role)(\s+)(q)(\s*)', bygroups(Keyword, Whitespace, Name, Whitespace)),
611
+ (_build_word_match(PERL6_KEYWORDS, PERL6_IDENTIFIER_RANGE), Keyword),
612
+ (_build_word_match(PERL6_BUILTIN_CLASSES, PERL6_IDENTIFIER_RANGE, suffix='(?::[UD])?'),
613
+ Name.Builtin),
614
+ (_build_word_match(PERL6_BUILTINS, PERL6_IDENTIFIER_RANGE), Name.Builtin),
615
+ # copied from PerlLexer
616
+ (r'[$@%&][.^:?=!~]?' + PERL6_IDENTIFIER_RANGE + '+(?:<<.*?>>|<.*?>|«.*?»)*',
617
+ Name.Variable),
618
+ (r'\$[!/](?:<<.*?>>|<.*?>|«.*?»)*', Name.Variable.Global),
619
+ (r'::\?\w+', Name.Variable.Global),
620
+ (r'[$@%&]\*' + PERL6_IDENTIFIER_RANGE + '+(?:<<.*?>>|<.*?>|«.*?»)*',
621
+ Name.Variable.Global),
622
+ (r'\$(?:<.*?>)+', Name.Variable),
623
+ (r'(?:q|qq|Q)[a-zA-Z]?\s*(?P<adverbs>:[\w\s:]+)?\s*(?P<delimiter>(?P<first_char>[^0-9a-zA-Z:\s])'
624
+ r'(?P=first_char)*)', brackets_callback(String)),
625
+ # copied from PerlLexer
626
+ (r'0_?[0-7]+(_[0-7]+)*', Number.Oct),
627
+ (r'0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*', Number.Hex),
628
+ (r'0b[01]+(_[01]+)*', Number.Bin),
629
+ (r'(?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?',
630
+ Number.Float),
631
+ (r'(?i)\d+(_\d*)*e[+-]?\d+(_\d*)*', Number.Float),
632
+ (r'\d+(_\d+)*', Number.Integer),
633
+ (r'(?<=~~)\s*/(?:\\\\|\\/|.)*?/', String.Regex),
634
+ (r'(?<=[=(,])\s*/(?:\\\\|\\/|.)*?/', String.Regex),
635
+ (r'm\w+(?=\()', Name),
636
+ (r'(?:m|ms|rx)\s*(?P<adverbs>:[\w\s:]+)?\s*(?P<delimiter>(?P<first_char>[^\w:\s])'
637
+ r'(?P=first_char)*)', brackets_callback(String.Regex)),
638
+ (r'(?:s|ss|tr)\s*(?::[\w\s:]+)?\s*/(?:\\\\|\\/|.)*?/(?:\\\\|\\/|.)*?/',
639
+ String.Regex),
640
+ (r'<[^\s=].*?\S>', String),
641
+ (_build_word_match(PERL6_OPERATORS), Operator),
642
+ (r'\w' + PERL6_IDENTIFIER_RANGE + '*', Name),
643
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String),
644
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
645
+ ],
646
+ 'root': [
647
+ include('common'),
648
+ (r'\{', opening_brace_callback),
649
+ (r'\}', closing_brace_callback),
650
+ (r'.+?', Text),
651
+ ],
652
+ 'pre-token': [
653
+ include('common'),
654
+ (r'\{', Text, ('#pop', 'token')),
655
+ (r'.+?', Text),
656
+ ],
657
+ 'token-sym-brackets': [
658
+ (r'(?P<delimiter>(?P<first_char>[' + ''.join(PERL6_BRACKETS) + '])(?P=first_char)*)',
659
+ brackets_callback(Name), ('#pop', 'pre-token')),
660
+ default(('#pop', 'pre-token')),
661
+ ],
662
+ 'token': [
663
+ (r'\}', Text, '#pop'),
664
+ (r'(?<=:)(?:my|our|state|constant|temp|let).*?;', using(this)),
665
+ # make sure that quotes in character classes aren't treated as strings
666
+ (r'<(?:[-!?+.]\s*)?\[.*?\]>', String.Regex),
667
+ # make sure that '#' characters in quotes aren't treated as comments
668
+ (r"(?<!\\)'(\\\\|\\[^\\]|[^'\\])*'", String.Regex),
669
+ (r'(?<!\\)"(\\\\|\\[^\\]|[^"\\])*"', String.Regex),
670
+ (r'#.*?$', Comment.Single),
671
+ (r'\{', embedded_perl6_callback),
672
+ ('.+?', String.Regex),
673
+ ],
674
+ }
675
+
676
+ def analyse_text(text):
677
+ def strip_pod(lines):
678
+ in_pod = False
679
+ stripped_lines = []
680
+
681
+ for line in lines:
682
+ if re.match(r'^=(?:end|cut)', line):
683
+ in_pod = False
684
+ elif re.match(r'^=\w+', line):
685
+ in_pod = True
686
+ elif not in_pod:
687
+ stripped_lines.append(line)
688
+
689
+ return stripped_lines
690
+
691
+ # XXX handle block comments
692
+ lines = text.splitlines()
693
+ lines = strip_pod(lines)
694
+ text = '\n'.join(lines)
695
+
696
+ if shebang_matches(text, r'perl6|rakudo|niecza|pugs'):
697
+ return True
698
+
699
+ saw_perl_decl = False
700
+ rating = False
701
+
702
+ # check for my/our/has declarations
703
+ if re.search(r"(?:my|our|has)\s+(?:" + Perl6Lexer.PERL6_IDENTIFIER_RANGE +
704
+ r"+\s+)?[$@%&(]", text):
705
+ rating = 0.8
706
+ saw_perl_decl = True
707
+
708
+ for line in lines:
709
+ line = re.sub('#.*', '', line)
710
+ if re.match(r'^\s*$', line):
711
+ continue
712
+
713
+ # match v6; use v6; use v6.0; use v6.0.0;
714
+ if re.match(r'^\s*(?:use\s+)?v6(?:\.\d(?:\.\d)?)?;', line):
715
+ return True
716
+ # match class, module, role, enum, grammar declarations
717
+ class_decl = re.match(r'^\s*(?:(?P<scope>my|our)\s+)?(?:module|class|role|enum|grammar)', line)
718
+ if class_decl:
719
+ if saw_perl_decl or class_decl.group('scope') is not None:
720
+ return True
721
+ rating = 0.05
722
+ continue
723
+ break
724
+
725
+ if ':=' in text:
726
+ # Same logic as above for PerlLexer
727
+ rating /= 2
728
+
729
+ return rating
730
+
731
+ def __init__(self, **options):
732
+ super().__init__(**options)
733
+ self.encoding = options.get('encoding', 'utf-8')
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/phix.py ADDED
@@ -0,0 +1,363 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.phix
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Phix.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, words
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Whitespace
16
+
17
+ __all__ = ['PhixLexer']
18
+
19
+
20
+ class PhixLexer(RegexLexer):
21
+ """
22
+ Pygments Lexer for Phix files (.exw).
23
+ See http://phix.x10.mx
24
+ """
25
+
26
+ name = 'Phix'
27
+ url = 'http://phix.x10.mx'
28
+ aliases = ['phix']
29
+ filenames = ['*.exw']
30
+ mimetypes = ['text/x-phix']
31
+ version_added = '2.14'
32
+
33
+ flags = re.MULTILINE # nb: **NOT** re.DOTALL! (totally spanners comment handling)
34
+
35
+ preproc = (
36
+ 'ifdef', 'elsifdef', 'elsedef'
37
+ )
38
+ # Note these lists are auto-generated by pwa/p2js.exw, when pwa\src\p2js_keywords.e (etc)
39
+ # change, though of course subsequent copy/commit/pull requests are all manual steps.
40
+ types = (
41
+ 'string', 'nullable_string', 'atom_string', 'atom', 'bool', 'boolean',
42
+ 'cdCanvan', 'cdCanvas', 'complex', 'CURLcode', 'dictionary', 'int',
43
+ 'integer', 'Ihandle', 'Ihandles', 'Ihandln', 'mpfr', 'mpq', 'mpz',
44
+ 'mpz_or_string', 'number', 'rid_string', 'seq', 'sequence', 'timedate',
45
+ 'object'
46
+ )
47
+ keywords = (
48
+ 'abstract', 'class', 'continue', 'export', 'extends', 'nullable',
49
+ 'private', 'public', 'static', 'struct', 'trace',
50
+ 'and', 'break', 'by', 'case', 'catch', 'const', 'constant', 'debug',
51
+ 'default', 'do', 'else', 'elsif', 'end', 'enum', 'exit', 'fallthru',
52
+ 'fallthrough', 'for', 'forward', 'function', 'global', 'if', 'in',
53
+ 'include', 'js', 'javascript', 'javascript_semantics', 'let', 'not',
54
+ 'or', 'procedure', 'profile', 'profile_time', 'return', 'safe_mode',
55
+ 'switch', 'then', 'to', 'try', 'type', 'type_check', 'until', 'warning',
56
+ 'while', 'with', 'without', 'xor'
57
+ )
58
+ routines = (
59
+ 'abort', 'abs', 'adjust_timedate', 'and_bits', 'and_bitsu', 'apply',
60
+ 'append', 'arccos', 'arcsin', 'arctan', 'assert', 'atan2',
61
+ 'atom_to_float32', 'atom_to_float64', 'bankers_rounding', 'beep',
62
+ 'begins', 'binary_search', 'bits_to_int', 'bk_color', 'bytes_to_int',
63
+ 'call_func', 'call_proc', 'cdCanvasActivate', 'cdCanvasArc',
64
+ 'cdCanvasBegin', 'cdCanvasBox', 'cdCanvasChord', 'cdCanvasCircle',
65
+ 'cdCanvasClear', 'cdCanvasEnd', 'cdCanvasFlush', 'cdCanvasFont',
66
+ 'cdCanvasGetImageRGB', 'cdCanvasGetSize', 'cdCanvasGetTextAlignment',
67
+ 'cdCanvasGetTextSize', 'cdCanvasLine', 'cdCanvasMark',
68
+ 'cdCanvasMarkSize', 'cdCanvasMultiLineVectorText', 'cdCanvasPixel',
69
+ 'cdCanvasRect', 'cdCanvasRoundedBox', 'cdCanvasRoundedRect',
70
+ 'cdCanvasSector', 'cdCanvasSetAttribute', 'cdCanvasSetBackground',
71
+ 'cdCanvasSetFillMode', 'cdCanvasSetForeground',
72
+ 'cdCanvasSetInteriorStyle', 'cdCanvasSetLineStyle',
73
+ 'cdCanvasSetLineWidth', 'cdCanvasSetTextAlignment', 'cdCanvasText',
74
+ 'cdCanvasSetTextOrientation', 'cdCanvasGetTextOrientation',
75
+ 'cdCanvasVectorText', 'cdCanvasVectorTextDirection',
76
+ 'cdCanvasVectorTextSize', 'cdCanvasVertex', 'cdCreateCanvas',
77
+ 'cdDecodeAlpha', 'cdDecodeColor', 'cdDecodeColorAlpha', 'cdEncodeAlpha',
78
+ 'cdEncodeColor', 'cdEncodeColorAlpha', 'cdKillCanvas', 'cdVersion',
79
+ 'cdVersionDate', 'ceil', 'change_timezone', 'choose', 'clear_screen',
80
+ 'columnize', 'command_line', 'compare', 'complex_abs', 'complex_add',
81
+ 'complex_arg', 'complex_conjugate', 'complex_cos', 'complex_cosh',
82
+ 'complex_div', 'complex_exp', 'complex_imag', 'complex_inv',
83
+ 'complex_log', 'complex_mul', 'complex_neg', 'complex_new',
84
+ 'complex_norm', 'complex_power', 'complex_rho', 'complex_real',
85
+ 'complex_round', 'complex_sin', 'complex_sinh', 'complex_sprint',
86
+ 'complex_sqrt', 'complex_sub', 'complex_theta', 'concat', 'cos',
87
+ 'crash', 'custom_sort', 'date', 'day_of_week', 'day_of_year',
88
+ 'days_in_month', 'decode_base64', 'decode_flags', 'deep_copy', 'deld',
89
+ 'deserialize', 'destroy_dict', 'destroy_queue', 'destroy_stack',
90
+ 'dict_name', 'dict_size', 'elapsed', 'elapsed_short', 'encode_base64',
91
+ 'equal', 'even', 'exp', 'extract', 'factorial', 'factors',
92
+ 'file_size_k', 'find', 'find_all', 'find_any', 'find_replace', 'filter',
93
+ 'flatten', 'float32_to_atom', 'float64_to_atom', 'floor',
94
+ 'format_timedate', 'free_console', 'from_polar', 'gcd', 'get_file_base',
95
+ 'get_file_extension', 'get_file_name', 'get_file_name_and_path',
96
+ 'get_file_path', 'get_file_path_and_name', 'get_maxprime', 'get_prime',
97
+ 'get_primes', 'get_primes_le', 'get_proper_dir', 'get_proper_path',
98
+ 'get_rand', 'get_routine_info', 'get_test_abort', 'get_test_logfile',
99
+ 'get_test_pause', 'get_test_verbosity', 'get_tzid', 'getd', 'getdd',
100
+ 'getd_all_keys', 'getd_by_index', 'getd_index', 'getd_partial_key',
101
+ 'glAttachShader', 'glBindBuffer', 'glBindTexture', 'glBufferData',
102
+ 'glCanvasSpecialText', 'glClear', 'glClearColor', 'glColor',
103
+ 'glCompileShader', 'glCreateBuffer', 'glCreateProgram',
104
+ 'glCreateShader', 'glCreateTexture', 'glDeleteProgram',
105
+ 'glDeleteShader', 'glDrawArrays', 'glEnable',
106
+ 'glEnableVertexAttribArray', 'glFloat32Array', 'glInt32Array',
107
+ 'glFlush', 'glGetAttribLocation', 'glGetError', 'glGetProgramInfoLog',
108
+ 'glGetProgramParameter', 'glGetShaderInfoLog', 'glGetShaderParameter',
109
+ 'glGetUniformLocation', 'glLinkProgram', 'glLoadIdentity',
110
+ 'glMatrixMode', 'glOrtho', 'glRotatef', 'glShadeModel',
111
+ 'glShaderSource', 'glSimpleA7texcoords', 'glTexImage2Dc',
112
+ 'glTexParameteri', 'glTranslate', 'glUniform1f', 'glUniform1i',
113
+ 'glUniformMatrix4fv', 'glUseProgram', 'glVertex',
114
+ 'glVertexAttribPointer', 'glViewport', 'head', 'hsv_to_rgb', 'iff',
115
+ 'iif', 'include_file', 'incl0de_file', 'insert', 'instance',
116
+ 'int_to_bits', 'int_to_bytes', 'is_dict', 'is_integer', 's_leap_year',
117
+ 'is_prime', 'is_prime2', 'islower', 'isupper', 'Icallback',
118
+ 'iup_isdouble', 'iup_isprint', 'iup_XkeyBase', 'IupAppend', 'IupAlarm',
119
+ 'IupBackgroundBox', 'IupButton', 'IupCalendar', 'IupCanvas',
120
+ 'IupClipboard', 'IupClose', 'IupCloseOnEscape', 'IupControlsOpen',
121
+ 'IupDatePick', 'IupDestroy', 'IupDialog', 'IupDrawArc', 'IupDrawBegin',
122
+ 'IupDrawEnd', 'IupDrawGetSize', 'IupDrawGetTextSize', 'IupDrawLine',
123
+ 'IupDrawRectangle', 'IupDrawText', 'IupExpander', 'IupFill',
124
+ 'IupFlatLabel', 'IupFlatList', 'IupFlatTree', 'IupFlush', 'IupFrame',
125
+ 'IupGetAttribute', 'IupGetAttributeId', 'IupGetAttributePtr',
126
+ 'IupGetBrother', 'IupGetChild', 'IupGetChildCount', 'IupGetClassName',
127
+ 'IupGetDialog', 'IupGetDialogChild', 'IupGetDouble', 'IupGetFocus',
128
+ 'IupGetGlobal', 'IupGetGlobalInt', 'IupGetGlobalIntInt', 'IupGetInt',
129
+ 'IupGetInt2', 'IupGetIntId', 'IupGetIntInt', 'IupGetParent',
130
+ 'IupGLCanvas', 'IupGLCanvasOpen', 'IupGLMakeCurrent', 'IupGraph',
131
+ 'IupHbox', 'IupHide', 'IupImage', 'IupImageRGBA', 'IupItem',
132
+ 'iupKeyCodeToName', 'IupLabel', 'IupLink', 'IupList', 'IupMap',
133
+ 'IupMenu', 'IupMenuItem', 'IupMessage', 'IupMessageDlg', 'IupMultiBox',
134
+ 'IupMultiLine', 'IupNextField', 'IupNormaliser', 'IupOpen',
135
+ 'IupPlayInput', 'IupPopup', 'IupPreviousField', 'IupProgressBar',
136
+ 'IupRadio', 'IupRecordInput', 'IupRedraw', 'IupRefresh',
137
+ 'IupRefreshChildren', 'IupSeparator', 'IupSetAttribute',
138
+ 'IupSetAttributes', 'IupSetAttributeHandle', 'IupSetAttributeId',
139
+ 'IupSetAttributePtr', 'IupSetCallback', 'IupSetCallbacks',
140
+ 'IupSetDouble', 'IupSetFocus', 'IupSetGlobal', 'IupSetGlobalInt',
141
+ 'IupSetGlobalFunction', 'IupSetHandle', 'IupSetInt',
142
+ 'IupSetStrAttribute', 'IupSetStrGlobal', 'IupShow', 'IupShowXY',
143
+ 'IupSplit', 'IupStoreAttribute', 'IupSubmenu', 'IupTable',
144
+ 'IupTableClearSelected', 'IupTableClick_cb', 'IupTableGetSelected',
145
+ 'IupTableResize_cb', 'IupTableSetData', 'IupTabs', 'IupText',
146
+ 'IupTimer', 'IupToggle', 'IupTreeAddNodes', 'IupTreeView', 'IupUpdate',
147
+ 'IupValuator', 'IupVbox', 'join', 'join_by', 'join_path', 'k_perm',
148
+ 'largest', 'lcm', 'length', 'log', 'log10', 'log2', 'lower',
149
+ 'm4_crossProduct', 'm4_inverse', 'm4_lookAt', 'm4_multiply',
150
+ 'm4_normalize', 'm4_perspective', 'm4_subtractVectors', 'm4_xRotate',
151
+ 'm4_yRotate', 'machine_bits', 'machine_word', 'match', 'match_all',
152
+ 'match_replace', 'max', 'maxsq', 'min', 'minsq', 'mod', 'mpfr_add',
153
+ 'mpfr_ceil', 'mpfr_cmp', 'mpfr_cmp_si', 'mpfr_const_pi', 'mpfr_div',
154
+ 'mpfr_div_si', 'mpfr_div_z', 'mpfr_floor', 'mpfr_free', 'mpfr_get_d',
155
+ 'mpfr_get_default_precision', 'mpfr_get_default_rounding_mode',
156
+ 'mpfr_get_fixed', 'mpfr_get_precision', 'mpfr_get_si', 'mpfr_init',
157
+ 'mpfr_inits', 'mpfr_init_set', 'mpfr_init_set_q', 'mpfr_init_set_z',
158
+ 'mpfr_mul', 'mpfr_mul_si', 'mpfr_pow_si', 'mpfr_set', 'mpfr_set_d',
159
+ 'mpfr_set_default_precision', 'mpfr_set_default_rounding_mode',
160
+ 'mpfr_set_precision', 'mpfr_set_q', 'mpfr_set_si', 'mpfr_set_str',
161
+ 'mpfr_set_z', 'mpfr_si_div', 'mpfr_si_sub', 'mpfr_sqrt', 'mpfr_sub',
162
+ 'mpfr_sub_si', 'mpq_abs', 'mpq_add', 'mpq_add_si', 'mpq_canonicalize',
163
+ 'mpq_cmp', 'mpq_cmp_si', 'mpq_div', 'mpq_div_2exp', 'mpq_free',
164
+ 'mpq_get_den', 'mpq_get_num', 'mpq_get_str', 'mpq_init', 'mpq_init_set',
165
+ 'mpq_init_set_si', 'mpq_init_set_str', 'mpq_init_set_z', 'mpq_inits',
166
+ 'mpq_inv', 'mpq_mul', 'mpq_neg', 'mpq_set', 'mpq_set_si', 'mpq_set_str',
167
+ 'mpq_set_z', 'mpq_sub', 'mpz_abs', 'mpz_add', 'mpz_addmul',
168
+ 'mpz_addmul_ui', 'mpz_addmul_si', 'mpz_add_si', 'mpz_add_ui', 'mpz_and',
169
+ 'mpz_bin_uiui', 'mpz_cdiv_q', 'mpz_cmp', 'mpz_cmp_si', 'mpz_divexact',
170
+ 'mpz_divexact_ui', 'mpz_divisible_p', 'mpz_divisible_ui_p', 'mpz_even',
171
+ 'mpz_fac_ui', 'mpz_factorstring', 'mpz_fdiv_q', 'mpz_fdiv_q_2exp',
172
+ 'mpz_fdiv_q_ui', 'mpz_fdiv_qr', 'mpz_fdiv_r', 'mpz_fdiv_ui',
173
+ 'mpz_fib_ui', 'mpz_fib2_ui', 'mpz_fits_atom', 'mpz_fits_integer',
174
+ 'mpz_free', 'mpz_gcd', 'mpz_gcd_ui', 'mpz_get_atom', 'mpz_get_integer',
175
+ 'mpz_get_short_str', 'mpz_get_str', 'mpz_init', 'mpz_init_set',
176
+ 'mpz_inits', 'mpz_invert', 'mpz_lcm', 'mpz_lcm_ui', 'mpz_max',
177
+ 'mpz_min', 'mpz_mod', 'mpz_mod_ui', 'mpz_mul', 'mpz_mul_2exp',
178
+ 'mpz_mul_d', 'mpz_mul_si', 'mpz_neg', 'mpz_nthroot', 'mpz_odd',
179
+ 'mpz_pollard_rho', 'mpz_pow_ui', 'mpz_powm', 'mpz_powm_ui', 'mpz_prime',
180
+ 'mpz_prime_factors', 'mpz_prime_mr', 'mpz_rand', 'mpz_rand_ui',
181
+ 'mpz_re_compose', 'mpz_remove', 'mpz_scan0', 'mpz_scan1', 'mpz_set',
182
+ 'mpz_set_d', 'mpz_set_si', 'mpz_set_str', 'mpz_set_v', 'mpz_sign',
183
+ 'mpz_sizeinbase', 'mpz_sqrt', 'mpz_sub', 'mpz_sub_si', 'mpz_sub_ui',
184
+ 'mpz_si_sub', 'mpz_tdiv_q_2exp', 'mpz_tdiv_r_2exp', 'mpz_tstbit',
185
+ 'mpz_ui_pow_ui', 'mpz_xor', 'named_dict', 'new_dict', 'new_queue',
186
+ 'new_stack', 'not_bits', 'not_bitsu', 'odd', 'or_all', 'or_allu',
187
+ 'or_bits', 'or_bitsu', 'ord', 'ordinal', 'ordinant',
188
+ 'override_timezone', 'pad', 'pad_head', 'pad_tail', 'parse_date_string',
189
+ 'papply', 'peep', 'peepn', 'peep_dict', 'permute', 'permutes',
190
+ 'platform', 'pop', 'popn', 'pop_dict', 'power', 'pp', 'ppEx', 'ppExf',
191
+ 'ppf', 'ppOpt', 'pq_add', 'pq_destroy', 'pq_empty', 'pq_new', 'pq_peek',
192
+ 'pq_pop', 'pq_pop_data', 'pq_size', 'prepend', 'prime_factors',
193
+ 'printf', 'product', 'proper', 'push', 'pushn', 'putd', 'puts',
194
+ 'queue_empty', 'queue_size', 'rand', 'rand_range', 'reinstate',
195
+ 'remainder', 'remove', 'remove_all', 'repeat', 'repeatch', 'replace',
196
+ 'requires', 'reverse', 'rfind', 'rgb', 'rmatch', 'rmdr', 'rnd', 'round',
197
+ 'routine_id', 'scanf', 'serialize', 'series', 'set_rand',
198
+ 'set_test_abort', 'set_test_logfile', 'set_test_module',
199
+ 'set_test_pause', 'set_test_verbosity', 'set_timedate_formats',
200
+ 'set_timezone', 'setd', 'setd_default', 'shorten', 'sha256',
201
+ 'shift_bits', 'shuffle', 'sign', 'sin', 'smallest', 'sort',
202
+ 'sort_columns', 'speak', 'splice', 'split', 'split_any', 'split_by',
203
+ 'sprint', 'sprintf', 'sq_abs', 'sq_add', 'sq_and', 'sq_and_bits',
204
+ 'sq_arccos', 'sq_arcsin', 'sq_arctan', 'sq_atom', 'sq_ceil', 'sq_cmp',
205
+ 'sq_cos', 'sq_div', 'sq_even', 'sq_eq', 'sq_floor', 'sq_floor_div',
206
+ 'sq_ge', 'sq_gt', 'sq_int', 'sq_le', 'sq_log', 'sq_log10', 'sq_log2',
207
+ 'sq_lt', 'sq_max', 'sq_min', 'sq_mod', 'sq_mul', 'sq_ne', 'sq_not',
208
+ 'sq_not_bits', 'sq_odd', 'sq_or', 'sq_or_bits', 'sq_power', 'sq_rand',
209
+ 'sq_remainder', 'sq_rmdr', 'sq_rnd', 'sq_round', 'sq_seq', 'sq_sign',
210
+ 'sq_sin', 'sq_sqrt', 'sq_str', 'sq_sub', 'sq_tan', 'sq_trunc',
211
+ 'sq_uminus', 'sq_xor', 'sq_xor_bits', 'sqrt', 'square_free',
212
+ 'stack_empty', 'stack_size', 'substitute', 'substitute_all', 'sum',
213
+ 'tail', 'tan', 'test_equal', 'test_fail', 'test_false',
214
+ 'test_not_equal', 'test_pass', 'test_summary', 'test_true',
215
+ 'text_color', 'throw', 'time', 'timedate_diff', 'timedelta',
216
+ 'to_integer', 'to_number', 'to_rgb', 'to_string', 'traverse_dict',
217
+ 'traverse_dict_partial_key', 'trim', 'trim_head', 'trim_tail', 'trunc',
218
+ 'tagset', 'tagstart', 'typeof', 'unique', 'unix_dict', 'upper',
219
+ 'utf8_to_utf32', 'utf32_to_utf8', 'version', 'vlookup', 'vslice',
220
+ 'wglGetProcAddress', 'wildcard_file', 'wildcard_match', 'with_rho',
221
+ 'with_theta', 'xml_new_doc', 'xml_new_element', 'xml_set_attribute',
222
+ 'xml_sprint', 'xor_bits', 'xor_bitsu',
223
+ 'accept', 'allocate', 'allocate_string', 'allow_break', 'ARM',
224
+ 'atom_to_float80', 'c_func', 'c_proc', 'call_back', 'chdir',
225
+ 'check_break', 'clearDib', 'close', 'closesocket', 'console',
226
+ 'copy_file', 'create', 'create_directory', 'create_thread',
227
+ 'curl_easy_cleanup', 'curl_easy_get_file', 'curl_easy_init',
228
+ 'curl_easy_perform', 'curl_easy_perform_ex', 'curl_easy_setopt',
229
+ 'curl_easy_strerror', 'curl_global_cleanup', 'curl_global_init',
230
+ 'curl_slist_append', 'curl_slist_free_all', 'current_dir', 'cursor',
231
+ 'define_c_func', 'define_c_proc', 'delete', 'delete_cs', 'delete_file',
232
+ 'dir', 'DLL', 'drawDib', 'drawShadedPolygonToDib', 'ELF32', 'ELF64',
233
+ 'enter_cs', 'eval', 'exit_thread', 'free', 'file_exists', 'final',
234
+ 'float80_to_atom', 'format', 'get_bytes', 'get_file_date',
235
+ 'get_file_size', 'get_file_type', 'get_interpreter', 'get_key',
236
+ 'get_socket_error', 'get_text', 'get_thread_exitcode', 'get_thread_id',
237
+ 'getc', 'getenv', 'gets', 'getsockaddr', 'glBegin', 'glCallList',
238
+ 'glFrustum', 'glGenLists', 'glGetString', 'glLight', 'glMaterial',
239
+ 'glNewList', 'glNormal', 'glPopMatrix', 'glPushMatrix', 'glRotate',
240
+ 'glEnd', 'glEndList', 'glTexImage2D', 'goto', 'GUI', 'icons', 'ilASM',
241
+ 'include_files', 'include_paths', 'init_cs', 'ip_to_string',
242
+ 'IupConfig', 'IupConfigDialogClosed', 'IupConfigDialogShow',
243
+ 'IupConfigGetVariableInt', 'IupConfigLoad', 'IupConfigSave',
244
+ 'IupConfigSetVariableInt', 'IupExitLoop', 'IupFileDlg', 'IupFileList',
245
+ 'IupGLSwapBuffers', 'IupHelp', 'IupLoopStep', 'IupMainLoop',
246
+ 'IupNormalizer', 'IupPlot', 'IupPlotAdd', 'IupPlotBegin', 'IupPlotEnd',
247
+ 'IupPlotInsert', 'IupSaveImage', 'IupTreeGetUserId', 'IupUser',
248
+ 'IupVersion', 'IupVersionDate', 'IupVersionNumber', 'IupVersionShow',
249
+ 'killDib', 'leave_cs', 'listen', 'manifest', 'mem_copy', 'mem_set',
250
+ 'mpfr_gamma', 'mpfr_printf', 'mpfr_sprintf', 'mpz_export', 'mpz_import',
251
+ 'namespace', 'new', 'newDib', 'open', 'open_dll', 'PE32', 'PE64',
252
+ 'peek', 'peek_string', 'peek1s', 'peek1u', 'peek2s', 'peek2u', 'peek4s',
253
+ 'peek4u', 'peek8s', 'peek8u', 'peekNS', 'peekns', 'peeknu', 'poke',
254
+ 'poke2', 'poke4', 'poke8', 'pokeN', 'poke_string', 'poke_wstring',
255
+ 'position', 'progress', 'prompt_number', 'prompt_string', 'read_file',
256
+ 'read_lines', 'recv', 'resume_thread', 'seek', 'select', 'send',
257
+ 'setHandler', 'shutdown', 'sleep', 'SO', 'sockaddr_in', 'socket',
258
+ 'split_path', 'suspend_thread', 'system', 'system_exec', 'system_open',
259
+ 'system_wait', 'task_clock_start', 'task_clock_stop', 'task_create',
260
+ 'task_delay', 'task_list', 'task_schedule', 'task_self', 'task_status',
261
+ 'task_suspend', 'task_yield', 'thread_safe_string', 'try_cs',
262
+ 'utf8_to_utf16', 'utf16_to_utf8', 'utf16_to_utf32', 'utf32_to_utf16',
263
+ 'video_config', 'WSACleanup', 'wait_thread', 'walk_dir', 'where',
264
+ 'write_lines', 'wait_key'
265
+ )
266
+ constants = (
267
+ 'ANY_QUEUE', 'ASCENDING', 'BLACK', 'BLOCK_CURSOR', 'BLUE',
268
+ 'BRIGHT_CYAN', 'BRIGHT_BLUE', 'BRIGHT_GREEN', 'BRIGHT_MAGENTA',
269
+ 'BRIGHT_RED', 'BRIGHT_WHITE', 'BROWN', 'C_DWORD', 'C_INT', 'C_POINTER',
270
+ 'C_USHORT', 'C_WORD', 'CD_AMBER', 'CD_BLACK', 'CD_BLUE', 'CD_BOLD',
271
+ 'CD_BOLD_ITALIC', 'CD_BOX', 'CD_CENTER', 'CD_CIRCLE', 'CD_CLOSED_LINES',
272
+ 'CD_CONTINUOUS', 'CD_CUSTOM', 'CD_CYAN', 'CD_DARK_BLUE', 'CD_DARK_CYAN',
273
+ 'CD_DARK_GRAY', 'CD_DARK_GREY', 'CD_DARK_GREEN', 'CD_DARK_MAGENTA',
274
+ 'CD_DARK_RED', 'CD_DARK_YELLOW', 'CD_DASH_DOT', 'CD_DASH_DOT_DOT',
275
+ 'CD_DASHED', 'CD_DBUFFER', 'CD_DEG2RAD', 'CD_DIAMOND', 'CD_DOTTED',
276
+ 'CD_EAST', 'CD_EVENODD', 'CD_FILL', 'CD_GL', 'CD_GRAY', 'CD_GREY',
277
+ 'CD_GREEN', 'CD_HATCH', 'CD_HOLLOW', 'CD_HOLLOW_BOX',
278
+ 'CD_HOLLOW_CIRCLE', 'CD_HOLLOW_DIAMOND', 'CD_INDIGO', 'CD_ITALIC',
279
+ 'CD_IUP', 'CD_IUPDBUFFER', 'CD_LIGHT_BLUE', 'CD_LIGHT_GRAY',
280
+ 'CD_LIGHT_GREY', 'CD_LIGHT_GREEN', 'CD_LIGHT_PARCHMENT', 'CD_MAGENTA',
281
+ 'CD_NAVY', 'CD_NORTH', 'CD_NORTH_EAST', 'CD_NORTH_WEST', 'CD_OLIVE',
282
+ 'CD_OPEN_LINES', 'CD_ORANGE', 'CD_PARCHMENT', 'CD_PATTERN',
283
+ 'CD_PRINTER', 'CD_PURPLE', 'CD_PLAIN', 'CD_PLUS', 'CD_QUERY',
284
+ 'CD_RAD2DEG', 'CD_RED', 'CD_SILVER', 'CD_SOLID', 'CD_SOUTH_EAST',
285
+ 'CD_SOUTH_WEST', 'CD_STAR', 'CD_STIPPLE', 'CD_STRIKEOUT',
286
+ 'CD_UNDERLINE', 'CD_WEST', 'CD_WHITE', 'CD_WINDING', 'CD_VIOLET',
287
+ 'CD_X', 'CD_YELLOW', 'CURLE_OK', 'CURLOPT_MAIL_FROM',
288
+ 'CURLOPT_MAIL_RCPT', 'CURLOPT_PASSWORD', 'CURLOPT_READDATA',
289
+ 'CURLOPT_READFUNCTION', 'CURLOPT_SSL_VERIFYPEER',
290
+ 'CURLOPT_SSL_VERIFYHOST', 'CURLOPT_UPLOAD', 'CURLOPT_URL',
291
+ 'CURLOPT_USE_SSL', 'CURLOPT_USERNAME', 'CURLOPT_VERBOSE',
292
+ 'CURLOPT_WRITEFUNCTION', 'CURLUSESSL_ALL', 'CYAN', 'D_NAME',
293
+ 'D_ATTRIBUTES', 'D_SIZE', 'D_YEAR', 'D_MONTH', 'D_DAY', 'D_HOUR',
294
+ 'D_MINUTE', 'D_SECOND', 'D_CREATION', 'D_LASTACCESS', 'D_MODIFICATION',
295
+ 'DT_YEAR', 'DT_MONTH', 'DT_DAY', 'DT_HOUR', 'DT_MINUTE', 'DT_SECOND',
296
+ 'DT_DOW', 'DT_MSEC', 'DT_DOY', 'DT_GMT', 'EULER', 'E_CODE', 'E_ADDR',
297
+ 'E_LINE', 'E_RTN', 'E_NAME', 'E_FILE', 'E_PATH', 'E_USER', 'false',
298
+ 'False', 'FALSE', 'FIFO_QUEUE', 'FILETYPE_DIRECTORY', 'FILETYPE_FILE',
299
+ 'GET_EOF', 'GET_FAIL', 'GET_IGNORE', 'GET_SUCCESS',
300
+ 'GL_AMBIENT_AND_DIFFUSE', 'GL_ARRAY_BUFFER', 'GL_CLAMP',
301
+ 'GL_CLAMP_TO_BORDER', 'GL_CLAMP_TO_EDGE', 'GL_COLOR_BUFFER_BIT',
302
+ 'GL_COMPILE', 'GL_COMPILE_STATUS', 'GL_CULL_FACE',
303
+ 'GL_DEPTH_BUFFER_BIT', 'GL_DEPTH_TEST', 'GL_EXTENSIONS', 'GL_FLAT',
304
+ 'GL_FLOAT', 'GL_FRAGMENT_SHADER', 'GL_FRONT', 'GL_LIGHT0',
305
+ 'GL_LIGHTING', 'GL_LINEAR', 'GL_LINK_STATUS', 'GL_MODELVIEW',
306
+ 'GL_NEAREST', 'GL_NO_ERROR', 'GL_NORMALIZE', 'GL_POSITION',
307
+ 'GL_PROJECTION', 'GL_QUAD_STRIP', 'GL_QUADS', 'GL_RENDERER',
308
+ 'GL_REPEAT', 'GL_RGB', 'GL_RGBA', 'GL_SMOOTH', 'GL_STATIC_DRAW',
309
+ 'GL_TEXTURE_2D', 'GL_TEXTURE_MAG_FILTER', 'GL_TEXTURE_MIN_FILTER',
310
+ 'GL_TEXTURE_WRAP_S', 'GL_TEXTURE_WRAP_T', 'GL_TRIANGLES',
311
+ 'GL_UNSIGNED_BYTE', 'GL_VENDOR', 'GL_VERSION', 'GL_VERTEX_SHADER',
312
+ 'GRAY', 'GREEN', 'GT_LF_STRIPPED', 'GT_WHOLE_FILE', 'INVLN10',
313
+ 'IUP_CLOSE', 'IUP_CONTINUE', 'IUP_DEFAULT', 'IUP_BLACK', 'IUP_BLUE',
314
+ 'IUP_BUTTON1', 'IUP_BUTTON3', 'IUP_CENTER', 'IUP_CYAN', 'IUP_DARK_BLUE',
315
+ 'IUP_DARK_CYAN', 'IUP_DARK_GRAY', 'IUP_DARK_GREY', 'IUP_DARK_GREEN',
316
+ 'IUP_DARK_MAGENTA', 'IUP_DARK_RED', 'IUP_GRAY', 'IUP_GREY', 'IUP_GREEN',
317
+ 'IUP_IGNORE', 'IUP_INDIGO', 'IUP_MAGENTA', 'IUP_MASK_INT',
318
+ 'IUP_MASK_UINT', 'IUP_MOUSEPOS', 'IUP_NAVY', 'IUP_OLIVE', 'IUP_RECTEXT',
319
+ 'IUP_RED', 'IUP_LIGHT_BLUE', 'IUP_LIGHT_GRAY', 'IUP_LIGHT_GREY',
320
+ 'IUP_LIGHT_GREEN', 'IUP_ORANGE', 'IUP_PARCHMENT', 'IUP_PURPLE',
321
+ 'IUP_SILVER', 'IUP_TEAL', 'IUP_VIOLET', 'IUP_WHITE', 'IUP_YELLOW',
322
+ 'K_BS', 'K_cA', 'K_cC', 'K_cD', 'K_cF5', 'K_cK', 'K_cM', 'K_cN', 'K_cO',
323
+ 'K_cP', 'K_cR', 'K_cS', 'K_cT', 'K_cW', 'K_CR', 'K_DEL', 'K_DOWN',
324
+ 'K_END', 'K_ESC', 'K_F1', 'K_F2', 'K_F3', 'K_F4', 'K_F5', 'K_F6',
325
+ 'K_F7', 'K_F8', 'K_F9', 'K_F10', 'K_F11', 'K_F12', 'K_HOME', 'K_INS',
326
+ 'K_LEFT', 'K_MIDDLE', 'K_PGDN', 'K_PGUP', 'K_RIGHT', 'K_SP', 'K_TAB',
327
+ 'K_UP', 'K_h', 'K_i', 'K_j', 'K_p', 'K_r', 'K_s', 'JS', 'LIFO_QUEUE',
328
+ 'LINUX', 'MAX_HEAP', 'MAGENTA', 'MIN_HEAP', 'Nan', 'NO_CURSOR', 'null',
329
+ 'NULL', 'PI', 'pp_Ascii', 'pp_Brkt', 'pp_Date', 'pp_File', 'pp_FltFmt',
330
+ 'pp_Indent', 'pp_IntCh', 'pp_IntFmt', 'pp_Maxlen', 'pp_Nest',
331
+ 'pp_Pause', 'pp_Q22', 'pp_StrFmt', 'RED', 'SEEK_OK', 'SLASH',
332
+ 'TEST_ABORT', 'TEST_CRASH', 'TEST_PAUSE', 'TEST_PAUSE_FAIL',
333
+ 'TEST_QUIET', 'TEST_SHOW_ALL', 'TEST_SHOW_FAILED', 'TEST_SUMMARY',
334
+ 'true', 'True', 'TRUE', 'VC_SCRNLINES', 'WHITE', 'WINDOWS', 'YELLOW'
335
+ )
336
+
337
+ tokens = {
338
+ 'root': [
339
+ (r"\s+", Whitespace),
340
+ (r'/\*|--/\*|#\[', Comment.Multiline, 'comment'),
341
+ (r'(?://|--|#!).*$', Comment.Single),
342
+ #Alt:
343
+ # (r'//.*$|--.*$|#!.*$', Comment.Single),
344
+ (r'"([^"\\]|\\.)*"', String.Other),
345
+ (r'\'[^\']*\'', String.Other),
346
+ (r'`[^`]*`', String.Other),
347
+
348
+ (words(types, prefix=r'\b', suffix=r'\b'), Name.Function),
349
+ (words(routines, prefix=r'\b', suffix=r'\b'), Name.Function),
350
+ (words(preproc, prefix=r'\b', suffix=r'\b'), Keyword.Declaration),
351
+ (words(keywords, prefix=r'\b', suffix=r'\b'), Keyword.Declaration),
352
+ (words(constants, prefix=r'\b', suffix=r'\b'), Name.Constant),
353
+ # Aside: Phix only supports/uses the ascii/non-unicode tilde
354
+ (r'!=|==|<<|>>|:=|[-~+/*%=<>&^|\.(){},?:\[\]$\\;#]', Operator),
355
+ (r'[\w-]+', Text)
356
+ ],
357
+ 'comment': [
358
+ (r'[^*/#]+', Comment.Multiline),
359
+ (r'/\*|#\[', Comment.Multiline, '#push'),
360
+ (r'\*/|#\]', Comment.Multiline, '#pop'),
361
+ (r'[*/#]', Comment.Multiline)
362
+ ]
363
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/php.py ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.php
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for PHP and related languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import Lexer, RegexLexer, include, bygroups, default, \
14
+ using, this, words, do_insertions, line_re
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Other, Generic
17
+ from pygments.util import get_bool_opt, get_list_opt, shebang_matches
18
+
19
+ __all__ = ['ZephirLexer', 'PsyshConsoleLexer', 'PhpLexer']
20
+
21
+
22
+ class ZephirLexer(RegexLexer):
23
+ """
24
+ For Zephir language source code.
25
+
26
+ Zephir is a compiled high level language aimed
27
+ to the creation of C-extensions for PHP.
28
+ """
29
+
30
+ name = 'Zephir'
31
+ url = 'http://zephir-lang.com/'
32
+ aliases = ['zephir']
33
+ filenames = ['*.zep']
34
+ version_added = '2.0'
35
+
36
+ zephir_keywords = ['fetch', 'echo', 'isset', 'empty']
37
+ zephir_type = ['bit', 'bits', 'string']
38
+
39
+ flags = re.DOTALL | re.MULTILINE
40
+
41
+ tokens = {
42
+ 'commentsandwhitespace': [
43
+ (r'\s+', Text),
44
+ (r'//.*?\n', Comment.Single),
45
+ (r'/\*.*?\*/', Comment.Multiline)
46
+ ],
47
+ 'slashstartsregex': [
48
+ include('commentsandwhitespace'),
49
+ (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
50
+ r'([gim]+\b|\B)', String.Regex, '#pop'),
51
+ (r'/', Operator, '#pop'),
52
+ default('#pop')
53
+ ],
54
+ 'badregex': [
55
+ (r'\n', Text, '#pop')
56
+ ],
57
+ 'root': [
58
+ (r'^(?=\s|/)', Text, 'slashstartsregex'),
59
+ include('commentsandwhitespace'),
60
+ (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
61
+ r'(<<|>>>?|==?|!=?|->|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
62
+ (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
63
+ (r'[})\].]', Punctuation),
64
+ (r'(for|in|while|do|break|return|continue|switch|case|default|if|else|loop|'
65
+ r'require|inline|throw|try|catch|finally|new|delete|typeof|instanceof|void|'
66
+ r'namespace|use|extends|this|fetch|isset|unset|echo|fetch|likely|unlikely|'
67
+ r'empty)\b', Keyword, 'slashstartsregex'),
68
+ (r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
69
+ (r'(abstract|boolean|bool|char|class|const|double|enum|export|extends|final|'
70
+ r'native|goto|implements|import|int|string|interface|long|ulong|char|uchar|'
71
+ r'float|unsigned|private|protected|public|short|static|self|throws|reverse|'
72
+ r'transient|volatile|readonly)\b', Keyword.Reserved),
73
+ (r'(true|false|null|undefined)\b', Keyword.Constant),
74
+ (r'(Array|Boolean|Date|_REQUEST|_COOKIE|_SESSION|'
75
+ r'_GET|_POST|_SERVER|this|stdClass|range|count|iterator|'
76
+ r'window)\b', Name.Builtin),
77
+ (r'[$a-zA-Z_][\w\\]*', Name.Other),
78
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
79
+ (r'0x[0-9a-fA-F]+', Number.Hex),
80
+ (r'[0-9]+', Number.Integer),
81
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
82
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
83
+ ]
84
+ }
85
+
86
+
87
+ class PsyshConsoleLexer(Lexer):
88
+ """
89
+ For PsySH console output, such as:
90
+
91
+ .. sourcecode:: psysh
92
+
93
+ >>> $greeting = function($name): string {
94
+ ... return "Hello, {$name}";
95
+ ... };
96
+ => Closure($name): string {#2371 …3}
97
+ >>> $greeting('World')
98
+ => "Hello, World"
99
+ """
100
+ name = 'PsySH console session for PHP'
101
+ url = 'https://psysh.org/'
102
+ aliases = ['psysh']
103
+ version_added = '2.7'
104
+
105
+ def __init__(self, **options):
106
+ options['startinline'] = True
107
+ Lexer.__init__(self, **options)
108
+
109
+ def get_tokens_unprocessed(self, text):
110
+ phplexer = PhpLexer(**self.options)
111
+ curcode = ''
112
+ insertions = []
113
+ for match in line_re.finditer(text):
114
+ line = match.group()
115
+ if line.startswith('>>> ') or line.startswith('... '):
116
+ insertions.append((len(curcode),
117
+ [(0, Generic.Prompt, line[:4])]))
118
+ curcode += line[4:]
119
+ elif line.rstrip() == '...':
120
+ insertions.append((len(curcode),
121
+ [(0, Generic.Prompt, '...')]))
122
+ curcode += line[3:]
123
+ else:
124
+ if curcode:
125
+ yield from do_insertions(
126
+ insertions, phplexer.get_tokens_unprocessed(curcode))
127
+ curcode = ''
128
+ insertions = []
129
+ yield match.start(), Generic.Output, line
130
+ if curcode:
131
+ yield from do_insertions(insertions,
132
+ phplexer.get_tokens_unprocessed(curcode))
133
+
134
+
135
+ class PhpLexer(RegexLexer):
136
+ """
137
+ For PHP source code.
138
+ For PHP embedded in HTML, use the `HtmlPhpLexer`.
139
+
140
+ Additional options accepted:
141
+
142
+ `startinline`
143
+ If given and ``True`` the lexer starts highlighting with
144
+ php code (i.e.: no starting ``<?php`` required). The default
145
+ is ``False``.
146
+ `funcnamehighlighting`
147
+ If given and ``True``, highlight builtin function names
148
+ (default: ``True``).
149
+ `disabledmodules`
150
+ If given, must be a list of module names whose function names
151
+ should not be highlighted. By default all modules are highlighted
152
+ except the special ``'unknown'`` module that includes functions
153
+ that are known to php but are undocumented.
154
+
155
+ To get a list of allowed modules have a look into the
156
+ `_php_builtins` module:
157
+
158
+ .. sourcecode:: pycon
159
+
160
+ >>> from pygments.lexers._php_builtins import MODULES
161
+ >>> MODULES.keys()
162
+ ['PHP Options/Info', 'Zip', 'dba', ...]
163
+
164
+ In fact the names of those modules match the module names from
165
+ the php documentation.
166
+ """
167
+
168
+ name = 'PHP'
169
+ url = 'https://www.php.net/'
170
+ aliases = ['php', 'php3', 'php4', 'php5']
171
+ filenames = ['*.php', '*.php[345]', '*.inc']
172
+ mimetypes = ['text/x-php']
173
+ version_added = ''
174
+
175
+ # Note that a backslash is included, PHP uses a backslash as a namespace
176
+ # separator.
177
+ _ident_inner = r'(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*'
178
+ # But not inside strings.
179
+ _ident_nons = r'(?:[_a-z]|[^\x00-\x7f])(?:\w|[^\x00-\x7f])*'
180
+
181
+ flags = re.IGNORECASE | re.DOTALL | re.MULTILINE
182
+ tokens = {
183
+ 'root': [
184
+ (r'<\?(php)?', Comment.Preproc, 'php'),
185
+ (r'[^<]+', Other),
186
+ (r'<', Other)
187
+ ],
188
+ 'php': [
189
+ (r'\?>', Comment.Preproc, '#pop'),
190
+ (r'(<<<)([\'"]?)(' + _ident_nons + r')(\2\n.*?\n\s*)(\3)(;?)(\n)',
191
+ bygroups(String, String, String.Delimiter, String, String.Delimiter,
192
+ Punctuation, Text)),
193
+ (r'\s+', Text),
194
+ (r'#\[', Punctuation, 'attribute'),
195
+ (r'#.*?\n', Comment.Single),
196
+ (r'//.*?\n', Comment.Single),
197
+ # put the empty comment here, it is otherwise seen as
198
+ # the start of a docstring
199
+ (r'/\*\*/', Comment.Multiline),
200
+ (r'/\*\*.*?\*/', String.Doc),
201
+ (r'/\*.*?\*/', Comment.Multiline),
202
+ (r'(->|::)(\s*)(' + _ident_nons + ')',
203
+ bygroups(Operator, Text, Name.Attribute)),
204
+ (r'[~!%^&*+=|:.<>/@-]+', Operator),
205
+ (r'\?', Operator), # don't add to the charclass above!
206
+ (r'[\[\]{}();,]+', Punctuation),
207
+ (r'(new)(\s+)(class)\b', bygroups(Keyword, Text, Keyword)),
208
+ (r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
209
+ (r'(function)(\s*)(?=\()', bygroups(Keyword, Text)),
210
+ (r'(function)(\s+)(&?)(\s*)',
211
+ bygroups(Keyword, Text, Operator, Text), 'functionname'),
212
+ (r'(const)(\s+)(' + _ident_inner + ')',
213
+ bygroups(Keyword, Text, Name.Constant)),
214
+ # source: https://www.php.net/manual/en/reserved.keywords.php
215
+ (r'(and|E_PARSE|old_function|E_ERROR|or|as|E_WARNING|parent|'
216
+ r'eval|PHP_OS|break|exit|case|extends|PHP_VERSION|cfunction|'
217
+ r'FALSE|print|for|require|continue|foreach|require_once|'
218
+ r'declare|return|default|static|do|switch|die|stdClass|'
219
+ r'echo|else|TRUE|elseif|var|empty|if|xor|enddeclare|include|'
220
+ r'virtual|endfor|include_once|while|endforeach|global|'
221
+ r'endif|list|endswitch|new|endwhile|not|'
222
+ r'array|E_ALL|NULL|final|php_user_filter|interface|'
223
+ r'implements|public|private|protected|abstract|clone|try|'
224
+ r'catch|throw|this|use|namespace|trait|yield( from)?|'
225
+ r'finally|match|readonly)\b', Keyword),
226
+ (r'(true|false|null)\b', Keyword.Constant),
227
+ include('magicconstants'),
228
+ (r'\$\{', Name.Variable, 'variablevariable'),
229
+ (r'\$+' + _ident_inner, Name.Variable),
230
+ (_ident_inner, Name.Other),
231
+ (r'(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?', Number.Float),
232
+ (r'\d+e[+-]?[0-9]+', Number.Float),
233
+ (r'0[0-7]+', Number.Oct),
234
+ (r'0x[a-f0-9]+', Number.Hex),
235
+ (r'\d+', Number.Integer),
236
+ (r'0b[01]+', Number.Bin),
237
+ (r"'([^'\\]*(?:\\.[^'\\]*)*)'", String.Single),
238
+ (r'`([^`\\]*(?:\\.[^`\\]*)*)`', String.Backtick),
239
+ (r'"', String.Double, 'string'),
240
+ ],
241
+ 'variablevariable': [
242
+ (r'\}', Name.Variable, '#pop'),
243
+ include('php')
244
+ ],
245
+ 'magicfuncs': [
246
+ # source: http://php.net/manual/en/language.oop5.magic.php
247
+ (words((
248
+ '__construct', '__destruct', '__call', '__callStatic', '__get', '__set',
249
+ '__isset', '__unset', '__sleep', '__wakeup', '__toString', '__invoke',
250
+ '__set_state', '__clone', '__debugInfo',), suffix=r'\b'),
251
+ Name.Function.Magic),
252
+ ],
253
+ 'magicconstants': [
254
+ # source: https://www.php.net/manual/en/language.constants.magic.php
255
+ (words((
256
+ '__LINE__', '__FILE__', '__DIR__', '__FUNCTION__', '__CLASS__',
257
+ '__TRAIT__', '__METHOD__', '__NAMESPACE__', '__PROPERTY__',),
258
+ suffix=r'\b'),
259
+ Name.Constant),
260
+ ],
261
+ 'classname': [
262
+ (_ident_inner, Name.Class, '#pop')
263
+ ],
264
+ 'functionname': [
265
+ include('magicfuncs'),
266
+ (_ident_inner, Name.Function, '#pop'),
267
+ default('#pop')
268
+ ],
269
+ 'string': [
270
+ (r'"', String.Double, '#pop'),
271
+ (r'[^{$"\\]+', String.Double),
272
+ (r'\\([nrt"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})', String.Escape),
273
+ (r'\$' + _ident_nons + r'(\[\S+?\]|->' + _ident_nons + ')?',
274
+ String.Interpol),
275
+ (r'(\{\$\{)(.*?)(\}\})',
276
+ bygroups(String.Interpol, using(this, _startinline=True),
277
+ String.Interpol)),
278
+ (r'(\{)(\$.*?)(\})',
279
+ bygroups(String.Interpol, using(this, _startinline=True),
280
+ String.Interpol)),
281
+ (r'(\$\{)(\S+)(\})',
282
+ bygroups(String.Interpol, Name.Variable, String.Interpol)),
283
+ (r'[${\\]', String.Double)
284
+ ],
285
+ 'attribute': [
286
+ (r'\]', Punctuation, '#pop'),
287
+ (r'\(', Punctuation, 'attributeparams'),
288
+ (_ident_inner, Name.Decorator),
289
+ include('php')
290
+ ],
291
+ 'attributeparams': [
292
+ (r'\)', Punctuation, '#pop'),
293
+ include('php')
294
+ ],
295
+ }
296
+
297
+ def __init__(self, **options):
298
+ self.funcnamehighlighting = get_bool_opt(
299
+ options, 'funcnamehighlighting', True)
300
+ self.disabledmodules = get_list_opt(
301
+ options, 'disabledmodules', ['unknown'])
302
+ self.startinline = get_bool_opt(options, 'startinline', False)
303
+
304
+ # private option argument for the lexer itself
305
+ if '_startinline' in options:
306
+ self.startinline = options.pop('_startinline')
307
+
308
+ # collect activated functions in a set
309
+ self._functions = set()
310
+ if self.funcnamehighlighting:
311
+ from pygments.lexers._php_builtins import MODULES
312
+ for key, value in MODULES.items():
313
+ if key not in self.disabledmodules:
314
+ self._functions.update(value)
315
+ RegexLexer.__init__(self, **options)
316
+
317
+ def get_tokens_unprocessed(self, text):
318
+ stack = ['root']
319
+ if self.startinline:
320
+ stack.append('php')
321
+ for index, token, value in \
322
+ RegexLexer.get_tokens_unprocessed(self, text, stack):
323
+ if token is Name.Other:
324
+ if value in self._functions:
325
+ yield index, Name.Builtin, value
326
+ continue
327
+ yield index, token, value
328
+
329
+ def analyse_text(text):
330
+ if shebang_matches(text, r'php'):
331
+ return True
332
+ rv = 0.0
333
+ if re.search(r'<\?(?!xml)', text):
334
+ rv += 0.3
335
+ return rv
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/pointless.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.pointless
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Pointless.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words
12
+ from pygments.token import Comment, Error, Keyword, Name, Number, Operator, \
13
+ Punctuation, String, Text
14
+
15
+ __all__ = ['PointlessLexer']
16
+
17
+
18
+ class PointlessLexer(RegexLexer):
19
+ """
20
+ For Pointless source code.
21
+ """
22
+
23
+ name = 'Pointless'
24
+ url = 'https://ptls.dev'
25
+ aliases = ['pointless']
26
+ filenames = ['*.ptls']
27
+ version_added = '2.7'
28
+
29
+ ops = words([
30
+ "+", "-", "*", "/", "**", "%", "+=", "-=", "*=",
31
+ "/=", "**=", "%=", "|>", "=", "==", "!=", "<", ">",
32
+ "<=", ">=", "=>", "$", "++",
33
+ ])
34
+
35
+ keywords = words([
36
+ "if", "then", "else", "where", "with", "cond",
37
+ "case", "and", "or", "not", "in", "as", "for",
38
+ "requires", "throw", "try", "catch", "when",
39
+ "yield", "upval",
40
+ ], suffix=r'\b')
41
+
42
+ tokens = {
43
+ 'root': [
44
+ (r'[ \n\r]+', Text),
45
+ (r'--.*$', Comment.Single),
46
+ (r'"""', String, 'multiString'),
47
+ (r'"', String, 'string'),
48
+ (r'[\[\](){}:;,.]', Punctuation),
49
+ (ops, Operator),
50
+ (keywords, Keyword),
51
+ (r'\d+|\d*\.\d+', Number),
52
+ (r'(true|false)\b', Name.Builtin),
53
+ (r'[A-Z][a-zA-Z0-9]*\b', String.Symbol),
54
+ (r'output\b', Name.Variable.Magic),
55
+ (r'(export|import)\b', Keyword.Namespace),
56
+ (r'[a-z][a-zA-Z0-9]*\b', Name.Variable)
57
+ ],
58
+ 'multiString': [
59
+ (r'\\.', String.Escape),
60
+ (r'"""', String, '#pop'),
61
+ (r'"', String),
62
+ (r'[^\\"]+', String),
63
+ ],
64
+ 'string': [
65
+ (r'\\.', String.Escape),
66
+ (r'"', String, '#pop'),
67
+ (r'\n', Error),
68
+ (r'[^\\"]+', String),
69
+ ],
70
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/pony.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.pony
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Pony and related languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, words
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation
14
+
15
+ __all__ = ['PonyLexer']
16
+
17
+
18
+ class PonyLexer(RegexLexer):
19
+ """
20
+ For Pony source code.
21
+ """
22
+
23
+ name = 'Pony'
24
+ aliases = ['pony']
25
+ filenames = ['*.pony']
26
+ url = 'https://www.ponylang.io'
27
+ version_added = '2.4'
28
+
29
+ _caps = r'(iso|trn|ref|val|box|tag)'
30
+
31
+ tokens = {
32
+ 'root': [
33
+ (r'\n', Text),
34
+ (r'[^\S\n]+', Text),
35
+ (r'//.*\n', Comment.Single),
36
+ (r'/\*', Comment.Multiline, 'nested_comment'),
37
+ (r'"""(?:.|\n)*?"""', String.Doc),
38
+ (r'"', String, 'string'),
39
+ (r'\'.*\'', String.Char),
40
+ (r'=>|[]{}:().~;,|&!^?[]', Punctuation),
41
+ (words((
42
+ 'addressof', 'and', 'as', 'consume', 'digestof', 'is', 'isnt',
43
+ 'not', 'or'),
44
+ suffix=r'\b'),
45
+ Operator.Word),
46
+ (r'!=|==|<<|>>|[-+/*%=<>]', Operator),
47
+ (words((
48
+ 'box', 'break', 'compile_error', 'compile_intrinsic',
49
+ 'continue', 'do', 'else', 'elseif', 'embed', 'end', 'error',
50
+ 'for', 'if', 'ifdef', 'in', 'iso', 'lambda', 'let', 'match',
51
+ 'object', 'recover', 'ref', 'repeat', 'return', 'tag', 'then',
52
+ 'this', 'trn', 'try', 'until', 'use', 'var', 'val', 'where',
53
+ 'while', 'with', '#any', '#read', '#send', '#share'),
54
+ suffix=r'\b'),
55
+ Keyword),
56
+ (r'(actor|class|struct|primitive|interface|trait|type)((?:\s)+)',
57
+ bygroups(Keyword, Text), 'typename'),
58
+ (r'(new|fun|be)((?:\s)+)', bygroups(Keyword, Text), 'methodname'),
59
+ (words((
60
+ 'I8', 'U8', 'I16', 'U16', 'I32', 'U32', 'I64', 'U64', 'I128',
61
+ 'U128', 'ILong', 'ULong', 'ISize', 'USize', 'F32', 'F64',
62
+ 'Bool', 'Pointer', 'None', 'Any', 'Array', 'String',
63
+ 'Iterator'),
64
+ suffix=r'\b'),
65
+ Name.Builtin.Type),
66
+ (r'_?[A-Z]\w*', Name.Type),
67
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+', Number.Float),
68
+ (r'0x[0-9a-fA-F]+', Number.Hex),
69
+ (r'\d+', Number.Integer),
70
+ (r'(true|false)\b', Name.Builtin),
71
+ (r'_\d*', Name),
72
+ (r'_?[a-z][\w\']*', Name)
73
+ ],
74
+ 'typename': [
75
+ (_caps + r'?((?:\s)*)(_?[A-Z]\w*)',
76
+ bygroups(Keyword, Text, Name.Class), '#pop')
77
+ ],
78
+ 'methodname': [
79
+ (_caps + r'?((?:\s)*)(_?[a-z]\w*)',
80
+ bygroups(Keyword, Text, Name.Function), '#pop')
81
+ ],
82
+ 'nested_comment': [
83
+ (r'[^*/]+', Comment.Multiline),
84
+ (r'/\*', Comment.Multiline, '#push'),
85
+ (r'\*/', Comment.Multiline, '#pop'),
86
+ (r'[*/]', Comment.Multiline)
87
+ ],
88
+ 'string': [
89
+ (r'"', String, '#pop'),
90
+ (r'\\"', String),
91
+ (r'[^\\"]+', String)
92
+ ]
93
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/praat.py ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.praat
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Praat
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, words, bygroups, include
12
+ from pygments.token import Name, Text, Comment, Keyword, String, Punctuation, \
13
+ Number, Operator, Whitespace
14
+
15
+ __all__ = ['PraatLexer']
16
+
17
+
18
+ class PraatLexer(RegexLexer):
19
+ """
20
+ For Praat scripts.
21
+ """
22
+
23
+ name = 'Praat'
24
+ url = 'http://www.praat.org'
25
+ aliases = ['praat']
26
+ filenames = ['*.praat', '*.proc', '*.psc']
27
+ version_added = '2.1'
28
+
29
+ keywords = (
30
+ 'if', 'then', 'else', 'elsif', 'elif', 'endif', 'fi', 'for', 'from', 'to',
31
+ 'endfor', 'endproc', 'while', 'endwhile', 'repeat', 'until', 'select', 'plus',
32
+ 'minus', 'demo', 'assert', 'stopwatch', 'nocheck', 'nowarn', 'noprogress',
33
+ 'editor', 'endeditor', 'clearinfo',
34
+ )
35
+
36
+ functions_string = (
37
+ 'backslashTrigraphsToUnicode', 'chooseDirectory', 'chooseReadFile',
38
+ 'chooseWriteFile', 'date', 'demoKey', 'do', 'environment', 'extractLine',
39
+ 'extractWord', 'fixed', 'info', 'left', 'mid', 'percent', 'readFile', 'replace',
40
+ 'replace_regex', 'right', 'selected', 'string', 'unicodeToBackslashTrigraphs',
41
+ )
42
+
43
+ functions_numeric = (
44
+ 'abs', 'appendFile', 'appendFileLine', 'appendInfo', 'appendInfoLine', 'arccos',
45
+ 'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctan2', 'arctanh', 'barkToHertz',
46
+ 'beginPause', 'beginSendPraat', 'besselI', 'besselK', 'beta', 'beta2',
47
+ 'binomialP', 'binomialQ', 'boolean', 'ceiling', 'chiSquareP', 'chiSquareQ',
48
+ 'choice', 'comment', 'cos', 'cosh', 'createDirectory', 'deleteFile',
49
+ 'demoClicked', 'demoClickedIn', 'demoCommandKeyPressed',
50
+ 'demoExtraControlKeyPressed', 'demoInput', 'demoKeyPressed',
51
+ 'demoOptionKeyPressed', 'demoShiftKeyPressed', 'demoShow', 'demoWaitForInput',
52
+ 'demoWindowTitle', 'demoX', 'demoY', 'differenceLimensToPhon', 'do', 'editor',
53
+ 'endPause', 'endSendPraat', 'endsWith', 'erb', 'erbToHertz', 'erf', 'erfc',
54
+ 'exitScript', 'exp', 'extractNumber', 'fileReadable', 'fisherP', 'fisherQ',
55
+ 'floor', 'gaussP', 'gaussQ', 'hertzToBark', 'hertzToErb', 'hertzToMel',
56
+ 'hertzToSemitones', 'imax', 'imin', 'incompleteBeta', 'incompleteGammaP', 'index',
57
+ 'index_regex', 'integer', 'invBinomialP', 'invBinomialQ', 'invChiSquareQ', 'invFisherQ',
58
+ 'invGaussQ', 'invSigmoid', 'invStudentQ', 'length', 'ln', 'lnBeta', 'lnGamma',
59
+ 'log10', 'log2', 'max', 'melToHertz', 'min', 'minusObject', 'natural', 'number',
60
+ 'numberOfColumns', 'numberOfRows', 'numberOfSelected', 'objectsAreIdentical',
61
+ 'option', 'optionMenu', 'pauseScript', 'phonToDifferenceLimens', 'plusObject',
62
+ 'positive', 'randomBinomial', 'randomGauss', 'randomInteger', 'randomPoisson',
63
+ 'randomUniform', 'real', 'readFile', 'removeObject', 'rindex', 'rindex_regex',
64
+ 'round', 'runScript', 'runSystem', 'runSystem_nocheck', 'selectObject',
65
+ 'selected', 'semitonesToHertz', 'sentence', 'sentencetext', 'sigmoid', 'sin', 'sinc',
66
+ 'sincpi', 'sinh', 'soundPressureToPhon', 'sqrt', 'startsWith', 'studentP',
67
+ 'studentQ', 'tan', 'tanh', 'text', 'variableExists', 'word', 'writeFile', 'writeFileLine',
68
+ 'writeInfo', 'writeInfoLine',
69
+ )
70
+
71
+ functions_array = (
72
+ 'linear', 'randomGauss', 'randomInteger', 'randomUniform', 'zero',
73
+ )
74
+
75
+ objects = (
76
+ 'Activation', 'AffineTransform', 'AmplitudeTier', 'Art', 'Artword',
77
+ 'Autosegment', 'BarkFilter', 'BarkSpectrogram', 'CCA', 'Categories',
78
+ 'Cepstrogram', 'Cepstrum', 'Cepstrumc', 'ChebyshevSeries', 'ClassificationTable',
79
+ 'Cochleagram', 'Collection', 'ComplexSpectrogram', 'Configuration', 'Confusion',
80
+ 'ContingencyTable', 'Corpus', 'Correlation', 'Covariance',
81
+ 'CrossCorrelationTable', 'CrossCorrelationTables', 'DTW', 'DataModeler',
82
+ 'Diagonalizer', 'Discriminant', 'Dissimilarity', 'Distance', 'Distributions',
83
+ 'DurationTier', 'EEG', 'ERP', 'ERPTier', 'EditCostsTable', 'EditDistanceTable',
84
+ 'Eigen', 'Excitation', 'Excitations', 'ExperimentMFC', 'FFNet', 'FeatureWeights',
85
+ 'FileInMemory', 'FilesInMemory', 'Formant', 'FormantFilter', 'FormantGrid',
86
+ 'FormantModeler', 'FormantPoint', 'FormantTier', 'GaussianMixture', 'HMM',
87
+ 'HMM_Observation', 'HMM_ObservationSequence', 'HMM_State', 'HMM_StateSequence',
88
+ 'Harmonicity', 'ISpline', 'Index', 'Intensity', 'IntensityTier', 'IntervalTier',
89
+ 'KNN', 'KlattGrid', 'KlattTable', 'LFCC', 'LPC', 'Label', 'LegendreSeries',
90
+ 'LinearRegression', 'LogisticRegression', 'LongSound', 'Ltas', 'MFCC', 'MSpline',
91
+ 'ManPages', 'Manipulation', 'Matrix', 'MelFilter', 'MelSpectrogram',
92
+ 'MixingMatrix', 'Movie', 'Network', 'Object', 'OTGrammar', 'OTHistory', 'OTMulti',
93
+ 'PCA', 'PairDistribution', 'ParamCurve', 'Pattern', 'Permutation', 'Photo',
94
+ 'Pitch', 'PitchModeler', 'PitchTier', 'PointProcess', 'Polygon', 'Polynomial',
95
+ 'PowerCepstrogram', 'PowerCepstrum', 'Procrustes', 'RealPoint', 'RealTier',
96
+ 'ResultsMFC', 'Roots', 'SPINET', 'SSCP', 'SVD', 'Salience', 'ScalarProduct',
97
+ 'Similarity', 'SimpleString', 'SortedSetOfString', 'Sound', 'Speaker',
98
+ 'Spectrogram', 'Spectrum', 'SpectrumTier', 'SpeechSynthesizer', 'SpellingChecker',
99
+ 'Strings', 'StringsIndex', 'Table', 'TableOfReal', 'TextGrid', 'TextInterval',
100
+ 'TextPoint', 'TextTier', 'Tier', 'Transition', 'VocalTract', 'VocalTractTier',
101
+ 'Weight', 'WordList',
102
+ )
103
+
104
+ variables_numeric = (
105
+ 'macintosh', 'windows', 'unix', 'praatVersion', 'pi', 'e', 'undefined',
106
+ )
107
+
108
+ variables_string = (
109
+ 'praatVersion', 'tab', 'shellDirectory', 'homeDirectory',
110
+ 'preferencesDirectory', 'newline', 'temporaryDirectory',
111
+ 'defaultDirectory',
112
+ )
113
+
114
+ object_attributes = (
115
+ 'ncol', 'nrow', 'xmin', 'ymin', 'xmax', 'ymax', 'nx', 'ny', 'dx', 'dy',
116
+ )
117
+
118
+ tokens = {
119
+ 'root': [
120
+ (r'(\s+)(#.*?$)', bygroups(Whitespace, Comment.Single)),
121
+ (r'^#.*?$', Comment.Single),
122
+ (r';[^\n]*', Comment.Single),
123
+ (r'\s+', Whitespace),
124
+
125
+ (r'\bprocedure\b', Keyword, 'procedure_definition'),
126
+ (r'\bcall\b', Keyword, 'procedure_call'),
127
+ (r'@', Name.Function, 'procedure_call'),
128
+
129
+ include('function_call'),
130
+
131
+ (words(keywords, suffix=r'\b'), Keyword),
132
+
133
+ (r'(\bform\b)(\s+)([^\n]+)',
134
+ bygroups(Keyword, Whitespace, String), 'old_form'),
135
+
136
+ (r'(print(?:line|tab)?|echo|exit|asserterror|pause|send(?:praat|socket)|'
137
+ r'include|execute|system(?:_nocheck)?)(\s+)',
138
+ bygroups(Keyword, Whitespace), 'string_unquoted'),
139
+
140
+ (r'(goto|label)(\s+)(\w+)', bygroups(Keyword, Whitespace, Name.Label)),
141
+
142
+ include('variable_name'),
143
+ include('number'),
144
+
145
+ (r'"', String, 'string'),
146
+
147
+ (words((objects), suffix=r'(?=\s+\S+\n)'), Name.Class, 'string_unquoted'),
148
+
149
+ (r'\b[A-Z]', Keyword, 'command'),
150
+ (r'(\.{3}|[)(,])', Punctuation),
151
+ ],
152
+ 'command': [
153
+ (r'( ?[\w()-]+ ?)', Keyword),
154
+
155
+ include('string_interpolated'),
156
+
157
+ (r'\.{3}', Keyword, ('#pop', 'old_arguments')),
158
+ (r':', Keyword, ('#pop', 'comma_list')),
159
+ (r'\s', Whitespace, '#pop'),
160
+ ],
161
+ 'procedure_call': [
162
+ (r'\s+', Whitespace),
163
+ (r'([\w.]+)(?:(:)|(?:(\s*)(\()))',
164
+ bygroups(Name.Function, Punctuation,
165
+ Text.Whitespace, Punctuation), '#pop'),
166
+ (r'([\w.]+)', Name.Function, ('#pop', 'old_arguments')),
167
+ ],
168
+ 'procedure_definition': [
169
+ (r'\s', Whitespace),
170
+ (r'([\w.]+)(\s*?[(:])',
171
+ bygroups(Name.Function, Whitespace), '#pop'),
172
+ (r'([\w.]+)([^\n]*)',
173
+ bygroups(Name.Function, Text), '#pop'),
174
+ ],
175
+ 'function_call': [
176
+ (words(functions_string, suffix=r'\$(?=\s*[:(])'), Name.Function, 'function'),
177
+ (words(functions_array, suffix=r'#(?=\s*[:(])'), Name.Function, 'function'),
178
+ (words(functions_numeric, suffix=r'(?=\s*[:(])'), Name.Function, 'function'),
179
+ ],
180
+ 'function': [
181
+ (r'\s+', Whitespace),
182
+ (r':', Punctuation, ('#pop', 'comma_list')),
183
+ (r'\s*\(', Punctuation, ('#pop', 'comma_list')),
184
+ ],
185
+ 'comma_list': [
186
+ (r'(\s*\n\s*)(\.{3})', bygroups(Whitespace, Punctuation)),
187
+
188
+ (r'(\s*)(?:([)\]])|(\n))', bygroups(
189
+ Whitespace, Punctuation, Whitespace), '#pop'),
190
+
191
+ (r'\s+', Whitespace),
192
+ (r'"', String, 'string'),
193
+ (r'\b(if|then|else|fi|endif)\b', Keyword),
194
+
195
+ include('function_call'),
196
+ include('variable_name'),
197
+ include('operator'),
198
+ include('number'),
199
+
200
+ (r'[()]', Text),
201
+ (r',', Punctuation),
202
+ ],
203
+ 'old_arguments': [
204
+ (r'\n', Whitespace, '#pop'),
205
+
206
+ include('variable_name'),
207
+ include('operator'),
208
+ include('number'),
209
+
210
+ (r'"', String, 'string'),
211
+ (r'[^\n]', Text),
212
+ ],
213
+ 'number': [
214
+ (r'\n', Whitespace, '#pop'),
215
+ (r'\b\d+(\.\d*)?([eE][-+]?\d+)?%?', Number),
216
+ ],
217
+ 'object_reference': [
218
+ include('string_interpolated'),
219
+ (r'([a-z][a-zA-Z0-9_]*|\d+)', Name.Builtin),
220
+
221
+ (words(object_attributes, prefix=r'\.'), Name.Builtin, '#pop'),
222
+
223
+ (r'\$', Name.Builtin),
224
+ (r'\[', Text, '#pop'),
225
+ ],
226
+ 'variable_name': [
227
+ include('operator'),
228
+ include('number'),
229
+
230
+ (words(variables_string, suffix=r'\$'), Name.Variable.Global),
231
+ (words(variables_numeric,
232
+ suffix=r'(?=[^a-zA-Z0-9_."\'$#\[:(]|\s|^|$)'),
233
+ Name.Variable.Global),
234
+
235
+ (words(objects, prefix=r'\b', suffix=r"(_)"),
236
+ bygroups(Name.Builtin, Name.Builtin),
237
+ 'object_reference'),
238
+
239
+ (r'\.?_?[a-z][\w.]*(\$|#)?', Text),
240
+ (r'[\[\]]', Punctuation, 'comma_list'),
241
+
242
+ include('string_interpolated'),
243
+ ],
244
+ 'operator': [
245
+ (r'([+\/*<>=!-]=?|[&*|][&*|]?|\^|<>)', Operator),
246
+ (r'(?<![\w.])(and|or|not|div|mod)(?![\w.])', Operator.Word),
247
+ ],
248
+ 'string_interpolated': [
249
+ (r'\'[_a-z][^\[\]\'":]*(\[([\d,]+|"[\w,]+")\])?(:[0-9]+)?\'',
250
+ String.Interpol),
251
+ ],
252
+ 'string_unquoted': [
253
+ (r'(\n\s*)(\.{3})', bygroups(Whitespace, Punctuation)),
254
+
255
+ (r'\n', Whitespace, '#pop'),
256
+ (r'\s', Whitespace),
257
+
258
+ include('string_interpolated'),
259
+
260
+ (r"'", String),
261
+ (r"[^'\n]+", String),
262
+ ],
263
+ 'string': [
264
+ (r'(\n\s*)(\.{3})', bygroups(Whitespace, Punctuation)),
265
+
266
+ (r'"', String, '#pop'),
267
+
268
+ include('string_interpolated'),
269
+
270
+ (r"'", String),
271
+ (r'[^\'"\n]+', String),
272
+ ],
273
+ 'old_form': [
274
+ (r'(\s+)(#.*?$)', bygroups(Whitespace, Comment.Single)),
275
+ (r'\s+', Whitespace),
276
+
277
+ (r'(optionmenu|choice)([ \t]+)(\S+)(:)([ \t]+)',
278
+ bygroups(Keyword, Whitespace, Text, Punctuation, Whitespace), 'number'),
279
+
280
+ (r'(option|button)([ \t]+)',
281
+ bygroups(Keyword, Whitespace), 'string_unquoted'),
282
+
283
+ (r'(sentence|text)([ \t]+)(\S+)',
284
+ bygroups(Keyword, Whitespace, String), 'string_unquoted'),
285
+
286
+ (r'(word)([ \t]+)(\S+)([ \t]*)(\S+)?(?:([ \t]+)(.*))?',
287
+ bygroups(Keyword, Whitespace, Text, Whitespace, Text, Whitespace, Text)),
288
+
289
+ (r'(boolean)(\s+\S+\s*)(0|1|"?(?:yes|no)"?)',
290
+ bygroups(Keyword, Whitespace, Name.Variable)),
291
+
292
+ # Ideally processing of the number would happen in the 'number'
293
+ # but that doesn't seem to work
294
+ (r'(real|natural|positive|integer)([ \t]+\S+[ \t]*)([+-]?)(\d+(?:\.\d*)?'
295
+ r'(?:[eE][-+]?\d+)?%?)',
296
+ bygroups(Keyword, Whitespace, Operator, Number)),
297
+
298
+ (r'(comment)(\s+)',
299
+ bygroups(Keyword, Whitespace), 'string_unquoted'),
300
+
301
+ (r'\bendform\b', Keyword, '#pop'),
302
+ ]
303
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/procfile.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.procfile
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Procfile file format.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups
12
+ from pygments.token import Name, Number, String, Text, Punctuation
13
+
14
+ __all__ = ["ProcfileLexer"]
15
+
16
+
17
+ class ProcfileLexer(RegexLexer):
18
+ """
19
+ Lexer for Procfile file format.
20
+
21
+ The format is used to run processes on Heroku or is used by Foreman or
22
+ Honcho tools.
23
+ """
24
+ name = 'Procfile'
25
+ url = 'https://devcenter.heroku.com/articles/procfile#procfile-format'
26
+ aliases = ['procfile']
27
+ filenames = ['Procfile']
28
+ version_added = '2.10'
29
+
30
+ tokens = {
31
+ 'root': [
32
+ (r'^([a-z]+)(:)', bygroups(Name.Label, Punctuation)),
33
+ (r'\s+', Text.Whitespace),
34
+ (r'"[^"]*"', String),
35
+ (r"'[^']*'", String),
36
+ (r'[0-9]+', Number.Integer),
37
+ (r'\$[a-zA-Z_][\w]*', Name.Variable),
38
+ (r'(\w+)(=)(\w+)', bygroups(Name.Variable, Punctuation, String)),
39
+ (r'([\w\-\./]+)', Text),
40
+ ],
41
+ }
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/prolog.py ADDED
@@ -0,0 +1,318 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.prolog
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Prolog and Prolog-like languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, bygroups
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation
16
+
17
+ __all__ = ['PrologLexer', 'LogtalkLexer']
18
+
19
+
20
+ class PrologLexer(RegexLexer):
21
+ """
22
+ Lexer for Prolog files.
23
+ """
24
+ name = 'Prolog'
25
+ aliases = ['prolog']
26
+ filenames = ['*.ecl', '*.prolog', '*.pro', '*.pl']
27
+ mimetypes = ['text/x-prolog']
28
+ url = 'https://en.wikipedia.org/wiki/Prolog'
29
+ version_added = ''
30
+
31
+ tokens = {
32
+ 'root': [
33
+ (r'/\*', Comment.Multiline, 'nested-comment'),
34
+ (r'%.*', Comment.Single),
35
+ # character literal
36
+ (r'0\'.', String.Char),
37
+ (r'0b[01]+', Number.Bin),
38
+ (r'0o[0-7]+', Number.Oct),
39
+ (r'0x[0-9a-fA-F]+', Number.Hex),
40
+ # literal with prepended base
41
+ (r'\d\d?\'[a-zA-Z0-9]+', Number.Integer),
42
+ (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
43
+ (r'\d+', Number.Integer),
44
+ (r'[\[\](){}|.,;!]', Punctuation),
45
+ (r':-|-->', Punctuation),
46
+ (r'"(?:\\x[0-9a-fA-F]+\\|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|'
47
+ r'\\[0-7]+\\|\\["\\abcefnrstv]|[^\\"])*"', String.Double),
48
+ (r"'(?:''|[^'])*'", String.Atom), # quoted atom
49
+ # Needs to not be followed by an atom.
50
+ # (r'=(?=\s|[a-zA-Z\[])', Operator),
51
+ (r'is\b', Operator),
52
+ (r'(<|>|=<|>=|==|=:=|=|/|//|\*|\+|-)(?=\s|[a-zA-Z0-9\[])',
53
+ Operator),
54
+ (r'(mod|div|not)\b', Operator),
55
+ (r'_', Keyword), # The don't-care variable
56
+ (r'([a-z]+)(:)', bygroups(Name.Namespace, Punctuation)),
57
+ (r'([a-z\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]'
58
+ r'[\w$\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]*)'
59
+ r'(\s*)(:-|-->)',
60
+ bygroups(Name.Function, Text, Operator)), # function defn
61
+ (r'([a-z\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]'
62
+ r'[\w$\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]*)'
63
+ r'(\s*)(\()',
64
+ bygroups(Name.Function, Text, Punctuation)),
65
+ (r'[a-z\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]'
66
+ r'[\w$\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]*',
67
+ String.Atom), # atom, characters
68
+ # This one includes !
69
+ (r'[#&*+\-./:<=>?@\\^~\u00a1-\u00bf\u2010-\u303f]+',
70
+ String.Atom), # atom, graphics
71
+ (r'[A-Z_]\w*', Name.Variable),
72
+ (r'\s+|[\u2000-\u200f\ufff0-\ufffe\uffef]', Text),
73
+ ],
74
+ 'nested-comment': [
75
+ (r'\*/', Comment.Multiline, '#pop'),
76
+ (r'/\*', Comment.Multiline, '#push'),
77
+ (r'[^*/]+', Comment.Multiline),
78
+ (r'[*/]', Comment.Multiline),
79
+ ],
80
+ }
81
+
82
+ def analyse_text(text):
83
+ """Competes with IDL and Visual Prolog on *.pro"""
84
+ if ':-' in text:
85
+ # Visual Prolog also uses :-
86
+ return 0.5
87
+ else:
88
+ return 0
89
+
90
+
91
+ class LogtalkLexer(RegexLexer):
92
+ """
93
+ For Logtalk source code.
94
+ """
95
+
96
+ name = 'Logtalk'
97
+ url = 'http://logtalk.org/'
98
+ aliases = ['logtalk']
99
+ filenames = ['*.lgt', '*.logtalk']
100
+ mimetypes = ['text/x-logtalk']
101
+ version_added = '0.10'
102
+
103
+ tokens = {
104
+ 'root': [
105
+ # Directives
106
+ (r'^\s*:-\s', Punctuation, 'directive'),
107
+ # Comments
108
+ (r'%.*?\n', Comment),
109
+ (r'/\*(.|\n)*?\*/', Comment),
110
+ # Whitespace
111
+ (r'\n', Text),
112
+ (r'\s+', Text),
113
+ # Numbers
114
+ (r"0'[\\]?.", Number),
115
+ (r'0b[01]+', Number.Bin),
116
+ (r'0o[0-7]+', Number.Oct),
117
+ (r'0x[0-9a-fA-F]+', Number.Hex),
118
+ (r'\d+\.?\d*((e|E)(\+|-)?\d+)?', Number),
119
+ # Variables
120
+ (r'([A-Z_][a-zA-Z0-9_]*)', Name.Variable),
121
+ # Event handlers
122
+ (r'(after|before)(?=[(])', Keyword),
123
+ # Message forwarding handler
124
+ (r'forward(?=[(])', Keyword),
125
+ # Execution-context methods
126
+ (r'(context|parameter|this|se(lf|nder))(?=[(])', Keyword),
127
+ # Reflection
128
+ (r'(current_predicate|predicate_property)(?=[(])', Keyword),
129
+ # DCGs and term expansion
130
+ (r'(expand_(goal|term)|(goal|term)_expansion|phrase)(?=[(])', Keyword),
131
+ # Entity
132
+ (r'(abolish|c(reate|urrent))_(object|protocol|category)(?=[(])', Keyword),
133
+ (r'(object|protocol|category)_property(?=[(])', Keyword),
134
+ # Entity relations
135
+ (r'co(mplements_object|nforms_to_protocol)(?=[(])', Keyword),
136
+ (r'extends_(object|protocol|category)(?=[(])', Keyword),
137
+ (r'imp(lements_protocol|orts_category)(?=[(])', Keyword),
138
+ (r'(instantiat|specializ)es_class(?=[(])', Keyword),
139
+ # Events
140
+ (r'(current_event|(abolish|define)_events)(?=[(])', Keyword),
141
+ # Flags
142
+ (r'(create|current|set)_logtalk_flag(?=[(])', Keyword),
143
+ # Compiling, loading, and library paths
144
+ (r'logtalk_(compile|l(ibrary_path|oad|oad_context)|make(_target_action)?)(?=[(])', Keyword),
145
+ (r'\blogtalk_make\b', Keyword),
146
+ # Database
147
+ (r'(clause|retract(all)?)(?=[(])', Keyword),
148
+ (r'a(bolish|ssert(a|z))(?=[(])', Keyword),
149
+ # Control constructs
150
+ (r'(ca(ll|tch)|throw)(?=[(])', Keyword),
151
+ (r'(fa(il|lse)|true|(instantiation|system)_error)\b', Keyword),
152
+ (r'(uninstantiation|type|domain|existence|permission|representation|evaluation|resource|syntax)_error(?=[(])', Keyword),
153
+ # All solutions
154
+ (r'((bag|set)of|f(ind|or)all)(?=[(])', Keyword),
155
+ # Multi-threading predicates
156
+ (r'threaded(_(ca(ll|ncel)|once|ignore|exit|peek|wait|notify))?(?=[(])', Keyword),
157
+ # Engine predicates
158
+ (r'threaded_engine(_(create|destroy|self|next|next_reified|yield|post|fetch))?(?=[(])', Keyword),
159
+ # Term unification
160
+ (r'(subsumes_term|unify_with_occurs_check)(?=[(])', Keyword),
161
+ # Term creation and decomposition
162
+ (r'(functor|arg|copy_term|numbervars|term_variables)(?=[(])', Keyword),
163
+ # Evaluable functors
164
+ (r'(div|rem|m(ax|in|od)|abs|sign)(?=[(])', Keyword),
165
+ (r'float(_(integer|fractional)_part)?(?=[(])', Keyword),
166
+ (r'(floor|t(an|runcate)|round|ceiling)(?=[(])', Keyword),
167
+ # Other arithmetic functors
168
+ (r'(cos|a(cos|sin|tan|tan2)|exp|log|s(in|qrt)|xor)(?=[(])', Keyword),
169
+ # Term testing
170
+ (r'(var|atom(ic)?|integer|float|c(allable|ompound)|n(onvar|umber)|ground|acyclic_term)(?=[(])', Keyword),
171
+ # Term comparison
172
+ (r'compare(?=[(])', Keyword),
173
+ # Stream selection and control
174
+ (r'(curren|se)t_(in|out)put(?=[(])', Keyword),
175
+ (r'(open|close)(?=[(])', Keyword),
176
+ (r'flush_output(?=[(])', Keyword),
177
+ (r'(at_end_of_stream|flush_output)\b', Keyword),
178
+ (r'(stream_property|at_end_of_stream|set_stream_position)(?=[(])', Keyword),
179
+ # Character and byte input/output
180
+ (r'(nl|(get|peek|put)_(byte|c(har|ode)))(?=[(])', Keyword),
181
+ (r'\bnl\b', Keyword),
182
+ # Term input/output
183
+ (r'read(_term)?(?=[(])', Keyword),
184
+ (r'write(q|_(canonical|term))?(?=[(])', Keyword),
185
+ (r'(current_)?op(?=[(])', Keyword),
186
+ (r'(current_)?char_conversion(?=[(])', Keyword),
187
+ # Atomic term processing
188
+ (r'atom_(length|c(hars|o(ncat|des)))(?=[(])', Keyword),
189
+ (r'(char_code|sub_atom)(?=[(])', Keyword),
190
+ (r'number_c(har|ode)s(?=[(])', Keyword),
191
+ # Implementation defined hooks functions
192
+ (r'(se|curren)t_prolog_flag(?=[(])', Keyword),
193
+ (r'\bhalt\b', Keyword),
194
+ (r'halt(?=[(])', Keyword),
195
+ # Message sending operators
196
+ (r'(::|:|\^\^)', Operator),
197
+ # External call
198
+ (r'[{}]', Keyword),
199
+ # Logic and control
200
+ (r'(ignore|once)(?=[(])', Keyword),
201
+ (r'\brepeat\b', Keyword),
202
+ # Sorting
203
+ (r'(key)?sort(?=[(])', Keyword),
204
+ # Bitwise functors
205
+ (r'(>>|<<|/\\|\\\\|\\)', Operator),
206
+ # Predicate aliases
207
+ (r'\bas\b', Operator),
208
+ # Arithmetic evaluation
209
+ (r'\bis\b', Keyword),
210
+ # Arithmetic comparison
211
+ (r'(=:=|=\\=|<|=<|>=|>)', Operator),
212
+ # Term creation and decomposition
213
+ (r'=\.\.', Operator),
214
+ # Term unification
215
+ (r'(=|\\=)', Operator),
216
+ # Term comparison
217
+ (r'(==|\\==|@=<|@<|@>=|@>)', Operator),
218
+ # Evaluable functors
219
+ (r'(//|[-+*/])', Operator),
220
+ (r'\b(e|pi|div|mod|rem)\b', Operator),
221
+ # Other arithmetic functors
222
+ (r'\b\*\*\b', Operator),
223
+ # DCG rules
224
+ (r'-->', Operator),
225
+ # Control constructs
226
+ (r'([!;]|->)', Operator),
227
+ # Logic and control
228
+ (r'\\+', Operator),
229
+ # Mode operators
230
+ (r'[?@]', Operator),
231
+ # Existential quantifier
232
+ (r'\^', Operator),
233
+ # Punctuation
234
+ (r'[()\[\],.|]', Text),
235
+ # Atoms
236
+ (r"[a-z][a-zA-Z0-9_]*", Text),
237
+ (r"'", String, 'quoted_atom'),
238
+ # Double-quoted terms
239
+ (r'"', String, 'double_quoted_term'),
240
+ ],
241
+
242
+ 'quoted_atom': [
243
+ (r"''", String),
244
+ (r"'", String, '#pop'),
245
+ (r'\\([\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\)', String.Escape),
246
+ (r"[^\\'\n]+", String),
247
+ (r'\\', String),
248
+ ],
249
+
250
+ 'double_quoted_term': [
251
+ (r'""', String),
252
+ (r'"', String, '#pop'),
253
+ (r'\\([\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\)', String.Escape),
254
+ (r'[^\\"\n]+', String),
255
+ (r'\\', String),
256
+ ],
257
+
258
+ 'directive': [
259
+ # Conditional compilation directives
260
+ (r'(el)?if(?=[(])', Keyword, 'root'),
261
+ (r'(e(lse|ndif))(?=[.])', Keyword, 'root'),
262
+ # Entity directives
263
+ (r'(category|object|protocol)(?=[(])', Keyword, 'entityrelations'),
264
+ (r'(end_(category|object|protocol))(?=[.])', Keyword, 'root'),
265
+ # Predicate scope directives
266
+ (r'(public|protected|private)(?=[(])', Keyword, 'root'),
267
+ # Other directives
268
+ (r'e(n(coding|sure_loaded)|xport)(?=[(])', Keyword, 'root'),
269
+ (r'in(clude|itialization|fo)(?=[(])', Keyword, 'root'),
270
+ (r'(built_in|dynamic|synchronized|threaded)(?=[.])', Keyword, 'root'),
271
+ (r'(alias|d(ynamic|iscontiguous)|m(eta_(non_terminal|predicate)|ode|ultifile)|s(et_(logtalk|prolog)_flag|ynchronized))(?=[(])', Keyword, 'root'),
272
+ (r'op(?=[(])', Keyword, 'root'),
273
+ (r'(c(alls|oinductive)|module|reexport|use(s|_module))(?=[(])', Keyword, 'root'),
274
+ (r'[a-z][a-zA-Z0-9_]*(?=[(])', Text, 'root'),
275
+ (r'[a-z][a-zA-Z0-9_]*(?=[.])', Text, 'root'),
276
+ ],
277
+
278
+ 'entityrelations': [
279
+ (r'(complements|extends|i(nstantiates|mp(lements|orts))|specializes)(?=[(])', Keyword),
280
+ # Numbers
281
+ (r"0'[\\]?.", Number),
282
+ (r'0b[01]+', Number.Bin),
283
+ (r'0o[0-7]+', Number.Oct),
284
+ (r'0x[0-9a-fA-F]+', Number.Hex),
285
+ (r'\d+\.?\d*((e|E)(\+|-)?\d+)?', Number),
286
+ # Variables
287
+ (r'([A-Z_][a-zA-Z0-9_]*)', Name.Variable),
288
+ # Atoms
289
+ (r"[a-z][a-zA-Z0-9_]*", Text),
290
+ (r"'", String, 'quoted_atom'),
291
+ # Double-quoted terms
292
+ (r'"', String, 'double_quoted_term'),
293
+ # End of entity-opening directive
294
+ (r'([)]\.)', Text, 'root'),
295
+ # Scope operator
296
+ (r'(::)', Operator),
297
+ # Punctuation
298
+ (r'[()\[\],.|]', Text),
299
+ # Comments
300
+ (r'%.*?\n', Comment),
301
+ (r'/\*(.|\n)*?\*/', Comment),
302
+ # Whitespace
303
+ (r'\n', Text),
304
+ (r'\s+', Text),
305
+ ]
306
+ }
307
+
308
+ def analyse_text(text):
309
+ if ':- object(' in text:
310
+ return 1.0
311
+ elif ':- protocol(' in text:
312
+ return 1.0
313
+ elif ':- category(' in text:
314
+ return 1.0
315
+ elif re.search(r'^:-\s[a-z]', text, re.M):
316
+ return 0.9
317
+ else:
318
+ return 0.0
.cache/uv/archive-v0/_I6mGTfUeRVJi-r3LnJj6/pygments/lexers/promql.py ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.promql
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Prometheus Query Language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, default, words
12
+ from pygments.token import Comment, Keyword, Name, Number, Operator, \
13
+ Punctuation, String, Whitespace
14
+
15
+ __all__ = ["PromQLLexer"]
16
+
17
+
18
+ class PromQLLexer(RegexLexer):
19
+ """
20
+ For PromQL queries.
21
+
22
+ For details about the grammar see:
23
+ https://github.com/prometheus/prometheus/tree/master/promql/parser
24
+
25
+ .. versionadded: 2.7
26
+ """
27
+
28
+ name = "PromQL"
29
+ url = 'https://prometheus.io/docs/prometheus/latest/querying/basics/'
30
+ aliases = ["promql"]
31
+ filenames = ["*.promql"]
32
+ version_added = ''
33
+
34
+ base_keywords = (
35
+ words(
36
+ (
37
+ "bool",
38
+ "by",
39
+ "group_left",
40
+ "group_right",
41
+ "ignoring",
42
+ "offset",
43
+ "on",
44
+ "without",
45
+ ),
46
+ suffix=r"\b",
47
+ ),
48
+ Keyword,
49
+ )
50
+
51
+ aggregator_keywords = (
52
+ words(
53
+ (
54
+ "sum",
55
+ "min",
56
+ "max",
57
+ "avg",
58
+ "group",
59
+ "stddev",
60
+ "stdvar",
61
+ "count",
62
+ "count_values",
63
+ "bottomk",
64
+ "topk",
65
+ "quantile",
66
+ ),
67
+ suffix=r"\b",
68
+ ),
69
+ Keyword,
70
+ )
71
+
72
+ function_keywords = (
73
+ words(
74
+ (
75
+ "abs",
76
+ "absent",
77
+ "absent_over_time",
78
+ "avg_over_time",
79
+ "ceil",
80
+ "changes",
81
+ "clamp_max",
82
+ "clamp_min",
83
+ "count_over_time",
84
+ "day_of_month",
85
+ "day_of_week",
86
+ "days_in_month",
87
+ "delta",
88
+ "deriv",
89
+ "exp",
90
+ "floor",
91
+ "histogram_quantile",
92
+ "holt_winters",
93
+ "hour",
94
+ "idelta",
95
+ "increase",
96
+ "irate",
97
+ "label_join",
98
+ "label_replace",
99
+ "ln",
100
+ "log10",
101
+ "log2",
102
+ "max_over_time",
103
+ "min_over_time",
104
+ "minute",
105
+ "month",
106
+ "predict_linear",
107
+ "quantile_over_time",
108
+ "rate",
109
+ "resets",
110
+ "round",
111
+ "scalar",
112
+ "sort",
113
+ "sort_desc",
114
+ "sqrt",
115
+ "stddev_over_time",
116
+ "stdvar_over_time",
117
+ "sum_over_time",
118
+ "time",
119
+ "timestamp",
120
+ "vector",
121
+ "year",
122
+ ),
123
+ suffix=r"\b",
124
+ ),
125
+ Keyword.Reserved,
126
+ )
127
+
128
+ tokens = {
129
+ "root": [
130
+ (r"\n", Whitespace),
131
+ (r"\s+", Whitespace),
132
+ (r",", Punctuation),
133
+ # Keywords
134
+ base_keywords,
135
+ aggregator_keywords,
136
+ function_keywords,
137
+ # Offsets
138
+ (r"[1-9][0-9]*[smhdwy]", String),
139
+ # Numbers
140
+ (r"-?[0-9]+\.[0-9]+", Number.Float),
141
+ (r"-?[0-9]+", Number.Integer),
142
+ # Comments
143
+ (r"#.*?$", Comment.Single),
144
+ # Operators
145
+ (r"(\+|\-|\*|\/|\%|\^)", Operator),
146
+ (r"==|!=|>=|<=|<|>", Operator),
147
+ (r"and|or|unless", Operator.Word),
148
+ # Metrics
149
+ (r"[_a-zA-Z][a-zA-Z0-9_]+", Name.Variable),
150
+ # Params
151
+ (r'(["\'])(.*?)(["\'])', bygroups(Punctuation, String, Punctuation)),
152
+ # Other states
153
+ (r"\(", Operator, "function"),
154
+ (r"\)", Operator),
155
+ (r"\{", Punctuation, "labels"),
156
+ (r"\[", Punctuation, "range"),
157
+ ],
158
+ "labels": [
159
+ (r"\}", Punctuation, "#pop"),
160
+ (r"\n", Whitespace),
161
+ (r"\s+", Whitespace),
162
+ (r",", Punctuation),
163
+ (r'([_a-zA-Z][a-zA-Z0-9_]*?)(\s*?)(=~|!=|=|!~)(\s*?)("|\')(.*?)("|\')',
164
+ bygroups(Name.Label, Whitespace, Operator, Whitespace,
165
+ Punctuation, String, Punctuation)),
166
+ ],
167
+ "range": [
168
+ (r"\]", Punctuation, "#pop"),
169
+ (r"[1-9][0-9]*[smhdwy]", String),
170
+ ],
171
+ "function": [
172
+ (r"\)", Operator, "#pop"),
173
+ (r"\(", Operator, "#push"),
174
+ default("#pop"),
175
+ ],
176
+ }