Amar-Aly commited on
Commit
eaf3343
·
verified ·
1 Parent(s): 9b552d7

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/6WaZhd1wSprhjD1HCu34f/pygments/lexers/q.py +187 -0
  2. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/qvt.py +153 -0
  3. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rdf.py +468 -0
  4. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rebol.py +419 -0
  5. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rego.py +57 -0
  6. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rell.py +68 -0
  7. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/resource.py +83 -0
  8. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/ride.py +138 -0
  9. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rita.py +42 -0
  10. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rnc.py +66 -0
  11. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/roboconf.py +81 -0
  12. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/robotframework.py +551 -0
  13. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/ruby.py +518 -0
  14. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rust.py +222 -0
  15. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/sas.py +227 -0
  16. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/savi.py +171 -0
  17. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/scdoc.py +85 -0
  18. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/scripting.py +1638 -0
  19. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/sgf.py +59 -0
  20. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/shell.py +902 -0
  21. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/sieve.py +78 -0
  22. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/slash.py +183 -0
  23. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/smalltalk.py +194 -0
  24. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/smithy.py +77 -0
  25. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/smv.py +78 -0
  26. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/snobol.py +82 -0
  27. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/solidity.py +87 -0
  28. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/soong.py +78 -0
  29. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/sophia.py +102 -0
  30. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/special.py +122 -0
  31. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/spice.py +70 -0
  32. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/sql.py +1111 -0
  33. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/srcinfo.py +62 -0
  34. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/stata.py +170 -0
  35. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/supercollider.py +94 -0
  36. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/tablegen.py +177 -0
  37. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/tact.py +303 -0
  38. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/tal.py +77 -0
  39. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/tcl.py +148 -0
  40. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/teal.py +88 -0
  41. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/templates.py +2355 -0
  42. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/teraterm.py +335 -0
  43. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/testing.py +209 -0
  44. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/text.py +27 -0
  45. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/textedit.py +205 -0
  46. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/textfmts.py +436 -0
  47. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/theorem.py +410 -0
  48. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/thingsdb.py +143 -0
  49. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/tlb.py +59 -0
  50. .cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/tls.py +54 -0
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/q.py ADDED
@@ -0,0 +1,187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.q
3
+ ~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Q 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.lexer import RegexLexer, words, include, bygroups, inherit
12
+ from pygments.token import Comment, Name, Number, Operator, Punctuation, \
13
+ String, Whitespace, Literal, Generic
14
+
15
+ __all__ = ["KLexer", "QLexer"]
16
+
17
+
18
+ class KLexer(RegexLexer):
19
+ """
20
+ For K source code.
21
+ """
22
+
23
+ name = "K"
24
+ aliases = ["k"]
25
+ filenames = ["*.k"]
26
+ url = "https://code.kx.com"
27
+ version_added = '2.12'
28
+
29
+ tokens = {
30
+ "whitespace": [
31
+ # hashbang script
32
+ (r"^#!.*", Comment.Hashbang),
33
+ # Comments
34
+ (r"^/\s*\n", Comment.Multiline, "comments"),
35
+ (r"(?<!\S)/.*", Comment.Single),
36
+ # Whitespace
37
+ (r"\s+", Whitespace),
38
+ # Strings
39
+ (r"\"", String.Double, "strings"),
40
+ ],
41
+ "root": [
42
+ include("whitespace"),
43
+ include("keywords"),
44
+ include("declarations"),
45
+ ],
46
+ "keywords": [
47
+ (words(("abs", "acos", "asin", "atan", "avg", "bin",
48
+ "binr", "by", "cor", "cos", "cov", "dev",
49
+ "delete", "div", "do", "enlist", "exec", "exit",
50
+ "exp", "from", "getenv", "hopen", "if", "in",
51
+ "insert", "last", "like", "log", "max", "min",
52
+ "prd", "select", "setenv", "sin", "sqrt", "ss",
53
+ "sum", "tan", "update", "var", "wavg", "while",
54
+ "within", "wsum", "xexp"),
55
+ suffix=r"\b"), Operator.Word),
56
+ ],
57
+ "declarations": [
58
+ # Timing
59
+ (r"^\\ts?", Comment.Preproc),
60
+ (r"^(\\\w\s+[^/\n]*?)(/.*)",
61
+ bygroups(Comment.Preproc, Comment.Single)),
62
+ # Generic System Commands
63
+ (r"^\\\w.*", Comment.Preproc),
64
+ # Prompt
65
+ (r"^[a-zA-Z]\)", Generic.Prompt),
66
+ # Function Names
67
+ (r"([.]?[a-zA-Z][\w.]*)(\s*)([-.~=!@#$%^&*_+|,<>?/\\:']?:)(\s*)(\{)",
68
+ bygroups(Name.Function, Whitespace, Operator, Whitespace, Punctuation),
69
+ "functions"),
70
+ # Variable Names
71
+ (r"([.]?[a-zA-Z][\w.]*)(\s*)([-.~=!@#$%^&*_+|,<>?/\\:']?:)",
72
+ bygroups(Name.Variable, Whitespace, Operator)),
73
+ # Functions
74
+ (r"\{", Punctuation, "functions"),
75
+ # Parentheses
76
+ (r"\(", Punctuation, "parentheses"),
77
+ # Brackets
78
+ (r"\[", Punctuation, "brackets"),
79
+ # Errors
80
+ (r"'`([a-zA-Z][\w.]*)?", Name.Exception),
81
+ # File Symbols
82
+ (r"`:([a-zA-Z/][\w./]*)?", String.Symbol),
83
+ # Symbols
84
+ (r"`([a-zA-Z][\w.]*)?", String.Symbol),
85
+ # Numbers
86
+ include("numbers"),
87
+ # Variable Names
88
+ (r"[a-zA-Z][\w.]*", Name),
89
+ # Operators
90
+ (r"[-=+*#$%@!~^&:.,<>'\\|/?_]", Operator),
91
+ # Punctuation
92
+ (r";", Punctuation),
93
+ ],
94
+ "functions": [
95
+ include("root"),
96
+ (r"\}", Punctuation, "#pop"),
97
+ ],
98
+ "parentheses": [
99
+ include("root"),
100
+ (r"\)", Punctuation, "#pop"),
101
+ ],
102
+ "brackets": [
103
+ include("root"),
104
+ (r"\]", Punctuation, "#pop"),
105
+ ],
106
+ "numbers": [
107
+ # Binary Values
108
+ (r"[01]+b", Number.Bin),
109
+ # Nulls/Infinities
110
+ (r"0[nNwW][cefghijmndzuvtp]?", Number),
111
+ # Timestamps
112
+ ((r"(?:[0-9]{4}[.][0-9]{2}[.][0-9]{2}|[0-9]+)"
113
+ "D(?:[0-9](?:[0-9](?::[0-9]{2}"
114
+ "(?::[0-9]{2}(?:[.][0-9]*)?)?)?)?)?"), Literal.Date),
115
+ # Datetimes
116
+ ((r"[0-9]{4}[.][0-9]{2}"
117
+ "(?:m|[.][0-9]{2}(?:T(?:[0-9]{2}:[0-9]{2}"
118
+ "(?::[0-9]{2}(?:[.][0-9]*)?)?)?)?)"), Literal.Date),
119
+ # Times
120
+ (r"[0-9]{2}:[0-9]{2}(?::[0-9]{2}(?:[.][0-9]{1,3})?)?",
121
+ Literal.Date),
122
+ # GUIDs
123
+ (r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",
124
+ Number.Hex),
125
+ # Byte Vectors
126
+ (r"0x[0-9a-fA-F]+", Number.Hex),
127
+ # Floats
128
+ (r"([0-9]*[.]?[0-9]+|[0-9]+[.]?[0-9]*)[eE][+-]?[0-9]+[ef]?",
129
+ Number.Float),
130
+ (r"([0-9]*[.][0-9]+|[0-9]+[.][0-9]*)[ef]?", Number.Float),
131
+ (r"[0-9]+[ef]", Number.Float),
132
+ # Characters
133
+ (r"[0-9]+c", Number),
134
+ # Integers
135
+ (r"[0-9]+[ihtuv]", Number.Integer),
136
+ # Long Integers
137
+ (r"[0-9]+[jnp]?", Number.Integer.Long),
138
+ ],
139
+ "comments": [
140
+ (r"[^\\]+", Comment.Multiline),
141
+ (r"^\\", Comment.Multiline, "#pop"),
142
+ (r"\\", Comment.Multiline),
143
+ ],
144
+ "strings": [
145
+ (r'[^"\\]+', String.Double),
146
+ (r"\\.", String.Escape),
147
+ (r'"', String.Double, "#pop"),
148
+ ],
149
+ }
150
+
151
+
152
+ class QLexer(KLexer):
153
+ """
154
+ For `Q <https://code.kx.com/>`_ source code.
155
+ """
156
+
157
+ name = "Q"
158
+ aliases = ["q"]
159
+ filenames = ["*.q"]
160
+ version_added = '2.12'
161
+
162
+ tokens = {
163
+ "root": [
164
+ (words(("aj", "aj0", "ajf", "ajf0", "all", "and", "any", "asc",
165
+ "asof", "attr", "avgs", "ceiling", "cols", "count", "cross",
166
+ "csv", "cut", "deltas", "desc", "differ", "distinct", "dsave",
167
+ "each", "ej", "ema", "eval", "except", "fby", "fills", "first",
168
+ "fkeys", "flip", "floor", "get", "group", "gtime", "hclose",
169
+ "hcount", "hdel", "hsym", "iasc", "idesc", "ij", "ijf",
170
+ "inter", "inv", "key", "keys", "lj", "ljf", "load", "lower",
171
+ "lsq", "ltime", "ltrim", "mavg", "maxs", "mcount", "md5",
172
+ "mdev", "med", "meta", "mins", "mmax", "mmin", "mmu", "mod",
173
+ "msum", "neg", "next", "not", "null", "or", "over", "parse",
174
+ "peach", "pj", "prds", "prior", "prev", "rand", "rank", "ratios",
175
+ "raze", "read0", "read1", "reciprocal", "reval", "reverse",
176
+ "rload", "rotate", "rsave", "rtrim", "save", "scan", "scov",
177
+ "sdev", "set", "show", "signum", "ssr", "string", "sublist",
178
+ "sums", "sv", "svar", "system", "tables", "til", "trim", "txf",
179
+ "type", "uj", "ujf", "ungroup", "union", "upper", "upsert",
180
+ "value", "view", "views", "vs", "where", "wj", "wj1", "ww",
181
+ "xasc", "xbar", "xcol", "xcols", "xdesc", "xgroup", "xkey",
182
+ "xlog", "xprev", "xrank"),
183
+ suffix=r"\b"), Name.Builtin,
184
+ ),
185
+ inherit,
186
+ ],
187
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/qvt.py ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.qvt
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for QVT Operational language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, include, combined, default, \
12
+ words
13
+ from pygments.token import Text, Comment, Operator, Keyword, Punctuation, \
14
+ Name, String, Number
15
+
16
+ __all__ = ['QVToLexer']
17
+
18
+
19
+ class QVToLexer(RegexLexer):
20
+ """
21
+ For the QVT Operational Mapping language.
22
+
23
+ Reference for implementing this: «Meta Object Facility (MOF) 2.0
24
+ Query/View/Transformation Specification», Version 1.1 - January 2011
25
+ (https://www.omg.org/spec/QVT/1.1/), see §8.4, «Concrete Syntax» in
26
+ particular.
27
+
28
+ Notable tokens assignments:
29
+
30
+ - Name.Class is assigned to the identifier following any of the following
31
+ keywords: metamodel, class, exception, primitive, enum, transformation
32
+ or library
33
+
34
+ - Name.Function is assigned to the names of mappings and queries
35
+
36
+ - Name.Builtin.Pseudo is assigned to the pre-defined variables 'this',
37
+ 'self' and 'result'.
38
+ """
39
+ # With obvious borrowings & inspiration from the Java, Python and C lexers
40
+
41
+ name = 'QVTO'
42
+ aliases = ['qvto', 'qvt']
43
+ filenames = ['*.qvto']
44
+ url = 'https://www.omg.org/spec/QVT/1.1'
45
+ version_added = ''
46
+
47
+ tokens = {
48
+ 'root': [
49
+ (r'\n', Text),
50
+ (r'[^\S\n]+', Text),
51
+ (r'(--|//)(\s*)(directive:)?(.*)$',
52
+ bygroups(Comment, Comment, Comment.Preproc, Comment)),
53
+ # Uncomment the following if you want to distinguish between
54
+ # '/*' and '/**', à la javadoc
55
+ # (r'/[*]{2}(.|\n)*?[*]/', Comment.Multiline),
56
+ (r'/[*](.|\n)*?[*]/', Comment.Multiline),
57
+ (r'\\\n', Text),
58
+ (r'(and|not|or|xor|##?)\b', Operator.Word),
59
+ (r'(:{1,2}=|[-+]=)\b', Operator.Word),
60
+ (r'(@|<<|>>)\b', Keyword), # stereotypes
61
+ (r'!=|<>|==|=|!->|->|>=|<=|[.]{3}|[+/*%=<>&|.~]', Operator),
62
+ (r'[]{}:(),;[]', Punctuation),
63
+ (r'(true|false|unlimited|null)\b', Keyword.Constant),
64
+ (r'(this|self|result)\b', Name.Builtin.Pseudo),
65
+ (r'(var)\b', Keyword.Declaration),
66
+ (r'(from|import)\b', Keyword.Namespace, 'fromimport'),
67
+ (r'(metamodel|class|exception|primitive|enum|transformation|'
68
+ r'library)(\s+)(\w+)',
69
+ bygroups(Keyword.Word, Text, Name.Class)),
70
+ (r'(exception)(\s+)(\w+)',
71
+ bygroups(Keyword.Word, Text, Name.Exception)),
72
+ (r'(main)\b', Name.Function),
73
+ (r'(mapping|helper|query)(\s+)',
74
+ bygroups(Keyword.Declaration, Text), 'operation'),
75
+ (r'(assert)(\s+)\b', bygroups(Keyword, Text), 'assert'),
76
+ (r'(Bag|Collection|Dict|OrderedSet|Sequence|Set|Tuple|List)\b',
77
+ Keyword.Type),
78
+ include('keywords'),
79
+ ('"', String, combined('stringescape', 'dqs')),
80
+ ("'", String, combined('stringescape', 'sqs')),
81
+ include('name'),
82
+ include('numbers'),
83
+ # (r'([a-zA-Z_]\w*)(::)([a-zA-Z_]\w*)',
84
+ # bygroups(Text, Text, Text)),
85
+ ],
86
+
87
+ 'fromimport': [
88
+ (r'(?:[ \t]|\\\n)+', Text),
89
+ (r'[a-zA-Z_][\w.]*', Name.Namespace),
90
+ default('#pop'),
91
+ ],
92
+
93
+ 'operation': [
94
+ (r'::', Text),
95
+ (r'(.*::)([a-zA-Z_]\w*)([ \t]*)(\()',
96
+ bygroups(Text, Name.Function, Text, Punctuation), '#pop')
97
+ ],
98
+
99
+ 'assert': [
100
+ (r'(warning|error|fatal)\b', Keyword, '#pop'),
101
+ default('#pop'), # all else: go back
102
+ ],
103
+
104
+ 'keywords': [
105
+ (words((
106
+ 'abstract', 'access', 'any', 'assert', 'blackbox', 'break',
107
+ 'case', 'collect', 'collectNested', 'collectOne', 'collectselect',
108
+ 'collectselectOne', 'composes', 'compute', 'configuration',
109
+ 'constructor', 'continue', 'datatype', 'default', 'derived',
110
+ 'disjuncts', 'do', 'elif', 'else', 'end', 'endif', 'except',
111
+ 'exists', 'extends', 'forAll', 'forEach', 'forOne', 'from', 'if',
112
+ 'implies', 'in', 'inherits', 'init', 'inout', 'intermediate',
113
+ 'invresolve', 'invresolveIn', 'invresolveone', 'invresolveoneIn',
114
+ 'isUnique', 'iterate', 'late', 'let', 'literal', 'log', 'map',
115
+ 'merges', 'modeltype', 'new', 'object', 'one', 'ordered', 'out',
116
+ 'package', 'population', 'property', 'raise', 'readonly',
117
+ 'references', 'refines', 'reject', 'resolve', 'resolveIn',
118
+ 'resolveone', 'resolveoneIn', 'return', 'select', 'selectOne',
119
+ 'sortedBy', 'static', 'switch', 'tag', 'then', 'try', 'typedef',
120
+ 'unlimited', 'uses', 'when', 'where', 'while', 'with', 'xcollect',
121
+ 'xmap', 'xselect'), suffix=r'\b'), Keyword),
122
+ ],
123
+
124
+ # There is no need to distinguish between String.Single and
125
+ # String.Double: 'strings' is factorised for 'dqs' and 'sqs'
126
+ 'strings': [
127
+ (r'[^\\\'"\n]+', String),
128
+ # quotes, percents and backslashes must be parsed one at a time
129
+ (r'[\'"\\]', String),
130
+ ],
131
+ 'stringescape': [
132
+ (r'\\([\\btnfr"\']|u[0-3][0-7]{2}|u[0-7]{1,2})', String.Escape)
133
+ ],
134
+ 'dqs': [ # double-quoted string
135
+ (r'"', String, '#pop'),
136
+ (r'\\\\|\\"', String.Escape),
137
+ include('strings')
138
+ ],
139
+ 'sqs': [ # single-quoted string
140
+ (r"'", String, '#pop'),
141
+ (r"\\\\|\\'", String.Escape),
142
+ include('strings')
143
+ ],
144
+ 'name': [
145
+ (r'[a-zA-Z_]\w*', Name),
146
+ ],
147
+ # numbers: excerpt taken from the python lexer
148
+ 'numbers': [
149
+ (r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
150
+ (r'\d+[eE][+-]?[0-9]+', Number.Float),
151
+ (r'\d+', Number.Integer)
152
+ ],
153
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rdf.py ADDED
@@ -0,0 +1,468 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.rdf
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for semantic web and RDF query languages and markup.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, bygroups, default
14
+ from pygments.token import Keyword, Punctuation, String, Number, Operator, \
15
+ Generic, Whitespace, Name, Literal, Comment, Text
16
+
17
+ __all__ = ['SparqlLexer', 'TurtleLexer', 'ShExCLexer']
18
+
19
+
20
+ class SparqlLexer(RegexLexer):
21
+ """
22
+ Lexer for SPARQL query language.
23
+ """
24
+ name = 'SPARQL'
25
+ aliases = ['sparql']
26
+ filenames = ['*.rq', '*.sparql']
27
+ mimetypes = ['application/sparql-query']
28
+ url = 'https://www.w3.org/TR/sparql11-query'
29
+ version_added = '2.0'
30
+
31
+ # character group definitions ::
32
+
33
+ PN_CHARS_BASE_GRP = ('a-zA-Z'
34
+ '\u00c0-\u00d6'
35
+ '\u00d8-\u00f6'
36
+ '\u00f8-\u02ff'
37
+ '\u0370-\u037d'
38
+ '\u037f-\u1fff'
39
+ '\u200c-\u200d'
40
+ '\u2070-\u218f'
41
+ '\u2c00-\u2fef'
42
+ '\u3001-\ud7ff'
43
+ '\uf900-\ufdcf'
44
+ '\ufdf0-\ufffd')
45
+
46
+ PN_CHARS_U_GRP = (PN_CHARS_BASE_GRP + '_')
47
+
48
+ PN_CHARS_GRP = (PN_CHARS_U_GRP +
49
+ r'\-' +
50
+ r'0-9' +
51
+ '\u00b7' +
52
+ '\u0300-\u036f' +
53
+ '\u203f-\u2040')
54
+
55
+ HEX_GRP = '0-9A-Fa-f'
56
+
57
+ PN_LOCAL_ESC_CHARS_GRP = r' _~.\-!$&"()*+,;=/?#@%'
58
+
59
+ # terminal productions ::
60
+
61
+ PN_CHARS_BASE = '[' + PN_CHARS_BASE_GRP + ']'
62
+
63
+ PN_CHARS_U = '[' + PN_CHARS_U_GRP + ']'
64
+
65
+ PN_CHARS = '[' + PN_CHARS_GRP + ']'
66
+
67
+ HEX = '[' + HEX_GRP + ']'
68
+
69
+ PN_LOCAL_ESC_CHARS = '[' + PN_LOCAL_ESC_CHARS_GRP + ']'
70
+
71
+ IRIREF = r'<(?:[^<>"{}|^`\\\x00-\x20])*>'
72
+
73
+ BLANK_NODE_LABEL = '_:[0-9' + PN_CHARS_U_GRP + '](?:[' + PN_CHARS_GRP + \
74
+ '.]*' + PN_CHARS + ')?'
75
+
76
+ PN_PREFIX = PN_CHARS_BASE + '(?:[' + PN_CHARS_GRP + '.]*' + PN_CHARS + ')?'
77
+
78
+ VARNAME = '[0-9' + PN_CHARS_U_GRP + '][' + PN_CHARS_U_GRP + \
79
+ '0-9\u00b7\u0300-\u036f\u203f-\u2040]*'
80
+
81
+ PERCENT = '%' + HEX + HEX
82
+
83
+ PN_LOCAL_ESC = r'\\' + PN_LOCAL_ESC_CHARS
84
+
85
+ PLX = '(?:' + PERCENT + ')|(?:' + PN_LOCAL_ESC + ')'
86
+
87
+ PN_LOCAL = ('(?:[' + PN_CHARS_U_GRP + ':0-9' + ']|' + PLX + ')' +
88
+ '(?:(?:[' + PN_CHARS_GRP + '.:]|' + PLX + ')*(?:[' +
89
+ PN_CHARS_GRP + ':]|' + PLX + '))?')
90
+
91
+ EXPONENT = r'[eE][+-]?\d+'
92
+
93
+ # Lexer token definitions ::
94
+
95
+ tokens = {
96
+ 'root': [
97
+ (r'\s+', Text),
98
+ # keywords ::
99
+ (r'(?i)(select|construct|describe|ask|where|filter|group\s+by|minus|'
100
+ r'distinct|reduced|from\s+named|from|order\s+by|desc|asc|limit|'
101
+ r'offset|values|bindings|load|into|clear|drop|create|add|move|copy|'
102
+ r'insert\s+data|delete\s+data|delete\s+where|with|delete|insert|'
103
+ r'using\s+named|using|graph|default|named|all|optional|service|'
104
+ r'silent|bind|undef|union|not\s+in|in|as|having|to|prefix|base)\b', Keyword),
105
+ (r'(a)\b', Keyword),
106
+ # IRIs ::
107
+ ('(' + IRIREF + ')', Name.Label),
108
+ # blank nodes ::
109
+ ('(' + BLANK_NODE_LABEL + ')', Name.Label),
110
+ # # variables ::
111
+ ('[?$]' + VARNAME, Name.Variable),
112
+ # prefixed names ::
113
+ (r'(' + PN_PREFIX + r')?(\:)(' + PN_LOCAL + r')?',
114
+ bygroups(Name.Namespace, Punctuation, Name.Tag)),
115
+ # function names ::
116
+ (r'(?i)(str|lang|langmatches|datatype|bound|iri|uri|bnode|rand|abs|'
117
+ r'ceil|floor|round|concat|strlen|ucase|lcase|encode_for_uri|'
118
+ r'contains|strstarts|strends|strbefore|strafter|year|month|day|'
119
+ r'hours|minutes|seconds|timezone|tz|now|uuid|struuid|md5|sha1|sha256|sha384|'
120
+ r'sha512|coalesce|if|strlang|strdt|sameterm|isiri|isuri|isblank|'
121
+ r'isliteral|isnumeric|regex|substr|replace|exists|not\s+exists|'
122
+ r'count|sum|min|max|avg|sample|group_concat|separator)\b',
123
+ Name.Function),
124
+ # boolean literals ::
125
+ (r'(true|false)', Keyword.Constant),
126
+ # double literals ::
127
+ (r'[+\-]?(\d+\.\d*' + EXPONENT + r'|\.?\d+' + EXPONENT + ')', Number.Float),
128
+ # decimal literals ::
129
+ (r'[+\-]?(\d+\.\d*|\.\d+)', Number.Float),
130
+ # integer literals ::
131
+ (r'[+\-]?\d+', Number.Integer),
132
+ # operators ::
133
+ (r'(\|\||&&|=|\*|\-|\+|/|!=|<=|>=|!|<|>)', Operator),
134
+ # punctuation characters ::
135
+ (r'[(){}.;,:^\[\]]', Punctuation),
136
+ # line comments ::
137
+ (r'#[^\n]*', Comment),
138
+ # strings ::
139
+ (r'"""', String, 'triple-double-quoted-string'),
140
+ (r'"', String, 'single-double-quoted-string'),
141
+ (r"'''", String, 'triple-single-quoted-string'),
142
+ (r"'", String, 'single-single-quoted-string'),
143
+ ],
144
+ 'triple-double-quoted-string': [
145
+ (r'"""', String, 'end-of-string'),
146
+ (r'[^\\]+', String),
147
+ (r'\\', String, 'string-escape'),
148
+ ],
149
+ 'single-double-quoted-string': [
150
+ (r'"', String, 'end-of-string'),
151
+ (r'[^"\\\n]+', String),
152
+ (r'\\', String, 'string-escape'),
153
+ ],
154
+ 'triple-single-quoted-string': [
155
+ (r"'''", String, 'end-of-string'),
156
+ (r'[^\\]+', String),
157
+ (r'\\', String.Escape, 'string-escape'),
158
+ ],
159
+ 'single-single-quoted-string': [
160
+ (r"'", String, 'end-of-string'),
161
+ (r"[^'\\\n]+", String),
162
+ (r'\\', String, 'string-escape'),
163
+ ],
164
+ 'string-escape': [
165
+ (r'u' + HEX + '{4}', String.Escape, '#pop'),
166
+ (r'U' + HEX + '{8}', String.Escape, '#pop'),
167
+ (r'.', String.Escape, '#pop'),
168
+ ],
169
+ 'end-of-string': [
170
+ (r'(@)([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)',
171
+ bygroups(Operator, Name.Function), '#pop:2'),
172
+ (r'\^\^', Operator, '#pop:2'),
173
+ default('#pop:2'),
174
+ ],
175
+ }
176
+
177
+
178
+ class TurtleLexer(RegexLexer):
179
+ """
180
+ Lexer for Turtle data language.
181
+ """
182
+ name = 'Turtle'
183
+ aliases = ['turtle']
184
+ filenames = ['*.ttl']
185
+ mimetypes = ['text/turtle', 'application/x-turtle']
186
+ url = 'https://www.w3.org/TR/turtle'
187
+ version_added = '2.1'
188
+
189
+ # character group definitions ::
190
+ PN_CHARS_BASE_GRP = ('a-zA-Z'
191
+ '\u00c0-\u00d6'
192
+ '\u00d8-\u00f6'
193
+ '\u00f8-\u02ff'
194
+ '\u0370-\u037d'
195
+ '\u037f-\u1fff'
196
+ '\u200c-\u200d'
197
+ '\u2070-\u218f'
198
+ '\u2c00-\u2fef'
199
+ '\u3001-\ud7ff'
200
+ '\uf900-\ufdcf'
201
+ '\ufdf0-\ufffd')
202
+
203
+ PN_CHARS_U_GRP = (PN_CHARS_BASE_GRP + '_')
204
+
205
+ PN_CHARS_GRP = (PN_CHARS_U_GRP +
206
+ r'\-' +
207
+ r'0-9' +
208
+ '\u00b7' +
209
+ '\u0300-\u036f' +
210
+ '\u203f-\u2040')
211
+
212
+ PN_CHARS = '[' + PN_CHARS_GRP + ']'
213
+
214
+ PN_CHARS_BASE = '[' + PN_CHARS_BASE_GRP + ']'
215
+
216
+ PN_PREFIX = PN_CHARS_BASE + '(?:[' + PN_CHARS_GRP + '.]*' + PN_CHARS + ')?'
217
+
218
+ HEX_GRP = '0-9A-Fa-f'
219
+
220
+ HEX = '[' + HEX_GRP + ']'
221
+
222
+ PERCENT = '%' + HEX + HEX
223
+
224
+ PN_LOCAL_ESC_CHARS_GRP = r' _~.\-!$&"()*+,;=/?#@%'
225
+
226
+ PN_LOCAL_ESC_CHARS = '[' + PN_LOCAL_ESC_CHARS_GRP + ']'
227
+
228
+ PN_LOCAL_ESC = r'\\' + PN_LOCAL_ESC_CHARS
229
+
230
+ PLX = '(?:' + PERCENT + ')|(?:' + PN_LOCAL_ESC + ')'
231
+
232
+ PN_LOCAL = ('(?:[' + PN_CHARS_U_GRP + ':0-9' + ']|' + PLX + ')' +
233
+ '(?:(?:[' + PN_CHARS_GRP + '.:]|' + PLX + ')*(?:[' +
234
+ PN_CHARS_GRP + ':]|' + PLX + '))?')
235
+
236
+ patterns = {
237
+ 'PNAME_NS': r'((?:[a-zA-Z][\w-]*)?\:)', # Simplified character range
238
+ 'IRIREF': r'(<[^<>"{}|^`\\\x00-\x20]*>)'
239
+ }
240
+
241
+ tokens = {
242
+ 'root': [
243
+ (r'\s+', Text),
244
+
245
+ # Base / prefix
246
+ (r'(@base|BASE)(\s+){IRIREF}(\s*)(\.?)'.format(**patterns),
247
+ bygroups(Keyword, Whitespace, Name.Variable, Whitespace,
248
+ Punctuation)),
249
+ (r'(@prefix|PREFIX)(\s+){PNAME_NS}(\s+){IRIREF}(\s*)(\.?)'.format(**patterns),
250
+ bygroups(Keyword, Whitespace, Name.Namespace, Whitespace,
251
+ Name.Variable, Whitespace, Punctuation)),
252
+
253
+ # The shorthand predicate 'a'
254
+ (r'(?<=\s)a(?=\s)', Keyword.Type),
255
+
256
+ # IRIREF
257
+ (r'{IRIREF}'.format(**patterns), Name.Variable),
258
+
259
+ # PrefixedName
260
+ (r'(' + PN_PREFIX + r')?(\:)(' + PN_LOCAL + r')?',
261
+ bygroups(Name.Namespace, Punctuation, Name.Tag)),
262
+
263
+ # BlankNodeLabel
264
+ (r'(_)(:)([' + PN_CHARS_U_GRP + r'0-9]([' + PN_CHARS_GRP + r'.]*' + PN_CHARS + ')?)',
265
+ bygroups(Name.Namespace, Punctuation, Name.Tag)),
266
+
267
+ # Comment
268
+ (r'#([^\n]+|$)', Comment),
269
+
270
+ (r'\b(true|false)\b', Literal),
271
+ (r'[+\-]?\d*\.\d+', Number.Float),
272
+ (r'[+\-]?\d*(:?\.\d+)?E[+\-]?\d+', Number.Float),
273
+ (r'[+\-]?\d+', Number.Integer),
274
+ (r'[\[\](){}.;,:^]', Punctuation),
275
+
276
+ (r'"""', String, 'triple-double-quoted-string'),
277
+ (r'"', String, 'single-double-quoted-string'),
278
+ (r"'''", String, 'triple-single-quoted-string'),
279
+ (r"'", String, 'single-single-quoted-string'),
280
+ ],
281
+ 'triple-double-quoted-string': [
282
+ (r'"""', String, 'end-of-string'),
283
+ (r'[^\\]+(?=""")', String),
284
+ (r'\\', String, 'string-escape'),
285
+ ],
286
+ 'single-double-quoted-string': [
287
+ (r'"', String, 'end-of-string'),
288
+ (r'[^"\\\n]+', String),
289
+ (r'\\', String, 'string-escape'),
290
+ ],
291
+ 'triple-single-quoted-string': [
292
+ (r"'''", String, 'end-of-string'),
293
+ (r"[^\\]+(?=''')", String),
294
+ (r'\\', String, 'string-escape'),
295
+ ],
296
+ 'single-single-quoted-string': [
297
+ (r"'", String, 'end-of-string'),
298
+ (r"[^'\\\n]+", String),
299
+ (r'\\', String, 'string-escape'),
300
+ ],
301
+ 'string-escape': [
302
+ (r'.', String, '#pop'),
303
+ ],
304
+ 'end-of-string': [
305
+ (r'(@)([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)',
306
+ bygroups(Operator, Generic.Emph), '#pop:2'),
307
+
308
+ (r'(\^\^){IRIREF}'.format(**patterns), bygroups(Operator, Generic.Emph), '#pop:2'),
309
+
310
+ default('#pop:2'),
311
+
312
+ ],
313
+ }
314
+
315
+ # Turtle and Tera Term macro files share the same file extension
316
+ # but each has a recognizable and distinct syntax.
317
+ def analyse_text(text):
318
+ for t in ('@base ', 'BASE ', '@prefix ', 'PREFIX '):
319
+ if re.search(rf'^\s*{t}', text):
320
+ return 0.80
321
+
322
+
323
+ class ShExCLexer(RegexLexer):
324
+ """
325
+ Lexer for ShExC shape expressions language syntax.
326
+ """
327
+ name = 'ShExC'
328
+ aliases = ['shexc', 'shex']
329
+ filenames = ['*.shex']
330
+ mimetypes = ['text/shex']
331
+ url = 'https://shex.io/shex-semantics/#shexc'
332
+ version_added = ''
333
+
334
+ # character group definitions ::
335
+
336
+ PN_CHARS_BASE_GRP = ('a-zA-Z'
337
+ '\u00c0-\u00d6'
338
+ '\u00d8-\u00f6'
339
+ '\u00f8-\u02ff'
340
+ '\u0370-\u037d'
341
+ '\u037f-\u1fff'
342
+ '\u200c-\u200d'
343
+ '\u2070-\u218f'
344
+ '\u2c00-\u2fef'
345
+ '\u3001-\ud7ff'
346
+ '\uf900-\ufdcf'
347
+ '\ufdf0-\ufffd')
348
+
349
+ PN_CHARS_U_GRP = (PN_CHARS_BASE_GRP + '_')
350
+
351
+ PN_CHARS_GRP = (PN_CHARS_U_GRP +
352
+ r'\-' +
353
+ r'0-9' +
354
+ '\u00b7' +
355
+ '\u0300-\u036f' +
356
+ '\u203f-\u2040')
357
+
358
+ HEX_GRP = '0-9A-Fa-f'
359
+
360
+ PN_LOCAL_ESC_CHARS_GRP = r"_~.\-!$&'()*+,;=/?#@%"
361
+
362
+ # terminal productions ::
363
+
364
+ PN_CHARS_BASE = '[' + PN_CHARS_BASE_GRP + ']'
365
+
366
+ PN_CHARS_U = '[' + PN_CHARS_U_GRP + ']'
367
+
368
+ PN_CHARS = '[' + PN_CHARS_GRP + ']'
369
+
370
+ HEX = '[' + HEX_GRP + ']'
371
+
372
+ PN_LOCAL_ESC_CHARS = '[' + PN_LOCAL_ESC_CHARS_GRP + ']'
373
+
374
+ UCHAR_NO_BACKSLASH = '(?:u' + HEX + '{4}|U' + HEX + '{8})'
375
+
376
+ UCHAR = r'\\' + UCHAR_NO_BACKSLASH
377
+
378
+ IRIREF = r'<(?:[^\x00-\x20<>"{}|^`\\]|' + UCHAR + ')*>'
379
+
380
+ BLANK_NODE_LABEL = '_:[0-9' + PN_CHARS_U_GRP + '](?:[' + PN_CHARS_GRP + \
381
+ '.]*' + PN_CHARS + ')?'
382
+
383
+ PN_PREFIX = PN_CHARS_BASE + '(?:[' + PN_CHARS_GRP + '.]*' + PN_CHARS + ')?'
384
+
385
+ PERCENT = '%' + HEX + HEX
386
+
387
+ PN_LOCAL_ESC = r'\\' + PN_LOCAL_ESC_CHARS
388
+
389
+ PLX = '(?:' + PERCENT + ')|(?:' + PN_LOCAL_ESC + ')'
390
+
391
+ PN_LOCAL = ('(?:[' + PN_CHARS_U_GRP + ':0-9' + ']|' + PLX + ')' +
392
+ '(?:(?:[' + PN_CHARS_GRP + '.:]|' + PLX + ')*(?:[' +
393
+ PN_CHARS_GRP + ':]|' + PLX + '))?')
394
+
395
+ EXPONENT = r'[eE][+-]?\d+'
396
+
397
+ # Lexer token definitions ::
398
+
399
+ tokens = {
400
+ 'root': [
401
+ (r'\s+', Text),
402
+ # keywords ::
403
+ (r'(?i)(base|prefix|start|external|'
404
+ r'literal|iri|bnode|nonliteral|length|minlength|maxlength|'
405
+ r'mininclusive|minexclusive|maxinclusive|maxexclusive|'
406
+ r'totaldigits|fractiondigits|'
407
+ r'closed|extra)\b', Keyword),
408
+ (r'(a)\b', Keyword),
409
+ # IRIs ::
410
+ ('(' + IRIREF + ')', Name.Label),
411
+ # blank nodes ::
412
+ ('(' + BLANK_NODE_LABEL + ')', Name.Label),
413
+ # prefixed names ::
414
+ (r'(' + PN_PREFIX + r')?(\:)(' + PN_LOCAL + ')?',
415
+ bygroups(Name.Namespace, Punctuation, Name.Tag)),
416
+ # boolean literals ::
417
+ (r'(true|false)', Keyword.Constant),
418
+ # double literals ::
419
+ (r'[+\-]?(\d+\.\d*' + EXPONENT + r'|\.?\d+' + EXPONENT + ')', Number.Float),
420
+ # decimal literals ::
421
+ (r'[+\-]?(\d+\.\d*|\.\d+)', Number.Float),
422
+ # integer literals ::
423
+ (r'[+\-]?\d+', Number.Integer),
424
+ # operators ::
425
+ (r'[@|$&=*+?^\-~]', Operator),
426
+ # operator keywords ::
427
+ (r'(?i)(and|or|not)\b', Operator.Word),
428
+ # punctuation characters ::
429
+ (r'[(){}.;,:^\[\]]', Punctuation),
430
+ # line comments ::
431
+ (r'#[^\n]*', Comment),
432
+ # strings ::
433
+ (r'"""', String, 'triple-double-quoted-string'),
434
+ (r'"', String, 'single-double-quoted-string'),
435
+ (r"'''", String, 'triple-single-quoted-string'),
436
+ (r"'", String, 'single-single-quoted-string'),
437
+ ],
438
+ 'triple-double-quoted-string': [
439
+ (r'"""', String, 'end-of-string'),
440
+ (r'[^\\]+', String),
441
+ (r'\\', String, 'string-escape'),
442
+ ],
443
+ 'single-double-quoted-string': [
444
+ (r'"', String, 'end-of-string'),
445
+ (r'[^"\\\n]+', String),
446
+ (r'\\', String, 'string-escape'),
447
+ ],
448
+ 'triple-single-quoted-string': [
449
+ (r"'''", String, 'end-of-string'),
450
+ (r'[^\\]+', String),
451
+ (r'\\', String.Escape, 'string-escape'),
452
+ ],
453
+ 'single-single-quoted-string': [
454
+ (r"'", String, 'end-of-string'),
455
+ (r"[^'\\\n]+", String),
456
+ (r'\\', String, 'string-escape'),
457
+ ],
458
+ 'string-escape': [
459
+ (UCHAR_NO_BACKSLASH, String.Escape, '#pop'),
460
+ (r'.', String.Escape, '#pop'),
461
+ ],
462
+ 'end-of-string': [
463
+ (r'(@)([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)',
464
+ bygroups(Operator, Name.Function), '#pop:2'),
465
+ (r'\^\^', Operator, '#pop:2'),
466
+ default('#pop:2'),
467
+ ],
468
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rebol.py ADDED
@@ -0,0 +1,419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.rebol
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the REBOL 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, bygroups
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Generic, Whitespace
16
+
17
+ __all__ = ['RebolLexer', 'RedLexer']
18
+
19
+
20
+ class RebolLexer(RegexLexer):
21
+ """
22
+ A REBOL lexer.
23
+ """
24
+ name = 'REBOL'
25
+ aliases = ['rebol']
26
+ filenames = ['*.r', '*.r3', '*.reb']
27
+ mimetypes = ['text/x-rebol']
28
+ url = 'http://www.rebol.com'
29
+ version_added = '1.1'
30
+
31
+ flags = re.IGNORECASE | re.MULTILINE
32
+
33
+ escape_re = r'(?:\^\([0-9a-f]{1,4}\)*)'
34
+
35
+ def word_callback(lexer, match):
36
+ word = match.group()
37
+
38
+ if re.match(".*:$", word):
39
+ yield match.start(), Generic.Subheading, word
40
+ elif re.match(
41
+ r'(native|alias|all|any|as-string|as-binary|bind|bound\?|case|'
42
+ r'catch|checksum|comment|debase|dehex|exclude|difference|disarm|'
43
+ r'either|else|enbase|foreach|remove-each|form|free|get|get-env|if|'
44
+ r'in|intersect|loop|minimum-of|maximum-of|mold|new-line|'
45
+ r'new-line\?|not|now|prin|print|reduce|compose|construct|repeat|'
46
+ r'reverse|save|script\?|set|shift|switch|throw|to-hex|trace|try|'
47
+ r'type\?|union|unique|unless|unprotect|unset|until|use|value\?|'
48
+ r'while|compress|decompress|secure|open|close|read|read-io|'
49
+ r'write-io|write|update|query|wait|input\?|exp|log-10|log-2|'
50
+ r'log-e|square-root|cosine|sine|tangent|arccosine|arcsine|'
51
+ r'arctangent|protect|lowercase|uppercase|entab|detab|connected\?|'
52
+ r'browse|launch|stats|get-modes|set-modes|to-local-file|'
53
+ r'to-rebol-file|encloak|decloak|create-link|do-browser|bind\?|'
54
+ r'hide|draw|show|size-text|textinfo|offset-to-caret|'
55
+ r'caret-to-offset|local-request-file|rgb-to-hsv|hsv-to-rgb|'
56
+ r'crypt-strength\?|dh-make-key|dh-generate-key|dh-compute-key|'
57
+ r'dsa-make-key|dsa-generate-key|dsa-make-signature|'
58
+ r'dsa-verify-signature|rsa-make-key|rsa-generate-key|'
59
+ r'rsa-encrypt)$', word):
60
+ yield match.start(), Name.Builtin, word
61
+ elif re.match(
62
+ r'(add|subtract|multiply|divide|remainder|power|and~|or~|xor~|'
63
+ r'minimum|maximum|negate|complement|absolute|random|head|tail|'
64
+ r'next|back|skip|at|pick|first|second|third|fourth|fifth|sixth|'
65
+ r'seventh|eighth|ninth|tenth|last|path|find|select|make|to|copy\*|'
66
+ r'insert|remove|change|poke|clear|trim|sort|min|max|abs|cp|'
67
+ r'copy)$', word):
68
+ yield match.start(), Name.Function, word
69
+ elif re.match(
70
+ r'(error|source|input|license|help|install|echo|Usage|with|func|'
71
+ r'throw-on-error|function|does|has|context|probe|\?\?|as-pair|'
72
+ r'mod|modulo|round|repend|about|set-net|append|join|rejoin|reform|'
73
+ r'remold|charset|array|replace|move|extract|forskip|forall|alter|'
74
+ r'first+|also|take|for|forever|dispatch|attempt|what-dir|'
75
+ r'change-dir|clean-path|list-dir|dirize|rename|split-path|delete|'
76
+ r'make-dir|delete-dir|in-dir|confirm|dump-obj|upgrade|what|'
77
+ r'build-tag|process-source|build-markup|decode-cgi|read-cgi|'
78
+ r'write-user|save-user|set-user-name|protect-system|parse-xml|'
79
+ r'cvs-date|cvs-version|do-boot|get-net-info|desktop|layout|'
80
+ r'scroll-para|get-face|alert|set-face|uninstall|unfocus|'
81
+ r'request-dir|center-face|do-events|net-error|decode-url|'
82
+ r'parse-header|parse-header-date|parse-email-addrs|import-email|'
83
+ r'send|build-attach-body|resend|show-popup|hide-popup|open-events|'
84
+ r'find-key-face|do-face|viewtop|confine|find-window|'
85
+ r'insert-event-func|remove-event-func|inform|dump-pane|dump-face|'
86
+ r'flag-face|deflag-face|clear-fields|read-net|vbug|path-thru|'
87
+ r'read-thru|load-thru|do-thru|launch-thru|load-image|'
88
+ r'request-download|do-face-alt|set-font|set-para|get-style|'
89
+ r'set-style|make-face|stylize|choose|hilight-text|hilight-all|'
90
+ r'unlight-text|focus|scroll-drag|clear-face|reset-face|scroll-face|'
91
+ r'resize-face|load-stock|load-stock-block|notify|request|flash|'
92
+ r'request-color|request-pass|request-text|request-list|'
93
+ r'request-date|request-file|dbug|editor|link-relative-path|'
94
+ r'emailer|parse-error)$', word):
95
+ yield match.start(), Keyword.Namespace, word
96
+ elif re.match(
97
+ r'(halt|quit|do|load|q|recycle|call|run|ask|parse|view|unview|'
98
+ r'return|exit|break)$', word):
99
+ yield match.start(), Name.Exception, word
100
+ elif re.match('REBOL$', word):
101
+ yield match.start(), Generic.Heading, word
102
+ elif re.match("to-.*", word):
103
+ yield match.start(), Keyword, word
104
+ elif re.match(r'(\+|-|\*|/|//|\*\*|and|or|xor|=\?|=|==|<>|<|>|<=|>=)$',
105
+ word):
106
+ yield match.start(), Operator, word
107
+ elif re.match(r".*\?$", word):
108
+ yield match.start(), Keyword, word
109
+ elif re.match(r".*\!$", word):
110
+ yield match.start(), Keyword.Type, word
111
+ elif re.match("'.*", word):
112
+ yield match.start(), Name.Variable.Instance, word # lit-word
113
+ elif re.match("#.*", word):
114
+ yield match.start(), Name.Label, word # issue
115
+ elif re.match("%.*", word):
116
+ yield match.start(), Name.Decorator, word # file
117
+ else:
118
+ yield match.start(), Name.Variable, word
119
+
120
+ tokens = {
121
+ 'root': [
122
+ (r'\s+', Text),
123
+ (r'#"', String.Char, 'char'),
124
+ (r'#\{[0-9a-f]*\}', Number.Hex),
125
+ (r'2#\{', Number.Hex, 'bin2'),
126
+ (r'64#\{[0-9a-z+/=\s]*\}', Number.Hex),
127
+ (r'"', String, 'string'),
128
+ (r'\{', String, 'string2'),
129
+ (r';#+.*\n', Comment.Special),
130
+ (r';\*+.*\n', Comment.Preproc),
131
+ (r';.*\n', Comment),
132
+ (r'%"', Name.Decorator, 'stringFile'),
133
+ (r'%[^(^{")\s\[\]]+', Name.Decorator),
134
+ (r'[+-]?([a-z]{1,3})?\$\d+(\.\d+)?', Number.Float), # money
135
+ (r'[+-]?\d+\:\d+(\:\d+)?(\.\d+)?', String.Other), # time
136
+ (r'\d+[\-/][0-9a-z]+[\-/]\d+(\/\d+\:\d+((\:\d+)?'
137
+ r'([.\d+]?([+-]?\d+:\d+)?)?)?)?', String.Other), # date
138
+ (r'\d+(\.\d+)+\.\d+', Keyword.Constant), # tuple
139
+ (r'\d+X\d+', Keyword.Constant), # pair
140
+ (r'[+-]?\d+(\'\d+)?([.,]\d*)?E[+-]?\d+', Number.Float),
141
+ (r'[+-]?\d+(\'\d+)?[.,]\d*', Number.Float),
142
+ (r'[+-]?\d+(\'\d+)?', Number),
143
+ (r'[\[\]()]', Generic.Strong),
144
+ (r'[a-z]+[^(^{"\s:)]*://[^(^{"\s)]*', Name.Decorator), # url
145
+ (r'mailto:[^(^{"@\s)]+@[^(^{"@\s)]+', Name.Decorator), # url
146
+ (r'[^(^{"@\s)]+@[^(^{"@\s)]+', Name.Decorator), # email
147
+ (r'comment\s"', Comment, 'commentString1'),
148
+ (r'comment\s\{', Comment, 'commentString2'),
149
+ (r'comment\s\[', Comment, 'commentBlock'),
150
+ (r'comment\s[^(\s{"\[]+', Comment),
151
+ (r'/[^(^{")\s/[\]]*', Name.Attribute),
152
+ (r'([^(^{")\s/[\]]+)(?=[:({"\s/\[\]])', word_callback),
153
+ (r'<[\w:.-]*>', Name.Tag),
154
+ (r'<[^(<>\s")]+', Name.Tag, 'tag'),
155
+ (r'([^(^{")\s]+)', Text),
156
+ ],
157
+ 'string': [
158
+ (r'[^(^")]+', String),
159
+ (escape_re, String.Escape),
160
+ (r'[(|)]+', String),
161
+ (r'\^.', String.Escape),
162
+ (r'"', String, '#pop'),
163
+ ],
164
+ 'string2': [
165
+ (r'[^(^{})]+', String),
166
+ (escape_re, String.Escape),
167
+ (r'[(|)]+', String),
168
+ (r'\^.', String.Escape),
169
+ (r'\{', String, '#push'),
170
+ (r'\}', String, '#pop'),
171
+ ],
172
+ 'stringFile': [
173
+ (r'[^(^")]+', Name.Decorator),
174
+ (escape_re, Name.Decorator),
175
+ (r'\^.', Name.Decorator),
176
+ (r'"', Name.Decorator, '#pop'),
177
+ ],
178
+ 'char': [
179
+ (escape_re + '"', String.Char, '#pop'),
180
+ (r'\^."', String.Char, '#pop'),
181
+ (r'."', String.Char, '#pop'),
182
+ ],
183
+ 'tag': [
184
+ (escape_re, Name.Tag),
185
+ (r'"', Name.Tag, 'tagString'),
186
+ (r'[^(<>\r\n")]+', Name.Tag),
187
+ (r'>', Name.Tag, '#pop'),
188
+ ],
189
+ 'tagString': [
190
+ (r'[^(^")]+', Name.Tag),
191
+ (escape_re, Name.Tag),
192
+ (r'[(|)]+', Name.Tag),
193
+ (r'\^.', Name.Tag),
194
+ (r'"', Name.Tag, '#pop'),
195
+ ],
196
+ 'tuple': [
197
+ (r'(\d+\.)+', Keyword.Constant),
198
+ (r'\d+', Keyword.Constant, '#pop'),
199
+ ],
200
+ 'bin2': [
201
+ (r'\s+', Number.Hex),
202
+ (r'([01]\s*){8}', Number.Hex),
203
+ (r'\}', Number.Hex, '#pop'),
204
+ ],
205
+ 'commentString1': [
206
+ (r'[^(^")]+', Comment),
207
+ (escape_re, Comment),
208
+ (r'[(|)]+', Comment),
209
+ (r'\^.', Comment),
210
+ (r'"', Comment, '#pop'),
211
+ ],
212
+ 'commentString2': [
213
+ (r'[^(^{})]+', Comment),
214
+ (escape_re, Comment),
215
+ (r'[(|)]+', Comment),
216
+ (r'\^.', Comment),
217
+ (r'\{', Comment, '#push'),
218
+ (r'\}', Comment, '#pop'),
219
+ ],
220
+ 'commentBlock': [
221
+ (r'\[', Comment, '#push'),
222
+ (r'\]', Comment, '#pop'),
223
+ (r'"', Comment, "commentString1"),
224
+ (r'\{', Comment, "commentString2"),
225
+ (r'[^(\[\]"{)]+', Comment),
226
+ ],
227
+ }
228
+
229
+ def analyse_text(text):
230
+ """
231
+ Check if code contains REBOL header and so it probably not R code
232
+ """
233
+ if re.match(r'^\s*REBOL\s*\[', text, re.IGNORECASE):
234
+ # The code starts with REBOL header
235
+ return 1.0
236
+ elif re.search(r'\s*REBOL\s*\[', text, re.IGNORECASE):
237
+ # The code contains REBOL header but also some text before it
238
+ return 0.5
239
+
240
+
241
+ class RedLexer(RegexLexer):
242
+ """
243
+ A Red-language lexer.
244
+ """
245
+ name = 'Red'
246
+ aliases = ['red', 'red/system']
247
+ filenames = ['*.red', '*.reds']
248
+ mimetypes = ['text/x-red', 'text/x-red-system']
249
+ url = 'https://www.red-lang.org'
250
+ version_added = '2.0'
251
+
252
+ flags = re.IGNORECASE | re.MULTILINE
253
+
254
+ escape_re = r'(?:\^\([0-9a-f]{1,4}\)*)'
255
+
256
+ def word_callback(lexer, match):
257
+ word = match.group()
258
+
259
+ if re.match(".*:$", word):
260
+ yield match.start(), Generic.Subheading, word
261
+ elif re.match(r'(if|unless|either|any|all|while|until|loop|repeat|'
262
+ r'foreach|forall|func|function|does|has|switch|'
263
+ r'case|reduce|compose|get|set|print|prin|equal\?|'
264
+ r'not-equal\?|strict-equal\?|lesser\?|greater\?|lesser-or-equal\?|'
265
+ r'greater-or-equal\?|same\?|not|type\?|stats|'
266
+ r'bind|union|replace|charset|routine)$', word):
267
+ yield match.start(), Name.Builtin, word
268
+ elif re.match(r'(make|random|reflect|to|form|mold|absolute|add|divide|multiply|negate|'
269
+ r'power|remainder|round|subtract|even\?|odd\?|and~|complement|or~|xor~|'
270
+ r'append|at|back|change|clear|copy|find|head|head\?|index\?|insert|'
271
+ r'length\?|next|pick|poke|remove|reverse|select|sort|skip|swap|tail|tail\?|'
272
+ r'take|trim|create|close|delete|modify|open|open\?|query|read|rename|'
273
+ r'update|write)$', word):
274
+ yield match.start(), Name.Function, word
275
+ elif re.match(r'(yes|on|no|off|true|false|tab|cr|lf|newline|escape|slash|sp|space|null|'
276
+ r'none|crlf|dot|null-byte)$', word):
277
+ yield match.start(), Name.Builtin.Pseudo, word
278
+ elif re.match(r'(#system-global|#include|#enum|#define|#either|#if|#import|#export|'
279
+ r'#switch|#default|#get-definition)$', word):
280
+ yield match.start(), Keyword.Namespace, word
281
+ elif re.match(r'(system|halt|quit|quit-return|do|load|q|recycle|call|run|ask|parse|'
282
+ r'raise-error|return|exit|break|alias|push|pop|probe|\?\?|spec-of|body-of|'
283
+ r'quote|forever)$', word):
284
+ yield match.start(), Name.Exception, word
285
+ elif re.match(r'(action\?|block\?|char\?|datatype\?|file\?|function\?|get-path\?|zero\?|'
286
+ r'get-word\?|integer\?|issue\?|lit-path\?|lit-word\?|logic\?|native\?|'
287
+ r'op\?|paren\?|path\?|refinement\?|set-path\?|set-word\?|string\?|unset\?|'
288
+ r'any-struct\?|none\?|word\?|any-series\?)$', word):
289
+ yield match.start(), Keyword, word
290
+ elif re.match(r'(JNICALL|stdcall|cdecl|infix)$', word):
291
+ yield match.start(), Keyword.Namespace, word
292
+ elif re.match("to-.*", word):
293
+ yield match.start(), Keyword, word
294
+ elif re.match(r'(\+|-\*\*|-|\*\*|//|/|\*|and|or|xor|=\?|===|==|=|<>|<=|>=|'
295
+ r'<<<|>>>|<<|>>|<|>%)$', word):
296
+ yield match.start(), Operator, word
297
+ elif re.match(r".*\!$", word):
298
+ yield match.start(), Keyword.Type, word
299
+ elif re.match("'.*", word):
300
+ yield match.start(), Name.Variable.Instance, word # lit-word
301
+ elif re.match("#.*", word):
302
+ yield match.start(), Name.Label, word # issue
303
+ elif re.match("%.*", word):
304
+ yield match.start(), Name.Decorator, word # file
305
+ elif re.match(":.*", word):
306
+ yield match.start(), Generic.Subheading, word # get-word
307
+ else:
308
+ yield match.start(), Name.Variable, word
309
+
310
+ tokens = {
311
+ 'root': [
312
+ (r'\s+', Text),
313
+ (r'#"', String.Char, 'char'),
314
+ (r'#\{[0-9a-f\s]*\}', Number.Hex),
315
+ (r'2#\{', Number.Hex, 'bin2'),
316
+ (r'64#\{[0-9a-z+/=\s]*\}', Number.Hex),
317
+ (r'([0-9a-f]+)(h)((\s)|(?=[\[\]{}"()]))',
318
+ bygroups(Number.Hex, Name.Variable, Whitespace)),
319
+ (r'"', String, 'string'),
320
+ (r'\{', String, 'string2'),
321
+ (r';#+.*\n', Comment.Special),
322
+ (r';\*+.*\n', Comment.Preproc),
323
+ (r';.*\n', Comment),
324
+ (r'%"', Name.Decorator, 'stringFile'),
325
+ (r'%[^(^{")\s\[\]]+', Name.Decorator),
326
+ (r'[+-]?([a-z]{1,3})?\$\d+(\.\d+)?', Number.Float), # money
327
+ (r'[+-]?\d+\:\d+(\:\d+)?(\.\d+)?', String.Other), # time
328
+ (r'\d+[\-/][0-9a-z]+[\-/]\d+(/\d+:\d+((:\d+)?'
329
+ r'([\.\d+]?([+-]?\d+:\d+)?)?)?)?', String.Other), # date
330
+ (r'\d+(\.\d+)+\.\d+', Keyword.Constant), # tuple
331
+ (r'\d+X\d+', Keyword.Constant), # pair
332
+ (r'[+-]?\d+(\'\d+)?([.,]\d*)?E[+-]?\d+', Number.Float),
333
+ (r'[+-]?\d+(\'\d+)?[.,]\d*', Number.Float),
334
+ (r'[+-]?\d+(\'\d+)?', Number),
335
+ (r'[\[\]()]', Generic.Strong),
336
+ (r'[a-z]+[^(^{"\s:)]*://[^(^{"\s)]*', Name.Decorator), # url
337
+ (r'mailto:[^(^{"@\s)]+@[^(^{"@\s)]+', Name.Decorator), # url
338
+ (r'[^(^{"@\s)]+@[^(^{"@\s)]+', Name.Decorator), # email
339
+ (r'comment\s"', Comment, 'commentString1'),
340
+ (r'comment\s\{', Comment, 'commentString2'),
341
+ (r'comment\s\[', Comment, 'commentBlock'),
342
+ (r'comment\s[^(\s{"\[]+', Comment),
343
+ (r'/[^(^{^")\s/[\]]*', Name.Attribute),
344
+ (r'([^(^{^")\s/[\]]+)(?=[:({"\s/\[\]])', word_callback),
345
+ (r'<[\w:.-]*>', Name.Tag),
346
+ (r'<[^(<>\s")]+', Name.Tag, 'tag'),
347
+ (r'([^(^{")\s]+)', Text),
348
+ ],
349
+ 'string': [
350
+ (r'[^(^")]+', String),
351
+ (escape_re, String.Escape),
352
+ (r'[(|)]+', String),
353
+ (r'\^.', String.Escape),
354
+ (r'"', String, '#pop'),
355
+ ],
356
+ 'string2': [
357
+ (r'[^(^{})]+', String),
358
+ (escape_re, String.Escape),
359
+ (r'[(|)]+', String),
360
+ (r'\^.', String.Escape),
361
+ (r'\{', String, '#push'),
362
+ (r'\}', String, '#pop'),
363
+ ],
364
+ 'stringFile': [
365
+ (r'[^(^")]+', Name.Decorator),
366
+ (escape_re, Name.Decorator),
367
+ (r'\^.', Name.Decorator),
368
+ (r'"', Name.Decorator, '#pop'),
369
+ ],
370
+ 'char': [
371
+ (escape_re + '"', String.Char, '#pop'),
372
+ (r'\^."', String.Char, '#pop'),
373
+ (r'."', String.Char, '#pop'),
374
+ ],
375
+ 'tag': [
376
+ (escape_re, Name.Tag),
377
+ (r'"', Name.Tag, 'tagString'),
378
+ (r'[^(<>\r\n")]+', Name.Tag),
379
+ (r'>', Name.Tag, '#pop'),
380
+ ],
381
+ 'tagString': [
382
+ (r'[^(^")]+', Name.Tag),
383
+ (escape_re, Name.Tag),
384
+ (r'[(|)]+', Name.Tag),
385
+ (r'\^.', Name.Tag),
386
+ (r'"', Name.Tag, '#pop'),
387
+ ],
388
+ 'tuple': [
389
+ (r'(\d+\.)+', Keyword.Constant),
390
+ (r'\d+', Keyword.Constant, '#pop'),
391
+ ],
392
+ 'bin2': [
393
+ (r'\s+', Number.Hex),
394
+ (r'([01]\s*){8}', Number.Hex),
395
+ (r'\}', Number.Hex, '#pop'),
396
+ ],
397
+ 'commentString1': [
398
+ (r'[^(^")]+', Comment),
399
+ (escape_re, Comment),
400
+ (r'[(|)]+', Comment),
401
+ (r'\^.', Comment),
402
+ (r'"', Comment, '#pop'),
403
+ ],
404
+ 'commentString2': [
405
+ (r'[^(^{})]+', Comment),
406
+ (escape_re, Comment),
407
+ (r'[(|)]+', Comment),
408
+ (r'\^.', Comment),
409
+ (r'\{', Comment, '#push'),
410
+ (r'\}', Comment, '#pop'),
411
+ ],
412
+ 'commentBlock': [
413
+ (r'\[', Comment, '#push'),
414
+ (r'\]', Comment, '#pop'),
415
+ (r'"', Comment, "commentString1"),
416
+ (r'\{', Comment, "commentString2"),
417
+ (r'[^(\[\]"{)]+', Comment),
418
+ ],
419
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rego.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.rego
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Rego policy 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, words
12
+ from pygments.token import Comment, Operator, Keyword, Name, String, Number, Punctuation, Whitespace
13
+
14
+ class RegoLexer(RegexLexer):
15
+ """
16
+ For Rego source.
17
+ """
18
+ name = 'Rego'
19
+ url = 'https://www.openpolicyagent.org/docs/latest/policy-language/'
20
+ filenames = ['*.rego']
21
+ aliases = ['rego']
22
+ mimetypes = ['text/x-rego']
23
+ version_added = '2.19'
24
+
25
+ reserved_words = (
26
+ 'as', 'contains', 'data', 'default', 'else', 'every', 'false',
27
+ 'if', 'in', 'import', 'package', 'not', 'null',
28
+ 'some', 'true', 'with'
29
+ )
30
+
31
+ builtins = (
32
+ # https://www.openpolicyagent.org/docs/latest/philosophy/#the-opa-document-model
33
+ 'data', # Global variable for accessing base and virtual documents
34
+ 'input', # Represents synchronously pushed base documents
35
+ )
36
+
37
+ tokens = {
38
+ 'root': [
39
+ (r'\n', Whitespace),
40
+ (r'\s+', Whitespace),
41
+ (r'#.*?$', Comment.Single),
42
+ (words(reserved_words, suffix=r'\b'), Keyword),
43
+ (words(builtins, suffix=r'\b'), Name.Builtin),
44
+ (r'[a-zA-Z_][a-zA-Z0-9_]*', Name),
45
+ (r'"(\\\\|\\"|[^"])*"', String.Double),
46
+ (r'`[^`]*`', String.Backtick),
47
+ (r'-?\d+(\.\d+)?', Number),
48
+ (r'(==|!=|<=|>=|:=)', Operator), # Compound operators
49
+ (r'[=<>+\-*/%&|]', Operator), # Single-character operators
50
+ (r'[\[\]{}(),.:;]', Punctuation),
51
+ ]
52
+ }
53
+
54
+ __all__ = ['RegoLexer']
55
+
56
+
57
+
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rell.py ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.rell
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Rell 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, String, Number, \
13
+ Punctuation, Whitespace
14
+
15
+ __all__ = ['RellLexer']
16
+
17
+
18
+ class RellLexer(RegexLexer):
19
+ """
20
+ A Lexer for Rell.
21
+ """
22
+ name = 'Rell'
23
+ url = 'https://docs.chromia.com/rell/rell-intro'
24
+ aliases = ['rell']
25
+ filenames = ['*.rell']
26
+ mimetypes = ['text/x-rell']
27
+ version_added = '2.20'
28
+
29
+ ident = r'[a-zA-Z_][a-zA-Z0-9_]*'
30
+
31
+ tokens = {
32
+ 'root': [
33
+ (words((
34
+ 'big_integer', 'boolean', 'byte_array', 'decimal', 'gtv',
35
+ 'integer', 'json', 'list', 'map', 'mutable', 'set', 'text',
36
+ 'virtual'), suffix=r'\b'),
37
+ Keyword.Type),
38
+ (r'(false|true|null)\b', Keyword.Constant),
39
+ (r'(entity|enum|namespace|object|struct)\b', Keyword.Declaration),
40
+ (r'(function|operation|query)\b', Keyword.Declaration, 'function'),
41
+ (words((
42
+ 'abstract', 'and', 'break', 'continue', 'create', 'delete',
43
+ 'else', 'for', 'if', 'import', 'in', 'index', 'key', 'limit',
44
+ 'module', 'not', 'offset', 'or', 'override', 'return', 'update',
45
+ 'val', 'var', 'when', 'while'), suffix=r'\b'),
46
+ Keyword.Reserved),
47
+ (r'//.*?$', Comment.Single),
48
+ (r'/\*(.|\n|\r)*?\*/', Comment.Multiline),
49
+ (r'"(\\\\|\\"|[^"])*"', String.Double),
50
+ (r'\'(\\\\|\\\'|[^\\\'])*\'', String.Single),
51
+ (r'-?[0-9]*\.[0-9]+([eE][+-][0-9]+)?', Number.Float),
52
+ (r'-?[0-9]+([eE][+-][0-9]+|[lL])?', Number.Integer),
53
+ (r'x(\'[a-fA-F0-9]*\'|"[a-fA-F0-9]*")', String.Binary),
54
+ (r'(\.)([ \n\t\r]*)(' + ident + ')',
55
+ bygroups(Punctuation, Whitespace, Name.Attribute)),
56
+ (r'[{}():;,]+', Punctuation),
57
+ (r'[ \n\t\r]+', Whitespace),
58
+ (r'@[a-zA-Z_][a-zA-Z0-9_]*', Name.Decorator),
59
+ (r'[~^*!%&\[\]<>|+=/?\-@\$]', Punctuation.Marker),
60
+ (ident, Name),
61
+ (r'(\.)+', Punctuation),
62
+ ],
63
+ 'function': [
64
+ (r'[ \n\t\r]+', Whitespace),
65
+ (ident, Name.Function, '#pop'),
66
+ default('#pop'),
67
+ ],
68
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/resource.py ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.resource
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for resource definition files.
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, words
14
+ from pygments.token import Comment, String, Number, Operator, Text, \
15
+ Keyword, Name
16
+
17
+ __all__ = ['ResourceLexer']
18
+
19
+
20
+ class ResourceLexer(RegexLexer):
21
+ """Lexer for ICU Resource bundles.
22
+ """
23
+ name = 'ResourceBundle'
24
+ aliases = ['resourcebundle', 'resource']
25
+ filenames = []
26
+ url = 'https://unicode-org.github.io/icu/userguide/locale/resources.html'
27
+ version_added = '2.0'
28
+
29
+ _types = (':table', ':array', ':string', ':bin', ':import', ':intvector',
30
+ ':int', ':alias')
31
+
32
+ flags = re.MULTILINE | re.IGNORECASE
33
+ tokens = {
34
+ 'root': [
35
+ (r'//.*?$', Comment),
36
+ (r'"', String, 'string'),
37
+ (r'-?\d+', Number.Integer),
38
+ (r'[,{}]', Operator),
39
+ (r'([^\s{{:]+)(\s*)({}?)'.format('|'.join(_types)),
40
+ bygroups(Name, Text, Keyword)),
41
+ (r'\s+', Text),
42
+ (words(_types), Keyword),
43
+ ],
44
+ 'string': [
45
+ (r'(\\x[0-9a-f]{2}|\\u[0-9a-f]{4}|\\U00[0-9a-f]{6}|'
46
+ r'\\[0-7]{1,3}|\\c.|\\[abtnvfre\'"?\\]|\\\{|[^"{\\])+', String),
47
+ (r'\{', String.Escape, 'msgname'),
48
+ (r'"', String, '#pop')
49
+ ],
50
+ 'msgname': [
51
+ (r'([^{},]+)(\s*)', bygroups(Name, String.Escape), ('#pop', 'message'))
52
+ ],
53
+ 'message': [
54
+ (r'\{', String.Escape, 'msgname'),
55
+ (r'\}', String.Escape, '#pop'),
56
+ (r'(,)(\s*)([a-z]+)(\s*\})',
57
+ bygroups(Operator, String.Escape, Keyword, String.Escape), '#pop'),
58
+ (r'(,)(\s*)([a-z]+)(\s*)(,)(\s*)(offset)(\s*)(:)(\s*)(-?\d+)(\s*)',
59
+ bygroups(Operator, String.Escape, Keyword, String.Escape, Operator,
60
+ String.Escape, Operator.Word, String.Escape, Operator,
61
+ String.Escape, Number.Integer, String.Escape), 'choice'),
62
+ (r'(,)(\s*)([a-z]+)(\s*)(,)(\s*)',
63
+ bygroups(Operator, String.Escape, Keyword, String.Escape, Operator,
64
+ String.Escape), 'choice'),
65
+ (r'\s+', String.Escape)
66
+ ],
67
+ 'choice': [
68
+ (r'(=|<|>|<=|>=|!=)(-?\d+)(\s*\{)',
69
+ bygroups(Operator, Number.Integer, String.Escape), 'message'),
70
+ (r'([a-z]+)(\s*\{)', bygroups(Keyword.Type, String.Escape), 'str'),
71
+ (r'\}', String.Escape, ('#pop', '#pop')),
72
+ (r'\s+', String.Escape)
73
+ ],
74
+ 'str': [
75
+ (r'\}', String.Escape, '#pop'),
76
+ (r'\{', String.Escape, 'msgname'),
77
+ (r'[^{}]+', String)
78
+ ]
79
+ }
80
+
81
+ def analyse_text(text):
82
+ if text.startswith('root:table'):
83
+ return 1.0
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/ride.py ADDED
@@ -0,0 +1,138 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ride
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Ride 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.lexer import RegexLexer, words, include
12
+ from pygments.token import Comment, Keyword, Name, Number, Punctuation, \
13
+ String, Text
14
+
15
+ __all__ = ['RideLexer']
16
+
17
+
18
+ class RideLexer(RegexLexer):
19
+ """
20
+ For Ride source code.
21
+ """
22
+
23
+ name = 'Ride'
24
+ aliases = ['ride']
25
+ filenames = ['*.ride']
26
+ mimetypes = ['text/x-ride']
27
+ url = 'https://docs.waves.tech/en/ride'
28
+ version_added = '2.6'
29
+
30
+ validName = r'[a-zA-Z_][a-zA-Z0-9_\']*'
31
+
32
+ builtinOps = (
33
+ '||', '|', '>=', '>', '==', '!',
34
+ '=', '<=', '<', '::', ':+', ':', '!=', '/',
35
+ '.', '=>', '-', '+', '*', '&&', '%', '++',
36
+ )
37
+
38
+ globalVariablesName = (
39
+ 'NOALG', 'MD5', 'SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512',
40
+ 'SHA3224', 'SHA3256', 'SHA3384', 'SHA3512', 'nil', 'this', 'unit',
41
+ 'height', 'lastBlock', 'Buy', 'Sell', 'CEILING', 'FLOOR', 'DOWN',
42
+ 'HALFDOWN', 'HALFEVEN', 'HALFUP', 'UP',
43
+ )
44
+
45
+ typesName = (
46
+ 'Unit', 'Int', 'Boolean', 'ByteVector', 'String', 'Address', 'Alias',
47
+ 'Transfer', 'AssetPair', 'DataEntry', 'Order', 'Transaction',
48
+ 'GenesisTransaction', 'PaymentTransaction', 'ReissueTransaction',
49
+ 'BurnTransaction', 'MassTransferTransaction', 'ExchangeTransaction',
50
+ 'TransferTransaction', 'SetAssetScriptTransaction',
51
+ 'InvokeScriptTransaction', 'IssueTransaction', 'LeaseTransaction',
52
+ 'LeaseCancelTransaction', 'CreateAliasTransaction',
53
+ 'SetScriptTransaction', 'SponsorFeeTransaction', 'DataTransaction',
54
+ 'WriteSet', 'AttachedPayment', 'ScriptTransfer', 'TransferSet',
55
+ 'ScriptResult', 'Invocation', 'Asset', 'BlockInfo', 'Issue', 'Reissue',
56
+ 'Burn', 'NoAlg', 'Md5', 'Sha1', 'Sha224', 'Sha256', 'Sha384', 'Sha512',
57
+ 'Sha3224', 'Sha3256', 'Sha3384', 'Sha3512', 'BinaryEntry',
58
+ 'BooleanEntry', 'IntegerEntry', 'StringEntry', 'List', 'Ceiling',
59
+ 'Down', 'Floor', 'HalfDown', 'HalfEven', 'HalfUp', 'Up',
60
+ )
61
+
62
+ functionsName = (
63
+ 'fraction', 'size', 'toBytes', 'take', 'drop', 'takeRight', 'dropRight',
64
+ 'toString', 'isDefined', 'extract', 'throw', 'getElement', 'value',
65
+ 'cons', 'toUtf8String', 'toInt', 'indexOf', 'lastIndexOf', 'split',
66
+ 'parseInt', 'parseIntValue', 'keccak256', 'blake2b256', 'sha256',
67
+ 'sigVerify', 'toBase58String', 'fromBase58String', 'toBase64String',
68
+ 'fromBase64String', 'transactionById', 'transactionHeightById',
69
+ 'getInteger', 'getBoolean', 'getBinary', 'getString',
70
+ 'addressFromPublicKey', 'addressFromString', 'addressFromRecipient',
71
+ 'assetBalance', 'wavesBalance', 'getIntegerValue', 'getBooleanValue',
72
+ 'getBinaryValue', 'getStringValue', 'addressFromStringValue',
73
+ 'assetInfo', 'rsaVerify', 'checkMerkleProof', 'median',
74
+ 'valueOrElse', 'valueOrErrorMessage', 'contains', 'log', 'pow',
75
+ 'toBase16String', 'fromBase16String', 'blockInfoByHeight',
76
+ 'transferTransactionById',
77
+ )
78
+
79
+ reservedWords = words((
80
+ 'match', 'case', 'else', 'func', 'if',
81
+ 'let', 'then', '@Callable', '@Verifier',
82
+ ), suffix=r'\b')
83
+
84
+ tokens = {
85
+ 'root': [
86
+ # Comments
87
+ (r'#.*', Comment.Single),
88
+ # Whitespace
89
+ (r'\s+', Text),
90
+ # Strings
91
+ (r'"', String, 'doublequote'),
92
+ (r'utf8\'', String, 'utf8quote'),
93
+ (r'base(58|64|16)\'', String, 'singlequote'),
94
+ # Keywords
95
+ (reservedWords, Keyword.Reserved),
96
+ (r'\{-#.*?#-\}', Keyword.Reserved),
97
+ (r'FOLD<\d+>', Keyword.Reserved),
98
+ # Types
99
+ (words(typesName), Keyword.Type),
100
+ # Main
101
+ # (specialName, Keyword.Reserved),
102
+ # Prefix Operators
103
+ (words(builtinOps, prefix=r'\(', suffix=r'\)'), Name.Function),
104
+ # Infix Operators
105
+ (words(builtinOps), Name.Function),
106
+ (words(globalVariablesName), Name.Function),
107
+ (words(functionsName), Name.Function),
108
+ # Numbers
109
+ include('numbers'),
110
+ # Variable Names
111
+ (validName, Name.Variable),
112
+ # Parens
113
+ (r'[,()\[\]{}]', Punctuation),
114
+ ],
115
+
116
+ 'doublequote': [
117
+ (r'\\u[0-9a-fA-F]{4}', String.Escape),
118
+ (r'\\[nrfvb\\"]', String.Escape),
119
+ (r'[^"]', String),
120
+ (r'"', String, '#pop'),
121
+ ],
122
+
123
+ 'utf8quote': [
124
+ (r'\\u[0-9a-fA-F]{4}', String.Escape),
125
+ (r'\\[nrfvb\\\']', String.Escape),
126
+ (r'[^\']', String),
127
+ (r'\'', String, '#pop'),
128
+ ],
129
+
130
+ 'singlequote': [
131
+ (r'[^\']', String),
132
+ (r'\'', String, '#pop'),
133
+ ],
134
+
135
+ 'numbers': [
136
+ (r'_?\d+', Number.Integer),
137
+ ],
138
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rita.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.rita
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for RITA 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
12
+ from pygments.token import Comment, Operator, Keyword, Name, Literal, \
13
+ Punctuation, Whitespace
14
+
15
+ __all__ = ['RitaLexer']
16
+
17
+
18
+ class RitaLexer(RegexLexer):
19
+ """
20
+ Lexer for RITA.
21
+ """
22
+ name = 'Rita'
23
+ url = 'https://github.com/zaibacu/rita-dsl'
24
+ filenames = ['*.rita']
25
+ aliases = ['rita']
26
+ mimetypes = ['text/rita']
27
+ version_added = '2.11'
28
+
29
+ tokens = {
30
+ 'root': [
31
+ (r'\n', Whitespace),
32
+ (r'\s+', Whitespace),
33
+ (r'#(.*?)\n', Comment.Single),
34
+ (r'@(.*?)\n', Operator), # Yes, whole line as an operator
35
+ (r'"(\w|\d|\s|(\\")|[\'_\-./,\?\!])+?"', Literal),
36
+ (r'\'(\w|\d|\s|(\\\')|["_\-./,\?\!])+?\'', Literal),
37
+ (r'([A-Z_]+)', Keyword),
38
+ (r'([a-z0-9_]+)', Name),
39
+ (r'((->)|[!?+*|=])', Operator),
40
+ (r'[\(\),\{\}]', Punctuation)
41
+ ]
42
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rnc.py ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.rnc
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Relax-NG Compact syntax
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
+ Punctuation
14
+
15
+ __all__ = ['RNCCompactLexer']
16
+
17
+
18
+ class RNCCompactLexer(RegexLexer):
19
+ """
20
+ For RelaxNG-compact syntax.
21
+ """
22
+
23
+ name = 'Relax-NG Compact'
24
+ url = 'http://relaxng.org'
25
+ aliases = ['rng-compact', 'rnc']
26
+ filenames = ['*.rnc']
27
+ version_added = '2.2'
28
+
29
+ tokens = {
30
+ 'root': [
31
+ (r'namespace\b', Keyword.Namespace),
32
+ (r'(?:default|datatypes)\b', Keyword.Declaration),
33
+ (r'##.*$', Comment.Preproc),
34
+ (r'#.*$', Comment.Single),
35
+ (r'"[^"]*"', String.Double),
36
+ # TODO single quoted strings and escape sequences outside of
37
+ # double-quoted strings
38
+ (r'(?:element|attribute|mixed)\b', Keyword.Declaration, 'variable'),
39
+ (r'(text\b|xsd:[^ ]+)', Keyword.Type, 'maybe_xsdattributes'),
40
+ (r'[,?&*=|~]|>>', Operator),
41
+ (r'[(){}]', Punctuation),
42
+ (r'.', Text),
43
+ ],
44
+
45
+ # a variable has been declared using `element` or `attribute`
46
+ 'variable': [
47
+ (r'[^{]+', Name.Variable),
48
+ (r'\{', Punctuation, '#pop'),
49
+ ],
50
+
51
+ # after an xsd:<datatype> declaration there may be attributes
52
+ 'maybe_xsdattributes': [
53
+ (r'\{', Punctuation, 'xsdattributes'),
54
+ (r'\}', Punctuation, '#pop'),
55
+ (r'.', Text),
56
+ ],
57
+
58
+ # attributes take the form { key1 = value1 key2 = value2 ... }
59
+ 'xsdattributes': [
60
+ (r'[^ =}]', Name.Attribute),
61
+ (r'=', Operator),
62
+ (r'"[^"]*"', String.Double),
63
+ (r'\}', Punctuation, '#pop'),
64
+ (r'.', Text),
65
+ ],
66
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/roboconf.py ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.roboconf
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Roboconf DSL.
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, re
12
+ from pygments.token import Text, Operator, Keyword, Name, Comment
13
+
14
+ __all__ = ['RoboconfGraphLexer', 'RoboconfInstancesLexer']
15
+
16
+
17
+ class RoboconfGraphLexer(RegexLexer):
18
+ """
19
+ Lexer for Roboconf graph files.
20
+ """
21
+ name = 'Roboconf Graph'
22
+ aliases = ['roboconf-graph']
23
+ filenames = ['*.graph']
24
+ url = 'https://roboconf.github.io/en/user-guide/graph-definition.html'
25
+ version_added = '2.1'
26
+
27
+ flags = re.IGNORECASE | re.MULTILINE
28
+ tokens = {
29
+ 'root': [
30
+ # Skip white spaces
31
+ (r'\s+', Text),
32
+
33
+ # There is one operator
34
+ (r'=', Operator),
35
+
36
+ # Keywords
37
+ (words(('facet', 'import'), suffix=r'\s*\b', prefix=r'\b'), Keyword),
38
+ (words((
39
+ 'installer', 'extends', 'exports', 'imports', 'facets',
40
+ 'children'), suffix=r'\s*:?', prefix=r'\b'), Name),
41
+
42
+ # Comments
43
+ (r'#.*\n', Comment),
44
+
45
+ # Default
46
+ (r'[^#]', Text),
47
+ (r'.*\n', Text)
48
+ ]
49
+ }
50
+
51
+
52
+ class RoboconfInstancesLexer(RegexLexer):
53
+ """
54
+ Lexer for Roboconf instances files.
55
+ """
56
+ name = 'Roboconf Instances'
57
+ aliases = ['roboconf-instances']
58
+ filenames = ['*.instances']
59
+ url = 'https://roboconf.github.io'
60
+ version_added = '2.1'
61
+
62
+ flags = re.IGNORECASE | re.MULTILINE
63
+ tokens = {
64
+ 'root': [
65
+
66
+ # Skip white spaces
67
+ (r'\s+', Text),
68
+
69
+ # Keywords
70
+ (words(('instance of', 'import'), suffix=r'\s*\b', prefix=r'\b'), Keyword),
71
+ (words(('name', 'count'), suffix=r's*:?', prefix=r'\b'), Name),
72
+ (r'\s*[\w.-]+\s*:', Name),
73
+
74
+ # Comments
75
+ (r'#.*\n', Comment),
76
+
77
+ # Default
78
+ (r'[^#]', Text),
79
+ (r'.*\n', Text)
80
+ ]
81
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/robotframework.py ADDED
@@ -0,0 +1,551 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.robotframework
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Robot Framework.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ # Copyright 2012 Nokia Siemens Networks Oyj
12
+ #
13
+ # Licensed under the Apache License, Version 2.0 (the "License");
14
+ # you may not use this file except in compliance with the License.
15
+ # You may obtain a copy of the License at
16
+ #
17
+ # http://www.apache.org/licenses/LICENSE-2.0
18
+ #
19
+ # Unless required by applicable law or agreed to in writing, software
20
+ # distributed under the License is distributed on an "AS IS" BASIS,
21
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22
+ # See the License for the specific language governing permissions and
23
+ # limitations under the License.
24
+
25
+ import re
26
+
27
+ from pygments.lexer import Lexer
28
+ from pygments.token import Token
29
+
30
+ __all__ = ['RobotFrameworkLexer']
31
+
32
+
33
+ HEADING = Token.Generic.Heading
34
+ SETTING = Token.Keyword.Namespace
35
+ IMPORT = Token.Name.Namespace
36
+ TC_KW_NAME = Token.Generic.Subheading
37
+ KEYWORD = Token.Name.Function
38
+ ARGUMENT = Token.String
39
+ VARIABLE = Token.Name.Variable
40
+ COMMENT = Token.Comment
41
+ SEPARATOR = Token.Punctuation
42
+ SYNTAX = Token.Punctuation
43
+ GHERKIN = Token.Generic.Emph
44
+ ERROR = Token.Error
45
+
46
+
47
+ def normalize(string, remove=''):
48
+ string = string.lower()
49
+ for char in remove + ' ':
50
+ if char in string:
51
+ string = string.replace(char, '')
52
+ return string
53
+
54
+
55
+ class RobotFrameworkLexer(Lexer):
56
+ """
57
+ For Robot Framework test data.
58
+
59
+ Supports both space and pipe separated plain text formats.
60
+ """
61
+ name = 'RobotFramework'
62
+ url = 'http://robotframework.org'
63
+ aliases = ['robotframework']
64
+ filenames = ['*.robot', '*.resource']
65
+ mimetypes = ['text/x-robotframework']
66
+ version_added = '1.6'
67
+
68
+ def __init__(self, **options):
69
+ options['tabsize'] = 2
70
+ options['encoding'] = 'UTF-8'
71
+ Lexer.__init__(self, **options)
72
+
73
+ def get_tokens_unprocessed(self, text):
74
+ row_tokenizer = RowTokenizer()
75
+ var_tokenizer = VariableTokenizer()
76
+ index = 0
77
+ for row in text.splitlines():
78
+ for value, token in row_tokenizer.tokenize(row):
79
+ for value, token in var_tokenizer.tokenize(value, token):
80
+ if value:
81
+ yield index, token, str(value)
82
+ index += len(value)
83
+
84
+
85
+ class VariableTokenizer:
86
+
87
+ def tokenize(self, string, token):
88
+ var = VariableSplitter(string, identifiers='$@%&')
89
+ if var.start < 0 or token in (COMMENT, ERROR):
90
+ yield string, token
91
+ return
92
+ for value, token in self._tokenize(var, string, token):
93
+ if value:
94
+ yield value, token
95
+
96
+ def _tokenize(self, var, string, orig_token):
97
+ before = string[:var.start]
98
+ yield before, orig_token
99
+ yield var.identifier + '{', SYNTAX
100
+ yield from self.tokenize(var.base, VARIABLE)
101
+ yield '}', SYNTAX
102
+ if var.index is not None:
103
+ yield '[', SYNTAX
104
+ yield from self.tokenize(var.index, VARIABLE)
105
+ yield ']', SYNTAX
106
+ yield from self.tokenize(string[var.end:], orig_token)
107
+
108
+
109
+ class RowTokenizer:
110
+
111
+ def __init__(self):
112
+ self._table = UnknownTable()
113
+ self._splitter = RowSplitter()
114
+ testcases = TestCaseTable()
115
+ settings = SettingTable(testcases.set_default_template)
116
+ variables = VariableTable()
117
+ keywords = KeywordTable()
118
+ self._tables = {'settings': settings, 'setting': settings,
119
+ 'metadata': settings,
120
+ 'variables': variables, 'variable': variables,
121
+ 'testcases': testcases, 'testcase': testcases,
122
+ 'tasks': testcases, 'task': testcases,
123
+ 'keywords': keywords, 'keyword': keywords,
124
+ 'userkeywords': keywords, 'userkeyword': keywords}
125
+
126
+ def tokenize(self, row):
127
+ commented = False
128
+ heading = False
129
+ for index, value in enumerate(self._splitter.split(row)):
130
+ # First value, and every second after that, is a separator.
131
+ index, separator = divmod(index-1, 2)
132
+ if value.startswith('#'):
133
+ commented = True
134
+ elif index == 0 and value.startswith('*'):
135
+ self._table = self._start_table(value)
136
+ heading = True
137
+ yield from self._tokenize(value, index, commented,
138
+ separator, heading)
139
+ self._table.end_row()
140
+
141
+ def _start_table(self, header):
142
+ name = normalize(header, remove='*')
143
+ return self._tables.get(name, UnknownTable())
144
+
145
+ def _tokenize(self, value, index, commented, separator, heading):
146
+ if commented:
147
+ yield value, COMMENT
148
+ elif separator:
149
+ yield value, SEPARATOR
150
+ elif heading:
151
+ yield value, HEADING
152
+ else:
153
+ yield from self._table.tokenize(value, index)
154
+
155
+
156
+ class RowSplitter:
157
+ _space_splitter = re.compile('( {2,})')
158
+ _pipe_splitter = re.compile(r'((?:^| +)\|(?: +|$))')
159
+
160
+ def split(self, row):
161
+ splitter = (row.startswith('| ') and self._split_from_pipes
162
+ or self._split_from_spaces)
163
+ yield from splitter(row)
164
+ yield '\n'
165
+
166
+ def _split_from_spaces(self, row):
167
+ yield '' # Start with (pseudo)separator similarly as with pipes
168
+ yield from self._space_splitter.split(row)
169
+
170
+ def _split_from_pipes(self, row):
171
+ _, separator, rest = self._pipe_splitter.split(row, 1)
172
+ yield separator
173
+ while self._pipe_splitter.search(rest):
174
+ cell, separator, rest = self._pipe_splitter.split(rest, 1)
175
+ yield cell
176
+ yield separator
177
+ yield rest
178
+
179
+
180
+ class Tokenizer:
181
+ _tokens = None
182
+
183
+ def __init__(self):
184
+ self._index = 0
185
+
186
+ def tokenize(self, value):
187
+ values_and_tokens = self._tokenize(value, self._index)
188
+ self._index += 1
189
+ if isinstance(values_and_tokens, type(Token)):
190
+ values_and_tokens = [(value, values_and_tokens)]
191
+ return values_and_tokens
192
+
193
+ def _tokenize(self, value, index):
194
+ index = min(index, len(self._tokens) - 1)
195
+ return self._tokens[index]
196
+
197
+ def _is_assign(self, value):
198
+ if value.endswith('='):
199
+ value = value[:-1].strip()
200
+ var = VariableSplitter(value, identifiers='$@&')
201
+ return var.start == 0 and var.end == len(value)
202
+
203
+
204
+ class Comment(Tokenizer):
205
+ _tokens = (COMMENT,)
206
+
207
+
208
+ class Setting(Tokenizer):
209
+ _tokens = (SETTING, ARGUMENT)
210
+ _keyword_settings = ('suitesetup', 'suiteprecondition', 'suiteteardown',
211
+ 'suitepostcondition', 'testsetup', 'tasksetup', 'testprecondition',
212
+ 'testteardown','taskteardown', 'testpostcondition', 'testtemplate', 'tasktemplate')
213
+ _import_settings = ('library', 'resource', 'variables')
214
+ _other_settings = ('documentation', 'metadata', 'forcetags', 'defaulttags',
215
+ 'testtimeout','tasktimeout')
216
+ _custom_tokenizer = None
217
+
218
+ def __init__(self, template_setter=None):
219
+ Tokenizer.__init__(self)
220
+ self._template_setter = template_setter
221
+
222
+ def _tokenize(self, value, index):
223
+ if index == 1 and self._template_setter:
224
+ self._template_setter(value)
225
+ if index == 0:
226
+ normalized = normalize(value)
227
+ if normalized in self._keyword_settings:
228
+ self._custom_tokenizer = KeywordCall(support_assign=False)
229
+ elif normalized in self._import_settings:
230
+ self._custom_tokenizer = ImportSetting()
231
+ elif normalized not in self._other_settings:
232
+ return ERROR
233
+ elif self._custom_tokenizer:
234
+ return self._custom_tokenizer.tokenize(value)
235
+ return Tokenizer._tokenize(self, value, index)
236
+
237
+
238
+ class ImportSetting(Tokenizer):
239
+ _tokens = (IMPORT, ARGUMENT)
240
+
241
+
242
+ class TestCaseSetting(Setting):
243
+ _keyword_settings = ('setup', 'precondition', 'teardown', 'postcondition',
244
+ 'template')
245
+ _import_settings = ()
246
+ _other_settings = ('documentation', 'tags', 'timeout')
247
+
248
+ def _tokenize(self, value, index):
249
+ if index == 0:
250
+ type = Setting._tokenize(self, value[1:-1], index)
251
+ return [('[', SYNTAX), (value[1:-1], type), (']', SYNTAX)]
252
+ return Setting._tokenize(self, value, index)
253
+
254
+
255
+ class KeywordSetting(TestCaseSetting):
256
+ _keyword_settings = ('teardown',)
257
+ _other_settings = ('documentation', 'arguments', 'return', 'timeout', 'tags')
258
+
259
+
260
+ class Variable(Tokenizer):
261
+ _tokens = (SYNTAX, ARGUMENT)
262
+
263
+ def _tokenize(self, value, index):
264
+ if index == 0 and not self._is_assign(value):
265
+ return ERROR
266
+ return Tokenizer._tokenize(self, value, index)
267
+
268
+
269
+ class KeywordCall(Tokenizer):
270
+ _tokens = (KEYWORD, ARGUMENT)
271
+
272
+ def __init__(self, support_assign=True):
273
+ Tokenizer.__init__(self)
274
+ self._keyword_found = not support_assign
275
+ self._assigns = 0
276
+
277
+ def _tokenize(self, value, index):
278
+ if not self._keyword_found and self._is_assign(value):
279
+ self._assigns += 1
280
+ return SYNTAX # VariableTokenizer tokenizes this later.
281
+ if self._keyword_found:
282
+ return Tokenizer._tokenize(self, value, index - self._assigns)
283
+ self._keyword_found = True
284
+ return GherkinTokenizer().tokenize(value, KEYWORD)
285
+
286
+
287
+ class GherkinTokenizer:
288
+ _gherkin_prefix = re.compile('^(Given|When|Then|And|But) ', re.IGNORECASE)
289
+
290
+ def tokenize(self, value, token):
291
+ match = self._gherkin_prefix.match(value)
292
+ if not match:
293
+ return [(value, token)]
294
+ end = match.end()
295
+ return [(value[:end], GHERKIN), (value[end:], token)]
296
+
297
+
298
+ class TemplatedKeywordCall(Tokenizer):
299
+ _tokens = (ARGUMENT,)
300
+
301
+
302
+ class ForLoop(Tokenizer):
303
+
304
+ def __init__(self):
305
+ Tokenizer.__init__(self)
306
+ self._in_arguments = False
307
+
308
+ def _tokenize(self, value, index):
309
+ token = self._in_arguments and ARGUMENT or SYNTAX
310
+ if value.upper() in ('IN', 'IN RANGE'):
311
+ self._in_arguments = True
312
+ return token
313
+
314
+
315
+ class _Table:
316
+ _tokenizer_class = None
317
+
318
+ def __init__(self, prev_tokenizer=None):
319
+ self._tokenizer = self._tokenizer_class()
320
+ self._prev_tokenizer = prev_tokenizer
321
+ self._prev_values_on_row = []
322
+
323
+ def tokenize(self, value, index):
324
+ if self._continues(value, index):
325
+ self._tokenizer = self._prev_tokenizer
326
+ yield value, SYNTAX
327
+ else:
328
+ yield from self._tokenize(value, index)
329
+ self._prev_values_on_row.append(value)
330
+
331
+ def _continues(self, value, index):
332
+ return value == '...' and all(self._is_empty(t)
333
+ for t in self._prev_values_on_row)
334
+
335
+ def _is_empty(self, value):
336
+ return value in ('', '\\')
337
+
338
+ def _tokenize(self, value, index):
339
+ return self._tokenizer.tokenize(value)
340
+
341
+ def end_row(self):
342
+ self.__init__(prev_tokenizer=self._tokenizer)
343
+
344
+
345
+ class UnknownTable(_Table):
346
+ _tokenizer_class = Comment
347
+
348
+ def _continues(self, value, index):
349
+ return False
350
+
351
+
352
+ class VariableTable(_Table):
353
+ _tokenizer_class = Variable
354
+
355
+
356
+ class SettingTable(_Table):
357
+ _tokenizer_class = Setting
358
+
359
+ def __init__(self, template_setter, prev_tokenizer=None):
360
+ _Table.__init__(self, prev_tokenizer)
361
+ self._template_setter = template_setter
362
+
363
+ def _tokenize(self, value, index):
364
+ if index == 0 and normalize(value) == 'testtemplate':
365
+ self._tokenizer = Setting(self._template_setter)
366
+ return _Table._tokenize(self, value, index)
367
+
368
+ def end_row(self):
369
+ self.__init__(self._template_setter, prev_tokenizer=self._tokenizer)
370
+
371
+
372
+ class TestCaseTable(_Table):
373
+ _setting_class = TestCaseSetting
374
+ _test_template = None
375
+ _default_template = None
376
+
377
+ @property
378
+ def _tokenizer_class(self):
379
+ if self._test_template or (self._default_template and
380
+ self._test_template is not False):
381
+ return TemplatedKeywordCall
382
+ return KeywordCall
383
+
384
+ def _continues(self, value, index):
385
+ return index > 0 and _Table._continues(self, value, index)
386
+
387
+ def _tokenize(self, value, index):
388
+ if index == 0:
389
+ if value:
390
+ self._test_template = None
391
+ return GherkinTokenizer().tokenize(value, TC_KW_NAME)
392
+ if index == 1 and self._is_setting(value):
393
+ if self._is_template(value):
394
+ self._test_template = False
395
+ self._tokenizer = self._setting_class(self.set_test_template)
396
+ else:
397
+ self._tokenizer = self._setting_class()
398
+ if index == 1 and self._is_for_loop(value):
399
+ self._tokenizer = ForLoop()
400
+ if index == 1 and self._is_empty(value):
401
+ return [(value, SYNTAX)]
402
+ return _Table._tokenize(self, value, index)
403
+
404
+ def _is_setting(self, value):
405
+ return value.startswith('[') and value.endswith(']')
406
+
407
+ def _is_template(self, value):
408
+ return normalize(value) == '[template]'
409
+
410
+ def _is_for_loop(self, value):
411
+ return value.startswith(':') and normalize(value, remove=':') == 'for'
412
+
413
+ def set_test_template(self, template):
414
+ self._test_template = self._is_template_set(template)
415
+
416
+ def set_default_template(self, template):
417
+ self._default_template = self._is_template_set(template)
418
+
419
+ def _is_template_set(self, template):
420
+ return normalize(template) not in ('', '\\', 'none', '${empty}')
421
+
422
+
423
+ class KeywordTable(TestCaseTable):
424
+ _tokenizer_class = KeywordCall
425
+ _setting_class = KeywordSetting
426
+
427
+ def _is_template(self, value):
428
+ return False
429
+
430
+
431
+ # Following code copied directly from Robot Framework 2.7.5.
432
+
433
+ class VariableSplitter:
434
+
435
+ def __init__(self, string, identifiers):
436
+ self.identifier = None
437
+ self.base = None
438
+ self.index = None
439
+ self.start = -1
440
+ self.end = -1
441
+ self._identifiers = identifiers
442
+ self._may_have_internal_variables = False
443
+ try:
444
+ self._split(string)
445
+ except ValueError:
446
+ pass
447
+ else:
448
+ self._finalize()
449
+
450
+ def get_replaced_base(self, variables):
451
+ if self._may_have_internal_variables:
452
+ return variables.replace_string(self.base)
453
+ return self.base
454
+
455
+ def _finalize(self):
456
+ self.identifier = self._variable_chars[0]
457
+ self.base = ''.join(self._variable_chars[2:-1])
458
+ self.end = self.start + len(self._variable_chars)
459
+ if self._has_list_or_dict_variable_index():
460
+ self.index = ''.join(self._list_and_dict_variable_index_chars[1:-1])
461
+ self.end += len(self._list_and_dict_variable_index_chars)
462
+
463
+ def _has_list_or_dict_variable_index(self):
464
+ return self._list_and_dict_variable_index_chars\
465
+ and self._list_and_dict_variable_index_chars[-1] == ']'
466
+
467
+ def _split(self, string):
468
+ start_index, max_index = self._find_variable(string)
469
+ self.start = start_index
470
+ self._open_curly = 1
471
+ self._state = self._variable_state
472
+ self._variable_chars = [string[start_index], '{']
473
+ self._list_and_dict_variable_index_chars = []
474
+ self._string = string
475
+ start_index += 2
476
+ for index, char in enumerate(string[start_index:]):
477
+ index += start_index # Giving start to enumerate only in Py 2.6+
478
+ try:
479
+ self._state(char, index)
480
+ except StopIteration:
481
+ return
482
+ if index == max_index and not self._scanning_list_variable_index():
483
+ return
484
+
485
+ def _scanning_list_variable_index(self):
486
+ return self._state in [self._waiting_list_variable_index_state,
487
+ self._list_variable_index_state]
488
+
489
+ def _find_variable(self, string):
490
+ max_end_index = string.rfind('}')
491
+ if max_end_index == -1:
492
+ raise ValueError('No variable end found')
493
+ if self._is_escaped(string, max_end_index):
494
+ return self._find_variable(string[:max_end_index])
495
+ start_index = self._find_start_index(string, 1, max_end_index)
496
+ if start_index == -1:
497
+ raise ValueError('No variable start found')
498
+ return start_index, max_end_index
499
+
500
+ def _find_start_index(self, string, start, end):
501
+ index = string.find('{', start, end) - 1
502
+ if index < 0:
503
+ return -1
504
+ if self._start_index_is_ok(string, index):
505
+ return index
506
+ return self._find_start_index(string, index+2, end)
507
+
508
+ def _start_index_is_ok(self, string, index):
509
+ return string[index] in self._identifiers\
510
+ and not self._is_escaped(string, index)
511
+
512
+ def _is_escaped(self, string, index):
513
+ escaped = False
514
+ while index > 0 and string[index-1] == '\\':
515
+ index -= 1
516
+ escaped = not escaped
517
+ return escaped
518
+
519
+ def _variable_state(self, char, index):
520
+ self._variable_chars.append(char)
521
+ if char == '}' and not self._is_escaped(self._string, index):
522
+ self._open_curly -= 1
523
+ if self._open_curly == 0:
524
+ if not self._is_list_or_dict_variable():
525
+ raise StopIteration
526
+ self._state = self._waiting_list_variable_index_state
527
+ elif char in self._identifiers:
528
+ self._state = self._internal_variable_start_state
529
+
530
+ def _is_list_or_dict_variable(self):
531
+ return self._variable_chars[0] in ('@','&')
532
+
533
+ def _internal_variable_start_state(self, char, index):
534
+ self._state = self._variable_state
535
+ if char == '{':
536
+ self._variable_chars.append(char)
537
+ self._open_curly += 1
538
+ self._may_have_internal_variables = True
539
+ else:
540
+ self._variable_state(char, index)
541
+
542
+ def _waiting_list_variable_index_state(self, char, index):
543
+ if char != '[':
544
+ raise StopIteration
545
+ self._list_and_dict_variable_index_chars.append(char)
546
+ self._state = self._list_variable_index_state
547
+
548
+ def _list_variable_index_state(self, char, index):
549
+ self._list_and_dict_variable_index_chars.append(char)
550
+ if char == ']':
551
+ raise StopIteration
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/ruby.py ADDED
@@ -0,0 +1,518 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.ruby
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Ruby 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, ExtendedRegexLexer, include, \
14
+ bygroups, default, LexerContext, do_insertions, words, line_re
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Error, Generic, Whitespace
17
+ from pygments.util import shebang_matches
18
+
19
+ __all__ = ['RubyLexer', 'RubyConsoleLexer', 'FancyLexer']
20
+
21
+
22
+ RUBY_OPERATORS = (
23
+ '*', '**', '-', '+', '-@', '+@', '/', '%', '&', '|', '^', '`', '~',
24
+ '[]', '[]=', '<<', '>>', '<', '<>', '<=>', '>', '>=', '==', '==='
25
+ )
26
+
27
+
28
+ class RubyLexer(ExtendedRegexLexer):
29
+ """
30
+ For Ruby source code.
31
+ """
32
+
33
+ name = 'Ruby'
34
+ url = 'http://www.ruby-lang.org'
35
+ aliases = ['ruby', 'rb', 'duby']
36
+ filenames = ['*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec',
37
+ '*.rbx', '*.duby', 'Gemfile', 'Vagrantfile']
38
+ mimetypes = ['text/x-ruby', 'application/x-ruby']
39
+ version_added = ''
40
+
41
+ flags = re.DOTALL | re.MULTILINE
42
+
43
+ def heredoc_callback(self, match, ctx):
44
+ # okay, this is the hardest part of parsing Ruby...
45
+ # match: 1 = <<[-~]?, 2 = quote? 3 = name 4 = quote? 5 = rest of line
46
+
47
+ start = match.start(1)
48
+ yield start, Operator, match.group(1) # <<[-~]?
49
+ yield match.start(2), String.Heredoc, match.group(2) # quote ", ', `
50
+ yield match.start(3), String.Delimiter, match.group(3) # heredoc name
51
+ yield match.start(4), String.Heredoc, match.group(4) # quote again
52
+
53
+ heredocstack = ctx.__dict__.setdefault('heredocstack', [])
54
+ outermost = not bool(heredocstack)
55
+ heredocstack.append((match.group(1) in ('<<-', '<<~'), match.group(3)))
56
+
57
+ ctx.pos = match.start(5)
58
+ ctx.end = match.end(5)
59
+ # this may find other heredocs, so limit the recursion depth
60
+ if len(heredocstack) < 100:
61
+ yield from self.get_tokens_unprocessed(context=ctx)
62
+ else:
63
+ yield ctx.pos, String.Heredoc, match.group(5)
64
+ ctx.pos = match.end()
65
+
66
+ if outermost:
67
+ # this is the outer heredoc again, now we can process them all
68
+ for tolerant, hdname in heredocstack:
69
+ lines = []
70
+ for match in line_re.finditer(ctx.text, ctx.pos):
71
+ if tolerant:
72
+ check = match.group().strip()
73
+ else:
74
+ check = match.group().rstrip()
75
+ if check == hdname:
76
+ for amatch in lines:
77
+ yield amatch.start(), String.Heredoc, amatch.group()
78
+ yield match.start(), String.Delimiter, match.group()
79
+ ctx.pos = match.end()
80
+ break
81
+ else:
82
+ lines.append(match)
83
+ else:
84
+ # end of heredoc not found -- error!
85
+ for amatch in lines:
86
+ yield amatch.start(), Error, amatch.group()
87
+ ctx.end = len(ctx.text)
88
+ del heredocstack[:]
89
+
90
+ def gen_rubystrings_rules():
91
+ def intp_regex_callback(self, match, ctx):
92
+ yield match.start(1), String.Regex, match.group(1) # begin
93
+ nctx = LexerContext(match.group(3), 0, ['interpolated-regex'])
94
+ for i, t, v in self.get_tokens_unprocessed(context=nctx):
95
+ yield match.start(3)+i, t, v
96
+ yield match.start(4), String.Regex, match.group(4) # end[mixounse]*
97
+ ctx.pos = match.end()
98
+
99
+ def intp_string_callback(self, match, ctx):
100
+ yield match.start(1), String.Other, match.group(1)
101
+ nctx = LexerContext(match.group(3), 0, ['interpolated-string'])
102
+ for i, t, v in self.get_tokens_unprocessed(context=nctx):
103
+ yield match.start(3)+i, t, v
104
+ yield match.start(4), String.Other, match.group(4) # end
105
+ ctx.pos = match.end()
106
+
107
+ states = {}
108
+ states['strings'] = [
109
+ # easy ones
110
+ (r'\:@{0,2}[a-zA-Z_]\w*[!?]?', String.Symbol),
111
+ (words(RUBY_OPERATORS, prefix=r'\:@{0,2}'), String.Symbol),
112
+ (r":'(\\\\|\\[^\\]|[^'\\])*'", String.Symbol),
113
+ (r':"', String.Symbol, 'simple-sym'),
114
+ (r'([a-zA-Z_]\w*)(:)(?!:)',
115
+ bygroups(String.Symbol, Punctuation)), # Since Ruby 1.9
116
+ (r'"', String.Double, 'simple-string-double'),
117
+ (r"'", String.Single, 'simple-string-single'),
118
+ (r'(?<!\.)`', String.Backtick, 'simple-backtick'),
119
+ ]
120
+
121
+ # quoted string and symbol
122
+ for name, ttype, end in ('string-double', String.Double, '"'), \
123
+ ('string-single', String.Single, "'"),\
124
+ ('sym', String.Symbol, '"'), \
125
+ ('backtick', String.Backtick, '`'):
126
+ states['simple-'+name] = [
127
+ include('string-intp-escaped'),
128
+ (rf'[^\\{end}#]+', ttype),
129
+ (r'[\\#]', ttype),
130
+ (end, ttype, '#pop'),
131
+ ]
132
+
133
+ # braced quoted strings
134
+ for lbrace, rbrace, bracecc, name in \
135
+ ('\\{', '\\}', '{}', 'cb'), \
136
+ ('\\[', '\\]', '\\[\\]', 'sb'), \
137
+ ('\\(', '\\)', '()', 'pa'), \
138
+ ('<', '>', '<>', 'ab'):
139
+ states[name+'-intp-string'] = [
140
+ (r'\\[\\' + bracecc + ']', String.Other),
141
+ (lbrace, String.Other, '#push'),
142
+ (rbrace, String.Other, '#pop'),
143
+ include('string-intp-escaped'),
144
+ (r'[\\#' + bracecc + ']', String.Other),
145
+ (r'[^\\#' + bracecc + ']+', String.Other),
146
+ ]
147
+ states['strings'].append((r'%[QWx]?' + lbrace, String.Other,
148
+ name+'-intp-string'))
149
+ states[name+'-string'] = [
150
+ (r'\\[\\' + bracecc + ']', String.Other),
151
+ (lbrace, String.Other, '#push'),
152
+ (rbrace, String.Other, '#pop'),
153
+ (r'[\\#' + bracecc + ']', String.Other),
154
+ (r'[^\\#' + bracecc + ']+', String.Other),
155
+ ]
156
+ states['strings'].append((r'%[qsw]' + lbrace, String.Other,
157
+ name+'-string'))
158
+ states[name+'-regex'] = [
159
+ (r'\\[\\' + bracecc + ']', String.Regex),
160
+ (lbrace, String.Regex, '#push'),
161
+ (rbrace + '[mixounse]*', String.Regex, '#pop'),
162
+ include('string-intp'),
163
+ (r'[\\#' + bracecc + ']', String.Regex),
164
+ (r'[^\\#' + bracecc + ']+', String.Regex),
165
+ ]
166
+ states['strings'].append((r'%r' + lbrace, String.Regex,
167
+ name+'-regex'))
168
+
169
+ # these must come after %<brace>!
170
+ states['strings'] += [
171
+ # %r regex
172
+ (r'(%r([\W_]))((?:\\\2|(?!\2).)*)(\2[mixounse]*)',
173
+ intp_regex_callback),
174
+ # regular fancy strings with qsw
175
+ (r'%[qsw]([\W_])((?:\\\1|(?!\1).)*)\1', String.Other),
176
+ (r'(%[QWx]([\W_]))((?:\\\2|(?!\2).)*)(\2)',
177
+ intp_string_callback),
178
+ # special forms of fancy strings after operators or
179
+ # in method calls with braces
180
+ (r'(?<=[-+/*%=<>&!^|~,(])(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)',
181
+ bygroups(Whitespace, String.Other, None)),
182
+ # and because of fixed width lookbehinds the whole thing a
183
+ # second time for line startings...
184
+ (r'^(\s*)(%([\t ])(?:(?:\\\3|(?!\3).)*)\3)',
185
+ bygroups(Whitespace, String.Other, None)),
186
+ # all regular fancy strings without qsw
187
+ (r'(%([^a-zA-Z0-9\s]))((?:\\\2|(?!\2).)*)(\2)',
188
+ intp_string_callback),
189
+ ]
190
+
191
+ return states
192
+
193
+ tokens = {
194
+ 'root': [
195
+ (r'\A#!.+?$', Comment.Hashbang),
196
+ (r'#.*?$', Comment.Single),
197
+ (r'=begin\s.*?\n=end.*?$', Comment.Multiline),
198
+ # keywords
199
+ (words((
200
+ 'BEGIN', 'END', 'alias', 'begin', 'break', 'case', 'defined?',
201
+ 'do', 'else', 'elsif', 'end', 'ensure', 'for', 'if', 'in', 'next', 'redo',
202
+ 'rescue', 'raise', 'retry', 'return', 'super', 'then', 'undef',
203
+ 'unless', 'until', 'when', 'while', 'yield'), suffix=r'\b'),
204
+ Keyword),
205
+ # start of function, class and module names
206
+ (r'(module)(\s+)([a-zA-Z_]\w*'
207
+ r'(?:::[a-zA-Z_]\w*)*)',
208
+ bygroups(Keyword, Whitespace, Name.Namespace)),
209
+ (r'(def)(\s+)', bygroups(Keyword, Whitespace), 'funcname'),
210
+ (r'def(?=[*%&^`~+-/\[<>=])', Keyword, 'funcname'),
211
+ (r'(class)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
212
+ # special methods
213
+ (words((
214
+ 'initialize', 'new', 'loop', 'include', 'extend', 'raise', 'attr_reader',
215
+ 'attr_writer', 'attr_accessor', 'attr', 'catch', 'throw', 'private',
216
+ 'module_function', 'public', 'protected', 'true', 'false', 'nil'),
217
+ suffix=r'\b'),
218
+ Keyword.Pseudo),
219
+ (r'(not|and|or)\b', Operator.Word),
220
+ (words((
221
+ 'autoload', 'block_given', 'const_defined', 'eql', 'equal', 'frozen', 'include',
222
+ 'instance_of', 'is_a', 'iterator', 'kind_of', 'method_defined', 'nil',
223
+ 'private_method_defined', 'protected_method_defined',
224
+ 'public_method_defined', 'respond_to', 'tainted'), suffix=r'\?'),
225
+ Name.Builtin),
226
+ (r'(chomp|chop|exit|gsub|sub)!', Name.Builtin),
227
+ (words((
228
+ 'Array', 'Float', 'Integer', 'String', '__id__', '__send__', 'abort',
229
+ 'ancestors', 'at_exit', 'autoload', 'binding', 'callcc', 'caller',
230
+ 'catch', 'chomp', 'chop', 'class_eval', 'class_variables',
231
+ 'clone', 'const_defined?', 'const_get', 'const_missing', 'const_set',
232
+ 'constants', 'display', 'dup', 'eval', 'exec', 'exit', 'extend', 'fail', 'fork',
233
+ 'format', 'freeze', 'getc', 'gets', 'global_variables', 'gsub',
234
+ 'hash', 'id', 'included_modules', 'inspect', 'instance_eval',
235
+ 'instance_method', 'instance_methods',
236
+ 'instance_variable_get', 'instance_variable_set', 'instance_variables',
237
+ 'lambda', 'load', 'local_variables', 'loop',
238
+ 'method', 'method_missing', 'methods', 'module_eval', 'name',
239
+ 'object_id', 'open', 'p', 'print', 'printf', 'private_class_method',
240
+ 'private_instance_methods',
241
+ 'private_methods', 'proc', 'protected_instance_methods',
242
+ 'protected_methods', 'public_class_method',
243
+ 'public_instance_methods', 'public_methods',
244
+ 'putc', 'puts', 'raise', 'rand', 'readline', 'readlines', 'require',
245
+ 'scan', 'select', 'self', 'send', 'set_trace_func', 'singleton_methods', 'sleep',
246
+ 'split', 'sprintf', 'srand', 'sub', 'syscall', 'system', 'taint',
247
+ 'test', 'throw', 'to_a', 'to_s', 'trace_var', 'trap', 'untaint',
248
+ 'untrace_var', 'warn'), prefix=r'(?<!\.)', suffix=r'\b'),
249
+ Name.Builtin),
250
+ (r'__(FILE|LINE)__\b', Name.Builtin.Pseudo),
251
+ # normal heredocs
252
+ (r'(?<!\w)(<<[-~]?)(["`\']?)([a-zA-Z_]\w*)(\2)(.*?\n)',
253
+ heredoc_callback),
254
+ # empty string heredocs
255
+ (r'(<<[-~]?)("|\')()(\2)(.*?\n)', heredoc_callback),
256
+ (r'__END__', Comment.Preproc, 'end-part'),
257
+ # multiline regex (after keywords or assignments)
258
+ (r'(?:^|(?<=[=<>~!:])|'
259
+ r'(?<=(?:\s|;)when\s)|'
260
+ r'(?<=(?:\s|;)or\s)|'
261
+ r'(?<=(?:\s|;)and\s)|'
262
+ r'(?<=\.index\s)|'
263
+ r'(?<=\.scan\s)|'
264
+ r'(?<=\.sub\s)|'
265
+ r'(?<=\.sub!\s)|'
266
+ r'(?<=\.gsub\s)|'
267
+ r'(?<=\.gsub!\s)|'
268
+ r'(?<=\.match\s)|'
269
+ r'(?<=(?:\s|;)if\s)|'
270
+ r'(?<=(?:\s|;)elsif\s)|'
271
+ r'(?<=^when\s)|'
272
+ r'(?<=^index\s)|'
273
+ r'(?<=^scan\s)|'
274
+ r'(?<=^sub\s)|'
275
+ r'(?<=^gsub\s)|'
276
+ r'(?<=^sub!\s)|'
277
+ r'(?<=^gsub!\s)|'
278
+ r'(?<=^match\s)|'
279
+ r'(?<=^if\s)|'
280
+ r'(?<=^elsif\s)'
281
+ r')(\s*)(/)', bygroups(Text, String.Regex), 'multiline-regex'),
282
+ # multiline regex (in method calls or subscripts)
283
+ (r'(?<=\(|,|\[)/', String.Regex, 'multiline-regex'),
284
+ # multiline regex (this time the funny no whitespace rule)
285
+ (r'(\s+)(/)(?![\s=])', bygroups(Whitespace, String.Regex),
286
+ 'multiline-regex'),
287
+ # lex numbers and ignore following regular expressions which
288
+ # are division operators in fact (grrrr. i hate that. any
289
+ # better ideas?)
290
+ # since pygments 0.7 we also eat a "?" operator after numbers
291
+ # so that the char operator does not work. Chars are not allowed
292
+ # there so that you can use the ternary operator.
293
+ # stupid example:
294
+ # x>=0?n[x]:""
295
+ (r'(0_?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?',
296
+ bygroups(Number.Oct, Whitespace, Operator)),
297
+ (r'(0x[0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?',
298
+ bygroups(Number.Hex, Whitespace, Operator)),
299
+ (r'(0b[01]+(?:_[01]+)*)(\s*)([/?])?',
300
+ bygroups(Number.Bin, Whitespace, Operator)),
301
+ (r'([\d]+(?:_\d+)*)(\s*)([/?])?',
302
+ bygroups(Number.Integer, Whitespace, Operator)),
303
+ # Names
304
+ (r'@@[a-zA-Z_]\w*', Name.Variable.Class),
305
+ (r'@[a-zA-Z_]\w*', Name.Variable.Instance),
306
+ (r'\$\w+', Name.Variable.Global),
307
+ (r'\$[!@&`\'+~=/\\,;.<>_*$?:"^-]', Name.Variable.Global),
308
+ (r'\$-[0adFiIlpvw]', Name.Variable.Global),
309
+ (r'::', Operator),
310
+ include('strings'),
311
+ # chars
312
+ (r'\?(\\[MC]-)*' # modifiers
313
+ r'(\\([\\abefnrstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})|\S)'
314
+ r'(?!\w)',
315
+ String.Char),
316
+ (r'[A-Z]\w+', Name.Constant),
317
+ # this is needed because ruby attributes can look
318
+ # like keywords (class) or like this: ` ?!?
319
+ (words(RUBY_OPERATORS, prefix=r'(\.|::)'),
320
+ bygroups(Operator, Name.Operator)),
321
+ (r'(\.|::)([a-zA-Z_]\w*[!?]?|[*%&^`~+\-/\[<>=])',
322
+ bygroups(Operator, Name)),
323
+ (r'[a-zA-Z_]\w*[!?]?', Name),
324
+ (r'(\[|\]|\*\*|<<?|>>?|>=|<=|<=>|=~|={3}|'
325
+ r'!~|&&?|\|\||\.{1,3})', Operator),
326
+ (r'[-+/*%=<>&!^|~]=?', Operator),
327
+ (r'[(){};,/?:\\]', Punctuation),
328
+ (r'\s+', Whitespace)
329
+ ],
330
+ 'funcname': [
331
+ (r'\(', Punctuation, 'defexpr'),
332
+ (r'(?:([a-zA-Z_]\w*)(\.))?' # optional scope name, like "self."
333
+ r'('
334
+ r'[a-zA-Z\u0080-\uffff][a-zA-Z0-9_\u0080-\uffff]*[!?=]?' # method name
335
+ r'|!=|!~|=~|\*\*?|[-+!~]@?|[/%&|^]|<=>|<[<=]?|>[>=]?|===?' # or operator override
336
+ r'|\[\]=?' # or element reference/assignment override
337
+ r'|`' # or the undocumented backtick override
338
+ r')',
339
+ bygroups(Name.Class, Operator, Name.Function), '#pop'),
340
+ default('#pop')
341
+ ],
342
+ 'classname': [
343
+ (r'\(', Punctuation, 'defexpr'),
344
+ (r'<<', Operator, '#pop'),
345
+ (r'[A-Z_]\w*', Name.Class, '#pop'),
346
+ default('#pop')
347
+ ],
348
+ 'defexpr': [
349
+ (r'(\))(\.|::)?', bygroups(Punctuation, Operator), '#pop'),
350
+ (r'\(', Operator, '#push'),
351
+ include('root')
352
+ ],
353
+ 'in-intp': [
354
+ (r'\{', String.Interpol, '#push'),
355
+ (r'\}', String.Interpol, '#pop'),
356
+ include('root'),
357
+ ],
358
+ 'string-intp': [
359
+ (r'#\{', String.Interpol, 'in-intp'),
360
+ (r'#@@?[a-zA-Z_]\w*', String.Interpol),
361
+ (r'#\$[a-zA-Z_]\w*', String.Interpol)
362
+ ],
363
+ 'string-intp-escaped': [
364
+ include('string-intp'),
365
+ (r'\\([\\abefnrstv#"\']|x[a-fA-F0-9]{1,2}|[0-7]{1,3})',
366
+ String.Escape)
367
+ ],
368
+ 'interpolated-regex': [
369
+ include('string-intp'),
370
+ (r'[\\#]', String.Regex),
371
+ (r'[^\\#]+', String.Regex),
372
+ ],
373
+ 'interpolated-string': [
374
+ include('string-intp'),
375
+ (r'[\\#]', String.Other),
376
+ (r'[^\\#]+', String.Other),
377
+ ],
378
+ 'multiline-regex': [
379
+ include('string-intp'),
380
+ (r'\\\\', String.Regex),
381
+ (r'\\/', String.Regex),
382
+ (r'[\\#]', String.Regex),
383
+ (r'[^\\/#]+', String.Regex),
384
+ (r'/[mixounse]*', String.Regex, '#pop'),
385
+ ],
386
+ 'end-part': [
387
+ (r'.+', Comment.Preproc, '#pop')
388
+ ]
389
+ }
390
+ tokens.update(gen_rubystrings_rules())
391
+
392
+ def analyse_text(text):
393
+ return shebang_matches(text, r'ruby(1\.\d)?')
394
+
395
+
396
+ class RubyConsoleLexer(Lexer):
397
+ """
398
+ For Ruby interactive console (**irb**) output.
399
+ """
400
+ name = 'Ruby irb session'
401
+ aliases = ['rbcon', 'irb']
402
+ mimetypes = ['text/x-ruby-shellsession']
403
+ url = 'https://www.ruby-lang.org'
404
+ version_added = ''
405
+ _example = 'rbcon/console'
406
+
407
+ _prompt_re = re.compile(r'irb\([a-zA-Z_]\w*\):\d{3}:\d+[>*"\'] '
408
+ r'|>> |\?> ')
409
+
410
+ def get_tokens_unprocessed(self, text):
411
+ rblexer = RubyLexer(**self.options)
412
+
413
+ curcode = ''
414
+ insertions = []
415
+ for match in line_re.finditer(text):
416
+ line = match.group()
417
+ m = self._prompt_re.match(line)
418
+ if m is not None:
419
+ end = m.end()
420
+ insertions.append((len(curcode),
421
+ [(0, Generic.Prompt, line[:end])]))
422
+ curcode += line[end:]
423
+ else:
424
+ if curcode:
425
+ yield from do_insertions(
426
+ insertions, rblexer.get_tokens_unprocessed(curcode))
427
+ curcode = ''
428
+ insertions = []
429
+ yield match.start(), Generic.Output, line
430
+ if curcode:
431
+ yield from do_insertions(
432
+ insertions, rblexer.get_tokens_unprocessed(curcode))
433
+
434
+
435
+ class FancyLexer(RegexLexer):
436
+ """
437
+ Pygments Lexer For Fancy.
438
+
439
+ Fancy is a self-hosted, pure object-oriented, dynamic,
440
+ class-based, concurrent general-purpose programming language
441
+ running on Rubinius, the Ruby VM.
442
+ """
443
+ name = 'Fancy'
444
+ url = 'https://github.com/bakkdoor/fancy'
445
+ filenames = ['*.fy', '*.fancypack']
446
+ aliases = ['fancy', 'fy']
447
+ mimetypes = ['text/x-fancysrc']
448
+ version_added = '1.5'
449
+
450
+ tokens = {
451
+ # copied from PerlLexer:
452
+ 'balanced-regex': [
453
+ (r'/(\\\\|\\[^\\]|[^/\\])*/[egimosx]*', String.Regex, '#pop'),
454
+ (r'!(\\\\|\\[^\\]|[^!\\])*![egimosx]*', String.Regex, '#pop'),
455
+ (r'\\(\\\\|[^\\])*\\[egimosx]*', String.Regex, '#pop'),
456
+ (r'\{(\\\\|\\[^\\]|[^}\\])*\}[egimosx]*', String.Regex, '#pop'),
457
+ (r'<(\\\\|\\[^\\]|[^>\\])*>[egimosx]*', String.Regex, '#pop'),
458
+ (r'\[(\\\\|\\[^\\]|[^\]\\])*\][egimosx]*', String.Regex, '#pop'),
459
+ (r'\((\\\\|\\[^\\]|[^)\\])*\)[egimosx]*', String.Regex, '#pop'),
460
+ (r'@(\\\\|\\[^\\]|[^@\\])*@[egimosx]*', String.Regex, '#pop'),
461
+ (r'%(\\\\|\\[^\\]|[^%\\])*%[egimosx]*', String.Regex, '#pop'),
462
+ (r'\$(\\\\|\\[^\\]|[^$\\])*\$[egimosx]*', String.Regex, '#pop'),
463
+ ],
464
+ 'root': [
465
+ (r'\s+', Whitespace),
466
+
467
+ # balanced delimiters (copied from PerlLexer):
468
+ (r's\{(\\\\|\\[^\\]|[^}\\])*\}\s*', String.Regex, 'balanced-regex'),
469
+ (r's<(\\\\|\\[^\\]|[^>\\])*>\s*', String.Regex, 'balanced-regex'),
470
+ (r's\[(\\\\|\\[^\\]|[^\]\\])*\]\s*', String.Regex, 'balanced-regex'),
471
+ (r's\((\\\\|\\[^\\]|[^)\\])*\)\s*', String.Regex, 'balanced-regex'),
472
+ (r'm?/(\\\\|\\[^\\]|[^///\n])*/[gcimosx]*', String.Regex),
473
+ (r'm(?=[/!\\{<\[(@%$])', String.Regex, 'balanced-regex'),
474
+
475
+ # Comments
476
+ (r'#(.*?)\n', Comment.Single),
477
+ # Symbols
478
+ (r'\'([^\'\s\[\](){}]+|\[\])', String.Symbol),
479
+ # Multi-line DoubleQuotedString
480
+ (r'"""(\\\\|\\[^\\]|[^\\])*?"""', String),
481
+ # DoubleQuotedString
482
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
483
+ # keywords
484
+ (r'(def|class|try|catch|finally|retry|return|return_local|match|'
485
+ r'case|->|=>)\b', Keyword),
486
+ # constants
487
+ (r'(self|super|nil|false|true)\b', Name.Constant),
488
+ (r'[(){};,/?|:\\]', Punctuation),
489
+ # names
490
+ (words((
491
+ 'Object', 'Array', 'Hash', 'Directory', 'File', 'Class', 'String',
492
+ 'Number', 'Enumerable', 'FancyEnumerable', 'Block', 'TrueClass',
493
+ 'NilClass', 'FalseClass', 'Tuple', 'Symbol', 'Stack', 'Set',
494
+ 'FancySpec', 'Method', 'Package', 'Range'), suffix=r'\b'),
495
+ Name.Builtin),
496
+ # functions
497
+ (r'[a-zA-Z](\w|[-+?!=*/^><%])*:', Name.Function),
498
+ # operators, must be below functions
499
+ (r'[-+*/~,<>=&!?%^\[\].$]+', Operator),
500
+ (r'[A-Z]\w*', Name.Constant),
501
+ (r'@[a-zA-Z_]\w*', Name.Variable.Instance),
502
+ (r'@@[a-zA-Z_]\w*', Name.Variable.Class),
503
+ ('@@?', Operator),
504
+ (r'[a-zA-Z_]\w*', Name),
505
+ # numbers - / checks are necessary to avoid mismarking regexes,
506
+ # see comment in RubyLexer
507
+ (r'(0[oO]?[0-7]+(?:_[0-7]+)*)(\s*)([/?])?',
508
+ bygroups(Number.Oct, Whitespace, Operator)),
509
+ (r'(0[xX][0-9A-Fa-f]+(?:_[0-9A-Fa-f]+)*)(\s*)([/?])?',
510
+ bygroups(Number.Hex, Whitespace, Operator)),
511
+ (r'(0[bB][01]+(?:_[01]+)*)(\s*)([/?])?',
512
+ bygroups(Number.Bin, Whitespace, Operator)),
513
+ (r'([\d]+(?:_\d+)*)(\s*)([/?])?',
514
+ bygroups(Number.Integer, Whitespace, Operator)),
515
+ (r'\d+([eE][+-]?[0-9]+)|\d+\.\d+([eE][+-]?[0-9]+)?', Number.Float),
516
+ (r'\d+', Number.Integer)
517
+ ]
518
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/rust.py ADDED
@@ -0,0 +1,222 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.rust
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Rust 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, bygroups, words, default
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation, Whitespace
14
+
15
+ __all__ = ['RustLexer']
16
+
17
+
18
+ class RustLexer(RegexLexer):
19
+ """
20
+ Lexer for the Rust programming language (version 1.47).
21
+ """
22
+ name = 'Rust'
23
+ url = 'https://www.rust-lang.org/'
24
+ filenames = ['*.rs', '*.rs.in']
25
+ aliases = ['rust', 'rs']
26
+ mimetypes = ['text/rust', 'text/x-rust']
27
+ version_added = '1.6'
28
+
29
+ keyword_types = (words((
30
+ 'u8', 'u16', 'u32', 'u64', 'u128', 'i8', 'i16', 'i32', 'i64', 'i128',
31
+ 'usize', 'isize', 'f32', 'f64', 'char', 'str', 'bool',
32
+ ), suffix=r'\b'), Keyword.Type)
33
+
34
+ builtin_funcs_types = (words((
35
+ 'Copy', 'Send', 'Sized', 'Sync', 'Unpin',
36
+ 'Drop', 'Fn', 'FnMut', 'FnOnce', 'drop',
37
+ 'Box', 'ToOwned', 'Clone',
38
+ 'PartialEq', 'PartialOrd', 'Eq', 'Ord',
39
+ 'AsRef', 'AsMut', 'Into', 'From', 'Default',
40
+ 'Iterator', 'Extend', 'IntoIterator', 'DoubleEndedIterator',
41
+ 'ExactSizeIterator',
42
+ 'Option', 'Some', 'None',
43
+ 'Result', 'Ok', 'Err',
44
+ 'String', 'ToString', 'Vec',
45
+ ), suffix=r'\b'), Name.Builtin)
46
+
47
+ builtin_macros = (words((
48
+ 'asm', 'assert', 'assert_eq', 'assert_ne', 'cfg', 'column',
49
+ 'compile_error', 'concat', 'concat_idents', 'dbg', 'debug_assert',
50
+ 'debug_assert_eq', 'debug_assert_ne', 'env', 'eprint', 'eprintln',
51
+ 'file', 'format', 'format_args', 'format_args_nl', 'global_asm',
52
+ 'include', 'include_bytes', 'include_str',
53
+ 'is_aarch64_feature_detected',
54
+ 'is_arm_feature_detected',
55
+ 'is_mips64_feature_detected',
56
+ 'is_mips_feature_detected',
57
+ 'is_powerpc64_feature_detected',
58
+ 'is_powerpc_feature_detected',
59
+ 'is_x86_feature_detected',
60
+ 'line', 'llvm_asm', 'log_syntax', 'macro_rules', 'matches',
61
+ 'module_path', 'option_env', 'panic', 'print', 'println', 'stringify',
62
+ 'thread_local', 'todo', 'trace_macros', 'unimplemented', 'unreachable',
63
+ 'vec', 'write', 'writeln',
64
+ ), suffix=r'!'), Name.Function.Magic)
65
+
66
+ tokens = {
67
+ 'root': [
68
+ # rust allows a file to start with a shebang, but if the first line
69
+ # starts with #![ then it's not a shebang but a crate attribute.
70
+ (r'#![^[\r\n].*$', Comment.Preproc),
71
+ default('base'),
72
+ ],
73
+ 'base': [
74
+ # Whitespace and Comments
75
+ (r'\n', Whitespace),
76
+ (r'\s+', Whitespace),
77
+ (r'//!.*?\n', String.Doc),
78
+ (r'///(\n|[^/].*?\n)', String.Doc),
79
+ (r'//(.*?)\n', Comment.Single),
80
+ (r'/\*\*(\n|[^/*])', String.Doc, 'doccomment'),
81
+ (r'/\*!', String.Doc, 'doccomment'),
82
+ (r'/\*', Comment.Multiline, 'comment'),
83
+
84
+ # Macro parameters
85
+ (r"""\$([a-zA-Z_]\w*|\(,?|\),?|,?)""", Comment.Preproc),
86
+ # Keywords
87
+ (words(('as', 'async', 'await', 'box', 'const', 'crate', 'dyn',
88
+ 'else', 'extern', 'for', 'if', 'impl', 'in', 'loop',
89
+ 'match', 'move', 'mut', 'pub', 'ref', 'return', 'static',
90
+ 'super', 'trait', 'unsafe', 'use', 'where', 'while'),
91
+ suffix=r'\b'), Keyword),
92
+ (words(('abstract', 'become', 'do', 'final', 'macro', 'override',
93
+ 'priv', 'typeof', 'try', 'unsized', 'virtual', 'yield'),
94
+ suffix=r'\b'), Keyword.Reserved),
95
+ (r'(true|false)\b', Keyword.Constant),
96
+ (r'self\b', Name.Builtin.Pseudo),
97
+ (r'mod\b', Keyword, 'modname'),
98
+ (r'let\b', Keyword.Declaration),
99
+ (r'fn\b', Keyword, 'funcname'),
100
+ (r'(struct|enum|type|union)\b', Keyword, 'typename'),
101
+ (r'(default)(\s+)(type|fn)\b', bygroups(Keyword, Whitespace, Keyword)),
102
+ keyword_types,
103
+ (r'[sS]elf\b', Name.Builtin.Pseudo),
104
+ # Prelude (taken from Rust's src/libstd/prelude.rs)
105
+ builtin_funcs_types,
106
+ builtin_macros,
107
+ # Path separators, so types don't catch them.
108
+ (r'::\b', Punctuation),
109
+ # Types in positions.
110
+ (r'(?::|->)', Punctuation, 'typename'),
111
+ # Labels
112
+ (r'(break|continue)(\b\s*)(\'[A-Za-z_]\w*)?',
113
+ bygroups(Keyword, Text.Whitespace, Name.Label)),
114
+
115
+ # Character literals
116
+ (r"""'(\\['"\\nrt]|\\x[0-7][0-9a-fA-F]|\\0"""
117
+ r"""|\\u\{[0-9a-fA-F]{1,6}\}|.)'""",
118
+ String.Char),
119
+ (r"""b'(\\['"\\nrt]|\\x[0-9a-fA-F]{2}|\\0"""
120
+ r"""|\\u\{[0-9a-fA-F]{1,6}\}|.)'""",
121
+ String.Char),
122
+
123
+ # Binary literals
124
+ (r'0b[01_]+', Number.Bin, 'number_lit'),
125
+ # Octal literals
126
+ (r'0o[0-7_]+', Number.Oct, 'number_lit'),
127
+ # Hexadecimal literals
128
+ (r'0[xX][0-9a-fA-F_]+', Number.Hex, 'number_lit'),
129
+ # Decimal literals
130
+ (r'[0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|'
131
+ r'\.[0-9_]*(?!\.)|[eE][+\-]?[0-9_]+)', Number.Float,
132
+ 'number_lit'),
133
+ (r'[0-9][0-9_]*', Number.Integer, 'number_lit'),
134
+
135
+ # String literals
136
+ (r'b"', String, 'bytestring'),
137
+ (r'"', String, 'string'),
138
+ (r'(?s)b?r(#*)".*?"\1', String),
139
+
140
+ # Lifetime names
141
+ (r"'", Operator, 'lifetime'),
142
+
143
+ # Operators and Punctuation
144
+ (r'\.\.=?', Operator),
145
+ (r'[{}()\[\],.;]', Punctuation),
146
+ (r'[+\-*/%&|<>^!~@=:?]', Operator),
147
+
148
+ # Identifiers
149
+ (r'[a-zA-Z_]\w*', Name),
150
+ # Raw identifiers
151
+ (r'r#[a-zA-Z_]\w*', Name),
152
+
153
+ # Attributes
154
+ (r'#!?\[', Comment.Preproc, 'attribute['),
155
+
156
+ # Misc
157
+ # Lone hashes: not used in Rust syntax, but allowed in macro
158
+ # arguments, most famously for quote::quote!()
159
+ (r'#', Punctuation),
160
+ ],
161
+ 'comment': [
162
+ (r'[^*/]+', Comment.Multiline),
163
+ (r'/\*', Comment.Multiline, '#push'),
164
+ (r'\*/', Comment.Multiline, '#pop'),
165
+ (r'[*/]', Comment.Multiline),
166
+ ],
167
+ 'doccomment': [
168
+ (r'[^*/]+', String.Doc),
169
+ (r'/\*', String.Doc, '#push'),
170
+ (r'\*/', String.Doc, '#pop'),
171
+ (r'[*/]', String.Doc),
172
+ ],
173
+ 'modname': [
174
+ (r'\s+', Whitespace),
175
+ (r'[a-zA-Z_]\w*', Name.Namespace, '#pop'),
176
+ default('#pop'),
177
+ ],
178
+ 'funcname': [
179
+ (r'\s+', Whitespace),
180
+ (r'[a-zA-Z_]\w*', Name.Function, '#pop'),
181
+ default('#pop'),
182
+ ],
183
+ 'typename': [
184
+ (r'\s+', Whitespace),
185
+ (r'&', Keyword.Pseudo),
186
+ (r"'", Operator, 'lifetime'),
187
+ builtin_funcs_types,
188
+ keyword_types,
189
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop'),
190
+ default('#pop'),
191
+ ],
192
+ 'lifetime': [
193
+ (r"(static|_)", Name.Builtin),
194
+ (r"[a-zA-Z_]+\w*", Name.Attribute),
195
+ default('#pop'),
196
+ ],
197
+ 'number_lit': [
198
+ (r'[ui](8|16|32|64|size)', Keyword, '#pop'),
199
+ (r'f(32|64)', Keyword, '#pop'),
200
+ default('#pop'),
201
+ ],
202
+ 'string': [
203
+ (r'"', String, '#pop'),
204
+ (r"""\\['"\\nrt]|\\x[0-7][0-9a-fA-F]|\\0"""
205
+ r"""|\\u\{[0-9a-fA-F]{1,6}\}""", String.Escape),
206
+ (r'[^\\"]+', String),
207
+ (r'\\', String),
208
+ ],
209
+ 'bytestring': [
210
+ (r"""\\x[89a-fA-F][0-9a-fA-F]""", String.Escape),
211
+ include('string'),
212
+ ],
213
+ 'attribute_common': [
214
+ (r'"', String, 'string'),
215
+ (r'\[', Comment.Preproc, 'attribute['),
216
+ ],
217
+ 'attribute[': [
218
+ include('attribute_common'),
219
+ (r'\]', Comment.Preproc, '#pop'),
220
+ (r'[^"\]\[]+', Comment.Preproc),
221
+ ],
222
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/sas.py ADDED
@@ -0,0 +1,227 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.sas
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for SAS.
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
+ from pygments.lexer import RegexLexer, include, words
13
+ from pygments.token import Comment, Keyword, Name, Number, String, Text, \
14
+ Other, Generic
15
+
16
+ __all__ = ['SASLexer']
17
+
18
+
19
+ class SASLexer(RegexLexer):
20
+ """
21
+ For SAS files.
22
+ """
23
+ # Syntax from syntax/sas.vim by James Kidd <james.kidd@covance.com>
24
+
25
+ name = 'SAS'
26
+ aliases = ['sas']
27
+ filenames = ['*.SAS', '*.sas']
28
+ mimetypes = ['text/x-sas', 'text/sas', 'application/x-sas']
29
+ url = 'https://en.wikipedia.org/wiki/SAS_(software)'
30
+ version_added = '2.2'
31
+ flags = re.IGNORECASE | re.MULTILINE
32
+
33
+ builtins_macros = (
34
+ "bquote", "nrbquote", "cmpres", "qcmpres", "compstor", "datatyp",
35
+ "display", "do", "else", "end", "eval", "global", "goto", "if",
36
+ "index", "input", "keydef", "label", "left", "length", "let",
37
+ "local", "lowcase", "macro", "mend", "nrquote",
38
+ "nrstr", "put", "qleft", "qlowcase", "qscan",
39
+ "qsubstr", "qsysfunc", "qtrim", "quote", "qupcase", "scan",
40
+ "str", "substr", "superq", "syscall", "sysevalf", "sysexec",
41
+ "sysfunc", "sysget", "syslput", "sysprod", "sysrc", "sysrput",
42
+ "then", "to", "trim", "unquote", "until", "upcase", "verify",
43
+ "while", "window"
44
+ )
45
+
46
+ builtins_conditionals = (
47
+ "do", "if", "then", "else", "end", "until", "while"
48
+ )
49
+
50
+ builtins_statements = (
51
+ "abort", "array", "attrib", "by", "call", "cards", "cards4",
52
+ "catname", "continue", "datalines", "datalines4", "delete", "delim",
53
+ "delimiter", "display", "dm", "drop", "endsas", "error", "file",
54
+ "filename", "footnote", "format", "goto", "in", "infile", "informat",
55
+ "input", "keep", "label", "leave", "length", "libname", "link",
56
+ "list", "lostcard", "merge", "missing", "modify", "options", "output",
57
+ "out", "page", "put", "redirect", "remove", "rename", "replace",
58
+ "retain", "return", "select", "set", "skip", "startsas", "stop",
59
+ "title", "update", "waitsas", "where", "window", "x", "systask"
60
+ )
61
+
62
+ builtins_sql = (
63
+ "add", "and", "alter", "as", "cascade", "check", "create",
64
+ "delete", "describe", "distinct", "drop", "foreign", "from",
65
+ "group", "having", "index", "insert", "into", "in", "key", "like",
66
+ "message", "modify", "msgtype", "not", "null", "on", "or",
67
+ "order", "primary", "references", "reset", "restrict", "select",
68
+ "set", "table", "unique", "update", "validate", "view", "where"
69
+ )
70
+
71
+ builtins_functions = (
72
+ "abs", "addr", "airy", "arcos", "arsin", "atan", "attrc",
73
+ "attrn", "band", "betainv", "blshift", "bnot", "bor",
74
+ "brshift", "bxor", "byte", "cdf", "ceil", "cexist", "cinv",
75
+ "close", "cnonct", "collate", "compbl", "compound",
76
+ "compress", "cos", "cosh", "css", "curobs", "cv", "daccdb",
77
+ "daccdbsl", "daccsl", "daccsyd", "dacctab", "dairy", "date",
78
+ "datejul", "datepart", "datetime", "day", "dclose", "depdb",
79
+ "depdbsl", "depsl", "depsyd",
80
+ "deptab", "dequote", "dhms", "dif", "digamma",
81
+ "dim", "dinfo", "dnum", "dopen", "doptname", "doptnum",
82
+ "dread", "dropnote", "dsname", "erf", "erfc", "exist", "exp",
83
+ "fappend", "fclose", "fcol", "fdelete", "fetch", "fetchobs",
84
+ "fexist", "fget", "fileexist", "filename", "fileref",
85
+ "finfo", "finv", "fipname", "fipnamel", "fipstate", "floor",
86
+ "fnonct", "fnote", "fopen", "foptname", "foptnum", "fpoint",
87
+ "fpos", "fput", "fread", "frewind", "frlen", "fsep", "fuzz",
88
+ "fwrite", "gaminv", "gamma", "getoption", "getvarc", "getvarn",
89
+ "hbound", "hms", "hosthelp", "hour", "ibessel", "index",
90
+ "indexc", "indexw", "input", "inputc", "inputn", "int",
91
+ "intck", "intnx", "intrr", "irr", "jbessel", "juldate",
92
+ "kurtosis", "lag", "lbound", "left", "length", "lgamma",
93
+ "libname", "libref", "log", "log10", "log2", "logpdf", "logpmf",
94
+ "logsdf", "lowcase", "max", "mdy", "mean", "min", "minute",
95
+ "mod", "month", "mopen", "mort", "n", "netpv", "nmiss",
96
+ "normal", "note", "npv", "open", "ordinal", "pathname",
97
+ "pdf", "peek", "peekc", "pmf", "point", "poisson", "poke",
98
+ "probbeta", "probbnml", "probchi", "probf", "probgam",
99
+ "probhypr", "probit", "probnegb", "probnorm", "probt",
100
+ "put", "putc", "putn", "qtr", "quote", "ranbin", "rancau",
101
+ "ranexp", "rangam", "range", "rank", "rannor", "ranpoi",
102
+ "rantbl", "rantri", "ranuni", "repeat", "resolve", "reverse",
103
+ "rewind", "right", "round", "saving", "scan", "sdf", "second",
104
+ "sign", "sin", "sinh", "skewness", "soundex", "spedis",
105
+ "sqrt", "std", "stderr", "stfips", "stname", "stnamel",
106
+ "substr", "sum", "symget", "sysget", "sysmsg", "sysprod",
107
+ "sysrc", "system", "tan", "tanh", "time", "timepart", "tinv",
108
+ "tnonct", "today", "translate", "tranwrd", "trigamma",
109
+ "trim", "trimn", "trunc", "uniform", "upcase", "uss", "var",
110
+ "varfmt", "varinfmt", "varlabel", "varlen", "varname",
111
+ "varnum", "varray", "varrayx", "vartype", "verify", "vformat",
112
+ "vformatd", "vformatdx", "vformatn", "vformatnx", "vformatw",
113
+ "vformatwx", "vformatx", "vinarray", "vinarrayx", "vinformat",
114
+ "vinformatd", "vinformatdx", "vinformatn", "vinformatnx",
115
+ "vinformatw", "vinformatwx", "vinformatx", "vlabel",
116
+ "vlabelx", "vlength", "vlengthx", "vname", "vnamex", "vtype",
117
+ "vtypex", "weekday", "year", "yyq", "zipfips", "zipname",
118
+ "zipnamel", "zipstate"
119
+ )
120
+
121
+ tokens = {
122
+ 'root': [
123
+ include('comments'),
124
+ include('proc-data'),
125
+ include('cards-datalines'),
126
+ include('logs'),
127
+ include('general'),
128
+ (r'.', Text),
129
+ ],
130
+ # SAS is multi-line regardless, but * is ended by ;
131
+ 'comments': [
132
+ (r'^\s*\*.*?;', Comment),
133
+ (r'/\*.*?\*/', Comment),
134
+ (r'^\s*\*(.|\n)*?;', Comment.Multiline),
135
+ (r'/[*](.|\n)*?[*]/', Comment.Multiline),
136
+ ],
137
+ # Special highlight for proc, data, quit, run
138
+ 'proc-data': [
139
+ (r'(^|;)\s*(proc \w+|data|run|quit)[\s;]',
140
+ Keyword.Reserved),
141
+ ],
142
+ # Special highlight cards and datalines
143
+ 'cards-datalines': [
144
+ (r'^\s*(datalines|cards)\s*;\s*$', Keyword, 'data'),
145
+ ],
146
+ 'data': [
147
+ (r'(.|\n)*^\s*;\s*$', Other, '#pop'),
148
+ ],
149
+ # Special highlight for put NOTE|ERROR|WARNING (order matters)
150
+ 'logs': [
151
+ (r'\n?^\s*%?put ', Keyword, 'log-messages'),
152
+ ],
153
+ 'log-messages': [
154
+ (r'NOTE(:|-).*', Generic, '#pop'),
155
+ (r'WARNING(:|-).*', Generic.Emph, '#pop'),
156
+ (r'ERROR(:|-).*', Generic.Error, '#pop'),
157
+ include('general'),
158
+ ],
159
+ 'general': [
160
+ include('keywords'),
161
+ include('vars-strings'),
162
+ include('special'),
163
+ include('numbers'),
164
+ ],
165
+ # Keywords, statements, functions, macros
166
+ 'keywords': [
167
+ (words(builtins_statements,
168
+ prefix = r'\b',
169
+ suffix = r'\b'),
170
+ Keyword),
171
+ (words(builtins_sql,
172
+ prefix = r'\b',
173
+ suffix = r'\b'),
174
+ Keyword),
175
+ (words(builtins_conditionals,
176
+ prefix = r'\b',
177
+ suffix = r'\b'),
178
+ Keyword),
179
+ (words(builtins_macros,
180
+ prefix = r'%',
181
+ suffix = r'\b'),
182
+ Name.Builtin),
183
+ (words(builtins_functions,
184
+ prefix = r'\b',
185
+ suffix = r'\('),
186
+ Name.Builtin),
187
+ ],
188
+ # Strings and user-defined variables and macros (order matters)
189
+ 'vars-strings': [
190
+ (r'&[a-z_]\w{0,31}\.?', Name.Variable),
191
+ (r'%[a-z_]\w{0,31}', Name.Function),
192
+ (r'\'', String, 'string_squote'),
193
+ (r'"', String, 'string_dquote'),
194
+ ],
195
+ 'string_squote': [
196
+ ('\'', String, '#pop'),
197
+ (r'\\\\|\\"|\\\n', String.Escape),
198
+ # AFAIK, macro variables are not evaluated in single quotes
199
+ # (r'&', Name.Variable, 'validvar'),
200
+ (r'[^$\'\\]+', String),
201
+ (r'[$\'\\]', String),
202
+ ],
203
+ 'string_dquote': [
204
+ (r'"', String, '#pop'),
205
+ (r'\\\\|\\"|\\\n', String.Escape),
206
+ (r'&', Name.Variable, 'validvar'),
207
+ (r'[^$&"\\]+', String),
208
+ (r'[$"\\]', String),
209
+ ],
210
+ 'validvar': [
211
+ (r'[a-z_]\w{0,31}\.?', Name.Variable, '#pop'),
212
+ ],
213
+ # SAS numbers and special variables
214
+ 'numbers': [
215
+ (r'\b[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)(E[+-]?[0-9]+)?i?\b',
216
+ Number),
217
+ ],
218
+ 'special': [
219
+ (r'(null|missing|_all_|_automatic_|_character_|_n_|'
220
+ r'_infile_|_name_|_null_|_numeric_|_user_|_webout_)',
221
+ Keyword.Constant),
222
+ ],
223
+ # 'operators': [
224
+ # (r'(-|=|<=|>=|<|>|<>|&|!=|'
225
+ # r'\||\*|\+|\^|/|!|~|~=)', Operator)
226
+ # ],
227
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/savi.py ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.savi
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Savi.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, include
12
+ from pygments.token import Whitespace, Keyword, Name, String, Number, \
13
+ Operator, Punctuation, Comment, Generic, Error
14
+
15
+ __all__ = ['SaviLexer']
16
+
17
+
18
+ # The canonical version of this file can be found in the following repository,
19
+ # where it is kept in sync with any language changes, as well as the other
20
+ # pygments-like lexers that are maintained for use with other tools:
21
+ # - https://github.com/savi-lang/savi/blob/main/tooling/pygments/lexers/savi.py
22
+ #
23
+ # If you're changing this file in the pygments repository, please ensure that
24
+ # any changes you make are also propagated to the official Savi repository,
25
+ # in order to avoid accidental clobbering of your changes later when an update
26
+ # from the Savi repository flows forward into the pygments repository.
27
+ #
28
+ # If you're changing this file in the Savi repository, please ensure that
29
+ # any changes you make are also reflected in the other pygments-like lexers
30
+ # (rouge, vscode, etc) so that all of the lexers can be kept cleanly in sync.
31
+
32
+ class SaviLexer(RegexLexer):
33
+ """
34
+ For Savi source code.
35
+
36
+ .. versionadded: 2.10
37
+ """
38
+
39
+ name = 'Savi'
40
+ url = 'https://github.com/savi-lang/savi'
41
+ aliases = ['savi']
42
+ filenames = ['*.savi']
43
+ version_added = ''
44
+
45
+ tokens = {
46
+ "root": [
47
+ # Line Comment
48
+ (r'//.*?$', Comment.Single),
49
+
50
+ # Doc Comment
51
+ (r'::.*?$', Comment.Single),
52
+
53
+ # Capability Operator
54
+ (r'(\')(\w+)(?=[^\'])', bygroups(Operator, Name)),
55
+
56
+ # Double-Quote String
57
+ (r'\w?"', String.Double, "string.double"),
58
+
59
+ # Single-Char String
60
+ (r"'", String.Char, "string.char"),
61
+
62
+ # Type Name
63
+ (r'(_?[A-Z]\w*)', Name.Class),
64
+
65
+ # Nested Type Name
66
+ (r'(\.)(\s*)(_?[A-Z]\w*)', bygroups(Punctuation, Whitespace, Name.Class)),
67
+
68
+ # Declare
69
+ (r'^([ \t]*)(:\w+)',
70
+ bygroups(Whitespace, Name.Tag),
71
+ "decl"),
72
+
73
+ # Error-Raising Calls/Names
74
+ (r'((\w+|\+|\-|\*)\!)', Generic.Deleted),
75
+
76
+ # Numeric Values
77
+ (r'\b\d([\d_]*(\.[\d_]+)?)\b', Number),
78
+
79
+ # Hex Numeric Values
80
+ (r'\b0x([0-9a-fA-F_]+)\b', Number.Hex),
81
+
82
+ # Binary Numeric Values
83
+ (r'\b0b([01_]+)\b', Number.Bin),
84
+
85
+ # Function Call (with braces)
86
+ (r'\w+(?=\()', Name.Function),
87
+
88
+ # Function Call (with receiver)
89
+ (r'(\.)(\s*)(\w+)', bygroups(Punctuation, Whitespace, Name.Function)),
90
+
91
+ # Function Call (with self receiver)
92
+ (r'(@)(\w+)', bygroups(Punctuation, Name.Function)),
93
+
94
+ # Parenthesis
95
+ (r'\(', Punctuation, "root"),
96
+ (r'\)', Punctuation, "#pop"),
97
+
98
+ # Brace
99
+ (r'\{', Punctuation, "root"),
100
+ (r'\}', Punctuation, "#pop"),
101
+
102
+ # Bracket
103
+ (r'\[', Punctuation, "root"),
104
+ (r'(\])(\!)', bygroups(Punctuation, Generic.Deleted), "#pop"),
105
+ (r'\]', Punctuation, "#pop"),
106
+
107
+ # Punctuation
108
+ (r'[,;:\.@]', Punctuation),
109
+
110
+ # Piping Operators
111
+ (r'(\|\>)', Operator),
112
+
113
+ # Branching Operators
114
+ (r'(\&\&|\|\||\?\?|\&\?|\|\?|\.\?)', Operator),
115
+
116
+ # Comparison Operators
117
+ (r'(\<\=\>|\=\~|\=\=|\<\=|\>\=|\<|\>)', Operator),
118
+
119
+ # Arithmetic Operators
120
+ (r'(\+|\-|\/|\*|\%)', Operator),
121
+
122
+ # Assignment Operators
123
+ (r'(\=)', Operator),
124
+
125
+ # Other Operators
126
+ (r'(\!|\<\<|\<|\&|\|)', Operator),
127
+
128
+ # Identifiers
129
+ (r'\b\w+\b', Name),
130
+
131
+ # Whitespace
132
+ (r'[ \t\r]+\n*|\n+', Whitespace),
133
+ ],
134
+
135
+ # Declare (nested rules)
136
+ "decl": [
137
+ (r'\b[a-z_]\w*\b(?!\!)', Keyword.Declaration),
138
+ (r':', Punctuation, "#pop"),
139
+ (r'\n', Whitespace, "#pop"),
140
+ include("root"),
141
+ ],
142
+
143
+ # Double-Quote String (nested rules)
144
+ "string.double": [
145
+ (r'\\\(', String.Interpol, "string.interpolation"),
146
+ (r'\\u[0-9a-fA-F]{4}', String.Escape),
147
+ (r'\\x[0-9a-fA-F]{2}', String.Escape),
148
+ (r'\\[bfnrt\\\']', String.Escape),
149
+ (r'\\"', String.Escape),
150
+ (r'"', String.Double, "#pop"),
151
+ (r'[^\\"]+', String.Double),
152
+ (r'.', Error),
153
+ ],
154
+
155
+ # Single-Char String (nested rules)
156
+ "string.char": [
157
+ (r'\\u[0-9a-fA-F]{4}', String.Escape),
158
+ (r'\\x[0-9a-fA-F]{2}', String.Escape),
159
+ (r'\\[bfnrt\\\']', String.Escape),
160
+ (r"\\'", String.Escape),
161
+ (r"'", String.Char, "#pop"),
162
+ (r"[^\\']+", String.Char),
163
+ (r'.', Error),
164
+ ],
165
+
166
+ # Interpolation inside String (nested rules)
167
+ "string.interpolation": [
168
+ (r"\)", String.Interpol, "#pop"),
169
+ include("root"),
170
+ ]
171
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/scdoc.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.scdoc
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for scdoc, a simple man page generator.
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
14
+ from pygments.token import Text, Comment, Keyword, String, Generic
15
+
16
+ __all__ = ['ScdocLexer']
17
+
18
+
19
+ class ScdocLexer(RegexLexer):
20
+ """
21
+ `scdoc` is a simple man page generator for POSIX systems written in C99.
22
+ """
23
+ name = 'scdoc'
24
+ url = 'https://git.sr.ht/~sircmpwn/scdoc'
25
+ aliases = ['scdoc', 'scd']
26
+ filenames = ['*.scd', '*.scdoc']
27
+ version_added = '2.5'
28
+ flags = re.MULTILINE
29
+
30
+ tokens = {
31
+ 'root': [
32
+ # comment
33
+ (r'^(;.+\n)', bygroups(Comment)),
34
+
35
+ # heading with pound prefix
36
+ (r'^(#)([^#].+\n)', bygroups(Generic.Heading, Text)),
37
+ (r'^(#{2})(.+\n)', bygroups(Generic.Subheading, Text)),
38
+ # bulleted lists
39
+ (r'^(\s*)([*-])(\s)(.+\n)',
40
+ bygroups(Text, Keyword, Text, using(this, state='inline'))),
41
+ # numbered lists
42
+ (r'^(\s*)(\.+\.)( .+\n)',
43
+ bygroups(Text, Keyword, using(this, state='inline'))),
44
+ # quote
45
+ (r'^(\s*>\s)(.+\n)', bygroups(Keyword, Generic.Emph)),
46
+ # text block
47
+ (r'^(```\n)([\w\W]*?)(^```$)', bygroups(String, Text, String)),
48
+
49
+ include('inline'),
50
+ ],
51
+ 'inline': [
52
+ # escape
53
+ (r'\\.', Text),
54
+ # underlines
55
+ (r'(\s)(_[^_]+_)(\W|\n)', bygroups(Text, Generic.Emph, Text)),
56
+ # bold
57
+ (r'(\s)(\*[^*]+\*)(\W|\n)', bygroups(Text, Generic.Strong, Text)),
58
+ # inline code
59
+ (r'`[^`]+`', String.Backtick),
60
+
61
+ # general text, must come last!
62
+ (r'[^\\\s]+', Text),
63
+ (r'.', Text),
64
+ ],
65
+ }
66
+
67
+ def analyse_text(text):
68
+ """We checks for bold and underline text with * and _. Also
69
+ every scdoc file must start with a strictly defined first line."""
70
+ result = 0
71
+
72
+ if '*' in text:
73
+ result += 0.01
74
+
75
+ if '_' in text:
76
+ result += 0.01
77
+
78
+ # name(section) ["left_footer" ["center_header"]]
79
+ first_line = text.partition('\n')[0]
80
+ scdoc_preamble_pattern = r'^.*\([1-7]\)( "[^"]+"){0,2}$'
81
+
82
+ if re.search(scdoc_preamble_pattern, first_line):
83
+ result += 0.5
84
+
85
+ return result
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/scripting.py ADDED
@@ -0,0 +1,1638 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.scripting
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for scripting and embedded 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, combined, \
14
+ words
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Punctuation, Error, Whitespace, Other
17
+ from pygments.util import get_bool_opt, get_list_opt
18
+
19
+ __all__ = ['LuaLexer', 'LuauLexer', 'MoonScriptLexer', 'ChaiscriptLexer', 'LSLLexer',
20
+ 'AppleScriptLexer', 'RexxLexer', 'MOOCodeLexer', 'HybrisLexer',
21
+ 'EasytrieveLexer', 'JclLexer', 'MiniScriptLexer']
22
+
23
+
24
+ def all_lua_builtins():
25
+ from pygments.lexers._lua_builtins import MODULES
26
+ return [w for values in MODULES.values() for w in values]
27
+
28
+ class LuaLexer(RegexLexer):
29
+ """
30
+ For Lua source code.
31
+
32
+ Additional options accepted:
33
+
34
+ `func_name_highlighting`
35
+ If given and ``True``, highlight builtin function names
36
+ (default: ``True``).
37
+ `disabled_modules`
38
+ If given, must be a list of module names whose function names
39
+ should not be highlighted. By default all modules are highlighted.
40
+
41
+ To get a list of allowed modules have a look into the
42
+ `_lua_builtins` module:
43
+
44
+ .. sourcecode:: pycon
45
+
46
+ >>> from pygments.lexers._lua_builtins import MODULES
47
+ >>> MODULES.keys()
48
+ ['string', 'coroutine', 'modules', 'io', 'basic', ...]
49
+ """
50
+
51
+ name = 'Lua'
52
+ url = 'https://www.lua.org/'
53
+ aliases = ['lua']
54
+ filenames = ['*.lua', '*.wlua']
55
+ mimetypes = ['text/x-lua', 'application/x-lua']
56
+ version_added = ''
57
+
58
+ _comment_multiline = r'(?:--\[(?P<level>=*)\[[\w\W]*?\](?P=level)\])'
59
+ _comment_single = r'(?:--.*$)'
60
+ _space = r'(?:\s+(?!\s))'
61
+ _s = rf'(?:{_comment_multiline}|{_comment_single}|{_space})'
62
+ # A lookahead-safe version of _s that avoids catastrophic backtracking.
63
+ # The _comment_multiline pattern contains [\w\W]*? which, when used
64
+ # inside a lookahead with a * quantifier, causes exponential blowup.
65
+ # This version skips only whitespace; comments between an identifier
66
+ # and a following [.:] or ( are rare enough to sacrifice.
67
+ _s_la = r'\s'
68
+ _name = r'(?:[^\W\d]\w*)'
69
+
70
+ tokens = {
71
+ 'root': [
72
+ # Lua allows a file to start with a shebang.
73
+ (r'#!.*', Comment.Preproc),
74
+ default('base'),
75
+ ],
76
+ 'ws': [
77
+ (_comment_multiline, Comment.Multiline),
78
+ (_comment_single, Comment.Single),
79
+ (_space, Whitespace),
80
+ ],
81
+ 'base': [
82
+ include('ws'),
83
+
84
+ (r'(?i)0x[\da-f]*(\.[\da-f]*)?(p[+-]?\d+)?', Number.Hex),
85
+ (r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float),
86
+ (r'(?i)\d+e[+-]?\d+', Number.Float),
87
+ (r'\d+', Number.Integer),
88
+
89
+ # multiline strings
90
+ (r'(?s)\[(=*)\[.*?\]\1\]', String),
91
+
92
+ (r'::', Punctuation, 'label'),
93
+ (r'\.{3}', Punctuation),
94
+ (r'[=<>|~&+\-*/%#^]+|\.\.', Operator),
95
+ (r'[\[\]{}().,:;]+', Punctuation),
96
+ (r'(and|or|not)\b', Operator.Word),
97
+
98
+ (words([
99
+ 'break', 'do', 'else', 'elseif', 'end', 'for', 'if', 'in',
100
+ 'repeat', 'return', 'then', 'until', 'while'
101
+ ], suffix=r'\b'), Keyword.Reserved),
102
+ (r'goto\b', Keyword.Reserved, 'goto'),
103
+ (r'(local)\b', Keyword.Declaration),
104
+ (r'(true|false|nil)\b', Keyword.Constant),
105
+
106
+ (r'(function)\b', Keyword.Reserved, 'funcname'),
107
+
108
+ (words(all_lua_builtins(), suffix=r"\b"), Name.Builtin),
109
+ (fr'[A-Za-z_]\w*(?={_s_la}*[.:])', Name.Variable, 'varname'),
110
+ (fr'[A-Za-z_]\w*(?={_s_la}*\()', Name.Function),
111
+ (r'[A-Za-z_]\w*', Name.Variable),
112
+
113
+ ("'", String.Single, combined('stringescape', 'sqs')),
114
+ ('"', String.Double, combined('stringescape', 'dqs'))
115
+ ],
116
+
117
+ 'varname': [
118
+ include('ws'),
119
+ (r'\.\.', Operator, '#pop'),
120
+ (r'[.:]', Punctuation),
121
+ (rf'{_name}(?={_s_la}*[.:])', Name.Property),
122
+ (rf'{_name}(?={_s_la}*\()', Name.Function, '#pop'),
123
+ (_name, Name.Property, '#pop'),
124
+ ],
125
+
126
+ 'funcname': [
127
+ include('ws'),
128
+ (r'[.:]', Punctuation),
129
+ (rf'{_name}(?={_s_la}*[.:])', Name.Class),
130
+ (_name, Name.Function, '#pop'),
131
+ # inline function
132
+ (r'\(', Punctuation, '#pop'),
133
+ ],
134
+
135
+ 'goto': [
136
+ include('ws'),
137
+ (_name, Name.Label, '#pop'),
138
+ ],
139
+
140
+ 'label': [
141
+ include('ws'),
142
+ (r'::', Punctuation, '#pop'),
143
+ (_name, Name.Label),
144
+ ],
145
+
146
+ 'stringescape': [
147
+ (r'\\([abfnrtv\\"\']|[\r\n]{1,2}|z\s*|x[0-9a-fA-F]{2}|\d{1,3}|'
148
+ r'u\{[0-9a-fA-F]+\})', String.Escape),
149
+ ],
150
+
151
+ 'sqs': [
152
+ (r"'", String.Single, '#pop'),
153
+ (r"[^\\']+", String.Single),
154
+ ],
155
+
156
+ 'dqs': [
157
+ (r'"', String.Double, '#pop'),
158
+ (r'[^\\"]+', String.Double),
159
+ ]
160
+ }
161
+
162
+ def __init__(self, **options):
163
+ self.func_name_highlighting = get_bool_opt(
164
+ options, 'func_name_highlighting', True)
165
+ self.disabled_modules = get_list_opt(options, 'disabled_modules', [])
166
+
167
+ self._functions = set()
168
+ if self.func_name_highlighting:
169
+ from pygments.lexers._lua_builtins import MODULES
170
+ for mod, func in MODULES.items():
171
+ if mod not in self.disabled_modules:
172
+ self._functions.update(func)
173
+ RegexLexer.__init__(self, **options)
174
+
175
+ def get_tokens_unprocessed(self, text):
176
+ for index, token, value in \
177
+ RegexLexer.get_tokens_unprocessed(self, text):
178
+ if token is Name.Builtin and value not in self._functions:
179
+ if '.' in value:
180
+ a, b = value.split('.')
181
+ yield index, Name, a
182
+ yield index + len(a), Punctuation, '.'
183
+ yield index + len(a) + 1, Name, b
184
+ else:
185
+ yield index, Name, value
186
+ continue
187
+ yield index, token, value
188
+
189
+ def _luau_make_expression(should_pop, _s, _s_la):
190
+ temp_list = [
191
+ (r'0[xX][\da-fA-F_]*', Number.Hex, '#pop'),
192
+ (r'0[bB][\d_]*', Number.Bin, '#pop'),
193
+ (r'\.?\d[\d_]*(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?', Number.Float, '#pop'),
194
+
195
+ (words((
196
+ 'true', 'false', 'nil'
197
+ ), suffix=r'\b'), Keyword.Constant, '#pop'),
198
+
199
+ (r'\[(=*)\[[.\n]*?\]\1\]', String, '#pop'),
200
+
201
+ (r'(\.)([a-zA-Z_]\w*)(?=%s*[({"\'])', bygroups(Punctuation, Name.Function), '#pop'),
202
+ (r'(\.)([a-zA-Z_]\w*)', bygroups(Punctuation, Name.Variable), '#pop'),
203
+
204
+ (rf'[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*(?={_s_la}*[({{"\'])', Name.Other, '#pop'),
205
+ (r'[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*', Name, '#pop'),
206
+ ]
207
+ if should_pop:
208
+ return temp_list
209
+ return [entry[:2] for entry in temp_list]
210
+
211
+ def _luau_make_expression_special(should_pop):
212
+ temp_list = [
213
+ (r'\{', Punctuation, ('#pop', 'closing_brace_base', 'expression')),
214
+ (r'\(', Punctuation, ('#pop', 'closing_parenthesis_base', 'expression')),
215
+
216
+ (r'::?', Punctuation, ('#pop', 'type_end', 'type_start')),
217
+
218
+ (r"'", String.Single, ('#pop', 'string_single')),
219
+ (r'"', String.Double, ('#pop', 'string_double')),
220
+ (r'`', String.Backtick, ('#pop', 'string_interpolated')),
221
+ ]
222
+ if should_pop:
223
+ return temp_list
224
+ return [(entry[0], entry[1], entry[2][1:]) for entry in temp_list]
225
+
226
+ class LuauLexer(RegexLexer):
227
+ """
228
+ For Luau source code.
229
+
230
+ Additional options accepted:
231
+
232
+ `include_luau_builtins`
233
+ If given and ``True``, automatically highlight Luau builtins
234
+ (default: ``True``).
235
+ `include_roblox_builtins`
236
+ If given and ``True``, automatically highlight Roblox-specific builtins
237
+ (default: ``False``).
238
+ `additional_builtins`
239
+ If given, must be a list of additional builtins to highlight.
240
+ `disabled_builtins`
241
+ If given, must be a list of builtins that will not be highlighted.
242
+ """
243
+
244
+ name = 'Luau'
245
+ url = 'https://luau-lang.org/'
246
+ aliases = ['luau']
247
+ filenames = ['*.luau']
248
+ version_added = '2.18'
249
+
250
+ _comment_multiline = r'(?:--\[(?P<level>=*)\[[\w\W]*?\](?P=level)\])'
251
+ _comment_single = r'(?:--.*$)'
252
+ _s = r'(?:{}|{}|{})'.format(_comment_multiline, _comment_single, r'\s+')
253
+ # Lookahead-safe version — avoids catastrophic backtracking from
254
+ # [\w\W]*? inside _comment_multiline when combined with * quantifier.
255
+ _s_la = r'\s'
256
+
257
+ tokens = {
258
+ 'root': [
259
+ (r'#!.*', Comment.Hashbang, 'base'),
260
+ default('base'),
261
+ ],
262
+
263
+ 'ws': [
264
+ (_comment_multiline, Comment.Multiline),
265
+ (_comment_single, Comment.Single),
266
+ (r'\s+', Whitespace),
267
+ ],
268
+
269
+ 'base': [
270
+ include('ws'),
271
+
272
+ *_luau_make_expression_special(False),
273
+ (r'\.\.\.', Punctuation),
274
+
275
+ (rf'type\b(?={_s}+[a-zA-Z_])', Keyword.Reserved, 'type_declaration'),
276
+ (rf'export\b(?={_s}+[a-zA-Z_])', Keyword.Reserved),
277
+
278
+ (r'(?:\.\.|//|[+\-*\/%^<>=])=?', Operator, 'expression'),
279
+ (r'~=', Operator, 'expression'),
280
+
281
+ (words((
282
+ 'and', 'or', 'not'
283
+ ), suffix=r'\b'), Operator.Word, 'expression'),
284
+
285
+ (words((
286
+ 'elseif', 'for', 'if', 'in', 'repeat', 'return', 'until',
287
+ 'while'), suffix=r'\b'), Keyword.Reserved, 'expression'),
288
+ (r'local\b', Keyword.Declaration, 'expression'),
289
+
290
+ (r'function\b', Keyword.Reserved, ('expression', 'func_name')),
291
+
292
+ (r'[\])};]+', Punctuation),
293
+
294
+ include('expression_static'),
295
+ *_luau_make_expression(False, _s, _s_la),
296
+
297
+ (r'[\[.,]', Punctuation, 'expression'),
298
+ ],
299
+ 'expression_static': [
300
+ (words((
301
+ 'break', 'continue', 'do', 'else', 'elseif', 'end', 'for',
302
+ 'if', 'in', 'repeat', 'return', 'then', 'until', 'while'),
303
+ suffix=r'\b'), Keyword.Reserved),
304
+ ],
305
+ 'expression': [
306
+ include('ws'),
307
+
308
+ (r'if\b', Keyword.Reserved, ('ternary', 'expression')),
309
+
310
+ (r'local\b', Keyword.Declaration),
311
+ *_luau_make_expression_special(True),
312
+ (r'\.\.\.', Punctuation, '#pop'),
313
+
314
+ (r'function\b', Keyword.Reserved, 'func_name'),
315
+
316
+ include('expression_static'),
317
+ *_luau_make_expression(True, _s, _s_la),
318
+
319
+ default('#pop'),
320
+ ],
321
+ 'ternary': [
322
+ include('ws'),
323
+
324
+ (r'else\b', Keyword.Reserved, '#pop'),
325
+ (words((
326
+ 'then', 'elseif',
327
+ ), suffix=r'\b'), Operator.Reserved, 'expression'),
328
+
329
+ default('#pop'),
330
+ ],
331
+
332
+ 'closing_brace_pop': [
333
+ (r'\}', Punctuation, '#pop'),
334
+ ],
335
+ 'closing_parenthesis_pop': [
336
+ (r'\)', Punctuation, '#pop'),
337
+ ],
338
+ 'closing_gt_pop': [
339
+ (r'>', Punctuation, '#pop'),
340
+ ],
341
+
342
+ 'closing_parenthesis_base': [
343
+ include('closing_parenthesis_pop'),
344
+ include('base'),
345
+ ],
346
+ 'closing_parenthesis_type': [
347
+ include('closing_parenthesis_pop'),
348
+ include('type'),
349
+ ],
350
+ 'closing_brace_base': [
351
+ include('closing_brace_pop'),
352
+ include('base'),
353
+ ],
354
+ 'closing_brace_type': [
355
+ include('closing_brace_pop'),
356
+ include('type'),
357
+ ],
358
+ 'closing_gt_type': [
359
+ include('closing_gt_pop'),
360
+ include('type'),
361
+ ],
362
+
363
+ 'string_escape': [
364
+ (r'\\z\s*', String.Escape),
365
+ (r'\\(?:[abfnrtvz\\"\'`\{\n])|[\r\n]{1,2}|x[\da-fA-F]{2}|\d{1,3}|'
366
+ r'u\{\}[\da-fA-F]*\}', String.Escape),
367
+ ],
368
+ 'string_single': [
369
+ include('string_escape'),
370
+
371
+ (r"'", String.Single, "#pop"),
372
+ (r"[^\\']+", String.Single),
373
+ ],
374
+ 'string_double': [
375
+ include('string_escape'),
376
+
377
+ (r'"', String.Double, "#pop"),
378
+ (r'[^\\"]+', String.Double),
379
+ ],
380
+ 'string_interpolated': [
381
+ include('string_escape'),
382
+
383
+ (r'\{', Punctuation, ('closing_brace_base', 'expression')),
384
+
385
+ (r'`', String.Backtick, "#pop"),
386
+ (r'[^\\`\{]+', String.Backtick),
387
+ ],
388
+
389
+ 'func_name': [
390
+ include('ws'),
391
+
392
+ (r'[.:]', Punctuation),
393
+ (rf'[a-zA-Z_]\w*(?={_s_la}*[.:])', Name.Class),
394
+ (r'[a-zA-Z_]\w*', Name.Function),
395
+
396
+ (r'<', Punctuation, 'closing_gt_type'),
397
+
398
+ (r'\(', Punctuation, '#pop'),
399
+ ],
400
+
401
+ 'type': [
402
+ include('ws'),
403
+
404
+ (r'\(', Punctuation, 'closing_parenthesis_type'),
405
+ (r'\{', Punctuation, 'closing_brace_type'),
406
+ (r'<', Punctuation, 'closing_gt_type'),
407
+
408
+ (r"'", String.Single, 'string_single'),
409
+ (r'"', String.Double, 'string_double'),
410
+
411
+ (r'[|&\.,\[\]:=]+', Punctuation),
412
+ (r'->', Punctuation),
413
+
414
+ (r'typeof\(', Name.Builtin, ('closing_parenthesis_base',
415
+ 'expression')),
416
+ (r'[a-zA-Z_]\w*', Name.Class),
417
+ ],
418
+ 'type_start': [
419
+ include('ws'),
420
+
421
+ (r'\(', Punctuation, ('#pop', 'closing_parenthesis_type')),
422
+ (r'\{', Punctuation, ('#pop', 'closing_brace_type')),
423
+ (r'<', Punctuation, ('#pop', 'closing_gt_type')),
424
+
425
+ (r"'", String.Single, ('#pop', 'string_single')),
426
+ (r'"', String.Double, ('#pop', 'string_double')),
427
+
428
+ (r'typeof\(', Name.Builtin, ('#pop', 'closing_parenthesis_base',
429
+ 'expression')),
430
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop'),
431
+ ],
432
+ 'type_end': [
433
+ include('ws'),
434
+
435
+ (r'[|&\.]', Punctuation, 'type_start'),
436
+ (r'->', Punctuation, 'type_start'),
437
+
438
+ (r'<', Punctuation, 'closing_gt_type'),
439
+
440
+ default('#pop'),
441
+ ],
442
+ 'type_declaration': [
443
+ include('ws'),
444
+
445
+ (r'[a-zA-Z_]\w*', Name.Class),
446
+ (r'<', Punctuation, 'closing_gt_type'),
447
+
448
+ (r'=', Punctuation, ('#pop', 'type_end', 'type_start')),
449
+ ],
450
+ }
451
+
452
+ def __init__(self, **options):
453
+ self.include_luau_builtins = get_bool_opt(
454
+ options, 'include_luau_builtins', True)
455
+ self.include_roblox_builtins = get_bool_opt(
456
+ options, 'include_roblox_builtins', False)
457
+ self.additional_builtins = get_list_opt(options, 'additional_builtins', [])
458
+ self.disabled_builtins = get_list_opt(options, 'disabled_builtins', [])
459
+
460
+ self._builtins = set(self.additional_builtins)
461
+ if self.include_luau_builtins:
462
+ from pygments.lexers._luau_builtins import LUAU_BUILTINS
463
+ self._builtins.update(LUAU_BUILTINS)
464
+ if self.include_roblox_builtins:
465
+ from pygments.lexers._luau_builtins import ROBLOX_BUILTINS
466
+ self._builtins.update(ROBLOX_BUILTINS)
467
+ if self.additional_builtins:
468
+ self._builtins.update(self.additional_builtins)
469
+ self._builtins.difference_update(self.disabled_builtins)
470
+
471
+ RegexLexer.__init__(self, **options)
472
+
473
+ def get_tokens_unprocessed(self, text):
474
+ for index, token, value in \
475
+ RegexLexer.get_tokens_unprocessed(self, text):
476
+ if token is Name or token is Name.Other:
477
+ split_value = value.split('.')
478
+ complete_value = []
479
+ new_index = index
480
+ for position in range(len(split_value), 0, -1):
481
+ potential_string = '.'.join(split_value[:position])
482
+ if potential_string in self._builtins:
483
+ yield index, Name.Builtin, potential_string
484
+ new_index += len(potential_string)
485
+
486
+ if complete_value:
487
+ yield new_index, Punctuation, '.'
488
+ new_index += 1
489
+ break
490
+ complete_value.insert(0, split_value[position - 1])
491
+
492
+ for position, substring in enumerate(complete_value):
493
+ if position + 1 == len(complete_value):
494
+ if token is Name:
495
+ yield new_index, Name.Variable, substring
496
+ continue
497
+ yield new_index, Name.Function, substring
498
+ continue
499
+ yield new_index, Name.Variable, substring
500
+ new_index += len(substring)
501
+ yield new_index, Punctuation, '.'
502
+ new_index += 1
503
+
504
+ continue
505
+ yield index, token, value
506
+
507
+ class MoonScriptLexer(LuaLexer):
508
+ """
509
+ For MoonScript source code.
510
+ """
511
+
512
+ name = 'MoonScript'
513
+ url = 'http://moonscript.org'
514
+ aliases = ['moonscript', 'moon']
515
+ filenames = ['*.moon']
516
+ mimetypes = ['text/x-moonscript', 'application/x-moonscript']
517
+ version_added = '1.5'
518
+
519
+ tokens = {
520
+ 'root': [
521
+ (r'#!(.*?)$', Comment.Preproc),
522
+ default('base'),
523
+ ],
524
+ 'base': [
525
+ ('--.*$', Comment.Single),
526
+ (r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float),
527
+ (r'(?i)\d+e[+-]?\d+', Number.Float),
528
+ (r'(?i)0x[0-9a-f]*', Number.Hex),
529
+ (r'\d+', Number.Integer),
530
+ (r'\n', Whitespace),
531
+ (r'[^\S\n]+', Text),
532
+ (r'(?s)\[(=*)\[.*?\]\1\]', String),
533
+ (r'(->|=>)', Name.Function),
534
+ (r':[a-zA-Z_]\w*', Name.Variable),
535
+ (r'(==|!=|~=|<=|>=|\.\.\.|\.\.|[=+\-*/%^<>#!.\\:])', Operator),
536
+ (r'[;,]', Punctuation),
537
+ (r'[\[\]{}()]', Keyword.Type),
538
+ (r'[a-zA-Z_]\w*:', Name.Variable),
539
+ (words((
540
+ 'class', 'extends', 'if', 'then', 'super', 'do', 'with',
541
+ 'import', 'export', 'while', 'elseif', 'return', 'for', 'in',
542
+ 'from', 'when', 'using', 'else', 'and', 'or', 'not', 'switch',
543
+ 'break'), suffix=r'\b'),
544
+ Keyword),
545
+ (r'(true|false|nil)\b', Keyword.Constant),
546
+ (r'(and|or|not)\b', Operator.Word),
547
+ (r'(self)\b', Name.Builtin.Pseudo),
548
+ (r'@@?([a-zA-Z_]\w*)?', Name.Variable.Class),
549
+ (r'[A-Z]\w*', Name.Class), # proper name
550
+ (words(all_lua_builtins(), suffix=r"\b"), Name.Builtin),
551
+ (r'[A-Za-z_]\w*', Name),
552
+ ("'", String.Single, combined('stringescape', 'sqs')),
553
+ ('"', String.Double, combined('stringescape', 'dqs'))
554
+ ],
555
+ 'stringescape': [
556
+ (r'''\\([abfnrtv\\"']|\d{1,3})''', String.Escape)
557
+ ],
558
+ 'strings': [
559
+ (r'[^#\\\'"]+', String),
560
+ # note that strings are multi-line.
561
+ # hashmarks, quotes and backslashes must be parsed one at a time
562
+ ],
563
+ 'interpoling_string': [
564
+ (r'\}', String.Interpol, "#pop"),
565
+ include('base')
566
+ ],
567
+ 'dqs': [
568
+ (r'"', String.Double, '#pop'),
569
+ (r'\\.|\'', String), # double-quoted string don't need ' escapes
570
+ (r'#\{', String.Interpol, "interpoling_string"),
571
+ (r'#', String),
572
+ include('strings')
573
+ ],
574
+ 'sqs': [
575
+ (r"'", String.Single, '#pop'),
576
+ (r'#|\\.|"', String), # single quoted strings don't need " escapses
577
+ include('strings')
578
+ ]
579
+ }
580
+
581
+ def get_tokens_unprocessed(self, text):
582
+ # set . as Operator instead of Punctuation
583
+ for index, token, value in LuaLexer.get_tokens_unprocessed(self, text):
584
+ if token == Punctuation and value == ".":
585
+ token = Operator
586
+ yield index, token, value
587
+
588
+
589
+ class ChaiscriptLexer(RegexLexer):
590
+ """
591
+ For ChaiScript source code.
592
+ """
593
+
594
+ name = 'ChaiScript'
595
+ url = 'http://chaiscript.com/'
596
+ aliases = ['chaiscript', 'chai']
597
+ filenames = ['*.chai']
598
+ mimetypes = ['text/x-chaiscript', 'application/x-chaiscript']
599
+ version_added = '2.0'
600
+
601
+ flags = re.DOTALL | re.MULTILINE
602
+
603
+ tokens = {
604
+ 'commentsandwhitespace': [
605
+ (r'\s+', Text),
606
+ (r'//.*?\n', Comment.Single),
607
+ (r'/\*.*?\*/', Comment.Multiline),
608
+ (r'^\#.*?\n', Comment.Single)
609
+ ],
610
+ 'slashstartsregex': [
611
+ include('commentsandwhitespace'),
612
+ (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
613
+ r'([gim]+\b|\B)', String.Regex, '#pop'),
614
+ (r'(?=/)', Text, ('#pop', 'badregex')),
615
+ default('#pop')
616
+ ],
617
+ 'badregex': [
618
+ (r'\n', Text, '#pop')
619
+ ],
620
+ 'root': [
621
+ include('commentsandwhitespace'),
622
+ (r'\n', Text),
623
+ (r'[^\S\n]+', Text),
624
+ (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|\.\.'
625
+ r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
626
+ (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
627
+ (r'[})\].]', Punctuation),
628
+ (r'[=+\-*/]', Operator),
629
+ (r'(for|in|while|do|break|return|continue|if|else|'
630
+ r'throw|try|catch'
631
+ r')\b', Keyword, 'slashstartsregex'),
632
+ (r'(var)\b', Keyword.Declaration, 'slashstartsregex'),
633
+ (r'(attr|def|fun)\b', Keyword.Reserved),
634
+ (r'(true|false)\b', Keyword.Constant),
635
+ (r'(eval|throw)\b', Name.Builtin),
636
+ (r'`\S+`', Name.Builtin),
637
+ (r'[$a-zA-Z_]\w*', Name.Other),
638
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
639
+ (r'0x[0-9a-fA-F]+', Number.Hex),
640
+ (r'[0-9]+', Number.Integer),
641
+ (r'"', String.Double, 'dqstring'),
642
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
643
+ ],
644
+ 'dqstring': [
645
+ (r'\$\{[^"}]+?\}', String.Interpol),
646
+ (r'\$', String.Double),
647
+ (r'\\\\', String.Double),
648
+ (r'\\"', String.Double),
649
+ (r'[^\\"$]+', String.Double),
650
+ (r'"', String.Double, '#pop'),
651
+ ],
652
+ }
653
+
654
+
655
+ class LSLLexer(RegexLexer):
656
+ """
657
+ For Second Life's Linden Scripting Language source code.
658
+ """
659
+
660
+ name = 'LSL'
661
+ aliases = ['lsl']
662
+ filenames = ['*.lsl']
663
+ mimetypes = ['text/x-lsl']
664
+ url = 'https://wiki.secondlife.com/wiki/Linden_Scripting_Language'
665
+ version_added = '2.0'
666
+
667
+ flags = re.MULTILINE
668
+
669
+ lsl_keywords = r'\b(?:do|else|for|if|jump|return|while)\b'
670
+ lsl_types = r'\b(?:float|integer|key|list|quaternion|rotation|string|vector)\b'
671
+ lsl_states = r'\b(?:(?:state)\s+\w+|default)\b'
672
+ lsl_events = r'\b(?:state_(?:entry|exit)|touch(?:_(?:start|end))?|(?:land_)?collision(?:_(?:start|end))?|timer|listen|(?:no_)?sensor|control|(?:not_)?at_(?:rot_)?target|money|email|run_time_permissions|changed|attach|dataserver|moving_(?:start|end)|link_message|(?:on|object)_rez|remote_data|http_re(?:sponse|quest)|path_update|transaction_result)\b'
673
+ lsl_functions_builtin = r'\b(?:ll(?:ReturnObjectsBy(?:ID|Owner)|Json(?:2List|[GS]etValue|ValueType)|Sin|Cos|Tan|Atan2|Sqrt|Pow|Abs|Fabs|Frand|Floor|Ceil|Round|Vec(?:Mag|Norm|Dist)|Rot(?:Between|2(?:Euler|Fwd|Left|Up))|(?:Euler|Axes)2Rot|Whisper|(?:Region|Owner)?Say|Shout|Listen(?:Control|Remove)?|Sensor(?:Repeat|Remove)?|Detected(?:Name|Key|Owner|Type|Pos|Vel|Grab|Rot|Group|LinkNumber)|Die|Ground|Wind|(?:[GS]et)(?:AnimationOverride|MemoryLimit|PrimMediaParams|ParcelMusicURL|Object(?:Desc|Name)|PhysicsMaterial|Status|Scale|Color|Alpha|Texture|Pos|Rot|Force|Torque)|ResetAnimationOverride|(?:Scale|Offset|Rotate)Texture|(?:Rot)?Target(?:Remove)?|(?:Stop)?MoveToTarget|Apply(?:Rotational)?Impulse|Set(?:KeyframedMotion|ContentType|RegionPos|(?:Angular)?Velocity|Buoyancy|HoverHeight|ForceAndTorque|TimerEvent|ScriptState|Damage|TextureAnim|Sound(?:Queueing|Radius)|Vehicle(?:Type|(?:Float|Vector|Rotation)Param)|(?:Touch|Sit)?Text|Camera(?:Eye|At)Offset|PrimitiveParams|ClickAction|Link(?:Alpha|Color|PrimitiveParams(?:Fast)?|Texture(?:Anim)?|Camera|Media)|RemoteScriptAccessPin|PayPrice|LocalRot)|ScaleByFactor|Get(?:(?:Max|Min)ScaleFactor|ClosestNavPoint|StaticPath|SimStats|Env|PrimitiveParams|Link(?:PrimitiveParams|Number(?:OfSides)?|Key|Name|Media)|HTTPHeader|FreeURLs|Object(?:Details|PermMask|PrimCount)|Parcel(?:MaxPrims|Details|Prim(?:Count|Owners))|Attached|(?:SPMax|Free|Used)Memory|Region(?:Name|TimeDilation|FPS|Corner|AgentCount)|Root(?:Position|Rotation)|UnixTime|(?:Parcel|Region)Flags|(?:Wall|GMT)clock|SimulatorHostname|BoundingBox|GeometricCenter|Creator|NumberOf(?:Prims|NotecardLines|Sides)|Animation(?:List)?|(?:Camera|Local)(?:Pos|Rot)|Vel|Accel|Omega|Time(?:stamp|OfDay)|(?:Object|CenterOf)?Mass|MassMKS|Energy|Owner|(?:Owner)?Key|SunDirection|Texture(?:Offset|Scale|Rot)|Inventory(?:Number|Name|Key|Type|Creator|PermMask)|Permissions(?:Key)?|StartParameter|List(?:Length|EntryType)|Date|Agent(?:Size|Info|Language|List)|LandOwnerAt|NotecardLine|Script(?:Name|State))|(?:Get|Reset|GetAndReset)Time|PlaySound(?:Slave)?|LoopSound(?:Master|Slave)?|(?:Trigger|Stop|Preload)Sound|(?:(?:Get|Delete)Sub|Insert)String|To(?:Upper|Lower)|Give(?:InventoryList|Money)|RezObject|(?:Stop)?LookAt|Sleep|CollisionFilter|(?:Take|Release)Controls|DetachFromAvatar|AttachToAvatar(?:Temp)?|InstantMessage|(?:GetNext)?Email|StopHover|MinEventDelay|RotLookAt|String(?:Length|Trim)|(?:Start|Stop)Animation|TargetOmega|RequestPermissions|(?:Create|Break)Link|BreakAllLinks|(?:Give|Remove)Inventory|Water|PassTouches|Request(?:Agent|Inventory)Data|TeleportAgent(?:Home|GlobalCoords)?|ModifyLand|CollisionSound|ResetScript|MessageLinked|PushObject|PassCollisions|AxisAngle2Rot|Rot2(?:Axis|Angle)|A(?:cos|sin)|AngleBetween|AllowInventoryDrop|SubStringIndex|List2(?:CSV|Integer|Json|Float|String|Key|Vector|Rot|List(?:Strided)?)|DeleteSubList|List(?:Statistics|Sort|Randomize|(?:Insert|Find|Replace)List)|EdgeOfWorld|AdjustSoundVolume|Key2Name|TriggerSoundLimited|EjectFromLand|(?:CSV|ParseString)2List|OverMyLand|SameGroup|UnSit|Ground(?:Slope|Normal|Contour)|GroundRepel|(?:Set|Remove)VehicleFlags|(?:AvatarOn)?(?:Link)?SitTarget|Script(?:Danger|Profiler)|Dialog|VolumeDetect|ResetOtherScript|RemoteLoadScriptPin|(?:Open|Close)RemoteDataChannel|SendRemoteData|RemoteDataReply|(?:Integer|String)ToBase64|XorBase64|Log(?:10)?|Base64To(?:String|Integer)|ParseStringKeepNulls|RezAtRoot|RequestSimulatorData|ForceMouselook|(?:Load|Release|(?:E|Une)scape)URL|ParcelMedia(?:CommandList|Query)|ModPow|MapDestination|(?:RemoveFrom|AddTo|Reset)Land(?:Pass|Ban)List|(?:Set|Clear)CameraParams|HTTP(?:Request|Response)|TextBox|DetectedTouch(?:UV|Face|Pos|(?:N|Bin)ormal|ST)|(?:MD5|SHA1|DumpList2)String|Request(?:Secure)?URL|Clear(?:Prim|Link)Media|(?:Link)?ParticleSystem|(?:Get|Request)(?:Username|DisplayName)|RegionSayTo|CastRay|GenerateKey|TransferLindenDollars|ManageEstateAccess|(?:Create|Delete)Character|ExecCharacterCmd|Evade|FleeFrom|NavigateTo|PatrolPoints|Pursue|UpdateCharacter|WanderWithin))\b'
674
+ lsl_constants_float = r'\b(?:DEG_TO_RAD|PI(?:_BY_TWO)?|RAD_TO_DEG|SQRT2|TWO_PI)\b'
675
+ lsl_constants_integer = r'\b(?:JSON_APPEND|STATUS_(?:PHYSICS|ROTATE_[XYZ]|PHANTOM|SANDBOX|BLOCK_GRAB(?:_OBJECT)?|(?:DIE|RETURN)_AT_EDGE|CAST_SHADOWS|OK|MALFORMED_PARAMS|TYPE_MISMATCH|BOUNDS_ERROR|NOT_(?:FOUND|SUPPORTED)|INTERNAL_ERROR|WHITELIST_FAILED)|AGENT(?:_(?:BY_(?:LEGACY_|USER)NAME|FLYING|ATTACHMENTS|SCRIPTED|MOUSELOOK|SITTING|ON_OBJECT|AWAY|WALKING|IN_AIR|TYPING|CROUCHING|BUSY|ALWAYS_RUN|AUTOPILOT|LIST_(?:PARCEL(?:_OWNER)?|REGION)))?|CAMERA_(?:PITCH|DISTANCE|BEHINDNESS_(?:ANGLE|LAG)|(?:FOCUS|POSITION)(?:_(?:THRESHOLD|LOCKED|LAG))?|FOCUS_OFFSET|ACTIVE)|ANIM_ON|LOOP|REVERSE|PING_PONG|SMOOTH|ROTATE|SCALE|ALL_SIDES|LINK_(?:ROOT|SET|ALL_(?:OTHERS|CHILDREN)|THIS)|ACTIVE|PASSIVE|SCRIPTED|CONTROL_(?:FWD|BACK|(?:ROT_)?(?:LEFT|RIGHT)|UP|DOWN|(?:ML_)?LBUTTON)|PERMISSION_(?:RETURN_OBJECTS|DEBIT|OVERRIDE_ANIMATIONS|SILENT_ESTATE_MANAGEMENT|TAKE_CONTROLS|TRIGGER_ANIMATION|ATTACH|CHANGE_LINKS|(?:CONTROL|TRACK)_CAMERA|TELEPORT)|INVENTORY_(?:TEXTURE|SOUND|OBJECT|SCRIPT|LANDMARK|CLOTHING|NOTECARD|BODYPART|ANIMATION|GESTURE|ALL|NONE)|CHANGED_(?:INVENTORY|COLOR|SHAPE|SCALE|TEXTURE|LINK|ALLOWED_DROP|OWNER|REGION(?:_START)?|TELEPORT|MEDIA)|OBJECT_(?:(?:PHYSICS|SERVER|STREAMING)_COST|UNKNOWN_DETAIL|CHARACTER_TIME|PHANTOM|PHYSICS|TEMP_ON_REZ|NAME|DESC|POS|PRIM_EQUIVALENCE|RETURN_(?:PARCEL(?:_OWNER)?|REGION)|ROO?T|VELOCITY|OWNER|GROUP|CREATOR|ATTACHED_POINT|RENDER_WEIGHT|PATHFINDING_TYPE|(?:RUNNING|TOTAL)_SCRIPT_COUNT|SCRIPT_(?:MEMORY|TIME))|TYPE_(?:INTEGER|FLOAT|STRING|KEY|VECTOR|ROTATION|INVALID)|(?:DEBUG|PUBLIC)_CHANNEL|ATTACH_(?:AVATAR_CENTER|CHEST|HEAD|BACK|PELVIS|MOUTH|CHIN|NECK|NOSE|BELLY|[LR](?:SHOULDER|HAND|FOOT|EAR|EYE|[UL](?:ARM|LEG)|HIP)|(?:LEFT|RIGHT)_PEC|HUD_(?:CENTER_[12]|TOP_(?:RIGHT|CENTER|LEFT)|BOTTOM(?:_(?:RIGHT|LEFT))?))|LAND_(?:LEVEL|RAISE|LOWER|SMOOTH|NOISE|REVERT)|DATA_(?:ONLINE|NAME|BORN|SIM_(?:POS|STATUS|RATING)|PAYINFO)|PAYMENT_INFO_(?:ON_FILE|USED)|REMOTE_DATA_(?:CHANNEL|REQUEST|REPLY)|PSYS_(?:PART_(?:BF_(?:ZERO|ONE(?:_MINUS_(?:DEST_COLOR|SOURCE_(ALPHA|COLOR)))?|DEST_COLOR|SOURCE_(ALPHA|COLOR))|BLEND_FUNC_(DEST|SOURCE)|FLAGS|(?:START|END)_(?:COLOR|ALPHA|SCALE|GLOW)|MAX_AGE|(?:RIBBON|WIND|INTERP_(?:COLOR|SCALE)|BOUNCE|FOLLOW_(?:SRC|VELOCITY)|TARGET_(?:POS|LINEAR)|EMISSIVE)_MASK)|SRC_(?:MAX_AGE|PATTERN|ANGLE_(?:BEGIN|END)|BURST_(?:RATE|PART_COUNT|RADIUS|SPEED_(?:MIN|MAX))|ACCEL|TEXTURE|TARGET_KEY|OMEGA|PATTERN_(?:DROP|EXPLODE|ANGLE(?:_CONE(?:_EMPTY)?)?)))|VEHICLE_(?:REFERENCE_FRAME|TYPE_(?:NONE|SLED|CAR|BOAT|AIRPLANE|BALLOON)|(?:LINEAR|ANGULAR)_(?:FRICTION_TIMESCALE|MOTOR_DIRECTION)|LINEAR_MOTOR_OFFSET|HOVER_(?:HEIGHT|EFFICIENCY|TIMESCALE)|BUOYANCY|(?:LINEAR|ANGULAR)_(?:DEFLECTION_(?:EFFICIENCY|TIMESCALE)|MOTOR_(?:DECAY_)?TIMESCALE)|VERTICAL_ATTRACTION_(?:EFFICIENCY|TIMESCALE)|BANKING_(?:EFFICIENCY|MIX|TIMESCALE)|FLAG_(?:NO_DEFLECTION_UP|LIMIT_(?:ROLL_ONLY|MOTOR_UP)|HOVER_(?:(?:WATER|TERRAIN|UP)_ONLY|GLOBAL_HEIGHT)|MOUSELOOK_(?:STEER|BANK)|CAMERA_DECOUPLED))|PRIM_(?:TYPE(?:_(?:BOX|CYLINDER|PRISM|SPHERE|TORUS|TUBE|RING|SCULPT))?|HOLE_(?:DEFAULT|CIRCLE|SQUARE|TRIANGLE)|MATERIAL(?:_(?:STONE|METAL|GLASS|WOOD|FLESH|PLASTIC|RUBBER))?|SHINY_(?:NONE|LOW|MEDIUM|HIGH)|BUMP_(?:NONE|BRIGHT|DARK|WOOD|BARK|BRICKS|CHECKER|CONCRETE|TILE|STONE|DISKS|GRAVEL|BLOBS|SIDING|LARGETILE|STUCCO|SUCTION|WEAVE)|TEXGEN_(?:DEFAULT|PLANAR)|SCULPT_(?:TYPE_(?:SPHERE|TORUS|PLANE|CYLINDER|MASK)|FLAG_(?:MIRROR|INVERT))|PHYSICS(?:_(?:SHAPE_(?:CONVEX|NONE|PRIM|TYPE)))?|(?:POS|ROT)_LOCAL|SLICE|TEXT|FLEXIBLE|POINT_LIGHT|TEMP_ON_REZ|PHANTOM|POSITION|SIZE|ROTATION|TEXTURE|NAME|OMEGA|DESC|LINK_TARGET|COLOR|BUMP_SHINY|FULLBRIGHT|TEXGEN|GLOW|MEDIA_(?:ALT_IMAGE_ENABLE|CONTROLS|(?:CURRENT|HOME)_URL|AUTO_(?:LOOP|PLAY|SCALE|ZOOM)|FIRST_CLICK_INTERACT|(?:WIDTH|HEIGHT)_PIXELS|WHITELIST(?:_ENABLE)?|PERMS_(?:INTERACT|CONTROL)|PARAM_MAX|CONTROLS_(?:STANDARD|MINI)|PERM_(?:NONE|OWNER|GROUP|ANYONE)|MAX_(?:URL_LENGTH|WHITELIST_(?:SIZE|COUNT)|(?:WIDTH|HEIGHT)_PIXELS)))|MASK_(?:BASE|OWNER|GROUP|EVERYONE|NEXT)|PERM_(?:TRANSFER|MODIFY|COPY|MOVE|ALL)|PARCEL_(?:MEDIA_COMMAND_(?:STOP|PAUSE|PLAY|LOOP|TEXTURE|URL|TIME|AGENT|UNLOAD|AUTO_ALIGN|TYPE|SIZE|DESC|LOOP_SET)|FLAG_(?:ALLOW_(?:FLY|(?:GROUP_)?SCRIPTS|LANDMARK|TERRAFORM|DAMAGE|CREATE_(?:GROUP_)?OBJECTS)|USE_(?:ACCESS_(?:GROUP|LIST)|BAN_LIST|LAND_PASS_LIST)|LOCAL_SOUND_ONLY|RESTRICT_PUSHOBJECT|ALLOW_(?:GROUP|ALL)_OBJECT_ENTRY)|COUNT_(?:TOTAL|OWNER|GROUP|OTHER|SELECTED|TEMP)|DETAILS_(?:NAME|DESC|OWNER|GROUP|AREA|ID|SEE_AVATARS))|LIST_STAT_(?:MAX|MIN|MEAN|MEDIAN|STD_DEV|SUM(?:_SQUARES)?|NUM_COUNT|GEOMETRIC_MEAN|RANGE)|PAY_(?:HIDE|DEFAULT)|REGION_FLAG_(?:ALLOW_DAMAGE|FIXED_SUN|BLOCK_TERRAFORM|SANDBOX|DISABLE_(?:COLLISIONS|PHYSICS)|BLOCK_FLY|ALLOW_DIRECT_TELEPORT|RESTRICT_PUSHOBJECT)|HTTP_(?:METHOD|MIMETYPE|BODY_(?:MAXLENGTH|TRUNCATED)|CUSTOM_HEADER|PRAGMA_NO_CACHE|VERBOSE_THROTTLE|VERIFY_CERT)|STRING_(?:TRIM(?:_(?:HEAD|TAIL))?)|CLICK_ACTION_(?:NONE|TOUCH|SIT|BUY|PAY|OPEN(?:_MEDIA)?|PLAY|ZOOM)|TOUCH_INVALID_FACE|PROFILE_(?:NONE|SCRIPT_MEMORY)|RC_(?:DATA_FLAGS|DETECT_PHANTOM|GET_(?:LINK_NUM|NORMAL|ROOT_KEY)|MAX_HITS|REJECT_(?:TYPES|AGENTS|(?:NON)?PHYSICAL|LAND))|RCERR_(?:CAST_TIME_EXCEEDED|SIM_PERF_LOW|UNKNOWN)|ESTATE_ACCESS_(?:ALLOWED_(?:AGENT|GROUP)_(?:ADD|REMOVE)|BANNED_AGENT_(?:ADD|REMOVE))|DENSITY|FRICTION|RESTITUTION|GRAVITY_MULTIPLIER|KFM_(?:COMMAND|CMD_(?:PLAY|STOP|PAUSE|SET_MODE)|MODE|FORWARD|LOOP|PING_PONG|REVERSE|DATA|ROTATION|TRANSLATION)|ERR_(?:GENERIC|PARCEL_PERMISSIONS|MALFORMED_PARAMS|RUNTIME_PERMISSIONS|THROTTLED)|CHARACTER_(?:CMD_(?:(?:SMOOTH_)?STOP|JUMP)|DESIRED_(?:TURN_)?SPEED|RADIUS|STAY_WITHIN_PARCEL|LENGTH|ORIENTATION|ACCOUNT_FOR_SKIPPED_FRAMES|AVOIDANCE_MODE|TYPE(?:_(?:[A-D]|NONE))?|MAX_(?:DECEL|TURN_RADIUS|(?:ACCEL|SPEED)))|PURSUIT_(?:OFFSET|FUZZ_FACTOR|GOAL_TOLERANCE|INTERCEPT)|REQUIRE_LINE_OF_SIGHT|FORCE_DIRECT_PATH|VERTICAL|HORIZONTAL|AVOID_(?:CHARACTERS|DYNAMIC_OBSTACLES|NONE)|PU_(?:EVADE_(?:HIDDEN|SPOTTED)|FAILURE_(?:DYNAMIC_PATHFINDING_DISABLED|INVALID_(?:GOAL|START)|NO_(?:NAVMESH|VALID_DESTINATION)|OTHER|TARGET_GONE|(?:PARCEL_)?UNREACHABLE)|(?:GOAL|SLOWDOWN_DISTANCE)_REACHED)|TRAVERSAL_TYPE(?:_(?:FAST|NONE|SLOW))?|CONTENT_TYPE_(?:ATOM|FORM|HTML|JSON|LLSD|RSS|TEXT|XHTML|XML)|GCNP_(?:RADIUS|STATIC)|(?:PATROL|WANDER)_PAUSE_AT_WAYPOINTS|OPT_(?:AVATAR|CHARACTER|EXCLUSION_VOLUME|LEGACY_LINKSET|MATERIAL_VOLUME|OTHER|STATIC_OBSTACLE|WALKABLE)|SIM_STAT_PCT_CHARS_STEPPED)\b'
676
+ lsl_constants_integer_boolean = r'\b(?:FALSE|TRUE)\b'
677
+ lsl_constants_rotation = r'\b(?:ZERO_ROTATION)\b'
678
+ lsl_constants_string = r'\b(?:EOF|JSON_(?:ARRAY|DELETE|FALSE|INVALID|NULL|NUMBER|OBJECT|STRING|TRUE)|NULL_KEY|TEXTURE_(?:BLANK|DEFAULT|MEDIA|PLYWOOD|TRANSPARENT)|URL_REQUEST_(?:GRANTED|DENIED))\b'
679
+ lsl_constants_vector = r'\b(?:TOUCH_INVALID_(?:TEXCOORD|VECTOR)|ZERO_VECTOR)\b'
680
+ lsl_invalid_broken = r'\b(?:LAND_(?:LARGE|MEDIUM|SMALL)_BRUSH)\b'
681
+ lsl_invalid_deprecated = r'\b(?:ATTACH_[LR]PEC|DATA_RATING|OBJECT_ATTACHMENT_(?:GEOMETRY_BYTES|SURFACE_AREA)|PRIM_(?:CAST_SHADOWS|MATERIAL_LIGHT|TYPE_LEGACY)|PSYS_SRC_(?:INNER|OUTER)ANGLE|VEHICLE_FLAG_NO_FLY_UP|ll(?:Cloud|Make(?:Explosion|Fountain|Smoke|Fire)|RemoteDataSetRegion|Sound(?:Preload)?|XorBase64Strings(?:Correct)?))\b'
682
+ lsl_invalid_illegal = r'\b(?:event)\b'
683
+ lsl_invalid_unimplemented = r'\b(?:CHARACTER_(?:MAX_ANGULAR_(?:ACCEL|SPEED)|TURN_SPEED_MULTIPLIER)|PERMISSION_(?:CHANGE_(?:JOINTS|PERMISSIONS)|RELEASE_OWNERSHIP|REMAP_CONTROLS)|PRIM_PHYSICS_MATERIAL|PSYS_SRC_OBJ_REL_MASK|ll(?:CollisionSprite|(?:Stop)?PointAt|(?:(?:Refresh|Set)Prim)URL|(?:Take|Release)Camera|RemoteLoadScript))\b'
684
+ lsl_reserved_godmode = r'\b(?:ll(?:GodLikeRezObject|Set(?:Inventory|Object)PermMask))\b'
685
+ lsl_reserved_log = r'\b(?:print)\b'
686
+ lsl_operators = r'\+\+|\-\-|<<|>>|&&?|\|\|?|\^|~|[!%<>=*+\-/]=?'
687
+
688
+ tokens = {
689
+ 'root':
690
+ [
691
+ (r'//.*?\n', Comment.Single),
692
+ (r'/\*', Comment.Multiline, 'comment'),
693
+ (r'"', String.Double, 'string'),
694
+ (lsl_keywords, Keyword),
695
+ (lsl_types, Keyword.Type),
696
+ (lsl_states, Name.Class),
697
+ (lsl_events, Name.Builtin),
698
+ (lsl_functions_builtin, Name.Function),
699
+ (lsl_constants_float, Keyword.Constant),
700
+ (lsl_constants_integer, Keyword.Constant),
701
+ (lsl_constants_integer_boolean, Keyword.Constant),
702
+ (lsl_constants_rotation, Keyword.Constant),
703
+ (lsl_constants_string, Keyword.Constant),
704
+ (lsl_constants_vector, Keyword.Constant),
705
+ (lsl_invalid_broken, Error),
706
+ (lsl_invalid_deprecated, Error),
707
+ (lsl_invalid_illegal, Error),
708
+ (lsl_invalid_unimplemented, Error),
709
+ (lsl_reserved_godmode, Keyword.Reserved),
710
+ (lsl_reserved_log, Keyword.Reserved),
711
+ (r'\b([a-zA-Z_]\w*)\b', Name.Variable),
712
+ (r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d*', Number.Float),
713
+ (r'(\d+\.\d*|\.\d+)', Number.Float),
714
+ (r'0[xX][0-9a-fA-F]+', Number.Hex),
715
+ (r'\d+', Number.Integer),
716
+ (lsl_operators, Operator),
717
+ (r':=?', Error),
718
+ (r'[,;{}()\[\]]', Punctuation),
719
+ (r'\n+', Whitespace),
720
+ (r'\s+', Whitespace)
721
+ ],
722
+ 'comment':
723
+ [
724
+ (r'[^*/]+', Comment.Multiline),
725
+ (r'/\*', Comment.Multiline, '#push'),
726
+ (r'\*/', Comment.Multiline, '#pop'),
727
+ (r'[*/]', Comment.Multiline)
728
+ ],
729
+ 'string':
730
+ [
731
+ (r'\\([nt"\\])', String.Escape),
732
+ (r'"', String.Double, '#pop'),
733
+ (r'\\.', Error),
734
+ (r'[^"\\]+', String.Double),
735
+ ]
736
+ }
737
+
738
+
739
+ class AppleScriptLexer(RegexLexer):
740
+ """
741
+ For AppleScript source code,
742
+ including `AppleScript Studio
743
+ <http://developer.apple.com/documentation/AppleScript/
744
+ Reference/StudioReference>`_.
745
+ Contributed by Andreas Amann <aamann@mac.com>.
746
+ """
747
+
748
+ name = 'AppleScript'
749
+ url = 'https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html'
750
+ aliases = ['applescript']
751
+ filenames = ['*.applescript']
752
+ version_added = '1.0'
753
+
754
+ flags = re.MULTILINE | re.DOTALL
755
+
756
+ Identifiers = r'[a-zA-Z]\w*'
757
+
758
+ # XXX: use words() for all of these
759
+ Literals = ('AppleScript', 'current application', 'false', 'linefeed',
760
+ 'missing value', 'pi', 'quote', 'result', 'return', 'space',
761
+ 'tab', 'text item delimiters', 'true', 'version')
762
+ Classes = ('alias ', 'application ', 'boolean ', 'class ', 'constant ',
763
+ 'date ', 'file ', 'integer ', 'list ', 'number ', 'POSIX file ',
764
+ 'real ', 'record ', 'reference ', 'RGB color ', 'script ',
765
+ 'text ', 'unit types', '(?:Unicode )?text', 'string')
766
+ BuiltIn = ('attachment', 'attribute run', 'character', 'day', 'month',
767
+ 'paragraph', 'word', 'year')
768
+ HandlerParams = ('about', 'above', 'against', 'apart from', 'around',
769
+ 'aside from', 'at', 'below', 'beneath', 'beside',
770
+ 'between', 'for', 'given', 'instead of', 'on', 'onto',
771
+ 'out of', 'over', 'since')
772
+ Commands = ('ASCII (character|number)', 'activate', 'beep', 'choose URL',
773
+ 'choose application', 'choose color', 'choose file( name)?',
774
+ 'choose folder', 'choose from list',
775
+ 'choose remote application', 'clipboard info',
776
+ 'close( access)?', 'copy', 'count', 'current date', 'delay',
777
+ 'delete', 'display (alert|dialog)', 'do shell script',
778
+ 'duplicate', 'exists', 'get eof', 'get volume settings',
779
+ 'info for', 'launch', 'list (disks|folder)', 'load script',
780
+ 'log', 'make', 'mount volume', 'new', 'offset',
781
+ 'open( (for access|location))?', 'path to', 'print', 'quit',
782
+ 'random number', 'read', 'round', 'run( script)?',
783
+ 'say', 'scripting components',
784
+ 'set (eof|the clipboard to|volume)', 'store script',
785
+ 'summarize', 'system attribute', 'system info',
786
+ 'the clipboard', 'time to GMT', 'write', 'quoted form')
787
+ References = ('(in )?back of', '(in )?front of', '[0-9]+(st|nd|rd|th)',
788
+ 'first', 'second', 'third', 'fourth', 'fifth', 'sixth',
789
+ 'seventh', 'eighth', 'ninth', 'tenth', 'after', 'back',
790
+ 'before', 'behind', 'every', 'front', 'index', 'last',
791
+ 'middle', 'some', 'that', 'through', 'thru', 'where', 'whose')
792
+ Operators = ("and", "or", "is equal", "equals", "(is )?equal to", "is not",
793
+ "isn't", "isn't equal( to)?", "is not equal( to)?",
794
+ "doesn't equal", "does not equal", "(is )?greater than",
795
+ "comes after", "is not less than or equal( to)?",
796
+ "isn't less than or equal( to)?", "(is )?less than",
797
+ "comes before", "is not greater than or equal( to)?",
798
+ "isn't greater than or equal( to)?",
799
+ "(is )?greater than or equal( to)?", "is not less than",
800
+ "isn't less than", "does not come before",
801
+ "doesn't come before", "(is )?less than or equal( to)?",
802
+ "is not greater than", "isn't greater than",
803
+ "does not come after", "doesn't come after", "starts? with",
804
+ "begins? with", "ends? with", "contains?", "does not contain",
805
+ "doesn't contain", "is in", "is contained by", "is not in",
806
+ "is not contained by", "isn't contained by", "div", "mod",
807
+ "not", "(a )?(ref( to)?|reference to)", "is", "does")
808
+ Control = ('considering', 'else', 'error', 'exit', 'from', 'if',
809
+ 'ignoring', 'in', 'repeat', 'tell', 'then', 'times', 'to',
810
+ 'try', 'until', 'using terms from', 'while', 'whith',
811
+ 'with timeout( of)?', 'with transaction', 'by', 'continue',
812
+ 'end', 'its?', 'me', 'my', 'return', 'of', 'as')
813
+ Declarations = ('global', 'local', 'prop(erty)?', 'set', 'get')
814
+ Reserved = ('but', 'put', 'returning', 'the')
815
+ StudioClasses = ('action cell', 'alert reply', 'application', 'box',
816
+ 'browser( cell)?', 'bundle', 'button( cell)?', 'cell',
817
+ 'clip view', 'color well', 'color-panel',
818
+ 'combo box( item)?', 'control',
819
+ 'data( (cell|column|item|row|source))?', 'default entry',
820
+ 'dialog reply', 'document', 'drag info', 'drawer',
821
+ 'event', 'font(-panel)?', 'formatter',
822
+ 'image( (cell|view))?', 'matrix', 'menu( item)?', 'item',
823
+ 'movie( view)?', 'open-panel', 'outline view', 'panel',
824
+ 'pasteboard', 'plugin', 'popup button',
825
+ 'progress indicator', 'responder', 'save-panel',
826
+ 'scroll view', 'secure text field( cell)?', 'slider',
827
+ 'sound', 'split view', 'stepper', 'tab view( item)?',
828
+ 'table( (column|header cell|header view|view))',
829
+ 'text( (field( cell)?|view))?', 'toolbar( item)?',
830
+ 'user-defaults', 'view', 'window')
831
+ StudioEvents = ('accept outline drop', 'accept table drop', 'action',
832
+ 'activated', 'alert ended', 'awake from nib', 'became key',
833
+ 'became main', 'begin editing', 'bounds changed',
834
+ 'cell value', 'cell value changed', 'change cell value',
835
+ 'change item value', 'changed', 'child of item',
836
+ 'choose menu item', 'clicked', 'clicked toolbar item',
837
+ 'closed', 'column clicked', 'column moved',
838
+ 'column resized', 'conclude drop', 'data representation',
839
+ 'deminiaturized', 'dialog ended', 'document nib name',
840
+ 'double clicked', 'drag( (entered|exited|updated))?',
841
+ 'drop', 'end editing', 'exposed', 'idle', 'item expandable',
842
+ 'item value', 'item value changed', 'items changed',
843
+ 'keyboard down', 'keyboard up', 'launched',
844
+ 'load data representation', 'miniaturized', 'mouse down',
845
+ 'mouse dragged', 'mouse entered', 'mouse exited',
846
+ 'mouse moved', 'mouse up', 'moved',
847
+ 'number of browser rows', 'number of items',
848
+ 'number of rows', 'open untitled', 'opened', 'panel ended',
849
+ 'parameters updated', 'plugin loaded', 'prepare drop',
850
+ 'prepare outline drag', 'prepare outline drop',
851
+ 'prepare table drag', 'prepare table drop',
852
+ 'read from file', 'resigned active', 'resigned key',
853
+ 'resigned main', 'resized( sub views)?',
854
+ 'right mouse down', 'right mouse dragged',
855
+ 'right mouse up', 'rows changed', 'scroll wheel',
856
+ 'selected tab view item', 'selection changed',
857
+ 'selection changing', 'should begin editing',
858
+ 'should close', 'should collapse item',
859
+ 'should end editing', 'should expand item',
860
+ 'should open( untitled)?',
861
+ 'should quit( after last window closed)?',
862
+ 'should select column', 'should select item',
863
+ 'should select row', 'should select tab view item',
864
+ 'should selection change', 'should zoom', 'shown',
865
+ 'update menu item', 'update parameters',
866
+ 'update toolbar item', 'was hidden', 'was miniaturized',
867
+ 'will become active', 'will close', 'will dismiss',
868
+ 'will display browser cell', 'will display cell',
869
+ 'will display item cell', 'will display outline cell',
870
+ 'will finish launching', 'will hide', 'will miniaturize',
871
+ 'will move', 'will open', 'will pop up', 'will quit',
872
+ 'will resign active', 'will resize( sub views)?',
873
+ 'will select tab view item', 'will show', 'will zoom',
874
+ 'write to file', 'zoomed')
875
+ StudioCommands = ('animate', 'append', 'call method', 'center',
876
+ 'close drawer', 'close panel', 'display',
877
+ 'display alert', 'display dialog', 'display panel', 'go',
878
+ 'hide', 'highlight', 'increment', 'item for',
879
+ 'load image', 'load movie', 'load nib', 'load panel',
880
+ 'load sound', 'localized string', 'lock focus', 'log',
881
+ 'open drawer', 'path for', 'pause', 'perform action',
882
+ 'play', 'register', 'resume', 'scroll', 'select( all)?',
883
+ 'show', 'size to fit', 'start', 'step back',
884
+ 'step forward', 'stop', 'synchronize', 'unlock focus',
885
+ 'update')
886
+ StudioProperties = ('accepts arrow key', 'action method', 'active',
887
+ 'alignment', 'allowed identifiers',
888
+ 'allows branch selection', 'allows column reordering',
889
+ 'allows column resizing', 'allows column selection',
890
+ 'allows customization',
891
+ 'allows editing text attributes',
892
+ 'allows empty selection', 'allows mixed state',
893
+ 'allows multiple selection', 'allows reordering',
894
+ 'allows undo', 'alpha( value)?', 'alternate image',
895
+ 'alternate increment value', 'alternate title',
896
+ 'animation delay', 'associated file name',
897
+ 'associated object', 'auto completes', 'auto display',
898
+ 'auto enables items', 'auto repeat',
899
+ 'auto resizes( outline column)?',
900
+ 'auto save expanded items', 'auto save name',
901
+ 'auto save table columns', 'auto saves configuration',
902
+ 'auto scroll', 'auto sizes all columns to fit',
903
+ 'auto sizes cells', 'background color', 'bezel state',
904
+ 'bezel style', 'bezeled', 'border rect', 'border type',
905
+ 'bordered', 'bounds( rotation)?', 'box type',
906
+ 'button returned', 'button type',
907
+ 'can choose directories', 'can choose files',
908
+ 'can draw', 'can hide',
909
+ 'cell( (background color|size|type))?', 'characters',
910
+ 'class', 'click count', 'clicked( data)? column',
911
+ 'clicked data item', 'clicked( data)? row',
912
+ 'closeable', 'collating', 'color( (mode|panel))',
913
+ 'command key down', 'configuration',
914
+ 'content(s| (size|view( margins)?))?', 'context',
915
+ 'continuous', 'control key down', 'control size',
916
+ 'control tint', 'control view',
917
+ 'controller visible', 'coordinate system',
918
+ 'copies( on scroll)?', 'corner view', 'current cell',
919
+ 'current column', 'current( field)? editor',
920
+ 'current( menu)? item', 'current row',
921
+ 'current tab view item', 'data source',
922
+ 'default identifiers', 'delta (x|y|z)',
923
+ 'destination window', 'directory', 'display mode',
924
+ 'displayed cell', 'document( (edited|rect|view))?',
925
+ 'double value', 'dragged column', 'dragged distance',
926
+ 'dragged items', 'draws( cell)? background',
927
+ 'draws grid', 'dynamically scrolls', 'echos bullets',
928
+ 'edge', 'editable', 'edited( data)? column',
929
+ 'edited data item', 'edited( data)? row', 'enabled',
930
+ 'enclosing scroll view', 'ending page',
931
+ 'error handling', 'event number', 'event type',
932
+ 'excluded from windows menu', 'executable path',
933
+ 'expanded', 'fax number', 'field editor', 'file kind',
934
+ 'file name', 'file type', 'first responder',
935
+ 'first visible column', 'flipped', 'floating',
936
+ 'font( panel)?', 'formatter', 'frameworks path',
937
+ 'frontmost', 'gave up', 'grid color', 'has data items',
938
+ 'has horizontal ruler', 'has horizontal scroller',
939
+ 'has parent data item', 'has resize indicator',
940
+ 'has shadow', 'has sub menu', 'has vertical ruler',
941
+ 'has vertical scroller', 'header cell', 'header view',
942
+ 'hidden', 'hides when deactivated', 'highlights by',
943
+ 'horizontal line scroll', 'horizontal page scroll',
944
+ 'horizontal ruler view', 'horizontally resizable',
945
+ 'icon image', 'id', 'identifier',
946
+ 'ignores multiple clicks',
947
+ 'image( (alignment|dims when disabled|frame style|scaling))?',
948
+ 'imports graphics', 'increment value',
949
+ 'indentation per level', 'indeterminate', 'index',
950
+ 'integer value', 'intercell spacing', 'item height',
951
+ 'key( (code|equivalent( modifier)?|window))?',
952
+ 'knob thickness', 'label', 'last( visible)? column',
953
+ 'leading offset', 'leaf', 'level', 'line scroll',
954
+ 'loaded', 'localized sort', 'location', 'loop mode',
955
+ 'main( (bunde|menu|window))?', 'marker follows cell',
956
+ 'matrix mode', 'maximum( content)? size',
957
+ 'maximum visible columns',
958
+ 'menu( form representation)?', 'miniaturizable',
959
+ 'miniaturized', 'minimized image', 'minimized title',
960
+ 'minimum column width', 'minimum( content)? size',
961
+ 'modal', 'modified', 'mouse down state',
962
+ 'movie( (controller|file|rect))?', 'muted', 'name',
963
+ 'needs display', 'next state', 'next text',
964
+ 'number of tick marks', 'only tick mark values',
965
+ 'opaque', 'open panel', 'option key down',
966
+ 'outline table column', 'page scroll', 'pages across',
967
+ 'pages down', 'palette label', 'pane splitter',
968
+ 'parent data item', 'parent window', 'pasteboard',
969
+ 'path( (names|separator))?', 'playing',
970
+ 'plays every frame', 'plays selection only', 'position',
971
+ 'preferred edge', 'preferred type', 'pressure',
972
+ 'previous text', 'prompt', 'properties',
973
+ 'prototype cell', 'pulls down', 'rate',
974
+ 'released when closed', 'repeated',
975
+ 'requested print time', 'required file type',
976
+ 'resizable', 'resized column', 'resource path',
977
+ 'returns records', 'reuses columns', 'rich text',
978
+ 'roll over', 'row height', 'rulers visible',
979
+ 'save panel', 'scripts path', 'scrollable',
980
+ 'selectable( identifiers)?', 'selected cell',
981
+ 'selected( data)? columns?', 'selected data items?',
982
+ 'selected( data)? rows?', 'selected item identifier',
983
+ 'selection by rect', 'send action on arrow key',
984
+ 'sends action when done editing', 'separates columns',
985
+ 'separator item', 'sequence number', 'services menu',
986
+ 'shared frameworks path', 'shared support path',
987
+ 'sheet', 'shift key down', 'shows alpha',
988
+ 'shows state by', 'size( mode)?',
989
+ 'smart insert delete enabled', 'sort case sensitivity',
990
+ 'sort column', 'sort order', 'sort type',
991
+ 'sorted( data rows)?', 'sound', 'source( mask)?',
992
+ 'spell checking enabled', 'starting page', 'state',
993
+ 'string value', 'sub menu', 'super menu', 'super view',
994
+ 'tab key traverses cells', 'tab state', 'tab type',
995
+ 'tab view', 'table view', 'tag', 'target( printer)?',
996
+ 'text color', 'text container insert',
997
+ 'text container origin', 'text returned',
998
+ 'tick mark position', 'time stamp',
999
+ 'title(d| (cell|font|height|position|rect))?',
1000
+ 'tool tip', 'toolbar', 'trailing offset', 'transparent',
1001
+ 'treat packages as directories', 'truncated labels',
1002
+ 'types', 'unmodified characters', 'update views',
1003
+ 'use sort indicator', 'user defaults',
1004
+ 'uses data source', 'uses ruler',
1005
+ 'uses threaded animation',
1006
+ 'uses title from previous column', 'value wraps',
1007
+ 'version',
1008
+ 'vertical( (line scroll|page scroll|ruler view))?',
1009
+ 'vertically resizable', 'view',
1010
+ 'visible( document rect)?', 'volume', 'width', 'window',
1011
+ 'windows menu', 'wraps', 'zoomable', 'zoomed')
1012
+
1013
+ tokens = {
1014
+ 'root': [
1015
+ (r'\s+', Text),
1016
+ (r'¬\n', String.Escape),
1017
+ (r"'s\s+", Text), # This is a possessive, consider moving
1018
+ (r'(--|#).*?$', Comment),
1019
+ (r'\(\*', Comment.Multiline, 'comment'),
1020
+ (r'[(){}!,.:]', Punctuation),
1021
+ (r'(«)([^»]+)(»)',
1022
+ bygroups(Text, Name.Builtin, Text)),
1023
+ (r'\b((?:considering|ignoring)\s*)'
1024
+ r'(application responses|case|diacriticals|hyphens|'
1025
+ r'numeric strings|punctuation|white space)',
1026
+ bygroups(Keyword, Name.Builtin)),
1027
+ (r'(-|\*|\+|&|≠|>=?|<=?|=|≥|≤|/|÷|\^)', Operator),
1028
+ (r"\b({})\b".format('|'.join(Operators)), Operator.Word),
1029
+ (r'^(\s*(?:on|end)\s+)'
1030
+ r'({})'.format('|'.join(StudioEvents[::-1])),
1031
+ bygroups(Keyword, Name.Function)),
1032
+ (r'^(\s*)(in|on|script|to)(\s+)', bygroups(Text, Keyword, Text)),
1033
+ (r'\b(as )({})\b'.format('|'.join(Classes)),
1034
+ bygroups(Keyword, Name.Class)),
1035
+ (r'\b({})\b'.format('|'.join(Literals)), Name.Constant),
1036
+ (r'\b({})\b'.format('|'.join(Commands)), Name.Builtin),
1037
+ (r'\b({})\b'.format('|'.join(Control)), Keyword),
1038
+ (r'\b({})\b'.format('|'.join(Declarations)), Keyword),
1039
+ (r'\b({})\b'.format('|'.join(Reserved)), Name.Builtin),
1040
+ (r'\b({})s?\b'.format('|'.join(BuiltIn)), Name.Builtin),
1041
+ (r'\b({})\b'.format('|'.join(HandlerParams)), Name.Builtin),
1042
+ (r'\b({})\b'.format('|'.join(StudioProperties)), Name.Attribute),
1043
+ (r'\b({})s?\b'.format('|'.join(StudioClasses)), Name.Builtin),
1044
+ (r'\b({})\b'.format('|'.join(StudioCommands)), Name.Builtin),
1045
+ (r'\b({})\b'.format('|'.join(References)), Name.Builtin),
1046
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
1047
+ (rf'\b({Identifiers})\b', Name.Variable),
1048
+ (r'[-+]?(\d+\.\d*|\d*\.\d+)(E[-+][0-9]+)?', Number.Float),
1049
+ (r'[-+]?\d+', Number.Integer),
1050
+ ],
1051
+ 'comment': [
1052
+ (r'\(\*', Comment.Multiline, '#push'),
1053
+ (r'\*\)', Comment.Multiline, '#pop'),
1054
+ ('[^*(]+', Comment.Multiline),
1055
+ ('[*(]', Comment.Multiline),
1056
+ ],
1057
+ }
1058
+
1059
+
1060
+ class RexxLexer(RegexLexer):
1061
+ """
1062
+ Rexx is a scripting language available for
1063
+ a wide range of different platforms with its roots found on mainframe
1064
+ systems. It is popular for I/O- and data based tasks and can act as glue
1065
+ language to bind different applications together.
1066
+ """
1067
+ name = 'Rexx'
1068
+ url = 'http://www.rexxinfo.org/'
1069
+ aliases = ['rexx', 'arexx']
1070
+ filenames = ['*.rexx', '*.rex', '*.rx', '*.arexx']
1071
+ mimetypes = ['text/x-rexx']
1072
+ version_added = '2.0'
1073
+ flags = re.IGNORECASE
1074
+
1075
+ tokens = {
1076
+ 'root': [
1077
+ (r'\s+', Whitespace),
1078
+ (r'/\*', Comment.Multiline, 'comment'),
1079
+ (r'"', String, 'string_double'),
1080
+ (r"'", String, 'string_single'),
1081
+ (r'[0-9]+(\.[0-9]+)?(e[+-]?[0-9])?', Number),
1082
+ (r'([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b',
1083
+ bygroups(Name.Function, Whitespace, Operator, Whitespace,
1084
+ Keyword.Declaration)),
1085
+ (r'([a-z_]\w*)(\s*)(:)',
1086
+ bygroups(Name.Label, Whitespace, Operator)),
1087
+ include('function'),
1088
+ include('keyword'),
1089
+ include('operator'),
1090
+ (r'[a-z_]\w*', Text),
1091
+ ],
1092
+ 'function': [
1093
+ (words((
1094
+ 'abbrev', 'abs', 'address', 'arg', 'b2x', 'bitand', 'bitor', 'bitxor',
1095
+ 'c2d', 'c2x', 'center', 'charin', 'charout', 'chars', 'compare',
1096
+ 'condition', 'copies', 'd2c', 'd2x', 'datatype', 'date', 'delstr',
1097
+ 'delword', 'digits', 'errortext', 'form', 'format', 'fuzz', 'insert',
1098
+ 'lastpos', 'left', 'length', 'linein', 'lineout', 'lines', 'max',
1099
+ 'min', 'overlay', 'pos', 'queued', 'random', 'reverse', 'right', 'sign',
1100
+ 'sourceline', 'space', 'stream', 'strip', 'substr', 'subword', 'symbol',
1101
+ 'time', 'trace', 'translate', 'trunc', 'value', 'verify', 'word',
1102
+ 'wordindex', 'wordlength', 'wordpos', 'words', 'x2b', 'x2c', 'x2d',
1103
+ 'xrange'), suffix=r'(\s*)(\()'),
1104
+ bygroups(Name.Builtin, Whitespace, Operator)),
1105
+ ],
1106
+ 'keyword': [
1107
+ (r'(address|arg|by|call|do|drop|else|end|exit|for|forever|if|'
1108
+ r'interpret|iterate|leave|nop|numeric|off|on|options|parse|'
1109
+ r'pull|push|queue|return|say|select|signal|to|then|trace|until|'
1110
+ r'while)\b', Keyword.Reserved),
1111
+ ],
1112
+ 'operator': [
1113
+ (r'(-|//|/|\(|\)|\*\*|\*|\\<<|\\<|\\==|\\=|\\>>|\\>|\\|\|\||\||'
1114
+ r'&&|&|%|\+|<<=|<<|<=|<>|<|==|=|><|>=|>>=|>>|>|¬<<|¬<|¬==|¬=|'
1115
+ r'¬>>|¬>|¬|\.|,)', Operator),
1116
+ ],
1117
+ 'string_double': [
1118
+ (r'[^"\n]+', String),
1119
+ (r'""', String),
1120
+ (r'"', String, '#pop'),
1121
+ (r'\n', Text, '#pop'), # Stray linefeed also terminates strings.
1122
+ ],
1123
+ 'string_single': [
1124
+ (r'[^\'\n]+', String),
1125
+ (r'\'\'', String),
1126
+ (r'\'', String, '#pop'),
1127
+ (r'\n', Text, '#pop'), # Stray linefeed also terminates strings.
1128
+ ],
1129
+ 'comment': [
1130
+ (r'[^*]+', Comment.Multiline),
1131
+ (r'\*/', Comment.Multiline, '#pop'),
1132
+ (r'\*', Comment.Multiline),
1133
+ ]
1134
+ }
1135
+
1136
+ def _c(s):
1137
+ return re.compile(s, re.MULTILINE)
1138
+ _ADDRESS_COMMAND_PATTERN = _c(r'^\s*address\s+command\b')
1139
+ _ADDRESS_PATTERN = _c(r'^\s*address\s+')
1140
+ _DO_WHILE_PATTERN = _c(r'^\s*do\s+while\b')
1141
+ _IF_THEN_DO_PATTERN = _c(r'^\s*if\b.+\bthen\s+do\s*$')
1142
+ _PROCEDURE_PATTERN = _c(r'^\s*([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b')
1143
+ _ELSE_DO_PATTERN = _c(r'\belse\s+do\s*$')
1144
+ _PARSE_ARG_PATTERN = _c(r'^\s*parse\s+(upper\s+)?(arg|value)\b')
1145
+ PATTERNS_AND_WEIGHTS = (
1146
+ (_ADDRESS_COMMAND_PATTERN, 0.2),
1147
+ (_ADDRESS_PATTERN, 0.05),
1148
+ (_DO_WHILE_PATTERN, 0.1),
1149
+ (_ELSE_DO_PATTERN, 0.1),
1150
+ (_IF_THEN_DO_PATTERN, 0.1),
1151
+ (_PROCEDURE_PATTERN, 0.5),
1152
+ (_PARSE_ARG_PATTERN, 0.2),
1153
+ )
1154
+
1155
+ def analyse_text(text):
1156
+ """
1157
+ Check for initial comment and patterns that distinguish Rexx from other
1158
+ C-like languages.
1159
+ """
1160
+ if re.search(r'/\*\**\s*rexx', text, re.IGNORECASE):
1161
+ # Header matches MVS Rexx requirements, this is certainly a Rexx
1162
+ # script.
1163
+ return 1.0
1164
+ elif text.startswith('/*'):
1165
+ # Header matches general Rexx requirements; the source code might
1166
+ # still be any language using C comments such as C++, C# or Java.
1167
+ lowerText = text.lower()
1168
+ result = sum(weight
1169
+ for (pattern, weight) in RexxLexer.PATTERNS_AND_WEIGHTS
1170
+ if pattern.search(lowerText)) + 0.01
1171
+ return min(result, 1.0)
1172
+
1173
+
1174
+ class MOOCodeLexer(RegexLexer):
1175
+ """
1176
+ For MOOCode (the MOO scripting language).
1177
+ """
1178
+ name = 'MOOCode'
1179
+ url = 'http://www.moo.mud.org/'
1180
+ filenames = ['*.moo']
1181
+ aliases = ['moocode', 'moo']
1182
+ mimetypes = ['text/x-moocode']
1183
+ version_added = '0.9'
1184
+
1185
+ tokens = {
1186
+ 'root': [
1187
+ # Numbers
1188
+ (r'(0|[1-9][0-9_]*)', Number.Integer),
1189
+ # Strings
1190
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
1191
+ # exceptions
1192
+ (r'(E_PERM|E_DIV)', Name.Exception),
1193
+ # db-refs
1194
+ (r'((#[-0-9]+)|(\$\w+))', Name.Entity),
1195
+ # Keywords
1196
+ (r'\b(if|else|elseif|endif|for|endfor|fork|endfork|while'
1197
+ r'|endwhile|break|continue|return|try'
1198
+ r'|except|endtry|finally|in)\b', Keyword),
1199
+ # builtins
1200
+ (r'(random|length)', Name.Builtin),
1201
+ # special variables
1202
+ (r'(player|caller|this|args)', Name.Variable.Instance),
1203
+ # skip whitespace
1204
+ (r'\s+', Text),
1205
+ (r'\n', Text),
1206
+ # other operators
1207
+ (r'([!;=,{}&|:.\[\]@()<>?]+)', Operator),
1208
+ # function call
1209
+ (r'(\w+)(\()', bygroups(Name.Function, Operator)),
1210
+ # variables
1211
+ (r'(\w+)', Text),
1212
+ ]
1213
+ }
1214
+
1215
+
1216
+ class HybrisLexer(RegexLexer):
1217
+ """
1218
+ For Hybris source code.
1219
+ """
1220
+
1221
+ name = 'Hybris'
1222
+ aliases = ['hybris']
1223
+ filenames = ['*.hyb']
1224
+ mimetypes = ['text/x-hybris', 'application/x-hybris']
1225
+ url = 'https://github.com/evilsocket/hybris'
1226
+ version_added = '1.4'
1227
+
1228
+ flags = re.MULTILINE | re.DOTALL
1229
+
1230
+ tokens = {
1231
+ 'root': [
1232
+ # method names
1233
+ (r'^(\s*(?:function|method|operator\s+)+?)'
1234
+ r'([a-zA-Z_]\w*)'
1235
+ r'(\s*)(\()', bygroups(Keyword, Name.Function, Text, Operator)),
1236
+ (r'[^\S\n]+', Text),
1237
+ (r'//.*?\n', Comment.Single),
1238
+ (r'/\*.*?\*/', Comment.Multiline),
1239
+ (r'@[a-zA-Z_][\w.]*', Name.Decorator),
1240
+ (r'(break|case|catch|next|default|do|else|finally|for|foreach|of|'
1241
+ r'unless|if|new|return|switch|me|throw|try|while)\b', Keyword),
1242
+ (r'(extends|private|protected|public|static|throws|function|method|'
1243
+ r'operator)\b', Keyword.Declaration),
1244
+ (r'(true|false|null|__FILE__|__LINE__|__VERSION__|__LIB_PATH__|'
1245
+ r'__INC_PATH__)\b', Keyword.Constant),
1246
+ (r'(class|struct)(\s+)',
1247
+ bygroups(Keyword.Declaration, Text), 'class'),
1248
+ (r'(import|include)(\s+)',
1249
+ bygroups(Keyword.Namespace, Text), 'import'),
1250
+ (words((
1251
+ 'gc_collect', 'gc_mm_items', 'gc_mm_usage', 'gc_collect_threshold',
1252
+ 'urlencode', 'urldecode', 'base64encode', 'base64decode', 'sha1', 'crc32',
1253
+ 'sha2', 'md5', 'md5_file', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos',
1254
+ 'cosh', 'exp', 'fabs', 'floor', 'fmod', 'log', 'log10', 'pow', 'sin',
1255
+ 'sinh', 'sqrt', 'tan', 'tanh', 'isint', 'isfloat', 'ischar', 'isstring',
1256
+ 'isarray', 'ismap', 'isalias', 'typeof', 'sizeof', 'toint', 'tostring',
1257
+ 'fromxml', 'toxml', 'binary', 'pack', 'load', 'eval', 'var_names',
1258
+ 'var_values', 'user_functions', 'dyn_functions', 'methods', 'call',
1259
+ 'call_method', 'mknod', 'mkfifo', 'mount', 'umount2', 'umount', 'ticks',
1260
+ 'usleep', 'sleep', 'time', 'strtime', 'strdate', 'dllopen', 'dlllink',
1261
+ 'dllcall', 'dllcall_argv', 'dllclose', 'env', 'exec', 'fork', 'getpid',
1262
+ 'wait', 'popen', 'pclose', 'exit', 'kill', 'pthread_create',
1263
+ 'pthread_create_argv', 'pthread_exit', 'pthread_join', 'pthread_kill',
1264
+ 'smtp_send', 'http_get', 'http_post', 'http_download', 'socket', 'bind',
1265
+ 'listen', 'accept', 'getsockname', 'getpeername', 'settimeout', 'connect',
1266
+ 'server', 'recv', 'send', 'close', 'print', 'println', 'printf', 'input',
1267
+ 'readline', 'serial_open', 'serial_fcntl', 'serial_get_attr',
1268
+ 'serial_get_ispeed', 'serial_get_ospeed', 'serial_set_attr',
1269
+ 'serial_set_ispeed', 'serial_set_ospeed', 'serial_write', 'serial_read',
1270
+ 'serial_close', 'xml_load', 'xml_parse', 'fopen', 'fseek', 'ftell',
1271
+ 'fsize', 'fread', 'fwrite', 'fgets', 'fclose', 'file', 'readdir',
1272
+ 'pcre_replace', 'size', 'pop', 'unmap', 'has', 'keys', 'values',
1273
+ 'length', 'find', 'substr', 'replace', 'split', 'trim', 'remove',
1274
+ 'contains', 'join'), suffix=r'\b'),
1275
+ Name.Builtin),
1276
+ (words((
1277
+ 'MethodReference', 'Runner', 'Dll', 'Thread', 'Pipe', 'Process',
1278
+ 'Runnable', 'CGI', 'ClientSocket', 'Socket', 'ServerSocket',
1279
+ 'File', 'Console', 'Directory', 'Exception'), suffix=r'\b'),
1280
+ Keyword.Type),
1281
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
1282
+ (r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
1283
+ (r'(\.)([a-zA-Z_]\w*)',
1284
+ bygroups(Operator, Name.Attribute)),
1285
+ (r'[a-zA-Z_]\w*:', Name.Label),
1286
+ (r'[a-zA-Z_$]\w*', Name),
1287
+ (r'[~^*!%&\[\](){}<>|+=:;,./?\-@]+', Operator),
1288
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
1289
+ (r'0x[0-9a-f]+', Number.Hex),
1290
+ (r'[0-9]+L?', Number.Integer),
1291
+ (r'\n', Text),
1292
+ ],
1293
+ 'class': [
1294
+ (r'[a-zA-Z_]\w*', Name.Class, '#pop')
1295
+ ],
1296
+ 'import': [
1297
+ (r'[\w.]+\*?', Name.Namespace, '#pop')
1298
+ ],
1299
+ }
1300
+
1301
+ def analyse_text(text):
1302
+ """public method and private method don't seem to be quite common
1303
+ elsewhere."""
1304
+ result = 0
1305
+ if re.search(r'\b(?:public|private)\s+method\b', text):
1306
+ result += 0.01
1307
+ return result
1308
+
1309
+
1310
+
1311
+ class EasytrieveLexer(RegexLexer):
1312
+ """
1313
+ Easytrieve Plus is a programming language for extracting, filtering and
1314
+ converting sequential data. Furthermore it can layout data for reports.
1315
+ It is mainly used on mainframe platforms and can access several of the
1316
+ mainframe's native file formats. It is somewhat comparable to awk.
1317
+ """
1318
+ name = 'Easytrieve'
1319
+ aliases = ['easytrieve']
1320
+ filenames = ['*.ezt', '*.mac']
1321
+ mimetypes = ['text/x-easytrieve']
1322
+ url = 'https://www.broadcom.com/products/mainframe/application-development/easytrieve-report-generator'
1323
+ version_added = '2.1'
1324
+ flags = 0
1325
+
1326
+ # Note: We cannot use r'\b' at the start and end of keywords because
1327
+ # Easytrieve Plus delimiter characters are:
1328
+ #
1329
+ # * space ( )
1330
+ # * apostrophe (')
1331
+ # * period (.)
1332
+ # * comma (,)
1333
+ # * parenthesis ( and )
1334
+ # * colon (:)
1335
+ #
1336
+ # Additionally words end once a '*' appears, indicatins a comment.
1337
+ _DELIMITERS = r' \'.,():\n'
1338
+ _DELIMITERS_OR_COMENT = _DELIMITERS + '*'
1339
+ _DELIMITER_PATTERN = '[' + _DELIMITERS + ']'
1340
+ _DELIMITER_PATTERN_CAPTURE = '(' + _DELIMITER_PATTERN + ')'
1341
+ _NON_DELIMITER_OR_COMMENT_PATTERN = '[^' + _DELIMITERS_OR_COMENT + ']'
1342
+ _OPERATORS_PATTERN = '[.+\\-/=\\[\\](){}<>;,&%¬]'
1343
+ _KEYWORDS = [
1344
+ 'AFTER-BREAK', 'AFTER-LINE', 'AFTER-SCREEN', 'AIM', 'AND', 'ATTR',
1345
+ 'BEFORE', 'BEFORE-BREAK', 'BEFORE-LINE', 'BEFORE-SCREEN', 'BUSHU',
1346
+ 'BY', 'CALL', 'CASE', 'CHECKPOINT', 'CHKP', 'CHKP-STATUS', 'CLEAR',
1347
+ 'CLOSE', 'COL', 'COLOR', 'COMMIT', 'CONTROL', 'COPY', 'CURSOR', 'D',
1348
+ 'DECLARE', 'DEFAULT', 'DEFINE', 'DELETE', 'DENWA', 'DISPLAY', 'DLI',
1349
+ 'DO', 'DUPLICATE', 'E', 'ELSE', 'ELSE-IF', 'END', 'END-CASE',
1350
+ 'END-DO', 'END-IF', 'END-PROC', 'ENDPAGE', 'ENDTABLE', 'ENTER', 'EOF',
1351
+ 'EQ', 'ERROR', 'EXIT', 'EXTERNAL', 'EZLIB', 'F1', 'F10', 'F11', 'F12',
1352
+ 'F13', 'F14', 'F15', 'F16', 'F17', 'F18', 'F19', 'F2', 'F20', 'F21',
1353
+ 'F22', 'F23', 'F24', 'F25', 'F26', 'F27', 'F28', 'F29', 'F3', 'F30',
1354
+ 'F31', 'F32', 'F33', 'F34', 'F35', 'F36', 'F4', 'F5', 'F6', 'F7',
1355
+ 'F8', 'F9', 'FETCH', 'FILE-STATUS', 'FILL', 'FINAL', 'FIRST',
1356
+ 'FIRST-DUP', 'FOR', 'GE', 'GET', 'GO', 'GOTO', 'GQ', 'GR', 'GT',
1357
+ 'HEADING', 'HEX', 'HIGH-VALUES', 'IDD', 'IDMS', 'IF', 'IN', 'INSERT',
1358
+ 'JUSTIFY', 'KANJI-DATE', 'KANJI-DATE-LONG', 'KANJI-TIME', 'KEY',
1359
+ 'KEY-PRESSED', 'KOKUGO', 'KUN', 'LAST-DUP', 'LE', 'LEVEL', 'LIKE',
1360
+ 'LINE', 'LINE-COUNT', 'LINE-NUMBER', 'LINK', 'LIST', 'LOW-VALUES',
1361
+ 'LQ', 'LS', 'LT', 'MACRO', 'MASK', 'MATCHED', 'MEND', 'MESSAGE',
1362
+ 'MOVE', 'MSTART', 'NE', 'NEWPAGE', 'NOMASK', 'NOPRINT', 'NOT',
1363
+ 'NOTE', 'NOVERIFY', 'NQ', 'NULL', 'OF', 'OR', 'OTHERWISE', 'PA1',
1364
+ 'PA2', 'PA3', 'PAGE-COUNT', 'PAGE-NUMBER', 'PARM-REGISTER',
1365
+ 'PATH-ID', 'PATTERN', 'PERFORM', 'POINT', 'POS', 'PRIMARY', 'PRINT',
1366
+ 'PROCEDURE', 'PROGRAM', 'PUT', 'READ', 'RECORD', 'RECORD-COUNT',
1367
+ 'RECORD-LENGTH', 'REFRESH', 'RELEASE', 'RENUM', 'REPEAT', 'REPORT',
1368
+ 'REPORT-INPUT', 'RESHOW', 'RESTART', 'RETRIEVE', 'RETURN-CODE',
1369
+ 'ROLLBACK', 'ROW', 'S', 'SCREEN', 'SEARCH', 'SECONDARY', 'SELECT',
1370
+ 'SEQUENCE', 'SIZE', 'SKIP', 'SOKAKU', 'SORT', 'SQL', 'STOP', 'SUM',
1371
+ 'SYSDATE', 'SYSDATE-LONG', 'SYSIN', 'SYSIPT', 'SYSLST', 'SYSPRINT',
1372
+ 'SYSSNAP', 'SYSTIME', 'TALLY', 'TERM-COLUMNS', 'TERM-NAME',
1373
+ 'TERM-ROWS', 'TERMINATION', 'TITLE', 'TO', 'TRANSFER', 'TRC',
1374
+ 'UNIQUE', 'UNTIL', 'UPDATE', 'UPPERCASE', 'USER', 'USERID', 'VALUE',
1375
+ 'VERIFY', 'W', 'WHEN', 'WHILE', 'WORK', 'WRITE', 'X', 'XDM', 'XRST'
1376
+ ]
1377
+
1378
+ tokens = {
1379
+ 'root': [
1380
+ (r'\*.*\n', Comment.Single),
1381
+ (r'\n+', Whitespace),
1382
+ # Macro argument
1383
+ (r'&' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+\.', Name.Variable,
1384
+ 'after_macro_argument'),
1385
+ # Macro call
1386
+ (r'%' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name.Variable),
1387
+ (r'(FILE|MACRO|REPORT)(\s+)',
1388
+ bygroups(Keyword.Declaration, Whitespace), 'after_declaration'),
1389
+ (r'(JOB|PARM)' + r'(' + _DELIMITER_PATTERN + r')',
1390
+ bygroups(Keyword.Declaration, Operator)),
1391
+ (words(_KEYWORDS, suffix=_DELIMITER_PATTERN_CAPTURE),
1392
+ bygroups(Keyword.Reserved, Operator)),
1393
+ (_OPERATORS_PATTERN, Operator),
1394
+ # Procedure declaration
1395
+ (r'(' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+)(\s*)(\.?)(\s*)(PROC)(\s*\n)',
1396
+ bygroups(Name.Function, Whitespace, Operator, Whitespace,
1397
+ Keyword.Declaration, Whitespace)),
1398
+ (r'[0-9]+\.[0-9]*', Number.Float),
1399
+ (r'[0-9]+', Number.Integer),
1400
+ (r"'(''|[^'])*'", String),
1401
+ (r'\s+', Whitespace),
1402
+ # Everything else just belongs to a name
1403
+ (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name),
1404
+ ],
1405
+ 'after_declaration': [
1406
+ (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name.Function),
1407
+ default('#pop'),
1408
+ ],
1409
+ 'after_macro_argument': [
1410
+ (r'\*.*\n', Comment.Single, '#pop'),
1411
+ (r'\s+', Whitespace, '#pop'),
1412
+ (_OPERATORS_PATTERN, Operator, '#pop'),
1413
+ (r"'(''|[^'])*'", String, '#pop'),
1414
+ # Everything else just belongs to a name
1415
+ (_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name),
1416
+ ],
1417
+ }
1418
+ _COMMENT_LINE_REGEX = re.compile(r'^\s*\*')
1419
+ _MACRO_HEADER_REGEX = re.compile(r'^\s*MACRO')
1420
+
1421
+ def analyse_text(text):
1422
+ """
1423
+ Perform a structural analysis for basic Easytrieve constructs.
1424
+ """
1425
+ result = 0.0
1426
+ lines = text.split('\n')
1427
+ hasEndProc = False
1428
+ hasHeaderComment = False
1429
+ hasFile = False
1430
+ hasJob = False
1431
+ hasProc = False
1432
+ hasParm = False
1433
+ hasReport = False
1434
+
1435
+ def isCommentLine(line):
1436
+ return EasytrieveLexer._COMMENT_LINE_REGEX.match(lines[0]) is not None
1437
+
1438
+ def isEmptyLine(line):
1439
+ return not bool(line.strip())
1440
+
1441
+ # Remove possible empty lines and header comments.
1442
+ while lines and (isEmptyLine(lines[0]) or isCommentLine(lines[0])):
1443
+ if not isEmptyLine(lines[0]):
1444
+ hasHeaderComment = True
1445
+ del lines[0]
1446
+
1447
+ if EasytrieveLexer._MACRO_HEADER_REGEX.match(lines[0]):
1448
+ # Looks like an Easytrieve macro.
1449
+ result = 0.4
1450
+ if hasHeaderComment:
1451
+ result += 0.4
1452
+ else:
1453
+ # Scan the source for lines starting with indicators.
1454
+ for line in lines:
1455
+ words = line.split()
1456
+ if (len(words) >= 2):
1457
+ firstWord = words[0]
1458
+ if not hasReport:
1459
+ if not hasJob:
1460
+ if not hasFile:
1461
+ if not hasParm:
1462
+ if firstWord == 'PARM':
1463
+ hasParm = True
1464
+ if firstWord == 'FILE':
1465
+ hasFile = True
1466
+ if firstWord == 'JOB':
1467
+ hasJob = True
1468
+ elif firstWord == 'PROC':
1469
+ hasProc = True
1470
+ elif firstWord == 'END-PROC':
1471
+ hasEndProc = True
1472
+ elif firstWord == 'REPORT':
1473
+ hasReport = True
1474
+
1475
+ # Weight the findings.
1476
+ if hasJob and (hasProc == hasEndProc):
1477
+ if hasHeaderComment:
1478
+ result += 0.1
1479
+ if hasParm:
1480
+ if hasProc:
1481
+ # Found PARM, JOB and PROC/END-PROC:
1482
+ # pretty sure this is Easytrieve.
1483
+ result += 0.8
1484
+ else:
1485
+ # Found PARAM and JOB: probably this is Easytrieve
1486
+ result += 0.5
1487
+ else:
1488
+ # Found JOB and possibly other keywords: might be Easytrieve
1489
+ result += 0.11
1490
+ if hasParm:
1491
+ # Note: PARAM is not a proper English word, so this is
1492
+ # regarded a much better indicator for Easytrieve than
1493
+ # the other words.
1494
+ result += 0.2
1495
+ if hasFile:
1496
+ result += 0.01
1497
+ if hasReport:
1498
+ result += 0.01
1499
+ assert 0.0 <= result <= 1.0
1500
+ return result
1501
+
1502
+
1503
+ class JclLexer(RegexLexer):
1504
+ """
1505
+ Job Control Language (JCL)
1506
+ is a scripting language used on mainframe platforms to instruct the system
1507
+ on how to run a batch job or start a subsystem. It is somewhat
1508
+ comparable to MS DOS batch and Unix shell scripts.
1509
+ """
1510
+ name = 'JCL'
1511
+ aliases = ['jcl']
1512
+ filenames = ['*.jcl']
1513
+ mimetypes = ['text/x-jcl']
1514
+ url = 'https://en.wikipedia.org/wiki/Job_Control_Language'
1515
+ version_added = '2.1'
1516
+
1517
+ flags = re.IGNORECASE
1518
+
1519
+ tokens = {
1520
+ 'root': [
1521
+ (r'//\*.*\n', Comment.Single),
1522
+ (r'//', Keyword.Pseudo, 'statement'),
1523
+ (r'/\*', Keyword.Pseudo, 'jes2_statement'),
1524
+ # TODO: JES3 statement
1525
+ (r'.*\n', Other) # Input text or inline code in any language.
1526
+ ],
1527
+ 'statement': [
1528
+ (r'\s*\n', Whitespace, '#pop'),
1529
+ (r'([a-z]\w*)(\s+)(exec|job)(\s*)',
1530
+ bygroups(Name.Label, Whitespace, Keyword.Reserved, Whitespace),
1531
+ 'option'),
1532
+ (r'[a-z]\w*', Name.Variable, 'statement_command'),
1533
+ (r'\s+', Whitespace, 'statement_command'),
1534
+ ],
1535
+ 'statement_command': [
1536
+ (r'\s+(command|cntl|dd|endctl|endif|else|include|jcllib|'
1537
+ r'output|pend|proc|set|then|xmit)\s+', Keyword.Reserved, 'option'),
1538
+ include('option')
1539
+ ],
1540
+ 'jes2_statement': [
1541
+ (r'\s*\n', Whitespace, '#pop'),
1542
+ (r'\$', Keyword, 'option'),
1543
+ (r'\b(jobparam|message|netacct|notify|output|priority|route|'
1544
+ r'setup|signoff|xeq|xmit)\b', Keyword, 'option'),
1545
+ ],
1546
+ 'option': [
1547
+ # (r'\n', Text, 'root'),
1548
+ (r'\*', Name.Builtin),
1549
+ (r'[\[\](){}<>;,]', Punctuation),
1550
+ (r'[-+*/=&%]', Operator),
1551
+ (r'[a-z_]\w*', Name),
1552
+ (r'\d+\.\d*', Number.Float),
1553
+ (r'\.\d+', Number.Float),
1554
+ (r'\d+', Number.Integer),
1555
+ (r"'", String, 'option_string'),
1556
+ (r'[ \t]+', Whitespace, 'option_comment'),
1557
+ (r'\.', Punctuation),
1558
+ ],
1559
+ 'option_string': [
1560
+ (r"(\n)(//)", bygroups(Text, Keyword.Pseudo)),
1561
+ (r"''", String),
1562
+ (r"[^']", String),
1563
+ (r"'", String, '#pop'),
1564
+ ],
1565
+ 'option_comment': [
1566
+ # (r'\n', Text, 'root'),
1567
+ (r'.+', Comment.Single),
1568
+ ]
1569
+ }
1570
+
1571
+ _JOB_HEADER_PATTERN = re.compile(r'^//[a-z#$@][a-z0-9#$@]{0,7}\s+job(\s+.*)?$',
1572
+ re.IGNORECASE)
1573
+
1574
+ def analyse_text(text):
1575
+ """
1576
+ Recognize JCL job by header.
1577
+ """
1578
+ result = 0.0
1579
+ lines = text.split('\n')
1580
+ if len(lines) > 0:
1581
+ if JclLexer._JOB_HEADER_PATTERN.match(lines[0]):
1582
+ result = 1.0
1583
+ assert 0.0 <= result <= 1.0
1584
+ return result
1585
+
1586
+
1587
+ class MiniScriptLexer(RegexLexer):
1588
+ """
1589
+ For MiniScript source code.
1590
+ """
1591
+
1592
+ name = 'MiniScript'
1593
+ url = 'https://miniscript.org'
1594
+ aliases = ['miniscript', 'ms']
1595
+ filenames = ['*.ms']
1596
+ mimetypes = ['text/x-minicript', 'application/x-miniscript']
1597
+ version_added = '2.6'
1598
+
1599
+ tokens = {
1600
+ 'root': [
1601
+ (r'#!(.*?)$', Comment.Preproc),
1602
+ default('base'),
1603
+ ],
1604
+ 'base': [
1605
+ ('//.*$', Comment.Single),
1606
+ (r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number),
1607
+ (r'(?i)\d+e[+-]?\d+', Number),
1608
+ (r'\d+', Number),
1609
+ (r'\n', Text),
1610
+ (r'[^\S\n]+', Text),
1611
+ (r'"', String, 'string_double'),
1612
+ (r'(==|!=|<=|>=|[=+\-*/%^<>.:])', Operator),
1613
+ (r'[;,\[\]{}()]', Punctuation),
1614
+ (words((
1615
+ 'break', 'continue', 'else', 'end', 'for', 'function', 'if',
1616
+ 'in', 'isa', 'then', 'repeat', 'return', 'while'), suffix=r'\b'),
1617
+ Keyword),
1618
+ (words((
1619
+ 'abs', 'acos', 'asin', 'atan', 'ceil', 'char', 'cos', 'floor',
1620
+ 'log', 'round', 'rnd', 'pi', 'sign', 'sin', 'sqrt', 'str', 'tan',
1621
+ 'hasIndex', 'indexOf', 'len', 'val', 'code', 'remove', 'lower',
1622
+ 'upper', 'replace', 'split', 'indexes', 'values', 'join', 'sum',
1623
+ 'sort', 'shuffle', 'push', 'pop', 'pull', 'range',
1624
+ 'print', 'input', 'time', 'wait', 'locals', 'globals', 'outer',
1625
+ 'yield'), suffix=r'\b'),
1626
+ Name.Builtin),
1627
+ (r'(true|false|null)\b', Keyword.Constant),
1628
+ (r'(and|or|not|new)\b', Operator.Word),
1629
+ (r'(self|super|__isa)\b', Name.Builtin.Pseudo),
1630
+ (r'[a-zA-Z_]\w*', Name.Variable)
1631
+ ],
1632
+ 'string_double': [
1633
+ (r'[^"\n]+', String),
1634
+ (r'""', String),
1635
+ (r'"', String, '#pop'),
1636
+ (r'\n', Text, '#pop'), # Stray linefeed also terminates strings.
1637
+ ]
1638
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/sgf.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.sgf
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Smart Game Format (sgf) 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, Literal, String, Punctuation, Whitespace
13
+
14
+ __all__ = ["SmartGameFormatLexer"]
15
+
16
+
17
+ class SmartGameFormatLexer(RegexLexer):
18
+ """
19
+ Lexer for Smart Game Format (sgf) file format.
20
+
21
+ The format is used to store game records of board games for two players
22
+ (mainly Go game).
23
+ """
24
+ name = 'SmartGameFormat'
25
+ url = 'https://www.red-bean.com/sgf/'
26
+ aliases = ['sgf']
27
+ filenames = ['*.sgf']
28
+ version_added = '2.4'
29
+
30
+ tokens = {
31
+ 'root': [
32
+ (r'[():;]+', Punctuation),
33
+ # tokens:
34
+ (r'(A[BW]|AE|AN|AP|AR|AS|[BW]L|BM|[BW]R|[BW]S|[BW]T|CA|CH|CP|CR|'
35
+ r'DD|DM|DO|DT|EL|EV|EX|FF|FG|G[BW]|GC|GM|GN|HA|HO|ID|IP|IT|IY|KM|'
36
+ r'KO|LB|LN|LT|L|MA|MN|M|N|OB|OM|ON|OP|OT|OV|P[BW]|PC|PL|PM|RE|RG|'
37
+ r'RO|RU|SO|SC|SE|SI|SL|SO|SQ|ST|SU|SZ|T[BW]|TC|TE|TM|TR|UC|US|VW|'
38
+ r'V|[BW]|C)',
39
+ Name.Builtin),
40
+ # number:
41
+ (r'(\[)([0-9.]+)(\])',
42
+ bygroups(Punctuation, Literal.Number, Punctuation)),
43
+ # date:
44
+ (r'(\[)([0-9]{4}-[0-9]{2}-[0-9]{2})(\])',
45
+ bygroups(Punctuation, Literal.Date, Punctuation)),
46
+ # point:
47
+ (r'(\[)([a-z]{2})(\])',
48
+ bygroups(Punctuation, String, Punctuation)),
49
+ # double points:
50
+ (r'(\[)([a-z]{2})(:)([a-z]{2})(\])',
51
+ bygroups(Punctuation, String, Punctuation, String, Punctuation)),
52
+
53
+ (r'(\[)([\w\s#()+,\-.:?]+)(\])',
54
+ bygroups(Punctuation, String, Punctuation)),
55
+ (r'(\[)(\s.*)(\])',
56
+ bygroups(Punctuation, Whitespace, Punctuation)),
57
+ (r'\s+', Whitespace)
58
+ ],
59
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/shell.py ADDED
@@ -0,0 +1,902 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.shell
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for various shells.
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, do_insertions, bygroups, \
14
+ include, default, this, using, words, line_re
15
+ from pygments.token import Punctuation, Whitespace, \
16
+ Text, Comment, Operator, Keyword, Name, String, Number, Generic
17
+ from pygments.util import shebang_matches
18
+
19
+ __all__ = ['BashLexer', 'BashSessionLexer', 'TcshLexer', 'BatchLexer',
20
+ 'SlurmBashLexer', 'MSDOSSessionLexer', 'PowerShellLexer',
21
+ 'PowerShellSessionLexer', 'TcshSessionLexer', 'FishShellLexer',
22
+ 'ExeclineLexer']
23
+
24
+
25
+ class BashLexer(RegexLexer):
26
+ """
27
+ Lexer for (ba|k|z|)sh shell scripts.
28
+ """
29
+
30
+ name = 'Bash'
31
+ aliases = ['bash', 'sh', 'ksh', 'zsh', 'shell', 'openrc']
32
+ filenames = ['*.sh', '*.ksh', '*.bash', '*.ebuild', '*.eclass',
33
+ '*.exheres-0', '*.exlib', '*.zsh',
34
+ '.bashrc', 'bashrc', '.bash_*', 'bash_*', 'zshrc', '.zshrc',
35
+ '.kshrc', 'kshrc',
36
+ 'PKGBUILD']
37
+ mimetypes = ['application/x-sh', 'application/x-shellscript', 'text/x-shellscript']
38
+ url = 'https://en.wikipedia.org/wiki/Unix_shell'
39
+ version_added = '0.6'
40
+
41
+ tokens = {
42
+ 'root': [
43
+ include('basic'),
44
+ (r'`', String.Backtick, 'backticks'),
45
+ include('data'),
46
+ include('interp'),
47
+ ],
48
+ 'interp': [
49
+ (r'\$\(\(', Keyword, 'math'),
50
+ (r'\$\(', Keyword, 'paren'),
51
+ (r'\$\{#?', String.Interpol, 'curly'),
52
+ (r'\$[a-zA-Z_]\w*', Name.Variable), # user variable
53
+ (r'\$(?:\d+|[#$?!_*@-])', Name.Variable), # builtin
54
+ (r'\$', Text),
55
+ ],
56
+ 'basic': [
57
+ (r'\b(if|fi|else|while|in|do|done|for|then|return|function|case|'
58
+ r'select|break|continue|until|esac|elif)(\s*)\b',
59
+ bygroups(Keyword, Whitespace)),
60
+ (r'\b(alias|bg|bind|builtin|caller|cd|command|compgen|'
61
+ r'complete|declare|dirs|disown|echo|enable|eval|exec|exit|'
62
+ r'export|false|fc|fg|getopts|hash|help|history|jobs|kill|let|'
63
+ r'local|logout|popd|printf|pushd|pwd|read|readonly|set|shift|'
64
+ r'shopt|source|suspend|test|time|times|trap|true|type|typeset|'
65
+ r'ulimit|umask|unalias|unset|wait)(?=[\s)`])',
66
+ Name.Builtin),
67
+ (r'\A#!.+\n', Comment.Hashbang),
68
+ (r'#.*\n', Comment.Single),
69
+ (r'\\[\w\W]', String.Escape),
70
+ (r'(\b\w+)(\s*)(\+?=)', bygroups(Name.Variable, Whitespace, Operator)),
71
+ (r'[\[\]{}()=]', Operator),
72
+ (r'<<<', Operator), # here-string
73
+ (r'<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
74
+ (r'&&|\|\|', Operator),
75
+ ],
76
+ 'data': [
77
+ (r'(?s)\$?"(\\.|[^"\\$])*"', String.Double),
78
+ (r'"', String.Double, 'string'),
79
+ (r"(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
80
+ (r"(?s)'.*?'", String.Single),
81
+ (r';', Punctuation),
82
+ (r'&', Punctuation),
83
+ (r'\|', Punctuation),
84
+ (r'\s+', Whitespace),
85
+ (r'\d+\b', Number),
86
+ (r'[^=\s\[\]{}()$"\'`\\<&|;]+', Text),
87
+ (r'<', Text),
88
+ ],
89
+ 'string': [
90
+ (r'"', String.Double, '#pop'),
91
+ (r'(?s)(\\\\|\\[0-7]+|\\.|[^"\\$])+', String.Double),
92
+ include('interp'),
93
+ ],
94
+ 'curly': [
95
+ (r'\}', String.Interpol, '#pop'),
96
+ (r':-', Keyword),
97
+ (r'\w+', Name.Variable),
98
+ (r'[^}:"\'`$\\]+', Punctuation),
99
+ (r':', Punctuation),
100
+ include('root'),
101
+ ],
102
+ 'paren': [
103
+ (r'\)', Keyword, '#pop'),
104
+ include('root'),
105
+ ],
106
+ 'math': [
107
+ (r'\)\)', Keyword, '#pop'),
108
+ (r'\*\*|\|\||<<|>>|[-+*/%^|&<>]', Operator),
109
+ (r'\d+#[\da-zA-Z]+', Number),
110
+ (r'\d+#(?! )', Number),
111
+ (r'0[xX][\da-fA-F]+', Number),
112
+ (r'\d+', Number),
113
+ (r'[a-zA-Z_]\w*', Name.Variable), # user variable
114
+ include('root'),
115
+ ],
116
+ 'backticks': [
117
+ (r'`', String.Backtick, '#pop'),
118
+ include('root'),
119
+ ],
120
+ }
121
+
122
+ def analyse_text(text):
123
+ if shebang_matches(text, r'(ba|z|)sh'):
124
+ return 1
125
+ if text.startswith('$ '):
126
+ return 0.2
127
+
128
+
129
+ class SlurmBashLexer(BashLexer):
130
+ """
131
+ Lexer for (ba|k|z|)sh Slurm scripts.
132
+ """
133
+
134
+ name = 'Slurm'
135
+ aliases = ['slurm', 'sbatch']
136
+ filenames = ['*.sl']
137
+ mimetypes = []
138
+ version_added = '2.4'
139
+ EXTRA_KEYWORDS = {'srun'}
140
+
141
+ def get_tokens_unprocessed(self, text):
142
+ for index, token, value in BashLexer.get_tokens_unprocessed(self, text):
143
+ if token is Text and value in self.EXTRA_KEYWORDS:
144
+ yield index, Name.Builtin, value
145
+ elif token is Comment.Single and 'SBATCH' in value:
146
+ yield index, Keyword.Pseudo, value
147
+ else:
148
+ yield index, token, value
149
+
150
+
151
+ class ShellSessionBaseLexer(Lexer):
152
+ """
153
+ Base lexer for shell sessions.
154
+
155
+ .. versionadded:: 2.1
156
+ """
157
+
158
+ _bare_continuation = False
159
+ _venv = re.compile(r'^(\([^)]*\))(\s*)')
160
+
161
+ def get_tokens_unprocessed(self, text):
162
+ innerlexer = self._innerLexerCls(**self.options)
163
+
164
+ pos = 0
165
+ curcode = ''
166
+ insertions = []
167
+ backslash_continuation = False
168
+
169
+ for match in line_re.finditer(text):
170
+ line = match.group()
171
+
172
+ venv_match = self._venv.match(line)
173
+ if venv_match:
174
+ venv = venv_match.group(1)
175
+ venv_whitespace = venv_match.group(2)
176
+ insertions.append((len(curcode),
177
+ [(0, Generic.Prompt.VirtualEnv, venv)]))
178
+ if venv_whitespace:
179
+ insertions.append((len(curcode),
180
+ [(0, Text, venv_whitespace)]))
181
+ line = line[venv_match.end():]
182
+
183
+ m = self._ps1rgx.match(line)
184
+ if m:
185
+ # To support output lexers (say diff output), the output
186
+ # needs to be broken by prompts whenever the output lexer
187
+ # changes.
188
+ if not insertions:
189
+ pos = match.start()
190
+
191
+ insertions.append((len(curcode),
192
+ [(0, Generic.Prompt, m.group(1))]))
193
+ curcode += m.group(2)
194
+ backslash_continuation = curcode.endswith('\\\n')
195
+ elif backslash_continuation:
196
+ if line.startswith(self._ps2):
197
+ insertions.append((len(curcode),
198
+ [(0, Generic.Prompt,
199
+ line[:len(self._ps2)])]))
200
+ curcode += line[len(self._ps2):]
201
+ else:
202
+ curcode += line
203
+ backslash_continuation = curcode.endswith('\\\n')
204
+ elif self._bare_continuation and line.startswith(self._ps2):
205
+ insertions.append((len(curcode),
206
+ [(0, Generic.Prompt,
207
+ line[:len(self._ps2)])]))
208
+ curcode += line[len(self._ps2):]
209
+ else:
210
+ if insertions:
211
+ toks = innerlexer.get_tokens_unprocessed(curcode)
212
+ for i, t, v in do_insertions(insertions, toks):
213
+ yield pos+i, t, v
214
+ yield match.start(), Generic.Output, line
215
+ insertions = []
216
+ curcode = ''
217
+ if insertions:
218
+ for i, t, v in do_insertions(insertions,
219
+ innerlexer.get_tokens_unprocessed(curcode)):
220
+ yield pos+i, t, v
221
+
222
+
223
+ class BashSessionLexer(ShellSessionBaseLexer):
224
+ """
225
+ Lexer for Bash shell sessions, i.e. command lines, including a
226
+ prompt, interspersed with output.
227
+ """
228
+
229
+ name = 'Bash Session'
230
+ aliases = ['console', 'shell-session']
231
+ filenames = ['*.sh-session', '*.shell-session']
232
+ mimetypes = ['application/x-shell-session', 'application/x-sh-session']
233
+ url = 'https://en.wikipedia.org/wiki/Unix_shell'
234
+ version_added = '1.1'
235
+ _example = "console/example.sh-session"
236
+
237
+ _innerLexerCls = BashLexer
238
+ _ps1rgx = re.compile(
239
+ r'^((?:(?:\[.*?\])|(?:\(\S+\))?(?:| |sh\S*?|\w+\S+[@:]\S+(?:\s+\S+)' \
240
+ r'?|\[\S+[@:][^\n]+\].+))\s*[$#%]\s*)(.*\n?)')
241
+ _ps2 = '> '
242
+
243
+
244
+ class BatchLexer(RegexLexer):
245
+ """
246
+ Lexer for the DOS/Windows Batch file format.
247
+ """
248
+ name = 'Batchfile'
249
+ aliases = ['batch', 'bat', 'dosbatch', 'winbatch']
250
+ filenames = ['*.bat', '*.cmd']
251
+ mimetypes = ['application/x-dos-batch']
252
+ url = 'https://en.wikipedia.org/wiki/Batch_file'
253
+ version_added = '0.7'
254
+
255
+ flags = re.MULTILINE | re.IGNORECASE
256
+
257
+ _nl = r'\n\x1a'
258
+ _punct = r'&<>|'
259
+ _ws = r'\t\v\f\r ,;=\xa0'
260
+ _nlws = r'\s\x1a\xa0,;='
261
+ _space = rf'(?:(?:(?:\^[{_nl}])?[{_ws}])+)'
262
+ _keyword_terminator = (rf'(?=(?:\^[{_nl}]?)?[{_ws}+./:[\\\]]|[{_nl}{_punct}(])')
263
+ _token_terminator = rf'(?=\^?[{_ws}]|[{_punct}{_nl}])'
264
+ _start_label = rf'((?:(?<=^[^:])|^[^:]?)[{_ws}]*)(:)'
265
+ _label = rf'(?:(?:[^{_nlws}{_punct}+:^]|\^[{_nl}]?[\w\W])*)'
266
+ _label_compound = rf'(?:(?:[^{_nlws}{_punct}+:^)]|\^[{_nl}]?[^)])*)'
267
+ _number = rf'(?:-?(?:0[0-7]+|0x[\da-f]+|\d+){_token_terminator})'
268
+ _opword = r'(?:equ|geq|gtr|leq|lss|neq)'
269
+ _string = rf'(?:"[^{_nl}"]*(?:"|(?=[{_nl}])))'
270
+ _variable = (r'(?:(?:%(?:\*|(?:~[a-z]*(?:\$[^:]+:)?)?\d|'
271
+ rf'[^%:{_nl}]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:[^%{_nl}^]|'
272
+ rf'\^[^%{_nl}])[^={_nl}]*=(?:[^%{_nl}^]|\^[^%{_nl}])*)?)?%))|'
273
+ rf'(?:\^?![^!:{_nl}]+(?::(?:~(?:-?\d+)?(?:,(?:-?\d+)?)?|(?:'
274
+ rf'[^!{_nl}^]|\^[^!{_nl}])[^={_nl}]*=(?:[^!{_nl}^]|\^[^!{_nl}])*)?)?\^?!))')
275
+ _core_token = rf'(?:(?:(?:\^[{_nl}]?)?[^"{_nlws}{_punct}])+)'
276
+ _core_token_compound = rf'(?:(?:(?:\^[{_nl}]?)?[^"{_nlws}{_punct})])+)'
277
+ _token = rf'(?:[{_punct}]+|{_core_token})'
278
+ _token_compound = rf'(?:[{_punct}]+|{_core_token_compound})'
279
+ _stoken = (rf'(?:[{_punct}]+|(?:{_string}|{_variable}|{_core_token})+)')
280
+
281
+ def _make_begin_state(compound, _core_token=_core_token,
282
+ _core_token_compound=_core_token_compound,
283
+ _keyword_terminator=_keyword_terminator,
284
+ _nl=_nl, _punct=_punct, _string=_string,
285
+ _space=_space, _start_label=_start_label,
286
+ _stoken=_stoken, _token_terminator=_token_terminator,
287
+ _variable=_variable, _ws=_ws):
288
+ rest = '(?:{}|{}|[^"%{}{}{}])*'.format(_string, _variable, _nl, _punct,
289
+ ')' if compound else '')
290
+ rest_of_line = rf'(?:(?:[^{_nl}^]|\^[{_nl}]?[\w\W])*)'
291
+ rest_of_line_compound = rf'(?:(?:[^{_nl}^)]|\^[{_nl}]?[^)])*)'
292
+ set_space = rf'((?:(?:\^[{_nl}]?)?[^\S\n])*)'
293
+ suffix = ''
294
+ if compound:
295
+ _keyword_terminator = rf'(?:(?=\))|{_keyword_terminator})'
296
+ _token_terminator = rf'(?:(?=\))|{_token_terminator})'
297
+ suffix = '/compound'
298
+ return [
299
+ ((r'\)', Punctuation, '#pop') if compound else
300
+ (rf'\)((?=\()|{_token_terminator}){rest_of_line}',
301
+ Comment.Single)),
302
+ (rf'(?={_start_label})', Text, f'follow{suffix}'),
303
+ (_space, using(this, state='text')),
304
+ include(f'redirect{suffix}'),
305
+ (rf'[{_nl}]+', Text),
306
+ (r'\(', Punctuation, 'root/compound'),
307
+ (r'@+', Punctuation),
308
+ (rf'((?:for|if|rem)(?:(?=(?:\^[{_nl}]?)?/)|(?:(?!\^)|'
309
+ rf'(?<=m))(?:(?=\()|{_token_terminator})))({_space}?{_core_token_compound if compound else _core_token}?(?:\^[{_nl}]?)?/(?:\^[{_nl}]?)?\?)',
310
+ bygroups(Keyword, using(this, state='text')),
311
+ f'follow{suffix}'),
312
+ (rf'(goto{_keyword_terminator})({rest}(?:\^[{_nl}]?)?/(?:\^[{_nl}]?)?\?{rest})',
313
+ bygroups(Keyword, using(this, state='text')),
314
+ f'follow{suffix}'),
315
+ (words(('assoc', 'break', 'cd', 'chdir', 'cls', 'color', 'copy',
316
+ 'date', 'del', 'dir', 'dpath', 'echo', 'endlocal', 'erase',
317
+ 'exit', 'ftype', 'keys', 'md', 'mkdir', 'mklink', 'move',
318
+ 'path', 'pause', 'popd', 'prompt', 'pushd', 'rd', 'ren',
319
+ 'rename', 'rmdir', 'setlocal', 'shift', 'start', 'time',
320
+ 'title', 'type', 'ver', 'verify', 'vol'),
321
+ suffix=_keyword_terminator), Keyword, f'follow{suffix}'),
322
+ (rf'(call)({_space}?)(:)',
323
+ bygroups(Keyword, using(this, state='text'), Punctuation),
324
+ f'call{suffix}'),
325
+ (rf'call{_keyword_terminator}', Keyword),
326
+ (rf'(for{_token_terminator}(?!\^))({_space})(/f{_token_terminator})',
327
+ bygroups(Keyword, using(this, state='text'), Keyword),
328
+ ('for/f', 'for')),
329
+ (rf'(for{_token_terminator}(?!\^))({_space})(/l{_token_terminator})',
330
+ bygroups(Keyword, using(this, state='text'), Keyword),
331
+ ('for/l', 'for')),
332
+ (rf'for{_token_terminator}(?!\^)', Keyword, ('for2', 'for')),
333
+ (rf'(goto{_keyword_terminator})({_space}?)(:?)',
334
+ bygroups(Keyword, using(this, state='text'), Punctuation),
335
+ f'label{suffix}'),
336
+ (rf'(if(?:(?=\()|{_token_terminator})(?!\^))({_space}?)((?:/i{_token_terminator})?)({_space}?)((?:not{_token_terminator})?)({_space}?)',
337
+ bygroups(Keyword, using(this, state='text'), Keyword,
338
+ using(this, state='text'), Keyword,
339
+ using(this, state='text')), ('(?', 'if')),
340
+ (rf'rem(((?=\()|{_token_terminator}){_space}?{_stoken}?.*|{_keyword_terminator}{rest_of_line_compound if compound else rest_of_line})',
341
+ Comment.Single, f'follow{suffix}'),
342
+ (rf'(set{_keyword_terminator}){set_space}(/a)',
343
+ bygroups(Keyword, using(this, state='text'), Keyword),
344
+ f'arithmetic{suffix}'),
345
+ (r'(set{}){}((?:/p)?){}((?:(?:(?:\^[{}]?)?[^"{}{}^={}]|'
346
+ r'\^[{}]?[^"=])+)?)((?:(?:\^[{}]?)?=)?)'.format(_keyword_terminator, set_space, set_space, _nl, _nl, _punct,
347
+ ')' if compound else '', _nl, _nl),
348
+ bygroups(Keyword, using(this, state='text'), Keyword,
349
+ using(this, state='text'), using(this, state='variable'),
350
+ Punctuation),
351
+ f'follow{suffix}'),
352
+ default(f'follow{suffix}')
353
+ ]
354
+
355
+ def _make_follow_state(compound, _label=_label,
356
+ _label_compound=_label_compound, _nl=_nl,
357
+ _space=_space, _start_label=_start_label,
358
+ _token=_token, _token_compound=_token_compound,
359
+ _ws=_ws):
360
+ suffix = '/compound' if compound else ''
361
+ state = []
362
+ if compound:
363
+ state.append((r'(?=\))', Text, '#pop'))
364
+ state += [
365
+ (rf'{_start_label}([{_ws}]*)({_label_compound if compound else _label})(.*)',
366
+ bygroups(Text, Punctuation, Text, Name.Label, Comment.Single)),
367
+ include(f'redirect{suffix}'),
368
+ (rf'(?=[{_nl}])', Text, '#pop'),
369
+ (r'\|\|?|&&?', Punctuation, '#pop'),
370
+ include('text')
371
+ ]
372
+ return state
373
+
374
+ def _make_arithmetic_state(compound, _nl=_nl, _punct=_punct,
375
+ _string=_string, _variable=_variable,
376
+ _ws=_ws, _nlws=_nlws):
377
+ op = r'=+\-*/!~'
378
+ state = []
379
+ if compound:
380
+ state.append((r'(?=\))', Text, '#pop'))
381
+ state += [
382
+ (r'0[0-7]+', Number.Oct),
383
+ (r'0x[\da-f]+', Number.Hex),
384
+ (r'\d+', Number.Integer),
385
+ (r'[(),]+', Punctuation),
386
+ (rf'([{op}]|%|\^\^)+', Operator),
387
+ (r'({}|{}|(\^[{}]?)?[^(){}%\^"{}{}]|\^[{}]?{})+'.format(_string, _variable, _nl, op, _nlws, _punct, _nlws,
388
+ r'[^)]' if compound else r'[\w\W]'),
389
+ using(this, state='variable')),
390
+ (r'(?=[\x00|&])', Text, '#pop'),
391
+ include('follow')
392
+ ]
393
+ return state
394
+
395
+ def _make_call_state(compound, _label=_label,
396
+ _label_compound=_label_compound):
397
+ state = []
398
+ if compound:
399
+ state.append((r'(?=\))', Text, '#pop'))
400
+ state.append((r'(:?)(%s)' % (_label_compound if compound else _label),
401
+ bygroups(Punctuation, Name.Label), '#pop'))
402
+ return state
403
+
404
+ def _make_label_state(compound, _label=_label,
405
+ _label_compound=_label_compound, _nl=_nl,
406
+ _punct=_punct, _string=_string, _variable=_variable):
407
+ state = []
408
+ if compound:
409
+ state.append((r'(?=\))', Text, '#pop'))
410
+ state.append((r'({}?)((?:{}|{}|\^[{}]?{}|[^"%^{}{}{}])*)'.format(_label_compound if compound else _label, _string,
411
+ _variable, _nl, r'[^)]' if compound else r'[\w\W]', _nl,
412
+ _punct, r')' if compound else ''),
413
+ bygroups(Name.Label, Comment.Single), '#pop'))
414
+ return state
415
+
416
+ def _make_redirect_state(compound,
417
+ _core_token_compound=_core_token_compound,
418
+ _nl=_nl, _punct=_punct, _stoken=_stoken,
419
+ _string=_string, _space=_space,
420
+ _variable=_variable, _nlws=_nlws):
421
+ stoken_compound = (rf'(?:[{_punct}]+|(?:{_string}|{_variable}|{_core_token_compound})+)')
422
+ return [
423
+ (rf'((?:(?<=[{_nlws}])\d)?)(>>?&|<&)([{_nlws}]*)(\d)',
424
+ bygroups(Number.Integer, Punctuation, Text, Number.Integer)),
425
+ (rf'((?:(?<=[{_nlws}])(?<!\^[{_nl}])\d)?)(>>?|<)({_space}?{stoken_compound if compound else _stoken})',
426
+ bygroups(Number.Integer, Punctuation, using(this, state='text')))
427
+ ]
428
+
429
+ tokens = {
430
+ 'root': _make_begin_state(False),
431
+ 'follow': _make_follow_state(False),
432
+ 'arithmetic': _make_arithmetic_state(False),
433
+ 'call': _make_call_state(False),
434
+ 'label': _make_label_state(False),
435
+ 'redirect': _make_redirect_state(False),
436
+ 'root/compound': _make_begin_state(True),
437
+ 'follow/compound': _make_follow_state(True),
438
+ 'arithmetic/compound': _make_arithmetic_state(True),
439
+ 'call/compound': _make_call_state(True),
440
+ 'label/compound': _make_label_state(True),
441
+ 'redirect/compound': _make_redirect_state(True),
442
+ 'variable-or-escape': [
443
+ (_variable, Name.Variable),
444
+ (rf'%%|\^[{_nl}]?(\^!|[\w\W])', String.Escape)
445
+ ],
446
+ 'string': [
447
+ (r'"', String.Double, '#pop'),
448
+ (_variable, Name.Variable),
449
+ (r'\^!|%%', String.Escape),
450
+ (rf'[^"%^{_nl}]+|[%^]', String.Double),
451
+ default('#pop')
452
+ ],
453
+ 'sqstring': [
454
+ include('variable-or-escape'),
455
+ (r'[^%]+|%', String.Single)
456
+ ],
457
+ 'bqstring': [
458
+ include('variable-or-escape'),
459
+ (r'[^%]+|%', String.Backtick)
460
+ ],
461
+ 'text': [
462
+ (r'"', String.Double, 'string'),
463
+ include('variable-or-escape'),
464
+ (rf'[^"%^{_nlws}{_punct}\d)]+|.', Text)
465
+ ],
466
+ 'variable': [
467
+ (r'"', String.Double, 'string'),
468
+ include('variable-or-escape'),
469
+ (rf'[^"%^{_nl}]+|.', Name.Variable)
470
+ ],
471
+ 'for': [
472
+ (rf'({_space})(in)({_space})(\()',
473
+ bygroups(using(this, state='text'), Keyword,
474
+ using(this, state='text'), Punctuation), '#pop'),
475
+ include('follow')
476
+ ],
477
+ 'for2': [
478
+ (r'\)', Punctuation),
479
+ (rf'({_space})(do{_token_terminator})',
480
+ bygroups(using(this, state='text'), Keyword), '#pop'),
481
+ (rf'[{_nl}]+', Text),
482
+ include('follow')
483
+ ],
484
+ 'for/f': [
485
+ (rf'(")((?:{_variable}|[^"])*?")([{_nlws}]*)(\))',
486
+ bygroups(String.Double, using(this, state='string'), Text,
487
+ Punctuation)),
488
+ (r'"', String.Double, ('#pop', 'for2', 'string')),
489
+ (rf"('(?:%%|{_variable}|[\w\W])*?')([{_nlws}]*)(\))",
490
+ bygroups(using(this, state='sqstring'), Text, Punctuation)),
491
+ (rf'(`(?:%%|{_variable}|[\w\W])*?`)([{_nlws}]*)(\))',
492
+ bygroups(using(this, state='bqstring'), Text, Punctuation)),
493
+ include('for2')
494
+ ],
495
+ 'for/l': [
496
+ (r'-?\d+', Number.Integer),
497
+ include('for2')
498
+ ],
499
+ 'if': [
500
+ (rf'((?:cmdextversion|errorlevel){_token_terminator})({_space})(\d+)',
501
+ bygroups(Keyword, using(this, state='text'),
502
+ Number.Integer), '#pop'),
503
+ (rf'(defined{_token_terminator})({_space})({_stoken})',
504
+ bygroups(Keyword, using(this, state='text'),
505
+ using(this, state='variable')), '#pop'),
506
+ (rf'(exist{_token_terminator})({_space}{_stoken})',
507
+ bygroups(Keyword, using(this, state='text')), '#pop'),
508
+ (rf'({_number}{_space})({_opword})({_space}{_number})',
509
+ bygroups(using(this, state='arithmetic'), Operator.Word,
510
+ using(this, state='arithmetic')), '#pop'),
511
+ (_stoken, using(this, state='text'), ('#pop', 'if2')),
512
+ ],
513
+ 'if2': [
514
+ (rf'({_space}?)(==)({_space}?{_stoken})',
515
+ bygroups(using(this, state='text'), Operator,
516
+ using(this, state='text')), '#pop'),
517
+ (rf'({_space})({_opword})({_space}{_stoken})',
518
+ bygroups(using(this, state='text'), Operator.Word,
519
+ using(this, state='text')), '#pop')
520
+ ],
521
+ '(?': [
522
+ (_space, using(this, state='text')),
523
+ (r'\(', Punctuation, ('#pop', 'else?', 'root/compound')),
524
+ default('#pop')
525
+ ],
526
+ 'else?': [
527
+ (_space, using(this, state='text')),
528
+ (rf'else{_token_terminator}', Keyword, '#pop'),
529
+ default('#pop')
530
+ ]
531
+ }
532
+
533
+
534
+ class MSDOSSessionLexer(ShellSessionBaseLexer):
535
+ """
536
+ Lexer for MS DOS shell sessions, i.e. command lines, including a
537
+ prompt, interspersed with output.
538
+ """
539
+
540
+ name = 'MSDOS Session'
541
+ aliases = ['doscon']
542
+ filenames = []
543
+ mimetypes = []
544
+ url = 'https://en.wikipedia.org/wiki/MS-DOS'
545
+ version_added = '2.1'
546
+ _example = "doscon/session"
547
+
548
+ _innerLexerCls = BatchLexer
549
+ _ps1rgx = re.compile(r'^([^>]*>)(.*\n?)')
550
+ _ps2 = 'More? '
551
+
552
+
553
+ class TcshLexer(RegexLexer):
554
+ """
555
+ Lexer for tcsh scripts.
556
+ """
557
+
558
+ name = 'Tcsh'
559
+ aliases = ['tcsh', 'csh']
560
+ filenames = ['*.tcsh', '*.csh']
561
+ mimetypes = ['application/x-csh']
562
+ url = 'https://www.tcsh.org'
563
+ version_added = '0.10'
564
+
565
+ tokens = {
566
+ 'root': [
567
+ include('basic'),
568
+ (r'\$\(', Keyword, 'paren'),
569
+ (r'\$\{#?', Keyword, 'curly'),
570
+ (r'`', String.Backtick, 'backticks'),
571
+ include('data'),
572
+ ],
573
+ 'basic': [
574
+ (r'\b(if|endif|else|while|then|foreach|case|default|'
575
+ r'break|continue|goto|breaksw|end|switch|endsw)\s*\b',
576
+ Keyword),
577
+ (r'\b(alias|alloc|bg|bindkey|builtins|bye|caller|cd|chdir|'
578
+ r'complete|dirs|echo|echotc|eval|exec|exit|fg|filetest|getxvers|'
579
+ r'glob|getspath|hashstat|history|hup|inlib|jobs|kill|'
580
+ r'limit|log|login|logout|ls-F|migrate|newgrp|nice|nohup|notify|'
581
+ r'onintr|popd|printenv|pushd|rehash|repeat|rootnode|popd|pushd|'
582
+ r'set|shift|sched|setenv|setpath|settc|setty|setxvers|shift|'
583
+ r'source|stop|suspend|source|suspend|telltc|time|'
584
+ r'umask|unalias|uncomplete|unhash|universe|unlimit|unset|unsetenv|'
585
+ r'ver|wait|warp|watchlog|where|which)\s*\b',
586
+ Name.Builtin),
587
+ (r'#.*', Comment),
588
+ (r'\\[\w\W]', String.Escape),
589
+ (r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Text, Operator)),
590
+ (r'[\[\]{}()=]+', Operator),
591
+ (r'<<\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
592
+ (r';', Punctuation),
593
+ ],
594
+ 'data': [
595
+ (r'(?s)"(\\\\|\\[0-7]+|\\.|[^"\\])*"', String.Double),
596
+ (r"(?s)'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
597
+ (r'\s+', Text),
598
+ (r'[^=\s\[\]{}()$"\'`\\;#]+', Text),
599
+ (r'\d+(?= |\Z)', Number),
600
+ (r'\$#?(\w+|.)', Name.Variable),
601
+ ],
602
+ 'curly': [
603
+ (r'\}', Keyword, '#pop'),
604
+ (r':-', Keyword),
605
+ (r'\w+', Name.Variable),
606
+ (r'[^}:"\'`$]+', Punctuation),
607
+ (r':', Punctuation),
608
+ include('root'),
609
+ ],
610
+ 'paren': [
611
+ (r'\)', Keyword, '#pop'),
612
+ include('root'),
613
+ ],
614
+ 'backticks': [
615
+ (r'`', String.Backtick, '#pop'),
616
+ include('root'),
617
+ ],
618
+ }
619
+
620
+
621
+ class TcshSessionLexer(ShellSessionBaseLexer):
622
+ """
623
+ Lexer for Tcsh sessions, i.e. command lines, including a
624
+ prompt, interspersed with output.
625
+ """
626
+
627
+ name = 'Tcsh Session'
628
+ aliases = ['tcshcon']
629
+ filenames = []
630
+ mimetypes = []
631
+ url = 'https://www.tcsh.org'
632
+ version_added = '2.1'
633
+ _example = "tcshcon/session"
634
+
635
+ _innerLexerCls = TcshLexer
636
+ _ps1rgx = re.compile(r'^([^>]+>)(.*\n?)')
637
+ _ps2 = '? '
638
+
639
+
640
+ class PowerShellLexer(RegexLexer):
641
+ """
642
+ For Windows PowerShell code.
643
+ """
644
+ name = 'PowerShell'
645
+ aliases = ['powershell', 'pwsh', 'posh', 'ps1', 'psm1']
646
+ filenames = ['*.ps1', '*.psm1']
647
+ mimetypes = ['text/x-powershell']
648
+ url = 'https://learn.microsoft.com/en-us/powershell'
649
+ version_added = '1.5'
650
+
651
+ flags = re.DOTALL | re.IGNORECASE | re.MULTILINE
652
+
653
+ keywords = (
654
+ 'while validateset validaterange validatepattern validatelength '
655
+ 'validatecount until trap switch return ref process param parameter in '
656
+ 'if global: local: function foreach for finally filter end elseif else '
657
+ 'dynamicparam do default continue cmdletbinding break begin alias \\? '
658
+ '% #script #private #local #global mandatory parametersetname position '
659
+ 'valuefrompipeline valuefrompipelinebypropertyname '
660
+ 'valuefromremainingarguments helpmessage try catch throw').split()
661
+
662
+ operators = (
663
+ 'and as band bnot bor bxor casesensitive ccontains ceq cge cgt cle '
664
+ 'clike clt cmatch cne cnotcontains cnotlike cnotmatch contains '
665
+ 'creplace eq exact f file ge gt icontains ieq ige igt ile ilike ilt '
666
+ 'imatch ine inotcontains inotlike inotmatch ireplace is isnot le like '
667
+ 'lt match ne not notcontains notlike notmatch or regex replace '
668
+ 'wildcard').split()
669
+
670
+ verbs = (
671
+ 'write where watch wait use update unregister unpublish unprotect '
672
+ 'unlock uninstall undo unblock trace test tee take sync switch '
673
+ 'suspend submit stop step start split sort skip show set send select '
674
+ 'search scroll save revoke resume restore restart resolve resize '
675
+ 'reset request repair rename remove register redo receive read push '
676
+ 'publish protect pop ping out optimize open new move mount merge '
677
+ 'measure lock limit join invoke install initialize import hide group '
678
+ 'grant get format foreach find export expand exit enter enable edit '
679
+ 'dismount disconnect disable deny debug cxnew copy convertto '
680
+ 'convertfrom convert connect confirm compress complete compare close '
681
+ 'clear checkpoint block backup assert approve aggregate add').split()
682
+
683
+ aliases_ = (
684
+ 'ac asnp cat cd cfs chdir clc clear clhy cli clp cls clv cnsn '
685
+ 'compare copy cp cpi cpp curl cvpa dbp del diff dir dnsn ebp echo epal '
686
+ 'epcsv epsn erase etsn exsn fc fhx fl foreach ft fw gal gbp gc gci gcm '
687
+ 'gcs gdr ghy gi gjb gl gm gmo gp gps gpv group gsn gsnp gsv gu gv gwmi '
688
+ 'h history icm iex ihy ii ipal ipcsv ipmo ipsn irm ise iwmi iwr kill lp '
689
+ 'ls man md measure mi mount move mp mv nal ndr ni nmo npssc nsn nv ogv '
690
+ 'oh popd ps pushd pwd r rbp rcjb rcsn rd rdr ren ri rjb rm rmdir rmo '
691
+ 'rni rnp rp rsn rsnp rujb rv rvpa rwmi sajb sal saps sasv sbp sc select '
692
+ 'set shcm si sl sleep sls sort sp spjb spps spsv start sujb sv swmi tee '
693
+ 'trcm type wget where wjb write').split()
694
+
695
+ commenthelp = (
696
+ 'component description example externalhelp forwardhelpcategory '
697
+ 'forwardhelptargetname functionality inputs link '
698
+ 'notes outputs parameter remotehelprunspace role synopsis').split()
699
+
700
+ tokens = {
701
+ 'root': [
702
+ # we need to count pairs of parentheses for correct highlight
703
+ # of '$(...)' blocks in strings
704
+ (r'\(', Punctuation, 'child'),
705
+ (r'\s+', Text),
706
+ (r'^(\s*#[#\s]*)(\.(?:{}))([^\n]*$)'.format('|'.join(commenthelp)),
707
+ bygroups(Comment, String.Doc, Comment)),
708
+ (r'#[^\n]*?$', Comment),
709
+ (r'(&lt;|<)#', Comment.Multiline, 'multline'),
710
+ (r'@"\n', String.Heredoc, 'heredoc-double'),
711
+ (r"@'\n.*?\n'@", String.Heredoc),
712
+ # escaped syntax
713
+ (r'`[\'"$@-]', Punctuation),
714
+ (r'"', String.Double, 'string'),
715
+ (r"'([^']|'')*'", String.Single),
716
+ (r'(\$|@@|@)((global|script|private|env):)?\w+',
717
+ Name.Variable),
718
+ (r'({})\b'.format('|'.join(keywords)), Keyword),
719
+ (r'-({})\b'.format('|'.join(operators)), Operator),
720
+ (r'({})-[a-z_]\w*\b'.format('|'.join(verbs)), Name.Builtin),
721
+ (r'({})\s'.format('|'.join(aliases_)), Name.Builtin),
722
+ (r'\[[a-z_\[][\w. `,\[\]]*\]', Name.Constant), # .net [type]s
723
+ (r'-[a-z_]\w*', Name),
724
+ (r'\w+', Name),
725
+ (r'[.,;:@{}\[\]$()=+*/\\&%!~?^`|<>-]', Punctuation),
726
+ ],
727
+ 'child': [
728
+ (r'\)', Punctuation, '#pop'),
729
+ include('root'),
730
+ ],
731
+ 'multline': [
732
+ (r'[^#&.]+', Comment.Multiline),
733
+ (r'#(>|&gt;)', Comment.Multiline, '#pop'),
734
+ (r'\.({})'.format('|'.join(commenthelp)), String.Doc),
735
+ (r'[#&.]', Comment.Multiline),
736
+ ],
737
+ 'string': [
738
+ (r"`[0abfnrtv'\"$`]", String.Escape),
739
+ (r'[^$`"]+', String.Double),
740
+ (r'\$\(', Punctuation, 'child'),
741
+ (r'""', String.Double),
742
+ (r'[`$]', String.Double),
743
+ (r'"', String.Double, '#pop'),
744
+ ],
745
+ 'heredoc-double': [
746
+ (r'\n"@', String.Heredoc, '#pop'),
747
+ (r'\$\(', Punctuation, 'child'),
748
+ (r'[^@\n]+"]', String.Heredoc),
749
+ (r".", String.Heredoc),
750
+ ]
751
+ }
752
+
753
+
754
+ class PowerShellSessionLexer(ShellSessionBaseLexer):
755
+ """
756
+ Lexer for PowerShell sessions, i.e. command lines, including a
757
+ prompt, interspersed with output.
758
+ """
759
+
760
+ name = 'PowerShell Session'
761
+ aliases = ['pwsh-session', 'ps1con']
762
+ filenames = []
763
+ mimetypes = []
764
+ url = 'https://learn.microsoft.com/en-us/powershell'
765
+ version_added = '2.1'
766
+ _example = "pwsh-session/session"
767
+
768
+ _innerLexerCls = PowerShellLexer
769
+ _bare_continuation = True
770
+ _ps1rgx = re.compile(r'^((?:\[[^]]+\]: )?PS[^>]*> ?)(.*\n?)')
771
+ _ps2 = '> '
772
+
773
+
774
+ class FishShellLexer(RegexLexer):
775
+ """
776
+ Lexer for Fish shell scripts.
777
+ """
778
+
779
+ name = 'Fish'
780
+ aliases = ['fish', 'fishshell']
781
+ filenames = ['*.fish', '*.load']
782
+ mimetypes = ['application/x-fish']
783
+ url = 'https://fishshell.com'
784
+ version_added = '2.1'
785
+
786
+ tokens = {
787
+ 'root': [
788
+ include('basic'),
789
+ include('data'),
790
+ include('interp'),
791
+ ],
792
+ 'interp': [
793
+ (r'\$\(\(', Keyword, 'math'),
794
+ (r'\(', Keyword, 'paren'),
795
+ (r'\$#?(\w+|.)', Name.Variable),
796
+ ],
797
+ 'basic': [
798
+ (r'\b(begin|end|if|else|while|break|for|in|return|function|block|'
799
+ r'case|continue|switch|not|and|or|set|echo|exit|pwd|true|false|'
800
+ r'cd|count|test)(\s*)\b',
801
+ bygroups(Keyword, Text)),
802
+ (r'\b(alias|bg|bind|breakpoint|builtin|command|commandline|'
803
+ r'complete|contains|dirh|dirs|emit|eval|exec|fg|fish|fish_config|'
804
+ r'fish_indent|fish_pager|fish_prompt|fish_right_prompt|'
805
+ r'fish_update_completions|fishd|funced|funcsave|functions|help|'
806
+ r'history|isatty|jobs|math|mimedb|nextd|open|popd|prevd|psub|'
807
+ r'pushd|random|read|set_color|source|status|trap|type|ulimit|'
808
+ r'umask|vared|fc|getopts|hash|kill|printf|time|wait)\s*\b(?!\.)',
809
+ Name.Builtin),
810
+ (r'#.*\n', Comment),
811
+ (r'\\[\w\W]', String.Escape),
812
+ (r'(\b\w+)(\s*)(=)', bygroups(Name.Variable, Whitespace, Operator)),
813
+ (r'[\[\]()=]', Operator),
814
+ (r'<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
815
+ ],
816
+ 'data': [
817
+ (r'(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*"', String.Double),
818
+ (r'"', String.Double, 'string'),
819
+ (r"(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single),
820
+ (r"(?s)'.*?'", String.Single),
821
+ (r';', Punctuation),
822
+ (r'&|\||\^|<|>', Operator),
823
+ (r'\s+', Text),
824
+ (r'\d+(?= |\Z)', Number),
825
+ (r'[^=\s\[\]{}()$"\'`\\<&|;]+', Text),
826
+ ],
827
+ 'string': [
828
+ (r'"', String.Double, '#pop'),
829
+ (r'(?s)(\\\\|\\[0-7]+|\\.|[^"\\$])+', String.Double),
830
+ include('interp'),
831
+ ],
832
+ 'paren': [
833
+ (r'\)', Keyword, '#pop'),
834
+ include('root'),
835
+ ],
836
+ 'math': [
837
+ (r'\)\)', Keyword, '#pop'),
838
+ (r'[-+*/%^|&]|\*\*|\|\|', Operator),
839
+ (r'\d+#\d+', Number),
840
+ (r'\d+#(?! )', Number),
841
+ (r'\d+', Number),
842
+ include('root'),
843
+ ],
844
+ }
845
+
846
+ class ExeclineLexer(RegexLexer):
847
+ """
848
+ Lexer for Laurent Bercot's execline language.
849
+ """
850
+
851
+ name = 'execline'
852
+ aliases = ['execline']
853
+ filenames = ['*.exec']
854
+ url = 'https://skarnet.org/software/execline'
855
+ version_added = '2.7'
856
+
857
+ tokens = {
858
+ 'root': [
859
+ include('basic'),
860
+ include('data'),
861
+ include('interp')
862
+ ],
863
+ 'interp': [
864
+ (r'\$\{', String.Interpol, 'curly'),
865
+ (r'\$[\w@#]+', Name.Variable), # user variable
866
+ (r'\$', Text),
867
+ ],
868
+ 'basic': [
869
+ (r'\b(background|backtick|cd|define|dollarat|elgetopt|'
870
+ r'elgetpositionals|elglob|emptyenv|envfile|exec|execlineb|'
871
+ r'exit|export|fdblock|fdclose|fdmove|fdreserve|fdswap|'
872
+ r'forbacktickx|foreground|forstdin|forx|getcwd|getpid|heredoc|'
873
+ r'homeof|if|ifelse|ifte|ifthenelse|importas|loopwhilex|'
874
+ r'multidefine|multisubstitute|pipeline|piperw|posix-cd|'
875
+ r'redirfd|runblock|shift|trap|tryexec|umask|unexport|wait|'
876
+ r'withstdinas)\b', Name.Builtin),
877
+ (r'\A#!.+\n', Comment.Hashbang),
878
+ (r'#.*\n', Comment.Single),
879
+ (r'[{}]', Operator)
880
+ ],
881
+ 'data': [
882
+ (r'(?s)"(\\.|[^"\\$])*"', String.Double),
883
+ (r'"', String.Double, 'string'),
884
+ (r'\s+', Text),
885
+ (r'[^\s{}$"\\]+', Text)
886
+ ],
887
+ 'string': [
888
+ (r'"', String.Double, '#pop'),
889
+ (r'(?s)(\\\\|\\.|[^"\\$])+', String.Double),
890
+ include('interp'),
891
+ ],
892
+ 'curly': [
893
+ (r'\}', String.Interpol, '#pop'),
894
+ (r'[\w#@]+', Name.Variable),
895
+ include('root')
896
+ ]
897
+
898
+ }
899
+
900
+ def analyse_text(text):
901
+ if shebang_matches(text, r'execlineb'):
902
+ return 1
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/sieve.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.sieve
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Sieve file format.
6
+
7
+ https://tools.ietf.org/html/rfc5228
8
+ https://tools.ietf.org/html/rfc5173
9
+ https://tools.ietf.org/html/rfc5229
10
+ https://tools.ietf.org/html/rfc5230
11
+ https://tools.ietf.org/html/rfc5232
12
+ https://tools.ietf.org/html/rfc5235
13
+ https://tools.ietf.org/html/rfc5429
14
+ https://tools.ietf.org/html/rfc8580
15
+
16
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
17
+ :license: BSD, see LICENSE for details.
18
+ """
19
+
20
+ from pygments.lexer import RegexLexer, bygroups
21
+ from pygments.token import Comment, Name, Literal, String, Text, Punctuation, \
22
+ Keyword
23
+
24
+ __all__ = ["SieveLexer"]
25
+
26
+
27
+ class SieveLexer(RegexLexer):
28
+ """
29
+ Lexer for sieve format.
30
+ """
31
+ name = 'Sieve'
32
+ filenames = ['*.siv', '*.sieve']
33
+ aliases = ['sieve']
34
+ url = 'https://en.wikipedia.org/wiki/Sieve_(mail_filtering_language)'
35
+ version_added = '2.6'
36
+
37
+ tokens = {
38
+ 'root': [
39
+ (r'\s+', Text),
40
+ (r'[();,{}\[\]]', Punctuation),
41
+ # import:
42
+ (r'(?i)require',
43
+ Keyword.Namespace),
44
+ # tags:
45
+ (r'(?i)(:)(addresses|all|contains|content|create|copy|comparator|'
46
+ r'count|days|detail|domain|fcc|flags|from|handle|importance|is|'
47
+ r'localpart|length|lowerfirst|lower|matches|message|mime|options|'
48
+ r'over|percent|quotewildcard|raw|regex|specialuse|subject|text|'
49
+ r'under|upperfirst|upper|value)',
50
+ bygroups(Name.Tag, Name.Tag)),
51
+ # tokens:
52
+ (r'(?i)(address|addflag|allof|anyof|body|discard|elsif|else|envelope|'
53
+ r'ereject|exists|false|fileinto|if|hasflag|header|keep|'
54
+ r'notify_method_capability|notify|not|redirect|reject|removeflag|'
55
+ r'setflag|size|spamtest|stop|string|true|vacation|virustest)',
56
+ Name.Builtin),
57
+ (r'(?i)set',
58
+ Keyword.Declaration),
59
+ # number:
60
+ (r'([0-9.]+)([kmgKMG])?',
61
+ bygroups(Literal.Number, Literal.Number)),
62
+ # comment:
63
+ (r'#.*$',
64
+ Comment.Single),
65
+ (r'/\*.*\*/',
66
+ Comment.Multiline),
67
+ # string:
68
+ (r'"[^"]*?"',
69
+ String),
70
+ # text block:
71
+ (r'text:',
72
+ Name.Tag, 'text'),
73
+ ],
74
+ 'text': [
75
+ (r'[^.].*?\n', String),
76
+ (r'^\.', Punctuation, "#pop"),
77
+ ]
78
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/slash.py ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.slash
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for the Slash 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.lexer import ExtendedRegexLexer, bygroups, DelegatingLexer
12
+ from pygments.token import Name, Number, String, Comment, Punctuation, \
13
+ Other, Keyword, Operator, Whitespace
14
+
15
+ __all__ = ['SlashLexer']
16
+
17
+
18
+ class SlashLanguageLexer(ExtendedRegexLexer):
19
+ _nkw = r'(?=[^a-zA-Z_0-9])'
20
+
21
+ def move_state(new_state):
22
+ return ("#pop", new_state)
23
+
24
+ def right_angle_bracket(lexer, match, ctx):
25
+ if len(ctx.stack) > 1 and ctx.stack[-2] == "string":
26
+ ctx.stack.pop()
27
+ yield match.start(), String.Interpol, '}'
28
+ ctx.pos = match.end()
29
+ pass
30
+
31
+ tokens = {
32
+ "root": [
33
+ (r"<%=", Comment.Preproc, move_state("slash")),
34
+ (r"<%!!", Comment.Preproc, move_state("slash")),
35
+ (r"<%#.*?%>", Comment.Multiline),
36
+ (r"<%", Comment.Preproc, move_state("slash")),
37
+ (r".|\n", Other),
38
+ ],
39
+ "string": [
40
+ (r"\\", String.Escape, move_state("string_e")),
41
+ (r"\"", String, move_state("slash")),
42
+ (r"#\{", String.Interpol, "slash"),
43
+ (r'.|\n', String),
44
+ ],
45
+ "string_e": [
46
+ (r'n', String.Escape, move_state("string")),
47
+ (r't', String.Escape, move_state("string")),
48
+ (r'r', String.Escape, move_state("string")),
49
+ (r'e', String.Escape, move_state("string")),
50
+ (r'x[a-fA-F0-9]{2}', String.Escape, move_state("string")),
51
+ (r'.', String.Escape, move_state("string")),
52
+ ],
53
+ "regexp": [
54
+ (r'}[a-z]*', String.Regex, move_state("slash")),
55
+ (r'\\(.|\n)', String.Regex),
56
+ (r'{', String.Regex, "regexp_r"),
57
+ (r'.|\n', String.Regex),
58
+ ],
59
+ "regexp_r": [
60
+ (r'}[a-z]*', String.Regex, "#pop"),
61
+ (r'\\(.|\n)', String.Regex),
62
+ (r'{', String.Regex, "regexp_r"),
63
+ ],
64
+ "slash": [
65
+ (r"%>", Comment.Preproc, move_state("root")),
66
+ (r"\"", String, move_state("string")),
67
+ (r"'[a-zA-Z0-9_]+", String),
68
+ (r'%r{', String.Regex, move_state("regexp")),
69
+ (r'/\*.*?\*/', Comment.Multiline),
70
+ (r"(#|//).*?\n", Comment.Single),
71
+ (r'-?[0-9]+e[+-]?[0-9]+', Number.Float),
72
+ (r'-?[0-9]+\.[0-9]+(e[+-]?[0-9]+)?', Number.Float),
73
+ (r'-?[0-9]+', Number.Integer),
74
+ (r'nil'+_nkw, Name.Builtin),
75
+ (r'true'+_nkw, Name.Builtin),
76
+ (r'false'+_nkw, Name.Builtin),
77
+ (r'self'+_nkw, Name.Builtin),
78
+ (r'(class)(\s+)([A-Z][a-zA-Z0-9_\']*)',
79
+ bygroups(Keyword, Whitespace, Name.Class)),
80
+ (r'class'+_nkw, Keyword),
81
+ (r'extends'+_nkw, Keyword),
82
+ (r'(def)(\s+)(self)(\s*)(\.)(\s*)([a-z_][a-zA-Z0-9_\']*=?|<<|>>|==|<=>|<=|<|>=|>|\+|-(self)?|~(self)?|\*|/|%|^|&&|&|\||\[\]=?)',
83
+ bygroups(Keyword, Whitespace, Name.Builtin, Whitespace, Punctuation, Whitespace, Name.Function)),
84
+ (r'(def)(\s+)([a-z_][a-zA-Z0-9_\']*=?|<<|>>|==|<=>|<=|<|>=|>|\+|-(self)?|~(self)?|\*|/|%|^|&&|&|\||\[\]=?)',
85
+ bygroups(Keyword, Whitespace, Name.Function)),
86
+ (r'def'+_nkw, Keyword),
87
+ (r'if'+_nkw, Keyword),
88
+ (r'elsif'+_nkw, Keyword),
89
+ (r'else'+_nkw, Keyword),
90
+ (r'unless'+_nkw, Keyword),
91
+ (r'for'+_nkw, Keyword),
92
+ (r'in'+_nkw, Keyword),
93
+ (r'while'+_nkw, Keyword),
94
+ (r'until'+_nkw, Keyword),
95
+ (r'and'+_nkw, Keyword),
96
+ (r'or'+_nkw, Keyword),
97
+ (r'not'+_nkw, Keyword),
98
+ (r'lambda'+_nkw, Keyword),
99
+ (r'try'+_nkw, Keyword),
100
+ (r'catch'+_nkw, Keyword),
101
+ (r'return'+_nkw, Keyword),
102
+ (r'next'+_nkw, Keyword),
103
+ (r'last'+_nkw, Keyword),
104
+ (r'throw'+_nkw, Keyword),
105
+ (r'use'+_nkw, Keyword),
106
+ (r'switch'+_nkw, Keyword),
107
+ (r'\\', Keyword),
108
+ (r'λ', Keyword),
109
+ (r'__FILE__'+_nkw, Name.Builtin.Pseudo),
110
+ (r'__LINE__'+_nkw, Name.Builtin.Pseudo),
111
+ (r'[A-Z][a-zA-Z0-9_\']*'+_nkw, Name.Constant),
112
+ (r'[a-z_][a-zA-Z0-9_\']*'+_nkw, Name),
113
+ (r'@[a-z_][a-zA-Z0-9_\']*'+_nkw, Name.Variable.Instance),
114
+ (r'@@[a-z_][a-zA-Z0-9_\']*'+_nkw, Name.Variable.Class),
115
+ (r'\(', Punctuation),
116
+ (r'\)', Punctuation),
117
+ (r'\[', Punctuation),
118
+ (r'\]', Punctuation),
119
+ (r'\{', Punctuation),
120
+ (r'\}', right_angle_bracket),
121
+ (r';', Punctuation),
122
+ (r',', Punctuation),
123
+ (r'<<=', Operator),
124
+ (r'>>=', Operator),
125
+ (r'<<', Operator),
126
+ (r'>>', Operator),
127
+ (r'==', Operator),
128
+ (r'!=', Operator),
129
+ (r'=>', Operator),
130
+ (r'=', Operator),
131
+ (r'<=>', Operator),
132
+ (r'<=', Operator),
133
+ (r'>=', Operator),
134
+ (r'<', Operator),
135
+ (r'>', Operator),
136
+ (r'\+\+', Operator),
137
+ (r'\+=', Operator),
138
+ (r'-=', Operator),
139
+ (r'\*\*=', Operator),
140
+ (r'\*=', Operator),
141
+ (r'\*\*', Operator),
142
+ (r'\*', Operator),
143
+ (r'/=', Operator),
144
+ (r'\+', Operator),
145
+ (r'-', Operator),
146
+ (r'/', Operator),
147
+ (r'%=', Operator),
148
+ (r'%', Operator),
149
+ (r'^=', Operator),
150
+ (r'&&=', Operator),
151
+ (r'&=', Operator),
152
+ (r'&&', Operator),
153
+ (r'&', Operator),
154
+ (r'\|\|=', Operator),
155
+ (r'\|=', Operator),
156
+ (r'\|\|', Operator),
157
+ (r'\|', Operator),
158
+ (r'!', Operator),
159
+ (r'\.\.\.', Operator),
160
+ (r'\.\.', Operator),
161
+ (r'\.', Operator),
162
+ (r'::', Operator),
163
+ (r':', Operator),
164
+ (r'(\s|\n)+', Whitespace),
165
+ (r'[a-z_][a-zA-Z0-9_\']*', Name.Variable),
166
+ ],
167
+ }
168
+
169
+
170
+ class SlashLexer(DelegatingLexer):
171
+ """
172
+ Lexer for the Slash programming language.
173
+ """
174
+
175
+ name = 'Slash'
176
+ aliases = ['slash']
177
+ filenames = ['*.sla']
178
+ url = 'https://github.com/arturadib/Slash-A'
179
+ version_added = '2.4'
180
+
181
+ def __init__(self, **options):
182
+ from pygments.lexers.web import HtmlLexer
183
+ super().__init__(HtmlLexer, SlashLanguageLexer, **options)
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/smalltalk.py ADDED
@@ -0,0 +1,194 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.smalltalk
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Smalltalk 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, include, bygroups, default
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation
14
+
15
+ __all__ = ['SmalltalkLexer', 'NewspeakLexer']
16
+
17
+
18
+ class SmalltalkLexer(RegexLexer):
19
+ """
20
+ For Smalltalk syntax.
21
+ Contributed by Stefan Matthias Aust.
22
+ Rewritten by Nils Winter.
23
+ """
24
+ name = 'Smalltalk'
25
+ url = 'http://www.smalltalk.org/'
26
+ filenames = ['*.st']
27
+ aliases = ['smalltalk', 'squeak', 'st']
28
+ mimetypes = ['text/x-smalltalk']
29
+ version_added = '0.10'
30
+
31
+ tokens = {
32
+ 'root': [
33
+ (r'(<)(\w+:)(.*?)(>)', bygroups(Text, Keyword, Text, Text)),
34
+ include('squeak fileout'),
35
+ include('whitespaces'),
36
+ include('method definition'),
37
+ (r'(\|)([\w\s]*)(\|)', bygroups(Operator, Name.Variable, Operator)),
38
+ include('objects'),
39
+ (r'\^|\:=|\_', Operator),
40
+ # temporaries
41
+ (r'[\]({}.;!]', Text),
42
+ ],
43
+ 'method definition': [
44
+ # Not perfect can't allow whitespaces at the beginning and the
45
+ # without breaking everything
46
+ (r'([a-zA-Z]+\w*:)(\s*)(\w+)',
47
+ bygroups(Name.Function, Text, Name.Variable)),
48
+ (r'^(\b[a-zA-Z]+\w*\b)(\s*)$', bygroups(Name.Function, Text)),
49
+ (r'^([-+*/\\~<>=|&!?,@%]+)(\s*)(\w+)(\s*)$',
50
+ bygroups(Name.Function, Text, Name.Variable, Text)),
51
+ ],
52
+ 'blockvariables': [
53
+ include('whitespaces'),
54
+ (r'(:)(\s*)(\w+)',
55
+ bygroups(Operator, Text, Name.Variable)),
56
+ (r'\|', Operator, '#pop'),
57
+ default('#pop'), # else pop
58
+ ],
59
+ 'literals': [
60
+ (r"'(''|[^'])*'", String, 'afterobject'),
61
+ (r'\$.', String.Char, 'afterobject'),
62
+ (r'#\(', String.Symbol, 'parenth'),
63
+ (r'\)', Text, 'afterobject'),
64
+ (r'(\d+r)?-?\d+(\.\d+)?(e-?\d+)?', Number, 'afterobject'),
65
+ ],
66
+ '_parenth_helper': [
67
+ include('whitespaces'),
68
+ (r'(\d+r)?-?\d+(\.\d+)?(e-?\d+)?', Number),
69
+ (r'[-+*/\\~<>=|&#!?,@%\w:]+', String.Symbol),
70
+ # literals
71
+ (r"'(''|[^'])*'", String),
72
+ (r'\$.', String.Char),
73
+ (r'#*\(', String.Symbol, 'inner_parenth'),
74
+ ],
75
+ 'parenth': [
76
+ # This state is a bit tricky since
77
+ # we can't just pop this state
78
+ (r'\)', String.Symbol, ('root', 'afterobject')),
79
+ include('_parenth_helper'),
80
+ ],
81
+ 'inner_parenth': [
82
+ (r'\)', String.Symbol, '#pop'),
83
+ include('_parenth_helper'),
84
+ ],
85
+ 'whitespaces': [
86
+ # skip whitespace and comments
87
+ (r'\s+', Text),
88
+ (r'"(""|[^"])*"', Comment),
89
+ ],
90
+ 'objects': [
91
+ (r'\[', Text, 'blockvariables'),
92
+ (r'\]', Text, 'afterobject'),
93
+ (r'\b(self|super|true|false|nil|thisContext)\b',
94
+ Name.Builtin.Pseudo, 'afterobject'),
95
+ (r'\b[A-Z]\w*(?!:)\b', Name.Class, 'afterobject'),
96
+ (r'\b[a-z]\w*(?!:)\b', Name.Variable, 'afterobject'),
97
+ (r'#("(""|[^"])*"|[-+*/\\~<>=|&!?,@%]+|[\w:]+)',
98
+ String.Symbol, 'afterobject'),
99
+ include('literals'),
100
+ ],
101
+ 'afterobject': [
102
+ (r'! !$', Keyword, '#pop'), # squeak chunk delimiter
103
+ include('whitespaces'),
104
+ (r'\b(ifTrue:|ifFalse:|whileTrue:|whileFalse:|timesRepeat:)',
105
+ Name.Builtin, '#pop'),
106
+ (r'\b(new\b(?!:))', Name.Builtin),
107
+ (r'\:=|\_', Operator, '#pop'),
108
+ (r'\b[a-zA-Z]+\w*:', Name.Function, '#pop'),
109
+ (r'\b[a-zA-Z]+\w*', Name.Function),
110
+ (r'\w+:?|[-+*/\\~<>=|&!?,@%]+', Name.Function, '#pop'),
111
+ (r'\.', Punctuation, '#pop'),
112
+ (r';', Punctuation),
113
+ (r'[\])}]', Text),
114
+ (r'[\[({]', Text, '#pop'),
115
+ ],
116
+ 'squeak fileout': [
117
+ # Squeak fileout format (optional)
118
+ (r'^"(""|[^"])*"!', Keyword),
119
+ (r"^'(''|[^'])*'!", Keyword),
120
+ (r'^(!)(\w+)( commentStamp: )(.*?)( prior: .*?!\n)(.*?)(!)',
121
+ bygroups(Keyword, Name.Class, Keyword, String, Keyword, Text, Keyword)),
122
+ (r"^(!)(\w+(?: class)?)( methodsFor: )('(?:''|[^'])*')(.*?!)",
123
+ bygroups(Keyword, Name.Class, Keyword, String, Keyword)),
124
+ (r'^(\w+)( subclass: )(#\w+)'
125
+ r'(\s+instanceVariableNames: )(.*?)'
126
+ r'(\s+classVariableNames: )(.*?)'
127
+ r'(\s+poolDictionaries: )(.*?)'
128
+ r'(\s+category: )(.*?)(!)',
129
+ bygroups(Name.Class, Keyword, String.Symbol, Keyword, String, Keyword,
130
+ String, Keyword, String, Keyword, String, Keyword)),
131
+ (r'^(\w+(?: class)?)(\s+instanceVariableNames: )(.*?)(!)',
132
+ bygroups(Name.Class, Keyword, String, Keyword)),
133
+ (r'(!\n)(\].*)(! !)$', bygroups(Keyword, Text, Keyword)),
134
+ (r'! !$', Keyword),
135
+ ],
136
+ }
137
+
138
+
139
+ class NewspeakLexer(RegexLexer):
140
+ """
141
+ For Newspeak syntax.
142
+ """
143
+ name = 'Newspeak'
144
+ url = 'http://newspeaklanguage.org/'
145
+ filenames = ['*.ns2']
146
+ aliases = ['newspeak', ]
147
+ mimetypes = ['text/x-newspeak']
148
+ version_added = '1.1'
149
+
150
+ tokens = {
151
+ 'root': [
152
+ (r'\b(Newsqueak2)\b', Keyword.Declaration),
153
+ (r"'[^']*'", String),
154
+ (r'\b(class)(\s+)(\w+)(\s*)',
155
+ bygroups(Keyword.Declaration, Text, Name.Class, Text)),
156
+ (r'\b(mixin|self|super|private|public|protected|nil|true|false)\b',
157
+ Keyword),
158
+ (r'(\w+\:)(\s*)([a-zA-Z_]\w+)',
159
+ bygroups(Name.Function, Text, Name.Variable)),
160
+ (r'(\w+)(\s*)(=)',
161
+ bygroups(Name.Attribute, Text, Operator)),
162
+ (r'<\w+>', Comment.Special),
163
+ include('expressionstat'),
164
+ include('whitespace')
165
+ ],
166
+
167
+ 'expressionstat': [
168
+ (r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
169
+ (r'\d+', Number.Integer),
170
+ (r':\w+', Name.Variable),
171
+ (r'(\w+)(::)', bygroups(Name.Variable, Operator)),
172
+ (r'\w+:', Name.Function),
173
+ (r'\w+', Name.Variable),
174
+ (r'\(|\)', Punctuation),
175
+ (r'\[|\]', Punctuation),
176
+ (r'\{|\}', Punctuation),
177
+
178
+ (r'(\^|\+|\/|~|\*|<|>|=|@|%|\||&|\?|!|,|-|:)', Operator),
179
+ (r'\.|;', Punctuation),
180
+ include('whitespace'),
181
+ include('literals'),
182
+ ],
183
+ 'literals': [
184
+ (r'\$.', String),
185
+ (r"'[^']*'", String),
186
+ (r"#'[^']*'", String.Symbol),
187
+ (r"#\w+:?", String.Symbol),
188
+ (r"#(\+|\/|~|\*|<|>|=|@|%|\||&|\?|!|,|-)+", String.Symbol)
189
+ ],
190
+ 'whitespace': [
191
+ (r'\s+', Text),
192
+ (r'"[^"]*"', Comment)
193
+ ],
194
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/smithy.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.smithy
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Smithy IDL.
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, Keyword, Name, String, \
13
+ Number, Whitespace, Punctuation
14
+
15
+ __all__ = ['SmithyLexer']
16
+
17
+
18
+ class SmithyLexer(RegexLexer):
19
+ """
20
+ For Smithy IDL
21
+ """
22
+ name = 'Smithy'
23
+ url = 'https://awslabs.github.io/smithy/'
24
+ filenames = ['*.smithy']
25
+ aliases = ['smithy']
26
+ version_added = '2.10'
27
+
28
+ unquoted = r'[A-Za-z0-9_\.#$-]+'
29
+ identifier = r"[A-Za-z0-9_\.#$-]+"
30
+
31
+ simple_shapes = (
32
+ 'use', 'byte', 'short', 'integer', 'long', 'float', 'document',
33
+ 'double', 'bigInteger', 'bigDecimal', 'boolean', 'blob', 'string',
34
+ 'timestamp',
35
+ )
36
+
37
+ aggregate_shapes = (
38
+ 'apply', 'list', 'map', 'set', 'structure', 'union', 'resource',
39
+ 'operation', 'service', 'trait'
40
+ )
41
+
42
+ tokens = {
43
+ 'root': [
44
+ (r'///.*$', Comment.Multiline),
45
+ (r'//.*$', Comment),
46
+ (r'@[0-9a-zA-Z\.#-]*', Name.Decorator),
47
+ (r'(=)', Name.Decorator),
48
+ (r'^(\$version)(:)(.+)',
49
+ bygroups(Keyword.Declaration, Name.Decorator, Name.Class)),
50
+ (r'^(namespace)(\s+' + identifier + r')\b',
51
+ bygroups(Keyword.Declaration, Name.Class)),
52
+ (words(simple_shapes,
53
+ prefix=r'^', suffix=r'(\s+' + identifier + r')\b'),
54
+ bygroups(Keyword.Declaration, Name.Class)),
55
+ (words(aggregate_shapes,
56
+ prefix=r'^', suffix=r'(\s+' + identifier + r')'),
57
+ bygroups(Keyword.Declaration, Name.Class)),
58
+ (r'^(metadata)(\s+)((?:\S+)|(?:\"[^"]+\"))(\s*)(=)',
59
+ bygroups(Keyword.Declaration, Whitespace, Name.Class,
60
+ Whitespace, Name.Decorator)),
61
+ (r"(true|false|null)", Keyword.Constant),
62
+ (r"(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)", Number),
63
+ (identifier + ":", Name.Label),
64
+ (identifier, Name.Variable.Class),
65
+ (r'\[', Text, "#push"),
66
+ (r'\]', Text, "#pop"),
67
+ (r'\(', Text, "#push"),
68
+ (r'\)', Text, "#pop"),
69
+ (r'\{', Text, "#push"),
70
+ (r'\}', Text, "#pop"),
71
+ (r'"{3}(\\\\|\n|\\")*"{3}', String.Doc),
72
+ (r'"(\\\\|\n|\\"|[^"])*"', String.Double),
73
+ (r"'(\\\\|\n|\\'|[^'])*'", String.Single),
74
+ (r'[:,]+', Punctuation),
75
+ (r'\s+', Whitespace),
76
+ ]
77
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/smv.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.smv
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the SMV 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, words
12
+ from pygments.token import Comment, Keyword, Name, Number, Operator, \
13
+ Punctuation, Text
14
+
15
+ __all__ = ['NuSMVLexer']
16
+
17
+
18
+ class NuSMVLexer(RegexLexer):
19
+ """
20
+ Lexer for the NuSMV language.
21
+ """
22
+
23
+ name = 'NuSMV'
24
+ aliases = ['nusmv']
25
+ filenames = ['*.smv']
26
+ mimetypes = []
27
+ url = 'https://nusmv.fbk.eu'
28
+ version_added = '2.2'
29
+
30
+ tokens = {
31
+ 'root': [
32
+ # Comments
33
+ (r'(?s)\/\-\-.*?\-\-/', Comment),
34
+ (r'--.*\n', Comment),
35
+
36
+ # Reserved
37
+ (words(('MODULE', 'DEFINE', 'MDEFINE', 'CONSTANTS', 'VAR', 'IVAR',
38
+ 'FROZENVAR', 'INIT', 'TRANS', 'INVAR', 'SPEC', 'CTLSPEC',
39
+ 'LTLSPEC', 'PSLSPEC', 'COMPUTE', 'NAME', 'INVARSPEC',
40
+ 'FAIRNESS', 'JUSTICE', 'COMPASSION', 'ISA', 'ASSIGN',
41
+ 'CONSTRAINT', 'SIMPWFF', 'CTLWFF', 'LTLWFF', 'PSLWFF',
42
+ 'COMPWFF', 'IN', 'MIN', 'MAX', 'MIRROR', 'PRED',
43
+ 'PREDICATES'), suffix=r'(?![\w$#-])'),
44
+ Keyword.Declaration),
45
+ (r'process(?![\w$#-])', Keyword),
46
+ (words(('array', 'of', 'boolean', 'integer', 'real', 'word'),
47
+ suffix=r'(?![\w$#-])'), Keyword.Type),
48
+ (words(('case', 'esac'), suffix=r'(?![\w$#-])'), Keyword),
49
+ (words(('word1', 'bool', 'signed', 'unsigned', 'extend', 'resize',
50
+ 'sizeof', 'uwconst', 'swconst', 'init', 'self', 'count',
51
+ 'abs', 'max', 'min'), suffix=r'(?![\w$#-])'),
52
+ Name.Builtin),
53
+ (words(('EX', 'AX', 'EF', 'AF', 'EG', 'AG', 'E', 'F', 'O', 'G',
54
+ 'H', 'X', 'Y', 'Z', 'A', 'U', 'S', 'V', 'T', 'BU', 'EBF',
55
+ 'ABF', 'EBG', 'ABG', 'next', 'mod', 'union', 'in', 'xor',
56
+ 'xnor'), suffix=r'(?![\w$#-])'),
57
+ Operator.Word),
58
+ (words(('TRUE', 'FALSE'), suffix=r'(?![\w$#-])'), Keyword.Constant),
59
+
60
+ # Names
61
+ (r'[a-zA-Z_][\w$#-]*', Name.Variable),
62
+
63
+ # Operators
64
+ (r':=', Operator),
65
+ (r'[-&|+*/<>!=]', Operator),
66
+
67
+ # Literals
68
+ (r'\-?\d+\b', Number.Integer),
69
+ (r'0[su][bB]\d*_[01_]+', Number.Bin),
70
+ (r'0[su][oO]\d*_[0-7_]+', Number.Oct),
71
+ (r'0[su][dD]\d*_[\d_]+', Number.Decimal),
72
+ (r'0[su][hH]\d*_[\da-fA-F_]+', Number.Hex),
73
+
74
+ # Whitespace, punctuation and the rest
75
+ (r'\s+', Text.Whitespace),
76
+ (r'[()\[\]{};?:.,]', Punctuation),
77
+ ],
78
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/snobol.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.snobol
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the SNOBOL 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
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation
14
+
15
+ __all__ = ['SnobolLexer']
16
+
17
+
18
+ class SnobolLexer(RegexLexer):
19
+ """
20
+ Lexer for the SNOBOL4 programming language.
21
+
22
+ Recognizes the common ASCII equivalents of the original SNOBOL4 operators.
23
+ Does not require spaces around binary operators.
24
+ """
25
+
26
+ name = "Snobol"
27
+ aliases = ["snobol"]
28
+ filenames = ['*.snobol']
29
+ mimetypes = ['text/x-snobol']
30
+ url = 'https://www.regressive.org/snobol4'
31
+ version_added = '1.5'
32
+
33
+ tokens = {
34
+ # root state, start of line
35
+ # comments, continuation lines, and directives start in column 1
36
+ # as do labels
37
+ 'root': [
38
+ (r'\*.*\n', Comment),
39
+ (r'[+.] ', Punctuation, 'statement'),
40
+ (r'-.*\n', Comment),
41
+ (r'END\s*\n', Name.Label, 'heredoc'),
42
+ (r'[A-Za-z$][\w$]*', Name.Label, 'statement'),
43
+ (r'\s+', Text, 'statement'),
44
+ ],
45
+ # statement state, line after continuation or label
46
+ 'statement': [
47
+ (r'\s*\n', Text, '#pop'),
48
+ (r'\s+', Text),
49
+ (r'(?<=[^\w.])(LT|LE|EQ|NE|GE|GT|INTEGER|IDENT|DIFFER|LGT|SIZE|'
50
+ r'REPLACE|TRIM|DUPL|REMDR|DATE|TIME|EVAL|APPLY|OPSYN|LOAD|UNLOAD|'
51
+ r'LEN|SPAN|BREAK|ANY|NOTANY|TAB|RTAB|REM|POS|RPOS|FAIL|FENCE|'
52
+ r'ABORT|ARB|ARBNO|BAL|SUCCEED|INPUT|OUTPUT|TERMINAL)(?=[^\w.])',
53
+ Name.Builtin),
54
+ (r'[A-Za-z][\w.]*', Name),
55
+ # ASCII equivalents of original operators
56
+ # | for the EBCDIC equivalent, ! likewise
57
+ # \ for EBCDIC negation
58
+ (r'\*\*|[?$.!%*/#+\-@|&\\=]', Operator),
59
+ (r'"[^"]*"', String),
60
+ (r"'[^']*'", String),
61
+ # Accept SPITBOL syntax for real numbers
62
+ # as well as Macro SNOBOL4
63
+ (r'[0-9]+(?=[^.EeDd])', Number.Integer),
64
+ (r'[0-9]+(\.[0-9]*)?([EDed][-+]?[0-9]+)?', Number.Float),
65
+ # Goto
66
+ (r':', Punctuation, 'goto'),
67
+ (r'[()<>,;]', Punctuation),
68
+ ],
69
+ # Goto block
70
+ 'goto': [
71
+ (r'\s*\n', Text, "#pop:2"),
72
+ (r'\s+', Text),
73
+ (r'F|S', Keyword),
74
+ (r'(\()([A-Za-z][\w.]*)(\))',
75
+ bygroups(Punctuation, Name.Label, Punctuation))
76
+ ],
77
+ # everything after the END statement is basically one
78
+ # big heredoc.
79
+ 'heredoc': [
80
+ (r'.*\n', String.Heredoc)
81
+ ]
82
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/solidity.py ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.solidity
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Solidity.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, include, words
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation, Whitespace
14
+
15
+ __all__ = ['SolidityLexer']
16
+
17
+
18
+ class SolidityLexer(RegexLexer):
19
+ """
20
+ For Solidity source code.
21
+ """
22
+
23
+ name = 'Solidity'
24
+ aliases = ['solidity']
25
+ filenames = ['*.sol']
26
+ mimetypes = []
27
+ url = 'https://soliditylang.org'
28
+ version_added = '2.5'
29
+
30
+ datatype = (
31
+ r'\b(address|bool|(?:(?:bytes|hash|int|string|uint)(?:8|16|24|32|40|48|56|64'
32
+ r'|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208'
33
+ r'|216|224|232|240|248|256)?))\b'
34
+ )
35
+
36
+ tokens = {
37
+ 'root': [
38
+ include('whitespace'),
39
+ include('comments'),
40
+ (r'\bpragma\s+solidity\b', Keyword, 'pragma'),
41
+ (r'\b(contract)(\s+)([a-zA-Z_]\w*)',
42
+ bygroups(Keyword, Whitespace, Name.Entity)),
43
+ (datatype + r'(\s+)((?:external|public|internal|private)\s+)?' +
44
+ r'([a-zA-Z_]\w*)',
45
+ bygroups(Keyword.Type, Whitespace, Keyword, Name.Variable)),
46
+ (r'\b(enum|event|function|struct)(\s+)([a-zA-Z_]\w*)',
47
+ bygroups(Keyword.Type, Whitespace, Name.Variable)),
48
+ (r'\b(msg|block|tx)\.([A-Za-z_][a-zA-Z0-9_]*)\b', Keyword),
49
+ (words((
50
+ 'block', 'break', 'constant', 'constructor', 'continue',
51
+ 'contract', 'do', 'else', 'external', 'false', 'for',
52
+ 'function', 'if', 'import', 'inherited', 'internal', 'is',
53
+ 'library', 'mapping', 'memory', 'modifier', 'msg', 'new',
54
+ 'payable', 'private', 'public', 'require', 'return',
55
+ 'returns', 'struct', 'suicide', 'throw', 'this', 'true',
56
+ 'tx', 'var', 'while'), prefix=r'\b', suffix=r'\b'),
57
+ Keyword.Type),
58
+ (words(('keccak256',), prefix=r'\b', suffix=r'\b'), Name.Builtin),
59
+ (datatype, Keyword.Type),
60
+ include('constants'),
61
+ (r'[a-zA-Z_]\w*', Text),
62
+ (r'[~!%^&*+=|?:<>/-]', Operator),
63
+ (r'[.;{}(),\[\]]', Punctuation)
64
+ ],
65
+ 'comments': [
66
+ (r'//(\n|[\w\W]*?[^\\]\n)', Comment.Single),
67
+ (r'/(\\\n)?[*][\w\W]*?[*](\\\n)?/', Comment.Multiline),
68
+ (r'/(\\\n)?[*][\w\W]*', Comment.Multiline)
69
+ ],
70
+ 'constants': [
71
+ (r'("(\\"|.)*?")', String.Double),
72
+ (r"('(\\'|.)*?')", String.Single),
73
+ (r'\b0[xX][0-9a-fA-F]+\b', Number.Hex),
74
+ (r'\b\d+\b', Number.Decimal),
75
+ ],
76
+ 'pragma': [
77
+ include('whitespace'),
78
+ include('comments'),
79
+ (r'(\^|>=|<)(\s*)(\d+\.\d+\.\d+)',
80
+ bygroups(Operator, Whitespace, Keyword)),
81
+ (r';', Punctuation, '#pop')
82
+ ],
83
+ 'whitespace': [
84
+ (r'\s+', Whitespace),
85
+ (r'\n', Whitespace)
86
+ ]
87
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/soong.py ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.soong
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Soong (Android.bp Blueprint) files.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, include
12
+ from pygments.token import Comment, Name, Number, Operator, Punctuation, \
13
+ String, Whitespace
14
+
15
+ __all__ = ['SoongLexer']
16
+
17
+ class SoongLexer(RegexLexer):
18
+ name = 'Soong'
19
+ version_added = '2.18'
20
+ url = 'https://source.android.com/docs/setup/reference/androidbp'
21
+ aliases = ['androidbp', 'bp', 'soong']
22
+ filenames = ['Android.bp']
23
+
24
+ tokens = {
25
+ 'root': [
26
+ # A variable assignment
27
+ (r'(\w*)(\s*)(\+?=)(\s*)',
28
+ bygroups(Name.Variable, Whitespace, Operator, Whitespace),
29
+ 'assign-rhs'),
30
+
31
+ # A top-level module
32
+ (r'(\w*)(\s*)(\{)',
33
+ bygroups(Name.Function, Whitespace, Punctuation),
34
+ 'in-rule'),
35
+
36
+ # Everything else
37
+ include('comments'),
38
+ (r'\s+', Whitespace), # newlines okay
39
+ ],
40
+ 'assign-rhs': [
41
+ include('expr'),
42
+ (r'\n', Whitespace, '#pop'),
43
+ ],
44
+ 'in-list': [
45
+ include('expr'),
46
+ include('comments'),
47
+ (r'\s+', Whitespace), # newlines okay in a list
48
+ (r',', Punctuation),
49
+ (r'\]', Punctuation, '#pop'),
50
+ ],
51
+ 'in-map': [
52
+ # A map key
53
+ (r'(\w+)(:)(\s*)', bygroups(Name, Punctuation, Whitespace)),
54
+
55
+ include('expr'),
56
+ include('comments'),
57
+ (r'\s+', Whitespace), # newlines okay in a map
58
+ (r',', Punctuation),
59
+ (r'\}', Punctuation, '#pop'),
60
+ ],
61
+ 'in-rule': [
62
+ # Just re-use map syntax
63
+ include('in-map'),
64
+ ],
65
+ 'comments': [
66
+ (r'//.*', Comment.Single),
67
+ (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
68
+ ],
69
+ 'expr': [
70
+ (r'(true|false)\b', Name.Builtin),
71
+ (r'0x[0-9a-fA-F]+', Number.Hex),
72
+ (r'\d+', Number.Integer),
73
+ (r'".*?"', String),
74
+ (r'\{', Punctuation, 'in-map'),
75
+ (r'\[', Punctuation, 'in-list'),
76
+ (r'\w+', Name),
77
+ ],
78
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/sophia.py ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.sophia
3
+ ~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Sophia.
6
+
7
+ Derived from pygments/lexers/reason.py.
8
+
9
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
10
+ :license: BSD, see LICENSE for details.
11
+ """
12
+
13
+ from pygments.lexer import RegexLexer, include, default, words
14
+ from pygments.token import Comment, Keyword, Name, Number, Operator, \
15
+ Punctuation, String, Text
16
+
17
+ __all__ = ['SophiaLexer']
18
+
19
+ class SophiaLexer(RegexLexer):
20
+ """
21
+ A Sophia lexer.
22
+ """
23
+
24
+ name = 'Sophia'
25
+ aliases = ['sophia']
26
+ filenames = ['*.aes']
27
+ mimetypes = []
28
+ url = 'https://docs.aeternity.com/aesophia'
29
+ version_added = '2.11'
30
+
31
+ keywords = (
32
+ 'contract', 'include', 'let', 'switch', 'type', 'record', 'datatype',
33
+ 'if', 'elif', 'else', 'function', 'stateful', 'payable', 'public',
34
+ 'entrypoint', 'private', 'indexed', 'namespace', 'interface', 'main',
35
+ 'using', 'as', 'for', 'hiding',
36
+ )
37
+
38
+ builtins = ('state', 'put', 'abort', 'require')
39
+
40
+ word_operators = ('mod', 'band', 'bor', 'bxor', 'bnot')
41
+
42
+ primitive_types = ('int', 'address', 'bool', 'bits', 'bytes', 'string',
43
+ 'list', 'option', 'char', 'unit', 'map', 'event',
44
+ 'hash', 'signature', 'oracle', 'oracle_query')
45
+
46
+ tokens = {
47
+ 'escape-sequence': [
48
+ (r'\\[\\"\'ntbr]', String.Escape),
49
+ (r'\\[0-9]{3}', String.Escape),
50
+ (r'\\x[0-9a-fA-F]{2}', String.Escape),
51
+ ],
52
+ 'root': [
53
+ (r'\s+', Text.Whitespace),
54
+ (r'(true|false)\b', Keyword.Constant),
55
+ (r'\b([A-Z][\w\']*)(?=\s*\.)', Name.Class, 'dotted'),
56
+ (r'\b([A-Z][\w\']*)', Name.Function),
57
+ (r'//.*?\n', Comment.Single),
58
+ (r'\/\*(?!/)', Comment.Multiline, 'comment'),
59
+
60
+ (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
61
+ (r'#[\da-fA-F][\da-fA-F_]*', Name.Label),
62
+ (r'\d[\d_]*', Number.Integer),
63
+
64
+ (words(keywords, suffix=r'\b'), Keyword),
65
+ (words(builtins, suffix=r'\b'), Name.Builtin),
66
+ (words(word_operators, prefix=r'\b', suffix=r'\b'), Operator.Word),
67
+ (words(primitive_types, prefix=r'\b', suffix=r'\b'), Keyword.Type),
68
+
69
+ (r'[=!<>+\\*/:&|?~@^-]', Operator.Word),
70
+ (r'[.;:{}(),\[\]]', Punctuation),
71
+
72
+ (r"(ak_|ok_|oq_|ct_)[\w']*", Name.Label),
73
+ (r"[^\W\d][\w']*", Name),
74
+
75
+ (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'",
76
+ String.Char),
77
+ (r"'.'", String.Char),
78
+ (r"'[a-z][\w]*", Name.Variable),
79
+
80
+ (r'"', String.Double, 'string')
81
+ ],
82
+ '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.Double),
90
+ include('escape-sequence'),
91
+ (r'\\\n', String.Double),
92
+ (r'"', String.Double, '#pop'),
93
+ ],
94
+ 'dotted': [
95
+ (r'\s+', Text),
96
+ (r'\.', Punctuation),
97
+ (r'[A-Z][\w\']*(?=\s*\.)', Name.Function),
98
+ (r'[A-Z][\w\']*', Name.Function, '#pop'),
99
+ (r'[a-z_][\w\']*', Name, '#pop'),
100
+ default('#pop'),
101
+ ],
102
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/special.py ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.special
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Special lexers.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import ast
12
+
13
+ from pygments.lexer import Lexer, line_re
14
+ from pygments.token import Token, Error, Text, Generic
15
+ from pygments.util import get_choice_opt
16
+
17
+
18
+ __all__ = ['TextLexer', 'OutputLexer', 'RawTokenLexer']
19
+
20
+
21
+ class TextLexer(Lexer):
22
+ """
23
+ "Null" lexer, doesn't highlight anything.
24
+ """
25
+ name = 'Text only'
26
+ aliases = ['text']
27
+ filenames = ['*.txt']
28
+ mimetypes = ['text/plain']
29
+ url = ""
30
+ version_added = ''
31
+
32
+ priority = 0.01
33
+
34
+ def get_tokens_unprocessed(self, text):
35
+ yield 0, Text, text
36
+
37
+ def analyse_text(text):
38
+ return TextLexer.priority
39
+
40
+
41
+ class OutputLexer(Lexer):
42
+ """
43
+ Simple lexer that highlights everything as ``Token.Generic.Output``.
44
+ """
45
+ name = 'Text output'
46
+ aliases = ['output']
47
+ url = ""
48
+ version_added = '2.10'
49
+ _example = "output/output"
50
+
51
+ def get_tokens_unprocessed(self, text):
52
+ yield 0, Generic.Output, text
53
+
54
+
55
+ _ttype_cache = {}
56
+
57
+
58
+ class RawTokenLexer(Lexer):
59
+ """
60
+ Recreate a token stream formatted with the `RawTokenFormatter`.
61
+
62
+ Additional options accepted:
63
+
64
+ `compress`
65
+ If set to ``"gz"`` or ``"bz2"``, decompress the token stream with
66
+ the given compression algorithm before lexing (default: ``""``).
67
+ """
68
+ name = 'Raw token data'
69
+ aliases = []
70
+ filenames = []
71
+ mimetypes = ['application/x-pygments-tokens']
72
+ url = 'https://pygments.org/docs/formatters/#RawTokenFormatter'
73
+ version_added = ''
74
+
75
+ def __init__(self, **options):
76
+ self.compress = get_choice_opt(options, 'compress',
77
+ ['', 'none', 'gz', 'bz2'], '')
78
+ Lexer.__init__(self, **options)
79
+
80
+ def get_tokens(self, text):
81
+ if self.compress:
82
+ if isinstance(text, str):
83
+ text = text.encode('latin1')
84
+ try:
85
+ if self.compress == 'gz':
86
+ import gzip
87
+ text = gzip.decompress(text)
88
+ elif self.compress == 'bz2':
89
+ import bz2
90
+ text = bz2.decompress(text)
91
+ except OSError:
92
+ yield Error, text.decode('latin1')
93
+ if isinstance(text, bytes):
94
+ text = text.decode('latin1')
95
+
96
+ # do not call Lexer.get_tokens() because stripping is not optional.
97
+ text = text.strip('\n') + '\n'
98
+ for i, t, v in self.get_tokens_unprocessed(text):
99
+ yield t, v
100
+
101
+ def get_tokens_unprocessed(self, text):
102
+ length = 0
103
+ for match in line_re.finditer(text):
104
+ try:
105
+ ttypestr, val = match.group().rstrip().split('\t', 1)
106
+ ttype = _ttype_cache.get(ttypestr)
107
+ if not ttype:
108
+ ttype = Token
109
+ ttypes = ttypestr.split('.')[1:]
110
+ for ttype_ in ttypes:
111
+ if not ttype_ or not ttype_[0].isupper():
112
+ raise ValueError('malformed token name')
113
+ ttype = getattr(ttype, ttype_)
114
+ _ttype_cache[ttypestr] = ttype
115
+ val = ast.literal_eval(val)
116
+ if not isinstance(val, str):
117
+ raise ValueError('expected str')
118
+ except (SyntaxError, ValueError):
119
+ val = match.group()
120
+ ttype = Error
121
+ yield length, ttype, val
122
+ length += len(val)
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/spice.py ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.spice
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the Spice 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.lexer import RegexLexer, bygroups, words
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Punctuation, Whitespace
14
+
15
+ __all__ = ['SpiceLexer']
16
+
17
+
18
+ class SpiceLexer(RegexLexer):
19
+ """
20
+ For Spice source.
21
+ """
22
+ name = 'Spice'
23
+ url = 'https://www.spicelang.com'
24
+ filenames = ['*.spice']
25
+ aliases = ['spice', 'spicelang']
26
+ mimetypes = ['text/x-spice']
27
+ version_added = '2.11'
28
+
29
+ tokens = {
30
+ 'root': [
31
+ (r'\n', Whitespace),
32
+ (r'\s+', Whitespace),
33
+ (r'\\\n', Text),
34
+ # comments
35
+ (r'//(.*?)\n', Comment.Single),
36
+ (r'/(\\\n)?[*]{2}(.|\n)*?[*](\\\n)?/', String.Doc),
37
+ (r'/(\\\n)?[*](.|\n)*?[*](\\\n)?/', Comment.Multiline),
38
+ # keywords
39
+ (r'(import|as)\b', Keyword.Namespace),
40
+ (r'(f|p|type|struct|interface|enum|alias|operator)\b', Keyword.Declaration),
41
+ (words(('if', 'else', 'switch', 'case', 'default', 'for', 'foreach', 'do',
42
+ 'while', 'break', 'continue', 'fallthrough', 'return', 'assert',
43
+ 'unsafe', 'ext', 'cast'), suffix=r'\b'), Keyword),
44
+ (words(('const', 'signed', 'unsigned', 'inline', 'public', 'heap', 'compose'),
45
+ suffix=r'\b'), Keyword.Pseudo),
46
+ (words(('new', 'yield', 'stash', 'pick', 'sync', 'class'), suffix=r'\b'),
47
+ Keyword.Reserved),
48
+ (r'(true|false|nil)\b', Keyword.Constant),
49
+ (words(('double', 'int', 'short', 'long', 'byte', 'char', 'string',
50
+ 'bool', 'dyn'), suffix=r'\b'), Keyword.Type),
51
+ (words(('printf', 'sizeof', 'alignof', 'len', 'panic'), suffix=r'\b(\()'),
52
+ bygroups(Name.Builtin, Punctuation)),
53
+ # numeric literals
54
+ (r'[-]?[0-9]*[.][0-9]+([eE][+-]?[0-9]+)?', Number.Double),
55
+ (r'0[bB][01]+[slu]?', Number.Bin),
56
+ (r'0[oO][0-7]+[slu]?', Number.Oct),
57
+ (r'0[xXhH][0-9a-fA-F]+[slu]?', Number.Hex),
58
+ (r'(0[dD])?[0-9]+[slu]?', Number.Integer),
59
+ # string literal
60
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String),
61
+ # char literal
62
+ (r'\'(\\\\|\\[^\\]|[^\'\\])\'', String.Char),
63
+ # tokens
64
+ (r'<<=|>>=|<<|>>|<=|>=|\+=|-=|\*=|/=|\%=|\|=|&=|\^=|&&|\|\||&|\||'
65
+ r'\+\+|--|\%|\^|\~|==|!=|->|::|[.]{3}|#!|#|[+\-*/&]', Operator),
66
+ (r'[|<>=!()\[\]{}.,;:\?]', Punctuation),
67
+ # identifiers
68
+ (r'[^\W\d]\w*', Name.Other),
69
+ ]
70
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/sql.py ADDED
@@ -0,0 +1,1111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.sql
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for various SQL dialects and related interactive sessions.
6
+
7
+ Postgres specific lexers:
8
+
9
+ `PostgresLexer`
10
+ A SQL lexer for the PostgreSQL dialect. Differences w.r.t. the SQL
11
+ lexer are:
12
+
13
+ - keywords and data types list parsed from the PG docs (run the
14
+ `_postgres_builtins` module to update them);
15
+ - Content of $-strings parsed using a specific lexer, e.g. the content
16
+ of a PL/Python function is parsed using the Python lexer;
17
+ - parse PG specific constructs: E-strings, $-strings, U&-strings,
18
+ different operators and punctuation.
19
+
20
+ `PlPgsqlLexer`
21
+ A lexer for the PL/pgSQL language. Adds a few specific construct on
22
+ top of the PG SQL lexer (such as <<label>>).
23
+
24
+ `PostgresConsoleLexer`
25
+ A lexer to highlight an interactive psql session:
26
+
27
+ - identifies the prompt and does its best to detect the end of command
28
+ in multiline statement where not all the lines are prefixed by a
29
+ prompt, telling them apart from the output;
30
+ - highlights errors in the output and notification levels;
31
+ - handles psql backslash commands.
32
+
33
+ `PostgresExplainLexer`
34
+ A lexer to highlight Postgres execution plan.
35
+
36
+ The ``tests/examplefiles`` contains a few test files with data to be
37
+ parsed by these lexers.
38
+
39
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
40
+ :license: BSD, see LICENSE for details.
41
+ """
42
+
43
+ import collections
44
+ import re
45
+
46
+ from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, words
47
+ from pygments.lexers import _googlesql_builtins
48
+ from pygments.lexers import _mysql_builtins
49
+ from pygments.lexers import _postgres_builtins
50
+ from pygments.lexers import _sql_builtins
51
+ from pygments.lexers import _tsql_builtins
52
+ from pygments.lexers import get_lexer_by_name, ClassNotFound
53
+ from pygments.token import Punctuation, Whitespace, Text, Comment, Operator, \
54
+ Keyword, Name, String, Number, Generic, Literal
55
+
56
+
57
+ __all__ = ['GoogleSqlLexer', 'PostgresLexer', 'PlPgsqlLexer',
58
+ 'PostgresConsoleLexer', 'PostgresExplainLexer', 'SqlLexer',
59
+ 'TransactSqlLexer', 'MySqlLexer', 'SqliteConsoleLexer', 'RqlLexer']
60
+
61
+ line_re = re.compile('.*?\n')
62
+ sqlite_prompt_re = re.compile(r'^(?:sqlite| ...)>(?= )')
63
+
64
+ language_re = re.compile(r"\s+LANGUAGE\s+'?(\w+)'?", re.IGNORECASE)
65
+
66
+ do_re = re.compile(r'\bDO\b', re.IGNORECASE)
67
+
68
+ # Regular expressions for analyse_text()
69
+ name_between_bracket_re = re.compile(r'\[[a-zA-Z_]\w*\]')
70
+ name_between_backtick_re = re.compile(r'`[a-zA-Z_]\w*`')
71
+ tsql_go_re = re.compile(r'\bgo\b', re.IGNORECASE)
72
+ tsql_declare_re = re.compile(r'\bdeclare\s+@', re.IGNORECASE)
73
+ tsql_variable_re = re.compile(r'@[a-zA-Z_]\w*\b')
74
+
75
+ # Identifiers for analyse_text()
76
+ googlesql_identifiers = (
77
+ _googlesql_builtins.functionnames
78
+ + _googlesql_builtins.keywords
79
+ + _googlesql_builtins.types)
80
+
81
+
82
+ def language_callback(lexer, match):
83
+ """Parse the content of a $-string using a lexer
84
+
85
+ The lexer is chosen looking for a nearby LANGUAGE or assumed as
86
+ plpgsql if inside a DO statement and no LANGUAGE has been found.
87
+ """
88
+ lx = None
89
+ m = language_re.match(lexer.text[match.end():match.end()+100])
90
+ if m is not None:
91
+ lx = lexer._get_lexer(m.group(1))
92
+ else:
93
+ m = list(language_re.finditer(
94
+ lexer.text[max(0, match.start()-100):match.start()]))
95
+ if m:
96
+ lx = lexer._get_lexer(m[-1].group(1))
97
+ else:
98
+ m = list(do_re.finditer(
99
+ lexer.text[max(0, match.start()-25):match.start()]))
100
+ if m:
101
+ lx = lexer._get_lexer('plpgsql')
102
+
103
+ # 1 = $, 2 = delimiter, 3 = $
104
+ yield (match.start(1), String, match.group(1))
105
+ yield (match.start(2), String.Delimiter, match.group(2))
106
+ yield (match.start(3), String, match.group(3))
107
+ # 4 = string contents
108
+ if lx:
109
+ yield from lx.get_tokens_unprocessed(match.group(4))
110
+ else:
111
+ yield (match.start(4), String, match.group(4))
112
+ # 5 = $, 6 = delimiter, 7 = $
113
+ yield (match.start(5), String, match.group(5))
114
+ yield (match.start(6), String.Delimiter, match.group(6))
115
+ yield (match.start(7), String, match.group(7))
116
+
117
+
118
+ class PostgresBase:
119
+ """Base class for Postgres-related lexers.
120
+
121
+ This is implemented as a mixin to avoid the Lexer metaclass kicking in.
122
+ this way the different lexer don't have a common Lexer ancestor. If they
123
+ had, _tokens could be created on this ancestor and not updated for the
124
+ other classes, resulting e.g. in PL/pgSQL parsed as SQL. This shortcoming
125
+ seem to suggest that regexp lexers are not really subclassable.
126
+ """
127
+ def get_tokens_unprocessed(self, text, *args):
128
+ # Have a copy of the entire text to be used by `language_callback`.
129
+ self.text = text
130
+ yield from super().get_tokens_unprocessed(text, *args)
131
+
132
+ def _get_lexer(self, lang):
133
+ if lang.lower() == 'sql':
134
+ return get_lexer_by_name('postgresql', **self.options)
135
+
136
+ tries = [lang]
137
+ if lang.startswith('pl'):
138
+ tries.append(lang[2:])
139
+ if lang.endswith('u'):
140
+ tries.append(lang[:-1])
141
+ if lang.startswith('pl') and lang.endswith('u'):
142
+ tries.append(lang[2:-1])
143
+
144
+ for lx in tries:
145
+ try:
146
+ return get_lexer_by_name(lx, **self.options)
147
+ except ClassNotFound:
148
+ pass
149
+ else:
150
+ # TODO: better logging
151
+ # print >>sys.stderr, "language not found:", lang
152
+ return None
153
+
154
+
155
+ class PostgresLexer(PostgresBase, RegexLexer):
156
+ """
157
+ Lexer for the PostgreSQL dialect of SQL.
158
+ """
159
+
160
+ name = 'PostgreSQL SQL dialect'
161
+ aliases = ['postgresql', 'postgres']
162
+ mimetypes = ['text/x-postgresql']
163
+ url = 'https://www.postgresql.org'
164
+ version_added = '1.5'
165
+
166
+ flags = re.IGNORECASE
167
+ tokens = {
168
+ 'root': [
169
+ (r'\s+', Whitespace),
170
+ (r'--.*\n?', Comment.Single),
171
+ (r'/\*', Comment.Multiline, 'multiline-comments'),
172
+ (r'(' + '|'.join(s.replace(" ", r"\s+")
173
+ for s in _postgres_builtins.DATATYPES +
174
+ _postgres_builtins.PSEUDO_TYPES) + r')\b',
175
+ Name.Builtin),
176
+ (words(_postgres_builtins.KEYWORDS, suffix=r'\b'), Keyword),
177
+ (r'[+*/<>=~!@#%^&|`?-]+', Operator),
178
+ (r'::', Operator), # cast
179
+ (r'\$\d+', Name.Variable),
180
+ (r'([0-9]*\.[0-9]*|[0-9]+)(e[+-]?[0-9]+)?', Number.Float),
181
+ (r'[0-9]+', Number.Integer),
182
+ (r"((?:E|U&)?)(')", bygroups(String.Affix, String.Single), 'string'),
183
+ # quoted identifier
184
+ (r'((?:U&)?)(")', bygroups(String.Affix, String.Name), 'quoted-ident'),
185
+ (r'(?s)(\$)([^$]*)(\$)(.*?)(\$)(\2)(\$)', language_callback),
186
+ (r'[a-z_]\w*', Name),
187
+
188
+ # psql variable in SQL
189
+ (r""":(['"]?)[a-z]\w*\b\1""", Name.Variable),
190
+
191
+ (r'[;:()\[\]{},.]', Punctuation),
192
+ ],
193
+ 'multiline-comments': [
194
+ (r'/\*', Comment.Multiline, 'multiline-comments'),
195
+ (r'\*/', Comment.Multiline, '#pop'),
196
+ (r'[^/*]+', Comment.Multiline),
197
+ (r'[/*]', Comment.Multiline)
198
+ ],
199
+ 'string': [
200
+ (r"[^']+", String.Single),
201
+ (r"''", String.Single),
202
+ (r"'", String.Single, '#pop'),
203
+ ],
204
+ 'quoted-ident': [
205
+ (r'[^"]+', String.Name),
206
+ (r'""', String.Name),
207
+ (r'"', String.Name, '#pop'),
208
+ ],
209
+ }
210
+
211
+
212
+ class PlPgsqlLexer(PostgresBase, RegexLexer):
213
+ """
214
+ Handle the extra syntax in Pl/pgSQL language.
215
+ """
216
+ name = 'PL/pgSQL'
217
+ aliases = ['plpgsql']
218
+ mimetypes = ['text/x-plpgsql']
219
+ url = 'https://www.postgresql.org/docs/current/plpgsql.html'
220
+ version_added = '1.5'
221
+
222
+ flags = re.IGNORECASE
223
+ # FIXME: use inheritance
224
+ tokens = {name: state[:] for (name, state) in PostgresLexer.tokens.items()}
225
+
226
+ # extend the keywords list
227
+ for i, pattern in enumerate(tokens['root']):
228
+ if pattern[1] == Keyword:
229
+ tokens['root'][i] = (
230
+ words(_postgres_builtins.KEYWORDS +
231
+ _postgres_builtins.PLPGSQL_KEYWORDS, suffix=r'\b'),
232
+ Keyword)
233
+ del i
234
+ break
235
+ else:
236
+ assert 0, "SQL keywords not found"
237
+
238
+ # Add specific PL/pgSQL rules (before the SQL ones)
239
+ tokens['root'][:0] = [
240
+ (r'\%[a-z]\w*\b', Name.Builtin), # actually, a datatype
241
+ (r':=', Operator),
242
+ (r'\<\<[a-z]\w*\>\>', Name.Label),
243
+ (r'\#[a-z]\w*\b', Keyword.Pseudo), # #variable_conflict
244
+ ]
245
+
246
+
247
+ class PsqlRegexLexer(PostgresBase, RegexLexer):
248
+ """
249
+ Extend the PostgresLexer adding support specific for psql commands.
250
+
251
+ This is not a complete psql lexer yet as it lacks prompt support
252
+ and output rendering.
253
+ """
254
+
255
+ name = 'PostgreSQL console - regexp based lexer'
256
+ aliases = [] # not public
257
+
258
+ flags = re.IGNORECASE
259
+ tokens = {name: state[:] for (name, state) in PostgresLexer.tokens.items()}
260
+
261
+ tokens['root'].append(
262
+ (r'\\[^\s]+', Keyword.Pseudo, 'psql-command'))
263
+ tokens['psql-command'] = [
264
+ (r'\n', Text, 'root'),
265
+ (r'\s+', Whitespace),
266
+ (r'\\[^\s]+', Keyword.Pseudo),
267
+ (r""":(['"]?)[a-z]\w*\b\1""", Name.Variable),
268
+ (r"'(''|[^'])*'", String.Single),
269
+ (r"`([^`])*`", String.Backtick),
270
+ (r"[^\s]+", String.Symbol),
271
+ ]
272
+
273
+
274
+ re_prompt = re.compile(r'^(\S.*?)??[=\-\(\$\'\"][#>]')
275
+ re_psql_command = re.compile(r'\s*\\')
276
+ re_end_command = re.compile(r';\s*(--.*?)?$')
277
+ re_psql_command = re.compile(r'(\s*)(\\.+?)(\s+)$')
278
+ re_error = re.compile(r'(ERROR|FATAL):')
279
+ re_message = re.compile(
280
+ r'((?:DEBUG|INFO|NOTICE|WARNING|ERROR|'
281
+ r'FATAL|HINT|DETAIL|CONTEXT|LINE [0-9]+):)(.*?\n)')
282
+
283
+
284
+ class lookahead:
285
+ """Wrap an iterator and allow pushing back an item."""
286
+ def __init__(self, x):
287
+ self.iter = iter(x)
288
+ self._nextitem = None
289
+
290
+ def __iter__(self):
291
+ return self
292
+
293
+ def send(self, i):
294
+ self._nextitem = i
295
+ return i
296
+
297
+ def __next__(self):
298
+ if self._nextitem is not None:
299
+ ni = self._nextitem
300
+ self._nextitem = None
301
+ return ni
302
+ return next(self.iter)
303
+ next = __next__
304
+
305
+
306
+ class PostgresConsoleLexer(Lexer):
307
+ """
308
+ Lexer for psql sessions.
309
+ """
310
+
311
+ name = 'PostgreSQL console (psql)'
312
+ aliases = ['psql', 'postgresql-console', 'postgres-console']
313
+ mimetypes = ['text/x-postgresql-psql']
314
+ url = 'https://www.postgresql.org'
315
+ version_added = '1.5'
316
+ _example = "psql/psql_session.txt"
317
+
318
+ def get_tokens_unprocessed(self, data):
319
+ sql = PsqlRegexLexer(**self.options)
320
+
321
+ lines = lookahead(line_re.findall(data))
322
+
323
+ # prompt-output cycle
324
+ while 1:
325
+
326
+ # consume the lines of the command: start with an optional prompt
327
+ # and continue until the end of command is detected
328
+ curcode = ''
329
+ insertions = []
330
+ for line in lines:
331
+ # Identify a shell prompt in case of psql commandline example
332
+ if line.startswith('$') and not curcode:
333
+ lexer = get_lexer_by_name('console', **self.options)
334
+ yield from lexer.get_tokens_unprocessed(line)
335
+ break
336
+
337
+ # Identify a psql prompt
338
+ mprompt = re_prompt.match(line)
339
+ if mprompt is not None:
340
+ insertions.append((len(curcode),
341
+ [(0, Generic.Prompt, mprompt.group())]))
342
+ curcode += line[len(mprompt.group()):]
343
+ else:
344
+ curcode += line
345
+
346
+ # Check if this is the end of the command
347
+ # TODO: better handle multiline comments at the end with
348
+ # a lexer with an external state?
349
+ if re_psql_command.match(curcode) \
350
+ or re_end_command.search(curcode):
351
+ break
352
+
353
+ # Emit the combined stream of command and prompt(s)
354
+ yield from do_insertions(insertions,
355
+ sql.get_tokens_unprocessed(curcode))
356
+
357
+ # Emit the output lines
358
+ out_token = Generic.Output
359
+ for line in lines:
360
+ mprompt = re_prompt.match(line)
361
+ if mprompt is not None:
362
+ # push the line back to have it processed by the prompt
363
+ lines.send(line)
364
+ break
365
+
366
+ mmsg = re_message.match(line)
367
+ if mmsg is not None:
368
+ if mmsg.group(1).startswith("ERROR") \
369
+ or mmsg.group(1).startswith("FATAL"):
370
+ out_token = Generic.Error
371
+ yield (mmsg.start(1), Generic.Strong, mmsg.group(1))
372
+ yield (mmsg.start(2), out_token, mmsg.group(2))
373
+ else:
374
+ yield (0, out_token, line)
375
+ else:
376
+ return
377
+
378
+
379
+ class PostgresExplainLexer(RegexLexer):
380
+ """
381
+ Handle PostgreSQL EXPLAIN output
382
+ """
383
+
384
+ name = 'PostgreSQL EXPLAIN dialect'
385
+ aliases = ['postgres-explain']
386
+ filenames = ['*.explain']
387
+ mimetypes = ['text/x-postgresql-explain']
388
+ url = 'https://www.postgresql.org/docs/current/using-explain.html'
389
+ version_added = '2.15'
390
+
391
+ tokens = {
392
+ 'root': [
393
+ (r'(:|\(|\)|ms|kB|->|\.\.|\,|\/|=|%)', Punctuation),
394
+ (r'(\s+)', Whitespace),
395
+
396
+ # This match estimated cost and effectively measured counters with ANALYZE
397
+ # Then, we move to instrumentation state
398
+ (r'(cost)(=?)', bygroups(Name.Class, Punctuation), 'instrumentation'),
399
+ (r'(actual)( )(=?)', bygroups(Name.Class, Whitespace, Punctuation), 'instrumentation'),
400
+
401
+ # Misc keywords
402
+ (words(('actual', 'Memory Usage', 'Disk Usage', 'Memory', 'Buckets',
403
+ 'Batches', 'originally', 'row', 'rows', 'Hits', 'Misses',
404
+ 'Evictions', 'Overflows', 'Planned Partitions', 'Estimates',
405
+ 'capacity', 'distinct keys', 'lookups', 'hit percent',
406
+ 'Index Searches', 'Storage', 'Disk Maximum Storage'), suffix=r'\b'),
407
+ Comment.Single),
408
+
409
+ (r'(hit|read|dirtied|written|write|time|calls)(=)', bygroups(Comment.Single, Operator)),
410
+ (r'(shared|temp|local)', Keyword.Pseudo),
411
+
412
+ # We move to sort state in order to emphasize specific keywords (especially disk access)
413
+ (r'(Sort Method)(: )', bygroups(Comment.Preproc, Punctuation), 'sort'),
414
+
415
+ # These keywords can be followed by an object, like a table
416
+ (r'(Sort Key|Group Key|Presorted Key|Hash Key)(:)( )',
417
+ bygroups(Comment.Preproc, Punctuation, Whitespace), 'object_name'),
418
+ (r'(Cache Key|Cache Mode)(:)( )', bygroups(Comment, Punctuation, Whitespace), 'object_name'),
419
+
420
+ # These keywords can be followed by a predicate
421
+ (words(('Join Filter', 'Subplans Removed', 'Filter', 'Merge Cond',
422
+ 'Hash Cond', 'Index Cond', 'Recheck Cond', 'Heap Blocks',
423
+ 'TID Cond', 'Run Condition', 'Order By', 'Function Call',
424
+ 'Table Function Call', 'Inner Unique', 'Params Evaluated',
425
+ 'Single Copy', 'Sampling', 'One-Time Filter', 'Output',
426
+ 'Relations', 'Remote SQL', 'Disabled'), suffix=r'\b'),
427
+ Comment.Preproc, 'predicate'),
428
+
429
+ # Special keyword to handle ON CONFLICT
430
+ (r'Conflict ', Comment.Preproc, 'conflict'),
431
+
432
+ # Special keyword for InitPlan or SubPlan
433
+ (r'(InitPlan|SubPlan)( )(\d+)( )',
434
+ bygroups(Keyword, Whitespace, Number.Integer, Whitespace),
435
+ 'init_plan'),
436
+
437
+ (words(('Sort Method', 'Join Filter', 'Planning time',
438
+ 'Planning Time', 'Execution time', 'Execution Time',
439
+ 'Workers Planned', 'Workers Launched', 'Buffers',
440
+ 'Planning', 'Worker', 'Query Identifier', 'Time',
441
+ 'Full-sort Groups', 'Pre-sorted Groups'), suffix=r'\b'), Comment.Preproc),
442
+
443
+ # Emphasize these keywords
444
+
445
+ (words(('Rows Removed by Join Filter', 'Rows Removed by Filter',
446
+ 'Rows Removed by Index Recheck',
447
+ 'Heap Fetches', 'never executed'),
448
+ suffix=r'\b'), Name.Exception),
449
+ (r'(I/O Timings)(:)( )', bygroups(Name.Exception, Punctuation, Whitespace)),
450
+
451
+ (words(_postgres_builtins.EXPLAIN_KEYWORDS, suffix=r'\b'), Keyword),
452
+
453
+ # join keywords
454
+ (r'((Right|Left|Full|Semi|Anti) Join)', Keyword.Type),
455
+ (r'(Parallel |Async |Finalize |Partial )', Comment.Preproc),
456
+ (r'Backward', Comment.Preproc),
457
+ (r'(Intersect|Except|Hash)', Comment.Preproc),
458
+
459
+ (r'(CTE)( )(\w*)?', bygroups(Comment, Whitespace, Name.Variable)),
460
+
461
+
462
+ # Treat "on" and "using" as a punctuation
463
+ (r'(on|using)', Punctuation, 'object_name'),
464
+
465
+
466
+ # strings
467
+ (r"'(''|[^'])*'", String.Single),
468
+ # numbers
469
+ (r'-?\d+\.\d+', Number.Float),
470
+ (r'(-?\d+)', Number.Integer),
471
+
472
+ # boolean
473
+ (r'(true|false)', Name.Constant),
474
+ # explain header
475
+ (r'\s*QUERY PLAN\s*\n\s*-+', Comment.Single),
476
+ # Settings
477
+ (r'(Settings)(:)( )', bygroups(Comment.Preproc, Punctuation, Whitespace), 'setting'),
478
+
479
+ # Handle JIT counters
480
+ (r'(JIT|Functions|Options|Timing)(:)', bygroups(Comment.Preproc, Punctuation)),
481
+ (r'(Inlining|Optimization|Expressions|Deforming|Generation|Emission|Total)', Keyword.Pseudo),
482
+
483
+ # Handle Triggers counters
484
+ (r'(Trigger)( )(\S*)(:)( )',
485
+ bygroups(Comment.Preproc, Whitespace, Name.Variable, Punctuation, Whitespace)),
486
+
487
+ ],
488
+ 'expression': [
489
+ # matches any kind of parenthesized expression
490
+ # the first opening paren is matched by the 'caller'
491
+ (r'\(', Punctuation, '#push'),
492
+ (r'\)', Punctuation, '#pop'),
493
+ (r'(never executed)', Name.Exception),
494
+ (r'[^)(]+', Comment),
495
+ ],
496
+ 'object_name': [
497
+
498
+ # This is a cost or analyze measure
499
+ (r'(\(cost)(=?)', bygroups(Name.Class, Punctuation), 'instrumentation'),
500
+ (r'(\(actual)( )(=?)', bygroups(Name.Class, Whitespace, Punctuation), 'instrumentation'),
501
+
502
+ # if object_name is parenthesized, mark opening paren as
503
+ # punctuation, call 'expression', and exit state
504
+ (r'\(', Punctuation, 'expression'),
505
+ (r'(on)', Punctuation),
506
+ # matches possibly schema-qualified table and column names
507
+ (r'\w+(\.\w+)*( USING \S+| \w+ USING \S+)', Name.Variable),
508
+ (r'\"?\w+\"?(?:\.\"?\w+\"?)?', Name.Variable),
509
+ (r'\'\S*\'', Name.Variable),
510
+
511
+ # if we encounter a comma, another object is listed
512
+ (r',\n', Punctuation, 'object_name'),
513
+ (r',', Punctuation, 'object_name'),
514
+
515
+ # special case: "*SELECT*"
516
+ (r'"\*SELECT\*( \d+)?"(.\w+)?', Name.Variable),
517
+ (r'"\*VALUES\*(_\d+)?"(.\w+)?', Name.Variable),
518
+ (r'"ANY_subquery"', Name.Variable),
519
+
520
+ # Variable $1 ...
521
+ (r'\$\d+', Name.Variable),
522
+ # cast
523
+ (r'::\w+', Name.Variable),
524
+ (r' +', Whitespace),
525
+ (r'"', Punctuation),
526
+ (r'\[\.\.\.\]', Punctuation),
527
+ (r'\)', Punctuation, '#pop'),
528
+ ],
529
+ 'predicate': [
530
+ # if predicate is parenthesized, mark paren as punctuation
531
+ (r'(\()([^\n]*)(\))', bygroups(Punctuation, Name.Variable, Punctuation), '#pop'),
532
+ # otherwise color until newline
533
+ (r'[^\n]*', Name.Variable, '#pop'),
534
+ ],
535
+ 'instrumentation': [
536
+ (r'=|\.\.', Punctuation),
537
+ (r' +', Whitespace),
538
+ (r'(rows|width|time|loops)', Name.Class),
539
+ (r'\d+\.\d+', Number.Float),
540
+ (r'(\d+)', Number.Integer),
541
+ (r'\)', Punctuation, '#pop'),
542
+ ],
543
+ 'conflict': [
544
+ (r'(Resolution: )(\w+)', bygroups(Comment.Preproc, Name.Variable)),
545
+ (r'(Arbiter \w+:)', Comment.Preproc, 'object_name'),
546
+ (r'(Filter: )', Comment.Preproc, 'predicate'),
547
+ ],
548
+ 'setting': [
549
+ (r'([a-z_]*?)(\s*)(=)(\s*)(\'.*?\')', bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String)),
550
+ (r'\, ', Punctuation),
551
+ ],
552
+ 'init_plan': [
553
+ (r'\(', Punctuation),
554
+ (r'returns \$\d+(,\$\d+)?', Name.Variable),
555
+ (r'\)', Punctuation, '#pop'),
556
+ ],
557
+ 'sort': [
558
+ (r':|kB', Punctuation),
559
+ (r'(quicksort|top-N|heapsort|Average|Memory|Peak)', Comment.Prepoc),
560
+ (r'(external|merge|Disk|sort)', Name.Exception),
561
+ (r'(\d+)', Number.Integer),
562
+ (r' +', Whitespace),
563
+ ],
564
+ }
565
+
566
+
567
+ class SqlLexer(RegexLexer):
568
+ """
569
+ Lexer for Structured Query Language. Currently, this lexer does
570
+ not recognize any special syntax except ANSI SQL.
571
+ """
572
+
573
+ name = 'SQL'
574
+ aliases = ['sql']
575
+ filenames = ['*.sql']
576
+ mimetypes = ['text/x-sql']
577
+ url = 'https://en.wikipedia.org/wiki/SQL'
578
+ version_added = ''
579
+
580
+ flags = re.IGNORECASE
581
+ tokens = {
582
+ 'root': [
583
+ (r'\s+', Whitespace),
584
+ (r'--.*\n?', Comment.Single),
585
+ (r'/\*', Comment.Multiline, 'multiline-comments'),
586
+ (words(_sql_builtins.KEYWORDS, suffix=r'\b'), Keyword),
587
+ (words(_sql_builtins.DATATYPES, suffix=r'\b'), Name.Builtin),
588
+ (r'[+*/<>=~!@#%^&|`?-]', Operator),
589
+ (r'[0-9]+', Number.Integer),
590
+ # TODO: Backslash escapes?
591
+ (r"'(''|[^'])*'", String.Single),
592
+ (r'"(""|[^"])*"', String.Symbol), # not a real string literal in ANSI SQL
593
+ (r'[a-z_][\w$]*', Name), # allow $s in strings for Oracle
594
+ (r'[;:()\[\],.]', Punctuation)
595
+ ],
596
+ 'multiline-comments': [
597
+ (r'/\*', Comment.Multiline, 'multiline-comments'),
598
+ (r'\*/', Comment.Multiline, '#pop'),
599
+ (r'[^/*]+', Comment.Multiline),
600
+ (r'[/*]', Comment.Multiline)
601
+ ]
602
+ }
603
+
604
+ def analyse_text(self, text):
605
+ return
606
+
607
+
608
+ class TransactSqlLexer(RegexLexer):
609
+ """
610
+ Transact-SQL (T-SQL) is Microsoft's and Sybase's proprietary extension to
611
+ SQL.
612
+
613
+ The list of keywords includes ODBC and keywords reserved for future use.
614
+ """
615
+
616
+ name = 'Transact-SQL'
617
+ aliases = ['tsql', 't-sql']
618
+ filenames = ['*.sql']
619
+ mimetypes = ['text/x-tsql']
620
+ url = 'https://www.tsql.info'
621
+ version_added = ''
622
+
623
+ flags = re.IGNORECASE
624
+
625
+ tokens = {
626
+ 'root': [
627
+ (r'\s+', Whitespace),
628
+ (r'--.*[$|\n]?', Comment.Single),
629
+ (r'/\*', Comment.Multiline, 'multiline-comments'),
630
+ (words(_tsql_builtins.OPERATORS), Operator),
631
+ (words(_tsql_builtins.OPERATOR_WORDS, suffix=r'\b'), Operator.Word),
632
+ (words(_tsql_builtins.TYPES, suffix=r'\b'), Name.Class),
633
+ (words(_tsql_builtins.FUNCTIONS, suffix=r'\b'), Name.Function),
634
+ (r'(goto)(\s+)(\w+\b)', bygroups(Keyword, Whitespace, Name.Label)),
635
+ (words(_tsql_builtins.KEYWORDS, suffix=r'\b'), Keyword),
636
+ (r'(\[)([^]]+)(\])', bygroups(Operator, Name, Operator)),
637
+ (r'0x[0-9a-f]+', Number.Hex),
638
+ # Float variant 1, for example: 1., 1.e2, 1.2e3
639
+ (r'[0-9]+\.[0-9]*(e[+-]?[0-9]+)?', Number.Float),
640
+ # Float variant 2, for example: .1, .1e2
641
+ (r'\.[0-9]+(e[+-]?[0-9]+)?', Number.Float),
642
+ # Float variant 3, for example: 123e45
643
+ (r'[0-9]+e[+-]?[0-9]+', Number.Float),
644
+ (r'[0-9]+', Number.Integer),
645
+ (r"'(''|[^'])*'", String.Single),
646
+ (r'"(""|[^"])*"', String.Symbol),
647
+ (r'[;(),.]', Punctuation),
648
+ # Below we use \w even for the first "real" character because
649
+ # tokens starting with a digit have already been recognized
650
+ # as Number above.
651
+ (r'@@\w+', Name.Builtin),
652
+ (r'@\w+', Name.Variable),
653
+ (r'(\w+)(:)', bygroups(Name.Label, Punctuation)),
654
+ (r'#?#?\w+', Name), # names for temp tables and anything else
655
+ (r'\?', Name.Variable.Magic), # parameter for prepared statements
656
+ ],
657
+ 'multiline-comments': [
658
+ (r'/\*', Comment.Multiline, 'multiline-comments'),
659
+ (r'\*/', Comment.Multiline, '#pop'),
660
+ (r'[^/*]+', Comment.Multiline),
661
+ (r'[/*]', Comment.Multiline)
662
+ ]
663
+ }
664
+
665
+ def analyse_text(text):
666
+ rating = 0
667
+ if tsql_declare_re.search(text):
668
+ # Found T-SQL variable declaration.
669
+ rating = 1.0
670
+ else:
671
+ name_between_backtick_count = len(
672
+ name_between_backtick_re.findall(text))
673
+ name_between_bracket_count = len(
674
+ name_between_bracket_re.findall(text))
675
+ # We need to check if there are any names using
676
+ # backticks or brackets, as otherwise both are 0
677
+ # and 0 >= 2 * 0, so we would always assume it's true
678
+ dialect_name_count = name_between_backtick_count + name_between_bracket_count
679
+ if dialect_name_count >= 1 and \
680
+ name_between_bracket_count >= 2 * name_between_backtick_count:
681
+ # Found at least twice as many [name] as `name`.
682
+ rating += 0.5
683
+ elif name_between_bracket_count > name_between_backtick_count:
684
+ rating += 0.2
685
+ elif name_between_bracket_count > 0:
686
+ rating += 0.1
687
+ if tsql_variable_re.search(text) is not None:
688
+ rating += 0.1
689
+ if tsql_go_re.search(text) is not None:
690
+ rating += 0.1
691
+ return rating
692
+
693
+
694
+ class MySqlLexer(RegexLexer):
695
+ """The Oracle MySQL lexer.
696
+
697
+ This lexer does not attempt to maintain strict compatibility with
698
+ MariaDB syntax or keywords. Although MySQL and MariaDB's common code
699
+ history suggests there may be significant overlap between the two,
700
+ compatibility between the two is not a target for this lexer.
701
+ """
702
+
703
+ name = 'MySQL'
704
+ aliases = ['mysql']
705
+ mimetypes = ['text/x-mysql']
706
+ url = 'https://www.mysql.com'
707
+ version_added = ''
708
+
709
+ flags = re.IGNORECASE
710
+ tokens = {
711
+ 'root': [
712
+ (r'\s+', Whitespace),
713
+
714
+ # Comments
715
+ (r'(?:#|--\s+).*', Comment.Single),
716
+ (r'/\*\+', Comment.Special, 'optimizer-hints'),
717
+ (r'/\*', Comment.Multiline, 'multiline-comment'),
718
+
719
+ # Hexadecimal literals
720
+ (r"x'([0-9a-f]{2})+'", Number.Hex), # MySQL requires paired hex characters in this form.
721
+ (r'0x[0-9a-f]+', Number.Hex),
722
+
723
+ # Binary literals
724
+ (r"b'[01]+'", Number.Bin),
725
+ (r'0b[01]+', Number.Bin),
726
+
727
+ # Numeric literals
728
+ (r'[0-9]+\.[0-9]*(e[+-]?[0-9]+)?', Number.Float), # Mandatory integer, optional fraction and exponent
729
+ (r'[0-9]*\.[0-9]+(e[+-]?[0-9]+)?', Number.Float), # Mandatory fraction, optional integer and exponent
730
+ (r'[0-9]+e[+-]?[0-9]+', Number.Float), # Exponents with integer significands are still floats
731
+ (r'[0-9]+(?=[^0-9a-z$_\u0080-\uffff])', Number.Integer), # Integers that are not in a schema object name
732
+
733
+ # Date literals
734
+ (r"\{\s*d\s*(?P<quote>['\"])\s*\d{2}(\d{2})?.?\d{2}.?\d{2}\s*(?P=quote)\s*\}",
735
+ Literal.Date),
736
+
737
+ # Time literals
738
+ (r"\{\s*t\s*(?P<quote>['\"])\s*(?:\d+\s+)?\d{1,2}.?\d{1,2}.?\d{1,2}(\.\d*)?\s*(?P=quote)\s*\}",
739
+ Literal.Date),
740
+
741
+ # Timestamp literals
742
+ (
743
+ r"\{\s*ts\s*(?P<quote>['\"])\s*"
744
+ r"\d{2}(?:\d{2})?.?\d{2}.?\d{2}" # Date part
745
+ r"\s+" # Whitespace between date and time
746
+ r"\d{1,2}.?\d{1,2}.?\d{1,2}(\.\d*)?" # Time part
747
+ r"\s*(?P=quote)\s*\}",
748
+ Literal.Date
749
+ ),
750
+
751
+ # String literals
752
+ (r"'", String.Single, 'single-quoted-string'),
753
+ (r'"', String.Double, 'double-quoted-string'),
754
+
755
+ # Variables
756
+ (r'@@(?:global\.|persist\.|persist_only\.|session\.)?[a-z_]+', Name.Variable),
757
+ (r'@[a-z0-9_$.]+', Name.Variable),
758
+ (r"@'", Name.Variable, 'single-quoted-variable'),
759
+ (r'@"', Name.Variable, 'double-quoted-variable'),
760
+ (r"@`", Name.Variable, 'backtick-quoted-variable'),
761
+ (r'\?', Name.Variable), # For demonstrating prepared statements
762
+
763
+ # Operators
764
+ (r'[!%&*+/:<=>^|~-]+', Operator),
765
+
766
+ # Exceptions; these words tokenize differently in different contexts.
767
+ (r'\b(set)(?!\s*\()', Keyword),
768
+ (r'\b(character)(\s+)(set)\b', bygroups(Keyword, Whitespace, Keyword)),
769
+ # In all other known cases, "SET" is tokenized by MYSQL_DATATYPES.
770
+
771
+ (words(_mysql_builtins.MYSQL_CONSTANTS, prefix=r'\b', suffix=r'\b'),
772
+ Name.Constant),
773
+ (words(_mysql_builtins.MYSQL_DATATYPES, prefix=r'\b', suffix=r'\b'),
774
+ Keyword.Type),
775
+ (words(_mysql_builtins.MYSQL_KEYWORDS, prefix=r'\b', suffix=r'\b'),
776
+ Keyword),
777
+ (words(_mysql_builtins.MYSQL_FUNCTIONS, prefix=r'\b', suffix=r'\b(\s*)(\()'),
778
+ bygroups(Name.Function, Whitespace, Punctuation)),
779
+
780
+ # Schema object names
781
+ #
782
+ # Note: Although the first regex supports unquoted all-numeric
783
+ # identifiers, this will not be a problem in practice because
784
+ # numeric literals have already been handled above.
785
+ #
786
+ ('[0-9a-z$_\u0080-\uffff]+', Name),
787
+ (r'`', Name.Quoted, 'schema-object-name'),
788
+
789
+ # Punctuation
790
+ (r'[(),.;]', Punctuation),
791
+ ],
792
+
793
+ # Multiline comment substates
794
+ # ---------------------------
795
+
796
+ 'optimizer-hints': [
797
+ (r'[^*a-z]+', Comment.Special),
798
+ (r'\*/', Comment.Special, '#pop'),
799
+ (words(_mysql_builtins.MYSQL_OPTIMIZER_HINTS, suffix=r'\b'),
800
+ Comment.Preproc),
801
+ ('[a-z]+', Comment.Special),
802
+ (r'\*', Comment.Special),
803
+ ],
804
+
805
+ 'multiline-comment': [
806
+ (r'[^*]+', Comment.Multiline),
807
+ (r'\*/', Comment.Multiline, '#pop'),
808
+ (r'\*', Comment.Multiline),
809
+ ],
810
+
811
+ # String substates
812
+ # ----------------
813
+
814
+ 'single-quoted-string': [
815
+ (r"[^'\\]+", String.Single),
816
+ (r"''", String.Escape),
817
+ (r"""\\[0'"bnrtZ\\%_]""", String.Escape),
818
+ (r"'", String.Single, '#pop'),
819
+ ],
820
+
821
+ 'double-quoted-string': [
822
+ (r'[^"\\]+', String.Double),
823
+ (r'""', String.Escape),
824
+ (r"""\\[0'"bnrtZ\\%_]""", String.Escape),
825
+ (r'"', String.Double, '#pop'),
826
+ ],
827
+
828
+ # Variable substates
829
+ # ------------------
830
+
831
+ 'single-quoted-variable': [
832
+ (r"[^']+", Name.Variable),
833
+ (r"''", Name.Variable),
834
+ (r"'", Name.Variable, '#pop'),
835
+ ],
836
+
837
+ 'double-quoted-variable': [
838
+ (r'[^"]+', Name.Variable),
839
+ (r'""', Name.Variable),
840
+ (r'"', Name.Variable, '#pop'),
841
+ ],
842
+
843
+ 'backtick-quoted-variable': [
844
+ (r'[^`]+', Name.Variable),
845
+ (r'``', Name.Variable),
846
+ (r'`', Name.Variable, '#pop'),
847
+ ],
848
+
849
+ # Schema object name substates
850
+ # ----------------------------
851
+ #
852
+ # "Name.Quoted" and "Name.Quoted.Escape" are non-standard but
853
+ # formatters will style them as "Name" by default but add
854
+ # additional styles based on the token name. This gives users
855
+ # flexibility to add custom styles as desired.
856
+ #
857
+ 'schema-object-name': [
858
+ (r'[^`]+', Name.Quoted),
859
+ (r'``', Name.Quoted.Escape),
860
+ (r'`', Name.Quoted, '#pop'),
861
+ ],
862
+ }
863
+
864
+ def analyse_text(text):
865
+ rating = 0
866
+ name_between_backtick_count = len(
867
+ name_between_backtick_re.findall(text))
868
+ name_between_bracket_count = len(
869
+ name_between_bracket_re.findall(text))
870
+ # Same logic as above in the TSQL analysis
871
+ dialect_name_count = name_between_backtick_count + name_between_bracket_count
872
+ if dialect_name_count >= 1 and \
873
+ name_between_backtick_count >= 2 * name_between_bracket_count:
874
+ # Found at least twice as many `name` as [name].
875
+ rating += 0.5
876
+ elif name_between_backtick_count > name_between_bracket_count:
877
+ rating += 0.2
878
+ elif name_between_backtick_count > 0:
879
+ rating += 0.1
880
+ return rating
881
+
882
+
883
+ class GoogleSqlLexer(RegexLexer):
884
+ """
885
+ GoogleSQL is Google's standard SQL dialect, formerly known as ZetaSQL.
886
+
887
+ The list of keywords includes reserved words for future use.
888
+ """
889
+
890
+ name = 'GoogleSQL'
891
+ aliases = ['googlesql', 'zetasql']
892
+ filenames = ['*.googlesql', '*.googlesql.sql']
893
+ mimetypes = ['text/x-google-sql', 'text/x-google-sql-aux']
894
+ url = 'https://cloud.google.com/bigquery/googlesql'
895
+ version_added = '2.19'
896
+
897
+ flags = re.IGNORECASE
898
+ tokens = {
899
+ 'root': [
900
+ (r'\s+', Whitespace),
901
+
902
+ # Comments
903
+ (r'(?:#|--\s+).*', Comment.Single),
904
+ (r'/\*', Comment.Multiline, 'multiline-comment'),
905
+
906
+ # Hexadecimal literals
907
+ (r"x'([0-9a-f]{2})+'", Number.Hex),
908
+ (r'0x[0-9a-f]+', Number.Hex),
909
+
910
+ # Binary literals
911
+ (r"b'[01]+'", Number.Bin),
912
+ (r'0b[01]+', Number.Bin),
913
+
914
+ # Numeric literals
915
+ (r'[0-9]+\.[0-9]*(e[+-]?[0-9]+)?', Number.Float), # Mandatory integer, optional fraction and exponent
916
+ (r'[0-9]*\.[0-9]+(e[+-]?[0-9]+)?', Number.Float), # Mandatory fraction, optional integer and exponent
917
+ (r'[0-9]+e[+-]?[0-9]+', Number.Float), # Exponents with integer significands are still floats
918
+ (r'[0-9]+(?=[^0-9a-z$_\u0080-\uffff])', Number.Integer), # Integers that are not in a schema object name
919
+
920
+ # Date literals
921
+ (r"\{\s*d\s*(?P<quote>['\"])\s*\d{2}(\d{2})?.?\d{2}.?\d{2}\s*(?P=quote)\s*\}",
922
+ Literal.Date),
923
+
924
+ # Time literals
925
+ (r"\{\s*t\s*(?P<quote>['\"])\s*(?:\d+\s+)?\d{1,2}.?\d{1,2}.?\d{1,2}(\.\d*)?\s*(?P=quote)\s*\}",
926
+ Literal.Date),
927
+
928
+ # Timestamp literals
929
+ (
930
+ r"\{\s*ts\s*(?P<quote>['\"])\s*"
931
+ r"\d{2}(?:\d{2})?.?\d{2}.?\d{2}" # Date part
932
+ r"\s+" # Whitespace between date and time
933
+ r"\d{1,2}.?\d{1,2}.?\d{1,2}(\.\d*)?" # Time part
934
+ r"\s*(?P=quote)\s*\}",
935
+ Literal.Date
936
+ ),
937
+
938
+ # String literals
939
+ (r"'", String.Single, 'single-quoted-string'),
940
+ (r'"', String.Double, 'double-quoted-string'),
941
+
942
+ # Variables
943
+ (r'@@(?:global\.|persist\.|persist_only\.|session\.)?[a-z_]+', Name.Variable),
944
+ (r'@[a-z0-9_$.]+', Name.Variable),
945
+ (r"@'", Name.Variable, 'single-quoted-variable'),
946
+ (r'@"', Name.Variable, 'double-quoted-variable'),
947
+ (r"@`", Name.Variable, 'backtick-quoted-variable'),
948
+ (r'\?', Name.Variable), # For demonstrating prepared statements
949
+
950
+ # Exceptions; these words tokenize differently in different contexts.
951
+ (r'\b(set)(?!\s*\()', Keyword),
952
+ (r'\b(character)(\s+)(set)\b', bygroups(Keyword, Whitespace, Keyword)),
953
+
954
+ # Constants, types, keywords, functions, operators
955
+ (words(_googlesql_builtins.constants, prefix=r'\b', suffix=r'\b'), Name.Constant),
956
+ (words(_googlesql_builtins.types, prefix=r'\b', suffix=r'\b'), Keyword.Type),
957
+ (words(_googlesql_builtins.keywords, prefix=r'\b', suffix=r'\b'), Keyword),
958
+ (words(_googlesql_builtins.functionnames, prefix=r'\b', suffix=r'\b(\s*)(\()'),
959
+ bygroups(Name.Function, Whitespace, Punctuation)),
960
+ (words(_googlesql_builtins.operators, prefix=r'\b', suffix=r'\b'), Operator),
961
+
962
+ # Schema object names
963
+ #
964
+ # Note: Although the first regex supports unquoted all-numeric
965
+ # identifiers, this will not be a problem in practice because
966
+ # numeric literals have already been handled above.
967
+ #
968
+ ('[0-9a-z$_\u0080-\uffff]+', Name),
969
+ (r'`', Name.Quoted, 'schema-object-name'),
970
+
971
+ # Punctuation
972
+ (r'[(),.;]', Punctuation),
973
+ ],
974
+
975
+ # Multiline comment substates
976
+ # ---------------------------
977
+
978
+ 'multiline-comment': [
979
+ (r'[^*]+', Comment.Multiline),
980
+ (r'\*/', Comment.Multiline, '#pop'),
981
+ (r'\*', Comment.Multiline),
982
+ ],
983
+
984
+ # String substates
985
+ # ----------------
986
+
987
+ 'single-quoted-string': [
988
+ (r"[^'\\]+", String.Single),
989
+ (r"''", String.Escape),
990
+ (r"""\\[0'"bnrtZ\\%_]""", String.Escape),
991
+ (r"'", String.Single, '#pop'),
992
+ ],
993
+
994
+ 'double-quoted-string': [
995
+ (r'[^"\\]+', String.Double),
996
+ (r'""', String.Escape),
997
+ (r"""\\[0'"bnrtZ\\%_]""", String.Escape),
998
+ (r'"', String.Double, '#pop'),
999
+ ],
1000
+
1001
+ # Variable substates
1002
+ # ------------------
1003
+
1004
+ 'single-quoted-variable': [
1005
+ (r"[^']+", Name.Variable),
1006
+ (r"''", Name.Variable),
1007
+ (r"'", Name.Variable, '#pop'),
1008
+ ],
1009
+
1010
+ 'double-quoted-variable': [
1011
+ (r'[^"]+', Name.Variable),
1012
+ (r'""', Name.Variable),
1013
+ (r'"', Name.Variable, '#pop'),
1014
+ ],
1015
+
1016
+ 'backtick-quoted-variable': [
1017
+ (r'[^`]+', Name.Variable),
1018
+ (r'``', Name.Variable),
1019
+ (r'`', Name.Variable, '#pop'),
1020
+ ],
1021
+
1022
+ # Schema object name substates
1023
+ # ----------------------------
1024
+ #
1025
+ # "Name.Quoted" and "Name.Quoted.Escape" are non-standard but
1026
+ # formatters will style them as "Name" by default but add
1027
+ # additional styles based on the token name. This gives users
1028
+ # flexibility to add custom styles as desired.
1029
+ #
1030
+ 'schema-object-name': [
1031
+ (r'[^`]+', Name.Quoted),
1032
+ (r'``', Name.Quoted.Escape),
1033
+ (r'`', Name.Quoted, '#pop'),
1034
+ ],
1035
+ }
1036
+
1037
+ def analyse_text(text):
1038
+ tokens = collections.Counter(text.split())
1039
+ return 0.001 * sum(count for t, count in tokens.items()
1040
+ if t in googlesql_identifiers)
1041
+
1042
+
1043
+ class SqliteConsoleLexer(Lexer):
1044
+ """
1045
+ Lexer for example sessions using sqlite3.
1046
+ """
1047
+
1048
+ name = 'sqlite3con'
1049
+ aliases = ['sqlite3']
1050
+ filenames = ['*.sqlite3-console']
1051
+ mimetypes = ['text/x-sqlite3-console']
1052
+ url = 'https://www.sqlite.org'
1053
+ version_added = '0.11'
1054
+ _example = "sqlite3/sqlite3.sqlite3-console"
1055
+
1056
+ def get_tokens_unprocessed(self, data):
1057
+ sql = SqlLexer(**self.options)
1058
+
1059
+ curcode = ''
1060
+ insertions = []
1061
+ for match in line_re.finditer(data):
1062
+ line = match.group()
1063
+ prompt_match = sqlite_prompt_re.match(line)
1064
+ if prompt_match is not None:
1065
+ insertions.append((len(curcode),
1066
+ [(0, Generic.Prompt, line[:7])]))
1067
+ insertions.append((len(curcode),
1068
+ [(7, Whitespace, ' ')]))
1069
+ curcode += line[8:]
1070
+ else:
1071
+ if curcode:
1072
+ yield from do_insertions(insertions,
1073
+ sql.get_tokens_unprocessed(curcode))
1074
+ curcode = ''
1075
+ insertions = []
1076
+ if line.startswith('SQL error: '):
1077
+ yield (match.start(), Generic.Traceback, line)
1078
+ else:
1079
+ yield (match.start(), Generic.Output, line)
1080
+ if curcode:
1081
+ yield from do_insertions(insertions,
1082
+ sql.get_tokens_unprocessed(curcode))
1083
+
1084
+
1085
+ class RqlLexer(RegexLexer):
1086
+ """
1087
+ Lexer for Relation Query Language.
1088
+ """
1089
+ name = 'RQL'
1090
+ url = 'http://www.logilab.org/project/rql'
1091
+ aliases = ['rql']
1092
+ filenames = ['*.rql']
1093
+ mimetypes = ['text/x-rql']
1094
+ version_added = '2.0'
1095
+
1096
+ flags = re.IGNORECASE
1097
+ tokens = {
1098
+ 'root': [
1099
+ (r'\s+', Whitespace),
1100
+ (r'(DELETE|SET|INSERT|UNION|DISTINCT|WITH|WHERE|BEING|OR'
1101
+ r'|AND|NOT|GROUPBY|HAVING|ORDERBY|ASC|DESC|LIMIT|OFFSET'
1102
+ r'|TODAY|NOW|TRUE|FALSE|NULL|EXISTS)\b', Keyword),
1103
+ (r'[+*/<>=%-]', Operator),
1104
+ (r'(Any|is|instance_of|CWEType|CWRelation)\b', Name.Builtin),
1105
+ (r'[0-9]+', Number.Integer),
1106
+ (r'[A-Z_]\w*\??', Name),
1107
+ (r"'(''|[^'])*'", String.Single),
1108
+ (r'"(""|[^"])*"', String.Single),
1109
+ (r'[;:()\[\],.]', Punctuation)
1110
+ ],
1111
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/srcinfo.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.srcinfo
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for .SRCINFO files used by Arch Linux Packages.
6
+
7
+ The description of the format can be found in the wiki:
8
+ https://wiki.archlinux.org/title/.SRCINFO
9
+
10
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
11
+ :license: BSD, see LICENSE for details.
12
+ """
13
+
14
+ from pygments.lexer import RegexLexer, words
15
+ from pygments.token import Text, Comment, Keyword, Name, Operator, Whitespace
16
+
17
+ __all__ = ['SrcinfoLexer']
18
+
19
+ keywords = (
20
+ 'pkgbase', 'pkgname',
21
+ 'pkgver', 'pkgrel', 'epoch',
22
+ 'pkgdesc', 'url', 'install', 'changelog',
23
+ 'arch', 'groups', 'license', 'noextract', 'options', 'backup',
24
+ 'validpgpkeys',
25
+ )
26
+
27
+ architecture_dependent_keywords = (
28
+ 'source', 'depends', 'checkdepends', 'makedepends', 'optdepends',
29
+ 'provides', 'conflicts', 'replaces',
30
+ 'md5sums', 'sha1sums', 'sha224sums', 'sha256sums', 'sha384sums',
31
+ 'sha512sums',
32
+ )
33
+
34
+
35
+ class SrcinfoLexer(RegexLexer):
36
+ """Lexer for .SRCINFO files used by Arch Linux Packages.
37
+ """
38
+
39
+ name = 'Srcinfo'
40
+ aliases = ['srcinfo']
41
+ filenames = ['.SRCINFO']
42
+ url = 'https://wiki.archlinux.org/title/.SRCINFO'
43
+ version_added = '2.11'
44
+
45
+ tokens = {
46
+ 'root': [
47
+ (r'\s+', Whitespace),
48
+ (r'#.*', Comment.Single),
49
+ (words(keywords), Keyword, 'assignment'),
50
+ (words(architecture_dependent_keywords, suffix=r'_\w+'),
51
+ Keyword, 'assignment'),
52
+ (r'\w+', Name.Variable, 'assignment'),
53
+ ],
54
+ 'assignment': [
55
+ (r' +', Whitespace),
56
+ (r'=', Operator, 'value'),
57
+ ],
58
+ 'value': [
59
+ (r' +', Whitespace),
60
+ (r'.*', Text, '#pop:2'),
61
+ ],
62
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/stata.py ADDED
@@ -0,0 +1,170 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.stata
3
+ ~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Stata
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
+ from pygments.lexer import RegexLexer, default, include, words
13
+ from pygments.token import Comment, Keyword, Name, Number, \
14
+ String, Text, Operator
15
+
16
+ from pygments.lexers._stata_builtins import builtins_base, builtins_functions
17
+
18
+ __all__ = ['StataLexer']
19
+
20
+
21
+ class StataLexer(RegexLexer):
22
+ """
23
+ For Stata do files.
24
+ """
25
+ # Syntax based on
26
+ # - http://fmwww.bc.edu/RePEc/bocode/s/synlightlist.ado
27
+ # - https://github.com/isagalaev/highlight.js/blob/master/src/languages/stata.js
28
+ # - https://github.com/jpitblado/vim-stata/blob/master/syntax/stata.vim
29
+
30
+ name = 'Stata'
31
+ url = 'http://www.stata.com/'
32
+ version_added = '2.2'
33
+ aliases = ['stata', 'do']
34
+ filenames = ['*.do', '*.ado']
35
+ mimetypes = ['text/x-stata', 'text/stata', 'application/x-stata']
36
+ flags = re.MULTILINE | re.DOTALL
37
+
38
+ tokens = {
39
+ 'root': [
40
+ include('comments'),
41
+ include('strings'),
42
+ include('macros'),
43
+ include('numbers'),
44
+ include('keywords'),
45
+ include('operators'),
46
+ include('format'),
47
+ (r'.', Text),
48
+ ],
49
+ # Comments are a complicated beast in Stata because they can be
50
+ # nested and there are a few corner cases with that. See:
51
+ # - github.com/kylebarron/language-stata/issues/90
52
+ # - statalist.org/forums/forum/general-stata-discussion/general/1448244
53
+ 'comments': [
54
+ (r'(^//|(?<=\s)//)(?!/)', Comment.Single, 'comments-double-slash'),
55
+ (r'^\s*\*', Comment.Single, 'comments-star'),
56
+ (r'/\*', Comment.Multiline, 'comments-block'),
57
+ (r'(^///|(?<=\s)///)', Comment.Special, 'comments-triple-slash')
58
+ ],
59
+ 'comments-block': [
60
+ (r'/\*', Comment.Multiline, '#push'),
61
+ # this ends and restarts a comment block. but need to catch this so
62
+ # that it doesn\'t start _another_ level of comment blocks
63
+ (r'\*/\*', Comment.Multiline),
64
+ (r'(\*/\s+\*(?!/)[^\n]*)|(\*/)', Comment.Multiline, '#pop'),
65
+ # Match anything else as a character inside the comment
66
+ (r'.', Comment.Multiline),
67
+ ],
68
+ 'comments-star': [
69
+ (r'///.*?\n', Comment.Single,
70
+ ('#pop', 'comments-triple-slash')),
71
+ (r'(^//|(?<=\s)//)(?!/)', Comment.Single,
72
+ ('#pop', 'comments-double-slash')),
73
+ (r'/\*', Comment.Multiline, 'comments-block'),
74
+ (r'.(?=\n)', Comment.Single, '#pop'),
75
+ (r'.', Comment.Single),
76
+ ],
77
+ 'comments-triple-slash': [
78
+ (r'\n', Comment.Special, '#pop'),
79
+ # A // breaks out of a comment for the rest of the line
80
+ (r'//.*?(?=\n)', Comment.Single, '#pop'),
81
+ (r'.', Comment.Special),
82
+ ],
83
+ 'comments-double-slash': [
84
+ (r'\n', Text, '#pop'),
85
+ (r'.', Comment.Single),
86
+ ],
87
+ # `"compound string"' and regular "string"; note the former are
88
+ # nested.
89
+ 'strings': [
90
+ (r'`"', String, 'string-compound'),
91
+ (r'(?<!`)"', String, 'string-regular'),
92
+ ],
93
+ 'string-compound': [
94
+ (r'`"', String, '#push'),
95
+ (r'"\'', String, '#pop'),
96
+ (r'\\\\|\\"|\\\$|\\`|\\\n', String.Escape),
97
+ include('macros'),
98
+ (r'.', String)
99
+ ],
100
+ 'string-regular': [
101
+ (r'(")(?!\')|(?=\n)', String, '#pop'),
102
+ (r'\\\\|\\"|\\\$|\\`|\\\n', String.Escape),
103
+ include('macros'),
104
+ (r'.', String)
105
+ ],
106
+ # A local is usually
107
+ # `\w{0,31}'
108
+ # `:extended macro'
109
+ # `=expression'
110
+ # `[rsen](results)'
111
+ # `(++--)scalar(++--)'
112
+ #
113
+ # However, there are all sorts of weird rules wrt edge
114
+ # cases. Instead of writing 27 exceptions, anything inside
115
+ # `' is a local.
116
+ #
117
+ # A global is more restricted, so we do follow rules. Note only
118
+ # locals explicitly enclosed ${} can be nested.
119
+ 'macros': [
120
+ (r'\$(\{|(?=[$`]))', Name.Variable.Global, 'macro-global-nested'),
121
+ (r'\$', Name.Variable.Global, 'macro-global-name'),
122
+ (r'`', Name.Variable, 'macro-local'),
123
+ ],
124
+ 'macro-local': [
125
+ (r'`', Name.Variable, '#push'),
126
+ (r"'", Name.Variable, '#pop'),
127
+ (r'\$(\{|(?=[$`]))', Name.Variable.Global, 'macro-global-nested'),
128
+ (r'\$', Name.Variable.Global, 'macro-global-name'),
129
+ (r'.', Name.Variable), # fallback
130
+ ],
131
+ 'macro-global-nested': [
132
+ (r'\$(\{|(?=[$`]))', Name.Variable.Global, '#push'),
133
+ (r'\}', Name.Variable.Global, '#pop'),
134
+ (r'\$', Name.Variable.Global, 'macro-global-name'),
135
+ (r'`', Name.Variable, 'macro-local'),
136
+ (r'\w', Name.Variable.Global), # fallback
137
+ default('#pop'),
138
+ ],
139
+ 'macro-global-name': [
140
+ (r'\$(\{|(?=[$`]))', Name.Variable.Global, 'macro-global-nested', '#pop'),
141
+ (r'\$', Name.Variable.Global, 'macro-global-name', '#pop'),
142
+ (r'`', Name.Variable, 'macro-local', '#pop'),
143
+ (r'\w{1,32}', Name.Variable.Global, '#pop'),
144
+ ],
145
+ # Built in functions and statements
146
+ 'keywords': [
147
+ (words(builtins_functions, prefix = r'\b', suffix = r'(?=\()'),
148
+ Name.Function),
149
+ (words(builtins_base, prefix = r'(^\s*|\s)', suffix = r'\b'),
150
+ Keyword),
151
+ ],
152
+ # http://www.stata.com/help.cgi?operators
153
+ 'operators': [
154
+ (r'-|==|<=|>=|<|>|&|!=', Operator),
155
+ (r'\*|\+|\^|/|!|~|==|~=', Operator)
156
+ ],
157
+ # Stata numbers
158
+ 'numbers': [
159
+ # decimal number
160
+ (r'\b[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)([eE][+-]?[0-9]+)?[i]?\b',
161
+ Number),
162
+ ],
163
+ # Stata formats
164
+ 'format': [
165
+ (r'%-?\d{1,2}(\.\d{1,2})?[gfe]c?', Name.Other),
166
+ (r'%(21x|16H|16L|8H|8L)', Name.Other),
167
+ (r'%-?(tc|tC|td|tw|tm|tq|th|ty|tg)\S{0,32}', Name.Other),
168
+ (r'%[-~]?\d{1,4}s', Name.Other),
169
+ ]
170
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/supercollider.py ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.supercollider
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for SuperCollider
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, words, default
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation
16
+
17
+ __all__ = ['SuperColliderLexer']
18
+
19
+
20
+ class SuperColliderLexer(RegexLexer):
21
+ """
22
+ For SuperCollider source code.
23
+ """
24
+
25
+ name = 'SuperCollider'
26
+ url = 'http://supercollider.github.io/'
27
+ aliases = ['supercollider', 'sc']
28
+ filenames = ['*.sc', '*.scd']
29
+ mimetypes = ['application/supercollider', 'text/supercollider']
30
+ version_added = '2.1'
31
+
32
+ flags = re.DOTALL | re.MULTILINE
33
+ tokens = {
34
+ 'commentsandwhitespace': [
35
+ (r'\s+', Text),
36
+ (r'<!--', Comment),
37
+ (r'//.*?\n', Comment.Single),
38
+ (r'/\*.*?\*/', Comment.Multiline)
39
+ ],
40
+ 'slashstartsregex': [
41
+ include('commentsandwhitespace'),
42
+ (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
43
+ r'([gim]+\b|\B)', String.Regex, '#pop'),
44
+ (r'(?=/)', Text, ('#pop', 'badregex')),
45
+ default('#pop'),
46
+ ],
47
+ 'badregex': [
48
+ (r'\n', Text, '#pop')
49
+ ],
50
+ 'root': [
51
+ (r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
52
+ include('commentsandwhitespace'),
53
+ (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
54
+ r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
55
+ (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
56
+ (r'[})\].]', Punctuation),
57
+ (words((
58
+ 'for', 'in', 'while', 'do', 'break', 'return', 'continue',
59
+ 'switch', 'case', 'default', 'if', 'else', 'throw', 'try',
60
+ 'catch', 'finally', 'new', 'delete', 'typeof', 'instanceof',
61
+ 'void'), suffix=r'\b'),
62
+ Keyword, 'slashstartsregex'),
63
+ (words(('var', 'let', 'with', 'function', 'arg'), suffix=r'\b'),
64
+ Keyword.Declaration, 'slashstartsregex'),
65
+ (words((
66
+ '(abstract', 'boolean', 'byte', 'char', 'class', 'const',
67
+ 'debugger', 'double', 'enum', 'export', 'extends', 'final',
68
+ 'float', 'goto', 'implements', 'import', 'int', 'interface',
69
+ 'long', 'native', 'package', 'private', 'protected', 'public',
70
+ 'short', 'static', 'super', 'synchronized', 'throws',
71
+ 'transient', 'volatile'), suffix=r'\b'),
72
+ Keyword.Reserved),
73
+ (words(('true', 'false', 'nil', 'inf'), suffix=r'\b'), Keyword.Constant),
74
+ (words((
75
+ 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Number',
76
+ 'Object', 'Packages', 'RegExp', 'String',
77
+ 'isFinite', 'isNaN', 'parseFloat', 'parseInt', 'super',
78
+ 'thisFunctionDef', 'thisFunction', 'thisMethod', 'thisProcess',
79
+ 'thisThread', 'this'), suffix=r'\b'),
80
+ Name.Builtin),
81
+ (r'[$a-zA-Z_]\w*', Name.Other),
82
+ (r'\\?[$a-zA-Z_]\w*', String.Symbol),
83
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
84
+ (r'0x[0-9a-fA-F]+', Number.Hex),
85
+ (r'[0-9]+', Number.Integer),
86
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
87
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
88
+ ]
89
+ }
90
+
91
+ def analyse_text(text):
92
+ """We're searching for a common function and a unique keyword here."""
93
+ if 'SinOsc' in text or 'thisFunctionDef' in text:
94
+ return 0.1
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/tablegen.py ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.tablegen
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for LLVM's TableGen DSL.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, include, words, using
12
+ from pygments.lexers.c_cpp import CppLexer
13
+ from pygments.token import Comment, Keyword, Name, Number, Operator, \
14
+ Punctuation, String, Text, Whitespace, Error
15
+
16
+ __all__ = ['TableGenLexer']
17
+
18
+ KEYWORDS = (
19
+ 'assert',
20
+ 'class',
21
+ 'code',
22
+ 'def',
23
+ 'dump',
24
+ 'else',
25
+ 'foreach',
26
+ 'defm',
27
+ 'defset',
28
+ 'defvar',
29
+ 'field',
30
+ 'if',
31
+ 'in',
32
+ 'include',
33
+ 'let',
34
+ 'multiclass',
35
+ 'then',
36
+ )
37
+
38
+ KEYWORDS_CONST = (
39
+ 'false',
40
+ 'true',
41
+ )
42
+ KEYWORDS_TYPE = (
43
+ 'bit',
44
+ 'bits',
45
+ 'dag',
46
+ 'int',
47
+ 'list',
48
+ 'string',
49
+ )
50
+
51
+ BANG_OPERATORS = (
52
+ 'add',
53
+ 'and',
54
+ 'cast',
55
+ 'con',
56
+ 'cond',
57
+ 'dag',
58
+ 'div',
59
+ 'empty',
60
+ 'eq',
61
+ 'exists',
62
+ 'filter',
63
+ 'find',
64
+ 'foldl',
65
+ 'foreach',
66
+ 'ge',
67
+ 'getdagarg',
68
+ 'getdagname',
69
+ 'getdagop',
70
+ 'gt',
71
+ 'head',
72
+ 'if',
73
+ 'interleave',
74
+ 'isa',
75
+ 'le',
76
+ 'listconcat',
77
+ 'listremove',
78
+ 'listsplat',
79
+ 'logtwo',
80
+ 'lt',
81
+ 'mul',
82
+ 'ne',
83
+ 'not',
84
+ 'or',
85
+ 'range',
86
+ 'repr',
87
+ 'setdagarg',
88
+ 'setdagname',
89
+ 'setdagop',
90
+ 'shl',
91
+ 'size',
92
+ 'sra',
93
+ 'srl',
94
+ 'strconcat',
95
+ 'sub',
96
+ 'subst',
97
+ 'substr',
98
+ 'tail',
99
+ 'tolower',
100
+ 'toupper',
101
+ 'xor',
102
+ )
103
+
104
+ class TableGenLexer(RegexLexer):
105
+ """
106
+ Lexer for TableGen
107
+ """
108
+
109
+ name = 'TableGen'
110
+ url = 'https://llvm.org/docs/TableGen/ProgRef.html'
111
+ aliases = ['tablegen', 'td']
112
+ filenames = ['*.td']
113
+
114
+ version_added = '2.19'
115
+
116
+ tokens = {
117
+ 'root': [
118
+ (r'\s+', Whitespace),
119
+
120
+ (r'/\*', Comment.Multiline, 'comment'),
121
+ (r'//.*?$', Comment.Single),
122
+ (r'#(define|ifdef|ifndef|else|endif)', Comment.Preproc),
123
+
124
+ # Binary/hex numbers. Note that these take priority over names,
125
+ # which may begin with numbers.
126
+ (r'0b[10]+', Number.Bin),
127
+ (r'0x[0-9a-fA-F]+', Number.Hex),
128
+
129
+ # Keywords
130
+ (words(KEYWORDS, suffix=r'\b'), Keyword),
131
+ (words(KEYWORDS_CONST, suffix=r'\b'), Keyword.Constant),
132
+ (words(KEYWORDS_TYPE, suffix=r'\b'), Keyword.Type),
133
+
134
+ # Bang operators
135
+ (words(BANG_OPERATORS, prefix=r'\!', suffix=r'\b'), Operator),
136
+ # Unknown bang operators are an error
137
+ (r'![a-zA-Z]+', Error),
138
+
139
+ # Names and identifiers
140
+ (r'[0-9]*[a-zA-Z_][a-zA-Z_0-9]*', Name),
141
+ (r'\$[a-zA-Z_][a-zA-Z_0-9]*', Name.Variable),
142
+
143
+ # Place numbers after keywords. Names/identifiers may begin with
144
+ # numbers, and we want to parse 1X as one name token as opposed to
145
+ # a number and a name.
146
+ (r'[-\+]?[0-9]+', Number.Integer),
147
+
148
+ # String literals
149
+ (r'"', String, 'dqs'),
150
+ (r'\[\{', Punctuation, 'codeblock'),
151
+
152
+ # Misc. punctuation
153
+ (r'[-+\[\]{}()<>\.,;:=?#]+', Punctuation),
154
+ ],
155
+ 'comment': [
156
+ (r'[^*/]+', Comment.Multiline),
157
+ (r'/\*', Comment.Multiline, '#push'),
158
+ (r'\*/', Comment.Multiline, '#pop'),
159
+ (r'[*/]', Comment.Multiline)
160
+ ],
161
+ 'strings': [
162
+ (r'\\[\\\'"tn]', String.Escape),
163
+ (r'[^\\"]+', String),
164
+ ],
165
+ # Double-quoted string, a la C
166
+ 'dqs': [
167
+ (r'"', String, '#pop'),
168
+ include('strings'),
169
+ ],
170
+ # NOTE: Must escape (pop Cpplexer) codeblock to avoid infinite loop.
171
+ # Assume that the code inside a code block is C++. This isn't always
172
+ # true in TableGen, but is the far most common scenario.
173
+ 'codeblock': [
174
+ (r'\}\]', Text, '#pop'),
175
+ (r'([^}]+|\}[^]])*', using(CppLexer), "#pop"),
176
+ ],
177
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/tact.py ADDED
@@ -0,0 +1,303 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.tact
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Tact.
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 Comment, Operator, Keyword, Name, String, \
13
+ Number, Whitespace, Punctuation
14
+
15
+ __all__ = ['TactLexer']
16
+
17
+
18
+ class TactLexer(RegexLexer):
19
+ """For Tact source code."""
20
+
21
+ name = 'Tact'
22
+ aliases = ['tact']
23
+ filenames = ['*.tact']
24
+ url = "https://tact-lang.org"
25
+ version_added = '2.18'
26
+
27
+ tokens = {
28
+ 'root': [
29
+ (r'\s+', Whitespace),
30
+ (r'[.;(),\[\]{}]', Punctuation),
31
+ (r'\?|!!', Operator),
32
+ include('comments'),
33
+ include('import-in'),
34
+ include('struct-in'),
35
+ include('contract-or-trait-in'),
36
+ include('annotation-in'),
37
+ include('fun-declaration-in'),
38
+ include('const-declaration-in'),
39
+ include('statements'),
40
+ ],
41
+ 'import-in': [
42
+ (r'((?<=\.\.\.)|(?<![.$]))\b(import)\b(\s*)', bygroups(Punctuation, Keyword, Whitespace), 'import'),
43
+ ],
44
+ 'import': [
45
+ (r';', Punctuation, '#pop'),
46
+ include('comments'),
47
+ include('string-in'),
48
+ (r'\s+', Whitespace),
49
+ ],
50
+ 'struct-in': [
51
+ (r'((?<=\.\.\.)|(?<![.$]))\b(struct|message)\b', bygroups(Punctuation, Keyword), 'struct'),
52
+ ],
53
+ 'struct': [
54
+ include('comments'),
55
+ include('struct-header'),
56
+ include('struct-body-in'),
57
+ (r'\s+', Whitespace),
58
+ ],
59
+ 'struct-header': [
60
+ include('comments'),
61
+ (r'\b\w+', Name.Class),
62
+ (r'(\()((?:\b0[xX])[0-9a-fA-F][0-9a-fA-F_]*\b)(\))', bygroups(Punctuation, Number.Hex, Punctuation)),
63
+ (r'(\()((?:\b[0-9]+\b))(\))', bygroups(Punctuation, Number.Integer, Punctuation)),
64
+ ],
65
+ 'struct-body-in': [
66
+ (r'\{', Punctuation, 'struct-body'),
67
+ ],
68
+ 'struct-body': [
69
+ (r'\}', Punctuation, '#pop:2'),
70
+ include('comments'),
71
+ include('field-declaration-in'),
72
+ ],
73
+ 'contract-or-trait-in': [
74
+ (r'((?<=\.\.\.)|(?<![.$]))\b(contract|trait)\b', Keyword, 'contract-or-trait'),
75
+ ],
76
+ 'contract-or-trait': [
77
+ include('comments'),
78
+ (r'with', Keyword),
79
+ (r'\b\w+', Name.Class),
80
+ include('contract-or-trait-body-in'),
81
+ (r'\s+', Whitespace),
82
+ (r',', Punctuation),
83
+ ],
84
+ 'contract-or-trait-body-in': [
85
+ (r'\{', Punctuation, 'contract-or-trait-body'),
86
+ ],
87
+ 'contract-or-trait-body': [
88
+ (r'\}', Punctuation, '#pop:2'),
89
+ include('comments'),
90
+ include('init-declaration-in'),
91
+ include('receive-declaration-in'),
92
+ include('bounce-declaration-in'),
93
+ include('fun-declaration-in'),
94
+ include('const-declaration-in'),
95
+ include('field-declaration-in'),
96
+ (r'\s+', Whitespace),
97
+ ],
98
+ 'field-declaration-in': [
99
+ (r'\b\w+', Name.Property, 'field-declaration'),
100
+ ],
101
+ 'field-declaration': [
102
+ (r';', Punctuation, '#pop'),
103
+ include('comments'),
104
+ include('type-annotation-in'),
105
+ include('variable-init-in'),
106
+ ],
107
+ 'const-declaration-in': [
108
+ (r'(?=\b(?:(?:get|native|extends|mutates|virtual|override|inline|abstract)\s*)*const\b)', Keyword, 'const-declaration'),
109
+ ],
110
+ 'const-declaration': [
111
+ (r'(;)', Punctuation, '#pop'),
112
+ (r'const', Keyword),
113
+ (words(('get', 'native', 'extends', 'mutates', 'virtual', 'override', 'inline', 'abstract'), suffix=r'\b'), Keyword),
114
+ (r'\b\w+\b', Name.Constant),
115
+ include('comments'),
116
+ include('type-annotation-in'),
117
+ include('variable-init-in'),
118
+ (r'\s+', Whitespace),
119
+ ],
120
+ 'init-declaration-in': [
121
+ (r'(init)', Keyword, 'init-declaration')
122
+ ],
123
+ 'init-declaration': [
124
+ (r'(?<=\})', Punctuation, '#pop'),
125
+ include('comments'),
126
+ include('fun-arguments-in'),
127
+ include('block-declaration-in'),
128
+ (r'\s+', Whitespace),
129
+ ],
130
+ 'receive-declaration-in': [
131
+ (r'(receive|exernal)', Keyword, 'receive-declaration')
132
+ ],
133
+ 'receive-declaration': [
134
+ (r'(?<=\})', Punctuation, '#pop'),
135
+ include('comments'),
136
+ include('fun-arguments-in'),
137
+ include('block-declaration-in'),
138
+ ],
139
+ 'bounce-declaration-in': [
140
+ (r'(bounced)', Keyword, 'bounce-declaration')
141
+ ],
142
+ 'bounce-declaration': [
143
+ (r'(?<=\})', Punctuation, '#pop'),
144
+ include('comments'),
145
+ include('fun-arguments-in'),
146
+ include('block-declaration-in'),
147
+ ],
148
+ 'fun-declaration-in': [
149
+ (r'(?=\b(?:(?:get|native|extends|mutates|virtual|override|inline|abstract)\s*)*fun\b)', Keyword, 'fun-declaration')
150
+ ],
151
+ 'fun-declaration': [
152
+ (r'(?<=\}|\;)', Punctuation, '#pop'),
153
+ (r'fun', Keyword),
154
+ (r'\b(get|native|extends|mutates|virtual|override|inline|abstract)\b', Keyword),
155
+ (r'\b[\w]+', Name.Function),
156
+ include('fun-declaration-body'),
157
+ (r'[,;]', Punctuation),
158
+ ],
159
+ 'fun-declaration-body': [
160
+ include('comments'),
161
+ include('fun-arguments-in'),
162
+ include('type-annotation-in'),
163
+ include('block-declaration-in'),
164
+ (r'\s+', Whitespace),
165
+ ],
166
+ 'fun-arguments-in': [
167
+ (r'\(', Punctuation, 'fun-arguments'),
168
+ ],
169
+ 'fun-arguments': [
170
+ (r'\)', Punctuation, '#pop'),
171
+ include('comments'),
172
+ include('string-in'),
173
+ include('type-annotation-in'),
174
+ (r'(self)|(\b[\w]+\b)', bygroups(Name.Variable.Instance, Name.Variable)),
175
+ (r',', Punctuation),
176
+ (r'\s+', Whitespace),
177
+ ],
178
+ 'block-declaration-in': [
179
+ (r'\{', Punctuation, 'block-declaration')
180
+ ],
181
+ 'block-declaration': [
182
+ (r'\}', Punctuation, '#pop'),
183
+ include('statements'),
184
+ ],
185
+ 'statements': [
186
+ include('comments'),
187
+ include('block-declaration-in'),
188
+ include('expressions'),
189
+ ],
190
+ 'annotation-in': [
191
+ (r'(@)(\w+)(\()', bygroups(Keyword.Pseudo, Keyword, Punctuation), 'annotation')
192
+ ],
193
+ 'annotation': [
194
+ (r'\)', Punctuation, '#pop'),
195
+ include('annotation-argument'),
196
+ (r'\s+', Whitespace),
197
+ ],
198
+ 'annotation-argument': [
199
+ (r'\w+', Name.Function.Magic),
200
+ ],
201
+ 'expressions': [
202
+ include('comments'),
203
+ include('type-annotation-in'),
204
+ include('keywords'),
205
+ include('numeric'),
206
+ include('string-in'),
207
+ include('variable'),
208
+ include('function-call'),
209
+ include('struct-init-in'),
210
+ ],
211
+ 'struct-init-in': [
212
+ (r'(\b\w+)(\s*)(\{)', bygroups(Name.Class, Whitespace, Punctuation), 'struct-init')
213
+ ],
214
+ 'struct-init': [
215
+ (r'(\})', Punctuation, '#pop'),
216
+ include('comments'),
217
+ include('struct-property-in'),
218
+ (r'\s+', Whitespace),
219
+ (r',', Punctuation),
220
+ ],
221
+ 'struct-property-in': [
222
+ (r'(\b[\w]+)(\s*)(:)', bygroups(Name.Property, Whitespace, Punctuation), 'struct-property')
223
+ ],
224
+ 'struct-property': [
225
+ (r'(?=\}|\,)', Punctuation, '#pop'),
226
+ include('comments'),
227
+ include('expressions'),
228
+ (r'\s+', Whitespace),
229
+ ],
230
+ 'variable-init-in': [
231
+ (r'(=)', Operator, 'variable-init')
232
+ ],
233
+ 'variable-init': [
234
+ (r'(?=\}|\{|\,|\;)',Punctuation, '#pop'),
235
+ include('comments'),
236
+ include('expressions'),
237
+ (r'\s+', Whitespace),
238
+ ],
239
+ 'type-annotation-in': [
240
+ (r'(:)(\s+)', bygroups(Punctuation, Whitespace), 'type-annotation')
241
+ ],
242
+ 'type-annotation': [
243
+ (r'(?=\{|\;|\=|\,|\))', Punctuation, '#pop'),
244
+ include('comments'),
245
+ include('type-as-in'),
246
+ include('type-generic-in'),
247
+ (r'\?', Operator),
248
+ (r'\b\w+', Keyword.Type),
249
+ (r'\s+', Whitespace),
250
+ ],
251
+ 'type-generic-in': [
252
+ (r'<', Punctuation, 'type-generic'),
253
+ ],
254
+ 'type-generic': [
255
+ (r'>', Punctuation, '#pop'),
256
+ include('comments'),
257
+ include('type-as-in'),
258
+ (r'\b\w+', Keyword.Type),
259
+ (r'\s+', Whitespace),
260
+ (r',', Punctuation),
261
+ ],
262
+ 'type-as-in': [
263
+ (r'\b(as)(\s+)', bygroups(Keyword, Whitespace), 'type-as'),
264
+ ],
265
+ 'type-as': [
266
+ (r'(?=\{|\;|\=|\,|\)|\>)', Punctuation, '#pop'),
267
+ include('comments'),
268
+ (r'\b\w+', Keyword.Type),
269
+ (r'\s+', Whitespace),
270
+ ],
271
+ 'keywords': [
272
+ (words(('if', 'else', 'while', 'do', 'until', 'repeat', 'return', 'extends', 'mutates', 'virtual', 'override', 'inline', 'native', 'let', 'const', 'fun', 'self', 'is', 'initOf', 'map', 'bounced', 'get', 'as'), prefix=r'\b', suffix=r'\b'), Keyword),
273
+ (r'(<=>|>=|<=|!=|==|\^>>|~>>|>>|<<|\/%|\^%|~%|\^\/|~\/|\+=|-=|\*=|\/=|~\/=|\^\/=|%=|\^%=|<<=|>>=|~>>=|\^>>=|&=|\|=|\^=|\^|=|~|\/|%|-|\*|\+|>|<|&|\||:|\?)', Operator),
274
+ (words(('true', 'false'), prefix=r'\b', suffix=r'\b'), Keyword.Constant),
275
+ ],
276
+ 'string-in': [
277
+ (r'"', String, 'string'),
278
+ ],
279
+ 'string': [
280
+ (r'"', String, '#pop'),
281
+ (r'\\.', String.Escape),
282
+ (r'[^\\"]+', String.Double),
283
+ ],
284
+ 'numeric': [
285
+ (r'(?:\b0[xX])[0-9a-fA-F][0-9a-fA-F_]*\b', Number.Hex),
286
+ (r'(?:\b[0-9]+\b)', Number.Integer),
287
+ ],
288
+ 'comments': [
289
+ (r'//.*', Comment.Single),
290
+ (r'/\*', Comment.Multiline, 'comments-multiline'),
291
+ ],
292
+ 'comments-multiline': [
293
+ (r'\*/', Comment.Multiline, '#pop'),
294
+ (r'[^*]+', Comment.Multiline),
295
+ (r'[*]', Comment.Multiline),
296
+ ],
297
+ 'variable': [
298
+ (r'\b\w+\b(?!\s*\()(?!\s*\{)', Name.Variable)
299
+ ],
300
+ 'function-call': [
301
+ (r'\b\w+\b(?=\s*\()(?!\s*\{)', Name.Function)
302
+ ],
303
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/tal.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.tal
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Uxntal
6
+
7
+ .. versionadded:: 2.12
8
+
9
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
10
+ :license: BSD, see LICENSE for details.
11
+ """
12
+
13
+ from pygments.lexer import RegexLexer, words
14
+ from pygments.token import Comment, Keyword, Name, String, Number, \
15
+ Punctuation, Whitespace, Literal
16
+
17
+ __all__ = ['TalLexer']
18
+
19
+
20
+ class TalLexer(RegexLexer):
21
+ """
22
+ For Uxntal source code.
23
+ """
24
+
25
+ name = 'Tal'
26
+ aliases = ['tal', 'uxntal']
27
+ filenames = ['*.tal']
28
+ mimetypes = ['text/x-uxntal']
29
+ url = 'https://wiki.xxiivv.com/site/uxntal.html'
30
+ version_added = '2.12'
31
+
32
+ instructions = [
33
+ 'BRK', 'LIT', 'INC', 'POP', 'DUP', 'NIP', 'SWP', 'OVR', 'ROT',
34
+ 'EQU', 'NEQ', 'GTH', 'LTH', 'JMP', 'JCN', 'JSR', 'STH',
35
+ 'LDZ', 'STZ', 'LDR', 'STR', 'LDA', 'STA', 'DEI', 'DEO',
36
+ 'ADD', 'SUB', 'MUL', 'DIV', 'AND', 'ORA', 'EOR', 'SFT'
37
+ ]
38
+
39
+ tokens = {
40
+ # the comment delimiters must not be adjacent to non-space characters.
41
+ # this means ( foo ) is a valid comment but (foo) is not. this also
42
+ # applies to nested comments.
43
+ 'comment': [
44
+ (r'(?<!\S)\((?!\S)', Comment.Multiline, '#push'), # nested comments
45
+ (r'(?<!\S)\)(?!\S)', Comment.Multiline, '#pop'), # nested comments
46
+ (r'[^()]+', Comment.Multiline), # comments
47
+ (r'[()]+', Comment.Multiline), # comments
48
+ ],
49
+ 'root': [
50
+ (r'\s+', Whitespace), # spaces
51
+ (r'(?<!\S)\((?!\S)', Comment.Multiline, 'comment'), # comments
52
+ (words(instructions, prefix=r'(?<!\S)', suffix=r'2?k?r?(?!\S)'),
53
+ Keyword.Reserved), # instructions
54
+ (r'[][{}](?!\S)', Punctuation), # delimiters
55
+ (r'#([0-9a-f]{2}){1,2}(?!\S)', Number.Hex), # integer
56
+ (r'"\S+', String), # raw string
57
+ (r'([0-9a-f]{2}){1,2}(?!\S)', Literal), # raw integer
58
+ (r'[|$][0-9a-f]{1,4}(?!\S)', Keyword.Declaration), # abs/rel pad
59
+ (r'%\S+', Name.Decorator), # macro
60
+ (r'@\S+', Name.Function), # label
61
+ (r'&\S+', Name.Label), # sublabel
62
+ (r'/\S+', Name.Tag), # spacer
63
+ (r'\.\S+', Name.Variable.Magic), # literal zero page addr
64
+ (r',\S+', Name.Variable.Instance), # literal rel addr
65
+ (r';\S+', Name.Variable.Global), # literal abs addr
66
+ (r'-\S+', Literal), # raw zero page addr
67
+ (r'_\S+', Literal), # raw relative addr
68
+ (r'=\S+', Literal), # raw absolute addr
69
+ (r'!\S+', Name.Function), # immediate jump
70
+ (r'\?\S+', Name.Function), # conditional immediate jump
71
+ (r'~\S+', Keyword.Namespace), # include
72
+ (r'\S+', Name.Function), # macro invocation, immediate subroutine
73
+ ]
74
+ }
75
+
76
+ def analyse_text(text):
77
+ return '|0100' in text[:500]
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/tcl.py ADDED
@@ -0,0 +1,148 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.tcl
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for Tcl 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, include, words
12
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
13
+ Number, Whitespace
14
+ from pygments.util import shebang_matches
15
+
16
+ __all__ = ['TclLexer']
17
+
18
+
19
+ class TclLexer(RegexLexer):
20
+ """
21
+ For Tcl source code.
22
+ """
23
+
24
+ keyword_cmds_re = words((
25
+ 'after', 'apply', 'array', 'break', 'catch', 'continue', 'elseif',
26
+ 'else', 'error', 'eval', 'expr', 'for', 'foreach', 'global', 'if',
27
+ 'namespace', 'proc', 'rename', 'return', 'set', 'switch', 'then',
28
+ 'trace', 'unset', 'update', 'uplevel', 'upvar', 'variable', 'vwait',
29
+ 'while'), prefix=r'\b', suffix=r'\b')
30
+
31
+ builtin_cmds_re = words((
32
+ 'append', 'bgerror', 'binary', 'cd', 'chan', 'clock', 'close',
33
+ 'concat', 'dde', 'dict', 'encoding', 'eof', 'exec', 'exit', 'fblocked',
34
+ 'fconfigure', 'fcopy', 'file', 'fileevent', 'flush', 'format', 'gets',
35
+ 'glob', 'history', 'http', 'incr', 'info', 'interp', 'join', 'lappend',
36
+ 'lassign', 'lindex', 'linsert', 'list', 'llength', 'load', 'loadTk',
37
+ 'lrange', 'lrepeat', 'lreplace', 'lreverse', 'lsearch', 'lset', 'lsort',
38
+ 'mathfunc', 'mathop', 'memory', 'msgcat', 'open', 'package', 'pid',
39
+ 'pkg::create', 'pkg_mkIndex', 'platform', 'platform::shell', 'puts',
40
+ 'pwd', 're_syntax', 'read', 'refchan', 'regexp', 'registry', 'regsub',
41
+ 'scan', 'seek', 'socket', 'source', 'split', 'string', 'subst', 'tell',
42
+ 'time', 'tm', 'unknown', 'unload'), prefix=r'\b', suffix=r'\b')
43
+
44
+ name = 'Tcl'
45
+ url = 'https://www.tcl.tk/about/language.html'
46
+ aliases = ['tcl']
47
+ filenames = ['*.tcl', '*.rvt']
48
+ mimetypes = ['text/x-tcl', 'text/x-script.tcl', 'application/x-tcl']
49
+ version_added = '0.10'
50
+
51
+ def _gen_command_rules(keyword_cmds_re, builtin_cmds_re, context=""):
52
+ return [
53
+ (keyword_cmds_re, Keyword, 'params' + context),
54
+ (builtin_cmds_re, Name.Builtin, 'params' + context),
55
+ (r'([\w.-]+)', Name.Variable, 'params' + context),
56
+ (r'#', Comment, 'comment'),
57
+ ]
58
+
59
+ tokens = {
60
+ 'root': [
61
+ include('command'),
62
+ include('basic'),
63
+ include('data'),
64
+ (r'\}', Keyword), # HACK: somehow we miscounted our braces
65
+ ],
66
+ 'command': _gen_command_rules(keyword_cmds_re, builtin_cmds_re),
67
+ 'command-in-brace': _gen_command_rules(keyword_cmds_re,
68
+ builtin_cmds_re,
69
+ "-in-brace"),
70
+ 'command-in-bracket': _gen_command_rules(keyword_cmds_re,
71
+ builtin_cmds_re,
72
+ "-in-bracket"),
73
+ 'command-in-paren': _gen_command_rules(keyword_cmds_re,
74
+ builtin_cmds_re,
75
+ "-in-paren"),
76
+ 'basic': [
77
+ (r'\(', Keyword, 'paren'),
78
+ (r'\[', Keyword, 'bracket'),
79
+ (r'\{', Keyword, 'brace'),
80
+ (r'"', String.Double, 'string'),
81
+ (r'(eq|ne|in|ni)\b', Operator.Word),
82
+ (r'!=|==|<<|>>|<=|>=|&&|\|\||\*\*|[-+~!*/%<>&^|?:]', Operator),
83
+ ],
84
+ 'data': [
85
+ (r'\s+', Whitespace),
86
+ (r'0x[a-fA-F0-9]+', Number.Hex),
87
+ (r'0[0-7]+', Number.Oct),
88
+ (r'\d+\.\d+', Number.Float),
89
+ (r'\d+', Number.Integer),
90
+ (r'\$[\w.:-]+', Name.Variable),
91
+ (r'\$\{[\w.:-]+\}', Name.Variable),
92
+ (r'[\w.,@:-]+', Text),
93
+ ],
94
+ 'params': [
95
+ (r';', Keyword, '#pop'),
96
+ (r'\n', Text, '#pop'),
97
+ (r'(else|elseif|then)\b', Keyword),
98
+ include('basic'),
99
+ include('data'),
100
+ ],
101
+ 'params-in-brace': [
102
+ (r'\}', Keyword, ('#pop', '#pop')),
103
+ include('params')
104
+ ],
105
+ 'params-in-paren': [
106
+ (r'\)', Keyword, ('#pop', '#pop')),
107
+ include('params')
108
+ ],
109
+ 'params-in-bracket': [
110
+ (r'\]', Keyword, ('#pop', '#pop')),
111
+ include('params')
112
+ ],
113
+ 'string': [
114
+ (r'\[', String.Double, 'string-square'),
115
+ (r'(?s)(\\\\|\\[0-7]+|\\.|[^"\\])', String.Double),
116
+ (r'"', String.Double, '#pop')
117
+ ],
118
+ 'string-square': [
119
+ (r'\[', String.Double, 'string-square'),
120
+ (r'(?s)(\\\\|\\[0-7]+|\\.|\\\n|[^\]\\])', String.Double),
121
+ (r'\]', String.Double, '#pop')
122
+ ],
123
+ 'brace': [
124
+ (r'\}', Keyword, '#pop'),
125
+ include('command-in-brace'),
126
+ include('basic'),
127
+ include('data'),
128
+ ],
129
+ 'paren': [
130
+ (r'\)', Keyword, '#pop'),
131
+ include('command-in-paren'),
132
+ include('basic'),
133
+ include('data'),
134
+ ],
135
+ 'bracket': [
136
+ (r'\]', Keyword, '#pop'),
137
+ include('command-in-bracket'),
138
+ include('basic'),
139
+ include('data'),
140
+ ],
141
+ 'comment': [
142
+ (r'.*[^\\]\n', Comment, '#pop'),
143
+ (r'.*\\\n', Comment),
144
+ ],
145
+ }
146
+
147
+ def analyse_text(text):
148
+ return shebang_matches(text, r'(tcl)')
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/teal.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.teal
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for TEAL.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, bygroups, include, words
12
+ from pygments.token import Comment, Name, Number, String, Text, Keyword, \
13
+ Whitespace
14
+
15
+ __all__ = ['TealLexer']
16
+
17
+
18
+ class TealLexer(RegexLexer):
19
+ """
20
+ For the Transaction Execution Approval Language (TEAL)
21
+
22
+ For more information about the grammar, see:
23
+ https://github.com/algorand/go-algorand/blob/master/data/transactions/logic/assembler.go
24
+ """
25
+ name = 'teal'
26
+ url = 'https://developer.algorand.org/docs/reference/teal/specification/'
27
+ aliases = ['teal']
28
+ filenames = ['*.teal']
29
+ version_added = '2.9'
30
+
31
+ keywords = words({
32
+ 'Sender', 'Fee', 'FirstValid', 'FirstValidTime', 'LastValid', 'Note',
33
+ 'Lease', 'Receiver', 'Amount', 'CloseRemainderTo', 'VotePK',
34
+ 'SelectionPK', 'VoteFirst', 'VoteLast', 'VoteKeyDilution', 'Type',
35
+ 'TypeEnum', 'XferAsset', 'AssetAmount', 'AssetSender', 'AssetReceiver',
36
+ 'AssetCloseTo', 'GroupIndex', 'TxID', 'ApplicationID', 'OnCompletion',
37
+ 'ApplicationArgs', 'NumAppArgs', 'Accounts', 'NumAccounts',
38
+ 'ApprovalProgram', 'ClearStateProgram', 'RekeyTo', 'ConfigAsset',
39
+ 'ConfigAssetTotal', 'ConfigAssetDecimals', 'ConfigAssetDefaultFrozen',
40
+ 'ConfigAssetUnitName', 'ConfigAssetName', 'ConfigAssetURL',
41
+ 'ConfigAssetMetadataHash', 'ConfigAssetManager', 'ConfigAssetReserve',
42
+ 'ConfigAssetFreeze', 'ConfigAssetClawback', 'FreezeAsset',
43
+ 'FreezeAssetAccount', 'FreezeAssetFrozen',
44
+ 'NoOp', 'OptIn', 'CloseOut', 'ClearState', 'UpdateApplication',
45
+ 'DeleteApplication',
46
+ 'MinTxnFee', 'MinBalance', 'MaxTxnLife', 'ZeroAddress', 'GroupSize',
47
+ 'LogicSigVersion', 'Round', 'LatestTimestamp', 'CurrentApplicationID',
48
+ 'AssetBalance', 'AssetFrozen',
49
+ 'AssetTotal', 'AssetDecimals', 'AssetDefaultFrozen', 'AssetUnitName',
50
+ 'AssetName', 'AssetURL', 'AssetMetadataHash', 'AssetManager',
51
+ 'AssetReserve', 'AssetFreeze', 'AssetClawback',
52
+ }, suffix=r'\b')
53
+
54
+ identifier = r'[^ \t\n]+(?=\/\/)|[^ \t\n]+'
55
+ newline = r'\r?\n'
56
+ tokens = {
57
+ 'root': [
58
+ include('whitespace'),
59
+ # pragmas match specifically on the space character
60
+ (r'^#pragma .*' + newline, Comment.Directive),
61
+ # labels must be followed by a space,
62
+ # but anything after that is ignored
63
+ ('(' + identifier + ':' + ')' + '([ \t].*)',
64
+ bygroups(Name.Label, Comment.Single)),
65
+ (identifier, Name.Function, 'function-args'),
66
+ ],
67
+ 'function-args': [
68
+ include('whitespace'),
69
+ (r'"', String, 'string'),
70
+ (r'(b(?:ase)?(?:32|64) ?)(\(?[a-zA-Z0-9+/=]+\)?)',
71
+ bygroups(String.Affix, String.Other)),
72
+ (r'[A-Z2-7]{58}', Number), # address
73
+ (r'0x[\da-fA-F]+', Number.Hex),
74
+ (r'\d+', Number.Integer),
75
+ (keywords, Keyword),
76
+ (identifier, Name.Attributes), # branch targets
77
+ (newline, Text, '#pop'),
78
+ ],
79
+ 'string': [
80
+ (r'\\(?:["nrt\\]|x\d\d)', String.Escape),
81
+ (r'[^\\\"\n]+', String),
82
+ (r'"', String, '#pop'),
83
+ ],
84
+ 'whitespace': [
85
+ (r'[ \t]+', Whitespace),
86
+ (r'//[^\n]+', Comment.Single),
87
+ ],
88
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/templates.py ADDED
@@ -0,0 +1,2355 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.templates
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for various template engines' markup.
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 HtmlLexer, XmlLexer
14
+ from pygments.lexers.javascript import JavascriptLexer, LassoLexer
15
+ from pygments.lexers.css import CssLexer
16
+ from pygments.lexers.php import PhpLexer
17
+ from pygments.lexers.python import PythonLexer
18
+ from pygments.lexers.perl import PerlLexer
19
+ from pygments.lexers.jvm import JavaLexer, TeaLangLexer
20
+ from pygments.lexers.data import YamlLexer
21
+ from pygments.lexers.sql import SqlLexer
22
+ from pygments.lexer import Lexer, DelegatingLexer, RegexLexer, bygroups, \
23
+ include, using, this, default, combined
24
+ from pygments.token import Error, Punctuation, Whitespace, \
25
+ Text, Comment, Operator, Keyword, Name, String, Number, Other, Token
26
+ from pygments.util import html_doctype_matches, looks_like_xml
27
+
28
+ __all__ = ['HtmlPhpLexer', 'XmlPhpLexer', 'CssPhpLexer',
29
+ 'JavascriptPhpLexer', 'ErbLexer', 'RhtmlLexer',
30
+ 'XmlErbLexer', 'CssErbLexer', 'JavascriptErbLexer',
31
+ 'SmartyLexer', 'HtmlSmartyLexer', 'XmlSmartyLexer',
32
+ 'CssSmartyLexer', 'JavascriptSmartyLexer', 'DjangoLexer',
33
+ 'HtmlDjangoLexer', 'CssDjangoLexer', 'XmlDjangoLexer',
34
+ 'JavascriptDjangoLexer', 'GenshiLexer', 'HtmlGenshiLexer',
35
+ 'GenshiTextLexer', 'CssGenshiLexer', 'JavascriptGenshiLexer',
36
+ 'MyghtyLexer', 'MyghtyHtmlLexer', 'MyghtyXmlLexer',
37
+ 'MyghtyCssLexer', 'MyghtyJavascriptLexer', 'MasonLexer', 'MakoLexer',
38
+ 'MakoHtmlLexer', 'MakoXmlLexer', 'MakoJavascriptLexer',
39
+ 'MakoCssLexer', 'JspLexer', 'CheetahLexer', 'CheetahHtmlLexer',
40
+ 'CheetahXmlLexer', 'CheetahJavascriptLexer', 'EvoqueLexer',
41
+ 'EvoqueHtmlLexer', 'EvoqueXmlLexer', 'ColdfusionLexer',
42
+ 'ColdfusionHtmlLexer', 'ColdfusionCFCLexer', 'VelocityLexer',
43
+ 'VelocityHtmlLexer', 'VelocityXmlLexer', 'SspLexer',
44
+ 'TeaTemplateLexer', 'LassoHtmlLexer', 'LassoXmlLexer',
45
+ 'LassoCssLexer', 'LassoJavascriptLexer', 'HandlebarsLexer',
46
+ 'HandlebarsHtmlLexer', 'YamlJinjaLexer', 'LiquidLexer',
47
+ 'TwigLexer', 'TwigHtmlLexer', 'Angular2Lexer', 'Angular2HtmlLexer',
48
+ 'SqlJinjaLexer']
49
+
50
+
51
+ class ErbLexer(Lexer):
52
+ """
53
+ Generic ERB (Ruby Templating) lexer.
54
+
55
+ Just highlights ruby code between the preprocessor directives, other data
56
+ is left untouched by the lexer.
57
+
58
+ All options are also forwarded to the `RubyLexer`.
59
+ """
60
+
61
+ name = 'ERB'
62
+ url = 'https://github.com/ruby/erb'
63
+ aliases = ['erb']
64
+ mimetypes = ['application/x-ruby-templating']
65
+ version_added = ''
66
+
67
+ _block_re = re.compile(r'(<%%|%%>|<%=|<%#|<%-|<%|-%>|%>|^%[^%].*?$)', re.M)
68
+
69
+ def __init__(self, **options):
70
+ from pygments.lexers.ruby import RubyLexer
71
+ self.ruby_lexer = RubyLexer(**options)
72
+ Lexer.__init__(self, **options)
73
+
74
+ def get_tokens_unprocessed(self, text):
75
+ """
76
+ Since ERB doesn't allow "<%" and other tags inside of ruby
77
+ blocks we have to use a split approach here that fails for
78
+ that too.
79
+ """
80
+ tokens = self._block_re.split(text)
81
+ tokens.reverse()
82
+ state = idx = 0
83
+ try:
84
+ while True:
85
+ # text
86
+ if state == 0:
87
+ val = tokens.pop()
88
+ yield idx, Other, val
89
+ idx += len(val)
90
+ state = 1
91
+ # block starts
92
+ elif state == 1:
93
+ tag = tokens.pop()
94
+ # literals
95
+ if tag in ('<%%', '%%>'):
96
+ yield idx, Other, tag
97
+ idx += 3
98
+ state = 0
99
+ # comment
100
+ elif tag == '<%#':
101
+ yield idx, Comment.Preproc, tag
102
+ val = tokens.pop()
103
+ yield idx + 3, Comment, val
104
+ idx += 3 + len(val)
105
+ state = 2
106
+ # blocks or output
107
+ elif tag in ('<%', '<%=', '<%-'):
108
+ yield idx, Comment.Preproc, tag
109
+ idx += len(tag)
110
+ data = tokens.pop()
111
+ r_idx = 0
112
+ for r_idx, r_token, r_value in \
113
+ self.ruby_lexer.get_tokens_unprocessed(data):
114
+ yield r_idx + idx, r_token, r_value
115
+ idx += len(data)
116
+ state = 2
117
+ elif tag in ('%>', '-%>'):
118
+ yield idx, Error, tag
119
+ idx += len(tag)
120
+ state = 0
121
+ # % raw ruby statements
122
+ else:
123
+ yield idx, Comment.Preproc, tag[0]
124
+ r_idx = 0
125
+ for r_idx, r_token, r_value in \
126
+ self.ruby_lexer.get_tokens_unprocessed(tag[1:]):
127
+ yield idx + 1 + r_idx, r_token, r_value
128
+ idx += len(tag)
129
+ state = 0
130
+ # block ends
131
+ elif state == 2:
132
+ tag = tokens.pop()
133
+ if tag not in ('%>', '-%>'):
134
+ yield idx, Other, tag
135
+ else:
136
+ yield idx, Comment.Preproc, tag
137
+ idx += len(tag)
138
+ state = 0
139
+ except IndexError:
140
+ return
141
+
142
+ def analyse_text(text):
143
+ if '<%' in text and '%>' in text:
144
+ return 0.4
145
+
146
+
147
+ class SmartyLexer(RegexLexer):
148
+ """
149
+ Generic Smarty template lexer.
150
+
151
+ Just highlights smarty code between the preprocessor directives, other
152
+ data is left untouched by the lexer.
153
+ """
154
+
155
+ name = 'Smarty'
156
+ url = 'https://www.smarty.net/'
157
+ aliases = ['smarty']
158
+ filenames = ['*.tpl']
159
+ mimetypes = ['application/x-smarty']
160
+ version_added = ''
161
+
162
+ flags = re.MULTILINE | re.DOTALL
163
+
164
+ tokens = {
165
+ 'root': [
166
+ (r'[^{]+', Other),
167
+ (r'(\{)(\*.*?\*)(\})',
168
+ bygroups(Comment.Preproc, Comment, Comment.Preproc)),
169
+ (r'(\{php\})(.*?)(\{/php\})',
170
+ bygroups(Comment.Preproc, using(PhpLexer, startinline=True),
171
+ Comment.Preproc)),
172
+ (r'(\{)(/?[a-zA-Z_]\w*)(\s*)',
173
+ bygroups(Comment.Preproc, Name.Function, Text), 'smarty'),
174
+ (r'\{', Comment.Preproc, 'smarty')
175
+ ],
176
+ 'smarty': [
177
+ (r'\s+', Text),
178
+ (r'\{', Comment.Preproc, '#push'),
179
+ (r'\}', Comment.Preproc, '#pop'),
180
+ (r'#[a-zA-Z_]\w*#', Name.Variable),
181
+ (r'\$[a-zA-Z_]\w*(\.\w+)*', Name.Variable),
182
+ (r'[~!%^&*()+=|\[\]:;,.<>/?@-]', Operator),
183
+ (r'(true|false|null)\b', Keyword.Constant),
184
+ (r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
185
+ r"0[xX][0-9a-fA-F]+[Ll]?", Number),
186
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
187
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
188
+ (r'[a-zA-Z_]\w*', Name.Attribute)
189
+ ]
190
+ }
191
+
192
+ def analyse_text(text):
193
+ rv = 0.0
194
+ if re.search(r'\{if\s+.*?\}.*?\{/if\}', text):
195
+ rv += 0.15
196
+ if re.search(r'\{include\s+file=.*?\}', text):
197
+ rv += 0.15
198
+ if re.search(r'\{foreach\s+.*?\}.*?\{/foreach\}', text):
199
+ rv += 0.15
200
+ if re.search(r'\{\$.*?\}', text):
201
+ rv += 0.01
202
+ return rv
203
+
204
+
205
+ class VelocityLexer(RegexLexer):
206
+ """
207
+ Generic Velocity template lexer.
208
+
209
+ Just highlights velocity directives and variable references, other
210
+ data is left untouched by the lexer.
211
+ """
212
+
213
+ name = 'Velocity'
214
+ url = 'https://velocity.apache.org/'
215
+ aliases = ['velocity']
216
+ filenames = ['*.vm', '*.fhtml']
217
+ version_added = ''
218
+
219
+ flags = re.MULTILINE | re.DOTALL
220
+
221
+ identifier = r'[a-zA-Z_]\w*'
222
+
223
+ tokens = {
224
+ 'root': [
225
+ (r'[^{#$]+', Other),
226
+ (r'(#)(\*.*?\*)(#)',
227
+ bygroups(Comment.Preproc, Comment, Comment.Preproc)),
228
+ (r'(##)(.*?$)',
229
+ bygroups(Comment.Preproc, Comment)),
230
+ (r'(#\{?)(' + identifier + r')(\}?)(\s?\()',
231
+ bygroups(Comment.Preproc, Name.Function, Comment.Preproc, Punctuation),
232
+ 'directiveparams'),
233
+ (r'(#\{?)(' + identifier + r')(\}|\b)',
234
+ bygroups(Comment.Preproc, Name.Function, Comment.Preproc)),
235
+ (r'\$!?\{?', Punctuation, 'variable')
236
+ ],
237
+ 'variable': [
238
+ (identifier, Name.Variable),
239
+ (r'\(', Punctuation, 'funcparams'),
240
+ (r'(\.)(' + identifier + r')',
241
+ bygroups(Punctuation, Name.Variable), '#push'),
242
+ (r'\}', Punctuation, '#pop'),
243
+ default('#pop')
244
+ ],
245
+ 'directiveparams': [
246
+ (r'(&&|\|\||==?|!=?|[-<>+*%&|^/])|\b(eq|ne|gt|lt|ge|le|not|in)\b',
247
+ Operator),
248
+ (r'\[', Operator, 'rangeoperator'),
249
+ (r'\b' + identifier + r'\b', Name.Function),
250
+ include('funcparams')
251
+ ],
252
+ 'rangeoperator': [
253
+ (r'\.\.', Operator),
254
+ include('funcparams'),
255
+ (r'\]', Operator, '#pop')
256
+ ],
257
+ 'funcparams': [
258
+ (r'\$!?\{?', Punctuation, 'variable'),
259
+ (r'\s+', Text),
260
+ (r'[,:]', Punctuation),
261
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
262
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
263
+ (r"0[xX][0-9a-fA-F]+[Ll]?", Number),
264
+ (r"\b[0-9]+\b", Number),
265
+ (r'(true|false|null)\b', Keyword.Constant),
266
+ (r'\(', Punctuation, '#push'),
267
+ (r'\)', Punctuation, '#pop'),
268
+ (r'\{', Punctuation, '#push'),
269
+ (r'\}', Punctuation, '#pop'),
270
+ (r'\[', Punctuation, '#push'),
271
+ (r'\]', Punctuation, '#pop'),
272
+ ]
273
+ }
274
+
275
+ def analyse_text(text):
276
+ rv = 0.0
277
+ if re.search(r'#\{?macro\}?\(.*?\).*?#\{?end\}?', text, re.DOTALL):
278
+ rv += 0.25
279
+ if re.search(r'#\{?if\}?\(.+?\).*?#\{?end\}?', text, re.DOTALL):
280
+ rv += 0.15
281
+ if re.search(r'#\{?foreach\}?\(.+?\).*?#\{?end\}?', text, re.DOTALL):
282
+ rv += 0.15
283
+ if re.search(r'\$!?\{?[a-zA-Z_]\w*(\([^)]*\))?'
284
+ r'(\.\w+(\([^)]*\))?)*\}?', text):
285
+ rv += 0.01
286
+ return rv
287
+
288
+
289
+ class VelocityHtmlLexer(DelegatingLexer):
290
+ """
291
+ Subclass of the `VelocityLexer` that highlights unlexed data
292
+ with the `HtmlLexer`.
293
+
294
+ """
295
+
296
+ name = 'HTML+Velocity'
297
+ aliases = ['html+velocity']
298
+ version_added = ''
299
+ alias_filenames = ['*.html', '*.fhtml']
300
+ mimetypes = ['text/html+velocity']
301
+ url = 'https://velocity.apache.org/'
302
+
303
+ def __init__(self, **options):
304
+ super().__init__(HtmlLexer, VelocityLexer, **options)
305
+
306
+
307
+ class VelocityXmlLexer(DelegatingLexer):
308
+ """
309
+ Subclass of the `VelocityLexer` that highlights unlexed data
310
+ with the `XmlLexer`.
311
+
312
+ """
313
+
314
+ name = 'XML+Velocity'
315
+ aliases = ['xml+velocity']
316
+ version_added = ''
317
+ alias_filenames = ['*.xml', '*.vm']
318
+ mimetypes = ['application/xml+velocity']
319
+ url = 'https://velocity.apache.org/'
320
+
321
+ def __init__(self, **options):
322
+ super().__init__(XmlLexer, VelocityLexer, **options)
323
+
324
+ def analyse_text(text):
325
+ rv = VelocityLexer.analyse_text(text) - 0.01
326
+ if looks_like_xml(text):
327
+ rv += 0.4
328
+ return rv
329
+
330
+
331
+ class DjangoLexer(RegexLexer):
332
+ """
333
+ Generic `Django <https://www.djangoproject.com/documentation/templates/>`_
334
+ and `Jinja <https://jinja.palletsprojects.com>`_ template lexer.
335
+
336
+ It just highlights django/jinja code between the preprocessor directives,
337
+ other data is left untouched by the lexer.
338
+ """
339
+
340
+ name = 'Django/Jinja'
341
+ aliases = ['django', 'jinja']
342
+ mimetypes = ['application/x-django-templating', 'application/x-jinja']
343
+ url = 'https://www.djangoproject.com/documentation/templates'
344
+ version_added = ''
345
+
346
+ flags = re.M | re.S
347
+
348
+ tokens = {
349
+ 'root': [
350
+ (r'[^{]+', Other),
351
+ (r'\{\{', Comment.Preproc, 'var'),
352
+ # jinja/django comments
353
+ (r'\{#.*?#\}', Comment),
354
+ # django comments
355
+ (r'(\{%)(-?\s*)(comment)(\s*-?)(%\})(.*?)'
356
+ r'(\{%)(-?\s*)(endcomment)(\s*-?)(%\})',
357
+ bygroups(Comment.Preproc, Text, Keyword, Text, Comment.Preproc,
358
+ Comment, Comment.Preproc, Text, Keyword, Text,
359
+ Comment.Preproc)),
360
+ # raw jinja blocks
361
+ (r'(\{%)(-?\s*)(raw)(\s*-?)(%\})(.*?)'
362
+ r'(\{%)(-?\s*)(endraw)(\s*-?)(%\})',
363
+ bygroups(Comment.Preproc, Text, Keyword, Text, Comment.Preproc,
364
+ Text, Comment.Preproc, Text, Keyword, Text,
365
+ Comment.Preproc)),
366
+ # filter blocks
367
+ (r'(\{%)(-?\s*)(filter)(\s+)([a-zA-Z_]\w*)',
368
+ bygroups(Comment.Preproc, Text, Keyword, Text, Name.Function),
369
+ 'block'),
370
+ (r'(\{%)(-?\s*)([a-zA-Z_]\w*)',
371
+ bygroups(Comment.Preproc, Text, Keyword), 'block'),
372
+ (r'\{', Other)
373
+ ],
374
+ 'varnames': [
375
+ (r'(\|)(\s*)([a-zA-Z_]\w*)',
376
+ bygroups(Operator, Text, Name.Function)),
377
+ (r'(is)(\s+)(not)?(\s+)?([a-zA-Z_]\w*)',
378
+ bygroups(Keyword, Text, Keyword, Text, Name.Function)),
379
+ (r'(_|true|false|none|True|False|None)\b', Keyword.Pseudo),
380
+ (r'(in|as|reversed|recursive|not|and|or|is|if|else|import|'
381
+ r'with(?:(?:out)?\s*context)?|scoped|ignore\s+missing)\b',
382
+ Keyword),
383
+ (r'(loop|block|super|forloop)\b', Name.Builtin),
384
+ (r'[a-zA-Z_][\w-]*', Name.Variable),
385
+ (r'\.\w+', Name.Variable),
386
+ (r':?"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
387
+ (r":?'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
388
+ (r'([{}()\[\]+\-*/%,:~]|[><=]=?|!=)', Operator),
389
+ (r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
390
+ r"0[xX][0-9a-fA-F]+[Ll]?", Number),
391
+ ],
392
+ 'var': [
393
+ (r'\s+', Text),
394
+ (r'(-?)(\}\})', bygroups(Text, Comment.Preproc), '#pop'),
395
+ include('varnames')
396
+ ],
397
+ 'block': [
398
+ (r'\s+', Text),
399
+ (r'(-?)(%\})', bygroups(Text, Comment.Preproc), '#pop'),
400
+ include('varnames'),
401
+ (r'.', Punctuation)
402
+ ]
403
+ }
404
+
405
+ def analyse_text(text):
406
+ rv = 0.0
407
+ if re.search(r'\{%\s*(block|extends)', text) is not None:
408
+ rv += 0.4
409
+ if re.search(r'\{%\s*if\s*.*?%\}', text) is not None:
410
+ rv += 0.1
411
+ if re.search(r'\{\{.*?\}\}', text) is not None:
412
+ rv += 0.1
413
+ return rv
414
+
415
+
416
+ class MyghtyLexer(RegexLexer):
417
+ """
418
+ Generic myghty templates lexer. Code that isn't Myghty
419
+ markup is yielded as `Token.Other`.
420
+ """
421
+
422
+ name = 'Myghty'
423
+ url = 'http://www.myghty.org/'
424
+ aliases = ['myghty']
425
+ filenames = ['*.myt', 'autodelegate']
426
+ mimetypes = ['application/x-myghty']
427
+ version_added = '0.6'
428
+
429
+ tokens = {
430
+ 'root': [
431
+ (r'\s+', Text),
432
+ (r'(?s)(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)',
433
+ bygroups(Name.Tag, Text, Name.Function, Name.Tag,
434
+ using(this), Name.Tag)),
435
+ (r'(?s)(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)',
436
+ bygroups(Name.Tag, Name.Function, Name.Tag,
437
+ using(PythonLexer), Name.Tag)),
438
+ (r'(<&[^|])(.*?)(,.*?)?(&>)',
439
+ bygroups(Name.Tag, Name.Function, using(PythonLexer), Name.Tag)),
440
+ (r'(?s)(<&\|)(.*?)(,.*?)?(&>)',
441
+ bygroups(Name.Tag, Name.Function, using(PythonLexer), Name.Tag)),
442
+ (r'</&>', Name.Tag),
443
+ (r'(?s)(<%!?)(.*?)(%>)',
444
+ bygroups(Name.Tag, using(PythonLexer), Name.Tag)),
445
+ (r'(?<=^)#[^\n]*(\n|\Z)', Comment),
446
+ (r'(?<=^)(%)([^\n]*)(\n|\Z)',
447
+ bygroups(Name.Tag, using(PythonLexer), Other)),
448
+ (r"""(?sx)
449
+ (.+?) # anything, followed by:
450
+ (?:
451
+ (?<=\n)(?=[%#]) | # an eval or comment line
452
+ (?=</?[%&]) | # a substitution or block or
453
+ # call start or end
454
+ # - don't consume
455
+ (\\\n) | # an escaped newline
456
+ \Z # end of string
457
+ )""", bygroups(Other, Operator)),
458
+ ]
459
+ }
460
+
461
+
462
+ class MyghtyHtmlLexer(DelegatingLexer):
463
+ """
464
+ Subclass of the `MyghtyLexer` that highlights unlexed data
465
+ with the `HtmlLexer`.
466
+ """
467
+
468
+ name = 'HTML+Myghty'
469
+ aliases = ['html+myghty']
470
+ mimetypes = ['text/html+myghty']
471
+ url = 'http://www.myghty.org/'
472
+ version_added = '0.6'
473
+
474
+ def __init__(self, **options):
475
+ super().__init__(HtmlLexer, MyghtyLexer, **options)
476
+
477
+
478
+ class MyghtyXmlLexer(DelegatingLexer):
479
+ """
480
+ Subclass of the `MyghtyLexer` that highlights unlexed data
481
+ with the `XmlLexer`.
482
+ """
483
+
484
+ name = 'XML+Myghty'
485
+ aliases = ['xml+myghty']
486
+ mimetypes = ['application/xml+myghty']
487
+ url = 'http://www.myghty.org/'
488
+ version_added = '0.6'
489
+
490
+ def __init__(self, **options):
491
+ super().__init__(XmlLexer, MyghtyLexer, **options)
492
+
493
+
494
+ class MyghtyJavascriptLexer(DelegatingLexer):
495
+ """
496
+ Subclass of the `MyghtyLexer` that highlights unlexed data
497
+ with the `JavascriptLexer`.
498
+ """
499
+
500
+ name = 'JavaScript+Myghty'
501
+ aliases = ['javascript+myghty', 'js+myghty']
502
+ mimetypes = ['application/x-javascript+myghty',
503
+ 'text/x-javascript+myghty',
504
+ 'text/javascript+mygthy']
505
+ url = 'http://www.myghty.org/'
506
+ version_added = '0.6'
507
+
508
+ def __init__(self, **options):
509
+ super().__init__(JavascriptLexer, MyghtyLexer, **options)
510
+
511
+
512
+ class MyghtyCssLexer(DelegatingLexer):
513
+ """
514
+ Subclass of the `MyghtyLexer` that highlights unlexed data
515
+ with the `CssLexer`.
516
+ """
517
+
518
+ name = 'CSS+Myghty'
519
+ aliases = ['css+myghty']
520
+ mimetypes = ['text/css+myghty']
521
+ url = 'http://www.myghty.org/'
522
+ version_added = '0.6'
523
+
524
+ def __init__(self, **options):
525
+ super().__init__(CssLexer, MyghtyLexer, **options)
526
+
527
+
528
+ class MasonLexer(RegexLexer):
529
+ """
530
+ Generic mason templates lexer. Stolen from Myghty lexer. Code that isn't
531
+ Mason markup is HTML.
532
+ """
533
+ name = 'Mason'
534
+ url = 'http://www.masonhq.com/'
535
+ aliases = ['mason']
536
+ filenames = ['*.m', '*.mhtml', '*.mc', '*.mi', 'autohandler', 'dhandler']
537
+ mimetypes = ['application/x-mason']
538
+ version_added = '1.4'
539
+
540
+ tokens = {
541
+ 'root': [
542
+ (r'\s+', Whitespace),
543
+ (r'(?s)(<%doc>)(.*?)(</%doc>)',
544
+ bygroups(Name.Tag, Comment.Multiline, Name.Tag)),
545
+ (r'(?s)(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)',
546
+ bygroups(Name.Tag, Whitespace, Name.Function, Name.Tag,
547
+ using(this), Name.Tag)),
548
+ (r'(?s)(<%(\w+)(.*?)(>))(.*?)(</%\2\s*>)',
549
+ bygroups(Name.Tag, None, None, None, using(PerlLexer), Name.Tag)),
550
+ (r'(?s)(<&[^|])(.*?)(,.*?)?(&>)',
551
+ bygroups(Name.Tag, Name.Function, using(PerlLexer), Name.Tag)),
552
+ (r'(?s)(<&\|)(.*?)(,.*?)?(&>)',
553
+ bygroups(Name.Tag, Name.Function, using(PerlLexer), Name.Tag)),
554
+ (r'</&>', Name.Tag),
555
+ (r'(?s)(<%!?)(.*?)(%>)',
556
+ bygroups(Name.Tag, using(PerlLexer), Name.Tag)),
557
+ (r'(?<=^)#[^\n]*(\n|\Z)', Comment),
558
+ (r'(?<=^)(%)([^\n]*)(\n|\Z)',
559
+ bygroups(Name.Tag, using(PerlLexer), Other)),
560
+ (r"""(?sx)
561
+ (.+?) # anything, followed by:
562
+ (?:
563
+ (?<=\n)(?=[%#]) | # an eval or comment line
564
+ (?=</?[%&]) | # a substitution or block or
565
+ # call start or end
566
+ # - don't consume
567
+ (\\\n) | # an escaped newline
568
+ \Z # end of string
569
+ )""", bygroups(using(HtmlLexer), Operator)),
570
+ ]
571
+ }
572
+
573
+ def analyse_text(text):
574
+ result = 0.0
575
+ if re.search(r'</%(class|doc|init)>', text) is not None:
576
+ result = 1.0
577
+ elif re.search(r'<&.+&>', text, re.DOTALL) is not None:
578
+ result = 0.11
579
+ return result
580
+
581
+
582
+ class MakoLexer(RegexLexer):
583
+ """
584
+ Generic mako templates lexer. Code that isn't Mako
585
+ markup is yielded as `Token.Other`.
586
+ """
587
+
588
+ name = 'Mako'
589
+ url = 'http://www.makotemplates.org/'
590
+ aliases = ['mako']
591
+ filenames = ['*.mao']
592
+ mimetypes = ['application/x-mako']
593
+ version_added = '0.7'
594
+
595
+ tokens = {
596
+ 'root': [
597
+ (r'(\s*)(%)(\s*end(?:\w+))(\n|\Z)',
598
+ bygroups(Text.Whitespace, Comment.Preproc, Keyword, Other)),
599
+ (r'(\s*)(%)([^\n]*)(\n|\Z)',
600
+ bygroups(Text.Whitespace, Comment.Preproc, using(PythonLexer), Other)),
601
+ (r'(\s*)(##[^\n]*)(\n|\Z)',
602
+ bygroups(Text.Whitespace, Comment.Single, Text.Whitespace)),
603
+ (r'(?s)<%doc>.*?</%doc>', Comment.Multiline),
604
+ (r'(<%)([\w.:]+)',
605
+ bygroups(Comment.Preproc, Name.Builtin), 'tag'),
606
+ (r'(</%)([\w.:]+)(>)',
607
+ bygroups(Comment.Preproc, Name.Builtin, Comment.Preproc)),
608
+ (r'<%(?=([\w.:]+))', Comment.Preproc, 'ondeftags'),
609
+ (r'(?s)(<%(?:!?))(.*?)(%>)',
610
+ bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
611
+ (r'(\$\{)(.*?)(\})',
612
+ bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
613
+ (r'''(?sx)
614
+ (.+?) # anything, followed by:
615
+ (?:
616
+ (?<=\n)(?=%|\#\#) | # an eval or comment line
617
+ (?=\#\*) | # multiline comment
618
+ (?=</?%) | # a python block
619
+ # call start or end
620
+ (?=\$\{) | # a substitution
621
+ (?<=\n)(?=\s*%) |
622
+ # - don't consume
623
+ (\\\n) | # an escaped newline
624
+ \Z # end of string
625
+ )
626
+ ''', bygroups(Other, Operator)),
627
+ (r'\s+', Text),
628
+ ],
629
+ 'ondeftags': [
630
+ (r'<%', Comment.Preproc),
631
+ (r'(?<=<%)(include|inherit|namespace|page)', Name.Builtin),
632
+ include('tag'),
633
+ ],
634
+ 'tag': [
635
+ (r'((?:\w+)\s*=)(\s*)(".*?")',
636
+ bygroups(Name.Attribute, Text, String)),
637
+ (r'/?\s*>', Comment.Preproc, '#pop'),
638
+ (r'\s+', Text),
639
+ ],
640
+ 'attr': [
641
+ ('".*?"', String, '#pop'),
642
+ ("'.*?'", String, '#pop'),
643
+ (r'[^\s>]+', String, '#pop'),
644
+ ],
645
+ }
646
+
647
+
648
+ class MakoHtmlLexer(DelegatingLexer):
649
+ """
650
+ Subclass of the `MakoLexer` that highlights unlexed data
651
+ with the `HtmlLexer`.
652
+ """
653
+
654
+ name = 'HTML+Mako'
655
+ aliases = ['html+mako']
656
+ mimetypes = ['text/html+mako']
657
+ url = 'http://www.makotemplates.org/'
658
+ version_added = '0.7'
659
+
660
+ def __init__(self, **options):
661
+ super().__init__(HtmlLexer, MakoLexer, **options)
662
+
663
+
664
+ class MakoXmlLexer(DelegatingLexer):
665
+ """
666
+ Subclass of the `MakoLexer` that highlights unlexed data
667
+ with the `XmlLexer`.
668
+ """
669
+
670
+ name = 'XML+Mako'
671
+ aliases = ['xml+mako']
672
+ mimetypes = ['application/xml+mako']
673
+ url = 'http://www.makotemplates.org/'
674
+ version_added = '0.7'
675
+
676
+ def __init__(self, **options):
677
+ super().__init__(XmlLexer, MakoLexer, **options)
678
+
679
+
680
+ class MakoJavascriptLexer(DelegatingLexer):
681
+ """
682
+ Subclass of the `MakoLexer` that highlights unlexed data
683
+ with the `JavascriptLexer`.
684
+ """
685
+
686
+ name = 'JavaScript+Mako'
687
+ aliases = ['javascript+mako', 'js+mako']
688
+ mimetypes = ['application/x-javascript+mako',
689
+ 'text/x-javascript+mako',
690
+ 'text/javascript+mako']
691
+ url = 'http://www.makotemplates.org/'
692
+ version_added = '0.7'
693
+
694
+ def __init__(self, **options):
695
+ super().__init__(JavascriptLexer, MakoLexer, **options)
696
+
697
+
698
+ class MakoCssLexer(DelegatingLexer):
699
+ """
700
+ Subclass of the `MakoLexer` that highlights unlexed data
701
+ with the `CssLexer`.
702
+ """
703
+
704
+ name = 'CSS+Mako'
705
+ aliases = ['css+mako']
706
+ mimetypes = ['text/css+mako']
707
+ url = 'http://www.makotemplates.org/'
708
+ version_added = '0.7'
709
+
710
+ def __init__(self, **options):
711
+ super().__init__(CssLexer, MakoLexer, **options)
712
+
713
+
714
+ # Genshi and Cheetah lexers courtesy of Matt Good.
715
+
716
+ class CheetahPythonLexer(Lexer):
717
+ """
718
+ Lexer for handling Cheetah's special $ tokens in Python syntax.
719
+ """
720
+
721
+ def get_tokens_unprocessed(self, text):
722
+ pylexer = PythonLexer(**self.options)
723
+ for pos, type_, value in pylexer.get_tokens_unprocessed(text):
724
+ if type_ == Token.Error and value == '$':
725
+ type_ = Comment.Preproc
726
+ yield pos, type_, value
727
+
728
+
729
+ class CheetahLexer(RegexLexer):
730
+ """
731
+ Generic cheetah templates lexer. Code that isn't Cheetah
732
+ markup is yielded as `Token.Other`. This also works for
733
+ `spitfire templates`_ which use the same syntax.
734
+
735
+ .. _spitfire templates: http://code.google.com/p/spitfire/
736
+ """
737
+
738
+ name = 'Cheetah'
739
+ url = 'http://www.cheetahtemplate.org/'
740
+ aliases = ['cheetah', 'spitfire']
741
+ filenames = ['*.tmpl', '*.spt']
742
+ mimetypes = ['application/x-cheetah', 'application/x-spitfire']
743
+ version_added = ''
744
+
745
+ tokens = {
746
+ 'root': [
747
+ (r'(##[^\n]*)$',
748
+ (bygroups(Comment))),
749
+ (r'#[*](.|\n)*?[*]#', Comment),
750
+ (r'#end[^#\n]*(?:#|$)', Comment.Preproc),
751
+ (r'#slurp$', Comment.Preproc),
752
+ (r'(#[a-zA-Z]+)([^#\n]*)(#|$)',
753
+ (bygroups(Comment.Preproc, using(CheetahPythonLexer),
754
+ Comment.Preproc))),
755
+ # TODO support other Python syntax like $foo['bar']
756
+ (r'(\$)([a-zA-Z_][\w.]*\w)',
757
+ bygroups(Comment.Preproc, using(CheetahPythonLexer))),
758
+ (r'(?s)(\$\{!?)(.*?)(\})',
759
+ bygroups(Comment.Preproc, using(CheetahPythonLexer),
760
+ Comment.Preproc)),
761
+ (r'''(?sx)
762
+ (.+?) # anything, followed by:
763
+ (?:
764
+ (?=\#[#a-zA-Z]*) | # an eval comment
765
+ (?=\$[a-zA-Z_{]) | # a substitution
766
+ \Z # end of string
767
+ )
768
+ ''', Other),
769
+ (r'\s+', Text),
770
+ ],
771
+ }
772
+
773
+
774
+ class CheetahHtmlLexer(DelegatingLexer):
775
+ """
776
+ Subclass of the `CheetahLexer` that highlights unlexed data
777
+ with the `HtmlLexer`.
778
+ """
779
+
780
+ name = 'HTML+Cheetah'
781
+ aliases = ['html+cheetah', 'html+spitfire', 'htmlcheetah']
782
+ mimetypes = ['text/html+cheetah', 'text/html+spitfire']
783
+ url = 'http://www.cheetahtemplate.org/'
784
+ version_added = ''
785
+
786
+ def __init__(self, **options):
787
+ super().__init__(HtmlLexer, CheetahLexer, **options)
788
+
789
+
790
+ class CheetahXmlLexer(DelegatingLexer):
791
+ """
792
+ Subclass of the `CheetahLexer` that highlights unlexed data
793
+ with the `XmlLexer`.
794
+ """
795
+
796
+ name = 'XML+Cheetah'
797
+ aliases = ['xml+cheetah', 'xml+spitfire']
798
+ mimetypes = ['application/xml+cheetah', 'application/xml+spitfire']
799
+ url = 'http://www.cheetahtemplate.org/'
800
+ version_added = ''
801
+
802
+ def __init__(self, **options):
803
+ super().__init__(XmlLexer, CheetahLexer, **options)
804
+
805
+
806
+ class CheetahJavascriptLexer(DelegatingLexer):
807
+ """
808
+ Subclass of the `CheetahLexer` that highlights unlexed data
809
+ with the `JavascriptLexer`.
810
+ """
811
+
812
+ name = 'JavaScript+Cheetah'
813
+ aliases = ['javascript+cheetah', 'js+cheetah',
814
+ 'javascript+spitfire', 'js+spitfire']
815
+ mimetypes = ['application/x-javascript+cheetah',
816
+ 'text/x-javascript+cheetah',
817
+ 'text/javascript+cheetah',
818
+ 'application/x-javascript+spitfire',
819
+ 'text/x-javascript+spitfire',
820
+ 'text/javascript+spitfire']
821
+ url = 'http://www.cheetahtemplate.org/'
822
+ version_added = ''
823
+
824
+ def __init__(self, **options):
825
+ super().__init__(JavascriptLexer, CheetahLexer, **options)
826
+
827
+
828
+ class GenshiTextLexer(RegexLexer):
829
+ """
830
+ A lexer that highlights genshi text templates.
831
+ """
832
+
833
+ name = 'Genshi Text'
834
+ url = 'https://genshi.edgewall.org/'
835
+ aliases = ['genshitext']
836
+ mimetypes = ['application/x-genshi-text', 'text/x-genshi']
837
+ version_added = ''
838
+
839
+ tokens = {
840
+ 'root': [
841
+ (r'[^#$\s]+', Other),
842
+ (r'^(\s*)(##.*)$', bygroups(Text, Comment)),
843
+ (r'^(\s*)(#)', bygroups(Text, Comment.Preproc), 'directive'),
844
+ include('variable'),
845
+ (r'[#$\s]', Other),
846
+ ],
847
+ 'directive': [
848
+ (r'\n', Text, '#pop'),
849
+ (r'(?:def|for|if)\s+.*', using(PythonLexer), '#pop'),
850
+ (r'(choose|when|with)([^\S\n]+)(.*)',
851
+ bygroups(Keyword, Text, using(PythonLexer)), '#pop'),
852
+ (r'(choose|otherwise)\b', Keyword, '#pop'),
853
+ (r'(end\w*)([^\S\n]*)(.*)', bygroups(Keyword, Text, Comment), '#pop'),
854
+ ],
855
+ 'variable': [
856
+ (r'(?<!\$)(\$\{)(.+?)(\})',
857
+ bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
858
+ (r'(?<!\$)(\$)([a-zA-Z_][\w.]*)',
859
+ Name.Variable),
860
+ ]
861
+ }
862
+
863
+
864
+ class GenshiMarkupLexer(RegexLexer):
865
+ """
866
+ Base lexer for Genshi markup, used by `HtmlGenshiLexer` and
867
+ `GenshiLexer`.
868
+ """
869
+
870
+ flags = re.DOTALL
871
+
872
+ tokens = {
873
+ 'root': [
874
+ (r'[^<$]+', Other),
875
+ (r'(<\?python)(.*?)(\?>)',
876
+ bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
877
+ # yield style and script blocks as Other
878
+ (r'<\s*(script|style)\s*.*?>.*?<\s*/\1\s*>', Other),
879
+ (r'<\s*py:[a-zA-Z0-9]+', Name.Tag, 'pytag'),
880
+ (r'<\s*[a-zA-Z0-9:.]+', Name.Tag, 'tag'),
881
+ include('variable'),
882
+ (r'[<$]', Other),
883
+ ],
884
+ 'pytag': [
885
+ (r'\s+', Text),
886
+ (r'[\w:-]+\s*=', Name.Attribute, 'pyattr'),
887
+ (r'/?\s*>', Name.Tag, '#pop'),
888
+ ],
889
+ 'pyattr': [
890
+ ('(")(.*?)(")', bygroups(String, using(PythonLexer), String), '#pop'),
891
+ ("(')(.*?)(')", bygroups(String, using(PythonLexer), String), '#pop'),
892
+ (r'[^\s>]+', String, '#pop'),
893
+ ],
894
+ 'tag': [
895
+ (r'\s+', Text),
896
+ (r'py:[\w-]+\s*=', Name.Attribute, 'pyattr'),
897
+ (r'[\w:-]+\s*=', Name.Attribute, 'attr'),
898
+ (r'/?\s*>', Name.Tag, '#pop'),
899
+ ],
900
+ 'attr': [
901
+ ('"', String, 'attr-dstring'),
902
+ ("'", String, 'attr-sstring'),
903
+ (r'[^\s>]*', String, '#pop')
904
+ ],
905
+ 'attr-dstring': [
906
+ ('"', String, '#pop'),
907
+ include('strings'),
908
+ ("'", String)
909
+ ],
910
+ 'attr-sstring': [
911
+ ("'", String, '#pop'),
912
+ include('strings'),
913
+ ("'", String)
914
+ ],
915
+ 'strings': [
916
+ ('[^"\'$]+', String),
917
+ include('variable')
918
+ ],
919
+ 'variable': [
920
+ (r'(?<!\$)(\$\{)(.+?)(\})',
921
+ bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
922
+ (r'(?<!\$)(\$)([a-zA-Z_][\w\.]*)',
923
+ Name.Variable),
924
+ ]
925
+ }
926
+
927
+
928
+ class HtmlGenshiLexer(DelegatingLexer):
929
+ """
930
+ A lexer that highlights `genshi <https://genshi.edgewall.org/>`_ and
931
+ `kid <http://kid-templating.org/>`_ kid HTML templates.
932
+ """
933
+
934
+ name = 'HTML+Genshi'
935
+ aliases = ['html+genshi', 'html+kid']
936
+ version_added = ''
937
+ alias_filenames = ['*.html', '*.htm', '*.xhtml']
938
+ mimetypes = ['text/html+genshi']
939
+ url = 'https://genshi.edgewall.org/'
940
+
941
+ def __init__(self, **options):
942
+ super().__init__(HtmlLexer, GenshiMarkupLexer, **options)
943
+
944
+ def analyse_text(text):
945
+ rv = 0.0
946
+ if re.search(r'\$\{.*?\}', text) is not None:
947
+ rv += 0.2
948
+ if re.search(r'py:(.*?)=["\']', text) is not None:
949
+ rv += 0.2
950
+ return rv + HtmlLexer.analyse_text(text) - 0.01
951
+
952
+
953
+ class GenshiLexer(DelegatingLexer):
954
+ """
955
+ A lexer that highlights `genshi <https://genshi.edgewall.org/>`_ and
956
+ `kid <http://kid-templating.org/>`_ kid XML templates.
957
+ """
958
+
959
+ name = 'Genshi'
960
+ aliases = ['genshi', 'kid', 'xml+genshi', 'xml+kid']
961
+ filenames = ['*.kid']
962
+ version_added = ''
963
+ alias_filenames = ['*.xml']
964
+ mimetypes = ['application/x-genshi', 'application/x-kid']
965
+ url = 'https://genshi.edgewall.org/'
966
+
967
+ def __init__(self, **options):
968
+ super().__init__(XmlLexer, GenshiMarkupLexer, **options)
969
+
970
+ def analyse_text(text):
971
+ rv = 0.0
972
+ if re.search(r'\$\{.*?\}', text) is not None:
973
+ rv += 0.2
974
+ if re.search(r'py:(.*?)=["\']', text) is not None:
975
+ rv += 0.2
976
+ return rv + XmlLexer.analyse_text(text) - 0.01
977
+
978
+
979
+ class JavascriptGenshiLexer(DelegatingLexer):
980
+ """
981
+ A lexer that highlights javascript code in genshi text templates.
982
+ """
983
+
984
+ name = 'JavaScript+Genshi Text'
985
+ aliases = ['js+genshitext', 'js+genshi', 'javascript+genshitext',
986
+ 'javascript+genshi']
987
+ version_added = ''
988
+ alias_filenames = ['*.js']
989
+ mimetypes = ['application/x-javascript+genshi',
990
+ 'text/x-javascript+genshi',
991
+ 'text/javascript+genshi']
992
+ url = 'https://genshi.edgewall.org'
993
+
994
+ def __init__(self, **options):
995
+ super().__init__(JavascriptLexer, GenshiTextLexer, **options)
996
+
997
+ def analyse_text(text):
998
+ return GenshiLexer.analyse_text(text) - 0.05
999
+
1000
+
1001
+ class CssGenshiLexer(DelegatingLexer):
1002
+ """
1003
+ A lexer that highlights CSS definitions in genshi text templates.
1004
+ """
1005
+
1006
+ name = 'CSS+Genshi Text'
1007
+ aliases = ['css+genshitext', 'css+genshi']
1008
+ version_added = ''
1009
+ alias_filenames = ['*.css']
1010
+ mimetypes = ['text/css+genshi']
1011
+ url = 'https://genshi.edgewall.org'
1012
+
1013
+ def __init__(self, **options):
1014
+ super().__init__(CssLexer, GenshiTextLexer, **options)
1015
+
1016
+ def analyse_text(text):
1017
+ return GenshiLexer.analyse_text(text) - 0.05
1018
+
1019
+
1020
+ class RhtmlLexer(DelegatingLexer):
1021
+ """
1022
+ Subclass of the ERB lexer that highlights the unlexed data with the
1023
+ html lexer.
1024
+
1025
+ Nested Javascript and CSS is highlighted too.
1026
+ """
1027
+
1028
+ name = 'RHTML'
1029
+ aliases = ['rhtml', 'html+erb', 'html+ruby']
1030
+ filenames = ['*.rhtml']
1031
+ version_added = ''
1032
+ alias_filenames = ['*.html', '*.htm', '*.xhtml']
1033
+ mimetypes = ['text/html+ruby']
1034
+ url = 'https://github.com/ruby/erb'
1035
+
1036
+
1037
+ def __init__(self, **options):
1038
+ super().__init__(HtmlLexer, ErbLexer, **options)
1039
+
1040
+ def analyse_text(text):
1041
+ rv = ErbLexer.analyse_text(text) - 0.01
1042
+ if html_doctype_matches(text):
1043
+ # one more than the XmlErbLexer returns
1044
+ rv += 0.5
1045
+ return rv
1046
+
1047
+
1048
+ class XmlErbLexer(DelegatingLexer):
1049
+ """
1050
+ Subclass of `ErbLexer` which highlights data outside preprocessor
1051
+ directives with the `XmlLexer`.
1052
+ """
1053
+
1054
+ name = 'XML+Ruby'
1055
+ aliases = ['xml+ruby', 'xml+erb']
1056
+ version_added = ''
1057
+ alias_filenames = ['*.xml']
1058
+ mimetypes = ['application/xml+ruby']
1059
+ url = 'https://github.com/ruby/erb'
1060
+
1061
+ def __init__(self, **options):
1062
+ super().__init__(XmlLexer, ErbLexer, **options)
1063
+
1064
+ def analyse_text(text):
1065
+ rv = ErbLexer.analyse_text(text) - 0.01
1066
+ if looks_like_xml(text):
1067
+ rv += 0.4
1068
+ return rv
1069
+
1070
+
1071
+ class CssErbLexer(DelegatingLexer):
1072
+ """
1073
+ Subclass of `ErbLexer` which highlights unlexed data with the `CssLexer`.
1074
+ """
1075
+
1076
+ name = 'CSS+Ruby'
1077
+ aliases = ['css+ruby', 'css+erb']
1078
+ version_added = ''
1079
+ alias_filenames = ['*.css']
1080
+ mimetypes = ['text/css+ruby']
1081
+ url = 'https://github.com/ruby/erb'
1082
+
1083
+ def __init__(self, **options):
1084
+ super().__init__(CssLexer, ErbLexer, **options)
1085
+
1086
+ def analyse_text(text):
1087
+ return ErbLexer.analyse_text(text) - 0.05
1088
+
1089
+
1090
+ class JavascriptErbLexer(DelegatingLexer):
1091
+ """
1092
+ Subclass of `ErbLexer` which highlights unlexed data with the
1093
+ `JavascriptLexer`.
1094
+ """
1095
+
1096
+ name = 'JavaScript+Ruby'
1097
+ aliases = ['javascript+ruby', 'js+ruby', 'javascript+erb', 'js+erb']
1098
+ version_added = ''
1099
+ alias_filenames = ['*.js']
1100
+ mimetypes = ['application/x-javascript+ruby',
1101
+ 'text/x-javascript+ruby',
1102
+ 'text/javascript+ruby']
1103
+ url = 'https://github.com/ruby/erb'
1104
+
1105
+ def __init__(self, **options):
1106
+ super().__init__(JavascriptLexer, ErbLexer, **options)
1107
+
1108
+ def analyse_text(text):
1109
+ return ErbLexer.analyse_text(text) - 0.05
1110
+
1111
+
1112
+ class HtmlPhpLexer(DelegatingLexer):
1113
+ """
1114
+ Subclass of `PhpLexer` that highlights unhandled data with the `HtmlLexer`.
1115
+
1116
+ Nested Javascript and CSS is highlighted too.
1117
+ """
1118
+
1119
+ name = 'HTML+PHP'
1120
+ aliases = ['html+php']
1121
+ filenames = ['*.phtml']
1122
+ version_added = ''
1123
+ alias_filenames = ['*.php', '*.html', '*.htm', '*.xhtml',
1124
+ '*.php[345]']
1125
+ mimetypes = ['application/x-php',
1126
+ 'application/x-httpd-php', 'application/x-httpd-php3',
1127
+ 'application/x-httpd-php4', 'application/x-httpd-php5']
1128
+ url = 'https://www.php.net'
1129
+
1130
+
1131
+ def __init__(self, **options):
1132
+ super().__init__(HtmlLexer, PhpLexer, **options)
1133
+
1134
+ def analyse_text(text):
1135
+ rv = PhpLexer.analyse_text(text) - 0.01
1136
+ if html_doctype_matches(text):
1137
+ rv += 0.5
1138
+ return rv
1139
+
1140
+
1141
+ class XmlPhpLexer(DelegatingLexer):
1142
+ """
1143
+ Subclass of `PhpLexer` that highlights unhandled data with the `XmlLexer`.
1144
+ """
1145
+
1146
+ name = 'XML+PHP'
1147
+ aliases = ['xml+php']
1148
+ version_added = ''
1149
+ alias_filenames = ['*.xml', '*.php', '*.php[345]']
1150
+ mimetypes = ['application/xml+php']
1151
+ url = 'https://www.php.net'
1152
+
1153
+ def __init__(self, **options):
1154
+ super().__init__(XmlLexer, PhpLexer, **options)
1155
+
1156
+ def analyse_text(text):
1157
+ rv = PhpLexer.analyse_text(text) - 0.01
1158
+ if looks_like_xml(text):
1159
+ rv += 0.4
1160
+ return rv
1161
+
1162
+
1163
+ class CssPhpLexer(DelegatingLexer):
1164
+ """
1165
+ Subclass of `PhpLexer` which highlights unmatched data with the `CssLexer`.
1166
+ """
1167
+
1168
+ name = 'CSS+PHP'
1169
+ aliases = ['css+php']
1170
+ version_added = ''
1171
+ alias_filenames = ['*.css']
1172
+ mimetypes = ['text/css+php']
1173
+ url = 'https://www.php.net'
1174
+
1175
+ def __init__(self, **options):
1176
+ super().__init__(CssLexer, PhpLexer, **options)
1177
+
1178
+ def analyse_text(text):
1179
+ return PhpLexer.analyse_text(text) - 0.05
1180
+
1181
+
1182
+ class JavascriptPhpLexer(DelegatingLexer):
1183
+ """
1184
+ Subclass of `PhpLexer` which highlights unmatched data with the
1185
+ `JavascriptLexer`.
1186
+ """
1187
+
1188
+ name = 'JavaScript+PHP'
1189
+ aliases = ['javascript+php', 'js+php']
1190
+ version_added = ''
1191
+ alias_filenames = ['*.js']
1192
+ mimetypes = ['application/x-javascript+php',
1193
+ 'text/x-javascript+php',
1194
+ 'text/javascript+php']
1195
+ url = 'https://www.php.net'
1196
+
1197
+ def __init__(self, **options):
1198
+ super().__init__(JavascriptLexer, PhpLexer, **options)
1199
+
1200
+ def analyse_text(text):
1201
+ return PhpLexer.analyse_text(text)
1202
+
1203
+
1204
+ class HtmlSmartyLexer(DelegatingLexer):
1205
+ """
1206
+ Subclass of the `SmartyLexer` that highlights unlexed data with the
1207
+ `HtmlLexer`.
1208
+
1209
+ Nested Javascript and CSS is highlighted too.
1210
+ """
1211
+
1212
+ name = 'HTML+Smarty'
1213
+ aliases = ['html+smarty']
1214
+ version_added = ''
1215
+ alias_filenames = ['*.html', '*.htm', '*.xhtml', '*.tpl']
1216
+ mimetypes = ['text/html+smarty']
1217
+ url = 'https://www.smarty.net/'
1218
+
1219
+ def __init__(self, **options):
1220
+ super().__init__(HtmlLexer, SmartyLexer, **options)
1221
+
1222
+ def analyse_text(text):
1223
+ rv = SmartyLexer.analyse_text(text) - 0.01
1224
+ if html_doctype_matches(text):
1225
+ rv += 0.5
1226
+ return rv
1227
+
1228
+
1229
+ class XmlSmartyLexer(DelegatingLexer):
1230
+ """
1231
+ Subclass of the `SmartyLexer` that highlights unlexed data with the
1232
+ `XmlLexer`.
1233
+ """
1234
+
1235
+ name = 'XML+Smarty'
1236
+ aliases = ['xml+smarty']
1237
+ version_added = ''
1238
+ alias_filenames = ['*.xml', '*.tpl']
1239
+ mimetypes = ['application/xml+smarty']
1240
+ url = 'https://www.smarty.net/'
1241
+
1242
+ def __init__(self, **options):
1243
+ super().__init__(XmlLexer, SmartyLexer, **options)
1244
+
1245
+ def analyse_text(text):
1246
+ rv = SmartyLexer.analyse_text(text) - 0.01
1247
+ if looks_like_xml(text):
1248
+ rv += 0.4
1249
+ return rv
1250
+
1251
+
1252
+ class CssSmartyLexer(DelegatingLexer):
1253
+ """
1254
+ Subclass of the `SmartyLexer` that highlights unlexed data with the
1255
+ `CssLexer`.
1256
+ """
1257
+
1258
+ name = 'CSS+Smarty'
1259
+ aliases = ['css+smarty']
1260
+ version_added = ''
1261
+ alias_filenames = ['*.css', '*.tpl']
1262
+ mimetypes = ['text/css+smarty']
1263
+ url = 'https://www.smarty.net/'
1264
+
1265
+ def __init__(self, **options):
1266
+ super().__init__(CssLexer, SmartyLexer, **options)
1267
+
1268
+ def analyse_text(text):
1269
+ return SmartyLexer.analyse_text(text) - 0.05
1270
+
1271
+
1272
+ class JavascriptSmartyLexer(DelegatingLexer):
1273
+ """
1274
+ Subclass of the `SmartyLexer` that highlights unlexed data with the
1275
+ `JavascriptLexer`.
1276
+ """
1277
+
1278
+ name = 'JavaScript+Smarty'
1279
+ aliases = ['javascript+smarty', 'js+smarty']
1280
+ version_added = ''
1281
+ alias_filenames = ['*.js', '*.tpl']
1282
+ mimetypes = ['application/x-javascript+smarty',
1283
+ 'text/x-javascript+smarty',
1284
+ 'text/javascript+smarty']
1285
+ url = 'https://www.smarty.net/'
1286
+
1287
+ def __init__(self, **options):
1288
+ super().__init__(JavascriptLexer, SmartyLexer, **options)
1289
+
1290
+ def analyse_text(text):
1291
+ return SmartyLexer.analyse_text(text) - 0.05
1292
+
1293
+
1294
+ class HtmlDjangoLexer(DelegatingLexer):
1295
+ """
1296
+ Subclass of the `DjangoLexer` that highlights unlexed data with the
1297
+ `HtmlLexer`.
1298
+
1299
+ Nested Javascript and CSS is highlighted too.
1300
+ """
1301
+
1302
+ name = 'HTML+Django/Jinja'
1303
+ aliases = ['html+django', 'html+jinja', 'htmldjango']
1304
+ filenames = ['*.html.j2', '*.htm.j2', '*.xhtml.j2', '*.html.jinja2', '*.htm.jinja2', '*.xhtml.jinja2']
1305
+ version_added = ''
1306
+ alias_filenames = ['*.html', '*.htm', '*.xhtml']
1307
+ mimetypes = ['text/html+django', 'text/html+jinja']
1308
+ url = 'https://www.djangoproject.com/documentation/templates'
1309
+
1310
+ def __init__(self, **options):
1311
+ super().__init__(HtmlLexer, DjangoLexer, **options)
1312
+
1313
+ def analyse_text(text):
1314
+ rv = DjangoLexer.analyse_text(text) - 0.01
1315
+ if html_doctype_matches(text):
1316
+ rv += 0.5
1317
+ return rv
1318
+
1319
+
1320
+ class XmlDjangoLexer(DelegatingLexer):
1321
+ """
1322
+ Subclass of the `DjangoLexer` that highlights unlexed data with the
1323
+ `XmlLexer`.
1324
+ """
1325
+
1326
+ name = 'XML+Django/Jinja'
1327
+ aliases = ['xml+django', 'xml+jinja']
1328
+ filenames = ['*.xml.j2', '*.xml.jinja2']
1329
+ version_added = ''
1330
+ alias_filenames = ['*.xml']
1331
+ mimetypes = ['application/xml+django', 'application/xml+jinja']
1332
+ url = 'https://www.djangoproject.com/documentation/templates'
1333
+
1334
+ def __init__(self, **options):
1335
+ super().__init__(XmlLexer, DjangoLexer, **options)
1336
+
1337
+ def analyse_text(text):
1338
+ rv = DjangoLexer.analyse_text(text) - 0.01
1339
+ if looks_like_xml(text):
1340
+ rv += 0.4
1341
+ return rv
1342
+
1343
+
1344
+ class CssDjangoLexer(DelegatingLexer):
1345
+ """
1346
+ Subclass of the `DjangoLexer` that highlights unlexed data with the
1347
+ `CssLexer`.
1348
+ """
1349
+
1350
+ name = 'CSS+Django/Jinja'
1351
+ aliases = ['css+django', 'css+jinja']
1352
+ filenames = ['*.css.j2', '*.css.jinja2']
1353
+ version_added = ''
1354
+ alias_filenames = ['*.css']
1355
+ mimetypes = ['text/css+django', 'text/css+jinja']
1356
+ url = 'https://www.djangoproject.com/documentation/templates'
1357
+
1358
+ def __init__(self, **options):
1359
+ super().__init__(CssLexer, DjangoLexer, **options)
1360
+
1361
+ def analyse_text(text):
1362
+ return DjangoLexer.analyse_text(text) - 0.05
1363
+
1364
+
1365
+ class JavascriptDjangoLexer(DelegatingLexer):
1366
+ """
1367
+ Subclass of the `DjangoLexer` that highlights unlexed data with the
1368
+ `JavascriptLexer`.
1369
+ """
1370
+
1371
+ name = 'JavaScript+Django/Jinja'
1372
+ aliases = ['javascript+django', 'js+django',
1373
+ 'javascript+jinja', 'js+jinja']
1374
+ filenames = ['*.js.j2', '*.js.jinja2']
1375
+ version_added = ''
1376
+ alias_filenames = ['*.js']
1377
+ mimetypes = ['application/x-javascript+django',
1378
+ 'application/x-javascript+jinja',
1379
+ 'text/x-javascript+django',
1380
+ 'text/x-javascript+jinja',
1381
+ 'text/javascript+django',
1382
+ 'text/javascript+jinja']
1383
+ url = 'https://www.djangoproject.com/documentation/templates'
1384
+
1385
+ def __init__(self, **options):
1386
+ super().__init__(JavascriptLexer, DjangoLexer, **options)
1387
+
1388
+ def analyse_text(text):
1389
+ return DjangoLexer.analyse_text(text) - 0.05
1390
+
1391
+
1392
+ class JspRootLexer(RegexLexer):
1393
+ """
1394
+ Base for the `JspLexer`. Yields `Token.Other` for area outside of
1395
+ JSP tags.
1396
+
1397
+ .. versionadded:: 0.7
1398
+ """
1399
+
1400
+ tokens = {
1401
+ 'root': [
1402
+ (r'<%\S?', Keyword, 'sec'),
1403
+ # FIXME: I want to make these keywords but still parse attributes.
1404
+ (r'</?jsp:(forward|getProperty|include|plugin|setProperty|useBean).*?>',
1405
+ Keyword),
1406
+ (r'[^<]+', Other),
1407
+ (r'<', Other),
1408
+ ],
1409
+ 'sec': [
1410
+ (r'%>', Keyword, '#pop'),
1411
+ # note: '\w\W' != '.' without DOTALL.
1412
+ (r'[\w\W]+?(?=%>|\Z)', using(JavaLexer)),
1413
+ ],
1414
+ }
1415
+
1416
+
1417
+ class JspLexer(DelegatingLexer):
1418
+ """
1419
+ Lexer for Java Server Pages.
1420
+ """
1421
+ name = 'Java Server Page'
1422
+ aliases = ['jsp']
1423
+ filenames = ['*.jsp']
1424
+ mimetypes = ['application/x-jsp']
1425
+ url = 'https://projects.eclipse.org/projects/ee4j.jsp'
1426
+ version_added = '0.7'
1427
+
1428
+ def __init__(self, **options):
1429
+ super().__init__(XmlLexer, JspRootLexer, **options)
1430
+
1431
+ def analyse_text(text):
1432
+ rv = JavaLexer.analyse_text(text) - 0.01
1433
+ if looks_like_xml(text):
1434
+ rv += 0.4
1435
+ if '<%' in text and '%>' in text:
1436
+ rv += 0.1
1437
+ return rv
1438
+
1439
+
1440
+ class EvoqueLexer(RegexLexer):
1441
+ """
1442
+ For files using the Evoque templating system.
1443
+ """
1444
+ name = 'Evoque'
1445
+ aliases = ['evoque']
1446
+ filenames = ['*.evoque']
1447
+ mimetypes = ['application/x-evoque']
1448
+ url = 'https://gizmojo.org/templating'
1449
+ version_added = '1.1'
1450
+
1451
+ flags = re.DOTALL
1452
+
1453
+ tokens = {
1454
+ 'root': [
1455
+ (r'[^#$]+', Other),
1456
+ (r'#\[', Comment.Multiline, 'comment'),
1457
+ (r'\$\$', Other),
1458
+ # svn keywords
1459
+ (r'\$\w+:[^$\n]*\$', Comment.Multiline),
1460
+ # directives: begin, end
1461
+ (r'(\$)(begin|end)(\{(%)?)(.*?)((?(4)%)\})',
1462
+ bygroups(Punctuation, Name.Builtin, Punctuation, None,
1463
+ String, Punctuation)),
1464
+ # directives: evoque, overlay
1465
+ # see doc for handling first name arg: /directives/evoque/
1466
+ # + minor inconsistency: the "name" in e.g. $overlay{name=site_base}
1467
+ # should be using(PythonLexer), not passed out as String
1468
+ (r'(\$)(evoque|overlay)(\{(%)?)(\s*[#\w\-"\'.]+)?'
1469
+ r'(.*?)((?(4)%)\})',
1470
+ bygroups(Punctuation, Name.Builtin, Punctuation, None,
1471
+ String, using(PythonLexer), Punctuation)),
1472
+ # directives: if, for, prefer, test
1473
+ (r'(\$)(\w+)(\{(%)?)(.*?)((?(4)%)\})',
1474
+ bygroups(Punctuation, Name.Builtin, Punctuation, None,
1475
+ using(PythonLexer), Punctuation)),
1476
+ # directive clauses (no {} expression)
1477
+ (r'(\$)(else|rof|fi)', bygroups(Punctuation, Name.Builtin)),
1478
+ # expressions
1479
+ (r'(\$\{(%)?)(.*?)((!)(.*?))?((?(2)%)\})',
1480
+ bygroups(Punctuation, None, using(PythonLexer),
1481
+ Name.Builtin, None, None, Punctuation)),
1482
+ (r'#', Other),
1483
+ ],
1484
+ 'comment': [
1485
+ (r'[^\]#]', Comment.Multiline),
1486
+ (r'#\[', Comment.Multiline, '#push'),
1487
+ (r'\]#', Comment.Multiline, '#pop'),
1488
+ (r'[\]#]', Comment.Multiline)
1489
+ ],
1490
+ }
1491
+
1492
+ def analyse_text(text):
1493
+ """Evoque templates use $evoque, which is unique."""
1494
+ if '$evoque' in text:
1495
+ return 1
1496
+
1497
+ class EvoqueHtmlLexer(DelegatingLexer):
1498
+ """
1499
+ Subclass of the `EvoqueLexer` that highlights unlexed data with the
1500
+ `HtmlLexer`.
1501
+ """
1502
+ name = 'HTML+Evoque'
1503
+ aliases = ['html+evoque']
1504
+ alias_filenames = ['*.html']
1505
+ mimetypes = ['text/html+evoque']
1506
+ url = 'https://gizmojo.org/templating'
1507
+ version_added = '1.1'
1508
+
1509
+ def __init__(self, **options):
1510
+ super().__init__(HtmlLexer, EvoqueLexer, **options)
1511
+
1512
+ def analyse_text(text):
1513
+ return EvoqueLexer.analyse_text(text)
1514
+
1515
+
1516
+ class EvoqueXmlLexer(DelegatingLexer):
1517
+ """
1518
+ Subclass of the `EvoqueLexer` that highlights unlexed data with the
1519
+ `XmlLexer`.
1520
+ """
1521
+ name = 'XML+Evoque'
1522
+ aliases = ['xml+evoque']
1523
+ alias_filenames = ['*.xml']
1524
+ mimetypes = ['application/xml+evoque']
1525
+ url = 'https://gizmojo.org/templating'
1526
+ version_added = '1.1'
1527
+
1528
+ def __init__(self, **options):
1529
+ super().__init__(XmlLexer, EvoqueLexer, **options)
1530
+
1531
+ def analyse_text(text):
1532
+ return EvoqueLexer.analyse_text(text)
1533
+
1534
+
1535
+ class ColdfusionLexer(RegexLexer):
1536
+ """
1537
+ Coldfusion statements
1538
+ """
1539
+ name = 'cfstatement'
1540
+ aliases = ['cfs']
1541
+ filenames = []
1542
+ mimetypes = []
1543
+ url = 'https://www.adobe.com/products/coldfusion-family.html'
1544
+ version_added = ''
1545
+
1546
+ flags = re.IGNORECASE
1547
+
1548
+ tokens = {
1549
+ 'root': [
1550
+ (r'//.*?\n', Comment.Single),
1551
+ (r'/\*(?:.|\n)*?\*/', Comment.Multiline),
1552
+ (r'\+\+|--', Operator),
1553
+ (r'[-+*/^&=!]', Operator),
1554
+ (r'<=|>=|<|>|==', Operator),
1555
+ (r'mod\b', Operator),
1556
+ (r'(eq|lt|gt|lte|gte|not|is|and|or)\b', Operator),
1557
+ (r'\|\||&&', Operator),
1558
+ (r'\?', Operator),
1559
+ (r'"', String.Double, 'string'),
1560
+ # There is a special rule for allowing html in single quoted
1561
+ # strings, evidently.
1562
+ (r"'.*?'", String.Single),
1563
+ (r'\d+', Number),
1564
+ (r'(if|else|len|var|xml|default|break|switch|component|property|function|do|'
1565
+ r'try|catch|in|continue|for|return|while|required|any|array|binary|boolean|'
1566
+ r'component|date|guid|numeric|query|string|struct|uuid|case)\b', Keyword),
1567
+ (r'(true|false|null)\b', Keyword.Constant),
1568
+ (r'(application|session|client|cookie|super|this|variables|arguments)\b',
1569
+ Name.Constant),
1570
+ (r'([a-z_$][\w.]*)(\s*)(\()',
1571
+ bygroups(Name.Function, Text, Punctuation)),
1572
+ (r'[a-z_$][\w.]*', Name.Variable),
1573
+ (r'[()\[\]{};:,.\\]', Punctuation),
1574
+ (r'\s+', Text),
1575
+ ],
1576
+ 'string': [
1577
+ (r'""', String.Double),
1578
+ (r'#.+?#', String.Interp),
1579
+ (r'[^"#]+', String.Double),
1580
+ (r'#', String.Double),
1581
+ (r'"', String.Double, '#pop'),
1582
+ ],
1583
+ }
1584
+
1585
+
1586
+ class ColdfusionMarkupLexer(RegexLexer):
1587
+ """
1588
+ Coldfusion markup only
1589
+ """
1590
+ name = 'Coldfusion'
1591
+ aliases = ['cf']
1592
+ filenames = []
1593
+ mimetypes = []
1594
+ url = 'https://www.adobe.com/products/coldfusion-family.html'
1595
+
1596
+ tokens = {
1597
+ 'root': [
1598
+ (r'[^<]+', Other),
1599
+ include('tags'),
1600
+ (r'<[^<>]*', Other),
1601
+ ],
1602
+ 'tags': [
1603
+ (r'<!---', Comment.Multiline, 'cfcomment'),
1604
+ (r'(?s)<!--.*?-->', Comment),
1605
+ (r'<cfoutput.*?>', Name.Builtin, 'cfoutput'),
1606
+ (r'(?s)(<cfscript.*?>)(.+?)(</cfscript.*?>)',
1607
+ bygroups(Name.Builtin, using(ColdfusionLexer), Name.Builtin)),
1608
+ # negative lookbehind is for strings with embedded >
1609
+ (r'(?s)(</?cf(?:component|include|if|else|elseif|loop|return|'
1610
+ r'dbinfo|dump|abort|location|invoke|throw|file|savecontent|'
1611
+ r'mailpart|mail|header|content|zip|image|lock|argument|try|'
1612
+ r'catch|break|directory|http|set|function|param)\b)(.*?)((?<!\\)>)',
1613
+ bygroups(Name.Builtin, using(ColdfusionLexer), Name.Builtin)),
1614
+ ],
1615
+ 'cfoutput': [
1616
+ (r'[^#<]+', Other),
1617
+ (r'(#)(.*?)(#)', bygroups(Punctuation, using(ColdfusionLexer),
1618
+ Punctuation)),
1619
+ # (r'<cfoutput.*?>', Name.Builtin, '#push'),
1620
+ (r'</cfoutput.*?>', Name.Builtin, '#pop'),
1621
+ include('tags'),
1622
+ (r'(?s)<[^<>]*', Other),
1623
+ (r'#', Other),
1624
+ ],
1625
+ 'cfcomment': [
1626
+ (r'<!---', Comment.Multiline, '#push'),
1627
+ (r'--->', Comment.Multiline, '#pop'),
1628
+ (r'([^<-]|<(?!!---)|-(?!-->))+', Comment.Multiline),
1629
+ ],
1630
+ }
1631
+
1632
+
1633
+ class ColdfusionHtmlLexer(DelegatingLexer):
1634
+ """
1635
+ Coldfusion markup in html
1636
+ """
1637
+ name = 'Coldfusion HTML'
1638
+ aliases = ['cfm']
1639
+ filenames = ['*.cfm', '*.cfml']
1640
+ mimetypes = ['application/x-coldfusion']
1641
+ url = 'https://www.adobe.com/products/coldfusion-family.html'
1642
+ version_added = ''
1643
+
1644
+ def __init__(self, **options):
1645
+ super().__init__(HtmlLexer, ColdfusionMarkupLexer, **options)
1646
+
1647
+
1648
+ class ColdfusionCFCLexer(DelegatingLexer):
1649
+ """
1650
+ Coldfusion markup/script components
1651
+ """
1652
+ name = 'Coldfusion CFC'
1653
+ aliases = ['cfc']
1654
+ filenames = ['*.cfc']
1655
+ mimetypes = []
1656
+ url = 'https://www.adobe.com/products/coldfusion-family.html'
1657
+ version_added = '2.0'
1658
+
1659
+ def __init__(self, **options):
1660
+ super().__init__(ColdfusionHtmlLexer, ColdfusionLexer, **options)
1661
+
1662
+
1663
+ class SspLexer(DelegatingLexer):
1664
+ """
1665
+ Lexer for Scalate Server Pages.
1666
+ """
1667
+ name = 'Scalate Server Page'
1668
+ aliases = ['ssp']
1669
+ filenames = ['*.ssp']
1670
+ mimetypes = ['application/x-ssp']
1671
+ url = 'https://scalate.github.io/scalate/'
1672
+ version_added = '1.4'
1673
+
1674
+ def __init__(self, **options):
1675
+ super().__init__(XmlLexer, JspRootLexer, **options)
1676
+
1677
+ def analyse_text(text):
1678
+ rv = 0.0
1679
+ if re.search(r'val \w+\s*:', text):
1680
+ rv += 0.6
1681
+ if looks_like_xml(text):
1682
+ rv += 0.2
1683
+ if '<%' in text and '%>' in text:
1684
+ rv += 0.1
1685
+ return rv
1686
+
1687
+
1688
+ class TeaTemplateRootLexer(RegexLexer):
1689
+ """
1690
+ Base for the `TeaTemplateLexer`. Yields `Token.Other` for area outside of
1691
+ code blocks.
1692
+
1693
+ .. versionadded:: 1.5
1694
+ """
1695
+
1696
+ tokens = {
1697
+ 'root': [
1698
+ (r'<%\S?', Keyword, 'sec'),
1699
+ (r'[^<]+', Other),
1700
+ (r'<', Other),
1701
+ ],
1702
+ 'sec': [
1703
+ (r'%>', Keyword, '#pop'),
1704
+ # note: '\w\W' != '.' without DOTALL.
1705
+ (r'[\w\W]+?(?=%>|\Z)', using(TeaLangLexer)),
1706
+ ],
1707
+ }
1708
+
1709
+
1710
+ class TeaTemplateLexer(DelegatingLexer):
1711
+ """
1712
+ Lexer for Tea Templates.
1713
+ """
1714
+ name = 'Tea'
1715
+ aliases = ['tea']
1716
+ filenames = ['*.tea']
1717
+ mimetypes = ['text/x-tea']
1718
+ url = 'https://github.com/teatrove/teatrove'
1719
+ version_added = '1.5'
1720
+
1721
+ def __init__(self, **options):
1722
+ super().__init__(XmlLexer, TeaTemplateRootLexer, **options)
1723
+
1724
+ def analyse_text(text):
1725
+ rv = TeaLangLexer.analyse_text(text) - 0.01
1726
+ if looks_like_xml(text):
1727
+ rv += 0.4
1728
+ if '<%' in text and '%>' in text:
1729
+ rv += 0.1
1730
+ return rv
1731
+
1732
+
1733
+ class LassoHtmlLexer(DelegatingLexer):
1734
+ """
1735
+ Subclass of the `LassoLexer` which highlights unhandled data with the
1736
+ `HtmlLexer`.
1737
+
1738
+ Nested JavaScript and CSS is also highlighted.
1739
+ """
1740
+
1741
+ name = 'HTML+Lasso'
1742
+ aliases = ['html+lasso']
1743
+ version_added = '1.6'
1744
+ alias_filenames = ['*.html', '*.htm', '*.xhtml', '*.lasso', '*.lasso[89]',
1745
+ '*.incl', '*.inc', '*.las']
1746
+ mimetypes = ['text/html+lasso',
1747
+ 'application/x-httpd-lasso',
1748
+ 'application/x-httpd-lasso[89]']
1749
+ url = 'https://www.lassosoft.com'
1750
+
1751
+ def __init__(self, **options):
1752
+ super().__init__(HtmlLexer, LassoLexer, **options)
1753
+
1754
+ def analyse_text(text):
1755
+ rv = LassoLexer.analyse_text(text) - 0.01
1756
+ if html_doctype_matches(text): # same as HTML lexer
1757
+ rv += 0.5
1758
+ return rv
1759
+
1760
+
1761
+ class LassoXmlLexer(DelegatingLexer):
1762
+ """
1763
+ Subclass of the `LassoLexer` which highlights unhandled data with the
1764
+ `XmlLexer`.
1765
+ """
1766
+
1767
+ name = 'XML+Lasso'
1768
+ aliases = ['xml+lasso']
1769
+ version_added = '1.6'
1770
+ alias_filenames = ['*.xml', '*.lasso', '*.lasso[89]',
1771
+ '*.incl', '*.inc', '*.las']
1772
+ mimetypes = ['application/xml+lasso']
1773
+ url = 'https://www.lassosoft.com'
1774
+
1775
+ def __init__(self, **options):
1776
+ super().__init__(XmlLexer, LassoLexer, **options)
1777
+
1778
+ def analyse_text(text):
1779
+ rv = LassoLexer.analyse_text(text) - 0.01
1780
+ if looks_like_xml(text):
1781
+ rv += 0.4
1782
+ return rv
1783
+
1784
+
1785
+ class LassoCssLexer(DelegatingLexer):
1786
+ """
1787
+ Subclass of the `LassoLexer` which highlights unhandled data with the
1788
+ `CssLexer`.
1789
+ """
1790
+
1791
+ name = 'CSS+Lasso'
1792
+ aliases = ['css+lasso']
1793
+ version_added = '1.6'
1794
+ alias_filenames = ['*.css']
1795
+ mimetypes = ['text/css+lasso']
1796
+ url = 'https://www.lassosoft.com'
1797
+
1798
+ def __init__(self, **options):
1799
+ options['requiredelimiters'] = True
1800
+ super().__init__(CssLexer, LassoLexer, **options)
1801
+
1802
+ def analyse_text(text):
1803
+ rv = LassoLexer.analyse_text(text) - 0.05
1804
+ if re.search(r'\w+:[^;]+;', text):
1805
+ rv += 0.1
1806
+ if 'padding:' in text:
1807
+ rv += 0.1
1808
+ return rv
1809
+
1810
+
1811
+ class LassoJavascriptLexer(DelegatingLexer):
1812
+ """
1813
+ Subclass of the `LassoLexer` which highlights unhandled data with the
1814
+ `JavascriptLexer`.
1815
+ """
1816
+
1817
+ name = 'JavaScript+Lasso'
1818
+ aliases = ['javascript+lasso', 'js+lasso']
1819
+ version_added = '1.6'
1820
+ alias_filenames = ['*.js']
1821
+ mimetypes = ['application/x-javascript+lasso',
1822
+ 'text/x-javascript+lasso',
1823
+ 'text/javascript+lasso']
1824
+ url = 'https://www.lassosoft.com'
1825
+
1826
+ def __init__(self, **options):
1827
+ options['requiredelimiters'] = True
1828
+ super().__init__(JavascriptLexer, LassoLexer, **options)
1829
+
1830
+ def analyse_text(text):
1831
+ rv = LassoLexer.analyse_text(text) - 0.05
1832
+ return rv
1833
+
1834
+
1835
+ class HandlebarsLexer(RegexLexer):
1836
+ """
1837
+ Generic handlebars template lexer.
1838
+
1839
+ Highlights only the Handlebars template tags (stuff between `{{` and `}}`).
1840
+ Everything else is left for a delegating lexer.
1841
+ """
1842
+
1843
+ name = "Handlebars"
1844
+ url = 'https://handlebarsjs.com/'
1845
+ aliases = ['handlebars']
1846
+ version_added = '2.0'
1847
+
1848
+ tokens = {
1849
+ 'root': [
1850
+ (r'[^{]+', Other),
1851
+
1852
+ # Comment start {{! }} or {{!--
1853
+ (r'\{\{!.*\}\}', Comment),
1854
+
1855
+ # HTML Escaping open {{{expression
1856
+ (r'(\{\{\{)(\s*)', bygroups(Comment.Special, Text), 'tag'),
1857
+
1858
+ # {{blockOpen {{#blockOpen {{/blockClose with optional tilde ~
1859
+ (r'(\{\{)([#~/]+)([^\s}]*)',
1860
+ bygroups(Comment.Preproc, Number.Attribute, Number.Attribute), 'tag'),
1861
+ (r'(\{\{)(\s*)', bygroups(Comment.Preproc, Text), 'tag'),
1862
+ ],
1863
+
1864
+ 'tag': [
1865
+ (r'\s+', Text),
1866
+ # HTML Escaping close }}}
1867
+ (r'\}\}\}', Comment.Special, '#pop'),
1868
+ # blockClose}}, includes optional tilde ~
1869
+ (r'(~?)(\}\})', bygroups(Number, Comment.Preproc), '#pop'),
1870
+
1871
+ # {{opt=something}}
1872
+ (r'([^\s}]+)(=)', bygroups(Name.Attribute, Operator)),
1873
+
1874
+ # Partials {{> ...}}
1875
+ (r'(>)(\s*)(@partial-block)', bygroups(Keyword, Text, Keyword)),
1876
+ (r'(#?>)(\s*)([\w-]+)', bygroups(Keyword, Text, Name.Variable)),
1877
+ (r'(>)(\s*)(\()', bygroups(Keyword, Text, Punctuation),
1878
+ 'dynamic-partial'),
1879
+
1880
+ include('generic'),
1881
+ ],
1882
+ 'dynamic-partial': [
1883
+ (r'\s+', Text),
1884
+ (r'\)', Punctuation, '#pop'),
1885
+
1886
+ (r'(lookup)(\s+)(\.|this)(\s+)', bygroups(Keyword, Text,
1887
+ Name.Variable, Text)),
1888
+ (r'(lookup)(\s+)(\S+)', bygroups(Keyword, Text,
1889
+ using(this, state='variable'))),
1890
+ (r'[\w-]+', Name.Function),
1891
+
1892
+ include('generic'),
1893
+ ],
1894
+ 'variable': [
1895
+ (r'[()/@a-zA-Z][\w-]*', Name.Variable),
1896
+ (r'\.[\w-]+', Name.Variable),
1897
+ (r'(this\/|\.\/|(\.\.\/)+)[\w-]+', Name.Variable),
1898
+ ],
1899
+ 'generic': [
1900
+ include('variable'),
1901
+
1902
+ # borrowed from DjangoLexer
1903
+ (r':?"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
1904
+ (r":?'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
1905
+ (r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
1906
+ r"0[xX][0-9a-fA-F]+[Ll]?", Number),
1907
+ ]
1908
+ }
1909
+
1910
+
1911
+ class HandlebarsHtmlLexer(DelegatingLexer):
1912
+ """
1913
+ Subclass of the `HandlebarsLexer` that highlights unlexed data with the
1914
+ `HtmlLexer`.
1915
+ """
1916
+
1917
+ name = "HTML+Handlebars"
1918
+ aliases = ["html+handlebars"]
1919
+ filenames = ['*.handlebars', '*.hbs']
1920
+ mimetypes = ['text/html+handlebars', 'text/x-handlebars-template']
1921
+ url = 'https://handlebarsjs.com/'
1922
+ version_added = '2.0'
1923
+
1924
+ def __init__(self, **options):
1925
+ super().__init__(HtmlLexer, HandlebarsLexer, **options)
1926
+
1927
+
1928
+ class YamlJinjaLexer(DelegatingLexer):
1929
+ """
1930
+ Subclass of the `DjangoLexer` that highlights unlexed data with the
1931
+ `YamlLexer`.
1932
+
1933
+ Commonly used in Saltstack salt states.
1934
+ """
1935
+
1936
+ name = 'YAML+Jinja'
1937
+ aliases = ['yaml+jinja', 'salt', 'sls']
1938
+ filenames = ['*.sls', '*.yaml.j2', '*.yml.j2', '*.yaml.jinja2', '*.yml.jinja2']
1939
+ mimetypes = ['text/x-yaml+jinja', 'text/x-sls']
1940
+ url = 'https://jinja.palletsprojects.com'
1941
+ version_added = '2.0'
1942
+
1943
+ def __init__(self, **options):
1944
+ super().__init__(YamlLexer, DjangoLexer, **options)
1945
+
1946
+
1947
+ class LiquidLexer(RegexLexer):
1948
+ """
1949
+ Lexer for Liquid templates.
1950
+ """
1951
+ name = 'liquid'
1952
+ url = 'https://www.rubydoc.info/github/Shopify/liquid'
1953
+ aliases = ['liquid']
1954
+ filenames = ['*.liquid']
1955
+ version_added = '2.0'
1956
+
1957
+ tokens = {
1958
+ 'root': [
1959
+ (r'[^{]+', Text),
1960
+ # tags and block tags
1961
+ (r'(\{%)(\s*)', bygroups(Punctuation, Whitespace), 'tag-or-block'),
1962
+ # output tags
1963
+ (r'(\{\{)(\s*)([^\s}]+)',
1964
+ bygroups(Punctuation, Whitespace, using(this, state = 'generic')),
1965
+ 'output'),
1966
+ (r'\{', Text)
1967
+ ],
1968
+
1969
+ 'tag-or-block': [
1970
+ # builtin logic blocks
1971
+ (r'(if|unless|elsif|case)(?=\s+)', Keyword.Reserved, 'condition'),
1972
+ (r'(when)(\s+)', bygroups(Keyword.Reserved, Whitespace),
1973
+ combined('end-of-block', 'whitespace', 'generic')),
1974
+ (r'(else)(\s*)(%\})',
1975
+ bygroups(Keyword.Reserved, Whitespace, Punctuation), '#pop'),
1976
+
1977
+ # other builtin blocks
1978
+ (r'(capture)(\s+)([^\s%]+)(\s*)(%\})',
1979
+ bygroups(Name.Tag, Whitespace, using(this, state = 'variable'),
1980
+ Whitespace, Punctuation), '#pop'),
1981
+ (r'(comment)(\s*)(%\})',
1982
+ bygroups(Name.Tag, Whitespace, Punctuation), 'comment'),
1983
+ (r'(raw)(\s*)(%\})',
1984
+ bygroups(Name.Tag, Whitespace, Punctuation), 'raw'),
1985
+
1986
+ # end of block
1987
+ (r'(end(case|unless|if))(\s*)(%\})',
1988
+ bygroups(Keyword.Reserved, None, Whitespace, Punctuation), '#pop'),
1989
+ (r'(end([^\s%]+))(\s*)(%\})',
1990
+ bygroups(Name.Tag, None, Whitespace, Punctuation), '#pop'),
1991
+
1992
+ # builtin tags (assign and include are handled together with usual tags)
1993
+ (r'(cycle)(\s+)(?:([^\s:]*)(:))?(\s*)',
1994
+ bygroups(Name.Tag, Whitespace,
1995
+ using(this, state='generic'), Punctuation, Whitespace),
1996
+ 'variable-tag-markup'),
1997
+
1998
+ # other tags or blocks
1999
+ (r'([^\s%]+)(\s*)', bygroups(Name.Tag, Whitespace), 'tag-markup')
2000
+ ],
2001
+
2002
+ 'output': [
2003
+ include('whitespace'),
2004
+ (r'\}\}', Punctuation, '#pop'), # end of output
2005
+
2006
+ (r'\|', Punctuation, 'filters')
2007
+ ],
2008
+
2009
+ 'filters': [
2010
+ include('whitespace'),
2011
+ (r'\}\}', Punctuation, ('#pop', '#pop')), # end of filters and output
2012
+
2013
+ (r'([^\s|:]+)(:?)(\s*)',
2014
+ bygroups(Name.Function, Punctuation, Whitespace), 'filter-markup')
2015
+ ],
2016
+
2017
+ 'filter-markup': [
2018
+ (r'\|', Punctuation, '#pop'),
2019
+ include('end-of-tag'),
2020
+ include('default-param-markup')
2021
+ ],
2022
+
2023
+ 'condition': [
2024
+ include('end-of-block'),
2025
+ include('whitespace'),
2026
+
2027
+ (r'([^\s=!><]+)(\s*)([=!><]=?)(\s*)(\S+)(\s*)(%\})',
2028
+ bygroups(using(this, state = 'generic'), Whitespace, Operator,
2029
+ Whitespace, using(this, state = 'generic'), Whitespace,
2030
+ Punctuation)),
2031
+ (r'\b!', Operator),
2032
+ (r'\bnot\b', Operator.Word),
2033
+ (r'([\w.\'"]+)(\s+)(contains)(\s+)([\w.\'"]+)',
2034
+ bygroups(using(this, state = 'generic'), Whitespace, Operator.Word,
2035
+ Whitespace, using(this, state = 'generic'))),
2036
+
2037
+ include('generic'),
2038
+ include('whitespace')
2039
+ ],
2040
+
2041
+ 'generic-value': [
2042
+ include('generic'),
2043
+ include('end-at-whitespace')
2044
+ ],
2045
+
2046
+ 'operator': [
2047
+ (r'(\s*)((=|!|>|<)=?)(\s*)',
2048
+ bygroups(Whitespace, Operator, None, Whitespace), '#pop'),
2049
+ (r'(\s*)(\bcontains\b)(\s*)',
2050
+ bygroups(Whitespace, Operator.Word, Whitespace), '#pop'),
2051
+ ],
2052
+
2053
+ 'end-of-tag': [
2054
+ (r'\}\}', Punctuation, '#pop')
2055
+ ],
2056
+
2057
+ 'end-of-block': [
2058
+ (r'%\}', Punctuation, ('#pop', '#pop'))
2059
+ ],
2060
+
2061
+ 'end-at-whitespace': [
2062
+ (r'\s+', Whitespace, '#pop')
2063
+ ],
2064
+
2065
+ # states for unknown markup
2066
+ 'param-markup': [
2067
+ include('whitespace'),
2068
+ # params with colons or equals
2069
+ (r'([^\s=:]+)(\s*)(=|:)',
2070
+ bygroups(Name.Attribute, Whitespace, Operator)),
2071
+ # explicit variables
2072
+ (r'(\{\{)(\s*)([^\s}])(\s*)(\}\})',
2073
+ bygroups(Punctuation, Whitespace, using(this, state = 'variable'),
2074
+ Whitespace, Punctuation)),
2075
+
2076
+ include('string'),
2077
+ include('number'),
2078
+ include('keyword'),
2079
+ (r',', Punctuation)
2080
+ ],
2081
+
2082
+ 'default-param-markup': [
2083
+ include('param-markup'),
2084
+ (r'.', Text) # fallback for switches / variables / un-quoted strings / ...
2085
+ ],
2086
+
2087
+ 'variable-param-markup': [
2088
+ include('param-markup'),
2089
+ include('variable'),
2090
+ (r'.', Text) # fallback
2091
+ ],
2092
+
2093
+ 'tag-markup': [
2094
+ (r'%\}', Punctuation, ('#pop', '#pop')), # end of tag
2095
+ include('default-param-markup')
2096
+ ],
2097
+
2098
+ 'variable-tag-markup': [
2099
+ (r'%\}', Punctuation, ('#pop', '#pop')), # end of tag
2100
+ include('variable-param-markup')
2101
+ ],
2102
+
2103
+ # states for different values types
2104
+ 'keyword': [
2105
+ (r'\b(false|true)\b', Keyword.Constant)
2106
+ ],
2107
+
2108
+ 'variable': [
2109
+ (r'[a-zA-Z_]\w*', Name.Variable),
2110
+ (r'(?<=\w)\.(?=\w)', Punctuation)
2111
+ ],
2112
+
2113
+ 'string': [
2114
+ (r"'[^']*'", String.Single),
2115
+ (r'"[^"]*"', String.Double)
2116
+ ],
2117
+
2118
+ 'number': [
2119
+ (r'\d+\.\d+', Number.Float),
2120
+ (r'\d+', Number.Integer)
2121
+ ],
2122
+
2123
+ 'generic': [ # decides for variable, string, keyword or number
2124
+ include('keyword'),
2125
+ include('string'),
2126
+ include('number'),
2127
+ include('variable')
2128
+ ],
2129
+
2130
+ 'whitespace': [
2131
+ (r'[ \t]+', Whitespace)
2132
+ ],
2133
+
2134
+ # states for builtin blocks
2135
+ 'comment': [
2136
+ (r'(\{%)(\s*)(endcomment)(\s*)(%\})',
2137
+ bygroups(Punctuation, Whitespace, Name.Tag, Whitespace,
2138
+ Punctuation), ('#pop', '#pop')),
2139
+ (r'.', Comment)
2140
+ ],
2141
+
2142
+ 'raw': [
2143
+ (r'[^{]+', Text),
2144
+ (r'(\{%)(\s*)(endraw)(\s*)(%\})',
2145
+ bygroups(Punctuation, Whitespace, Name.Tag, Whitespace,
2146
+ Punctuation), '#pop'),
2147
+ (r'\{', Text)
2148
+ ],
2149
+ }
2150
+
2151
+
2152
+ class TwigLexer(RegexLexer):
2153
+ """
2154
+ Twig template lexer.
2155
+
2156
+ It just highlights Twig code between the preprocessor directives,
2157
+ other data is left untouched by the lexer.
2158
+ """
2159
+
2160
+ name = 'Twig'
2161
+ aliases = ['twig']
2162
+ mimetypes = ['application/x-twig']
2163
+ url = 'https://twig.symfony.com'
2164
+ version_added = '2.0'
2165
+
2166
+ flags = re.M | re.S
2167
+
2168
+ # Note that a backslash is included in the following two patterns
2169
+ # PHP uses a backslash as a namespace separator
2170
+ _ident_char = r'[\\\w-]|[^\x00-\x7f]'
2171
+ _ident_begin = r'(?:[\\_a-z]|[^\x00-\x7f])'
2172
+ _ident_end = r'(?:' + _ident_char + ')*'
2173
+ _ident_inner = _ident_begin + _ident_end
2174
+
2175
+ tokens = {
2176
+ 'root': [
2177
+ (r'[^{]+', Other),
2178
+ (r'\{\{', Comment.Preproc, 'var'),
2179
+ # twig comments
2180
+ (r'\{\#.*?\#\}', Comment),
2181
+ # raw twig blocks
2182
+ (r'(\{%)(-?\s*)(raw)(\s*-?)(%\})(.*?)'
2183
+ r'(\{%)(-?\s*)(endraw)(\s*-?)(%\})',
2184
+ bygroups(Comment.Preproc, Text, Keyword, Text, Comment.Preproc,
2185
+ Other, Comment.Preproc, Text, Keyword, Text,
2186
+ Comment.Preproc)),
2187
+ (r'(\{%)(-?\s*)(verbatim)(\s*-?)(%\})(.*?)'
2188
+ r'(\{%)(-?\s*)(endverbatim)(\s*-?)(%\})',
2189
+ bygroups(Comment.Preproc, Text, Keyword, Text, Comment.Preproc,
2190
+ Other, Comment.Preproc, Text, Keyword, Text,
2191
+ Comment.Preproc)),
2192
+ # filter blocks
2193
+ (rf'(\{{%)(-?\s*)(filter)(\s+)({_ident_inner})',
2194
+ bygroups(Comment.Preproc, Text, Keyword, Text, Name.Function),
2195
+ 'tag'),
2196
+ (r'(\{%)(-?\s*)([a-zA-Z_]\w*)',
2197
+ bygroups(Comment.Preproc, Text, Keyword), 'tag'),
2198
+ (r'\{', Other),
2199
+ ],
2200
+ 'varnames': [
2201
+ (rf'(\|)(\s*)({_ident_inner})',
2202
+ bygroups(Operator, Text, Name.Function)),
2203
+ (rf'(is)(\s+)(not)?(\s*)({_ident_inner})',
2204
+ bygroups(Keyword, Text, Keyword, Text, Name.Function)),
2205
+ (r'(?i)(true|false|none|null)\b', Keyword.Pseudo),
2206
+ (r'(in|not|and|b-and|or|b-or|b-xor|is'
2207
+ r'if|elseif|else|import'
2208
+ r'constant|defined|divisibleby|empty|even|iterable|odd|sameas'
2209
+ r'matches|starts\s+with|ends\s+with)\b',
2210
+ Keyword),
2211
+ (r'(loop|block|parent)\b', Name.Builtin),
2212
+ (_ident_inner, Name.Variable),
2213
+ (r'\.' + _ident_inner, Name.Variable),
2214
+ (r'\.[0-9]+', Number),
2215
+ (r':?"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
2216
+ (r":?'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
2217
+ (r'([{}()\[\]+\-*/,:~%]|\.\.|\?|:|\*\*|\/\/|!=|[><=]=?)', Operator),
2218
+ (r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
2219
+ r"0[xX][0-9a-fA-F]+[Ll]?", Number),
2220
+ ],
2221
+ 'var': [
2222
+ (r'\s+', Text),
2223
+ (r'(-?)(\}\})', bygroups(Text, Comment.Preproc), '#pop'),
2224
+ include('varnames')
2225
+ ],
2226
+ 'tag': [
2227
+ (r'\s+', Text),
2228
+ (r'(-?)(%\})', bygroups(Text, Comment.Preproc), '#pop'),
2229
+ include('varnames'),
2230
+ (r'.', Punctuation),
2231
+ ],
2232
+ }
2233
+
2234
+
2235
+ class TwigHtmlLexer(DelegatingLexer):
2236
+ """
2237
+ Subclass of the `TwigLexer` that highlights unlexed data with the
2238
+ `HtmlLexer`.
2239
+ """
2240
+
2241
+ name = "HTML+Twig"
2242
+ aliases = ["html+twig"]
2243
+ filenames = ['*.twig']
2244
+ mimetypes = ['text/html+twig']
2245
+ url = 'https://twig.symfony.com'
2246
+ version_added = '2.0'
2247
+
2248
+ def __init__(self, **options):
2249
+ super().__init__(HtmlLexer, TwigLexer, **options)
2250
+
2251
+
2252
+ class Angular2Lexer(RegexLexer):
2253
+ """
2254
+ Generic angular2 template lexer.
2255
+
2256
+ Highlights only the Angular template tags (stuff between `{{` and `}}` and
2257
+ special attributes: '(event)=', '[property]=', '[(twoWayBinding)]=').
2258
+ Everything else is left for a delegating lexer.
2259
+ """
2260
+
2261
+ name = "Angular2"
2262
+ url = 'https://angular.io/guide/template-syntax'
2263
+ aliases = ['ng2']
2264
+ version_added = '2.1'
2265
+
2266
+ tokens = {
2267
+ 'root': [
2268
+ (r'[^{([*#]+', Other),
2269
+
2270
+ # {{meal.name}}
2271
+ (r'(\{\{)(\s*)', bygroups(Comment.Preproc, Text), 'ngExpression'),
2272
+
2273
+ # (click)="deleteOrder()"; [value]="test"; [(twoWayTest)]="foo.bar"
2274
+ (r'([([]+)([\w:.-]+)([\])]+)(\s*)(=)(\s*)',
2275
+ bygroups(Punctuation, Name.Attribute, Punctuation, Text, Operator, Text),
2276
+ 'attr'),
2277
+ (r'([([]+)([\w:.-]+)([\])]+)(\s*)',
2278
+ bygroups(Punctuation, Name.Attribute, Punctuation, Text)),
2279
+
2280
+ # *ngIf="..."; #f="ngForm"
2281
+ (r'([*#])([\w:.-]+)(\s*)(=)(\s*)',
2282
+ bygroups(Punctuation, Name.Attribute, Text, Operator, Text), 'attr'),
2283
+ (r'([*#])([\w:.-]+)(\s*)',
2284
+ bygroups(Punctuation, Name.Attribute, Text)),
2285
+ ],
2286
+
2287
+ 'ngExpression': [
2288
+ (r'\s+(\|\s+)?', Text),
2289
+ (r'\}\}', Comment.Preproc, '#pop'),
2290
+
2291
+ # Literals
2292
+ (r':?(true|false)', String.Boolean),
2293
+ (r':?"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
2294
+ (r":?'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
2295
+ (r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
2296
+ r"0[xX][0-9a-fA-F]+[Ll]?", Number),
2297
+
2298
+ # Variabletext
2299
+ (r'[a-zA-Z][\w-]*(\(.*\))?', Name.Variable),
2300
+ (r'\.[\w-]+(\(.*\))?', Name.Variable),
2301
+
2302
+ # inline If
2303
+ (r'(\?)(\s*)([^}\s]+)(\s*)(:)(\s*)([^}\s]+)(\s*)',
2304
+ bygroups(Operator, Text, String, Text, Operator, Text, String, Text)),
2305
+ ],
2306
+ 'attr': [
2307
+ ('".*?"', String, '#pop'),
2308
+ ("'.*?'", String, '#pop'),
2309
+ (r'[^\s>]+', String, '#pop'),
2310
+ ],
2311
+ }
2312
+
2313
+
2314
+ class Angular2HtmlLexer(DelegatingLexer):
2315
+ """
2316
+ Subclass of the `Angular2Lexer` that highlights unlexed data with the
2317
+ `HtmlLexer`.
2318
+ """
2319
+
2320
+ name = "HTML + Angular2"
2321
+ aliases = ["html+ng2"]
2322
+ filenames = ['*.ng2']
2323
+ url = 'https://angular.io/guide/template-syntax'
2324
+ version_added = '2.0'
2325
+
2326
+ def __init__(self, **options):
2327
+ super().__init__(HtmlLexer, Angular2Lexer, **options)
2328
+
2329
+
2330
+ class SqlJinjaLexer(DelegatingLexer):
2331
+ """
2332
+ Templated SQL lexer.
2333
+ """
2334
+
2335
+ name = 'SQL+Jinja'
2336
+ aliases = ['sql+jinja']
2337
+ filenames = ['*.sql', '*.sql.j2', '*.sql.jinja2']
2338
+ url = 'https://jinja.palletsprojects.com'
2339
+ version_added = '2.13'
2340
+
2341
+ def __init__(self, **options):
2342
+ super().__init__(SqlLexer, DjangoLexer, **options)
2343
+
2344
+ def analyse_text(text):
2345
+ rv = 0.0
2346
+ # dbt's ref function
2347
+ if re.search(r'\{\{\s*ref\(.*\)\s*\}\}', text):
2348
+ rv += 0.4
2349
+ # dbt's source function
2350
+ if re.search(r'\{\{\s*source\(.*\)\s*\}\}', text):
2351
+ rv += 0.25
2352
+ # Jinja macro
2353
+ if re.search(r'\{%-?\s*macro \w+\(.*\)\s*-?%\}', text):
2354
+ rv += 0.15
2355
+ return rv
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/teraterm.py ADDED
@@ -0,0 +1,335 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.teraterm
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexer for Tera Term macro files.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexer import RegexLexer, include, bygroups
14
+ from pygments.token import Text, Comment, Operator, Name, String, \
15
+ Number, Keyword, Error
16
+
17
+ __all__ = ['TeraTermLexer']
18
+
19
+
20
+ class TeraTermLexer(RegexLexer):
21
+ """
22
+ For Tera Term macro source code.
23
+ """
24
+ name = 'Tera Term macro'
25
+ url = 'https://ttssh2.osdn.jp/'
26
+ aliases = ['teratermmacro', 'teraterm', 'ttl']
27
+ filenames = ['*.ttl']
28
+ mimetypes = ['text/x-teratermmacro']
29
+ version_added = '2.4'
30
+
31
+ tokens = {
32
+ 'root': [
33
+ include('comments'),
34
+ include('labels'),
35
+ include('commands'),
36
+ include('builtin-variables'),
37
+ include('user-variables'),
38
+ include('operators'),
39
+ include('numeric-literals'),
40
+ include('string-literals'),
41
+ include('all-whitespace'),
42
+ (r'\S', Text),
43
+ ],
44
+ 'comments': [
45
+ (r';[^\r\n]*', Comment.Single),
46
+ (r'/\*', Comment.Multiline, 'in-comment'),
47
+ ],
48
+ 'in-comment': [
49
+ (r'\*/', Comment.Multiline, '#pop'),
50
+ (r'[^*/]+', Comment.Multiline),
51
+ (r'[*/]', Comment.Multiline)
52
+ ],
53
+ 'labels': [
54
+ (r'(?i)^(\s*)(:[a-z0-9_]+)', bygroups(Text.Whitespace, Name.Label)),
55
+ ],
56
+ 'commands': [
57
+ (
58
+ r'(?i)\b('
59
+ r'basename|'
60
+ r'beep|'
61
+ r'bplusrecv|'
62
+ r'bplussend|'
63
+ r'break|'
64
+ r'bringupbox|'
65
+ # 'call' is handled separately.
66
+ r'callmenu|'
67
+ r'changedir|'
68
+ r'checksum16|'
69
+ r'checksum16file|'
70
+ r'checksum32|'
71
+ r'checksum32file|'
72
+ r'checksum8|'
73
+ r'checksum8file|'
74
+ r'clearscreen|'
75
+ r'clipb2var|'
76
+ r'closesbox|'
77
+ r'closett|'
78
+ r'code2str|'
79
+ r'connect|'
80
+ r'continue|'
81
+ r'crc16|'
82
+ r'crc16file|'
83
+ r'crc32|'
84
+ r'crc32file|'
85
+ r'cygconnect|'
86
+ r'delpassword|'
87
+ r'delpassword2|'
88
+ r'dirname|'
89
+ r'dirnamebox|'
90
+ r'disconnect|'
91
+ r'dispstr|'
92
+ r'do|'
93
+ r'else|'
94
+ r'elseif|'
95
+ r'enablekeyb|'
96
+ r'end|'
97
+ r'endif|'
98
+ r'enduntil|'
99
+ r'endwhile|'
100
+ r'exec|'
101
+ r'execcmnd|'
102
+ r'exit|'
103
+ r'expandenv|'
104
+ r'fileclose|'
105
+ r'fileconcat|'
106
+ r'filecopy|'
107
+ r'filecreate|'
108
+ r'filedelete|'
109
+ r'filelock|'
110
+ r'filemarkptr|'
111
+ r'filenamebox|'
112
+ r'fileopen|'
113
+ r'fileread|'
114
+ r'filereadln|'
115
+ r'filerename|'
116
+ r'filesearch|'
117
+ r'fileseek|'
118
+ r'fileseekback|'
119
+ r'filestat|'
120
+ r'filestrseek|'
121
+ r'filestrseek2|'
122
+ r'filetruncate|'
123
+ r'fileunlock|'
124
+ r'filewrite|'
125
+ r'filewriteln|'
126
+ r'findclose|'
127
+ r'findfirst|'
128
+ r'findnext|'
129
+ r'flushrecv|'
130
+ r'foldercreate|'
131
+ r'folderdelete|'
132
+ r'foldersearch|'
133
+ r'for|'
134
+ r'getdate|'
135
+ r'getdir|'
136
+ r'getenv|'
137
+ r'getfileattr|'
138
+ r'gethostname|'
139
+ r'getipv4addr|'
140
+ r'getipv6addr|'
141
+ r'getmodemstatus|'
142
+ r'getpassword|'
143
+ r'getpassword2|'
144
+ r'getspecialfolder|'
145
+ r'gettime|'
146
+ r'gettitle|'
147
+ r'getttdir|'
148
+ r'getttpos|'
149
+ r'getver|'
150
+ # 'goto' is handled separately.
151
+ r'if|'
152
+ r'ifdefined|'
153
+ r'include|'
154
+ r'inputbox|'
155
+ r'int2str|'
156
+ r'intdim|'
157
+ r'ispassword|'
158
+ r'ispassword2|'
159
+ r'kmtfinish|'
160
+ r'kmtget|'
161
+ r'kmtrecv|'
162
+ r'kmtsend|'
163
+ r'listbox|'
164
+ r'loadkeymap|'
165
+ r'logautoclosemode|'
166
+ r'logclose|'
167
+ r'loginfo|'
168
+ r'logopen|'
169
+ r'logpause|'
170
+ r'logrotate|'
171
+ r'logstart|'
172
+ r'logwrite|'
173
+ r'loop|'
174
+ r'makepath|'
175
+ r'messagebox|'
176
+ r'mpause|'
177
+ r'next|'
178
+ r'passwordbox|'
179
+ r'pause|'
180
+ r'quickvanrecv|'
181
+ r'quickvansend|'
182
+ r'random|'
183
+ r'recvfile'
184
+ r'recvln|'
185
+ r'regexoption|'
186
+ r'restoresetup|'
187
+ r'return|'
188
+ r'rotateleft|'
189
+ r'rotateright|'
190
+ r'scprecv|'
191
+ r'scpsend|'
192
+ r'send|'
193
+ r'sendbinary|'
194
+ r'sendbreak|'
195
+ r'sendbroadcast|'
196
+ r'sendfile|'
197
+ r'sendkcode|'
198
+ r'sendln|'
199
+ r'sendlnbroadcast|'
200
+ r'sendlnmulticast|'
201
+ r'sendmulticast|'
202
+ r'sendtext|'
203
+ r'setbaud|'
204
+ r'setdate|'
205
+ r'setdebug|'
206
+ r'setdir|'
207
+ r'setdlgpos|'
208
+ r'setdtr|'
209
+ r'setecho|'
210
+ r'setenv|'
211
+ r'setexitcode|'
212
+ r'setfileattr|'
213
+ r'setflowctrl|'
214
+ r'setmulticastname|'
215
+ r'setpassword|'
216
+ r'setpassword2|'
217
+ r'setrts|'
218
+ r'setserialdelaychar'
219
+ r'setserialdelayline'
220
+ r'setspeed|'
221
+ r'setsync|'
222
+ r'settime|'
223
+ r'settitle|'
224
+ r'show|'
225
+ r'showtt|'
226
+ r'sprintf|'
227
+ r'sprintf2|'
228
+ r'statusbox|'
229
+ r'str2code|'
230
+ r'str2int|'
231
+ r'strcompare|'
232
+ r'strconcat|'
233
+ r'strcopy|'
234
+ r'strdim|'
235
+ r'strinsert|'
236
+ r'strjoin|'
237
+ r'strlen|'
238
+ r'strmatch|'
239
+ r'strremove|'
240
+ r'strreplace|'
241
+ r'strscan|'
242
+ r'strspecial|'
243
+ r'strsplit|'
244
+ r'strtrim|'
245
+ r'testlink|'
246
+ r'then|'
247
+ r'tolower|'
248
+ r'toupper|'
249
+ r'unlink|'
250
+ r'until|'
251
+ r'uptime|'
252
+ r'var2clipb|'
253
+ r'wait|'
254
+ r'wait4all|'
255
+ r'waitevent|'
256
+ r'waitln|'
257
+ r'waitn|'
258
+ r'waitrecv|'
259
+ r'waitregex|'
260
+ r'while|'
261
+ r'xmodemrecv|'
262
+ r'xmodemsend|'
263
+ r'yesnobox|'
264
+ r'ymodemrecv|'
265
+ r'ymodemsend|'
266
+ r'zmodemrecv|'
267
+ r'zmodemsend'
268
+ r')\b',
269
+ Keyword,
270
+ ),
271
+ (r'(?i)(call|goto)([ \t]+)([a-z0-9_]+)',
272
+ bygroups(Keyword, Text.Whitespace, Name.Label)),
273
+ ],
274
+ 'builtin-variables': [
275
+ (
276
+ r'(?i)('
277
+ r'groupmatchstr1|'
278
+ r'groupmatchstr2|'
279
+ r'groupmatchstr3|'
280
+ r'groupmatchstr4|'
281
+ r'groupmatchstr5|'
282
+ r'groupmatchstr6|'
283
+ r'groupmatchstr7|'
284
+ r'groupmatchstr8|'
285
+ r'groupmatchstr9|'
286
+ r'inputstr|'
287
+ r'matchstr|'
288
+ r'mtimeout|'
289
+ r'param1|'
290
+ r'param2|'
291
+ r'param3|'
292
+ r'param4|'
293
+ r'param5|'
294
+ r'param6|'
295
+ r'param7|'
296
+ r'param8|'
297
+ r'param9|'
298
+ r'paramcnt|'
299
+ r'params|'
300
+ r'result|'
301
+ r'timeout'
302
+ r')\b',
303
+ Name.Builtin
304
+ ),
305
+ ],
306
+ 'user-variables': [
307
+ (r'(?i)[a-z_][a-z0-9_]*', Name.Variable),
308
+ ],
309
+ 'numeric-literals': [
310
+ (r'(-?)([0-9]+)', bygroups(Operator, Number.Integer)),
311
+ (r'(?i)\$[0-9a-f]+', Number.Hex),
312
+ ],
313
+ 'string-literals': [
314
+ (r'(?i)#(?:[0-9]+|\$[0-9a-f]+)', String.Char),
315
+ (r"'[^'\n]*'", String.Single),
316
+ (r'"[^"\n]*"', String.Double),
317
+ # Opening quotes without a closing quote on the same line are errors.
318
+ (r"('[^']*)(\n)", bygroups(Error, Text.Whitespace)),
319
+ (r'("[^"]*)(\n)', bygroups(Error, Text.Whitespace)),
320
+ ],
321
+ 'operators': [
322
+ (r'and|not|or|xor', Operator.Word),
323
+ (r'[!%&*+<=>^~\|\/-]+', Operator),
324
+ (r'[()]', String.Symbol),
325
+ ],
326
+ 'all-whitespace': [
327
+ (r'\s+', Text.Whitespace),
328
+ ],
329
+ }
330
+
331
+ # Turtle and Tera Term macro files share the same file extension
332
+ # but each has a recognizable and distinct syntax.
333
+ def analyse_text(text):
334
+ if re.search(TeraTermLexer.tokens['commands'][0][0], text):
335
+ return 0.01
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/testing.py ADDED
@@ -0,0 +1,209 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.testing
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for testing languages.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, include, bygroups
12
+ from pygments.token import Comment, Keyword, Name, String, Number, Generic, Text
13
+
14
+ __all__ = ['GherkinLexer', 'TAPLexer']
15
+
16
+
17
+ class GherkinLexer(RegexLexer):
18
+ """
19
+ For Gherkin syntax.
20
+ """
21
+ name = 'Gherkin'
22
+ aliases = ['gherkin', 'cucumber']
23
+ filenames = ['*.feature']
24
+ mimetypes = ['text/x-gherkin']
25
+ url = 'https://cucumber.io/docs/gherkin'
26
+ version_added = '1.2'
27
+
28
+ feature_keywords = '^(기능|機能|功能|フィーチャ|خاصية|תכונה|Функціонал|Функционалност|Функционал|Фича|Особина|Могућност|Özellik|Właściwość|Tính năng|Trajto|Savybė|Požiadavka|Požadavek|Osobina|Ominaisuus|Omadus|OH HAI|Mogućnost|Mogucnost|Jellemző|Fīča|Funzionalità|Funktionalität|Funkcionalnost|Funkcionalitāte|Funcționalitate|Functionaliteit|Functionalitate|Funcionalitat|Funcionalidade|Fonctionnalité|Fitur|Feature|Egenskap|Egenskab|Crikey|Característica|Arwedd)(:)(.*)$'
29
+ feature_element_keywords = '^(\\s*)(시나리오 개요|시나리오|배경|背景|場景大綱|場景|场景大纲|场景|劇本大綱|劇本|剧本大纲|剧本|テンプレ|シナリオテンプレート|シナリオテンプレ|シナリオアウトライン|シナリオ|سيناريو مخطط|سيناريو|الخلفية|תרחיש|תבנית תרחיש|רקע|Тарих|Сценарій|Сценарио|Сценарий структураси|Сценарий|Структура сценарію|Структура сценарија|Структура сценария|Скица|Рамка на сценарий|Пример|Предыстория|Предистория|Позадина|Передумова|Основа|Концепт|Контекст|Założenia|Wharrimean is|Tình huống|The thing of it is|Tausta|Taust|Tapausaihio|Tapaus|Szenariogrundriss|Szenario|Szablon scenariusza|Stsenaarium|Struktura scenarija|Skica|Skenario konsep|Skenario|Situācija|Senaryo taslağı|Senaryo|Scénář|Scénario|Schema dello scenario|Scenārijs pēc parauga|Scenārijs|Scenár|Scenaro|Scenariusz|Scenariul de şablon|Scenariul de sablon|Scenariu|Scenario Outline|Scenario Amlinellol|Scenario|Scenarijus|Scenarijaus šablonas|Scenarij|Scenarie|Rerefons|Raamstsenaarium|Primer|Pozadí|Pozadina|Pozadie|Plan du scénario|Plan du Scénario|Osnova scénáře|Osnova|Náčrt Scénáře|Náčrt Scenáru|Mate|MISHUN SRSLY|MISHUN|Kịch bản|Konturo de la scenaro|Kontext|Konteksts|Kontekstas|Kontekst|Koncept|Khung tình huống|Khung kịch bản|Háttér|Grundlage|Geçmiş|Forgatókönyv vázlat|Forgatókönyv|Fono|Esquema do Cenário|Esquema do Cenario|Esquema del escenario|Esquema de l\'escenari|Escenario|Escenari|Dis is what went down|Dasar|Contexto|Contexte|Contesto|Condiţii|Conditii|Cenário|Cenario|Cefndir|Bối cảnh|Blokes|Bakgrunn|Bakgrund|Baggrund|Background|B4|Antecedents|Antecedentes|All y\'all|Achtergrond|Abstrakt Scenario|Abstract Scenario)(:)(.*)$'
30
+ examples_keywords = '^(\\s*)(예|例子|例|サンプル|امثلة|דוגמאות|Сценарији|Примери|Приклади|Мисоллар|Значения|Örnekler|Voorbeelden|Variantai|Tapaukset|Scenarios|Scenariji|Scenarijai|Příklady|Példák|Príklady|Przykłady|Primjeri|Primeri|Piemēri|Pavyzdžiai|Paraugs|Juhtumid|Exemplos|Exemples|Exemplele|Exempel|Examples|Esempi|Enghreifftiau|Ekzemploj|Eksempler|Ejemplos|EXAMPLZ|Dữ liệu|Contoh|Cobber|Beispiele)(:)(.*)$'
31
+ step_keywords = '^(\\s*)(하지만|조건|먼저|만일|만약|단|그리고|그러면|那麼|那么|而且|當|当|前提|假設|假设|假如|假定|但是|但し|並且|并且|同時|同时|もし|ならば|ただし|しかし|かつ|و |متى |لكن |عندما |ثم |بفرض |اذاً |כאשר |וגם |בהינתן |אזי |אז |אבל |Якщо |Унда |То |Припустимо, що |Припустимо |Онда |Но |Нехай |Лекин |Когато |Када |Кад |К тому же |И |Задато |Задати |Задате |Если |Допустим |Дадено |Ва |Бирок |Аммо |Али |Але |Агар |А |І |Și |És |Zatati |Zakładając |Zadato |Zadate |Zadano |Zadani |Zadan |Youse know when youse got |Youse know like when |Yna |Ya know how |Ya gotta |Y |Wun |Wtedy |When y\'all |When |Wenn |WEN |Và |Ve |Und |Un |Thì |Then y\'all |Then |Tapi |Tak |Tada |Tad |Så |Stel |Soit |Siis |Si |Sed |Se |Quando |Quand |Quan |Pryd |Pokud |Pokiaľ |Però |Pero |Pak |Oraz |Onda |Ond |Oletetaan |Og |Och |O zaman |Når |När |Niin |Nhưng |N |Mutta |Men |Mas |Maka |Majd |Mais |Maar |Ma |Lorsque |Lorsqu\'|Kun |Kuid |Kui |Khi |Keď |Ketika |Když |Kaj |Kai |Kada |Kad |Jeżeli |Ja |Ir |I CAN HAZ |I |Ha |Givun |Givet |Given y\'all |Given |Gitt |Gegeven |Gegeben sei |Fakat |Eğer ki |Etant donné |Et |Então |Entonces |Entao |En |Eeldades |E |Duota |Dun |Donitaĵo |Donat |Donada |Do |Diyelim ki |Dengan |Den youse gotta |De |Dato |Dar |Dann |Dan |Dado |Dacă |Daca |DEN |Când |Cuando |Cho |Cept |Cand |Cal |But y\'all |But |Buh |Biết |Bet |BUT |Atès |Atunci |Atesa |Anrhegedig a |Angenommen |And y\'all |And |An |Ama |Als |Alors |Allora |Ali |Aleshores |Ale |Akkor |Aber |AN |A také |A |\\* )'
32
+
33
+ tokens = {
34
+ 'comments': [
35
+ (r'^\s*#.*$', Comment),
36
+ ],
37
+ 'feature_elements': [
38
+ (step_keywords, Keyword, "step_content_stack"),
39
+ include('comments'),
40
+ (r"(\s|.)", Name.Function),
41
+ ],
42
+ 'feature_elements_on_stack': [
43
+ (step_keywords, Keyword, "#pop:2"),
44
+ include('comments'),
45
+ (r"(\s|.)", Name.Function),
46
+ ],
47
+ 'examples_table': [
48
+ (r"\s+\|", Keyword, 'examples_table_header'),
49
+ include('comments'),
50
+ (r"(\s|.)", Name.Function),
51
+ ],
52
+ 'examples_table_header': [
53
+ (r"\s+\|\s*$", Keyword, "#pop:2"),
54
+ include('comments'),
55
+ (r"\\\|", Name.Variable),
56
+ (r"\s*\|", Keyword),
57
+ (r"[^|]", Name.Variable),
58
+ ],
59
+ 'scenario_sections_on_stack': [
60
+ (feature_element_keywords,
61
+ bygroups(Name.Function, Keyword, Keyword, Name.Function),
62
+ "feature_elements_on_stack"),
63
+ ],
64
+ 'narrative': [
65
+ include('scenario_sections_on_stack'),
66
+ include('comments'),
67
+ (r"(\s|.)", Name.Function),
68
+ ],
69
+ 'table_vars': [
70
+ (r'(<[^>]+>)', Name.Variable),
71
+ ],
72
+ 'numbers': [
73
+ (r'(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', String),
74
+ ],
75
+ 'string': [
76
+ include('table_vars'),
77
+ (r'(\s|.)', String),
78
+ ],
79
+ 'py_string': [
80
+ (r'"""', Keyword, "#pop"),
81
+ include('string'),
82
+ ],
83
+ 'step_content_root': [
84
+ (r"$", Keyword, "#pop"),
85
+ include('step_content'),
86
+ ],
87
+ 'step_content_stack': [
88
+ (r"$", Keyword, "#pop:2"),
89
+ include('step_content'),
90
+ ],
91
+ 'step_content': [
92
+ (r'"', Name.Function, "double_string"),
93
+ include('table_vars'),
94
+ include('numbers'),
95
+ include('comments'),
96
+ (r'(\s|.)', Name.Function),
97
+ ],
98
+ 'table_content': [
99
+ (r"\s+\|\s*$", Keyword, "#pop"),
100
+ include('comments'),
101
+ (r"\\\|", String),
102
+ (r"\s*\|", Keyword),
103
+ include('string'),
104
+ ],
105
+ 'double_string': [
106
+ (r'"', Name.Function, "#pop"),
107
+ include('string'),
108
+ ],
109
+ 'root': [
110
+ (r'\n', Name.Function),
111
+ include('comments'),
112
+ (r'"""', Keyword, "py_string"),
113
+ (r'\s+\|', Keyword, 'table_content'),
114
+ (r'"', Name.Function, "double_string"),
115
+ include('table_vars'),
116
+ include('numbers'),
117
+ (r'(\s*)(@[^@\r\n\t ]+)', bygroups(Name.Function, Name.Tag)),
118
+ (step_keywords, bygroups(Name.Function, Keyword),
119
+ 'step_content_root'),
120
+ (feature_keywords, bygroups(Keyword, Keyword, Name.Function),
121
+ 'narrative'),
122
+ (feature_element_keywords,
123
+ bygroups(Name.Function, Keyword, Keyword, Name.Function),
124
+ 'feature_elements'),
125
+ (examples_keywords,
126
+ bygroups(Name.Function, Keyword, Keyword, Name.Function),
127
+ 'examples_table'),
128
+ (r'(\s|.)', Name.Function),
129
+ ]
130
+ }
131
+
132
+ def analyse_text(self, text):
133
+ return
134
+
135
+
136
+ class TAPLexer(RegexLexer):
137
+ """
138
+ For Test Anything Protocol (TAP) output.
139
+ """
140
+ name = 'TAP'
141
+ url = 'https://testanything.org/'
142
+ aliases = ['tap']
143
+ filenames = ['*.tap']
144
+ version_added = '2.1'
145
+
146
+ tokens = {
147
+ 'root': [
148
+ # A TAP version may be specified.
149
+ (r'^TAP version \d+\n', Name.Namespace),
150
+
151
+ # Specify a plan with a plan line.
152
+ (r'^1\.\.\d+', Keyword.Declaration, 'plan'),
153
+
154
+ # A test failure
155
+ (r'^(not ok)([^\S\n]*)(\d*)',
156
+ bygroups(Generic.Error, Text, Number.Integer), 'test'),
157
+
158
+ # A test success
159
+ (r'^(ok)([^\S\n]*)(\d*)',
160
+ bygroups(Keyword.Reserved, Text, Number.Integer), 'test'),
161
+
162
+ # Diagnostics start with a hash.
163
+ (r'^#.*\n', Comment),
164
+
165
+ # TAP's version of an abort statement.
166
+ (r'^Bail out!.*\n', Generic.Error),
167
+
168
+ # TAP ignores any unrecognized lines.
169
+ (r'^.*\n', Text),
170
+ ],
171
+ 'plan': [
172
+ # Consume whitespace (but not newline).
173
+ (r'[^\S\n]+', Text),
174
+
175
+ # A plan may have a directive with it.
176
+ (r'#', Comment, 'directive'),
177
+
178
+ # Or it could just end.
179
+ (r'\n', Comment, '#pop'),
180
+
181
+ # Anything else is wrong.
182
+ (r'.*\n', Generic.Error, '#pop'),
183
+ ],
184
+ 'test': [
185
+ # Consume whitespace (but not newline).
186
+ (r'[^\S\n]+', Text),
187
+
188
+ # A test may have a directive with it.
189
+ (r'#', Comment, 'directive'),
190
+
191
+ (r'\S+', Text),
192
+
193
+ (r'\n', Text, '#pop'),
194
+ ],
195
+ 'directive': [
196
+ # Consume whitespace (but not newline).
197
+ (r'[^\S\n]+', Comment),
198
+
199
+ # Extract todo items.
200
+ (r'(?i)\bTODO\b', Comment.Preproc),
201
+
202
+ # Extract skip items.
203
+ (r'(?i)\bSKIP\S*', Comment.Preproc),
204
+
205
+ (r'\S+', Comment),
206
+
207
+ (r'\n', Comment, '#pop:2'),
208
+ ],
209
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/text.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.text
3
+ ~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for non-source code file types.
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.configs import ApacheConfLexer, NginxConfLexer, \
13
+ SquidConfLexer, LighttpdConfLexer, IniLexer, RegeditLexer, PropertiesLexer, \
14
+ UnixConfigLexer
15
+ from pygments.lexers.console import PyPyLogLexer
16
+ from pygments.lexers.textedit import VimLexer
17
+ from pygments.lexers.markup import BBCodeLexer, MoinWikiLexer, RstLexer, \
18
+ TexLexer, GroffLexer
19
+ from pygments.lexers.installers import DebianControlLexer, DebianSourcesLexer, SourcesListLexer
20
+ from pygments.lexers.make import MakefileLexer, BaseMakefileLexer, CMakeLexer
21
+ from pygments.lexers.haxe import HxmlLexer
22
+ from pygments.lexers.sgf import SmartGameFormatLexer
23
+ from pygments.lexers.diff import DiffLexer, DarcsPatchLexer
24
+ from pygments.lexers.data import YamlLexer
25
+ from pygments.lexers.textfmts import IrcLogsLexer, GettextLexer, HttpLexer
26
+
27
+ __all__ = []
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/textedit.py ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.textedit
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for languages related to text processing.
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
+ from bisect import bisect
13
+
14
+ from pygments.lexer import RegexLexer, bygroups, default, include, this, using
15
+ from pygments.lexers.python import PythonLexer
16
+ from pygments.token import Comment, Keyword, Name, Number, Operator, \
17
+ Punctuation, String, Text, Whitespace
18
+
19
+ __all__ = ['AwkLexer', 'SedLexer', 'VimLexer']
20
+
21
+
22
+ class AwkLexer(RegexLexer):
23
+ """
24
+ For Awk scripts.
25
+ """
26
+
27
+ name = 'Awk'
28
+ aliases = ['awk', 'gawk', 'mawk', 'nawk']
29
+ filenames = ['*.awk']
30
+ mimetypes = ['application/x-awk']
31
+ url = 'https://en.wikipedia.org/wiki/AWK'
32
+ version_added = '1.5'
33
+
34
+ tokens = {
35
+ 'commentsandwhitespace': [
36
+ (r'\s+', Text),
37
+ (r'#.*$', Comment.Single)
38
+ ],
39
+ 'slashstartsregex': [
40
+ include('commentsandwhitespace'),
41
+ (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
42
+ r'\B', String.Regex, '#pop'),
43
+ (r'(?=/)', Text, ('#pop', 'badregex')),
44
+ default('#pop')
45
+ ],
46
+ 'badregex': [
47
+ (r'\n', Text, '#pop')
48
+ ],
49
+ 'root': [
50
+ (r'^(?=\s|/)', Text, 'slashstartsregex'),
51
+ include('commentsandwhitespace'),
52
+ (r'\+\+|--|\|\||&&|in\b|\$|!?~|\?|:|'
53
+ r'(\*\*|[-<>+*%\^/!=|])=?', Operator, 'slashstartsregex'),
54
+ (r'[{(\[;,]', Punctuation, 'slashstartsregex'),
55
+ (r'[})\].]', Punctuation),
56
+ (r'(break|continue|do|while|exit|for|if|else|'
57
+ r'return)\b', Keyword, 'slashstartsregex'),
58
+ (r'function\b', Keyword.Declaration, 'slashstartsregex'),
59
+ (r'(atan2|cos|exp|int|log|rand|sin|sqrt|srand|gensub|gsub|index|'
60
+ r'length|match|split|sprintf|sub|substr|tolower|toupper|close|'
61
+ r'fflush|getline|next|nextfile|print|printf|strftime|systime|'
62
+ r'delete|system)\b', Keyword.Reserved),
63
+ (r'(ARGC|ARGIND|ARGV|BEGIN|CONVFMT|ENVIRON|END|ERRNO|FIELDWIDTHS|'
64
+ r'FILENAME|FNR|FS|IGNORECASE|NF|NR|OFMT|OFS|ORFS|RLENGTH|RS|'
65
+ r'RSTART|RT|SUBSEP)\b', Name.Builtin),
66
+ (r'[$a-zA-Z_]\w*', Name.Other),
67
+ (r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
68
+ (r'0x[0-9a-fA-F]+', Number.Hex),
69
+ (r'[0-9]+', Number.Integer),
70
+ (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
71
+ (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
72
+ ]
73
+ }
74
+
75
+
76
+ class SedLexer(RegexLexer):
77
+ """
78
+ Lexer for Sed script files.
79
+ """
80
+ name = 'Sed'
81
+ aliases = ['sed', 'gsed', 'ssed']
82
+ filenames = ['*.sed', '*.[gs]sed']
83
+ mimetypes = ['text/x-sed']
84
+ url = 'https://en.wikipedia.org/wiki/Sed'
85
+ version_added = ''
86
+ flags = re.MULTILINE
87
+
88
+ # Match the contents within delimiters such as /<contents>/
89
+ _inside_delims = r'((?:(?:\\[^\n]|[^\\])*?\\\n)*?(?:\\.|[^\\])*?)'
90
+
91
+ tokens = {
92
+ 'root': [
93
+ (r'\s+', Whitespace),
94
+ (r'#.*$', Comment.Single),
95
+ (r'[0-9]+', Number.Integer),
96
+ (r'\$', Operator),
97
+ (r'[{};,!]', Punctuation),
98
+ (r'[dDFgGhHlnNpPqQxz=]', Keyword),
99
+ (r'([berRtTvwW:])([^;\n]*)', bygroups(Keyword, String.Single)),
100
+ (r'([aci])((?:.*?\\\n)*(?:.*?[^\\]$))', bygroups(Keyword, String.Double)),
101
+ (r'([qQ])([0-9]*)', bygroups(Keyword, Number.Integer)),
102
+ (r'(/)' + _inside_delims + r'(/)', bygroups(Punctuation, String.Regex, Punctuation)),
103
+ (r'(\\(.))' + _inside_delims + r'(\2)',
104
+ bygroups(Punctuation, None, String.Regex, Punctuation)),
105
+ (r'(y)(.)' + _inside_delims + r'(\2)' + _inside_delims + r'(\2)',
106
+ bygroups(Keyword, Punctuation, String.Single, Punctuation, String.Single, Punctuation)),
107
+ (r'(s)(.)' + _inside_delims + r'(\2)' + _inside_delims + r'(\2)((?:[gpeIiMm]|[0-9])*)',
108
+ bygroups(Keyword, Punctuation, String.Regex, Punctuation, String.Single, Punctuation,
109
+ Keyword))
110
+ ]
111
+ }
112
+
113
+ class VimLexer(RegexLexer):
114
+ """
115
+ Lexer for VimL script files.
116
+ """
117
+ name = 'VimL'
118
+ aliases = ['vim']
119
+ filenames = ['*.vim', '.vimrc', '.exrc', '.gvimrc',
120
+ '_vimrc', '_exrc', '_gvimrc', 'vimrc', 'gvimrc']
121
+ mimetypes = ['text/x-vim']
122
+ url = 'https://www.vim.org'
123
+ version_added = '0.8'
124
+
125
+ flags = re.MULTILINE
126
+
127
+ _python = r'py(?:t(?:h(?:o(?:n)?)?)?)?'
128
+
129
+ tokens = {
130
+ 'root': [
131
+ (r'^([ \t:]*)(' + _python + r')([ \t]*)(<<)([ \t]*)(.*)((?:\n|.)*)(\6)',
132
+ bygroups(using(this), Keyword, Text, Operator, Text, Text,
133
+ using(PythonLexer), Text)),
134
+ (r'^([ \t:]*)(' + _python + r')([ \t])(.*)',
135
+ bygroups(using(this), Keyword, Text, using(PythonLexer))),
136
+
137
+ (r'^\s*".*', Comment),
138
+
139
+ (r'[ \t]+', Text),
140
+ # TODO: regexes can have other delims
141
+ (r'/[^/\\\n]*(?:\\[\s\S][^/\\\n]*)*/', String.Regex),
142
+ (r'"[^"\\\n]*(?:\\[\s\S][^"\\\n]*)*"', String.Double),
143
+ (r"'[^\n']*(?:''[^\n']*)*'", String.Single),
144
+
145
+ # Who decided that doublequote was a good comment character??
146
+ (r'(?<=\s)"[^\-:.%#=*].*', Comment),
147
+ (r'-?\d+', Number),
148
+ (r'#[0-9a-f]{6}', Number.Hex),
149
+ (r'^:', Punctuation),
150
+ (r'[()<>+=!|,~-]', Punctuation), # Inexact list. Looks decent.
151
+ (r'\b(let|if|else|endif|elseif|fun|function|endfunction)\b',
152
+ Keyword),
153
+ (r'\b(NONE|bold|italic|underline|dark|light)\b', Name.Builtin),
154
+ (r'\b\w+\b', Name.Other), # These are postprocessed below
155
+ (r'.', Text),
156
+ ],
157
+ }
158
+
159
+ def __init__(self, **options):
160
+ from pygments.lexers._vim_builtins import auto, command, option
161
+ self._cmd = command
162
+ self._opt = option
163
+ self._aut = auto
164
+
165
+ RegexLexer.__init__(self, **options)
166
+
167
+ def is_in(self, w, mapping):
168
+ r"""
169
+ It's kind of difficult to decide if something might be a keyword
170
+ in VimL because it allows you to abbreviate them. In fact,
171
+ 'ab[breviate]' is a good example. :ab, :abbre, or :abbreviate are
172
+ valid ways to call it so rather than making really awful regexps
173
+ like::
174
+
175
+ \bab(?:b(?:r(?:e(?:v(?:i(?:a(?:t(?:e)?)?)?)?)?)?)?)?\b
176
+
177
+ we match `\b\w+\b` and then call is_in() on those tokens. See
178
+ `scripts/get_vimkw.py` for how the lists are extracted.
179
+ """
180
+ p = bisect(mapping, (w,))
181
+ if p > 0:
182
+ if mapping[p-1][0] == w[:len(mapping[p-1][0])] and \
183
+ mapping[p-1][1][:len(w)] == w:
184
+ return True
185
+ if p < len(mapping):
186
+ return mapping[p][0] == w[:len(mapping[p][0])] and \
187
+ mapping[p][1][:len(w)] == w
188
+ return False
189
+
190
+ def get_tokens_unprocessed(self, text):
191
+ # TODO: builtins are only subsequent tokens on lines
192
+ # and 'keywords' only happen at the beginning except
193
+ # for :au ones
194
+ for index, token, value in \
195
+ RegexLexer.get_tokens_unprocessed(self, text):
196
+ if token is Name.Other:
197
+ if self.is_in(value, self._cmd):
198
+ yield index, Keyword, value
199
+ elif self.is_in(value, self._opt) or \
200
+ self.is_in(value, self._aut):
201
+ yield index, Name.Builtin, value
202
+ else:
203
+ yield index, Text, value
204
+ else:
205
+ yield index, token, value
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/textfmts.py ADDED
@@ -0,0 +1,436 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.textfmts
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for various text formats.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ import re
12
+
13
+ from pygments.lexers import guess_lexer, get_lexer_by_name
14
+ from pygments.lexer import RegexLexer, bygroups, default, include
15
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
16
+ Number, Generic, Literal, Punctuation
17
+ from pygments.util import ClassNotFound
18
+
19
+ __all__ = ['IrcLogsLexer', 'TodotxtLexer', 'HttpLexer', 'GettextLexer',
20
+ 'NotmuchLexer', 'KernelLogLexer']
21
+
22
+
23
+ class IrcLogsLexer(RegexLexer):
24
+ """
25
+ Lexer for IRC logs in *irssi*, *xchat* or *weechat* style.
26
+ """
27
+
28
+ name = 'IRC logs'
29
+ aliases = ['irc']
30
+ filenames = ['*.weechatlog']
31
+ mimetypes = ['text/x-irclog']
32
+ url = 'https://en.wikipedia.org/wiki/Internet_Relay_Chat'
33
+ version_added = ''
34
+
35
+ flags = re.VERBOSE | re.MULTILINE
36
+ timestamp = r"""
37
+ (
38
+ # irssi / xchat and others
39
+ (?: \[|\()? # Opening bracket or paren for the timestamp
40
+ (?: # Timestamp
41
+ (?: (?:\d{1,4} [-/])* # Date as - or /-separated groups of digits
42
+ (?:\d{1,4})
43
+ [T ])? # Date/time separator: T or space
44
+ (?: \d?\d [:.])* # Time as :/.-separated groups of 1 or 2 digits
45
+ (?: \d?\d)
46
+ )
47
+ (?: \]|\))?\s+ # Closing bracket or paren for the timestamp
48
+ |
49
+ # weechat
50
+ \d{4}\s\w{3}\s\d{2}\s # Date
51
+ \d{2}:\d{2}:\d{2}\s+ # Time + Whitespace
52
+ |
53
+ # xchat
54
+ \w{3}\s\d{2}\s # Date
55
+ \d{2}:\d{2}:\d{2}\s+ # Time + Whitespace
56
+ )?
57
+ """
58
+ tokens = {
59
+ 'root': [
60
+ # log start/end
61
+ (r'^\*\*\*\*(.*)\*\*\*\*$', Comment),
62
+ # hack
63
+ ("^" + timestamp + r'(\s*<[^>]*>\s*)$', bygroups(Comment.Preproc, Name.Tag)),
64
+ # normal msgs
65
+ ("^" + timestamp + r"""
66
+ (\s*<.*?>\s*) # Nick """,
67
+ bygroups(Comment.Preproc, Name.Tag), 'msg'),
68
+ # /me msgs
69
+ ("^" + timestamp + r"""
70
+ (\s*[*]\s+) # Star
71
+ (\S+\s+.*?\n) # Nick + rest of message """,
72
+ bygroups(Comment.Preproc, Keyword, Generic.Inserted)),
73
+ # join/part msgs
74
+ ("^" + timestamp + r"""
75
+ (\s*(?:\*{3}|<?-[!@=P]?->?)\s*) # Star(s) or symbols
76
+ (\S+\s+) # Nick + Space
77
+ (.*?\n) # Rest of message """,
78
+ bygroups(Comment.Preproc, Keyword, String, Comment)),
79
+ (r"^.*?\n", Text),
80
+ ],
81
+ 'msg': [
82
+ (r"\S+:(?!//)", Name.Attribute), # Prefix
83
+ (r".*\n", Text, '#pop'),
84
+ ],
85
+ }
86
+
87
+
88
+ class GettextLexer(RegexLexer):
89
+ """
90
+ Lexer for Gettext catalog files.
91
+ """
92
+ name = 'Gettext Catalog'
93
+ aliases = ['pot', 'po']
94
+ filenames = ['*.pot', '*.po']
95
+ mimetypes = ['application/x-gettext', 'text/x-gettext', 'text/gettext']
96
+ url = 'https://www.gnu.org/software/gettext'
97
+ version_added = '0.9'
98
+
99
+ tokens = {
100
+ 'root': [
101
+ (r'^#,\s.*?$', Keyword.Type),
102
+ (r'^#:\s.*?$', Keyword.Declaration),
103
+ # (r'^#$', Comment),
104
+ (r'^(#|#\.\s|#\|\s|#~\s|#\s).*$', Comment.Single),
105
+ (r'^(")([A-Za-z-]+:)(.*")$',
106
+ bygroups(String, Name.Property, String)),
107
+ (r'^".*"$', String),
108
+ (r'^(msgid|msgid_plural|msgstr|msgctxt)(\s+)(".*")$',
109
+ bygroups(Name.Variable, Text, String)),
110
+ (r'^(msgstr\[)(\d)(\])(\s+)(".*")$',
111
+ bygroups(Name.Variable, Number.Integer, Name.Variable, Text, String)),
112
+ ]
113
+ }
114
+
115
+
116
+ class HttpLexer(RegexLexer):
117
+ """
118
+ Lexer for HTTP sessions.
119
+ """
120
+
121
+ name = 'HTTP'
122
+ aliases = ['http']
123
+ url = 'https://httpwg.org/specs'
124
+ version_added = '1.5'
125
+
126
+ flags = re.DOTALL
127
+
128
+ def get_tokens_unprocessed(self, text, stack=('root',)):
129
+ """Reset the content-type state."""
130
+ self.content_type = None
131
+ return RegexLexer.get_tokens_unprocessed(self, text, stack)
132
+
133
+ def header_callback(self, match):
134
+ if match.group(1).lower() == 'content-type':
135
+ content_type = match.group(5).strip()
136
+ if ';' in content_type:
137
+ content_type = content_type[:content_type.find(';')].strip()
138
+ self.content_type = content_type
139
+ yield match.start(1), Name.Attribute, match.group(1)
140
+ yield match.start(2), Text, match.group(2)
141
+ yield match.start(3), Operator, match.group(3)
142
+ yield match.start(4), Text, match.group(4)
143
+ yield match.start(5), Literal, match.group(5)
144
+ yield match.start(6), Text, match.group(6)
145
+
146
+ def continuous_header_callback(self, match):
147
+ yield match.start(1), Text, match.group(1)
148
+ yield match.start(2), Literal, match.group(2)
149
+ yield match.start(3), Text, match.group(3)
150
+
151
+ def content_callback(self, match):
152
+ content_type = getattr(self, 'content_type', None)
153
+ content = match.group()
154
+ offset = match.start()
155
+ if content_type:
156
+ from pygments.lexers import get_lexer_for_mimetype
157
+ possible_lexer_mimetypes = [content_type]
158
+ if '+' in content_type:
159
+ # application/calendar+xml can be treated as application/xml
160
+ # if there's not a better match.
161
+ general_type = re.sub(r'^(.*)/.*\+(.*)$', r'\1/\2',
162
+ content_type)
163
+ possible_lexer_mimetypes.append(general_type)
164
+
165
+ for i in possible_lexer_mimetypes:
166
+ try:
167
+ lexer = get_lexer_for_mimetype(i)
168
+ except ClassNotFound:
169
+ pass
170
+ else:
171
+ for idx, token, value in lexer.get_tokens_unprocessed(content):
172
+ yield offset + idx, token, value
173
+ return
174
+ yield offset, Text, content
175
+
176
+ tokens = {
177
+ 'root': [
178
+ (r'([a-zA-Z][-_a-zA-Z]+)( +)([^ ]+)( +)'
179
+ r'(HTTP)(/)(1\.[01]|2(?:\.0)?|3)(\r?\n|\Z)',
180
+ bygroups(Name.Function, Text, Name.Namespace, Text,
181
+ Keyword.Reserved, Operator, Number, Text),
182
+ 'headers'),
183
+ (r'(HTTP)(/)(1\.[01]|2(?:\.0)?|3)( +)(\d{3})(?:( +)([^\r\n]*))?(\r?\n|\Z)',
184
+ bygroups(Keyword.Reserved, Operator, Number, Text, Number, Text,
185
+ Name.Exception, Text),
186
+ 'headers'),
187
+ ],
188
+ 'headers': [
189
+ (r'([^\s:]+)( *)(:)( *)([^\r\n]*)(\r?\n|\Z)', header_callback),
190
+ (r'([\t ]+)([^\r\n]+)(\r?\n|\Z)', continuous_header_callback),
191
+ (r'\r?\n', Text, 'content')
192
+ ],
193
+ 'content': [
194
+ (r'.+', content_callback)
195
+ ]
196
+ }
197
+
198
+ def analyse_text(text):
199
+ return any (
200
+ re.search(pattern, text) is not None
201
+ for pattern in (
202
+ r'^([a-zA-Z][-_a-zA-Z]+)( +)([^ ]+)( +)(HTTP)(/)(1\.[01]|2(?:\.0)?|3)(\r?\n|\Z)',
203
+ r'^(HTTP)(/)(1\.[01]|2(?:\.0)?|3)( +)(\d{3})(?:( +)([^\r\n]*))?(\r?\n|\Z)',
204
+ )
205
+ )
206
+
207
+
208
+ class TodotxtLexer(RegexLexer):
209
+ """
210
+ Lexer for Todo.txt todo list format.
211
+ """
212
+
213
+ name = 'Todotxt'
214
+ url = 'http://todotxt.com/'
215
+ aliases = ['todotxt']
216
+ version_added = '2.0'
217
+ # *.todotxt is not a standard extension for Todo.txt files; including it
218
+ # makes testing easier, and also makes autodetecting file type easier.
219
+ filenames = ['todo.txt', '*.todotxt']
220
+ mimetypes = ['text/x-todo']
221
+
222
+ # Aliases mapping standard token types of Todo.txt format concepts
223
+ CompleteTaskText = Operator # Chosen to de-emphasize complete tasks
224
+ IncompleteTaskText = Text # Incomplete tasks should look like plain text
225
+
226
+ # Priority should have most emphasis to indicate importance of tasks
227
+ Priority = Generic.Heading
228
+ # Dates should have next most emphasis because time is important
229
+ Date = Generic.Subheading
230
+
231
+ # Project and context should have equal weight, and be in different colors
232
+ Project = Generic.Error
233
+ Context = String
234
+
235
+ # If tag functionality is added, it should have the same weight as Project
236
+ # and Context, and a different color. Generic.Traceback would work well.
237
+
238
+ # Regex patterns for building up rules; dates, priorities, projects, and
239
+ # contexts are all atomic
240
+ # TODO: Make date regex more ISO 8601 compliant
241
+ date_regex = r'\d{4,}-\d{2}-\d{2}'
242
+ priority_regex = r'\([A-Z]\)'
243
+ project_regex = r'\+\S+'
244
+ context_regex = r'@\S+'
245
+
246
+ # Compound regex expressions
247
+ complete_one_date_regex = r'(x )(' + date_regex + r')'
248
+ complete_two_date_regex = (complete_one_date_regex + r'( )(' +
249
+ date_regex + r')')
250
+ priority_date_regex = r'(' + priority_regex + r')( )(' + date_regex + r')'
251
+
252
+ tokens = {
253
+ # Should parse starting at beginning of line; each line is a task
254
+ 'root': [
255
+ # Complete task entry points: two total:
256
+ # 1. Complete task with two dates
257
+ (complete_two_date_regex, bygroups(CompleteTaskText, Date,
258
+ CompleteTaskText, Date),
259
+ 'complete'),
260
+ # 2. Complete task with one date
261
+ (complete_one_date_regex, bygroups(CompleteTaskText, Date),
262
+ 'complete'),
263
+
264
+ # Incomplete task entry points: six total:
265
+ # 1. Priority plus date
266
+ (priority_date_regex, bygroups(Priority, IncompleteTaskText, Date),
267
+ 'incomplete'),
268
+ # 2. Priority only
269
+ (priority_regex, Priority, 'incomplete'),
270
+ # 3. Leading date
271
+ (date_regex, Date, 'incomplete'),
272
+ # 4. Leading context
273
+ (context_regex, Context, 'incomplete'),
274
+ # 5. Leading project
275
+ (project_regex, Project, 'incomplete'),
276
+ # 6. Non-whitespace catch-all
277
+ (r'\S+', IncompleteTaskText, 'incomplete'),
278
+ ],
279
+
280
+ # Parse a complete task
281
+ 'complete': [
282
+ # Newline indicates end of task, should return to root
283
+ (r'\s*\n', CompleteTaskText, '#pop'),
284
+ # Tokenize contexts and projects
285
+ (context_regex, Context),
286
+ (project_regex, Project),
287
+ # Tokenize non-whitespace text
288
+ (r'\S+', CompleteTaskText),
289
+ # Tokenize whitespace not containing a newline
290
+ (r'\s+', CompleteTaskText),
291
+ ],
292
+
293
+ # Parse an incomplete task
294
+ 'incomplete': [
295
+ # Newline indicates end of task, should return to root
296
+ (r'\s*\n', IncompleteTaskText, '#pop'),
297
+ # Tokenize contexts and projects
298
+ (context_regex, Context),
299
+ (project_regex, Project),
300
+ # Tokenize non-whitespace text
301
+ (r'\S+', IncompleteTaskText),
302
+ # Tokenize whitespace not containing a newline
303
+ (r'\s+', IncompleteTaskText),
304
+ ],
305
+ }
306
+
307
+
308
+ class NotmuchLexer(RegexLexer):
309
+ """
310
+ For Notmuch email text format.
311
+
312
+ Additional options accepted:
313
+
314
+ `body_lexer`
315
+ If given, highlight the contents of the message body with the specified
316
+ lexer, else guess it according to the body content (default: ``None``).
317
+ """
318
+
319
+ name = 'Notmuch'
320
+ url = 'https://notmuchmail.org/'
321
+ aliases = ['notmuch']
322
+ version_added = '2.5'
323
+
324
+ def _highlight_code(self, match):
325
+ code = match.group(1)
326
+
327
+ try:
328
+ if self.body_lexer:
329
+ lexer = get_lexer_by_name(self.body_lexer)
330
+ else:
331
+ lexer = guess_lexer(code.strip())
332
+ except ClassNotFound:
333
+ lexer = get_lexer_by_name('text')
334
+
335
+ yield from lexer.get_tokens_unprocessed(code)
336
+
337
+ tokens = {
338
+ 'root': [
339
+ (r'\fmessage\{\s*', Keyword, ('message', 'message-attr')),
340
+ ],
341
+ 'message-attr': [
342
+ (r'(\s*id:\s*)(\S+)', bygroups(Name.Attribute, String)),
343
+ (r'(\s*(?:depth|match|excluded):\s*)(\d+)',
344
+ bygroups(Name.Attribute, Number.Integer)),
345
+ (r'(\s*filename:\s*)(.+\n)',
346
+ bygroups(Name.Attribute, String)),
347
+ default('#pop'),
348
+ ],
349
+ 'message': [
350
+ (r'\fmessage\}\n', Keyword, '#pop'),
351
+ (r'\fheader\{\n', Keyword, 'header'),
352
+ (r'\fbody\{\n', Keyword, 'body'),
353
+ ],
354
+ 'header': [
355
+ (r'\fheader\}\n', Keyword, '#pop'),
356
+ (r'((?:Subject|From|To|Cc|Date):\s*)(.*\n)',
357
+ bygroups(Name.Attribute, String)),
358
+ (r'(.*)(\s*\(.*\))(\s*\(.*\)\n)',
359
+ bygroups(Generic.Strong, Literal, Name.Tag)),
360
+ ],
361
+ 'body': [
362
+ (r'\fpart\{\n', Keyword, 'part'),
363
+ (r'\f(part|attachment)\{\s*', Keyword, ('part', 'part-attr')),
364
+ (r'\fbody\}\n', Keyword, '#pop'),
365
+ ],
366
+ 'part-attr': [
367
+ (r'(ID:\s*)(\d+)', bygroups(Name.Attribute, Number.Integer)),
368
+ (r'(,\s*)((?:Filename|Content-id):\s*)([^,]+)',
369
+ bygroups(Punctuation, Name.Attribute, String)),
370
+ (r'(,\s*)(Content-type:\s*)(.+\n)',
371
+ bygroups(Punctuation, Name.Attribute, String)),
372
+ default('#pop'),
373
+ ],
374
+ 'part': [
375
+ (r'\f(?:part|attachment)\}\n', Keyword, '#pop'),
376
+ (r'\f(?:part|attachment)\{\s*', Keyword, ('#push', 'part-attr')),
377
+ (r'^Non-text part: .*\n', Comment),
378
+ (r'(?s)(.*?(?=\f(?:part|attachment)\}\n))', _highlight_code),
379
+ ],
380
+ }
381
+
382
+ def analyse_text(text):
383
+ return 1.0 if text.startswith('\fmessage{') else 0.0
384
+
385
+ def __init__(self, **options):
386
+ self.body_lexer = options.get('body_lexer', None)
387
+ RegexLexer.__init__(self, **options)
388
+
389
+
390
+ class KernelLogLexer(RegexLexer):
391
+ """
392
+ For Linux Kernel log ("dmesg") output.
393
+ """
394
+ name = 'Kernel log'
395
+ aliases = ['kmsg', 'dmesg']
396
+ filenames = ['*.kmsg', '*.dmesg']
397
+ url = 'https://fr.wikipedia.org/wiki/Dmesg'
398
+ version_added = '2.6'
399
+
400
+ tokens = {
401
+ 'root': [
402
+ (r'^[^:]+:debug : (?=\[)', Text, 'debug'),
403
+ (r'^[^:]+:info : (?=\[)', Text, 'info'),
404
+ (r'^[^:]+:warn : (?=\[)', Text, 'warn'),
405
+ (r'^[^:]+:notice: (?=\[)', Text, 'warn'),
406
+ (r'^[^:]+:err : (?=\[)', Text, 'error'),
407
+ (r'^[^:]+:crit : (?=\[)', Text, 'error'),
408
+ (r'^(?=\[)', Text, 'unknown'),
409
+ ],
410
+ 'unknown': [
411
+ (r'^(?=.+(warning|notice|audit|deprecated))', Text, 'warn'),
412
+ (r'^(?=.+(error|critical|fail|Bug))', Text, 'error'),
413
+ default('info'),
414
+ ],
415
+ 'base': [
416
+ (r'\[[0-9. ]+\] ', Number),
417
+ (r'(?<=\] ).+?:', Keyword),
418
+ (r'\n', Text, '#pop'),
419
+ ],
420
+ 'debug': [
421
+ include('base'),
422
+ (r'.+\n', Comment, '#pop')
423
+ ],
424
+ 'info': [
425
+ include('base'),
426
+ (r'.+\n', Text, '#pop')
427
+ ],
428
+ 'warn': [
429
+ include('base'),
430
+ (r'.+\n', Generic.Strong, '#pop')
431
+ ],
432
+ 'error': [
433
+ include('base'),
434
+ (r'.+\n', Generic.Error, '#pop')
435
+ ]
436
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/theorem.py ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.theorem
3
+ ~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for theorem-proving languages.
6
+
7
+ See also :mod:`pygments.lexers.lean`
8
+
9
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
10
+ :license: BSD, see LICENSE for details.
11
+ """
12
+
13
+ from pygments.lexer import RegexLexer, bygroups, default, words
14
+ from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
15
+ Number, Punctuation, Generic, Whitespace
16
+ # compatibility import
17
+ from pygments.lexers.lean import LeanLexer # noqa: F401
18
+
19
+ __all__ = ['RocqLexer', 'IsabelleLexer']
20
+
21
+
22
+ class RocqLexer(RegexLexer):
23
+ """
24
+ For the Rocq Prover.
25
+ """
26
+
27
+ name = 'Rocq Prover'
28
+ url = 'https://rocq-prover.org/'
29
+ aliases = ['coq', 'rocq', 'rocq-prover']
30
+ filenames = ['*.v']
31
+ mimetypes = ['text/x-coq', 'text/x-rocq']
32
+ version_added = '1.5'
33
+
34
+ flags = 0 # no re.MULTILINE
35
+
36
+ keywords1 = (
37
+ # Vernacular commands
38
+ 'Section', 'Module', 'End', 'Require', 'Import', 'Export', 'Include', 'Variable',
39
+ 'Variables', 'Parameter', 'Parameters', 'Axiom', 'Axioms', 'Hypothesis',
40
+ 'Hypotheses', 'Notation', 'Local', 'Tactic', 'Reserved', 'Scope',
41
+ 'Open', 'Close', 'Bind', 'Declare', 'Delimit', 'Definition', 'Example', 'Let',
42
+ 'Ltac', 'Ltac2', 'Fixpoint', 'CoFixpoint', 'Morphism', 'Relation', 'Implicit',
43
+ 'Arguments', 'Types', 'Contextual', 'Strict', 'Prenex',
44
+ 'Implicits', 'Inductive', 'CoInductive', 'Record', 'Structure',
45
+ 'Variant', 'Canonical', 'Coercion', 'Theorem', 'Lemma', 'Fact',
46
+ 'Remark', 'Corollary', 'Proposition', 'Property', 'Goal',
47
+ 'Proof', 'Restart', 'Save', 'Qed', 'Defined', 'Abort', 'Admitted',
48
+ 'Hint', 'Resolve', 'Rewrite', 'View', 'Search', 'Compute', 'Eval',
49
+ 'Show', 'Print', 'Printing', 'All', 'Graph', 'Projections', 'inside',
50
+ 'outside', 'Check', 'Global', 'Instance', 'Class', 'Existing',
51
+ 'Universe', 'Polymorphic', 'Monomorphic', 'Context', 'Scheme', 'From',
52
+ 'Undo', 'Fail', 'Function', 'Program', 'Elpi', 'Extract', 'Opaque',
53
+ 'Transparent', 'Unshelve', 'Next Obligation',
54
+ )
55
+ keywords2 = (
56
+ # Gallina
57
+ 'forall', 'exists', 'exists2', 'fun', 'fix', 'cofix', 'struct',
58
+ 'match', 'end', 'in', 'return', 'let', 'if', 'is', 'then', 'else',
59
+ 'for', 'of', 'nosimpl', 'with', 'as',
60
+ )
61
+ keywords3 = (
62
+ # Sorts
63
+ 'Type', 'Prop', 'SProp', 'Set',
64
+ )
65
+ keywords4 = (
66
+ # Tactics
67
+ 'pose', 'set', 'move', 'case', 'elim', 'apply', 'clear', 'hnf', 'intro',
68
+ 'intros', 'generalize', 'rename', 'pattern', 'after', 'destruct',
69
+ 'induction', 'using', 'refine', 'inversion', 'injection', 'rewrite',
70
+ 'congr', 'unlock', 'compute', 'ring', 'field', 'replace', 'fold',
71
+ 'unfold', 'change', 'cutrewrite', 'simpl', 'have', 'suff', 'wlog',
72
+ 'suffices', 'without', 'loss', 'nat_norm', 'assert', 'cut', 'trivial',
73
+ 'revert', 'bool_congr', 'nat_congr', 'symmetry', 'transitivity', 'auto',
74
+ 'split', 'left', 'right', 'autorewrite', 'tauto', 'setoid_rewrite',
75
+ 'intuition', 'eauto', 'eapply', 'econstructor', 'etransitivity',
76
+ 'constructor', 'erewrite', 'red', 'cbv', 'lazy', 'vm_compute',
77
+ 'native_compute', 'subst',
78
+ )
79
+ keywords5 = (
80
+ # Terminators
81
+ 'by', 'now', 'done', 'exact', 'reflexivity',
82
+ 'tauto', 'romega', 'omega', 'lia', 'nia', 'lra', 'nra', 'psatz',
83
+ 'assumption', 'solve', 'contradiction', 'discriminate',
84
+ 'congruence', 'admit'
85
+ )
86
+ keywords6 = (
87
+ # Control
88
+ 'do', 'last', 'first', 'try', 'idtac', 'repeat',
89
+ )
90
+ # 'as', 'assert', 'begin', 'class', 'constraint', 'do', 'done',
91
+ # 'downto', 'else', 'end', 'exception', 'external', 'false',
92
+ # 'for', 'fun', 'function', 'functor', 'if', 'in', 'include',
93
+ # 'inherit', 'initializer', 'lazy', 'let', 'match', 'method',
94
+ # 'module', 'mutable', 'new', 'object', 'of', 'open', 'private',
95
+ # 'raise', 'rec', 'sig', 'struct', 'then', 'to', 'true', 'try',
96
+ # 'type', 'val', 'virtual', 'when', 'while', 'with'
97
+ keyopts = (
98
+ '!=', '#', '&', '&&', r'\(', r'\)', r'\*', r'\+', ',', '-', r'-\.',
99
+ '->', r'\.', r'\.\.', ':', '::', ':=', ':>', ';', ';;', '<', '<-',
100
+ '<->', '=', '>', '>]', r'>\}', r'\?', r'\?\?', r'\[', r'\[<', r'\[>',
101
+ r'\[\|', ']', '_', '`', r'\{', r'\{<', r'lp:\{\{', r'\|', r'\|]', r'\}', '~', '=>',
102
+ r'/\\', r'\\/', r'\{\|', r'\|\}',
103
+ # 'Π', 'Σ', # Not defined in the standard library
104
+ 'λ', '¬', '∧', '∨', '∀', '∃', '→', '↔', '≠', '≤', '≥',
105
+ )
106
+ operators = r'[!$%&*+\./:<=>?@^|~-]'
107
+ prefix_syms = r'[!?~]'
108
+ infix_syms = r'[=<>@^|&+\*/$%-]'
109
+
110
+ tokens = {
111
+ 'root': [
112
+ (r'\s+', Text),
113
+ (r'false|true|\(\)|\[\]', Name.Builtin.Pseudo),
114
+ (r'\(\*', Comment, 'comment'),
115
+ (r'\b(?:[^\W\d][\w\']*\.)+[^\W\d][\w\']*\b', Name),
116
+ (r'\bEquations\b\??', Keyword.Namespace),
117
+ (r'\b(Elpi)(\s+)(Program|Query|Accumulate|Command|Typecheck|Db|Export|Tactic)?\b', bygroups(Keyword.Namespace,Text,Keyword.Namespace)),
118
+ # Very weak heuristic to distinguish the Set vernacular from the Set sort
119
+ (r'\bUnset\b|\bSet(?=[ \t]+[A-Z][a-z][^\n]*?\.)', Keyword.Namespace, 'set-options'),
120
+ (r'\b(?:String|Number)\s+Notation', Keyword.Namespace, 'sn-notation'),
121
+ (words(keywords1, prefix=r'\b', suffix=r'\b'), Keyword.Namespace),
122
+ (words(keywords2, prefix=r'\b', suffix=r'\b'), Keyword),
123
+ (words(keywords3, prefix=r'\b', suffix=r'\b'), Keyword.Type),
124
+ (words(keywords4, prefix=r'\b', suffix=r'\b'), Keyword),
125
+ (words(keywords5, prefix=r'\b', suffix=r'\b'), Keyword.Pseudo),
126
+ (words(keywords6, prefix=r'\b', suffix=r'\b'), Keyword.Reserved),
127
+ # (r'\b([A-Z][\w\']*)(\.)', Name.Namespace, 'dotted'),
128
+ (r'\b([A-Z][\w\']*)', Name),
129
+ (r'({})'.format('|'.join(keyopts[::-1])), Operator),
130
+ (rf'({infix_syms}|{prefix_syms})?{operators}', Operator),
131
+
132
+ (r"[^\W\d][\w']*", Name),
133
+
134
+ (r'\d[\d_]*', Number.Integer),
135
+ (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
136
+ (r'0[oO][0-7][0-7_]*', Number.Oct),
137
+ (r'0[bB][01][01_]*', Number.Bin),
138
+ (r'-?\d[\d_]*(.[\d_]*)?([eE][+\-]?\d[\d_]*)', Number.Float),
139
+
140
+ (r"'(?:(\\[\\\"'ntbr ])|(\\[0-9]{3})|(\\x[0-9a-fA-F]{2}))'", String.Char),
141
+
142
+ (r"'.'", String.Char),
143
+ (r"'", Keyword), # a stray quote is another syntax element
144
+
145
+ (r'"', String.Double, 'string'),
146
+
147
+ (r'[~?][a-z][\w\']*:', Name),
148
+ (r'\S', Name.Builtin.Pseudo),
149
+ ],
150
+ 'set-options': [
151
+ (r'\s+', Text),
152
+ (r'[A-Z]\w*', Keyword.Namespace),
153
+ (r'"', String.Double, 'string'),
154
+ (r'\d+', Number.Integer),
155
+ (r'\.', Punctuation, '#pop'),
156
+ ],
157
+ 'sn-notation': [
158
+ (r'\s+', Text),
159
+ # Extra keywords to highlight only in this scope
160
+ (r'\b(?:via|mapping|abstract|warning|after)\b', Keyword),
161
+ (r'=>|[()\[\]:,]', Operator),
162
+ (r'\b[^\W\d][\w\']*(?:\.[^\W\d][\w\']*)*\b', Name),
163
+ (r'\d[\d_]*', Number.Integer),
164
+ (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
165
+ (r'\(\*', Comment, 'comment'),
166
+ (r'\.', Punctuation, '#pop'),
167
+ ],
168
+ 'comment': [
169
+ # Consume comments like ***** as one token
170
+ (r'([^(*)]+|\*+(?!\)))+', Comment),
171
+ (r'\(\*', Comment, '#push'),
172
+ (r'\*\)', Comment, '#pop'),
173
+ (r'[(*)]', Comment),
174
+ ],
175
+ 'string': [
176
+ (r'[^"]+', String.Double),
177
+ (r'""', String.Double),
178
+ (r'"', String.Double, '#pop'),
179
+ ],
180
+ 'dotted': [
181
+ (r'\s+', Text),
182
+ (r'\.', Punctuation),
183
+ (r'[A-Z][\w\']*(?=\s*\.)', Name.Namespace),
184
+ (r'[A-Z][\w\']*', Name.Class, '#pop'),
185
+ (r'[a-z][a-z0-9_\']*', Name, '#pop'),
186
+ default('#pop')
187
+ ],
188
+ }
189
+
190
+ def analyse_text(text):
191
+ if 'Qed' in text and 'Proof' in text:
192
+ return 1
193
+
194
+
195
+ class IsabelleLexer(RegexLexer):
196
+ """
197
+ For the Isabelle proof assistant.
198
+ """
199
+
200
+ name = 'Isabelle'
201
+ url = 'https://isabelle.in.tum.de/'
202
+ aliases = ['isabelle']
203
+ filenames = ['*.thy']
204
+ mimetypes = ['text/x-isabelle']
205
+ version_added = '2.0'
206
+
207
+ keyword_minor = (
208
+ 'and', 'assumes', 'attach', 'avoids', 'binder', 'checking',
209
+ 'class_instance', 'class_relation', 'code_module', 'congs',
210
+ 'constant', 'constrains', 'datatypes', 'defines', 'file', 'fixes',
211
+ 'for', 'functions', 'hints', 'identifier', 'if', 'imports', 'in',
212
+ 'includes', 'infix', 'infixl', 'infixr', 'is', 'keywords', 'lazy',
213
+ 'module_name', 'monos', 'morphisms', 'no_discs_sels', 'notes',
214
+ 'obtains', 'open', 'output', 'overloaded', 'parametric', 'permissive',
215
+ 'pervasive', 'rep_compat', 'shows', 'structure', 'type_class',
216
+ 'type_constructor', 'unchecked', 'unsafe', 'where',
217
+ )
218
+
219
+ keyword_diag = (
220
+ 'ML_command', 'ML_val', 'class_deps', 'code_deps', 'code_thms',
221
+ 'display_drafts', 'find_consts', 'find_theorems', 'find_unused_assms',
222
+ 'full_prf', 'help', 'locale_deps', 'nitpick', 'pr', 'prf',
223
+ 'print_abbrevs', 'print_antiquotations', 'print_attributes',
224
+ 'print_binds', 'print_bnfs', 'print_bundles',
225
+ 'print_case_translations', 'print_cases', 'print_claset',
226
+ 'print_classes', 'print_codeproc', 'print_codesetup',
227
+ 'print_coercions', 'print_commands', 'print_context',
228
+ 'print_defn_rules', 'print_dependencies', 'print_facts',
229
+ 'print_induct_rules', 'print_inductives', 'print_interps',
230
+ 'print_locale', 'print_locales', 'print_methods', 'print_options',
231
+ 'print_orders', 'print_quot_maps', 'print_quotconsts',
232
+ 'print_quotients', 'print_quotientsQ3', 'print_quotmapsQ3',
233
+ 'print_rules', 'print_simpset', 'print_state', 'print_statement',
234
+ 'print_syntax', 'print_theorems', 'print_theory', 'print_trans_rules',
235
+ 'prop', 'pwd', 'quickcheck', 'refute', 'sledgehammer', 'smt_status',
236
+ 'solve_direct', 'spark_status', 'term', 'thm', 'thm_deps', 'thy_deps',
237
+ 'try', 'try0', 'typ', 'unused_thms', 'value', 'values', 'welcome',
238
+ 'print_ML_antiquotations', 'print_term_bindings', 'values_prolog',
239
+ )
240
+
241
+ keyword_thy = ('theory', 'begin', 'end')
242
+
243
+ keyword_section = ('header', 'chapter')
244
+
245
+ keyword_subsection = (
246
+ 'section', 'subsection', 'subsubsection', 'sect', 'subsect',
247
+ 'subsubsect',
248
+ )
249
+
250
+ keyword_theory_decl = (
251
+ 'ML', 'ML_file', 'abbreviation', 'adhoc_overloading', 'arities',
252
+ 'atom_decl', 'attribute_setup', 'axiomatization', 'bundle',
253
+ 'case_of_simps', 'class', 'classes', 'classrel', 'codatatype',
254
+ 'code_abort', 'code_class', 'code_const', 'code_datatype',
255
+ 'code_identifier', 'code_include', 'code_instance', 'code_modulename',
256
+ 'code_monad', 'code_printing', 'code_reflect', 'code_reserved',
257
+ 'code_type', 'coinductive', 'coinductive_set', 'consts', 'context',
258
+ 'datatype', 'datatype_new', 'datatype_new_compat', 'declaration',
259
+ 'declare', 'default_sort', 'defer_recdef', 'definition', 'defs',
260
+ 'domain', 'domain_isomorphism', 'domaindef', 'equivariance',
261
+ 'export_code', 'extract', 'extract_type', 'fixrec', 'fun',
262
+ 'fun_cases', 'hide_class', 'hide_const', 'hide_fact', 'hide_type',
263
+ 'import_const_map', 'import_file', 'import_tptp', 'import_type_map',
264
+ 'inductive', 'inductive_set', 'instantiation', 'judgment', 'lemmas',
265
+ 'lifting_forget', 'lifting_update', 'local_setup', 'locale',
266
+ 'method_setup', 'nitpick_params', 'no_adhoc_overloading',
267
+ 'no_notation', 'no_syntax', 'no_translations', 'no_type_notation',
268
+ 'nominal_datatype', 'nonterminal', 'notation', 'notepad', 'oracle',
269
+ 'overloading', 'parse_ast_translation', 'parse_translation',
270
+ 'partial_function', 'primcorec', 'primrec', 'primrec_new',
271
+ 'print_ast_translation', 'print_translation', 'quickcheck_generator',
272
+ 'quickcheck_params', 'realizability', 'realizers', 'recdef', 'record',
273
+ 'refute_params', 'setup', 'setup_lifting', 'simproc_setup',
274
+ 'simps_of_case', 'sledgehammer_params', 'spark_end', 'spark_open',
275
+ 'spark_open_siv', 'spark_open_vcg', 'spark_proof_functions',
276
+ 'spark_types', 'statespace', 'syntax', 'syntax_declaration', 'text',
277
+ 'text_raw', 'theorems', 'translations', 'type_notation',
278
+ 'type_synonym', 'typed_print_translation', 'typedecl', 'hoarestate',
279
+ 'install_C_file', 'install_C_types', 'wpc_setup', 'c_defs', 'c_types',
280
+ 'memsafe', 'SML_export', 'SML_file', 'SML_import', 'approximate',
281
+ 'bnf_axiomatization', 'cartouche', 'datatype_compat',
282
+ 'free_constructors', 'functor', 'nominal_function',
283
+ 'nominal_termination', 'permanent_interpretation',
284
+ 'binds', 'defining', 'smt2_status', 'term_cartouche',
285
+ 'boogie_file', 'text_cartouche',
286
+ )
287
+
288
+ keyword_theory_script = ('inductive_cases', 'inductive_simps')
289
+
290
+ keyword_theory_goal = (
291
+ 'ax_specification', 'bnf', 'code_pred', 'corollary', 'cpodef',
292
+ 'crunch', 'crunch_ignore',
293
+ 'enriched_type', 'function', 'instance', 'interpretation', 'lemma',
294
+ 'lift_definition', 'nominal_inductive', 'nominal_inductive2',
295
+ 'nominal_primrec', 'pcpodef', 'primcorecursive',
296
+ 'quotient_definition', 'quotient_type', 'recdef_tc', 'rep_datatype',
297
+ 'schematic_corollary', 'schematic_lemma', 'schematic_theorem',
298
+ 'spark_vc', 'specification', 'subclass', 'sublocale', 'termination',
299
+ 'theorem', 'typedef', 'wrap_free_constructors',
300
+ )
301
+
302
+ keyword_qed = ('by', 'done', 'qed')
303
+ keyword_abandon_proof = ('sorry', 'oops')
304
+
305
+ keyword_proof_goal = ('have', 'hence', 'interpret')
306
+
307
+ keyword_proof_block = ('next', 'proof')
308
+
309
+ keyword_proof_chain = (
310
+ 'finally', 'from', 'then', 'ultimately', 'with',
311
+ )
312
+
313
+ keyword_proof_decl = (
314
+ 'ML_prf', 'also', 'include', 'including', 'let', 'moreover', 'note',
315
+ 'txt', 'txt_raw', 'unfolding', 'using', 'write',
316
+ )
317
+
318
+ keyword_proof_asm = ('assume', 'case', 'def', 'fix', 'presume')
319
+
320
+ keyword_proof_asm_goal = ('guess', 'obtain', 'show', 'thus')
321
+
322
+ keyword_proof_script = (
323
+ 'apply', 'apply_end', 'apply_trace', 'back', 'defer', 'prefer',
324
+ )
325
+
326
+ operators = (
327
+ '::', ':', '(', ')', '[', ']', '_', '=', ',', '|',
328
+ '+', '-', '!', '?',
329
+ )
330
+
331
+ proof_operators = ('{', '}', '.', '..')
332
+
333
+ tokens = {
334
+ 'root': [
335
+ (r'\s+', Whitespace),
336
+ (r'\(\*', Comment, 'comment'),
337
+ (r'\\<open>', String.Symbol, 'cartouche'),
338
+ (r'\{\*|‹', String, 'cartouche'),
339
+
340
+ (words(operators), Operator),
341
+ (words(proof_operators), Operator.Word),
342
+
343
+ (words(keyword_minor, prefix=r'\b', suffix=r'\b'), Keyword.Pseudo),
344
+
345
+ (words(keyword_diag, prefix=r'\b', suffix=r'\b'), Keyword.Type),
346
+
347
+ (words(keyword_thy, prefix=r'\b', suffix=r'\b'), Keyword),
348
+ (words(keyword_theory_decl, prefix=r'\b', suffix=r'\b'), Keyword),
349
+
350
+ (words(keyword_section, prefix=r'\b', suffix=r'\b'), Generic.Heading),
351
+ (words(keyword_subsection, prefix=r'\b', suffix=r'\b'), Generic.Subheading),
352
+
353
+ (words(keyword_theory_goal, prefix=r'\b', suffix=r'\b'), Keyword.Namespace),
354
+ (words(keyword_theory_script, prefix=r'\b', suffix=r'\b'), Keyword.Namespace),
355
+
356
+ (words(keyword_abandon_proof, prefix=r'\b', suffix=r'\b'), Generic.Error),
357
+
358
+ (words(keyword_qed, prefix=r'\b', suffix=r'\b'), Keyword),
359
+ (words(keyword_proof_goal, prefix=r'\b', suffix=r'\b'), Keyword),
360
+ (words(keyword_proof_block, prefix=r'\b', suffix=r'\b'), Keyword),
361
+ (words(keyword_proof_decl, prefix=r'\b', suffix=r'\b'), Keyword),
362
+
363
+ (words(keyword_proof_chain, prefix=r'\b', suffix=r'\b'), Keyword),
364
+ (words(keyword_proof_asm, prefix=r'\b', suffix=r'\b'), Keyword),
365
+ (words(keyword_proof_asm_goal, prefix=r'\b', suffix=r'\b'), Keyword),
366
+
367
+ (words(keyword_proof_script, prefix=r'\b', suffix=r'\b'), Keyword.Pseudo),
368
+
369
+ (r'\\<(\w|\^)*>', Text.Symbol),
370
+
371
+ (r"'[^\W\d][.\w']*", Name.Type),
372
+
373
+ (r'0[xX][\da-fA-F][\da-fA-F_]*', Number.Hex),
374
+ (r'0[oO][0-7][0-7_]*', Number.Oct),
375
+ (r'0[bB][01][01_]*', Number.Bin),
376
+
377
+ (r'"', String, 'string'),
378
+ (r'`', String.Other, 'fact'),
379
+ (r'[^\s:|\[\]\-()=,+!?{}._][^\s:|\[\]\-()=,+!?{}]*', Name),
380
+ ],
381
+ 'comment': [
382
+ (r'[^(*)]+', Comment),
383
+ (r'\(\*', Comment, '#push'),
384
+ (r'\*\)', Comment, '#pop'),
385
+ (r'[(*)]', Comment),
386
+ ],
387
+ 'cartouche': [
388
+ (r'[^{*}\\‹›]+', String),
389
+ (r'\\<open>', String.Symbol, '#push'),
390
+ (r'\{\*|‹', String, '#push'),
391
+ (r'\\<close>', String.Symbol, '#pop'),
392
+ (r'\*\}|›', String, '#pop'),
393
+ (r'\\<(\w|\^)*>', String.Symbol),
394
+ (r'[{*}\\]', String),
395
+ ],
396
+ 'string': [
397
+ (r'[^"\\]+', String),
398
+ (r'\\<(\w|\^)*>', String.Symbol),
399
+ (r'\\"', String),
400
+ (r'\\', String),
401
+ (r'"', String, '#pop'),
402
+ ],
403
+ 'fact': [
404
+ (r'[^`\\]+', String.Other),
405
+ (r'\\<(\w|\^)*>', String.Symbol),
406
+ (r'\\`', String.Other),
407
+ (r'\\', String.Other),
408
+ (r'`', String.Other, '#pop'),
409
+ ],
410
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/thingsdb.py ADDED
@@ -0,0 +1,143 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.thingsdb
3
+ ~~~~~~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the ThingsDB 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, bygroups
12
+ from pygments.token import Comment, Keyword, Name, Number, String, Text, \
13
+ Operator, Punctuation, Whitespace
14
+
15
+ __all__ = ['ThingsDBLexer']
16
+
17
+
18
+ class ThingsDBLexer(RegexLexer):
19
+ """
20
+ Lexer for the ThingsDB programming language.
21
+ """
22
+ name = 'ThingsDB'
23
+ aliases = ['ti', 'thingsdb']
24
+ filenames = ['*.ti']
25
+ url = 'https://www.thingsdb.net'
26
+ version_added = '2.9'
27
+
28
+ tokens = {
29
+ 'root': [
30
+ include('expression'),
31
+ ],
32
+ 'expression': [
33
+ include('comments'),
34
+ include('whitespace'),
35
+
36
+ # numbers
37
+ (r'[-+]?0b[01]+', Number.Bin),
38
+ (r'[-+]?0o[0-8]+', Number.Oct),
39
+ (r'([-+]?0x[0-9a-fA-F]+)', Number.Hex),
40
+ (r'[-+]?[0-9]+', Number.Integer),
41
+ (r'[-+]?((inf|nan)([^0-9A-Za-z_]|$)|[0-9]*\.[0-9]+(e[+-][0-9]+)?)',
42
+ Number.Float),
43
+
44
+ # strings
45
+ (r'(?:"(?:[^"]*)")+', String.Double),
46
+ (r"(?:'(?:[^']*)')+", String.Single),
47
+ (r"(?:`(?:[^`]*)`)+", String.Backtick),
48
+
49
+ # literals
50
+ (r'(true|false|nil)\b', Keyword.Constant),
51
+
52
+ # name constants
53
+ (r'(FULL|USER|GRANT|CHANGE|JOIN|RUN|QUERY|'
54
+ r'DEBUG|INFO|WARNING|ERROR|CRITICAL|'
55
+ r'NO_IDS|INT_MIN|INT_MAX|MATH_E|MATH_PI)\b', Name.Constant),
56
+
57
+ # regular expressions
58
+ (r'(/[^/\\]*(?:\\.[^/\\]*)*/i?)', String.Regex),
59
+
60
+ # name, assignments and functions
61
+ include('names'),
62
+
63
+ (r'[(){}\[\],;]', Punctuation),
64
+ (r'[+\-*/%&|<>^!~@=:?]', Operator),
65
+ ],
66
+ 'names': [
67
+ (r'(\.)'
68
+ r'(first|last|then|else|load|at|again_in|again_at|err|cancel|'
69
+ r'closure|set_closure|args|set_args|owner|set_owner|equals|copy|'
70
+ r'dup|assign|week|weekday|yday|zone|len|call|doc|emit|extract|'
71
+ r'choice|code|format|msg|each|every|extend|extend_unique|filter|'
72
+ r'find|flat|find_index|has|index_of|count|sum|is_unique|unique|'
73
+ r'join|map|map_id|map_wrap|map_type|vmap|move|pop|push|fill|'
74
+ r'remove|replace|restrict|restriction|shift|sort|splice|to|add|'
75
+ r'one|clear|contains|ends_with|name|lower|replace|reverse|'
76
+ r'starts_with|split|test|trim|trim_left|trim_right|upper|del|ren|'
77
+ r'to_type|to_thing|get|id|keys|reduce|set|some|value|values|wrap|'
78
+ r'unshift|unwrap|search|set_name|bit_count)'
79
+ r'(\()',
80
+ bygroups(Name.Function, Name.Function, Punctuation), 'arguments'),
81
+ (r'(alt_raise|assert|base64_encode|base64_decode|bool|bytes|'
82
+ r'closure|datetime|deep|future|is_future|del_enum|del_type|room|'
83
+ r'is_room|task|tasks|is_task|is_email|is_url|is_tel|is_time_zone|'
84
+ r'timeit|enum|enum_info|enum_map|enums_info|err|regex|is_regex|'
85
+ r'change_id|float|has_enum|has_type|int|is_array|is_ascii|'
86
+ r'is_float|is_bool|is_bytes|is_closure|is_datetime|is_enum|'
87
+ r'is_err|is_mpdata|is_inf|is_int|is_list|is_nan|is_nil|is_raw|'
88
+ r'is_set|is_str|is_thing|is_timeval|is_tuple|is_utf8|json_dump|'
89
+ r'json_load|list|log|import|export|root|mod_enum|mod_type|new|'
90
+ r'new_type|now|raise|rand|range|randint|randstr|refs|rename_enum|'
91
+ r'set|set_enum|set_type|str|thing|timeval|try|type|type_assert|'
92
+ r'type_all|type_count|type_info|types_info|nse|wse|backup_info|'
93
+ r'backups_info|backups_ok|counters|del_backup|has_backup|'
94
+ r'new_backup|node_info|nodes_info|reset_counters|restart_module|'
95
+ r'set_log_level|shutdown|has_module|del_module|module_info|'
96
+ r'modules_info|new_module|deploy_module|rename_module|'
97
+ r'refresh_module|set_module_conf|set_module_scope|'
98
+ r'collections_info|del_collection|del_expired|del_node|del_token|'
99
+ r'del_user|grant|has_collection|has_node|has_token|has_user|'
100
+ r'new_collection|new_node|new_token|new_user|rename_collection|'
101
+ r'rename_user|restore|revoke|set_password|set_time_zone|'
102
+ r'set_default_deep|time_zones_info|user_info|users_info|'
103
+ r'del_procedure|has_procedure|new_procedure|mod_procedure|'
104
+ r'procedure_doc|procedure_info|procedures_info|rename_procedure|'
105
+ r'run|assert_err|auth_err|bad_data_err|cancelled_err|'
106
+ r'rename_type|forbidden_err|lookup_err|max_quota_err|node_err|'
107
+ r'num_arguments_err|operation_err|overflow_err|syntax_err|'
108
+ r'collection_info|type_err|value_err|zero_div_err|whitelist_add|'
109
+ r'whitelist_del|round|abs|ceil|cos|exp|floor|log10|log2|'
110
+ r'loge|pow|sin|sqrt|tan|is_module|commit|history|set_history|'
111
+ r'del_history|ano)'
112
+ r'(\()',
113
+ bygroups(Name.Function, Punctuation),
114
+ 'arguments'),
115
+ (r'(\.[A-Za-z_][0-9A-Za-z_]*)'
116
+ r'(\s*)(=)',
117
+ bygroups(Name.Attribute, Text, Operator)),
118
+ (r'\.[A-Za-z_][0-9A-Za-z_]*', Name.Attribute),
119
+ (r'([A-Za-z_][0-9A-Za-z_]*)(\s*)(=)',
120
+ bygroups(Name.Variable, Text, Operator)),
121
+ (r'[A-Za-z_][0-9A-Za-z_]*', Name.Variable),
122
+ ],
123
+ 'whitespace': [
124
+ (r'\n', Whitespace),
125
+ (r'\s+', Whitespace),
126
+ ],
127
+ 'comments': [
128
+ (r'//(.*?)\n', Comment.Single),
129
+ (r'/\*', Comment.Multiline, 'comment'),
130
+ ],
131
+ 'comment': [
132
+ (r'[^*/]+', Comment.Multiline),
133
+ (r'/\*', Comment.Multiline, '#push'),
134
+ (r'\*/', Comment.Multiline, '#pop'),
135
+ (r'[*/]', Comment.Multiline),
136
+ ],
137
+ 'arguments': [
138
+ include('expression'),
139
+ (',', Punctuation),
140
+ (r'\(', Punctuation, '#push'),
141
+ (r'\)', Punctuation, '#pop'),
142
+ ],
143
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/tlb.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.tlb
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for TL-b.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+
11
+ from pygments.lexer import RegexLexer, include, words
12
+ from pygments.token import Operator, Name, \
13
+ Number, Whitespace, Punctuation, Comment
14
+
15
+ __all__ = ['TlbLexer']
16
+
17
+
18
+ class TlbLexer(RegexLexer):
19
+ """
20
+ For TL-b source code.
21
+ """
22
+
23
+ name = 'Tl-b'
24
+ aliases = ['tlb']
25
+ filenames = ['*.tlb']
26
+ url = 'https://docs.ton.org/#/overviews/TL-B'
27
+ version_added = ''
28
+
29
+ tokens = {
30
+ 'root': [
31
+ (r'\s+', Whitespace),
32
+
33
+ include('comments'),
34
+
35
+ (r'[0-9]+', Number),
36
+ (words((
37
+ '+', '-', '*', '=', '?', '~', '.',
38
+ '^', '==', '<', '>', '<=', '>=', '!='
39
+ )), Operator),
40
+ (words(('##', '#<', '#<=')), Name.Tag),
41
+ (r'#[0-9a-f]*_?', Name.Tag),
42
+ (r'\$[01]*_?', Name.Tag),
43
+
44
+ (r'[a-zA-Z_][0-9a-zA-Z_]*', Name),
45
+
46
+ (r'[;():\[\]{}]', Punctuation)
47
+ ],
48
+
49
+ 'comments': [
50
+ (r'//.*', Comment.Singleline),
51
+ (r'/\*', Comment.Multiline, 'comment'),
52
+ ],
53
+ 'comment': [
54
+ (r'[^/*]+', Comment.Multiline),
55
+ (r'/\*', Comment.Multiline, '#push'),
56
+ (r'\*/', Comment.Multiline, '#pop'),
57
+ (r'[*/]', Comment.Multiline),
58
+ ],
59
+ }
.cache/uv/archive-v0/6WaZhd1wSprhjD1HCu34f/pygments/lexers/tls.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ pygments.lexers.tls
3
+ ~~~~~~~~~~~~~~~~~~~
4
+
5
+ Lexers for the TLS presentation language.
6
+
7
+ :copyright: Copyright 2006-present by the Pygments team, see AUTHORS.
8
+ :license: BSD, see LICENSE for details.
9
+ """
10
+ import re
11
+
12
+ from pygments.lexer import RegexLexer, words
13
+ from pygments.token import Comment, Operator, Keyword, Name, String, \
14
+ Number, Punctuation, Whitespace
15
+
16
+ __all__ = ['TlsLexer']
17
+
18
+
19
+ class TlsLexer(RegexLexer):
20
+ """
21
+ The TLS presentation language, described in RFC 8446.
22
+ """
23
+ name = 'TLS Presentation Language'
24
+ url = 'https://www.rfc-editor.org/rfc/rfc8446#section-3'
25
+ filenames = []
26
+ aliases = ['tls']
27
+ mimetypes = []
28
+ version_added = '2.16'
29
+
30
+ flags = re.MULTILINE | re.DOTALL
31
+
32
+ tokens = {
33
+ 'root': [
34
+ (r'\s+', Whitespace),
35
+ # comments
36
+ (r'/[*].*?[*]/', Comment.Multiline),
37
+ # Keywords
38
+ (words(('struct', 'enum', 'select', 'case'), suffix=r'\b'),
39
+ Keyword),
40
+ (words(('uint8', 'uint16', 'uint24', 'uint32', 'uint64', 'opaque'),
41
+ suffix=r'\b'), Keyword.Type),
42
+ # numeric literals
43
+ (r'0x[0-9a-fA-F]+', Number.Hex),
44
+ (r'[0-9]+', Number.Integer),
45
+ # string literal
46
+ (r'"(\\.|[^"\\])*"', String),
47
+ # tokens
48
+ (r'[.]{2}', Operator),
49
+ (r'[+\-*/&^]', Operator),
50
+ (r'[|<>=!()\[\]{}.,;:\?]', Punctuation),
51
+ # identifiers
52
+ (r'[^\W\d]\w*', Name.Other),
53
+ ]
54
+ }