pygments.rb 2.2.0 → 2.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +12 -7
- data/.github/workflows/release.yml +5 -5
- data/CHANGELOG.adoc +9 -0
- data/README.adoc +1 -1
- data/bench.rb +2 -2
- data/lib/pygments/lexer.rb +1 -1
- data/lib/pygments/mentos.py +6 -4
- data/lib/pygments/popen.rb +20 -11
- data/lib/pygments/version.rb +1 -1
- data/lib/pygments.rb +8 -2
- data/pygments.rb.gemspec +4 -4
- data/test/test_pygments.rb +14 -8
- data/vendor/pygments-main/{Pygments-2.8.1.dist-info → Pygments-2.10.0.dist-info}/AUTHORS +8 -1
- data/vendor/pygments-main/{Pygments-2.8.1.dist-info → Pygments-2.10.0.dist-info}/INSTALLER +0 -0
- data/vendor/pygments-main/{Pygments-2.8.1.dist-info → Pygments-2.10.0.dist-info}/LICENSE +0 -0
- data/vendor/pygments-main/{Pygments-2.8.1.dist-info → Pygments-2.10.0.dist-info}/METADATA +1 -1
- data/vendor/pygments-main/Pygments-2.10.0.dist-info/RECORD +524 -0
- data/vendor/pygments-main/{Pygments-2.8.1.dist-info → Pygments-2.10.0.dist-info}/REQUESTED +0 -0
- data/vendor/pygments-main/{Pygments-2.8.1.dist-info → Pygments-2.10.0.dist-info}/WHEEL +0 -0
- data/vendor/pygments-main/{Pygments-2.8.1.dist-info → Pygments-2.10.0.dist-info}/entry_points.txt +0 -0
- data/vendor/pygments-main/{Pygments-2.8.1.dist-info → Pygments-2.10.0.dist-info}/top_level.txt +0 -0
- data/vendor/pygments-main/bin/pygmentize +1 -1
- data/vendor/pygments-main/pygments/__init__.py +1 -1
- data/vendor/pygments-main/pygments/formatters/_mapping.py +1 -0
- data/vendor/pygments-main/pygments/formatters/html.py +20 -7
- data/vendor/pygments-main/pygments/formatters/pangomarkup.py +83 -0
- data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +55 -14
- data/vendor/pygments-main/pygments/lexers/_julia_builtins.py +401 -0
- data/vendor/pygments-main/pygments/lexers/_mapping.py +68 -52
- data/vendor/pygments-main/pygments/lexers/actionscript.py +2 -2
- data/vendor/pygments-main/pygments/lexers/ambient.py +1 -1
- data/vendor/pygments-main/pygments/lexers/amdgpu.py +9 -4
- data/vendor/pygments-main/pygments/lexers/apdlexer.py +448 -0
- data/vendor/pygments-main/pygments/lexers/apl.py +6 -3
- data/vendor/pygments-main/pygments/lexers/asc.py +51 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +86 -58
- data/vendor/pygments-main/pygments/lexers/automation.py +1 -1
- data/vendor/pygments-main/pygments/lexers/bibtex.py +2 -2
- data/vendor/pygments-main/pygments/lexers/c_cpp.py +60 -33
- data/vendor/pygments-main/pygments/lexers/c_like.py +102 -3
- data/vendor/pygments-main/pygments/lexers/cddl.py +2 -2
- data/vendor/pygments-main/pygments/lexers/chapel.py +53 -29
- data/vendor/pygments-main/pygments/lexers/clean.py +6 -6
- data/vendor/pygments-main/pygments/lexers/configs.py +133 -43
- data/vendor/pygments-main/pygments/lexers/csound.py +2 -2
- data/vendor/pygments-main/pygments/lexers/devicetree.py +1 -1
- data/vendor/pygments-main/pygments/lexers/dotnet.py +1 -1
- data/vendor/pygments-main/pygments/lexers/erlang.py +1 -1
- data/vendor/pygments-main/pygments/lexers/floscript.py +1 -1
- data/vendor/pygments-main/pygments/lexers/futhark.py +5 -4
- data/vendor/pygments-main/pygments/lexers/gcodelexer.py +36 -0
- data/vendor/pygments-main/pygments/lexers/go.py +1 -1
- data/vendor/pygments-main/pygments/lexers/graphics.py +1 -1
- data/vendor/pygments-main/pygments/lexers/graphviz.py +5 -4
- data/vendor/pygments-main/pygments/lexers/gsql.py +92 -0
- data/vendor/pygments-main/pygments/lexers/haskell.py +4 -4
- data/vendor/pygments-main/pygments/lexers/haxe.py +1 -1
- data/vendor/pygments-main/pygments/lexers/installers.py +2 -2
- data/vendor/pygments-main/pygments/lexers/javascript.py +145 -127
- data/vendor/pygments-main/pygments/lexers/jslt.py +94 -0
- data/vendor/pygments-main/pygments/lexers/julia.py +135 -183
- data/vendor/pygments-main/pygments/lexers/jvm.py +262 -202
- data/vendor/pygments-main/pygments/lexers/kuin.py +299 -0
- data/vendor/pygments-main/pygments/lexers/lisp.py +18 -15
- data/vendor/pygments-main/pygments/lexers/markup.py +3 -3
- data/vendor/pygments-main/pygments/lexers/matlab.py +23 -10
- data/vendor/pygments-main/pygments/lexers/meson.py +155 -0
- data/vendor/pygments-main/pygments/lexers/mime.py +6 -21
- data/vendor/pygments-main/pygments/lexers/ml.py +1 -1
- data/vendor/pygments-main/pygments/lexers/nimrod.py +1 -1
- data/vendor/pygments-main/pygments/lexers/objective.py +3 -3
- data/vendor/pygments-main/pygments/lexers/parsers.py +1 -1
- data/vendor/pygments-main/pygments/lexers/procfile.py +43 -0
- data/vendor/pygments-main/pygments/lexers/promql.py +1 -1
- data/vendor/pygments-main/pygments/lexers/python.py +19 -5
- data/vendor/pygments-main/pygments/lexers/resource.py +1 -1
- data/vendor/pygments-main/pygments/lexers/rnc.py +1 -1
- data/vendor/pygments-main/pygments/lexers/ruby.py +1 -1
- data/vendor/pygments-main/pygments/lexers/rust.py +9 -10
- data/vendor/pygments-main/pygments/lexers/scripting.py +7 -7
- data/vendor/pygments-main/pygments/lexers/shell.py +11 -8
- data/vendor/pygments-main/pygments/lexers/smithy.py +79 -0
- data/vendor/pygments-main/pygments/lexers/smv.py +1 -1
- data/vendor/pygments-main/pygments/lexers/special.py +15 -2
- data/vendor/pygments-main/pygments/lexers/supercollider.py +1 -1
- data/vendor/pygments-main/pygments/lexers/tcl.py +3 -3
- data/vendor/pygments-main/pygments/lexers/teal.py +88 -0
- data/vendor/pygments-main/pygments/lexers/templates.py +19 -19
- data/vendor/pygments-main/pygments/lexers/teraterm.py +1 -1
- data/vendor/pygments-main/pygments/lexers/testing.py +1 -1
- data/vendor/pygments-main/pygments/lexers/theorem.py +4 -2
- data/vendor/pygments-main/pygments/lexers/thingsdb.py +118 -0
- data/vendor/pygments-main/pygments/lexers/tnt.py +25 -15
- data/vendor/pygments-main/pygments/lexers/trafficscript.py +1 -1
- data/vendor/pygments-main/pygments/lexers/webassembly.py +120 -0
- data/vendor/pygments-main/pygments/regexopt.py +1 -1
- data/vendor/pygments-main/pygments/style.py +1 -1
- data/vendor/pygments-main/pygments/styles/__init__.py +2 -0
- data/vendor/pygments-main/pygments/styles/friendly.py +1 -0
- data/vendor/pygments-main/pygments/styles/gruvbox.py +107 -0
- data/vendor/pygments-main/pygments/styles/native.py +1 -0
- metadata +29 -14
- data/vendor/pygments-main/Pygments-2.8.1.dist-info/RECORD +0 -494
|
@@ -412,7 +412,7 @@ class SwiftLexer(RegexLexer):
|
|
|
412
412
|
],
|
|
413
413
|
'keywords': [
|
|
414
414
|
(words((
|
|
415
|
-
'as', 'break', 'case', 'catch', 'continue', 'default', 'defer',
|
|
415
|
+
'as', 'async', 'await', 'break', 'case', 'catch', 'continue', 'default', 'defer',
|
|
416
416
|
'do', 'else', 'fallthrough', 'for', 'guard', 'if', 'in', 'is',
|
|
417
417
|
'repeat', 'return', '#selector', 'switch', 'throw', 'try',
|
|
418
418
|
'where', 'while'), suffix=r'\b'),
|
|
@@ -440,8 +440,8 @@ class SwiftLexer(RegexLexer):
|
|
|
440
440
|
(r'(var|let)(\s+)([a-zA-Z_]\w*)', bygroups(Keyword.Declaration,
|
|
441
441
|
Text, Name.Variable)),
|
|
442
442
|
(words((
|
|
443
|
-
'class', 'deinit', 'enum', 'extension', 'func', 'import',
|
|
444
|
-
'internal', 'let', 'operator', 'private', 'protocol', 'public',
|
|
443
|
+
'actor', 'associatedtype', 'class', 'deinit', 'enum', 'extension', 'func', 'import',
|
|
444
|
+
'init', 'internal', 'let', 'operator', 'private', 'protocol', 'public',
|
|
445
445
|
'static', 'struct', 'subscript', 'typealias', 'var'), suffix=r'\b'),
|
|
446
446
|
Keyword.Declaration)
|
|
447
447
|
],
|
|
@@ -652,7 +652,7 @@ class AntlrActionScriptLexer(DelegatingLexer):
|
|
|
652
652
|
"""
|
|
653
653
|
|
|
654
654
|
name = 'ANTLR With ActionScript Target'
|
|
655
|
-
aliases = ['antlr-
|
|
655
|
+
aliases = ['antlr-actionscript', 'antlr-as']
|
|
656
656
|
filenames = ['*.G', '*.g']
|
|
657
657
|
|
|
658
658
|
def __init__(self, **options):
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""
|
|
2
|
+
pygments.lexers.procfile
|
|
3
|
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
|
4
|
+
|
|
5
|
+
Lexer for Procfile file format.
|
|
6
|
+
|
|
7
|
+
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
|
|
8
|
+
:license: BSD, see LICENSE for details.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from pygments.lexer import RegexLexer, bygroups
|
|
12
|
+
from pygments.token import Name, Number, String, Text, Punctuation
|
|
13
|
+
|
|
14
|
+
__all__ = ["ProcfileLexer"]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ProcfileLexer(RegexLexer):
|
|
18
|
+
"""
|
|
19
|
+
Lexer for Procfile file format.
|
|
20
|
+
|
|
21
|
+
The format is used to run processes on Heroku or is used by Foreman or
|
|
22
|
+
Honcho tools.
|
|
23
|
+
For more information about the definition of the format, see:
|
|
24
|
+
https://devcenter.heroku.com/articles/procfile#procfile-format
|
|
25
|
+
|
|
26
|
+
.. versionadded:: 2.10
|
|
27
|
+
"""
|
|
28
|
+
name = 'Procfile'
|
|
29
|
+
aliases = ['procfile']
|
|
30
|
+
filenames = ['Procfile']
|
|
31
|
+
|
|
32
|
+
tokens = {
|
|
33
|
+
'root': [
|
|
34
|
+
(r'^([a-z]+)(:)', bygroups(Name.Label, Punctuation)),
|
|
35
|
+
(r'\s+', Text.Whitespace),
|
|
36
|
+
(r'"[^"]*"', String),
|
|
37
|
+
(r"'[^']*'", String),
|
|
38
|
+
(r'[0-9]+', Number.Integer),
|
|
39
|
+
(r'\$[a-zA-Z_][\w]*', Name.Variable),
|
|
40
|
+
(r'(\w+)(=)(\w+)', bygroups(Name.Variable, Punctuation, String)),
|
|
41
|
+
(r'([\w\-\./]+)', Text),
|
|
42
|
+
],
|
|
43
|
+
}
|
|
@@ -166,7 +166,7 @@ class PromQLLexer(RegexLexer):
|
|
|
166
166
|
(r"\n", Whitespace),
|
|
167
167
|
(r"\s+", Whitespace),
|
|
168
168
|
(r",", Punctuation),
|
|
169
|
-
(r'([_a-zA-Z][a-zA-Z0-9_]*?)(\s*?)(
|
|
169
|
+
(r'([_a-zA-Z][a-zA-Z0-9_]*?)(\s*?)(=~|!=|=|!~)(\s*?)("|\')(.*?)("|\')',
|
|
170
170
|
bygroups(Name.Label, Whitespace, Operator, Whitespace,
|
|
171
171
|
Punctuation, String, Punctuation)),
|
|
172
172
|
],
|
|
@@ -160,6 +160,7 @@ class PythonLexer(RegexLexer):
|
|
|
160
160
|
("([uUbB]?)(')", bygroups(String.Affix, String.Single),
|
|
161
161
|
combined('stringescape', 'sqs')),
|
|
162
162
|
(r'[^\S\n]+', Text),
|
|
163
|
+
include('numbers'),
|
|
163
164
|
(r'!=|==|<<|>>|:=|[-~+/*%=<>&^|.]', Operator),
|
|
164
165
|
(r'[]{}:(),;[]', Punctuation),
|
|
165
166
|
(r'(in|is|and|or|not)\b', Operator.Word),
|
|
@@ -168,7 +169,6 @@ class PythonLexer(RegexLexer):
|
|
|
168
169
|
include('magicfuncs'),
|
|
169
170
|
include('magicvars'),
|
|
170
171
|
include('name'),
|
|
171
|
-
include('numbers'),
|
|
172
172
|
],
|
|
173
173
|
'expr-inside-fstring': [
|
|
174
174
|
(r'[{([]', Punctuation, 'expr-inside-fstring-inner'),
|
|
@@ -727,7 +727,7 @@ class PythonTracebackLexer(RegexLexer):
|
|
|
727
727
|
(r'^( File )("[^"]+")(, line )(\d+)(\n)',
|
|
728
728
|
bygroups(Text, Name.Builtin, Text, Number, Text)),
|
|
729
729
|
(r'^( )(.+)(\n)',
|
|
730
|
-
bygroups(Text, using(PythonLexer), Text)),
|
|
730
|
+
bygroups(Text, using(PythonLexer), Text), 'markers'),
|
|
731
731
|
(r'^([ \t]*)(\.\.\.)(\n)',
|
|
732
732
|
bygroups(Text, Comment, Text)), # for doctests...
|
|
733
733
|
(r'^([^:]+)(: )(.+)(\n)',
|
|
@@ -735,6 +735,15 @@ class PythonTracebackLexer(RegexLexer):
|
|
|
735
735
|
(r'^([a-zA-Z_][\w.]*)(:?\n)',
|
|
736
736
|
bygroups(Generic.Error, Text), '#pop')
|
|
737
737
|
],
|
|
738
|
+
'markers': [
|
|
739
|
+
# Either `PEP 657 <https://www.python.org/dev/peps/pep-0657/>`
|
|
740
|
+
# error locations in Python 3.11+, or single-caret markers
|
|
741
|
+
# for syntax errors before that.
|
|
742
|
+
(r'^( {4,})(\^+)(\n)',
|
|
743
|
+
bygroups(Text, Punctuation.Marker, Text),
|
|
744
|
+
'#pop'),
|
|
745
|
+
default('#pop'),
|
|
746
|
+
],
|
|
738
747
|
}
|
|
739
748
|
|
|
740
749
|
|
|
@@ -773,7 +782,7 @@ class Python2TracebackLexer(RegexLexer):
|
|
|
773
782
|
(r'^( File )("[^"]+")(, line )(\d+)(\n)',
|
|
774
783
|
bygroups(Text, Name.Builtin, Text, Number, Text)),
|
|
775
784
|
(r'^( )(.+)(\n)',
|
|
776
|
-
bygroups(Text, using(Python2Lexer), Text)),
|
|
785
|
+
bygroups(Text, using(Python2Lexer), Text), 'marker'),
|
|
777
786
|
(r'^([ \t]*)(\.\.\.)(\n)',
|
|
778
787
|
bygroups(Text, Comment, Text)), # for doctests...
|
|
779
788
|
(r'^([^:]+)(: )(.+)(\n)',
|
|
@@ -781,6 +790,11 @@ class Python2TracebackLexer(RegexLexer):
|
|
|
781
790
|
(r'^([a-zA-Z_]\w*)(:?\n)',
|
|
782
791
|
bygroups(Generic.Error, Text), '#pop')
|
|
783
792
|
],
|
|
793
|
+
'marker': [
|
|
794
|
+
# For syntax errors.
|
|
795
|
+
(r'( {4,})(\^)', bygroups(Text, Punctuation.Marker), '#pop'),
|
|
796
|
+
default('#pop'),
|
|
797
|
+
],
|
|
784
798
|
}
|
|
785
799
|
|
|
786
800
|
|
|
@@ -845,14 +859,14 @@ class CythonLexer(RegexLexer):
|
|
|
845
859
|
],
|
|
846
860
|
'builtins': [
|
|
847
861
|
(words((
|
|
848
|
-
'__import__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin',
|
|
862
|
+
'__import__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', 'bint',
|
|
849
863
|
'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr',
|
|
850
864
|
'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'delattr',
|
|
851
865
|
'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit',
|
|
852
866
|
'file', 'filter', 'float', 'frozenset', 'getattr', 'globals',
|
|
853
867
|
'hasattr', 'hash', 'hex', 'id', 'input', 'int', 'intern', 'isinstance',
|
|
854
868
|
'issubclass', 'iter', 'len', 'list', 'locals', 'long', 'map', 'max',
|
|
855
|
-
'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'property',
|
|
869
|
+
'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'Py_ssize_t',
|
|
856
870
|
'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed',
|
|
857
871
|
'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod',
|
|
858
872
|
'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'unsigned',
|
|
@@ -24,7 +24,7 @@ class ResourceLexer(RegexLexer):
|
|
|
24
24
|
.. versionadded:: 2.0
|
|
25
25
|
"""
|
|
26
26
|
name = 'ResourceBundle'
|
|
27
|
-
aliases = ['
|
|
27
|
+
aliases = ['resourcebundle', 'resource']
|
|
28
28
|
filenames = []
|
|
29
29
|
|
|
30
30
|
_types = (':table', ':array', ':string', ':bin', ':import', ':intvector',
|
|
@@ -33,7 +33,7 @@ class RubyLexer(ExtendedRegexLexer):
|
|
|
33
33
|
"""
|
|
34
34
|
|
|
35
35
|
name = 'Ruby'
|
|
36
|
-
aliases = ['
|
|
36
|
+
aliases = ['ruby', 'rb', 'duby']
|
|
37
37
|
filenames = ['*.rb', '*.rbw', 'Rakefile', '*.rake', '*.gemspec',
|
|
38
38
|
'*.rbx', '*.duby', 'Gemfile']
|
|
39
39
|
mimetypes = ['text/x-ruby', 'application/x-ruby']
|
|
@@ -109,7 +109,7 @@ class RustLexer(RegexLexer):
|
|
|
109
109
|
# Types in positions.
|
|
110
110
|
(r'(?::|->)', Text, 'typename'),
|
|
111
111
|
# Labels
|
|
112
|
-
(r'(break|continue)(\s*)(\'[A-Za-z_]\w*)?',
|
|
112
|
+
(r'(break|continue)(\b\s*)(\'[A-Za-z_]\w*)?',
|
|
113
113
|
bygroups(Keyword, Text.Whitespace, Name.Label)),
|
|
114
114
|
|
|
115
115
|
# Character literals
|
|
@@ -135,7 +135,7 @@ class RustLexer(RegexLexer):
|
|
|
135
135
|
# String literals
|
|
136
136
|
(r'b"', String, 'bytestring'),
|
|
137
137
|
(r'"', String, 'string'),
|
|
138
|
-
(r'b?r(#*)".*?"\1', String),
|
|
138
|
+
(r'(?s)b?r(#*)".*?"\1', String),
|
|
139
139
|
|
|
140
140
|
# Lifetime names
|
|
141
141
|
(r"'", Operator, 'lifetime'),
|
|
@@ -152,6 +152,11 @@ class RustLexer(RegexLexer):
|
|
|
152
152
|
|
|
153
153
|
# Attributes
|
|
154
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'#', Text),
|
|
155
160
|
],
|
|
156
161
|
'comment': [
|
|
157
162
|
(r'[^*/]+', Comment.Multiline),
|
|
@@ -208,16 +213,10 @@ class RustLexer(RegexLexer):
|
|
|
208
213
|
'attribute_common': [
|
|
209
214
|
(r'"', String, 'string'),
|
|
210
215
|
(r'\[', Comment.Preproc, 'attribute['),
|
|
211
|
-
(r'\(', Comment.Preproc, 'attribute('),
|
|
212
216
|
],
|
|
213
217
|
'attribute[': [
|
|
214
218
|
include('attribute_common'),
|
|
215
|
-
(r'\]
|
|
216
|
-
(r'[^"\]]+', Comment.Preproc),
|
|
217
|
-
],
|
|
218
|
-
'attribute(': [
|
|
219
|
-
include('attribute_common'),
|
|
220
|
-
(r'\);?', Comment.Preproc, '#pop'),
|
|
221
|
-
(r'[^")]+', Comment.Preproc),
|
|
219
|
+
(r'\]', Comment.Preproc, '#pop'),
|
|
220
|
+
(r'[^"\]\[]+', Comment.Preproc),
|
|
222
221
|
],
|
|
223
222
|
}
|
|
@@ -168,9 +168,9 @@ class MoonScriptLexer(LuaLexer):
|
|
|
168
168
|
.. versionadded:: 1.5
|
|
169
169
|
"""
|
|
170
170
|
|
|
171
|
-
name =
|
|
172
|
-
aliases = [
|
|
173
|
-
filenames = [
|
|
171
|
+
name = 'MoonScript'
|
|
172
|
+
aliases = ['moonscript', 'moon']
|
|
173
|
+
filenames = ['*.moon']
|
|
174
174
|
mimetypes = ['text/x-moonscript', 'application/x-moonscript']
|
|
175
175
|
|
|
176
176
|
tokens = {
|
|
@@ -237,7 +237,7 @@ class ChaiscriptLexer(RegexLexer):
|
|
|
237
237
|
"""
|
|
238
238
|
|
|
239
239
|
name = 'ChaiScript'
|
|
240
|
-
aliases = ['
|
|
240
|
+
aliases = ['chaiscript', 'chai']
|
|
241
241
|
filenames = ['*.chai']
|
|
242
242
|
mimetypes = ['text/x-chaiscript', 'application/x-chaiscript']
|
|
243
243
|
|
|
@@ -1236,9 +1236,9 @@ class MiniScriptLexer(RegexLexer):
|
|
|
1236
1236
|
.. versionadded:: 2.6
|
|
1237
1237
|
"""
|
|
1238
1238
|
|
|
1239
|
-
name =
|
|
1240
|
-
aliases = [
|
|
1241
|
-
filenames = [
|
|
1239
|
+
name = 'MiniScript'
|
|
1240
|
+
aliases = ['miniscript', 'ms']
|
|
1241
|
+
filenames = ['*.ms']
|
|
1242
1242
|
mimetypes = ['text/x-minicript', 'application/x-miniscript']
|
|
1243
1243
|
|
|
1244
1244
|
tokens = {
|
|
@@ -192,10 +192,13 @@ class ShellSessionBaseLexer(Lexer):
|
|
|
192
192
|
[(0, Generic.Prompt, m.group(1))]))
|
|
193
193
|
curcode += m.group(2)
|
|
194
194
|
backslash_continuation = curcode.endswith('\\\n')
|
|
195
|
-
elif
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
195
|
+
elif backslash_continuation:
|
|
196
|
+
if line.startswith(self._ps2):
|
|
197
|
+
insertions.append((len(curcode),
|
|
198
|
+
[(0, Generic.Prompt, line[:len(self._ps2)])]))
|
|
199
|
+
curcode += line[len(self._ps2):]
|
|
200
|
+
else:
|
|
201
|
+
curcode += line
|
|
199
202
|
backslash_continuation = curcode.endswith('\\\n')
|
|
200
203
|
else:
|
|
201
204
|
if insertions:
|
|
@@ -238,7 +241,7 @@ class BatchLexer(RegexLexer):
|
|
|
238
241
|
.. versionadded:: 0.7
|
|
239
242
|
"""
|
|
240
243
|
name = 'Batchfile'
|
|
241
|
-
aliases = ['
|
|
244
|
+
aliases = ['batch', 'bat', 'dosbatch', 'winbatch']
|
|
242
245
|
filenames = ['*.bat', '*.cmd']
|
|
243
246
|
mimetypes = ['application/x-dos-batch']
|
|
244
247
|
|
|
@@ -652,7 +655,7 @@ class PowerShellLexer(RegexLexer):
|
|
|
652
655
|
.. versionadded:: 1.5
|
|
653
656
|
"""
|
|
654
657
|
name = 'PowerShell'
|
|
655
|
-
aliases = ['powershell', 'posh', 'ps1', 'psm1']
|
|
658
|
+
aliases = ['powershell', 'pwsh', 'posh', 'ps1', 'psm1']
|
|
656
659
|
filenames = ['*.ps1', '*.psm1']
|
|
657
660
|
mimetypes = ['text/x-powershell']
|
|
658
661
|
|
|
@@ -730,7 +733,7 @@ class PowerShellLexer(RegexLexer):
|
|
|
730
733
|
(r'\[[a-z_\[][\w. `,\[\]]*\]', Name.Constant), # .net [type]s
|
|
731
734
|
(r'-[a-z_]\w*', Name),
|
|
732
735
|
(r'\w+', Name),
|
|
733
|
-
(r'[
|
|
736
|
+
(r'[.,;:@{}\[\]$()=+*/\\&%!~?^`|<>-]', Punctuation),
|
|
734
737
|
],
|
|
735
738
|
'child': [
|
|
736
739
|
(r'\)', Punctuation, '#pop'),
|
|
@@ -768,7 +771,7 @@ class PowerShellSessionLexer(ShellSessionBaseLexer):
|
|
|
768
771
|
"""
|
|
769
772
|
|
|
770
773
|
name = 'PowerShell Session'
|
|
771
|
-
aliases = ['ps1con']
|
|
774
|
+
aliases = ['pwsh-session', 'ps1con']
|
|
772
775
|
filenames = []
|
|
773
776
|
mimetypes = []
|
|
774
777
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"""
|
|
2
|
+
pygments.lexers.smithy
|
|
3
|
+
~~~~~~~~~~~~~~~~~~~~~~
|
|
4
|
+
|
|
5
|
+
Lexers for the Smithy IDL.
|
|
6
|
+
|
|
7
|
+
:copyright: Copyright 2006-2021 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 Text, Comment, Keyword, Name, String, \
|
|
15
|
+
Number, Whitespace, Punctuation
|
|
16
|
+
|
|
17
|
+
__all__ = ['SmithyLexer']
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class SmithyLexer(RegexLexer):
|
|
21
|
+
"""
|
|
22
|
+
For Smithy IDL
|
|
23
|
+
|
|
24
|
+
.. versionadded:: 2.10
|
|
25
|
+
"""
|
|
26
|
+
name = 'Smithy'
|
|
27
|
+
filenames = ['*.smithy']
|
|
28
|
+
aliases = ['smithy']
|
|
29
|
+
|
|
30
|
+
flags = re.MULTILINE | re.UNICODE
|
|
31
|
+
unquoted = r'[A-Za-z0-9_\.#$-]+'
|
|
32
|
+
identifier = r"[A-Za-z0-9_\.#$-]+"
|
|
33
|
+
|
|
34
|
+
simple_shapes = (
|
|
35
|
+
'use', 'byte', 'short', 'integer', 'long', 'float', 'document',
|
|
36
|
+
'double', 'bigInteger', 'bigDecimal', 'boolean', 'blob', 'string',
|
|
37
|
+
'timestamp',
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
aggregate_shapes = (
|
|
41
|
+
'apply', 'list', 'map', 'set', 'structure', 'union', 'resource',
|
|
42
|
+
'operation', 'service', 'trait'
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
tokens = {
|
|
46
|
+
'root': [
|
|
47
|
+
(r'///.*$', Comment.Multiline),
|
|
48
|
+
(r'//.*$', Comment),
|
|
49
|
+
(r'@[0-9a-zA-Z\.#-]*', Name.Decorator),
|
|
50
|
+
(r'(=)', Name.Decorator),
|
|
51
|
+
(r'^(\$version)(:)(.+)',
|
|
52
|
+
bygroups(Keyword.Declaration, Name.Decorator, Name.Class)),
|
|
53
|
+
(r'^(namespace)(\s+' + identifier + r')\b',
|
|
54
|
+
bygroups(Keyword.Declaration, Name.Class)),
|
|
55
|
+
(words(simple_shapes,
|
|
56
|
+
prefix=r'^', suffix=r'(\s+' + identifier + r')\b'),
|
|
57
|
+
bygroups(Keyword.Declaration, Name.Class)),
|
|
58
|
+
(words(aggregate_shapes,
|
|
59
|
+
prefix=r'^', suffix=r'(\s+' + identifier + r')'),
|
|
60
|
+
bygroups(Keyword.Declaration, Name.Class)),
|
|
61
|
+
(r'^(metadata)(\s+.+)(\s*)(=)',
|
|
62
|
+
bygroups(Keyword.Declaration, Name.Class, Whitespace, Name.Decorator)),
|
|
63
|
+
(r"(true|false|null)", Keyword.Constant),
|
|
64
|
+
(r"(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)", Number),
|
|
65
|
+
(identifier + ":", Name.Label),
|
|
66
|
+
(identifier, Name.Variable.Class),
|
|
67
|
+
(r'\[', Text, "#push"),
|
|
68
|
+
(r'\]', Text, "#pop"),
|
|
69
|
+
(r'\(', Text, "#push"),
|
|
70
|
+
(r'\)', Text, "#pop"),
|
|
71
|
+
(r'\{', Text, "#push"),
|
|
72
|
+
(r'\}', Text, "#pop"),
|
|
73
|
+
(r'"{3}(\\\\|\n|\\")*"{3}', String.Doc),
|
|
74
|
+
(r'"(\\\\|\n|\\"|[^"])*"', String.Double),
|
|
75
|
+
(r"'(\\\\|\n|\\'|[^'])*'", String.Single),
|
|
76
|
+
(r'[:,]+', Punctuation),
|
|
77
|
+
(r'\s+', Whitespace),
|
|
78
|
+
]
|
|
79
|
+
}
|
|
@@ -68,7 +68,7 @@ class NuSMVLexer(RegexLexer):
|
|
|
68
68
|
(r'\-?\d+\b', Number.Integer),
|
|
69
69
|
(r'0[su][bB]\d*_[01_]+', Number.Bin),
|
|
70
70
|
(r'0[su][oO]\d*_[0-7_]+', Number.Oct),
|
|
71
|
-
(r'0[su][dD]\d*_[\d_]+', Number.
|
|
71
|
+
(r'0[su][dD]\d*_[\d_]+', Number.Decimal),
|
|
72
72
|
(r'0[su][hH]\d*_[\da-fA-F_]+', Number.Hex),
|
|
73
73
|
|
|
74
74
|
# Whitespace, punctuation and the rest
|
|
@@ -12,11 +12,11 @@ import ast
|
|
|
12
12
|
import re
|
|
13
13
|
|
|
14
14
|
from pygments.lexer import Lexer
|
|
15
|
-
from pygments.token import Token, Error, Text
|
|
15
|
+
from pygments.token import Token, Error, Text, Generic
|
|
16
16
|
from pygments.util import get_choice_opt
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
__all__ = ['TextLexer', 'RawTokenLexer']
|
|
19
|
+
__all__ = ['TextLexer', 'OutputLexer', 'RawTokenLexer']
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
class TextLexer(Lexer):
|
|
@@ -36,6 +36,19 @@ class TextLexer(Lexer):
|
|
|
36
36
|
return TextLexer.priority
|
|
37
37
|
|
|
38
38
|
|
|
39
|
+
class OutputLexer(Lexer):
|
|
40
|
+
"""
|
|
41
|
+
Simple lexer that highlights everything as ``Token.Generic.Output``.
|
|
42
|
+
|
|
43
|
+
.. versionadded:: 2.10
|
|
44
|
+
"""
|
|
45
|
+
name = 'Text output'
|
|
46
|
+
aliases = ['output']
|
|
47
|
+
|
|
48
|
+
def get_tokens_unprocessed(self, text):
|
|
49
|
+
yield 0, Generic.Output, text
|
|
50
|
+
|
|
51
|
+
|
|
39
52
|
_ttype_cache = {}
|
|
40
53
|
|
|
41
54
|
line_re = re.compile('.*?\n')
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
from pygments.lexer import RegexLexer, include, words
|
|
12
12
|
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
|
13
|
-
Number
|
|
13
|
+
Number, Whitespace
|
|
14
14
|
from pygments.util import shebang_matches
|
|
15
15
|
|
|
16
16
|
__all__ = ['TclLexer']
|
|
@@ -79,13 +79,13 @@ class TclLexer(RegexLexer):
|
|
|
79
79
|
(r'!=|==|<<|>>|<=|>=|&&|\|\||\*\*|[-+~!*/%<>&^|?:]', Operator),
|
|
80
80
|
],
|
|
81
81
|
'data': [
|
|
82
|
-
(r'\s+',
|
|
82
|
+
(r'\s+', Whitespace),
|
|
83
83
|
(r'0x[a-fA-F0-9]+', Number.Hex),
|
|
84
84
|
(r'0[0-7]+', Number.Oct),
|
|
85
85
|
(r'\d+\.\d+', Number.Float),
|
|
86
86
|
(r'\d+', Number.Integer),
|
|
87
87
|
(r'\$([\w.:-]+)', Name.Variable),
|
|
88
|
-
(r'([\w
|
|
88
|
+
(r'([\w.,@:-]+)', Text),
|
|
89
89
|
],
|
|
90
90
|
'params': [
|
|
91
91
|
(r';', Keyword, '#pop'),
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
pygments.lexers.teal
|
|
4
|
+
~~~~~~~~~~~~~~~~~~~~
|
|
5
|
+
|
|
6
|
+
Lexer for TEAL.
|
|
7
|
+
|
|
8
|
+
:copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS.
|
|
9
|
+
:license: BSD, see LICENSE for details.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from pygments.lexer import RegexLexer, bygroups, include, words
|
|
13
|
+
from pygments.token import Comment, Name, Number, String, Text, Keyword
|
|
14
|
+
|
|
15
|
+
__all__ = ['TealLexer']
|
|
16
|
+
|
|
17
|
+
class TealLexer(RegexLexer):
|
|
18
|
+
"""
|
|
19
|
+
For the `Transaction Execution Approval Language (TEAL)
|
|
20
|
+
<https://developer.algorand.org/docs/reference/teal/specification/>`
|
|
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
|
+
.. versionadded:: 2.9
|
|
26
|
+
"""
|
|
27
|
+
name = 'teal'
|
|
28
|
+
aliases = ['teal']
|
|
29
|
+
filenames = ['*.teal']
|
|
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]+', Text),
|
|
86
|
+
(r'//[^\n]+', Comment.Single),
|
|
87
|
+
],
|
|
88
|
+
}
|