Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/INSTALLER +1 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/METADATA +58 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/RECORD +684 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/WHEEL +4 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/entry_points.txt +2 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/licenses/AUTHORS +291 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/licenses/LICENSE +25 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/oberon.py +120 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/objective.py +513 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/ooc.py +84 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/openscad.py +96 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/other.py +41 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/parasail.py +78 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/parsers.py +798 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/pascal.py +644 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/pawn.py +202 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/pddl.py +82 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/perl.py +733 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/phix.py +363 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/php.py +334 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/pointless.py +70 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/pony.py +93 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/praat.py +303 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/procfile.py +41 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/prolog.py +318 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/promql.py +176 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/prql.py +251 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/ptx.py +119 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/python.py +1201 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/q.py +187 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/qlik.py +117 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/qvt.py +153 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/r.py +196 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/rdf.py +468 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/rebol.py +419 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/rego.py +57 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/resource.py +83 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/ride.py +138 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/rita.py +42 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/rnc.py +66 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/roboconf.py +81 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/robotframework.py +551 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/ruby.py +518 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/rust.py +222 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/sas.py +227 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/savi.py +171 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/scdoc.py +85 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/scripting.py +1616 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/sgf.py +59 -0
- miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/shell.py +902 -0
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/INSTALLER
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
pip
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/METADATA
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Metadata-Version: 2.4
|
| 2 |
+
Name: Pygments
|
| 3 |
+
Version: 2.19.2
|
| 4 |
+
Summary: Pygments is a syntax highlighting package written in Python.
|
| 5 |
+
Project-URL: Homepage, https://pygments.org
|
| 6 |
+
Project-URL: Documentation, https://pygments.org/docs
|
| 7 |
+
Project-URL: Source, https://github.com/pygments/pygments
|
| 8 |
+
Project-URL: Bug Tracker, https://github.com/pygments/pygments/issues
|
| 9 |
+
Project-URL: Changelog, https://github.com/pygments/pygments/blob/master/CHANGES
|
| 10 |
+
Author-email: Georg Brandl <georg@python.org>
|
| 11 |
+
Maintainer: Matthäus G. Chajdas
|
| 12 |
+
Maintainer-email: Georg Brandl <georg@python.org>, Jean Abou Samra <jean@abou-samra.fr>
|
| 13 |
+
License: BSD-2-Clause
|
| 14 |
+
License-File: AUTHORS
|
| 15 |
+
License-File: LICENSE
|
| 16 |
+
Keywords: syntax highlighting
|
| 17 |
+
Classifier: Development Status :: 6 - Mature
|
| 18 |
+
Classifier: Intended Audience :: Developers
|
| 19 |
+
Classifier: Intended Audience :: End Users/Desktop
|
| 20 |
+
Classifier: Intended Audience :: System Administrators
|
| 21 |
+
Classifier: License :: OSI Approved :: BSD License
|
| 22 |
+
Classifier: Operating System :: OS Independent
|
| 23 |
+
Classifier: Programming Language :: Python
|
| 24 |
+
Classifier: Programming Language :: Python :: 3
|
| 25 |
+
Classifier: Programming Language :: Python :: 3.8
|
| 26 |
+
Classifier: Programming Language :: Python :: 3.9
|
| 27 |
+
Classifier: Programming Language :: Python :: 3.10
|
| 28 |
+
Classifier: Programming Language :: Python :: 3.11
|
| 29 |
+
Classifier: Programming Language :: Python :: 3.12
|
| 30 |
+
Classifier: Programming Language :: Python :: 3.13
|
| 31 |
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
| 32 |
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
| 33 |
+
Classifier: Topic :: Text Processing :: Filters
|
| 34 |
+
Classifier: Topic :: Utilities
|
| 35 |
+
Requires-Python: >=3.8
|
| 36 |
+
Provides-Extra: plugins
|
| 37 |
+
Provides-Extra: windows-terminal
|
| 38 |
+
Requires-Dist: colorama>=0.4.6; extra == 'windows-terminal'
|
| 39 |
+
Description-Content-Type: text/x-rst
|
| 40 |
+
|
| 41 |
+
Pygments
|
| 42 |
+
~~~~~~~~
|
| 43 |
+
|
| 44 |
+
Pygments is a syntax highlighting package written in Python.
|
| 45 |
+
|
| 46 |
+
It is a generic syntax highlighter suitable for use in code hosting, forums,
|
| 47 |
+
wikis or other applications that need to prettify source code. Highlights
|
| 48 |
+
are:
|
| 49 |
+
|
| 50 |
+
* a wide range of over 500 languages and other text formats is supported
|
| 51 |
+
* special attention is paid to details, increasing quality by a fair amount
|
| 52 |
+
* support for new languages and formats are added easily
|
| 53 |
+
* a number of output formats, presently HTML, LaTeX, RTF, SVG, all image
|
| 54 |
+
formats that PIL supports and ANSI sequences
|
| 55 |
+
* it is usable as a command-line tool and as a library
|
| 56 |
+
|
| 57 |
+
Copyright 2006-2025 by the Pygments team, see ``AUTHORS``.
|
| 58 |
+
Licensed under the BSD, see ``LICENSE`` for details.
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/RECORD
ADDED
|
@@ -0,0 +1,684 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
../../../bin/pygmentize,sha256=8XeW1J8AeaahBy3ymyzli-gI5S0cxmt1pu4NRQhdBJI,224
|
| 2 |
+
pygments-2.19.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
| 3 |
+
pygments-2.19.2.dist-info/METADATA,sha256=euEA1n1nAGxkeYA92DX89HqbWfrHlEQeqOZqp_WYTYI,2512
|
| 4 |
+
pygments-2.19.2.dist-info/RECORD,,
|
| 5 |
+
pygments-2.19.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
| 6 |
+
pygments-2.19.2.dist-info/entry_points.txt,sha256=uUXw-XhMKBEX4pWcCtpuTTnPhL3h7OEE2jWi51VQsa8,53
|
| 7 |
+
pygments-2.19.2.dist-info/licenses/AUTHORS,sha256=BmDjGKbyFYAq3Icxq4XQxl_yfPzKP10oWX8wZHYZW9k,10824
|
| 8 |
+
pygments-2.19.2.dist-info/licenses/LICENSE,sha256=qdZvHVJt8C4p3Oc0NtNOVuhjL0bCdbvf_HBWnogvnxc,1331
|
| 9 |
+
pygments/__init__.py,sha256=_3UT86TGpHuW8FekdZ8uLidEZH1NhmcLiOy2KKNPCt4,2959
|
| 10 |
+
pygments/__main__.py,sha256=p8AJyoyCOMYGvzWHdnq0_A9qaaVqaj02nIu3xhJp1_4,348
|
| 11 |
+
pygments/__pycache__/__init__.cpython-310.pyc,,
|
| 12 |
+
pygments/__pycache__/__main__.cpython-310.pyc,,
|
| 13 |
+
pygments/__pycache__/cmdline.cpython-310.pyc,,
|
| 14 |
+
pygments/__pycache__/console.cpython-310.pyc,,
|
| 15 |
+
pygments/__pycache__/filter.cpython-310.pyc,,
|
| 16 |
+
pygments/__pycache__/formatter.cpython-310.pyc,,
|
| 17 |
+
pygments/__pycache__/lexer.cpython-310.pyc,,
|
| 18 |
+
pygments/__pycache__/modeline.cpython-310.pyc,,
|
| 19 |
+
pygments/__pycache__/plugin.cpython-310.pyc,,
|
| 20 |
+
pygments/__pycache__/regexopt.cpython-310.pyc,,
|
| 21 |
+
pygments/__pycache__/scanner.cpython-310.pyc,,
|
| 22 |
+
pygments/__pycache__/sphinxext.cpython-310.pyc,,
|
| 23 |
+
pygments/__pycache__/style.cpython-310.pyc,,
|
| 24 |
+
pygments/__pycache__/token.cpython-310.pyc,,
|
| 25 |
+
pygments/__pycache__/unistring.cpython-310.pyc,,
|
| 26 |
+
pygments/__pycache__/util.cpython-310.pyc,,
|
| 27 |
+
pygments/cmdline.py,sha256=4pL9Kpn2PUEKPobgrsQgg-vCx2NjsrapKzQ6LxQR7Q0,23536
|
| 28 |
+
pygments/console.py,sha256=AagDWqwea2yBWf10KC9ptBgMpMjxKp8yABAmh-NQOVk,1718
|
| 29 |
+
pygments/filter.py,sha256=YLtpTnZiu07nY3oK9nfR6E9Y1FBHhP5PX8gvkJWcfag,1910
|
| 30 |
+
pygments/filters/__init__.py,sha256=B00KqPCQh5E0XhzaDK74Qa1E4fDSTlD6b0Pvr1v-vEQ,40344
|
| 31 |
+
pygments/filters/__pycache__/__init__.cpython-310.pyc,,
|
| 32 |
+
pygments/formatter.py,sha256=H_4J-moKkKfRWUOW9J0u7hhw6n1LiO-2Xu1q2B0sE5w,4366
|
| 33 |
+
pygments/formatters/__init__.py,sha256=7OuvmoYLyoPzoOQV_brHG8GSKYB_wjFSkAQng6x2y9g,5349
|
| 34 |
+
pygments/formatters/__pycache__/__init__.cpython-310.pyc,,
|
| 35 |
+
pygments/formatters/__pycache__/_mapping.cpython-310.pyc,,
|
| 36 |
+
pygments/formatters/__pycache__/bbcode.cpython-310.pyc,,
|
| 37 |
+
pygments/formatters/__pycache__/groff.cpython-310.pyc,,
|
| 38 |
+
pygments/formatters/__pycache__/html.cpython-310.pyc,,
|
| 39 |
+
pygments/formatters/__pycache__/img.cpython-310.pyc,,
|
| 40 |
+
pygments/formatters/__pycache__/irc.cpython-310.pyc,,
|
| 41 |
+
pygments/formatters/__pycache__/latex.cpython-310.pyc,,
|
| 42 |
+
pygments/formatters/__pycache__/other.cpython-310.pyc,,
|
| 43 |
+
pygments/formatters/__pycache__/pangomarkup.cpython-310.pyc,,
|
| 44 |
+
pygments/formatters/__pycache__/rtf.cpython-310.pyc,,
|
| 45 |
+
pygments/formatters/__pycache__/svg.cpython-310.pyc,,
|
| 46 |
+
pygments/formatters/__pycache__/terminal.cpython-310.pyc,,
|
| 47 |
+
pygments/formatters/__pycache__/terminal256.cpython-310.pyc,,
|
| 48 |
+
pygments/formatters/_mapping.py,sha256=1Cw37FuQlNacnxRKmtlPX4nyLoX9_ttko5ZwscNUZZ4,4176
|
| 49 |
+
pygments/formatters/bbcode.py,sha256=s0Ka35OKuIchoSgEAGf6rj0rl2a9ym9L31JVNSRbZFQ,3296
|
| 50 |
+
pygments/formatters/groff.py,sha256=pLcIHj4jJS_lRAVFnyJODKDu1Xlyl9_AEIdOtbl3DT0,5082
|
| 51 |
+
pygments/formatters/html.py,sha256=FrHJ69FUliEyPY0zTfab0C1gPf7LXsKgeRlhwkniqIs,35953
|
| 52 |
+
pygments/formatters/img.py,sha256=aRpFo8mBmWTL3sBUjRCWkeS3rc6FZrSFC4EksDrl53g,23301
|
| 53 |
+
pygments/formatters/irc.py,sha256=R0Js0TYWySlI2yE9sW6tN4d4X-x3k9ZmudsijGPnLmU,4945
|
| 54 |
+
pygments/formatters/latex.py,sha256=BRYtbLeW_YD1kwhhnFInhJIKylurnri8CF1lP069KWE,19258
|
| 55 |
+
pygments/formatters/other.py,sha256=8pYW27sU_7XicLUqOEt2yWSO0h1IEUM3TIv34KODLwo,4986
|
| 56 |
+
pygments/formatters/pangomarkup.py,sha256=pcFvEC7K1Me0EjGeOZth4oCnEY85bfqc77XzZASEPpY,2206
|
| 57 |
+
pygments/formatters/rtf.py,sha256=kcKMCxTXu-2-hpgEftlGJRm7Ss-yA_Sy8OsHH_qzykA,11921
|
| 58 |
+
pygments/formatters/svg.py,sha256=R6A2ME6JsMQWFiyn8wcKwFUOD6vsu-HLwiIztLu-77E,7138
|
| 59 |
+
pygments/formatters/terminal.py,sha256=J_F_dFXwR9LHWvatIDnwqRYJyjVmSo1Zx8K_XDh6SyM,4626
|
| 60 |
+
pygments/formatters/terminal256.py,sha256=7GQFLE5cfmeu53CAzANO74-kBk2BFkXfn5phmZjYkhM,11717
|
| 61 |
+
pygments/lexer.py,sha256=ib-F_0GxHkwGpb6vWP0DeLMLc7EYgjo3hWFKN5IgOq0,35109
|
| 62 |
+
pygments/lexers/__init__.py,sha256=6YhzxGKlWk38P6JpIJUQ1rVvV0DEZjEmdYsdMQ58hSk,12067
|
| 63 |
+
pygments/lexers/__pycache__/__init__.cpython-310.pyc,,
|
| 64 |
+
pygments/lexers/__pycache__/_ada_builtins.cpython-310.pyc,,
|
| 65 |
+
pygments/lexers/__pycache__/_asy_builtins.cpython-310.pyc,,
|
| 66 |
+
pygments/lexers/__pycache__/_cl_builtins.cpython-310.pyc,,
|
| 67 |
+
pygments/lexers/__pycache__/_cocoa_builtins.cpython-310.pyc,,
|
| 68 |
+
pygments/lexers/__pycache__/_csound_builtins.cpython-310.pyc,,
|
| 69 |
+
pygments/lexers/__pycache__/_css_builtins.cpython-310.pyc,,
|
| 70 |
+
pygments/lexers/__pycache__/_googlesql_builtins.cpython-310.pyc,,
|
| 71 |
+
pygments/lexers/__pycache__/_julia_builtins.cpython-310.pyc,,
|
| 72 |
+
pygments/lexers/__pycache__/_lasso_builtins.cpython-310.pyc,,
|
| 73 |
+
pygments/lexers/__pycache__/_lilypond_builtins.cpython-310.pyc,,
|
| 74 |
+
pygments/lexers/__pycache__/_lua_builtins.cpython-310.pyc,,
|
| 75 |
+
pygments/lexers/__pycache__/_luau_builtins.cpython-310.pyc,,
|
| 76 |
+
pygments/lexers/__pycache__/_mapping.cpython-310.pyc,,
|
| 77 |
+
pygments/lexers/__pycache__/_mql_builtins.cpython-310.pyc,,
|
| 78 |
+
pygments/lexers/__pycache__/_mysql_builtins.cpython-310.pyc,,
|
| 79 |
+
pygments/lexers/__pycache__/_openedge_builtins.cpython-310.pyc,,
|
| 80 |
+
pygments/lexers/__pycache__/_php_builtins.cpython-310.pyc,,
|
| 81 |
+
pygments/lexers/__pycache__/_postgres_builtins.cpython-310.pyc,,
|
| 82 |
+
pygments/lexers/__pycache__/_qlik_builtins.cpython-310.pyc,,
|
| 83 |
+
pygments/lexers/__pycache__/_scheme_builtins.cpython-310.pyc,,
|
| 84 |
+
pygments/lexers/__pycache__/_scilab_builtins.cpython-310.pyc,,
|
| 85 |
+
pygments/lexers/__pycache__/_sourcemod_builtins.cpython-310.pyc,,
|
| 86 |
+
pygments/lexers/__pycache__/_sql_builtins.cpython-310.pyc,,
|
| 87 |
+
pygments/lexers/__pycache__/_stan_builtins.cpython-310.pyc,,
|
| 88 |
+
pygments/lexers/__pycache__/_stata_builtins.cpython-310.pyc,,
|
| 89 |
+
pygments/lexers/__pycache__/_tsql_builtins.cpython-310.pyc,,
|
| 90 |
+
pygments/lexers/__pycache__/_usd_builtins.cpython-310.pyc,,
|
| 91 |
+
pygments/lexers/__pycache__/_vbscript_builtins.cpython-310.pyc,,
|
| 92 |
+
pygments/lexers/__pycache__/_vim_builtins.cpython-310.pyc,,
|
| 93 |
+
pygments/lexers/__pycache__/actionscript.cpython-310.pyc,,
|
| 94 |
+
pygments/lexers/__pycache__/ada.cpython-310.pyc,,
|
| 95 |
+
pygments/lexers/__pycache__/agile.cpython-310.pyc,,
|
| 96 |
+
pygments/lexers/__pycache__/algebra.cpython-310.pyc,,
|
| 97 |
+
pygments/lexers/__pycache__/ambient.cpython-310.pyc,,
|
| 98 |
+
pygments/lexers/__pycache__/amdgpu.cpython-310.pyc,,
|
| 99 |
+
pygments/lexers/__pycache__/ampl.cpython-310.pyc,,
|
| 100 |
+
pygments/lexers/__pycache__/apdlexer.cpython-310.pyc,,
|
| 101 |
+
pygments/lexers/__pycache__/apl.cpython-310.pyc,,
|
| 102 |
+
pygments/lexers/__pycache__/archetype.cpython-310.pyc,,
|
| 103 |
+
pygments/lexers/__pycache__/arrow.cpython-310.pyc,,
|
| 104 |
+
pygments/lexers/__pycache__/arturo.cpython-310.pyc,,
|
| 105 |
+
pygments/lexers/__pycache__/asc.cpython-310.pyc,,
|
| 106 |
+
pygments/lexers/__pycache__/asm.cpython-310.pyc,,
|
| 107 |
+
pygments/lexers/__pycache__/asn1.cpython-310.pyc,,
|
| 108 |
+
pygments/lexers/__pycache__/automation.cpython-310.pyc,,
|
| 109 |
+
pygments/lexers/__pycache__/bare.cpython-310.pyc,,
|
| 110 |
+
pygments/lexers/__pycache__/basic.cpython-310.pyc,,
|
| 111 |
+
pygments/lexers/__pycache__/bdd.cpython-310.pyc,,
|
| 112 |
+
pygments/lexers/__pycache__/berry.cpython-310.pyc,,
|
| 113 |
+
pygments/lexers/__pycache__/bibtex.cpython-310.pyc,,
|
| 114 |
+
pygments/lexers/__pycache__/blueprint.cpython-310.pyc,,
|
| 115 |
+
pygments/lexers/__pycache__/boa.cpython-310.pyc,,
|
| 116 |
+
pygments/lexers/__pycache__/bqn.cpython-310.pyc,,
|
| 117 |
+
pygments/lexers/__pycache__/business.cpython-310.pyc,,
|
| 118 |
+
pygments/lexers/__pycache__/c_cpp.cpython-310.pyc,,
|
| 119 |
+
pygments/lexers/__pycache__/c_like.cpython-310.pyc,,
|
| 120 |
+
pygments/lexers/__pycache__/capnproto.cpython-310.pyc,,
|
| 121 |
+
pygments/lexers/__pycache__/carbon.cpython-310.pyc,,
|
| 122 |
+
pygments/lexers/__pycache__/cddl.cpython-310.pyc,,
|
| 123 |
+
pygments/lexers/__pycache__/chapel.cpython-310.pyc,,
|
| 124 |
+
pygments/lexers/__pycache__/clean.cpython-310.pyc,,
|
| 125 |
+
pygments/lexers/__pycache__/codeql.cpython-310.pyc,,
|
| 126 |
+
pygments/lexers/__pycache__/comal.cpython-310.pyc,,
|
| 127 |
+
pygments/lexers/__pycache__/compiled.cpython-310.pyc,,
|
| 128 |
+
pygments/lexers/__pycache__/configs.cpython-310.pyc,,
|
| 129 |
+
pygments/lexers/__pycache__/console.cpython-310.pyc,,
|
| 130 |
+
pygments/lexers/__pycache__/cplint.cpython-310.pyc,,
|
| 131 |
+
pygments/lexers/__pycache__/crystal.cpython-310.pyc,,
|
| 132 |
+
pygments/lexers/__pycache__/csound.cpython-310.pyc,,
|
| 133 |
+
pygments/lexers/__pycache__/css.cpython-310.pyc,,
|
| 134 |
+
pygments/lexers/__pycache__/d.cpython-310.pyc,,
|
| 135 |
+
pygments/lexers/__pycache__/dalvik.cpython-310.pyc,,
|
| 136 |
+
pygments/lexers/__pycache__/data.cpython-310.pyc,,
|
| 137 |
+
pygments/lexers/__pycache__/dax.cpython-310.pyc,,
|
| 138 |
+
pygments/lexers/__pycache__/devicetree.cpython-310.pyc,,
|
| 139 |
+
pygments/lexers/__pycache__/diff.cpython-310.pyc,,
|
| 140 |
+
pygments/lexers/__pycache__/dns.cpython-310.pyc,,
|
| 141 |
+
pygments/lexers/__pycache__/dotnet.cpython-310.pyc,,
|
| 142 |
+
pygments/lexers/__pycache__/dsls.cpython-310.pyc,,
|
| 143 |
+
pygments/lexers/__pycache__/dylan.cpython-310.pyc,,
|
| 144 |
+
pygments/lexers/__pycache__/ecl.cpython-310.pyc,,
|
| 145 |
+
pygments/lexers/__pycache__/eiffel.cpython-310.pyc,,
|
| 146 |
+
pygments/lexers/__pycache__/elm.cpython-310.pyc,,
|
| 147 |
+
pygments/lexers/__pycache__/elpi.cpython-310.pyc,,
|
| 148 |
+
pygments/lexers/__pycache__/email.cpython-310.pyc,,
|
| 149 |
+
pygments/lexers/__pycache__/erlang.cpython-310.pyc,,
|
| 150 |
+
pygments/lexers/__pycache__/esoteric.cpython-310.pyc,,
|
| 151 |
+
pygments/lexers/__pycache__/ezhil.cpython-310.pyc,,
|
| 152 |
+
pygments/lexers/__pycache__/factor.cpython-310.pyc,,
|
| 153 |
+
pygments/lexers/__pycache__/fantom.cpython-310.pyc,,
|
| 154 |
+
pygments/lexers/__pycache__/felix.cpython-310.pyc,,
|
| 155 |
+
pygments/lexers/__pycache__/fift.cpython-310.pyc,,
|
| 156 |
+
pygments/lexers/__pycache__/floscript.cpython-310.pyc,,
|
| 157 |
+
pygments/lexers/__pycache__/forth.cpython-310.pyc,,
|
| 158 |
+
pygments/lexers/__pycache__/fortran.cpython-310.pyc,,
|
| 159 |
+
pygments/lexers/__pycache__/foxpro.cpython-310.pyc,,
|
| 160 |
+
pygments/lexers/__pycache__/freefem.cpython-310.pyc,,
|
| 161 |
+
pygments/lexers/__pycache__/func.cpython-310.pyc,,
|
| 162 |
+
pygments/lexers/__pycache__/functional.cpython-310.pyc,,
|
| 163 |
+
pygments/lexers/__pycache__/futhark.cpython-310.pyc,,
|
| 164 |
+
pygments/lexers/__pycache__/gcodelexer.cpython-310.pyc,,
|
| 165 |
+
pygments/lexers/__pycache__/gdscript.cpython-310.pyc,,
|
| 166 |
+
pygments/lexers/__pycache__/gleam.cpython-310.pyc,,
|
| 167 |
+
pygments/lexers/__pycache__/go.cpython-310.pyc,,
|
| 168 |
+
pygments/lexers/__pycache__/grammar_notation.cpython-310.pyc,,
|
| 169 |
+
pygments/lexers/__pycache__/graph.cpython-310.pyc,,
|
| 170 |
+
pygments/lexers/__pycache__/graphics.cpython-310.pyc,,
|
| 171 |
+
pygments/lexers/__pycache__/graphql.cpython-310.pyc,,
|
| 172 |
+
pygments/lexers/__pycache__/graphviz.cpython-310.pyc,,
|
| 173 |
+
pygments/lexers/__pycache__/gsql.cpython-310.pyc,,
|
| 174 |
+
pygments/lexers/__pycache__/hare.cpython-310.pyc,,
|
| 175 |
+
pygments/lexers/__pycache__/haskell.cpython-310.pyc,,
|
| 176 |
+
pygments/lexers/__pycache__/haxe.cpython-310.pyc,,
|
| 177 |
+
pygments/lexers/__pycache__/hdl.cpython-310.pyc,,
|
| 178 |
+
pygments/lexers/__pycache__/hexdump.cpython-310.pyc,,
|
| 179 |
+
pygments/lexers/__pycache__/html.cpython-310.pyc,,
|
| 180 |
+
pygments/lexers/__pycache__/idl.cpython-310.pyc,,
|
| 181 |
+
pygments/lexers/__pycache__/igor.cpython-310.pyc,,
|
| 182 |
+
pygments/lexers/__pycache__/inferno.cpython-310.pyc,,
|
| 183 |
+
pygments/lexers/__pycache__/installers.cpython-310.pyc,,
|
| 184 |
+
pygments/lexers/__pycache__/int_fiction.cpython-310.pyc,,
|
| 185 |
+
pygments/lexers/__pycache__/iolang.cpython-310.pyc,,
|
| 186 |
+
pygments/lexers/__pycache__/j.cpython-310.pyc,,
|
| 187 |
+
pygments/lexers/__pycache__/javascript.cpython-310.pyc,,
|
| 188 |
+
pygments/lexers/__pycache__/jmespath.cpython-310.pyc,,
|
| 189 |
+
pygments/lexers/__pycache__/jslt.cpython-310.pyc,,
|
| 190 |
+
pygments/lexers/__pycache__/json5.cpython-310.pyc,,
|
| 191 |
+
pygments/lexers/__pycache__/jsonnet.cpython-310.pyc,,
|
| 192 |
+
pygments/lexers/__pycache__/jsx.cpython-310.pyc,,
|
| 193 |
+
pygments/lexers/__pycache__/julia.cpython-310.pyc,,
|
| 194 |
+
pygments/lexers/__pycache__/jvm.cpython-310.pyc,,
|
| 195 |
+
pygments/lexers/__pycache__/kuin.cpython-310.pyc,,
|
| 196 |
+
pygments/lexers/__pycache__/kusto.cpython-310.pyc,,
|
| 197 |
+
pygments/lexers/__pycache__/ldap.cpython-310.pyc,,
|
| 198 |
+
pygments/lexers/__pycache__/lean.cpython-310.pyc,,
|
| 199 |
+
pygments/lexers/__pycache__/lilypond.cpython-310.pyc,,
|
| 200 |
+
pygments/lexers/__pycache__/lisp.cpython-310.pyc,,
|
| 201 |
+
pygments/lexers/__pycache__/macaulay2.cpython-310.pyc,,
|
| 202 |
+
pygments/lexers/__pycache__/make.cpython-310.pyc,,
|
| 203 |
+
pygments/lexers/__pycache__/maple.cpython-310.pyc,,
|
| 204 |
+
pygments/lexers/__pycache__/markup.cpython-310.pyc,,
|
| 205 |
+
pygments/lexers/__pycache__/math.cpython-310.pyc,,
|
| 206 |
+
pygments/lexers/__pycache__/matlab.cpython-310.pyc,,
|
| 207 |
+
pygments/lexers/__pycache__/maxima.cpython-310.pyc,,
|
| 208 |
+
pygments/lexers/__pycache__/meson.cpython-310.pyc,,
|
| 209 |
+
pygments/lexers/__pycache__/mime.cpython-310.pyc,,
|
| 210 |
+
pygments/lexers/__pycache__/minecraft.cpython-310.pyc,,
|
| 211 |
+
pygments/lexers/__pycache__/mips.cpython-310.pyc,,
|
| 212 |
+
pygments/lexers/__pycache__/ml.cpython-310.pyc,,
|
| 213 |
+
pygments/lexers/__pycache__/modeling.cpython-310.pyc,,
|
| 214 |
+
pygments/lexers/__pycache__/modula2.cpython-310.pyc,,
|
| 215 |
+
pygments/lexers/__pycache__/mojo.cpython-310.pyc,,
|
| 216 |
+
pygments/lexers/__pycache__/monte.cpython-310.pyc,,
|
| 217 |
+
pygments/lexers/__pycache__/mosel.cpython-310.pyc,,
|
| 218 |
+
pygments/lexers/__pycache__/ncl.cpython-310.pyc,,
|
| 219 |
+
pygments/lexers/__pycache__/nimrod.cpython-310.pyc,,
|
| 220 |
+
pygments/lexers/__pycache__/nit.cpython-310.pyc,,
|
| 221 |
+
pygments/lexers/__pycache__/nix.cpython-310.pyc,,
|
| 222 |
+
pygments/lexers/__pycache__/numbair.cpython-310.pyc,,
|
| 223 |
+
pygments/lexers/__pycache__/oberon.cpython-310.pyc,,
|
| 224 |
+
pygments/lexers/__pycache__/objective.cpython-310.pyc,,
|
| 225 |
+
pygments/lexers/__pycache__/ooc.cpython-310.pyc,,
|
| 226 |
+
pygments/lexers/__pycache__/openscad.cpython-310.pyc,,
|
| 227 |
+
pygments/lexers/__pycache__/other.cpython-310.pyc,,
|
| 228 |
+
pygments/lexers/__pycache__/parasail.cpython-310.pyc,,
|
| 229 |
+
pygments/lexers/__pycache__/parsers.cpython-310.pyc,,
|
| 230 |
+
pygments/lexers/__pycache__/pascal.cpython-310.pyc,,
|
| 231 |
+
pygments/lexers/__pycache__/pawn.cpython-310.pyc,,
|
| 232 |
+
pygments/lexers/__pycache__/pddl.cpython-310.pyc,,
|
| 233 |
+
pygments/lexers/__pycache__/perl.cpython-310.pyc,,
|
| 234 |
+
pygments/lexers/__pycache__/phix.cpython-310.pyc,,
|
| 235 |
+
pygments/lexers/__pycache__/php.cpython-310.pyc,,
|
| 236 |
+
pygments/lexers/__pycache__/pointless.cpython-310.pyc,,
|
| 237 |
+
pygments/lexers/__pycache__/pony.cpython-310.pyc,,
|
| 238 |
+
pygments/lexers/__pycache__/praat.cpython-310.pyc,,
|
| 239 |
+
pygments/lexers/__pycache__/procfile.cpython-310.pyc,,
|
| 240 |
+
pygments/lexers/__pycache__/prolog.cpython-310.pyc,,
|
| 241 |
+
pygments/lexers/__pycache__/promql.cpython-310.pyc,,
|
| 242 |
+
pygments/lexers/__pycache__/prql.cpython-310.pyc,,
|
| 243 |
+
pygments/lexers/__pycache__/ptx.cpython-310.pyc,,
|
| 244 |
+
pygments/lexers/__pycache__/python.cpython-310.pyc,,
|
| 245 |
+
pygments/lexers/__pycache__/q.cpython-310.pyc,,
|
| 246 |
+
pygments/lexers/__pycache__/qlik.cpython-310.pyc,,
|
| 247 |
+
pygments/lexers/__pycache__/qvt.cpython-310.pyc,,
|
| 248 |
+
pygments/lexers/__pycache__/r.cpython-310.pyc,,
|
| 249 |
+
pygments/lexers/__pycache__/rdf.cpython-310.pyc,,
|
| 250 |
+
pygments/lexers/__pycache__/rebol.cpython-310.pyc,,
|
| 251 |
+
pygments/lexers/__pycache__/rego.cpython-310.pyc,,
|
| 252 |
+
pygments/lexers/__pycache__/resource.cpython-310.pyc,,
|
| 253 |
+
pygments/lexers/__pycache__/ride.cpython-310.pyc,,
|
| 254 |
+
pygments/lexers/__pycache__/rita.cpython-310.pyc,,
|
| 255 |
+
pygments/lexers/__pycache__/rnc.cpython-310.pyc,,
|
| 256 |
+
pygments/lexers/__pycache__/roboconf.cpython-310.pyc,,
|
| 257 |
+
pygments/lexers/__pycache__/robotframework.cpython-310.pyc,,
|
| 258 |
+
pygments/lexers/__pycache__/ruby.cpython-310.pyc,,
|
| 259 |
+
pygments/lexers/__pycache__/rust.cpython-310.pyc,,
|
| 260 |
+
pygments/lexers/__pycache__/sas.cpython-310.pyc,,
|
| 261 |
+
pygments/lexers/__pycache__/savi.cpython-310.pyc,,
|
| 262 |
+
pygments/lexers/__pycache__/scdoc.cpython-310.pyc,,
|
| 263 |
+
pygments/lexers/__pycache__/scripting.cpython-310.pyc,,
|
| 264 |
+
pygments/lexers/__pycache__/sgf.cpython-310.pyc,,
|
| 265 |
+
pygments/lexers/__pycache__/shell.cpython-310.pyc,,
|
| 266 |
+
pygments/lexers/__pycache__/sieve.cpython-310.pyc,,
|
| 267 |
+
pygments/lexers/__pycache__/slash.cpython-310.pyc,,
|
| 268 |
+
pygments/lexers/__pycache__/smalltalk.cpython-310.pyc,,
|
| 269 |
+
pygments/lexers/__pycache__/smithy.cpython-310.pyc,,
|
| 270 |
+
pygments/lexers/__pycache__/smv.cpython-310.pyc,,
|
| 271 |
+
pygments/lexers/__pycache__/snobol.cpython-310.pyc,,
|
| 272 |
+
pygments/lexers/__pycache__/solidity.cpython-310.pyc,,
|
| 273 |
+
pygments/lexers/__pycache__/soong.cpython-310.pyc,,
|
| 274 |
+
pygments/lexers/__pycache__/sophia.cpython-310.pyc,,
|
| 275 |
+
pygments/lexers/__pycache__/special.cpython-310.pyc,,
|
| 276 |
+
pygments/lexers/__pycache__/spice.cpython-310.pyc,,
|
| 277 |
+
pygments/lexers/__pycache__/sql.cpython-310.pyc,,
|
| 278 |
+
pygments/lexers/__pycache__/srcinfo.cpython-310.pyc,,
|
| 279 |
+
pygments/lexers/__pycache__/stata.cpython-310.pyc,,
|
| 280 |
+
pygments/lexers/__pycache__/supercollider.cpython-310.pyc,,
|
| 281 |
+
pygments/lexers/__pycache__/tablegen.cpython-310.pyc,,
|
| 282 |
+
pygments/lexers/__pycache__/tact.cpython-310.pyc,,
|
| 283 |
+
pygments/lexers/__pycache__/tal.cpython-310.pyc,,
|
| 284 |
+
pygments/lexers/__pycache__/tcl.cpython-310.pyc,,
|
| 285 |
+
pygments/lexers/__pycache__/teal.cpython-310.pyc,,
|
| 286 |
+
pygments/lexers/__pycache__/templates.cpython-310.pyc,,
|
| 287 |
+
pygments/lexers/__pycache__/teraterm.cpython-310.pyc,,
|
| 288 |
+
pygments/lexers/__pycache__/testing.cpython-310.pyc,,
|
| 289 |
+
pygments/lexers/__pycache__/text.cpython-310.pyc,,
|
| 290 |
+
pygments/lexers/__pycache__/textedit.cpython-310.pyc,,
|
| 291 |
+
pygments/lexers/__pycache__/textfmts.cpython-310.pyc,,
|
| 292 |
+
pygments/lexers/__pycache__/theorem.cpython-310.pyc,,
|
| 293 |
+
pygments/lexers/__pycache__/thingsdb.cpython-310.pyc,,
|
| 294 |
+
pygments/lexers/__pycache__/tlb.cpython-310.pyc,,
|
| 295 |
+
pygments/lexers/__pycache__/tls.cpython-310.pyc,,
|
| 296 |
+
pygments/lexers/__pycache__/tnt.cpython-310.pyc,,
|
| 297 |
+
pygments/lexers/__pycache__/trafficscript.cpython-310.pyc,,
|
| 298 |
+
pygments/lexers/__pycache__/typoscript.cpython-310.pyc,,
|
| 299 |
+
pygments/lexers/__pycache__/typst.cpython-310.pyc,,
|
| 300 |
+
pygments/lexers/__pycache__/ul4.cpython-310.pyc,,
|
| 301 |
+
pygments/lexers/__pycache__/unicon.cpython-310.pyc,,
|
| 302 |
+
pygments/lexers/__pycache__/urbi.cpython-310.pyc,,
|
| 303 |
+
pygments/lexers/__pycache__/usd.cpython-310.pyc,,
|
| 304 |
+
pygments/lexers/__pycache__/varnish.cpython-310.pyc,,
|
| 305 |
+
pygments/lexers/__pycache__/verification.cpython-310.pyc,,
|
| 306 |
+
pygments/lexers/__pycache__/verifpal.cpython-310.pyc,,
|
| 307 |
+
pygments/lexers/__pycache__/vip.cpython-310.pyc,,
|
| 308 |
+
pygments/lexers/__pycache__/vyper.cpython-310.pyc,,
|
| 309 |
+
pygments/lexers/__pycache__/web.cpython-310.pyc,,
|
| 310 |
+
pygments/lexers/__pycache__/webassembly.cpython-310.pyc,,
|
| 311 |
+
pygments/lexers/__pycache__/webidl.cpython-310.pyc,,
|
| 312 |
+
pygments/lexers/__pycache__/webmisc.cpython-310.pyc,,
|
| 313 |
+
pygments/lexers/__pycache__/wgsl.cpython-310.pyc,,
|
| 314 |
+
pygments/lexers/__pycache__/whiley.cpython-310.pyc,,
|
| 315 |
+
pygments/lexers/__pycache__/wowtoc.cpython-310.pyc,,
|
| 316 |
+
pygments/lexers/__pycache__/wren.cpython-310.pyc,,
|
| 317 |
+
pygments/lexers/__pycache__/x10.cpython-310.pyc,,
|
| 318 |
+
pygments/lexers/__pycache__/xorg.cpython-310.pyc,,
|
| 319 |
+
pygments/lexers/__pycache__/yang.cpython-310.pyc,,
|
| 320 |
+
pygments/lexers/__pycache__/yara.cpython-310.pyc,,
|
| 321 |
+
pygments/lexers/__pycache__/zig.cpython-310.pyc,,
|
| 322 |
+
pygments/lexers/_ada_builtins.py,sha256=CA_OnShtdc7wWh9oYcRlcrkDAQwYUKl6w7tdSbALQd4,1543
|
| 323 |
+
pygments/lexers/_asy_builtins.py,sha256=cd9M00YH19w5ZL7aqucmC3nwpJGTS04U-01NLy5E2_4,27287
|
| 324 |
+
pygments/lexers/_cl_builtins.py,sha256=kQeUIyZjP4kX0frkICDcKxBYQCLqzIDXa5WV5cevhDo,13994
|
| 325 |
+
pygments/lexers/_cocoa_builtins.py,sha256=Ka1lLJe7JfWtdho4IFIB82X9yBvrbfHCCmEG-peXXhQ,105173
|
| 326 |
+
pygments/lexers/_csound_builtins.py,sha256=qnQYKeI26ZHim316uqy_hDiRiCoHo2RHjD3sYBALyXs,18414
|
| 327 |
+
pygments/lexers/_css_builtins.py,sha256=aD-dhLFXVd1Atn_bZd7gEdQn7Mhe60_VHpvZ340WzDI,12446
|
| 328 |
+
pygments/lexers/_googlesql_builtins.py,sha256=IkrOk-T2v1yzbGzUEEQh5_Cf4uC_cmL_uuhwDpZlTug,16132
|
| 329 |
+
pygments/lexers/_julia_builtins.py,sha256=N2WdSw5zgI2fhDat_i4YeVqurRTC_P8x71ez00SCN6U,11883
|
| 330 |
+
pygments/lexers/_lasso_builtins.py,sha256=8q1gbsrMJeaeUhxIYKhaOxC9j_B-NBpq_XFj2Ze41X0,134510
|
| 331 |
+
pygments/lexers/_lilypond_builtins.py,sha256=XTbGL1z1oKMoqWLEktG33jx5GdGTI9CpeO5NheEi4Y0,108094
|
| 332 |
+
pygments/lexers/_lua_builtins.py,sha256=PhFdZV5-Tzz2j_q4lvG9lr84ELGfL41BhnrSDNNTaG4,8108
|
| 333 |
+
pygments/lexers/_luau_builtins.py,sha256=-IDrU04kUVfjXwSQzMMpXmMYhNsQxZVVZk8cuAA0Lo0,955
|
| 334 |
+
pygments/lexers/_mapping.py,sha256=9fv7xYOUAOr6LzfdFS4MDbPu78o4OQQH-2nsI1bNZf4,70438
|
| 335 |
+
pygments/lexers/_mql_builtins.py,sha256=ybRQjlb7Cul0sDstnzxJl3h0qS6Ieqsr811fqrxyumU,24713
|
| 336 |
+
pygments/lexers/_mysql_builtins.py,sha256=y0kAWZVAs0z2dTFJJV42OZpILgRnd8T3zSlBFv-g_oA,25838
|
| 337 |
+
pygments/lexers/_openedge_builtins.py,sha256=Sz4j9-CPWIaxMa-2fZgY66j7igcu1ob1GR2UtI8zAkg,49398
|
| 338 |
+
pygments/lexers/_php_builtins.py,sha256=Jd4BZpjMDELPi4EVoSxK1-8BFTc63HUwYfm1rLrGj0M,107922
|
| 339 |
+
pygments/lexers/_postgres_builtins.py,sha256=Pqh4z0RBRbnW6rCQtWUdzWCJxNyqpJ7_0HOktxHDxk4,13343
|
| 340 |
+
pygments/lexers/_qlik_builtins.py,sha256=xuJy9c9uZDXv6h8z582P5PrxqkxTZ_nS8gPl9OD9VN8,12595
|
| 341 |
+
pygments/lexers/_scheme_builtins.py,sha256=2hNtJOJmP21lUsikpqMJ2gAmLT3Rwn_KEeqhXwCjgfk,32564
|
| 342 |
+
pygments/lexers/_scilab_builtins.py,sha256=oZYPB1XPdIEz3pII11pFDe6extRRyWGA7pY06X8KZ8w,52411
|
| 343 |
+
pygments/lexers/_sourcemod_builtins.py,sha256=H8AFLsNDdEpymIWOpDwbDJGCP1w-x-1gSlzPDioMF4o,26777
|
| 344 |
+
pygments/lexers/_sql_builtins.py,sha256=oe8F9wWuO2iS6nEsZAdJtCUChBTjgM1Sq_aipu74jXM,6767
|
| 345 |
+
pygments/lexers/_stan_builtins.py,sha256=dwi1hllM_NsaCv-aXJy7lEi57X5Hh5gSD97aCQyT9KM,13445
|
| 346 |
+
pygments/lexers/_stata_builtins.py,sha256=Hqrr6j77zWU3cGGpBPohwexZci43YA4_sVYE4E1sNow,27227
|
| 347 |
+
pygments/lexers/_tsql_builtins.py,sha256=Pi2RhTXcLE3glI9oxNhyVsOMn-fK_1TRxJ-EsYP5LcI,15460
|
| 348 |
+
pygments/lexers/_usd_builtins.py,sha256=c9hbU1cwqBUCFIhNfu_Dob8ywv1rlPhi9w2OTj3kR8s,1658
|
| 349 |
+
pygments/lexers/_vbscript_builtins.py,sha256=MqJ2ABywD21aSRtWYZRG64CCbGstC1kfsiHGJmZzxiw,4225
|
| 350 |
+
pygments/lexers/_vim_builtins.py,sha256=bA4mH8t1mPPQfEiUCKEqRO1O0rL2DUG0Ux1Bt8ZSu0E,57066
|
| 351 |
+
pygments/lexers/actionscript.py,sha256=JBngCe5UhYT_0dLD2j7PnPO0xRRJhmypEuQ-C5in8pY,11727
|
| 352 |
+
pygments/lexers/ada.py,sha256=58k5ra1vGS4iLpW3h1ItY9ftzF3WevaeAAXzAYTiYkQ,5353
|
| 353 |
+
pygments/lexers/agile.py,sha256=DN-7AVIqtG1MshA94rtSGYI_884hVHgzq405wD0_dl8,896
|
| 354 |
+
pygments/lexers/algebra.py,sha256=yGTu9Tt-cQzAISQYIC5MS5a3z4QmL-tGcXnd_pkWGbk,9952
|
| 355 |
+
pygments/lexers/ambient.py,sha256=UnzKpIlfSm3iitHvMd7XTMSY8TjZYYhKOC3AiARS_cE,2605
|
| 356 |
+
pygments/lexers/amdgpu.py,sha256=S8qjn2UMLhBFm3Yn_c06XAGf8cl5x_ZeluelWG_-JAw,1723
|
| 357 |
+
pygments/lexers/ampl.py,sha256=ZBRfDXm760gR1a1gqItnsHuoO3JdUcTBjJ5tFY9UtPA,4176
|
| 358 |
+
pygments/lexers/apdlexer.py,sha256=Zr5-jgjxC8PKzRlEeclakZXPHci7FHBZghQ6wwiuT7A,30800
|
| 359 |
+
pygments/lexers/apl.py,sha256=PTQMp-bxT5P-DbrEvFha10HBTcsDJ5srL3I1s9ljz58,3404
|
| 360 |
+
pygments/lexers/archetype.py,sha256=pQVlP1Fb5OA8nn7QwmFaaaOSvvpoIsQVw43FVCQCve4,11538
|
| 361 |
+
pygments/lexers/arrow.py,sha256=2PKdbWq3xQLF1KoDbWvSxpjwKRrznnDiArTflRGZzBo,3564
|
| 362 |
+
pygments/lexers/arturo.py,sha256=U5MtRNHJtnBn4ZOeWmW6MKlVRG7SX6KhTRamDqzn9tA,11414
|
| 363 |
+
pygments/lexers/asc.py,sha256=-DgZl9jccBDHPlDmjCsrEqx0-Q7ap7XVdNKtxLNWG1w,1693
|
| 364 |
+
pygments/lexers/asm.py,sha256=xm2Y5mcT-sF3oQvair4SWs9EWTyndoaUoSsDy5v6shI,41967
|
| 365 |
+
pygments/lexers/asn1.py,sha256=BlcloIX2bu6Q7BxGcksuhYFHGsXLVKyB4B9mFd4Pj6E,4262
|
| 366 |
+
pygments/lexers/automation.py,sha256=Q61qon8EwpfakMh_2MS2E2zUUT16rG3UNIKPYjITeTs,19831
|
| 367 |
+
pygments/lexers/bare.py,sha256=tWoei86JJX1k-ADhaXd5TgX6ItDTici9yFWpkTPhnfM,3020
|
| 368 |
+
pygments/lexers/basic.py,sha256=qpVe5h8Fa7NJo1EihN-4R_UZpHO6my2Ssgkb-BktkKs,27989
|
| 369 |
+
pygments/lexers/bdd.py,sha256=yysefcOFAEyk9kJ2y4EXmzJTecgLYUHlWixt_3YzPMU,1641
|
| 370 |
+
pygments/lexers/berry.py,sha256=zxGowFb8HMIyN15-m8nmWnW6bPRR4esKtSEVugc9uXM,3209
|
| 371 |
+
pygments/lexers/bibtex.py,sha256=yuNoPxwrJf9DCGUT17hxfDzbq_HtCLkQkRbBtiTVmeQ,4811
|
| 372 |
+
pygments/lexers/blueprint.py,sha256=NzvWHMxCLDWt8hc6gB5jokltxVJgNa7Jwh4c61ng388,6188
|
| 373 |
+
pygments/lexers/boa.py,sha256=dOot1XWNZThPIio2UyAX67K6EpISjSRCFjotD7dcnwE,3921
|
| 374 |
+
pygments/lexers/bqn.py,sha256=nJiwrPKKbRF-qdai5tfqipwBkkko2P3weiZAjHUMimY,3671
|
| 375 |
+
pygments/lexers/business.py,sha256=lRtekOJfsDkb12AGbuz10-G67OJrVJgCBtihTQ8_aoY,28345
|
| 376 |
+
pygments/lexers/c_cpp.py,sha256=D7ZIswaHASlGBgoTlwnSqTQHf8_JyvvSt2L2q1W-F6g,18059
|
| 377 |
+
pygments/lexers/c_like.py,sha256=FTGp17ds6X2rDZOHup2hH6BEn3gKK4nLm9pydNEhm0E,32021
|
| 378 |
+
pygments/lexers/capnproto.py,sha256=XQJAh1WS-0ulqbTn9TdzR6gEgWLcuBqb4sj3jNsrhsY,2174
|
| 379 |
+
pygments/lexers/carbon.py,sha256=av12YuTGZGpOa1Cmxp3lppx3LfSJUWbvOu0ixmUVll0,3211
|
| 380 |
+
pygments/lexers/cddl.py,sha256=MKa70IwABgjBjYu15_Q9v8rsu2sr1a-i2jkiaPTI6sM,5076
|
| 381 |
+
pygments/lexers/chapel.py,sha256=0n_fL3ehLC4pw4YKnmq9jxIXOJcxGPka1Wr1t1zsXPc,5156
|
| 382 |
+
pygments/lexers/clean.py,sha256=dkDPAwF5BTALPeuKFoRKOSD3RfsKcGWbaRo6_G8LHng,6418
|
| 383 |
+
pygments/lexers/codeql.py,sha256=ebvghn2zbrnETV4buVozMDmRCVKSdGiIN8ycLlHpGsE,2576
|
| 384 |
+
pygments/lexers/comal.py,sha256=TC3NzcJ58ew5jw7qwK0kJ-okTA47psZje0yAIS39HR4,3179
|
| 385 |
+
pygments/lexers/compiled.py,sha256=Slfo1sjWqcPawUwf0dIIZLBCL5pkOIoAX2S8Lxs02Mc,1426
|
| 386 |
+
pygments/lexers/configs.py,sha256=wW8pY0Sa5a10pnAeTLGf48HhixQTVageIyHEf1aYMCc,50913
|
| 387 |
+
pygments/lexers/console.py,sha256=-jAG120dupvV3kG3zC70brLJvSLwTFqMubBQuj_GVnU,4180
|
| 388 |
+
pygments/lexers/cplint.py,sha256=DkbyE5EKydLgf6BRr1FhQrK-IeQPL7Zmjk0DVdlRFnQ,1389
|
| 389 |
+
pygments/lexers/crystal.py,sha256=xU-RnpIkpjrquoxtOuOcP8fcesSJl4xhU7kO9m42LZY,15754
|
| 390 |
+
pygments/lexers/csound.py,sha256=ioSw4Q04wdwjUAbnTZ1qLhUq1vxdWFxhh3QtEl5RAJc,16998
|
| 391 |
+
pygments/lexers/css.py,sha256=JN1RBYsee-jrpHWrSmhN3TKc4TkOBn-_BEGpgTCzcqE,25376
|
| 392 |
+
pygments/lexers/d.py,sha256=piOy0EJeiAwPHugiM3gVv0z7HNh3u2gZQoCUSASRbY4,9920
|
| 393 |
+
pygments/lexers/dalvik.py,sha256=deFg2JPBktJ9mEGb9EgxNkmd6vaMjJFQVzUHo8NKIa8,4606
|
| 394 |
+
pygments/lexers/data.py,sha256=o0x0SmB5ms_CPUPljEEEenOON4IQWn86DkwFjkJYCOg,27026
|
| 395 |
+
pygments/lexers/dax.py,sha256=ASi73qmr7OA7cVZXF2GTYGt01Ly1vY8CgD_Pnpm8k-4,8098
|
| 396 |
+
pygments/lexers/devicetree.py,sha256=RecSQCidt8DRE1QFCPUbwwR0hiRlNtsFihdGldeUn3k,4019
|
| 397 |
+
pygments/lexers/diff.py,sha256=F6vxZ64wm5Nag_97de1H_3F700ZwCVnYjKvtT5jilww,5382
|
| 398 |
+
pygments/lexers/dns.py,sha256=Hh5hJ7MXfrq36KgfyIRwK3X8o1LdR98IKERcV4eZ7HY,3891
|
| 399 |
+
pygments/lexers/dotnet.py,sha256=NDE0kOmpe96GLO-zwNLazmj77E9ORGmKpa4ZMCXDXxQ,39441
|
| 400 |
+
pygments/lexers/dsls.py,sha256=GnHKhGL5GxsRFnqC7-65NTPZLOZdmnllNrGP86x_fQE,36746
|
| 401 |
+
pygments/lexers/dylan.py,sha256=7zZ1EbHWXeVHqTD36AqykKqo3fhuIh4sM-whcxUaH_Y,10409
|
| 402 |
+
pygments/lexers/ecl.py,sha256=vhmpa2LBrHxsPkYcf3kPZ1ItVaLRDTebi186wY0xGZA,6371
|
| 403 |
+
pygments/lexers/eiffel.py,sha256=5ydYIEFcgcMoEj4BlK31hZ0aJb8OX0RdAvuCNdlxwqw,2690
|
| 404 |
+
pygments/lexers/elm.py,sha256=uRCddU8jK5vVkH6Y66y8KOsDJprIfrOgeYq3hv1PxAM,3152
|
| 405 |
+
pygments/lexers/elpi.py,sha256=O9j_WKBPyvNFjCRuPciVpW4etVSnILm_T79BhCPZYmo,6877
|
| 406 |
+
pygments/lexers/email.py,sha256=ZZL6yvwCRl1CEQyysuOu0lbabp5tjMutS7f3efFKGR4,4804
|
| 407 |
+
pygments/lexers/erlang.py,sha256=bU11eVHvooLwmVknzN6Xkb2DMk7HbenqdNlYSzhThDM,19147
|
| 408 |
+
pygments/lexers/esoteric.py,sha256=Jfp8UUKyKYsqLaqXRZT3GSM9dzkF65zduwfnH1GoGhU,10500
|
| 409 |
+
pygments/lexers/ezhil.py,sha256=22r-xjvvBVpExTqCI-HycAwunDb1p5gY4tIfDmM0vDw,3272
|
| 410 |
+
pygments/lexers/factor.py,sha256=urZ4En4uKFCLXdEkXLWg9EYUFGHQTTDCwNXtyq-ngok,19530
|
| 411 |
+
pygments/lexers/fantom.py,sha256=JJ13-NwykD-iIESnuzCefCYeQDO95cHMJA8TasF4gHA,10231
|
| 412 |
+
pygments/lexers/felix.py,sha256=F-v0si4zPtRelqzDQWXI1-tarCE-BvawziODxRU7378,9655
|
| 413 |
+
pygments/lexers/fift.py,sha256=rOCwp3v5ocK5YOWvt7Td3Md--97_8e-7Sonx52uS8mA,1644
|
| 414 |
+
pygments/lexers/floscript.py,sha256=aHh82k52jMuDuzl9LatrcSANJiXTCyjGU3SO53bwbb0,2667
|
| 415 |
+
pygments/lexers/forth.py,sha256=ZMtsHdNbnS_0IdSYlfAlfTSPEr0MEsRo-YZriQNueTQ,7193
|
| 416 |
+
pygments/lexers/fortran.py,sha256=1PE5dTxf4Df6LUeXFcmNtyeXWsC8tSiK5dYwPHIJeeQ,10382
|
| 417 |
+
pygments/lexers/foxpro.py,sha256=CBkW62Fuibz3yfyelZCaEO8GGdFJWsuRhqwtsSeBwLM,26295
|
| 418 |
+
pygments/lexers/freefem.py,sha256=LFBQk-m1-nNCgrl-VDH3QwnVWurvb7W29i06LoT207A,26913
|
| 419 |
+
pygments/lexers/func.py,sha256=OR2rkM7gf9fKvad5WcFQln-_U_pb-RUCM9eQatToF4A,3700
|
| 420 |
+
pygments/lexers/functional.py,sha256=fYT2AGZ642cRkIAId0rnXFBsx1c8LLEDRN_VuCEkUyM,693
|
| 421 |
+
pygments/lexers/futhark.py,sha256=Vf1i4t-tR3zqaktVjhTzFNg_ts_9CcyA4ZDfDizbCmk,3743
|
| 422 |
+
pygments/lexers/gcodelexer.py,sha256=4Xs9ax4-JZGupW_qSnHon39wQGpb-tNA3xorMKg841E,874
|
| 423 |
+
pygments/lexers/gdscript.py,sha256=Ws7JKxy0M0IyZ_1iMfRvJPrizEwmeCNLDoeMIFaM-CU,7566
|
| 424 |
+
pygments/lexers/gleam.py,sha256=XIlTcq6cB743pCqbNYo8PocSkjZyDPR6hHgdaJNJ1Vc,2392
|
| 425 |
+
pygments/lexers/go.py,sha256=4LezefgyuqZWHzLZHieUkKTi-ssY6aHJxx7Z-LFaLK0,3783
|
| 426 |
+
pygments/lexers/grammar_notation.py,sha256=LvzhRQHgwZzq9oceukZS_hwnKK58ee7Z5d0cwXOR734,8043
|
| 427 |
+
pygments/lexers/graph.py,sha256=WFqoPA1c_hHYrV0i_F7-eUw3Co4_HmZY3GJ-TyDr670,4108
|
| 428 |
+
pygments/lexers/graphics.py,sha256=tmF9NNALnvPnax8ywYC3pLOla45YXtp9UA0H-5EiTQY,39145
|
| 429 |
+
pygments/lexers/graphql.py,sha256=O_zcrGrBaDaKTlUoJGRruxqk7CJi-NR92Y0Cs-KkCvw,5601
|
| 430 |
+
pygments/lexers/graphviz.py,sha256=mzdXOMpwz9_V-be1eTAMyhkKCBl6UxCIXuq6C2yrtsw,1934
|
| 431 |
+
pygments/lexers/gsql.py,sha256=VPZk9sb26-DumRkWfEaSTeoc0lx5xt5n-6eDDLezMtc,3990
|
| 432 |
+
pygments/lexers/hare.py,sha256=PGCOuILktJsmtTpCZZKkMFtObfJuBpei8HM8HHuq1Tw,2649
|
| 433 |
+
pygments/lexers/haskell.py,sha256=MYr74-PAC8kGJRX-dZmvZsHTc7a2u6yFS2B19LfDD7g,33262
|
| 434 |
+
pygments/lexers/haxe.py,sha256=WHCy_nrXHnfLITfbdp3Ji3lqQU4HAsTUpXsLCp2_4sk,30974
|
| 435 |
+
pygments/lexers/hdl.py,sha256=MOWxhmAuE4Ei0CKDqqaON7T8tl43geancrNYM136Z0U,22738
|
| 436 |
+
pygments/lexers/hexdump.py,sha256=1lj9oJ-KiZXSVYvTMfGmEAQzNEW08WlMcC2I5aYvHK4,3653
|
| 437 |
+
pygments/lexers/html.py,sha256=MxYTI4EeT7QxoGleCAyQq-8n_Sgly6tD95H5zanCNmk,21977
|
| 438 |
+
pygments/lexers/idl.py,sha256=rcihUAGhfuGEaSW6pgFq6NzplT_pv0DagUoefg4zAmk,15449
|
| 439 |
+
pygments/lexers/igor.py,sha256=wVefbUjb3ftaW3LCKGtX1JgLgiY4EmRor5gVOn8vQA8,31633
|
| 440 |
+
pygments/lexers/inferno.py,sha256=ChE_5y5SLH_75Uv7D2dKWQMk2dlN6z1gY1IDjlJZ8rU,3135
|
| 441 |
+
pygments/lexers/installers.py,sha256=ZHliit4Pxz1tYKOIjKkDXI5djTkpzYUMVIPR1xvUrL8,14435
|
| 442 |
+
pygments/lexers/int_fiction.py,sha256=0ZzIa1sZDUQsltd1oHuS-BoNiOF8zKQfcVuDyK1Ttv8,56544
|
| 443 |
+
pygments/lexers/iolang.py,sha256=L6dNDCLH0kxkIUi00fI4Z14QnRu79UcNDrgv02c5Zw8,1905
|
| 444 |
+
pygments/lexers/j.py,sha256=DqNdwQGFLiZW3mCNLRg81gpmsy4Hgcai_9NP3LbWhNU,4853
|
| 445 |
+
pygments/lexers/javascript.py,sha256=TGKQLSrCprCKfhLLGAq_0EOdvqvJKX9pOdKo7tCRurQ,63243
|
| 446 |
+
pygments/lexers/jmespath.py,sha256=R5yA5LJ2nTIaDwnFIpSNGAThd0sAYFccwawA9xBptlg,2082
|
| 447 |
+
pygments/lexers/jslt.py,sha256=OeYQf8O2_9FCaf9W6Q3a7rPdAFLthePCtVSgCrOTcl8,3700
|
| 448 |
+
pygments/lexers/json5.py,sha256=8JZbc8EiTEZdKaIdQg3hXEh0mHWSzPlwd473a0nUuT0,2502
|
| 449 |
+
pygments/lexers/jsonnet.py,sha256=bx2G6J4tJqGrJV1PyZrIWzWHXcoefCX-4lIxxtbn2gw,5636
|
| 450 |
+
pygments/lexers/jsx.py,sha256=wGsoGSB40qAJrVfXwRPtan7OcK0O87RVsHHk0m6gogk,2693
|
| 451 |
+
pygments/lexers/julia.py,sha256=0ZDJ9X83V5GqJzA6T6p0TTN8WHy2JAjvu-FSBXvfXdc,11710
|
| 452 |
+
pygments/lexers/jvm.py,sha256=Yt1iQ3QodXRY-x_HUOGedhyuBBHn5jYH-I8NzOzHTlE,72667
|
| 453 |
+
pygments/lexers/kuin.py,sha256=3dKKJVJlskgrvMKv2tY9NOsFfDjyo-3MLcJ1lFKdXSg,11405
|
| 454 |
+
pygments/lexers/kusto.py,sha256=kaxkoPpEBDsBTCvCOkZZx7oGfv0jk_UNIRIRbfVAsBE,3477
|
| 455 |
+
pygments/lexers/ldap.py,sha256=77vF4t_19x9V522cxRCM5d3HW8Ne3giYsFsMPVYYBw4,6551
|
| 456 |
+
pygments/lexers/lean.py,sha256=7HWRgxFsxS1N9XKqw0vfKwaxl27s5YiVYtZeRUoTHFo,8570
|
| 457 |
+
pygments/lexers/lilypond.py,sha256=yd2Tuv67um6EyCIr-VwBnlPhTHxMaQsBJ4nGgO5fjIk,9752
|
| 458 |
+
pygments/lexers/lisp.py,sha256=EHUy1g4pzEsYPE-zGj2rAXm3YATE1j9dCQOr5-JPSkU,157668
|
| 459 |
+
pygments/lexers/macaulay2.py,sha256=zkV-vxjQYa0Jj9TGfFP1iMgpTZ4ApQuAAIdJVGWb2is,33366
|
| 460 |
+
pygments/lexers/make.py,sha256=YMI5DBCrxWca-pz9cVXcyfuHLcikPx9R_3pW_98Myqo,7831
|
| 461 |
+
pygments/lexers/maple.py,sha256=Rs0dEmOMD3C1YQPd0mntN-vzReq4XfHegH6xV4lvJWo,7960
|
| 462 |
+
pygments/lexers/markup.py,sha256=zWtxsyIx_1OxQzS6wLe8bEqglePv4RqvJjbia8AvV5c,65088
|
| 463 |
+
pygments/lexers/math.py,sha256=P3ZK1ePd8ZnLdlmHezo2irCA8T2-nlHBoSaBoT5mEVI,695
|
| 464 |
+
pygments/lexers/matlab.py,sha256=F9KO4qowIhfP8oVhCRRzE_1sqg4zmQbsB2NZH193PiM,133027
|
| 465 |
+
pygments/lexers/maxima.py,sha256=a0h9Ggs9JEovTrzbJT-BLVbOqI29yPnaMZlkU5f_FeY,2715
|
| 466 |
+
pygments/lexers/meson.py,sha256=BMrsDo6BH2lzTFw7JDwQ9SDNMTrRkXCNRDVf4aFHdsI,4336
|
| 467 |
+
pygments/lexers/mime.py,sha256=yGrf3h37LK4b6ERBpFiL_qzn3JgOfGR5KLagnbWFl6c,7582
|
| 468 |
+
pygments/lexers/minecraft.py,sha256=Nu88snDDPzM0D-742fFdUriczL-EE911pAd4_I4-pAw,13696
|
| 469 |
+
pygments/lexers/mips.py,sha256=STKiZT67b3QERXXn7XKVxlPBu7vwbPC5EyCpuf3Jfbw,4656
|
| 470 |
+
pygments/lexers/ml.py,sha256=t8sCv4BjvuBq6AihKKUwStEONIgdXCC2RMtO0RopNbM,35390
|
| 471 |
+
pygments/lexers/modeling.py,sha256=M7B58bGB-Zwd1EmPxKqtRvg7TgNCyem3MVUHv0_H2SQ,13683
|
| 472 |
+
pygments/lexers/modula2.py,sha256=NtpXBRoUCeHfflgB39LknSkCwhBHBKv2Er_pinjVsNE,53072
|
| 473 |
+
pygments/lexers/mojo.py,sha256=8JRVoftN1E-W2woG0K-4n8PQXTUM9iY6Sl5sWb2uGNg,24233
|
| 474 |
+
pygments/lexers/monte.py,sha256=baWU6zlXloenw9MO1MtEVGE9i3CfiXAYhqU621MIjRk,6289
|
| 475 |
+
pygments/lexers/mosel.py,sha256=gjRdedhA1jTjoYoM1Gpaoog_I9o7TRbYMHk97N1TXwg,9297
|
| 476 |
+
pygments/lexers/ncl.py,sha256=zJ6ahlitit4S0pBXc7Wu96PB7xOn59MwfR2HdY5_C60,63999
|
| 477 |
+
pygments/lexers/nimrod.py,sha256=Q1NSqEkLC5wWt7xJyKC-vzWw_Iw2SfDNP_pyMFBuIfA,6413
|
| 478 |
+
pygments/lexers/nit.py,sha256=p_hVD8GzMRl3CABVKHtYgnXFUQk0i5F2FbWFA6WXm6s,2725
|
| 479 |
+
pygments/lexers/nix.py,sha256=NOrv20gdq-2A7eZ6c2gElPHv1Xx2pvv20-qOymL9GMg,4421
|
| 480 |
+
pygments/lexers/numbair.py,sha256=fxkp2CXeXWKBMewfi1H4JSYkmm4kU58wZ2Sh9BDYAWQ,1758
|
| 481 |
+
pygments/lexers/oberon.py,sha256=jw403qUUs7zpTHAs5CbLjb8qiuwtxLk0spDIYqGZwAw,4210
|
| 482 |
+
pygments/lexers/objective.py,sha256=Fo1WB3JMj8sNeYnvB84H4_qwhOt4WNJtJWjVEOwrJGk,23297
|
| 483 |
+
pygments/lexers/ooc.py,sha256=kD1XaJZaihDF_s-Vyu1Bx68S_9zFt2rhox7NF8LpOZM,3002
|
| 484 |
+
pygments/lexers/openscad.py,sha256=h9I1k8kiuQmhX5vZm6VDSr2fa5Finy0sN8ZDIE-jx1c,3700
|
| 485 |
+
pygments/lexers/other.py,sha256=WLVyqPsvm9oSXIbZwbfyJloS6HGgoFW5nVTaU1uQpTw,1763
|
| 486 |
+
pygments/lexers/parasail.py,sha256=DWMGhtyQgGTXbIgQl_mID6CKqi-Dhbvs_dTkmvrZXfE,2719
|
| 487 |
+
pygments/lexers/parsers.py,sha256=feNgxroPoWRf0NEsON2mtmKDUfslIQppukw6ndEsQ3M,26596
|
| 488 |
+
pygments/lexers/pascal.py,sha256=N2tRAjlXnTxggAzzk2tOOAVzeC2MBzrXy97_HQl5n44,30989
|
| 489 |
+
pygments/lexers/pawn.py,sha256=LWUYQYsebMMt2d5oxX1HYWvBqbakR1h7Av_z8Vw94Wg,8253
|
| 490 |
+
pygments/lexers/pddl.py,sha256=Mk4_BzlROJCd0xR4KKRRSrbj0F7LLQcBRjmsmtWmrCg,2989
|
| 491 |
+
pygments/lexers/perl.py,sha256=9BXn3tyHMA49NvzbM9E2czSCHjeU7bvaPLUcoZrhz-4,39192
|
| 492 |
+
pygments/lexers/phix.py,sha256=hZqychqo5sFMBDESzDPXg1DYHQe_9sn294UfbjihaFk,23249
|
| 493 |
+
pygments/lexers/php.py,sha256=l4hzQrlm0525i5dSw9Vmjcai3TzbPT6DkjzxPg9l6Zc,13061
|
| 494 |
+
pygments/lexers/pointless.py,sha256=WSDjqQyGrNIGmTCdaMxl4zk7OZTlJAMzeUZ02kfgcTI,1974
|
| 495 |
+
pygments/lexers/pony.py,sha256=EXrMkacqMZblI7v4AvBRQe-3Py8__bx5FOgjCLdfXxQ,3279
|
| 496 |
+
pygments/lexers/praat.py,sha256=4UFK-nbC6WkZBhJgcQqEGqq9CocJkW7AmT_OJQbjWzk,12676
|
| 497 |
+
pygments/lexers/procfile.py,sha256=05W2fyofLTP-FbEdSXD1eles-PPqVNfF6RWXjQdW2us,1155
|
| 498 |
+
pygments/lexers/prolog.py,sha256=9Kc5YNUFqkfWu2sYoyzC3RX65abf1bm7oHr86z1s4kQ,12866
|
| 499 |
+
pygments/lexers/promql.py,sha256=n-0vo-o8-ZasqP3Va4ujs562UfZSLfZF-RzT71yL0Tk,4738
|
| 500 |
+
pygments/lexers/prql.py,sha256=PFReuvhbv4K5aeu6lvDfw4m-3hULkB3r43bKAy948os,8747
|
| 501 |
+
pygments/lexers/ptx.py,sha256=KSHAvbiNVUntKilQ6EPYoLFocmJpRsBy_7fW6_Nrs1Y,4501
|
| 502 |
+
pygments/lexers/python.py,sha256=WZe7fBAHKZ_BxPg8qIU26UGhk8qwUYyENJ3IyPW64mc,53805
|
| 503 |
+
pygments/lexers/q.py,sha256=WQFUh3JrpK2j-VGW_Ytn3uJ5frUNmQIFnLtMVGRA9DI,6936
|
| 504 |
+
pygments/lexers/qlik.py,sha256=2wqwdfIjrAz6RNBsP4MyeLX8Z7QpIGzxtf1CvaOlr_g,3693
|
| 505 |
+
pygments/lexers/qvt.py,sha256=XMBnsWRrvCDf989OuDeb-KpszAkeETiACyaghZeL1ns,6103
|
| 506 |
+
pygments/lexers/r.py,sha256=B6WgrD9SY1UTCV1fQBSlZbezPfpYsARn3FQIHcFYOiM,6474
|
| 507 |
+
pygments/lexers/rdf.py,sha256=qUzxLna9v071bHhZAjdsBi8dKaJNk_h9g1ZRUAYCfoo,16056
|
| 508 |
+
pygments/lexers/rebol.py,sha256=4u3N4kzui55HapopXDu3Kt0jczxDZ4buzwR7Mt4tQiM,18259
|
| 509 |
+
pygments/lexers/rego.py,sha256=Rx5Gphbktr9ojg5DbqlyxHeQqqtF7g8W-oF0rmloDNY,1748
|
| 510 |
+
pygments/lexers/resource.py,sha256=ioEzgWksB5HCjoz85XNkQPSd7n5kL0SZiuPkJP1hunQ,2927
|
| 511 |
+
pygments/lexers/ride.py,sha256=kCWdxuR3PclVi4wiA0uUx4CYEFwuTqoMsKjhSW4X3yg,5035
|
| 512 |
+
pygments/lexers/rita.py,sha256=Mj1QNxx1sWAZYC02kw8piVckaiw9B0MqQtiIiDFH0pA,1127
|
| 513 |
+
pygments/lexers/rnc.py,sha256=g7ZD334PMGUqy_Ij64laSN1vJerwHqVkegfMCa3E-y8,1972
|
| 514 |
+
pygments/lexers/roboconf.py,sha256=HbYuK5CqmQdd63SRY2nle01r7-p7mil0SnoauYDmEOY,2074
|
| 515 |
+
pygments/lexers/robotframework.py,sha256=c4U1B9Q9ITBCTohqJTZOvkfyeVbenN4xhzSWIoZh5eU,18448
|
| 516 |
+
pygments/lexers/ruby.py,sha256=uG617E5abBZcECRCqkhIfc-IbZcRb5cGuUZq_xpax90,22753
|
| 517 |
+
pygments/lexers/rust.py,sha256=ZY-9vtsreBP0NfDd0WCouLSp_9MChAL8U8Abe-m9PB8,8260
|
| 518 |
+
pygments/lexers/sas.py,sha256=C1Uz2s9DU6_s2kL-cB_PAGPtpyK5THlmhNmCumC1l48,9456
|
| 519 |
+
pygments/lexers/savi.py,sha256=jrmruK0GnXktgBTWXW3oN3TXtofn3HBbkMlHnR84cko,4878
|
| 520 |
+
pygments/lexers/scdoc.py,sha256=DXRmFDmYuc7h3gPAAVhfcL1OEbNBK5RdPpJqQzF3ZTk,2524
|
| 521 |
+
pygments/lexers/scripting.py,sha256=eaYlkDK-_cAwTcCBHP6QXBCz8n6OzbhzdkRe0uV0xWY,81814
|
| 522 |
+
pygments/lexers/sgf.py,sha256=w6C513ENaO2YCnqrduK7k03NaMDf-pgygvfzq2NaSRk,1985
|
| 523 |
+
pygments/lexers/shell.py,sha256=dCS1zwkf5KwTog4__MnMC7h3Xmwv4_d3fnEV29tSwXI,36381
|
| 524 |
+
pygments/lexers/sieve.py,sha256=eob-L84yf2jmhdNyYZUlbUJozdcd6GXcHW68lmAe8WE,2514
|
| 525 |
+
pygments/lexers/slash.py,sha256=I-cRepmaxhL1SgYvD1hHX3gNBFI8NPszdU7hn1o5JlA,8484
|
| 526 |
+
pygments/lexers/smalltalk.py,sha256=ue2PmqDK2sw0j75WdseiiENJBdZ1OwysH2Op1QN1r24,7204
|
| 527 |
+
pygments/lexers/smithy.py,sha256=VREWoeuz7ANap_Uiopn7rs0Tnsfc-xBisDJKRGQY_y8,2659
|
| 528 |
+
pygments/lexers/smv.py,sha256=He_VBSMbWONMWZmkrB5RYR0cfHVnMyKIXz68IFYl-a8,2805
|
| 529 |
+
pygments/lexers/snobol.py,sha256=qDzb41xQQWMNmjB2MtZs23pFoFgZ2gbRZhK_Ir03r7I,2778
|
| 530 |
+
pygments/lexers/solidity.py,sha256=Tixfnwku4Yezj6nNm8xVaw7EdV1qgAgdwahdTFP0St8,3163
|
| 531 |
+
pygments/lexers/soong.py,sha256=Vm18vV4g6T8UPgjjY2yTRlSXGDpZowmuqQUBFfm4A9A,2339
|
| 532 |
+
pygments/lexers/sophia.py,sha256=2YtYIT8iwAoW0B7TZuuoG_ZILhJV-2A7oBGat-98naE,3376
|
| 533 |
+
pygments/lexers/special.py,sha256=8JuR2Vex8X-RWnC36S0HXTHWp2qmZclc90-TrLUWyaY,3585
|
| 534 |
+
pygments/lexers/spice.py,sha256=m4nK0q4Sq_OFQez7kGWfki0No4ZV24YrONfHVj1Piqs,2790
|
| 535 |
+
pygments/lexers/sql.py,sha256=WSG6vOsR87EEEwSQefP_Z7TauUG_BjqMHUFmPaSOVj4,41476
|
| 536 |
+
pygments/lexers/srcinfo.py,sha256=B8vDs-sJogG3mWa5Hp_7JfHHUMyYRwGvKv6cKbFQXLM,1746
|
| 537 |
+
pygments/lexers/stata.py,sha256=Zr9BC52D5O_3BbdW0N-tzoUmy0NTguL2sC-saXRVM-c,6415
|
| 538 |
+
pygments/lexers/supercollider.py,sha256=_H5wDrn0DiGnlhB_cz6Rt_lo2TvqjSm0o6NPTd9R4Ko,3697
|
| 539 |
+
pygments/lexers/tablegen.py,sha256=1JjedXYY18BNiY9JtNGLOtGfiwduNDZpQLBGTeQ6jAw,3987
|
| 540 |
+
pygments/lexers/tact.py,sha256=X_lsxjFUMaC1TmYysXJq9tmAGifRnil83Bt1zA86Xdo,10809
|
| 541 |
+
pygments/lexers/tal.py,sha256=xS9PlaWQOPj8MVr56fUNq31vUQKRWoLTlyWj9ZHm8AM,2904
|
| 542 |
+
pygments/lexers/tcl.py,sha256=lK97ju4nikkt-oGOzIeyFEM98yq4dZSI8uEmYsq0R6c,5512
|
| 543 |
+
pygments/lexers/teal.py,sha256=t3dqy_Arwv8_yExbX_xiFxv1TqJLPv4vh1MVKjKwS4Y,3522
|
| 544 |
+
pygments/lexers/templates.py,sha256=BVdjYeoacIUuFyHTG39j4PxeNCe5E1oUURjH1rITrI4,75731
|
| 545 |
+
pygments/lexers/teraterm.py,sha256=ciwztagW5Drg2gr17Qykrh6GwMsKy7e4xdQshX95GyQ,9718
|
| 546 |
+
pygments/lexers/testing.py,sha256=YZgDgUEaLEYKSKEqpDsUi3Bn-Db_D42IlyiSsr1oX8U,10810
|
| 547 |
+
pygments/lexers/text.py,sha256=nOCQPssIlKdVWU3PKxZiBPkf_KFM2V48IOssSyqhFY8,1068
|
| 548 |
+
pygments/lexers/textedit.py,sha256=ttT4Ph-hIdgFLG6maRy_GskkziTFK0Wcg28yU0s6lek,7760
|
| 549 |
+
pygments/lexers/textfmts.py,sha256=mi9KLEq4mrzDJbEc8G3VM-mSki_Tylkzodu47yH6z84,15524
|
| 550 |
+
pygments/lexers/theorem.py,sha256=51ppBAEdhJmwU_lC916zMyjEoKLXqf89VAE_Lr0PNCc,17855
|
| 551 |
+
pygments/lexers/thingsdb.py,sha256=x_fHNkLA-hIJyeIs6rg_X8n5OLYvFqaSu1FhI3apI5Y,6017
|
| 552 |
+
pygments/lexers/tlb.py,sha256=ue2gqm45BI512lM13O8skAky9zAb7pLMrxZ8pbt5zRU,1450
|
| 553 |
+
pygments/lexers/tls.py,sha256=_uQUVuMRDOhN-XUyGR5DIlVCk1CUZ1fIOSN4_WQYPKk,1540
|
| 554 |
+
pygments/lexers/tnt.py,sha256=pK4LgoKON7u1xF66JYFncAPSbD8DZaeI_WTZ9HqEFlY,10456
|
| 555 |
+
pygments/lexers/trafficscript.py,sha256=X3B8kgxS54ecuok9ic6Hkp-UMn5DvOmCK0p70Tz27Cw,1506
|
| 556 |
+
pygments/lexers/typoscript.py,sha256=mBuePiVZUoAORPKsHwrx6fBWiy3fAIqG-2O67QmMiFI,8332
|
| 557 |
+
pygments/lexers/typst.py,sha256=zIJBEhUXtWp5OiyAmvFA5m8d1EQG-ocwrJ677dvTUAk,7167
|
| 558 |
+
pygments/lexers/ul4.py,sha256=rCaw0J9j3cdql9lX_HTilg65k9-9S118zOA6TAYfxaM,10499
|
| 559 |
+
pygments/lexers/unicon.py,sha256=RAqoCnAAJBYOAGdR8ng0g6FtB39bGemLRlIqv5mcg9E,18625
|
| 560 |
+
pygments/lexers/urbi.py,sha256=ajNP70NJg32jNnFDZsLvr_-4TToSGqRGkFyAPIJLfCU,6082
|
| 561 |
+
pygments/lexers/usd.py,sha256=2eEGouolodYS402P_gtBrn4lLzpg1z8uHwPCKqjUb_k,3304
|
| 562 |
+
pygments/lexers/varnish.py,sha256=dSh0Ku9SrjmlB29Fi_mWdWavN7M0cMKeepR4a34sOyI,7473
|
| 563 |
+
pygments/lexers/verification.py,sha256=Qu433Q_h3EK3uS4bJoLRFZK0kIVwzX5AFKsa4Z-qnxA,3934
|
| 564 |
+
pygments/lexers/verifpal.py,sha256=buyOOzCo_dGnoC40h0tthylHVVpgDt8qXu4olLvYy_4,2661
|
| 565 |
+
pygments/lexers/vip.py,sha256=2lEV4cLV9p4E37wctBL7zkZ4ZU4p3HVsiLJFzB1bie0,5711
|
| 566 |
+
pygments/lexers/vyper.py,sha256=Zq6sQIUBk6mBdpgOVgu3A6swGoBne0kDlRyjZznm2BY,5615
|
| 567 |
+
pygments/lexers/web.py,sha256=4W9a7vcskrGJnxt4KmoE3SZydWB1qLq7lP2XS85J_m8,913
|
| 568 |
+
pygments/lexers/webassembly.py,sha256=zgcMouzLawcbeFr6w_SOvGoUR68ZtqnnsbOcWEVleLk,5698
|
| 569 |
+
pygments/lexers/webidl.py,sha256=ODtVmw4gVzI8HQWxuEckP6KMwm8WP2G2lSZEjagDXts,10516
|
| 570 |
+
pygments/lexers/webmisc.py,sha256=-_-INDVdk47e2jlj-9bFcuLtntqVorBqIjlnwPfZFdI,40564
|
| 571 |
+
pygments/lexers/wgsl.py,sha256=9igd9dzixGIgNewruv9mPnFms-c9BahkZcCCrZygv84,11880
|
| 572 |
+
pygments/lexers/whiley.py,sha256=lMr750lA4MZsB4xqzVsIRtVMJIC3_dArhFYTHvOPwvA,4017
|
| 573 |
+
pygments/lexers/wowtoc.py,sha256=8xxvf0xGeYtf4PE7KtkHZ_ly9xY_XXHrpCitdKE42Ro,4076
|
| 574 |
+
pygments/lexers/wren.py,sha256=goGXnAMKKa13LLL40ybT3aMGPrk3gCRwZQFYAkKB_w0,3229
|
| 575 |
+
pygments/lexers/x10.py,sha256=Q-AmgdF2E-N7mtOPpZ07CsxrTVnikyqC4uRRv6H75sk,1943
|
| 576 |
+
pygments/lexers/xorg.py,sha256=9ttrBd3_Y2nXANsqtMposSgblYmMYqWXQ-Iz5RH9RsU,925
|
| 577 |
+
pygments/lexers/yang.py,sha256=13CWbSaNr9giOHz4o0SXSklh0bfWt0ah14jJGpTvcn0,4499
|
| 578 |
+
pygments/lexers/yara.py,sha256=jUSv78KTDfguCoAoAZKbYzQERkkyxBBWv5dInVrkDxo,2427
|
| 579 |
+
pygments/lexers/zig.py,sha256=f-80MVOSp1KnczAMokQLVM-_wAEOD16EcGFnaCNlsN0,3976
|
| 580 |
+
pygments/modeline.py,sha256=K5eSkR8GS1r5OkXXTHOcV0aM_6xpk9eWNEIAW-OOJ2g,1005
|
| 581 |
+
pygments/plugin.py,sha256=tPx0rJCTIZ9ioRgLNYG4pifCbAwTRUZddvLw-NfAk2w,1891
|
| 582 |
+
pygments/regexopt.py,sha256=wXaP9Gjp_hKAdnICqoDkRxAOQJSc4v3X6mcxx3z-TNs,3072
|
| 583 |
+
pygments/scanner.py,sha256=nNcETRR1tRuiTaHmHSTTECVYFPcLf6mDZu1e4u91A9E,3092
|
| 584 |
+
pygments/sphinxext.py,sha256=VEe_oHNgLoEGMHc2ROfbee2mF2PPREFyE6_m_JN5FvQ,7898
|
| 585 |
+
pygments/style.py,sha256=Cpw9dCAyW3_JAwFRXOJXmtKb5ZwO2_5KSmlq6q4fZw4,6408
|
| 586 |
+
pygments/styles/__init__.py,sha256=f9KCQXN4uKbe8aI8-L3qTC-_XPfT563FwTg6VTGVfwI,2006
|
| 587 |
+
pygments/styles/__pycache__/__init__.cpython-310.pyc,,
|
| 588 |
+
pygments/styles/__pycache__/_mapping.cpython-310.pyc,,
|
| 589 |
+
pygments/styles/__pycache__/abap.cpython-310.pyc,,
|
| 590 |
+
pygments/styles/__pycache__/algol.cpython-310.pyc,,
|
| 591 |
+
pygments/styles/__pycache__/algol_nu.cpython-310.pyc,,
|
| 592 |
+
pygments/styles/__pycache__/arduino.cpython-310.pyc,,
|
| 593 |
+
pygments/styles/__pycache__/autumn.cpython-310.pyc,,
|
| 594 |
+
pygments/styles/__pycache__/borland.cpython-310.pyc,,
|
| 595 |
+
pygments/styles/__pycache__/bw.cpython-310.pyc,,
|
| 596 |
+
pygments/styles/__pycache__/coffee.cpython-310.pyc,,
|
| 597 |
+
pygments/styles/__pycache__/colorful.cpython-310.pyc,,
|
| 598 |
+
pygments/styles/__pycache__/default.cpython-310.pyc,,
|
| 599 |
+
pygments/styles/__pycache__/dracula.cpython-310.pyc,,
|
| 600 |
+
pygments/styles/__pycache__/emacs.cpython-310.pyc,,
|
| 601 |
+
pygments/styles/__pycache__/friendly.cpython-310.pyc,,
|
| 602 |
+
pygments/styles/__pycache__/friendly_grayscale.cpython-310.pyc,,
|
| 603 |
+
pygments/styles/__pycache__/fruity.cpython-310.pyc,,
|
| 604 |
+
pygments/styles/__pycache__/gh_dark.cpython-310.pyc,,
|
| 605 |
+
pygments/styles/__pycache__/gruvbox.cpython-310.pyc,,
|
| 606 |
+
pygments/styles/__pycache__/igor.cpython-310.pyc,,
|
| 607 |
+
pygments/styles/__pycache__/inkpot.cpython-310.pyc,,
|
| 608 |
+
pygments/styles/__pycache__/lightbulb.cpython-310.pyc,,
|
| 609 |
+
pygments/styles/__pycache__/lilypond.cpython-310.pyc,,
|
| 610 |
+
pygments/styles/__pycache__/lovelace.cpython-310.pyc,,
|
| 611 |
+
pygments/styles/__pycache__/manni.cpython-310.pyc,,
|
| 612 |
+
pygments/styles/__pycache__/material.cpython-310.pyc,,
|
| 613 |
+
pygments/styles/__pycache__/monokai.cpython-310.pyc,,
|
| 614 |
+
pygments/styles/__pycache__/murphy.cpython-310.pyc,,
|
| 615 |
+
pygments/styles/__pycache__/native.cpython-310.pyc,,
|
| 616 |
+
pygments/styles/__pycache__/nord.cpython-310.pyc,,
|
| 617 |
+
pygments/styles/__pycache__/onedark.cpython-310.pyc,,
|
| 618 |
+
pygments/styles/__pycache__/paraiso_dark.cpython-310.pyc,,
|
| 619 |
+
pygments/styles/__pycache__/paraiso_light.cpython-310.pyc,,
|
| 620 |
+
pygments/styles/__pycache__/pastie.cpython-310.pyc,,
|
| 621 |
+
pygments/styles/__pycache__/perldoc.cpython-310.pyc,,
|
| 622 |
+
pygments/styles/__pycache__/rainbow_dash.cpython-310.pyc,,
|
| 623 |
+
pygments/styles/__pycache__/rrt.cpython-310.pyc,,
|
| 624 |
+
pygments/styles/__pycache__/sas.cpython-310.pyc,,
|
| 625 |
+
pygments/styles/__pycache__/solarized.cpython-310.pyc,,
|
| 626 |
+
pygments/styles/__pycache__/staroffice.cpython-310.pyc,,
|
| 627 |
+
pygments/styles/__pycache__/stata_dark.cpython-310.pyc,,
|
| 628 |
+
pygments/styles/__pycache__/stata_light.cpython-310.pyc,,
|
| 629 |
+
pygments/styles/__pycache__/tango.cpython-310.pyc,,
|
| 630 |
+
pygments/styles/__pycache__/trac.cpython-310.pyc,,
|
| 631 |
+
pygments/styles/__pycache__/vim.cpython-310.pyc,,
|
| 632 |
+
pygments/styles/__pycache__/vs.cpython-310.pyc,,
|
| 633 |
+
pygments/styles/__pycache__/xcode.cpython-310.pyc,,
|
| 634 |
+
pygments/styles/__pycache__/zenburn.cpython-310.pyc,,
|
| 635 |
+
pygments/styles/_mapping.py,sha256=6lovFUE29tz6EsV3XYY4hgozJ7q1JL7cfO3UOlgnS8w,3312
|
| 636 |
+
pygments/styles/abap.py,sha256=64Uwr8uPdEdcT-tE-Y2VveTXfH3SkqH9qdMgY49YHQI,749
|
| 637 |
+
pygments/styles/algol.py,sha256=fCuk8ITTehvbJSufiaKlgnFsKbl-xFxxR82xhltc-cQ,2262
|
| 638 |
+
pygments/styles/algol_nu.py,sha256=Gv9WfHJvYegGcUk1zcufQgsdXPNjCUNk8sAHyrSGGh4,2283
|
| 639 |
+
pygments/styles/arduino.py,sha256=NoUB8xk7M1HGPoLfuySOLU0sVwoTuLcZqllXl2EO_iE,4557
|
| 640 |
+
pygments/styles/autumn.py,sha256=fLLfjHXjxCl6crBAxEsBLH372ALMkFacA2bG6KFbJi4,2195
|
| 641 |
+
pygments/styles/borland.py,sha256=_0ySKp4KGCSgtYjPe8uzD6gQhlmAIR4T43i-FoRYNOM,1611
|
| 642 |
+
pygments/styles/bw.py,sha256=vhk8Xoj64fLPdA9IQU6mUVsYMel255jR-FDU7BjIHtI,1406
|
| 643 |
+
pygments/styles/coffee.py,sha256=NqLt-fc7LONma1BGggbceVRY9uDE70WBuZXqK4zwaco,2308
|
| 644 |
+
pygments/styles/colorful.py,sha256=mYcSbehtH7itH_QV9NqJp4Wna1X4lrwl2wkVXS2u-5A,2832
|
| 645 |
+
pygments/styles/default.py,sha256=RTgG2zKWWUxPTDCFxhTnyZI_WZBIVgu5XsUpNvFisCA,2588
|
| 646 |
+
pygments/styles/dracula.py,sha256=vRJmixBoSKV9o8NVQhXGViQqchhIYugfikLmvX0DoBw,2182
|
| 647 |
+
pygments/styles/emacs.py,sha256=TiOG9oc83qToMCRMnJrXtWYqnzAqYycRz_50OoCKtxc,2535
|
| 648 |
+
pygments/styles/friendly.py,sha256=oAi-l9anQTs9STDmUzXGDlOegatEOH4hpD0j6o6dZGM,2604
|
| 649 |
+
pygments/styles/friendly_grayscale.py,sha256=a7Cqkzt6-uTiXvj6GoYBXzRvX5_zviCjjRB04Kf_-Q0,2828
|
| 650 |
+
pygments/styles/fruity.py,sha256=GfSUTG0stlJr5Ow_saCaxbI2IB4-34Dp2TuRTpfUJBs,1324
|
| 651 |
+
pygments/styles/gh_dark.py,sha256=ruNX3d4rf22rx-8HnwvGbNbXRQpXCNcHU1HNq6N4uNg,3590
|
| 652 |
+
pygments/styles/gruvbox.py,sha256=KrFoHEoVnZW6XM9udyXncPomeGyZgIDsNWOH3kCrxFQ,3387
|
| 653 |
+
pygments/styles/igor.py,sha256=fYYPhM0dRCvcDTMVrMVO5oFKnYm-8YVlsuVBoczFLtY,737
|
| 654 |
+
pygments/styles/inkpot.py,sha256=jggSeX9NV15eOL2oJaVmZ6vmV7LWRzXJQRUqcWEqGRs,2404
|
| 655 |
+
pygments/styles/lightbulb.py,sha256=Y8u1qdvlHfBqI2jJex55SkvVatVo_FjEUzE6h-X7m-0,3172
|
| 656 |
+
pygments/styles/lilypond.py,sha256=Y6fp_sEL-zESmxAaMxzjtrKk90cuDC_DalNdC8wj0nw,2066
|
| 657 |
+
pygments/styles/lovelace.py,sha256=cA9uhmbnzY04MccsiYSgMY7fvb4WMRbegWBUrGvXh1M,3178
|
| 658 |
+
pygments/styles/manni.py,sha256=g9FyO7plTwfMm2cU4iiKgdlkMlvQLG6l2Lwkgz5ITS4,2443
|
| 659 |
+
pygments/styles/material.py,sha256=LDmgomAbgtJDZhbv446_zIwgYh50UAqEEtgYNUns1rQ,4201
|
| 660 |
+
pygments/styles/monokai.py,sha256=lrxTJpkBarV9gTLkBQryZ6oNSjekAVheJueKJP5iEYA,5184
|
| 661 |
+
pygments/styles/murphy.py,sha256=-AKZiLkpiWej-otjHMsYCE-I-_IzCOLJY-_GBdKRZRw,2805
|
| 662 |
+
pygments/styles/native.py,sha256=l6tezGSQTB8p_SyOXJ0PWI7KzCeEdtsPmVc4Yn4_CwU,2043
|
| 663 |
+
pygments/styles/nord.py,sha256=GDt3WAaqaWsiCeqpIBPxd8TEUX708fGfwaA7S0w0oy0,5391
|
| 664 |
+
pygments/styles/onedark.py,sha256=k80cZEppCEF-HLoxy_FEA0QmQDZze68nHVMNGyUVa28,1719
|
| 665 |
+
pygments/styles/paraiso_dark.py,sha256=Jkrg4nUKIVNF8U4fPNV_Smq_g9NFbb9eiUrjYpVgQZg,5662
|
| 666 |
+
pygments/styles/paraiso_light.py,sha256=MxN964ZEpze3wF0ss-igaa2I7E684MHe-Zq0rWPH3wo,5668
|
| 667 |
+
pygments/styles/pastie.py,sha256=ZvAs9UpBNYFC-5PFrCRGYnm3FoPKb-eKR-ozbWZP-4g,2525
|
| 668 |
+
pygments/styles/perldoc.py,sha256=HSxB93e4UpQkZspReQ34FeJbZ-59ksGvdaH-hToehi8,2230
|
| 669 |
+
pygments/styles/rainbow_dash.py,sha256=4ugL18Or7aNtaLfPfCLFRiFy0Gu2RA4a9G2LQUE9SrM,2390
|
| 670 |
+
pygments/styles/rrt.py,sha256=fgzfpC0PC_SCcLOMCNEIQTjPUMOncRe7SR10GfSRbXY,1006
|
| 671 |
+
pygments/styles/sas.py,sha256=yzoXmbfQ2ND1WWq93b4vVGYkQSZHPqb4ymes9YYRT3w,1440
|
| 672 |
+
pygments/styles/solarized.py,sha256=qupILFZn02WspnAF5SPYb-W8guo9xnUtjb1HeLw3XgE,4247
|
| 673 |
+
pygments/styles/staroffice.py,sha256=CLbBeMoxay21Xyu3Af2p4xUXyG1_6ydCbvs5RJKYe5w,831
|
| 674 |
+
pygments/styles/stata_dark.py,sha256=vX8SwHV__sG92F4CKribG08MJfSVq98dgs7gEA_n9yc,1257
|
| 675 |
+
pygments/styles/stata_light.py,sha256=uV3GE-ylvffQ0yN3py1YAVqBB5wflIKZbceyK1Lqvrc,1289
|
| 676 |
+
pygments/styles/tango.py,sha256=O2wcM4hHuU1Yt071M9CK7JPtiiSCqyxtT9tbiQICV28,7137
|
| 677 |
+
pygments/styles/trac.py,sha256=9kMv1ZZyMKACWlx2fQVjRP0I2pgcRYCNrd7iGGZg9qk,1981
|
| 678 |
+
pygments/styles/vim.py,sha256=J7_TqvrGkTX_XuTHW0In5wqPLAUPRWyr1122XueZWmM,2019
|
| 679 |
+
pygments/styles/vs.py,sha256=s7YnzbIPuFU3LIke27mc4lAQSn2R3vbbHc1baMGSU_U,1130
|
| 680 |
+
pygments/styles/xcode.py,sha256=PbQdzgGaA4a9LAU1i58alY9kM4IFlQX5jHQwOYmf_Rk,1504
|
| 681 |
+
pygments/styles/zenburn.py,sha256=suZEKzBTCYdhf2cxNwcY7UATJK1tq5eYhGdBcXdf6MU,2203
|
| 682 |
+
pygments/token.py,sha256=WbdWGhYm_Vosb0DDxW9lHNPgITXfWTsQmHt6cy9RbcM,6226
|
| 683 |
+
pygments/unistring.py,sha256=al-_rBemRuGvinsrM6atNsHTmJ6DUbw24q2O2Ru1cBc,63208
|
| 684 |
+
pygments/util.py,sha256=oRtSpiAo5jM9ulntkvVbgXUdiAW57jnuYGB7t9fYuhc,10031
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/WHEEL
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Wheel-Version: 1.0
|
| 2 |
+
Generator: hatchling 1.27.0
|
| 3 |
+
Root-Is-Purelib: true
|
| 4 |
+
Tag: py3-none-any
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/entry_points.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
[console_scripts]
|
| 2 |
+
pygmentize = pygments.cmdline:main
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/licenses/AUTHORS
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Pygments is written and maintained by Georg Brandl <georg@python.org>.
|
| 2 |
+
|
| 3 |
+
Major developers are Tim Hatch <tim@timhatch.com> and Armin Ronacher
|
| 4 |
+
<armin.ronacher@active-4.com>.
|
| 5 |
+
|
| 6 |
+
Other contributors, listed alphabetically, are:
|
| 7 |
+
|
| 8 |
+
* Sam Aaron -- Ioke lexer
|
| 9 |
+
* Jean Abou Samra -- LilyPond lexer
|
| 10 |
+
* João Abecasis -- JSLT lexer
|
| 11 |
+
* Ali Afshar -- image formatter
|
| 12 |
+
* Thomas Aglassinger -- Easytrieve, JCL, Rexx, Transact-SQL and VBScript
|
| 13 |
+
lexers
|
| 14 |
+
* Maxence Ahlouche -- PostgreSQL Explain lexer
|
| 15 |
+
* Muthiah Annamalai -- Ezhil lexer
|
| 16 |
+
* Nikolay Antipov -- OpenSCAD lexer
|
| 17 |
+
* Kumar Appaiah -- Debian control lexer
|
| 18 |
+
* Andreas Amann -- AppleScript lexer
|
| 19 |
+
* Timothy Armstrong -- Dart lexer fixes
|
| 20 |
+
* Jeffrey Arnold -- R/S, Rd, BUGS, Jags, and Stan lexers
|
| 21 |
+
* Eiríkr Åsheim -- Uxntal lexer
|
| 22 |
+
* Jeremy Ashkenas -- CoffeeScript lexer
|
| 23 |
+
* José Joaquín Atria -- Praat lexer
|
| 24 |
+
* Stefan Matthias Aust -- Smalltalk lexer
|
| 25 |
+
* Lucas Bajolet -- Nit lexer
|
| 26 |
+
* Ben Bangert -- Mako lexers
|
| 27 |
+
* Max Battcher -- Darcs patch lexer
|
| 28 |
+
* Thomas Baruchel -- APL lexer
|
| 29 |
+
* Tim Baumann -- (Literate) Agda lexer
|
| 30 |
+
* Paul Baumgart, 280 North, Inc. -- Objective-J lexer
|
| 31 |
+
* Michael Bayer -- Myghty lexers
|
| 32 |
+
* Thomas Beale -- Archetype lexers
|
| 33 |
+
* John Benediktsson -- Factor lexer
|
| 34 |
+
* David Benjamin, Google LLC -- TLS lexer
|
| 35 |
+
* Trevor Bergeron -- mIRC formatter
|
| 36 |
+
* Vincent Bernat -- LessCSS lexer
|
| 37 |
+
* Christopher Bertels -- Fancy lexer
|
| 38 |
+
* Sébastien Bigaret -- QVT Operational lexer
|
| 39 |
+
* Jarrett Billingsley -- MiniD lexer
|
| 40 |
+
* Adam Blinkinsop -- Haskell, Redcode lexers
|
| 41 |
+
* Stéphane Blondon -- Procfile, SGF and Sieve lexers
|
| 42 |
+
* Frits van Bommel -- assembler lexers
|
| 43 |
+
* Pierre Bourdon -- bugfixes
|
| 44 |
+
* Martijn Braam -- Kernel log lexer, BARE lexer
|
| 45 |
+
* JD Browne, Google LLC -- GoogleSQL lexer
|
| 46 |
+
* Matthias Bussonnier -- ANSI style handling for terminal-256 formatter
|
| 47 |
+
* chebee7i -- Python traceback lexer improvements
|
| 48 |
+
* Hiram Chirino -- Scaml and Jade lexers
|
| 49 |
+
* Mauricio Caceres -- SAS and Stata lexers.
|
| 50 |
+
* Michael Camilleri, John Gabriele, sogaiu -- Janet lexer
|
| 51 |
+
* Daren Chandisingh -- Gleam lexer
|
| 52 |
+
* Ian Cooper -- VGL lexer
|
| 53 |
+
* David Corbett -- Inform, Jasmin, JSGF, Snowball, and TADS 3 lexers
|
| 54 |
+
* Leaf Corcoran -- MoonScript lexer
|
| 55 |
+
* Fraser Cormack -- TableGen lexer
|
| 56 |
+
* Gabriel Corona -- ASN.1 lexer
|
| 57 |
+
* Christopher Creutzig -- MuPAD lexer
|
| 58 |
+
* Daniël W. Crompton -- Pike lexer
|
| 59 |
+
* Pete Curry -- bugfixes
|
| 60 |
+
* Bryan Davis -- EBNF lexer
|
| 61 |
+
* Bruno Deferrari -- Shen lexer
|
| 62 |
+
* Walter Dörwald -- UL4 lexer
|
| 63 |
+
* Luke Drummond -- Meson lexer
|
| 64 |
+
* Giedrius Dubinskas -- HTML formatter improvements
|
| 65 |
+
* Owen Durni -- Haxe lexer
|
| 66 |
+
* Alexander Dutton, Oxford University Computing Services -- SPARQL lexer
|
| 67 |
+
* James Edwards -- Terraform lexer
|
| 68 |
+
* Nick Efford -- Python 3 lexer
|
| 69 |
+
* Sven Efftinge -- Xtend lexer
|
| 70 |
+
* Artem Egorkine -- terminal256 formatter
|
| 71 |
+
* Matthew Fernandez -- CAmkES lexer
|
| 72 |
+
* Paweł Fertyk -- GDScript lexer, HTML formatter improvements
|
| 73 |
+
* Michael Ficarra -- CPSA lexer
|
| 74 |
+
* James H. Fisher -- PostScript lexer
|
| 75 |
+
* Amanda Fitch, Google LLC -- GoogleSQL lexer
|
| 76 |
+
* William S. Fulton -- SWIG lexer
|
| 77 |
+
* Carlos Galdino -- Elixir and Elixir Console lexers
|
| 78 |
+
* Michael Galloy -- IDL lexer
|
| 79 |
+
* Naveen Garg -- Autohotkey lexer
|
| 80 |
+
* Simon Garnotel -- FreeFem++ lexer
|
| 81 |
+
* Laurent Gautier -- R/S lexer
|
| 82 |
+
* Alex Gaynor -- PyPy log lexer
|
| 83 |
+
* Richard Gerkin -- Igor Pro lexer
|
| 84 |
+
* Alain Gilbert -- TypeScript lexer
|
| 85 |
+
* Alex Gilding -- BlitzBasic lexer
|
| 86 |
+
* GitHub, Inc -- DASM16, Augeas, TOML, and Slash lexers
|
| 87 |
+
* Bertrand Goetzmann -- Groovy lexer
|
| 88 |
+
* Krzysiek Goj -- Scala lexer
|
| 89 |
+
* Rostyslav Golda -- FloScript lexer
|
| 90 |
+
* Andrey Golovizin -- BibTeX lexers
|
| 91 |
+
* Matt Good -- Genshi, Cheetah lexers
|
| 92 |
+
* Michał Górny -- vim modeline support
|
| 93 |
+
* Alex Gosse -- TrafficScript lexer
|
| 94 |
+
* Patrick Gotthardt -- PHP namespaces support
|
| 95 |
+
* Hubert Gruniaux -- C and C++ lexer improvements
|
| 96 |
+
* Olivier Guibe -- Asymptote lexer
|
| 97 |
+
* Phil Hagelberg -- Fennel lexer
|
| 98 |
+
* Florian Hahn -- Boogie lexer
|
| 99 |
+
* Martin Harriman -- SNOBOL lexer
|
| 100 |
+
* Matthew Harrison -- SVG formatter
|
| 101 |
+
* Steven Hazel -- Tcl lexer
|
| 102 |
+
* Dan Michael Heggø -- Turtle lexer
|
| 103 |
+
* Aslak Hellesøy -- Gherkin lexer
|
| 104 |
+
* Greg Hendershott -- Racket lexer
|
| 105 |
+
* Justin Hendrick -- ParaSail lexer
|
| 106 |
+
* Jordi Gutiérrez Hermoso -- Octave lexer
|
| 107 |
+
* David Hess, Fish Software, Inc. -- Objective-J lexer
|
| 108 |
+
* Ken Hilton -- Typographic Number Theory and Arrow lexers
|
| 109 |
+
* Varun Hiremath -- Debian control lexer
|
| 110 |
+
* Rob Hoelz -- Perl 6 lexer
|
| 111 |
+
* Doug Hogan -- Mscgen lexer
|
| 112 |
+
* Ben Hollis -- Mason lexer
|
| 113 |
+
* Max Horn -- GAP lexer
|
| 114 |
+
* Fred Hornsey -- OMG IDL Lexer
|
| 115 |
+
* Alastair Houghton -- Lexer inheritance facility
|
| 116 |
+
* Tim Howard -- BlitzMax lexer
|
| 117 |
+
* Dustin Howett -- Logos lexer
|
| 118 |
+
* Ivan Inozemtsev -- Fantom lexer
|
| 119 |
+
* Hiroaki Itoh -- Shell console rewrite, Lexers for PowerShell session,
|
| 120 |
+
MSDOS session, BC, WDiff
|
| 121 |
+
* Brian R. Jackson -- Tea lexer
|
| 122 |
+
* Christian Jann -- ShellSession lexer
|
| 123 |
+
* Jonas Camillus Jeppesen -- Line numbers and line highlighting for
|
| 124 |
+
RTF-formatter
|
| 125 |
+
* Dennis Kaarsemaker -- sources.list lexer
|
| 126 |
+
* Dmitri Kabak -- Inferno Limbo lexer
|
| 127 |
+
* Igor Kalnitsky -- vhdl lexer
|
| 128 |
+
* Colin Kennedy - USD lexer
|
| 129 |
+
* Alexander Kit -- MaskJS lexer
|
| 130 |
+
* Pekka Klärck -- Robot Framework lexer
|
| 131 |
+
* Gerwin Klein -- Isabelle lexer
|
| 132 |
+
* Eric Knibbe -- Lasso lexer
|
| 133 |
+
* Stepan Koltsov -- Clay lexer
|
| 134 |
+
* Oliver Kopp - Friendly grayscale style
|
| 135 |
+
* Adam Koprowski -- Opa lexer
|
| 136 |
+
* Benjamin Kowarsch -- Modula-2 lexer
|
| 137 |
+
* Domen Kožar -- Nix lexer
|
| 138 |
+
* Oleh Krekel -- Emacs Lisp lexer
|
| 139 |
+
* Alexander Kriegisch -- Kconfig and AspectJ lexers
|
| 140 |
+
* Marek Kubica -- Scheme lexer
|
| 141 |
+
* Jochen Kupperschmidt -- Markdown processor
|
| 142 |
+
* Gerd Kurzbach -- Modelica lexer
|
| 143 |
+
* Jon Larimer, Google Inc. -- Smali lexer
|
| 144 |
+
* Olov Lassus -- Dart lexer
|
| 145 |
+
* Matt Layman -- TAP lexer
|
| 146 |
+
* Dan Lazin, Google LLC -- GoogleSQL lexer
|
| 147 |
+
* Kristian Lyngstøl -- Varnish lexers
|
| 148 |
+
* Sylvestre Ledru -- Scilab lexer
|
| 149 |
+
* Chee Sing Lee -- Flatline lexer
|
| 150 |
+
* Mark Lee -- Vala lexer
|
| 151 |
+
* Thomas Linder Puls -- Visual Prolog lexer
|
| 152 |
+
* Pete Lomax -- Phix lexer
|
| 153 |
+
* Valentin Lorentz -- C++ lexer improvements
|
| 154 |
+
* Ben Mabey -- Gherkin lexer
|
| 155 |
+
* Angus MacArthur -- QML lexer
|
| 156 |
+
* Louis Mandel -- X10 lexer
|
| 157 |
+
* Louis Marchand -- Eiffel lexer
|
| 158 |
+
* Simone Margaritelli -- Hybris lexer
|
| 159 |
+
* Tim Martin - World of Warcraft TOC lexer
|
| 160 |
+
* Kirk McDonald -- D lexer
|
| 161 |
+
* Gordon McGregor -- SystemVerilog lexer
|
| 162 |
+
* Stephen McKamey -- Duel/JBST lexer
|
| 163 |
+
* Brian McKenna -- F# lexer
|
| 164 |
+
* Charles McLaughlin -- Puppet lexer
|
| 165 |
+
* Kurt McKee -- Tera Term macro lexer, PostgreSQL updates, MySQL overhaul, JSON lexer
|
| 166 |
+
* Joe Eli McIlvain -- Savi lexer
|
| 167 |
+
* Lukas Meuser -- BBCode formatter, Lua lexer
|
| 168 |
+
* Cat Miller -- Pig lexer
|
| 169 |
+
* Paul Miller -- LiveScript lexer
|
| 170 |
+
* Hong Minhee -- HTTP lexer
|
| 171 |
+
* Michael Mior -- Awk lexer
|
| 172 |
+
* Bruce Mitchener -- Dylan lexer rewrite
|
| 173 |
+
* Reuben Morais -- SourcePawn lexer
|
| 174 |
+
* Jon Morton -- Rust lexer
|
| 175 |
+
* Paulo Moura -- Logtalk lexer
|
| 176 |
+
* Mher Movsisyan -- DTD lexer
|
| 177 |
+
* Dejan Muhamedagic -- Crmsh lexer
|
| 178 |
+
* Adrien Nayrat -- PostgreSQL Explain lexer
|
| 179 |
+
* Ana Nelson -- Ragel, ANTLR, R console lexers
|
| 180 |
+
* David Neto, Google LLC -- WebGPU Shading Language lexer
|
| 181 |
+
* Kurt Neufeld -- Markdown lexer
|
| 182 |
+
* Nam T. Nguyen -- Monokai style
|
| 183 |
+
* Jesper Noehr -- HTML formatter "anchorlinenos"
|
| 184 |
+
* Mike Nolta -- Julia lexer
|
| 185 |
+
* Avery Nortonsmith -- Pointless lexer
|
| 186 |
+
* Jonas Obrist -- BBCode lexer
|
| 187 |
+
* Edward O'Callaghan -- Cryptol lexer
|
| 188 |
+
* David Oliva -- Rebol lexer
|
| 189 |
+
* Pat Pannuto -- nesC lexer
|
| 190 |
+
* Jon Parise -- Protocol buffers and Thrift lexers
|
| 191 |
+
* Benjamin Peterson -- Test suite refactoring
|
| 192 |
+
* Ronny Pfannschmidt -- BBCode lexer
|
| 193 |
+
* Dominik Picheta -- Nimrod lexer
|
| 194 |
+
* Andrew Pinkham -- RTF Formatter Refactoring
|
| 195 |
+
* Clément Prévost -- UrbiScript lexer
|
| 196 |
+
* Tanner Prynn -- cmdline -x option and loading lexers from files
|
| 197 |
+
* Oleh Prypin -- Crystal lexer (based on Ruby lexer)
|
| 198 |
+
* Nick Psaris -- K and Q lexers
|
| 199 |
+
* Xidorn Quan -- Web IDL lexer
|
| 200 |
+
* Elias Rabel -- Fortran fixed form lexer
|
| 201 |
+
* raichoo -- Idris lexer
|
| 202 |
+
* Daniel Ramirez -- GDScript lexer
|
| 203 |
+
* Kashif Rasul -- CUDA lexer
|
| 204 |
+
* Nathan Reed -- HLSL lexer
|
| 205 |
+
* Justin Reidy -- MXML lexer
|
| 206 |
+
* Jonathon Reinhart, Google LLC -- Soong lexer
|
| 207 |
+
* Norman Richards -- JSON lexer
|
| 208 |
+
* Corey Richardson -- Rust lexer updates
|
| 209 |
+
* Fabrizio Riguzzi -- cplint leder
|
| 210 |
+
* Lubomir Rintel -- GoodData MAQL and CL lexers
|
| 211 |
+
* Andre Roberge -- Tango style
|
| 212 |
+
* Georg Rollinger -- HSAIL lexer
|
| 213 |
+
* Michiel Roos -- TypoScript lexer
|
| 214 |
+
* Konrad Rudolph -- LaTeX formatter enhancements
|
| 215 |
+
* Mario Ruggier -- Evoque lexers
|
| 216 |
+
* Miikka Salminen -- Lovelace style, Hexdump lexer, lexer enhancements
|
| 217 |
+
* Stou Sandalski -- NumPy, FORTRAN, tcsh and XSLT lexers
|
| 218 |
+
* Matteo Sasso -- Common Lisp lexer
|
| 219 |
+
* Joe Schafer -- Ada lexer
|
| 220 |
+
* Max Schillinger -- TiddlyWiki5 lexer
|
| 221 |
+
* Andrew Schmidt -- X++ lexer
|
| 222 |
+
* Ken Schutte -- Matlab lexers
|
| 223 |
+
* René Schwaiger -- Rainbow Dash style
|
| 224 |
+
* Sebastian Schweizer -- Whiley lexer
|
| 225 |
+
* Tassilo Schweyer -- Io, MOOCode lexers
|
| 226 |
+
* Pablo Seminario -- PromQL lexer
|
| 227 |
+
* Ted Shaw -- AutoIt lexer
|
| 228 |
+
* Joerg Sieker -- ABAP lexer
|
| 229 |
+
* Robert Simmons -- Standard ML lexer
|
| 230 |
+
* Kirill Simonov -- YAML lexer
|
| 231 |
+
* Corbin Simpson -- Monte lexer
|
| 232 |
+
* Ville Skyttä -- ASCII armored lexer
|
| 233 |
+
* Alexander Smishlajev -- Visual FoxPro lexer
|
| 234 |
+
* Steve Spigarelli -- XQuery lexer
|
| 235 |
+
* Jerome St-Louis -- eC lexer
|
| 236 |
+
* Camil Staps -- Clean and NuSMV lexers; Solarized style
|
| 237 |
+
* James Strachan -- Kotlin lexer
|
| 238 |
+
* Tom Stuart -- Treetop lexer
|
| 239 |
+
* Colin Sullivan -- SuperCollider lexer
|
| 240 |
+
* Ben Swift -- Extempore lexer
|
| 241 |
+
* tatt61880 -- Kuin lexer
|
| 242 |
+
* Edoardo Tenani -- Arduino lexer
|
| 243 |
+
* Tiberius Teng -- default style overhaul
|
| 244 |
+
* Jeremy Thurgood -- Erlang, Squid config lexers
|
| 245 |
+
* Brian Tiffin -- OpenCOBOL lexer
|
| 246 |
+
* Bob Tolbert -- Hy lexer
|
| 247 |
+
* Doug Torrance -- Macaulay2 lexer
|
| 248 |
+
* Matthias Trute -- Forth lexer
|
| 249 |
+
* Tuoa Spi T4 -- Bdd lexer
|
| 250 |
+
* Erick Tryzelaar -- Felix lexer
|
| 251 |
+
* Alexander Udalov -- Kotlin lexer improvements
|
| 252 |
+
* Thomas Van Doren -- Chapel lexer
|
| 253 |
+
* Dave Van Ee -- Uxntal lexer updates
|
| 254 |
+
* Daniele Varrazzo -- PostgreSQL lexers
|
| 255 |
+
* Abe Voelker -- OpenEdge ABL lexer
|
| 256 |
+
* Pepijn de Vos -- HTML formatter CTags support
|
| 257 |
+
* Matthias Vallentin -- Bro lexer
|
| 258 |
+
* Benoît Vinot -- AMPL lexer
|
| 259 |
+
* Linh Vu Hong -- RSL lexer
|
| 260 |
+
* Taavi Väänänen -- Debian control lexer
|
| 261 |
+
* Immanuel Washington -- Smithy lexer
|
| 262 |
+
* Nathan Weizenbaum -- Haml and Sass lexers
|
| 263 |
+
* Nathan Whetsell -- Csound lexers
|
| 264 |
+
* Dietmar Winkler -- Modelica lexer
|
| 265 |
+
* Nils Winter -- Smalltalk lexer
|
| 266 |
+
* Davy Wybiral -- Clojure lexer
|
| 267 |
+
* Whitney Young -- ObjectiveC lexer
|
| 268 |
+
* Diego Zamboni -- CFengine3 lexer
|
| 269 |
+
* Enrique Zamudio -- Ceylon lexer
|
| 270 |
+
* Alex Zimin -- Nemerle lexer
|
| 271 |
+
* Rob Zimmerman -- Kal lexer
|
| 272 |
+
* Evgenii Zheltonozhskii -- Maple lexer
|
| 273 |
+
* Vincent Zurczak -- Roboconf lexer
|
| 274 |
+
* Hubert Gruniaux -- C and C++ lexer improvements
|
| 275 |
+
* Thomas Symalla -- AMDGPU Lexer
|
| 276 |
+
* 15b3 -- Image Formatter improvements
|
| 277 |
+
* Fabian Neumann -- CDDL lexer
|
| 278 |
+
* Thomas Duboucher -- CDDL lexer
|
| 279 |
+
* Philipp Imhof -- Pango Markup formatter
|
| 280 |
+
* Thomas Voss -- Sed lexer
|
| 281 |
+
* Martin Fischer -- WCAG contrast testing
|
| 282 |
+
* Marc Auberer -- Spice lexer
|
| 283 |
+
* Amr Hesham -- Carbon lexer
|
| 284 |
+
* diskdance -- Wikitext lexer
|
| 285 |
+
* vanillajonathan -- PRQL lexer
|
| 286 |
+
* Nikolay Antipov -- OpenSCAD lexer
|
| 287 |
+
* Markus Meyer, Nextron Systems -- YARA lexer
|
| 288 |
+
* Hannes Römer -- Mojo lexer
|
| 289 |
+
* Jan Frederik Schaefer -- PDDL lexer
|
| 290 |
+
|
| 291 |
+
Many thanks for all contributions!
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments-2.19.2.dist-info/licenses/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Copyright (c) 2006-2022 by the respective authors (see AUTHORS file).
|
| 2 |
+
All rights reserved.
|
| 3 |
+
|
| 4 |
+
Redistribution and use in source and binary forms, with or without
|
| 5 |
+
modification, are permitted provided that the following conditions are
|
| 6 |
+
met:
|
| 7 |
+
|
| 8 |
+
* Redistributions of source code must retain the above copyright
|
| 9 |
+
notice, this list of conditions and the following disclaimer.
|
| 10 |
+
|
| 11 |
+
* Redistributions in binary form must reproduce the above copyright
|
| 12 |
+
notice, this list of conditions and the following disclaimer in the
|
| 13 |
+
documentation and/or other materials provided with the distribution.
|
| 14 |
+
|
| 15 |
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
| 16 |
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
| 17 |
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
| 18 |
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
| 19 |
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
| 20 |
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
| 21 |
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
| 22 |
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
| 23 |
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| 24 |
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| 25 |
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/oberon.py
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.oberon
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for Oberon family languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import RegexLexer, include, words
|
| 14 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 15 |
+
Number, Punctuation
|
| 16 |
+
|
| 17 |
+
__all__ = ['ComponentPascalLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class ComponentPascalLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
For Component Pascal source code.
|
| 23 |
+
"""
|
| 24 |
+
name = 'Component Pascal'
|
| 25 |
+
aliases = ['componentpascal', 'cp']
|
| 26 |
+
filenames = ['*.cp', '*.cps']
|
| 27 |
+
mimetypes = ['text/x-component-pascal']
|
| 28 |
+
url = 'https://blackboxframework.org'
|
| 29 |
+
version_added = '2.1'
|
| 30 |
+
|
| 31 |
+
flags = re.MULTILINE | re.DOTALL
|
| 32 |
+
|
| 33 |
+
tokens = {
|
| 34 |
+
'root': [
|
| 35 |
+
include('whitespace'),
|
| 36 |
+
include('comments'),
|
| 37 |
+
include('punctuation'),
|
| 38 |
+
include('numliterals'),
|
| 39 |
+
include('strings'),
|
| 40 |
+
include('operators'),
|
| 41 |
+
include('builtins'),
|
| 42 |
+
include('identifiers'),
|
| 43 |
+
],
|
| 44 |
+
'whitespace': [
|
| 45 |
+
(r'\n+', Text), # blank lines
|
| 46 |
+
(r'\s+', Text), # whitespace
|
| 47 |
+
],
|
| 48 |
+
'comments': [
|
| 49 |
+
(r'\(\*([^$].*?)\*\)', Comment.Multiline),
|
| 50 |
+
# TODO: nested comments (* (* ... *) ... (* ... *) *) not supported!
|
| 51 |
+
],
|
| 52 |
+
'punctuation': [
|
| 53 |
+
(r'[()\[\]{},.:;|]', Punctuation),
|
| 54 |
+
],
|
| 55 |
+
'numliterals': [
|
| 56 |
+
(r'[0-9A-F]+X\b', Number.Hex), # char code
|
| 57 |
+
(r'[0-9A-F]+[HL]\b', Number.Hex), # hexadecimal number
|
| 58 |
+
(r'[0-9]+\.[0-9]+E[+-][0-9]+', Number.Float), # real number
|
| 59 |
+
(r'[0-9]+\.[0-9]+', Number.Float), # real number
|
| 60 |
+
(r'[0-9]+', Number.Integer), # decimal whole number
|
| 61 |
+
],
|
| 62 |
+
'strings': [
|
| 63 |
+
(r"'[^\n']*'", String), # single quoted string
|
| 64 |
+
(r'"[^\n"]*"', String), # double quoted string
|
| 65 |
+
],
|
| 66 |
+
'operators': [
|
| 67 |
+
# Arithmetic Operators
|
| 68 |
+
(r'[+-]', Operator),
|
| 69 |
+
(r'[*/]', Operator),
|
| 70 |
+
# Relational Operators
|
| 71 |
+
(r'[=#<>]', Operator),
|
| 72 |
+
# Dereferencing Operator
|
| 73 |
+
(r'\^', Operator),
|
| 74 |
+
# Logical AND Operator
|
| 75 |
+
(r'&', Operator),
|
| 76 |
+
# Logical NOT Operator
|
| 77 |
+
(r'~', Operator),
|
| 78 |
+
# Assignment Symbol
|
| 79 |
+
(r':=', Operator),
|
| 80 |
+
# Range Constructor
|
| 81 |
+
(r'\.\.', Operator),
|
| 82 |
+
(r'\$', Operator),
|
| 83 |
+
],
|
| 84 |
+
'identifiers': [
|
| 85 |
+
(r'([a-zA-Z_$][\w$]*)', Name),
|
| 86 |
+
],
|
| 87 |
+
'builtins': [
|
| 88 |
+
(words((
|
| 89 |
+
'ANYPTR', 'ANYREC', 'BOOLEAN', 'BYTE', 'CHAR', 'INTEGER', 'LONGINT',
|
| 90 |
+
'REAL', 'SET', 'SHORTCHAR', 'SHORTINT', 'SHORTREAL'
|
| 91 |
+
), suffix=r'\b'), Keyword.Type),
|
| 92 |
+
(words((
|
| 93 |
+
'ABS', 'ABSTRACT', 'ARRAY', 'ASH', 'ASSERT', 'BEGIN', 'BITS', 'BY',
|
| 94 |
+
'CAP', 'CASE', 'CHR', 'CLOSE', 'CONST', 'DEC', 'DIV', 'DO', 'ELSE',
|
| 95 |
+
'ELSIF', 'EMPTY', 'END', 'ENTIER', 'EXCL', 'EXIT', 'EXTENSIBLE', 'FOR',
|
| 96 |
+
'HALT', 'IF', 'IMPORT', 'IN', 'INC', 'INCL', 'IS', 'LEN', 'LIMITED',
|
| 97 |
+
'LONG', 'LOOP', 'MAX', 'MIN', 'MOD', 'MODULE', 'NEW', 'ODD', 'OF',
|
| 98 |
+
'OR', 'ORD', 'OUT', 'POINTER', 'PROCEDURE', 'RECORD', 'REPEAT', 'RETURN',
|
| 99 |
+
'SHORT', 'SHORTCHAR', 'SHORTINT', 'SIZE', 'THEN', 'TYPE', 'TO', 'UNTIL',
|
| 100 |
+
'VAR', 'WHILE', 'WITH'
|
| 101 |
+
), suffix=r'\b'), Keyword.Reserved),
|
| 102 |
+
(r'(TRUE|FALSE|NIL|INF)\b', Keyword.Constant),
|
| 103 |
+
]
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
def analyse_text(text):
|
| 107 |
+
"""The only other lexer using .cp is the C++ one, so we check if for
|
| 108 |
+
a few common Pascal keywords here. Those are unfortunately quite
|
| 109 |
+
common across various business languages as well."""
|
| 110 |
+
result = 0
|
| 111 |
+
if 'BEGIN' in text:
|
| 112 |
+
result += 0.01
|
| 113 |
+
if 'END' in text:
|
| 114 |
+
result += 0.01
|
| 115 |
+
if 'PROCEDURE' in text:
|
| 116 |
+
result += 0.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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.objective
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for Objective-C family languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import RegexLexer, include, bygroups, using, this, words, \
|
| 14 |
+
inherit, default
|
| 15 |
+
from pygments.token import Text, Keyword, Name, String, Operator, \
|
| 16 |
+
Number, Punctuation, Literal, Comment, Whitespace
|
| 17 |
+
|
| 18 |
+
from pygments.lexers.c_cpp import CLexer, CppLexer
|
| 19 |
+
|
| 20 |
+
__all__ = ['ObjectiveCLexer', 'ObjectiveCppLexer', 'LogosLexer', 'SwiftLexer']
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
def objective(baselexer):
|
| 24 |
+
"""
|
| 25 |
+
Generate a subclass of baselexer that accepts the Objective-C syntax
|
| 26 |
+
extensions.
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
+
# Have to be careful not to accidentally match JavaDoc/Doxygen syntax here,
|
| 30 |
+
# since that's quite common in ordinary C/C++ files. It's OK to match
|
| 31 |
+
# JavaDoc/Doxygen keywords that only apply to Objective-C, mind.
|
| 32 |
+
#
|
| 33 |
+
# The upshot of this is that we CANNOT match @class or @interface
|
| 34 |
+
_oc_keywords = re.compile(r'@(?:end|implementation|protocol)')
|
| 35 |
+
|
| 36 |
+
# Matches [ <ws>? identifier <ws> ( identifier <ws>? ] | identifier? : )
|
| 37 |
+
# (note the identifier is *optional* when there is a ':'!)
|
| 38 |
+
_oc_message = re.compile(r'\[\s*[a-zA-Z_]\w*\s+'
|
| 39 |
+
r'(?:[a-zA-Z_]\w*\s*\]|'
|
| 40 |
+
r'(?:[a-zA-Z_]\w*)?:)')
|
| 41 |
+
|
| 42 |
+
class GeneratedObjectiveCVariant(baselexer):
|
| 43 |
+
"""
|
| 44 |
+
Implements Objective-C syntax on top of an existing C family lexer.
|
| 45 |
+
"""
|
| 46 |
+
|
| 47 |
+
tokens = {
|
| 48 |
+
'statements': [
|
| 49 |
+
(r'@"', String, 'string'),
|
| 50 |
+
(r'@(YES|NO)', Number),
|
| 51 |
+
(r"@'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
|
| 52 |
+
(r'@(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?', Number.Float),
|
| 53 |
+
(r'@(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
| 54 |
+
(r'@0x[0-9a-fA-F]+[Ll]?', Number.Hex),
|
| 55 |
+
(r'@0[0-7]+[Ll]?', Number.Oct),
|
| 56 |
+
(r'@\d+[Ll]?', Number.Integer),
|
| 57 |
+
(r'@\(', Literal, 'literal_number'),
|
| 58 |
+
(r'@\[', Literal, 'literal_array'),
|
| 59 |
+
(r'@\{', Literal, 'literal_dictionary'),
|
| 60 |
+
(words((
|
| 61 |
+
'@selector', '@private', '@protected', '@public', '@encode',
|
| 62 |
+
'@synchronized', '@try', '@throw', '@catch', '@finally',
|
| 63 |
+
'@end', '@property', '@synthesize', '__bridge', '__bridge_transfer',
|
| 64 |
+
'__autoreleasing', '__block', '__weak', '__strong', 'weak', 'strong',
|
| 65 |
+
'copy', 'retain', 'assign', 'unsafe_unretained', 'atomic', 'nonatomic',
|
| 66 |
+
'readonly', 'readwrite', 'setter', 'getter', 'typeof', 'in',
|
| 67 |
+
'out', 'inout', 'release', 'class', '@dynamic', '@optional',
|
| 68 |
+
'@required', '@autoreleasepool', '@import'), suffix=r'\b'),
|
| 69 |
+
Keyword),
|
| 70 |
+
(words(('id', 'instancetype', 'Class', 'IMP', 'SEL', 'BOOL',
|
| 71 |
+
'IBOutlet', 'IBAction', 'unichar'), suffix=r'\b'),
|
| 72 |
+
Keyword.Type),
|
| 73 |
+
(r'@(true|false|YES|NO)\n', Name.Builtin),
|
| 74 |
+
(r'(YES|NO|nil|self|super)\b', Name.Builtin),
|
| 75 |
+
# Carbon types
|
| 76 |
+
(r'(Boolean|UInt8|SInt8|UInt16|SInt16|UInt32|SInt32)\b', Keyword.Type),
|
| 77 |
+
# Carbon built-ins
|
| 78 |
+
(r'(TRUE|FALSE)\b', Name.Builtin),
|
| 79 |
+
(r'(@interface|@implementation)(\s+)', bygroups(Keyword, Text),
|
| 80 |
+
('#pop', 'oc_classname')),
|
| 81 |
+
(r'(@class|@protocol)(\s+)', bygroups(Keyword, Text),
|
| 82 |
+
('#pop', 'oc_forward_classname')),
|
| 83 |
+
# @ can also prefix other expressions like @{...} or @(...)
|
| 84 |
+
(r'@', Punctuation),
|
| 85 |
+
inherit,
|
| 86 |
+
],
|
| 87 |
+
'oc_classname': [
|
| 88 |
+
# interface definition that inherits
|
| 89 |
+
(r'([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?(\s*)(\{)',
|
| 90 |
+
bygroups(Name.Class, Text, Name.Class, Text, Punctuation),
|
| 91 |
+
('#pop', 'oc_ivars')),
|
| 92 |
+
(r'([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?',
|
| 93 |
+
bygroups(Name.Class, Text, Name.Class), '#pop'),
|
| 94 |
+
# interface definition for a category
|
| 95 |
+
(r'([a-zA-Z$_][\w$]*)(\s*)(\([a-zA-Z$_][\w$]*\))(\s*)(\{)',
|
| 96 |
+
bygroups(Name.Class, Text, Name.Label, Text, Punctuation),
|
| 97 |
+
('#pop', 'oc_ivars')),
|
| 98 |
+
(r'([a-zA-Z$_][\w$]*)(\s*)(\([a-zA-Z$_][\w$]*\))',
|
| 99 |
+
bygroups(Name.Class, Text, Name.Label), '#pop'),
|
| 100 |
+
# simple interface / implementation
|
| 101 |
+
(r'([a-zA-Z$_][\w$]*)(\s*)(\{)',
|
| 102 |
+
bygroups(Name.Class, Text, Punctuation), ('#pop', 'oc_ivars')),
|
| 103 |
+
(r'([a-zA-Z$_][\w$]*)', Name.Class, '#pop')
|
| 104 |
+
],
|
| 105 |
+
'oc_forward_classname': [
|
| 106 |
+
(r'([a-zA-Z$_][\w$]*)(\s*,\s*)',
|
| 107 |
+
bygroups(Name.Class, Text), 'oc_forward_classname'),
|
| 108 |
+
(r'([a-zA-Z$_][\w$]*)(\s*;?)',
|
| 109 |
+
bygroups(Name.Class, Text), '#pop')
|
| 110 |
+
],
|
| 111 |
+
'oc_ivars': [
|
| 112 |
+
include('whitespace'),
|
| 113 |
+
include('statements'),
|
| 114 |
+
(';', Punctuation),
|
| 115 |
+
(r'\{', Punctuation, '#push'),
|
| 116 |
+
(r'\}', Punctuation, '#pop'),
|
| 117 |
+
],
|
| 118 |
+
'root': [
|
| 119 |
+
# methods
|
| 120 |
+
(r'^([-+])(\s*)' # method marker
|
| 121 |
+
r'(\(.*?\))?(\s*)' # return type
|
| 122 |
+
r'([a-zA-Z$_][\w$]*:?)', # begin of method name
|
| 123 |
+
bygroups(Punctuation, Text, using(this),
|
| 124 |
+
Text, Name.Function),
|
| 125 |
+
'method'),
|
| 126 |
+
inherit,
|
| 127 |
+
],
|
| 128 |
+
'method': [
|
| 129 |
+
include('whitespace'),
|
| 130 |
+
# TODO unsure if ellipses are allowed elsewhere, see
|
| 131 |
+
# discussion in Issue 789
|
| 132 |
+
(r',', Punctuation),
|
| 133 |
+
(r'\.\.\.', Punctuation),
|
| 134 |
+
(r'(\(.*?\))(\s*)([a-zA-Z$_][\w$]*)',
|
| 135 |
+
bygroups(using(this), Text, Name.Variable)),
|
| 136 |
+
(r'[a-zA-Z$_][\w$]*:', Name.Function),
|
| 137 |
+
(';', Punctuation, '#pop'),
|
| 138 |
+
(r'\{', Punctuation, 'function'),
|
| 139 |
+
default('#pop'),
|
| 140 |
+
],
|
| 141 |
+
'literal_number': [
|
| 142 |
+
(r'\(', Punctuation, 'literal_number_inner'),
|
| 143 |
+
(r'\)', Literal, '#pop'),
|
| 144 |
+
include('statement'),
|
| 145 |
+
],
|
| 146 |
+
'literal_number_inner': [
|
| 147 |
+
(r'\(', Punctuation, '#push'),
|
| 148 |
+
(r'\)', Punctuation, '#pop'),
|
| 149 |
+
include('statement'),
|
| 150 |
+
],
|
| 151 |
+
'literal_array': [
|
| 152 |
+
(r'\[', Punctuation, 'literal_array_inner'),
|
| 153 |
+
(r'\]', Literal, '#pop'),
|
| 154 |
+
include('statement'),
|
| 155 |
+
],
|
| 156 |
+
'literal_array_inner': [
|
| 157 |
+
(r'\[', Punctuation, '#push'),
|
| 158 |
+
(r'\]', Punctuation, '#pop'),
|
| 159 |
+
include('statement'),
|
| 160 |
+
],
|
| 161 |
+
'literal_dictionary': [
|
| 162 |
+
(r'\}', Literal, '#pop'),
|
| 163 |
+
include('statement'),
|
| 164 |
+
],
|
| 165 |
+
}
|
| 166 |
+
|
| 167 |
+
def analyse_text(text):
|
| 168 |
+
if _oc_keywords.search(text):
|
| 169 |
+
return 1.0
|
| 170 |
+
elif '@"' in text: # strings
|
| 171 |
+
return 0.8
|
| 172 |
+
elif re.search('@[0-9]+', text):
|
| 173 |
+
return 0.7
|
| 174 |
+
elif _oc_message.search(text):
|
| 175 |
+
return 0.8
|
| 176 |
+
return 0
|
| 177 |
+
|
| 178 |
+
def get_tokens_unprocessed(self, text, stack=('root',)):
|
| 179 |
+
from pygments.lexers._cocoa_builtins import COCOA_INTERFACES, \
|
| 180 |
+
COCOA_PROTOCOLS, COCOA_PRIMITIVES
|
| 181 |
+
|
| 182 |
+
for index, token, value in \
|
| 183 |
+
baselexer.get_tokens_unprocessed(self, text, stack):
|
| 184 |
+
if token is Name or token is Name.Class:
|
| 185 |
+
if value in COCOA_INTERFACES or value in COCOA_PROTOCOLS \
|
| 186 |
+
or value in COCOA_PRIMITIVES:
|
| 187 |
+
token = Name.Builtin.Pseudo
|
| 188 |
+
|
| 189 |
+
yield index, token, value
|
| 190 |
+
|
| 191 |
+
return GeneratedObjectiveCVariant
|
| 192 |
+
|
| 193 |
+
|
| 194 |
+
class ObjectiveCLexer(objective(CLexer)):
|
| 195 |
+
"""
|
| 196 |
+
For Objective-C source code with preprocessor directives.
|
| 197 |
+
"""
|
| 198 |
+
|
| 199 |
+
name = 'Objective-C'
|
| 200 |
+
url = 'https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html'
|
| 201 |
+
aliases = ['objective-c', 'objectivec', 'obj-c', 'objc']
|
| 202 |
+
filenames = ['*.m', '*.h']
|
| 203 |
+
mimetypes = ['text/x-objective-c']
|
| 204 |
+
version_added = ''
|
| 205 |
+
priority = 0.05 # Lower than C
|
| 206 |
+
|
| 207 |
+
|
| 208 |
+
class ObjectiveCppLexer(objective(CppLexer)):
|
| 209 |
+
"""
|
| 210 |
+
For Objective-C++ source code with preprocessor directives.
|
| 211 |
+
"""
|
| 212 |
+
|
| 213 |
+
name = 'Objective-C++'
|
| 214 |
+
aliases = ['objective-c++', 'objectivec++', 'obj-c++', 'objc++']
|
| 215 |
+
filenames = ['*.mm', '*.hh']
|
| 216 |
+
mimetypes = ['text/x-objective-c++']
|
| 217 |
+
version_added = ''
|
| 218 |
+
priority = 0.05 # Lower than C++
|
| 219 |
+
|
| 220 |
+
|
| 221 |
+
class LogosLexer(ObjectiveCppLexer):
|
| 222 |
+
"""
|
| 223 |
+
For Logos + Objective-C source code with preprocessor directives.
|
| 224 |
+
"""
|
| 225 |
+
|
| 226 |
+
name = 'Logos'
|
| 227 |
+
aliases = ['logos']
|
| 228 |
+
filenames = ['*.x', '*.xi', '*.xm', '*.xmi']
|
| 229 |
+
mimetypes = ['text/x-logos']
|
| 230 |
+
version_added = '1.6'
|
| 231 |
+
priority = 0.25
|
| 232 |
+
|
| 233 |
+
tokens = {
|
| 234 |
+
'statements': [
|
| 235 |
+
(r'(%orig|%log)\b', Keyword),
|
| 236 |
+
(r'(%c)\b(\()(\s*)([a-zA-Z$_][\w$]*)(\s*)(\))',
|
| 237 |
+
bygroups(Keyword, Punctuation, Text, Name.Class, Text, Punctuation)),
|
| 238 |
+
(r'(%init)\b(\()',
|
| 239 |
+
bygroups(Keyword, Punctuation), 'logos_init_directive'),
|
| 240 |
+
(r'(%init)(?=\s*;)', bygroups(Keyword)),
|
| 241 |
+
(r'(%hook|%group)(\s+)([a-zA-Z$_][\w$]+)',
|
| 242 |
+
bygroups(Keyword, Text, Name.Class), '#pop'),
|
| 243 |
+
(r'(%subclass)(\s+)', bygroups(Keyword, Text),
|
| 244 |
+
('#pop', 'logos_classname')),
|
| 245 |
+
inherit,
|
| 246 |
+
],
|
| 247 |
+
'logos_init_directive': [
|
| 248 |
+
(r'\s+', Text),
|
| 249 |
+
(',', Punctuation, ('logos_init_directive', '#pop')),
|
| 250 |
+
(r'([a-zA-Z$_][\w$]*)(\s*)(=)(\s*)([^);]*)',
|
| 251 |
+
bygroups(Name.Class, Text, Punctuation, Text, Text)),
|
| 252 |
+
(r'([a-zA-Z$_][\w$]*)', Name.Class),
|
| 253 |
+
(r'\)', Punctuation, '#pop'),
|
| 254 |
+
],
|
| 255 |
+
'logos_classname': [
|
| 256 |
+
(r'([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?',
|
| 257 |
+
bygroups(Name.Class, Text, Name.Class), '#pop'),
|
| 258 |
+
(r'([a-zA-Z$_][\w$]*)', Name.Class, '#pop')
|
| 259 |
+
],
|
| 260 |
+
'root': [
|
| 261 |
+
(r'(%subclass)(\s+)', bygroups(Keyword, Text),
|
| 262 |
+
'logos_classname'),
|
| 263 |
+
(r'(%hook|%group)(\s+)([a-zA-Z$_][\w$]+)',
|
| 264 |
+
bygroups(Keyword, Text, Name.Class)),
|
| 265 |
+
(r'(%config)(\s*\(\s*)(\w+)(\s*=)(.*?)(\)\s*)',
|
| 266 |
+
bygroups(Keyword, Text, Name.Variable, Text, String, Text)),
|
| 267 |
+
(r'(%ctor)(\s*)(\{)', bygroups(Keyword, Text, Punctuation),
|
| 268 |
+
'function'),
|
| 269 |
+
(r'(%new)(\s*)(\()(.*?)(\))',
|
| 270 |
+
bygroups(Keyword, Text, Keyword, String, Keyword)),
|
| 271 |
+
(r'(\s*)(%end)(\s*)', bygroups(Text, Keyword, Text)),
|
| 272 |
+
inherit,
|
| 273 |
+
],
|
| 274 |
+
}
|
| 275 |
+
|
| 276 |
+
_logos_keywords = re.compile(r'%(?:hook|ctor|init|c\()')
|
| 277 |
+
|
| 278 |
+
def analyse_text(text):
|
| 279 |
+
if LogosLexer._logos_keywords.search(text):
|
| 280 |
+
return 1.0
|
| 281 |
+
return 0
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
class SwiftLexer(RegexLexer):
|
| 285 |
+
"""
|
| 286 |
+
For Swift source.
|
| 287 |
+
"""
|
| 288 |
+
name = 'Swift'
|
| 289 |
+
url = 'https://www.swift.org/'
|
| 290 |
+
filenames = ['*.swift']
|
| 291 |
+
aliases = ['swift']
|
| 292 |
+
mimetypes = ['text/x-swift']
|
| 293 |
+
version_added = '2.0'
|
| 294 |
+
|
| 295 |
+
tokens = {
|
| 296 |
+
'root': [
|
| 297 |
+
# Whitespace and Comments
|
| 298 |
+
(r'\n', Text),
|
| 299 |
+
(r'\s+', Whitespace),
|
| 300 |
+
(r'//', Comment.Single, 'comment-single'),
|
| 301 |
+
(r'/\*', Comment.Multiline, 'comment-multi'),
|
| 302 |
+
(r'#(if|elseif|else|endif|available)\b', Comment.Preproc, 'preproc'),
|
| 303 |
+
|
| 304 |
+
# Keywords
|
| 305 |
+
include('keywords'),
|
| 306 |
+
|
| 307 |
+
# Global Types
|
| 308 |
+
(words((
|
| 309 |
+
'Array', 'AutoreleasingUnsafeMutablePointer', 'BidirectionalReverseView',
|
| 310 |
+
'Bit', 'Bool', 'CFunctionPointer', 'COpaquePointer', 'CVaListPointer',
|
| 311 |
+
'Character', 'ClosedInterval', 'CollectionOfOne', 'ContiguousArray',
|
| 312 |
+
'Dictionary', 'DictionaryGenerator', 'DictionaryIndex', 'Double',
|
| 313 |
+
'EmptyCollection', 'EmptyGenerator', 'EnumerateGenerator',
|
| 314 |
+
'EnumerateSequence', 'FilterCollectionView',
|
| 315 |
+
'FilterCollectionViewIndex', 'FilterGenerator', 'FilterSequenceView',
|
| 316 |
+
'Float', 'Float80', 'FloatingPointClassification', 'GeneratorOf',
|
| 317 |
+
'GeneratorOfOne', 'GeneratorSequence', 'HalfOpenInterval', 'HeapBuffer',
|
| 318 |
+
'HeapBufferStorage', 'ImplicitlyUnwrappedOptional', 'IndexingGenerator',
|
| 319 |
+
'Int', 'Int16', 'Int32', 'Int64', 'Int8', 'LazyBidirectionalCollection',
|
| 320 |
+
'LazyForwardCollection', 'LazyRandomAccessCollection',
|
| 321 |
+
'LazySequence', 'MapCollectionView', 'MapSequenceGenerator',
|
| 322 |
+
'MapSequenceView', 'MirrorDisposition', 'ObjectIdentifier', 'OnHeap',
|
| 323 |
+
'Optional', 'PermutationGenerator', 'QuickLookObject',
|
| 324 |
+
'RandomAccessReverseView', 'Range', 'RangeGenerator', 'RawByte', 'Repeat',
|
| 325 |
+
'ReverseBidirectionalIndex', 'ReverseRandomAccessIndex', 'SequenceOf',
|
| 326 |
+
'SinkOf', 'Slice', 'StaticString', 'StrideThrough', 'StrideThroughGenerator',
|
| 327 |
+
'StrideTo', 'StrideToGenerator', 'String', 'UInt', 'UInt16', 'UInt32',
|
| 328 |
+
'UInt64', 'UInt8', 'UTF16', 'UTF32', 'UTF8', 'UnicodeDecodingResult',
|
| 329 |
+
'UnicodeScalar', 'Unmanaged', 'UnsafeBufferPointer',
|
| 330 |
+
'UnsafeBufferPointerGenerator', 'UnsafeMutableBufferPointer',
|
| 331 |
+
'UnsafeMutablePointer', 'UnsafePointer', 'Zip2', 'ZipGenerator2',
|
| 332 |
+
# Protocols
|
| 333 |
+
'AbsoluteValuable', 'AnyObject', 'ArrayLiteralConvertible',
|
| 334 |
+
'BidirectionalIndexType', 'BitwiseOperationsType',
|
| 335 |
+
'BooleanLiteralConvertible', 'BooleanType', 'CVarArgType',
|
| 336 |
+
'CollectionType', 'Comparable', 'DebugPrintable',
|
| 337 |
+
'DictionaryLiteralConvertible', 'Equatable',
|
| 338 |
+
'ExtendedGraphemeClusterLiteralConvertible',
|
| 339 |
+
'ExtensibleCollectionType', 'FloatLiteralConvertible',
|
| 340 |
+
'FloatingPointType', 'ForwardIndexType', 'GeneratorType', 'Hashable',
|
| 341 |
+
'IntegerArithmeticType', 'IntegerLiteralConvertible', 'IntegerType',
|
| 342 |
+
'IntervalType', 'MirrorType', 'MutableCollectionType', 'MutableSliceable',
|
| 343 |
+
'NilLiteralConvertible', 'OutputStreamType', 'Printable',
|
| 344 |
+
'RandomAccessIndexType', 'RangeReplaceableCollectionType',
|
| 345 |
+
'RawOptionSetType', 'RawRepresentable', 'Reflectable', 'SequenceType',
|
| 346 |
+
'SignedIntegerType', 'SignedNumberType', 'SinkType', 'Sliceable',
|
| 347 |
+
'Streamable', 'Strideable', 'StringInterpolationConvertible',
|
| 348 |
+
'StringLiteralConvertible', 'UnicodeCodecType',
|
| 349 |
+
'UnicodeScalarLiteralConvertible', 'UnsignedIntegerType',
|
| 350 |
+
'_ArrayBufferType', '_BidirectionalIndexType', '_CocoaStringType',
|
| 351 |
+
'_CollectionType', '_Comparable', '_ExtensibleCollectionType',
|
| 352 |
+
'_ForwardIndexType', '_Incrementable', '_IntegerArithmeticType',
|
| 353 |
+
'_IntegerType', '_ObjectiveCBridgeable', '_RandomAccessIndexType',
|
| 354 |
+
'_RawOptionSetType', '_SequenceType', '_Sequence_Type',
|
| 355 |
+
'_SignedIntegerType', '_SignedNumberType', '_Sliceable', '_Strideable',
|
| 356 |
+
'_SwiftNSArrayRequiredOverridesType', '_SwiftNSArrayType',
|
| 357 |
+
'_SwiftNSCopyingType', '_SwiftNSDictionaryRequiredOverridesType',
|
| 358 |
+
'_SwiftNSDictionaryType', '_SwiftNSEnumeratorType',
|
| 359 |
+
'_SwiftNSFastEnumerationType', '_SwiftNSStringRequiredOverridesType',
|
| 360 |
+
'_SwiftNSStringType', '_UnsignedIntegerType',
|
| 361 |
+
# Variables
|
| 362 |
+
'C_ARGC', 'C_ARGV', 'Process',
|
| 363 |
+
# Typealiases
|
| 364 |
+
'Any', 'AnyClass', 'BooleanLiteralType', 'CBool', 'CChar', 'CChar16',
|
| 365 |
+
'CChar32', 'CDouble', 'CFloat', 'CInt', 'CLong', 'CLongLong', 'CShort',
|
| 366 |
+
'CSignedChar', 'CUnsignedInt', 'CUnsignedLong', 'CUnsignedShort',
|
| 367 |
+
'CWideChar', 'ExtendedGraphemeClusterType', 'Float32', 'Float64',
|
| 368 |
+
'FloatLiteralType', 'IntMax', 'IntegerLiteralType', 'StringLiteralType',
|
| 369 |
+
'UIntMax', 'UWord', 'UnicodeScalarType', 'Void', 'Word',
|
| 370 |
+
# Foundation/Cocoa
|
| 371 |
+
'NSErrorPointer', 'NSObjectProtocol', 'Selector'), suffix=r'\b'),
|
| 372 |
+
Name.Builtin),
|
| 373 |
+
# Functions
|
| 374 |
+
(words((
|
| 375 |
+
'abs', 'advance', 'alignof', 'alignofValue', 'assert', 'assertionFailure',
|
| 376 |
+
'contains', 'count', 'countElements', 'debugPrint', 'debugPrintln',
|
| 377 |
+
'distance', 'dropFirst', 'dropLast', 'dump', 'enumerate', 'equal',
|
| 378 |
+
'extend', 'fatalError', 'filter', 'find', 'first', 'getVaList', 'indices',
|
| 379 |
+
'insert', 'isEmpty', 'join', 'last', 'lazy', 'lexicographicalCompare',
|
| 380 |
+
'map', 'max', 'maxElement', 'min', 'minElement', 'numericCast', 'overlaps',
|
| 381 |
+
'partition', 'precondition', 'preconditionFailure', 'prefix', 'print',
|
| 382 |
+
'println', 'reduce', 'reflect', 'removeAll', 'removeAtIndex', 'removeLast',
|
| 383 |
+
'removeRange', 'reverse', 'sizeof', 'sizeofValue', 'sort', 'sorted',
|
| 384 |
+
'splice', 'split', 'startsWith', 'stride', 'strideof', 'strideofValue',
|
| 385 |
+
'suffix', 'swap', 'toDebugString', 'toString', 'transcode',
|
| 386 |
+
'underestimateCount', 'unsafeAddressOf', 'unsafeBitCast', 'unsafeDowncast',
|
| 387 |
+
'withExtendedLifetime', 'withUnsafeMutablePointer',
|
| 388 |
+
'withUnsafeMutablePointers', 'withUnsafePointer', 'withUnsafePointers',
|
| 389 |
+
'withVaList'), suffix=r'\b'),
|
| 390 |
+
Name.Builtin.Pseudo),
|
| 391 |
+
|
| 392 |
+
# Implicit Block Variables
|
| 393 |
+
(r'\$\d+', Name.Variable),
|
| 394 |
+
|
| 395 |
+
# Binary Literal
|
| 396 |
+
(r'0b[01_]+', Number.Bin),
|
| 397 |
+
# Octal Literal
|
| 398 |
+
(r'0o[0-7_]+', Number.Oct),
|
| 399 |
+
# Hexadecimal Literal
|
| 400 |
+
(r'0x[0-9a-fA-F_]+', Number.Hex),
|
| 401 |
+
# Decimal Literal
|
| 402 |
+
(r'[0-9][0-9_]*(\.[0-9_]+[eE][+\-]?[0-9_]+|'
|
| 403 |
+
r'\.[0-9_]*|[eE][+\-]?[0-9_]+)', Number.Float),
|
| 404 |
+
(r'[0-9][0-9_]*', Number.Integer),
|
| 405 |
+
# String Literal
|
| 406 |
+
(r'"""', String, 'string-multi'),
|
| 407 |
+
(r'"', String, 'string'),
|
| 408 |
+
|
| 409 |
+
# Operators and Punctuation
|
| 410 |
+
(r'[(){}\[\].,:;=@#`?]|->|[<&?](?=\w)|(?<=\w)[>!?]', Punctuation),
|
| 411 |
+
(r'[/=\-+!*%<>&|^?~]+', Operator),
|
| 412 |
+
|
| 413 |
+
# Identifier
|
| 414 |
+
(r'[a-zA-Z_]\w*', Name)
|
| 415 |
+
],
|
| 416 |
+
'keywords': [
|
| 417 |
+
(words((
|
| 418 |
+
'as', 'async', 'await', 'break', 'case', 'catch', 'continue', 'default', 'defer',
|
| 419 |
+
'do', 'else', 'fallthrough', 'for', 'guard', 'if', 'in', 'is',
|
| 420 |
+
'repeat', 'return', '#selector', 'switch', 'throw', 'try',
|
| 421 |
+
'where', 'while'), suffix=r'\b'),
|
| 422 |
+
Keyword),
|
| 423 |
+
(r'@availability\([^)]+\)', Keyword.Reserved),
|
| 424 |
+
(words((
|
| 425 |
+
'associativity', 'convenience', 'dynamic', 'didSet', 'final',
|
| 426 |
+
'get', 'indirect', 'infix', 'inout', 'lazy', 'left', 'mutating',
|
| 427 |
+
'none', 'nonmutating', 'optional', 'override', 'postfix',
|
| 428 |
+
'precedence', 'prefix', 'Protocol', 'required', 'rethrows',
|
| 429 |
+
'right', 'set', 'throws', 'Type', 'unowned', 'weak', 'willSet',
|
| 430 |
+
'@availability', '@autoclosure', '@noreturn',
|
| 431 |
+
'@NSApplicationMain', '@NSCopying', '@NSManaged', '@objc',
|
| 432 |
+
'@UIApplicationMain', '@IBAction', '@IBDesignable',
|
| 433 |
+
'@IBInspectable', '@IBOutlet'), suffix=r'\b'),
|
| 434 |
+
Keyword.Reserved),
|
| 435 |
+
(r'(as|dynamicType|false|is|nil|self|Self|super|true|__COLUMN__'
|
| 436 |
+
r'|__FILE__|__FUNCTION__|__LINE__|_'
|
| 437 |
+
r'|#(?:file|line|column|function))\b', Keyword.Constant),
|
| 438 |
+
(r'import\b', Keyword.Declaration, 'module'),
|
| 439 |
+
(r'(class|enum|extension|struct|protocol)(\s+)([a-zA-Z_]\w*)',
|
| 440 |
+
bygroups(Keyword.Declaration, Whitespace, Name.Class)),
|
| 441 |
+
(r'(func)(\s+)([a-zA-Z_]\w*)',
|
| 442 |
+
bygroups(Keyword.Declaration, Whitespace, Name.Function)),
|
| 443 |
+
(r'(var|let)(\s+)([a-zA-Z_]\w*)', bygroups(Keyword.Declaration,
|
| 444 |
+
Whitespace, Name.Variable)),
|
| 445 |
+
(words((
|
| 446 |
+
'actor', 'associatedtype', 'class', 'deinit', 'enum', 'extension', 'func', 'import',
|
| 447 |
+
'init', 'internal', 'let', 'operator', 'private', 'protocol', 'public',
|
| 448 |
+
'static', 'struct', 'subscript', 'typealias', 'var'), suffix=r'\b'),
|
| 449 |
+
Keyword.Declaration)
|
| 450 |
+
],
|
| 451 |
+
'comment': [
|
| 452 |
+
(r':param: [a-zA-Z_]\w*|:returns?:|(FIXME|MARK|TODO):',
|
| 453 |
+
Comment.Special)
|
| 454 |
+
],
|
| 455 |
+
|
| 456 |
+
# Nested
|
| 457 |
+
'comment-single': [
|
| 458 |
+
(r'\n', Whitespace, '#pop'),
|
| 459 |
+
include('comment'),
|
| 460 |
+
(r'[^\n]+', Comment.Single)
|
| 461 |
+
],
|
| 462 |
+
'comment-multi': [
|
| 463 |
+
include('comment'),
|
| 464 |
+
(r'[^*/]+', Comment.Multiline),
|
| 465 |
+
(r'/\*', Comment.Multiline, '#push'),
|
| 466 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 467 |
+
(r'[*/]+', Comment.Multiline)
|
| 468 |
+
],
|
| 469 |
+
'module': [
|
| 470 |
+
(r'\n', Whitespace, '#pop'),
|
| 471 |
+
(r'[a-zA-Z_]\w*', Name.Class),
|
| 472 |
+
include('root')
|
| 473 |
+
],
|
| 474 |
+
'preproc': [
|
| 475 |
+
(r'\n', Whitespace, '#pop'),
|
| 476 |
+
include('keywords'),
|
| 477 |
+
(r'[A-Za-z]\w*', Comment.Preproc),
|
| 478 |
+
include('root')
|
| 479 |
+
],
|
| 480 |
+
'string': [
|
| 481 |
+
(r'"', String, '#pop'),
|
| 482 |
+
include("string-common"),
|
| 483 |
+
],
|
| 484 |
+
'string-multi': [
|
| 485 |
+
(r'"""', String, '#pop'),
|
| 486 |
+
include("string-common"),
|
| 487 |
+
],
|
| 488 |
+
'string-common': [
|
| 489 |
+
(r'\\\(', String.Interpol, 'string-intp'),
|
| 490 |
+
(r"""\\['"\\nrt]|\\x[0-9a-fA-F]{2}|\\[0-7]{1,3}"""
|
| 491 |
+
r"""|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}""", String.Escape),
|
| 492 |
+
(r'[^\\"]+', String),
|
| 493 |
+
(r'\\', String)
|
| 494 |
+
],
|
| 495 |
+
'string-intp': [
|
| 496 |
+
(r'\(', String.Interpol, '#push'),
|
| 497 |
+
(r'\)', String.Interpol, '#pop'),
|
| 498 |
+
include('root')
|
| 499 |
+
]
|
| 500 |
+
}
|
| 501 |
+
|
| 502 |
+
def get_tokens_unprocessed(self, text):
|
| 503 |
+
from pygments.lexers._cocoa_builtins import COCOA_INTERFACES, \
|
| 504 |
+
COCOA_PROTOCOLS, COCOA_PRIMITIVES
|
| 505 |
+
|
| 506 |
+
for index, token, value in \
|
| 507 |
+
RegexLexer.get_tokens_unprocessed(self, text):
|
| 508 |
+
if token is Name or token is Name.Class:
|
| 509 |
+
if value in COCOA_INTERFACES or value in COCOA_PROTOCOLS \
|
| 510 |
+
or value in COCOA_PRIMITIVES:
|
| 511 |
+
token = Name.Builtin.Pseudo
|
| 512 |
+
|
| 513 |
+
yield index, token, value
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/ooc.py
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.ooc
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for the Ooc language.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from pygments.lexer import RegexLexer, bygroups, words
|
| 12 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 13 |
+
Number, Punctuation
|
| 14 |
+
|
| 15 |
+
__all__ = ['OocLexer']
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class OocLexer(RegexLexer):
|
| 19 |
+
"""
|
| 20 |
+
For Ooc source code
|
| 21 |
+
"""
|
| 22 |
+
name = 'Ooc'
|
| 23 |
+
url = 'https://ooc-lang.github.io/'
|
| 24 |
+
aliases = ['ooc']
|
| 25 |
+
filenames = ['*.ooc']
|
| 26 |
+
mimetypes = ['text/x-ooc']
|
| 27 |
+
version_added = '1.2'
|
| 28 |
+
|
| 29 |
+
tokens = {
|
| 30 |
+
'root': [
|
| 31 |
+
(words((
|
| 32 |
+
'class', 'interface', 'implement', 'abstract', 'extends', 'from',
|
| 33 |
+
'this', 'super', 'new', 'const', 'final', 'static', 'import',
|
| 34 |
+
'use', 'extern', 'inline', 'proto', 'break', 'continue',
|
| 35 |
+
'fallthrough', 'operator', 'if', 'else', 'for', 'while', 'do',
|
| 36 |
+
'switch', 'case', 'as', 'in', 'version', 'return', 'true',
|
| 37 |
+
'false', 'null'), prefix=r'\b', suffix=r'\b'),
|
| 38 |
+
Keyword),
|
| 39 |
+
(r'include\b', Keyword, 'include'),
|
| 40 |
+
(r'(cover)([ \t]+)(from)([ \t]+)(\w+[*@]?)',
|
| 41 |
+
bygroups(Keyword, Text, Keyword, Text, Name.Class)),
|
| 42 |
+
(r'(func)((?:[ \t]|\\\n)+)(~[a-z_]\w*)',
|
| 43 |
+
bygroups(Keyword, Text, Name.Function)),
|
| 44 |
+
(r'\bfunc\b', Keyword),
|
| 45 |
+
# Note: %= not listed on https://ooc-lang.github.io/docs/lang/operators/
|
| 46 |
+
(r'//.*', Comment),
|
| 47 |
+
(r'(?s)/\*.*?\*/', Comment.Multiline),
|
| 48 |
+
(r'(==?|\+=?|-[=>]?|\*=?|/=?|:=|!=?|%=?|\?|>{1,3}=?|<{1,3}=?|\.\.|'
|
| 49 |
+
r'&&?|\|\|?|\^=?)', Operator),
|
| 50 |
+
(r'(\.)([ \t]*)([a-z]\w*)', bygroups(Operator, Text,
|
| 51 |
+
Name.Function)),
|
| 52 |
+
(r'[A-Z][A-Z0-9_]+', Name.Constant),
|
| 53 |
+
(r'[A-Z]\w*([@*]|\[[ \t]*\])?', Name.Class),
|
| 54 |
+
|
| 55 |
+
(r'([a-z]\w*(?:~[a-z]\w*)?)((?:[ \t]|\\\n)*)(?=\()',
|
| 56 |
+
bygroups(Name.Function, Text)),
|
| 57 |
+
(r'[a-z]\w*', Name.Variable),
|
| 58 |
+
|
| 59 |
+
# : introduces types
|
| 60 |
+
(r'[:(){}\[\];,]', Punctuation),
|
| 61 |
+
|
| 62 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 63 |
+
(r'0c[0-9]+', Number.Oct),
|
| 64 |
+
(r'0b[01]+', Number.Bin),
|
| 65 |
+
(r'[0-9_]\.[0-9_]*(?!\.)', Number.Float),
|
| 66 |
+
(r'[0-9_]+', Number.Decimal),
|
| 67 |
+
|
| 68 |
+
(r'"(?:\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\"])*"',
|
| 69 |
+
String.Double),
|
| 70 |
+
(r"'(?:\\.|\\[0-9]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'",
|
| 71 |
+
String.Char),
|
| 72 |
+
(r'@', Punctuation), # pointer dereference
|
| 73 |
+
(r'\.', Punctuation), # imports or chain operator
|
| 74 |
+
|
| 75 |
+
(r'\\[ \t\n]', Text),
|
| 76 |
+
(r'[ \t]+', Text),
|
| 77 |
+
],
|
| 78 |
+
'include': [
|
| 79 |
+
(r'[\w/]+', Name),
|
| 80 |
+
(r',', Punctuation),
|
| 81 |
+
(r'[ \t]', Text),
|
| 82 |
+
(r'[;\n]', Text, '#pop'),
|
| 83 |
+
],
|
| 84 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/openscad.py
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.openscad
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for the OpenSCAD languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from pygments.lexer import RegexLexer, bygroups, words, include
|
| 12 |
+
from pygments.token import Text, Comment, Punctuation, Operator, Keyword, Name, Number, Whitespace, Literal, String
|
| 13 |
+
|
| 14 |
+
__all__ = ['OpenScadLexer']
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class OpenScadLexer(RegexLexer):
|
| 18 |
+
"""For openSCAD code.
|
| 19 |
+
"""
|
| 20 |
+
name = "OpenSCAD"
|
| 21 |
+
url = "https://openscad.org/"
|
| 22 |
+
aliases = ["openscad"]
|
| 23 |
+
filenames = ["*.scad"]
|
| 24 |
+
mimetypes = ["application/x-openscad"]
|
| 25 |
+
version_added = '2.16'
|
| 26 |
+
|
| 27 |
+
tokens = {
|
| 28 |
+
"root": [
|
| 29 |
+
(r"[^\S\n]+", Whitespace),
|
| 30 |
+
(r'//', Comment.Single, 'comment-single'),
|
| 31 |
+
(r'/\*', Comment.Multiline, 'comment-multi'),
|
| 32 |
+
(r"[{}\[\]\(\),;:]", Punctuation),
|
| 33 |
+
(r"[*!#%\-+=?/]", Operator),
|
| 34 |
+
(r"<=|<|==|!=|>=|>|&&|\|\|", Operator),
|
| 35 |
+
(r"\$(f[asn]|t|vp[rtd]|children)", Operator),
|
| 36 |
+
(r"(undef|PI)\b", Keyword.Constant),
|
| 37 |
+
(
|
| 38 |
+
r"(use|include)((?:\s|\\\\s)+)",
|
| 39 |
+
bygroups(Keyword.Namespace, Text),
|
| 40 |
+
"includes",
|
| 41 |
+
),
|
| 42 |
+
(r"(module)(\s*)([^\s\(]+)",
|
| 43 |
+
bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
|
| 44 |
+
(r"(function)(\s*)([^\s\(]+)",
|
| 45 |
+
bygroups(Keyword.Declaration, Whitespace, Name.Function)),
|
| 46 |
+
(words(("true", "false"), prefix=r"\b", suffix=r"\b"), Literal),
|
| 47 |
+
(words((
|
| 48 |
+
"function", "module", "include", "use", "for",
|
| 49 |
+
"intersection_for", "if", "else", "return"
|
| 50 |
+
), prefix=r"\b", suffix=r"\b"), Keyword
|
| 51 |
+
),
|
| 52 |
+
(words((
|
| 53 |
+
"circle", "square", "polygon", "text", "sphere", "cube",
|
| 54 |
+
"cylinder", "polyhedron", "translate", "rotate", "scale",
|
| 55 |
+
"resize", "mirror", "multmatrix", "color", "offset", "hull",
|
| 56 |
+
"minkowski", "union", "difference", "intersection", "abs",
|
| 57 |
+
"sign", "sin", "cos", "tan", "acos", "asin", "atan", "atan2",
|
| 58 |
+
"floor", "round", "ceil", "ln", "log", "pow", "sqrt", "exp",
|
| 59 |
+
"rands", "min", "max", "concat", "lookup", "str", "chr",
|
| 60 |
+
"search", "version", "version_num", "norm", "cross",
|
| 61 |
+
"parent_module", "echo", "import", "import_dxf",
|
| 62 |
+
"dxf_linear_extrude", "linear_extrude", "rotate_extrude",
|
| 63 |
+
"surface", "projection", "render", "dxf_cross",
|
| 64 |
+
"dxf_dim", "let", "assign", "len"
|
| 65 |
+
), prefix=r"\b", suffix=r"\b"),
|
| 66 |
+
Name.Builtin
|
| 67 |
+
),
|
| 68 |
+
(r"\bchildren\b", Name.Builtin.Pseudo),
|
| 69 |
+
(r'""".*?"""', String.Double),
|
| 70 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
|
| 71 |
+
(r"-?\d+(\.\d+)?(e[+-]?\d+)?", Number),
|
| 72 |
+
(r"\w+", Name),
|
| 73 |
+
],
|
| 74 |
+
"includes": [
|
| 75 |
+
(
|
| 76 |
+
r"(<)([^>]*)(>)",
|
| 77 |
+
bygroups(Punctuation, Comment.PreprocFile, Punctuation),
|
| 78 |
+
),
|
| 79 |
+
],
|
| 80 |
+
'comment': [
|
| 81 |
+
(r':param: [a-zA-Z_]\w*|:returns?:|(FIXME|MARK|TODO):',
|
| 82 |
+
Comment.Special)
|
| 83 |
+
],
|
| 84 |
+
'comment-single': [
|
| 85 |
+
(r'\n', Text, '#pop'),
|
| 86 |
+
include('comment'),
|
| 87 |
+
(r'[^\n]+', Comment.Single)
|
| 88 |
+
],
|
| 89 |
+
'comment-multi': [
|
| 90 |
+
include('comment'),
|
| 91 |
+
(r'[^*/]+', Comment.Multiline),
|
| 92 |
+
(r'/\*', Comment.Multiline, '#push'),
|
| 93 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 94 |
+
(r'[*/]', Comment.Multiline)
|
| 95 |
+
],
|
| 96 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/other.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.other
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Just export lexer classes previously contained in this module.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
# ruff: noqa: F401
|
| 12 |
+
from pygments.lexers.sql import SqlLexer, MySqlLexer, SqliteConsoleLexer
|
| 13 |
+
from pygments.lexers.shell import BashLexer, BashSessionLexer, BatchLexer, \
|
| 14 |
+
TcshLexer
|
| 15 |
+
from pygments.lexers.robotframework import RobotFrameworkLexer
|
| 16 |
+
from pygments.lexers.testing import GherkinLexer
|
| 17 |
+
from pygments.lexers.esoteric import BrainfuckLexer, BefungeLexer, RedcodeLexer
|
| 18 |
+
from pygments.lexers.prolog import LogtalkLexer
|
| 19 |
+
from pygments.lexers.snobol import SnobolLexer
|
| 20 |
+
from pygments.lexers.rebol import RebolLexer
|
| 21 |
+
from pygments.lexers.configs import KconfigLexer, Cfengine3Lexer
|
| 22 |
+
from pygments.lexers.modeling import ModelicaLexer
|
| 23 |
+
from pygments.lexers.scripting import AppleScriptLexer, MOOCodeLexer, \
|
| 24 |
+
HybrisLexer
|
| 25 |
+
from pygments.lexers.graphics import PostScriptLexer, GnuplotLexer, \
|
| 26 |
+
AsymptoteLexer, PovrayLexer
|
| 27 |
+
from pygments.lexers.business import ABAPLexer, OpenEdgeLexer, \
|
| 28 |
+
GoodDataCLLexer, MaqlLexer
|
| 29 |
+
from pygments.lexers.automation import AutoItLexer, AutohotkeyLexer
|
| 30 |
+
from pygments.lexers.dsls import ProtoBufLexer, BroLexer, PuppetLexer, \
|
| 31 |
+
MscgenLexer, VGLLexer
|
| 32 |
+
from pygments.lexers.basic import CbmBasicV2Lexer
|
| 33 |
+
from pygments.lexers.pawn import SourcePawnLexer, PawnLexer
|
| 34 |
+
from pygments.lexers.ecl import ECLLexer
|
| 35 |
+
from pygments.lexers.urbi import UrbiscriptLexer
|
| 36 |
+
from pygments.lexers.smalltalk import SmalltalkLexer, NewspeakLexer
|
| 37 |
+
from pygments.lexers.installers import NSISLexer, RPMSpecLexer
|
| 38 |
+
from pygments.lexers.textedit import AwkLexer
|
| 39 |
+
from pygments.lexers.smv import NuSMVLexer
|
| 40 |
+
|
| 41 |
+
__all__ = []
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/parasail.py
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.parasail
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for ParaSail.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import RegexLexer, include
|
| 14 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 15 |
+
Number, Punctuation, Literal
|
| 16 |
+
|
| 17 |
+
__all__ = ['ParaSailLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class ParaSailLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
For ParaSail source code.
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
name = 'ParaSail'
|
| 26 |
+
url = 'http://www.parasail-lang.org'
|
| 27 |
+
aliases = ['parasail']
|
| 28 |
+
filenames = ['*.psi', '*.psl']
|
| 29 |
+
mimetypes = ['text/x-parasail']
|
| 30 |
+
version_added = '2.1'
|
| 31 |
+
|
| 32 |
+
flags = re.MULTILINE
|
| 33 |
+
|
| 34 |
+
tokens = {
|
| 35 |
+
'root': [
|
| 36 |
+
(r'[^\S\n]+', Text),
|
| 37 |
+
(r'//.*?\n', Comment.Single),
|
| 38 |
+
(r'\b(and|or|xor)=', Operator.Word),
|
| 39 |
+
(r'\b(and(\s+then)?|or(\s+else)?|xor|rem|mod|'
|
| 40 |
+
r'(is|not)\s+null)\b',
|
| 41 |
+
Operator.Word),
|
| 42 |
+
# Keywords
|
| 43 |
+
(r'\b(abs|abstract|all|block|class|concurrent|const|continue|'
|
| 44 |
+
r'each|end|exit|extends|exports|forward|func|global|implements|'
|
| 45 |
+
r'import|in|interface|is|lambda|locked|new|not|null|of|op|'
|
| 46 |
+
r'optional|private|queued|ref|return|reverse|separate|some|'
|
| 47 |
+
r'type|until|var|with|'
|
| 48 |
+
# Control flow
|
| 49 |
+
r'if|then|else|elsif|case|for|while|loop)\b',
|
| 50 |
+
Keyword.Reserved),
|
| 51 |
+
(r'(abstract\s+)?(interface|class|op|func|type)',
|
| 52 |
+
Keyword.Declaration),
|
| 53 |
+
# Literals
|
| 54 |
+
(r'"[^"]*"', String),
|
| 55 |
+
(r'\\[\'ntrf"0]', String.Escape),
|
| 56 |
+
(r'#[a-zA-Z]\w*', Literal), # Enumeration
|
| 57 |
+
include('numbers'),
|
| 58 |
+
(r"'[^']'", String.Char),
|
| 59 |
+
(r'[a-zA-Z]\w*', Name),
|
| 60 |
+
# Operators and Punctuation
|
| 61 |
+
(r'(<==|==>|<=>|\*\*=|<\|=|<<=|>>=|==|!=|=\?|<=|>=|'
|
| 62 |
+
r'\*\*|<<|>>|=>|:=|\+=|-=|\*=|\|=|\||/=|\+|-|\*|/|'
|
| 63 |
+
r'\.\.|<\.\.|\.\.<|<\.\.<)',
|
| 64 |
+
Operator),
|
| 65 |
+
(r'(<|>|\[|\]|\(|\)|\||:|;|,|.|\{|\}|->)',
|
| 66 |
+
Punctuation),
|
| 67 |
+
(r'\n+', Text),
|
| 68 |
+
],
|
| 69 |
+
'numbers': [
|
| 70 |
+
(r'\d[0-9_]*#[0-9a-fA-F][0-9a-fA-F_]*#', Number.Hex), # any base
|
| 71 |
+
(r'0[xX][0-9a-fA-F][0-9a-fA-F_]*', Number.Hex), # C-like hex
|
| 72 |
+
(r'0[bB][01][01_]*', Number.Bin), # C-like bin
|
| 73 |
+
(r'\d[0-9_]*\.\d[0-9_]*[eE][+-]\d[0-9_]*', # float exp
|
| 74 |
+
Number.Float),
|
| 75 |
+
(r'\d[0-9_]*\.\d[0-9_]*', Number.Float), # float
|
| 76 |
+
(r'\d[0-9_]*', Number.Integer), # integer
|
| 77 |
+
],
|
| 78 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/parsers.py
ADDED
|
@@ -0,0 +1,798 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.parsers
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for parser generators.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import RegexLexer, DelegatingLexer, \
|
| 14 |
+
include, bygroups, using
|
| 15 |
+
from pygments.token import Punctuation, Other, Text, Comment, Operator, \
|
| 16 |
+
Keyword, Name, String, Number, Whitespace
|
| 17 |
+
from pygments.lexers.jvm import JavaLexer
|
| 18 |
+
from pygments.lexers.c_cpp import CLexer, CppLexer
|
| 19 |
+
from pygments.lexers.objective import ObjectiveCLexer
|
| 20 |
+
from pygments.lexers.d import DLexer
|
| 21 |
+
from pygments.lexers.dotnet import CSharpLexer
|
| 22 |
+
from pygments.lexers.ruby import RubyLexer
|
| 23 |
+
from pygments.lexers.python import PythonLexer
|
| 24 |
+
from pygments.lexers.perl import PerlLexer
|
| 25 |
+
|
| 26 |
+
__all__ = ['RagelLexer', 'RagelEmbeddedLexer', 'RagelCLexer', 'RagelDLexer',
|
| 27 |
+
'RagelCppLexer', 'RagelObjectiveCLexer', 'RagelRubyLexer',
|
| 28 |
+
'RagelJavaLexer', 'AntlrLexer', 'AntlrPythonLexer',
|
| 29 |
+
'AntlrPerlLexer', 'AntlrRubyLexer', 'AntlrCppLexer',
|
| 30 |
+
'AntlrCSharpLexer', 'AntlrObjectiveCLexer',
|
| 31 |
+
'AntlrJavaLexer', 'AntlrActionScriptLexer',
|
| 32 |
+
'TreetopLexer', 'EbnfLexer']
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
class RagelLexer(RegexLexer):
|
| 36 |
+
"""A pure `Ragel <www.colm.net/open-source/ragel>`_ lexer. Use this
|
| 37 |
+
for fragments of Ragel. For ``.rl`` files, use
|
| 38 |
+
:class:`RagelEmbeddedLexer` instead (or one of the
|
| 39 |
+
language-specific subclasses).
|
| 40 |
+
|
| 41 |
+
"""
|
| 42 |
+
|
| 43 |
+
name = 'Ragel'
|
| 44 |
+
url = 'http://www.colm.net/open-source/ragel/'
|
| 45 |
+
aliases = ['ragel']
|
| 46 |
+
filenames = []
|
| 47 |
+
version_added = '1.1'
|
| 48 |
+
|
| 49 |
+
tokens = {
|
| 50 |
+
'whitespace': [
|
| 51 |
+
(r'\s+', Whitespace)
|
| 52 |
+
],
|
| 53 |
+
'comments': [
|
| 54 |
+
(r'\#.*$', Comment),
|
| 55 |
+
],
|
| 56 |
+
'keywords': [
|
| 57 |
+
(r'(access|action|alphtype)\b', Keyword),
|
| 58 |
+
(r'(getkey|write|machine|include)\b', Keyword),
|
| 59 |
+
(r'(any|ascii|extend|alpha|digit|alnum|lower|upper)\b', Keyword),
|
| 60 |
+
(r'(xdigit|cntrl|graph|print|punct|space|zlen|empty)\b', Keyword)
|
| 61 |
+
],
|
| 62 |
+
'numbers': [
|
| 63 |
+
(r'0x[0-9A-Fa-f]+', Number.Hex),
|
| 64 |
+
(r'[+-]?[0-9]+', Number.Integer),
|
| 65 |
+
],
|
| 66 |
+
'literals': [
|
| 67 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
|
| 68 |
+
(r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
|
| 69 |
+
(r'\[(\\\\|\\[^\\]|[^\\\]])*\]', String), # square bracket literals
|
| 70 |
+
(r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', String.Regex), # regular expressions
|
| 71 |
+
],
|
| 72 |
+
'identifiers': [
|
| 73 |
+
(r'[a-zA-Z_]\w*', Name.Variable),
|
| 74 |
+
],
|
| 75 |
+
'operators': [
|
| 76 |
+
(r',', Operator), # Join
|
| 77 |
+
(r'\||&|--?', Operator), # Union, Intersection and Subtraction
|
| 78 |
+
(r'\.|<:|:>>?', Operator), # Concatention
|
| 79 |
+
(r':', Operator), # Label
|
| 80 |
+
(r'->', Operator), # Epsilon Transition
|
| 81 |
+
(r'(>|\$|%|<|@|<>)(/|eof\b)', Operator), # EOF Actions
|
| 82 |
+
(r'(>|\$|%|<|@|<>)(!|err\b)', Operator), # Global Error Actions
|
| 83 |
+
(r'(>|\$|%|<|@|<>)(\^|lerr\b)', Operator), # Local Error Actions
|
| 84 |
+
(r'(>|\$|%|<|@|<>)(~|to\b)', Operator), # To-State Actions
|
| 85 |
+
(r'(>|\$|%|<|@|<>)(\*|from\b)', Operator), # From-State Actions
|
| 86 |
+
(r'>|@|\$|%', Operator), # Transition Actions and Priorities
|
| 87 |
+
(r'\*|\?|\+|\{[0-9]*,[0-9]*\}', Operator), # Repetition
|
| 88 |
+
(r'!|\^', Operator), # Negation
|
| 89 |
+
(r'\(|\)', Operator), # Grouping
|
| 90 |
+
],
|
| 91 |
+
'root': [
|
| 92 |
+
include('literals'),
|
| 93 |
+
include('whitespace'),
|
| 94 |
+
include('comments'),
|
| 95 |
+
include('keywords'),
|
| 96 |
+
include('numbers'),
|
| 97 |
+
include('identifiers'),
|
| 98 |
+
include('operators'),
|
| 99 |
+
(r'\{', Punctuation, 'host'),
|
| 100 |
+
(r'=', Operator),
|
| 101 |
+
(r';', Punctuation),
|
| 102 |
+
],
|
| 103 |
+
'host': [
|
| 104 |
+
(r'(' + r'|'.join(( # keep host code in largest possible chunks
|
| 105 |
+
r'[^{}\'"/#]+', # exclude unsafe characters
|
| 106 |
+
r'[^\\]\\[{}]', # allow escaped { or }
|
| 107 |
+
|
| 108 |
+
# strings and comments may safely contain unsafe characters
|
| 109 |
+
r'"(\\\\|\\[^\\]|[^"\\])*"',
|
| 110 |
+
r"'(\\\\|\\[^\\]|[^'\\])*'",
|
| 111 |
+
r'//.*$\n?', # single line comment
|
| 112 |
+
r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
|
| 113 |
+
r'\#.*$\n?', # ruby comment
|
| 114 |
+
|
| 115 |
+
# regular expression: There's no reason for it to start
|
| 116 |
+
# with a * and this stops confusion with comments.
|
| 117 |
+
r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/',
|
| 118 |
+
|
| 119 |
+
# / is safe now that we've handled regex and javadoc comments
|
| 120 |
+
r'/',
|
| 121 |
+
)) + r')+', Other),
|
| 122 |
+
|
| 123 |
+
(r'\{', Punctuation, '#push'),
|
| 124 |
+
(r'\}', Punctuation, '#pop'),
|
| 125 |
+
],
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
class RagelEmbeddedLexer(RegexLexer):
|
| 130 |
+
"""
|
| 131 |
+
A lexer for Ragel embedded in a host language file.
|
| 132 |
+
|
| 133 |
+
This will only highlight Ragel statements. If you want host language
|
| 134 |
+
highlighting then call the language-specific Ragel lexer.
|
| 135 |
+
"""
|
| 136 |
+
|
| 137 |
+
name = 'Embedded Ragel'
|
| 138 |
+
aliases = ['ragel-em']
|
| 139 |
+
filenames = ['*.rl']
|
| 140 |
+
url = 'http://www.colm.net/open-source/ragel/'
|
| 141 |
+
version_added = '1.1'
|
| 142 |
+
|
| 143 |
+
tokens = {
|
| 144 |
+
'root': [
|
| 145 |
+
(r'(' + r'|'.join(( # keep host code in largest possible chunks
|
| 146 |
+
r'[^%\'"/#]+', # exclude unsafe characters
|
| 147 |
+
r'%(?=[^%]|$)', # a single % sign is okay, just not 2 of them
|
| 148 |
+
|
| 149 |
+
# strings and comments may safely contain unsafe characters
|
| 150 |
+
r'"(\\\\|\\[^\\]|[^"\\])*"',
|
| 151 |
+
r"'(\\\\|\\[^\\]|[^'\\])*'",
|
| 152 |
+
r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
|
| 153 |
+
r'//.*$\n?', # single line comment
|
| 154 |
+
r'\#.*$\n?', # ruby/ragel comment
|
| 155 |
+
r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/', # regular expression
|
| 156 |
+
|
| 157 |
+
# / is safe now that we've handled regex and javadoc comments
|
| 158 |
+
r'/',
|
| 159 |
+
)) + r')+', Other),
|
| 160 |
+
|
| 161 |
+
# Single Line FSM.
|
| 162 |
+
# Please don't put a quoted newline in a single line FSM.
|
| 163 |
+
# That's just mean. It will break this.
|
| 164 |
+
(r'(%%)(?![{%])(.*)($|;)(\n?)', bygroups(Punctuation,
|
| 165 |
+
using(RagelLexer),
|
| 166 |
+
Punctuation, Text)),
|
| 167 |
+
|
| 168 |
+
# Multi Line FSM.
|
| 169 |
+
(r'(%%%%|%%)\{', Punctuation, 'multi-line-fsm'),
|
| 170 |
+
],
|
| 171 |
+
'multi-line-fsm': [
|
| 172 |
+
(r'(' + r'|'.join(( # keep ragel code in largest possible chunks.
|
| 173 |
+
r'(' + r'|'.join((
|
| 174 |
+
r'[^}\'"\[/#]', # exclude unsafe characters
|
| 175 |
+
r'\}(?=[^%]|$)', # } is okay as long as it's not followed by %
|
| 176 |
+
r'\}%(?=[^%]|$)', # ...well, one %'s okay, just not two...
|
| 177 |
+
r'[^\\]\\[{}]', # ...and } is okay if it's escaped
|
| 178 |
+
|
| 179 |
+
# allow / if it's preceded with one of these symbols
|
| 180 |
+
# (ragel EOF actions)
|
| 181 |
+
r'(>|\$|%|<|@|<>)/',
|
| 182 |
+
|
| 183 |
+
# specifically allow regex followed immediately by *
|
| 184 |
+
# so it doesn't get mistaken for a comment
|
| 185 |
+
r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/\*',
|
| 186 |
+
|
| 187 |
+
# allow / as long as it's not followed by another / or by a *
|
| 188 |
+
r'/(?=[^/*]|$)',
|
| 189 |
+
|
| 190 |
+
# We want to match as many of these as we can in one block.
|
| 191 |
+
# Not sure if we need the + sign here,
|
| 192 |
+
# does it help performance?
|
| 193 |
+
)) + r')+',
|
| 194 |
+
|
| 195 |
+
# strings and comments may safely contain unsafe characters
|
| 196 |
+
r'"(\\\\|\\[^\\]|[^"\\])*"',
|
| 197 |
+
r"'(\\\\|\\[^\\]|[^'\\])*'",
|
| 198 |
+
r"\[(\\\\|\\[^\\]|[^\]\\])*\]", # square bracket literal
|
| 199 |
+
r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
|
| 200 |
+
r'//.*$\n?', # single line comment
|
| 201 |
+
r'\#.*$\n?', # ruby/ragel comment
|
| 202 |
+
)) + r')+', using(RagelLexer)),
|
| 203 |
+
|
| 204 |
+
(r'\}%%', Punctuation, '#pop'),
|
| 205 |
+
]
|
| 206 |
+
}
|
| 207 |
+
|
| 208 |
+
def analyse_text(text):
|
| 209 |
+
return '@LANG: indep' in text
|
| 210 |
+
|
| 211 |
+
|
| 212 |
+
class RagelRubyLexer(DelegatingLexer):
|
| 213 |
+
"""
|
| 214 |
+
A lexer for Ragel in a Ruby host file.
|
| 215 |
+
"""
|
| 216 |
+
|
| 217 |
+
name = 'Ragel in Ruby Host'
|
| 218 |
+
aliases = ['ragel-ruby', 'ragel-rb']
|
| 219 |
+
filenames = ['*.rl']
|
| 220 |
+
url = 'http://www.colm.net/open-source/ragel/'
|
| 221 |
+
version_added = '1.1'
|
| 222 |
+
|
| 223 |
+
def __init__(self, **options):
|
| 224 |
+
super().__init__(RubyLexer, RagelEmbeddedLexer, **options)
|
| 225 |
+
|
| 226 |
+
def analyse_text(text):
|
| 227 |
+
return '@LANG: ruby' in text
|
| 228 |
+
|
| 229 |
+
|
| 230 |
+
class RagelCLexer(DelegatingLexer):
|
| 231 |
+
"""
|
| 232 |
+
A lexer for Ragel in a C host file.
|
| 233 |
+
"""
|
| 234 |
+
|
| 235 |
+
name = 'Ragel in C Host'
|
| 236 |
+
aliases = ['ragel-c']
|
| 237 |
+
filenames = ['*.rl']
|
| 238 |
+
url = 'http://www.colm.net/open-source/ragel/'
|
| 239 |
+
version_added = '1.1'
|
| 240 |
+
|
| 241 |
+
def __init__(self, **options):
|
| 242 |
+
super().__init__(CLexer, RagelEmbeddedLexer, **options)
|
| 243 |
+
|
| 244 |
+
def analyse_text(text):
|
| 245 |
+
return '@LANG: c' in text
|
| 246 |
+
|
| 247 |
+
|
| 248 |
+
class RagelDLexer(DelegatingLexer):
|
| 249 |
+
"""
|
| 250 |
+
A lexer for Ragel in a D host file.
|
| 251 |
+
"""
|
| 252 |
+
|
| 253 |
+
name = 'Ragel in D Host'
|
| 254 |
+
aliases = ['ragel-d']
|
| 255 |
+
filenames = ['*.rl']
|
| 256 |
+
url = 'http://www.colm.net/open-source/ragel/'
|
| 257 |
+
version_added = '1.1'
|
| 258 |
+
|
| 259 |
+
def __init__(self, **options):
|
| 260 |
+
super().__init__(DLexer, RagelEmbeddedLexer, **options)
|
| 261 |
+
|
| 262 |
+
def analyse_text(text):
|
| 263 |
+
return '@LANG: d' in text
|
| 264 |
+
|
| 265 |
+
|
| 266 |
+
class RagelCppLexer(DelegatingLexer):
|
| 267 |
+
"""
|
| 268 |
+
A lexer for Ragel in a C++ host file.
|
| 269 |
+
"""
|
| 270 |
+
|
| 271 |
+
name = 'Ragel in CPP Host'
|
| 272 |
+
aliases = ['ragel-cpp']
|
| 273 |
+
filenames = ['*.rl']
|
| 274 |
+
url = 'http://www.colm.net/open-source/ragel/'
|
| 275 |
+
version_added = '1.1'
|
| 276 |
+
|
| 277 |
+
def __init__(self, **options):
|
| 278 |
+
super().__init__(CppLexer, RagelEmbeddedLexer, **options)
|
| 279 |
+
|
| 280 |
+
def analyse_text(text):
|
| 281 |
+
return '@LANG: c++' in text
|
| 282 |
+
|
| 283 |
+
|
| 284 |
+
class RagelObjectiveCLexer(DelegatingLexer):
|
| 285 |
+
"""
|
| 286 |
+
A lexer for Ragel in an Objective C host file.
|
| 287 |
+
"""
|
| 288 |
+
|
| 289 |
+
name = 'Ragel in Objective C Host'
|
| 290 |
+
aliases = ['ragel-objc']
|
| 291 |
+
filenames = ['*.rl']
|
| 292 |
+
url = 'http://www.colm.net/open-source/ragel/'
|
| 293 |
+
version_added = '1.1'
|
| 294 |
+
|
| 295 |
+
def __init__(self, **options):
|
| 296 |
+
super().__init__(ObjectiveCLexer, RagelEmbeddedLexer, **options)
|
| 297 |
+
|
| 298 |
+
def analyse_text(text):
|
| 299 |
+
return '@LANG: objc' in text
|
| 300 |
+
|
| 301 |
+
|
| 302 |
+
class RagelJavaLexer(DelegatingLexer):
|
| 303 |
+
"""
|
| 304 |
+
A lexer for Ragel in a Java host file.
|
| 305 |
+
"""
|
| 306 |
+
|
| 307 |
+
name = 'Ragel in Java Host'
|
| 308 |
+
aliases = ['ragel-java']
|
| 309 |
+
filenames = ['*.rl']
|
| 310 |
+
url = 'http://www.colm.net/open-source/ragel/'
|
| 311 |
+
version_added = '1.1'
|
| 312 |
+
|
| 313 |
+
def __init__(self, **options):
|
| 314 |
+
super().__init__(JavaLexer, RagelEmbeddedLexer, **options)
|
| 315 |
+
|
| 316 |
+
def analyse_text(text):
|
| 317 |
+
return '@LANG: java' in text
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
class AntlrLexer(RegexLexer):
|
| 321 |
+
"""
|
| 322 |
+
Generic ANTLR Lexer.
|
| 323 |
+
Should not be called directly, instead
|
| 324 |
+
use DelegatingLexer for your target language.
|
| 325 |
+
"""
|
| 326 |
+
|
| 327 |
+
name = 'ANTLR'
|
| 328 |
+
aliases = ['antlr']
|
| 329 |
+
filenames = []
|
| 330 |
+
url = 'https://www.antlr.org'
|
| 331 |
+
version_added = '1.1'
|
| 332 |
+
|
| 333 |
+
_id = r'[A-Za-z]\w*'
|
| 334 |
+
_TOKEN_REF = r'[A-Z]\w*'
|
| 335 |
+
_RULE_REF = r'[a-z]\w*'
|
| 336 |
+
_STRING_LITERAL = r'\'(?:\\\\|\\\'|[^\']*)\''
|
| 337 |
+
_INT = r'[0-9]+'
|
| 338 |
+
|
| 339 |
+
tokens = {
|
| 340 |
+
'whitespace': [
|
| 341 |
+
(r'\s+', Whitespace),
|
| 342 |
+
],
|
| 343 |
+
'comments': [
|
| 344 |
+
(r'//.*$', Comment),
|
| 345 |
+
(r'/\*(.|\n)*?\*/', Comment),
|
| 346 |
+
],
|
| 347 |
+
'root': [
|
| 348 |
+
include('whitespace'),
|
| 349 |
+
include('comments'),
|
| 350 |
+
|
| 351 |
+
(r'(lexer|parser|tree)?(\s*)(grammar\b)(\s*)(' + _id + ')(;)',
|
| 352 |
+
bygroups(Keyword, Whitespace, Keyword, Whitespace, Name.Class,
|
| 353 |
+
Punctuation)),
|
| 354 |
+
# optionsSpec
|
| 355 |
+
(r'options\b', Keyword, 'options'),
|
| 356 |
+
# tokensSpec
|
| 357 |
+
(r'tokens\b', Keyword, 'tokens'),
|
| 358 |
+
# attrScope
|
| 359 |
+
(r'(scope)(\s*)(' + _id + r')(\s*)(\{)',
|
| 360 |
+
bygroups(Keyword, Whitespace, Name.Variable, Whitespace,
|
| 361 |
+
Punctuation), 'action'),
|
| 362 |
+
# exception
|
| 363 |
+
(r'(catch|finally)\b', Keyword, 'exception'),
|
| 364 |
+
# action
|
| 365 |
+
(r'(@' + _id + r')(\s*)(::)?(\s*)(' + _id + r')(\s*)(\{)',
|
| 366 |
+
bygroups(Name.Label, Whitespace, Punctuation, Whitespace,
|
| 367 |
+
Name.Label, Whitespace, Punctuation), 'action'),
|
| 368 |
+
# rule
|
| 369 |
+
(r'((?:protected|private|public|fragment)\b)?(\s*)(' + _id + ')(!)?',
|
| 370 |
+
bygroups(Keyword, Whitespace, Name.Label, Punctuation),
|
| 371 |
+
('rule-alts', 'rule-prelims')),
|
| 372 |
+
],
|
| 373 |
+
'exception': [
|
| 374 |
+
(r'\n', Whitespace, '#pop'),
|
| 375 |
+
(r'\s', Whitespace),
|
| 376 |
+
include('comments'),
|
| 377 |
+
|
| 378 |
+
(r'\[', Punctuation, 'nested-arg-action'),
|
| 379 |
+
(r'\{', Punctuation, 'action'),
|
| 380 |
+
],
|
| 381 |
+
'rule-prelims': [
|
| 382 |
+
include('whitespace'),
|
| 383 |
+
include('comments'),
|
| 384 |
+
|
| 385 |
+
(r'returns\b', Keyword),
|
| 386 |
+
(r'\[', Punctuation, 'nested-arg-action'),
|
| 387 |
+
(r'\{', Punctuation, 'action'),
|
| 388 |
+
# throwsSpec
|
| 389 |
+
(r'(throws)(\s+)(' + _id + ')',
|
| 390 |
+
bygroups(Keyword, Whitespace, Name.Label)),
|
| 391 |
+
(r'(,)(\s*)(' + _id + ')',
|
| 392 |
+
bygroups(Punctuation, Whitespace, Name.Label)), # Additional throws
|
| 393 |
+
# optionsSpec
|
| 394 |
+
(r'options\b', Keyword, 'options'),
|
| 395 |
+
# ruleScopeSpec - scope followed by target language code or name of action
|
| 396 |
+
# TODO finish implementing other possibilities for scope
|
| 397 |
+
# L173 ANTLRv3.g from ANTLR book
|
| 398 |
+
(r'(scope)(\s+)(\{)', bygroups(Keyword, Whitespace, Punctuation),
|
| 399 |
+
'action'),
|
| 400 |
+
(r'(scope)(\s+)(' + _id + r')(\s*)(;)',
|
| 401 |
+
bygroups(Keyword, Whitespace, Name.Label, Whitespace, Punctuation)),
|
| 402 |
+
# ruleAction
|
| 403 |
+
(r'(@' + _id + r')(\s*)(\{)',
|
| 404 |
+
bygroups(Name.Label, Whitespace, Punctuation), 'action'),
|
| 405 |
+
# finished prelims, go to rule alts!
|
| 406 |
+
(r':', Punctuation, '#pop')
|
| 407 |
+
],
|
| 408 |
+
'rule-alts': [
|
| 409 |
+
include('whitespace'),
|
| 410 |
+
include('comments'),
|
| 411 |
+
|
| 412 |
+
# These might need to go in a separate 'block' state triggered by (
|
| 413 |
+
(r'options\b', Keyword, 'options'),
|
| 414 |
+
(r':', Punctuation),
|
| 415 |
+
|
| 416 |
+
# literals
|
| 417 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
|
| 418 |
+
(r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
|
| 419 |
+
(r'<<([^>]|>[^>])>>', String),
|
| 420 |
+
# identifiers
|
| 421 |
+
# Tokens start with capital letter.
|
| 422 |
+
(r'\$?[A-Z_]\w*', Name.Constant),
|
| 423 |
+
# Rules start with small letter.
|
| 424 |
+
(r'\$?[a-z_]\w*', Name.Variable),
|
| 425 |
+
# operators
|
| 426 |
+
(r'(\+|\||->|=>|=|\(|\)|\.\.|\.|\?|\*|\^|!|\#|~)', Operator),
|
| 427 |
+
(r',', Punctuation),
|
| 428 |
+
(r'\[', Punctuation, 'nested-arg-action'),
|
| 429 |
+
(r'\{', Punctuation, 'action'),
|
| 430 |
+
(r';', Punctuation, '#pop')
|
| 431 |
+
],
|
| 432 |
+
'tokens': [
|
| 433 |
+
include('whitespace'),
|
| 434 |
+
include('comments'),
|
| 435 |
+
(r'\{', Punctuation),
|
| 436 |
+
(r'(' + _TOKEN_REF + r')(\s*)(=)?(\s*)(' + _STRING_LITERAL
|
| 437 |
+
+ r')?(\s*)(;)',
|
| 438 |
+
bygroups(Name.Label, Whitespace, Punctuation, Whitespace,
|
| 439 |
+
String, Whitespace, Punctuation)),
|
| 440 |
+
(r'\}', Punctuation, '#pop'),
|
| 441 |
+
],
|
| 442 |
+
'options': [
|
| 443 |
+
include('whitespace'),
|
| 444 |
+
include('comments'),
|
| 445 |
+
(r'\{', Punctuation),
|
| 446 |
+
(r'(' + _id + r')(\s*)(=)(\s*)(' +
|
| 447 |
+
'|'.join((_id, _STRING_LITERAL, _INT, r'\*')) + r')(\s*)(;)',
|
| 448 |
+
bygroups(Name.Variable, Whitespace, Punctuation, Whitespace,
|
| 449 |
+
Text, Whitespace, Punctuation)),
|
| 450 |
+
(r'\}', Punctuation, '#pop'),
|
| 451 |
+
],
|
| 452 |
+
'action': [
|
| 453 |
+
(r'(' + r'|'.join(( # keep host code in largest possible chunks
|
| 454 |
+
r'[^${}\'"/\\]+', # exclude unsafe characters
|
| 455 |
+
|
| 456 |
+
# strings and comments may safely contain unsafe characters
|
| 457 |
+
r'"(\\\\|\\[^\\]|[^"\\])*"',
|
| 458 |
+
r"'(\\\\|\\[^\\]|[^'\\])*'",
|
| 459 |
+
r'//.*$\n?', # single line comment
|
| 460 |
+
r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
|
| 461 |
+
|
| 462 |
+
# regular expression: There's no reason for it to start
|
| 463 |
+
# with a * and this stops confusion with comments.
|
| 464 |
+
r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/',
|
| 465 |
+
|
| 466 |
+
# backslashes are okay, as long as we are not backslashing a %
|
| 467 |
+
r'\\(?!%)',
|
| 468 |
+
|
| 469 |
+
# Now that we've handled regex and javadoc comments
|
| 470 |
+
# it's safe to let / through.
|
| 471 |
+
r'/',
|
| 472 |
+
)) + r')+', Other),
|
| 473 |
+
(r'(\\)(%)', bygroups(Punctuation, Other)),
|
| 474 |
+
(r'(\$[a-zA-Z]+)(\.?)(text|value)?',
|
| 475 |
+
bygroups(Name.Variable, Punctuation, Name.Property)),
|
| 476 |
+
(r'\{', Punctuation, '#push'),
|
| 477 |
+
(r'\}', Punctuation, '#pop'),
|
| 478 |
+
],
|
| 479 |
+
'nested-arg-action': [
|
| 480 |
+
(r'(' + r'|'.join(( # keep host code in largest possible chunks.
|
| 481 |
+
r'[^$\[\]\'"/]+', # exclude unsafe characters
|
| 482 |
+
|
| 483 |
+
# strings and comments may safely contain unsafe characters
|
| 484 |
+
r'"(\\\\|\\[^\\]|[^"\\])*"',
|
| 485 |
+
r"'(\\\\|\\[^\\]|[^'\\])*'",
|
| 486 |
+
r'//.*$\n?', # single line comment
|
| 487 |
+
r'/\*(.|\n)*?\*/', # multi-line javadoc-style comment
|
| 488 |
+
|
| 489 |
+
# regular expression: There's no reason for it to start
|
| 490 |
+
# with a * and this stops confusion with comments.
|
| 491 |
+
r'/(?!\*)(\\\\|\\[^\\]|[^/\\])*/',
|
| 492 |
+
|
| 493 |
+
# Now that we've handled regex and javadoc comments
|
| 494 |
+
# it's safe to let / through.
|
| 495 |
+
r'/',
|
| 496 |
+
)) + r')+', Other),
|
| 497 |
+
|
| 498 |
+
|
| 499 |
+
(r'\[', Punctuation, '#push'),
|
| 500 |
+
(r'\]', Punctuation, '#pop'),
|
| 501 |
+
(r'(\$[a-zA-Z]+)(\.?)(text|value)?',
|
| 502 |
+
bygroups(Name.Variable, Punctuation, Name.Property)),
|
| 503 |
+
(r'(\\\\|\\\]|\\\[|[^\[\]])+', Other),
|
| 504 |
+
]
|
| 505 |
+
}
|
| 506 |
+
|
| 507 |
+
def analyse_text(text):
|
| 508 |
+
return re.search(r'^\s*grammar\s+[a-zA-Z0-9]+\s*;', text, re.M)
|
| 509 |
+
|
| 510 |
+
|
| 511 |
+
# http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets
|
| 512 |
+
|
| 513 |
+
class AntlrCppLexer(DelegatingLexer):
|
| 514 |
+
"""
|
| 515 |
+
ANTLR with C++ Target
|
| 516 |
+
"""
|
| 517 |
+
|
| 518 |
+
name = 'ANTLR With CPP Target'
|
| 519 |
+
aliases = ['antlr-cpp']
|
| 520 |
+
filenames = ['*.G', '*.g']
|
| 521 |
+
url = 'https://www.antlr.org'
|
| 522 |
+
version_added = '1.1'
|
| 523 |
+
|
| 524 |
+
def __init__(self, **options):
|
| 525 |
+
super().__init__(CppLexer, AntlrLexer, **options)
|
| 526 |
+
|
| 527 |
+
def analyse_text(text):
|
| 528 |
+
return AntlrLexer.analyse_text(text) and \
|
| 529 |
+
re.search(r'^\s*language\s*=\s*C\s*;', text, re.M)
|
| 530 |
+
|
| 531 |
+
|
| 532 |
+
class AntlrObjectiveCLexer(DelegatingLexer):
|
| 533 |
+
"""
|
| 534 |
+
ANTLR with Objective-C Target
|
| 535 |
+
"""
|
| 536 |
+
|
| 537 |
+
name = 'ANTLR With ObjectiveC Target'
|
| 538 |
+
aliases = ['antlr-objc']
|
| 539 |
+
filenames = ['*.G', '*.g']
|
| 540 |
+
url = 'https://www.antlr.org'
|
| 541 |
+
version_added = '1.1'
|
| 542 |
+
|
| 543 |
+
def __init__(self, **options):
|
| 544 |
+
super().__init__(ObjectiveCLexer, AntlrLexer, **options)
|
| 545 |
+
|
| 546 |
+
def analyse_text(text):
|
| 547 |
+
return AntlrLexer.analyse_text(text) and \
|
| 548 |
+
re.search(r'^\s*language\s*=\s*ObjC\s*;', text)
|
| 549 |
+
|
| 550 |
+
|
| 551 |
+
class AntlrCSharpLexer(DelegatingLexer):
|
| 552 |
+
"""
|
| 553 |
+
ANTLR with C# Target
|
| 554 |
+
"""
|
| 555 |
+
|
| 556 |
+
name = 'ANTLR With C# Target'
|
| 557 |
+
aliases = ['antlr-csharp', 'antlr-c#']
|
| 558 |
+
filenames = ['*.G', '*.g']
|
| 559 |
+
url = 'https://www.antlr.org'
|
| 560 |
+
version_added = '1.1'
|
| 561 |
+
|
| 562 |
+
def __init__(self, **options):
|
| 563 |
+
super().__init__(CSharpLexer, AntlrLexer, **options)
|
| 564 |
+
|
| 565 |
+
def analyse_text(text):
|
| 566 |
+
return AntlrLexer.analyse_text(text) and \
|
| 567 |
+
re.search(r'^\s*language\s*=\s*CSharp2\s*;', text, re.M)
|
| 568 |
+
|
| 569 |
+
|
| 570 |
+
class AntlrPythonLexer(DelegatingLexer):
|
| 571 |
+
"""
|
| 572 |
+
ANTLR with Python Target
|
| 573 |
+
"""
|
| 574 |
+
|
| 575 |
+
name = 'ANTLR With Python Target'
|
| 576 |
+
aliases = ['antlr-python']
|
| 577 |
+
filenames = ['*.G', '*.g']
|
| 578 |
+
url = 'https://www.antlr.org'
|
| 579 |
+
version_added = '1.1'
|
| 580 |
+
|
| 581 |
+
def __init__(self, **options):
|
| 582 |
+
super().__init__(PythonLexer, AntlrLexer, **options)
|
| 583 |
+
|
| 584 |
+
def analyse_text(text):
|
| 585 |
+
return AntlrLexer.analyse_text(text) and \
|
| 586 |
+
re.search(r'^\s*language\s*=\s*Python\s*;', text, re.M)
|
| 587 |
+
|
| 588 |
+
|
| 589 |
+
class AntlrJavaLexer(DelegatingLexer):
|
| 590 |
+
"""
|
| 591 |
+
ANTLR with Java Target
|
| 592 |
+
"""
|
| 593 |
+
|
| 594 |
+
name = 'ANTLR With Java Target'
|
| 595 |
+
aliases = ['antlr-java']
|
| 596 |
+
filenames = ['*.G', '*.g']
|
| 597 |
+
url = 'https://www.antlr.org'
|
| 598 |
+
version_added = '1.1'
|
| 599 |
+
|
| 600 |
+
def __init__(self, **options):
|
| 601 |
+
super().__init__(JavaLexer, AntlrLexer, **options)
|
| 602 |
+
|
| 603 |
+
def analyse_text(text):
|
| 604 |
+
# Antlr language is Java by default
|
| 605 |
+
return AntlrLexer.analyse_text(text) and 0.9
|
| 606 |
+
|
| 607 |
+
|
| 608 |
+
class AntlrRubyLexer(DelegatingLexer):
|
| 609 |
+
"""
|
| 610 |
+
ANTLR with Ruby Target
|
| 611 |
+
"""
|
| 612 |
+
|
| 613 |
+
name = 'ANTLR With Ruby Target'
|
| 614 |
+
aliases = ['antlr-ruby', 'antlr-rb']
|
| 615 |
+
filenames = ['*.G', '*.g']
|
| 616 |
+
url = 'https://www.antlr.org'
|
| 617 |
+
version_added = '1.1'
|
| 618 |
+
|
| 619 |
+
def __init__(self, **options):
|
| 620 |
+
super().__init__(RubyLexer, AntlrLexer, **options)
|
| 621 |
+
|
| 622 |
+
def analyse_text(text):
|
| 623 |
+
return AntlrLexer.analyse_text(text) and \
|
| 624 |
+
re.search(r'^\s*language\s*=\s*Ruby\s*;', text, re.M)
|
| 625 |
+
|
| 626 |
+
|
| 627 |
+
class AntlrPerlLexer(DelegatingLexer):
|
| 628 |
+
"""
|
| 629 |
+
ANTLR with Perl Target
|
| 630 |
+
"""
|
| 631 |
+
|
| 632 |
+
name = 'ANTLR With Perl Target'
|
| 633 |
+
aliases = ['antlr-perl']
|
| 634 |
+
filenames = ['*.G', '*.g']
|
| 635 |
+
url = 'https://www.antlr.org'
|
| 636 |
+
version_added = '1.1'
|
| 637 |
+
|
| 638 |
+
def __init__(self, **options):
|
| 639 |
+
super().__init__(PerlLexer, AntlrLexer, **options)
|
| 640 |
+
|
| 641 |
+
def analyse_text(text):
|
| 642 |
+
return AntlrLexer.analyse_text(text) and \
|
| 643 |
+
re.search(r'^\s*language\s*=\s*Perl5\s*;', text, re.M)
|
| 644 |
+
|
| 645 |
+
|
| 646 |
+
class AntlrActionScriptLexer(DelegatingLexer):
|
| 647 |
+
"""
|
| 648 |
+
ANTLR with ActionScript Target
|
| 649 |
+
"""
|
| 650 |
+
|
| 651 |
+
name = 'ANTLR With ActionScript Target'
|
| 652 |
+
aliases = ['antlr-actionscript', 'antlr-as']
|
| 653 |
+
filenames = ['*.G', '*.g']
|
| 654 |
+
url = 'https://www.antlr.org'
|
| 655 |
+
version_added = '1.1'
|
| 656 |
+
|
| 657 |
+
def __init__(self, **options):
|
| 658 |
+
from pygments.lexers.actionscript import ActionScriptLexer
|
| 659 |
+
super().__init__(ActionScriptLexer, AntlrLexer, **options)
|
| 660 |
+
|
| 661 |
+
def analyse_text(text):
|
| 662 |
+
return AntlrLexer.analyse_text(text) and \
|
| 663 |
+
re.search(r'^\s*language\s*=\s*ActionScript\s*;', text, re.M)
|
| 664 |
+
|
| 665 |
+
|
| 666 |
+
class TreetopBaseLexer(RegexLexer):
|
| 667 |
+
"""
|
| 668 |
+
A base lexer for `Treetop <http://treetop.rubyforge.org/>`_ grammars.
|
| 669 |
+
Not for direct use; use :class:`TreetopLexer` instead.
|
| 670 |
+
|
| 671 |
+
.. versionadded:: 1.6
|
| 672 |
+
"""
|
| 673 |
+
|
| 674 |
+
tokens = {
|
| 675 |
+
'root': [
|
| 676 |
+
include('space'),
|
| 677 |
+
(r'require[ \t]+[^\n\r]+[\n\r]', Other),
|
| 678 |
+
(r'module\b', Keyword.Namespace, 'module'),
|
| 679 |
+
(r'grammar\b', Keyword, 'grammar'),
|
| 680 |
+
],
|
| 681 |
+
'module': [
|
| 682 |
+
include('space'),
|
| 683 |
+
include('end'),
|
| 684 |
+
(r'module\b', Keyword, '#push'),
|
| 685 |
+
(r'grammar\b', Keyword, 'grammar'),
|
| 686 |
+
(r'[A-Z]\w*(?:::[A-Z]\w*)*', Name.Namespace),
|
| 687 |
+
],
|
| 688 |
+
'grammar': [
|
| 689 |
+
include('space'),
|
| 690 |
+
include('end'),
|
| 691 |
+
(r'rule\b', Keyword, 'rule'),
|
| 692 |
+
(r'include\b', Keyword, 'include'),
|
| 693 |
+
(r'[A-Z]\w*', Name),
|
| 694 |
+
],
|
| 695 |
+
'include': [
|
| 696 |
+
include('space'),
|
| 697 |
+
(r'[A-Z]\w*(?:::[A-Z]\w*)*', Name.Class, '#pop'),
|
| 698 |
+
],
|
| 699 |
+
'rule': [
|
| 700 |
+
include('space'),
|
| 701 |
+
include('end'),
|
| 702 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
|
| 703 |
+
(r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
|
| 704 |
+
(r'([A-Za-z_]\w*)(:)', bygroups(Name.Label, Punctuation)),
|
| 705 |
+
(r'[A-Za-z_]\w*', Name),
|
| 706 |
+
(r'[()]', Punctuation),
|
| 707 |
+
(r'[?+*/&!~]', Operator),
|
| 708 |
+
(r'\[(?:\\.|\[:\^?[a-z]+:\]|[^\\\]])+\]', String.Regex),
|
| 709 |
+
(r'([0-9]*)(\.\.)([0-9]*)',
|
| 710 |
+
bygroups(Number.Integer, Operator, Number.Integer)),
|
| 711 |
+
(r'(<)([^>]+)(>)', bygroups(Punctuation, Name.Class, Punctuation)),
|
| 712 |
+
(r'\{', Punctuation, 'inline_module'),
|
| 713 |
+
(r'\.', String.Regex),
|
| 714 |
+
],
|
| 715 |
+
'inline_module': [
|
| 716 |
+
(r'\{', Other, 'ruby'),
|
| 717 |
+
(r'\}', Punctuation, '#pop'),
|
| 718 |
+
(r'[^{}]+', Other),
|
| 719 |
+
],
|
| 720 |
+
'ruby': [
|
| 721 |
+
(r'\{', Other, '#push'),
|
| 722 |
+
(r'\}', Other, '#pop'),
|
| 723 |
+
(r'[^{}]+', Other),
|
| 724 |
+
],
|
| 725 |
+
'space': [
|
| 726 |
+
(r'[ \t\n\r]+', Whitespace),
|
| 727 |
+
(r'#[^\n]*', Comment.Single),
|
| 728 |
+
],
|
| 729 |
+
'end': [
|
| 730 |
+
(r'end\b', Keyword, '#pop'),
|
| 731 |
+
],
|
| 732 |
+
}
|
| 733 |
+
|
| 734 |
+
|
| 735 |
+
class TreetopLexer(DelegatingLexer):
|
| 736 |
+
"""
|
| 737 |
+
A lexer for Treetop grammars.
|
| 738 |
+
"""
|
| 739 |
+
|
| 740 |
+
name = 'Treetop'
|
| 741 |
+
aliases = ['treetop']
|
| 742 |
+
filenames = ['*.treetop', '*.tt']
|
| 743 |
+
url = 'https://cjheath.github.io/treetop'
|
| 744 |
+
version_added = '1.6'
|
| 745 |
+
|
| 746 |
+
def __init__(self, **options):
|
| 747 |
+
super().__init__(RubyLexer, TreetopBaseLexer, **options)
|
| 748 |
+
|
| 749 |
+
|
| 750 |
+
class EbnfLexer(RegexLexer):
|
| 751 |
+
"""
|
| 752 |
+
Lexer for `ISO/IEC 14977 EBNF
|
| 753 |
+
<https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form>`_
|
| 754 |
+
grammars.
|
| 755 |
+
"""
|
| 756 |
+
|
| 757 |
+
name = 'EBNF'
|
| 758 |
+
aliases = ['ebnf']
|
| 759 |
+
filenames = ['*.ebnf']
|
| 760 |
+
mimetypes = ['text/x-ebnf']
|
| 761 |
+
url = 'https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_Form'
|
| 762 |
+
version_added = '2.0'
|
| 763 |
+
|
| 764 |
+
tokens = {
|
| 765 |
+
'root': [
|
| 766 |
+
include('whitespace'),
|
| 767 |
+
include('comment_start'),
|
| 768 |
+
include('identifier'),
|
| 769 |
+
(r'=', Operator, 'production'),
|
| 770 |
+
],
|
| 771 |
+
'production': [
|
| 772 |
+
include('whitespace'),
|
| 773 |
+
include('comment_start'),
|
| 774 |
+
include('identifier'),
|
| 775 |
+
(r'"[^"]*"', String.Double),
|
| 776 |
+
(r"'[^']*'", String.Single),
|
| 777 |
+
(r'(\?[^?]*\?)', Name.Entity),
|
| 778 |
+
(r'[\[\]{}(),|]', Punctuation),
|
| 779 |
+
(r'-', Operator),
|
| 780 |
+
(r';', Punctuation, '#pop'),
|
| 781 |
+
(r'\.', Punctuation, '#pop'),
|
| 782 |
+
],
|
| 783 |
+
'whitespace': [
|
| 784 |
+
(r'\s+', Text),
|
| 785 |
+
],
|
| 786 |
+
'comment_start': [
|
| 787 |
+
(r'\(\*', Comment.Multiline, 'comment'),
|
| 788 |
+
],
|
| 789 |
+
'comment': [
|
| 790 |
+
(r'[^*)]', Comment.Multiline),
|
| 791 |
+
include('comment_start'),
|
| 792 |
+
(r'\*\)', Comment.Multiline, '#pop'),
|
| 793 |
+
(r'[*)]', Comment.Multiline),
|
| 794 |
+
],
|
| 795 |
+
'identifier': [
|
| 796 |
+
(r'([a-zA-Z][\w \-]*)', Keyword),
|
| 797 |
+
],
|
| 798 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/pascal.py
ADDED
|
@@ -0,0 +1,644 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.pascal
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for Pascal family languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import Lexer
|
| 14 |
+
from pygments.util import get_bool_opt, get_list_opt
|
| 15 |
+
from pygments.token import Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation, Error, Whitespace
|
| 17 |
+
from pygments.scanner import Scanner
|
| 18 |
+
|
| 19 |
+
# compatibility import
|
| 20 |
+
from pygments.lexers.modula2 import Modula2Lexer # noqa: F401
|
| 21 |
+
|
| 22 |
+
__all__ = ['DelphiLexer', 'PortugolLexer']
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class PortugolLexer(Lexer):
|
| 26 |
+
"""For Portugol, a Pascal dialect with keywords in Portuguese."""
|
| 27 |
+
name = 'Portugol'
|
| 28 |
+
aliases = ['portugol']
|
| 29 |
+
filenames = ['*.alg', '*.portugol']
|
| 30 |
+
mimetypes = []
|
| 31 |
+
url = "https://www.apoioinformatica.inf.br/produtos/visualg/linguagem"
|
| 32 |
+
version_added = ''
|
| 33 |
+
|
| 34 |
+
def __init__(self, **options):
|
| 35 |
+
Lexer.__init__(self, **options)
|
| 36 |
+
self.lexer = DelphiLexer(**options, portugol=True)
|
| 37 |
+
|
| 38 |
+
def get_tokens_unprocessed(self, text):
|
| 39 |
+
return self.lexer.get_tokens_unprocessed(text)
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
class DelphiLexer(Lexer):
|
| 43 |
+
"""
|
| 44 |
+
For Delphi (Borland Object Pascal),
|
| 45 |
+
Turbo Pascal and Free Pascal source code.
|
| 46 |
+
|
| 47 |
+
Additional options accepted:
|
| 48 |
+
|
| 49 |
+
`turbopascal`
|
| 50 |
+
Highlight Turbo Pascal specific keywords (default: ``True``).
|
| 51 |
+
`delphi`
|
| 52 |
+
Highlight Borland Delphi specific keywords (default: ``True``).
|
| 53 |
+
`freepascal`
|
| 54 |
+
Highlight Free Pascal specific keywords (default: ``True``).
|
| 55 |
+
`units`
|
| 56 |
+
A list of units that should be considered builtin, supported are
|
| 57 |
+
``System``, ``SysUtils``, ``Classes`` and ``Math``.
|
| 58 |
+
Default is to consider all of them builtin.
|
| 59 |
+
"""
|
| 60 |
+
name = 'Delphi'
|
| 61 |
+
aliases = ['delphi', 'pas', 'pascal', 'objectpascal']
|
| 62 |
+
filenames = ['*.pas', '*.dpr']
|
| 63 |
+
mimetypes = ['text/x-pascal']
|
| 64 |
+
url = 'https://www.embarcadero.com/products/delphi'
|
| 65 |
+
version_added = ''
|
| 66 |
+
|
| 67 |
+
TURBO_PASCAL_KEYWORDS = (
|
| 68 |
+
'absolute', 'and', 'array', 'asm', 'begin', 'break', 'case',
|
| 69 |
+
'const', 'constructor', 'continue', 'destructor', 'div', 'do',
|
| 70 |
+
'downto', 'else', 'end', 'file', 'for', 'function', 'goto',
|
| 71 |
+
'if', 'implementation', 'in', 'inherited', 'inline', 'interface',
|
| 72 |
+
'label', 'mod', 'nil', 'not', 'object', 'of', 'on', 'operator',
|
| 73 |
+
'or', 'packed', 'procedure', 'program', 'record', 'reintroduce',
|
| 74 |
+
'repeat', 'self', 'set', 'shl', 'shr', 'string', 'then', 'to',
|
| 75 |
+
'type', 'unit', 'until', 'uses', 'var', 'while', 'with', 'xor'
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
DELPHI_KEYWORDS = (
|
| 79 |
+
'as', 'class', 'except', 'exports', 'finalization', 'finally',
|
| 80 |
+
'initialization', 'is', 'library', 'on', 'property', 'raise',
|
| 81 |
+
'threadvar', 'try'
|
| 82 |
+
)
|
| 83 |
+
|
| 84 |
+
FREE_PASCAL_KEYWORDS = (
|
| 85 |
+
'dispose', 'exit', 'false', 'new', 'true'
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
BLOCK_KEYWORDS = {
|
| 89 |
+
'begin', 'class', 'const', 'constructor', 'destructor', 'end',
|
| 90 |
+
'finalization', 'function', 'implementation', 'initialization',
|
| 91 |
+
'label', 'library', 'operator', 'procedure', 'program', 'property',
|
| 92 |
+
'record', 'threadvar', 'type', 'unit', 'uses', 'var'
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
FUNCTION_MODIFIERS = {
|
| 96 |
+
'alias', 'cdecl', 'export', 'inline', 'interrupt', 'nostackframe',
|
| 97 |
+
'pascal', 'register', 'safecall', 'softfloat', 'stdcall',
|
| 98 |
+
'varargs', 'name', 'dynamic', 'near', 'virtual', 'external',
|
| 99 |
+
'override', 'assembler'
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
# XXX: those aren't global. but currently we know no way for defining
|
| 103 |
+
# them just for the type context.
|
| 104 |
+
DIRECTIVES = {
|
| 105 |
+
'absolute', 'abstract', 'assembler', 'cppdecl', 'default', 'far',
|
| 106 |
+
'far16', 'forward', 'index', 'oldfpccall', 'private', 'protected',
|
| 107 |
+
'published', 'public'
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
BUILTIN_TYPES = {
|
| 111 |
+
'ansichar', 'ansistring', 'bool', 'boolean', 'byte', 'bytebool',
|
| 112 |
+
'cardinal', 'char', 'comp', 'currency', 'double', 'dword',
|
| 113 |
+
'extended', 'int64', 'integer', 'iunknown', 'longbool', 'longint',
|
| 114 |
+
'longword', 'pansichar', 'pansistring', 'pbool', 'pboolean',
|
| 115 |
+
'pbyte', 'pbytearray', 'pcardinal', 'pchar', 'pcomp', 'pcurrency',
|
| 116 |
+
'pdate', 'pdatetime', 'pdouble', 'pdword', 'pextended', 'phandle',
|
| 117 |
+
'pint64', 'pinteger', 'plongint', 'plongword', 'pointer',
|
| 118 |
+
'ppointer', 'pshortint', 'pshortstring', 'psingle', 'psmallint',
|
| 119 |
+
'pstring', 'pvariant', 'pwidechar', 'pwidestring', 'pword',
|
| 120 |
+
'pwordarray', 'pwordbool', 'real', 'real48', 'shortint',
|
| 121 |
+
'shortstring', 'single', 'smallint', 'string', 'tclass', 'tdate',
|
| 122 |
+
'tdatetime', 'textfile', 'thandle', 'tobject', 'ttime', 'variant',
|
| 123 |
+
'widechar', 'widestring', 'word', 'wordbool'
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
BUILTIN_UNITS = {
|
| 127 |
+
'System': (
|
| 128 |
+
'abs', 'acquireexceptionobject', 'addr', 'ansitoutf8',
|
| 129 |
+
'append', 'arctan', 'assert', 'assigned', 'assignfile',
|
| 130 |
+
'beginthread', 'blockread', 'blockwrite', 'break', 'chdir',
|
| 131 |
+
'chr', 'close', 'closefile', 'comptocurrency', 'comptodouble',
|
| 132 |
+
'concat', 'continue', 'copy', 'cos', 'dec', 'delete',
|
| 133 |
+
'dispose', 'doubletocomp', 'endthread', 'enummodules',
|
| 134 |
+
'enumresourcemodules', 'eof', 'eoln', 'erase', 'exceptaddr',
|
| 135 |
+
'exceptobject', 'exclude', 'exit', 'exp', 'filepos', 'filesize',
|
| 136 |
+
'fillchar', 'finalize', 'findclasshinstance', 'findhinstance',
|
| 137 |
+
'findresourcehinstance', 'flush', 'frac', 'freemem',
|
| 138 |
+
'get8087cw', 'getdir', 'getlasterror', 'getmem',
|
| 139 |
+
'getmemorymanager', 'getmodulefilename', 'getvariantmanager',
|
| 140 |
+
'halt', 'hi', 'high', 'inc', 'include', 'initialize', 'insert',
|
| 141 |
+
'int', 'ioresult', 'ismemorymanagerset', 'isvariantmanagerset',
|
| 142 |
+
'length', 'ln', 'lo', 'low', 'mkdir', 'move', 'new', 'odd',
|
| 143 |
+
'olestrtostring', 'olestrtostrvar', 'ord', 'paramcount',
|
| 144 |
+
'paramstr', 'pi', 'pos', 'pred', 'ptr', 'pucs4chars', 'random',
|
| 145 |
+
'randomize', 'read', 'readln', 'reallocmem',
|
| 146 |
+
'releaseexceptionobject', 'rename', 'reset', 'rewrite', 'rmdir',
|
| 147 |
+
'round', 'runerror', 'seek', 'seekeof', 'seekeoln',
|
| 148 |
+
'set8087cw', 'setlength', 'setlinebreakstyle',
|
| 149 |
+
'setmemorymanager', 'setstring', 'settextbuf',
|
| 150 |
+
'setvariantmanager', 'sin', 'sizeof', 'slice', 'sqr', 'sqrt',
|
| 151 |
+
'str', 'stringofchar', 'stringtoolestr', 'stringtowidechar',
|
| 152 |
+
'succ', 'swap', 'trunc', 'truncate', 'typeinfo',
|
| 153 |
+
'ucs4stringtowidestring', 'unicodetoutf8', 'uniquestring',
|
| 154 |
+
'upcase', 'utf8decode', 'utf8encode', 'utf8toansi',
|
| 155 |
+
'utf8tounicode', 'val', 'vararrayredim', 'varclear',
|
| 156 |
+
'widecharlentostring', 'widecharlentostrvar',
|
| 157 |
+
'widechartostring', 'widechartostrvar',
|
| 158 |
+
'widestringtoucs4string', 'write', 'writeln'
|
| 159 |
+
),
|
| 160 |
+
'SysUtils': (
|
| 161 |
+
'abort', 'addexitproc', 'addterminateproc', 'adjustlinebreaks',
|
| 162 |
+
'allocmem', 'ansicomparefilename', 'ansicomparestr',
|
| 163 |
+
'ansicomparetext', 'ansidequotedstr', 'ansiextractquotedstr',
|
| 164 |
+
'ansilastchar', 'ansilowercase', 'ansilowercasefilename',
|
| 165 |
+
'ansipos', 'ansiquotedstr', 'ansisamestr', 'ansisametext',
|
| 166 |
+
'ansistrcomp', 'ansistricomp', 'ansistrlastchar', 'ansistrlcomp',
|
| 167 |
+
'ansistrlicomp', 'ansistrlower', 'ansistrpos', 'ansistrrscan',
|
| 168 |
+
'ansistrscan', 'ansistrupper', 'ansiuppercase',
|
| 169 |
+
'ansiuppercasefilename', 'appendstr', 'assignstr', 'beep',
|
| 170 |
+
'booltostr', 'bytetocharindex', 'bytetocharlen', 'bytetype',
|
| 171 |
+
'callterminateprocs', 'changefileext', 'charlength',
|
| 172 |
+
'chartobyteindex', 'chartobytelen', 'comparemem', 'comparestr',
|
| 173 |
+
'comparetext', 'createdir', 'createguid', 'currentyear',
|
| 174 |
+
'currtostr', 'currtostrf', 'date', 'datetimetofiledate',
|
| 175 |
+
'datetimetostr', 'datetimetostring', 'datetimetosystemtime',
|
| 176 |
+
'datetimetotimestamp', 'datetostr', 'dayofweek', 'decodedate',
|
| 177 |
+
'decodedatefully', 'decodetime', 'deletefile', 'directoryexists',
|
| 178 |
+
'diskfree', 'disksize', 'disposestr', 'encodedate', 'encodetime',
|
| 179 |
+
'exceptionerrormessage', 'excludetrailingbackslash',
|
| 180 |
+
'excludetrailingpathdelimiter', 'expandfilename',
|
| 181 |
+
'expandfilenamecase', 'expanduncfilename', 'extractfiledir',
|
| 182 |
+
'extractfiledrive', 'extractfileext', 'extractfilename',
|
| 183 |
+
'extractfilepath', 'extractrelativepath', 'extractshortpathname',
|
| 184 |
+
'fileage', 'fileclose', 'filecreate', 'filedatetodatetime',
|
| 185 |
+
'fileexists', 'filegetattr', 'filegetdate', 'fileisreadonly',
|
| 186 |
+
'fileopen', 'fileread', 'filesearch', 'fileseek', 'filesetattr',
|
| 187 |
+
'filesetdate', 'filesetreadonly', 'filewrite', 'finalizepackage',
|
| 188 |
+
'findclose', 'findcmdlineswitch', 'findfirst', 'findnext',
|
| 189 |
+
'floattocurr', 'floattodatetime', 'floattodecimal', 'floattostr',
|
| 190 |
+
'floattostrf', 'floattotext', 'floattotextfmt', 'fmtloadstr',
|
| 191 |
+
'fmtstr', 'forcedirectories', 'format', 'formatbuf', 'formatcurr',
|
| 192 |
+
'formatdatetime', 'formatfloat', 'freeandnil', 'getcurrentdir',
|
| 193 |
+
'getenvironmentvariable', 'getfileversion', 'getformatsettings',
|
| 194 |
+
'getlocaleformatsettings', 'getmodulename', 'getpackagedescription',
|
| 195 |
+
'getpackageinfo', 'gettime', 'guidtostring', 'incamonth',
|
| 196 |
+
'includetrailingbackslash', 'includetrailingpathdelimiter',
|
| 197 |
+
'incmonth', 'initializepackage', 'interlockeddecrement',
|
| 198 |
+
'interlockedexchange', 'interlockedexchangeadd',
|
| 199 |
+
'interlockedincrement', 'inttohex', 'inttostr', 'isdelimiter',
|
| 200 |
+
'isequalguid', 'isleapyear', 'ispathdelimiter', 'isvalidident',
|
| 201 |
+
'languages', 'lastdelimiter', 'loadpackage', 'loadstr',
|
| 202 |
+
'lowercase', 'msecstotimestamp', 'newstr', 'nextcharindex', 'now',
|
| 203 |
+
'outofmemoryerror', 'quotedstr', 'raiselastoserror',
|
| 204 |
+
'raiselastwin32error', 'removedir', 'renamefile', 'replacedate',
|
| 205 |
+
'replacetime', 'safeloadlibrary', 'samefilename', 'sametext',
|
| 206 |
+
'setcurrentdir', 'showexception', 'sleep', 'stralloc', 'strbufsize',
|
| 207 |
+
'strbytetype', 'strcat', 'strcharlength', 'strcomp', 'strcopy',
|
| 208 |
+
'strdispose', 'strecopy', 'strend', 'strfmt', 'stricomp',
|
| 209 |
+
'stringreplace', 'stringtoguid', 'strlcat', 'strlcomp', 'strlcopy',
|
| 210 |
+
'strlen', 'strlfmt', 'strlicomp', 'strlower', 'strmove', 'strnew',
|
| 211 |
+
'strnextchar', 'strpas', 'strpcopy', 'strplcopy', 'strpos',
|
| 212 |
+
'strrscan', 'strscan', 'strtobool', 'strtobooldef', 'strtocurr',
|
| 213 |
+
'strtocurrdef', 'strtodate', 'strtodatedef', 'strtodatetime',
|
| 214 |
+
'strtodatetimedef', 'strtofloat', 'strtofloatdef', 'strtoint',
|
| 215 |
+
'strtoint64', 'strtoint64def', 'strtointdef', 'strtotime',
|
| 216 |
+
'strtotimedef', 'strupper', 'supports', 'syserrormessage',
|
| 217 |
+
'systemtimetodatetime', 'texttofloat', 'time', 'timestamptodatetime',
|
| 218 |
+
'timestamptomsecs', 'timetostr', 'trim', 'trimleft', 'trimright',
|
| 219 |
+
'tryencodedate', 'tryencodetime', 'tryfloattocurr', 'tryfloattodatetime',
|
| 220 |
+
'trystrtobool', 'trystrtocurr', 'trystrtodate', 'trystrtodatetime',
|
| 221 |
+
'trystrtofloat', 'trystrtoint', 'trystrtoint64', 'trystrtotime',
|
| 222 |
+
'unloadpackage', 'uppercase', 'widecomparestr', 'widecomparetext',
|
| 223 |
+
'widefmtstr', 'wideformat', 'wideformatbuf', 'widelowercase',
|
| 224 |
+
'widesamestr', 'widesametext', 'wideuppercase', 'win32check',
|
| 225 |
+
'wraptext'
|
| 226 |
+
),
|
| 227 |
+
'Classes': (
|
| 228 |
+
'activateclassgroup', 'allocatehwnd', 'bintohex', 'checksynchronize',
|
| 229 |
+
'collectionsequal', 'countgenerations', 'deallocatehwnd', 'equalrect',
|
| 230 |
+
'extractstrings', 'findclass', 'findglobalcomponent', 'getclass',
|
| 231 |
+
'groupdescendantswith', 'hextobin', 'identtoint',
|
| 232 |
+
'initinheritedcomponent', 'inttoident', 'invalidpoint',
|
| 233 |
+
'isuniqueglobalcomponentname', 'linestart', 'objectbinarytotext',
|
| 234 |
+
'objectresourcetotext', 'objecttexttobinary', 'objecttexttoresource',
|
| 235 |
+
'pointsequal', 'readcomponentres', 'readcomponentresex',
|
| 236 |
+
'readcomponentresfile', 'rect', 'registerclass', 'registerclassalias',
|
| 237 |
+
'registerclasses', 'registercomponents', 'registerintegerconsts',
|
| 238 |
+
'registernoicon', 'registernonactivex', 'smallpoint', 'startclassgroup',
|
| 239 |
+
'teststreamformat', 'unregisterclass', 'unregisterclasses',
|
| 240 |
+
'unregisterintegerconsts', 'unregistermoduleclasses',
|
| 241 |
+
'writecomponentresfile'
|
| 242 |
+
),
|
| 243 |
+
'Math': (
|
| 244 |
+
'arccos', 'arccosh', 'arccot', 'arccoth', 'arccsc', 'arccsch', 'arcsec',
|
| 245 |
+
'arcsech', 'arcsin', 'arcsinh', 'arctan2', 'arctanh', 'ceil',
|
| 246 |
+
'comparevalue', 'cosecant', 'cosh', 'cot', 'cotan', 'coth', 'csc',
|
| 247 |
+
'csch', 'cycletodeg', 'cycletograd', 'cycletorad', 'degtocycle',
|
| 248 |
+
'degtograd', 'degtorad', 'divmod', 'doubledecliningbalance',
|
| 249 |
+
'ensurerange', 'floor', 'frexp', 'futurevalue', 'getexceptionmask',
|
| 250 |
+
'getprecisionmode', 'getroundmode', 'gradtocycle', 'gradtodeg',
|
| 251 |
+
'gradtorad', 'hypot', 'inrange', 'interestpayment', 'interestrate',
|
| 252 |
+
'internalrateofreturn', 'intpower', 'isinfinite', 'isnan', 'iszero',
|
| 253 |
+
'ldexp', 'lnxp1', 'log10', 'log2', 'logn', 'max', 'maxintvalue',
|
| 254 |
+
'maxvalue', 'mean', 'meanandstddev', 'min', 'minintvalue', 'minvalue',
|
| 255 |
+
'momentskewkurtosis', 'netpresentvalue', 'norm', 'numberofperiods',
|
| 256 |
+
'payment', 'periodpayment', 'poly', 'popnstddev', 'popnvariance',
|
| 257 |
+
'power', 'presentvalue', 'radtocycle', 'radtodeg', 'radtograd',
|
| 258 |
+
'randg', 'randomrange', 'roundto', 'samevalue', 'sec', 'secant',
|
| 259 |
+
'sech', 'setexceptionmask', 'setprecisionmode', 'setroundmode',
|
| 260 |
+
'sign', 'simpleroundto', 'sincos', 'sinh', 'slndepreciation', 'stddev',
|
| 261 |
+
'sum', 'sumint', 'sumofsquares', 'sumsandsquares', 'syddepreciation',
|
| 262 |
+
'tan', 'tanh', 'totalvariance', 'variance'
|
| 263 |
+
)
|
| 264 |
+
}
|
| 265 |
+
|
| 266 |
+
ASM_REGISTERS = {
|
| 267 |
+
'ah', 'al', 'ax', 'bh', 'bl', 'bp', 'bx', 'ch', 'cl', 'cr0',
|
| 268 |
+
'cr1', 'cr2', 'cr3', 'cr4', 'cs', 'cx', 'dh', 'di', 'dl', 'dr0',
|
| 269 |
+
'dr1', 'dr2', 'dr3', 'dr4', 'dr5', 'dr6', 'dr7', 'ds', 'dx',
|
| 270 |
+
'eax', 'ebp', 'ebx', 'ecx', 'edi', 'edx', 'es', 'esi', 'esp',
|
| 271 |
+
'fs', 'gs', 'mm0', 'mm1', 'mm2', 'mm3', 'mm4', 'mm5', 'mm6',
|
| 272 |
+
'mm7', 'si', 'sp', 'ss', 'st0', 'st1', 'st2', 'st3', 'st4', 'st5',
|
| 273 |
+
'st6', 'st7', 'xmm0', 'xmm1', 'xmm2', 'xmm3', 'xmm4', 'xmm5',
|
| 274 |
+
'xmm6', 'xmm7'
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
ASM_INSTRUCTIONS = {
|
| 278 |
+
'aaa', 'aad', 'aam', 'aas', 'adc', 'add', 'and', 'arpl', 'bound',
|
| 279 |
+
'bsf', 'bsr', 'bswap', 'bt', 'btc', 'btr', 'bts', 'call', 'cbw',
|
| 280 |
+
'cdq', 'clc', 'cld', 'cli', 'clts', 'cmc', 'cmova', 'cmovae',
|
| 281 |
+
'cmovb', 'cmovbe', 'cmovc', 'cmovcxz', 'cmove', 'cmovg',
|
| 282 |
+
'cmovge', 'cmovl', 'cmovle', 'cmovna', 'cmovnae', 'cmovnb',
|
| 283 |
+
'cmovnbe', 'cmovnc', 'cmovne', 'cmovng', 'cmovnge', 'cmovnl',
|
| 284 |
+
'cmovnle', 'cmovno', 'cmovnp', 'cmovns', 'cmovnz', 'cmovo',
|
| 285 |
+
'cmovp', 'cmovpe', 'cmovpo', 'cmovs', 'cmovz', 'cmp', 'cmpsb',
|
| 286 |
+
'cmpsd', 'cmpsw', 'cmpxchg', 'cmpxchg486', 'cmpxchg8b', 'cpuid',
|
| 287 |
+
'cwd', 'cwde', 'daa', 'das', 'dec', 'div', 'emms', 'enter', 'hlt',
|
| 288 |
+
'ibts', 'icebp', 'idiv', 'imul', 'in', 'inc', 'insb', 'insd',
|
| 289 |
+
'insw', 'int', 'int01', 'int03', 'int1', 'int3', 'into', 'invd',
|
| 290 |
+
'invlpg', 'iret', 'iretd', 'iretw', 'ja', 'jae', 'jb', 'jbe',
|
| 291 |
+
'jc', 'jcxz', 'jcxz', 'je', 'jecxz', 'jg', 'jge', 'jl', 'jle',
|
| 292 |
+
'jmp', 'jna', 'jnae', 'jnb', 'jnbe', 'jnc', 'jne', 'jng', 'jnge',
|
| 293 |
+
'jnl', 'jnle', 'jno', 'jnp', 'jns', 'jnz', 'jo', 'jp', 'jpe',
|
| 294 |
+
'jpo', 'js', 'jz', 'lahf', 'lar', 'lcall', 'lds', 'lea', 'leave',
|
| 295 |
+
'les', 'lfs', 'lgdt', 'lgs', 'lidt', 'ljmp', 'lldt', 'lmsw',
|
| 296 |
+
'loadall', 'loadall286', 'lock', 'lodsb', 'lodsd', 'lodsw',
|
| 297 |
+
'loop', 'loope', 'loopne', 'loopnz', 'loopz', 'lsl', 'lss', 'ltr',
|
| 298 |
+
'mov', 'movd', 'movq', 'movsb', 'movsd', 'movsw', 'movsx',
|
| 299 |
+
'movzx', 'mul', 'neg', 'nop', 'not', 'or', 'out', 'outsb', 'outsd',
|
| 300 |
+
'outsw', 'pop', 'popa', 'popad', 'popaw', 'popf', 'popfd', 'popfw',
|
| 301 |
+
'push', 'pusha', 'pushad', 'pushaw', 'pushf', 'pushfd', 'pushfw',
|
| 302 |
+
'rcl', 'rcr', 'rdmsr', 'rdpmc', 'rdshr', 'rdtsc', 'rep', 'repe',
|
| 303 |
+
'repne', 'repnz', 'repz', 'ret', 'retf', 'retn', 'rol', 'ror',
|
| 304 |
+
'rsdc', 'rsldt', 'rsm', 'sahf', 'sal', 'salc', 'sar', 'sbb',
|
| 305 |
+
'scasb', 'scasd', 'scasw', 'seta', 'setae', 'setb', 'setbe',
|
| 306 |
+
'setc', 'setcxz', 'sete', 'setg', 'setge', 'setl', 'setle',
|
| 307 |
+
'setna', 'setnae', 'setnb', 'setnbe', 'setnc', 'setne', 'setng',
|
| 308 |
+
'setnge', 'setnl', 'setnle', 'setno', 'setnp', 'setns', 'setnz',
|
| 309 |
+
'seto', 'setp', 'setpe', 'setpo', 'sets', 'setz', 'sgdt', 'shl',
|
| 310 |
+
'shld', 'shr', 'shrd', 'sidt', 'sldt', 'smi', 'smint', 'smintold',
|
| 311 |
+
'smsw', 'stc', 'std', 'sti', 'stosb', 'stosd', 'stosw', 'str',
|
| 312 |
+
'sub', 'svdc', 'svldt', 'svts', 'syscall', 'sysenter', 'sysexit',
|
| 313 |
+
'sysret', 'test', 'ud1', 'ud2', 'umov', 'verr', 'verw', 'wait',
|
| 314 |
+
'wbinvd', 'wrmsr', 'wrshr', 'xadd', 'xbts', 'xchg', 'xlat',
|
| 315 |
+
'xlatb', 'xor'
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
PORTUGOL_KEYWORDS = (
|
| 319 |
+
'aleatorio',
|
| 320 |
+
'algoritmo',
|
| 321 |
+
'arquivo',
|
| 322 |
+
'ate',
|
| 323 |
+
'caso',
|
| 324 |
+
'cronometro',
|
| 325 |
+
'debug',
|
| 326 |
+
'e',
|
| 327 |
+
'eco',
|
| 328 |
+
'enquanto',
|
| 329 |
+
'entao',
|
| 330 |
+
'escolha',
|
| 331 |
+
'escreva',
|
| 332 |
+
'escreval',
|
| 333 |
+
'faca',
|
| 334 |
+
'falso',
|
| 335 |
+
'fimalgoritmo',
|
| 336 |
+
'fimenquanto',
|
| 337 |
+
'fimescolha',
|
| 338 |
+
'fimfuncao',
|
| 339 |
+
'fimpara',
|
| 340 |
+
'fimprocedimento',
|
| 341 |
+
'fimrepita',
|
| 342 |
+
'fimse',
|
| 343 |
+
'funcao',
|
| 344 |
+
'inicio',
|
| 345 |
+
'int',
|
| 346 |
+
'interrompa',
|
| 347 |
+
'leia',
|
| 348 |
+
'limpatela',
|
| 349 |
+
'mod',
|
| 350 |
+
'nao',
|
| 351 |
+
'ou',
|
| 352 |
+
'outrocaso',
|
| 353 |
+
'para',
|
| 354 |
+
'passo',
|
| 355 |
+
'pausa',
|
| 356 |
+
'procedimento',
|
| 357 |
+
'repita',
|
| 358 |
+
'retorne',
|
| 359 |
+
'se',
|
| 360 |
+
'senao',
|
| 361 |
+
'timer',
|
| 362 |
+
'var',
|
| 363 |
+
'vetor',
|
| 364 |
+
'verdadeiro',
|
| 365 |
+
'xou',
|
| 366 |
+
'div',
|
| 367 |
+
'mod',
|
| 368 |
+
'abs',
|
| 369 |
+
'arccos',
|
| 370 |
+
'arcsen',
|
| 371 |
+
'arctan',
|
| 372 |
+
'cos',
|
| 373 |
+
'cotan',
|
| 374 |
+
'Exp',
|
| 375 |
+
'grauprad',
|
| 376 |
+
'int',
|
| 377 |
+
'log',
|
| 378 |
+
'logn',
|
| 379 |
+
'pi',
|
| 380 |
+
'quad',
|
| 381 |
+
'radpgrau',
|
| 382 |
+
'raizq',
|
| 383 |
+
'rand',
|
| 384 |
+
'randi',
|
| 385 |
+
'sen',
|
| 386 |
+
'Tan',
|
| 387 |
+
'asc',
|
| 388 |
+
'carac',
|
| 389 |
+
'caracpnum',
|
| 390 |
+
'compr',
|
| 391 |
+
'copia',
|
| 392 |
+
'maiusc',
|
| 393 |
+
'minusc',
|
| 394 |
+
'numpcarac',
|
| 395 |
+
'pos',
|
| 396 |
+
)
|
| 397 |
+
|
| 398 |
+
PORTUGOL_BUILTIN_TYPES = {
|
| 399 |
+
'inteiro', 'real', 'caractere', 'logico'
|
| 400 |
+
}
|
| 401 |
+
|
| 402 |
+
def __init__(self, **options):
|
| 403 |
+
Lexer.__init__(self, **options)
|
| 404 |
+
self.keywords = set()
|
| 405 |
+
self.builtins = set()
|
| 406 |
+
if get_bool_opt(options, 'portugol', False):
|
| 407 |
+
self.keywords.update(self.PORTUGOL_KEYWORDS)
|
| 408 |
+
self.builtins.update(self.PORTUGOL_BUILTIN_TYPES)
|
| 409 |
+
self.is_portugol = True
|
| 410 |
+
else:
|
| 411 |
+
self.is_portugol = False
|
| 412 |
+
|
| 413 |
+
if get_bool_opt(options, 'turbopascal', True):
|
| 414 |
+
self.keywords.update(self.TURBO_PASCAL_KEYWORDS)
|
| 415 |
+
if get_bool_opt(options, 'delphi', True):
|
| 416 |
+
self.keywords.update(self.DELPHI_KEYWORDS)
|
| 417 |
+
if get_bool_opt(options, 'freepascal', True):
|
| 418 |
+
self.keywords.update(self.FREE_PASCAL_KEYWORDS)
|
| 419 |
+
for unit in get_list_opt(options, 'units', list(self.BUILTIN_UNITS)):
|
| 420 |
+
self.builtins.update(self.BUILTIN_UNITS[unit])
|
| 421 |
+
|
| 422 |
+
def get_tokens_unprocessed(self, text):
|
| 423 |
+
scanner = Scanner(text, re.DOTALL | re.MULTILINE | re.IGNORECASE)
|
| 424 |
+
stack = ['initial']
|
| 425 |
+
in_function_block = False
|
| 426 |
+
in_property_block = False
|
| 427 |
+
was_dot = False
|
| 428 |
+
next_token_is_function = False
|
| 429 |
+
next_token_is_property = False
|
| 430 |
+
collect_labels = False
|
| 431 |
+
block_labels = set()
|
| 432 |
+
brace_balance = [0, 0]
|
| 433 |
+
|
| 434 |
+
while not scanner.eos:
|
| 435 |
+
token = Error
|
| 436 |
+
|
| 437 |
+
if stack[-1] == 'initial':
|
| 438 |
+
if scanner.scan(r'\s+'):
|
| 439 |
+
token = Whitespace
|
| 440 |
+
elif not self.is_portugol and scanner.scan(r'\{.*?\}|\(\*.*?\*\)'):
|
| 441 |
+
if scanner.match.startswith('$'):
|
| 442 |
+
token = Comment.Preproc
|
| 443 |
+
else:
|
| 444 |
+
token = Comment.Multiline
|
| 445 |
+
elif scanner.scan(r'//.*?$'):
|
| 446 |
+
token = Comment.Single
|
| 447 |
+
elif self.is_portugol and scanner.scan(r'(<\-)|(>=)|(<=)|%|<|>|-|\+|\*|\=|(<>)|\/|\.|:|,'):
|
| 448 |
+
token = Operator
|
| 449 |
+
elif not self.is_portugol and scanner.scan(r'[-+*\/=<>:;,.@\^]'):
|
| 450 |
+
token = Operator
|
| 451 |
+
# stop label highlighting on next ";"
|
| 452 |
+
if collect_labels and scanner.match == ';':
|
| 453 |
+
collect_labels = False
|
| 454 |
+
elif scanner.scan(r'[\(\)\[\]]+'):
|
| 455 |
+
token = Punctuation
|
| 456 |
+
# abort function naming ``foo = Function(...)``
|
| 457 |
+
next_token_is_function = False
|
| 458 |
+
# if we are in a function block we count the open
|
| 459 |
+
# braces because ootherwise it's impossible to
|
| 460 |
+
# determine the end of the modifier context
|
| 461 |
+
if in_function_block or in_property_block:
|
| 462 |
+
if scanner.match == '(':
|
| 463 |
+
brace_balance[0] += 1
|
| 464 |
+
elif scanner.match == ')':
|
| 465 |
+
brace_balance[0] -= 1
|
| 466 |
+
elif scanner.match == '[':
|
| 467 |
+
brace_balance[1] += 1
|
| 468 |
+
elif scanner.match == ']':
|
| 469 |
+
brace_balance[1] -= 1
|
| 470 |
+
elif scanner.scan(r'[A-Za-z_][A-Za-z_0-9]*'):
|
| 471 |
+
lowercase_name = scanner.match.lower()
|
| 472 |
+
if lowercase_name == 'result':
|
| 473 |
+
token = Name.Builtin.Pseudo
|
| 474 |
+
elif lowercase_name in self.keywords:
|
| 475 |
+
token = Keyword
|
| 476 |
+
# if we are in a special block and a
|
| 477 |
+
# block ending keyword occurs (and the parenthesis
|
| 478 |
+
# is balanced) we end the current block context
|
| 479 |
+
if self.is_portugol:
|
| 480 |
+
if lowercase_name in ('funcao', 'procedimento'):
|
| 481 |
+
in_function_block = True
|
| 482 |
+
next_token_is_function = True
|
| 483 |
+
else:
|
| 484 |
+
if (in_function_block or in_property_block) and \
|
| 485 |
+
lowercase_name in self.BLOCK_KEYWORDS and \
|
| 486 |
+
brace_balance[0] <= 0 and \
|
| 487 |
+
brace_balance[1] <= 0:
|
| 488 |
+
in_function_block = False
|
| 489 |
+
in_property_block = False
|
| 490 |
+
brace_balance = [0, 0]
|
| 491 |
+
block_labels = set()
|
| 492 |
+
if lowercase_name in ('label', 'goto'):
|
| 493 |
+
collect_labels = True
|
| 494 |
+
elif lowercase_name == 'asm':
|
| 495 |
+
stack.append('asm')
|
| 496 |
+
elif lowercase_name == 'property':
|
| 497 |
+
in_property_block = True
|
| 498 |
+
next_token_is_property = True
|
| 499 |
+
elif lowercase_name in ('procedure', 'operator',
|
| 500 |
+
'function', 'constructor',
|
| 501 |
+
'destructor'):
|
| 502 |
+
in_function_block = True
|
| 503 |
+
next_token_is_function = True
|
| 504 |
+
# we are in a function block and the current name
|
| 505 |
+
# is in the set of registered modifiers. highlight
|
| 506 |
+
# it as pseudo keyword
|
| 507 |
+
elif not self.is_portugol and in_function_block and \
|
| 508 |
+
lowercase_name in self.FUNCTION_MODIFIERS:
|
| 509 |
+
token = Keyword.Pseudo
|
| 510 |
+
# if we are in a property highlight some more
|
| 511 |
+
# modifiers
|
| 512 |
+
elif not self.is_portugol and in_property_block and \
|
| 513 |
+
lowercase_name in ('read', 'write'):
|
| 514 |
+
token = Keyword.Pseudo
|
| 515 |
+
next_token_is_function = True
|
| 516 |
+
# if the last iteration set next_token_is_function
|
| 517 |
+
# to true we now want this name highlighted as
|
| 518 |
+
# function. so do that and reset the state
|
| 519 |
+
elif next_token_is_function:
|
| 520 |
+
# Look if the next token is a dot. If yes it's
|
| 521 |
+
# not a function, but a class name and the
|
| 522 |
+
# part after the dot a function name
|
| 523 |
+
if not self.is_portugol and scanner.test(r'\s*\.\s*'):
|
| 524 |
+
token = Name.Class
|
| 525 |
+
# it's not a dot, our job is done
|
| 526 |
+
else:
|
| 527 |
+
token = Name.Function
|
| 528 |
+
next_token_is_function = False
|
| 529 |
+
|
| 530 |
+
if self.is_portugol:
|
| 531 |
+
block_labels.add(scanner.match.lower())
|
| 532 |
+
|
| 533 |
+
# same for properties
|
| 534 |
+
elif not self.is_portugol and next_token_is_property:
|
| 535 |
+
token = Name.Property
|
| 536 |
+
next_token_is_property = False
|
| 537 |
+
# Highlight this token as label and add it
|
| 538 |
+
# to the list of known labels
|
| 539 |
+
elif not self.is_portugol and collect_labels:
|
| 540 |
+
token = Name.Label
|
| 541 |
+
block_labels.add(scanner.match.lower())
|
| 542 |
+
# name is in list of known labels
|
| 543 |
+
elif lowercase_name in block_labels:
|
| 544 |
+
token = Name.Label
|
| 545 |
+
elif self.is_portugol and lowercase_name in self.PORTUGOL_BUILTIN_TYPES:
|
| 546 |
+
token = Keyword.Type
|
| 547 |
+
elif not self.is_portugol and lowercase_name in self.BUILTIN_TYPES:
|
| 548 |
+
token = Keyword.Type
|
| 549 |
+
elif not self.is_portugol and lowercase_name in self.DIRECTIVES:
|
| 550 |
+
token = Keyword.Pseudo
|
| 551 |
+
# builtins are just builtins if the token
|
| 552 |
+
# before isn't a dot
|
| 553 |
+
elif not self.is_portugol and not was_dot and lowercase_name in self.builtins:
|
| 554 |
+
token = Name.Builtin
|
| 555 |
+
else:
|
| 556 |
+
token = Name
|
| 557 |
+
elif self.is_portugol and scanner.scan(r"\""):
|
| 558 |
+
token = String
|
| 559 |
+
stack.append('string')
|
| 560 |
+
elif not self.is_portugol and scanner.scan(r"'"):
|
| 561 |
+
token = String
|
| 562 |
+
stack.append('string')
|
| 563 |
+
elif not self.is_portugol and scanner.scan(r'\#(\d+|\$[0-9A-Fa-f]+)'):
|
| 564 |
+
token = String.Char
|
| 565 |
+
elif not self.is_portugol and scanner.scan(r'\$[0-9A-Fa-f]+'):
|
| 566 |
+
token = Number.Hex
|
| 567 |
+
elif scanner.scan(r'\d+(?![eE]|\.[^.])'):
|
| 568 |
+
token = Number.Integer
|
| 569 |
+
elif scanner.scan(r'\d+(\.\d+([eE][+-]?\d+)?|[eE][+-]?\d+)'):
|
| 570 |
+
token = Number.Float
|
| 571 |
+
else:
|
| 572 |
+
# if the stack depth is deeper than once, pop
|
| 573 |
+
if len(stack) > 1:
|
| 574 |
+
stack.pop()
|
| 575 |
+
scanner.get_char()
|
| 576 |
+
|
| 577 |
+
elif stack[-1] == 'string':
|
| 578 |
+
if self.is_portugol:
|
| 579 |
+
if scanner.scan(r"''"):
|
| 580 |
+
token = String.Escape
|
| 581 |
+
elif scanner.scan(r"\""):
|
| 582 |
+
token = String
|
| 583 |
+
stack.pop()
|
| 584 |
+
elif scanner.scan(r"[^\"]*"):
|
| 585 |
+
token = String
|
| 586 |
+
else:
|
| 587 |
+
scanner.get_char()
|
| 588 |
+
stack.pop()
|
| 589 |
+
else:
|
| 590 |
+
if scanner.scan(r"''"):
|
| 591 |
+
token = String.Escape
|
| 592 |
+
elif scanner.scan(r"'"):
|
| 593 |
+
token = String
|
| 594 |
+
stack.pop()
|
| 595 |
+
elif scanner.scan(r"[^']*"):
|
| 596 |
+
token = String
|
| 597 |
+
else:
|
| 598 |
+
scanner.get_char()
|
| 599 |
+
stack.pop()
|
| 600 |
+
elif not self.is_portugol and stack[-1] == 'asm':
|
| 601 |
+
if scanner.scan(r'\s+'):
|
| 602 |
+
token = Whitespace
|
| 603 |
+
elif scanner.scan(r'end'):
|
| 604 |
+
token = Keyword
|
| 605 |
+
stack.pop()
|
| 606 |
+
elif scanner.scan(r'\{.*?\}|\(\*.*?\*\)'):
|
| 607 |
+
if scanner.match.startswith('$'):
|
| 608 |
+
token = Comment.Preproc
|
| 609 |
+
else:
|
| 610 |
+
token = Comment.Multiline
|
| 611 |
+
elif scanner.scan(r'//.*?$'):
|
| 612 |
+
token = Comment.Single
|
| 613 |
+
elif scanner.scan(r"'"):
|
| 614 |
+
token = String
|
| 615 |
+
stack.append('string')
|
| 616 |
+
elif scanner.scan(r'@@[A-Za-z_][A-Za-z_0-9]*'):
|
| 617 |
+
token = Name.Label
|
| 618 |
+
elif scanner.scan(r'[A-Za-z_][A-Za-z_0-9]*'):
|
| 619 |
+
lowercase_name = scanner.match.lower()
|
| 620 |
+
if lowercase_name in self.ASM_INSTRUCTIONS:
|
| 621 |
+
token = Keyword
|
| 622 |
+
elif lowercase_name in self.ASM_REGISTERS:
|
| 623 |
+
token = Name.Builtin
|
| 624 |
+
else:
|
| 625 |
+
token = Name
|
| 626 |
+
elif scanner.scan(r'[-+*\/=<>:;,.@\^]+'):
|
| 627 |
+
token = Operator
|
| 628 |
+
elif scanner.scan(r'[\(\)\[\]]+'):
|
| 629 |
+
token = Punctuation
|
| 630 |
+
elif scanner.scan(r'\$[0-9A-Fa-f]+'):
|
| 631 |
+
token = Number.Hex
|
| 632 |
+
elif scanner.scan(r'\d+(?![eE]|\.[^.])'):
|
| 633 |
+
token = Number.Integer
|
| 634 |
+
elif scanner.scan(r'\d+(\.\d+([eE][+-]?\d+)?|[eE][+-]?\d+)'):
|
| 635 |
+
token = Number.Float
|
| 636 |
+
else:
|
| 637 |
+
scanner.get_char()
|
| 638 |
+
stack.pop()
|
| 639 |
+
|
| 640 |
+
# save the dot!!!11
|
| 641 |
+
if not self.is_portugol and scanner.match.strip():
|
| 642 |
+
was_dot = scanner.match == '.'
|
| 643 |
+
|
| 644 |
+
yield scanner.start_pos, token, scanner.match or ''
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/pawn.py
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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HORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from pygments.lexer import RegexLexer
|
| 12 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 13 |
+
Number, Punctuation
|
| 14 |
+
from pygments.util import get_bool_opt
|
| 15 |
+
|
| 16 |
+
__all__ = ['SourcePawnLexer', 'PawnLexer']
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
class SourcePawnLexer(RegexLexer):
|
| 20 |
+
"""
|
| 21 |
+
For SourcePawn source code with preprocessor directives.
|
| 22 |
+
"""
|
| 23 |
+
name = 'SourcePawn'
|
| 24 |
+
aliases = ['sp']
|
| 25 |
+
filenames = ['*.sp']
|
| 26 |
+
mimetypes = ['text/x-sourcepawn']
|
| 27 |
+
url = 'https://github.com/alliedmodders/sourcepawn'
|
| 28 |
+
version_added = '1.6'
|
| 29 |
+
|
| 30 |
+
#: optional Comment or Whitespace
|
| 31 |
+
_ws = r'(?:\s|//.*?\n|/\*.*?\*/)+'
|
| 32 |
+
#: only one /* */ style comment
|
| 33 |
+
_ws1 = r'\s*(?:/[*].*?[*]/\s*)*'
|
| 34 |
+
|
| 35 |
+
tokens = {
|
| 36 |
+
'root': [
|
| 37 |
+
# preprocessor directives: without whitespace
|
| 38 |
+
(r'^#if\s+0', Comment.Preproc, 'if0'),
|
| 39 |
+
('^#', Comment.Preproc, 'macro'),
|
| 40 |
+
# or with whitespace
|
| 41 |
+
('^' + _ws1 + r'#if\s+0', Comment.Preproc, 'if0'),
|
| 42 |
+
('^' + _ws1 + '#', Comment.Preproc, 'macro'),
|
| 43 |
+
(r'\n', Text),
|
| 44 |
+
(r'\s+', Text),
|
| 45 |
+
(r'\\\n', Text), # line continuation
|
| 46 |
+
(r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
| 47 |
+
(r'/(\\\n)?\*(.|\n)*?\*(\\\n)?/', Comment.Multiline),
|
| 48 |
+
(r'[{}]', Punctuation),
|
| 49 |
+
(r'L?"', String, 'string'),
|
| 50 |
+
(r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
|
| 51 |
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
|
| 52 |
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
| 53 |
+
(r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
|
| 54 |
+
(r'0[0-7]+[LlUu]*', Number.Oct),
|
| 55 |
+
(r'\d+[LlUu]*', Number.Integer),
|
| 56 |
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
| 57 |
+
(r'[()\[\],.;]', Punctuation),
|
| 58 |
+
(r'(case|const|continue|native|'
|
| 59 |
+
r'default|else|enum|for|if|new|operator|'
|
| 60 |
+
r'public|return|sizeof|static|decl|struct|switch)\b', Keyword),
|
| 61 |
+
(r'(bool|Float)\b', Keyword.Type),
|
| 62 |
+
(r'(true|false)\b', Keyword.Constant),
|
| 63 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 64 |
+
],
|
| 65 |
+
'string': [
|
| 66 |
+
(r'"', String, '#pop'),
|
| 67 |
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
| 68 |
+
(r'[^\\"\n]+', String), # all other characters
|
| 69 |
+
(r'\\\n', String), # line continuation
|
| 70 |
+
(r'\\', String), # stray backslash
|
| 71 |
+
],
|
| 72 |
+
'macro': [
|
| 73 |
+
(r'[^/\n]+', Comment.Preproc),
|
| 74 |
+
(r'/\*(.|\n)*?\*/', Comment.Multiline),
|
| 75 |
+
(r'//.*?\n', Comment.Single, '#pop'),
|
| 76 |
+
(r'/', Comment.Preproc),
|
| 77 |
+
(r'(?<=\\)\n', Comment.Preproc),
|
| 78 |
+
(r'\n', Comment.Preproc, '#pop'),
|
| 79 |
+
],
|
| 80 |
+
'if0': [
|
| 81 |
+
(r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
|
| 82 |
+
(r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
|
| 83 |
+
(r'.*?\n', Comment),
|
| 84 |
+
]
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
SM_TYPES = {'Action', 'bool', 'Float', 'Plugin', 'String', 'any',
|
| 88 |
+
'AdminFlag', 'OverrideType', 'OverrideRule', 'ImmunityType',
|
| 89 |
+
'GroupId', 'AdminId', 'AdmAccessMode', 'AdminCachePart',
|
| 90 |
+
'CookieAccess', 'CookieMenu', 'CookieMenuAction', 'NetFlow',
|
| 91 |
+
'ConVarBounds', 'QueryCookie', 'ReplySource',
|
| 92 |
+
'ConVarQueryResult', 'ConVarQueryFinished', 'Function',
|
| 93 |
+
'Action', 'Identity', 'PluginStatus', 'PluginInfo', 'DBResult',
|
| 94 |
+
'DBBindType', 'DBPriority', 'PropType', 'PropFieldType',
|
| 95 |
+
'MoveType', 'RenderMode', 'RenderFx', 'EventHookMode',
|
| 96 |
+
'EventHook', 'FileType', 'FileTimeMode', 'PathType',
|
| 97 |
+
'ParamType', 'ExecType', 'DialogType', 'Handle', 'KvDataTypes',
|
| 98 |
+
'NominateResult', 'MapChange', 'MenuStyle', 'MenuAction',
|
| 99 |
+
'MenuSource', 'RegexError', 'SDKCallType', 'SDKLibrary',
|
| 100 |
+
'SDKFuncConfSource', 'SDKType', 'SDKPassMethod', 'RayType',
|
| 101 |
+
'TraceEntityFilter', 'ListenOverride', 'SortOrder', 'SortType',
|
| 102 |
+
'SortFunc2D', 'APLRes', 'FeatureType', 'FeatureStatus',
|
| 103 |
+
'SMCResult', 'SMCError', 'TFClassType', 'TFTeam', 'TFCond',
|
| 104 |
+
'TFResourceType', 'Timer', 'TopMenuAction', 'TopMenuObjectType',
|
| 105 |
+
'TopMenuPosition', 'TopMenuObject', 'UserMsg'}
|
| 106 |
+
|
| 107 |
+
def __init__(self, **options):
|
| 108 |
+
self.smhighlighting = get_bool_opt(options,
|
| 109 |
+
'sourcemod', True)
|
| 110 |
+
|
| 111 |
+
self._functions = set()
|
| 112 |
+
if self.smhighlighting:
|
| 113 |
+
from pygments.lexers._sourcemod_builtins import FUNCTIONS
|
| 114 |
+
self._functions.update(FUNCTIONS)
|
| 115 |
+
RegexLexer.__init__(self, **options)
|
| 116 |
+
|
| 117 |
+
def get_tokens_unprocessed(self, text):
|
| 118 |
+
for index, token, value in \
|
| 119 |
+
RegexLexer.get_tokens_unprocessed(self, text):
|
| 120 |
+
if token is Name:
|
| 121 |
+
if self.smhighlighting:
|
| 122 |
+
if value in self.SM_TYPES:
|
| 123 |
+
token = Keyword.Type
|
| 124 |
+
elif value in self._functions:
|
| 125 |
+
token = Name.Builtin
|
| 126 |
+
yield index, token, value
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
class PawnLexer(RegexLexer):
|
| 130 |
+
"""
|
| 131 |
+
For Pawn source code.
|
| 132 |
+
"""
|
| 133 |
+
|
| 134 |
+
name = 'Pawn'
|
| 135 |
+
aliases = ['pawn']
|
| 136 |
+
filenames = ['*.p', '*.pwn', '*.inc']
|
| 137 |
+
mimetypes = ['text/x-pawn']
|
| 138 |
+
url = 'https://www.compuphase.com/pawn/pawn.htm'
|
| 139 |
+
version_added = '2.0'
|
| 140 |
+
|
| 141 |
+
#: optional Comment or Whitespace
|
| 142 |
+
_ws = r'(?:\s|//.*?\n|/[*][\w\W]*?[*]/)+'
|
| 143 |
+
#: only one /* */ style comment
|
| 144 |
+
_ws1 = r'\s*(?:/[*].*?[*]/\s*)*'
|
| 145 |
+
|
| 146 |
+
tokens = {
|
| 147 |
+
'root': [
|
| 148 |
+
# preprocessor directives: without whitespace
|
| 149 |
+
(r'^#if\s+0', Comment.Preproc, 'if0'),
|
| 150 |
+
('^#', Comment.Preproc, 'macro'),
|
| 151 |
+
# or with whitespace
|
| 152 |
+
('^' + _ws1 + r'#if\s+0', Comment.Preproc, 'if0'),
|
| 153 |
+
('^' + _ws1 + '#', Comment.Preproc, 'macro'),
|
| 154 |
+
(r'\n', Text),
|
| 155 |
+
(r'\s+', Text),
|
| 156 |
+
(r'\\\n', Text), # line continuation
|
| 157 |
+
(r'/(\\\n)?/(\n|(.|\n)*?[^\\]\n)', Comment.Single),
|
| 158 |
+
(r'/(\\\n)?\*[\w\W]*?\*(\\\n)?/', Comment.Multiline),
|
| 159 |
+
(r'[{}]', Punctuation),
|
| 160 |
+
(r'L?"', String, 'string'),
|
| 161 |
+
(r"L?'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'", String.Char),
|
| 162 |
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[LlUu]*', Number.Float),
|
| 163 |
+
(r'(\d+\.\d*|\.\d+|\d+[fF])[fF]?', Number.Float),
|
| 164 |
+
(r'0x[0-9a-fA-F]+[LlUu]*', Number.Hex),
|
| 165 |
+
(r'0[0-7]+[LlUu]*', Number.Oct),
|
| 166 |
+
(r'\d+[LlUu]*', Number.Integer),
|
| 167 |
+
(r'[~!%^&*+=|?:<>/-]', Operator),
|
| 168 |
+
(r'[()\[\],.;]', Punctuation),
|
| 169 |
+
(r'(switch|case|default|const|new|static|char|continue|break|'
|
| 170 |
+
r'if|else|for|while|do|operator|enum|'
|
| 171 |
+
r'public|return|sizeof|tagof|state|goto)\b', Keyword),
|
| 172 |
+
(r'(bool|Float)\b', Keyword.Type),
|
| 173 |
+
(r'(true|false)\b', Keyword.Constant),
|
| 174 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 175 |
+
],
|
| 176 |
+
'string': [
|
| 177 |
+
(r'"', String, '#pop'),
|
| 178 |
+
(r'\\([\\abfnrtv"\']|x[a-fA-F0-9]{2,4}|[0-7]{1,3})', String.Escape),
|
| 179 |
+
(r'[^\\"\n]+', String), # all other characters
|
| 180 |
+
(r'\\\n', String), # line continuation
|
| 181 |
+
(r'\\', String), # stray backslash
|
| 182 |
+
],
|
| 183 |
+
'macro': [
|
| 184 |
+
(r'[^/\n]+', Comment.Preproc),
|
| 185 |
+
(r'/\*(.|\n)*?\*/', Comment.Multiline),
|
| 186 |
+
(r'//.*?\n', Comment.Single, '#pop'),
|
| 187 |
+
(r'/', Comment.Preproc),
|
| 188 |
+
(r'(?<=\\)\n', Comment.Preproc),
|
| 189 |
+
(r'\n', Comment.Preproc, '#pop'),
|
| 190 |
+
],
|
| 191 |
+
'if0': [
|
| 192 |
+
(r'^\s*#if.*?(?<!\\)\n', Comment.Preproc, '#push'),
|
| 193 |
+
(r'^\s*#endif.*?(?<!\\)\n', Comment.Preproc, '#pop'),
|
| 194 |
+
(r'.*?\n', Comment),
|
| 195 |
+
]
|
| 196 |
+
}
|
| 197 |
+
|
| 198 |
+
def analyse_text(text):
|
| 199 |
+
"""This is basically C. There is a keyword which doesn't exist in C
|
| 200 |
+
though and is nearly unique to this language."""
|
| 201 |
+
if 'tagof' in text:
|
| 202 |
+
return 0.01
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/pddl.py
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.pddl
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for the Planning Domain Definition Language.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
from pygments.lexer import RegexLexer, words, include
|
| 13 |
+
from pygments.token import Punctuation, Keyword, Whitespace, Name, Comment, \
|
| 14 |
+
Operator, Number
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
__all__ = ['PddlLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class PddlLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
A PDDL lexer.
|
| 23 |
+
|
| 24 |
+
It should support up to PDDL 3.1.
|
| 25 |
+
"""
|
| 26 |
+
|
| 27 |
+
name = 'PDDL'
|
| 28 |
+
aliases = ['pddl']
|
| 29 |
+
filenames = ['*.pddl']
|
| 30 |
+
# there doesn't really seem to be a PDDL homepage.
|
| 31 |
+
url = 'https://en.wikipedia.org/wiki/Planning_Domain_Definition_Language'
|
| 32 |
+
version_added = '2.19'
|
| 33 |
+
|
| 34 |
+
tokens = {
|
| 35 |
+
'root': [
|
| 36 |
+
(r'\s+', Whitespace),
|
| 37 |
+
(r';.*$', Comment.Singleline),
|
| 38 |
+
include('keywords'),
|
| 39 |
+
include('builtins'),
|
| 40 |
+
(r'[()]', Punctuation),
|
| 41 |
+
(r'[=/*+><-]', Operator),
|
| 42 |
+
(r'[a-zA-Z][a-zA-Z0-9_-]*', Name),
|
| 43 |
+
(r'\?[a-zA-Z][a-zA-Z0-9_-]*', Name.Variable),
|
| 44 |
+
(r'[0-9]+\.[0-9]+', Number.Float),
|
| 45 |
+
(r'[0-9]+', Number.Integer),
|
| 46 |
+
],
|
| 47 |
+
'keywords': [
|
| 48 |
+
(words((
|
| 49 |
+
':requirements', ':types', ':constants',
|
| 50 |
+
':predicates', ':functions', ':action', ':agent',
|
| 51 |
+
':parameters', ':precondition', ':effect',
|
| 52 |
+
':durative-action', ':duration', ':condition',
|
| 53 |
+
':derived', ':domain', ':objects', ':init',
|
| 54 |
+
':goal', ':metric', ':length', ':serial', ':parallel',
|
| 55 |
+
# the following are requirements
|
| 56 |
+
':strips', ':typing', ':negative-preconditions',
|
| 57 |
+
':disjunctive-preconditions', ':equality',
|
| 58 |
+
':existential-preconditions', ':universal-preconditions',
|
| 59 |
+
':conditional-effects', ':fluents', ':numeric-fluents',
|
| 60 |
+
':object-fluents', ':adl', ':durative-actions',
|
| 61 |
+
':continuous-effects', ':derived-predicates',
|
| 62 |
+
':time-intial-literals', ':preferences',
|
| 63 |
+
':constraints', ':action-costs', ':multi-agent',
|
| 64 |
+
':unfactored-privacy', ':factored-privacy',
|
| 65 |
+
':non-deterministic'
|
| 66 |
+
), suffix=r'\b'), Keyword)
|
| 67 |
+
],
|
| 68 |
+
'builtins': [
|
| 69 |
+
(words((
|
| 70 |
+
'define', 'domain', 'object', 'either', 'and',
|
| 71 |
+
'forall', 'preference', 'imply', 'or', 'exists',
|
| 72 |
+
'not', 'when', 'assign', 'scale-up', 'scale-down',
|
| 73 |
+
'increase', 'decrease', 'at', 'over', 'start',
|
| 74 |
+
'end', 'all', 'problem', 'always', 'sometime',
|
| 75 |
+
'within', 'at-most-once', 'sometime-after',
|
| 76 |
+
'sometime-before', 'always-within', 'hold-during',
|
| 77 |
+
'hold-after', 'minimize', 'maximize',
|
| 78 |
+
'total-time', 'is-violated'), suffix=r'\b'),
|
| 79 |
+
Name.Builtin)
|
| 80 |
+
]
|
| 81 |
+
}
|
| 82 |
+
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/perl.py
ADDED
|
@@ -0,0 +1,733 @@
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.perl
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for Perl, Raku and related languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import RegexLexer, ExtendedRegexLexer, include, bygroups, \
|
| 14 |
+
using, this, default, words
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation, Whitespace
|
| 17 |
+
from pygments.util import shebang_matches
|
| 18 |
+
|
| 19 |
+
__all__ = ['PerlLexer', 'Perl6Lexer']
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class PerlLexer(RegexLexer):
|
| 23 |
+
"""
|
| 24 |
+
For Perl source code.
|
| 25 |
+
"""
|
| 26 |
+
|
| 27 |
+
name = 'Perl'
|
| 28 |
+
url = 'https://www.perl.org'
|
| 29 |
+
aliases = ['perl', 'pl']
|
| 30 |
+
filenames = ['*.pl', '*.pm', '*.t', '*.perl']
|
| 31 |
+
mimetypes = ['text/x-perl', 'application/x-perl']
|
| 32 |
+
version_added = ''
|
| 33 |
+
|
| 34 |
+
flags = re.DOTALL | re.MULTILINE
|
| 35 |
+
# TODO: give this to a perl guy who knows how to parse perl...
|
| 36 |
+
tokens = {
|
| 37 |
+
'balanced-regex': [
|
| 38 |
+
(r'/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*', String.Regex, '#pop'),
|
| 39 |
+
(r'!(\\\\|\\[^\\]|[^\\!])*![egimosx]*', String.Regex, '#pop'),
|
| 40 |
+
(r'\\(\\\\|[^\\])*\\[egimosx]*', String.Regex, '#pop'),
|
| 41 |
+
(r'\{(\\\\|\\[^\\]|[^\\}])*\}[egimosx]*', String.Regex, '#pop'),
|
| 42 |
+
(r'<(\\\\|\\[^\\]|[^\\>])*>[egimosx]*', String.Regex, '#pop'),
|
| 43 |
+
(r'\[(\\\\|\\[^\\]|[^\\\]])*\][egimosx]*', String.Regex, '#pop'),
|
| 44 |
+
(r'\((\\\\|\\[^\\]|[^\\)])*\)[egimosx]*', String.Regex, '#pop'),
|
| 45 |
+
(r'@(\\\\|\\[^\\]|[^\\@])*@[egimosx]*', String.Regex, '#pop'),
|
| 46 |
+
(r'%(\\\\|\\[^\\]|[^\\%])*%[egimosx]*', String.Regex, '#pop'),
|
| 47 |
+
(r'\$(\\\\|\\[^\\]|[^\\$])*\$[egimosx]*', String.Regex, '#pop'),
|
| 48 |
+
],
|
| 49 |
+
'root': [
|
| 50 |
+
(r'\A\#!.+?$', Comment.Hashbang),
|
| 51 |
+
(r'\#.*?$', Comment.Single),
|
| 52 |
+
(r'^=[a-zA-Z0-9]+\s+.*?\n=cut', Comment.Multiline),
|
| 53 |
+
(words((
|
| 54 |
+
'case', 'continue', 'do', 'else', 'elsif', 'for', 'foreach',
|
| 55 |
+
'if', 'last', 'my', 'next', 'our', 'redo', 'reset', 'then',
|
| 56 |
+
'unless', 'until', 'while', 'print', 'new', 'BEGIN',
|
| 57 |
+
'CHECK', 'INIT', 'END', 'return'), suffix=r'\b'),
|
| 58 |
+
Keyword),
|
| 59 |
+
(r'(format)(\s+)(\w+)(\s*)(=)(\s*\n)',
|
| 60 |
+
bygroups(Keyword, Whitespace, Name, Whitespace, Punctuation, Whitespace), 'format'),
|
| 61 |
+
(r'(eq|lt|gt|le|ge|ne|not|and|or|cmp)\b', Operator.Word),
|
| 62 |
+
# common delimiters
|
| 63 |
+
(r's/(\\\\|\\[^\\]|[^\\/])*/(\\\\|\\[^\\]|[^\\/])*/[egimosx]*',
|
| 64 |
+
String.Regex),
|
| 65 |
+
(r's!(\\\\|\\!|[^!])*!(\\\\|\\!|[^!])*![egimosx]*', String.Regex),
|
| 66 |
+
(r's\\(\\\\|[^\\])*\\(\\\\|[^\\])*\\[egimosx]*', String.Regex),
|
| 67 |
+
(r's@(\\\\|\\[^\\]|[^\\@])*@(\\\\|\\[^\\]|[^\\@])*@[egimosx]*',
|
| 68 |
+
String.Regex),
|
| 69 |
+
(r's%(\\\\|\\[^\\]|[^\\%])*%(\\\\|\\[^\\]|[^\\%])*%[egimosx]*',
|
| 70 |
+
String.Regex),
|
| 71 |
+
# balanced delimiters
|
| 72 |
+
(r's\{(\\\\|\\[^\\]|[^\\}])*\}\s*', String.Regex, 'balanced-regex'),
|
| 73 |
+
(r's<(\\\\|\\[^\\]|[^\\>])*>\s*', String.Regex, 'balanced-regex'),
|
| 74 |
+
(r's\[(\\\\|\\[^\\]|[^\\\]])*\]\s*', String.Regex,
|
| 75 |
+
'balanced-regex'),
|
| 76 |
+
(r's\((\\\\|\\[^\\]|[^\\)])*\)\s*', String.Regex,
|
| 77 |
+
'balanced-regex'),
|
| 78 |
+
|
| 79 |
+
(r'm?/(\\\\|\\[^\\]|[^\\/\n])*/[gcimosx]*', String.Regex),
|
| 80 |
+
(r'm(?=[/!\\{<\[(@%$])', String.Regex, 'balanced-regex'),
|
| 81 |
+
(r'((?<==~)|(?<=\())\s*/(\\\\|\\[^\\]|[^\\/])*/[gcimosx]*',
|
| 82 |
+
String.Regex),
|
| 83 |
+
(r'\s+', Whitespace),
|
| 84 |
+
(words((
|
| 85 |
+
'abs', 'accept', 'alarm', 'atan2', 'bind', 'binmode', 'bless', 'caller', 'chdir',
|
| 86 |
+
'chmod', 'chomp', 'chop', 'chown', 'chr', 'chroot', 'close', 'closedir', 'connect',
|
| 87 |
+
'continue', 'cos', 'crypt', 'dbmclose', 'dbmopen', 'defined', 'delete', 'die',
|
| 88 |
+
'dump', 'each', 'endgrent', 'endhostent', 'endnetent', 'endprotoent',
|
| 89 |
+
'endpwent', 'endservent', 'eof', 'eval', 'exec', 'exists', 'exit', 'exp', 'fcntl',
|
| 90 |
+
'fileno', 'flock', 'fork', 'format', 'formline', 'getc', 'getgrent', 'getgrgid',
|
| 91 |
+
'getgrnam', 'gethostbyaddr', 'gethostbyname', 'gethostent', 'getlogin',
|
| 92 |
+
'getnetbyaddr', 'getnetbyname', 'getnetent', 'getpeername', 'getpgrp',
|
| 93 |
+
'getppid', 'getpriority', 'getprotobyname', 'getprotobynumber',
|
| 94 |
+
'getprotoent', 'getpwent', 'getpwnam', 'getpwuid', 'getservbyname',
|
| 95 |
+
'getservbyport', 'getservent', 'getsockname', 'getsockopt', 'glob', 'gmtime',
|
| 96 |
+
'goto', 'grep', 'hex', 'import', 'index', 'int', 'ioctl', 'join', 'keys', 'kill', 'last',
|
| 97 |
+
'lc', 'lcfirst', 'length', 'link', 'listen', 'local', 'localtime', 'log', 'lstat',
|
| 98 |
+
'map', 'mkdir', 'msgctl', 'msgget', 'msgrcv', 'msgsnd', 'my', 'next', 'oct', 'open',
|
| 99 |
+
'opendir', 'ord', 'our', 'pack', 'pipe', 'pop', 'pos', 'printf',
|
| 100 |
+
'prototype', 'push', 'quotemeta', 'rand', 'read', 'readdir',
|
| 101 |
+
'readline', 'readlink', 'readpipe', 'recv', 'redo', 'ref', 'rename',
|
| 102 |
+
'reverse', 'rewinddir', 'rindex', 'rmdir', 'scalar', 'seek', 'seekdir',
|
| 103 |
+
'select', 'semctl', 'semget', 'semop', 'send', 'setgrent', 'sethostent', 'setnetent',
|
| 104 |
+
'setpgrp', 'setpriority', 'setprotoent', 'setpwent', 'setservent',
|
| 105 |
+
'setsockopt', 'shift', 'shmctl', 'shmget', 'shmread', 'shmwrite', 'shutdown',
|
| 106 |
+
'sin', 'sleep', 'socket', 'socketpair', 'sort', 'splice', 'split', 'sprintf', 'sqrt',
|
| 107 |
+
'srand', 'stat', 'study', 'substr', 'symlink', 'syscall', 'sysopen', 'sysread',
|
| 108 |
+
'sysseek', 'system', 'syswrite', 'tell', 'telldir', 'tie', 'tied', 'time', 'times', 'tr',
|
| 109 |
+
'truncate', 'uc', 'ucfirst', 'umask', 'undef', 'unlink', 'unpack', 'unshift', 'untie',
|
| 110 |
+
'utime', 'values', 'vec', 'wait', 'waitpid', 'wantarray', 'warn', 'write'), suffix=r'\b'),
|
| 111 |
+
Name.Builtin),
|
| 112 |
+
(r'((__(DATA|DIE|WARN)__)|(STD(IN|OUT|ERR)))\b', Name.Builtin.Pseudo),
|
| 113 |
+
(r'(<<)([\'"]?)([a-zA-Z_]\w*)(\2;?\n.*?\n)(\3)(\n)',
|
| 114 |
+
bygroups(String, String, String.Delimiter, String, String.Delimiter, Whitespace)),
|
| 115 |
+
(r'__END__', Comment.Preproc, 'end-part'),
|
| 116 |
+
(r'\$\^[ADEFHILMOPSTWX]', Name.Variable.Global),
|
| 117 |
+
(r"\$[\\\"\[\]'&`+*.,;=%~?@$!<>(^|/-](?!\w)", Name.Variable.Global),
|
| 118 |
+
(r'[$@%#]+', Name.Variable, 'varname'),
|
| 119 |
+
(r'0_?[0-7]+(_[0-7]+)*', Number.Oct),
|
| 120 |
+
(r'0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*', Number.Hex),
|
| 121 |
+
(r'0b[01]+(_[01]+)*', Number.Bin),
|
| 122 |
+
(r'(?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?',
|
| 123 |
+
Number.Float),
|
| 124 |
+
(r'(?i)\d+(_\d*)*e[+-]?\d+(_\d*)*', Number.Float),
|
| 125 |
+
(r'\d+(_\d+)*', Number.Integer),
|
| 126 |
+
(r"'(\\\\|\\[^\\]|[^'\\])*'", String),
|
| 127 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String),
|
| 128 |
+
(r'`(\\\\|\\[^\\]|[^`\\])*`', String.Backtick),
|
| 129 |
+
(r'<([^\s>]+)>', String.Regex),
|
| 130 |
+
(r'(q|qq|qw|qr|qx)\{', String.Other, 'cb-string'),
|
| 131 |
+
(r'(q|qq|qw|qr|qx)\(', String.Other, 'rb-string'),
|
| 132 |
+
(r'(q|qq|qw|qr|qx)\[', String.Other, 'sb-string'),
|
| 133 |
+
(r'(q|qq|qw|qr|qx)\<', String.Other, 'lt-string'),
|
| 134 |
+
(r'(q|qq|qw|qr|qx)([\W_])(.|\n)*?\2', String.Other),
|
| 135 |
+
(r'(package)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)',
|
| 136 |
+
bygroups(Keyword, Whitespace, Name.Namespace)),
|
| 137 |
+
(r'(use|require|no)(\s+)([a-zA-Z_]\w*(?:::[a-zA-Z_]\w*)*)',
|
| 138 |
+
bygroups(Keyword, Whitespace, Name.Namespace)),
|
| 139 |
+
(r'(sub)(\s+)', bygroups(Keyword, Whitespace), 'funcname'),
|
| 140 |
+
(words((
|
| 141 |
+
'no', 'package', 'require', 'use'), suffix=r'\b'),
|
| 142 |
+
Keyword),
|
| 143 |
+
(r'(\[\]|\*\*|::|<<|>>|>=|<=>|<=|={3}|!=|=~|'
|
| 144 |
+
r'!~|&&?|\|\||\.{1,3})', Operator),
|
| 145 |
+
(r'[-+/*%=<>&^|!\\~]=?', Operator),
|
| 146 |
+
(r'[()\[\]:;,<>/?{}]', Punctuation), # yes, there's no shortage
|
| 147 |
+
# of punctuation in Perl!
|
| 148 |
+
(r'(?=\w)', Name, 'name'),
|
| 149 |
+
],
|
| 150 |
+
'format': [
|
| 151 |
+
(r'\.\n', String.Interpol, '#pop'),
|
| 152 |
+
(r'[^\n]*\n', String.Interpol),
|
| 153 |
+
],
|
| 154 |
+
'varname': [
|
| 155 |
+
(r'\s+', Whitespace),
|
| 156 |
+
(r'\{', Punctuation, '#pop'), # hash syntax?
|
| 157 |
+
(r'\)|,', Punctuation, '#pop'), # argument specifier
|
| 158 |
+
(r'\w+::', Name.Namespace),
|
| 159 |
+
(r'[\w:]+', Name.Variable, '#pop'),
|
| 160 |
+
],
|
| 161 |
+
'name': [
|
| 162 |
+
(r'[a-zA-Z_]\w*(::[a-zA-Z_]\w*)*(::)?(?=\s*->)', Name.Namespace, '#pop'),
|
| 163 |
+
(r'[a-zA-Z_]\w*(::[a-zA-Z_]\w*)*::', Name.Namespace, '#pop'),
|
| 164 |
+
(r'[\w:]+', Name, '#pop'),
|
| 165 |
+
(r'[A-Z_]+(?=\W)', Name.Constant, '#pop'),
|
| 166 |
+
(r'(?=\W)', Text, '#pop'),
|
| 167 |
+
],
|
| 168 |
+
'funcname': [
|
| 169 |
+
(r'[a-zA-Z_]\w*[!?]?', Name.Function),
|
| 170 |
+
(r'\s+', Whitespace),
|
| 171 |
+
# argument declaration
|
| 172 |
+
(r'(\([$@%]*\))(\s*)', bygroups(Punctuation, Whitespace)),
|
| 173 |
+
(r';', Punctuation, '#pop'),
|
| 174 |
+
(r'.*?\{', Punctuation, '#pop'),
|
| 175 |
+
],
|
| 176 |
+
'cb-string': [
|
| 177 |
+
(r'\\[{}\\]', String.Other),
|
| 178 |
+
(r'\\', String.Other),
|
| 179 |
+
(r'\{', String.Other, 'cb-string'),
|
| 180 |
+
(r'\}', String.Other, '#pop'),
|
| 181 |
+
(r'[^{}\\]+', String.Other)
|
| 182 |
+
],
|
| 183 |
+
'rb-string': [
|
| 184 |
+
(r'\\[()\\]', String.Other),
|
| 185 |
+
(r'\\', String.Other),
|
| 186 |
+
(r'\(', String.Other, 'rb-string'),
|
| 187 |
+
(r'\)', String.Other, '#pop'),
|
| 188 |
+
(r'[^()]+', String.Other)
|
| 189 |
+
],
|
| 190 |
+
'sb-string': [
|
| 191 |
+
(r'\\[\[\]\\]', String.Other),
|
| 192 |
+
(r'\\', String.Other),
|
| 193 |
+
(r'\[', String.Other, 'sb-string'),
|
| 194 |
+
(r'\]', String.Other, '#pop'),
|
| 195 |
+
(r'[^\[\]]+', String.Other)
|
| 196 |
+
],
|
| 197 |
+
'lt-string': [
|
| 198 |
+
(r'\\[<>\\]', String.Other),
|
| 199 |
+
(r'\\', String.Other),
|
| 200 |
+
(r'\<', String.Other, 'lt-string'),
|
| 201 |
+
(r'\>', String.Other, '#pop'),
|
| 202 |
+
(r'[^<>]+', String.Other)
|
| 203 |
+
],
|
| 204 |
+
'end-part': [
|
| 205 |
+
(r'.+', Comment.Preproc, '#pop')
|
| 206 |
+
]
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
def analyse_text(text):
|
| 210 |
+
if shebang_matches(text, r'perl'):
|
| 211 |
+
return True
|
| 212 |
+
|
| 213 |
+
result = 0
|
| 214 |
+
|
| 215 |
+
if re.search(r'(?:my|our)\s+[$@%(]', text):
|
| 216 |
+
result += 0.9
|
| 217 |
+
|
| 218 |
+
if ':=' in text:
|
| 219 |
+
# := is not valid Perl, but it appears in unicon, so we should
|
| 220 |
+
# become less confident if we think we found Perl with :=
|
| 221 |
+
result /= 2
|
| 222 |
+
|
| 223 |
+
return result
|
| 224 |
+
|
| 225 |
+
|
| 226 |
+
class Perl6Lexer(ExtendedRegexLexer):
|
| 227 |
+
"""
|
| 228 |
+
For Raku (a.k.a. Perl 6) source code.
|
| 229 |
+
"""
|
| 230 |
+
|
| 231 |
+
name = 'Perl6'
|
| 232 |
+
url = 'https://www.raku.org'
|
| 233 |
+
aliases = ['perl6', 'pl6', 'raku']
|
| 234 |
+
filenames = ['*.pl', '*.pm', '*.nqp', '*.p6', '*.6pl', '*.p6l', '*.pl6',
|
| 235 |
+
'*.6pm', '*.p6m', '*.pm6', '*.t', '*.raku', '*.rakumod',
|
| 236 |
+
'*.rakutest', '*.rakudoc']
|
| 237 |
+
mimetypes = ['text/x-perl6', 'application/x-perl6']
|
| 238 |
+
version_added = '2.0'
|
| 239 |
+
flags = re.MULTILINE | re.DOTALL
|
| 240 |
+
|
| 241 |
+
PERL6_IDENTIFIER_RANGE = r"['\w:-]"
|
| 242 |
+
|
| 243 |
+
PERL6_KEYWORDS = (
|
| 244 |
+
#Phasers
|
| 245 |
+
'BEGIN','CATCH','CHECK','CLOSE','CONTROL','DOC','END','ENTER','FIRST',
|
| 246 |
+
'INIT','KEEP','LAST','LEAVE','NEXT','POST','PRE','QUIT','UNDO',
|
| 247 |
+
#Keywords
|
| 248 |
+
'anon','augment','but','class','constant','default','does','else',
|
| 249 |
+
'elsif','enum','for','gather','given','grammar','has','if','import',
|
| 250 |
+
'is','let','loop','made','make','method','module','multi','my','need',
|
| 251 |
+
'orwith','our','proceed','proto','repeat','require','return',
|
| 252 |
+
'return-rw','returns','role','rule','state','sub','submethod','subset',
|
| 253 |
+
'succeed','supersede','token','try','unit','unless','until','use',
|
| 254 |
+
'when','while','with','without',
|
| 255 |
+
#Traits
|
| 256 |
+
'export','native','repr','required','rw','symbol',
|
| 257 |
+
)
|
| 258 |
+
|
| 259 |
+
PERL6_BUILTINS = (
|
| 260 |
+
'ACCEPTS','abs','abs2rel','absolute','accept','accessed','acos',
|
| 261 |
+
'acosec','acosech','acosh','acotan','acotanh','acquire','act','action',
|
| 262 |
+
'actions','add','add_attribute','add_enum_value','add_fallback',
|
| 263 |
+
'add_method','add_parent','add_private_method','add_role','add_trustee',
|
| 264 |
+
'adverb','after','all','allocate','allof','allowed','alternative-names',
|
| 265 |
+
'annotations','antipair','antipairs','any','anyof','app_lifetime',
|
| 266 |
+
'append','arch','archname','args','arity','Array','asec','asech','asin',
|
| 267 |
+
'asinh','ASSIGN-KEY','ASSIGN-POS','assuming','ast','at','atan','atan2',
|
| 268 |
+
'atanh','AT-KEY','atomic-assign','atomic-dec-fetch','atomic-fetch',
|
| 269 |
+
'atomic-fetch-add','atomic-fetch-dec','atomic-fetch-inc',
|
| 270 |
+
'atomic-fetch-sub','atomic-inc-fetch','AT-POS','attributes','auth',
|
| 271 |
+
'await','backtrace','Bag','BagHash','bail-out','base','basename',
|
| 272 |
+
'base-repeating','batch','BIND-KEY','BIND-POS','bind-stderr',
|
| 273 |
+
'bind-stdin','bind-stdout','bind-udp','bits','bless','block','Bool',
|
| 274 |
+
'bool-only','bounds','break','Bridge','broken','BUILD','build-date',
|
| 275 |
+
'bytes','cache','callframe','calling-package','CALL-ME','callsame',
|
| 276 |
+
'callwith','can','cancel','candidates','cando','can-ok','canonpath',
|
| 277 |
+
'caps','caption','Capture','cas','catdir','categorize','categorize-list',
|
| 278 |
+
'catfile','catpath','cause','ceiling','cglobal','changed','Channel',
|
| 279 |
+
'chars','chdir','child','child-name','child-typename','chmod','chomp',
|
| 280 |
+
'chop','chr','chrs','chunks','cis','classify','classify-list','cleanup',
|
| 281 |
+
'clone','close','closed','close-stdin','cmp-ok','code','codes','collate',
|
| 282 |
+
'column','comb','combinations','command','comment','compiler','Complex',
|
| 283 |
+
'compose','compose_type','composer','condition','config',
|
| 284 |
+
'configure_destroy','configure_type_checking','conj','connect',
|
| 285 |
+
'constraints','construct','contains','contents','copy','cos','cosec',
|
| 286 |
+
'cosech','cosh','cotan','cotanh','count','count-only','cpu-cores',
|
| 287 |
+
'cpu-usage','CREATE','create_type','cross','cue','curdir','curupdir','d',
|
| 288 |
+
'Date','DateTime','day','daycount','day-of-month','day-of-week',
|
| 289 |
+
'day-of-year','days-in-month','declaration','decode','decoder','deepmap',
|
| 290 |
+
'default','defined','DEFINITE','delayed','DELETE-KEY','DELETE-POS',
|
| 291 |
+
'denominator','desc','DESTROY','destroyers','devnull','diag',
|
| 292 |
+
'did-you-mean','die','dies-ok','dir','dirname','dir-sep','DISTROnames',
|
| 293 |
+
'do','does','does-ok','done','done-testing','duckmap','dynamic','e',
|
| 294 |
+
'eager','earlier','elems','emit','enclosing','encode','encoder',
|
| 295 |
+
'encoding','end','ends-with','enum_from_value','enum_value_list',
|
| 296 |
+
'enum_values','enums','eof','EVAL','eval-dies-ok','EVALFILE',
|
| 297 |
+
'eval-lives-ok','exception','excludes-max','excludes-min','EXISTS-KEY',
|
| 298 |
+
'EXISTS-POS','exit','exitcode','exp','expected','explicitly-manage',
|
| 299 |
+
'expmod','extension','f','fail','fails-like','fc','feature','file',
|
| 300 |
+
'filename','find_method','find_method_qualified','finish','first','flat',
|
| 301 |
+
'flatmap','flip','floor','flunk','flush','fmt','format','formatter',
|
| 302 |
+
'freeze','from','from-list','from-loop','from-posix','full',
|
| 303 |
+
'full-barrier','get','get_value','getc','gist','got','grab','grabpairs',
|
| 304 |
+
'grep','handle','handled','handles','hardware','has_accessor','Hash',
|
| 305 |
+
'head','headers','hh-mm-ss','hidden','hides','hour','how','hyper','id',
|
| 306 |
+
'illegal','im','in','indent','index','indices','indir','infinite',
|
| 307 |
+
'infix','infix:<+>','infix:<->','install_method_cache','Instant',
|
| 308 |
+
'instead','Int','int-bounds','interval','in-timezone','invalid-str',
|
| 309 |
+
'invert','invocant','IO','IO::Notification.watch-path','is_trusted',
|
| 310 |
+
'is_type','isa','is-absolute','isa-ok','is-approx','is-deeply',
|
| 311 |
+
'is-hidden','is-initial-thread','is-int','is-lazy','is-leap-year',
|
| 312 |
+
'isNaN','isnt','is-prime','is-relative','is-routine','is-setting',
|
| 313 |
+
'is-win','item','iterator','join','keep','kept','KERNELnames','key',
|
| 314 |
+
'keyof','keys','kill','kv','kxxv','l','lang','last','lastcall','later',
|
| 315 |
+
'lazy','lc','leading','level','like','line','lines','link','List',
|
| 316 |
+
'listen','live','lives-ok','local','lock','log','log10','lookup','lsb',
|
| 317 |
+
'made','MAIN','make','Map','match','max','maxpairs','merge','message',
|
| 318 |
+
'method','method_table','methods','migrate','min','minmax','minpairs',
|
| 319 |
+
'minute','misplaced','Mix','MixHash','mkdir','mode','modified','month',
|
| 320 |
+
'move','mro','msb','multi','multiness','my','name','named','named_names',
|
| 321 |
+
'narrow','nativecast','native-descriptor','nativesizeof','new','new_type',
|
| 322 |
+
'new-from-daycount','new-from-pairs','next','nextcallee','next-handle',
|
| 323 |
+
'nextsame','nextwith','NFC','NFD','NFKC','NFKD','nl-in','nl-out',
|
| 324 |
+
'nodemap','nok','none','norm','not','note','now','nude','Num',
|
| 325 |
+
'numerator','Numeric','of','offset','offset-in-hours','offset-in-minutes',
|
| 326 |
+
'ok','old','on-close','one','on-switch','open','opened','operation',
|
| 327 |
+
'optional','ord','ords','orig','os-error','osname','out-buffer','pack',
|
| 328 |
+
'package','package-kind','package-name','packages','pair','pairs',
|
| 329 |
+
'pairup','parameter','params','parent','parent-name','parents','parse',
|
| 330 |
+
'parse-base','parsefile','parse-names','parts','pass','path','path-sep',
|
| 331 |
+
'payload','peer-host','peer-port','periods','perl','permutations','phaser',
|
| 332 |
+
'pick','pickpairs','pid','placeholder','plan','plus','polar','poll',
|
| 333 |
+
'polymod','pop','pos','positional','posix','postfix','postmatch',
|
| 334 |
+
'precomp-ext','precomp-target','pred','prefix','prematch','prepend',
|
| 335 |
+
'print','printf','print-nl','print-to','private','private_method_table',
|
| 336 |
+
'proc','produce','Promise','prompt','protect','pull-one','push',
|
| 337 |
+
'push-all','push-at-least','push-exactly','push-until-lazy','put',
|
| 338 |
+
'qualifier-type','quit','r','race','radix','rand','range','Rat','raw',
|
| 339 |
+
're','read','readchars','readonly','ready','Real','reallocate','reals',
|
| 340 |
+
'reason','rebless','receive','recv','redispatcher','redo','reduce',
|
| 341 |
+
'rel2abs','relative','release','rename','repeated','replacement',
|
| 342 |
+
'report','reserved','resolve','restore','result','resume','rethrow',
|
| 343 |
+
'reverse','right','rindex','rmdir','role','roles_to_compose','rolish',
|
| 344 |
+
'roll','rootdir','roots','rotate','rotor','round','roundrobin',
|
| 345 |
+
'routine-type','run','rwx','s','samecase','samemark','samewith','say',
|
| 346 |
+
'schedule-on','scheduler','scope','sec','sech','second','seek','self',
|
| 347 |
+
'send','Set','set_hidden','set_name','set_package','set_rw','set_value',
|
| 348 |
+
'SetHash','set-instruments','setup_finalization','shape','share','shell',
|
| 349 |
+
'shift','sibling','sigil','sign','signal','signals','signature','sin',
|
| 350 |
+
'sinh','sink','sink-all','skip','skip-at-least','skip-at-least-pull-one',
|
| 351 |
+
'skip-one','skip-rest','sleep','sleep-timer','sleep-until','Slip','slurp',
|
| 352 |
+
'slurp-rest','slurpy','snap','snapper','so','socket-host','socket-port',
|
| 353 |
+
'sort','source','source-package','spawn','SPEC','splice','split',
|
| 354 |
+
'splitdir','splitpath','sprintf','spurt','sqrt','squish','srand','stable',
|
| 355 |
+
'start','started','starts-with','status','stderr','stdout','Str',
|
| 356 |
+
'sub_signature','subbuf','subbuf-rw','subname','subparse','subst',
|
| 357 |
+
'subst-mutate','substr','substr-eq','substr-rw','subtest','succ','sum',
|
| 358 |
+
'Supply','symlink','t','tail','take','take-rw','tan','tanh','tap',
|
| 359 |
+
'target','target-name','tc','tclc','tell','then','throttle','throw',
|
| 360 |
+
'throws-like','timezone','tmpdir','to','today','todo','toggle','to-posix',
|
| 361 |
+
'total','trailing','trans','tree','trim','trim-leading','trim-trailing',
|
| 362 |
+
'truncate','truncated-to','trusts','try_acquire','trying','twigil','type',
|
| 363 |
+
'type_captures','typename','uc','udp','uncaught_handler','unimatch',
|
| 364 |
+
'uniname','uninames','uniparse','uniprop','uniprops','unique','unival',
|
| 365 |
+
'univals','unlike','unlink','unlock','unpack','unpolar','unshift',
|
| 366 |
+
'unwrap','updir','USAGE','use-ok','utc','val','value','values','VAR',
|
| 367 |
+
'variable','verbose-config','version','VMnames','volume','vow','w','wait',
|
| 368 |
+
'warn','watch','watch-path','week','weekday-of-month','week-number',
|
| 369 |
+
'week-year','WHAT','when','WHERE','WHEREFORE','WHICH','WHO',
|
| 370 |
+
'whole-second','WHY','wordcase','words','workaround','wrap','write',
|
| 371 |
+
'write-to','x','yada','year','yield','yyyy-mm-dd','z','zip','zip-latest',
|
| 372 |
+
|
| 373 |
+
)
|
| 374 |
+
|
| 375 |
+
PERL6_BUILTIN_CLASSES = (
|
| 376 |
+
#Booleans
|
| 377 |
+
'False','True',
|
| 378 |
+
#Classes
|
| 379 |
+
'Any','Array','Associative','AST','atomicint','Attribute','Backtrace',
|
| 380 |
+
'Backtrace::Frame','Bag','Baggy','BagHash','Blob','Block','Bool','Buf',
|
| 381 |
+
'Callable','CallFrame','Cancellation','Capture','CArray','Channel','Code',
|
| 382 |
+
'compiler','Complex','ComplexStr','Cool','CurrentThreadScheduler',
|
| 383 |
+
'Cursor','Date','Dateish','DateTime','Distro','Duration','Encoding',
|
| 384 |
+
'Exception','Failure','FatRat','Grammar','Hash','HyperWhatever','Instant',
|
| 385 |
+
'Int','int16','int32','int64','int8','IntStr','IO','IO::ArgFiles',
|
| 386 |
+
'IO::CatHandle','IO::Handle','IO::Notification','IO::Path',
|
| 387 |
+
'IO::Path::Cygwin','IO::Path::QNX','IO::Path::Unix','IO::Path::Win32',
|
| 388 |
+
'IO::Pipe','IO::Socket','IO::Socket::Async','IO::Socket::INET','IO::Spec',
|
| 389 |
+
'IO::Spec::Cygwin','IO::Spec::QNX','IO::Spec::Unix','IO::Spec::Win32',
|
| 390 |
+
'IO::Special','Iterable','Iterator','Junction','Kernel','Label','List',
|
| 391 |
+
'Lock','Lock::Async','long','longlong','Macro','Map','Match',
|
| 392 |
+
'Metamodel::AttributeContainer','Metamodel::C3MRO','Metamodel::ClassHOW',
|
| 393 |
+
'Metamodel::EnumHOW','Metamodel::Finalization','Metamodel::MethodContainer',
|
| 394 |
+
'Metamodel::MROBasedMethodDispatch','Metamodel::MultipleInheritance',
|
| 395 |
+
'Metamodel::Naming','Metamodel::Primitives','Metamodel::PrivateMethodContainer',
|
| 396 |
+
'Metamodel::RoleContainer','Metamodel::Trusting','Method','Mix','MixHash',
|
| 397 |
+
'Mixy','Mu','NFC','NFD','NFKC','NFKD','Nil','Num','num32','num64',
|
| 398 |
+
'Numeric','NumStr','ObjAt','Order','Pair','Parameter','Perl','Pod::Block',
|
| 399 |
+
'Pod::Block::Code','Pod::Block::Comment','Pod::Block::Declarator',
|
| 400 |
+
'Pod::Block::Named','Pod::Block::Para','Pod::Block::Table','Pod::Heading',
|
| 401 |
+
'Pod::Item','Pointer','Positional','PositionalBindFailover','Proc',
|
| 402 |
+
'Proc::Async','Promise','Proxy','PseudoStash','QuantHash','Range','Rat',
|
| 403 |
+
'Rational','RatStr','Real','Regex','Routine','Scalar','Scheduler',
|
| 404 |
+
'Semaphore','Seq','Set','SetHash','Setty','Signature','size_t','Slip',
|
| 405 |
+
'Stash','Str','StrDistance','Stringy','Sub','Submethod','Supplier',
|
| 406 |
+
'Supplier::Preserving','Supply','Systemic','Tap','Telemetry',
|
| 407 |
+
'Telemetry::Instrument::Thread','Telemetry::Instrument::Usage',
|
| 408 |
+
'Telemetry::Period','Telemetry::Sampler','Thread','ThreadPoolScheduler',
|
| 409 |
+
'UInt','uint16','uint32','uint64','uint8','Uni','utf8','Variable',
|
| 410 |
+
'Version','VM','Whatever','WhateverCode','WrapHandle'
|
| 411 |
+
)
|
| 412 |
+
|
| 413 |
+
PERL6_OPERATORS = (
|
| 414 |
+
'X', 'Z', 'after', 'also', 'and', 'andthen', 'before', 'cmp', 'div',
|
| 415 |
+
'eq', 'eqv', 'extra', 'ff', 'fff', 'ge', 'gt', 'le', 'leg', 'lt', 'm',
|
| 416 |
+
'mm', 'mod', 'ne', 'or', 'orelse', 'rx', 's', 'tr', 'x', 'xor', 'xx',
|
| 417 |
+
'++', '--', '**', '!', '+', '-', '~', '?', '|', '||', '+^', '~^', '?^',
|
| 418 |
+
'^', '*', '/', '%', '%%', '+&', '+<', '+>', '~&', '~<', '~>', '?&',
|
| 419 |
+
'gcd', 'lcm', '+', '-', '+|', '+^', '~|', '~^', '?|', '?^',
|
| 420 |
+
'~', '&', '^', 'but', 'does', '<=>', '..', '..^', '^..', '^..^',
|
| 421 |
+
'!=', '==', '<', '<=', '>', '>=', '~~', '===', '!eqv',
|
| 422 |
+
'&&', '||', '^^', '//', 'min', 'max', '??', '!!', 'ff', 'fff', 'so',
|
| 423 |
+
'not', '<==', '==>', '<<==', '==>>','unicmp',
|
| 424 |
+
)
|
| 425 |
+
|
| 426 |
+
# Perl 6 has a *lot* of possible bracketing characters
|
| 427 |
+
# this list was lifted from STD.pm6 (https://github.com/perl6/std)
|
| 428 |
+
PERL6_BRACKETS = {
|
| 429 |
+
'\u0028': '\u0029', '\u003c': '\u003e', '\u005b': '\u005d',
|
| 430 |
+
'\u007b': '\u007d', '\u00ab': '\u00bb', '\u0f3a': '\u0f3b',
|
| 431 |
+
'\u0f3c': '\u0f3d', '\u169b': '\u169c', '\u2018': '\u2019',
|
| 432 |
+
'\u201a': '\u2019', '\u201b': '\u2019', '\u201c': '\u201d',
|
| 433 |
+
'\u201e': '\u201d', '\u201f': '\u201d', '\u2039': '\u203a',
|
| 434 |
+
'\u2045': '\u2046', '\u207d': '\u207e', '\u208d': '\u208e',
|
| 435 |
+
'\u2208': '\u220b', '\u2209': '\u220c', '\u220a': '\u220d',
|
| 436 |
+
'\u2215': '\u29f5', '\u223c': '\u223d', '\u2243': '\u22cd',
|
| 437 |
+
'\u2252': '\u2253', '\u2254': '\u2255', '\u2264': '\u2265',
|
| 438 |
+
'\u2266': '\u2267', '\u2268': '\u2269', '\u226a': '\u226b',
|
| 439 |
+
'\u226e': '\u226f', '\u2270': '\u2271', '\u2272': '\u2273',
|
| 440 |
+
'\u2274': '\u2275', '\u2276': '\u2277', '\u2278': '\u2279',
|
| 441 |
+
'\u227a': '\u227b', '\u227c': '\u227d', '\u227e': '\u227f',
|
| 442 |
+
'\u2280': '\u2281', '\u2282': '\u2283', '\u2284': '\u2285',
|
| 443 |
+
'\u2286': '\u2287', '\u2288': '\u2289', '\u228a': '\u228b',
|
| 444 |
+
'\u228f': '\u2290', '\u2291': '\u2292', '\u2298': '\u29b8',
|
| 445 |
+
'\u22a2': '\u22a3', '\u22a6': '\u2ade', '\u22a8': '\u2ae4',
|
| 446 |
+
'\u22a9': '\u2ae3', '\u22ab': '\u2ae5', '\u22b0': '\u22b1',
|
| 447 |
+
'\u22b2': '\u22b3', '\u22b4': '\u22b5', '\u22b6': '\u22b7',
|
| 448 |
+
'\u22c9': '\u22ca', '\u22cb': '\u22cc', '\u22d0': '\u22d1',
|
| 449 |
+
'\u22d6': '\u22d7', '\u22d8': '\u22d9', '\u22da': '\u22db',
|
| 450 |
+
'\u22dc': '\u22dd', '\u22de': '\u22df', '\u22e0': '\u22e1',
|
| 451 |
+
'\u22e2': '\u22e3', '\u22e4': '\u22e5', '\u22e6': '\u22e7',
|
| 452 |
+
'\u22e8': '\u22e9', '\u22ea': '\u22eb', '\u22ec': '\u22ed',
|
| 453 |
+
'\u22f0': '\u22f1', '\u22f2': '\u22fa', '\u22f3': '\u22fb',
|
| 454 |
+
'\u22f4': '\u22fc', '\u22f6': '\u22fd', '\u22f7': '\u22fe',
|
| 455 |
+
'\u2308': '\u2309', '\u230a': '\u230b', '\u2329': '\u232a',
|
| 456 |
+
'\u23b4': '\u23b5', '\u2768': '\u2769', '\u276a': '\u276b',
|
| 457 |
+
'\u276c': '\u276d', '\u276e': '\u276f', '\u2770': '\u2771',
|
| 458 |
+
'\u2772': '\u2773', '\u2774': '\u2775', '\u27c3': '\u27c4',
|
| 459 |
+
'\u27c5': '\u27c6', '\u27d5': '\u27d6', '\u27dd': '\u27de',
|
| 460 |
+
'\u27e2': '\u27e3', '\u27e4': '\u27e5', '\u27e6': '\u27e7',
|
| 461 |
+
'\u27e8': '\u27e9', '\u27ea': '\u27eb', '\u2983': '\u2984',
|
| 462 |
+
'\u2985': '\u2986', '\u2987': '\u2988', '\u2989': '\u298a',
|
| 463 |
+
'\u298b': '\u298c', '\u298d': '\u298e', '\u298f': '\u2990',
|
| 464 |
+
'\u2991': '\u2992', '\u2993': '\u2994', '\u2995': '\u2996',
|
| 465 |
+
'\u2997': '\u2998', '\u29c0': '\u29c1', '\u29c4': '\u29c5',
|
| 466 |
+
'\u29cf': '\u29d0', '\u29d1': '\u29d2', '\u29d4': '\u29d5',
|
| 467 |
+
'\u29d8': '\u29d9', '\u29da': '\u29db', '\u29f8': '\u29f9',
|
| 468 |
+
'\u29fc': '\u29fd', '\u2a2b': '\u2a2c', '\u2a2d': '\u2a2e',
|
| 469 |
+
'\u2a34': '\u2a35', '\u2a3c': '\u2a3d', '\u2a64': '\u2a65',
|
| 470 |
+
'\u2a79': '\u2a7a', '\u2a7d': '\u2a7e', '\u2a7f': '\u2a80',
|
| 471 |
+
'\u2a81': '\u2a82', '\u2a83': '\u2a84', '\u2a8b': '\u2a8c',
|
| 472 |
+
'\u2a91': '\u2a92', '\u2a93': '\u2a94', '\u2a95': '\u2a96',
|
| 473 |
+
'\u2a97': '\u2a98', '\u2a99': '\u2a9a', '\u2a9b': '\u2a9c',
|
| 474 |
+
'\u2aa1': '\u2aa2', '\u2aa6': '\u2aa7', '\u2aa8': '\u2aa9',
|
| 475 |
+
'\u2aaa': '\u2aab', '\u2aac': '\u2aad', '\u2aaf': '\u2ab0',
|
| 476 |
+
'\u2ab3': '\u2ab4', '\u2abb': '\u2abc', '\u2abd': '\u2abe',
|
| 477 |
+
'\u2abf': '\u2ac0', '\u2ac1': '\u2ac2', '\u2ac3': '\u2ac4',
|
| 478 |
+
'\u2ac5': '\u2ac6', '\u2acd': '\u2ace', '\u2acf': '\u2ad0',
|
| 479 |
+
'\u2ad1': '\u2ad2', '\u2ad3': '\u2ad4', '\u2ad5': '\u2ad6',
|
| 480 |
+
'\u2aec': '\u2aed', '\u2af7': '\u2af8', '\u2af9': '\u2afa',
|
| 481 |
+
'\u2e02': '\u2e03', '\u2e04': '\u2e05', '\u2e09': '\u2e0a',
|
| 482 |
+
'\u2e0c': '\u2e0d', '\u2e1c': '\u2e1d', '\u2e20': '\u2e21',
|
| 483 |
+
'\u3008': '\u3009', '\u300a': '\u300b', '\u300c': '\u300d',
|
| 484 |
+
'\u300e': '\u300f', '\u3010': '\u3011', '\u3014': '\u3015',
|
| 485 |
+
'\u3016': '\u3017', '\u3018': '\u3019', '\u301a': '\u301b',
|
| 486 |
+
'\u301d': '\u301e', '\ufd3e': '\ufd3f', '\ufe17': '\ufe18',
|
| 487 |
+
'\ufe35': '\ufe36', '\ufe37': '\ufe38', '\ufe39': '\ufe3a',
|
| 488 |
+
'\ufe3b': '\ufe3c', '\ufe3d': '\ufe3e', '\ufe3f': '\ufe40',
|
| 489 |
+
'\ufe41': '\ufe42', '\ufe43': '\ufe44', '\ufe47': '\ufe48',
|
| 490 |
+
'\ufe59': '\ufe5a', '\ufe5b': '\ufe5c', '\ufe5d': '\ufe5e',
|
| 491 |
+
'\uff08': '\uff09', '\uff1c': '\uff1e', '\uff3b': '\uff3d',
|
| 492 |
+
'\uff5b': '\uff5d', '\uff5f': '\uff60', '\uff62': '\uff63',
|
| 493 |
+
}
|
| 494 |
+
|
| 495 |
+
def _build_word_match(words, boundary_regex_fragment=None, prefix='', suffix=''):
|
| 496 |
+
if boundary_regex_fragment is None:
|
| 497 |
+
return r'\b(' + prefix + r'|'.join(re.escape(x) for x in words) + \
|
| 498 |
+
suffix + r')\b'
|
| 499 |
+
else:
|
| 500 |
+
return r'(?<!' + boundary_regex_fragment + r')' + prefix + r'(' + \
|
| 501 |
+
r'|'.join(re.escape(x) for x in words) + r')' + suffix + r'(?!' + \
|
| 502 |
+
boundary_regex_fragment + r')'
|
| 503 |
+
|
| 504 |
+
def brackets_callback(token_class):
|
| 505 |
+
def callback(lexer, match, context):
|
| 506 |
+
groups = match.groupdict()
|
| 507 |
+
opening_chars = groups['delimiter']
|
| 508 |
+
n_chars = len(opening_chars)
|
| 509 |
+
adverbs = groups.get('adverbs')
|
| 510 |
+
|
| 511 |
+
closer = Perl6Lexer.PERL6_BRACKETS.get(opening_chars[0])
|
| 512 |
+
text = context.text
|
| 513 |
+
|
| 514 |
+
if closer is None: # it's not a mirrored character, which means we
|
| 515 |
+
# just need to look for the next occurrence
|
| 516 |
+
|
| 517 |
+
end_pos = text.find(opening_chars, match.start('delimiter') + n_chars)
|
| 518 |
+
else: # we need to look for the corresponding closing character,
|
| 519 |
+
# keep nesting in mind
|
| 520 |
+
closing_chars = closer * n_chars
|
| 521 |
+
nesting_level = 1
|
| 522 |
+
|
| 523 |
+
search_pos = match.start('delimiter')
|
| 524 |
+
|
| 525 |
+
while nesting_level > 0:
|
| 526 |
+
next_open_pos = text.find(opening_chars, search_pos + n_chars)
|
| 527 |
+
next_close_pos = text.find(closing_chars, search_pos + n_chars)
|
| 528 |
+
|
| 529 |
+
if next_close_pos == -1:
|
| 530 |
+
next_close_pos = len(text)
|
| 531 |
+
nesting_level = 0
|
| 532 |
+
elif next_open_pos != -1 and next_open_pos < next_close_pos:
|
| 533 |
+
nesting_level += 1
|
| 534 |
+
search_pos = next_open_pos
|
| 535 |
+
else: # next_close_pos < next_open_pos
|
| 536 |
+
nesting_level -= 1
|
| 537 |
+
search_pos = next_close_pos
|
| 538 |
+
|
| 539 |
+
end_pos = next_close_pos
|
| 540 |
+
|
| 541 |
+
if end_pos < 0: # if we didn't find a closer, just highlight the
|
| 542 |
+
# rest of the text in this class
|
| 543 |
+
end_pos = len(text)
|
| 544 |
+
|
| 545 |
+
if adverbs is not None and re.search(r':to\b', adverbs):
|
| 546 |
+
heredoc_terminator = text[match.start('delimiter') + n_chars:end_pos]
|
| 547 |
+
end_heredoc = re.search(r'^\s*' + re.escape(heredoc_terminator) +
|
| 548 |
+
r'\s*$', text[end_pos:], re.MULTILINE)
|
| 549 |
+
|
| 550 |
+
if end_heredoc:
|
| 551 |
+
end_pos += end_heredoc.end()
|
| 552 |
+
else:
|
| 553 |
+
end_pos = len(text)
|
| 554 |
+
|
| 555 |
+
yield match.start(), token_class, text[match.start():end_pos + n_chars]
|
| 556 |
+
context.pos = end_pos + n_chars
|
| 557 |
+
|
| 558 |
+
return callback
|
| 559 |
+
|
| 560 |
+
def opening_brace_callback(lexer, match, context):
|
| 561 |
+
stack = context.stack
|
| 562 |
+
|
| 563 |
+
yield match.start(), Text, context.text[match.start():match.end()]
|
| 564 |
+
context.pos = match.end()
|
| 565 |
+
|
| 566 |
+
# if we encounter an opening brace and we're one level
|
| 567 |
+
# below a token state, it means we need to increment
|
| 568 |
+
# the nesting level for braces so we know later when
|
| 569 |
+
# we should return to the token rules.
|
| 570 |
+
if len(stack) > 2 and stack[-2] == 'token':
|
| 571 |
+
context.perl6_token_nesting_level += 1
|
| 572 |
+
|
| 573 |
+
def closing_brace_callback(lexer, match, context):
|
| 574 |
+
stack = context.stack
|
| 575 |
+
|
| 576 |
+
yield match.start(), Text, context.text[match.start():match.end()]
|
| 577 |
+
context.pos = match.end()
|
| 578 |
+
|
| 579 |
+
# if we encounter a free closing brace and we're one level
|
| 580 |
+
# below a token state, it means we need to check the nesting
|
| 581 |
+
# level to see if we need to return to the token state.
|
| 582 |
+
if len(stack) > 2 and stack[-2] == 'token':
|
| 583 |
+
context.perl6_token_nesting_level -= 1
|
| 584 |
+
if context.perl6_token_nesting_level == 0:
|
| 585 |
+
stack.pop()
|
| 586 |
+
|
| 587 |
+
def embedded_perl6_callback(lexer, match, context):
|
| 588 |
+
context.perl6_token_nesting_level = 1
|
| 589 |
+
yield match.start(), Text, context.text[match.start():match.end()]
|
| 590 |
+
context.pos = match.end()
|
| 591 |
+
context.stack.append('root')
|
| 592 |
+
|
| 593 |
+
# If you're modifying these rules, be careful if you need to process '{' or '}'
|
| 594 |
+
# characters. We have special logic for processing these characters (due to the fact
|
| 595 |
+
# that you can nest Perl 6 code in regex blocks), so if you need to process one of
|
| 596 |
+
# them, make sure you also process the corresponding one!
|
| 597 |
+
tokens = {
|
| 598 |
+
'common': [
|
| 599 |
+
(r'#[`|=](?P<delimiter>(?P<first_char>[' + ''.join(PERL6_BRACKETS) + r'])(?P=first_char)*)',
|
| 600 |
+
brackets_callback(Comment.Multiline)),
|
| 601 |
+
(r'#[^\n]*$', Comment.Single),
|
| 602 |
+
(r'^(\s*)=begin\s+(\w+)\b.*?^\1=end\s+\2', Comment.Multiline),
|
| 603 |
+
(r'^(\s*)=for.*?\n\s*?\n', Comment.Multiline),
|
| 604 |
+
(r'^=.*?\n\s*?\n', Comment.Multiline),
|
| 605 |
+
(r'(regex|token|rule)(\s*' + PERL6_IDENTIFIER_RANGE + '+:sym)',
|
| 606 |
+
bygroups(Keyword, Name), 'token-sym-brackets'),
|
| 607 |
+
(r'(regex|token|rule)(?!' + PERL6_IDENTIFIER_RANGE + r')(\s*' + PERL6_IDENTIFIER_RANGE + '+)?',
|
| 608 |
+
bygroups(Keyword, Name), 'pre-token'),
|
| 609 |
+
# deal with a special case in the Perl 6 grammar (role q { ... })
|
| 610 |
+
(r'(role)(\s+)(q)(\s*)', bygroups(Keyword, Whitespace, Name, Whitespace)),
|
| 611 |
+
(_build_word_match(PERL6_KEYWORDS, PERL6_IDENTIFIER_RANGE), Keyword),
|
| 612 |
+
(_build_word_match(PERL6_BUILTIN_CLASSES, PERL6_IDENTIFIER_RANGE, suffix='(?::[UD])?'),
|
| 613 |
+
Name.Builtin),
|
| 614 |
+
(_build_word_match(PERL6_BUILTINS, PERL6_IDENTIFIER_RANGE), Name.Builtin),
|
| 615 |
+
# copied from PerlLexer
|
| 616 |
+
(r'[$@%&][.^:?=!~]?' + PERL6_IDENTIFIER_RANGE + '+(?:<<.*?>>|<.*?>|«.*?»)*',
|
| 617 |
+
Name.Variable),
|
| 618 |
+
(r'\$[!/](?:<<.*?>>|<.*?>|«.*?»)*', Name.Variable.Global),
|
| 619 |
+
(r'::\?\w+', Name.Variable.Global),
|
| 620 |
+
(r'[$@%&]\*' + PERL6_IDENTIFIER_RANGE + '+(?:<<.*?>>|<.*?>|«.*?»)*',
|
| 621 |
+
Name.Variable.Global),
|
| 622 |
+
(r'\$(?:<.*?>)+', Name.Variable),
|
| 623 |
+
(r'(?:q|qq|Q)[a-zA-Z]?\s*(?P<adverbs>:[\w\s:]+)?\s*(?P<delimiter>(?P<first_char>[^0-9a-zA-Z:\s])'
|
| 624 |
+
r'(?P=first_char)*)', brackets_callback(String)),
|
| 625 |
+
# copied from PerlLexer
|
| 626 |
+
(r'0_?[0-7]+(_[0-7]+)*', Number.Oct),
|
| 627 |
+
(r'0x[0-9A-Fa-f]+(_[0-9A-Fa-f]+)*', Number.Hex),
|
| 628 |
+
(r'0b[01]+(_[01]+)*', Number.Bin),
|
| 629 |
+
(r'(?i)(\d*(_\d*)*\.\d+(_\d*)*|\d+(_\d*)*\.\d+(_\d*)*)(e[+-]?\d+)?',
|
| 630 |
+
Number.Float),
|
| 631 |
+
(r'(?i)\d+(_\d*)*e[+-]?\d+(_\d*)*', Number.Float),
|
| 632 |
+
(r'\d+(_\d+)*', Number.Integer),
|
| 633 |
+
(r'(?<=~~)\s*/(?:\\\\|\\/|.)*?/', String.Regex),
|
| 634 |
+
(r'(?<=[=(,])\s*/(?:\\\\|\\/|.)*?/', String.Regex),
|
| 635 |
+
(r'm\w+(?=\()', Name),
|
| 636 |
+
(r'(?:m|ms|rx)\s*(?P<adverbs>:[\w\s:]+)?\s*(?P<delimiter>(?P<first_char>[^\w:\s])'
|
| 637 |
+
r'(?P=first_char)*)', brackets_callback(String.Regex)),
|
| 638 |
+
(r'(?:s|ss|tr)\s*(?::[\w\s:]+)?\s*/(?:\\\\|\\/|.)*?/(?:\\\\|\\/|.)*?/',
|
| 639 |
+
String.Regex),
|
| 640 |
+
(r'<[^\s=].*?\S>', String),
|
| 641 |
+
(_build_word_match(PERL6_OPERATORS), Operator),
|
| 642 |
+
(r'\w' + PERL6_IDENTIFIER_RANGE + '*', Name),
|
| 643 |
+
(r"'(\\\\|\\[^\\]|[^'\\])*'", String),
|
| 644 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String),
|
| 645 |
+
],
|
| 646 |
+
'root': [
|
| 647 |
+
include('common'),
|
| 648 |
+
(r'\{', opening_brace_callback),
|
| 649 |
+
(r'\}', closing_brace_callback),
|
| 650 |
+
(r'.+?', Text),
|
| 651 |
+
],
|
| 652 |
+
'pre-token': [
|
| 653 |
+
include('common'),
|
| 654 |
+
(r'\{', Text, ('#pop', 'token')),
|
| 655 |
+
(r'.+?', Text),
|
| 656 |
+
],
|
| 657 |
+
'token-sym-brackets': [
|
| 658 |
+
(r'(?P<delimiter>(?P<first_char>[' + ''.join(PERL6_BRACKETS) + '])(?P=first_char)*)',
|
| 659 |
+
brackets_callback(Name), ('#pop', 'pre-token')),
|
| 660 |
+
default(('#pop', 'pre-token')),
|
| 661 |
+
],
|
| 662 |
+
'token': [
|
| 663 |
+
(r'\}', Text, '#pop'),
|
| 664 |
+
(r'(?<=:)(?:my|our|state|constant|temp|let).*?;', using(this)),
|
| 665 |
+
# make sure that quotes in character classes aren't treated as strings
|
| 666 |
+
(r'<(?:[-!?+.]\s*)?\[.*?\]>', String.Regex),
|
| 667 |
+
# make sure that '#' characters in quotes aren't treated as comments
|
| 668 |
+
(r"(?<!\\)'(\\\\|\\[^\\]|[^'\\])*'", String.Regex),
|
| 669 |
+
(r'(?<!\\)"(\\\\|\\[^\\]|[^"\\])*"', String.Regex),
|
| 670 |
+
(r'#.*?$', Comment.Single),
|
| 671 |
+
(r'\{', embedded_perl6_callback),
|
| 672 |
+
('.+?', String.Regex),
|
| 673 |
+
],
|
| 674 |
+
}
|
| 675 |
+
|
| 676 |
+
def analyse_text(text):
|
| 677 |
+
def strip_pod(lines):
|
| 678 |
+
in_pod = False
|
| 679 |
+
stripped_lines = []
|
| 680 |
+
|
| 681 |
+
for line in lines:
|
| 682 |
+
if re.match(r'^=(?:end|cut)', line):
|
| 683 |
+
in_pod = False
|
| 684 |
+
elif re.match(r'^=\w+', line):
|
| 685 |
+
in_pod = True
|
| 686 |
+
elif not in_pod:
|
| 687 |
+
stripped_lines.append(line)
|
| 688 |
+
|
| 689 |
+
return stripped_lines
|
| 690 |
+
|
| 691 |
+
# XXX handle block comments
|
| 692 |
+
lines = text.splitlines()
|
| 693 |
+
lines = strip_pod(lines)
|
| 694 |
+
text = '\n'.join(lines)
|
| 695 |
+
|
| 696 |
+
if shebang_matches(text, r'perl6|rakudo|niecza|pugs'):
|
| 697 |
+
return True
|
| 698 |
+
|
| 699 |
+
saw_perl_decl = False
|
| 700 |
+
rating = False
|
| 701 |
+
|
| 702 |
+
# check for my/our/has declarations
|
| 703 |
+
if re.search(r"(?:my|our|has)\s+(?:" + Perl6Lexer.PERL6_IDENTIFIER_RANGE +
|
| 704 |
+
r"+\s+)?[$@%&(]", text):
|
| 705 |
+
rating = 0.8
|
| 706 |
+
saw_perl_decl = True
|
| 707 |
+
|
| 708 |
+
for line in lines:
|
| 709 |
+
line = re.sub('#.*', '', line)
|
| 710 |
+
if re.match(r'^\s*$', line):
|
| 711 |
+
continue
|
| 712 |
+
|
| 713 |
+
# match v6; use v6; use v6.0; use v6.0.0;
|
| 714 |
+
if re.match(r'^\s*(?:use\s+)?v6(?:\.\d(?:\.\d)?)?;', line):
|
| 715 |
+
return True
|
| 716 |
+
# match class, module, role, enum, grammar declarations
|
| 717 |
+
class_decl = re.match(r'^\s*(?:(?P<scope>my|our)\s+)?(?:module|class|role|enum|grammar)', line)
|
| 718 |
+
if class_decl:
|
| 719 |
+
if saw_perl_decl or class_decl.group('scope') is not None:
|
| 720 |
+
return True
|
| 721 |
+
rating = 0.05
|
| 722 |
+
continue
|
| 723 |
+
break
|
| 724 |
+
|
| 725 |
+
if ':=' in text:
|
| 726 |
+
# Same logic as above for PerlLexer
|
| 727 |
+
rating /= 2
|
| 728 |
+
|
| 729 |
+
return rating
|
| 730 |
+
|
| 731 |
+
def __init__(self, **options):
|
| 732 |
+
super().__init__(**options)
|
| 733 |
+
self.encoding = options.get('encoding', 'utf-8')
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/phix.py
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
| 2 |
+
pygments.lexers.phix
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for Phix.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import RegexLexer, words
|
| 14 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 15 |
+
Whitespace
|
| 16 |
+
|
| 17 |
+
__all__ = ['PhixLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class PhixLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
Pygments Lexer for Phix files (.exw).
|
| 23 |
+
See http://phix.x10.mx
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
name = 'Phix'
|
| 27 |
+
url = 'http://phix.x10.mx'
|
| 28 |
+
aliases = ['phix']
|
| 29 |
+
filenames = ['*.exw']
|
| 30 |
+
mimetypes = ['text/x-phix']
|
| 31 |
+
version_added = '2.14'
|
| 32 |
+
|
| 33 |
+
flags = re.MULTILINE # nb: **NOT** re.DOTALL! (totally spanners comment handling)
|
| 34 |
+
|
| 35 |
+
preproc = (
|
| 36 |
+
'ifdef', 'elsifdef', 'elsedef'
|
| 37 |
+
)
|
| 38 |
+
# Note these lists are auto-generated by pwa/p2js.exw, when pwa\src\p2js_keywords.e (etc)
|
| 39 |
+
# change, though of course subsequent copy/commit/pull requests are all manual steps.
|
| 40 |
+
types = (
|
| 41 |
+
'string', 'nullable_string', 'atom_string', 'atom', 'bool', 'boolean',
|
| 42 |
+
'cdCanvan', 'cdCanvas', 'complex', 'CURLcode', 'dictionary', 'int',
|
| 43 |
+
'integer', 'Ihandle', 'Ihandles', 'Ihandln', 'mpfr', 'mpq', 'mpz',
|
| 44 |
+
'mpz_or_string', 'number', 'rid_string', 'seq', 'sequence', 'timedate',
|
| 45 |
+
'object'
|
| 46 |
+
)
|
| 47 |
+
keywords = (
|
| 48 |
+
'abstract', 'class', 'continue', 'export', 'extends', 'nullable',
|
| 49 |
+
'private', 'public', 'static', 'struct', 'trace',
|
| 50 |
+
'and', 'break', 'by', 'case', 'catch', 'const', 'constant', 'debug',
|
| 51 |
+
'default', 'do', 'else', 'elsif', 'end', 'enum', 'exit', 'fallthru',
|
| 52 |
+
'fallthrough', 'for', 'forward', 'function', 'global', 'if', 'in',
|
| 53 |
+
'include', 'js', 'javascript', 'javascript_semantics', 'let', 'not',
|
| 54 |
+
'or', 'procedure', 'profile', 'profile_time', 'return', 'safe_mode',
|
| 55 |
+
'switch', 'then', 'to', 'try', 'type', 'type_check', 'until', 'warning',
|
| 56 |
+
'while', 'with', 'without', 'xor'
|
| 57 |
+
)
|
| 58 |
+
routines = (
|
| 59 |
+
'abort', 'abs', 'adjust_timedate', 'and_bits', 'and_bitsu', 'apply',
|
| 60 |
+
'append', 'arccos', 'arcsin', 'arctan', 'assert', 'atan2',
|
| 61 |
+
'atom_to_float32', 'atom_to_float64', 'bankers_rounding', 'beep',
|
| 62 |
+
'begins', 'binary_search', 'bits_to_int', 'bk_color', 'bytes_to_int',
|
| 63 |
+
'call_func', 'call_proc', 'cdCanvasActivate', 'cdCanvasArc',
|
| 64 |
+
'cdCanvasBegin', 'cdCanvasBox', 'cdCanvasChord', 'cdCanvasCircle',
|
| 65 |
+
'cdCanvasClear', 'cdCanvasEnd', 'cdCanvasFlush', 'cdCanvasFont',
|
| 66 |
+
'cdCanvasGetImageRGB', 'cdCanvasGetSize', 'cdCanvasGetTextAlignment',
|
| 67 |
+
'cdCanvasGetTextSize', 'cdCanvasLine', 'cdCanvasMark',
|
| 68 |
+
'cdCanvasMarkSize', 'cdCanvasMultiLineVectorText', 'cdCanvasPixel',
|
| 69 |
+
'cdCanvasRect', 'cdCanvasRoundedBox', 'cdCanvasRoundedRect',
|
| 70 |
+
'cdCanvasSector', 'cdCanvasSetAttribute', 'cdCanvasSetBackground',
|
| 71 |
+
'cdCanvasSetFillMode', 'cdCanvasSetForeground',
|
| 72 |
+
'cdCanvasSetInteriorStyle', 'cdCanvasSetLineStyle',
|
| 73 |
+
'cdCanvasSetLineWidth', 'cdCanvasSetTextAlignment', 'cdCanvasText',
|
| 74 |
+
'cdCanvasSetTextOrientation', 'cdCanvasGetTextOrientation',
|
| 75 |
+
'cdCanvasVectorText', 'cdCanvasVectorTextDirection',
|
| 76 |
+
'cdCanvasVectorTextSize', 'cdCanvasVertex', 'cdCreateCanvas',
|
| 77 |
+
'cdDecodeAlpha', 'cdDecodeColor', 'cdDecodeColorAlpha', 'cdEncodeAlpha',
|
| 78 |
+
'cdEncodeColor', 'cdEncodeColorAlpha', 'cdKillCanvas', 'cdVersion',
|
| 79 |
+
'cdVersionDate', 'ceil', 'change_timezone', 'choose', 'clear_screen',
|
| 80 |
+
'columnize', 'command_line', 'compare', 'complex_abs', 'complex_add',
|
| 81 |
+
'complex_arg', 'complex_conjugate', 'complex_cos', 'complex_cosh',
|
| 82 |
+
'complex_div', 'complex_exp', 'complex_imag', 'complex_inv',
|
| 83 |
+
'complex_log', 'complex_mul', 'complex_neg', 'complex_new',
|
| 84 |
+
'complex_norm', 'complex_power', 'complex_rho', 'complex_real',
|
| 85 |
+
'complex_round', 'complex_sin', 'complex_sinh', 'complex_sprint',
|
| 86 |
+
'complex_sqrt', 'complex_sub', 'complex_theta', 'concat', 'cos',
|
| 87 |
+
'crash', 'custom_sort', 'date', 'day_of_week', 'day_of_year',
|
| 88 |
+
'days_in_month', 'decode_base64', 'decode_flags', 'deep_copy', 'deld',
|
| 89 |
+
'deserialize', 'destroy_dict', 'destroy_queue', 'destroy_stack',
|
| 90 |
+
'dict_name', 'dict_size', 'elapsed', 'elapsed_short', 'encode_base64',
|
| 91 |
+
'equal', 'even', 'exp', 'extract', 'factorial', 'factors',
|
| 92 |
+
'file_size_k', 'find', 'find_all', 'find_any', 'find_replace', 'filter',
|
| 93 |
+
'flatten', 'float32_to_atom', 'float64_to_atom', 'floor',
|
| 94 |
+
'format_timedate', 'free_console', 'from_polar', 'gcd', 'get_file_base',
|
| 95 |
+
'get_file_extension', 'get_file_name', 'get_file_name_and_path',
|
| 96 |
+
'get_file_path', 'get_file_path_and_name', 'get_maxprime', 'get_prime',
|
| 97 |
+
'get_primes', 'get_primes_le', 'get_proper_dir', 'get_proper_path',
|
| 98 |
+
'get_rand', 'get_routine_info', 'get_test_abort', 'get_test_logfile',
|
| 99 |
+
'get_test_pause', 'get_test_verbosity', 'get_tzid', 'getd', 'getdd',
|
| 100 |
+
'getd_all_keys', 'getd_by_index', 'getd_index', 'getd_partial_key',
|
| 101 |
+
'glAttachShader', 'glBindBuffer', 'glBindTexture', 'glBufferData',
|
| 102 |
+
'glCanvasSpecialText', 'glClear', 'glClearColor', 'glColor',
|
| 103 |
+
'glCompileShader', 'glCreateBuffer', 'glCreateProgram',
|
| 104 |
+
'glCreateShader', 'glCreateTexture', 'glDeleteProgram',
|
| 105 |
+
'glDeleteShader', 'glDrawArrays', 'glEnable',
|
| 106 |
+
'glEnableVertexAttribArray', 'glFloat32Array', 'glInt32Array',
|
| 107 |
+
'glFlush', 'glGetAttribLocation', 'glGetError', 'glGetProgramInfoLog',
|
| 108 |
+
'glGetProgramParameter', 'glGetShaderInfoLog', 'glGetShaderParameter',
|
| 109 |
+
'glGetUniformLocation', 'glLinkProgram', 'glLoadIdentity',
|
| 110 |
+
'glMatrixMode', 'glOrtho', 'glRotatef', 'glShadeModel',
|
| 111 |
+
'glShaderSource', 'glSimpleA7texcoords', 'glTexImage2Dc',
|
| 112 |
+
'glTexParameteri', 'glTranslate', 'glUniform1f', 'glUniform1i',
|
| 113 |
+
'glUniformMatrix4fv', 'glUseProgram', 'glVertex',
|
| 114 |
+
'glVertexAttribPointer', 'glViewport', 'head', 'hsv_to_rgb', 'iff',
|
| 115 |
+
'iif', 'include_file', 'incl0de_file', 'insert', 'instance',
|
| 116 |
+
'int_to_bits', 'int_to_bytes', 'is_dict', 'is_integer', 's_leap_year',
|
| 117 |
+
'is_prime', 'is_prime2', 'islower', 'isupper', 'Icallback',
|
| 118 |
+
'iup_isdouble', 'iup_isprint', 'iup_XkeyBase', 'IupAppend', 'IupAlarm',
|
| 119 |
+
'IupBackgroundBox', 'IupButton', 'IupCalendar', 'IupCanvas',
|
| 120 |
+
'IupClipboard', 'IupClose', 'IupCloseOnEscape', 'IupControlsOpen',
|
| 121 |
+
'IupDatePick', 'IupDestroy', 'IupDialog', 'IupDrawArc', 'IupDrawBegin',
|
| 122 |
+
'IupDrawEnd', 'IupDrawGetSize', 'IupDrawGetTextSize', 'IupDrawLine',
|
| 123 |
+
'IupDrawRectangle', 'IupDrawText', 'IupExpander', 'IupFill',
|
| 124 |
+
'IupFlatLabel', 'IupFlatList', 'IupFlatTree', 'IupFlush', 'IupFrame',
|
| 125 |
+
'IupGetAttribute', 'IupGetAttributeId', 'IupGetAttributePtr',
|
| 126 |
+
'IupGetBrother', 'IupGetChild', 'IupGetChildCount', 'IupGetClassName',
|
| 127 |
+
'IupGetDialog', 'IupGetDialogChild', 'IupGetDouble', 'IupGetFocus',
|
| 128 |
+
'IupGetGlobal', 'IupGetGlobalInt', 'IupGetGlobalIntInt', 'IupGetInt',
|
| 129 |
+
'IupGetInt2', 'IupGetIntId', 'IupGetIntInt', 'IupGetParent',
|
| 130 |
+
'IupGLCanvas', 'IupGLCanvasOpen', 'IupGLMakeCurrent', 'IupGraph',
|
| 131 |
+
'IupHbox', 'IupHide', 'IupImage', 'IupImageRGBA', 'IupItem',
|
| 132 |
+
'iupKeyCodeToName', 'IupLabel', 'IupLink', 'IupList', 'IupMap',
|
| 133 |
+
'IupMenu', 'IupMenuItem', 'IupMessage', 'IupMessageDlg', 'IupMultiBox',
|
| 134 |
+
'IupMultiLine', 'IupNextField', 'IupNormaliser', 'IupOpen',
|
| 135 |
+
'IupPlayInput', 'IupPopup', 'IupPreviousField', 'IupProgressBar',
|
| 136 |
+
'IupRadio', 'IupRecordInput', 'IupRedraw', 'IupRefresh',
|
| 137 |
+
'IupRefreshChildren', 'IupSeparator', 'IupSetAttribute',
|
| 138 |
+
'IupSetAttributes', 'IupSetAttributeHandle', 'IupSetAttributeId',
|
| 139 |
+
'IupSetAttributePtr', 'IupSetCallback', 'IupSetCallbacks',
|
| 140 |
+
'IupSetDouble', 'IupSetFocus', 'IupSetGlobal', 'IupSetGlobalInt',
|
| 141 |
+
'IupSetGlobalFunction', 'IupSetHandle', 'IupSetInt',
|
| 142 |
+
'IupSetStrAttribute', 'IupSetStrGlobal', 'IupShow', 'IupShowXY',
|
| 143 |
+
'IupSplit', 'IupStoreAttribute', 'IupSubmenu', 'IupTable',
|
| 144 |
+
'IupTableClearSelected', 'IupTableClick_cb', 'IupTableGetSelected',
|
| 145 |
+
'IupTableResize_cb', 'IupTableSetData', 'IupTabs', 'IupText',
|
| 146 |
+
'IupTimer', 'IupToggle', 'IupTreeAddNodes', 'IupTreeView', 'IupUpdate',
|
| 147 |
+
'IupValuator', 'IupVbox', 'join', 'join_by', 'join_path', 'k_perm',
|
| 148 |
+
'largest', 'lcm', 'length', 'log', 'log10', 'log2', 'lower',
|
| 149 |
+
'm4_crossProduct', 'm4_inverse', 'm4_lookAt', 'm4_multiply',
|
| 150 |
+
'm4_normalize', 'm4_perspective', 'm4_subtractVectors', 'm4_xRotate',
|
| 151 |
+
'm4_yRotate', 'machine_bits', 'machine_word', 'match', 'match_all',
|
| 152 |
+
'match_replace', 'max', 'maxsq', 'min', 'minsq', 'mod', 'mpfr_add',
|
| 153 |
+
'mpfr_ceil', 'mpfr_cmp', 'mpfr_cmp_si', 'mpfr_const_pi', 'mpfr_div',
|
| 154 |
+
'mpfr_div_si', 'mpfr_div_z', 'mpfr_floor', 'mpfr_free', 'mpfr_get_d',
|
| 155 |
+
'mpfr_get_default_precision', 'mpfr_get_default_rounding_mode',
|
| 156 |
+
'mpfr_get_fixed', 'mpfr_get_precision', 'mpfr_get_si', 'mpfr_init',
|
| 157 |
+
'mpfr_inits', 'mpfr_init_set', 'mpfr_init_set_q', 'mpfr_init_set_z',
|
| 158 |
+
'mpfr_mul', 'mpfr_mul_si', 'mpfr_pow_si', 'mpfr_set', 'mpfr_set_d',
|
| 159 |
+
'mpfr_set_default_precision', 'mpfr_set_default_rounding_mode',
|
| 160 |
+
'mpfr_set_precision', 'mpfr_set_q', 'mpfr_set_si', 'mpfr_set_str',
|
| 161 |
+
'mpfr_set_z', 'mpfr_si_div', 'mpfr_si_sub', 'mpfr_sqrt', 'mpfr_sub',
|
| 162 |
+
'mpfr_sub_si', 'mpq_abs', 'mpq_add', 'mpq_add_si', 'mpq_canonicalize',
|
| 163 |
+
'mpq_cmp', 'mpq_cmp_si', 'mpq_div', 'mpq_div_2exp', 'mpq_free',
|
| 164 |
+
'mpq_get_den', 'mpq_get_num', 'mpq_get_str', 'mpq_init', 'mpq_init_set',
|
| 165 |
+
'mpq_init_set_si', 'mpq_init_set_str', 'mpq_init_set_z', 'mpq_inits',
|
| 166 |
+
'mpq_inv', 'mpq_mul', 'mpq_neg', 'mpq_set', 'mpq_set_si', 'mpq_set_str',
|
| 167 |
+
'mpq_set_z', 'mpq_sub', 'mpz_abs', 'mpz_add', 'mpz_addmul',
|
| 168 |
+
'mpz_addmul_ui', 'mpz_addmul_si', 'mpz_add_si', 'mpz_add_ui', 'mpz_and',
|
| 169 |
+
'mpz_bin_uiui', 'mpz_cdiv_q', 'mpz_cmp', 'mpz_cmp_si', 'mpz_divexact',
|
| 170 |
+
'mpz_divexact_ui', 'mpz_divisible_p', 'mpz_divisible_ui_p', 'mpz_even',
|
| 171 |
+
'mpz_fac_ui', 'mpz_factorstring', 'mpz_fdiv_q', 'mpz_fdiv_q_2exp',
|
| 172 |
+
'mpz_fdiv_q_ui', 'mpz_fdiv_qr', 'mpz_fdiv_r', 'mpz_fdiv_ui',
|
| 173 |
+
'mpz_fib_ui', 'mpz_fib2_ui', 'mpz_fits_atom', 'mpz_fits_integer',
|
| 174 |
+
'mpz_free', 'mpz_gcd', 'mpz_gcd_ui', 'mpz_get_atom', 'mpz_get_integer',
|
| 175 |
+
'mpz_get_short_str', 'mpz_get_str', 'mpz_init', 'mpz_init_set',
|
| 176 |
+
'mpz_inits', 'mpz_invert', 'mpz_lcm', 'mpz_lcm_ui', 'mpz_max',
|
| 177 |
+
'mpz_min', 'mpz_mod', 'mpz_mod_ui', 'mpz_mul', 'mpz_mul_2exp',
|
| 178 |
+
'mpz_mul_d', 'mpz_mul_si', 'mpz_neg', 'mpz_nthroot', 'mpz_odd',
|
| 179 |
+
'mpz_pollard_rho', 'mpz_pow_ui', 'mpz_powm', 'mpz_powm_ui', 'mpz_prime',
|
| 180 |
+
'mpz_prime_factors', 'mpz_prime_mr', 'mpz_rand', 'mpz_rand_ui',
|
| 181 |
+
'mpz_re_compose', 'mpz_remove', 'mpz_scan0', 'mpz_scan1', 'mpz_set',
|
| 182 |
+
'mpz_set_d', 'mpz_set_si', 'mpz_set_str', 'mpz_set_v', 'mpz_sign',
|
| 183 |
+
'mpz_sizeinbase', 'mpz_sqrt', 'mpz_sub', 'mpz_sub_si', 'mpz_sub_ui',
|
| 184 |
+
'mpz_si_sub', 'mpz_tdiv_q_2exp', 'mpz_tdiv_r_2exp', 'mpz_tstbit',
|
| 185 |
+
'mpz_ui_pow_ui', 'mpz_xor', 'named_dict', 'new_dict', 'new_queue',
|
| 186 |
+
'new_stack', 'not_bits', 'not_bitsu', 'odd', 'or_all', 'or_allu',
|
| 187 |
+
'or_bits', 'or_bitsu', 'ord', 'ordinal', 'ordinant',
|
| 188 |
+
'override_timezone', 'pad', 'pad_head', 'pad_tail', 'parse_date_string',
|
| 189 |
+
'papply', 'peep', 'peepn', 'peep_dict', 'permute', 'permutes',
|
| 190 |
+
'platform', 'pop', 'popn', 'pop_dict', 'power', 'pp', 'ppEx', 'ppExf',
|
| 191 |
+
'ppf', 'ppOpt', 'pq_add', 'pq_destroy', 'pq_empty', 'pq_new', 'pq_peek',
|
| 192 |
+
'pq_pop', 'pq_pop_data', 'pq_size', 'prepend', 'prime_factors',
|
| 193 |
+
'printf', 'product', 'proper', 'push', 'pushn', 'putd', 'puts',
|
| 194 |
+
'queue_empty', 'queue_size', 'rand', 'rand_range', 'reinstate',
|
| 195 |
+
'remainder', 'remove', 'remove_all', 'repeat', 'repeatch', 'replace',
|
| 196 |
+
'requires', 'reverse', 'rfind', 'rgb', 'rmatch', 'rmdr', 'rnd', 'round',
|
| 197 |
+
'routine_id', 'scanf', 'serialize', 'series', 'set_rand',
|
| 198 |
+
'set_test_abort', 'set_test_logfile', 'set_test_module',
|
| 199 |
+
'set_test_pause', 'set_test_verbosity', 'set_timedate_formats',
|
| 200 |
+
'set_timezone', 'setd', 'setd_default', 'shorten', 'sha256',
|
| 201 |
+
'shift_bits', 'shuffle', 'sign', 'sin', 'smallest', 'sort',
|
| 202 |
+
'sort_columns', 'speak', 'splice', 'split', 'split_any', 'split_by',
|
| 203 |
+
'sprint', 'sprintf', 'sq_abs', 'sq_add', 'sq_and', 'sq_and_bits',
|
| 204 |
+
'sq_arccos', 'sq_arcsin', 'sq_arctan', 'sq_atom', 'sq_ceil', 'sq_cmp',
|
| 205 |
+
'sq_cos', 'sq_div', 'sq_even', 'sq_eq', 'sq_floor', 'sq_floor_div',
|
| 206 |
+
'sq_ge', 'sq_gt', 'sq_int', 'sq_le', 'sq_log', 'sq_log10', 'sq_log2',
|
| 207 |
+
'sq_lt', 'sq_max', 'sq_min', 'sq_mod', 'sq_mul', 'sq_ne', 'sq_not',
|
| 208 |
+
'sq_not_bits', 'sq_odd', 'sq_or', 'sq_or_bits', 'sq_power', 'sq_rand',
|
| 209 |
+
'sq_remainder', 'sq_rmdr', 'sq_rnd', 'sq_round', 'sq_seq', 'sq_sign',
|
| 210 |
+
'sq_sin', 'sq_sqrt', 'sq_str', 'sq_sub', 'sq_tan', 'sq_trunc',
|
| 211 |
+
'sq_uminus', 'sq_xor', 'sq_xor_bits', 'sqrt', 'square_free',
|
| 212 |
+
'stack_empty', 'stack_size', 'substitute', 'substitute_all', 'sum',
|
| 213 |
+
'tail', 'tan', 'test_equal', 'test_fail', 'test_false',
|
| 214 |
+
'test_not_equal', 'test_pass', 'test_summary', 'test_true',
|
| 215 |
+
'text_color', 'throw', 'time', 'timedate_diff', 'timedelta',
|
| 216 |
+
'to_integer', 'to_number', 'to_rgb', 'to_string', 'traverse_dict',
|
| 217 |
+
'traverse_dict_partial_key', 'trim', 'trim_head', 'trim_tail', 'trunc',
|
| 218 |
+
'tagset', 'tagstart', 'typeof', 'unique', 'unix_dict', 'upper',
|
| 219 |
+
'utf8_to_utf32', 'utf32_to_utf8', 'version', 'vlookup', 'vslice',
|
| 220 |
+
'wglGetProcAddress', 'wildcard_file', 'wildcard_match', 'with_rho',
|
| 221 |
+
'with_theta', 'xml_new_doc', 'xml_new_element', 'xml_set_attribute',
|
| 222 |
+
'xml_sprint', 'xor_bits', 'xor_bitsu',
|
| 223 |
+
'accept', 'allocate', 'allocate_string', 'allow_break', 'ARM',
|
| 224 |
+
'atom_to_float80', 'c_func', 'c_proc', 'call_back', 'chdir',
|
| 225 |
+
'check_break', 'clearDib', 'close', 'closesocket', 'console',
|
| 226 |
+
'copy_file', 'create', 'create_directory', 'create_thread',
|
| 227 |
+
'curl_easy_cleanup', 'curl_easy_get_file', 'curl_easy_init',
|
| 228 |
+
'curl_easy_perform', 'curl_easy_perform_ex', 'curl_easy_setopt',
|
| 229 |
+
'curl_easy_strerror', 'curl_global_cleanup', 'curl_global_init',
|
| 230 |
+
'curl_slist_append', 'curl_slist_free_all', 'current_dir', 'cursor',
|
| 231 |
+
'define_c_func', 'define_c_proc', 'delete', 'delete_cs', 'delete_file',
|
| 232 |
+
'dir', 'DLL', 'drawDib', 'drawShadedPolygonToDib', 'ELF32', 'ELF64',
|
| 233 |
+
'enter_cs', 'eval', 'exit_thread', 'free', 'file_exists', 'final',
|
| 234 |
+
'float80_to_atom', 'format', 'get_bytes', 'get_file_date',
|
| 235 |
+
'get_file_size', 'get_file_type', 'get_interpreter', 'get_key',
|
| 236 |
+
'get_socket_error', 'get_text', 'get_thread_exitcode', 'get_thread_id',
|
| 237 |
+
'getc', 'getenv', 'gets', 'getsockaddr', 'glBegin', 'glCallList',
|
| 238 |
+
'glFrustum', 'glGenLists', 'glGetString', 'glLight', 'glMaterial',
|
| 239 |
+
'glNewList', 'glNormal', 'glPopMatrix', 'glPushMatrix', 'glRotate',
|
| 240 |
+
'glEnd', 'glEndList', 'glTexImage2D', 'goto', 'GUI', 'icons', 'ilASM',
|
| 241 |
+
'include_files', 'include_paths', 'init_cs', 'ip_to_string',
|
| 242 |
+
'IupConfig', 'IupConfigDialogClosed', 'IupConfigDialogShow',
|
| 243 |
+
'IupConfigGetVariableInt', 'IupConfigLoad', 'IupConfigSave',
|
| 244 |
+
'IupConfigSetVariableInt', 'IupExitLoop', 'IupFileDlg', 'IupFileList',
|
| 245 |
+
'IupGLSwapBuffers', 'IupHelp', 'IupLoopStep', 'IupMainLoop',
|
| 246 |
+
'IupNormalizer', 'IupPlot', 'IupPlotAdd', 'IupPlotBegin', 'IupPlotEnd',
|
| 247 |
+
'IupPlotInsert', 'IupSaveImage', 'IupTreeGetUserId', 'IupUser',
|
| 248 |
+
'IupVersion', 'IupVersionDate', 'IupVersionNumber', 'IupVersionShow',
|
| 249 |
+
'killDib', 'leave_cs', 'listen', 'manifest', 'mem_copy', 'mem_set',
|
| 250 |
+
'mpfr_gamma', 'mpfr_printf', 'mpfr_sprintf', 'mpz_export', 'mpz_import',
|
| 251 |
+
'namespace', 'new', 'newDib', 'open', 'open_dll', 'PE32', 'PE64',
|
| 252 |
+
'peek', 'peek_string', 'peek1s', 'peek1u', 'peek2s', 'peek2u', 'peek4s',
|
| 253 |
+
'peek4u', 'peek8s', 'peek8u', 'peekNS', 'peekns', 'peeknu', 'poke',
|
| 254 |
+
'poke2', 'poke4', 'poke8', 'pokeN', 'poke_string', 'poke_wstring',
|
| 255 |
+
'position', 'progress', 'prompt_number', 'prompt_string', 'read_file',
|
| 256 |
+
'read_lines', 'recv', 'resume_thread', 'seek', 'select', 'send',
|
| 257 |
+
'setHandler', 'shutdown', 'sleep', 'SO', 'sockaddr_in', 'socket',
|
| 258 |
+
'split_path', 'suspend_thread', 'system', 'system_exec', 'system_open',
|
| 259 |
+
'system_wait', 'task_clock_start', 'task_clock_stop', 'task_create',
|
| 260 |
+
'task_delay', 'task_list', 'task_schedule', 'task_self', 'task_status',
|
| 261 |
+
'task_suspend', 'task_yield', 'thread_safe_string', 'try_cs',
|
| 262 |
+
'utf8_to_utf16', 'utf16_to_utf8', 'utf16_to_utf32', 'utf32_to_utf16',
|
| 263 |
+
'video_config', 'WSACleanup', 'wait_thread', 'walk_dir', 'where',
|
| 264 |
+
'write_lines', 'wait_key'
|
| 265 |
+
)
|
| 266 |
+
constants = (
|
| 267 |
+
'ANY_QUEUE', 'ASCENDING', 'BLACK', 'BLOCK_CURSOR', 'BLUE',
|
| 268 |
+
'BRIGHT_CYAN', 'BRIGHT_BLUE', 'BRIGHT_GREEN', 'BRIGHT_MAGENTA',
|
| 269 |
+
'BRIGHT_RED', 'BRIGHT_WHITE', 'BROWN', 'C_DWORD', 'C_INT', 'C_POINTER',
|
| 270 |
+
'C_USHORT', 'C_WORD', 'CD_AMBER', 'CD_BLACK', 'CD_BLUE', 'CD_BOLD',
|
| 271 |
+
'CD_BOLD_ITALIC', 'CD_BOX', 'CD_CENTER', 'CD_CIRCLE', 'CD_CLOSED_LINES',
|
| 272 |
+
'CD_CONTINUOUS', 'CD_CUSTOM', 'CD_CYAN', 'CD_DARK_BLUE', 'CD_DARK_CYAN',
|
| 273 |
+
'CD_DARK_GRAY', 'CD_DARK_GREY', 'CD_DARK_GREEN', 'CD_DARK_MAGENTA',
|
| 274 |
+
'CD_DARK_RED', 'CD_DARK_YELLOW', 'CD_DASH_DOT', 'CD_DASH_DOT_DOT',
|
| 275 |
+
'CD_DASHED', 'CD_DBUFFER', 'CD_DEG2RAD', 'CD_DIAMOND', 'CD_DOTTED',
|
| 276 |
+
'CD_EAST', 'CD_EVENODD', 'CD_FILL', 'CD_GL', 'CD_GRAY', 'CD_GREY',
|
| 277 |
+
'CD_GREEN', 'CD_HATCH', 'CD_HOLLOW', 'CD_HOLLOW_BOX',
|
| 278 |
+
'CD_HOLLOW_CIRCLE', 'CD_HOLLOW_DIAMOND', 'CD_INDIGO', 'CD_ITALIC',
|
| 279 |
+
'CD_IUP', 'CD_IUPDBUFFER', 'CD_LIGHT_BLUE', 'CD_LIGHT_GRAY',
|
| 280 |
+
'CD_LIGHT_GREY', 'CD_LIGHT_GREEN', 'CD_LIGHT_PARCHMENT', 'CD_MAGENTA',
|
| 281 |
+
'CD_NAVY', 'CD_NORTH', 'CD_NORTH_EAST', 'CD_NORTH_WEST', 'CD_OLIVE',
|
| 282 |
+
'CD_OPEN_LINES', 'CD_ORANGE', 'CD_PARCHMENT', 'CD_PATTERN',
|
| 283 |
+
'CD_PRINTER', 'CD_PURPLE', 'CD_PLAIN', 'CD_PLUS', 'CD_QUERY',
|
| 284 |
+
'CD_RAD2DEG', 'CD_RED', 'CD_SILVER', 'CD_SOLID', 'CD_SOUTH_EAST',
|
| 285 |
+
'CD_SOUTH_WEST', 'CD_STAR', 'CD_STIPPLE', 'CD_STRIKEOUT',
|
| 286 |
+
'CD_UNDERLINE', 'CD_WEST', 'CD_WHITE', 'CD_WINDING', 'CD_VIOLET',
|
| 287 |
+
'CD_X', 'CD_YELLOW', 'CURLE_OK', 'CURLOPT_MAIL_FROM',
|
| 288 |
+
'CURLOPT_MAIL_RCPT', 'CURLOPT_PASSWORD', 'CURLOPT_READDATA',
|
| 289 |
+
'CURLOPT_READFUNCTION', 'CURLOPT_SSL_VERIFYPEER',
|
| 290 |
+
'CURLOPT_SSL_VERIFYHOST', 'CURLOPT_UPLOAD', 'CURLOPT_URL',
|
| 291 |
+
'CURLOPT_USE_SSL', 'CURLOPT_USERNAME', 'CURLOPT_VERBOSE',
|
| 292 |
+
'CURLOPT_WRITEFUNCTION', 'CURLUSESSL_ALL', 'CYAN', 'D_NAME',
|
| 293 |
+
'D_ATTRIBUTES', 'D_SIZE', 'D_YEAR', 'D_MONTH', 'D_DAY', 'D_HOUR',
|
| 294 |
+
'D_MINUTE', 'D_SECOND', 'D_CREATION', 'D_LASTACCESS', 'D_MODIFICATION',
|
| 295 |
+
'DT_YEAR', 'DT_MONTH', 'DT_DAY', 'DT_HOUR', 'DT_MINUTE', 'DT_SECOND',
|
| 296 |
+
'DT_DOW', 'DT_MSEC', 'DT_DOY', 'DT_GMT', 'EULER', 'E_CODE', 'E_ADDR',
|
| 297 |
+
'E_LINE', 'E_RTN', 'E_NAME', 'E_FILE', 'E_PATH', 'E_USER', 'false',
|
| 298 |
+
'False', 'FALSE', 'FIFO_QUEUE', 'FILETYPE_DIRECTORY', 'FILETYPE_FILE',
|
| 299 |
+
'GET_EOF', 'GET_FAIL', 'GET_IGNORE', 'GET_SUCCESS',
|
| 300 |
+
'GL_AMBIENT_AND_DIFFUSE', 'GL_ARRAY_BUFFER', 'GL_CLAMP',
|
| 301 |
+
'GL_CLAMP_TO_BORDER', 'GL_CLAMP_TO_EDGE', 'GL_COLOR_BUFFER_BIT',
|
| 302 |
+
'GL_COMPILE', 'GL_COMPILE_STATUS', 'GL_CULL_FACE',
|
| 303 |
+
'GL_DEPTH_BUFFER_BIT', 'GL_DEPTH_TEST', 'GL_EXTENSIONS', 'GL_FLAT',
|
| 304 |
+
'GL_FLOAT', 'GL_FRAGMENT_SHADER', 'GL_FRONT', 'GL_LIGHT0',
|
| 305 |
+
'GL_LIGHTING', 'GL_LINEAR', 'GL_LINK_STATUS', 'GL_MODELVIEW',
|
| 306 |
+
'GL_NEAREST', 'GL_NO_ERROR', 'GL_NORMALIZE', 'GL_POSITION',
|
| 307 |
+
'GL_PROJECTION', 'GL_QUAD_STRIP', 'GL_QUADS', 'GL_RENDERER',
|
| 308 |
+
'GL_REPEAT', 'GL_RGB', 'GL_RGBA', 'GL_SMOOTH', 'GL_STATIC_DRAW',
|
| 309 |
+
'GL_TEXTURE_2D', 'GL_TEXTURE_MAG_FILTER', 'GL_TEXTURE_MIN_FILTER',
|
| 310 |
+
'GL_TEXTURE_WRAP_S', 'GL_TEXTURE_WRAP_T', 'GL_TRIANGLES',
|
| 311 |
+
'GL_UNSIGNED_BYTE', 'GL_VENDOR', 'GL_VERSION', 'GL_VERTEX_SHADER',
|
| 312 |
+
'GRAY', 'GREEN', 'GT_LF_STRIPPED', 'GT_WHOLE_FILE', 'INVLN10',
|
| 313 |
+
'IUP_CLOSE', 'IUP_CONTINUE', 'IUP_DEFAULT', 'IUP_BLACK', 'IUP_BLUE',
|
| 314 |
+
'IUP_BUTTON1', 'IUP_BUTTON3', 'IUP_CENTER', 'IUP_CYAN', 'IUP_DARK_BLUE',
|
| 315 |
+
'IUP_DARK_CYAN', 'IUP_DARK_GRAY', 'IUP_DARK_GREY', 'IUP_DARK_GREEN',
|
| 316 |
+
'IUP_DARK_MAGENTA', 'IUP_DARK_RED', 'IUP_GRAY', 'IUP_GREY', 'IUP_GREEN',
|
| 317 |
+
'IUP_IGNORE', 'IUP_INDIGO', 'IUP_MAGENTA', 'IUP_MASK_INT',
|
| 318 |
+
'IUP_MASK_UINT', 'IUP_MOUSEPOS', 'IUP_NAVY', 'IUP_OLIVE', 'IUP_RECTEXT',
|
| 319 |
+
'IUP_RED', 'IUP_LIGHT_BLUE', 'IUP_LIGHT_GRAY', 'IUP_LIGHT_GREY',
|
| 320 |
+
'IUP_LIGHT_GREEN', 'IUP_ORANGE', 'IUP_PARCHMENT', 'IUP_PURPLE',
|
| 321 |
+
'IUP_SILVER', 'IUP_TEAL', 'IUP_VIOLET', 'IUP_WHITE', 'IUP_YELLOW',
|
| 322 |
+
'K_BS', 'K_cA', 'K_cC', 'K_cD', 'K_cF5', 'K_cK', 'K_cM', 'K_cN', 'K_cO',
|
| 323 |
+
'K_cP', 'K_cR', 'K_cS', 'K_cT', 'K_cW', 'K_CR', 'K_DEL', 'K_DOWN',
|
| 324 |
+
'K_END', 'K_ESC', 'K_F1', 'K_F2', 'K_F3', 'K_F4', 'K_F5', 'K_F6',
|
| 325 |
+
'K_F7', 'K_F8', 'K_F9', 'K_F10', 'K_F11', 'K_F12', 'K_HOME', 'K_INS',
|
| 326 |
+
'K_LEFT', 'K_MIDDLE', 'K_PGDN', 'K_PGUP', 'K_RIGHT', 'K_SP', 'K_TAB',
|
| 327 |
+
'K_UP', 'K_h', 'K_i', 'K_j', 'K_p', 'K_r', 'K_s', 'JS', 'LIFO_QUEUE',
|
| 328 |
+
'LINUX', 'MAX_HEAP', 'MAGENTA', 'MIN_HEAP', 'Nan', 'NO_CURSOR', 'null',
|
| 329 |
+
'NULL', 'PI', 'pp_Ascii', 'pp_Brkt', 'pp_Date', 'pp_File', 'pp_FltFmt',
|
| 330 |
+
'pp_Indent', 'pp_IntCh', 'pp_IntFmt', 'pp_Maxlen', 'pp_Nest',
|
| 331 |
+
'pp_Pause', 'pp_Q22', 'pp_StrFmt', 'RED', 'SEEK_OK', 'SLASH',
|
| 332 |
+
'TEST_ABORT', 'TEST_CRASH', 'TEST_PAUSE', 'TEST_PAUSE_FAIL',
|
| 333 |
+
'TEST_QUIET', 'TEST_SHOW_ALL', 'TEST_SHOW_FAILED', 'TEST_SUMMARY',
|
| 334 |
+
'true', 'True', 'TRUE', 'VC_SCRNLINES', 'WHITE', 'WINDOWS', 'YELLOW'
|
| 335 |
+
)
|
| 336 |
+
|
| 337 |
+
tokens = {
|
| 338 |
+
'root': [
|
| 339 |
+
(r"\s+", Whitespace),
|
| 340 |
+
(r'/\*|--/\*|#\[', Comment.Multiline, 'comment'),
|
| 341 |
+
(r'(?://|--|#!).*$', Comment.Single),
|
| 342 |
+
#Alt:
|
| 343 |
+
# (r'//.*$|--.*$|#!.*$', Comment.Single),
|
| 344 |
+
(r'"([^"\\]|\\.)*"', String.Other),
|
| 345 |
+
(r'\'[^\']*\'', String.Other),
|
| 346 |
+
(r'`[^`]*`', String.Other),
|
| 347 |
+
|
| 348 |
+
(words(types, prefix=r'\b', suffix=r'\b'), Name.Function),
|
| 349 |
+
(words(routines, prefix=r'\b', suffix=r'\b'), Name.Function),
|
| 350 |
+
(words(preproc, prefix=r'\b', suffix=r'\b'), Keyword.Declaration),
|
| 351 |
+
(words(keywords, prefix=r'\b', suffix=r'\b'), Keyword.Declaration),
|
| 352 |
+
(words(constants, prefix=r'\b', suffix=r'\b'), Name.Constant),
|
| 353 |
+
# Aside: Phix only supports/uses the ascii/non-unicode tilde
|
| 354 |
+
(r'!=|==|<<|>>|:=|[-~+/*%=<>&^|\.(){},?:\[\]$\\;#]', Operator),
|
| 355 |
+
(r'[\w-]+', Text)
|
| 356 |
+
],
|
| 357 |
+
'comment': [
|
| 358 |
+
(r'[^*/#]+', Comment.Multiline),
|
| 359 |
+
(r'/\*|#\[', Comment.Multiline, '#push'),
|
| 360 |
+
(r'\*/|#\]', Comment.Multiline, '#pop'),
|
| 361 |
+
(r'[*/#]', Comment.Multiline)
|
| 362 |
+
]
|
| 363 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/php.py
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.php
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for PHP and related languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import Lexer, RegexLexer, include, bygroups, default, \
|
| 14 |
+
using, this, words, do_insertions, line_re
|
| 15 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 16 |
+
Number, Punctuation, Other, Generic
|
| 17 |
+
from pygments.util import get_bool_opt, get_list_opt, shebang_matches
|
| 18 |
+
|
| 19 |
+
__all__ = ['ZephirLexer', 'PsyshConsoleLexer', 'PhpLexer']
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class ZephirLexer(RegexLexer):
|
| 23 |
+
"""
|
| 24 |
+
For Zephir language source code.
|
| 25 |
+
|
| 26 |
+
Zephir is a compiled high level language aimed
|
| 27 |
+
to the creation of C-extensions for PHP.
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
+
name = 'Zephir'
|
| 31 |
+
url = 'http://zephir-lang.com/'
|
| 32 |
+
aliases = ['zephir']
|
| 33 |
+
filenames = ['*.zep']
|
| 34 |
+
version_added = '2.0'
|
| 35 |
+
|
| 36 |
+
zephir_keywords = ['fetch', 'echo', 'isset', 'empty']
|
| 37 |
+
zephir_type = ['bit', 'bits', 'string']
|
| 38 |
+
|
| 39 |
+
flags = re.DOTALL | re.MULTILINE
|
| 40 |
+
|
| 41 |
+
tokens = {
|
| 42 |
+
'commentsandwhitespace': [
|
| 43 |
+
(r'\s+', Text),
|
| 44 |
+
(r'//.*?\n', Comment.Single),
|
| 45 |
+
(r'/\*.*?\*/', Comment.Multiline)
|
| 46 |
+
],
|
| 47 |
+
'slashstartsregex': [
|
| 48 |
+
include('commentsandwhitespace'),
|
| 49 |
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
| 50 |
+
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
| 51 |
+
(r'/', Operator, '#pop'),
|
| 52 |
+
default('#pop')
|
| 53 |
+
],
|
| 54 |
+
'badregex': [
|
| 55 |
+
(r'\n', Text, '#pop')
|
| 56 |
+
],
|
| 57 |
+
'root': [
|
| 58 |
+
(r'^(?=\s|/)', Text, 'slashstartsregex'),
|
| 59 |
+
include('commentsandwhitespace'),
|
| 60 |
+
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|'
|
| 61 |
+
r'(<<|>>>?|==?|!=?|->|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
|
| 62 |
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
| 63 |
+
(r'[})\].]', Punctuation),
|
| 64 |
+
(r'(for|in|while|do|break|return|continue|switch|case|default|if|else|loop|'
|
| 65 |
+
r'require|inline|throw|try|catch|finally|new|delete|typeof|instanceof|void|'
|
| 66 |
+
r'namespace|use|extends|this|fetch|isset|unset|echo|fetch|likely|unlikely|'
|
| 67 |
+
r'empty)\b', Keyword, 'slashstartsregex'),
|
| 68 |
+
(r'(var|let|with|function)\b', Keyword.Declaration, 'slashstartsregex'),
|
| 69 |
+
(r'(abstract|boolean|bool|char|class|const|double|enum|export|extends|final|'
|
| 70 |
+
r'native|goto|implements|import|int|string|interface|long|ulong|char|uchar|'
|
| 71 |
+
r'float|unsigned|private|protected|public|short|static|self|throws|reverse|'
|
| 72 |
+
r'transient|volatile|readonly)\b', Keyword.Reserved),
|
| 73 |
+
(r'(true|false|null|undefined)\b', Keyword.Constant),
|
| 74 |
+
(r'(Array|Boolean|Date|_REQUEST|_COOKIE|_SESSION|'
|
| 75 |
+
r'_GET|_POST|_SERVER|this|stdClass|range|count|iterator|'
|
| 76 |
+
r'window)\b', Name.Builtin),
|
| 77 |
+
(r'[$a-zA-Z_][\w\\]*', Name.Other),
|
| 78 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 79 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 80 |
+
(r'[0-9]+', Number.Integer),
|
| 81 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
|
| 82 |
+
(r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
|
| 83 |
+
]
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
class PsyshConsoleLexer(Lexer):
|
| 88 |
+
"""
|
| 89 |
+
For PsySH console output, such as:
|
| 90 |
+
|
| 91 |
+
.. sourcecode:: psysh
|
| 92 |
+
|
| 93 |
+
>>> $greeting = function($name): string {
|
| 94 |
+
... return "Hello, {$name}";
|
| 95 |
+
... };
|
| 96 |
+
=> Closure($name): string {#2371 …3}
|
| 97 |
+
>>> $greeting('World')
|
| 98 |
+
=> "Hello, World"
|
| 99 |
+
"""
|
| 100 |
+
name = 'PsySH console session for PHP'
|
| 101 |
+
url = 'https://psysh.org/'
|
| 102 |
+
aliases = ['psysh']
|
| 103 |
+
version_added = '2.7'
|
| 104 |
+
|
| 105 |
+
def __init__(self, **options):
|
| 106 |
+
options['startinline'] = True
|
| 107 |
+
Lexer.__init__(self, **options)
|
| 108 |
+
|
| 109 |
+
def get_tokens_unprocessed(self, text):
|
| 110 |
+
phplexer = PhpLexer(**self.options)
|
| 111 |
+
curcode = ''
|
| 112 |
+
insertions = []
|
| 113 |
+
for match in line_re.finditer(text):
|
| 114 |
+
line = match.group()
|
| 115 |
+
if line.startswith('>>> ') or line.startswith('... '):
|
| 116 |
+
insertions.append((len(curcode),
|
| 117 |
+
[(0, Generic.Prompt, line[:4])]))
|
| 118 |
+
curcode += line[4:]
|
| 119 |
+
elif line.rstrip() == '...':
|
| 120 |
+
insertions.append((len(curcode),
|
| 121 |
+
[(0, Generic.Prompt, '...')]))
|
| 122 |
+
curcode += line[3:]
|
| 123 |
+
else:
|
| 124 |
+
if curcode:
|
| 125 |
+
yield from do_insertions(
|
| 126 |
+
insertions, phplexer.get_tokens_unprocessed(curcode))
|
| 127 |
+
curcode = ''
|
| 128 |
+
insertions = []
|
| 129 |
+
yield match.start(), Generic.Output, line
|
| 130 |
+
if curcode:
|
| 131 |
+
yield from do_insertions(insertions,
|
| 132 |
+
phplexer.get_tokens_unprocessed(curcode))
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
class PhpLexer(RegexLexer):
|
| 136 |
+
"""
|
| 137 |
+
For PHP source code.
|
| 138 |
+
For PHP embedded in HTML, use the `HtmlPhpLexer`.
|
| 139 |
+
|
| 140 |
+
Additional options accepted:
|
| 141 |
+
|
| 142 |
+
`startinline`
|
| 143 |
+
If given and ``True`` the lexer starts highlighting with
|
| 144 |
+
php code (i.e.: no starting ``<?php`` required). The default
|
| 145 |
+
is ``False``.
|
| 146 |
+
`funcnamehighlighting`
|
| 147 |
+
If given and ``True``, highlight builtin function names
|
| 148 |
+
(default: ``True``).
|
| 149 |
+
`disabledmodules`
|
| 150 |
+
If given, must be a list of module names whose function names
|
| 151 |
+
should not be highlighted. By default all modules are highlighted
|
| 152 |
+
except the special ``'unknown'`` module that includes functions
|
| 153 |
+
that are known to php but are undocumented.
|
| 154 |
+
|
| 155 |
+
To get a list of allowed modules have a look into the
|
| 156 |
+
`_php_builtins` module:
|
| 157 |
+
|
| 158 |
+
.. sourcecode:: pycon
|
| 159 |
+
|
| 160 |
+
>>> from pygments.lexers._php_builtins import MODULES
|
| 161 |
+
>>> MODULES.keys()
|
| 162 |
+
['PHP Options/Info', 'Zip', 'dba', ...]
|
| 163 |
+
|
| 164 |
+
In fact the names of those modules match the module names from
|
| 165 |
+
the php documentation.
|
| 166 |
+
"""
|
| 167 |
+
|
| 168 |
+
name = 'PHP'
|
| 169 |
+
url = 'https://www.php.net/'
|
| 170 |
+
aliases = ['php', 'php3', 'php4', 'php5']
|
| 171 |
+
filenames = ['*.php', '*.php[345]', '*.inc']
|
| 172 |
+
mimetypes = ['text/x-php']
|
| 173 |
+
version_added = ''
|
| 174 |
+
|
| 175 |
+
# Note that a backslash is included, PHP uses a backslash as a namespace
|
| 176 |
+
# separator.
|
| 177 |
+
_ident_inner = r'(?:[\\_a-z]|[^\x00-\x7f])(?:[\\\w]|[^\x00-\x7f])*'
|
| 178 |
+
# But not inside strings.
|
| 179 |
+
_ident_nons = r'(?:[_a-z]|[^\x00-\x7f])(?:\w|[^\x00-\x7f])*'
|
| 180 |
+
|
| 181 |
+
flags = re.IGNORECASE | re.DOTALL | re.MULTILINE
|
| 182 |
+
tokens = {
|
| 183 |
+
'root': [
|
| 184 |
+
(r'<\?(php)?', Comment.Preproc, 'php'),
|
| 185 |
+
(r'[^<]+', Other),
|
| 186 |
+
(r'<', Other)
|
| 187 |
+
],
|
| 188 |
+
'php': [
|
| 189 |
+
(r'\?>', Comment.Preproc, '#pop'),
|
| 190 |
+
(r'(<<<)([\'"]?)(' + _ident_nons + r')(\2\n.*?\n\s*)(\3)(;?)(\n)',
|
| 191 |
+
bygroups(String, String, String.Delimiter, String, String.Delimiter,
|
| 192 |
+
Punctuation, Text)),
|
| 193 |
+
(r'\s+', Text),
|
| 194 |
+
(r'#\[', Punctuation, 'attribute'),
|
| 195 |
+
(r'#.*?\n', Comment.Single),
|
| 196 |
+
(r'//.*?\n', Comment.Single),
|
| 197 |
+
# put the empty comment here, it is otherwise seen as
|
| 198 |
+
# the start of a docstring
|
| 199 |
+
(r'/\*\*/', Comment.Multiline),
|
| 200 |
+
(r'/\*\*.*?\*/', String.Doc),
|
| 201 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 202 |
+
(r'(->|::)(\s*)(' + _ident_nons + ')',
|
| 203 |
+
bygroups(Operator, Text, Name.Attribute)),
|
| 204 |
+
(r'[~!%^&*+=|:.<>/@-]+', Operator),
|
| 205 |
+
(r'\?', Operator), # don't add to the charclass above!
|
| 206 |
+
(r'[\[\]{}();,]+', Punctuation),
|
| 207 |
+
(r'(new)(\s+)(class)\b', bygroups(Keyword, Text, Keyword)),
|
| 208 |
+
(r'(class)(\s+)', bygroups(Keyword, Text), 'classname'),
|
| 209 |
+
(r'(function)(\s*)(?=\()', bygroups(Keyword, Text)),
|
| 210 |
+
(r'(function)(\s+)(&?)(\s*)',
|
| 211 |
+
bygroups(Keyword, Text, Operator, Text), 'functionname'),
|
| 212 |
+
(r'(const)(\s+)(' + _ident_inner + ')',
|
| 213 |
+
bygroups(Keyword, Text, Name.Constant)),
|
| 214 |
+
(r'(and|E_PARSE|old_function|E_ERROR|or|as|E_WARNING|parent|'
|
| 215 |
+
r'eval|PHP_OS|break|exit|case|extends|PHP_VERSION|cfunction|'
|
| 216 |
+
r'FALSE|print|for|require|continue|foreach|require_once|'
|
| 217 |
+
r'declare|return|default|static|do|switch|die|stdClass|'
|
| 218 |
+
r'echo|else|TRUE|elseif|var|empty|if|xor|enddeclare|include|'
|
| 219 |
+
r'virtual|endfor|include_once|while|endforeach|global|'
|
| 220 |
+
r'endif|list|endswitch|new|endwhile|not|'
|
| 221 |
+
r'array|E_ALL|NULL|final|php_user_filter|interface|'
|
| 222 |
+
r'implements|public|private|protected|abstract|clone|try|'
|
| 223 |
+
r'catch|throw|this|use|namespace|trait|yield|'
|
| 224 |
+
r'finally|match)\b', Keyword),
|
| 225 |
+
(r'(true|false|null)\b', Keyword.Constant),
|
| 226 |
+
include('magicconstants'),
|
| 227 |
+
(r'\$\{', Name.Variable, 'variablevariable'),
|
| 228 |
+
(r'\$+' + _ident_inner, Name.Variable),
|
| 229 |
+
(_ident_inner, Name.Other),
|
| 230 |
+
(r'(\d+\.\d*|\d*\.\d+)(e[+-]?[0-9]+)?', Number.Float),
|
| 231 |
+
(r'\d+e[+-]?[0-9]+', Number.Float),
|
| 232 |
+
(r'0[0-7]+', Number.Oct),
|
| 233 |
+
(r'0x[a-f0-9]+', Number.Hex),
|
| 234 |
+
(r'\d+', Number.Integer),
|
| 235 |
+
(r'0b[01]+', Number.Bin),
|
| 236 |
+
(r"'([^'\\]*(?:\\.[^'\\]*)*)'", String.Single),
|
| 237 |
+
(r'`([^`\\]*(?:\\.[^`\\]*)*)`', String.Backtick),
|
| 238 |
+
(r'"', String.Double, 'string'),
|
| 239 |
+
],
|
| 240 |
+
'variablevariable': [
|
| 241 |
+
(r'\}', Name.Variable, '#pop'),
|
| 242 |
+
include('php')
|
| 243 |
+
],
|
| 244 |
+
'magicfuncs': [
|
| 245 |
+
# source: http://php.net/manual/en/language.oop5.magic.php
|
| 246 |
+
(words((
|
| 247 |
+
'__construct', '__destruct', '__call', '__callStatic', '__get', '__set',
|
| 248 |
+
'__isset', '__unset', '__sleep', '__wakeup', '__toString', '__invoke',
|
| 249 |
+
'__set_state', '__clone', '__debugInfo',), suffix=r'\b'),
|
| 250 |
+
Name.Function.Magic),
|
| 251 |
+
],
|
| 252 |
+
'magicconstants': [
|
| 253 |
+
# source: http://php.net/manual/en/language.constants.predefined.php
|
| 254 |
+
(words((
|
| 255 |
+
'__LINE__', '__FILE__', '__DIR__', '__FUNCTION__', '__CLASS__',
|
| 256 |
+
'__TRAIT__', '__METHOD__', '__NAMESPACE__',),
|
| 257 |
+
suffix=r'\b'),
|
| 258 |
+
Name.Constant),
|
| 259 |
+
],
|
| 260 |
+
'classname': [
|
| 261 |
+
(_ident_inner, Name.Class, '#pop')
|
| 262 |
+
],
|
| 263 |
+
'functionname': [
|
| 264 |
+
include('magicfuncs'),
|
| 265 |
+
(_ident_inner, Name.Function, '#pop'),
|
| 266 |
+
default('#pop')
|
| 267 |
+
],
|
| 268 |
+
'string': [
|
| 269 |
+
(r'"', String.Double, '#pop'),
|
| 270 |
+
(r'[^{$"\\]+', String.Double),
|
| 271 |
+
(r'\\([nrt"$\\]|[0-7]{1,3}|x[0-9a-f]{1,2})', String.Escape),
|
| 272 |
+
(r'\$' + _ident_nons + r'(\[\S+?\]|->' + _ident_nons + ')?',
|
| 273 |
+
String.Interpol),
|
| 274 |
+
(r'(\{\$\{)(.*?)(\}\})',
|
| 275 |
+
bygroups(String.Interpol, using(this, _startinline=True),
|
| 276 |
+
String.Interpol)),
|
| 277 |
+
(r'(\{)(\$.*?)(\})',
|
| 278 |
+
bygroups(String.Interpol, using(this, _startinline=True),
|
| 279 |
+
String.Interpol)),
|
| 280 |
+
(r'(\$\{)(\S+)(\})',
|
| 281 |
+
bygroups(String.Interpol, Name.Variable, String.Interpol)),
|
| 282 |
+
(r'[${\\]', String.Double)
|
| 283 |
+
],
|
| 284 |
+
'attribute': [
|
| 285 |
+
(r'\]', Punctuation, '#pop'),
|
| 286 |
+
(r'\(', Punctuation, 'attributeparams'),
|
| 287 |
+
(_ident_inner, Name.Decorator),
|
| 288 |
+
include('php')
|
| 289 |
+
],
|
| 290 |
+
'attributeparams': [
|
| 291 |
+
(r'\)', Punctuation, '#pop'),
|
| 292 |
+
include('php')
|
| 293 |
+
],
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
def __init__(self, **options):
|
| 297 |
+
self.funcnamehighlighting = get_bool_opt(
|
| 298 |
+
options, 'funcnamehighlighting', True)
|
| 299 |
+
self.disabledmodules = get_list_opt(
|
| 300 |
+
options, 'disabledmodules', ['unknown'])
|
| 301 |
+
self.startinline = get_bool_opt(options, 'startinline', False)
|
| 302 |
+
|
| 303 |
+
# private option argument for the lexer itself
|
| 304 |
+
if '_startinline' in options:
|
| 305 |
+
self.startinline = options.pop('_startinline')
|
| 306 |
+
|
| 307 |
+
# collect activated functions in a set
|
| 308 |
+
self._functions = set()
|
| 309 |
+
if self.funcnamehighlighting:
|
| 310 |
+
from pygments.lexers._php_builtins import MODULES
|
| 311 |
+
for key, value in MODULES.items():
|
| 312 |
+
if key not in self.disabledmodules:
|
| 313 |
+
self._functions.update(value)
|
| 314 |
+
RegexLexer.__init__(self, **options)
|
| 315 |
+
|
| 316 |
+
def get_tokens_unprocessed(self, text):
|
| 317 |
+
stack = ['root']
|
| 318 |
+
if self.startinline:
|
| 319 |
+
stack.append('php')
|
| 320 |
+
for index, token, value in \
|
| 321 |
+
RegexLexer.get_tokens_unprocessed(self, text, stack):
|
| 322 |
+
if token is Name.Other:
|
| 323 |
+
if value in self._functions:
|
| 324 |
+
yield index, Name.Builtin, value
|
| 325 |
+
continue
|
| 326 |
+
yield index, token, value
|
| 327 |
+
|
| 328 |
+
def analyse_text(text):
|
| 329 |
+
if shebang_matches(text, r'php'):
|
| 330 |
+
return True
|
| 331 |
+
rv = 0.0
|
| 332 |
+
if re.search(r'<\?(?!xml)', text):
|
| 333 |
+
rv += 0.3
|
| 334 |
+
return rv
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/pointless.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.pointless
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for Pointless.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from pygments.lexer import RegexLexer, words
|
| 12 |
+
from pygments.token import Comment, Error, Keyword, Name, Number, Operator, \
|
| 13 |
+
Punctuation, String, Text
|
| 14 |
+
|
| 15 |
+
__all__ = ['PointlessLexer']
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class PointlessLexer(RegexLexer):
|
| 19 |
+
"""
|
| 20 |
+
For Pointless source code.
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
name = 'Pointless'
|
| 24 |
+
url = 'https://ptls.dev'
|
| 25 |
+
aliases = ['pointless']
|
| 26 |
+
filenames = ['*.ptls']
|
| 27 |
+
version_added = '2.7'
|
| 28 |
+
|
| 29 |
+
ops = words([
|
| 30 |
+
"+", "-", "*", "/", "**", "%", "+=", "-=", "*=",
|
| 31 |
+
"/=", "**=", "%=", "|>", "=", "==", "!=", "<", ">",
|
| 32 |
+
"<=", ">=", "=>", "$", "++",
|
| 33 |
+
])
|
| 34 |
+
|
| 35 |
+
keywords = words([
|
| 36 |
+
"if", "then", "else", "where", "with", "cond",
|
| 37 |
+
"case", "and", "or", "not", "in", "as", "for",
|
| 38 |
+
"requires", "throw", "try", "catch", "when",
|
| 39 |
+
"yield", "upval",
|
| 40 |
+
], suffix=r'\b')
|
| 41 |
+
|
| 42 |
+
tokens = {
|
| 43 |
+
'root': [
|
| 44 |
+
(r'[ \n\r]+', Text),
|
| 45 |
+
(r'--.*$', Comment.Single),
|
| 46 |
+
(r'"""', String, 'multiString'),
|
| 47 |
+
(r'"', String, 'string'),
|
| 48 |
+
(r'[\[\](){}:;,.]', Punctuation),
|
| 49 |
+
(ops, Operator),
|
| 50 |
+
(keywords, Keyword),
|
| 51 |
+
(r'\d+|\d*\.\d+', Number),
|
| 52 |
+
(r'(true|false)\b', Name.Builtin),
|
| 53 |
+
(r'[A-Z][a-zA-Z0-9]*\b', String.Symbol),
|
| 54 |
+
(r'output\b', Name.Variable.Magic),
|
| 55 |
+
(r'(export|import)\b', Keyword.Namespace),
|
| 56 |
+
(r'[a-z][a-zA-Z0-9]*\b', Name.Variable)
|
| 57 |
+
],
|
| 58 |
+
'multiString': [
|
| 59 |
+
(r'\\.', String.Escape),
|
| 60 |
+
(r'"""', String, '#pop'),
|
| 61 |
+
(r'"', String),
|
| 62 |
+
(r'[^\\"]+', String),
|
| 63 |
+
],
|
| 64 |
+
'string': [
|
| 65 |
+
(r'\\.', String.Escape),
|
| 66 |
+
(r'"', String, '#pop'),
|
| 67 |
+
(r'\n', Error),
|
| 68 |
+
(r'[^\\"]+', String),
|
| 69 |
+
],
|
| 70 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/pony.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.pony
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for Pony and related languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from pygments.lexer import RegexLexer, bygroups, words
|
| 12 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 13 |
+
Number, Punctuation
|
| 14 |
+
|
| 15 |
+
__all__ = ['PonyLexer']
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class PonyLexer(RegexLexer):
|
| 19 |
+
"""
|
| 20 |
+
For Pony source code.
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
name = 'Pony'
|
| 24 |
+
aliases = ['pony']
|
| 25 |
+
filenames = ['*.pony']
|
| 26 |
+
url = 'https://www.ponylang.io'
|
| 27 |
+
version_added = '2.4'
|
| 28 |
+
|
| 29 |
+
_caps = r'(iso|trn|ref|val|box|tag)'
|
| 30 |
+
|
| 31 |
+
tokens = {
|
| 32 |
+
'root': [
|
| 33 |
+
(r'\n', Text),
|
| 34 |
+
(r'[^\S\n]+', Text),
|
| 35 |
+
(r'//.*\n', Comment.Single),
|
| 36 |
+
(r'/\*', Comment.Multiline, 'nested_comment'),
|
| 37 |
+
(r'"""(?:.|\n)*?"""', String.Doc),
|
| 38 |
+
(r'"', String, 'string'),
|
| 39 |
+
(r'\'.*\'', String.Char),
|
| 40 |
+
(r'=>|[]{}:().~;,|&!^?[]', Punctuation),
|
| 41 |
+
(words((
|
| 42 |
+
'addressof', 'and', 'as', 'consume', 'digestof', 'is', 'isnt',
|
| 43 |
+
'not', 'or'),
|
| 44 |
+
suffix=r'\b'),
|
| 45 |
+
Operator.Word),
|
| 46 |
+
(r'!=|==|<<|>>|[-+/*%=<>]', Operator),
|
| 47 |
+
(words((
|
| 48 |
+
'box', 'break', 'compile_error', 'compile_intrinsic',
|
| 49 |
+
'continue', 'do', 'else', 'elseif', 'embed', 'end', 'error',
|
| 50 |
+
'for', 'if', 'ifdef', 'in', 'iso', 'lambda', 'let', 'match',
|
| 51 |
+
'object', 'recover', 'ref', 'repeat', 'return', 'tag', 'then',
|
| 52 |
+
'this', 'trn', 'try', 'until', 'use', 'var', 'val', 'where',
|
| 53 |
+
'while', 'with', '#any', '#read', '#send', '#share'),
|
| 54 |
+
suffix=r'\b'),
|
| 55 |
+
Keyword),
|
| 56 |
+
(r'(actor|class|struct|primitive|interface|trait|type)((?:\s)+)',
|
| 57 |
+
bygroups(Keyword, Text), 'typename'),
|
| 58 |
+
(r'(new|fun|be)((?:\s)+)', bygroups(Keyword, Text), 'methodname'),
|
| 59 |
+
(words((
|
| 60 |
+
'I8', 'U8', 'I16', 'U16', 'I32', 'U32', 'I64', 'U64', 'I128',
|
| 61 |
+
'U128', 'ILong', 'ULong', 'ISize', 'USize', 'F32', 'F64',
|
| 62 |
+
'Bool', 'Pointer', 'None', 'Any', 'Array', 'String',
|
| 63 |
+
'Iterator'),
|
| 64 |
+
suffix=r'\b'),
|
| 65 |
+
Name.Builtin.Type),
|
| 66 |
+
(r'_?[A-Z]\w*', Name.Type),
|
| 67 |
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+', Number.Float),
|
| 68 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 69 |
+
(r'\d+', Number.Integer),
|
| 70 |
+
(r'(true|false)\b', Name.Builtin),
|
| 71 |
+
(r'_\d*', Name),
|
| 72 |
+
(r'_?[a-z][\w\']*', Name)
|
| 73 |
+
],
|
| 74 |
+
'typename': [
|
| 75 |
+
(_caps + r'?((?:\s)*)(_?[A-Z]\w*)',
|
| 76 |
+
bygroups(Keyword, Text, Name.Class), '#pop')
|
| 77 |
+
],
|
| 78 |
+
'methodname': [
|
| 79 |
+
(_caps + r'?((?:\s)*)(_?[a-z]\w*)',
|
| 80 |
+
bygroups(Keyword, Text, Name.Function), '#pop')
|
| 81 |
+
],
|
| 82 |
+
'nested_comment': [
|
| 83 |
+
(r'[^*/]+', Comment.Multiline),
|
| 84 |
+
(r'/\*', Comment.Multiline, '#push'),
|
| 85 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 86 |
+
(r'[*/]', Comment.Multiline)
|
| 87 |
+
],
|
| 88 |
+
'string': [
|
| 89 |
+
(r'"', String, '#pop'),
|
| 90 |
+
(r'\\"', String),
|
| 91 |
+
(r'[^\\"]+', String)
|
| 92 |
+
]
|
| 93 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/praat.py
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.praat
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for Praat
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from pygments.lexer import RegexLexer, words, bygroups, include
|
| 12 |
+
from pygments.token import Name, Text, Comment, Keyword, String, Punctuation, \
|
| 13 |
+
Number, Operator, Whitespace
|
| 14 |
+
|
| 15 |
+
__all__ = ['PraatLexer']
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class PraatLexer(RegexLexer):
|
| 19 |
+
"""
|
| 20 |
+
For Praat scripts.
|
| 21 |
+
"""
|
| 22 |
+
|
| 23 |
+
name = 'Praat'
|
| 24 |
+
url = 'http://www.praat.org'
|
| 25 |
+
aliases = ['praat']
|
| 26 |
+
filenames = ['*.praat', '*.proc', '*.psc']
|
| 27 |
+
version_added = '2.1'
|
| 28 |
+
|
| 29 |
+
keywords = (
|
| 30 |
+
'if', 'then', 'else', 'elsif', 'elif', 'endif', 'fi', 'for', 'from', 'to',
|
| 31 |
+
'endfor', 'endproc', 'while', 'endwhile', 'repeat', 'until', 'select', 'plus',
|
| 32 |
+
'minus', 'demo', 'assert', 'stopwatch', 'nocheck', 'nowarn', 'noprogress',
|
| 33 |
+
'editor', 'endeditor', 'clearinfo',
|
| 34 |
+
)
|
| 35 |
+
|
| 36 |
+
functions_string = (
|
| 37 |
+
'backslashTrigraphsToUnicode', 'chooseDirectory', 'chooseReadFile',
|
| 38 |
+
'chooseWriteFile', 'date', 'demoKey', 'do', 'environment', 'extractLine',
|
| 39 |
+
'extractWord', 'fixed', 'info', 'left', 'mid', 'percent', 'readFile', 'replace',
|
| 40 |
+
'replace_regex', 'right', 'selected', 'string', 'unicodeToBackslashTrigraphs',
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
functions_numeric = (
|
| 44 |
+
'abs', 'appendFile', 'appendFileLine', 'appendInfo', 'appendInfoLine', 'arccos',
|
| 45 |
+
'arccosh', 'arcsin', 'arcsinh', 'arctan', 'arctan2', 'arctanh', 'barkToHertz',
|
| 46 |
+
'beginPause', 'beginSendPraat', 'besselI', 'besselK', 'beta', 'beta2',
|
| 47 |
+
'binomialP', 'binomialQ', 'boolean', 'ceiling', 'chiSquareP', 'chiSquareQ',
|
| 48 |
+
'choice', 'comment', 'cos', 'cosh', 'createDirectory', 'deleteFile',
|
| 49 |
+
'demoClicked', 'demoClickedIn', 'demoCommandKeyPressed',
|
| 50 |
+
'demoExtraControlKeyPressed', 'demoInput', 'demoKeyPressed',
|
| 51 |
+
'demoOptionKeyPressed', 'demoShiftKeyPressed', 'demoShow', 'demoWaitForInput',
|
| 52 |
+
'demoWindowTitle', 'demoX', 'demoY', 'differenceLimensToPhon', 'do', 'editor',
|
| 53 |
+
'endPause', 'endSendPraat', 'endsWith', 'erb', 'erbToHertz', 'erf', 'erfc',
|
| 54 |
+
'exitScript', 'exp', 'extractNumber', 'fileReadable', 'fisherP', 'fisherQ',
|
| 55 |
+
'floor', 'gaussP', 'gaussQ', 'hertzToBark', 'hertzToErb', 'hertzToMel',
|
| 56 |
+
'hertzToSemitones', 'imax', 'imin', 'incompleteBeta', 'incompleteGammaP', 'index',
|
| 57 |
+
'index_regex', 'integer', 'invBinomialP', 'invBinomialQ', 'invChiSquareQ', 'invFisherQ',
|
| 58 |
+
'invGaussQ', 'invSigmoid', 'invStudentQ', 'length', 'ln', 'lnBeta', 'lnGamma',
|
| 59 |
+
'log10', 'log2', 'max', 'melToHertz', 'min', 'minusObject', 'natural', 'number',
|
| 60 |
+
'numberOfColumns', 'numberOfRows', 'numberOfSelected', 'objectsAreIdentical',
|
| 61 |
+
'option', 'optionMenu', 'pauseScript', 'phonToDifferenceLimens', 'plusObject',
|
| 62 |
+
'positive', 'randomBinomial', 'randomGauss', 'randomInteger', 'randomPoisson',
|
| 63 |
+
'randomUniform', 'real', 'readFile', 'removeObject', 'rindex', 'rindex_regex',
|
| 64 |
+
'round', 'runScript', 'runSystem', 'runSystem_nocheck', 'selectObject',
|
| 65 |
+
'selected', 'semitonesToHertz', 'sentence', 'sentencetext', 'sigmoid', 'sin', 'sinc',
|
| 66 |
+
'sincpi', 'sinh', 'soundPressureToPhon', 'sqrt', 'startsWith', 'studentP',
|
| 67 |
+
'studentQ', 'tan', 'tanh', 'text', 'variableExists', 'word', 'writeFile', 'writeFileLine',
|
| 68 |
+
'writeInfo', 'writeInfoLine',
|
| 69 |
+
)
|
| 70 |
+
|
| 71 |
+
functions_array = (
|
| 72 |
+
'linear', 'randomGauss', 'randomInteger', 'randomUniform', 'zero',
|
| 73 |
+
)
|
| 74 |
+
|
| 75 |
+
objects = (
|
| 76 |
+
'Activation', 'AffineTransform', 'AmplitudeTier', 'Art', 'Artword',
|
| 77 |
+
'Autosegment', 'BarkFilter', 'BarkSpectrogram', 'CCA', 'Categories',
|
| 78 |
+
'Cepstrogram', 'Cepstrum', 'Cepstrumc', 'ChebyshevSeries', 'ClassificationTable',
|
| 79 |
+
'Cochleagram', 'Collection', 'ComplexSpectrogram', 'Configuration', 'Confusion',
|
| 80 |
+
'ContingencyTable', 'Corpus', 'Correlation', 'Covariance',
|
| 81 |
+
'CrossCorrelationTable', 'CrossCorrelationTables', 'DTW', 'DataModeler',
|
| 82 |
+
'Diagonalizer', 'Discriminant', 'Dissimilarity', 'Distance', 'Distributions',
|
| 83 |
+
'DurationTier', 'EEG', 'ERP', 'ERPTier', 'EditCostsTable', 'EditDistanceTable',
|
| 84 |
+
'Eigen', 'Excitation', 'Excitations', 'ExperimentMFC', 'FFNet', 'FeatureWeights',
|
| 85 |
+
'FileInMemory', 'FilesInMemory', 'Formant', 'FormantFilter', 'FormantGrid',
|
| 86 |
+
'FormantModeler', 'FormantPoint', 'FormantTier', 'GaussianMixture', 'HMM',
|
| 87 |
+
'HMM_Observation', 'HMM_ObservationSequence', 'HMM_State', 'HMM_StateSequence',
|
| 88 |
+
'Harmonicity', 'ISpline', 'Index', 'Intensity', 'IntensityTier', 'IntervalTier',
|
| 89 |
+
'KNN', 'KlattGrid', 'KlattTable', 'LFCC', 'LPC', 'Label', 'LegendreSeries',
|
| 90 |
+
'LinearRegression', 'LogisticRegression', 'LongSound', 'Ltas', 'MFCC', 'MSpline',
|
| 91 |
+
'ManPages', 'Manipulation', 'Matrix', 'MelFilter', 'MelSpectrogram',
|
| 92 |
+
'MixingMatrix', 'Movie', 'Network', 'Object', 'OTGrammar', 'OTHistory', 'OTMulti',
|
| 93 |
+
'PCA', 'PairDistribution', 'ParamCurve', 'Pattern', 'Permutation', 'Photo',
|
| 94 |
+
'Pitch', 'PitchModeler', 'PitchTier', 'PointProcess', 'Polygon', 'Polynomial',
|
| 95 |
+
'PowerCepstrogram', 'PowerCepstrum', 'Procrustes', 'RealPoint', 'RealTier',
|
| 96 |
+
'ResultsMFC', 'Roots', 'SPINET', 'SSCP', 'SVD', 'Salience', 'ScalarProduct',
|
| 97 |
+
'Similarity', 'SimpleString', 'SortedSetOfString', 'Sound', 'Speaker',
|
| 98 |
+
'Spectrogram', 'Spectrum', 'SpectrumTier', 'SpeechSynthesizer', 'SpellingChecker',
|
| 99 |
+
'Strings', 'StringsIndex', 'Table', 'TableOfReal', 'TextGrid', 'TextInterval',
|
| 100 |
+
'TextPoint', 'TextTier', 'Tier', 'Transition', 'VocalTract', 'VocalTractTier',
|
| 101 |
+
'Weight', 'WordList',
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
variables_numeric = (
|
| 105 |
+
'macintosh', 'windows', 'unix', 'praatVersion', 'pi', 'e', 'undefined',
|
| 106 |
+
)
|
| 107 |
+
|
| 108 |
+
variables_string = (
|
| 109 |
+
'praatVersion', 'tab', 'shellDirectory', 'homeDirectory',
|
| 110 |
+
'preferencesDirectory', 'newline', 'temporaryDirectory',
|
| 111 |
+
'defaultDirectory',
|
| 112 |
+
)
|
| 113 |
+
|
| 114 |
+
object_attributes = (
|
| 115 |
+
'ncol', 'nrow', 'xmin', 'ymin', 'xmax', 'ymax', 'nx', 'ny', 'dx', 'dy',
|
| 116 |
+
)
|
| 117 |
+
|
| 118 |
+
tokens = {
|
| 119 |
+
'root': [
|
| 120 |
+
(r'(\s+)(#.*?$)', bygroups(Whitespace, Comment.Single)),
|
| 121 |
+
(r'^#.*?$', Comment.Single),
|
| 122 |
+
(r';[^\n]*', Comment.Single),
|
| 123 |
+
(r'\s+', Whitespace),
|
| 124 |
+
|
| 125 |
+
(r'\bprocedure\b', Keyword, 'procedure_definition'),
|
| 126 |
+
(r'\bcall\b', Keyword, 'procedure_call'),
|
| 127 |
+
(r'@', Name.Function, 'procedure_call'),
|
| 128 |
+
|
| 129 |
+
include('function_call'),
|
| 130 |
+
|
| 131 |
+
(words(keywords, suffix=r'\b'), Keyword),
|
| 132 |
+
|
| 133 |
+
(r'(\bform\b)(\s+)([^\n]+)',
|
| 134 |
+
bygroups(Keyword, Whitespace, String), 'old_form'),
|
| 135 |
+
|
| 136 |
+
(r'(print(?:line|tab)?|echo|exit|asserterror|pause|send(?:praat|socket)|'
|
| 137 |
+
r'include|execute|system(?:_nocheck)?)(\s+)',
|
| 138 |
+
bygroups(Keyword, Whitespace), 'string_unquoted'),
|
| 139 |
+
|
| 140 |
+
(r'(goto|label)(\s+)(\w+)', bygroups(Keyword, Whitespace, Name.Label)),
|
| 141 |
+
|
| 142 |
+
include('variable_name'),
|
| 143 |
+
include('number'),
|
| 144 |
+
|
| 145 |
+
(r'"', String, 'string'),
|
| 146 |
+
|
| 147 |
+
(words((objects), suffix=r'(?=\s+\S+\n)'), Name.Class, 'string_unquoted'),
|
| 148 |
+
|
| 149 |
+
(r'\b[A-Z]', Keyword, 'command'),
|
| 150 |
+
(r'(\.{3}|[)(,])', Punctuation),
|
| 151 |
+
],
|
| 152 |
+
'command': [
|
| 153 |
+
(r'( ?[\w()-]+ ?)', Keyword),
|
| 154 |
+
|
| 155 |
+
include('string_interpolated'),
|
| 156 |
+
|
| 157 |
+
(r'\.{3}', Keyword, ('#pop', 'old_arguments')),
|
| 158 |
+
(r':', Keyword, ('#pop', 'comma_list')),
|
| 159 |
+
(r'\s', Whitespace, '#pop'),
|
| 160 |
+
],
|
| 161 |
+
'procedure_call': [
|
| 162 |
+
(r'\s+', Whitespace),
|
| 163 |
+
(r'([\w.]+)(?:(:)|(?:(\s*)(\()))',
|
| 164 |
+
bygroups(Name.Function, Punctuation,
|
| 165 |
+
Text.Whitespace, Punctuation), '#pop'),
|
| 166 |
+
(r'([\w.]+)', Name.Function, ('#pop', 'old_arguments')),
|
| 167 |
+
],
|
| 168 |
+
'procedure_definition': [
|
| 169 |
+
(r'\s', Whitespace),
|
| 170 |
+
(r'([\w.]+)(\s*?[(:])',
|
| 171 |
+
bygroups(Name.Function, Whitespace), '#pop'),
|
| 172 |
+
(r'([\w.]+)([^\n]*)',
|
| 173 |
+
bygroups(Name.Function, Text), '#pop'),
|
| 174 |
+
],
|
| 175 |
+
'function_call': [
|
| 176 |
+
(words(functions_string, suffix=r'\$(?=\s*[:(])'), Name.Function, 'function'),
|
| 177 |
+
(words(functions_array, suffix=r'#(?=\s*[:(])'), Name.Function, 'function'),
|
| 178 |
+
(words(functions_numeric, suffix=r'(?=\s*[:(])'), Name.Function, 'function'),
|
| 179 |
+
],
|
| 180 |
+
'function': [
|
| 181 |
+
(r'\s+', Whitespace),
|
| 182 |
+
(r':', Punctuation, ('#pop', 'comma_list')),
|
| 183 |
+
(r'\s*\(', Punctuation, ('#pop', 'comma_list')),
|
| 184 |
+
],
|
| 185 |
+
'comma_list': [
|
| 186 |
+
(r'(\s*\n\s*)(\.{3})', bygroups(Whitespace, Punctuation)),
|
| 187 |
+
|
| 188 |
+
(r'(\s*)(?:([)\]])|(\n))', bygroups(
|
| 189 |
+
Whitespace, Punctuation, Whitespace), '#pop'),
|
| 190 |
+
|
| 191 |
+
(r'\s+', Whitespace),
|
| 192 |
+
(r'"', String, 'string'),
|
| 193 |
+
(r'\b(if|then|else|fi|endif)\b', Keyword),
|
| 194 |
+
|
| 195 |
+
include('function_call'),
|
| 196 |
+
include('variable_name'),
|
| 197 |
+
include('operator'),
|
| 198 |
+
include('number'),
|
| 199 |
+
|
| 200 |
+
(r'[()]', Text),
|
| 201 |
+
(r',', Punctuation),
|
| 202 |
+
],
|
| 203 |
+
'old_arguments': [
|
| 204 |
+
(r'\n', Whitespace, '#pop'),
|
| 205 |
+
|
| 206 |
+
include('variable_name'),
|
| 207 |
+
include('operator'),
|
| 208 |
+
include('number'),
|
| 209 |
+
|
| 210 |
+
(r'"', String, 'string'),
|
| 211 |
+
(r'[^\n]', Text),
|
| 212 |
+
],
|
| 213 |
+
'number': [
|
| 214 |
+
(r'\n', Whitespace, '#pop'),
|
| 215 |
+
(r'\b\d+(\.\d*)?([eE][-+]?\d+)?%?', Number),
|
| 216 |
+
],
|
| 217 |
+
'object_reference': [
|
| 218 |
+
include('string_interpolated'),
|
| 219 |
+
(r'([a-z][a-zA-Z0-9_]*|\d+)', Name.Builtin),
|
| 220 |
+
|
| 221 |
+
(words(object_attributes, prefix=r'\.'), Name.Builtin, '#pop'),
|
| 222 |
+
|
| 223 |
+
(r'\$', Name.Builtin),
|
| 224 |
+
(r'\[', Text, '#pop'),
|
| 225 |
+
],
|
| 226 |
+
'variable_name': [
|
| 227 |
+
include('operator'),
|
| 228 |
+
include('number'),
|
| 229 |
+
|
| 230 |
+
(words(variables_string, suffix=r'\$'), Name.Variable.Global),
|
| 231 |
+
(words(variables_numeric,
|
| 232 |
+
suffix=r'(?=[^a-zA-Z0-9_."\'$#\[:(]|\s|^|$)'),
|
| 233 |
+
Name.Variable.Global),
|
| 234 |
+
|
| 235 |
+
(words(objects, prefix=r'\b', suffix=r"(_)"),
|
| 236 |
+
bygroups(Name.Builtin, Name.Builtin),
|
| 237 |
+
'object_reference'),
|
| 238 |
+
|
| 239 |
+
(r'\.?_?[a-z][\w.]*(\$|#)?', Text),
|
| 240 |
+
(r'[\[\]]', Punctuation, 'comma_list'),
|
| 241 |
+
|
| 242 |
+
include('string_interpolated'),
|
| 243 |
+
],
|
| 244 |
+
'operator': [
|
| 245 |
+
(r'([+\/*<>=!-]=?|[&*|][&*|]?|\^|<>)', Operator),
|
| 246 |
+
(r'(?<![\w.])(and|or|not|div|mod)(?![\w.])', Operator.Word),
|
| 247 |
+
],
|
| 248 |
+
'string_interpolated': [
|
| 249 |
+
(r'\'[_a-z][^\[\]\'":]*(\[([\d,]+|"[\w,]+")\])?(:[0-9]+)?\'',
|
| 250 |
+
String.Interpol),
|
| 251 |
+
],
|
| 252 |
+
'string_unquoted': [
|
| 253 |
+
(r'(\n\s*)(\.{3})', bygroups(Whitespace, Punctuation)),
|
| 254 |
+
|
| 255 |
+
(r'\n', Whitespace, '#pop'),
|
| 256 |
+
(r'\s', Whitespace),
|
| 257 |
+
|
| 258 |
+
include('string_interpolated'),
|
| 259 |
+
|
| 260 |
+
(r"'", String),
|
| 261 |
+
(r"[^'\n]+", String),
|
| 262 |
+
],
|
| 263 |
+
'string': [
|
| 264 |
+
(r'(\n\s*)(\.{3})', bygroups(Whitespace, Punctuation)),
|
| 265 |
+
|
| 266 |
+
(r'"', String, '#pop'),
|
| 267 |
+
|
| 268 |
+
include('string_interpolated'),
|
| 269 |
+
|
| 270 |
+
(r"'", String),
|
| 271 |
+
(r'[^\'"\n]+', String),
|
| 272 |
+
],
|
| 273 |
+
'old_form': [
|
| 274 |
+
(r'(\s+)(#.*?$)', bygroups(Whitespace, Comment.Single)),
|
| 275 |
+
(r'\s+', Whitespace),
|
| 276 |
+
|
| 277 |
+
(r'(optionmenu|choice)([ \t]+)(\S+)(:)([ \t]+)',
|
| 278 |
+
bygroups(Keyword, Whitespace, Text, Punctuation, Whitespace), 'number'),
|
| 279 |
+
|
| 280 |
+
(r'(option|button)([ \t]+)',
|
| 281 |
+
bygroups(Keyword, Whitespace), 'string_unquoted'),
|
| 282 |
+
|
| 283 |
+
(r'(sentence|text)([ \t]+)(\S+)',
|
| 284 |
+
bygroups(Keyword, Whitespace, String), 'string_unquoted'),
|
| 285 |
+
|
| 286 |
+
(r'(word)([ \t]+)(\S+)([ \t]*)(\S+)?(?:([ \t]+)(.*))?',
|
| 287 |
+
bygroups(Keyword, Whitespace, Text, Whitespace, Text, Whitespace, Text)),
|
| 288 |
+
|
| 289 |
+
(r'(boolean)(\s+\S+\s*)(0|1|"?(?:yes|no)"?)',
|
| 290 |
+
bygroups(Keyword, Whitespace, Name.Variable)),
|
| 291 |
+
|
| 292 |
+
# Ideally processing of the number would happen in the 'number'
|
| 293 |
+
# but that doesn't seem to work
|
| 294 |
+
(r'(real|natural|positive|integer)([ \t]+\S+[ \t]*)([+-]?)(\d+(?:\.\d*)?'
|
| 295 |
+
r'(?:[eE][-+]?\d+)?%?)',
|
| 296 |
+
bygroups(Keyword, Whitespace, Operator, Number)),
|
| 297 |
+
|
| 298 |
+
(r'(comment)(\s+)',
|
| 299 |
+
bygroups(Keyword, Whitespace), 'string_unquoted'),
|
| 300 |
+
|
| 301 |
+
(r'\bendform\b', Keyword, '#pop'),
|
| 302 |
+
]
|
| 303 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/procfile.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.procfile
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for Procfile file format.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from pygments.lexer import RegexLexer, bygroups
|
| 12 |
+
from pygments.token import Name, Number, String, Text, Punctuation
|
| 13 |
+
|
| 14 |
+
__all__ = ["ProcfileLexer"]
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
class ProcfileLexer(RegexLexer):
|
| 18 |
+
"""
|
| 19 |
+
Lexer for Procfile file format.
|
| 20 |
+
|
| 21 |
+
The format is used to run processes on Heroku or is used by Foreman or
|
| 22 |
+
Honcho tools.
|
| 23 |
+
"""
|
| 24 |
+
name = 'Procfile'
|
| 25 |
+
url = 'https://devcenter.heroku.com/articles/procfile#procfile-format'
|
| 26 |
+
aliases = ['procfile']
|
| 27 |
+
filenames = ['Procfile']
|
| 28 |
+
version_added = '2.10'
|
| 29 |
+
|
| 30 |
+
tokens = {
|
| 31 |
+
'root': [
|
| 32 |
+
(r'^([a-z]+)(:)', bygroups(Name.Label, Punctuation)),
|
| 33 |
+
(r'\s+', Text.Whitespace),
|
| 34 |
+
(r'"[^"]*"', String),
|
| 35 |
+
(r"'[^']*'", String),
|
| 36 |
+
(r'[0-9]+', Number.Integer),
|
| 37 |
+
(r'\$[a-zA-Z_][\w]*', Name.Variable),
|
| 38 |
+
(r'(\w+)(=)(\w+)', bygroups(Name.Variable, Punctuation, String)),
|
| 39 |
+
(r'([\w\-\./]+)', Text),
|
| 40 |
+
],
|
| 41 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/prolog.py
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.prolog
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for Prolog and Prolog-like languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import RegexLexer, bygroups
|
| 14 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 15 |
+
Number, Punctuation
|
| 16 |
+
|
| 17 |
+
__all__ = ['PrologLexer', 'LogtalkLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
class PrologLexer(RegexLexer):
|
| 21 |
+
"""
|
| 22 |
+
Lexer for Prolog files.
|
| 23 |
+
"""
|
| 24 |
+
name = 'Prolog'
|
| 25 |
+
aliases = ['prolog']
|
| 26 |
+
filenames = ['*.ecl', '*.prolog', '*.pro', '*.pl']
|
| 27 |
+
mimetypes = ['text/x-prolog']
|
| 28 |
+
url = 'https://en.wikipedia.org/wiki/Prolog'
|
| 29 |
+
version_added = ''
|
| 30 |
+
|
| 31 |
+
tokens = {
|
| 32 |
+
'root': [
|
| 33 |
+
(r'/\*', Comment.Multiline, 'nested-comment'),
|
| 34 |
+
(r'%.*', Comment.Single),
|
| 35 |
+
# character literal
|
| 36 |
+
(r'0\'.', String.Char),
|
| 37 |
+
(r'0b[01]+', Number.Bin),
|
| 38 |
+
(r'0o[0-7]+', Number.Oct),
|
| 39 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 40 |
+
# literal with prepended base
|
| 41 |
+
(r'\d\d?\'[a-zA-Z0-9]+', Number.Integer),
|
| 42 |
+
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
| 43 |
+
(r'\d+', Number.Integer),
|
| 44 |
+
(r'[\[\](){}|.,;!]', Punctuation),
|
| 45 |
+
(r':-|-->', Punctuation),
|
| 46 |
+
(r'"(?:\\x[0-9a-fA-F]+\\|\\u[0-9a-fA-F]{4}|\\U[0-9a-fA-F]{8}|'
|
| 47 |
+
r'\\[0-7]+\\|\\["\\abcefnrstv]|[^\\"])*"', String.Double),
|
| 48 |
+
(r"'(?:''|[^'])*'", String.Atom), # quoted atom
|
| 49 |
+
# Needs to not be followed by an atom.
|
| 50 |
+
# (r'=(?=\s|[a-zA-Z\[])', Operator),
|
| 51 |
+
(r'is\b', Operator),
|
| 52 |
+
(r'(<|>|=<|>=|==|=:=|=|/|//|\*|\+|-)(?=\s|[a-zA-Z0-9\[])',
|
| 53 |
+
Operator),
|
| 54 |
+
(r'(mod|div|not)\b', Operator),
|
| 55 |
+
(r'_', Keyword), # The don't-care variable
|
| 56 |
+
(r'([a-z]+)(:)', bygroups(Name.Namespace, Punctuation)),
|
| 57 |
+
(r'([a-z\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]'
|
| 58 |
+
r'[\w$\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]*)'
|
| 59 |
+
r'(\s*)(:-|-->)',
|
| 60 |
+
bygroups(Name.Function, Text, Operator)), # function defn
|
| 61 |
+
(r'([a-z\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]'
|
| 62 |
+
r'[\w$\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]*)'
|
| 63 |
+
r'(\s*)(\()',
|
| 64 |
+
bygroups(Name.Function, Text, Punctuation)),
|
| 65 |
+
(r'[a-z\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]'
|
| 66 |
+
r'[\w$\u00c0-\u1fff\u3040-\ud7ff\ue000-\uffef]*',
|
| 67 |
+
String.Atom), # atom, characters
|
| 68 |
+
# This one includes !
|
| 69 |
+
(r'[#&*+\-./:<=>?@\\^~\u00a1-\u00bf\u2010-\u303f]+',
|
| 70 |
+
String.Atom), # atom, graphics
|
| 71 |
+
(r'[A-Z_]\w*', Name.Variable),
|
| 72 |
+
(r'\s+|[\u2000-\u200f\ufff0-\ufffe\uffef]', Text),
|
| 73 |
+
],
|
| 74 |
+
'nested-comment': [
|
| 75 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 76 |
+
(r'/\*', Comment.Multiline, '#push'),
|
| 77 |
+
(r'[^*/]+', Comment.Multiline),
|
| 78 |
+
(r'[*/]', Comment.Multiline),
|
| 79 |
+
],
|
| 80 |
+
}
|
| 81 |
+
|
| 82 |
+
def analyse_text(text):
|
| 83 |
+
"""Competes with IDL and Visual Prolog on *.pro"""
|
| 84 |
+
if ':-' in text:
|
| 85 |
+
# Visual Prolog also uses :-
|
| 86 |
+
return 0.5
|
| 87 |
+
else:
|
| 88 |
+
return 0
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
class LogtalkLexer(RegexLexer):
|
| 92 |
+
"""
|
| 93 |
+
For Logtalk source code.
|
| 94 |
+
"""
|
| 95 |
+
|
| 96 |
+
name = 'Logtalk'
|
| 97 |
+
url = 'http://logtalk.org/'
|
| 98 |
+
aliases = ['logtalk']
|
| 99 |
+
filenames = ['*.lgt', '*.logtalk']
|
| 100 |
+
mimetypes = ['text/x-logtalk']
|
| 101 |
+
version_added = '0.10'
|
| 102 |
+
|
| 103 |
+
tokens = {
|
| 104 |
+
'root': [
|
| 105 |
+
# Directives
|
| 106 |
+
(r'^\s*:-\s', Punctuation, 'directive'),
|
| 107 |
+
# Comments
|
| 108 |
+
(r'%.*?\n', Comment),
|
| 109 |
+
(r'/\*(.|\n)*?\*/', Comment),
|
| 110 |
+
# Whitespace
|
| 111 |
+
(r'\n', Text),
|
| 112 |
+
(r'\s+', Text),
|
| 113 |
+
# Numbers
|
| 114 |
+
(r"0'[\\]?.", Number),
|
| 115 |
+
(r'0b[01]+', Number.Bin),
|
| 116 |
+
(r'0o[0-7]+', Number.Oct),
|
| 117 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 118 |
+
(r'\d+\.?\d*((e|E)(\+|-)?\d+)?', Number),
|
| 119 |
+
# Variables
|
| 120 |
+
(r'([A-Z_][a-zA-Z0-9_]*)', Name.Variable),
|
| 121 |
+
# Event handlers
|
| 122 |
+
(r'(after|before)(?=[(])', Keyword),
|
| 123 |
+
# Message forwarding handler
|
| 124 |
+
(r'forward(?=[(])', Keyword),
|
| 125 |
+
# Execution-context methods
|
| 126 |
+
(r'(context|parameter|this|se(lf|nder))(?=[(])', Keyword),
|
| 127 |
+
# Reflection
|
| 128 |
+
(r'(current_predicate|predicate_property)(?=[(])', Keyword),
|
| 129 |
+
# DCGs and term expansion
|
| 130 |
+
(r'(expand_(goal|term)|(goal|term)_expansion|phrase)(?=[(])', Keyword),
|
| 131 |
+
# Entity
|
| 132 |
+
(r'(abolish|c(reate|urrent))_(object|protocol|category)(?=[(])', Keyword),
|
| 133 |
+
(r'(object|protocol|category)_property(?=[(])', Keyword),
|
| 134 |
+
# Entity relations
|
| 135 |
+
(r'co(mplements_object|nforms_to_protocol)(?=[(])', Keyword),
|
| 136 |
+
(r'extends_(object|protocol|category)(?=[(])', Keyword),
|
| 137 |
+
(r'imp(lements_protocol|orts_category)(?=[(])', Keyword),
|
| 138 |
+
(r'(instantiat|specializ)es_class(?=[(])', Keyword),
|
| 139 |
+
# Events
|
| 140 |
+
(r'(current_event|(abolish|define)_events)(?=[(])', Keyword),
|
| 141 |
+
# Flags
|
| 142 |
+
(r'(create|current|set)_logtalk_flag(?=[(])', Keyword),
|
| 143 |
+
# Compiling, loading, and library paths
|
| 144 |
+
(r'logtalk_(compile|l(ibrary_path|oad|oad_context)|make(_target_action)?)(?=[(])', Keyword),
|
| 145 |
+
(r'\blogtalk_make\b', Keyword),
|
| 146 |
+
# Database
|
| 147 |
+
(r'(clause|retract(all)?)(?=[(])', Keyword),
|
| 148 |
+
(r'a(bolish|ssert(a|z))(?=[(])', Keyword),
|
| 149 |
+
# Control constructs
|
| 150 |
+
(r'(ca(ll|tch)|throw)(?=[(])', Keyword),
|
| 151 |
+
(r'(fa(il|lse)|true|(instantiation|system)_error)\b', Keyword),
|
| 152 |
+
(r'(uninstantiation|type|domain|existence|permission|representation|evaluation|resource|syntax)_error(?=[(])', Keyword),
|
| 153 |
+
# All solutions
|
| 154 |
+
(r'((bag|set)of|f(ind|or)all)(?=[(])', Keyword),
|
| 155 |
+
# Multi-threading predicates
|
| 156 |
+
(r'threaded(_(ca(ll|ncel)|once|ignore|exit|peek|wait|notify))?(?=[(])', Keyword),
|
| 157 |
+
# Engine predicates
|
| 158 |
+
(r'threaded_engine(_(create|destroy|self|next|next_reified|yield|post|fetch))?(?=[(])', Keyword),
|
| 159 |
+
# Term unification
|
| 160 |
+
(r'(subsumes_term|unify_with_occurs_check)(?=[(])', Keyword),
|
| 161 |
+
# Term creation and decomposition
|
| 162 |
+
(r'(functor|arg|copy_term|numbervars|term_variables)(?=[(])', Keyword),
|
| 163 |
+
# Evaluable functors
|
| 164 |
+
(r'(div|rem|m(ax|in|od)|abs|sign)(?=[(])', Keyword),
|
| 165 |
+
(r'float(_(integer|fractional)_part)?(?=[(])', Keyword),
|
| 166 |
+
(r'(floor|t(an|runcate)|round|ceiling)(?=[(])', Keyword),
|
| 167 |
+
# Other arithmetic functors
|
| 168 |
+
(r'(cos|a(cos|sin|tan|tan2)|exp|log|s(in|qrt)|xor)(?=[(])', Keyword),
|
| 169 |
+
# Term testing
|
| 170 |
+
(r'(var|atom(ic)?|integer|float|c(allable|ompound)|n(onvar|umber)|ground|acyclic_term)(?=[(])', Keyword),
|
| 171 |
+
# Term comparison
|
| 172 |
+
(r'compare(?=[(])', Keyword),
|
| 173 |
+
# Stream selection and control
|
| 174 |
+
(r'(curren|se)t_(in|out)put(?=[(])', Keyword),
|
| 175 |
+
(r'(open|close)(?=[(])', Keyword),
|
| 176 |
+
(r'flush_output(?=[(])', Keyword),
|
| 177 |
+
(r'(at_end_of_stream|flush_output)\b', Keyword),
|
| 178 |
+
(r'(stream_property|at_end_of_stream|set_stream_position)(?=[(])', Keyword),
|
| 179 |
+
# Character and byte input/output
|
| 180 |
+
(r'(nl|(get|peek|put)_(byte|c(har|ode)))(?=[(])', Keyword),
|
| 181 |
+
(r'\bnl\b', Keyword),
|
| 182 |
+
# Term input/output
|
| 183 |
+
(r'read(_term)?(?=[(])', Keyword),
|
| 184 |
+
(r'write(q|_(canonical|term))?(?=[(])', Keyword),
|
| 185 |
+
(r'(current_)?op(?=[(])', Keyword),
|
| 186 |
+
(r'(current_)?char_conversion(?=[(])', Keyword),
|
| 187 |
+
# Atomic term processing
|
| 188 |
+
(r'atom_(length|c(hars|o(ncat|des)))(?=[(])', Keyword),
|
| 189 |
+
(r'(char_code|sub_atom)(?=[(])', Keyword),
|
| 190 |
+
(r'number_c(har|ode)s(?=[(])', Keyword),
|
| 191 |
+
# Implementation defined hooks functions
|
| 192 |
+
(r'(se|curren)t_prolog_flag(?=[(])', Keyword),
|
| 193 |
+
(r'\bhalt\b', Keyword),
|
| 194 |
+
(r'halt(?=[(])', Keyword),
|
| 195 |
+
# Message sending operators
|
| 196 |
+
(r'(::|:|\^\^)', Operator),
|
| 197 |
+
# External call
|
| 198 |
+
(r'[{}]', Keyword),
|
| 199 |
+
# Logic and control
|
| 200 |
+
(r'(ignore|once)(?=[(])', Keyword),
|
| 201 |
+
(r'\brepeat\b', Keyword),
|
| 202 |
+
# Sorting
|
| 203 |
+
(r'(key)?sort(?=[(])', Keyword),
|
| 204 |
+
# Bitwise functors
|
| 205 |
+
(r'(>>|<<|/\\|\\\\|\\)', Operator),
|
| 206 |
+
# Predicate aliases
|
| 207 |
+
(r'\bas\b', Operator),
|
| 208 |
+
# Arithmetic evaluation
|
| 209 |
+
(r'\bis\b', Keyword),
|
| 210 |
+
# Arithmetic comparison
|
| 211 |
+
(r'(=:=|=\\=|<|=<|>=|>)', Operator),
|
| 212 |
+
# Term creation and decomposition
|
| 213 |
+
(r'=\.\.', Operator),
|
| 214 |
+
# Term unification
|
| 215 |
+
(r'(=|\\=)', Operator),
|
| 216 |
+
# Term comparison
|
| 217 |
+
(r'(==|\\==|@=<|@<|@>=|@>)', Operator),
|
| 218 |
+
# Evaluable functors
|
| 219 |
+
(r'(//|[-+*/])', Operator),
|
| 220 |
+
(r'\b(e|pi|div|mod|rem)\b', Operator),
|
| 221 |
+
# Other arithmetic functors
|
| 222 |
+
(r'\b\*\*\b', Operator),
|
| 223 |
+
# DCG rules
|
| 224 |
+
(r'-->', Operator),
|
| 225 |
+
# Control constructs
|
| 226 |
+
(r'([!;]|->)', Operator),
|
| 227 |
+
# Logic and control
|
| 228 |
+
(r'\\+', Operator),
|
| 229 |
+
# Mode operators
|
| 230 |
+
(r'[?@]', Operator),
|
| 231 |
+
# Existential quantifier
|
| 232 |
+
(r'\^', Operator),
|
| 233 |
+
# Punctuation
|
| 234 |
+
(r'[()\[\],.|]', Text),
|
| 235 |
+
# Atoms
|
| 236 |
+
(r"[a-z][a-zA-Z0-9_]*", Text),
|
| 237 |
+
(r"'", String, 'quoted_atom'),
|
| 238 |
+
# Double-quoted terms
|
| 239 |
+
(r'"', String, 'double_quoted_term'),
|
| 240 |
+
],
|
| 241 |
+
|
| 242 |
+
'quoted_atom': [
|
| 243 |
+
(r"''", String),
|
| 244 |
+
(r"'", String, '#pop'),
|
| 245 |
+
(r'\\([\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\)', String.Escape),
|
| 246 |
+
(r"[^\\'\n]+", String),
|
| 247 |
+
(r'\\', String),
|
| 248 |
+
],
|
| 249 |
+
|
| 250 |
+
'double_quoted_term': [
|
| 251 |
+
(r'""', String),
|
| 252 |
+
(r'"', String, '#pop'),
|
| 253 |
+
(r'\\([\\abfnrtv"\']|(x[a-fA-F0-9]+|[0-7]+)\\)', String.Escape),
|
| 254 |
+
(r'[^\\"\n]+', String),
|
| 255 |
+
(r'\\', String),
|
| 256 |
+
],
|
| 257 |
+
|
| 258 |
+
'directive': [
|
| 259 |
+
# Conditional compilation directives
|
| 260 |
+
(r'(el)?if(?=[(])', Keyword, 'root'),
|
| 261 |
+
(r'(e(lse|ndif))(?=[.])', Keyword, 'root'),
|
| 262 |
+
# Entity directives
|
| 263 |
+
(r'(category|object|protocol)(?=[(])', Keyword, 'entityrelations'),
|
| 264 |
+
(r'(end_(category|object|protocol))(?=[.])', Keyword, 'root'),
|
| 265 |
+
# Predicate scope directives
|
| 266 |
+
(r'(public|protected|private)(?=[(])', Keyword, 'root'),
|
| 267 |
+
# Other directives
|
| 268 |
+
(r'e(n(coding|sure_loaded)|xport)(?=[(])', Keyword, 'root'),
|
| 269 |
+
(r'in(clude|itialization|fo)(?=[(])', Keyword, 'root'),
|
| 270 |
+
(r'(built_in|dynamic|synchronized|threaded)(?=[.])', Keyword, 'root'),
|
| 271 |
+
(r'(alias|d(ynamic|iscontiguous)|m(eta_(non_terminal|predicate)|ode|ultifile)|s(et_(logtalk|prolog)_flag|ynchronized))(?=[(])', Keyword, 'root'),
|
| 272 |
+
(r'op(?=[(])', Keyword, 'root'),
|
| 273 |
+
(r'(c(alls|oinductive)|module|reexport|use(s|_module))(?=[(])', Keyword, 'root'),
|
| 274 |
+
(r'[a-z][a-zA-Z0-9_]*(?=[(])', Text, 'root'),
|
| 275 |
+
(r'[a-z][a-zA-Z0-9_]*(?=[.])', Text, 'root'),
|
| 276 |
+
],
|
| 277 |
+
|
| 278 |
+
'entityrelations': [
|
| 279 |
+
(r'(complements|extends|i(nstantiates|mp(lements|orts))|specializes)(?=[(])', Keyword),
|
| 280 |
+
# Numbers
|
| 281 |
+
(r"0'[\\]?.", Number),
|
| 282 |
+
(r'0b[01]+', Number.Bin),
|
| 283 |
+
(r'0o[0-7]+', Number.Oct),
|
| 284 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 285 |
+
(r'\d+\.?\d*((e|E)(\+|-)?\d+)?', Number),
|
| 286 |
+
# Variables
|
| 287 |
+
(r'([A-Z_][a-zA-Z0-9_]*)', Name.Variable),
|
| 288 |
+
# Atoms
|
| 289 |
+
(r"[a-z][a-zA-Z0-9_]*", Text),
|
| 290 |
+
(r"'", String, 'quoted_atom'),
|
| 291 |
+
# Double-quoted terms
|
| 292 |
+
(r'"', String, 'double_quoted_term'),
|
| 293 |
+
# End of entity-opening directive
|
| 294 |
+
(r'([)]\.)', Text, 'root'),
|
| 295 |
+
# Scope operator
|
| 296 |
+
(r'(::)', Operator),
|
| 297 |
+
# Punctuation
|
| 298 |
+
(r'[()\[\],.|]', Text),
|
| 299 |
+
# Comments
|
| 300 |
+
(r'%.*?\n', Comment),
|
| 301 |
+
(r'/\*(.|\n)*?\*/', Comment),
|
| 302 |
+
# Whitespace
|
| 303 |
+
(r'\n', Text),
|
| 304 |
+
(r'\s+', Text),
|
| 305 |
+
]
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
def analyse_text(text):
|
| 309 |
+
if ':- object(' in text:
|
| 310 |
+
return 1.0
|
| 311 |
+
elif ':- protocol(' in text:
|
| 312 |
+
return 1.0
|
| 313 |
+
elif ':- category(' in text:
|
| 314 |
+
return 1.0
|
| 315 |
+
elif re.search(r'^:-\s[a-z]', text, re.M):
|
| 316 |
+
return 0.9
|
| 317 |
+
else:
|
| 318 |
+
return 0.0
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/promql.py
ADD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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.promql
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for Prometheus Query Language.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from pygments.lexer import RegexLexer, bygroups, default, words
|
| 12 |
+
from pygments.token import Comment, Keyword, Name, Number, Operator, \
|
| 13 |
+
Punctuation, String, Whitespace
|
| 14 |
+
|
| 15 |
+
__all__ = ["PromQLLexer"]
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class PromQLLexer(RegexLexer):
|
| 19 |
+
"""
|
| 20 |
+
For PromQL queries.
|
| 21 |
+
|
| 22 |
+
For details about the grammar see:
|
| 23 |
+
https://github.com/prometheus/prometheus/tree/master/promql/parser
|
| 24 |
+
|
| 25 |
+
.. versionadded: 2.7
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
name = "PromQL"
|
| 29 |
+
url = 'https://prometheus.io/docs/prometheus/latest/querying/basics/'
|
| 30 |
+
aliases = ["promql"]
|
| 31 |
+
filenames = ["*.promql"]
|
| 32 |
+
version_added = ''
|
| 33 |
+
|
| 34 |
+
base_keywords = (
|
| 35 |
+
words(
|
| 36 |
+
(
|
| 37 |
+
"bool",
|
| 38 |
+
"by",
|
| 39 |
+
"group_left",
|
| 40 |
+
"group_right",
|
| 41 |
+
"ignoring",
|
| 42 |
+
"offset",
|
| 43 |
+
"on",
|
| 44 |
+
"without",
|
| 45 |
+
),
|
| 46 |
+
suffix=r"\b",
|
| 47 |
+
),
|
| 48 |
+
Keyword,
|
| 49 |
+
)
|
| 50 |
+
|
| 51 |
+
aggregator_keywords = (
|
| 52 |
+
words(
|
| 53 |
+
(
|
| 54 |
+
"sum",
|
| 55 |
+
"min",
|
| 56 |
+
"max",
|
| 57 |
+
"avg",
|
| 58 |
+
"group",
|
| 59 |
+
"stddev",
|
| 60 |
+
"stdvar",
|
| 61 |
+
"count",
|
| 62 |
+
"count_values",
|
| 63 |
+
"bottomk",
|
| 64 |
+
"topk",
|
| 65 |
+
"quantile",
|
| 66 |
+
),
|
| 67 |
+
suffix=r"\b",
|
| 68 |
+
),
|
| 69 |
+
Keyword,
|
| 70 |
+
)
|
| 71 |
+
|
| 72 |
+
function_keywords = (
|
| 73 |
+
words(
|
| 74 |
+
(
|
| 75 |
+
"abs",
|
| 76 |
+
"absent",
|
| 77 |
+
"absent_over_time",
|
| 78 |
+
"avg_over_time",
|
| 79 |
+
"ceil",
|
| 80 |
+
"changes",
|
| 81 |
+
"clamp_max",
|
| 82 |
+
"clamp_min",
|
| 83 |
+
"count_over_time",
|
| 84 |
+
"day_of_month",
|
| 85 |
+
"day_of_week",
|
| 86 |
+
"days_in_month",
|
| 87 |
+
"delta",
|
| 88 |
+
"deriv",
|
| 89 |
+
"exp",
|
| 90 |
+
"floor",
|
| 91 |
+
"histogram_quantile",
|
| 92 |
+
"holt_winters",
|
| 93 |
+
"hour",
|
| 94 |
+
"idelta",
|
| 95 |
+
"increase",
|
| 96 |
+
"irate",
|
| 97 |
+
"label_join",
|
| 98 |
+
"label_replace",
|
| 99 |
+
"ln",
|
| 100 |
+
"log10",
|
| 101 |
+
"log2",
|
| 102 |
+
"max_over_time",
|
| 103 |
+
"min_over_time",
|
| 104 |
+
"minute",
|
| 105 |
+
"month",
|
| 106 |
+
"predict_linear",
|
| 107 |
+
"quantile_over_time",
|
| 108 |
+
"rate",
|
| 109 |
+
"resets",
|
| 110 |
+
"round",
|
| 111 |
+
"scalar",
|
| 112 |
+
"sort",
|
| 113 |
+
"sort_desc",
|
| 114 |
+
"sqrt",
|
| 115 |
+
"stddev_over_time",
|
| 116 |
+
"stdvar_over_time",
|
| 117 |
+
"sum_over_time",
|
| 118 |
+
"time",
|
| 119 |
+
"timestamp",
|
| 120 |
+
"vector",
|
| 121 |
+
"year",
|
| 122 |
+
),
|
| 123 |
+
suffix=r"\b",
|
| 124 |
+
),
|
| 125 |
+
Keyword.Reserved,
|
| 126 |
+
)
|
| 127 |
+
|
| 128 |
+
tokens = {
|
| 129 |
+
"root": [
|
| 130 |
+
(r"\n", Whitespace),
|
| 131 |
+
(r"\s+", Whitespace),
|
| 132 |
+
(r",", Punctuation),
|
| 133 |
+
# Keywords
|
| 134 |
+
base_keywords,
|
| 135 |
+
aggregator_keywords,
|
| 136 |
+
function_keywords,
|
| 137 |
+
# Offsets
|
| 138 |
+
(r"[1-9][0-9]*[smhdwy]", String),
|
| 139 |
+
# Numbers
|
| 140 |
+
(r"-?[0-9]+\.[0-9]+", Number.Float),
|
| 141 |
+
(r"-?[0-9]+", Number.Integer),
|
| 142 |
+
# Comments
|
| 143 |
+
(r"#.*?$", Comment.Single),
|
| 144 |
+
# Operators
|
| 145 |
+
(r"(\+|\-|\*|\/|\%|\^)", Operator),
|
| 146 |
+
(r"==|!=|>=|<=|<|>", Operator),
|
| 147 |
+
(r"and|or|unless", Operator.Word),
|
| 148 |
+
# Metrics
|
| 149 |
+
(r"[_a-zA-Z][a-zA-Z0-9_]+", Name.Variable),
|
| 150 |
+
# Params
|
| 151 |
+
(r'(["\'])(.*?)(["\'])', bygroups(Punctuation, String, Punctuation)),
|
| 152 |
+
# Other states
|
| 153 |
+
(r"\(", Operator, "function"),
|
| 154 |
+
(r"\)", Operator),
|
| 155 |
+
(r"\{", Punctuation, "labels"),
|
| 156 |
+
(r"\[", Punctuation, "range"),
|
| 157 |
+
],
|
| 158 |
+
"labels": [
|
| 159 |
+
(r"\}", Punctuation, "#pop"),
|
| 160 |
+
(r"\n", Whitespace),
|
| 161 |
+
(r"\s+", Whitespace),
|
| 162 |
+
(r",", Punctuation),
|
| 163 |
+
(r'([_a-zA-Z][a-zA-Z0-9_]*?)(\s*?)(=~|!=|=|!~)(\s*?)("|\')(.*?)("|\')',
|
| 164 |
+
bygroups(Name.Label, Whitespace, Operator, Whitespace,
|
| 165 |
+
Punctuation, String, Punctuation)),
|
| 166 |
+
],
|
| 167 |
+
"range": [
|
| 168 |
+
(r"\]", Punctuation, "#pop"),
|
| 169 |
+
(r"[1-9][0-9]*[smhdwy]", String),
|
| 170 |
+
],
|
| 171 |
+
"function": [
|
| 172 |
+
(r"\)", Operator, "#pop"),
|
| 173 |
+
(r"\(", Operator, "#push"),
|
| 174 |
+
default("#pop"),
|
| 175 |
+
],
|
| 176 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/prql.py
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from pygments.lexer import RegexLexer, combined, words, include, bygroups
|
| 12 |
+
from pygments.token import Comment, Literal, Keyword, Name, Number, Operator, \
|
| 13 |
+
Punctuation, String, Text, Whitespace
|
| 14 |
+
|
| 15 |
+
__all__ = ['PrqlLexer']
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class PrqlLexer(RegexLexer):
|
| 19 |
+
"""
|
| 20 |
+
For PRQL source code.
|
| 21 |
+
|
| 22 |
+
grammar: https://github.com/PRQL/prql/tree/main/grammars
|
| 23 |
+
"""
|
| 24 |
+
|
| 25 |
+
name = 'PRQL'
|
| 26 |
+
url = 'https://prql-lang.org/'
|
| 27 |
+
aliases = ['prql']
|
| 28 |
+
filenames = ['*.prql']
|
| 29 |
+
mimetypes = ['application/prql', 'application/x-prql']
|
| 30 |
+
version_added = '2.17'
|
| 31 |
+
|
| 32 |
+
builtinTypes = words((
|
| 33 |
+
"bool",
|
| 34 |
+
"int",
|
| 35 |
+
"int8", "int16", "int32", "int64", "int128",
|
| 36 |
+
"float",
|
| 37 |
+
"text",
|
| 38 |
+
"set"), suffix=r'\b')
|
| 39 |
+
|
| 40 |
+
def innerstring_rules(ttype):
|
| 41 |
+
return [
|
| 42 |
+
# the new style '{}'.format(...) string formatting
|
| 43 |
+
(r'\{'
|
| 44 |
+
r'((\w+)((\.\w+)|(\[[^\]]+\]))*)?' # field name
|
| 45 |
+
r'(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?'
|
| 46 |
+
r'\}', String.Interpol),
|
| 47 |
+
|
| 48 |
+
(r'[^\\\'"%{\n]+', ttype),
|
| 49 |
+
(r'[\'"\\]', ttype),
|
| 50 |
+
(r'%|(\{{1,2})', ttype)
|
| 51 |
+
]
|
| 52 |
+
|
| 53 |
+
def fstring_rules(ttype):
|
| 54 |
+
return [
|
| 55 |
+
(r'\}', String.Interpol),
|
| 56 |
+
(r'\{', String.Interpol, 'expr-inside-fstring'),
|
| 57 |
+
(r'[^\\\'"{}\n]+', ttype),
|
| 58 |
+
(r'[\'"\\]', ttype),
|
| 59 |
+
]
|
| 60 |
+
|
| 61 |
+
tokens = {
|
| 62 |
+
'root': [
|
| 63 |
+
|
| 64 |
+
# Comments
|
| 65 |
+
(r'#!.*', String.Doc),
|
| 66 |
+
(r'#.*', Comment.Single),
|
| 67 |
+
|
| 68 |
+
# Whitespace
|
| 69 |
+
(r'\s+', Whitespace),
|
| 70 |
+
|
| 71 |
+
# Modules
|
| 72 |
+
(r'^(\s*)(module)(\s*)',
|
| 73 |
+
bygroups(Whitespace, Keyword.Namespace, Whitespace),
|
| 74 |
+
'imports'),
|
| 75 |
+
|
| 76 |
+
(builtinTypes, Keyword.Type),
|
| 77 |
+
|
| 78 |
+
# Main
|
| 79 |
+
(r'^prql ', Keyword.Reserved),
|
| 80 |
+
|
| 81 |
+
('let', Keyword.Declaration),
|
| 82 |
+
|
| 83 |
+
include('keywords'),
|
| 84 |
+
include('expr'),
|
| 85 |
+
|
| 86 |
+
# Transforms
|
| 87 |
+
(r'^[A-Za-z_][a-zA-Z0-9_]*', Keyword),
|
| 88 |
+
],
|
| 89 |
+
'expr': [
|
| 90 |
+
# non-raw f-strings
|
| 91 |
+
('(f)(""")', bygroups(String.Affix, String.Double),
|
| 92 |
+
combined('fstringescape', 'tdqf')),
|
| 93 |
+
("(f)(''')", bygroups(String.Affix, String.Single),
|
| 94 |
+
combined('fstringescape', 'tsqf')),
|
| 95 |
+
('(f)(")', bygroups(String.Affix, String.Double),
|
| 96 |
+
combined('fstringescape', 'dqf')),
|
| 97 |
+
("(f)(')", bygroups(String.Affix, String.Single),
|
| 98 |
+
combined('fstringescape', 'sqf')),
|
| 99 |
+
|
| 100 |
+
# non-raw s-strings
|
| 101 |
+
('(s)(""")', bygroups(String.Affix, String.Double),
|
| 102 |
+
combined('stringescape', 'tdqf')),
|
| 103 |
+
("(s)(''')", bygroups(String.Affix, String.Single),
|
| 104 |
+
combined('stringescape', 'tsqf')),
|
| 105 |
+
('(s)(")', bygroups(String.Affix, String.Double),
|
| 106 |
+
combined('stringescape', 'dqf')),
|
| 107 |
+
("(s)(')", bygroups(String.Affix, String.Single),
|
| 108 |
+
combined('stringescape', 'sqf')),
|
| 109 |
+
|
| 110 |
+
# raw strings
|
| 111 |
+
('(?i)(r)(""")',
|
| 112 |
+
bygroups(String.Affix, String.Double), 'tdqs'),
|
| 113 |
+
("(?i)(r)(''')",
|
| 114 |
+
bygroups(String.Affix, String.Single), 'tsqs'),
|
| 115 |
+
('(?i)(r)(")',
|
| 116 |
+
bygroups(String.Affix, String.Double), 'dqs'),
|
| 117 |
+
("(?i)(r)(')",
|
| 118 |
+
bygroups(String.Affix, String.Single), 'sqs'),
|
| 119 |
+
|
| 120 |
+
# non-raw strings
|
| 121 |
+
('"""', String.Double, combined('stringescape', 'tdqs')),
|
| 122 |
+
("'''", String.Single, combined('stringescape', 'tsqs')),
|
| 123 |
+
('"', String.Double, combined('stringescape', 'dqs')),
|
| 124 |
+
("'", String.Single, combined('stringescape', 'sqs')),
|
| 125 |
+
|
| 126 |
+
# Time and dates
|
| 127 |
+
(r'@\d{4}-\d{2}-\d{2}T\d{2}(:\d{2})?(:\d{2})?(\.\d{1,6})?(Z|[+-]\d{1,2}(:\d{1,2})?)?', Literal.Date),
|
| 128 |
+
(r'@\d{4}-\d{2}-\d{2}', Literal.Date),
|
| 129 |
+
(r'@\d{2}(:\d{2})?(:\d{2})?(\.\d{1,6})?(Z|[+-]\d{1,2}(:\d{1,2})?)?', Literal.Date),
|
| 130 |
+
|
| 131 |
+
(r'[^\S\n]+', Text),
|
| 132 |
+
include('numbers'),
|
| 133 |
+
(r'->|=>|==|!=|>=|<=|~=|&&|\|\||\?\?|\/\/', Operator),
|
| 134 |
+
(r'[-~+/*%=<>&^|.@]', Operator),
|
| 135 |
+
(r'[]{}:(),;[]', Punctuation),
|
| 136 |
+
include('functions'),
|
| 137 |
+
|
| 138 |
+
# Variable Names
|
| 139 |
+
(r'[A-Za-z_][a-zA-Z0-9_]*', Name.Variable),
|
| 140 |
+
],
|
| 141 |
+
'numbers': [
|
| 142 |
+
(r'(\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|(?:\d(?:_?\d)*)?\.\d(?:_?\d)*)'
|
| 143 |
+
r'([eE][+-]?\d(?:_?\d)*)?', Number.Float),
|
| 144 |
+
(r'\d(?:_?\d)*[eE][+-]?\d(?:_?\d)*j?', Number.Float),
|
| 145 |
+
(r'0[oO](?:_?[0-7])+', Number.Oct),
|
| 146 |
+
(r'0[bB](?:_?[01])+', Number.Bin),
|
| 147 |
+
(r'0[xX](?:_?[a-fA-F0-9])+', Number.Hex),
|
| 148 |
+
(r'\d(?:_?\d)*', Number.Integer),
|
| 149 |
+
],
|
| 150 |
+
'fstringescape': [
|
| 151 |
+
include('stringescape'),
|
| 152 |
+
],
|
| 153 |
+
'bytesescape': [
|
| 154 |
+
(r'\\([\\bfnrt"\']|\n|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
|
| 155 |
+
],
|
| 156 |
+
'stringescape': [
|
| 157 |
+
(r'\\(N\{.*?\}|u\{[a-fA-F0-9]{1,6}\})', String.Escape),
|
| 158 |
+
include('bytesescape')
|
| 159 |
+
],
|
| 160 |
+
'fstrings-single': fstring_rules(String.Single),
|
| 161 |
+
'fstrings-double': fstring_rules(String.Double),
|
| 162 |
+
'strings-single': innerstring_rules(String.Single),
|
| 163 |
+
'strings-double': innerstring_rules(String.Double),
|
| 164 |
+
'dqf': [
|
| 165 |
+
(r'"', String.Double, '#pop'),
|
| 166 |
+
(r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
|
| 167 |
+
include('fstrings-double')
|
| 168 |
+
],
|
| 169 |
+
'sqf': [
|
| 170 |
+
(r"'", String.Single, '#pop'),
|
| 171 |
+
(r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings
|
| 172 |
+
include('fstrings-single')
|
| 173 |
+
],
|
| 174 |
+
'dqs': [
|
| 175 |
+
(r'"', String.Double, '#pop'),
|
| 176 |
+
(r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
|
| 177 |
+
include('strings-double')
|
| 178 |
+
],
|
| 179 |
+
'sqs': [
|
| 180 |
+
(r"'", String.Single, '#pop'),
|
| 181 |
+
(r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings
|
| 182 |
+
include('strings-single')
|
| 183 |
+
],
|
| 184 |
+
'tdqf': [
|
| 185 |
+
(r'"""', String.Double, '#pop'),
|
| 186 |
+
include('fstrings-double'),
|
| 187 |
+
(r'\n', String.Double)
|
| 188 |
+
],
|
| 189 |
+
'tsqf': [
|
| 190 |
+
(r"'''", String.Single, '#pop'),
|
| 191 |
+
include('fstrings-single'),
|
| 192 |
+
(r'\n', String.Single)
|
| 193 |
+
],
|
| 194 |
+
'tdqs': [
|
| 195 |
+
(r'"""', String.Double, '#pop'),
|
| 196 |
+
include('strings-double'),
|
| 197 |
+
(r'\n', String.Double)
|
| 198 |
+
],
|
| 199 |
+
'tsqs': [
|
| 200 |
+
(r"'''", String.Single, '#pop'),
|
| 201 |
+
include('strings-single'),
|
| 202 |
+
(r'\n', String.Single)
|
| 203 |
+
],
|
| 204 |
+
|
| 205 |
+
'expr-inside-fstring': [
|
| 206 |
+
(r'[{([]', Punctuation, 'expr-inside-fstring-inner'),
|
| 207 |
+
# without format specifier
|
| 208 |
+
(r'(=\s*)?' # debug (https://bugs.python.org/issue36817)
|
| 209 |
+
r'\}', String.Interpol, '#pop'),
|
| 210 |
+
# with format specifier
|
| 211 |
+
# we'll catch the remaining '}' in the outer scope
|
| 212 |
+
(r'(=\s*)?' # debug (https://bugs.python.org/issue36817)
|
| 213 |
+
r':', String.Interpol, '#pop'),
|
| 214 |
+
(r'\s+', Whitespace), # allow new lines
|
| 215 |
+
include('expr'),
|
| 216 |
+
],
|
| 217 |
+
'expr-inside-fstring-inner': [
|
| 218 |
+
(r'[{([]', Punctuation, 'expr-inside-fstring-inner'),
|
| 219 |
+
(r'[])}]', Punctuation, '#pop'),
|
| 220 |
+
(r'\s+', Whitespace), # allow new lines
|
| 221 |
+
include('expr'),
|
| 222 |
+
],
|
| 223 |
+
'keywords': [
|
| 224 |
+
(words((
|
| 225 |
+
'into', 'case', 'type', 'module', 'internal',
|
| 226 |
+
), suffix=r'\b'),
|
| 227 |
+
Keyword),
|
| 228 |
+
(words(('true', 'false', 'null'), suffix=r'\b'), Keyword.Constant),
|
| 229 |
+
],
|
| 230 |
+
'functions': [
|
| 231 |
+
(words((
|
| 232 |
+
"min", "max", "sum", "average", "stddev", "every", "any",
|
| 233 |
+
"concat_array", "count", "lag", "lead", "first", "last",
|
| 234 |
+
"rank", "rank_dense", "row_number", "round", "as", "in",
|
| 235 |
+
"tuple_every", "tuple_map", "tuple_zip", "_eq", "_is_null",
|
| 236 |
+
"from_text", "lower", "upper", "read_parquet", "read_csv"),
|
| 237 |
+
suffix=r'\b'),
|
| 238 |
+
Name.Function),
|
| 239 |
+
],
|
| 240 |
+
|
| 241 |
+
'comment': [
|
| 242 |
+
(r'-(?!\})', Comment.Multiline),
|
| 243 |
+
(r'\{-', Comment.Multiline, 'comment'),
|
| 244 |
+
(r'[^-}]', Comment.Multiline),
|
| 245 |
+
(r'-\}', Comment.Multiline, '#pop'),
|
| 246 |
+
],
|
| 247 |
+
|
| 248 |
+
'imports': [
|
| 249 |
+
(r'\w+(\.\w+)*', Name.Class, '#pop'),
|
| 250 |
+
],
|
| 251 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/ptx.py
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.ptx
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for other PTX language.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 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 Comment, Keyword, Name, String, Number, \
|
| 13 |
+
Punctuation, Whitespace, Operator
|
| 14 |
+
|
| 15 |
+
__all__ = ["PtxLexer"]
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
class PtxLexer(RegexLexer):
|
| 19 |
+
"""
|
| 20 |
+
For NVIDIA `PTX <https://docs.nvidia.com/cuda/parallel-thread-execution/>`_
|
| 21 |
+
source.
|
| 22 |
+
"""
|
| 23 |
+
name = 'PTX'
|
| 24 |
+
url = "https://docs.nvidia.com/cuda/parallel-thread-execution/"
|
| 25 |
+
filenames = ['*.ptx']
|
| 26 |
+
aliases = ['ptx']
|
| 27 |
+
mimetypes = ['text/x-ptx']
|
| 28 |
+
version_added = '2.16'
|
| 29 |
+
|
| 30 |
+
#: optional Comment or Whitespace
|
| 31 |
+
string = r'"[^"]*?"'
|
| 32 |
+
followsym = r'[a-zA-Z0-9_$]'
|
| 33 |
+
identifier = r'([-a-zA-Z$._][\w\-$.]*|' + string + ')'
|
| 34 |
+
block_label = r'(' + identifier + r'|(\d+))'
|
| 35 |
+
|
| 36 |
+
tokens = {
|
| 37 |
+
'root': [
|
| 38 |
+
include('whitespace'),
|
| 39 |
+
|
| 40 |
+
(block_label + r'\s*:', Name.Label),
|
| 41 |
+
|
| 42 |
+
include('keyword'),
|
| 43 |
+
|
| 44 |
+
(r'%' + identifier, Name.Variable),
|
| 45 |
+
(r'%\d+', Name.Variable.Anonymous),
|
| 46 |
+
(r'c?' + string, String),
|
| 47 |
+
(identifier, Name.Variable),
|
| 48 |
+
(r';', Punctuation),
|
| 49 |
+
(r'[*+-/]', Operator),
|
| 50 |
+
|
| 51 |
+
(r'0[xX][a-fA-F0-9]+', Number),
|
| 52 |
+
(r'-?\d+(?:[.]\d+)?(?:[eE][-+]?\d+(?:[.]\d+)?)?', Number),
|
| 53 |
+
|
| 54 |
+
(r'[=<>{}\[\]()*.,!]|x\b', Punctuation)
|
| 55 |
+
|
| 56 |
+
],
|
| 57 |
+
'whitespace': [
|
| 58 |
+
(r'(\n|\s+)+', Whitespace),
|
| 59 |
+
(r'//.*?\n', Comment)
|
| 60 |
+
],
|
| 61 |
+
|
| 62 |
+
'keyword': [
|
| 63 |
+
# Instruction keywords
|
| 64 |
+
(words((
|
| 65 |
+
'abs', 'discard', 'min', 'shf', 'vadd',
|
| 66 |
+
'activemask', 'div', 'mma', 'shfl', 'vadd2',
|
| 67 |
+
'add', 'dp2a', 'mov', 'shl', 'vadd4',
|
| 68 |
+
'addc', 'dp4a', 'movmatrix', 'shr', 'vavrg2',
|
| 69 |
+
'alloca', 'elect', 'mul', 'sin', 'vavrg4',
|
| 70 |
+
'and', 'ex2', 'mul24', 'slct', 'vmad',
|
| 71 |
+
'applypriority', 'exit', 'multimem', 'sqrt', 'vmax',
|
| 72 |
+
'atom', 'fence', 'nanosleep', 'st', 'vmax2',
|
| 73 |
+
'bar', 'fma', 'neg', 'stackrestore', 'vmax4',
|
| 74 |
+
'barrier', 'fns', 'not', 'stacksave', 'vmin',
|
| 75 |
+
'bfe', 'getctarank', 'or', 'stmatrix', 'vmin2',
|
| 76 |
+
'bfi', 'griddepcontrol', 'pmevent', 'sub', 'vmin4',
|
| 77 |
+
'bfind', 'isspacep', 'popc', 'subc', 'vote',
|
| 78 |
+
'bmsk', 'istypep', 'prefetch', 'suld', 'vset',
|
| 79 |
+
'bra', 'ld', 'prefetchu', 'suq', 'vset2',
|
| 80 |
+
'brev', 'ldmatrix', 'prmt', 'sured', 'vset4',
|
| 81 |
+
'brkpt', 'ldu', 'rcp', 'sust', 'vshl',
|
| 82 |
+
'brx', 'lg2', 'red', 'szext', 'vshr',
|
| 83 |
+
'call', 'lop3', 'redux', 'tanh', 'vsub',
|
| 84 |
+
'clz', 'mad', 'rem', 'testp', 'vsub2',
|
| 85 |
+
'cnot', 'mad24', 'ret', 'tex', 'vsub4',
|
| 86 |
+
'copysign', 'madc', 'rsqrt', 'tld4', 'wgmma',
|
| 87 |
+
'cos', 'mapa', 'sad', 'trap', 'wmma',
|
| 88 |
+
'cp', 'match', 'selp', 'txq', 'xor',
|
| 89 |
+
'createpolicy', 'max', 'set', 'vabsdiff', 'cvt',
|
| 90 |
+
'mbarrier', 'setmaxnreg', 'vabsdiff2', 'cvta',
|
| 91 |
+
'membar', 'setp', 'vabsdiff4')), Keyword),
|
| 92 |
+
# State Spaces and Suffixes
|
| 93 |
+
(words((
|
| 94 |
+
'reg', '.sreg', '.const', '.global',
|
| 95 |
+
'.local', '.param', '.shared', '.tex',
|
| 96 |
+
'.wide', '.loc'
|
| 97 |
+
)), Keyword.Pseudo),
|
| 98 |
+
# PTX Directives
|
| 99 |
+
(words((
|
| 100 |
+
'.address_size', '.explicitcluster', '.maxnreg', '.section',
|
| 101 |
+
'.alias', '.extern', '.maxntid', '.shared',
|
| 102 |
+
'.align', '.file', '.minnctapersm', '.sreg',
|
| 103 |
+
'.branchtargets', '.func', '.noreturn', '.target',
|
| 104 |
+
'.callprototype', '.global', '.param', '.tex',
|
| 105 |
+
'.calltargets', '.loc', '.pragma', '.version',
|
| 106 |
+
'.common', '.local', '.reg', '.visible',
|
| 107 |
+
'.const', '.maxclusterrank', '.reqnctapercluster', '.weak',
|
| 108 |
+
'.entry', '.maxnctapersm', '.reqntid')), Keyword.Reserved),
|
| 109 |
+
# Fundamental Types
|
| 110 |
+
(words((
|
| 111 |
+
'.s8', '.s16', '.s32', '.s64',
|
| 112 |
+
'.u8', '.u16', '.u32', '.u64',
|
| 113 |
+
'.f16', '.f16x2', '.f32', '.f64',
|
| 114 |
+
'.b8', '.b16', '.b32', '.b64',
|
| 115 |
+
'.pred'
|
| 116 |
+
)), Keyword.Type)
|
| 117 |
+
],
|
| 118 |
+
|
| 119 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/python.py
ADDED
|
@@ -0,0 +1,1201 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.python
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for Python and related languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import keyword
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import DelegatingLexer, RegexLexer, include, \
|
| 14 |
+
bygroups, using, default, words, combined, this
|
| 15 |
+
from pygments.util import get_bool_opt, shebang_matches
|
| 16 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 17 |
+
Number, Punctuation, Generic, Other, Error, Whitespace
|
| 18 |
+
from pygments import unistring as uni
|
| 19 |
+
|
| 20 |
+
__all__ = ['PythonLexer', 'PythonConsoleLexer', 'PythonTracebackLexer',
|
| 21 |
+
'Python2Lexer', 'Python2TracebackLexer',
|
| 22 |
+
'CythonLexer', 'DgLexer', 'NumPyLexer']
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
class PythonLexer(RegexLexer):
|
| 26 |
+
"""
|
| 27 |
+
For Python source code (version 3.x).
|
| 28 |
+
|
| 29 |
+
.. versionchanged:: 2.5
|
| 30 |
+
This is now the default ``PythonLexer``. It is still available as the
|
| 31 |
+
alias ``Python3Lexer``.
|
| 32 |
+
"""
|
| 33 |
+
|
| 34 |
+
name = 'Python'
|
| 35 |
+
url = 'https://www.python.org'
|
| 36 |
+
aliases = ['python', 'py', 'sage', 'python3', 'py3', 'bazel', 'starlark', 'pyi']
|
| 37 |
+
filenames = [
|
| 38 |
+
'*.py',
|
| 39 |
+
'*.pyw',
|
| 40 |
+
# Type stubs
|
| 41 |
+
'*.pyi',
|
| 42 |
+
# Jython
|
| 43 |
+
'*.jy',
|
| 44 |
+
# Sage
|
| 45 |
+
'*.sage',
|
| 46 |
+
# SCons
|
| 47 |
+
'*.sc',
|
| 48 |
+
'SConstruct',
|
| 49 |
+
'SConscript',
|
| 50 |
+
# Skylark/Starlark (used by Bazel, Buck, and Pants)
|
| 51 |
+
'*.bzl',
|
| 52 |
+
'BUCK',
|
| 53 |
+
'BUILD',
|
| 54 |
+
'BUILD.bazel',
|
| 55 |
+
'WORKSPACE',
|
| 56 |
+
# Twisted Application infrastructure
|
| 57 |
+
'*.tac',
|
| 58 |
+
]
|
| 59 |
+
mimetypes = ['text/x-python', 'application/x-python',
|
| 60 |
+
'text/x-python3', 'application/x-python3']
|
| 61 |
+
version_added = '0.10'
|
| 62 |
+
|
| 63 |
+
uni_name = f"[{uni.xid_start}][{uni.xid_continue}]*"
|
| 64 |
+
|
| 65 |
+
def innerstring_rules(ttype):
|
| 66 |
+
return [
|
| 67 |
+
# the old style '%s' % (...) string formatting (still valid in Py3)
|
| 68 |
+
(r'%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
|
| 69 |
+
'[hlL]?[E-GXc-giorsaux%]', String.Interpol),
|
| 70 |
+
# the new style '{}'.format(...) string formatting
|
| 71 |
+
(r'\{'
|
| 72 |
+
r'((\w+)((\.\w+)|(\[[^\]]+\]))*)?' # field name
|
| 73 |
+
r'(\![sra])?' # conversion
|
| 74 |
+
r'(\:(.?[<>=\^])?[-+ ]?#?0?(\d+)?,?(\.\d+)?[E-GXb-gnosx%]?)?'
|
| 75 |
+
r'\}', String.Interpol),
|
| 76 |
+
|
| 77 |
+
# backslashes, quotes and formatting signs must be parsed one at a time
|
| 78 |
+
(r'[^\\\'"%{\n]+', ttype),
|
| 79 |
+
(r'[\'"\\]', ttype),
|
| 80 |
+
# unhandled string formatting sign
|
| 81 |
+
(r'%|(\{{1,2})', ttype)
|
| 82 |
+
# newlines are an error (use "nl" state)
|
| 83 |
+
]
|
| 84 |
+
|
| 85 |
+
def fstring_rules(ttype):
|
| 86 |
+
return [
|
| 87 |
+
# Assuming that a '}' is the closing brace after format specifier.
|
| 88 |
+
# Sadly, this means that we won't detect syntax error. But it's
|
| 89 |
+
# more important to parse correct syntax correctly, than to
|
| 90 |
+
# highlight invalid syntax.
|
| 91 |
+
(r'\}', String.Interpol),
|
| 92 |
+
(r'\{', String.Interpol, 'expr-inside-fstring'),
|
| 93 |
+
# backslashes, quotes and formatting signs must be parsed one at a time
|
| 94 |
+
(r'[^\\\'"{}\n]+', ttype),
|
| 95 |
+
(r'[\'"\\]', ttype),
|
| 96 |
+
# newlines are an error (use "nl" state)
|
| 97 |
+
]
|
| 98 |
+
|
| 99 |
+
tokens = {
|
| 100 |
+
'root': [
|
| 101 |
+
(r'\n', Whitespace),
|
| 102 |
+
(r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")',
|
| 103 |
+
bygroups(Whitespace, String.Affix, String.Doc)),
|
| 104 |
+
(r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')",
|
| 105 |
+
bygroups(Whitespace, String.Affix, String.Doc)),
|
| 106 |
+
(r'\A#!.+$', Comment.Hashbang),
|
| 107 |
+
(r'#.*$', Comment.Single),
|
| 108 |
+
(r'\\\n', Text),
|
| 109 |
+
(r'\\', Text),
|
| 110 |
+
include('keywords'),
|
| 111 |
+
include('soft-keywords'),
|
| 112 |
+
(r'(def)((?:\s|\\\s)+)', bygroups(Keyword, Whitespace), 'funcname'),
|
| 113 |
+
(r'(class)((?:\s|\\\s)+)', bygroups(Keyword, Whitespace), 'classname'),
|
| 114 |
+
(r'(from)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Whitespace),
|
| 115 |
+
'fromimport'),
|
| 116 |
+
(r'(import)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Whitespace),
|
| 117 |
+
'import'),
|
| 118 |
+
include('expr'),
|
| 119 |
+
],
|
| 120 |
+
'expr': [
|
| 121 |
+
# raw f-strings
|
| 122 |
+
('(?i)(rf|fr)(""")',
|
| 123 |
+
bygroups(String.Affix, String.Double),
|
| 124 |
+
combined('rfstringescape', 'tdqf')),
|
| 125 |
+
("(?i)(rf|fr)(''')",
|
| 126 |
+
bygroups(String.Affix, String.Single),
|
| 127 |
+
combined('rfstringescape', 'tsqf')),
|
| 128 |
+
('(?i)(rf|fr)(")',
|
| 129 |
+
bygroups(String.Affix, String.Double),
|
| 130 |
+
combined('rfstringescape', 'dqf')),
|
| 131 |
+
("(?i)(rf|fr)(')",
|
| 132 |
+
bygroups(String.Affix, String.Single),
|
| 133 |
+
combined('rfstringescape', 'sqf')),
|
| 134 |
+
# non-raw f-strings
|
| 135 |
+
('([fF])(""")', bygroups(String.Affix, String.Double),
|
| 136 |
+
combined('fstringescape', 'tdqf')),
|
| 137 |
+
("([fF])(''')", bygroups(String.Affix, String.Single),
|
| 138 |
+
combined('fstringescape', 'tsqf')),
|
| 139 |
+
('([fF])(")', bygroups(String.Affix, String.Double),
|
| 140 |
+
combined('fstringescape', 'dqf')),
|
| 141 |
+
("([fF])(')", bygroups(String.Affix, String.Single),
|
| 142 |
+
combined('fstringescape', 'sqf')),
|
| 143 |
+
# raw bytes and strings
|
| 144 |
+
('(?i)(rb|br|r)(""")',
|
| 145 |
+
bygroups(String.Affix, String.Double), 'tdqs'),
|
| 146 |
+
("(?i)(rb|br|r)(''')",
|
| 147 |
+
bygroups(String.Affix, String.Single), 'tsqs'),
|
| 148 |
+
('(?i)(rb|br|r)(")',
|
| 149 |
+
bygroups(String.Affix, String.Double), 'dqs'),
|
| 150 |
+
("(?i)(rb|br|r)(')",
|
| 151 |
+
bygroups(String.Affix, String.Single), 'sqs'),
|
| 152 |
+
# non-raw strings
|
| 153 |
+
('([uU]?)(""")', bygroups(String.Affix, String.Double),
|
| 154 |
+
combined('stringescape', 'tdqs')),
|
| 155 |
+
("([uU]?)(''')", bygroups(String.Affix, String.Single),
|
| 156 |
+
combined('stringescape', 'tsqs')),
|
| 157 |
+
('([uU]?)(")', bygroups(String.Affix, String.Double),
|
| 158 |
+
combined('stringescape', 'dqs')),
|
| 159 |
+
("([uU]?)(')", bygroups(String.Affix, String.Single),
|
| 160 |
+
combined('stringescape', 'sqs')),
|
| 161 |
+
# non-raw bytes
|
| 162 |
+
('([bB])(""")', bygroups(String.Affix, String.Double),
|
| 163 |
+
combined('bytesescape', 'tdqs')),
|
| 164 |
+
("([bB])(''')", bygroups(String.Affix, String.Single),
|
| 165 |
+
combined('bytesescape', 'tsqs')),
|
| 166 |
+
('([bB])(")', bygroups(String.Affix, String.Double),
|
| 167 |
+
combined('bytesescape', 'dqs')),
|
| 168 |
+
("([bB])(')", bygroups(String.Affix, String.Single),
|
| 169 |
+
combined('bytesescape', 'sqs')),
|
| 170 |
+
|
| 171 |
+
(r'[^\S\n]+', Text),
|
| 172 |
+
include('numbers'),
|
| 173 |
+
(r'!=|==|<<|>>|:=|[-~+/*%=<>&^|.]', Operator),
|
| 174 |
+
(r'[]{}:(),;[]', Punctuation),
|
| 175 |
+
(r'(in|is|and|or|not)\b', Operator.Word),
|
| 176 |
+
include('expr-keywords'),
|
| 177 |
+
include('builtins'),
|
| 178 |
+
include('magicfuncs'),
|
| 179 |
+
include('magicvars'),
|
| 180 |
+
include('name'),
|
| 181 |
+
],
|
| 182 |
+
'expr-inside-fstring': [
|
| 183 |
+
(r'[{([]', Punctuation, 'expr-inside-fstring-inner'),
|
| 184 |
+
# without format specifier
|
| 185 |
+
(r'(=\s*)?' # debug (https://bugs.python.org/issue36817)
|
| 186 |
+
r'(\![sraf])?' # conversion
|
| 187 |
+
r'\}', String.Interpol, '#pop'),
|
| 188 |
+
# with format specifier
|
| 189 |
+
# we'll catch the remaining '}' in the outer scope
|
| 190 |
+
(r'(=\s*)?' # debug (https://bugs.python.org/issue36817)
|
| 191 |
+
r'(\![sraf])?' # conversion
|
| 192 |
+
r':', String.Interpol, '#pop'),
|
| 193 |
+
(r'\s+', Whitespace), # allow new lines
|
| 194 |
+
include('expr'),
|
| 195 |
+
],
|
| 196 |
+
'expr-inside-fstring-inner': [
|
| 197 |
+
(r'[{([]', Punctuation, 'expr-inside-fstring-inner'),
|
| 198 |
+
(r'[])}]', Punctuation, '#pop'),
|
| 199 |
+
(r'\s+', Whitespace), # allow new lines
|
| 200 |
+
include('expr'),
|
| 201 |
+
],
|
| 202 |
+
'expr-keywords': [
|
| 203 |
+
# Based on https://docs.python.org/3/reference/expressions.html
|
| 204 |
+
(words((
|
| 205 |
+
'async for', 'await', 'else', 'for', 'if', 'lambda',
|
| 206 |
+
'yield', 'yield from'), suffix=r'\b'),
|
| 207 |
+
Keyword),
|
| 208 |
+
(words(('True', 'False', 'None'), suffix=r'\b'), Keyword.Constant),
|
| 209 |
+
],
|
| 210 |
+
'keywords': [
|
| 211 |
+
(words((
|
| 212 |
+
'assert', 'async', 'await', 'break', 'continue', 'del', 'elif',
|
| 213 |
+
'else', 'except', 'finally', 'for', 'global', 'if', 'lambda',
|
| 214 |
+
'pass', 'raise', 'nonlocal', 'return', 'try', 'while', 'yield',
|
| 215 |
+
'yield from', 'as', 'with'), suffix=r'\b'),
|
| 216 |
+
Keyword),
|
| 217 |
+
(words(('True', 'False', 'None'), suffix=r'\b'), Keyword.Constant),
|
| 218 |
+
],
|
| 219 |
+
'soft-keywords': [
|
| 220 |
+
# `match`, `case` and `_` soft keywords
|
| 221 |
+
(r'(^[ \t]*)' # at beginning of line + possible indentation
|
| 222 |
+
r'(match|case)\b' # a possible keyword
|
| 223 |
+
r'(?![ \t]*(?:' # not followed by...
|
| 224 |
+
r'[:,;=^&|@~)\]}]|(?:' + # characters and keywords that mean this isn't
|
| 225 |
+
# pattern matching (but None/True/False is ok)
|
| 226 |
+
r'|'.join(k for k in keyword.kwlist if k[0].islower()) + r')\b))',
|
| 227 |
+
bygroups(Text, Keyword), 'soft-keywords-inner'),
|
| 228 |
+
],
|
| 229 |
+
'soft-keywords-inner': [
|
| 230 |
+
# optional `_` keyword
|
| 231 |
+
(r'(\s+)([^\n_]*)(_\b)', bygroups(Whitespace, using(this), Keyword)),
|
| 232 |
+
default('#pop')
|
| 233 |
+
],
|
| 234 |
+
'builtins': [
|
| 235 |
+
(words((
|
| 236 |
+
'__import__', 'abs', 'aiter', 'all', 'any', 'bin', 'bool', 'bytearray',
|
| 237 |
+
'breakpoint', 'bytes', 'callable', 'chr', 'classmethod', 'compile',
|
| 238 |
+
'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval',
|
| 239 |
+
'filter', 'float', 'format', 'frozenset', 'getattr', 'globals',
|
| 240 |
+
'hasattr', 'hash', 'hex', 'id', 'input', 'int', 'isinstance',
|
| 241 |
+
'issubclass', 'iter', 'len', 'list', 'locals', 'map', 'max',
|
| 242 |
+
'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow',
|
| 243 |
+
'print', 'property', 'range', 'repr', 'reversed', 'round', 'set',
|
| 244 |
+
'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super',
|
| 245 |
+
'tuple', 'type', 'vars', 'zip'), prefix=r'(?<!\.)', suffix=r'\b'),
|
| 246 |
+
Name.Builtin),
|
| 247 |
+
(r'(?<!\.)(self|Ellipsis|NotImplemented|cls)\b', Name.Builtin.Pseudo),
|
| 248 |
+
(words((
|
| 249 |
+
'ArithmeticError', 'AssertionError', 'AttributeError',
|
| 250 |
+
'BaseException', 'BufferError', 'BytesWarning', 'DeprecationWarning',
|
| 251 |
+
'EOFError', 'EnvironmentError', 'Exception', 'FloatingPointError',
|
| 252 |
+
'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError',
|
| 253 |
+
'ImportWarning', 'IndentationError', 'IndexError', 'KeyError',
|
| 254 |
+
'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError',
|
| 255 |
+
'NotImplementedError', 'OSError', 'OverflowError',
|
| 256 |
+
'PendingDeprecationWarning', 'ReferenceError', 'ResourceWarning',
|
| 257 |
+
'RuntimeError', 'RuntimeWarning', 'StopIteration',
|
| 258 |
+
'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit',
|
| 259 |
+
'TabError', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError',
|
| 260 |
+
'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError',
|
| 261 |
+
'UnicodeWarning', 'UserWarning', 'ValueError', 'VMSError',
|
| 262 |
+
'Warning', 'WindowsError', 'ZeroDivisionError',
|
| 263 |
+
# new builtin exceptions from PEP 3151
|
| 264 |
+
'BlockingIOError', 'ChildProcessError', 'ConnectionError',
|
| 265 |
+
'BrokenPipeError', 'ConnectionAbortedError', 'ConnectionRefusedError',
|
| 266 |
+
'ConnectionResetError', 'FileExistsError', 'FileNotFoundError',
|
| 267 |
+
'InterruptedError', 'IsADirectoryError', 'NotADirectoryError',
|
| 268 |
+
'PermissionError', 'ProcessLookupError', 'TimeoutError',
|
| 269 |
+
# others new in Python 3
|
| 270 |
+
'StopAsyncIteration', 'ModuleNotFoundError', 'RecursionError',
|
| 271 |
+
'EncodingWarning'),
|
| 272 |
+
prefix=r'(?<!\.)', suffix=r'\b'),
|
| 273 |
+
Name.Exception),
|
| 274 |
+
],
|
| 275 |
+
'magicfuncs': [
|
| 276 |
+
(words((
|
| 277 |
+
'__abs__', '__add__', '__aenter__', '__aexit__', '__aiter__',
|
| 278 |
+
'__and__', '__anext__', '__await__', '__bool__', '__bytes__',
|
| 279 |
+
'__call__', '__complex__', '__contains__', '__del__', '__delattr__',
|
| 280 |
+
'__delete__', '__delitem__', '__dir__', '__divmod__', '__enter__',
|
| 281 |
+
'__eq__', '__exit__', '__float__', '__floordiv__', '__format__',
|
| 282 |
+
'__ge__', '__get__', '__getattr__', '__getattribute__',
|
| 283 |
+
'__getitem__', '__gt__', '__hash__', '__iadd__', '__iand__',
|
| 284 |
+
'__ifloordiv__', '__ilshift__', '__imatmul__', '__imod__',
|
| 285 |
+
'__imul__', '__index__', '__init__', '__instancecheck__',
|
| 286 |
+
'__int__', '__invert__', '__ior__', '__ipow__', '__irshift__',
|
| 287 |
+
'__isub__', '__iter__', '__itruediv__', '__ixor__', '__le__',
|
| 288 |
+
'__len__', '__length_hint__', '__lshift__', '__lt__', '__matmul__',
|
| 289 |
+
'__missing__', '__mod__', '__mul__', '__ne__', '__neg__',
|
| 290 |
+
'__new__', '__next__', '__or__', '__pos__', '__pow__',
|
| 291 |
+
'__prepare__', '__radd__', '__rand__', '__rdivmod__', '__repr__',
|
| 292 |
+
'__reversed__', '__rfloordiv__', '__rlshift__', '__rmatmul__',
|
| 293 |
+
'__rmod__', '__rmul__', '__ror__', '__round__', '__rpow__',
|
| 294 |
+
'__rrshift__', '__rshift__', '__rsub__', '__rtruediv__',
|
| 295 |
+
'__rxor__', '__set__', '__setattr__', '__setitem__', '__str__',
|
| 296 |
+
'__sub__', '__subclasscheck__', '__truediv__',
|
| 297 |
+
'__xor__'), suffix=r'\b'),
|
| 298 |
+
Name.Function.Magic),
|
| 299 |
+
],
|
| 300 |
+
'magicvars': [
|
| 301 |
+
(words((
|
| 302 |
+
'__annotations__', '__bases__', '__class__', '__closure__',
|
| 303 |
+
'__code__', '__defaults__', '__dict__', '__doc__', '__file__',
|
| 304 |
+
'__func__', '__globals__', '__kwdefaults__', '__module__',
|
| 305 |
+
'__mro__', '__name__', '__objclass__', '__qualname__',
|
| 306 |
+
'__self__', '__slots__', '__weakref__'), suffix=r'\b'),
|
| 307 |
+
Name.Variable.Magic),
|
| 308 |
+
],
|
| 309 |
+
'numbers': [
|
| 310 |
+
(r'(\d(?:_?\d)*\.(?:\d(?:_?\d)*)?|(?:\d(?:_?\d)*)?\.\d(?:_?\d)*)'
|
| 311 |
+
r'([eE][+-]?\d(?:_?\d)*)?', Number.Float),
|
| 312 |
+
(r'\d(?:_?\d)*[eE][+-]?\d(?:_?\d)*j?', Number.Float),
|
| 313 |
+
(r'0[oO](?:_?[0-7])+', Number.Oct),
|
| 314 |
+
(r'0[bB](?:_?[01])+', Number.Bin),
|
| 315 |
+
(r'0[xX](?:_?[a-fA-F0-9])+', Number.Hex),
|
| 316 |
+
(r'\d(?:_?\d)*', Number.Integer),
|
| 317 |
+
],
|
| 318 |
+
'name': [
|
| 319 |
+
(r'@' + uni_name, Name.Decorator),
|
| 320 |
+
(r'@', Operator), # new matrix multiplication operator
|
| 321 |
+
(uni_name, Name),
|
| 322 |
+
],
|
| 323 |
+
'funcname': [
|
| 324 |
+
include('magicfuncs'),
|
| 325 |
+
(uni_name, Name.Function, '#pop'),
|
| 326 |
+
default('#pop'),
|
| 327 |
+
],
|
| 328 |
+
'classname': [
|
| 329 |
+
(uni_name, Name.Class, '#pop'),
|
| 330 |
+
],
|
| 331 |
+
'import': [
|
| 332 |
+
(r'(\s+)(as)(\s+)', bygroups(Whitespace, Keyword, Whitespace)),
|
| 333 |
+
(r'\.', Name.Namespace),
|
| 334 |
+
(uni_name, Name.Namespace),
|
| 335 |
+
(r'(\s*)(,)(\s*)', bygroups(Whitespace, Operator, Whitespace)),
|
| 336 |
+
default('#pop') # all else: go back
|
| 337 |
+
],
|
| 338 |
+
'fromimport': [
|
| 339 |
+
(r'(\s+)(import)\b', bygroups(Whitespace, Keyword.Namespace), '#pop'),
|
| 340 |
+
(r'\.', Name.Namespace),
|
| 341 |
+
# if None occurs here, it's "raise x from None", since None can
|
| 342 |
+
# never be a module name
|
| 343 |
+
(r'None\b', Keyword.Constant, '#pop'),
|
| 344 |
+
(uni_name, Name.Namespace),
|
| 345 |
+
default('#pop'),
|
| 346 |
+
],
|
| 347 |
+
'rfstringescape': [
|
| 348 |
+
(r'\{\{', String.Escape),
|
| 349 |
+
(r'\}\}', String.Escape),
|
| 350 |
+
],
|
| 351 |
+
'fstringescape': [
|
| 352 |
+
include('rfstringescape'),
|
| 353 |
+
include('stringescape'),
|
| 354 |
+
],
|
| 355 |
+
'bytesescape': [
|
| 356 |
+
(r'\\([\\abfnrtv"\']|\n|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
|
| 357 |
+
],
|
| 358 |
+
'stringescape': [
|
| 359 |
+
(r'\\(N\{.*?\}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8})', String.Escape),
|
| 360 |
+
include('bytesescape')
|
| 361 |
+
],
|
| 362 |
+
'fstrings-single': fstring_rules(String.Single),
|
| 363 |
+
'fstrings-double': fstring_rules(String.Double),
|
| 364 |
+
'strings-single': innerstring_rules(String.Single),
|
| 365 |
+
'strings-double': innerstring_rules(String.Double),
|
| 366 |
+
'dqf': [
|
| 367 |
+
(r'"', String.Double, '#pop'),
|
| 368 |
+
(r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
|
| 369 |
+
include('fstrings-double')
|
| 370 |
+
],
|
| 371 |
+
'sqf': [
|
| 372 |
+
(r"'", String.Single, '#pop'),
|
| 373 |
+
(r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings
|
| 374 |
+
include('fstrings-single')
|
| 375 |
+
],
|
| 376 |
+
'dqs': [
|
| 377 |
+
(r'"', String.Double, '#pop'),
|
| 378 |
+
(r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
|
| 379 |
+
include('strings-double')
|
| 380 |
+
],
|
| 381 |
+
'sqs': [
|
| 382 |
+
(r"'", String.Single, '#pop'),
|
| 383 |
+
(r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings
|
| 384 |
+
include('strings-single')
|
| 385 |
+
],
|
| 386 |
+
'tdqf': [
|
| 387 |
+
(r'"""', String.Double, '#pop'),
|
| 388 |
+
include('fstrings-double'),
|
| 389 |
+
(r'\n', String.Double)
|
| 390 |
+
],
|
| 391 |
+
'tsqf': [
|
| 392 |
+
(r"'''", String.Single, '#pop'),
|
| 393 |
+
include('fstrings-single'),
|
| 394 |
+
(r'\n', String.Single)
|
| 395 |
+
],
|
| 396 |
+
'tdqs': [
|
| 397 |
+
(r'"""', String.Double, '#pop'),
|
| 398 |
+
include('strings-double'),
|
| 399 |
+
(r'\n', String.Double)
|
| 400 |
+
],
|
| 401 |
+
'tsqs': [
|
| 402 |
+
(r"'''", String.Single, '#pop'),
|
| 403 |
+
include('strings-single'),
|
| 404 |
+
(r'\n', String.Single)
|
| 405 |
+
],
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
def analyse_text(text):
|
| 409 |
+
return shebang_matches(text, r'pythonw?(3(\.\d)?)?') or \
|
| 410 |
+
'import ' in text[:1000]
|
| 411 |
+
|
| 412 |
+
|
| 413 |
+
Python3Lexer = PythonLexer
|
| 414 |
+
|
| 415 |
+
|
| 416 |
+
class Python2Lexer(RegexLexer):
|
| 417 |
+
"""
|
| 418 |
+
For Python 2.x source code.
|
| 419 |
+
|
| 420 |
+
.. versionchanged:: 2.5
|
| 421 |
+
This class has been renamed from ``PythonLexer``. ``PythonLexer`` now
|
| 422 |
+
refers to the Python 3 variant. File name patterns like ``*.py`` have
|
| 423 |
+
been moved to Python 3 as well.
|
| 424 |
+
"""
|
| 425 |
+
|
| 426 |
+
name = 'Python 2.x'
|
| 427 |
+
url = 'https://www.python.org'
|
| 428 |
+
aliases = ['python2', 'py2']
|
| 429 |
+
filenames = [] # now taken over by PythonLexer (3.x)
|
| 430 |
+
mimetypes = ['text/x-python2', 'application/x-python2']
|
| 431 |
+
version_added = ''
|
| 432 |
+
|
| 433 |
+
def innerstring_rules(ttype):
|
| 434 |
+
return [
|
| 435 |
+
# the old style '%s' % (...) string formatting
|
| 436 |
+
(r'%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
|
| 437 |
+
'[hlL]?[E-GXc-giorsux%]', String.Interpol),
|
| 438 |
+
# backslashes, quotes and formatting signs must be parsed one at a time
|
| 439 |
+
(r'[^\\\'"%\n]+', ttype),
|
| 440 |
+
(r'[\'"\\]', ttype),
|
| 441 |
+
# unhandled string formatting sign
|
| 442 |
+
(r'%', ttype),
|
| 443 |
+
# newlines are an error (use "nl" state)
|
| 444 |
+
]
|
| 445 |
+
|
| 446 |
+
tokens = {
|
| 447 |
+
'root': [
|
| 448 |
+
(r'\n', Whitespace),
|
| 449 |
+
(r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")',
|
| 450 |
+
bygroups(Whitespace, String.Affix, String.Doc)),
|
| 451 |
+
(r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')",
|
| 452 |
+
bygroups(Whitespace, String.Affix, String.Doc)),
|
| 453 |
+
(r'[^\S\n]+', Text),
|
| 454 |
+
(r'\A#!.+$', Comment.Hashbang),
|
| 455 |
+
(r'#.*$', Comment.Single),
|
| 456 |
+
(r'[]{}:(),;[]', Punctuation),
|
| 457 |
+
(r'\\\n', Text),
|
| 458 |
+
(r'\\', Text),
|
| 459 |
+
(r'(in|is|and|or|not)\b', Operator.Word),
|
| 460 |
+
(r'!=|==|<<|>>|[-~+/*%=<>&^|.]', Operator),
|
| 461 |
+
include('keywords'),
|
| 462 |
+
(r'(def)((?:\s|\\\s)+)', bygroups(Keyword, Whitespace), 'funcname'),
|
| 463 |
+
(r'(class)((?:\s|\\\s)+)', bygroups(Keyword, Whitespace), 'classname'),
|
| 464 |
+
(r'(from)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Whitespace),
|
| 465 |
+
'fromimport'),
|
| 466 |
+
(r'(import)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Whitespace),
|
| 467 |
+
'import'),
|
| 468 |
+
include('builtins'),
|
| 469 |
+
include('magicfuncs'),
|
| 470 |
+
include('magicvars'),
|
| 471 |
+
include('backtick'),
|
| 472 |
+
('([rR]|[uUbB][rR]|[rR][uUbB])(""")',
|
| 473 |
+
bygroups(String.Affix, String.Double), 'tdqs'),
|
| 474 |
+
("([rR]|[uUbB][rR]|[rR][uUbB])(''')",
|
| 475 |
+
bygroups(String.Affix, String.Single), 'tsqs'),
|
| 476 |
+
('([rR]|[uUbB][rR]|[rR][uUbB])(")',
|
| 477 |
+
bygroups(String.Affix, String.Double), 'dqs'),
|
| 478 |
+
("([rR]|[uUbB][rR]|[rR][uUbB])(')",
|
| 479 |
+
bygroups(String.Affix, String.Single), 'sqs'),
|
| 480 |
+
('([uUbB]?)(""")', bygroups(String.Affix, String.Double),
|
| 481 |
+
combined('stringescape', 'tdqs')),
|
| 482 |
+
("([uUbB]?)(''')", bygroups(String.Affix, String.Single),
|
| 483 |
+
combined('stringescape', 'tsqs')),
|
| 484 |
+
('([uUbB]?)(")', bygroups(String.Affix, String.Double),
|
| 485 |
+
combined('stringescape', 'dqs')),
|
| 486 |
+
("([uUbB]?)(')", bygroups(String.Affix, String.Single),
|
| 487 |
+
combined('stringescape', 'sqs')),
|
| 488 |
+
include('name'),
|
| 489 |
+
include('numbers'),
|
| 490 |
+
],
|
| 491 |
+
'keywords': [
|
| 492 |
+
(words((
|
| 493 |
+
'assert', 'break', 'continue', 'del', 'elif', 'else', 'except',
|
| 494 |
+
'exec', 'finally', 'for', 'global', 'if', 'lambda', 'pass',
|
| 495 |
+
'print', 'raise', 'return', 'try', 'while', 'yield',
|
| 496 |
+
'yield from', 'as', 'with'), suffix=r'\b'),
|
| 497 |
+
Keyword),
|
| 498 |
+
],
|
| 499 |
+
'builtins': [
|
| 500 |
+
(words((
|
| 501 |
+
'__import__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin',
|
| 502 |
+
'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod',
|
| 503 |
+
'cmp', 'coerce', 'compile', 'complex', 'delattr', 'dict', 'dir', 'divmod',
|
| 504 |
+
'enumerate', 'eval', 'execfile', 'exit', 'file', 'filter', 'float',
|
| 505 |
+
'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'hex', 'id',
|
| 506 |
+
'input', 'int', 'intern', 'isinstance', 'issubclass', 'iter', 'len',
|
| 507 |
+
'list', 'locals', 'long', 'map', 'max', 'min', 'next', 'object',
|
| 508 |
+
'oct', 'open', 'ord', 'pow', 'property', 'range', 'raw_input', 'reduce',
|
| 509 |
+
'reload', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice',
|
| 510 |
+
'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type',
|
| 511 |
+
'unichr', 'unicode', 'vars', 'xrange', 'zip'),
|
| 512 |
+
prefix=r'(?<!\.)', suffix=r'\b'),
|
| 513 |
+
Name.Builtin),
|
| 514 |
+
(r'(?<!\.)(self|None|Ellipsis|NotImplemented|False|True|cls'
|
| 515 |
+
r')\b', Name.Builtin.Pseudo),
|
| 516 |
+
(words((
|
| 517 |
+
'ArithmeticError', 'AssertionError', 'AttributeError',
|
| 518 |
+
'BaseException', 'DeprecationWarning', 'EOFError', 'EnvironmentError',
|
| 519 |
+
'Exception', 'FloatingPointError', 'FutureWarning', 'GeneratorExit',
|
| 520 |
+
'IOError', 'ImportError', 'ImportWarning', 'IndentationError',
|
| 521 |
+
'IndexError', 'KeyError', 'KeyboardInterrupt', 'LookupError',
|
| 522 |
+
'MemoryError', 'NameError',
|
| 523 |
+
'NotImplementedError', 'OSError', 'OverflowError', 'OverflowWarning',
|
| 524 |
+
'PendingDeprecationWarning', 'ReferenceError',
|
| 525 |
+
'RuntimeError', 'RuntimeWarning', 'StandardError', 'StopIteration',
|
| 526 |
+
'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit',
|
| 527 |
+
'TabError', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError',
|
| 528 |
+
'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError',
|
| 529 |
+
'UnicodeWarning', 'UserWarning', 'ValueError', 'VMSError', 'Warning',
|
| 530 |
+
'WindowsError', 'ZeroDivisionError'), prefix=r'(?<!\.)', suffix=r'\b'),
|
| 531 |
+
Name.Exception),
|
| 532 |
+
],
|
| 533 |
+
'magicfuncs': [
|
| 534 |
+
(words((
|
| 535 |
+
'__abs__', '__add__', '__and__', '__call__', '__cmp__', '__coerce__',
|
| 536 |
+
'__complex__', '__contains__', '__del__', '__delattr__', '__delete__',
|
| 537 |
+
'__delitem__', '__delslice__', '__div__', '__divmod__', '__enter__',
|
| 538 |
+
'__eq__', '__exit__', '__float__', '__floordiv__', '__ge__', '__get__',
|
| 539 |
+
'__getattr__', '__getattribute__', '__getitem__', '__getslice__', '__gt__',
|
| 540 |
+
'__hash__', '__hex__', '__iadd__', '__iand__', '__idiv__', '__ifloordiv__',
|
| 541 |
+
'__ilshift__', '__imod__', '__imul__', '__index__', '__init__',
|
| 542 |
+
'__instancecheck__', '__int__', '__invert__', '__iop__', '__ior__',
|
| 543 |
+
'__ipow__', '__irshift__', '__isub__', '__iter__', '__itruediv__',
|
| 544 |
+
'__ixor__', '__le__', '__len__', '__long__', '__lshift__', '__lt__',
|
| 545 |
+
'__missing__', '__mod__', '__mul__', '__ne__', '__neg__', '__new__',
|
| 546 |
+
'__nonzero__', '__oct__', '__op__', '__or__', '__pos__', '__pow__',
|
| 547 |
+
'__radd__', '__rand__', '__rcmp__', '__rdiv__', '__rdivmod__', '__repr__',
|
| 548 |
+
'__reversed__', '__rfloordiv__', '__rlshift__', '__rmod__', '__rmul__',
|
| 549 |
+
'__rop__', '__ror__', '__rpow__', '__rrshift__', '__rshift__', '__rsub__',
|
| 550 |
+
'__rtruediv__', '__rxor__', '__set__', '__setattr__', '__setitem__',
|
| 551 |
+
'__setslice__', '__str__', '__sub__', '__subclasscheck__', '__truediv__',
|
| 552 |
+
'__unicode__', '__xor__'), suffix=r'\b'),
|
| 553 |
+
Name.Function.Magic),
|
| 554 |
+
],
|
| 555 |
+
'magicvars': [
|
| 556 |
+
(words((
|
| 557 |
+
'__bases__', '__class__', '__closure__', '__code__', '__defaults__',
|
| 558 |
+
'__dict__', '__doc__', '__file__', '__func__', '__globals__',
|
| 559 |
+
'__metaclass__', '__module__', '__mro__', '__name__', '__self__',
|
| 560 |
+
'__slots__', '__weakref__'),
|
| 561 |
+
suffix=r'\b'),
|
| 562 |
+
Name.Variable.Magic),
|
| 563 |
+
],
|
| 564 |
+
'numbers': [
|
| 565 |
+
(r'(\d+\.\d*|\d*\.\d+)([eE][+-]?[0-9]+)?j?', Number.Float),
|
| 566 |
+
(r'\d+[eE][+-]?[0-9]+j?', Number.Float),
|
| 567 |
+
(r'0[0-7]+j?', Number.Oct),
|
| 568 |
+
(r'0[bB][01]+', Number.Bin),
|
| 569 |
+
(r'0[xX][a-fA-F0-9]+', Number.Hex),
|
| 570 |
+
(r'\d+L', Number.Integer.Long),
|
| 571 |
+
(r'\d+j?', Number.Integer)
|
| 572 |
+
],
|
| 573 |
+
'backtick': [
|
| 574 |
+
('`.*?`', String.Backtick),
|
| 575 |
+
],
|
| 576 |
+
'name': [
|
| 577 |
+
(r'@[\w.]+', Name.Decorator),
|
| 578 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 579 |
+
],
|
| 580 |
+
'funcname': [
|
| 581 |
+
include('magicfuncs'),
|
| 582 |
+
(r'[a-zA-Z_]\w*', Name.Function, '#pop'),
|
| 583 |
+
default('#pop'),
|
| 584 |
+
],
|
| 585 |
+
'classname': [
|
| 586 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop')
|
| 587 |
+
],
|
| 588 |
+
'import': [
|
| 589 |
+
(r'(?:[ \t]|\\\n)+', Text),
|
| 590 |
+
(r'as\b', Keyword.Namespace),
|
| 591 |
+
(r',', Operator),
|
| 592 |
+
(r'[a-zA-Z_][\w.]*', Name.Namespace),
|
| 593 |
+
default('#pop') # all else: go back
|
| 594 |
+
],
|
| 595 |
+
'fromimport': [
|
| 596 |
+
(r'(?:[ \t]|\\\n)+', Text),
|
| 597 |
+
(r'import\b', Keyword.Namespace, '#pop'),
|
| 598 |
+
# if None occurs here, it's "raise x from None", since None can
|
| 599 |
+
# never be a module name
|
| 600 |
+
(r'None\b', Name.Builtin.Pseudo, '#pop'),
|
| 601 |
+
# sadly, in "raise x from y" y will be highlighted as namespace too
|
| 602 |
+
(r'[a-zA-Z_.][\w.]*', Name.Namespace),
|
| 603 |
+
# anything else here also means "raise x from y" and is therefore
|
| 604 |
+
# not an error
|
| 605 |
+
default('#pop'),
|
| 606 |
+
],
|
| 607 |
+
'stringescape': [
|
| 608 |
+
(r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
|
| 609 |
+
r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
|
| 610 |
+
],
|
| 611 |
+
'strings-single': innerstring_rules(String.Single),
|
| 612 |
+
'strings-double': innerstring_rules(String.Double),
|
| 613 |
+
'dqs': [
|
| 614 |
+
(r'"', String.Double, '#pop'),
|
| 615 |
+
(r'\\\\|\\"|\\\n', String.Escape), # included here for raw strings
|
| 616 |
+
include('strings-double')
|
| 617 |
+
],
|
| 618 |
+
'sqs': [
|
| 619 |
+
(r"'", String.Single, '#pop'),
|
| 620 |
+
(r"\\\\|\\'|\\\n", String.Escape), # included here for raw strings
|
| 621 |
+
include('strings-single')
|
| 622 |
+
],
|
| 623 |
+
'tdqs': [
|
| 624 |
+
(r'"""', String.Double, '#pop'),
|
| 625 |
+
include('strings-double'),
|
| 626 |
+
(r'\n', String.Double)
|
| 627 |
+
],
|
| 628 |
+
'tsqs': [
|
| 629 |
+
(r"'''", String.Single, '#pop'),
|
| 630 |
+
include('strings-single'),
|
| 631 |
+
(r'\n', String.Single)
|
| 632 |
+
],
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
def analyse_text(text):
|
| 636 |
+
return shebang_matches(text, r'pythonw?2(\.\d)?')
|
| 637 |
+
|
| 638 |
+
|
| 639 |
+
class _PythonConsoleLexerBase(RegexLexer):
|
| 640 |
+
name = 'Python console session'
|
| 641 |
+
aliases = ['pycon', 'python-console']
|
| 642 |
+
mimetypes = ['text/x-python-doctest']
|
| 643 |
+
|
| 644 |
+
"""Auxiliary lexer for `PythonConsoleLexer`.
|
| 645 |
+
|
| 646 |
+
Code tokens are output as ``Token.Other.Code``, traceback tokens as
|
| 647 |
+
``Token.Other.Traceback``.
|
| 648 |
+
"""
|
| 649 |
+
tokens = {
|
| 650 |
+
'root': [
|
| 651 |
+
(r'(>>> )(.*\n)', bygroups(Generic.Prompt, Other.Code), 'continuations'),
|
| 652 |
+
# This happens, e.g., when tracebacks are embedded in documentation;
|
| 653 |
+
# trailing whitespaces are often stripped in such contexts.
|
| 654 |
+
(r'(>>>)(\n)', bygroups(Generic.Prompt, Whitespace)),
|
| 655 |
+
(r'(\^C)?Traceback \(most recent call last\):\n', Other.Traceback, 'traceback'),
|
| 656 |
+
# SyntaxError starts with this
|
| 657 |
+
(r' File "[^"]+", line \d+', Other.Traceback, 'traceback'),
|
| 658 |
+
(r'.*\n', Generic.Output),
|
| 659 |
+
],
|
| 660 |
+
'continuations': [
|
| 661 |
+
(r'(\.\.\. )(.*\n)', bygroups(Generic.Prompt, Other.Code)),
|
| 662 |
+
# See above.
|
| 663 |
+
(r'(\.\.\.)(\n)', bygroups(Generic.Prompt, Whitespace)),
|
| 664 |
+
default('#pop'),
|
| 665 |
+
],
|
| 666 |
+
'traceback': [
|
| 667 |
+
# As soon as we see a traceback, consume everything until the next
|
| 668 |
+
# >>> prompt.
|
| 669 |
+
(r'(?=>>>( |$))', Text, '#pop'),
|
| 670 |
+
(r'(KeyboardInterrupt)(\n)', bygroups(Name.Class, Whitespace)),
|
| 671 |
+
(r'.*\n', Other.Traceback),
|
| 672 |
+
],
|
| 673 |
+
}
|
| 674 |
+
|
| 675 |
+
|
| 676 |
+
class PythonConsoleLexer(DelegatingLexer):
|
| 677 |
+
"""
|
| 678 |
+
For Python console output or doctests, such as:
|
| 679 |
+
|
| 680 |
+
.. sourcecode:: pycon
|
| 681 |
+
|
| 682 |
+
>>> a = 'foo'
|
| 683 |
+
>>> print(a)
|
| 684 |
+
foo
|
| 685 |
+
>>> 1 / 0
|
| 686 |
+
Traceback (most recent call last):
|
| 687 |
+
File "<stdin>", line 1, in <module>
|
| 688 |
+
ZeroDivisionError: integer division or modulo by zero
|
| 689 |
+
|
| 690 |
+
Additional options:
|
| 691 |
+
|
| 692 |
+
`python3`
|
| 693 |
+
Use Python 3 lexer for code. Default is ``True``.
|
| 694 |
+
|
| 695 |
+
.. versionadded:: 1.0
|
| 696 |
+
.. versionchanged:: 2.5
|
| 697 |
+
Now defaults to ``True``.
|
| 698 |
+
"""
|
| 699 |
+
|
| 700 |
+
name = 'Python console session'
|
| 701 |
+
aliases = ['pycon', 'python-console']
|
| 702 |
+
mimetypes = ['text/x-python-doctest']
|
| 703 |
+
url = 'https://python.org'
|
| 704 |
+
version_added = ''
|
| 705 |
+
|
| 706 |
+
def __init__(self, **options):
|
| 707 |
+
python3 = get_bool_opt(options, 'python3', True)
|
| 708 |
+
if python3:
|
| 709 |
+
pylexer = PythonLexer
|
| 710 |
+
tblexer = PythonTracebackLexer
|
| 711 |
+
else:
|
| 712 |
+
pylexer = Python2Lexer
|
| 713 |
+
tblexer = Python2TracebackLexer
|
| 714 |
+
# We have two auxiliary lexers. Use DelegatingLexer twice with
|
| 715 |
+
# different tokens. TODO: DelegatingLexer should support this
|
| 716 |
+
# directly, by accepting a tuplet of auxiliary lexers and a tuple of
|
| 717 |
+
# distinguishing tokens. Then we wouldn't need this intermediary
|
| 718 |
+
# class.
|
| 719 |
+
class _ReplaceInnerCode(DelegatingLexer):
|
| 720 |
+
def __init__(self, **options):
|
| 721 |
+
super().__init__(pylexer, _PythonConsoleLexerBase, Other.Code, **options)
|
| 722 |
+
super().__init__(tblexer, _ReplaceInnerCode, Other.Traceback, **options)
|
| 723 |
+
|
| 724 |
+
|
| 725 |
+
class PythonTracebackLexer(RegexLexer):
|
| 726 |
+
"""
|
| 727 |
+
For Python 3.x tracebacks, with support for chained exceptions.
|
| 728 |
+
|
| 729 |
+
.. versionchanged:: 2.5
|
| 730 |
+
This is now the default ``PythonTracebackLexer``. It is still available
|
| 731 |
+
as the alias ``Python3TracebackLexer``.
|
| 732 |
+
"""
|
| 733 |
+
|
| 734 |
+
name = 'Python Traceback'
|
| 735 |
+
aliases = ['pytb', 'py3tb']
|
| 736 |
+
filenames = ['*.pytb', '*.py3tb']
|
| 737 |
+
mimetypes = ['text/x-python-traceback', 'text/x-python3-traceback']
|
| 738 |
+
url = 'https://python.org'
|
| 739 |
+
version_added = '1.0'
|
| 740 |
+
|
| 741 |
+
tokens = {
|
| 742 |
+
'root': [
|
| 743 |
+
(r'\n', Whitespace),
|
| 744 |
+
(r'^(\^C)?Traceback \(most recent call last\):\n', Generic.Traceback, 'intb'),
|
| 745 |
+
(r'^During handling of the above exception, another '
|
| 746 |
+
r'exception occurred:\n\n', Generic.Traceback),
|
| 747 |
+
(r'^The above exception was the direct cause of the '
|
| 748 |
+
r'following exception:\n\n', Generic.Traceback),
|
| 749 |
+
(r'^(?= File "[^"]+", line \d+)', Generic.Traceback, 'intb'),
|
| 750 |
+
(r'^.*\n', Other),
|
| 751 |
+
],
|
| 752 |
+
'intb': [
|
| 753 |
+
(r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)',
|
| 754 |
+
bygroups(Text, Name.Builtin, Text, Number, Text, Name, Whitespace)),
|
| 755 |
+
(r'^( File )("[^"]+")(, line )(\d+)(\n)',
|
| 756 |
+
bygroups(Text, Name.Builtin, Text, Number, Whitespace)),
|
| 757 |
+
(r'^( )(.+)(\n)',
|
| 758 |
+
bygroups(Whitespace, using(PythonLexer), Whitespace), 'markers'),
|
| 759 |
+
(r'^([ \t]*)(\.\.\.)(\n)',
|
| 760 |
+
bygroups(Whitespace, Comment, Whitespace)), # for doctests...
|
| 761 |
+
(r'^([^:]+)(: )(.+)(\n)',
|
| 762 |
+
bygroups(Generic.Error, Text, Name, Whitespace), '#pop'),
|
| 763 |
+
(r'^([a-zA-Z_][\w.]*)(:?\n)',
|
| 764 |
+
bygroups(Generic.Error, Whitespace), '#pop'),
|
| 765 |
+
default('#pop'),
|
| 766 |
+
],
|
| 767 |
+
'markers': [
|
| 768 |
+
# Either `PEP 657 <https://www.python.org/dev/peps/pep-0657/>`
|
| 769 |
+
# error locations in Python 3.11+, or single-caret markers
|
| 770 |
+
# for syntax errors before that.
|
| 771 |
+
(r'^( {4,})([~^]+)(\n)',
|
| 772 |
+
bygroups(Whitespace, Punctuation.Marker, Whitespace),
|
| 773 |
+
'#pop'),
|
| 774 |
+
default('#pop'),
|
| 775 |
+
],
|
| 776 |
+
}
|
| 777 |
+
|
| 778 |
+
|
| 779 |
+
Python3TracebackLexer = PythonTracebackLexer
|
| 780 |
+
|
| 781 |
+
|
| 782 |
+
class Python2TracebackLexer(RegexLexer):
|
| 783 |
+
"""
|
| 784 |
+
For Python tracebacks.
|
| 785 |
+
|
| 786 |
+
.. versionchanged:: 2.5
|
| 787 |
+
This class has been renamed from ``PythonTracebackLexer``.
|
| 788 |
+
``PythonTracebackLexer`` now refers to the Python 3 variant.
|
| 789 |
+
"""
|
| 790 |
+
|
| 791 |
+
name = 'Python 2.x Traceback'
|
| 792 |
+
aliases = ['py2tb']
|
| 793 |
+
filenames = ['*.py2tb']
|
| 794 |
+
mimetypes = ['text/x-python2-traceback']
|
| 795 |
+
url = 'https://python.org'
|
| 796 |
+
version_added = '0.7'
|
| 797 |
+
|
| 798 |
+
tokens = {
|
| 799 |
+
'root': [
|
| 800 |
+
# Cover both (most recent call last) and (innermost last)
|
| 801 |
+
# The optional ^C allows us to catch keyboard interrupt signals.
|
| 802 |
+
(r'^(\^C)?(Traceback.*\n)',
|
| 803 |
+
bygroups(Text, Generic.Traceback), 'intb'),
|
| 804 |
+
# SyntaxError starts with this.
|
| 805 |
+
(r'^(?= File "[^"]+", line \d+)', Generic.Traceback, 'intb'),
|
| 806 |
+
(r'^.*\n', Other),
|
| 807 |
+
],
|
| 808 |
+
'intb': [
|
| 809 |
+
(r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)',
|
| 810 |
+
bygroups(Text, Name.Builtin, Text, Number, Text, Name, Whitespace)),
|
| 811 |
+
(r'^( File )("[^"]+")(, line )(\d+)(\n)',
|
| 812 |
+
bygroups(Text, Name.Builtin, Text, Number, Whitespace)),
|
| 813 |
+
(r'^( )(.+)(\n)',
|
| 814 |
+
bygroups(Text, using(Python2Lexer), Whitespace), 'marker'),
|
| 815 |
+
(r'^([ \t]*)(\.\.\.)(\n)',
|
| 816 |
+
bygroups(Text, Comment, Whitespace)), # for doctests...
|
| 817 |
+
(r'^([^:]+)(: )(.+)(\n)',
|
| 818 |
+
bygroups(Generic.Error, Text, Name, Whitespace), '#pop'),
|
| 819 |
+
(r'^([a-zA-Z_]\w*)(:?\n)',
|
| 820 |
+
bygroups(Generic.Error, Whitespace), '#pop')
|
| 821 |
+
],
|
| 822 |
+
'marker': [
|
| 823 |
+
# For syntax errors.
|
| 824 |
+
(r'( {4,})(\^)', bygroups(Text, Punctuation.Marker), '#pop'),
|
| 825 |
+
default('#pop'),
|
| 826 |
+
],
|
| 827 |
+
}
|
| 828 |
+
|
| 829 |
+
|
| 830 |
+
class CythonLexer(RegexLexer):
|
| 831 |
+
"""
|
| 832 |
+
For Pyrex and Cython source code.
|
| 833 |
+
"""
|
| 834 |
+
|
| 835 |
+
name = 'Cython'
|
| 836 |
+
url = 'https://cython.org'
|
| 837 |
+
aliases = ['cython', 'pyx', 'pyrex']
|
| 838 |
+
filenames = ['*.pyx', '*.pxd', '*.pxi']
|
| 839 |
+
mimetypes = ['text/x-cython', 'application/x-cython']
|
| 840 |
+
version_added = '1.1'
|
| 841 |
+
|
| 842 |
+
tokens = {
|
| 843 |
+
'root': [
|
| 844 |
+
(r'\n', Whitespace),
|
| 845 |
+
(r'^(\s*)("""(?:.|\n)*?""")', bygroups(Whitespace, String.Doc)),
|
| 846 |
+
(r"^(\s*)('''(?:.|\n)*?''')", bygroups(Whitespace, String.Doc)),
|
| 847 |
+
(r'[^\S\n]+', Text),
|
| 848 |
+
(r'#.*$', Comment),
|
| 849 |
+
(r'[]{}:(),;[]', Punctuation),
|
| 850 |
+
(r'\\\n', Whitespace),
|
| 851 |
+
(r'\\', Text),
|
| 852 |
+
(r'(in|is|and|or|not)\b', Operator.Word),
|
| 853 |
+
(r'(<)([a-zA-Z0-9.?]+)(>)',
|
| 854 |
+
bygroups(Punctuation, Keyword.Type, Punctuation)),
|
| 855 |
+
(r'!=|==|<<|>>|[-~+/*%=<>&^|.?]', Operator),
|
| 856 |
+
(r'(from)(\d+)(<=)(\s+)(<)(\d+)(:)',
|
| 857 |
+
bygroups(Keyword, Number.Integer, Operator, Whitespace, Operator,
|
| 858 |
+
Name, Punctuation)),
|
| 859 |
+
include('keywords'),
|
| 860 |
+
(r'(def|property)(\s+)', bygroups(Keyword, Whitespace), 'funcname'),
|
| 861 |
+
(r'(cp?def)(\s+)', bygroups(Keyword, Whitespace), 'cdef'),
|
| 862 |
+
# (should actually start a block with only cdefs)
|
| 863 |
+
(r'(cdef)(:)', bygroups(Keyword, Punctuation)),
|
| 864 |
+
(r'(class|struct)(\s+)', bygroups(Keyword, Whitespace), 'classname'),
|
| 865 |
+
(r'(from)(\s+)', bygroups(Keyword, Whitespace), 'fromimport'),
|
| 866 |
+
(r'(c?import)(\s+)', bygroups(Keyword, Whitespace), 'import'),
|
| 867 |
+
include('builtins'),
|
| 868 |
+
include('backtick'),
|
| 869 |
+
('(?:[rR]|[uU][rR]|[rR][uU])"""', String, 'tdqs'),
|
| 870 |
+
("(?:[rR]|[uU][rR]|[rR][uU])'''", String, 'tsqs'),
|
| 871 |
+
('(?:[rR]|[uU][rR]|[rR][uU])"', String, 'dqs'),
|
| 872 |
+
("(?:[rR]|[uU][rR]|[rR][uU])'", String, 'sqs'),
|
| 873 |
+
('[uU]?"""', String, combined('stringescape', 'tdqs')),
|
| 874 |
+
("[uU]?'''", String, combined('stringescape', 'tsqs')),
|
| 875 |
+
('[uU]?"', String, combined('stringescape', 'dqs')),
|
| 876 |
+
("[uU]?'", String, combined('stringescape', 'sqs')),
|
| 877 |
+
include('name'),
|
| 878 |
+
include('numbers'),
|
| 879 |
+
],
|
| 880 |
+
'keywords': [
|
| 881 |
+
(words((
|
| 882 |
+
'assert', 'async', 'await', 'break', 'by', 'continue', 'ctypedef', 'del', 'elif',
|
| 883 |
+
'else', 'except', 'except?', 'exec', 'finally', 'for', 'fused', 'gil',
|
| 884 |
+
'global', 'if', 'include', 'lambda', 'nogil', 'pass', 'print',
|
| 885 |
+
'raise', 'return', 'try', 'while', 'yield', 'as', 'with'), suffix=r'\b'),
|
| 886 |
+
Keyword),
|
| 887 |
+
(r'(DEF|IF|ELIF|ELSE)\b', Comment.Preproc),
|
| 888 |
+
],
|
| 889 |
+
'builtins': [
|
| 890 |
+
(words((
|
| 891 |
+
'__import__', 'abs', 'all', 'any', 'apply', 'basestring', 'bin', 'bint',
|
| 892 |
+
'bool', 'buffer', 'bytearray', 'bytes', 'callable', 'chr',
|
| 893 |
+
'classmethod', 'cmp', 'coerce', 'compile', 'complex', 'delattr',
|
| 894 |
+
'dict', 'dir', 'divmod', 'enumerate', 'eval', 'execfile', 'exit',
|
| 895 |
+
'file', 'filter', 'float', 'frozenset', 'getattr', 'globals',
|
| 896 |
+
'hasattr', 'hash', 'hex', 'id', 'input', 'int', 'intern', 'isinstance',
|
| 897 |
+
'issubclass', 'iter', 'len', 'list', 'locals', 'long', 'map', 'max',
|
| 898 |
+
'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'property', 'Py_ssize_t',
|
| 899 |
+
'range', 'raw_input', 'reduce', 'reload', 'repr', 'reversed',
|
| 900 |
+
'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod',
|
| 901 |
+
'str', 'sum', 'super', 'tuple', 'type', 'unichr', 'unicode', 'unsigned',
|
| 902 |
+
'vars', 'xrange', 'zip'), prefix=r'(?<!\.)', suffix=r'\b'),
|
| 903 |
+
Name.Builtin),
|
| 904 |
+
(r'(?<!\.)(self|None|Ellipsis|NotImplemented|False|True|NULL'
|
| 905 |
+
r')\b', Name.Builtin.Pseudo),
|
| 906 |
+
(words((
|
| 907 |
+
'ArithmeticError', 'AssertionError', 'AttributeError',
|
| 908 |
+
'BaseException', 'DeprecationWarning', 'EOFError', 'EnvironmentError',
|
| 909 |
+
'Exception', 'FloatingPointError', 'FutureWarning', 'GeneratorExit',
|
| 910 |
+
'IOError', 'ImportError', 'ImportWarning', 'IndentationError',
|
| 911 |
+
'IndexError', 'KeyError', 'KeyboardInterrupt', 'LookupError',
|
| 912 |
+
'MemoryError', 'NameError', 'NotImplemented', 'NotImplementedError',
|
| 913 |
+
'OSError', 'OverflowError', 'OverflowWarning',
|
| 914 |
+
'PendingDeprecationWarning', 'ReferenceError', 'RuntimeError',
|
| 915 |
+
'RuntimeWarning', 'StandardError', 'StopIteration', 'SyntaxError',
|
| 916 |
+
'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError',
|
| 917 |
+
'TypeError', 'UnboundLocalError', 'UnicodeDecodeError',
|
| 918 |
+
'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError',
|
| 919 |
+
'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning',
|
| 920 |
+
'ZeroDivisionError'), prefix=r'(?<!\.)', suffix=r'\b'),
|
| 921 |
+
Name.Exception),
|
| 922 |
+
],
|
| 923 |
+
'numbers': [
|
| 924 |
+
(r'(\d+\.?\d*|\d*\.\d+)([eE][+-]?[0-9]+)?', Number.Float),
|
| 925 |
+
(r'0\d+', Number.Oct),
|
| 926 |
+
(r'0[xX][a-fA-F0-9]+', Number.Hex),
|
| 927 |
+
(r'\d+L', Number.Integer.Long),
|
| 928 |
+
(r'\d+', Number.Integer)
|
| 929 |
+
],
|
| 930 |
+
'backtick': [
|
| 931 |
+
('`.*?`', String.Backtick),
|
| 932 |
+
],
|
| 933 |
+
'name': [
|
| 934 |
+
(r'@\w+', Name.Decorator),
|
| 935 |
+
(r'[a-zA-Z_]\w*', Name),
|
| 936 |
+
],
|
| 937 |
+
'funcname': [
|
| 938 |
+
(r'[a-zA-Z_]\w*', Name.Function, '#pop')
|
| 939 |
+
],
|
| 940 |
+
'cdef': [
|
| 941 |
+
(r'(public|readonly|extern|api|inline)\b', Keyword.Reserved),
|
| 942 |
+
(r'(struct|enum|union|class)\b', Keyword),
|
| 943 |
+
(r'([a-zA-Z_]\w*)(\s*)(?=[(:#=]|$)',
|
| 944 |
+
bygroups(Name.Function, Whitespace), '#pop'),
|
| 945 |
+
(r'([a-zA-Z_]\w*)(\s*)(,)',
|
| 946 |
+
bygroups(Name.Function, Whitespace, Punctuation)),
|
| 947 |
+
(r'from\b', Keyword, '#pop'),
|
| 948 |
+
(r'as\b', Keyword),
|
| 949 |
+
(r':', Punctuation, '#pop'),
|
| 950 |
+
(r'(?=["\'])', Text, '#pop'),
|
| 951 |
+
(r'[a-zA-Z_]\w*', Keyword.Type),
|
| 952 |
+
(r'.', Text),
|
| 953 |
+
],
|
| 954 |
+
'classname': [
|
| 955 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop')
|
| 956 |
+
],
|
| 957 |
+
'import': [
|
| 958 |
+
(r'(\s+)(as)(\s+)', bygroups(Whitespace, Keyword, Whitespace)),
|
| 959 |
+
(r'[a-zA-Z_][\w.]*', Name.Namespace),
|
| 960 |
+
(r'(\s*)(,)(\s*)', bygroups(Whitespace, Operator, Whitespace)),
|
| 961 |
+
default('#pop') # all else: go back
|
| 962 |
+
],
|
| 963 |
+
'fromimport': [
|
| 964 |
+
(r'(\s+)(c?import)\b', bygroups(Whitespace, Keyword), '#pop'),
|
| 965 |
+
(r'[a-zA-Z_.][\w.]*', Name.Namespace),
|
| 966 |
+
# ``cdef foo from "header"``, or ``for foo from 0 < i < 10``
|
| 967 |
+
default('#pop'),
|
| 968 |
+
],
|
| 969 |
+
'stringescape': [
|
| 970 |
+
(r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
|
| 971 |
+
r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
|
| 972 |
+
],
|
| 973 |
+
'strings': [
|
| 974 |
+
(r'%(\([a-zA-Z0-9]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
|
| 975 |
+
'[hlL]?[E-GXc-giorsux%]', String.Interpol),
|
| 976 |
+
(r'[^\\\'"%\n]+', String),
|
| 977 |
+
# quotes, percents and backslashes must be parsed one at a time
|
| 978 |
+
(r'[\'"\\]', String),
|
| 979 |
+
# unhandled string formatting sign
|
| 980 |
+
(r'%', String)
|
| 981 |
+
# newlines are an error (use "nl" state)
|
| 982 |
+
],
|
| 983 |
+
'nl': [
|
| 984 |
+
(r'\n', String)
|
| 985 |
+
],
|
| 986 |
+
'dqs': [
|
| 987 |
+
(r'"', String, '#pop'),
|
| 988 |
+
(r'\\\\|\\"|\\\n', String.Escape), # included here again for raw strings
|
| 989 |
+
include('strings')
|
| 990 |
+
],
|
| 991 |
+
'sqs': [
|
| 992 |
+
(r"'", String, '#pop'),
|
| 993 |
+
(r"\\\\|\\'|\\\n", String.Escape), # included here again for raw strings
|
| 994 |
+
include('strings')
|
| 995 |
+
],
|
| 996 |
+
'tdqs': [
|
| 997 |
+
(r'"""', String, '#pop'),
|
| 998 |
+
include('strings'),
|
| 999 |
+
include('nl')
|
| 1000 |
+
],
|
| 1001 |
+
'tsqs': [
|
| 1002 |
+
(r"'''", String, '#pop'),
|
| 1003 |
+
include('strings'),
|
| 1004 |
+
include('nl')
|
| 1005 |
+
],
|
| 1006 |
+
}
|
| 1007 |
+
|
| 1008 |
+
|
| 1009 |
+
class DgLexer(RegexLexer):
|
| 1010 |
+
"""
|
| 1011 |
+
Lexer for dg,
|
| 1012 |
+
a functional and object-oriented programming language
|
| 1013 |
+
running on the CPython 3 VM.
|
| 1014 |
+
"""
|
| 1015 |
+
name = 'dg'
|
| 1016 |
+
aliases = ['dg']
|
| 1017 |
+
filenames = ['*.dg']
|
| 1018 |
+
mimetypes = ['text/x-dg']
|
| 1019 |
+
url = 'http://pyos.github.io/dg'
|
| 1020 |
+
version_added = '1.6'
|
| 1021 |
+
|
| 1022 |
+
tokens = {
|
| 1023 |
+
'root': [
|
| 1024 |
+
(r'\s+', Text),
|
| 1025 |
+
(r'#.*?$', Comment.Single),
|
| 1026 |
+
|
| 1027 |
+
(r'(?i)0b[01]+', Number.Bin),
|
| 1028 |
+
(r'(?i)0o[0-7]+', Number.Oct),
|
| 1029 |
+
(r'(?i)0x[0-9a-f]+', Number.Hex),
|
| 1030 |
+
(r'(?i)[+-]?[0-9]+\.[0-9]+(e[+-]?[0-9]+)?j?', Number.Float),
|
| 1031 |
+
(r'(?i)[+-]?[0-9]+e[+-]?\d+j?', Number.Float),
|
| 1032 |
+
(r'(?i)[+-]?[0-9]+j?', Number.Integer),
|
| 1033 |
+
|
| 1034 |
+
(r"(?i)(br|r?b?)'''", String, combined('stringescape', 'tsqs', 'string')),
|
| 1035 |
+
(r'(?i)(br|r?b?)"""', String, combined('stringescape', 'tdqs', 'string')),
|
| 1036 |
+
(r"(?i)(br|r?b?)'", String, combined('stringescape', 'sqs', 'string')),
|
| 1037 |
+
(r'(?i)(br|r?b?)"', String, combined('stringescape', 'dqs', 'string')),
|
| 1038 |
+
|
| 1039 |
+
(r"`\w+'*`", Operator),
|
| 1040 |
+
(r'\b(and|in|is|or|where)\b', Operator.Word),
|
| 1041 |
+
(r'[!$%&*+\-./:<-@\\^|~;,]+', Operator),
|
| 1042 |
+
|
| 1043 |
+
(words((
|
| 1044 |
+
'bool', 'bytearray', 'bytes', 'classmethod', 'complex', 'dict', 'dict\'',
|
| 1045 |
+
'float', 'frozenset', 'int', 'list', 'list\'', 'memoryview', 'object',
|
| 1046 |
+
'property', 'range', 'set', 'set\'', 'slice', 'staticmethod', 'str',
|
| 1047 |
+
'super', 'tuple', 'tuple\'', 'type'),
|
| 1048 |
+
prefix=r'(?<!\.)', suffix=r'(?![\'\w])'),
|
| 1049 |
+
Name.Builtin),
|
| 1050 |
+
(words((
|
| 1051 |
+
'__import__', 'abs', 'all', 'any', 'bin', 'bind', 'chr', 'cmp', 'compile',
|
| 1052 |
+
'complex', 'delattr', 'dir', 'divmod', 'drop', 'dropwhile', 'enumerate',
|
| 1053 |
+
'eval', 'exhaust', 'filter', 'flip', 'foldl1?', 'format', 'fst',
|
| 1054 |
+
'getattr', 'globals', 'hasattr', 'hash', 'head', 'hex', 'id', 'init',
|
| 1055 |
+
'input', 'isinstance', 'issubclass', 'iter', 'iterate', 'last', 'len',
|
| 1056 |
+
'locals', 'map', 'max', 'min', 'next', 'oct', 'open', 'ord', 'pow',
|
| 1057 |
+
'print', 'repr', 'reversed', 'round', 'setattr', 'scanl1?', 'snd',
|
| 1058 |
+
'sorted', 'sum', 'tail', 'take', 'takewhile', 'vars', 'zip'),
|
| 1059 |
+
prefix=r'(?<!\.)', suffix=r'(?![\'\w])'),
|
| 1060 |
+
Name.Builtin),
|
| 1061 |
+
(r"(?<!\.)(self|Ellipsis|NotImplemented|None|True|False)(?!['\w])",
|
| 1062 |
+
Name.Builtin.Pseudo),
|
| 1063 |
+
|
| 1064 |
+
(r"(?<!\.)[A-Z]\w*(Error|Exception|Warning)'*(?!['\w])",
|
| 1065 |
+
Name.Exception),
|
| 1066 |
+
(r"(?<!\.)(Exception|GeneratorExit|KeyboardInterrupt|StopIteration|"
|
| 1067 |
+
r"SystemExit)(?!['\w])", Name.Exception),
|
| 1068 |
+
|
| 1069 |
+
(r"(?<![\w.])(except|finally|for|if|import|not|otherwise|raise|"
|
| 1070 |
+
r"subclass|while|with|yield)(?!['\w])", Keyword.Reserved),
|
| 1071 |
+
|
| 1072 |
+
(r"[A-Z_]+'*(?!['\w])", Name),
|
| 1073 |
+
(r"[A-Z]\w+'*(?!['\w])", Keyword.Type),
|
| 1074 |
+
(r"\w+'*", Name),
|
| 1075 |
+
|
| 1076 |
+
(r'[()]', Punctuation),
|
| 1077 |
+
(r'.', Error),
|
| 1078 |
+
],
|
| 1079 |
+
'stringescape': [
|
| 1080 |
+
(r'\\([\\abfnrtv"\']|\n|N\{.*?\}|u[a-fA-F0-9]{4}|'
|
| 1081 |
+
r'U[a-fA-F0-9]{8}|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
|
| 1082 |
+
],
|
| 1083 |
+
'string': [
|
| 1084 |
+
(r'%(\(\w+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?'
|
| 1085 |
+
'[hlL]?[E-GXc-giorsux%]', String.Interpol),
|
| 1086 |
+
(r'[^\\\'"%\n]+', String),
|
| 1087 |
+
# quotes, percents and backslashes must be parsed one at a time
|
| 1088 |
+
(r'[\'"\\]', String),
|
| 1089 |
+
# unhandled string formatting sign
|
| 1090 |
+
(r'%', String),
|
| 1091 |
+
(r'\n', String)
|
| 1092 |
+
],
|
| 1093 |
+
'dqs': [
|
| 1094 |
+
(r'"', String, '#pop')
|
| 1095 |
+
],
|
| 1096 |
+
'sqs': [
|
| 1097 |
+
(r"'", String, '#pop')
|
| 1098 |
+
],
|
| 1099 |
+
'tdqs': [
|
| 1100 |
+
(r'"""', String, '#pop')
|
| 1101 |
+
],
|
| 1102 |
+
'tsqs': [
|
| 1103 |
+
(r"'''", String, '#pop')
|
| 1104 |
+
],
|
| 1105 |
+
}
|
| 1106 |
+
|
| 1107 |
+
|
| 1108 |
+
class NumPyLexer(PythonLexer):
|
| 1109 |
+
"""
|
| 1110 |
+
A Python lexer recognizing Numerical Python builtins.
|
| 1111 |
+
"""
|
| 1112 |
+
|
| 1113 |
+
name = 'NumPy'
|
| 1114 |
+
url = 'https://numpy.org/'
|
| 1115 |
+
aliases = ['numpy']
|
| 1116 |
+
version_added = '0.10'
|
| 1117 |
+
|
| 1118 |
+
# override the mimetypes to not inherit them from python
|
| 1119 |
+
mimetypes = []
|
| 1120 |
+
filenames = []
|
| 1121 |
+
|
| 1122 |
+
EXTRA_KEYWORDS = {
|
| 1123 |
+
'abs', 'absolute', 'accumulate', 'add', 'alen', 'all', 'allclose',
|
| 1124 |
+
'alltrue', 'alterdot', 'amax', 'amin', 'angle', 'any', 'append',
|
| 1125 |
+
'apply_along_axis', 'apply_over_axes', 'arange', 'arccos', 'arccosh',
|
| 1126 |
+
'arcsin', 'arcsinh', 'arctan', 'arctan2', 'arctanh', 'argmax', 'argmin',
|
| 1127 |
+
'argsort', 'argwhere', 'around', 'array', 'array2string', 'array_equal',
|
| 1128 |
+
'array_equiv', 'array_repr', 'array_split', 'array_str', 'arrayrange',
|
| 1129 |
+
'asanyarray', 'asarray', 'asarray_chkfinite', 'ascontiguousarray',
|
| 1130 |
+
'asfarray', 'asfortranarray', 'asmatrix', 'asscalar', 'astype',
|
| 1131 |
+
'atleast_1d', 'atleast_2d', 'atleast_3d', 'average', 'bartlett',
|
| 1132 |
+
'base_repr', 'beta', 'binary_repr', 'bincount', 'binomial',
|
| 1133 |
+
'bitwise_and', 'bitwise_not', 'bitwise_or', 'bitwise_xor', 'blackman',
|
| 1134 |
+
'bmat', 'broadcast', 'byte_bounds', 'bytes', 'byteswap', 'c_',
|
| 1135 |
+
'can_cast', 'ceil', 'choose', 'clip', 'column_stack', 'common_type',
|
| 1136 |
+
'compare_chararrays', 'compress', 'concatenate', 'conj', 'conjugate',
|
| 1137 |
+
'convolve', 'copy', 'corrcoef', 'correlate', 'cos', 'cosh', 'cov',
|
| 1138 |
+
'cross', 'cumprod', 'cumproduct', 'cumsum', 'delete', 'deprecate',
|
| 1139 |
+
'diag', 'diagflat', 'diagonal', 'diff', 'digitize', 'disp', 'divide',
|
| 1140 |
+
'dot', 'dsplit', 'dstack', 'dtype', 'dump', 'dumps', 'ediff1d', 'empty',
|
| 1141 |
+
'empty_like', 'equal', 'exp', 'expand_dims', 'expm1', 'extract', 'eye',
|
| 1142 |
+
'fabs', 'fastCopyAndTranspose', 'fft', 'fftfreq', 'fftshift', 'fill',
|
| 1143 |
+
'finfo', 'fix', 'flat', 'flatnonzero', 'flatten', 'fliplr', 'flipud',
|
| 1144 |
+
'floor', 'floor_divide', 'fmod', 'frexp', 'fromarrays', 'frombuffer',
|
| 1145 |
+
'fromfile', 'fromfunction', 'fromiter', 'frompyfunc', 'fromstring',
|
| 1146 |
+
'generic', 'get_array_wrap', 'get_include', 'get_numarray_include',
|
| 1147 |
+
'get_numpy_include', 'get_printoptions', 'getbuffer', 'getbufsize',
|
| 1148 |
+
'geterr', 'geterrcall', 'geterrobj', 'getfield', 'gradient', 'greater',
|
| 1149 |
+
'greater_equal', 'gumbel', 'hamming', 'hanning', 'histogram',
|
| 1150 |
+
'histogram2d', 'histogramdd', 'hsplit', 'hstack', 'hypot', 'i0',
|
| 1151 |
+
'identity', 'ifft', 'imag', 'index_exp', 'indices', 'inf', 'info',
|
| 1152 |
+
'inner', 'insert', 'int_asbuffer', 'interp', 'intersect1d',
|
| 1153 |
+
'intersect1d_nu', 'inv', 'invert', 'iscomplex', 'iscomplexobj',
|
| 1154 |
+
'isfinite', 'isfortran', 'isinf', 'isnan', 'isneginf', 'isposinf',
|
| 1155 |
+
'isreal', 'isrealobj', 'isscalar', 'issctype', 'issubclass_',
|
| 1156 |
+
'issubdtype', 'issubsctype', 'item', 'itemset', 'iterable', 'ix_',
|
| 1157 |
+
'kaiser', 'kron', 'ldexp', 'left_shift', 'less', 'less_equal', 'lexsort',
|
| 1158 |
+
'linspace', 'load', 'loads', 'loadtxt', 'log', 'log10', 'log1p', 'log2',
|
| 1159 |
+
'logical_and', 'logical_not', 'logical_or', 'logical_xor', 'logspace',
|
| 1160 |
+
'lstsq', 'mat', 'matrix', 'max', 'maximum', 'maximum_sctype',
|
| 1161 |
+
'may_share_memory', 'mean', 'median', 'meshgrid', 'mgrid', 'min',
|
| 1162 |
+
'minimum', 'mintypecode', 'mod', 'modf', 'msort', 'multiply', 'nan',
|
| 1163 |
+
'nan_to_num', 'nanargmax', 'nanargmin', 'nanmax', 'nanmin', 'nansum',
|
| 1164 |
+
'ndenumerate', 'ndim', 'ndindex', 'negative', 'newaxis', 'newbuffer',
|
| 1165 |
+
'newbyteorder', 'nonzero', 'not_equal', 'obj2sctype', 'ogrid', 'ones',
|
| 1166 |
+
'ones_like', 'outer', 'permutation', 'piecewise', 'pinv', 'pkgload',
|
| 1167 |
+
'place', 'poisson', 'poly', 'poly1d', 'polyadd', 'polyder', 'polydiv',
|
| 1168 |
+
'polyfit', 'polyint', 'polymul', 'polysub', 'polyval', 'power', 'prod',
|
| 1169 |
+
'product', 'ptp', 'put', 'putmask', 'r_', 'randint', 'random_integers',
|
| 1170 |
+
'random_sample', 'ranf', 'rank', 'ravel', 'real', 'real_if_close',
|
| 1171 |
+
'recarray', 'reciprocal', 'reduce', 'remainder', 'repeat', 'require',
|
| 1172 |
+
'reshape', 'resize', 'restoredot', 'right_shift', 'rint', 'roll',
|
| 1173 |
+
'rollaxis', 'roots', 'rot90', 'round', 'round_', 'row_stack', 's_',
|
| 1174 |
+
'sample', 'savetxt', 'sctype2char', 'searchsorted', 'seed', 'select',
|
| 1175 |
+
'set_numeric_ops', 'set_printoptions', 'set_string_function',
|
| 1176 |
+
'setbufsize', 'setdiff1d', 'seterr', 'seterrcall', 'seterrobj',
|
| 1177 |
+
'setfield', 'setflags', 'setmember1d', 'setxor1d', 'shape',
|
| 1178 |
+
'show_config', 'shuffle', 'sign', 'signbit', 'sin', 'sinc', 'sinh',
|
| 1179 |
+
'size', 'slice', 'solve', 'sometrue', 'sort', 'sort_complex', 'source',
|
| 1180 |
+
'split', 'sqrt', 'square', 'squeeze', 'standard_normal', 'std',
|
| 1181 |
+
'subtract', 'sum', 'svd', 'swapaxes', 'take', 'tan', 'tanh', 'tensordot',
|
| 1182 |
+
'test', 'tile', 'tofile', 'tolist', 'tostring', 'trace', 'transpose',
|
| 1183 |
+
'trapz', 'tri', 'tril', 'trim_zeros', 'triu', 'true_divide', 'typeDict',
|
| 1184 |
+
'typename', 'uniform', 'union1d', 'unique', 'unique1d', 'unravel_index',
|
| 1185 |
+
'unwrap', 'vander', 'var', 'vdot', 'vectorize', 'view', 'vonmises',
|
| 1186 |
+
'vsplit', 'vstack', 'weibull', 'where', 'who', 'zeros', 'zeros_like'
|
| 1187 |
+
}
|
| 1188 |
+
|
| 1189 |
+
def get_tokens_unprocessed(self, text):
|
| 1190 |
+
for index, token, value in \
|
| 1191 |
+
PythonLexer.get_tokens_unprocessed(self, text):
|
| 1192 |
+
if token is Name and value in self.EXTRA_KEYWORDS:
|
| 1193 |
+
yield index, Keyword.Pseudo, value
|
| 1194 |
+
else:
|
| 1195 |
+
yield index, token, value
|
| 1196 |
+
|
| 1197 |
+
def analyse_text(text):
|
| 1198 |
+
ltext = text[:1000]
|
| 1199 |
+
return (shebang_matches(text, r'pythonw?(3(\.\d)?)?') or
|
| 1200 |
+
'import ' in ltext) \
|
| 1201 |
+
and ('import numpy' in ltext or 'from numpy import' in ltext)
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/q.py
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.q
|
| 3 |
+
~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for the Q programming language.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 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 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/qlik.py
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.qlik
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for the qlik scripting language
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import RegexLexer, include, bygroups, words
|
| 14 |
+
from pygments.token import Comment, Keyword, Name, Number, Operator, \
|
| 15 |
+
Punctuation, String, Text
|
| 16 |
+
from pygments.lexers._qlik_builtins import OPERATORS_LIST, STATEMENT_LIST, \
|
| 17 |
+
SCRIPT_FUNCTIONS, CONSTANT_LIST
|
| 18 |
+
|
| 19 |
+
__all__ = ["QlikLexer"]
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
class QlikLexer(RegexLexer):
|
| 23 |
+
"""
|
| 24 |
+
Lexer for qlik code, including .qvs files
|
| 25 |
+
"""
|
| 26 |
+
|
| 27 |
+
name = "Qlik"
|
| 28 |
+
aliases = ["qlik", "qlikview", "qliksense", "qlikscript"]
|
| 29 |
+
filenames = ["*.qvs", "*.qvw"]
|
| 30 |
+
url = "https://qlik.com"
|
| 31 |
+
version_added = '2.12'
|
| 32 |
+
|
| 33 |
+
flags = re.IGNORECASE
|
| 34 |
+
|
| 35 |
+
tokens = {
|
| 36 |
+
# Handle multi-line comments
|
| 37 |
+
"comment": [
|
| 38 |
+
(r"\*/", Comment.Multiline, "#pop"),
|
| 39 |
+
(r"[^*]+", Comment.Multiline),
|
| 40 |
+
],
|
| 41 |
+
# Handle numbers
|
| 42 |
+
"numerics": [
|
| 43 |
+
(r"\b\d+\.\d+(e\d+)?[fd]?\b", Number.Float),
|
| 44 |
+
(r"\b\d+\b", Number.Integer),
|
| 45 |
+
],
|
| 46 |
+
# Handle variable names in things
|
| 47 |
+
"interp": [
|
| 48 |
+
(
|
| 49 |
+
r"(\$\()(\w+)(\))",
|
| 50 |
+
bygroups(String.Interpol, Name.Variable, String.Interpol),
|
| 51 |
+
),
|
| 52 |
+
],
|
| 53 |
+
# Handle strings
|
| 54 |
+
"string": [
|
| 55 |
+
(r"'", String, "#pop"),
|
| 56 |
+
include("interp"),
|
| 57 |
+
(r"[^'$]+", String),
|
| 58 |
+
(r"\$", String),
|
| 59 |
+
],
|
| 60 |
+
#
|
| 61 |
+
"assignment": [
|
| 62 |
+
(r";", Punctuation, "#pop"),
|
| 63 |
+
include("root"),
|
| 64 |
+
],
|
| 65 |
+
"field_name_quote": [
|
| 66 |
+
(r'"', String.Symbol, "#pop"),
|
| 67 |
+
include("interp"),
|
| 68 |
+
(r"[^\"$]+", String.Symbol),
|
| 69 |
+
(r"\$", String.Symbol),
|
| 70 |
+
],
|
| 71 |
+
"field_name_bracket": [
|
| 72 |
+
(r"\]", String.Symbol, "#pop"),
|
| 73 |
+
include("interp"),
|
| 74 |
+
(r"[^\]$]+", String.Symbol),
|
| 75 |
+
(r"\$", String.Symbol),
|
| 76 |
+
],
|
| 77 |
+
"function": [(r"\)", Punctuation, "#pop"), include("root")],
|
| 78 |
+
"root": [
|
| 79 |
+
# Whitespace and comments
|
| 80 |
+
(r"\s+", Text.Whitespace),
|
| 81 |
+
(r"/\*", Comment.Multiline, "comment"),
|
| 82 |
+
(r"//.*\n", Comment.Single),
|
| 83 |
+
# variable assignment
|
| 84 |
+
(r"(let|set)(\s+)", bygroups(Keyword.Declaration, Text.Whitespace),
|
| 85 |
+
"assignment"),
|
| 86 |
+
# Word operators
|
| 87 |
+
(words(OPERATORS_LIST["words"], prefix=r"\b", suffix=r"\b"),
|
| 88 |
+
Operator.Word),
|
| 89 |
+
# Statements
|
| 90 |
+
(words(STATEMENT_LIST, suffix=r"\b"), Keyword),
|
| 91 |
+
# Table names
|
| 92 |
+
(r"[a-z]\w*:", Keyword.Declaration),
|
| 93 |
+
# Constants
|
| 94 |
+
(words(CONSTANT_LIST, suffix=r"\b"), Keyword.Constant),
|
| 95 |
+
# Functions
|
| 96 |
+
(words(SCRIPT_FUNCTIONS, suffix=r"(?=\s*\()"), Name.Builtin,
|
| 97 |
+
"function"),
|
| 98 |
+
# interpolation - e.g. $(variableName)
|
| 99 |
+
include("interp"),
|
| 100 |
+
# Quotes denote a field/file name
|
| 101 |
+
(r'"', String.Symbol, "field_name_quote"),
|
| 102 |
+
# Square brackets denote a field/file name
|
| 103 |
+
(r"\[", String.Symbol, "field_name_bracket"),
|
| 104 |
+
# Strings
|
| 105 |
+
(r"'", String, "string"),
|
| 106 |
+
# Numbers
|
| 107 |
+
include("numerics"),
|
| 108 |
+
# Operator symbols
|
| 109 |
+
(words(OPERATORS_LIST["symbols"]), Operator),
|
| 110 |
+
# Strings denoted by single quotes
|
| 111 |
+
(r"'.+?'", String),
|
| 112 |
+
# Words as text
|
| 113 |
+
(r"\b\w+\b", Text),
|
| 114 |
+
# Basic punctuation
|
| 115 |
+
(r"[,;.()\\/]", Punctuation),
|
| 116 |
+
],
|
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pygments.lexers.qvt
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for QVT Operational language.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 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 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/r.py
ADDED
|
@@ -0,0 +1,196 @@
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.r
|
| 3 |
+
~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for the R/S languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 by the Pygments team, see AUTHORS.
|
| 8 |
+
:license: BSD, see LICENSE for details.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
import re
|
| 12 |
+
|
| 13 |
+
from pygments.lexer import Lexer, RegexLexer, include, do_insertions
|
| 14 |
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
| 15 |
+
Number, Punctuation, Generic, Whitespace
|
| 16 |
+
|
| 17 |
+
__all__ = ['RConsoleLexer', 'SLexer', 'RdLexer']
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
line_re = re.compile('.*?\n')
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
class RConsoleLexer(Lexer):
|
| 24 |
+
"""
|
| 25 |
+
For R console transcripts or R CMD BATCH output files.
|
| 26 |
+
"""
|
| 27 |
+
|
| 28 |
+
name = 'RConsole'
|
| 29 |
+
aliases = ['rconsole', 'rout']
|
| 30 |
+
filenames = ['*.Rout']
|
| 31 |
+
url = 'https://www.r-project.org'
|
| 32 |
+
version_added = ''
|
| 33 |
+
_example = "rconsole/r-console-transcript.Rout"
|
| 34 |
+
|
| 35 |
+
def get_tokens_unprocessed(self, text):
|
| 36 |
+
slexer = SLexer(**self.options)
|
| 37 |
+
|
| 38 |
+
current_code_block = ''
|
| 39 |
+
insertions = []
|
| 40 |
+
|
| 41 |
+
for match in line_re.finditer(text):
|
| 42 |
+
line = match.group()
|
| 43 |
+
if line.startswith('>') or line.startswith('+'):
|
| 44 |
+
# Colorize the prompt as such,
|
| 45 |
+
# then put rest of line into current_code_block
|
| 46 |
+
insertions.append((len(current_code_block),
|
| 47 |
+
[(0, Generic.Prompt, line[:2])]))
|
| 48 |
+
current_code_block += line[2:]
|
| 49 |
+
else:
|
| 50 |
+
# We have reached a non-prompt line!
|
| 51 |
+
# If we have stored prompt lines, need to process them first.
|
| 52 |
+
if current_code_block:
|
| 53 |
+
# Weave together the prompts and highlight code.
|
| 54 |
+
yield from do_insertions(
|
| 55 |
+
insertions, slexer.get_tokens_unprocessed(current_code_block))
|
| 56 |
+
# Reset vars for next code block.
|
| 57 |
+
current_code_block = ''
|
| 58 |
+
insertions = []
|
| 59 |
+
# Now process the actual line itself, this is output from R.
|
| 60 |
+
yield match.start(), Generic.Output, line
|
| 61 |
+
|
| 62 |
+
# If we happen to end on a code block with nothing after it, need to
|
| 63 |
+
# process the last code block. This is neither elegant nor DRY so
|
| 64 |
+
# should be changed.
|
| 65 |
+
if current_code_block:
|
| 66 |
+
yield from do_insertions(
|
| 67 |
+
insertions, slexer.get_tokens_unprocessed(current_code_block))
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
class SLexer(RegexLexer):
|
| 71 |
+
"""
|
| 72 |
+
For S, S-plus, and R source code.
|
| 73 |
+
"""
|
| 74 |
+
|
| 75 |
+
name = 'S'
|
| 76 |
+
aliases = ['splus', 's', 'r']
|
| 77 |
+
filenames = ['*.S', '*.R', '.Rhistory', '.Rprofile', '.Renviron']
|
| 78 |
+
mimetypes = ['text/S-plus', 'text/S', 'text/x-r-source', 'text/x-r',
|
| 79 |
+
'text/x-R', 'text/x-r-history', 'text/x-r-profile']
|
| 80 |
+
url = 'https://www.r-project.org'
|
| 81 |
+
version_added = '0.10'
|
| 82 |
+
|
| 83 |
+
valid_name = r'`[^`\\]*(?:\\.[^`\\]*)*`|(?:[a-zA-Z]|\.[A-Za-z_.])[\w.]*|\.'
|
| 84 |
+
tokens = {
|
| 85 |
+
'comments': [
|
| 86 |
+
(r'#.*$', Comment.Single),
|
| 87 |
+
],
|
| 88 |
+
'valid_name': [
|
| 89 |
+
(valid_name, Name),
|
| 90 |
+
],
|
| 91 |
+
'function_name': [
|
| 92 |
+
(rf'({valid_name})\s*(?=\()', Name.Function),
|
| 93 |
+
],
|
| 94 |
+
'punctuation': [
|
| 95 |
+
(r'\[{1,2}|\]{1,2}|\(|\)|;|,', Punctuation),
|
| 96 |
+
],
|
| 97 |
+
'keywords': [
|
| 98 |
+
(r'(if|else|for|while|repeat|in|next|break|return|switch|function)'
|
| 99 |
+
r'(?![\w.])',
|
| 100 |
+
Keyword.Reserved),
|
| 101 |
+
],
|
| 102 |
+
'operators': [
|
| 103 |
+
(r'<<?-|->>?|-|==|<=|>=|\|>|<|>|&&?|!=|\|\|?|\?', Operator),
|
| 104 |
+
(r'\*|\+|\^|/|!|%[^%]*%|=|~|\$|@|:{1,3}', Operator),
|
| 105 |
+
],
|
| 106 |
+
'builtin_symbols': [
|
| 107 |
+
(r'(NULL|NA(_(integer|real|complex|character)_)?|'
|
| 108 |
+
r'letters|LETTERS|Inf|TRUE|FALSE|NaN|pi|\.\.(\.|[0-9]+))'
|
| 109 |
+
r'(?![\w.])',
|
| 110 |
+
Keyword.Constant),
|
| 111 |
+
(r'(T|F)\b', Name.Builtin.Pseudo),
|
| 112 |
+
],
|
| 113 |
+
'numbers': [
|
| 114 |
+
# hex number
|
| 115 |
+
(r'0[xX][a-fA-F0-9]+([pP][0-9]+)?[Li]?', Number.Hex),
|
| 116 |
+
# decimal number
|
| 117 |
+
(r'[+-]?([0-9]+(\.[0-9]+)?|\.[0-9]+|\.)([eE][+-]?[0-9]+)?[Li]?',
|
| 118 |
+
Number),
|
| 119 |
+
],
|
| 120 |
+
'statements': [
|
| 121 |
+
include('comments'),
|
| 122 |
+
# whitespaces
|
| 123 |
+
(r'\s+', Whitespace),
|
| 124 |
+
(r'\'', String, 'string_squote'),
|
| 125 |
+
(r'\"', String, 'string_dquote'),
|
| 126 |
+
include('builtin_symbols'),
|
| 127 |
+
include('keywords'),
|
| 128 |
+
include('function_name'),
|
| 129 |
+
include('valid_name'),
|
| 130 |
+
include('numbers'),
|
| 131 |
+
include('punctuation'),
|
| 132 |
+
include('operators'),
|
| 133 |
+
],
|
| 134 |
+
'root': [
|
| 135 |
+
# calls:
|
| 136 |
+
include('statements'),
|
| 137 |
+
# blocks:
|
| 138 |
+
(r'\{|\}', Punctuation),
|
| 139 |
+
# (r'\{', Punctuation, 'block'),
|
| 140 |
+
(r'.', Text),
|
| 141 |
+
],
|
| 142 |
+
# 'block': [
|
| 143 |
+
# include('statements'),
|
| 144 |
+
# ('\{', Punctuation, '#push'),
|
| 145 |
+
# ('\}', Punctuation, '#pop')
|
| 146 |
+
# ],
|
| 147 |
+
'string_squote': [
|
| 148 |
+
(r'([^\'\\]|\\.)*\'', String, '#pop'),
|
| 149 |
+
],
|
| 150 |
+
'string_dquote': [
|
| 151 |
+
(r'([^"\\]|\\.)*"', String, '#pop'),
|
| 152 |
+
],
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
def analyse_text(text):
|
| 156 |
+
if re.search(r'[a-z0-9_\])\s]<-(?!-)', text):
|
| 157 |
+
return 0.11
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
class RdLexer(RegexLexer):
|
| 161 |
+
"""
|
| 162 |
+
Pygments Lexer for R documentation (Rd) files
|
| 163 |
+
|
| 164 |
+
This is a very minimal implementation, highlighting little more
|
| 165 |
+
than the macros. A description of Rd syntax is found in `Writing R
|
| 166 |
+
Extensions <http://cran.r-project.org/doc/manuals/R-exts.html>`_
|
| 167 |
+
and `Parsing Rd files <http://developer.r-project.org/parseRd.pdf>`_.
|
| 168 |
+
"""
|
| 169 |
+
name = 'Rd'
|
| 170 |
+
aliases = ['rd']
|
| 171 |
+
filenames = ['*.Rd']
|
| 172 |
+
mimetypes = ['text/x-r-doc']
|
| 173 |
+
url = 'http://cran.r-project.org/doc/manuals/R-exts.html'
|
| 174 |
+
version_added = '1.6'
|
| 175 |
+
|
| 176 |
+
# To account for verbatim / LaTeX-like / and R-like areas
|
| 177 |
+
# would require parsing.
|
| 178 |
+
tokens = {
|
| 179 |
+
'root': [
|
| 180 |
+
# catch escaped brackets and percent sign
|
| 181 |
+
(r'\\[\\{}%]', String.Escape),
|
| 182 |
+
# comments
|
| 183 |
+
(r'%.*$', Comment),
|
| 184 |
+
# special macros with no arguments
|
| 185 |
+
(r'\\(?:cr|l?dots|R|tab)\b', Keyword.Constant),
|
| 186 |
+
# macros
|
| 187 |
+
(r'\\[a-zA-Z]+\b', Keyword),
|
| 188 |
+
# special preprocessor macros
|
| 189 |
+
(r'^\s*#(?:ifn?def|endif).*\b', Comment.Preproc),
|
| 190 |
+
# non-escaped brackets
|
| 191 |
+
(r'[{}]', Name.Builtin),
|
| 192 |
+
# everything else
|
| 193 |
+
(r'[^\\%\n{}]+', Text),
|
| 194 |
+
(r'.', Text),
|
| 195 |
+
]
|
| 196 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/rdf.py
ADDED
|
@@ -0,0 +1,468 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.rdf
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for semantic web and RDF query languages and markup.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 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]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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.rebol
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for the REBOL and related languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 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 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/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-2025 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 |
+
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/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-2025 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
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/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-2025 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 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/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-2025 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 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/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-2025 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 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/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-2025 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 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/robotframework.py
ADDED
|
@@ -0,0 +1,551 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.robotframework
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for Robot Framework.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 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
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/ruby.py
ADDED
|
@@ -0,0 +1,518 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.ruby
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for Ruby and related languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 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 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/rust.py
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.rust
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexers for the Rust language.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 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 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/sas.py
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
pygments.lexers.sas
|
| 3 |
+
~~~~~~~~~~~~~~~~~~~
|
| 4 |
+
|
| 5 |
+
Lexer for SAS.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 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 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/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-2025 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 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/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-2025 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
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/scripting.py
ADDED
|
@@ -0,0 +1,1616 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
+
Lexer for scripting and embedded languages.
|
| 6 |
+
|
| 7 |
+
:copyright: Copyright 2006-2025 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 |
+
_name = r'(?:[^\W\d]\w*)'
|
| 63 |
+
|
| 64 |
+
tokens = {
|
| 65 |
+
'root': [
|
| 66 |
+
# Lua allows a file to start with a shebang.
|
| 67 |
+
(r'#!.*', Comment.Preproc),
|
| 68 |
+
default('base'),
|
| 69 |
+
],
|
| 70 |
+
'ws': [
|
| 71 |
+
(_comment_multiline, Comment.Multiline),
|
| 72 |
+
(_comment_single, Comment.Single),
|
| 73 |
+
(_space, Whitespace),
|
| 74 |
+
],
|
| 75 |
+
'base': [
|
| 76 |
+
include('ws'),
|
| 77 |
+
|
| 78 |
+
(r'(?i)0x[\da-f]*(\.[\da-f]*)?(p[+-]?\d+)?', Number.Hex),
|
| 79 |
+
(r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float),
|
| 80 |
+
(r'(?i)\d+e[+-]?\d+', Number.Float),
|
| 81 |
+
(r'\d+', Number.Integer),
|
| 82 |
+
|
| 83 |
+
# multiline strings
|
| 84 |
+
(r'(?s)\[(=*)\[.*?\]\1\]', String),
|
| 85 |
+
|
| 86 |
+
(r'::', Punctuation, 'label'),
|
| 87 |
+
(r'\.{3}', Punctuation),
|
| 88 |
+
(r'[=<>|~&+\-*/%#^]+|\.\.', Operator),
|
| 89 |
+
(r'[\[\]{}().,:;]+', Punctuation),
|
| 90 |
+
(r'(and|or|not)\b', Operator.Word),
|
| 91 |
+
|
| 92 |
+
(words([
|
| 93 |
+
'break', 'do', 'else', 'elseif', 'end', 'for', 'if', 'in',
|
| 94 |
+
'repeat', 'return', 'then', 'until', 'while'
|
| 95 |
+
], suffix=r'\b'), Keyword.Reserved),
|
| 96 |
+
(r'goto\b', Keyword.Reserved, 'goto'),
|
| 97 |
+
(r'(local)\b', Keyword.Declaration),
|
| 98 |
+
(r'(true|false|nil)\b', Keyword.Constant),
|
| 99 |
+
|
| 100 |
+
(r'(function)\b', Keyword.Reserved, 'funcname'),
|
| 101 |
+
|
| 102 |
+
(words(all_lua_builtins(), suffix=r"\b"), Name.Builtin),
|
| 103 |
+
(fr'[A-Za-z_]\w*(?={_s}*[.:])', Name.Variable, 'varname'),
|
| 104 |
+
(fr'[A-Za-z_]\w*(?={_s}*\()', Name.Function),
|
| 105 |
+
(r'[A-Za-z_]\w*', Name.Variable),
|
| 106 |
+
|
| 107 |
+
("'", String.Single, combined('stringescape', 'sqs')),
|
| 108 |
+
('"', String.Double, combined('stringescape', 'dqs'))
|
| 109 |
+
],
|
| 110 |
+
|
| 111 |
+
'varname': [
|
| 112 |
+
include('ws'),
|
| 113 |
+
(r'\.\.', Operator, '#pop'),
|
| 114 |
+
(r'[.:]', Punctuation),
|
| 115 |
+
(rf'{_name}(?={_s}*[.:])', Name.Property),
|
| 116 |
+
(rf'{_name}(?={_s}*\()', Name.Function, '#pop'),
|
| 117 |
+
(_name, Name.Property, '#pop'),
|
| 118 |
+
],
|
| 119 |
+
|
| 120 |
+
'funcname': [
|
| 121 |
+
include('ws'),
|
| 122 |
+
(r'[.:]', Punctuation),
|
| 123 |
+
(rf'{_name}(?={_s}*[.:])', Name.Class),
|
| 124 |
+
(_name, Name.Function, '#pop'),
|
| 125 |
+
# inline function
|
| 126 |
+
(r'\(', Punctuation, '#pop'),
|
| 127 |
+
],
|
| 128 |
+
|
| 129 |
+
'goto': [
|
| 130 |
+
include('ws'),
|
| 131 |
+
(_name, Name.Label, '#pop'),
|
| 132 |
+
],
|
| 133 |
+
|
| 134 |
+
'label': [
|
| 135 |
+
include('ws'),
|
| 136 |
+
(r'::', Punctuation, '#pop'),
|
| 137 |
+
(_name, Name.Label),
|
| 138 |
+
],
|
| 139 |
+
|
| 140 |
+
'stringescape': [
|
| 141 |
+
(r'\\([abfnrtv\\"\']|[\r\n]{1,2}|z\s*|x[0-9a-fA-F]{2}|\d{1,3}|'
|
| 142 |
+
r'u\{[0-9a-fA-F]+\})', String.Escape),
|
| 143 |
+
],
|
| 144 |
+
|
| 145 |
+
'sqs': [
|
| 146 |
+
(r"'", String.Single, '#pop'),
|
| 147 |
+
(r"[^\\']+", String.Single),
|
| 148 |
+
],
|
| 149 |
+
|
| 150 |
+
'dqs': [
|
| 151 |
+
(r'"', String.Double, '#pop'),
|
| 152 |
+
(r'[^\\"]+', String.Double),
|
| 153 |
+
]
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
def __init__(self, **options):
|
| 157 |
+
self.func_name_highlighting = get_bool_opt(
|
| 158 |
+
options, 'func_name_highlighting', True)
|
| 159 |
+
self.disabled_modules = get_list_opt(options, 'disabled_modules', [])
|
| 160 |
+
|
| 161 |
+
self._functions = set()
|
| 162 |
+
if self.func_name_highlighting:
|
| 163 |
+
from pygments.lexers._lua_builtins import MODULES
|
| 164 |
+
for mod, func in MODULES.items():
|
| 165 |
+
if mod not in self.disabled_modules:
|
| 166 |
+
self._functions.update(func)
|
| 167 |
+
RegexLexer.__init__(self, **options)
|
| 168 |
+
|
| 169 |
+
def get_tokens_unprocessed(self, text):
|
| 170 |
+
for index, token, value in \
|
| 171 |
+
RegexLexer.get_tokens_unprocessed(self, text):
|
| 172 |
+
if token is Name.Builtin and value not in self._functions:
|
| 173 |
+
if '.' in value:
|
| 174 |
+
a, b = value.split('.')
|
| 175 |
+
yield index, Name, a
|
| 176 |
+
yield index + len(a), Punctuation, '.'
|
| 177 |
+
yield index + len(a) + 1, Name, b
|
| 178 |
+
else:
|
| 179 |
+
yield index, Name, value
|
| 180 |
+
continue
|
| 181 |
+
yield index, token, value
|
| 182 |
+
|
| 183 |
+
def _luau_make_expression(should_pop, _s):
|
| 184 |
+
temp_list = [
|
| 185 |
+
(r'0[xX][\da-fA-F_]*', Number.Hex, '#pop'),
|
| 186 |
+
(r'0[bB][\d_]*', Number.Bin, '#pop'),
|
| 187 |
+
(r'\.?\d[\d_]*(?:\.[\d_]*)?(?:[eE][+-]?[\d_]+)?', Number.Float, '#pop'),
|
| 188 |
+
|
| 189 |
+
(words((
|
| 190 |
+
'true', 'false', 'nil'
|
| 191 |
+
), suffix=r'\b'), Keyword.Constant, '#pop'),
|
| 192 |
+
|
| 193 |
+
(r'\[(=*)\[[.\n]*?\]\1\]', String, '#pop'),
|
| 194 |
+
|
| 195 |
+
(r'(\.)([a-zA-Z_]\w*)(?=%s*[({"\'])', bygroups(Punctuation, Name.Function), '#pop'),
|
| 196 |
+
(r'(\.)([a-zA-Z_]\w*)', bygroups(Punctuation, Name.Variable), '#pop'),
|
| 197 |
+
|
| 198 |
+
(rf'[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*(?={_s}*[({{"\'])', Name.Other, '#pop'),
|
| 199 |
+
(r'[a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*', Name, '#pop'),
|
| 200 |
+
]
|
| 201 |
+
if should_pop:
|
| 202 |
+
return temp_list
|
| 203 |
+
return [entry[:2] for entry in temp_list]
|
| 204 |
+
|
| 205 |
+
def _luau_make_expression_special(should_pop):
|
| 206 |
+
temp_list = [
|
| 207 |
+
(r'\{', Punctuation, ('#pop', 'closing_brace_base', 'expression')),
|
| 208 |
+
(r'\(', Punctuation, ('#pop', 'closing_parenthesis_base', 'expression')),
|
| 209 |
+
|
| 210 |
+
(r'::?', Punctuation, ('#pop', 'type_end', 'type_start')),
|
| 211 |
+
|
| 212 |
+
(r"'", String.Single, ('#pop', 'string_single')),
|
| 213 |
+
(r'"', String.Double, ('#pop', 'string_double')),
|
| 214 |
+
(r'`', String.Backtick, ('#pop', 'string_interpolated')),
|
| 215 |
+
]
|
| 216 |
+
if should_pop:
|
| 217 |
+
return temp_list
|
| 218 |
+
return [(entry[0], entry[1], entry[2][1:]) for entry in temp_list]
|
| 219 |
+
|
| 220 |
+
class LuauLexer(RegexLexer):
|
| 221 |
+
"""
|
| 222 |
+
For Luau source code.
|
| 223 |
+
|
| 224 |
+
Additional options accepted:
|
| 225 |
+
|
| 226 |
+
`include_luau_builtins`
|
| 227 |
+
If given and ``True``, automatically highlight Luau builtins
|
| 228 |
+
(default: ``True``).
|
| 229 |
+
`include_roblox_builtins`
|
| 230 |
+
If given and ``True``, automatically highlight Roblox-specific builtins
|
| 231 |
+
(default: ``False``).
|
| 232 |
+
`additional_builtins`
|
| 233 |
+
If given, must be a list of additional builtins to highlight.
|
| 234 |
+
`disabled_builtins`
|
| 235 |
+
If given, must be a list of builtins that will not be highlighted.
|
| 236 |
+
"""
|
| 237 |
+
|
| 238 |
+
name = 'Luau'
|
| 239 |
+
url = 'https://luau-lang.org/'
|
| 240 |
+
aliases = ['luau']
|
| 241 |
+
filenames = ['*.luau']
|
| 242 |
+
version_added = '2.18'
|
| 243 |
+
|
| 244 |
+
_comment_multiline = r'(?:--\[(?P<level>=*)\[[\w\W]*?\](?P=level)\])'
|
| 245 |
+
_comment_single = r'(?:--.*$)'
|
| 246 |
+
_s = r'(?:{}|{}|{})'.format(_comment_multiline, _comment_single, r'\s+')
|
| 247 |
+
|
| 248 |
+
tokens = {
|
| 249 |
+
'root': [
|
| 250 |
+
(r'#!.*', Comment.Hashbang, 'base'),
|
| 251 |
+
default('base'),
|
| 252 |
+
],
|
| 253 |
+
|
| 254 |
+
'ws': [
|
| 255 |
+
(_comment_multiline, Comment.Multiline),
|
| 256 |
+
(_comment_single, Comment.Single),
|
| 257 |
+
(r'\s+', Whitespace),
|
| 258 |
+
],
|
| 259 |
+
|
| 260 |
+
'base': [
|
| 261 |
+
include('ws'),
|
| 262 |
+
|
| 263 |
+
*_luau_make_expression_special(False),
|
| 264 |
+
(r'\.\.\.', Punctuation),
|
| 265 |
+
|
| 266 |
+
(rf'type\b(?={_s}+[a-zA-Z_])', Keyword.Reserved, 'type_declaration'),
|
| 267 |
+
(rf'export\b(?={_s}+[a-zA-Z_])', Keyword.Reserved),
|
| 268 |
+
|
| 269 |
+
(r'(?:\.\.|//|[+\-*\/%^<>=])=?', Operator, 'expression'),
|
| 270 |
+
(r'~=', Operator, 'expression'),
|
| 271 |
+
|
| 272 |
+
(words((
|
| 273 |
+
'and', 'or', 'not'
|
| 274 |
+
), suffix=r'\b'), Operator.Word, 'expression'),
|
| 275 |
+
|
| 276 |
+
(words((
|
| 277 |
+
'elseif', 'for', 'if', 'in', 'repeat', 'return', 'until',
|
| 278 |
+
'while'), suffix=r'\b'), Keyword.Reserved, 'expression'),
|
| 279 |
+
(r'local\b', Keyword.Declaration, 'expression'),
|
| 280 |
+
|
| 281 |
+
(r'function\b', Keyword.Reserved, ('expression', 'func_name')),
|
| 282 |
+
|
| 283 |
+
(r'[\])};]+', Punctuation),
|
| 284 |
+
|
| 285 |
+
include('expression_static'),
|
| 286 |
+
*_luau_make_expression(False, _s),
|
| 287 |
+
|
| 288 |
+
(r'[\[.,]', Punctuation, 'expression'),
|
| 289 |
+
],
|
| 290 |
+
'expression_static': [
|
| 291 |
+
(words((
|
| 292 |
+
'break', 'continue', 'do', 'else', 'elseif', 'end', 'for',
|
| 293 |
+
'if', 'in', 'repeat', 'return', 'then', 'until', 'while'),
|
| 294 |
+
suffix=r'\b'), Keyword.Reserved),
|
| 295 |
+
],
|
| 296 |
+
'expression': [
|
| 297 |
+
include('ws'),
|
| 298 |
+
|
| 299 |
+
(r'if\b', Keyword.Reserved, ('ternary', 'expression')),
|
| 300 |
+
|
| 301 |
+
(r'local\b', Keyword.Declaration),
|
| 302 |
+
*_luau_make_expression_special(True),
|
| 303 |
+
(r'\.\.\.', Punctuation, '#pop'),
|
| 304 |
+
|
| 305 |
+
(r'function\b', Keyword.Reserved, 'func_name'),
|
| 306 |
+
|
| 307 |
+
include('expression_static'),
|
| 308 |
+
*_luau_make_expression(True, _s),
|
| 309 |
+
|
| 310 |
+
default('#pop'),
|
| 311 |
+
],
|
| 312 |
+
'ternary': [
|
| 313 |
+
include('ws'),
|
| 314 |
+
|
| 315 |
+
(r'else\b', Keyword.Reserved, '#pop'),
|
| 316 |
+
(words((
|
| 317 |
+
'then', 'elseif',
|
| 318 |
+
), suffix=r'\b'), Operator.Reserved, 'expression'),
|
| 319 |
+
|
| 320 |
+
default('#pop'),
|
| 321 |
+
],
|
| 322 |
+
|
| 323 |
+
'closing_brace_pop': [
|
| 324 |
+
(r'\}', Punctuation, '#pop'),
|
| 325 |
+
],
|
| 326 |
+
'closing_parenthesis_pop': [
|
| 327 |
+
(r'\)', Punctuation, '#pop'),
|
| 328 |
+
],
|
| 329 |
+
'closing_gt_pop': [
|
| 330 |
+
(r'>', Punctuation, '#pop'),
|
| 331 |
+
],
|
| 332 |
+
|
| 333 |
+
'closing_parenthesis_base': [
|
| 334 |
+
include('closing_parenthesis_pop'),
|
| 335 |
+
include('base'),
|
| 336 |
+
],
|
| 337 |
+
'closing_parenthesis_type': [
|
| 338 |
+
include('closing_parenthesis_pop'),
|
| 339 |
+
include('type'),
|
| 340 |
+
],
|
| 341 |
+
'closing_brace_base': [
|
| 342 |
+
include('closing_brace_pop'),
|
| 343 |
+
include('base'),
|
| 344 |
+
],
|
| 345 |
+
'closing_brace_type': [
|
| 346 |
+
include('closing_brace_pop'),
|
| 347 |
+
include('type'),
|
| 348 |
+
],
|
| 349 |
+
'closing_gt_type': [
|
| 350 |
+
include('closing_gt_pop'),
|
| 351 |
+
include('type'),
|
| 352 |
+
],
|
| 353 |
+
|
| 354 |
+
'string_escape': [
|
| 355 |
+
(r'\\z\s*', String.Escape),
|
| 356 |
+
(r'\\(?:[abfnrtvz\\"\'`\{\n])|[\r\n]{1,2}|x[\da-fA-F]{2}|\d{1,3}|'
|
| 357 |
+
r'u\{\}[\da-fA-F]*\}', String.Escape),
|
| 358 |
+
],
|
| 359 |
+
'string_single': [
|
| 360 |
+
include('string_escape'),
|
| 361 |
+
|
| 362 |
+
(r"'", String.Single, "#pop"),
|
| 363 |
+
(r"[^\\']+", String.Single),
|
| 364 |
+
],
|
| 365 |
+
'string_double': [
|
| 366 |
+
include('string_escape'),
|
| 367 |
+
|
| 368 |
+
(r'"', String.Double, "#pop"),
|
| 369 |
+
(r'[^\\"]+', String.Double),
|
| 370 |
+
],
|
| 371 |
+
'string_interpolated': [
|
| 372 |
+
include('string_escape'),
|
| 373 |
+
|
| 374 |
+
(r'\{', Punctuation, ('closing_brace_base', 'expression')),
|
| 375 |
+
|
| 376 |
+
(r'`', String.Backtick, "#pop"),
|
| 377 |
+
(r'[^\\`\{]+', String.Backtick),
|
| 378 |
+
],
|
| 379 |
+
|
| 380 |
+
'func_name': [
|
| 381 |
+
include('ws'),
|
| 382 |
+
|
| 383 |
+
(r'[.:]', Punctuation),
|
| 384 |
+
(rf'[a-zA-Z_]\w*(?={_s}*[.:])', Name.Class),
|
| 385 |
+
(r'[a-zA-Z_]\w*', Name.Function),
|
| 386 |
+
|
| 387 |
+
(r'<', Punctuation, 'closing_gt_type'),
|
| 388 |
+
|
| 389 |
+
(r'\(', Punctuation, '#pop'),
|
| 390 |
+
],
|
| 391 |
+
|
| 392 |
+
'type': [
|
| 393 |
+
include('ws'),
|
| 394 |
+
|
| 395 |
+
(r'\(', Punctuation, 'closing_parenthesis_type'),
|
| 396 |
+
(r'\{', Punctuation, 'closing_brace_type'),
|
| 397 |
+
(r'<', Punctuation, 'closing_gt_type'),
|
| 398 |
+
|
| 399 |
+
(r"'", String.Single, 'string_single'),
|
| 400 |
+
(r'"', String.Double, 'string_double'),
|
| 401 |
+
|
| 402 |
+
(r'[|&\.,\[\]:=]+', Punctuation),
|
| 403 |
+
(r'->', Punctuation),
|
| 404 |
+
|
| 405 |
+
(r'typeof\(', Name.Builtin, ('closing_parenthesis_base',
|
| 406 |
+
'expression')),
|
| 407 |
+
(r'[a-zA-Z_]\w*', Name.Class),
|
| 408 |
+
],
|
| 409 |
+
'type_start': [
|
| 410 |
+
include('ws'),
|
| 411 |
+
|
| 412 |
+
(r'\(', Punctuation, ('#pop', 'closing_parenthesis_type')),
|
| 413 |
+
(r'\{', Punctuation, ('#pop', 'closing_brace_type')),
|
| 414 |
+
(r'<', Punctuation, ('#pop', 'closing_gt_type')),
|
| 415 |
+
|
| 416 |
+
(r"'", String.Single, ('#pop', 'string_single')),
|
| 417 |
+
(r'"', String.Double, ('#pop', 'string_double')),
|
| 418 |
+
|
| 419 |
+
(r'typeof\(', Name.Builtin, ('#pop', 'closing_parenthesis_base',
|
| 420 |
+
'expression')),
|
| 421 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop'),
|
| 422 |
+
],
|
| 423 |
+
'type_end': [
|
| 424 |
+
include('ws'),
|
| 425 |
+
|
| 426 |
+
(r'[|&\.]', Punctuation, 'type_start'),
|
| 427 |
+
(r'->', Punctuation, 'type_start'),
|
| 428 |
+
|
| 429 |
+
(r'<', Punctuation, 'closing_gt_type'),
|
| 430 |
+
|
| 431 |
+
default('#pop'),
|
| 432 |
+
],
|
| 433 |
+
'type_declaration': [
|
| 434 |
+
include('ws'),
|
| 435 |
+
|
| 436 |
+
(r'[a-zA-Z_]\w*', Name.Class),
|
| 437 |
+
(r'<', Punctuation, 'closing_gt_type'),
|
| 438 |
+
|
| 439 |
+
(r'=', Punctuation, ('#pop', 'type_end', 'type_start')),
|
| 440 |
+
],
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
def __init__(self, **options):
|
| 444 |
+
self.include_luau_builtins = get_bool_opt(
|
| 445 |
+
options, 'include_luau_builtins', True)
|
| 446 |
+
self.include_roblox_builtins = get_bool_opt(
|
| 447 |
+
options, 'include_roblox_builtins', False)
|
| 448 |
+
self.additional_builtins = get_list_opt(options, 'additional_builtins', [])
|
| 449 |
+
self.disabled_builtins = get_list_opt(options, 'disabled_builtins', [])
|
| 450 |
+
|
| 451 |
+
self._builtins = set(self.additional_builtins)
|
| 452 |
+
if self.include_luau_builtins:
|
| 453 |
+
from pygments.lexers._luau_builtins import LUAU_BUILTINS
|
| 454 |
+
self._builtins.update(LUAU_BUILTINS)
|
| 455 |
+
if self.include_roblox_builtins:
|
| 456 |
+
from pygments.lexers._luau_builtins import ROBLOX_BUILTINS
|
| 457 |
+
self._builtins.update(ROBLOX_BUILTINS)
|
| 458 |
+
if self.additional_builtins:
|
| 459 |
+
self._builtins.update(self.additional_builtins)
|
| 460 |
+
self._builtins.difference_update(self.disabled_builtins)
|
| 461 |
+
|
| 462 |
+
RegexLexer.__init__(self, **options)
|
| 463 |
+
|
| 464 |
+
def get_tokens_unprocessed(self, text):
|
| 465 |
+
for index, token, value in \
|
| 466 |
+
RegexLexer.get_tokens_unprocessed(self, text):
|
| 467 |
+
if token is Name or token is Name.Other:
|
| 468 |
+
split_value = value.split('.')
|
| 469 |
+
complete_value = []
|
| 470 |
+
new_index = index
|
| 471 |
+
for position in range(len(split_value), 0, -1):
|
| 472 |
+
potential_string = '.'.join(split_value[:position])
|
| 473 |
+
if potential_string in self._builtins:
|
| 474 |
+
yield index, Name.Builtin, potential_string
|
| 475 |
+
new_index += len(potential_string)
|
| 476 |
+
|
| 477 |
+
if complete_value:
|
| 478 |
+
yield new_index, Punctuation, '.'
|
| 479 |
+
new_index += 1
|
| 480 |
+
break
|
| 481 |
+
complete_value.insert(0, split_value[position - 1])
|
| 482 |
+
|
| 483 |
+
for position, substring in enumerate(complete_value):
|
| 484 |
+
if position + 1 == len(complete_value):
|
| 485 |
+
if token is Name:
|
| 486 |
+
yield new_index, Name.Variable, substring
|
| 487 |
+
continue
|
| 488 |
+
yield new_index, Name.Function, substring
|
| 489 |
+
continue
|
| 490 |
+
yield new_index, Name.Variable, substring
|
| 491 |
+
new_index += len(substring)
|
| 492 |
+
yield new_index, Punctuation, '.'
|
| 493 |
+
new_index += 1
|
| 494 |
+
|
| 495 |
+
continue
|
| 496 |
+
yield index, token, value
|
| 497 |
+
|
| 498 |
+
class MoonScriptLexer(LuaLexer):
|
| 499 |
+
"""
|
| 500 |
+
For MoonScript source code.
|
| 501 |
+
"""
|
| 502 |
+
|
| 503 |
+
name = 'MoonScript'
|
| 504 |
+
url = 'http://moonscript.org'
|
| 505 |
+
aliases = ['moonscript', 'moon']
|
| 506 |
+
filenames = ['*.moon']
|
| 507 |
+
mimetypes = ['text/x-moonscript', 'application/x-moonscript']
|
| 508 |
+
version_added = '1.5'
|
| 509 |
+
|
| 510 |
+
tokens = {
|
| 511 |
+
'root': [
|
| 512 |
+
(r'#!(.*?)$', Comment.Preproc),
|
| 513 |
+
default('base'),
|
| 514 |
+
],
|
| 515 |
+
'base': [
|
| 516 |
+
('--.*$', Comment.Single),
|
| 517 |
+
(r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number.Float),
|
| 518 |
+
(r'(?i)\d+e[+-]?\d+', Number.Float),
|
| 519 |
+
(r'(?i)0x[0-9a-f]*', Number.Hex),
|
| 520 |
+
(r'\d+', Number.Integer),
|
| 521 |
+
(r'\n', Whitespace),
|
| 522 |
+
(r'[^\S\n]+', Text),
|
| 523 |
+
(r'(?s)\[(=*)\[.*?\]\1\]', String),
|
| 524 |
+
(r'(->|=>)', Name.Function),
|
| 525 |
+
(r':[a-zA-Z_]\w*', Name.Variable),
|
| 526 |
+
(r'(==|!=|~=|<=|>=|\.\.\.|\.\.|[=+\-*/%^<>#!.\\:])', Operator),
|
| 527 |
+
(r'[;,]', Punctuation),
|
| 528 |
+
(r'[\[\]{}()]', Keyword.Type),
|
| 529 |
+
(r'[a-zA-Z_]\w*:', Name.Variable),
|
| 530 |
+
(words((
|
| 531 |
+
'class', 'extends', 'if', 'then', 'super', 'do', 'with',
|
| 532 |
+
'import', 'export', 'while', 'elseif', 'return', 'for', 'in',
|
| 533 |
+
'from', 'when', 'using', 'else', 'and', 'or', 'not', 'switch',
|
| 534 |
+
'break'), suffix=r'\b'),
|
| 535 |
+
Keyword),
|
| 536 |
+
(r'(true|false|nil)\b', Keyword.Constant),
|
| 537 |
+
(r'(and|or|not)\b', Operator.Word),
|
| 538 |
+
(r'(self)\b', Name.Builtin.Pseudo),
|
| 539 |
+
(r'@@?([a-zA-Z_]\w*)?', Name.Variable.Class),
|
| 540 |
+
(r'[A-Z]\w*', Name.Class), # proper name
|
| 541 |
+
(words(all_lua_builtins(), suffix=r"\b"), Name.Builtin),
|
| 542 |
+
(r'[A-Za-z_]\w*', Name),
|
| 543 |
+
("'", String.Single, combined('stringescape', 'sqs')),
|
| 544 |
+
('"', String.Double, combined('stringescape', 'dqs'))
|
| 545 |
+
],
|
| 546 |
+
'stringescape': [
|
| 547 |
+
(r'''\\([abfnrtv\\"']|\d{1,3})''', String.Escape)
|
| 548 |
+
],
|
| 549 |
+
'sqs': [
|
| 550 |
+
("'", String.Single, '#pop'),
|
| 551 |
+
("[^']+", String)
|
| 552 |
+
],
|
| 553 |
+
'dqs': [
|
| 554 |
+
('"', String.Double, '#pop'),
|
| 555 |
+
('[^"]+', String)
|
| 556 |
+
]
|
| 557 |
+
}
|
| 558 |
+
|
| 559 |
+
def get_tokens_unprocessed(self, text):
|
| 560 |
+
# set . as Operator instead of Punctuation
|
| 561 |
+
for index, token, value in LuaLexer.get_tokens_unprocessed(self, text):
|
| 562 |
+
if token == Punctuation and value == ".":
|
| 563 |
+
token = Operator
|
| 564 |
+
yield index, token, value
|
| 565 |
+
|
| 566 |
+
|
| 567 |
+
class ChaiscriptLexer(RegexLexer):
|
| 568 |
+
"""
|
| 569 |
+
For ChaiScript source code.
|
| 570 |
+
"""
|
| 571 |
+
|
| 572 |
+
name = 'ChaiScript'
|
| 573 |
+
url = 'http://chaiscript.com/'
|
| 574 |
+
aliases = ['chaiscript', 'chai']
|
| 575 |
+
filenames = ['*.chai']
|
| 576 |
+
mimetypes = ['text/x-chaiscript', 'application/x-chaiscript']
|
| 577 |
+
version_added = '2.0'
|
| 578 |
+
|
| 579 |
+
flags = re.DOTALL | re.MULTILINE
|
| 580 |
+
|
| 581 |
+
tokens = {
|
| 582 |
+
'commentsandwhitespace': [
|
| 583 |
+
(r'\s+', Text),
|
| 584 |
+
(r'//.*?\n', Comment.Single),
|
| 585 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 586 |
+
(r'^\#.*?\n', Comment.Single)
|
| 587 |
+
],
|
| 588 |
+
'slashstartsregex': [
|
| 589 |
+
include('commentsandwhitespace'),
|
| 590 |
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
| 591 |
+
r'([gim]+\b|\B)', String.Regex, '#pop'),
|
| 592 |
+
(r'(?=/)', Text, ('#pop', 'badregex')),
|
| 593 |
+
default('#pop')
|
| 594 |
+
],
|
| 595 |
+
'badregex': [
|
| 596 |
+
(r'\n', Text, '#pop')
|
| 597 |
+
],
|
| 598 |
+
'root': [
|
| 599 |
+
include('commentsandwhitespace'),
|
| 600 |
+
(r'\n', Text),
|
| 601 |
+
(r'[^\S\n]+', Text),
|
| 602 |
+
(r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|\.\.'
|
| 603 |
+
r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'),
|
| 604 |
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
| 605 |
+
(r'[})\].]', Punctuation),
|
| 606 |
+
(r'[=+\-*/]', Operator),
|
| 607 |
+
(r'(for|in|while|do|break|return|continue|if|else|'
|
| 608 |
+
r'throw|try|catch'
|
| 609 |
+
r')\b', Keyword, 'slashstartsregex'),
|
| 610 |
+
(r'(var)\b', Keyword.Declaration, 'slashstartsregex'),
|
| 611 |
+
(r'(attr|def|fun)\b', Keyword.Reserved),
|
| 612 |
+
(r'(true|false)\b', Keyword.Constant),
|
| 613 |
+
(r'(eval|throw)\b', Name.Builtin),
|
| 614 |
+
(r'`\S+`', Name.Builtin),
|
| 615 |
+
(r'[$a-zA-Z_]\w*', Name.Other),
|
| 616 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 617 |
+
(r'0x[0-9a-fA-F]+', Number.Hex),
|
| 618 |
+
(r'[0-9]+', Number.Integer),
|
| 619 |
+
(r'"', String.Double, 'dqstring'),
|
| 620 |
+
(r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single),
|
| 621 |
+
],
|
| 622 |
+
'dqstring': [
|
| 623 |
+
(r'\$\{[^"}]+?\}', String.Interpol),
|
| 624 |
+
(r'\$', String.Double),
|
| 625 |
+
(r'\\\\', String.Double),
|
| 626 |
+
(r'\\"', String.Double),
|
| 627 |
+
(r'[^\\"$]+', String.Double),
|
| 628 |
+
(r'"', String.Double, '#pop'),
|
| 629 |
+
],
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
|
| 633 |
+
class LSLLexer(RegexLexer):
|
| 634 |
+
"""
|
| 635 |
+
For Second Life's Linden Scripting Language source code.
|
| 636 |
+
"""
|
| 637 |
+
|
| 638 |
+
name = 'LSL'
|
| 639 |
+
aliases = ['lsl']
|
| 640 |
+
filenames = ['*.lsl']
|
| 641 |
+
mimetypes = ['text/x-lsl']
|
| 642 |
+
url = 'https://wiki.secondlife.com/wiki/Linden_Scripting_Language'
|
| 643 |
+
version_added = '2.0'
|
| 644 |
+
|
| 645 |
+
flags = re.MULTILINE
|
| 646 |
+
|
| 647 |
+
lsl_keywords = r'\b(?:do|else|for|if|jump|return|while)\b'
|
| 648 |
+
lsl_types = r'\b(?:float|integer|key|list|quaternion|rotation|string|vector)\b'
|
| 649 |
+
lsl_states = r'\b(?:(?:state)\s+\w+|default)\b'
|
| 650 |
+
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'
|
| 651 |
+
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'
|
| 652 |
+
lsl_constants_float = r'\b(?:DEG_TO_RAD|PI(?:_BY_TWO)?|RAD_TO_DEG|SQRT2|TWO_PI)\b'
|
| 653 |
+
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'
|
| 654 |
+
lsl_constants_integer_boolean = r'\b(?:FALSE|TRUE)\b'
|
| 655 |
+
lsl_constants_rotation = r'\b(?:ZERO_ROTATION)\b'
|
| 656 |
+
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'
|
| 657 |
+
lsl_constants_vector = r'\b(?:TOUCH_INVALID_(?:TEXCOORD|VECTOR)|ZERO_VECTOR)\b'
|
| 658 |
+
lsl_invalid_broken = r'\b(?:LAND_(?:LARGE|MEDIUM|SMALL)_BRUSH)\b'
|
| 659 |
+
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'
|
| 660 |
+
lsl_invalid_illegal = r'\b(?:event)\b'
|
| 661 |
+
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'
|
| 662 |
+
lsl_reserved_godmode = r'\b(?:ll(?:GodLikeRezObject|Set(?:Inventory|Object)PermMask))\b'
|
| 663 |
+
lsl_reserved_log = r'\b(?:print)\b'
|
| 664 |
+
lsl_operators = r'\+\+|\-\-|<<|>>|&&?|\|\|?|\^|~|[!%<>=*+\-/]=?'
|
| 665 |
+
|
| 666 |
+
tokens = {
|
| 667 |
+
'root':
|
| 668 |
+
[
|
| 669 |
+
(r'//.*?\n', Comment.Single),
|
| 670 |
+
(r'/\*', Comment.Multiline, 'comment'),
|
| 671 |
+
(r'"', String.Double, 'string'),
|
| 672 |
+
(lsl_keywords, Keyword),
|
| 673 |
+
(lsl_types, Keyword.Type),
|
| 674 |
+
(lsl_states, Name.Class),
|
| 675 |
+
(lsl_events, Name.Builtin),
|
| 676 |
+
(lsl_functions_builtin, Name.Function),
|
| 677 |
+
(lsl_constants_float, Keyword.Constant),
|
| 678 |
+
(lsl_constants_integer, Keyword.Constant),
|
| 679 |
+
(lsl_constants_integer_boolean, Keyword.Constant),
|
| 680 |
+
(lsl_constants_rotation, Keyword.Constant),
|
| 681 |
+
(lsl_constants_string, Keyword.Constant),
|
| 682 |
+
(lsl_constants_vector, Keyword.Constant),
|
| 683 |
+
(lsl_invalid_broken, Error),
|
| 684 |
+
(lsl_invalid_deprecated, Error),
|
| 685 |
+
(lsl_invalid_illegal, Error),
|
| 686 |
+
(lsl_invalid_unimplemented, Error),
|
| 687 |
+
(lsl_reserved_godmode, Keyword.Reserved),
|
| 688 |
+
(lsl_reserved_log, Keyword.Reserved),
|
| 689 |
+
(r'\b([a-zA-Z_]\w*)\b', Name.Variable),
|
| 690 |
+
(r'(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d*', Number.Float),
|
| 691 |
+
(r'(\d+\.\d*|\.\d+)', Number.Float),
|
| 692 |
+
(r'0[xX][0-9a-fA-F]+', Number.Hex),
|
| 693 |
+
(r'\d+', Number.Integer),
|
| 694 |
+
(lsl_operators, Operator),
|
| 695 |
+
(r':=?', Error),
|
| 696 |
+
(r'[,;{}()\[\]]', Punctuation),
|
| 697 |
+
(r'\n+', Whitespace),
|
| 698 |
+
(r'\s+', Whitespace)
|
| 699 |
+
],
|
| 700 |
+
'comment':
|
| 701 |
+
[
|
| 702 |
+
(r'[^*/]+', Comment.Multiline),
|
| 703 |
+
(r'/\*', Comment.Multiline, '#push'),
|
| 704 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 705 |
+
(r'[*/]', Comment.Multiline)
|
| 706 |
+
],
|
| 707 |
+
'string':
|
| 708 |
+
[
|
| 709 |
+
(r'\\([nt"\\])', String.Escape),
|
| 710 |
+
(r'"', String.Double, '#pop'),
|
| 711 |
+
(r'\\.', Error),
|
| 712 |
+
(r'[^"\\]+', String.Double),
|
| 713 |
+
]
|
| 714 |
+
}
|
| 715 |
+
|
| 716 |
+
|
| 717 |
+
class AppleScriptLexer(RegexLexer):
|
| 718 |
+
"""
|
| 719 |
+
For AppleScript source code,
|
| 720 |
+
including `AppleScript Studio
|
| 721 |
+
<http://developer.apple.com/documentation/AppleScript/
|
| 722 |
+
Reference/StudioReference>`_.
|
| 723 |
+
Contributed by Andreas Amann <aamann@mac.com>.
|
| 724 |
+
"""
|
| 725 |
+
|
| 726 |
+
name = 'AppleScript'
|
| 727 |
+
url = 'https://developer.apple.com/library/archive/documentation/AppleScript/Conceptual/AppleScriptLangGuide/introduction/ASLR_intro.html'
|
| 728 |
+
aliases = ['applescript']
|
| 729 |
+
filenames = ['*.applescript']
|
| 730 |
+
version_added = '1.0'
|
| 731 |
+
|
| 732 |
+
flags = re.MULTILINE | re.DOTALL
|
| 733 |
+
|
| 734 |
+
Identifiers = r'[a-zA-Z]\w*'
|
| 735 |
+
|
| 736 |
+
# XXX: use words() for all of these
|
| 737 |
+
Literals = ('AppleScript', 'current application', 'false', 'linefeed',
|
| 738 |
+
'missing value', 'pi', 'quote', 'result', 'return', 'space',
|
| 739 |
+
'tab', 'text item delimiters', 'true', 'version')
|
| 740 |
+
Classes = ('alias ', 'application ', 'boolean ', 'class ', 'constant ',
|
| 741 |
+
'date ', 'file ', 'integer ', 'list ', 'number ', 'POSIX file ',
|
| 742 |
+
'real ', 'record ', 'reference ', 'RGB color ', 'script ',
|
| 743 |
+
'text ', 'unit types', '(?:Unicode )?text', 'string')
|
| 744 |
+
BuiltIn = ('attachment', 'attribute run', 'character', 'day', 'month',
|
| 745 |
+
'paragraph', 'word', 'year')
|
| 746 |
+
HandlerParams = ('about', 'above', 'against', 'apart from', 'around',
|
| 747 |
+
'aside from', 'at', 'below', 'beneath', 'beside',
|
| 748 |
+
'between', 'for', 'given', 'instead of', 'on', 'onto',
|
| 749 |
+
'out of', 'over', 'since')
|
| 750 |
+
Commands = ('ASCII (character|number)', 'activate', 'beep', 'choose URL',
|
| 751 |
+
'choose application', 'choose color', 'choose file( name)?',
|
| 752 |
+
'choose folder', 'choose from list',
|
| 753 |
+
'choose remote application', 'clipboard info',
|
| 754 |
+
'close( access)?', 'copy', 'count', 'current date', 'delay',
|
| 755 |
+
'delete', 'display (alert|dialog)', 'do shell script',
|
| 756 |
+
'duplicate', 'exists', 'get eof', 'get volume settings',
|
| 757 |
+
'info for', 'launch', 'list (disks|folder)', 'load script',
|
| 758 |
+
'log', 'make', 'mount volume', 'new', 'offset',
|
| 759 |
+
'open( (for access|location))?', 'path to', 'print', 'quit',
|
| 760 |
+
'random number', 'read', 'round', 'run( script)?',
|
| 761 |
+
'say', 'scripting components',
|
| 762 |
+
'set (eof|the clipboard to|volume)', 'store script',
|
| 763 |
+
'summarize', 'system attribute', 'system info',
|
| 764 |
+
'the clipboard', 'time to GMT', 'write', 'quoted form')
|
| 765 |
+
References = ('(in )?back of', '(in )?front of', '[0-9]+(st|nd|rd|th)',
|
| 766 |
+
'first', 'second', 'third', 'fourth', 'fifth', 'sixth',
|
| 767 |
+
'seventh', 'eighth', 'ninth', 'tenth', 'after', 'back',
|
| 768 |
+
'before', 'behind', 'every', 'front', 'index', 'last',
|
| 769 |
+
'middle', 'some', 'that', 'through', 'thru', 'where', 'whose')
|
| 770 |
+
Operators = ("and", "or", "is equal", "equals", "(is )?equal to", "is not",
|
| 771 |
+
"isn't", "isn't equal( to)?", "is not equal( to)?",
|
| 772 |
+
"doesn't equal", "does not equal", "(is )?greater than",
|
| 773 |
+
"comes after", "is not less than or equal( to)?",
|
| 774 |
+
"isn't less than or equal( to)?", "(is )?less than",
|
| 775 |
+
"comes before", "is not greater than or equal( to)?",
|
| 776 |
+
"isn't greater than or equal( to)?",
|
| 777 |
+
"(is )?greater than or equal( to)?", "is not less than",
|
| 778 |
+
"isn't less than", "does not come before",
|
| 779 |
+
"doesn't come before", "(is )?less than or equal( to)?",
|
| 780 |
+
"is not greater than", "isn't greater than",
|
| 781 |
+
"does not come after", "doesn't come after", "starts? with",
|
| 782 |
+
"begins? with", "ends? with", "contains?", "does not contain",
|
| 783 |
+
"doesn't contain", "is in", "is contained by", "is not in",
|
| 784 |
+
"is not contained by", "isn't contained by", "div", "mod",
|
| 785 |
+
"not", "(a )?(ref( to)?|reference to)", "is", "does")
|
| 786 |
+
Control = ('considering', 'else', 'error', 'exit', 'from', 'if',
|
| 787 |
+
'ignoring', 'in', 'repeat', 'tell', 'then', 'times', 'to',
|
| 788 |
+
'try', 'until', 'using terms from', 'while', 'whith',
|
| 789 |
+
'with timeout( of)?', 'with transaction', 'by', 'continue',
|
| 790 |
+
'end', 'its?', 'me', 'my', 'return', 'of', 'as')
|
| 791 |
+
Declarations = ('global', 'local', 'prop(erty)?', 'set', 'get')
|
| 792 |
+
Reserved = ('but', 'put', 'returning', 'the')
|
| 793 |
+
StudioClasses = ('action cell', 'alert reply', 'application', 'box',
|
| 794 |
+
'browser( cell)?', 'bundle', 'button( cell)?', 'cell',
|
| 795 |
+
'clip view', 'color well', 'color-panel',
|
| 796 |
+
'combo box( item)?', 'control',
|
| 797 |
+
'data( (cell|column|item|row|source))?', 'default entry',
|
| 798 |
+
'dialog reply', 'document', 'drag info', 'drawer',
|
| 799 |
+
'event', 'font(-panel)?', 'formatter',
|
| 800 |
+
'image( (cell|view))?', 'matrix', 'menu( item)?', 'item',
|
| 801 |
+
'movie( view)?', 'open-panel', 'outline view', 'panel',
|
| 802 |
+
'pasteboard', 'plugin', 'popup button',
|
| 803 |
+
'progress indicator', 'responder', 'save-panel',
|
| 804 |
+
'scroll view', 'secure text field( cell)?', 'slider',
|
| 805 |
+
'sound', 'split view', 'stepper', 'tab view( item)?',
|
| 806 |
+
'table( (column|header cell|header view|view))',
|
| 807 |
+
'text( (field( cell)?|view))?', 'toolbar( item)?',
|
| 808 |
+
'user-defaults', 'view', 'window')
|
| 809 |
+
StudioEvents = ('accept outline drop', 'accept table drop', 'action',
|
| 810 |
+
'activated', 'alert ended', 'awake from nib', 'became key',
|
| 811 |
+
'became main', 'begin editing', 'bounds changed',
|
| 812 |
+
'cell value', 'cell value changed', 'change cell value',
|
| 813 |
+
'change item value', 'changed', 'child of item',
|
| 814 |
+
'choose menu item', 'clicked', 'clicked toolbar item',
|
| 815 |
+
'closed', 'column clicked', 'column moved',
|
| 816 |
+
'column resized', 'conclude drop', 'data representation',
|
| 817 |
+
'deminiaturized', 'dialog ended', 'document nib name',
|
| 818 |
+
'double clicked', 'drag( (entered|exited|updated))?',
|
| 819 |
+
'drop', 'end editing', 'exposed', 'idle', 'item expandable',
|
| 820 |
+
'item value', 'item value changed', 'items changed',
|
| 821 |
+
'keyboard down', 'keyboard up', 'launched',
|
| 822 |
+
'load data representation', 'miniaturized', 'mouse down',
|
| 823 |
+
'mouse dragged', 'mouse entered', 'mouse exited',
|
| 824 |
+
'mouse moved', 'mouse up', 'moved',
|
| 825 |
+
'number of browser rows', 'number of items',
|
| 826 |
+
'number of rows', 'open untitled', 'opened', 'panel ended',
|
| 827 |
+
'parameters updated', 'plugin loaded', 'prepare drop',
|
| 828 |
+
'prepare outline drag', 'prepare outline drop',
|
| 829 |
+
'prepare table drag', 'prepare table drop',
|
| 830 |
+
'read from file', 'resigned active', 'resigned key',
|
| 831 |
+
'resigned main', 'resized( sub views)?',
|
| 832 |
+
'right mouse down', 'right mouse dragged',
|
| 833 |
+
'right mouse up', 'rows changed', 'scroll wheel',
|
| 834 |
+
'selected tab view item', 'selection changed',
|
| 835 |
+
'selection changing', 'should begin editing',
|
| 836 |
+
'should close', 'should collapse item',
|
| 837 |
+
'should end editing', 'should expand item',
|
| 838 |
+
'should open( untitled)?',
|
| 839 |
+
'should quit( after last window closed)?',
|
| 840 |
+
'should select column', 'should select item',
|
| 841 |
+
'should select row', 'should select tab view item',
|
| 842 |
+
'should selection change', 'should zoom', 'shown',
|
| 843 |
+
'update menu item', 'update parameters',
|
| 844 |
+
'update toolbar item', 'was hidden', 'was miniaturized',
|
| 845 |
+
'will become active', 'will close', 'will dismiss',
|
| 846 |
+
'will display browser cell', 'will display cell',
|
| 847 |
+
'will display item cell', 'will display outline cell',
|
| 848 |
+
'will finish launching', 'will hide', 'will miniaturize',
|
| 849 |
+
'will move', 'will open', 'will pop up', 'will quit',
|
| 850 |
+
'will resign active', 'will resize( sub views)?',
|
| 851 |
+
'will select tab view item', 'will show', 'will zoom',
|
| 852 |
+
'write to file', 'zoomed')
|
| 853 |
+
StudioCommands = ('animate', 'append', 'call method', 'center',
|
| 854 |
+
'close drawer', 'close panel', 'display',
|
| 855 |
+
'display alert', 'display dialog', 'display panel', 'go',
|
| 856 |
+
'hide', 'highlight', 'increment', 'item for',
|
| 857 |
+
'load image', 'load movie', 'load nib', 'load panel',
|
| 858 |
+
'load sound', 'localized string', 'lock focus', 'log',
|
| 859 |
+
'open drawer', 'path for', 'pause', 'perform action',
|
| 860 |
+
'play', 'register', 'resume', 'scroll', 'select( all)?',
|
| 861 |
+
'show', 'size to fit', 'start', 'step back',
|
| 862 |
+
'step forward', 'stop', 'synchronize', 'unlock focus',
|
| 863 |
+
'update')
|
| 864 |
+
StudioProperties = ('accepts arrow key', 'action method', 'active',
|
| 865 |
+
'alignment', 'allowed identifiers',
|
| 866 |
+
'allows branch selection', 'allows column reordering',
|
| 867 |
+
'allows column resizing', 'allows column selection',
|
| 868 |
+
'allows customization',
|
| 869 |
+
'allows editing text attributes',
|
| 870 |
+
'allows empty selection', 'allows mixed state',
|
| 871 |
+
'allows multiple selection', 'allows reordering',
|
| 872 |
+
'allows undo', 'alpha( value)?', 'alternate image',
|
| 873 |
+
'alternate increment value', 'alternate title',
|
| 874 |
+
'animation delay', 'associated file name',
|
| 875 |
+
'associated object', 'auto completes', 'auto display',
|
| 876 |
+
'auto enables items', 'auto repeat',
|
| 877 |
+
'auto resizes( outline column)?',
|
| 878 |
+
'auto save expanded items', 'auto save name',
|
| 879 |
+
'auto save table columns', 'auto saves configuration',
|
| 880 |
+
'auto scroll', 'auto sizes all columns to fit',
|
| 881 |
+
'auto sizes cells', 'background color', 'bezel state',
|
| 882 |
+
'bezel style', 'bezeled', 'border rect', 'border type',
|
| 883 |
+
'bordered', 'bounds( rotation)?', 'box type',
|
| 884 |
+
'button returned', 'button type',
|
| 885 |
+
'can choose directories', 'can choose files',
|
| 886 |
+
'can draw', 'can hide',
|
| 887 |
+
'cell( (background color|size|type))?', 'characters',
|
| 888 |
+
'class', 'click count', 'clicked( data)? column',
|
| 889 |
+
'clicked data item', 'clicked( data)? row',
|
| 890 |
+
'closeable', 'collating', 'color( (mode|panel))',
|
| 891 |
+
'command key down', 'configuration',
|
| 892 |
+
'content(s| (size|view( margins)?))?', 'context',
|
| 893 |
+
'continuous', 'control key down', 'control size',
|
| 894 |
+
'control tint', 'control view',
|
| 895 |
+
'controller visible', 'coordinate system',
|
| 896 |
+
'copies( on scroll)?', 'corner view', 'current cell',
|
| 897 |
+
'current column', 'current( field)? editor',
|
| 898 |
+
'current( menu)? item', 'current row',
|
| 899 |
+
'current tab view item', 'data source',
|
| 900 |
+
'default identifiers', 'delta (x|y|z)',
|
| 901 |
+
'destination window', 'directory', 'display mode',
|
| 902 |
+
'displayed cell', 'document( (edited|rect|view))?',
|
| 903 |
+
'double value', 'dragged column', 'dragged distance',
|
| 904 |
+
'dragged items', 'draws( cell)? background',
|
| 905 |
+
'draws grid', 'dynamically scrolls', 'echos bullets',
|
| 906 |
+
'edge', 'editable', 'edited( data)? column',
|
| 907 |
+
'edited data item', 'edited( data)? row', 'enabled',
|
| 908 |
+
'enclosing scroll view', 'ending page',
|
| 909 |
+
'error handling', 'event number', 'event type',
|
| 910 |
+
'excluded from windows menu', 'executable path',
|
| 911 |
+
'expanded', 'fax number', 'field editor', 'file kind',
|
| 912 |
+
'file name', 'file type', 'first responder',
|
| 913 |
+
'first visible column', 'flipped', 'floating',
|
| 914 |
+
'font( panel)?', 'formatter', 'frameworks path',
|
| 915 |
+
'frontmost', 'gave up', 'grid color', 'has data items',
|
| 916 |
+
'has horizontal ruler', 'has horizontal scroller',
|
| 917 |
+
'has parent data item', 'has resize indicator',
|
| 918 |
+
'has shadow', 'has sub menu', 'has vertical ruler',
|
| 919 |
+
'has vertical scroller', 'header cell', 'header view',
|
| 920 |
+
'hidden', 'hides when deactivated', 'highlights by',
|
| 921 |
+
'horizontal line scroll', 'horizontal page scroll',
|
| 922 |
+
'horizontal ruler view', 'horizontally resizable',
|
| 923 |
+
'icon image', 'id', 'identifier',
|
| 924 |
+
'ignores multiple clicks',
|
| 925 |
+
'image( (alignment|dims when disabled|frame style|scaling))?',
|
| 926 |
+
'imports graphics', 'increment value',
|
| 927 |
+
'indentation per level', 'indeterminate', 'index',
|
| 928 |
+
'integer value', 'intercell spacing', 'item height',
|
| 929 |
+
'key( (code|equivalent( modifier)?|window))?',
|
| 930 |
+
'knob thickness', 'label', 'last( visible)? column',
|
| 931 |
+
'leading offset', 'leaf', 'level', 'line scroll',
|
| 932 |
+
'loaded', 'localized sort', 'location', 'loop mode',
|
| 933 |
+
'main( (bunde|menu|window))?', 'marker follows cell',
|
| 934 |
+
'matrix mode', 'maximum( content)? size',
|
| 935 |
+
'maximum visible columns',
|
| 936 |
+
'menu( form representation)?', 'miniaturizable',
|
| 937 |
+
'miniaturized', 'minimized image', 'minimized title',
|
| 938 |
+
'minimum column width', 'minimum( content)? size',
|
| 939 |
+
'modal', 'modified', 'mouse down state',
|
| 940 |
+
'movie( (controller|file|rect))?', 'muted', 'name',
|
| 941 |
+
'needs display', 'next state', 'next text',
|
| 942 |
+
'number of tick marks', 'only tick mark values',
|
| 943 |
+
'opaque', 'open panel', 'option key down',
|
| 944 |
+
'outline table column', 'page scroll', 'pages across',
|
| 945 |
+
'pages down', 'palette label', 'pane splitter',
|
| 946 |
+
'parent data item', 'parent window', 'pasteboard',
|
| 947 |
+
'path( (names|separator))?', 'playing',
|
| 948 |
+
'plays every frame', 'plays selection only', 'position',
|
| 949 |
+
'preferred edge', 'preferred type', 'pressure',
|
| 950 |
+
'previous text', 'prompt', 'properties',
|
| 951 |
+
'prototype cell', 'pulls down', 'rate',
|
| 952 |
+
'released when closed', 'repeated',
|
| 953 |
+
'requested print time', 'required file type',
|
| 954 |
+
'resizable', 'resized column', 'resource path',
|
| 955 |
+
'returns records', 'reuses columns', 'rich text',
|
| 956 |
+
'roll over', 'row height', 'rulers visible',
|
| 957 |
+
'save panel', 'scripts path', 'scrollable',
|
| 958 |
+
'selectable( identifiers)?', 'selected cell',
|
| 959 |
+
'selected( data)? columns?', 'selected data items?',
|
| 960 |
+
'selected( data)? rows?', 'selected item identifier',
|
| 961 |
+
'selection by rect', 'send action on arrow key',
|
| 962 |
+
'sends action when done editing', 'separates columns',
|
| 963 |
+
'separator item', 'sequence number', 'services menu',
|
| 964 |
+
'shared frameworks path', 'shared support path',
|
| 965 |
+
'sheet', 'shift key down', 'shows alpha',
|
| 966 |
+
'shows state by', 'size( mode)?',
|
| 967 |
+
'smart insert delete enabled', 'sort case sensitivity',
|
| 968 |
+
'sort column', 'sort order', 'sort type',
|
| 969 |
+
'sorted( data rows)?', 'sound', 'source( mask)?',
|
| 970 |
+
'spell checking enabled', 'starting page', 'state',
|
| 971 |
+
'string value', 'sub menu', 'super menu', 'super view',
|
| 972 |
+
'tab key traverses cells', 'tab state', 'tab type',
|
| 973 |
+
'tab view', 'table view', 'tag', 'target( printer)?',
|
| 974 |
+
'text color', 'text container insert',
|
| 975 |
+
'text container origin', 'text returned',
|
| 976 |
+
'tick mark position', 'time stamp',
|
| 977 |
+
'title(d| (cell|font|height|position|rect))?',
|
| 978 |
+
'tool tip', 'toolbar', 'trailing offset', 'transparent',
|
| 979 |
+
'treat packages as directories', 'truncated labels',
|
| 980 |
+
'types', 'unmodified characters', 'update views',
|
| 981 |
+
'use sort indicator', 'user defaults',
|
| 982 |
+
'uses data source', 'uses ruler',
|
| 983 |
+
'uses threaded animation',
|
| 984 |
+
'uses title from previous column', 'value wraps',
|
| 985 |
+
'version',
|
| 986 |
+
'vertical( (line scroll|page scroll|ruler view))?',
|
| 987 |
+
'vertically resizable', 'view',
|
| 988 |
+
'visible( document rect)?', 'volume', 'width', 'window',
|
| 989 |
+
'windows menu', 'wraps', 'zoomable', 'zoomed')
|
| 990 |
+
|
| 991 |
+
tokens = {
|
| 992 |
+
'root': [
|
| 993 |
+
(r'\s+', Text),
|
| 994 |
+
(r'¬\n', String.Escape),
|
| 995 |
+
(r"'s\s+", Text), # This is a possessive, consider moving
|
| 996 |
+
(r'(--|#).*?$', Comment),
|
| 997 |
+
(r'\(\*', Comment.Multiline, 'comment'),
|
| 998 |
+
(r'[(){}!,.:]', Punctuation),
|
| 999 |
+
(r'(«)([^»]+)(»)',
|
| 1000 |
+
bygroups(Text, Name.Builtin, Text)),
|
| 1001 |
+
(r'\b((?:considering|ignoring)\s*)'
|
| 1002 |
+
r'(application responses|case|diacriticals|hyphens|'
|
| 1003 |
+
r'numeric strings|punctuation|white space)',
|
| 1004 |
+
bygroups(Keyword, Name.Builtin)),
|
| 1005 |
+
(r'(-|\*|\+|&|≠|>=?|<=?|=|≥|≤|/|÷|\^)', Operator),
|
| 1006 |
+
(r"\b({})\b".format('|'.join(Operators)), Operator.Word),
|
| 1007 |
+
(r'^(\s*(?:on|end)\s+)'
|
| 1008 |
+
r'({})'.format('|'.join(StudioEvents[::-1])),
|
| 1009 |
+
bygroups(Keyword, Name.Function)),
|
| 1010 |
+
(r'^(\s*)(in|on|script|to)(\s+)', bygroups(Text, Keyword, Text)),
|
| 1011 |
+
(r'\b(as )({})\b'.format('|'.join(Classes)),
|
| 1012 |
+
bygroups(Keyword, Name.Class)),
|
| 1013 |
+
(r'\b({})\b'.format('|'.join(Literals)), Name.Constant),
|
| 1014 |
+
(r'\b({})\b'.format('|'.join(Commands)), Name.Builtin),
|
| 1015 |
+
(r'\b({})\b'.format('|'.join(Control)), Keyword),
|
| 1016 |
+
(r'\b({})\b'.format('|'.join(Declarations)), Keyword),
|
| 1017 |
+
(r'\b({})\b'.format('|'.join(Reserved)), Name.Builtin),
|
| 1018 |
+
(r'\b({})s?\b'.format('|'.join(BuiltIn)), Name.Builtin),
|
| 1019 |
+
(r'\b({})\b'.format('|'.join(HandlerParams)), Name.Builtin),
|
| 1020 |
+
(r'\b({})\b'.format('|'.join(StudioProperties)), Name.Attribute),
|
| 1021 |
+
(r'\b({})s?\b'.format('|'.join(StudioClasses)), Name.Builtin),
|
| 1022 |
+
(r'\b({})\b'.format('|'.join(StudioCommands)), Name.Builtin),
|
| 1023 |
+
(r'\b({})\b'.format('|'.join(References)), Name.Builtin),
|
| 1024 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double),
|
| 1025 |
+
(rf'\b({Identifiers})\b', Name.Variable),
|
| 1026 |
+
(r'[-+]?(\d+\.\d*|\d*\.\d+)(E[-+][0-9]+)?', Number.Float),
|
| 1027 |
+
(r'[-+]?\d+', Number.Integer),
|
| 1028 |
+
],
|
| 1029 |
+
'comment': [
|
| 1030 |
+
(r'\(\*', Comment.Multiline, '#push'),
|
| 1031 |
+
(r'\*\)', Comment.Multiline, '#pop'),
|
| 1032 |
+
('[^*(]+', Comment.Multiline),
|
| 1033 |
+
('[*(]', Comment.Multiline),
|
| 1034 |
+
],
|
| 1035 |
+
}
|
| 1036 |
+
|
| 1037 |
+
|
| 1038 |
+
class RexxLexer(RegexLexer):
|
| 1039 |
+
"""
|
| 1040 |
+
Rexx is a scripting language available for
|
| 1041 |
+
a wide range of different platforms with its roots found on mainframe
|
| 1042 |
+
systems. It is popular for I/O- and data based tasks and can act as glue
|
| 1043 |
+
language to bind different applications together.
|
| 1044 |
+
"""
|
| 1045 |
+
name = 'Rexx'
|
| 1046 |
+
url = 'http://www.rexxinfo.org/'
|
| 1047 |
+
aliases = ['rexx', 'arexx']
|
| 1048 |
+
filenames = ['*.rexx', '*.rex', '*.rx', '*.arexx']
|
| 1049 |
+
mimetypes = ['text/x-rexx']
|
| 1050 |
+
version_added = '2.0'
|
| 1051 |
+
flags = re.IGNORECASE
|
| 1052 |
+
|
| 1053 |
+
tokens = {
|
| 1054 |
+
'root': [
|
| 1055 |
+
(r'\s+', Whitespace),
|
| 1056 |
+
(r'/\*', Comment.Multiline, 'comment'),
|
| 1057 |
+
(r'"', String, 'string_double'),
|
| 1058 |
+
(r"'", String, 'string_single'),
|
| 1059 |
+
(r'[0-9]+(\.[0-9]+)?(e[+-]?[0-9])?', Number),
|
| 1060 |
+
(r'([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b',
|
| 1061 |
+
bygroups(Name.Function, Whitespace, Operator, Whitespace,
|
| 1062 |
+
Keyword.Declaration)),
|
| 1063 |
+
(r'([a-z_]\w*)(\s*)(:)',
|
| 1064 |
+
bygroups(Name.Label, Whitespace, Operator)),
|
| 1065 |
+
include('function'),
|
| 1066 |
+
include('keyword'),
|
| 1067 |
+
include('operator'),
|
| 1068 |
+
(r'[a-z_]\w*', Text),
|
| 1069 |
+
],
|
| 1070 |
+
'function': [
|
| 1071 |
+
(words((
|
| 1072 |
+
'abbrev', 'abs', 'address', 'arg', 'b2x', 'bitand', 'bitor', 'bitxor',
|
| 1073 |
+
'c2d', 'c2x', 'center', 'charin', 'charout', 'chars', 'compare',
|
| 1074 |
+
'condition', 'copies', 'd2c', 'd2x', 'datatype', 'date', 'delstr',
|
| 1075 |
+
'delword', 'digits', 'errortext', 'form', 'format', 'fuzz', 'insert',
|
| 1076 |
+
'lastpos', 'left', 'length', 'linein', 'lineout', 'lines', 'max',
|
| 1077 |
+
'min', 'overlay', 'pos', 'queued', 'random', 'reverse', 'right', 'sign',
|
| 1078 |
+
'sourceline', 'space', 'stream', 'strip', 'substr', 'subword', 'symbol',
|
| 1079 |
+
'time', 'trace', 'translate', 'trunc', 'value', 'verify', 'word',
|
| 1080 |
+
'wordindex', 'wordlength', 'wordpos', 'words', 'x2b', 'x2c', 'x2d',
|
| 1081 |
+
'xrange'), suffix=r'(\s*)(\()'),
|
| 1082 |
+
bygroups(Name.Builtin, Whitespace, Operator)),
|
| 1083 |
+
],
|
| 1084 |
+
'keyword': [
|
| 1085 |
+
(r'(address|arg|by|call|do|drop|else|end|exit|for|forever|if|'
|
| 1086 |
+
r'interpret|iterate|leave|nop|numeric|off|on|options|parse|'
|
| 1087 |
+
r'pull|push|queue|return|say|select|signal|to|then|trace|until|'
|
| 1088 |
+
r'while)\b', Keyword.Reserved),
|
| 1089 |
+
],
|
| 1090 |
+
'operator': [
|
| 1091 |
+
(r'(-|//|/|\(|\)|\*\*|\*|\\<<|\\<|\\==|\\=|\\>>|\\>|\\|\|\||\||'
|
| 1092 |
+
r'&&|&|%|\+|<<=|<<|<=|<>|<|==|=|><|>=|>>=|>>|>|¬<<|¬<|¬==|¬=|'
|
| 1093 |
+
r'¬>>|¬>|¬|\.|,)', Operator),
|
| 1094 |
+
],
|
| 1095 |
+
'string_double': [
|
| 1096 |
+
(r'[^"\n]+', String),
|
| 1097 |
+
(r'""', String),
|
| 1098 |
+
(r'"', String, '#pop'),
|
| 1099 |
+
(r'\n', Text, '#pop'), # Stray linefeed also terminates strings.
|
| 1100 |
+
],
|
| 1101 |
+
'string_single': [
|
| 1102 |
+
(r'[^\'\n]+', String),
|
| 1103 |
+
(r'\'\'', String),
|
| 1104 |
+
(r'\'', String, '#pop'),
|
| 1105 |
+
(r'\n', Text, '#pop'), # Stray linefeed also terminates strings.
|
| 1106 |
+
],
|
| 1107 |
+
'comment': [
|
| 1108 |
+
(r'[^*]+', Comment.Multiline),
|
| 1109 |
+
(r'\*/', Comment.Multiline, '#pop'),
|
| 1110 |
+
(r'\*', Comment.Multiline),
|
| 1111 |
+
]
|
| 1112 |
+
}
|
| 1113 |
+
|
| 1114 |
+
def _c(s):
|
| 1115 |
+
return re.compile(s, re.MULTILINE)
|
| 1116 |
+
_ADDRESS_COMMAND_PATTERN = _c(r'^\s*address\s+command\b')
|
| 1117 |
+
_ADDRESS_PATTERN = _c(r'^\s*address\s+')
|
| 1118 |
+
_DO_WHILE_PATTERN = _c(r'^\s*do\s+while\b')
|
| 1119 |
+
_IF_THEN_DO_PATTERN = _c(r'^\s*if\b.+\bthen\s+do\s*$')
|
| 1120 |
+
_PROCEDURE_PATTERN = _c(r'^\s*([a-z_]\w*)(\s*)(:)(\s*)(procedure)\b')
|
| 1121 |
+
_ELSE_DO_PATTERN = _c(r'\belse\s+do\s*$')
|
| 1122 |
+
_PARSE_ARG_PATTERN = _c(r'^\s*parse\s+(upper\s+)?(arg|value)\b')
|
| 1123 |
+
PATTERNS_AND_WEIGHTS = (
|
| 1124 |
+
(_ADDRESS_COMMAND_PATTERN, 0.2),
|
| 1125 |
+
(_ADDRESS_PATTERN, 0.05),
|
| 1126 |
+
(_DO_WHILE_PATTERN, 0.1),
|
| 1127 |
+
(_ELSE_DO_PATTERN, 0.1),
|
| 1128 |
+
(_IF_THEN_DO_PATTERN, 0.1),
|
| 1129 |
+
(_PROCEDURE_PATTERN, 0.5),
|
| 1130 |
+
(_PARSE_ARG_PATTERN, 0.2),
|
| 1131 |
+
)
|
| 1132 |
+
|
| 1133 |
+
def analyse_text(text):
|
| 1134 |
+
"""
|
| 1135 |
+
Check for initial comment and patterns that distinguish Rexx from other
|
| 1136 |
+
C-like languages.
|
| 1137 |
+
"""
|
| 1138 |
+
if re.search(r'/\*\**\s*rexx', text, re.IGNORECASE):
|
| 1139 |
+
# Header matches MVS Rexx requirements, this is certainly a Rexx
|
| 1140 |
+
# script.
|
| 1141 |
+
return 1.0
|
| 1142 |
+
elif text.startswith('/*'):
|
| 1143 |
+
# Header matches general Rexx requirements; the source code might
|
| 1144 |
+
# still be any language using C comments such as C++, C# or Java.
|
| 1145 |
+
lowerText = text.lower()
|
| 1146 |
+
result = sum(weight
|
| 1147 |
+
for (pattern, weight) in RexxLexer.PATTERNS_AND_WEIGHTS
|
| 1148 |
+
if pattern.search(lowerText)) + 0.01
|
| 1149 |
+
return min(result, 1.0)
|
| 1150 |
+
|
| 1151 |
+
|
| 1152 |
+
class MOOCodeLexer(RegexLexer):
|
| 1153 |
+
"""
|
| 1154 |
+
For MOOCode (the MOO scripting language).
|
| 1155 |
+
"""
|
| 1156 |
+
name = 'MOOCode'
|
| 1157 |
+
url = 'http://www.moo.mud.org/'
|
| 1158 |
+
filenames = ['*.moo']
|
| 1159 |
+
aliases = ['moocode', 'moo']
|
| 1160 |
+
mimetypes = ['text/x-moocode']
|
| 1161 |
+
version_added = '0.9'
|
| 1162 |
+
|
| 1163 |
+
tokens = {
|
| 1164 |
+
'root': [
|
| 1165 |
+
# Numbers
|
| 1166 |
+
(r'(0|[1-9][0-9_]*)', Number.Integer),
|
| 1167 |
+
# Strings
|
| 1168 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String),
|
| 1169 |
+
# exceptions
|
| 1170 |
+
(r'(E_PERM|E_DIV)', Name.Exception),
|
| 1171 |
+
# db-refs
|
| 1172 |
+
(r'((#[-0-9]+)|(\$\w+))', Name.Entity),
|
| 1173 |
+
# Keywords
|
| 1174 |
+
(r'\b(if|else|elseif|endif|for|endfor|fork|endfork|while'
|
| 1175 |
+
r'|endwhile|break|continue|return|try'
|
| 1176 |
+
r'|except|endtry|finally|in)\b', Keyword),
|
| 1177 |
+
# builtins
|
| 1178 |
+
(r'(random|length)', Name.Builtin),
|
| 1179 |
+
# special variables
|
| 1180 |
+
(r'(player|caller|this|args)', Name.Variable.Instance),
|
| 1181 |
+
# skip whitespace
|
| 1182 |
+
(r'\s+', Text),
|
| 1183 |
+
(r'\n', Text),
|
| 1184 |
+
# other operators
|
| 1185 |
+
(r'([!;=,{}&|:.\[\]@()<>?]+)', Operator),
|
| 1186 |
+
# function call
|
| 1187 |
+
(r'(\w+)(\()', bygroups(Name.Function, Operator)),
|
| 1188 |
+
# variables
|
| 1189 |
+
(r'(\w+)', Text),
|
| 1190 |
+
]
|
| 1191 |
+
}
|
| 1192 |
+
|
| 1193 |
+
|
| 1194 |
+
class HybrisLexer(RegexLexer):
|
| 1195 |
+
"""
|
| 1196 |
+
For Hybris source code.
|
| 1197 |
+
"""
|
| 1198 |
+
|
| 1199 |
+
name = 'Hybris'
|
| 1200 |
+
aliases = ['hybris']
|
| 1201 |
+
filenames = ['*.hyb']
|
| 1202 |
+
mimetypes = ['text/x-hybris', 'application/x-hybris']
|
| 1203 |
+
url = 'https://github.com/evilsocket/hybris'
|
| 1204 |
+
version_added = '1.4'
|
| 1205 |
+
|
| 1206 |
+
flags = re.MULTILINE | re.DOTALL
|
| 1207 |
+
|
| 1208 |
+
tokens = {
|
| 1209 |
+
'root': [
|
| 1210 |
+
# method names
|
| 1211 |
+
(r'^(\s*(?:function|method|operator\s+)+?)'
|
| 1212 |
+
r'([a-zA-Z_]\w*)'
|
| 1213 |
+
r'(\s*)(\()', bygroups(Keyword, Name.Function, Text, Operator)),
|
| 1214 |
+
(r'[^\S\n]+', Text),
|
| 1215 |
+
(r'//.*?\n', Comment.Single),
|
| 1216 |
+
(r'/\*.*?\*/', Comment.Multiline),
|
| 1217 |
+
(r'@[a-zA-Z_][\w.]*', Name.Decorator),
|
| 1218 |
+
(r'(break|case|catch|next|default|do|else|finally|for|foreach|of|'
|
| 1219 |
+
r'unless|if|new|return|switch|me|throw|try|while)\b', Keyword),
|
| 1220 |
+
(r'(extends|private|protected|public|static|throws|function|method|'
|
| 1221 |
+
r'operator)\b', Keyword.Declaration),
|
| 1222 |
+
(r'(true|false|null|__FILE__|__LINE__|__VERSION__|__LIB_PATH__|'
|
| 1223 |
+
r'__INC_PATH__)\b', Keyword.Constant),
|
| 1224 |
+
(r'(class|struct)(\s+)',
|
| 1225 |
+
bygroups(Keyword.Declaration, Text), 'class'),
|
| 1226 |
+
(r'(import|include)(\s+)',
|
| 1227 |
+
bygroups(Keyword.Namespace, Text), 'import'),
|
| 1228 |
+
(words((
|
| 1229 |
+
'gc_collect', 'gc_mm_items', 'gc_mm_usage', 'gc_collect_threshold',
|
| 1230 |
+
'urlencode', 'urldecode', 'base64encode', 'base64decode', 'sha1', 'crc32',
|
| 1231 |
+
'sha2', 'md5', 'md5_file', 'acos', 'asin', 'atan', 'atan2', 'ceil', 'cos',
|
| 1232 |
+
'cosh', 'exp', 'fabs', 'floor', 'fmod', 'log', 'log10', 'pow', 'sin',
|
| 1233 |
+
'sinh', 'sqrt', 'tan', 'tanh', 'isint', 'isfloat', 'ischar', 'isstring',
|
| 1234 |
+
'isarray', 'ismap', 'isalias', 'typeof', 'sizeof', 'toint', 'tostring',
|
| 1235 |
+
'fromxml', 'toxml', 'binary', 'pack', 'load', 'eval', 'var_names',
|
| 1236 |
+
'var_values', 'user_functions', 'dyn_functions', 'methods', 'call',
|
| 1237 |
+
'call_method', 'mknod', 'mkfifo', 'mount', 'umount2', 'umount', 'ticks',
|
| 1238 |
+
'usleep', 'sleep', 'time', 'strtime', 'strdate', 'dllopen', 'dlllink',
|
| 1239 |
+
'dllcall', 'dllcall_argv', 'dllclose', 'env', 'exec', 'fork', 'getpid',
|
| 1240 |
+
'wait', 'popen', 'pclose', 'exit', 'kill', 'pthread_create',
|
| 1241 |
+
'pthread_create_argv', 'pthread_exit', 'pthread_join', 'pthread_kill',
|
| 1242 |
+
'smtp_send', 'http_get', 'http_post', 'http_download', 'socket', 'bind',
|
| 1243 |
+
'listen', 'accept', 'getsockname', 'getpeername', 'settimeout', 'connect',
|
| 1244 |
+
'server', 'recv', 'send', 'close', 'print', 'println', 'printf', 'input',
|
| 1245 |
+
'readline', 'serial_open', 'serial_fcntl', 'serial_get_attr',
|
| 1246 |
+
'serial_get_ispeed', 'serial_get_ospeed', 'serial_set_attr',
|
| 1247 |
+
'serial_set_ispeed', 'serial_set_ospeed', 'serial_write', 'serial_read',
|
| 1248 |
+
'serial_close', 'xml_load', 'xml_parse', 'fopen', 'fseek', 'ftell',
|
| 1249 |
+
'fsize', 'fread', 'fwrite', 'fgets', 'fclose', 'file', 'readdir',
|
| 1250 |
+
'pcre_replace', 'size', 'pop', 'unmap', 'has', 'keys', 'values',
|
| 1251 |
+
'length', 'find', 'substr', 'replace', 'split', 'trim', 'remove',
|
| 1252 |
+
'contains', 'join'), suffix=r'\b'),
|
| 1253 |
+
Name.Builtin),
|
| 1254 |
+
(words((
|
| 1255 |
+
'MethodReference', 'Runner', 'Dll', 'Thread', 'Pipe', 'Process',
|
| 1256 |
+
'Runnable', 'CGI', 'ClientSocket', 'Socket', 'ServerSocket',
|
| 1257 |
+
'File', 'Console', 'Directory', 'Exception'), suffix=r'\b'),
|
| 1258 |
+
Keyword.Type),
|
| 1259 |
+
(r'"(\\\\|\\[^\\]|[^"\\])*"', String),
|
| 1260 |
+
(r"'\\.'|'[^\\]'|'\\u[0-9a-f]{4}'", String.Char),
|
| 1261 |
+
(r'(\.)([a-zA-Z_]\w*)',
|
| 1262 |
+
bygroups(Operator, Name.Attribute)),
|
| 1263 |
+
(r'[a-zA-Z_]\w*:', Name.Label),
|
| 1264 |
+
(r'[a-zA-Z_$]\w*', Name),
|
| 1265 |
+
(r'[~^*!%&\[\](){}<>|+=:;,./?\-@]+', Operator),
|
| 1266 |
+
(r'[0-9][0-9]*\.[0-9]+([eE][0-9]+)?[fd]?', Number.Float),
|
| 1267 |
+
(r'0x[0-9a-f]+', Number.Hex),
|
| 1268 |
+
(r'[0-9]+L?', Number.Integer),
|
| 1269 |
+
(r'\n', Text),
|
| 1270 |
+
],
|
| 1271 |
+
'class': [
|
| 1272 |
+
(r'[a-zA-Z_]\w*', Name.Class, '#pop')
|
| 1273 |
+
],
|
| 1274 |
+
'import': [
|
| 1275 |
+
(r'[\w.]+\*?', Name.Namespace, '#pop')
|
| 1276 |
+
],
|
| 1277 |
+
}
|
| 1278 |
+
|
| 1279 |
+
def analyse_text(text):
|
| 1280 |
+
"""public method and private method don't seem to be quite common
|
| 1281 |
+
elsewhere."""
|
| 1282 |
+
result = 0
|
| 1283 |
+
if re.search(r'\b(?:public|private)\s+method\b', text):
|
| 1284 |
+
result += 0.01
|
| 1285 |
+
return result
|
| 1286 |
+
|
| 1287 |
+
|
| 1288 |
+
|
| 1289 |
+
class EasytrieveLexer(RegexLexer):
|
| 1290 |
+
"""
|
| 1291 |
+
Easytrieve Plus is a programming language for extracting, filtering and
|
| 1292 |
+
converting sequential data. Furthermore it can layout data for reports.
|
| 1293 |
+
It is mainly used on mainframe platforms and can access several of the
|
| 1294 |
+
mainframe's native file formats. It is somewhat comparable to awk.
|
| 1295 |
+
"""
|
| 1296 |
+
name = 'Easytrieve'
|
| 1297 |
+
aliases = ['easytrieve']
|
| 1298 |
+
filenames = ['*.ezt', '*.mac']
|
| 1299 |
+
mimetypes = ['text/x-easytrieve']
|
| 1300 |
+
url = 'https://www.broadcom.com/products/mainframe/application-development/easytrieve-report-generator'
|
| 1301 |
+
version_added = '2.1'
|
| 1302 |
+
flags = 0
|
| 1303 |
+
|
| 1304 |
+
# Note: We cannot use r'\b' at the start and end of keywords because
|
| 1305 |
+
# Easytrieve Plus delimiter characters are:
|
| 1306 |
+
#
|
| 1307 |
+
# * space ( )
|
| 1308 |
+
# * apostrophe (')
|
| 1309 |
+
# * period (.)
|
| 1310 |
+
# * comma (,)
|
| 1311 |
+
# * parenthesis ( and )
|
| 1312 |
+
# * colon (:)
|
| 1313 |
+
#
|
| 1314 |
+
# Additionally words end once a '*' appears, indicatins a comment.
|
| 1315 |
+
_DELIMITERS = r' \'.,():\n'
|
| 1316 |
+
_DELIMITERS_OR_COMENT = _DELIMITERS + '*'
|
| 1317 |
+
_DELIMITER_PATTERN = '[' + _DELIMITERS + ']'
|
| 1318 |
+
_DELIMITER_PATTERN_CAPTURE = '(' + _DELIMITER_PATTERN + ')'
|
| 1319 |
+
_NON_DELIMITER_OR_COMMENT_PATTERN = '[^' + _DELIMITERS_OR_COMENT + ']'
|
| 1320 |
+
_OPERATORS_PATTERN = '[.+\\-/=\\[\\](){}<>;,&%¬]'
|
| 1321 |
+
_KEYWORDS = [
|
| 1322 |
+
'AFTER-BREAK', 'AFTER-LINE', 'AFTER-SCREEN', 'AIM', 'AND', 'ATTR',
|
| 1323 |
+
'BEFORE', 'BEFORE-BREAK', 'BEFORE-LINE', 'BEFORE-SCREEN', 'BUSHU',
|
| 1324 |
+
'BY', 'CALL', 'CASE', 'CHECKPOINT', 'CHKP', 'CHKP-STATUS', 'CLEAR',
|
| 1325 |
+
'CLOSE', 'COL', 'COLOR', 'COMMIT', 'CONTROL', 'COPY', 'CURSOR', 'D',
|
| 1326 |
+
'DECLARE', 'DEFAULT', 'DEFINE', 'DELETE', 'DENWA', 'DISPLAY', 'DLI',
|
| 1327 |
+
'DO', 'DUPLICATE', 'E', 'ELSE', 'ELSE-IF', 'END', 'END-CASE',
|
| 1328 |
+
'END-DO', 'END-IF', 'END-PROC', 'ENDPAGE', 'ENDTABLE', 'ENTER', 'EOF',
|
| 1329 |
+
'EQ', 'ERROR', 'EXIT', 'EXTERNAL', 'EZLIB', 'F1', 'F10', 'F11', 'F12',
|
| 1330 |
+
'F13', 'F14', 'F15', 'F16', 'F17', 'F18', 'F19', 'F2', 'F20', 'F21',
|
| 1331 |
+
'F22', 'F23', 'F24', 'F25', 'F26', 'F27', 'F28', 'F29', 'F3', 'F30',
|
| 1332 |
+
'F31', 'F32', 'F33', 'F34', 'F35', 'F36', 'F4', 'F5', 'F6', 'F7',
|
| 1333 |
+
'F8', 'F9', 'FETCH', 'FILE-STATUS', 'FILL', 'FINAL', 'FIRST',
|
| 1334 |
+
'FIRST-DUP', 'FOR', 'GE', 'GET', 'GO', 'GOTO', 'GQ', 'GR', 'GT',
|
| 1335 |
+
'HEADING', 'HEX', 'HIGH-VALUES', 'IDD', 'IDMS', 'IF', 'IN', 'INSERT',
|
| 1336 |
+
'JUSTIFY', 'KANJI-DATE', 'KANJI-DATE-LONG', 'KANJI-TIME', 'KEY',
|
| 1337 |
+
'KEY-PRESSED', 'KOKUGO', 'KUN', 'LAST-DUP', 'LE', 'LEVEL', 'LIKE',
|
| 1338 |
+
'LINE', 'LINE-COUNT', 'LINE-NUMBER', 'LINK', 'LIST', 'LOW-VALUES',
|
| 1339 |
+
'LQ', 'LS', 'LT', 'MACRO', 'MASK', 'MATCHED', 'MEND', 'MESSAGE',
|
| 1340 |
+
'MOVE', 'MSTART', 'NE', 'NEWPAGE', 'NOMASK', 'NOPRINT', 'NOT',
|
| 1341 |
+
'NOTE', 'NOVERIFY', 'NQ', 'NULL', 'OF', 'OR', 'OTHERWISE', 'PA1',
|
| 1342 |
+
'PA2', 'PA3', 'PAGE-COUNT', 'PAGE-NUMBER', 'PARM-REGISTER',
|
| 1343 |
+
'PATH-ID', 'PATTERN', 'PERFORM', 'POINT', 'POS', 'PRIMARY', 'PRINT',
|
| 1344 |
+
'PROCEDURE', 'PROGRAM', 'PUT', 'READ', 'RECORD', 'RECORD-COUNT',
|
| 1345 |
+
'RECORD-LENGTH', 'REFRESH', 'RELEASE', 'RENUM', 'REPEAT', 'REPORT',
|
| 1346 |
+
'REPORT-INPUT', 'RESHOW', 'RESTART', 'RETRIEVE', 'RETURN-CODE',
|
| 1347 |
+
'ROLLBACK', 'ROW', 'S', 'SCREEN', 'SEARCH', 'SECONDARY', 'SELECT',
|
| 1348 |
+
'SEQUENCE', 'SIZE', 'SKIP', 'SOKAKU', 'SORT', 'SQL', 'STOP', 'SUM',
|
| 1349 |
+
'SYSDATE', 'SYSDATE-LONG', 'SYSIN', 'SYSIPT', 'SYSLST', 'SYSPRINT',
|
| 1350 |
+
'SYSSNAP', 'SYSTIME', 'TALLY', 'TERM-COLUMNS', 'TERM-NAME',
|
| 1351 |
+
'TERM-ROWS', 'TERMINATION', 'TITLE', 'TO', 'TRANSFER', 'TRC',
|
| 1352 |
+
'UNIQUE', 'UNTIL', 'UPDATE', 'UPPERCASE', 'USER', 'USERID', 'VALUE',
|
| 1353 |
+
'VERIFY', 'W', 'WHEN', 'WHILE', 'WORK', 'WRITE', 'X', 'XDM', 'XRST'
|
| 1354 |
+
]
|
| 1355 |
+
|
| 1356 |
+
tokens = {
|
| 1357 |
+
'root': [
|
| 1358 |
+
(r'\*.*\n', Comment.Single),
|
| 1359 |
+
(r'\n+', Whitespace),
|
| 1360 |
+
# Macro argument
|
| 1361 |
+
(r'&' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+\.', Name.Variable,
|
| 1362 |
+
'after_macro_argument'),
|
| 1363 |
+
# Macro call
|
| 1364 |
+
(r'%' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name.Variable),
|
| 1365 |
+
(r'(FILE|MACRO|REPORT)(\s+)',
|
| 1366 |
+
bygroups(Keyword.Declaration, Whitespace), 'after_declaration'),
|
| 1367 |
+
(r'(JOB|PARM)' + r'(' + _DELIMITER_PATTERN + r')',
|
| 1368 |
+
bygroups(Keyword.Declaration, Operator)),
|
| 1369 |
+
(words(_KEYWORDS, suffix=_DELIMITER_PATTERN_CAPTURE),
|
| 1370 |
+
bygroups(Keyword.Reserved, Operator)),
|
| 1371 |
+
(_OPERATORS_PATTERN, Operator),
|
| 1372 |
+
# Procedure declaration
|
| 1373 |
+
(r'(' + _NON_DELIMITER_OR_COMMENT_PATTERN + r'+)(\s*)(\.?)(\s*)(PROC)(\s*\n)',
|
| 1374 |
+
bygroups(Name.Function, Whitespace, Operator, Whitespace,
|
| 1375 |
+
Keyword.Declaration, Whitespace)),
|
| 1376 |
+
(r'[0-9]+\.[0-9]*', Number.Float),
|
| 1377 |
+
(r'[0-9]+', Number.Integer),
|
| 1378 |
+
(r"'(''|[^'])*'", String),
|
| 1379 |
+
(r'\s+', Whitespace),
|
| 1380 |
+
# Everything else just belongs to a name
|
| 1381 |
+
(_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name),
|
| 1382 |
+
],
|
| 1383 |
+
'after_declaration': [
|
| 1384 |
+
(_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name.Function),
|
| 1385 |
+
default('#pop'),
|
| 1386 |
+
],
|
| 1387 |
+
'after_macro_argument': [
|
| 1388 |
+
(r'\*.*\n', Comment.Single, '#pop'),
|
| 1389 |
+
(r'\s+', Whitespace, '#pop'),
|
| 1390 |
+
(_OPERATORS_PATTERN, Operator, '#pop'),
|
| 1391 |
+
(r"'(''|[^'])*'", String, '#pop'),
|
| 1392 |
+
# Everything else just belongs to a name
|
| 1393 |
+
(_NON_DELIMITER_OR_COMMENT_PATTERN + r'+', Name),
|
| 1394 |
+
],
|
| 1395 |
+
}
|
| 1396 |
+
_COMMENT_LINE_REGEX = re.compile(r'^\s*\*')
|
| 1397 |
+
_MACRO_HEADER_REGEX = re.compile(r'^\s*MACRO')
|
| 1398 |
+
|
| 1399 |
+
def analyse_text(text):
|
| 1400 |
+
"""
|
| 1401 |
+
Perform a structural analysis for basic Easytrieve constructs.
|
| 1402 |
+
"""
|
| 1403 |
+
result = 0.0
|
| 1404 |
+
lines = text.split('\n')
|
| 1405 |
+
hasEndProc = False
|
| 1406 |
+
hasHeaderComment = False
|
| 1407 |
+
hasFile = False
|
| 1408 |
+
hasJob = False
|
| 1409 |
+
hasProc = False
|
| 1410 |
+
hasParm = False
|
| 1411 |
+
hasReport = False
|
| 1412 |
+
|
| 1413 |
+
def isCommentLine(line):
|
| 1414 |
+
return EasytrieveLexer._COMMENT_LINE_REGEX.match(lines[0]) is not None
|
| 1415 |
+
|
| 1416 |
+
def isEmptyLine(line):
|
| 1417 |
+
return not bool(line.strip())
|
| 1418 |
+
|
| 1419 |
+
# Remove possible empty lines and header comments.
|
| 1420 |
+
while lines and (isEmptyLine(lines[0]) or isCommentLine(lines[0])):
|
| 1421 |
+
if not isEmptyLine(lines[0]):
|
| 1422 |
+
hasHeaderComment = True
|
| 1423 |
+
del lines[0]
|
| 1424 |
+
|
| 1425 |
+
if EasytrieveLexer._MACRO_HEADER_REGEX.match(lines[0]):
|
| 1426 |
+
# Looks like an Easytrieve macro.
|
| 1427 |
+
result = 0.4
|
| 1428 |
+
if hasHeaderComment:
|
| 1429 |
+
result += 0.4
|
| 1430 |
+
else:
|
| 1431 |
+
# Scan the source for lines starting with indicators.
|
| 1432 |
+
for line in lines:
|
| 1433 |
+
words = line.split()
|
| 1434 |
+
if (len(words) >= 2):
|
| 1435 |
+
firstWord = words[0]
|
| 1436 |
+
if not hasReport:
|
| 1437 |
+
if not hasJob:
|
| 1438 |
+
if not hasFile:
|
| 1439 |
+
if not hasParm:
|
| 1440 |
+
if firstWord == 'PARM':
|
| 1441 |
+
hasParm = True
|
| 1442 |
+
if firstWord == 'FILE':
|
| 1443 |
+
hasFile = True
|
| 1444 |
+
if firstWord == 'JOB':
|
| 1445 |
+
hasJob = True
|
| 1446 |
+
elif firstWord == 'PROC':
|
| 1447 |
+
hasProc = True
|
| 1448 |
+
elif firstWord == 'END-PROC':
|
| 1449 |
+
hasEndProc = True
|
| 1450 |
+
elif firstWord == 'REPORT':
|
| 1451 |
+
hasReport = True
|
| 1452 |
+
|
| 1453 |
+
# Weight the findings.
|
| 1454 |
+
if hasJob and (hasProc == hasEndProc):
|
| 1455 |
+
if hasHeaderComment:
|
| 1456 |
+
result += 0.1
|
| 1457 |
+
if hasParm:
|
| 1458 |
+
if hasProc:
|
| 1459 |
+
# Found PARM, JOB and PROC/END-PROC:
|
| 1460 |
+
# pretty sure this is Easytrieve.
|
| 1461 |
+
result += 0.8
|
| 1462 |
+
else:
|
| 1463 |
+
# Found PARAM and JOB: probably this is Easytrieve
|
| 1464 |
+
result += 0.5
|
| 1465 |
+
else:
|
| 1466 |
+
# Found JOB and possibly other keywords: might be Easytrieve
|
| 1467 |
+
result += 0.11
|
| 1468 |
+
if hasParm:
|
| 1469 |
+
# Note: PARAM is not a proper English word, so this is
|
| 1470 |
+
# regarded a much better indicator for Easytrieve than
|
| 1471 |
+
# the other words.
|
| 1472 |
+
result += 0.2
|
| 1473 |
+
if hasFile:
|
| 1474 |
+
result += 0.01
|
| 1475 |
+
if hasReport:
|
| 1476 |
+
result += 0.01
|
| 1477 |
+
assert 0.0 <= result <= 1.0
|
| 1478 |
+
return result
|
| 1479 |
+
|
| 1480 |
+
|
| 1481 |
+
class JclLexer(RegexLexer):
|
| 1482 |
+
"""
|
| 1483 |
+
Job Control Language (JCL)
|
| 1484 |
+
is a scripting language used on mainframe platforms to instruct the system
|
| 1485 |
+
on how to run a batch job or start a subsystem. It is somewhat
|
| 1486 |
+
comparable to MS DOS batch and Unix shell scripts.
|
| 1487 |
+
"""
|
| 1488 |
+
name = 'JCL'
|
| 1489 |
+
aliases = ['jcl']
|
| 1490 |
+
filenames = ['*.jcl']
|
| 1491 |
+
mimetypes = ['text/x-jcl']
|
| 1492 |
+
url = 'https://en.wikipedia.org/wiki/Job_Control_Language'
|
| 1493 |
+
version_added = '2.1'
|
| 1494 |
+
|
| 1495 |
+
flags = re.IGNORECASE
|
| 1496 |
+
|
| 1497 |
+
tokens = {
|
| 1498 |
+
'root': [
|
| 1499 |
+
(r'//\*.*\n', Comment.Single),
|
| 1500 |
+
(r'//', Keyword.Pseudo, 'statement'),
|
| 1501 |
+
(r'/\*', Keyword.Pseudo, 'jes2_statement'),
|
| 1502 |
+
# TODO: JES3 statement
|
| 1503 |
+
(r'.*\n', Other) # Input text or inline code in any language.
|
| 1504 |
+
],
|
| 1505 |
+
'statement': [
|
| 1506 |
+
(r'\s*\n', Whitespace, '#pop'),
|
| 1507 |
+
(r'([a-z]\w*)(\s+)(exec|job)(\s*)',
|
| 1508 |
+
bygroups(Name.Label, Whitespace, Keyword.Reserved, Whitespace),
|
| 1509 |
+
'option'),
|
| 1510 |
+
(r'[a-z]\w*', Name.Variable, 'statement_command'),
|
| 1511 |
+
(r'\s+', Whitespace, 'statement_command'),
|
| 1512 |
+
],
|
| 1513 |
+
'statement_command': [
|
| 1514 |
+
(r'\s+(command|cntl|dd|endctl|endif|else|include|jcllib|'
|
| 1515 |
+
r'output|pend|proc|set|then|xmit)\s+', Keyword.Reserved, 'option'),
|
| 1516 |
+
include('option')
|
| 1517 |
+
],
|
| 1518 |
+
'jes2_statement': [
|
| 1519 |
+
(r'\s*\n', Whitespace, '#pop'),
|
| 1520 |
+
(r'\$', Keyword, 'option'),
|
| 1521 |
+
(r'\b(jobparam|message|netacct|notify|output|priority|route|'
|
| 1522 |
+
r'setup|signoff|xeq|xmit)\b', Keyword, 'option'),
|
| 1523 |
+
],
|
| 1524 |
+
'option': [
|
| 1525 |
+
# (r'\n', Text, 'root'),
|
| 1526 |
+
(r'\*', Name.Builtin),
|
| 1527 |
+
(r'[\[\](){}<>;,]', Punctuation),
|
| 1528 |
+
(r'[-+*/=&%]', Operator),
|
| 1529 |
+
(r'[a-z_]\w*', Name),
|
| 1530 |
+
(r'\d+\.\d*', Number.Float),
|
| 1531 |
+
(r'\.\d+', Number.Float),
|
| 1532 |
+
(r'\d+', Number.Integer),
|
| 1533 |
+
(r"'", String, 'option_string'),
|
| 1534 |
+
(r'[ \t]+', Whitespace, 'option_comment'),
|
| 1535 |
+
(r'\.', Punctuation),
|
| 1536 |
+
],
|
| 1537 |
+
'option_string': [
|
| 1538 |
+
(r"(\n)(//)", bygroups(Text, Keyword.Pseudo)),
|
| 1539 |
+
(r"''", String),
|
| 1540 |
+
(r"[^']", String),
|
| 1541 |
+
(r"'", String, '#pop'),
|
| 1542 |
+
],
|
| 1543 |
+
'option_comment': [
|
| 1544 |
+
# (r'\n', Text, 'root'),
|
| 1545 |
+
(r'.+', Comment.Single),
|
| 1546 |
+
]
|
| 1547 |
+
}
|
| 1548 |
+
|
| 1549 |
+
_JOB_HEADER_PATTERN = re.compile(r'^//[a-z#$@][a-z0-9#$@]{0,7}\s+job(\s+.*)?$',
|
| 1550 |
+
re.IGNORECASE)
|
| 1551 |
+
|
| 1552 |
+
def analyse_text(text):
|
| 1553 |
+
"""
|
| 1554 |
+
Recognize JCL job by header.
|
| 1555 |
+
"""
|
| 1556 |
+
result = 0.0
|
| 1557 |
+
lines = text.split('\n')
|
| 1558 |
+
if len(lines) > 0:
|
| 1559 |
+
if JclLexer._JOB_HEADER_PATTERN.match(lines[0]):
|
| 1560 |
+
result = 1.0
|
| 1561 |
+
assert 0.0 <= result <= 1.0
|
| 1562 |
+
return result
|
| 1563 |
+
|
| 1564 |
+
|
| 1565 |
+
class MiniScriptLexer(RegexLexer):
|
| 1566 |
+
"""
|
| 1567 |
+
For MiniScript source code.
|
| 1568 |
+
"""
|
| 1569 |
+
|
| 1570 |
+
name = 'MiniScript'
|
| 1571 |
+
url = 'https://miniscript.org'
|
| 1572 |
+
aliases = ['miniscript', 'ms']
|
| 1573 |
+
filenames = ['*.ms']
|
| 1574 |
+
mimetypes = ['text/x-minicript', 'application/x-miniscript']
|
| 1575 |
+
version_added = '2.6'
|
| 1576 |
+
|
| 1577 |
+
tokens = {
|
| 1578 |
+
'root': [
|
| 1579 |
+
(r'#!(.*?)$', Comment.Preproc),
|
| 1580 |
+
default('base'),
|
| 1581 |
+
],
|
| 1582 |
+
'base': [
|
| 1583 |
+
('//.*$', Comment.Single),
|
| 1584 |
+
(r'(?i)(\d*\.\d+|\d+\.\d*)(e[+-]?\d+)?', Number),
|
| 1585 |
+
(r'(?i)\d+e[+-]?\d+', Number),
|
| 1586 |
+
(r'\d+', Number),
|
| 1587 |
+
(r'\n', Text),
|
| 1588 |
+
(r'[^\S\n]+', Text),
|
| 1589 |
+
(r'"', String, 'string_double'),
|
| 1590 |
+
(r'(==|!=|<=|>=|[=+\-*/%^<>.:])', Operator),
|
| 1591 |
+
(r'[;,\[\]{}()]', Punctuation),
|
| 1592 |
+
(words((
|
| 1593 |
+
'break', 'continue', 'else', 'end', 'for', 'function', 'if',
|
| 1594 |
+
'in', 'isa', 'then', 'repeat', 'return', 'while'), suffix=r'\b'),
|
| 1595 |
+
Keyword),
|
| 1596 |
+
(words((
|
| 1597 |
+
'abs', 'acos', 'asin', 'atan', 'ceil', 'char', 'cos', 'floor',
|
| 1598 |
+
'log', 'round', 'rnd', 'pi', 'sign', 'sin', 'sqrt', 'str', 'tan',
|
| 1599 |
+
'hasIndex', 'indexOf', 'len', 'val', 'code', 'remove', 'lower',
|
| 1600 |
+
'upper', 'replace', 'split', 'indexes', 'values', 'join', 'sum',
|
| 1601 |
+
'sort', 'shuffle', 'push', 'pop', 'pull', 'range',
|
| 1602 |
+
'print', 'input', 'time', 'wait', 'locals', 'globals', 'outer',
|
| 1603 |
+
'yield'), suffix=r'\b'),
|
| 1604 |
+
Name.Builtin),
|
| 1605 |
+
(r'(true|false|null)\b', Keyword.Constant),
|
| 1606 |
+
(r'(and|or|not|new)\b', Operator.Word),
|
| 1607 |
+
(r'(self|super|__isa)\b', Name.Builtin.Pseudo),
|
| 1608 |
+
(r'[a-zA-Z_]\w*', Name.Variable)
|
| 1609 |
+
],
|
| 1610 |
+
'string_double': [
|
| 1611 |
+
(r'[^"\n]+', String),
|
| 1612 |
+
(r'""', String),
|
| 1613 |
+
(r'"', String, '#pop'),
|
| 1614 |
+
(r'\n', Text, '#pop'), # Stray linefeed also terminates strings.
|
| 1615 |
+
]
|
| 1616 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/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-2025 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 |
+
}
|
miniconda3/envs/active_proaction/lib/python3.10/site-packages/pygments/lexers/shell.py
ADDED
|
@@ -0,0 +1,902 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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, 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'(<|<)#', 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'#(>|>)', 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
|