From: DongHun Kwak Date: Mon, 18 Jul 2022 02:07:32 +0000 (+0900) Subject: Imported Upstream version 2.10.0 X-Git-Tag: upstream/2.10.0^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=abbcc3abf5bdb7b93a28e805a04dc75bc8921e2b;p=platform%2Fupstream%2Fpython3-pygments.git Imported Upstream version 2.10.0 --- diff --git a/AUTHORS b/AUTHORS index e8df185..9fc0393 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,6 +6,7 @@ Major developers are Tim Hatch and Armin Ronacher Other contributors, listed alphabetically, are: * Sam Aaron -- Ioke lexer +* João Abecasis -- JSLT lexer * Ali Afshar -- image formatter * Thomas Aglassinger -- Easytrieve, JCL, Rexx, Transact-SQL and VBScript lexers @@ -32,7 +33,7 @@ Other contributors, listed alphabetically, are: * Sébastien Bigaret -- QVT Operational lexer * Jarrett Billingsley -- MiniD lexer * Adam Blinkinsop -- Haskell, Redcode lexers -* Stéphane Blondon -- SGF and Sieve lexers +* Stéphane Blondon -- Procfile, SGF and Sieve lexers * Frits van Bommel -- assembler lexers * Pierre Bourdon -- bugfixes * Martijn Braam -- Kernel log lexer, BARE lexer @@ -48,6 +49,7 @@ Other contributors, listed alphabetically, are: * Pete Curry -- bugfixes * Bryan Davis -- EBNF lexer * Bruno Deferrari -- Shen lexer +* Luke Drummond -- Meson lexer * Giedrius Dubinskas -- HTML formatter improvements * Owen Durni -- Haxe lexer * Alexander Dutton, Oxford University Computing Services -- SPARQL lexer @@ -201,6 +203,7 @@ Other contributors, listed alphabetically, are: * Robert Simmons -- Standard ML lexer * Kirill Simonov -- YAML lexer * Corbin Simpson -- Monte lexer +* Ville Skyttä -- ASCII armored lexer * Alexander Smishlajev -- Visual FoxPro lexer * Steve Spigarelli -- XQuery lexer * Jerome St-Louis -- eC lexer @@ -225,6 +228,7 @@ Other contributors, listed alphabetically, are: * Matthias Vallentin -- Bro lexer * Benoît Vinot -- AMPL lexer * Linh Vu Hong -- RSL lexer +* Immanuel Washington -- Smithy lexer * Nathan Weizenbaum -- Haml and Sass lexers * Nathan Whetsell -- Csound lexers * Dietmar Winkler -- Modelica lexer diff --git a/CHANGES b/CHANGES index 1304754..4827f92 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,47 @@ pull request numbers to the requests at . +Version 2.10.0 +-------------- +(released August 15th, 2021) + +- Added lexers: + + * ASC armored files (#1807) + * GSQL (#1809, #1866) + * Javascript REPL (#1825) + * procfile (#1808) + * Smithy (#1878, #1879) + +- Updated lexers: + + * C-family: Fix preprocessor token issues (#1830) + * C# (#1573, #1869) + * CSound (#1837) + * Fennel (#1862) + * JavaScript (#1741, #1814) + * LLVM (#1824) + * Rust + + - Fix lexing of "break" and "continue" (#1843) + - Improve attribute handling (#1813) + + * Scala: Add support for the ``\`` operator (#1857) + * Swift (#1767, #1842) + * Tcl: Allow ``,`` and ``@`` in strings (#1834, #1742) + +- Fix assert statements in TNT lexer. +- Token types across all lexers have been unified (using the most common token + type name) (#1816, #1819) +- Improve Jasmin min score analysis (#1619) +- Add new alias for Go files (#1827) +- Fix multi-line console highlighting (#1833) +- Add a new trivial lexer which outputs everything as `Text.Generic.Output` (#1835, #1836) +- Use the ``.ini`` lexer for ``systemd`` files (#1849) +- Fix a ``FutureWarning`` related to ``words()`` (#1854) +- ``pwsh`` is now recognized as an alias for PowerShell (#1876) + + Version 2.9.0 ------------- (released May 3rd, 2021) @@ -30,7 +71,6 @@ Version 2.9.0 * Coq (#1721) * Cython (#853) * Groovy (#1765) - * JavaScript (#1741) * Julia (#1715) * Octave: Allow multiline and block-percent comments (#1726) * PowerShell: Improve lexing of ``:`` (#1682, #1758) @@ -38,7 +78,6 @@ Version 2.9.0 * Python: Improve float parsing (#1768, #1740) * Rust (#1061) * Scala: Rewrite to support Scala3 (#1694, #1035, #1121) - * Swift (#1767) * Terraform: Support 0.14 syntax (#1756) * Velocity: Detect multi-line patterns (#1776) diff --git a/Makefile b/Makefile index ab86244..f490b76 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,8 @@ check: @pyflakes pygments | grep -v 'but unused' || true @$(PYTHON) scripts/check_sources.py -i build -i dist -i pygments/lexers/_mapping.py \ -i docs/build -i pygments/formatters/_mapping.py -i pygments/unistring.py + @$(PYTHON) scripts/count_token_references.py --minfiles=1 --maxfiles=1 \ + --minlines=1 --maxlines=3 --subtoken clean: clean-pyc -rm -rf doc/_build build Pygments.egg-info diff --git a/PKG-INFO b/PKG-INFO index 325ea69..ba79439 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: Pygments -Version: 2.9.0 +Version: 2.10.0 Summary: Pygments is a syntax highlighting package written in Python. Home-page: https://pygments.org/ Author: Georg Brandl diff --git a/Pygments.egg-info/PKG-INFO b/Pygments.egg-info/PKG-INFO index 325ea69..ba79439 100644 --- a/Pygments.egg-info/PKG-INFO +++ b/Pygments.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.2 Name: Pygments -Version: 2.9.0 +Version: 2.10.0 Summary: Pygments is a syntax highlighting package written in Python. Home-page: https://pygments.org/ Author: Georg Brandl diff --git a/Pygments.egg-info/SOURCES.txt b/Pygments.egg-info/SOURCES.txt index c33fce1..5c185ae 100644 --- a/Pygments.egg-info/SOURCES.txt +++ b/Pygments.egg-info/SOURCES.txt @@ -129,6 +129,7 @@ pygments/lexers/apdlexer.py pygments/lexers/apl.py pygments/lexers/archetype.py pygments/lexers/arrow.py +pygments/lexers/asc.py pygments/lexers/asm.py pygments/lexers/automation.py pygments/lexers/bare.py @@ -180,6 +181,7 @@ pygments/lexers/grammar_notation.py pygments/lexers/graph.py pygments/lexers/graphics.py pygments/lexers/graphviz.py +pygments/lexers/gsql.py pygments/lexers/haskell.py pygments/lexers/haxe.py pygments/lexers/hdl.py @@ -193,6 +195,7 @@ pygments/lexers/int_fiction.py pygments/lexers/iolang.py pygments/lexers/j.py pygments/lexers/javascript.py +pygments/lexers/jslt.py pygments/lexers/julia.py pygments/lexers/jvm.py pygments/lexers/kuin.py @@ -201,6 +204,7 @@ pygments/lexers/make.py pygments/lexers/markup.py pygments/lexers/math.py pygments/lexers/matlab.py +pygments/lexers/meson.py pygments/lexers/mime.py pygments/lexers/ml.py pygments/lexers/modeling.py @@ -224,6 +228,7 @@ pygments/lexers/php.py pygments/lexers/pointless.py pygments/lexers/pony.py pygments/lexers/praat.py +pygments/lexers/procfile.py pygments/lexers/prolog.py pygments/lexers/promql.py pygments/lexers/python.py @@ -246,6 +251,7 @@ pygments/lexers/shell.py pygments/lexers/sieve.py pygments/lexers/slash.py pygments/lexers/smalltalk.py +pygments/lexers/smithy.py pygments/lexers/smv.py pygments/lexers/snobol.py pygments/lexers/solidity.py @@ -320,6 +326,7 @@ pygments/styles/xcode.py pygments/styles/zenburn.py scripts/check_crlf.py scripts/check_sources.py +scripts/count_token_references.py scripts/debug_lexer.py scripts/detect_missing_analyse_text.py scripts/get_vimkw.py @@ -348,6 +355,7 @@ tests/test_modeline.py tests/test_mysql.py tests/test_pangomarkup_formatter.py tests/test_perllexer.py +tests/test_procfile.py tests/test_raw_token.py tests/test_regexlexer.py tests/test_regexopt.py @@ -363,6 +371,7 @@ tests/test_unistring.py tests/test_usd.py tests/test_using_api.py tests/test_util.py +tests/test_words.py tests/dtds/HTML4-f.dtd tests/dtds/HTML4-s.dtd tests/dtds/HTML4.dcl @@ -422,6 +431,8 @@ tests/examplefiles/as3/as3_test2.as tests/examplefiles/as3/as3_test2.as.output tests/examplefiles/as3/as3_test3.as tests/examplefiles/as3/as3_test3.as.output +tests/examplefiles/asc/id_ecdsa +tests/examplefiles/asc/id_ecdsa.output tests/examplefiles/aspx-cs/aspx-cs_example tests/examplefiles/aspx-cs/aspx-cs_example.output tests/examplefiles/aspx-vb/example2.aspx @@ -714,6 +725,8 @@ tests/examplefiles/groovy/test.gradle tests/examplefiles/groovy/test.gradle.output tests/examplefiles/groovy/test.groovy tests/examplefiles/groovy/test.groovy.output +tests/examplefiles/gsql/test.gsql +tests/examplefiles/gsql/test.gsql.output tests/examplefiles/gst/example.gst tests/examplefiles/gst/example.gst.output tests/examplefiles/haskell/AcidStateAdvanced.hs @@ -792,8 +805,6 @@ tests/examplefiles/jags/example.jag tests/examplefiles/jags/example.jag.output tests/examplefiles/jasmin/example.j tests/examplefiles/jasmin/example.j.output -tests/examplefiles/java/Intro.java -tests/examplefiles/java/Intro.java.output tests/examplefiles/java/badcase.java tests/examplefiles/java/badcase.java.output tests/examplefiles/java/example.java @@ -806,10 +817,10 @@ tests/examplefiles/jcl/example.jcl tests/examplefiles/jcl/example.jcl.output tests/examplefiles/js/BOM.js tests/examplefiles/js/BOM.js.output -tests/examplefiles/js/es6.js -tests/examplefiles/js/es6.js.output tests/examplefiles/js/evil_regex.js tests/examplefiles/js/evil_regex.js.output +tests/examplefiles/js/general.js +tests/examplefiles/js/general.js.output tests/examplefiles/js/regex.js tests/examplefiles/js/regex.js.output tests/examplefiles/js/unicode.js @@ -876,6 +887,8 @@ tests/examplefiles/make/python25-bsd.mak tests/examplefiles/make/python25-bsd.mak.output tests/examplefiles/make/vpath.mk tests/examplefiles/make/vpath.mk.output +tests/examplefiles/mako/test.mao +tests/examplefiles/mako/test.mao.output tests/examplefiles/maql/test.maql tests/examplefiles/maql/test.maql.output tests/examplefiles/mask/test.mask @@ -890,6 +903,8 @@ tests/examplefiles/matlabsession/matlabsession_sample.txt tests/examplefiles/matlabsession/matlabsession_sample.txt.output tests/examplefiles/md/example.md tests/examplefiles/md/example.md.output +tests/examplefiles/meson/meson.build +tests/examplefiles/meson/meson.build.output tests/examplefiles/mime/MIME_example.eml tests/examplefiles/mime/MIME_example.eml.output tests/examplefiles/modelica/Constants.mo @@ -960,6 +975,8 @@ tests/examplefiles/nit/all.nit tests/examplefiles/nit/all.nit.output tests/examplefiles/nixos/example.nix tests/examplefiles/nixos/example.nix.output +tests/examplefiles/nodejsrepl/nodejsrepl_test.nodejsrepl +tests/examplefiles/nodejsrepl/nodejsrepl_test.nodejsrepl.output tests/examplefiles/notmuch/notmuch_example tests/examplefiles/notmuch/notmuch_example.output tests/examplefiles/nsis/bigtest.nsi @@ -1040,6 +1057,8 @@ tests/examplefiles/powershell/test.ps1 tests/examplefiles/powershell/test.ps1.output tests/examplefiles/praat/example.praat tests/examplefiles/praat/example.praat.output +tests/examplefiles/procfile/Procfile +tests/examplefiles/procfile/Procfile.output tests/examplefiles/prolog/qsort.prolog tests/examplefiles/prolog/qsort.prolog.output tests/examplefiles/prolog/sibling.prolog @@ -1066,12 +1085,22 @@ tests/examplefiles/pypylog/test2.pypylog tests/examplefiles/pypylog/test2.pypylog.output tests/examplefiles/pytb/database.pytb tests/examplefiles/pytb/database.pytb.output +tests/examplefiles/pytb/error_locations.pytb +tests/examplefiles/pytb/error_locations.pytb.output tests/examplefiles/pytb/py3tb_test.py3tb tests/examplefiles/pytb/py3tb_test.py3tb.output tests/examplefiles/pytb/pytb_test2.pytb tests/examplefiles/pytb/pytb_test2.pytb.output tests/examplefiles/pytb/pytb_test3.pytb tests/examplefiles/pytb/pytb_test3.pytb.output +tests/examplefiles/pytb/syntax_error.py2tb +tests/examplefiles/pytb/syntax_error.py2tb.output +tests/examplefiles/pytb/syntax_error.pytb +tests/examplefiles/pytb/syntax_error.pytb.output +tests/examplefiles/pytb/syntax_error_caret_code.py2tb +tests/examplefiles/pytb/syntax_error_caret_code.py2tb.output +tests/examplefiles/pytb/syntax_error_caret_code.pytb +tests/examplefiles/pytb/syntax_error_caret_code.pytb.output tests/examplefiles/pytb/truncated.pytb tests/examplefiles/pytb/truncated.pytb.output tests/examplefiles/python/linecontinuation.py @@ -1244,6 +1273,8 @@ tests/examplefiles/smalltalk/Object.st tests/examplefiles/smalltalk/Object.st.output tests/examplefiles/smarty/smarty_example.html tests/examplefiles/smarty/smarty_example.html.output +tests/examplefiles/smithy/test.smithy +tests/examplefiles/smithy/test.smithy.output tests/examplefiles/sml/example.sml tests/examplefiles/sml/example.sml.output tests/examplefiles/sml/intsyn.fun @@ -1552,6 +1583,9 @@ tests/snippets/c/test_label_space_before_colon.txt tests/snippets/c/test_numbers.txt tests/snippets/c/test_preproc_file.txt tests/snippets/c/test_preproc_file2.txt +tests/snippets/c/test_preproc_file3.txt +tests/snippets/c/test_preproc_file4.txt +tests/snippets/c/test_preproc_file5.txt tests/snippets/c/test_switch.txt tests/snippets/c/test_switch_space_before_colon.txt tests/snippets/cfm/test_basic_comment.txt @@ -1562,8 +1596,10 @@ tests/snippets/console/fake_ps2_prompt.txt tests/snippets/console/prompt_in_output.txt tests/snippets/console/ps2_prompt.txt tests/snippets/console/test_comment_after_prompt.txt -tests/snippets/console/test_newline_in_echo.txt -tests/snippets/console/test_newline_in_ls.txt +tests/snippets/console/test_newline_in_echo_no_ps2.txt +tests/snippets/console/test_newline_in_echo_ps2.txt +tests/snippets/console/test_newline_in_ls_no_ps2.txt +tests/snippets/console/test_newline_in_ls_ps2.txt tests/snippets/console/test_virtualenv.txt tests/snippets/coq/test_unicode.txt tests/snippets/cpp/test_good_comment.txt @@ -1632,8 +1668,10 @@ tests/snippets/ini/test_indented_entries_2.txt tests/snippets/ini/test_indented_entries_3.txt tests/snippets/j/test_deal_operator.txt tests/snippets/j/test_deal_operator_fixed_seed.txt +tests/snippets/java/test_default.txt tests/snippets/java/test_enhanced_for.txt tests/snippets/java/test_numeric_literals.txt +tests/snippets/jslt/test_sample.txt tests/snippets/json/test_basic.txt tests/snippets/json/test_basic_bare.txt tests/snippets/julia/test_keywords.txt @@ -1833,6 +1871,8 @@ tests/snippets/ruby/test_operator_methods.txt tests/snippets/ruby/test_range_syntax1.txt tests/snippets/ruby/test_range_syntax2.txt tests/snippets/ruby/test_range_syntax3.txt +tests/snippets/rust/test_attribute.txt +tests/snippets/rust/test_break.txt tests/snippets/rust/test_rawstrings.txt tests/snippets/scala/test_colon_colon_function_name.txt tests/snippets/scala/test_default_parameter.txt @@ -1863,6 +1903,7 @@ tests/snippets/systemverilog/test_basic.txt tests/snippets/systemverilog/test_classes.txt tests/snippets/systemverilog/test_numbers.txt tests/snippets/systemverilog/test_operators.txt +tests/snippets/tcl/test_comma_and_at.txt tests/snippets/teal/test_comments.txt tests/snippets/teal/test_literals.txt tests/snippets/teal/test_strings.txt diff --git a/README.rst b/README.rst index 6b7be27..77b2d56 100644 --- a/README.rst +++ b/README.rst @@ -37,7 +37,7 @@ Pygments is maintained by **Georg Brandl**, e-mail address *georg*\ *@*\ *python and **Matthäus Chajdas**. Many lexers and fixes have been contributed by **Armin Ronacher**, the rest of -the `Pocoo `_ team and **Tim Hatch**. +the `Pocoo `_ team and **Tim Hatch**. The code is distributed under the BSD 2-clause license. Contributors making pull requests must agree that they are able and willing to put their contributions diff --git a/doc/docs/tokens.rst b/doc/docs/tokens.rst index 801fc63..f5de675 100644 --- a/doc/docs/tokens.rst +++ b/doc/docs/tokens.rst @@ -306,6 +306,12 @@ Punctuation `Punctuation` For any punctuation which is not an operator (e.g. ``[``, ``(``...) +`Punctuation.Marker` + For markers that point to a location (e.g., carets in Python + tracebacks for syntax errors). + + .. versionadded:: 2.10 + Comments ======== diff --git a/doc/languages.rst b/doc/languages.rst index 86fde61..54a7345 100644 --- a/doc/languages.rst +++ b/doc/languages.rst @@ -93,6 +93,7 @@ Programming languages * `Jasmin `_ * `Jcl `_ * `Julia `_ +* `JSLT `_ * `Kotlin `_ * `Lasso `_ (incl. templating) * `Limbo `_ @@ -103,6 +104,7 @@ Programming languages * `Lua `_ * `Mathematica `_ * `Matlab `_ +* `The Meson Build System `_ * `MiniScript `_ * `Modelica `_ * `Modula-2 `_ @@ -235,6 +237,7 @@ Other markup * Gettext catalogs * Gnuplot script * Groff markup +* `GSQL `_ * Hexdumps * HTML * HTTP sessions @@ -263,6 +266,7 @@ Other markup * `OMG IDL `_ * `PEG `_ * POV-Ray scenes +* `Procfile `_ * `PromQL `_ * `Puppet `_ * QML @@ -277,6 +281,7 @@ Other markup * Scdoc * Sieve * Singularity +* `Smithy `_ * SPARQL * SQL, also MySQL, SQLite * Squid configuration diff --git a/pygments/__init__.py b/pygments/__init__.py index d7e892c..4ffb19f 100644 --- a/pygments/__init__.py +++ b/pygments/__init__.py @@ -27,7 +27,7 @@ import sys from io import StringIO, BytesIO -__version__ = '2.9.0' +__version__ = '2.10.0' __docformat__ = 'restructuredtext' __all__ = ['lex', 'format', 'highlight'] diff --git a/pygments/formatters/pangomarkup.py b/pygments/formatters/pangomarkup.py index 9225775..926ccc6 100644 --- a/pygments/formatters/pangomarkup.py +++ b/pygments/formatters/pangomarkup.py @@ -1,6 +1,6 @@ """ - pygments.formatters.pango - ~~~~~~~~~~~~~~~~~~~~~~~~~ + pygments.formatters.pangomarkup + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Formatter for Pango markup output. diff --git a/pygments/lexers/_csound_builtins.py b/pygments/lexers/_csound_builtins.py index 89fcb66..e7e395d 100644 --- a/pygments/lexers/_csound_builtins.py +++ b/pygments/lexers/_csound_builtins.py @@ -6,7 +6,35 @@ :license: BSD, see LICENSE for details. """ -# Opcodes in Csound 6.14.0 using: +REMOVED_OPCODES = set(''' +OSCsendA +beadsynt +beosc +buchla +getrowlin +lua_exec +lua_iaopcall +lua_iaopcall_off +lua_ikopcall +lua_ikopcall_off +lua_iopcall +lua_iopcall_off +lua_opdef +mp3scal_check +mp3scal_load +mp3scal_load2 +mp3scal_play +mp3scal_play2 +pvsgendy +socksend_k +signalflowgraph +sumTableFilter +systime +tabrowlin +vbap1move +'''.split()) + +# Opcodes in Csound 6.16.0 using: # python3 -c " # import re # from subprocess import Popen, PIPE @@ -209,6 +237,7 @@ ampmidicurve ampmidid apoleparams arduinoRead +arduinoReadF arduinoStart arduinoStop areson @@ -216,6 +245,7 @@ aresonk atone atonek atonex +autocorr babo balance balance2 @@ -223,8 +253,6 @@ bamboo barmodel bbcutm bbcuts -beadsynt -beosc betarand bexprnd bformdec1 @@ -259,6 +287,7 @@ centroid ceps cepsinv chanctrl +changed changed2 chani chano @@ -293,6 +322,8 @@ cmp cmplxprod cntCreate cntCycles +cntDelete +cntDelete_i cntRead cntReset cntState @@ -342,6 +373,11 @@ ctrl14 ctrl21 ctrl7 ctrlinit +ctrlpreset +ctrlprint +ctrlprintpresets +ctrlsave +ctrlselect cuserrnd dam date @@ -523,7 +559,6 @@ getcfg getcol getftargs getrow -getrowlin getseed gogobel grain @@ -776,6 +811,7 @@ lagud lastcycle lenarray lfo +lfsr limit limit1 lincos @@ -836,14 +872,6 @@ lpreson lpshold lpsholdp lpslot -lua_exec -lua_iaopcall -lua_iaopcall_off -lua_ikopcall -lua_ikopcall_off -lua_iopcall -lua_iopcall_off -lua_opdef lufs mac maca @@ -920,6 +948,7 @@ mp3scal mp3sr mpulse mrtmsg +ms2st mtof mton multitap @@ -929,6 +958,7 @@ mvclpf1 mvclpf2 mvclpf3 mvclpf4 +mvmfilter mxadsr nchnls_hw nestedap @@ -972,6 +1002,7 @@ oscils oscilx out out32 +outall outc outch outh @@ -1279,11 +1310,13 @@ sc_lagud sc_phasor sc_trig scale +scale2 scalearray scanhammer scans scantable scanu +scanu2 schedkwhen schedkwhennamed schedule @@ -1333,6 +1366,7 @@ sin sinh sininv sinsyn +skf sleighbells slicearray slicearray_i @@ -1368,12 +1402,14 @@ spat3d spat3di spat3dt spdist +spf splitrig sprintf sprintfk spsend sqrt squinewave +st2ms statevar sterrain stix @@ -1414,6 +1450,7 @@ subinstrinit sum sumarray svfilter +svn syncgrain syncloop syncphasor @@ -1454,7 +1491,6 @@ tabmorphak tabmorphi tabplay tabrec -tabrowlin tabsum tabw tabw_i @@ -1486,6 +1522,8 @@ transegr trcross trfilter trhighest +trigExpseg +trigLinseg trigger trighold trigphasor @@ -1500,6 +1538,8 @@ trshift trsplit turnoff turnoff2 +turnoff2_i +turnoff3 turnon tvconv unirand @@ -1523,6 +1563,7 @@ vbapmove vbapz vbapzmove vcella +vclpf vco vco2 vco2ft @@ -1611,6 +1652,7 @@ window wrap writescratch wterrain +wterrain2 xadsr xin xout @@ -1647,7 +1689,6 @@ DEPRECATED_OPCODES = set(''' array bformdec bformenc -changed copy2ftab copy2ttab hrtfer diff --git a/pygments/lexers/_mapping.py b/pygments/lexers/_mapping.py index aab8bde..24e3668 100644 --- a/pygments/lexers/_mapping.py +++ b/pygments/lexers/_mapping.py @@ -41,6 +41,7 @@ LEXERS = { 'AppleScriptLexer': ('pygments.lexers.scripting', 'AppleScript', ('applescript',), ('*.applescript',), ()), 'ArduinoLexer': ('pygments.lexers.c_like', 'Arduino', ('arduino',), ('*.ino',), ('text/x-arduino',)), 'ArrowLexer': ('pygments.lexers.arrow', 'Arrow', ('arrow',), ('*.arw',), ()), + 'AscLexer': ('pygments.lexers.asc', 'ASCII armored', ('asc', 'pem'), ('*.asc', '*.pem', 'id_dsa', 'id_ecdsa', 'id_ecdsa_sk', 'id_ed25519', 'id_ed25519_sk', 'id_rsa'), ('application/pgp-keys', 'application/pgp-encrypted', 'application/pgp-signature')), 'AspectJLexer': ('pygments.lexers.jvm', 'AspectJ', ('aspectj',), ('*.aj',), ('text/x-aspectj',)), 'AsymptoteLexer': ('pygments.lexers.graphics', 'Asymptote', ('asymptote', 'asy'), ('*.asy',), ('text/x-asymptote',)), 'AugeasLexer': ('pygments.lexers.configs', 'Augeas', ('augeas',), ('*.aug',), ()), @@ -175,6 +176,7 @@ LEXERS = { 'GAPLexer': ('pygments.lexers.algebra', 'GAP', ('gap',), ('*.g', '*.gd', '*.gi', '*.gap'), ()), 'GDScriptLexer': ('pygments.lexers.gdscript', 'GDScript', ('gdscript', 'gd'), ('*.gd',), ('text/x-gdscript', 'application/x-gdscript')), 'GLShaderLexer': ('pygments.lexers.graphics', 'GLSL', ('glsl',), ('*.vert', '*.frag', '*.geo'), ('text/x-glslsrc',)), + 'GSQLLexer': ('pygments.lexers.gsql', 'GSQL', ('gsql',), ('*.gsql',), ()), 'GasLexer': ('pygments.lexers.asm', 'GAS', ('gas', 'asm'), ('*.s', '*.S'), ('text/x-gas',)), 'GcodeLexer': ('pygments.lexers.gcodelexer', 'g-code', ('gcode',), ('*.gcode',), ()), 'GenshiLexer': ('pygments.lexers.templates', 'Genshi', ('genshi', 'kid', 'xml+genshi', 'xml+kid'), ('*.kid',), ('application/x-genshi', 'application/x-kid')), @@ -182,7 +184,7 @@ LEXERS = { 'GettextLexer': ('pygments.lexers.textfmts', 'Gettext Catalog', ('pot', 'po'), ('*.pot', '*.po'), ('application/x-gettext', 'text/x-gettext', 'text/gettext')), 'GherkinLexer': ('pygments.lexers.testing', 'Gherkin', ('gherkin', 'cucumber'), ('*.feature',), ('text/x-gherkin',)), 'GnuplotLexer': ('pygments.lexers.graphics', 'Gnuplot', ('gnuplot',), ('*.plot', '*.plt'), ('text/x-gnuplot',)), - 'GoLexer': ('pygments.lexers.go', 'Go', ('go',), ('*.go',), ('text/x-gosrc',)), + 'GoLexer': ('pygments.lexers.go', 'Go', ('go', 'golang'), ('*.go',), ('text/x-gosrc',)), 'GoloLexer': ('pygments.lexers.jvm', 'Golo', ('golo',), ('*.golo',), ()), 'GoodDataCLLexer': ('pygments.lexers.business', 'GoodData-CL', ('gooddata-cl',), ('*.gdc',), ('text/x-gooddata-cl',)), 'GosuLexer': ('pygments.lexers.jvm', 'Gosu', ('gosu',), ('*.gs', '*.gsx', '*.gsp', '*.vark'), ('text/x-gosu',)), @@ -215,12 +217,13 @@ LEXERS = { 'Inform6Lexer': ('pygments.lexers.int_fiction', 'Inform 6', ('inform6', 'i6'), ('*.inf',), ()), 'Inform6TemplateLexer': ('pygments.lexers.int_fiction', 'Inform 6 template', ('i6t',), ('*.i6t',), ()), 'Inform7Lexer': ('pygments.lexers.int_fiction', 'Inform 7', ('inform7', 'i7'), ('*.ni', '*.i7x'), ()), - 'IniLexer': ('pygments.lexers.configs', 'INI', ('ini', 'cfg', 'dosini'), ('*.ini', '*.cfg', '*.inf'), ('text/x-ini', 'text/inf')), + 'IniLexer': ('pygments.lexers.configs', 'INI', ('ini', 'cfg', 'dosini'), ('*.ini', '*.cfg', '*.inf', '*.service', '*.socket', '*.device', '*.mount', '*.automount', '*.swap', '*.target', '*.path', '*.timer', '*.slice', '*.scope'), ('text/x-ini', 'text/inf')), 'IoLexer': ('pygments.lexers.iolang', 'Io', ('io',), ('*.io',), ('text/x-iosrc',)), 'IokeLexer': ('pygments.lexers.jvm', 'Ioke', ('ioke', 'ik'), ('*.ik',), ('text/x-iokesrc',)), 'IrcLogsLexer': ('pygments.lexers.textfmts', 'IRC logs', ('irc',), ('*.weechatlog',), ('text/x-irclog',)), 'IsabelleLexer': ('pygments.lexers.theorem', 'Isabelle', ('isabelle',), ('*.thy',), ('text/x-isabelle',)), 'JLexer': ('pygments.lexers.j', 'J', ('j',), ('*.ijs',), ('text/x-j',)), + 'JSLTLexer': ('pygments.lexers.jslt', 'JSLT', ('jslt',), ('*.jslt',), ('text/x-jslt',)), 'JagsLexer': ('pygments.lexers.modeling', 'JAGS', ('jags',), ('*.jag', '*.bug'), ()), 'JasminLexer': ('pygments.lexers.jvm', 'Jasmin', ('jasmin', 'jasminxt'), ('*.j',), ()), 'JavaLexer': ('pygments.lexers.jvm', 'Java', ('java',), ('*.java',), ('text/x-java',)), @@ -283,6 +286,7 @@ LEXERS = { 'MathematicaLexer': ('pygments.lexers.algebra', 'Mathematica', ('mathematica', 'mma', 'nb'), ('*.nb', '*.cdf', '*.nbp', '*.ma'), ('application/mathematica', 'application/vnd.wolfram.mathematica', 'application/vnd.wolfram.mathematica.package', 'application/vnd.wolfram.cdf')), 'MatlabLexer': ('pygments.lexers.matlab', 'Matlab', ('matlab',), ('*.m',), ('text/matlab',)), 'MatlabSessionLexer': ('pygments.lexers.matlab', 'Matlab session', ('matlabsession',), (), ()), + 'MesonLexer': ('pygments.lexers.meson', 'Meson', ('meson', 'meson.build'), ('meson.build', 'meson_options.txt'), ('text/x-meson',)), 'MiniDLexer': ('pygments.lexers.d', 'MiniD', ('minid',), (), ('text/x-minidsrc',)), 'MiniScriptLexer': ('pygments.lexers.scripting', 'MiniScript', ('miniscript', 'ms'), ('*.ms',), ('text/x-minicript', 'application/x-miniscript')), 'ModelicaLexer': ('pygments.lexers.modeling', 'Modelica', ('modelica',), ('*.mo',), ('text/x-modelica',)), @@ -320,6 +324,7 @@ LEXERS = { 'NimrodLexer': ('pygments.lexers.nimrod', 'Nimrod', ('nimrod', 'nim'), ('*.nim', '*.nimrod'), ('text/x-nim',)), 'NitLexer': ('pygments.lexers.nit', 'Nit', ('nit',), ('*.nit',), ()), 'NixLexer': ('pygments.lexers.nix', 'Nix', ('nixos', 'nix'), ('*.nix',), ('text/x-nix',)), + 'NodeConsoleLexer': ('pygments.lexers.javascript', 'Node.js REPL console session', ('nodejsrepl',), (), ('text/x-nodejsrepl',)), 'NotmuchLexer': ('pygments.lexers.textfmts', 'Notmuch', ('notmuch',), (), ()), 'NuSMVLexer': ('pygments.lexers.smv', 'NuSMV', ('nusmv',), ('*.smv',), ()), 'NumPyLexer': ('pygments.lexers.python', 'NumPy', ('numpy',), (), ()), @@ -334,6 +339,7 @@ LEXERS = { 'OocLexer': ('pygments.lexers.ooc', 'Ooc', ('ooc',), ('*.ooc',), ('text/x-ooc',)), 'OpaLexer': ('pygments.lexers.ml', 'Opa', ('opa',), ('*.opa',), ('text/x-opa',)), 'OpenEdgeLexer': ('pygments.lexers.business', 'OpenEdge ABL', ('openedge', 'abl', 'progress'), ('*.p', '*.cls'), ('text/x-openedge', 'application/x-openedge')), + 'OutputLexer': ('pygments.lexers.special', 'Text output', ('output',), (), ()), 'PacmanConfLexer': ('pygments.lexers.configs', 'PacmanConf', ('pacmanconf',), ('pacman.conf',), ()), 'PanLexer': ('pygments.lexers.dsls', 'Pan', ('pan',), ('*.pan',), ()), 'ParaSailLexer': ('pygments.lexers.parasail', 'ParaSail', ('parasail',), ('*.psi', '*.psl'), ('text/x-parasail',)), @@ -352,9 +358,10 @@ LEXERS = { 'PostgresConsoleLexer': ('pygments.lexers.sql', 'PostgreSQL console (psql)', ('psql', 'postgresql-console', 'postgres-console'), (), ('text/x-postgresql-psql',)), 'PostgresLexer': ('pygments.lexers.sql', 'PostgreSQL SQL dialect', ('postgresql', 'postgres'), (), ('text/x-postgresql',)), 'PovrayLexer': ('pygments.lexers.graphics', 'POVRay', ('pov',), ('*.pov', '*.inc'), ('text/x-povray',)), - 'PowerShellLexer': ('pygments.lexers.shell', 'PowerShell', ('powershell', 'posh', 'ps1', 'psm1'), ('*.ps1', '*.psm1'), ('text/x-powershell',)), - 'PowerShellSessionLexer': ('pygments.lexers.shell', 'PowerShell Session', ('ps1con',), (), ()), + 'PowerShellLexer': ('pygments.lexers.shell', 'PowerShell', ('powershell', 'pwsh', 'posh', 'ps1', 'psm1'), ('*.ps1', '*.psm1'), ('text/x-powershell',)), + 'PowerShellSessionLexer': ('pygments.lexers.shell', 'PowerShell Session', ('pwsh-session', 'ps1con'), (), ()), 'PraatLexer': ('pygments.lexers.praat', 'Praat', ('praat',), ('*.praat', '*.proc', '*.psc'), ()), + 'ProcfileLexer': ('pygments.lexers.procfile', 'Procfile', ('procfile',), ('Procfile',), ()), 'PrologLexer': ('pygments.lexers.prolog', 'Prolog', ('prolog',), ('*.ecl', '*.prolog', '*.pro', '*.pl'), ('text/x-prolog',)), 'PromQLLexer': ('pygments.lexers.promql', 'PromQL', ('promql',), ('*.promql',), ()), 'PropertiesLexer': ('pygments.lexers.configs', 'Properties', ('properties', 'jproperties'), ('*.properties',), ('text/x-java-properties',)), @@ -427,6 +434,7 @@ LEXERS = { 'SmalltalkLexer': ('pygments.lexers.smalltalk', 'Smalltalk', ('smalltalk', 'squeak', 'st'), ('*.st',), ('text/x-smalltalk',)), 'SmartGameFormatLexer': ('pygments.lexers.sgf', 'SmartGameFormat', ('sgf',), ('*.sgf',), ()), 'SmartyLexer': ('pygments.lexers.templates', 'Smarty', ('smarty',), ('*.tpl',), ('application/x-smarty',)), + 'SmithyLexer': ('pygments.lexers.smithy', 'Smithy', ('smithy',), ('*.smithy',), ()), 'SnobolLexer': ('pygments.lexers.snobol', 'Snobol', ('snobol',), ('*.snobol',), ('text/x-snobol',)), 'SnowballLexer': ('pygments.lexers.dsls', 'Snowball', ('snowball',), ('*.sbl',), ()), 'SolidityLexer': ('pygments.lexers.solidity', 'Solidity', ('solidity',), ('*.sol',), ()), @@ -468,7 +476,7 @@ LEXERS = { 'TurtleLexer': ('pygments.lexers.rdf', 'Turtle', ('turtle',), ('*.ttl',), ('text/turtle', 'application/x-turtle')), 'TwigHtmlLexer': ('pygments.lexers.templates', 'HTML+Twig', ('html+twig',), ('*.twig',), ('text/html+twig',)), 'TwigLexer': ('pygments.lexers.templates', 'Twig', ('twig',), (), ('application/x-twig',)), - 'TypeScriptLexer': ('pygments.lexers.javascript', 'TypeScript', ('typescript', 'ts'), ('*.ts', '*.tsx'), ('text/x-typescript',)), + 'TypeScriptLexer': ('pygments.lexers.javascript', 'TypeScript', ('typescript', 'ts'), ('*.ts',), ('application/x-typescript', 'text/x-typescript')), 'TypoScriptCssDataLexer': ('pygments.lexers.typoscript', 'TypoScriptCssData', ('typoscriptcssdata',), (), ()), 'TypoScriptHtmlDataLexer': ('pygments.lexers.typoscript', 'TypoScriptHtmlData', ('typoscripthtmldata',), (), ()), 'TypoScriptLexer': ('pygments.lexers.typoscript', 'TypoScript', ('typoscript',), ('*.typoscript',), ('text/x-typoscript',)), diff --git a/pygments/lexers/asc.py b/pygments/lexers/asc.py new file mode 100644 index 0000000..f775fd0 --- /dev/null +++ b/pygments/lexers/asc.py @@ -0,0 +1,51 @@ +""" + pygments.lexers.asc + ~~~~~~~~~~~~~~~~~~~ + + Lexer for various ASCII armored files. + + :copyright: Copyright 2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" +import re + +from pygments.lexer import RegexLexer, bygroups +from pygments.token import Comment, Generic, Name, Operator, String, Whitespace + +__all__ = ['AscLexer'] + + +class AscLexer(RegexLexer): + """ + Lexer for ASCII armored files, containing `-----BEGIN/END ...-----` wrapped base64 data. + + .. versionadded:: 2.10 + """ + name = 'ASCII armored' + aliases = ['asc', 'pem'] + filenames = [ + '*.asc', # PGP; *.gpg, *.pgp, and *.sig too, but those can be binary + '*.pem', # X.509; *.cer, *.crt, *.csr, and key etc too, but those can be binary + 'id_dsa', 'id_ecdsa', 'id_ecdsa_sk', 'id_ed25519', 'id_ed25519_sk', 'id_rsa', # SSH private keys + ] + mimetypes = ['application/pgp-keys', 'application/pgp-encrypted', 'application/pgp-signature'] + + flags = re.MULTILINE + + tokens = { + 'root': [ + (r'\s+', Whitespace), + (r'^-----BEGIN [^\n]+-----$', Generic.Heading, 'data'), + (r'\S+', Comment), + ], + 'data': [ + (r'\s+', Whitespace), + (r'^([^:]+)(:)([ \t]+)(.*)', bygroups(Name.Attribute, Operator, Whitespace, String)), + (r'^-----END [^\n]+-----$', Generic.Heading, 'root'), + (r'\S+', String), + ], + } + + def analyse_text(text): + if re.search(r'^-----BEGIN [^\n]+-----\r?\n', text): + return True diff --git a/pygments/lexers/asm.py b/pygments/lexers/asm.py index d7e3e4b..f83abde 100644 --- a/pygments/lexers/asm.py +++ b/pygments/lexers/asm.py @@ -353,13 +353,14 @@ class LlvmLexer(RegexLexer): #: optional Comment or Whitespace string = r'"[^"]*?"' identifier = r'([-a-zA-Z$._][\w\-$.]*|' + string + ')' + block_label = r'(' + identifier + r'|(\d+))' tokens = { 'root': [ include('whitespace'), # Before keywords, because keywords are valid label names :(... - (identifier + r'\s*:', Name.Label), + (block_label + r'\s*:', Name.Label), include('keyword'), @@ -384,68 +385,95 @@ class LlvmLexer(RegexLexer): 'keyword': [ # Regular keywords (words(( - 'acq_rel', 'acquire', 'add', 'addrspace', 'addrspacecast', 'afn', 'alias', - 'aliasee', 'align', 'alignLog2', 'alignstack', 'alloca', 'allocsize', 'allOnes', - 'alwaysinline', 'amdgpu_cs', 'amdgpu_es', 'amdgpu_gs', 'amdgpu_hs', - 'amdgpu_kernel', 'amdgpu_ls', 'amdgpu_ps', 'amdgpu_vs', 'and', 'any', - 'anyregcc', 'appending', 'arcp', 'argmemonly', 'args', 'arm_aapcs_vfpcc', - 'arm_aapcscc', 'arm_apcscc', 'ashr', 'asm', 'atomic', 'atomicrmw', 'attributes', - 'available_externally', 'avr_intrcc', 'avr_signalcc', 'bit', 'bitcast', - 'bitMask', 'blockaddress', 'br', 'branchFunnel', 'builtin', 'byArg', 'byte', - 'byteArray', 'byval', 'c', 'call', 'callee', 'caller', 'calls', 'catch', - 'catchpad', 'catchret', 'catchswitch', 'cc', 'ccc', 'cleanup', 'cleanuppad', - 'cleanupret', 'cmpxchg', 'cold', 'coldcc', 'comdat', 'common', 'constant', - 'contract', 'convergent', 'critical', 'cxx_fast_tlscc', 'datalayout', 'declare', - 'default', 'define', 'deplibs', 'dereferenceable', 'dereferenceable_or_null', - 'distinct', 'dllexport', 'dllimport', 'dso_local', 'dso_preemptable', - 'dsoLocal', 'eq', 'exact', 'exactmatch', 'extern_weak', 'external', - 'externally_initialized', 'extractelement', 'extractvalue', 'fadd', 'false', - 'fast', 'fastcc', 'fcmp', 'fdiv', 'fence', 'filter', 'flags', 'fmul', - 'fpext', 'fptosi', 'fptoui', 'fptrunc', 'freeze', 'frem', 'from', 'fsub', - 'funcFlags', 'function', 'gc', 'getelementptr', 'ghccc', 'global', 'guid', 'gv', - 'hash', 'hhvm_ccc', 'hhvmcc', 'hidden', 'hot', 'hotness', 'icmp', - 'ifunc', 'inaccessiblemem_or_argmemonly', 'inaccessiblememonly', 'inalloca', - 'inbounds', 'indir', 'indirectbr', 'info', 'initialexec', 'inline', - 'inlineBits', 'inlinehint', 'inrange', 'inreg', 'insertelement', 'insertvalue', - 'insts', 'intel_ocl_bicc', 'inteldialect', 'internal', 'inttoptr', 'invoke', - 'jumptable', 'kind', 'landingpad', 'largest', 'linkage', 'linkonce', - 'linkonce_odr', 'live', 'load', 'local_unnamed_addr', 'localdynamic', - 'localexec', 'lshr', 'max', 'metadata', 'min', 'minsize', 'module', 'monotonic', - 'msp430_intrcc', 'mul', 'musttail', 'naked', 'name', 'nand', 'ne', 'nest', - 'ninf', 'nnan', 'noalias', 'nobuiltin', 'nocapture', 'nocf_check', - 'noduplicate', 'noduplicates', 'noimplicitfloat', 'noinline', 'none', - 'nonlazybind', 'nonnull', 'norecurse', 'noRecurse', 'noredzone', 'noreturn', - 'notail', 'notEligibleToImport', 'nounwind', 'nsw', 'nsz', 'null', 'nuw', 'oeq', - 'offset', 'oge', 'ogt', 'ole', 'olt', 'one', 'opaque', 'optforfuzzing', - 'optnone', 'optsize', 'or', 'ord', 'path', 'personality', 'phi', 'poison', - 'prefix', 'preserve_allcc', 'preserve_mostcc', 'private', 'prologue', - 'protected', 'ptrtoint', 'ptx_device', 'ptx_kernel', 'readnone', 'readNone', - 'readonly', 'readOnly', 'reassoc', 'refs', 'relbf', 'release', 'resByArg', - 'resume', 'ret', 'returnDoesNotAlias', 'returned', 'returns_twice', 'safestack', - 'samesize', 'sanitize_address', 'sanitize_hwaddress', 'sanitize_memory', - 'sanitize_thread', 'sdiv', 'section', 'select', 'seq_cst', 'sext', 'sge', 'sgt', - 'shadowcallstack', 'shl', 'shufflevector', 'sideeffect', 'signext', 'single', - 'singleImpl', 'singleImplName', 'sitofp', 'sizeM1', 'sizeM1BitWidth', 'sle', - 'slt', 'source_filename', 'speculatable', 'spir_func', 'spir_kernel', 'srem', - 'sret', 'ssp', 'sspreq', 'sspstrong', 'store', 'strictfp', 'sub', 'summaries', - 'summary', 'swiftcc', 'swifterror', 'swiftself', 'switch', 'syncscope', 'tail', - 'target', 'thread_local', 'to', 'token', 'triple', 'true', 'trunc', 'type', - 'typeCheckedLoadConstVCalls', 'typeCheckedLoadVCalls', 'typeid', 'typeIdInfo', - 'typeTestAssumeConstVCalls', 'typeTestAssumeVCalls', 'typeTestRes', 'typeTests', - 'udiv', 'ueq', 'uge', 'ugt', 'uitofp', 'ule', 'ult', 'umax', 'umin', 'undef', - 'une', 'uniformRetVal', 'uniqueRetVal', 'unknown', 'unnamed_addr', 'uno', - 'unordered', 'unreachable', 'unsat', 'unwind', 'urem', 'uselistorder', - 'uselistorder_bb', 'uwtable', 'va_arg', 'variable', 'vFuncId', - 'virtualConstProp', 'void', 'volatile', 'weak', 'weak_odr', 'webkit_jscc', + 'aarch64_sve_vector_pcs', 'aarch64_vector_pcs', 'acq_rel', + 'acquire', 'add', 'addrspace', 'addrspacecast', 'afn', 'alias', + 'aliasee', 'align', 'alignLog2', 'alignstack', 'alloca', + 'allocsize', 'allOnes', 'alwaysinline', 'alwaysInline', + 'amdgpu_cs', 'amdgpu_es', 'amdgpu_gfx', 'amdgpu_gs', + 'amdgpu_hs', 'amdgpu_kernel', 'amdgpu_ls', 'amdgpu_ps', + 'amdgpu_vs', 'and', 'any', 'anyregcc', 'appending', 'arcp', + 'argmemonly', 'args', 'arm_aapcs_vfpcc', 'arm_aapcscc', + 'arm_apcscc', 'ashr', 'asm', 'atomic', 'atomicrmw', + 'attributes', 'available_externally', 'avr_intrcc', + 'avr_signalcc', 'bit', 'bitcast', 'bitMask', 'blockaddress', + 'blockcount', 'br', 'branchFunnel', 'builtin', 'byArg', + 'byref', 'byte', 'byteArray', 'byval', 'c', 'call', 'callbr', + 'callee', 'caller', 'calls', 'canAutoHide', 'catch', + 'catchpad', 'catchret', 'catchswitch', 'cc', 'ccc', + 'cfguard_checkcc', 'cleanup', 'cleanuppad', 'cleanupret', + 'cmpxchg', 'cold', 'coldcc', 'comdat', 'common', 'constant', + 'contract', 'convergent', 'critical', 'cxx_fast_tlscc', + 'datalayout', 'declare', 'default', 'define', 'deplibs', + 'dereferenceable', 'dereferenceable_or_null', 'distinct', + 'dllexport', 'dllimport', 'dso_local', 'dso_local_equivalent', + 'dso_preemptable', 'dsoLocal', 'eq', 'exact', 'exactmatch', + 'extern_weak', 'external', 'externally_initialized', + 'extractelement', 'extractvalue', 'fadd', 'false', 'fast', + 'fastcc', 'fcmp', 'fdiv', 'fence', 'filter', 'flags', 'fmul', + 'fneg', 'fpext', 'fptosi', 'fptoui', 'fptrunc', 'freeze', + 'frem', 'from', 'fsub', 'funcFlags', 'function', 'gc', + 'getelementptr', 'ghccc', 'global', 'guid', 'gv', 'hash', + 'hhvm_ccc', 'hhvmcc', 'hidden', 'hot', 'hotness', 'icmp', + 'ifunc', 'inaccessiblemem_or_argmemonly', + 'inaccessiblememonly', 'inalloca', 'inbounds', 'indir', + 'indirectbr', 'info', 'initialexec', 'inline', 'inlineBits', + 'inlinehint', 'inrange', 'inreg', 'insertelement', + 'insertvalue', 'insts', 'intel_ocl_bicc', 'inteldialect', + 'internal', 'inttoptr', 'invoke', 'jumptable', 'kind', + 'landingpad', 'largest', 'linkage', 'linkonce', 'linkonce_odr', + 'live', 'load', 'local_unnamed_addr', 'localdynamic', + 'localexec', 'lshr', 'max', 'metadata', 'min', 'minsize', + 'module', 'monotonic', 'msp430_intrcc', 'mul', 'mustprogress', + 'musttail', 'naked', 'name', 'nand', 'ne', 'nest', 'ninf', + 'nnan', 'noalias', 'nobuiltin', 'nocallback', 'nocapture', + 'nocf_check', 'noduplicate', 'noduplicates', 'nofree', + 'noimplicitfloat', 'noinline', 'noInline', 'nomerge', 'none', + 'nonlazybind', 'nonnull', 'noprofile', 'norecurse', + 'noRecurse', 'noredzone', 'noreturn', 'nosync', 'notail', + 'notEligibleToImport', 'noundef', 'nounwind', 'nsw', + 'nsz', 'null', 'null_pointer_is_valid', 'nuw', 'oeq', 'offset', + 'oge', 'ogt', 'ole', 'olt', 'one', 'opaque', 'optforfuzzing', + 'optnone', 'optsize', 'or', 'ord', 'param', 'params', + 'partition', 'path', 'personality', 'phi', 'poison', + 'preallocated', 'prefix', 'preserve_allcc', 'preserve_mostcc', + 'private', 'prologue', 'protected', 'ptrtoint', 'ptx_device', + 'ptx_kernel', 'readnone', 'readNone', 'readonly', 'readOnly', + 'reassoc', 'refs', 'relbf', 'release', 'resByArg', 'resume', + 'ret', 'returnDoesNotAlias', 'returned', 'returns_twice', + 'safestack', 'samesize', 'sanitize_address', + 'sanitize_hwaddress', 'sanitize_memory', 'sanitize_memtag', + 'sanitize_thread', 'sdiv', 'section', 'select', 'seq_cst', + 'sext', 'sge', 'sgt', 'shadowcallstack', 'shl', + 'shufflevector', 'sideeffect', 'signext', 'single', + 'singleImpl', 'singleImplName', 'sitofp', 'sizeM1', + 'sizeM1BitWidth', 'sle', 'slt', 'source_filename', + 'speculatable', 'speculative_load_hardening', 'spir_func', + 'spir_kernel', 'srem', 'sret', 'ssp', 'sspreq', 'sspstrong', + 'store', 'strictfp', 'sub', 'summaries', 'summary', 'swiftcc', + 'swifterror', 'swiftself', 'switch', 'syncscope', 'tail', + 'tailcc', 'target', 'thread_local', 'to', 'token', 'triple', + 'true', 'trunc', 'type', 'typeCheckedLoadConstVCalls', + 'typeCheckedLoadVCalls', 'typeid', 'typeidCompatibleVTable', + 'typeIdInfo', 'typeTestAssumeConstVCalls', + 'typeTestAssumeVCalls', 'typeTestRes', 'typeTests', 'udiv', + 'ueq', 'uge', 'ugt', 'uitofp', 'ule', 'ult', 'umax', 'umin', + 'undef', 'une', 'uniformRetVal', 'uniqueRetVal', 'unknown', + 'unnamed_addr', 'uno', 'unordered', 'unreachable', 'unsat', + 'unwind', 'urem', 'uselistorder', 'uselistorder_bb', 'uwtable', + 'va_arg', 'varFlags', 'variable', 'vcall_visibility', + 'vFuncId', 'virtFunc', 'virtualConstProp', 'void', 'volatile', + 'vscale', 'vTableFuncs', 'weak', 'weak_odr', 'webkit_jscc', 'win64cc', 'within', 'wpdRes', 'wpdResolutions', 'writeonly', - 'x86_64_sysvcc', 'x86_fastcallcc', 'x86_intrcc', 'x86_mmx', - 'x86_regcallcc', 'x86_stdcallcc', 'x86_thiscallcc', 'x86_vectorcallcc', 'xchg', - 'xor', 'zeroext', 'zeroinitializer', 'zext', 'immarg', 'willreturn'), + 'x', 'x86_64_sysvcc', 'x86_fastcallcc', 'x86_intrcc', + 'x86_mmx', 'x86_regcallcc', 'x86_stdcallcc', 'x86_thiscallcc', + 'x86_vectorcallcc', 'xchg', 'xor', 'zeroext', + 'zeroinitializer', 'zext', 'immarg', 'willreturn'), suffix=r'\b'), Keyword), # Types (words(('void', 'half', 'bfloat', 'float', 'double', 'fp128', - 'x86_fp80', 'ppc_fp128', 'label', 'metadata', 'token')), + 'x86_fp80', 'ppc_fp128', 'label', 'metadata', 'x86_mmx', + 'x86_amx', 'token')), Keyword.Type), # Integer types diff --git a/pygments/lexers/bibtex.py b/pygments/lexers/bibtex.py index 0210082..bb572d6 100644 --- a/pygments/lexers/bibtex.py +++ b/pygments/lexers/bibtex.py @@ -154,6 +154,6 @@ class BSTLexer(RegexLexer): ], 'whitespace': [ (r'\s+', Text), - ('%.*?$', Comment.SingleLine), + ('%.*?$', Comment.Single), ], } diff --git a/pygments/lexers/c_cpp.py b/pygments/lexers/c_cpp.py index 059b9be..cf9a3d2 100644 --- a/pygments/lexers/c_cpp.py +++ b/pygments/lexers/c_cpp.py @@ -14,7 +14,7 @@ from pygments.lexer import RegexLexer, include, bygroups, using, \ this, inherit, default, words from pygments.util import get_bool_opt from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ - Number, Punctuation + Number, Punctuation, Whitespace __all__ = ['CLexer', 'CppLexer'] @@ -55,8 +55,8 @@ class CFamilyLexer(RegexLexer): bygroups(using(this), Comment.Preproc), 'if0'), ('^(' + _ws1 + ')(#)', bygroups(using(this), Comment.Preproc), 'macro'), - (r'\n', Text), - (r'\s+', Text), + (r'\n', Whitespace), + (r'[^\S\n]+', Whitespace), (r'\\\n', Text), # line continuation (r'//(\n|[\w\W]*?[^\\]\n)', Comment.Single), (r'/(\\\n)?[*][\w\W]*?[*](\\\n)?/', Comment.Multiline), diff --git a/pygments/lexers/cddl.py b/pygments/lexers/cddl.py index 72b3464..99eb17c 100644 --- a/pygments/lexers/cddl.py +++ b/pygments/lexers/cddl.py @@ -164,7 +164,7 @@ class CddlLexer(RegexLexer): Number.Float, ), # Int - (_re_int, Number.Int), + (_re_int, Number.Integer), (r'"(\\\\|\\"|[^"])*"', String.Double), ], "bstrb64url": [ diff --git a/pygments/lexers/clean.py b/pygments/lexers/clean.py index bf1d409..579cf7c 100644 --- a/pygments/lexers/clean.py +++ b/pygments/lexers/clean.py @@ -59,15 +59,15 @@ class CleanLexer(ExtendedRegexLexer): ], 'comments': [ (r'//.*\n', Comment.Single), - (r'/\*', Comment.Multi, 'comments.in'), + (r'/\*', Comment.Multiline, 'comments.in'), (r'/\*\*', Comment.Special, 'comments.in'), ], 'comments.in': [ - (r'\*\/', Comment.Multi, '#pop'), - (r'/\*', Comment.Multi, '#push'), - (r'[^*/]+', Comment.Multi), - (r'\*(?!/)', Comment.Multi), - (r'/', Comment.Multi), + (r'\*\/', Comment.Multiline, '#pop'), + (r'/\*', Comment.Multiline, '#push'), + (r'[^*/]+', Comment.Multiline), + (r'\*(?!/)', Comment.Multiline), + (r'/', Comment.Multiline), ], 'keywords': [ (words(keywords, prefix=r'\b', suffix=r'\b'), Keyword), diff --git a/pygments/lexers/configs.py b/pygments/lexers/configs.py index 927896f..c728e74 100644 --- a/pygments/lexers/configs.py +++ b/pygments/lexers/configs.py @@ -31,7 +31,13 @@ class IniLexer(RegexLexer): name = 'INI' aliases = ['ini', 'cfg', 'dosini'] - filenames = ['*.ini', '*.cfg', '*.inf'] + filenames = [ + '*.ini', '*.cfg', '*.inf', + # systemd unit files + # https://www.freedesktop.org/software/systemd/man/systemd.unit.html + '*.service', '*.socket', '*.device', '*.mount', '*.automount', + '*.swap', '*.target', '*.path', '*.timer', '*.slice', '*.scope', + ] mimetypes = ['text/x-ini', 'text/inf'] tokens = { @@ -962,9 +968,12 @@ class TOMLLexer(RegexLexer): tokens = { 'root': [ + # Table + (r'^(\s*)(\[.*?\])$', bygroups(Text, Keyword)), # Basics, comments, strings - (r'\s+', Text), + (r'[ \t]+', Text), + (r'\n', Text), (r'#.*?$', Comment.Single), # Basic string (r'"(\\\\|\\[^\\]|[^"\\])*"', String), @@ -974,7 +983,6 @@ class TOMLLexer(RegexLexer): (r'(true|false)$', Keyword.Constant), (r'[a-zA-Z_][\w\-]*', Name), - (r'\[.*?\]$', Keyword), # Datetime # TODO this needs to be expanded, as TOML is rather flexible: # https://github.com/toml-lang/toml#offset-date-time diff --git a/pygments/lexers/csound.py b/pygments/lexers/csound.py index b969aa6..7b49dc2 100644 --- a/pygments/lexers/csound.py +++ b/pygments/lexers/csound.py @@ -13,7 +13,7 @@ import re from pygments.lexer import RegexLexer, bygroups, default, include, using, words from pygments.token import Comment, Error, Keyword, Name, Number, Operator, Punctuation, \ String, Text, Whitespace -from pygments.lexers._csound_builtins import OPCODES, DEPRECATED_OPCODES +from pygments.lexers._csound_builtins import OPCODES, DEPRECATED_OPCODES, REMOVED_OPCODES from pygments.lexers.html import HtmlLexer from pygments.lexers.python import PythonLexer from pygments.lexers.scripting import LuaLexer @@ -219,7 +219,7 @@ class CsoundOrchestraLexer(CsoundLexer): type_annotation_token = Keyword.Type name = match.group(1) - if name in OPCODES or name in DEPRECATED_OPCODES: + if name in OPCODES or name in DEPRECATED_OPCODES or name in REMOVED_OPCODES: yield match.start(), Name.Builtin, name elif name in lexer.user_defined_opcodes: yield match.start(), Name.Function, name diff --git a/pygments/lexers/dotnet.py b/pygments/lexers/dotnet.py index 541e3ea..4a7e354 100644 --- a/pygments/lexers/dotnet.py +++ b/pygments/lexers/dotnet.py @@ -87,7 +87,7 @@ class CSharpLexer(RegexLexer): (r'[~!%^&*()+=|\[\]:;,.<>/?-]', Punctuation), (r'[{}]', Punctuation), (r'@"(""|[^"])*"', String), - (r'"(\\\\|\\[^\\]|[^"\\\n])*["\n]', String), + (r'\$?"(\\\\|\\[^\\]|[^"\\\n])*["\n]', String), (r"'\\.'|'[^\\]'", String.Char), (r"[0-9](\.[0-9]*)?([eE][+-][0-9]+)?" r"[flFLdD]?|0[xX][0-9a-fA-F]+[Ll]?", Number), diff --git a/pygments/lexers/floscript.py b/pygments/lexers/floscript.py index 82ebc0c..d6d3a20 100644 --- a/pygments/lexers/floscript.py +++ b/pygments/lexers/floscript.py @@ -59,7 +59,7 @@ class FloScriptLexer(RegexLexer): include('name'), include('numbers'), - (r'#.+$', Comment.Singleline), + (r'#.+$', Comment.Single), ], 'string': [ ('[^"]+', String), diff --git a/pygments/lexers/go.py b/pygments/lexers/go.py index b37a6e1..4e287ca 100644 --- a/pygments/lexers/go.py +++ b/pygments/lexers/go.py @@ -25,7 +25,7 @@ class GoLexer(RegexLexer): """ name = 'Go' filenames = ['*.go'] - aliases = ['go'] + aliases = ['go', 'golang'] mimetypes = ['text/x-gosrc'] flags = re.MULTILINE | re.UNICODE diff --git a/pygments/lexers/gsql.py b/pygments/lexers/gsql.py new file mode 100755 index 0000000..914df26 --- /dev/null +++ b/pygments/lexers/gsql.py @@ -0,0 +1,92 @@ +""" + pygments.lexers.gsql + ~~~~~~~~~~~~~~~~~~~~ + + Lexers for TigerGraph GSQL graph query language + + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +import re + +from pygments.lexer import RegexLexer, include, bygroups, using, this, words +from pygments.token import Keyword, Punctuation, Comment, Operator, Name,\ + String, Number, Whitespace, Token + + +__all__ = ["GSQLLexer"] + +class GSQLLexer(RegexLexer): + + """ + For `GSQL `_ queries (version 3.x). + .. versionadded:: 2.10 + """ + + name = 'GSQL' + aliases = ['gsql'] + filenames = ['*.gsql'] + + flags = re.MULTILINE | re.IGNORECASE + + tokens = { + 'root': [ + include('comment'), + include('keywords'), + include('clauses'), + include('accums'), + include('relations'), + include('strings'), + include('whitespace'), + include('barewords'), + include('operators'), + ], + 'comment': [ + (r'.*\#.*\n', Comment.Single), + (r'.*\/\*\s*.*\s*\*\/', Comment.Multiline), + ], + 'keywords': [ + (words(( + 'ACCUM', 'AND', 'ANY', 'API', 'AS', 'ASC', 'AVG', 'BAG', 'BATCH', 'BETWEEN', 'BOOL', 'BOTH', + 'BREAK', 'BY', 'CASE', 'CATCH', 'COALESCE', 'COMPRESS', 'CONTINUE', 'COUNT', + 'CREATE', 'DATETIME', 'DATETIME_ADD', 'DATETIME_SUB', 'DELETE', 'DESC', 'DISTRIBUTED', 'DO', + 'DOUBLE', 'EDGE', 'ELSE', 'END', 'ESCAPE', 'EXCEPTION', 'FALSE', 'FILE', 'FILTER', 'FLOAT', 'FOREACH', 'FOR', + 'FROM', 'GRAPH', 'GROUP', 'GSQL_INT_MAX', 'GSQL_INT_MIN', 'GSQL_UINT_MAX', 'HAVING', 'IF', + 'IN', 'INSERT', 'INT', 'INTERPRET', 'INTERSECT', 'INTERVAL', 'INTO', 'IS', 'ISEMPTY', 'JSONARRAY', 'JSONOBJECT', 'LASTHOP', + 'LEADING', 'LIKE', 'LIMIT', 'LIST', 'LOAD_ACCUM', 'LOG', 'MAP', 'MATCH', 'MAX', 'MIN', 'MINUS', 'NOT', + 'NOW', 'NULL', 'OFFSET', 'OR', 'ORDER', 'PATH', 'PER', 'PINNED', 'POST_ACCUM', 'POST-ACCUM', 'PRIMARY_ID', 'PRINT', + 'QUERY', 'RAISE', 'RANGE', 'REPLACE', 'RESET_COLLECTION_ACCUM', 'RETURN', 'RETURNS', 'RUN', 'SAMPLE', 'SELECT', 'SELECT_VERTEX', + 'SET', 'SRC', 'STATIC', 'STRING', 'SUM', 'SYNTAX', 'TARGET', 'TAGSTGT', 'THEN', 'TO', 'TO_CSV', 'TO_DATETIME', 'TRAILING', 'TRIM', 'TRUE', + 'TRY', 'TUPLE', 'TYPEDEF', 'UINT', 'UNION', 'UPDATE', 'VALUES', 'VERTEX', 'WHEN', 'WHERE', 'WHILE', 'WITH'), prefix=r'(?|<-', Operator), + (r'[.*{}]', Punctuation), + ], + 'strings': [ + (r'"(?:\\[tbnrf\'"\\]|[^\\"])*"', String), + (r'@{1,2}\w+', Name.Variable), + (r'(\<\w+)?\<(\w+\>?\,?\s?)+\>+', Name.Constant), + ], + 'whitespace': [ + (r'\s+', Whitespace), + ], + 'barewords': [ + (r'[a-z]\w*', Name), + (r'(\d+\.\d+|\d+)', Number), + ], + 'operators': [ + (r'[^0-9|\/|\-](\-\=|\+\=|\*\=|\\\=|\=|\=\=|\=\=\=|\+|\-|\*|\\|\+\=|\>|\<)[^\>|\/]', Operator), + (r'(\(|\)|\,|\;|\=|\-|\+|\*|\/|\>|\<|\:)', Operator), + ], + } diff --git a/pygments/lexers/javascript.py b/pygments/lexers/javascript.py index f04d42d..7ddd114 100644 --- a/pygments/lexers/javascript.py +++ b/pygments/lexers/javascript.py @@ -10,16 +10,17 @@ import re -from pygments.lexer import RegexLexer, include, bygroups, default, using, \ - this, words, combined +from pygments.lexer import bygroups, combined, default, do_insertions, include, \ + inherit, Lexer, RegexLexer, this, using, words from pygments.token import Text, Comment, Operator, Keyword, Name, String, \ - Number, Punctuation, Other + Number, Punctuation, Other, Generic from pygments.util import get_bool_opt import pygments.unistring as uni __all__ = ['JavascriptLexer', 'KalLexer', 'LiveScriptLexer', 'DartLexer', 'TypeScriptLexer', 'LassoLexer', 'ObjectiveJLexer', - 'CoffeeScriptLexer', 'MaskLexer', 'EarlGreyLexer', 'JuttleLexer'] + 'CoffeeScriptLexer', 'MaskLexer', 'EarlGreyLexer', 'JuttleLexer', + 'NodeConsoleLexer'] JS_IDENT_START = ('(?:[$_' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl') + ']|\\\\u[a-fA-F0-9]{4})') @@ -28,6 +29,7 @@ JS_IDENT_PART = ('(?:[$' + uni.combine('Lu', 'Ll', 'Lt', 'Lm', 'Lo', 'Nl', '\u200c\u200d]|\\\\u[a-fA-F0-9]{4})') JS_IDENT = JS_IDENT_START + '(?:' + JS_IDENT_PART + ')*' +line_re = re.compile('.*?\n') class JavascriptLexer(RegexLexer): """ @@ -52,7 +54,7 @@ class JavascriptLexer(RegexLexer): 'slashstartsregex': [ include('commentsandwhitespace'), (r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/' - r'([gimuys]+\b|\B)', String.Regex, '#pop'), + r'([gimuysd]+\b|\B)', String.Regex, '#pop'), (r'(?=/)', Text, ('#pop', 'badregex')), default('#pop') ], @@ -75,23 +77,43 @@ class JavascriptLexer(RegexLexer): (r'(\.[0-9]+|[0-9]+\.[0-9]*|[0-9]+)([eE][-+]?[0-9]+)?', Number.Float), (r'\.\.\.|=>', Punctuation), - (r'\+\+|--|~|&&|\?|:|\|\||\\(?=\n)|' - r'(<<|>>>?|==?|!=?|[-<>+*%&|^/])=?', Operator, 'slashstartsregex'), + (r'\+\+|--|~|\?\?=?|\?|:|\\(?=\n)|' + r'(<<|>>>?|==?|!=?|(?:\*\*|\|\||&&|[-<>+*%&|^/]))=?', Operator, 'slashstartsregex'), (r'[{(\[;,]', Punctuation, 'slashstartsregex'), (r'[})\].]', Punctuation), + + (r'(typeof|instanceof|in|void|delete|new)\b', Operator.Word, 'slashstartsregex'), + + # Match stuff like: constructor + (r'\b(constructor|from|as)\b', Keyword.Reserved), + (r'(for|in|while|do|break|return|continue|switch|case|default|if|else|' - r'throw|try|catch|finally|new|delete|typeof|instanceof|void|yield|await|async|' - r'this|of|static|export|import|from|as|debugger|extends|super)\b', Keyword, 'slashstartsregex'), + r'throw|try|catch|finally|yield|await|async|this|of|static|export|' + r'import|debugger|extends|super)\b', Keyword, 'slashstartsregex'), (r'(var|let|const|with|function|class)\b', Keyword.Declaration, 'slashstartsregex'), - (r'(abstract|boolean|byte|char|double|enum|final|float|goto' - r'implements|int|interface|long|native|package|private|protected' + + (r'(abstract|boolean|byte|char|double|enum|final|float|goto|' + r'implements|int|interface|long|native|package|private|protected|' r'public|short|synchronized|throws|transient|volatile)\b', Keyword.Reserved), (r'(true|false|null|NaN|Infinity|undefined)\b', Keyword.Constant), - (r'(Array|Boolean|Date|BigInt|Error|Function|Math|' + + (r'(Array|Boolean|Date|BigInt|Function|Math|ArrayBuffer|' r'Number|Object|RegExp|String|Promise|Proxy|decodeURI|' r'decodeURIComponent|encodeURI|encodeURIComponent|' - r'Error|eval|isFinite|isNaN|isSafeInteger|parseFloat|parseInt|' - r'document|this|window|globalThis|Symbol)\b', Name.Builtin), + r'eval|isFinite|isNaN|parseFloat|parseInt|DataView|' + r'document|window|globalThis|global|Symbol|Intl|' + r'WeakSet|WeakMap|Set|Map|Reflect|JSON|Atomics|' + r'Int(?:8|16|32)Array|BigInt64Array|Float32Array|Float64Array|' + r'Uint8ClampedArray|Uint(?:8|16|32)Array|BigUint64Array)\b', Name.Builtin), + + (r'((?:Eval|Internal|Range|Reference|Syntax|Type|URI)?Error)\b', Name.Exception), + + # Match stuff like: super(argument, list) + (r'(super)(\s*)(\([\w,?.$\s]+\s*\))', + bygroups(Keyword, Text), 'slashstartsregex'), + # Match stuff like: function() {...} + (r'([a-zA-Z_?.$][\w?.$]*)(?=\(\) \{)', Name.Other, 'slashstartsregex'), + (JS_IDENT, Name.Other), (r'"(\\\\|\\[^\\]|[^"\\])*"', String.Double), (r"'(\\\\|\\[^\\]|[^'\\])*'", String.Single), @@ -112,6 +134,43 @@ class JavascriptLexer(RegexLexer): } +class TypeScriptLexer(JavascriptLexer): + """ + For `TypeScript `_ source code. + + .. versionadded:: 1.6 + """ + + name = 'TypeScript' + aliases = ['typescript', 'ts'] + filenames = ['*.ts'] + mimetypes = ['application/x-typescript', 'text/x-typescript'] + + # Higher priority than the TypoScriptLexer, as TypeScript is far more + # common these days + priority = 0.5 + + tokens = { + 'root': [ + (r'(abstract|implements|private|protected|public|readonly)\b', + Keyword, 'slashstartsregex'), + (r'(enum|interface|override)\b', Keyword.Declaration, 'slashstartsregex'), + (r'\b(declare|type)\b', Keyword.Reserved), + # Match variable type keywords + (r'\b(string|boolean|number)\b', Keyword.Type), + # Match stuff like: module name {...} + (r'\b(module)(\s*)(\s*[\w?.$][\w?.$]*)(\s*)', + bygroups(Keyword.Reserved, Text, Name.Other, Text), 'slashstartsregex'), + # Match stuff like: (function: return type) + (r'([\w?.$][\w?.$]*)(\s*:\s*)([\w?.$][\w?.$]*)', + bygroups(Name.Other, Text, Keyword.Type)), + # Match stuff like: Decorators + (r'@' + JS_IDENT, Keyword.Declaration), + inherit, + ], + } + + class KalLexer(RegexLexer): """ For `Kal`_ source code. @@ -157,7 +216,7 @@ class KalLexer(RegexLexer): 'root': [ include('commentsandwhitespace'), (r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/' - r'([gimuys]+\b|\B)', String.Regex), + r'([gimuysd]+\b|\B)', String.Regex), (r'\?|:|_(?=\n)|==?|!=|-(?!>)|[<>+*/-]=?', Operator), (r'\b(and|or|isnt|is|not|but|bitwise|mod|\^|xor|exists|' @@ -250,7 +309,7 @@ class LiveScriptLexer(RegexLexer): ], 'multilineregex': [ include('commentsandwhitespace'), - (r'//([gimuys]+\b|\B)', String.Regex, '#pop'), + (r'//([gimuysd]+\b|\B)', String.Regex, '#pop'), (r'/', String.Regex), (r'[^/#]+', String.Regex) ], @@ -258,7 +317,7 @@ class LiveScriptLexer(RegexLexer): include('commentsandwhitespace'), (r'//', String.Regex, ('#pop', 'multilineregex')), (r'/(?! )(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/' - r'([gimuys]+\b|\B)', String.Regex, '#pop'), + r'([gimuysd]+\b|\B)', String.Regex, '#pop'), (r'/', Operator, '#pop'), default('#pop'), ], @@ -441,108 +500,6 @@ class DartLexer(RegexLexer): } -class TypeScriptLexer(RegexLexer): - """ - For `TypeScript `_ source code. - - .. versionadded:: 1.6 - """ - - name = 'TypeScript' - aliases = ['typescript', 'ts'] - filenames = ['*.ts', '*.tsx'] - mimetypes = ['text/x-typescript'] - - flags = re.DOTALL | re.MULTILINE - - # Higher priority than the TypoScriptLexer, as TypeScript is far more - # common these days - priority = 0.5 - - tokens = { - 'commentsandwhitespace': [ - (r'\s+', Text), - (r'