pygments.rb 2.3.1 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +1 -1
- data/.rubocop.yml +7 -0
- data/CHANGELOG.adoc +4 -0
- data/README.adoc +1 -1
- data/bench.rb +1 -1
- data/lib/pygments/popen.rb +3 -7
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +2 -2
- data/test/test_pygments.rb +0 -19
- data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/AUTHORS +21 -1
- data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/LICENSE +1 -1
- data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/METADATA +19 -11
- data/vendor/pygments-main/Pygments-2.15.1.dist-info/RECORD +614 -0
- data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/WHEEL +1 -1
- data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/entry_points.txt +0 -1
- data/vendor/pygments-main/bin/pygmentize +1 -1
- data/vendor/pygments-main/pygments/__init__.py +20 -22
- data/vendor/pygments-main/pygments/__main__.py +1 -1
- data/vendor/pygments-main/pygments/cmdline.py +74 -8
- data/vendor/pygments-main/pygments/console.py +1 -1
- data/vendor/pygments-main/pygments/filter.py +1 -1
- data/vendor/pygments-main/pygments/filters/__init__.py +6 -3
- data/vendor/pygments-main/pygments/formatter.py +41 -11
- data/vendor/pygments-main/pygments/formatters/__init__.py +21 -16
- data/vendor/pygments-main/pygments/formatters/_mapping.py +5 -65
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/groff.py +170 -0
- data/vendor/pygments-main/pygments/formatters/html.py +54 -32
- data/vendor/pygments-main/pygments/formatters/img.py +9 -5
- data/vendor/pygments-main/pygments/formatters/irc.py +6 -33
- data/vendor/pygments-main/pygments/formatters/latex.py +24 -14
- data/vendor/pygments-main/pygments/formatters/other.py +1 -1
- data/vendor/pygments-main/pygments/formatters/pangomarkup.py +1 -1
- data/vendor/pygments-main/pygments/formatters/rtf.py +1 -1
- data/vendor/pygments-main/pygments/formatters/svg.py +1 -1
- data/vendor/pygments-main/pygments/formatters/terminal.py +1 -3
- data/vendor/pygments-main/pygments/formatters/terminal256.py +2 -4
- data/vendor/pygments-main/pygments/lexer.py +101 -32
- data/vendor/pygments-main/pygments/lexers/__init__.py +50 -29
- data/vendor/pygments-main/pygments/lexers/_ada_builtins.py +103 -0
- data/vendor/pygments-main/pygments/lexers/_asy_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_cl_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +2 -2
- data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +21 -6
- data/vendor/pygments-main/pygments/lexers/_css_builtins.py +558 -0
- data/vendor/pygments-main/pygments/lexers/_julia_builtins.py +10 -0
- data/vendor/pygments-main/pygments/lexers/_lasso_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_lilypond_builtins.py +4932 -0
- data/vendor/pygments-main/pygments/lexers/_lua_builtins.py +11 -18
- data/vendor/pygments-main/pygments/lexers/_mapping.py +71 -82
- data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_mysql_builtins.py +58 -4
- data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_php_builtins.py +408 -1835
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +70 -8
- data/vendor/pygments-main/pygments/lexers/_qlik_builtins.py +666 -0
- data/vendor/pygments-main/pygments/lexers/_scheme_builtins.py +1609 -0
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +3 -3
- data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +9 -18
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +185 -94
- data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_usd_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_vbscript_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/actionscript.py +15 -14
- data/vendor/pygments-main/pygments/lexers/ada.py +144 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +1 -1
- data/vendor/pygments-main/pygments/lexers/algebra.py +72 -9
- data/vendor/pygments-main/pygments/lexers/ambient.py +8 -7
- data/vendor/pygments-main/pygments/lexers/amdgpu.py +4 -3
- data/vendor/pygments-main/pygments/lexers/ampl.py +10 -8
- data/vendor/pygments-main/pygments/lexers/apdlexer.py +164 -20
- data/vendor/pygments-main/pygments/lexers/apl.py +6 -5
- data/vendor/pygments-main/pygments/lexers/archetype.py +23 -21
- data/vendor/pygments-main/pygments/lexers/arrow.py +10 -9
- data/vendor/pygments-main/pygments/lexers/arturo.py +250 -0
- data/vendor/pygments-main/pygments/lexers/asc.py +9 -5
- data/vendor/pygments-main/pygments/lexers/asm.py +68 -63
- data/vendor/pygments-main/pygments/lexers/automation.py +7 -5
- data/vendor/pygments-main/pygments/lexers/bare.py +20 -21
- data/vendor/pygments-main/pygments/lexers/basic.py +45 -41
- data/vendor/pygments-main/pygments/lexers/bdd.py +58 -0
- data/vendor/pygments-main/pygments/lexers/berry.py +99 -0
- data/vendor/pygments-main/pygments/lexers/bibtex.py +6 -6
- data/vendor/pygments-main/pygments/lexers/boa.py +4 -8
- data/vendor/pygments-main/pygments/lexers/business.py +18 -18
- data/vendor/pygments-main/pygments/lexers/c_cpp.py +80 -40
- data/vendor/pygments-main/pygments/lexers/c_like.py +21 -19
- data/vendor/pygments-main/pygments/lexers/capnproto.py +6 -8
- data/vendor/pygments-main/pygments/lexers/carbon.py +96 -0
- data/vendor/pygments-main/pygments/lexers/cddl.py +16 -33
- data/vendor/pygments-main/pygments/lexers/chapel.py +14 -9
- data/vendor/pygments-main/pygments/lexers/clean.py +3 -2
- data/vendor/pygments-main/pygments/lexers/comal.py +80 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +3 -2
- data/vendor/pygments-main/pygments/lexers/configs.py +235 -120
- data/vendor/pygments-main/pygments/lexers/console.py +5 -4
- data/vendor/pygments-main/pygments/lexers/cplint.py +44 -0
- data/vendor/pygments-main/pygments/lexers/crystal.py +22 -23
- data/vendor/pygments-main/pygments/lexers/csound.py +19 -17
- data/vendor/pygments-main/pygments/lexers/css.py +67 -159
- data/vendor/pygments-main/pygments/lexers/d.py +15 -12
- data/vendor/pygments-main/pygments/lexers/dalvik.py +14 -11
- data/vendor/pygments-main/pygments/lexers/data.py +119 -49
- data/vendor/pygments-main/pygments/lexers/dax.py +136 -0
- data/vendor/pygments-main/pygments/lexers/devicetree.py +9 -8
- data/vendor/pygments-main/pygments/lexers/diff.py +23 -19
- data/vendor/pygments-main/pygments/lexers/dotnet.py +216 -81
- data/vendor/pygments-main/pygments/lexers/dsls.py +86 -64
- data/vendor/pygments-main/pygments/lexers/dylan.py +16 -15
- data/vendor/pygments-main/pygments/lexers/ecl.py +46 -38
- data/vendor/pygments-main/pygments/lexers/eiffel.py +15 -10
- data/vendor/pygments-main/pygments/lexers/elm.py +12 -8
- data/vendor/pygments-main/pygments/lexers/elpi.py +165 -0
- data/vendor/pygments-main/pygments/lexers/email.py +21 -39
- data/vendor/pygments-main/pygments/lexers/erlang.py +21 -22
- data/vendor/pygments-main/pygments/lexers/esoteric.py +28 -30
- data/vendor/pygments-main/pygments/lexers/ezhil.py +10 -9
- data/vendor/pygments-main/pygments/lexers/factor.py +104 -83
- data/vendor/pygments-main/pygments/lexers/fantom.py +31 -29
- data/vendor/pygments-main/pygments/lexers/felix.py +18 -14
- data/vendor/pygments-main/pygments/lexers/fift.py +67 -0
- data/vendor/pygments-main/pygments/lexers/floscript.py +7 -7
- data/vendor/pygments-main/pygments/lexers/forth.py +8 -6
- data/vendor/pygments-main/pygments/lexers/fortran.py +16 -11
- data/vendor/pygments-main/pygments/lexers/foxpro.py +2 -2
- data/vendor/pygments-main/pygments/lexers/freefem.py +7 -10
- data/vendor/pygments-main/pygments/lexers/func.py +108 -0
- data/vendor/pygments-main/pygments/lexers/functional.py +1 -1
- data/vendor/pygments-main/pygments/lexers/futhark.py +12 -17
- data/vendor/pygments-main/pygments/lexers/gcodelexer.py +1 -2
- data/vendor/pygments-main/pygments/lexers/gdscript.py +76 -233
- data/vendor/pygments-main/pygments/lexers/go.py +12 -14
- data/vendor/pygments-main/pygments/lexers/grammar_notation.py +22 -26
- data/vendor/pygments-main/pygments/lexers/graph.py +36 -15
- data/vendor/pygments-main/pygments/lexers/graphics.py +37 -38
- data/vendor/pygments-main/pygments/lexers/graphviz.py +2 -1
- data/vendor/pygments-main/pygments/lexers/gsql.py +39 -27
- data/vendor/pygments-main/pygments/lexers/haskell.py +73 -71
- data/vendor/pygments-main/pygments/lexers/haxe.py +13 -11
- data/vendor/pygments-main/pygments/lexers/hdl.py +31 -34
- data/vendor/pygments-main/pygments/lexers/hexdump.py +21 -21
- data/vendor/pygments-main/pygments/lexers/html.py +11 -19
- data/vendor/pygments-main/pygments/lexers/idl.py +10 -5
- data/vendor/pygments-main/pygments/lexers/igor.py +3 -2
- data/vendor/pygments-main/pygments/lexers/inferno.py +9 -8
- data/vendor/pygments-main/pygments/lexers/installers.py +39 -33
- data/vendor/pygments-main/pygments/lexers/int_fiction.py +35 -20
- data/vendor/pygments-main/pygments/lexers/iolang.py +9 -9
- data/vendor/pygments-main/pygments/lexers/j.py +20 -13
- data/vendor/pygments-main/pygments/lexers/javascript.py +183 -149
- data/vendor/pygments-main/pygments/lexers/jmespath.py +68 -0
- data/vendor/pygments-main/pygments/lexers/jslt.py +4 -3
- data/vendor/pygments-main/pygments/lexers/jsonnet.py +168 -0
- data/vendor/pygments-main/pygments/lexers/julia.py +44 -32
- data/vendor/pygments-main/pygments/lexers/jvm.py +161 -140
- data/vendor/pygments-main/pygments/lexers/kuin.py +93 -59
- data/vendor/pygments-main/pygments/lexers/lilypond.py +226 -0
- data/vendor/pygments-main/pygments/lexers/lisp.py +244 -107
- data/vendor/pygments-main/pygments/lexers/macaulay2.py +1739 -0
- data/vendor/pygments-main/pygments/lexers/make.py +21 -16
- data/vendor/pygments-main/pygments/lexers/markup.py +752 -11
- data/vendor/pygments-main/pygments/lexers/math.py +1 -1
- data/vendor/pygments-main/pygments/lexers/matlab.py +18 -3
- data/vendor/pygments-main/pygments/lexers/maxima.py +85 -0
- data/vendor/pygments-main/pygments/lexers/meson.py +10 -25
- data/vendor/pygments-main/pygments/lexers/mime.py +2 -2
- data/vendor/pygments-main/pygments/lexers/minecraft.py +394 -0
- data/vendor/pygments-main/pygments/lexers/mips.py +128 -0
- data/vendor/pygments-main/pygments/lexers/ml.py +9 -6
- data/vendor/pygments-main/pygments/lexers/modeling.py +12 -8
- data/vendor/pygments-main/pygments/lexers/modula2.py +3 -2
- data/vendor/pygments-main/pygments/lexers/monte.py +3 -2
- data/vendor/pygments-main/pygments/lexers/mosel.py +1 -1
- data/vendor/pygments-main/pygments/lexers/ncl.py +1 -1
- data/vendor/pygments-main/pygments/lexers/nimrod.py +62 -20
- data/vendor/pygments-main/pygments/lexers/nit.py +3 -2
- data/vendor/pygments-main/pygments/lexers/nix.py +5 -5
- data/vendor/pygments-main/pygments/lexers/oberon.py +2 -2
- data/vendor/pygments-main/pygments/lexers/objective.py +6 -4
- data/vendor/pygments-main/pygments/lexers/ooc.py +3 -2
- data/vendor/pygments-main/pygments/lexers/other.py +1 -1
- data/vendor/pygments-main/pygments/lexers/parasail.py +3 -2
- data/vendor/pygments-main/pygments/lexers/parsers.py +23 -21
- data/vendor/pygments-main/pygments/lexers/pascal.py +196 -198
- data/vendor/pygments-main/pygments/lexers/pawn.py +1 -1
- data/vendor/pygments-main/pygments/lexers/perl.py +17 -15
- data/vendor/pygments-main/pygments/lexers/phix.py +364 -0
- data/vendor/pygments-main/pygments/lexers/php.py +35 -20
- data/vendor/pygments-main/pygments/lexers/pointless.py +3 -2
- data/vendor/pygments-main/pygments/lexers/pony.py +1 -1
- data/vendor/pygments-main/pygments/lexers/praat.py +41 -38
- data/vendor/pygments-main/pygments/lexers/procfile.py +2 -3
- data/vendor/pygments-main/pygments/lexers/prolog.py +7 -8
- data/vendor/pygments-main/pygments/lexers/promql.py +5 -12
- data/vendor/pygments-main/pygments/lexers/python.py +145 -119
- data/vendor/pygments-main/pygments/lexers/q.py +188 -0
- data/vendor/pygments-main/pygments/lexers/qlik.py +117 -0
- data/vendor/pygments-main/pygments/lexers/qvt.py +1 -1
- data/vendor/pygments-main/pygments/lexers/r.py +4 -4
- data/vendor/pygments-main/pygments/lexers/rdf.py +3 -3
- data/vendor/pygments-main/pygments/lexers/rebol.py +1 -12
- data/vendor/pygments-main/pygments/lexers/resource.py +1 -1
- data/vendor/pygments-main/pygments/lexers/ride.py +3 -2
- data/vendor/pygments-main/pygments/lexers/rita.py +43 -0
- data/vendor/pygments-main/pygments/lexers/rnc.py +3 -2
- data/vendor/pygments-main/pygments/lexers/roboconf.py +3 -3
- data/vendor/pygments-main/pygments/lexers/robotframework.py +6 -5
- data/vendor/pygments-main/pygments/lexers/ruby.py +24 -24
- data/vendor/pygments-main/pygments/lexers/rust.py +3 -2
- data/vendor/pygments-main/pygments/lexers/sas.py +2 -2
- data/vendor/pygments-main/pygments/lexers/savi.py +170 -0
- data/vendor/pygments-main/pygments/lexers/scdoc.py +4 -7
- data/vendor/pygments-main/pygments/lexers/scripting.py +24 -21
- data/vendor/pygments-main/pygments/lexers/sgf.py +6 -6
- data/vendor/pygments-main/pygments/lexers/shell.py +29 -21
- data/vendor/pygments-main/pygments/lexers/sieve.py +14 -4
- data/vendor/pygments-main/pygments/lexers/slash.py +1 -1
- data/vendor/pygments-main/pygments/lexers/smalltalk.py +5 -3
- data/vendor/pygments-main/pygments/lexers/smithy.py +5 -6
- data/vendor/pygments-main/pygments/lexers/smv.py +1 -1
- data/vendor/pygments-main/pygments/lexers/snobol.py +1 -1
- data/vendor/pygments-main/pygments/lexers/solidity.py +3 -7
- data/vendor/pygments-main/pygments/lexers/sophia.py +103 -0
- data/vendor/pygments-main/pygments/lexers/special.py +2 -5
- data/vendor/pygments-main/pygments/lexers/spice.py +71 -0
- data/vendor/pygments-main/pygments/lexers/sql.py +212 -17
- data/vendor/pygments-main/pygments/lexers/srcinfo.py +62 -0
- data/vendor/pygments-main/pygments/lexers/stata.py +4 -3
- data/vendor/pygments-main/pygments/lexers/supercollider.py +4 -3
- data/vendor/pygments-main/pygments/lexers/tal.py +74 -0
- data/vendor/pygments-main/pygments/lexers/tcl.py +21 -16
- data/vendor/pygments-main/pygments/lexers/teal.py +9 -8
- data/vendor/pygments-main/pygments/lexers/templates.py +62 -29
- data/vendor/pygments-main/pygments/lexers/teraterm.py +12 -20
- data/vendor/pygments-main/pygments/lexers/testing.py +6 -2
- data/vendor/pygments-main/pygments/lexers/text.py +3 -2
- data/vendor/pygments-main/pygments/lexers/textedit.py +41 -7
- data/vendor/pygments-main/pygments/lexers/textfmts.py +7 -5
- data/vendor/pygments-main/pygments/lexers/theorem.py +42 -36
- data/vendor/pygments-main/pygments/lexers/thingsdb.py +2 -4
- data/vendor/pygments-main/pygments/lexers/tlb.py +57 -0
- data/vendor/pygments-main/pygments/lexers/tnt.py +3 -4
- data/vendor/pygments-main/pygments/lexers/trafficscript.py +2 -4
- data/vendor/pygments-main/pygments/lexers/typoscript.py +2 -3
- data/vendor/pygments-main/pygments/lexers/ul4.py +267 -0
- data/vendor/pygments-main/pygments/lexers/unicon.py +1 -1
- data/vendor/pygments-main/pygments/lexers/urbi.py +4 -4
- data/vendor/pygments-main/pygments/lexers/usd.py +2 -1
- data/vendor/pygments-main/pygments/lexers/varnish.py +5 -5
- data/vendor/pygments-main/pygments/lexers/verification.py +4 -3
- data/vendor/pygments-main/pygments/lexers/web.py +1 -1
- data/vendor/pygments-main/pygments/lexers/webassembly.py +5 -5
- data/vendor/pygments-main/pygments/lexers/webidl.py +2 -1
- data/vendor/pygments-main/pygments/lexers/webmisc.py +90 -71
- data/vendor/pygments-main/pygments/lexers/wgsl.py +407 -0
- data/vendor/pygments-main/pygments/lexers/whiley.py +2 -1
- data/vendor/pygments-main/pygments/lexers/wowtoc.py +120 -0
- data/vendor/pygments-main/pygments/lexers/wren.py +99 -0
- data/vendor/pygments-main/pygments/lexers/x10.py +5 -6
- data/vendor/pygments-main/pygments/lexers/xorg.py +3 -2
- data/vendor/pygments-main/pygments/lexers/yang.py +6 -5
- data/vendor/pygments-main/pygments/lexers/zig.py +3 -2
- data/vendor/pygments-main/pygments/modeline.py +1 -1
- data/vendor/pygments-main/pygments/plugin.py +28 -9
- data/vendor/pygments-main/pygments/regexopt.py +1 -1
- data/vendor/pygments-main/pygments/scanner.py +2 -2
- data/vendor/pygments-main/pygments/sphinxext.py +63 -1
- data/vendor/pygments-main/pygments/style.py +7 -1
- data/vendor/pygments-main/pygments/styles/__init__.py +19 -5
- data/vendor/pygments-main/pygments/styles/abap.py +2 -2
- data/vendor/pygments-main/pygments/styles/algol.py +1 -2
- data/vendor/pygments-main/pygments/styles/algol_nu.py +1 -2
- data/vendor/pygments-main/pygments/styles/arduino.py +2 -3
- data/vendor/pygments-main/pygments/styles/autumn.py +1 -3
- data/vendor/pygments-main/pygments/styles/borland.py +1 -3
- data/vendor/pygments-main/pygments/styles/bw.py +1 -2
- data/vendor/pygments-main/pygments/styles/colorful.py +1 -3
- data/vendor/pygments-main/pygments/styles/default.py +13 -14
- data/vendor/pygments-main/pygments/styles/dracula.py +102 -0
- data/vendor/pygments-main/pygments/styles/emacs.py +1 -2
- data/vendor/pygments-main/pygments/styles/friendly.py +1 -2
- data/vendor/pygments-main/pygments/styles/friendly_grayscale.py +75 -0
- data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
- data/vendor/pygments-main/pygments/styles/gh_dark.py +107 -0
- data/vendor/pygments-main/pygments/styles/gruvbox.py +4 -2
- data/vendor/pygments-main/pygments/styles/igor.py +1 -2
- data/vendor/pygments-main/pygments/styles/inkpot.py +3 -2
- data/vendor/pygments-main/pygments/styles/lilypond.py +56 -0
- data/vendor/pygments-main/pygments/styles/lovelace.py +1 -3
- data/vendor/pygments-main/pygments/styles/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/material.py +1 -2
- data/vendor/pygments-main/pygments/styles/monokai.py +3 -3
- data/vendor/pygments-main/pygments/styles/murphy.py +1 -3
- data/vendor/pygments-main/pygments/styles/native.py +11 -11
- data/vendor/pygments-main/pygments/styles/nord.py +150 -0
- data/vendor/pygments-main/pygments/styles/onedark.py +59 -0
- data/vendor/pygments-main/pygments/styles/paraiso_dark.py +1 -6
- data/vendor/pygments-main/pygments/styles/paraiso_light.py +1 -6
- data/vendor/pygments-main/pygments/styles/pastie.py +1 -3
- data/vendor/pygments-main/pygments/styles/perldoc.py +1 -2
- data/vendor/pygments-main/pygments/styles/rainbow_dash.py +3 -3
- data/vendor/pygments-main/pygments/styles/rrt.py +3 -2
- data/vendor/pygments-main/pygments/styles/sas.py +2 -4
- data/vendor/pygments-main/pygments/styles/solarized.py +1 -1
- data/vendor/pygments-main/pygments/styles/staroffice.py +26 -0
- data/vendor/pygments-main/pygments/styles/stata_dark.py +4 -6
- data/vendor/pygments-main/pygments/styles/stata_light.py +1 -2
- data/vendor/pygments-main/pygments/styles/tango.py +2 -3
- data/vendor/pygments-main/pygments/styles/trac.py +1 -3
- data/vendor/pygments-main/pygments/styles/vim.py +1 -2
- data/vendor/pygments-main/pygments/styles/vs.py +1 -2
- data/vendor/pygments-main/pygments/styles/xcode.py +1 -3
- data/vendor/pygments-main/pygments/styles/zenburn.py +4 -6
- data/vendor/pygments-main/pygments/token.py +2 -1
- data/vendor/pygments-main/pygments/unistring.py +4 -6
- data/vendor/pygments-main/pygments/util.py +27 -5
- metadata +59 -14
- data/vendor/pygments-main/Pygments-2.10.0.dist-info/RECORD +0 -524
- /data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/INSTALLER +0 -0
- /data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/REQUESTED +0 -0
- /data/vendor/pygments-main/{Pygments-2.10.0.dist-info → Pygments-2.15.1.dist-info}/top_level.txt +0 -0
@@ -4,29 +4,28 @@
|
|
4
4
|
|
5
5
|
Lexers for Python and related languages.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
11
11
|
import re
|
12
|
+
import keyword
|
12
13
|
|
13
|
-
from pygments.lexer import Lexer, RegexLexer, include,
|
14
|
-
default, words, combined, do_insertions
|
14
|
+
from pygments.lexer import DelegatingLexer, Lexer, RegexLexer, include, \
|
15
|
+
bygroups, using, default, words, combined, do_insertions, this, line_re
|
15
16
|
from pygments.util import get_bool_opt, shebang_matches
|
16
17
|
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
17
|
-
Number, Punctuation, Generic, Other, Error
|
18
|
+
Number, Punctuation, Generic, Other, Error, Whitespace
|
18
19
|
from pygments import unistring as uni
|
19
20
|
|
20
21
|
__all__ = ['PythonLexer', 'PythonConsoleLexer', 'PythonTracebackLexer',
|
21
22
|
'Python2Lexer', 'Python2TracebackLexer',
|
22
23
|
'CythonLexer', 'DgLexer', 'NumPyLexer']
|
23
24
|
|
24
|
-
line_re = re.compile('.*?\n')
|
25
|
-
|
26
25
|
|
27
26
|
class PythonLexer(RegexLexer):
|
28
27
|
"""
|
29
|
-
For
|
28
|
+
For Python source code (version 3.x).
|
30
29
|
|
31
30
|
.. versionadded:: 0.10
|
32
31
|
|
@@ -36,10 +35,13 @@ class PythonLexer(RegexLexer):
|
|
36
35
|
"""
|
37
36
|
|
38
37
|
name = 'Python'
|
38
|
+
url = 'http://www.python.org'
|
39
39
|
aliases = ['python', 'py', 'sage', 'python3', 'py3']
|
40
40
|
filenames = [
|
41
41
|
'*.py',
|
42
42
|
'*.pyw',
|
43
|
+
# Type stubs
|
44
|
+
'*.pyi',
|
43
45
|
# Jython
|
44
46
|
'*.jy',
|
45
47
|
# Sage
|
@@ -60,8 +62,6 @@ class PythonLexer(RegexLexer):
|
|
60
62
|
mimetypes = ['text/x-python', 'application/x-python',
|
61
63
|
'text/x-python3', 'application/x-python3']
|
62
64
|
|
63
|
-
flags = re.MULTILINE | re.UNICODE
|
64
|
-
|
65
65
|
uni_name = "[%s][%s]*" % (uni.xid_start, uni.xid_continue)
|
66
66
|
|
67
67
|
def innerstring_rules(ttype):
|
@@ -100,16 +100,17 @@ class PythonLexer(RegexLexer):
|
|
100
100
|
|
101
101
|
tokens = {
|
102
102
|
'root': [
|
103
|
-
(r'\n',
|
103
|
+
(r'\n', Whitespace),
|
104
104
|
(r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")',
|
105
|
-
bygroups(
|
105
|
+
bygroups(Whitespace, String.Affix, String.Doc)),
|
106
106
|
(r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')",
|
107
|
-
bygroups(
|
107
|
+
bygroups(Whitespace, String.Affix, String.Doc)),
|
108
108
|
(r'\A#!.+$', Comment.Hashbang),
|
109
109
|
(r'#.*$', Comment.Single),
|
110
110
|
(r'\\\n', Text),
|
111
111
|
(r'\\', Text),
|
112
112
|
include('keywords'),
|
113
|
+
include('soft-keywords'),
|
113
114
|
(r'(def)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'funcname'),
|
114
115
|
(r'(class)((?:\s|\\\s)+)', bygroups(Keyword, Text), 'classname'),
|
115
116
|
(r'(from)((?:\s|\\\s)+)', bygroups(Keyword.Namespace, Text),
|
@@ -141,7 +142,7 @@ class PythonLexer(RegexLexer):
|
|
141
142
|
combined('fstringescape', 'dqf')),
|
142
143
|
("([fF])(')", bygroups(String.Affix, String.Single),
|
143
144
|
combined('fstringescape', 'sqf')),
|
144
|
-
# raw strings
|
145
|
+
# raw bytes and strings
|
145
146
|
('(?i)(rb|br|r)(""")',
|
146
147
|
bygroups(String.Affix, String.Double), 'tdqs'),
|
147
148
|
("(?i)(rb|br|r)(''')",
|
@@ -151,14 +152,24 @@ class PythonLexer(RegexLexer):
|
|
151
152
|
("(?i)(rb|br|r)(')",
|
152
153
|
bygroups(String.Affix, String.Single), 'sqs'),
|
153
154
|
# non-raw strings
|
154
|
-
('([
|
155
|
+
('([uU]?)(""")', bygroups(String.Affix, String.Double),
|
155
156
|
combined('stringescape', 'tdqs')),
|
156
|
-
("([
|
157
|
+
("([uU]?)(''')", bygroups(String.Affix, String.Single),
|
157
158
|
combined('stringescape', 'tsqs')),
|
158
|
-
('([
|
159
|
+
('([uU]?)(")', bygroups(String.Affix, String.Double),
|
159
160
|
combined('stringescape', 'dqs')),
|
160
|
-
("([
|
161
|
+
("([uU]?)(')", bygroups(String.Affix, String.Single),
|
161
162
|
combined('stringescape', 'sqs')),
|
163
|
+
# non-raw bytes
|
164
|
+
('([bB])(""")', bygroups(String.Affix, String.Double),
|
165
|
+
combined('bytesescape', 'tdqs')),
|
166
|
+
("([bB])(''')", bygroups(String.Affix, String.Single),
|
167
|
+
combined('bytesescape', 'tsqs')),
|
168
|
+
('([bB])(")', bygroups(String.Affix, String.Double),
|
169
|
+
combined('bytesescape', 'dqs')),
|
170
|
+
("([bB])(')", bygroups(String.Affix, String.Single),
|
171
|
+
combined('bytesescape', 'sqs')),
|
172
|
+
|
162
173
|
(r'[^\S\n]+', Text),
|
163
174
|
include('numbers'),
|
164
175
|
(r'!=|==|<<|>>|:=|[-~+/*%=<>&^|.]', Operator),
|
@@ -181,13 +192,13 @@ class PythonLexer(RegexLexer):
|
|
181
192
|
(r'(=\s*)?' # debug (https://bugs.python.org/issue36817)
|
182
193
|
r'(\![sraf])?' # conversion
|
183
194
|
r':', String.Interpol, '#pop'),
|
184
|
-
(r'\s+',
|
195
|
+
(r'\s+', Whitespace), # allow new lines
|
185
196
|
include('expr'),
|
186
197
|
],
|
187
198
|
'expr-inside-fstring-inner': [
|
188
199
|
(r'[{([]', Punctuation, 'expr-inside-fstring-inner'),
|
189
200
|
(r'[])}]', Punctuation, '#pop'),
|
190
|
-
(r'\s+',
|
201
|
+
(r'\s+', Whitespace), # allow new lines
|
191
202
|
include('expr'),
|
192
203
|
],
|
193
204
|
'expr-keywords': [
|
@@ -207,18 +218,32 @@ class PythonLexer(RegexLexer):
|
|
207
218
|
Keyword),
|
208
219
|
(words(('True', 'False', 'None'), suffix=r'\b'), Keyword.Constant),
|
209
220
|
],
|
221
|
+
'soft-keywords': [
|
222
|
+
# `match`, `case` and `_` soft keywords
|
223
|
+
(r'(^[ \t]*)' # at beginning of line + possible indentation
|
224
|
+
r'(match|case)\b' # a possible keyword
|
225
|
+
r'(?![ \t]*(?:' # not followed by...
|
226
|
+
r'[:,;=^&|@~)\]}]|(?:' + # characters and keywords that mean this isn't
|
227
|
+
r'|'.join(keyword.kwlist) + r')\b))', # pattern matching
|
228
|
+
bygroups(Text, Keyword), 'soft-keywords-inner'),
|
229
|
+
],
|
230
|
+
'soft-keywords-inner': [
|
231
|
+
# optional `_` keyword
|
232
|
+
(r'(\s+)([^\n_]*)(_\b)', bygroups(Whitespace, using(this), Keyword)),
|
233
|
+
default('#pop')
|
234
|
+
],
|
210
235
|
'builtins': [
|
211
236
|
(words((
|
212
|
-
'__import__', 'abs', 'all', 'any', 'bin', 'bool', 'bytearray',
|
213
|
-
'bytes', '
|
214
|
-
'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval',
|
215
|
-
'float', 'format', 'frozenset', 'getattr', 'globals',
|
216
|
-
'hash', 'hex', 'id', 'input', 'int', 'isinstance',
|
217
|
-
'iter', 'len', 'list', 'locals', 'map', 'max',
|
218
|
-
'min', 'next', 'object', 'oct', 'open', 'ord', 'pow',
|
219
|
-
'property', 'range', 'repr', 'reversed', 'round', 'set',
|
220
|
-
'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super',
|
221
|
-
'type', 'vars', 'zip'), prefix=r'(?<!\.)', suffix=r'\b'),
|
237
|
+
'__import__', 'abs', 'aiter', 'all', 'any', 'bin', 'bool', 'bytearray',
|
238
|
+
'breakpoint', 'bytes', 'callable', 'chr', 'classmethod', 'compile',
|
239
|
+
'complex', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval',
|
240
|
+
'filter', 'float', 'format', 'frozenset', 'getattr', 'globals',
|
241
|
+
'hasattr', 'hash', 'hex', 'id', 'input', 'int', 'isinstance',
|
242
|
+
'issubclass', 'iter', 'len', 'list', 'locals', 'map', 'max',
|
243
|
+
'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow',
|
244
|
+
'print', 'property', 'range', 'repr', 'reversed', 'round', 'set',
|
245
|
+
'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super',
|
246
|
+
'tuple', 'type', 'vars', 'zip'), prefix=r'(?<!\.)', suffix=r'\b'),
|
222
247
|
Name.Builtin),
|
223
248
|
(r'(?<!\.)(self|Ellipsis|NotImplemented|cls)\b', Name.Builtin.Pseudo),
|
224
249
|
(words((
|
@@ -243,7 +268,8 @@ class PythonLexer(RegexLexer):
|
|
243
268
|
'InterruptedError', 'IsADirectoryError', 'NotADirectoryError',
|
244
269
|
'PermissionError', 'ProcessLookupError', 'TimeoutError',
|
245
270
|
# others new in Python 3
|
246
|
-
'StopAsyncIteration', 'ModuleNotFoundError', 'RecursionError'
|
271
|
+
'StopAsyncIteration', 'ModuleNotFoundError', 'RecursionError',
|
272
|
+
'EncodingWarning'),
|
247
273
|
prefix=r'(?<!\.)', suffix=r'\b'),
|
248
274
|
Name.Exception),
|
249
275
|
],
|
@@ -315,7 +341,7 @@ class PythonLexer(RegexLexer):
|
|
315
341
|
(r'\.', Name.Namespace),
|
316
342
|
# if None occurs here, it's "raise x from None", since None can
|
317
343
|
# never be a module name
|
318
|
-
(r'None\b',
|
344
|
+
(r'None\b', Keyword.Constant, '#pop'),
|
319
345
|
(uni_name, Name.Namespace),
|
320
346
|
default('#pop'),
|
321
347
|
],
|
@@ -327,9 +353,12 @@ class PythonLexer(RegexLexer):
|
|
327
353
|
include('rfstringescape'),
|
328
354
|
include('stringescape'),
|
329
355
|
],
|
356
|
+
'bytesescape': [
|
357
|
+
(r'\\([\\abfnrtv"\']|\n|x[a-fA-F0-9]{2}|[0-7]{1,3})', String.Escape)
|
358
|
+
],
|
330
359
|
'stringescape': [
|
331
|
-
(r'\\(
|
332
|
-
|
360
|
+
(r'\\(N\{.*?\}|u[a-fA-F0-9]{4}|U[a-fA-F0-9]{8})', String.Escape),
|
361
|
+
include('bytesescape')
|
333
362
|
],
|
334
363
|
'fstrings-single': fstring_rules(String.Single),
|
335
364
|
'fstrings-double': fstring_rules(String.Double),
|
@@ -387,7 +416,7 @@ Python3Lexer = PythonLexer
|
|
387
416
|
|
388
417
|
class Python2Lexer(RegexLexer):
|
389
418
|
"""
|
390
|
-
For
|
419
|
+
For Python 2.x source code.
|
391
420
|
|
392
421
|
.. versionchanged:: 2.5
|
393
422
|
This class has been renamed from ``PythonLexer``. ``PythonLexer`` now
|
@@ -396,6 +425,7 @@ class Python2Lexer(RegexLexer):
|
|
396
425
|
"""
|
397
426
|
|
398
427
|
name = 'Python 2.x'
|
428
|
+
url = 'http://www.python.org'
|
399
429
|
aliases = ['python2', 'py2']
|
400
430
|
filenames = [] # now taken over by PythonLexer (3.x)
|
401
431
|
mimetypes = ['text/x-python2', 'application/x-python2']
|
@@ -415,11 +445,11 @@ class Python2Lexer(RegexLexer):
|
|
415
445
|
|
416
446
|
tokens = {
|
417
447
|
'root': [
|
418
|
-
(r'\n',
|
448
|
+
(r'\n', Whitespace),
|
419
449
|
(r'^(\s*)([rRuUbB]{,2})("""(?:.|\n)*?""")',
|
420
|
-
bygroups(
|
450
|
+
bygroups(Whitespace, String.Affix, String.Doc)),
|
421
451
|
(r"^(\s*)([rRuUbB]{,2})('''(?:.|\n)*?''')",
|
422
|
-
bygroups(
|
452
|
+
bygroups(Whitespace, String.Affix, String.Doc)),
|
423
453
|
(r'[^\S\n]+', Text),
|
424
454
|
(r'\A#!.+$', Comment.Hashbang),
|
425
455
|
(r'#.*$', Comment.Single),
|
@@ -605,15 +635,50 @@ class Python2Lexer(RegexLexer):
|
|
605
635
|
def analyse_text(text):
|
606
636
|
return shebang_matches(text, r'pythonw?2(\.\d)?')
|
607
637
|
|
638
|
+
class _PythonConsoleLexerBase(RegexLexer):
|
639
|
+
name = 'Python console session'
|
640
|
+
aliases = ['pycon']
|
641
|
+
mimetypes = ['text/x-python-doctest']
|
642
|
+
|
643
|
+
"""Auxiliary lexer for `PythonConsoleLexer`.
|
644
|
+
|
645
|
+
Code tokens are output as ``Token.Other.Code``, traceback tokens as
|
646
|
+
``Token.Other.Traceback``.
|
647
|
+
"""
|
648
|
+
tokens = {
|
649
|
+
'root': [
|
650
|
+
(r'(>>> )(.*\n)', bygroups(Generic.Prompt, Other.Code), 'continuations'),
|
651
|
+
# This happens, e.g., when tracebacks are embedded in documentation;
|
652
|
+
# trailing whitespaces are often stripped in such contexts.
|
653
|
+
(r'(>>>)(\n)', bygroups(Generic.Prompt, Whitespace)),
|
654
|
+
(r'(\^C)?Traceback \(most recent call last\):\n', Other.Traceback, 'traceback'),
|
655
|
+
# SyntaxError starts with this
|
656
|
+
(r' File "[^"]+", line \d+', Other.Traceback, 'traceback'),
|
657
|
+
(r'.*\n', Generic.Output),
|
658
|
+
],
|
659
|
+
'continuations': [
|
660
|
+
(r'(\.\.\. )(.*\n)', bygroups(Generic.Prompt, Other.Code)),
|
661
|
+
# See above.
|
662
|
+
(r'(\.\.\.)(\n)', bygroups(Generic.Prompt, Whitespace)),
|
663
|
+
default('#pop'),
|
664
|
+
],
|
665
|
+
'traceback': [
|
666
|
+
# As soon as we see a traceback, consume everything until the next
|
667
|
+
# >>> prompt.
|
668
|
+
(r'(?=>>>( |$))', Text, '#pop'),
|
669
|
+
(r'(KeyboardInterrupt)(\n)', bygroups(Name.Class, Whitespace)),
|
670
|
+
(r'.*\n', Other.Traceback),
|
671
|
+
],
|
672
|
+
}
|
608
673
|
|
609
|
-
class PythonConsoleLexer(
|
674
|
+
class PythonConsoleLexer(DelegatingLexer):
|
610
675
|
"""
|
611
676
|
For Python console output or doctests, such as:
|
612
677
|
|
613
678
|
.. sourcecode:: pycon
|
614
679
|
|
615
680
|
>>> a = 'foo'
|
616
|
-
>>> print
|
681
|
+
>>> print(a)
|
617
682
|
foo
|
618
683
|
>>> 1 / 0
|
619
684
|
Traceback (most recent call last):
|
@@ -629,70 +694,28 @@ class PythonConsoleLexer(Lexer):
|
|
629
694
|
.. versionchanged:: 2.5
|
630
695
|
Now defaults to ``True``.
|
631
696
|
"""
|
697
|
+
|
632
698
|
name = 'Python console session'
|
633
699
|
aliases = ['pycon']
|
634
700
|
mimetypes = ['text/x-python-doctest']
|
635
701
|
|
636
702
|
def __init__(self, **options):
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
if self.python3:
|
642
|
-
pylexer = PythonLexer(**self.options)
|
643
|
-
tblexer = PythonTracebackLexer(**self.options)
|
703
|
+
python3 = get_bool_opt(options, 'python3', True)
|
704
|
+
if python3:
|
705
|
+
pylexer = PythonLexer
|
706
|
+
tblexer = PythonTracebackLexer
|
644
707
|
else:
|
645
|
-
pylexer = Python2Lexer
|
646
|
-
tblexer = Python2TracebackLexer
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
tb = 0
|
657
|
-
insertions.append((len(curcode),
|
658
|
-
[(0, Generic.Prompt, line[:4])]))
|
659
|
-
curcode += line[4:]
|
660
|
-
elif line.rstrip() == '...' and not tb:
|
661
|
-
# only a new >>> prompt can end an exception block
|
662
|
-
# otherwise an ellipsis in place of the traceback frames
|
663
|
-
# will be mishandled
|
664
|
-
insertions.append((len(curcode),
|
665
|
-
[(0, Generic.Prompt, '...')]))
|
666
|
-
curcode += line[3:]
|
667
|
-
else:
|
668
|
-
if curcode:
|
669
|
-
yield from do_insertions(
|
670
|
-
insertions, pylexer.get_tokens_unprocessed(curcode))
|
671
|
-
curcode = ''
|
672
|
-
insertions = []
|
673
|
-
if (line.startswith('Traceback (most recent call last):') or
|
674
|
-
re.match(' File "[^"]+", line \\d+\\n$', line)):
|
675
|
-
tb = 1
|
676
|
-
curtb = line
|
677
|
-
tbindex = match.start()
|
678
|
-
elif line == 'KeyboardInterrupt\n':
|
679
|
-
yield match.start(), Name.Class, line
|
680
|
-
elif tb:
|
681
|
-
curtb += line
|
682
|
-
if not (line.startswith(' ') or line.strip() == '...'):
|
683
|
-
tb = 0
|
684
|
-
for i, t, v in tblexer.get_tokens_unprocessed(curtb):
|
685
|
-
yield tbindex+i, t, v
|
686
|
-
curtb = ''
|
687
|
-
else:
|
688
|
-
yield match.start(), Generic.Output, line
|
689
|
-
if curcode:
|
690
|
-
yield from do_insertions(insertions,
|
691
|
-
pylexer.get_tokens_unprocessed(curcode))
|
692
|
-
if curtb:
|
693
|
-
for i, t, v in tblexer.get_tokens_unprocessed(curtb):
|
694
|
-
yield tbindex+i, t, v
|
695
|
-
|
708
|
+
pylexer = Python2Lexer
|
709
|
+
tblexer = Python2TracebackLexer
|
710
|
+
# We have two auxiliary lexers. Use DelegatingLexer twice with
|
711
|
+
# different tokens. TODO: DelegatingLexer should support this
|
712
|
+
# directly, by accepting a tuplet of auxiliary lexers and a tuple of
|
713
|
+
# distinguishing tokens. Then we wouldn't need this intermediary
|
714
|
+
# class.
|
715
|
+
class _ReplaceInnerCode(DelegatingLexer):
|
716
|
+
def __init__(self, **options):
|
717
|
+
super().__init__(pylexer, _PythonConsoleLexerBase, Other.Code, **options)
|
718
|
+
super().__init__(tblexer, _ReplaceInnerCode, Other.Traceback, **options)
|
696
719
|
|
697
720
|
class PythonTracebackLexer(RegexLexer):
|
698
721
|
"""
|
@@ -712,8 +735,8 @@ class PythonTracebackLexer(RegexLexer):
|
|
712
735
|
|
713
736
|
tokens = {
|
714
737
|
'root': [
|
715
|
-
(r'\n',
|
716
|
-
(r'^Traceback \(most recent call last\):\n', Generic.Traceback, 'intb'),
|
738
|
+
(r'\n', Whitespace),
|
739
|
+
(r'^(\^C)?Traceback \(most recent call last\):\n', Generic.Traceback, 'intb'),
|
717
740
|
(r'^During handling of the above exception, another '
|
718
741
|
r'exception occurred:\n\n', Generic.Traceback),
|
719
742
|
(r'^The above exception was the direct cause of the '
|
@@ -723,24 +746,25 @@ class PythonTracebackLexer(RegexLexer):
|
|
723
746
|
],
|
724
747
|
'intb': [
|
725
748
|
(r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)',
|
726
|
-
bygroups(Text, Name.Builtin, Text, Number, Text, Name,
|
749
|
+
bygroups(Text, Name.Builtin, Text, Number, Text, Name, Whitespace)),
|
727
750
|
(r'^( File )("[^"]+")(, line )(\d+)(\n)',
|
728
|
-
bygroups(Text, Name.Builtin, Text, Number,
|
751
|
+
bygroups(Text, Name.Builtin, Text, Number, Whitespace)),
|
729
752
|
(r'^( )(.+)(\n)',
|
730
|
-
bygroups(
|
753
|
+
bygroups(Whitespace, using(PythonLexer), Whitespace), 'markers'),
|
731
754
|
(r'^([ \t]*)(\.\.\.)(\n)',
|
732
|
-
bygroups(
|
755
|
+
bygroups(Whitespace, Comment, Whitespace)), # for doctests...
|
733
756
|
(r'^([^:]+)(: )(.+)(\n)',
|
734
|
-
bygroups(Generic.Error, Text, Name,
|
757
|
+
bygroups(Generic.Error, Text, Name, Whitespace), '#pop'),
|
735
758
|
(r'^([a-zA-Z_][\w.]*)(:?\n)',
|
736
|
-
bygroups(Generic.Error,
|
759
|
+
bygroups(Generic.Error, Whitespace), '#pop'),
|
760
|
+
default('#pop'),
|
737
761
|
],
|
738
762
|
'markers': [
|
739
763
|
# Either `PEP 657 <https://www.python.org/dev/peps/pep-0657/>`
|
740
764
|
# error locations in Python 3.11+, or single-caret markers
|
741
765
|
# for syntax errors before that.
|
742
|
-
(r'^( {4,})(
|
743
|
-
bygroups(
|
766
|
+
(r'^( {4,})([~^]+)(\n)',
|
767
|
+
bygroups(Whitespace, Punctuation.Marker, Whitespace),
|
744
768
|
'#pop'),
|
745
769
|
default('#pop'),
|
746
770
|
],
|
@@ -778,17 +802,17 @@ class Python2TracebackLexer(RegexLexer):
|
|
778
802
|
],
|
779
803
|
'intb': [
|
780
804
|
(r'^( File )("[^"]+")(, line )(\d+)(, in )(.+)(\n)',
|
781
|
-
bygroups(Text, Name.Builtin, Text, Number, Text, Name,
|
805
|
+
bygroups(Text, Name.Builtin, Text, Number, Text, Name, Whitespace)),
|
782
806
|
(r'^( File )("[^"]+")(, line )(\d+)(\n)',
|
783
|
-
bygroups(Text, Name.Builtin, Text, Number,
|
807
|
+
bygroups(Text, Name.Builtin, Text, Number, Whitespace)),
|
784
808
|
(r'^( )(.+)(\n)',
|
785
|
-
bygroups(Text, using(Python2Lexer),
|
809
|
+
bygroups(Text, using(Python2Lexer), Whitespace), 'marker'),
|
786
810
|
(r'^([ \t]*)(\.\.\.)(\n)',
|
787
|
-
bygroups(Text, Comment,
|
811
|
+
bygroups(Text, Comment, Whitespace)), # for doctests...
|
788
812
|
(r'^([^:]+)(: )(.+)(\n)',
|
789
|
-
bygroups(Generic.Error, Text, Name,
|
813
|
+
bygroups(Generic.Error, Text, Name, Whitespace), '#pop'),
|
790
814
|
(r'^([a-zA-Z_]\w*)(:?\n)',
|
791
|
-
bygroups(Generic.Error,
|
815
|
+
bygroups(Generic.Error, Whitespace), '#pop')
|
792
816
|
],
|
793
817
|
'marker': [
|
794
818
|
# For syntax errors.
|
@@ -800,25 +824,26 @@ class Python2TracebackLexer(RegexLexer):
|
|
800
824
|
|
801
825
|
class CythonLexer(RegexLexer):
|
802
826
|
"""
|
803
|
-
For Pyrex and
|
827
|
+
For Pyrex and Cython source code.
|
804
828
|
|
805
829
|
.. versionadded:: 1.1
|
806
830
|
"""
|
807
831
|
|
808
832
|
name = 'Cython'
|
833
|
+
url = 'http://cython.org'
|
809
834
|
aliases = ['cython', 'pyx', 'pyrex']
|
810
835
|
filenames = ['*.pyx', '*.pxd', '*.pxi']
|
811
836
|
mimetypes = ['text/x-cython', 'application/x-cython']
|
812
837
|
|
813
838
|
tokens = {
|
814
839
|
'root': [
|
815
|
-
(r'\n',
|
816
|
-
(r'^(\s*)("""(?:.|\n)*?""")', bygroups(
|
817
|
-
(r"^(\s*)('''(?:.|\n)*?''')", bygroups(
|
840
|
+
(r'\n', Whitespace),
|
841
|
+
(r'^(\s*)("""(?:.|\n)*?""")', bygroups(Whitespace, String.Doc)),
|
842
|
+
(r"^(\s*)('''(?:.|\n)*?''')", bygroups(Whitespace, String.Doc)),
|
818
843
|
(r'[^\S\n]+', Text),
|
819
844
|
(r'#.*$', Comment),
|
820
845
|
(r'[]{}:(),;[]', Punctuation),
|
821
|
-
(r'\\\n',
|
846
|
+
(r'\\\n', Whitespace),
|
822
847
|
(r'\\', Text),
|
823
848
|
(r'(in|is|and|or|not)\b', Operator.Word),
|
824
849
|
(r'(<)([a-zA-Z0-9.?]+)(>)',
|
@@ -979,7 +1004,7 @@ class CythonLexer(RegexLexer):
|
|
979
1004
|
|
980
1005
|
class DgLexer(RegexLexer):
|
981
1006
|
"""
|
982
|
-
Lexer for
|
1007
|
+
Lexer for dg,
|
983
1008
|
a functional and object-oriented programming language
|
984
1009
|
running on the CPython 3 VM.
|
985
1010
|
|
@@ -1084,6 +1109,7 @@ class NumPyLexer(PythonLexer):
|
|
1084
1109
|
"""
|
1085
1110
|
|
1086
1111
|
name = 'NumPy'
|
1112
|
+
url = 'https://numpy.org/'
|
1087
1113
|
aliases = ['numpy']
|
1088
1114
|
|
1089
1115
|
# override the mimetypes to not inherit them from python
|