pygments.rb 2.4.1 → 3.0.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 +8 -8
- data/.github/workflows/release.yml +5 -5
- data/.gitignore +2 -0
- data/.rubocop.yml +1 -1
- data/CHANGELOG.adoc +9 -1
- data/README.adoc +2 -2
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +2 -2
- data/vendor/pygments-main/bin/pygmentize +1 -1
- data/vendor/pygments-main/pygments/__init__.py +2 -2
- data/vendor/pygments-main/pygments/__main__.py +1 -1
- data/vendor/pygments-main/pygments/cmdline.py +12 -12
- data/vendor/pygments-main/pygments/console.py +5 -5
- data/vendor/pygments-main/pygments/filter.py +2 -3
- data/vendor/pygments-main/pygments/filters/__init__.py +4 -4
- data/vendor/pygments-main/pygments/formatter.py +6 -1
- data/vendor/pygments-main/pygments/formatters/__init__.py +7 -8
- data/vendor/pygments-main/pygments/formatters/_mapping.py +0 -0
- data/vendor/pygments-main/pygments/formatters/bbcode.py +2 -2
- data/vendor/pygments-main/pygments/formatters/groff.py +3 -3
- data/vendor/pygments-main/pygments/formatters/html.py +38 -40
- data/vendor/pygments-main/pygments/formatters/img.py +51 -11
- data/vendor/pygments-main/pygments/formatters/irc.py +1 -1
- data/vendor/pygments-main/pygments/formatters/latex.py +24 -27
- data/vendor/pygments-main/pygments/formatters/other.py +3 -4
- data/vendor/pygments-main/pygments/formatters/pangomarkup.py +2 -2
- data/vendor/pygments-main/pygments/formatters/rtf.py +228 -25
- data/vendor/pygments-main/pygments/formatters/svg.py +17 -20
- data/vendor/pygments-main/pygments/formatters/terminal.py +1 -1
- data/vendor/pygments-main/pygments/formatters/terminal256.py +1 -1
- data/vendor/pygments-main/pygments/lexer.py +51 -33
- data/vendor/pygments-main/pygments/lexers/__init__.py +12 -12
- data/vendor/pygments-main/pygments/lexers/_ada_builtins.py +1 -1
- 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 +1 -1
- data/vendor/pygments-main/pygments/lexers/_css_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_julia_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_lasso_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_lilypond_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_lua_builtins.py +5 -5
- data/vendor/pygments-main/pygments/lexers/_luau_builtins.py +62 -0
- data/vendor/pygments-main/pygments/lexers/_mapping.py +41 -11
- data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_mysql_builtins.py +3 -3
- data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_php_builtins.py +3 -3
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +5 -5
- data/vendor/pygments-main/pygments/lexers/_qlik_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_scheme_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +4 -4
- data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +3 -3
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +1 -1
- 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 +6 -8
- data/vendor/pygments-main/pygments/lexers/ada.py +3 -3
- data/vendor/pygments-main/pygments/lexers/agile.py +3 -1
- data/vendor/pygments-main/pygments/lexers/algebra.py +9 -13
- data/vendor/pygments-main/pygments/lexers/ambient.py +2 -3
- data/vendor/pygments-main/pygments/lexers/amdgpu.py +3 -3
- data/vendor/pygments-main/pygments/lexers/ampl.py +2 -3
- data/vendor/pygments-main/pygments/lexers/apdlexer.py +4 -3
- data/vendor/pygments-main/pygments/lexers/apl.py +2 -3
- data/vendor/pygments-main/pygments/lexers/archetype.py +8 -12
- data/vendor/pygments-main/pygments/lexers/arrow.py +2 -3
- data/vendor/pygments-main/pygments/lexers/arturo.py +2 -3
- data/vendor/pygments-main/pygments/lexers/asc.py +4 -4
- data/vendor/pygments-main/pygments/lexers/asm.py +28 -15
- data/vendor/pygments-main/pygments/lexers/asn1.py +178 -0
- data/vendor/pygments-main/pygments/lexers/automation.py +6 -8
- data/vendor/pygments-main/pygments/lexers/bare.py +2 -3
- data/vendor/pygments-main/pygments/lexers/basic.py +48 -57
- data/vendor/pygments-main/pygments/lexers/bdd.py +3 -4
- data/vendor/pygments-main/pygments/lexers/berry.py +4 -4
- data/vendor/pygments-main/pygments/lexers/bibtex.py +5 -5
- data/vendor/pygments-main/pygments/lexers/blueprint.py +173 -0
- data/vendor/pygments-main/pygments/lexers/boa.py +4 -4
- data/vendor/pygments-main/pygments/lexers/bqn.py +109 -0
- data/vendor/pygments-main/pygments/lexers/business.py +21 -22
- data/vendor/pygments-main/pygments/lexers/c_cpp.py +9 -4
- data/vendor/pygments-main/pygments/lexers/c_like.py +99 -27
- data/vendor/pygments-main/pygments/lexers/capnproto.py +2 -3
- data/vendor/pygments-main/pygments/lexers/carbon.py +10 -11
- data/vendor/pygments-main/pygments/lexers/cddl.py +8 -9
- data/vendor/pygments-main/pygments/lexers/chapel.py +2 -3
- data/vendor/pygments-main/pygments/lexers/clean.py +2 -1
- data/vendor/pygments-main/pygments/lexers/comal.py +2 -1
- data/vendor/pygments-main/pygments/lexers/compiled.py +2 -1
- data/vendor/pygments-main/pygments/lexers/configs.py +342 -108
- data/vendor/pygments-main/pygments/lexers/console.py +5 -5
- data/vendor/pygments-main/pygments/lexers/cplint.py +2 -3
- data/vendor/pygments-main/pygments/lexers/crystal.py +4 -5
- data/vendor/pygments-main/pygments/lexers/csound.py +6 -8
- data/vendor/pygments-main/pygments/lexers/css.py +5 -5
- data/vendor/pygments-main/pygments/lexers/d.py +4 -3
- data/vendor/pygments-main/pygments/lexers/dalvik.py +2 -3
- data/vendor/pygments-main/pygments/lexers/data.py +8 -12
- data/vendor/pygments-main/pygments/lexers/dax.py +2 -3
- data/vendor/pygments-main/pygments/lexers/devicetree.py +2 -3
- data/vendor/pygments-main/pygments/lexers/diff.py +7 -6
- data/vendor/pygments-main/pygments/lexers/dns.py +109 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +19 -14
- data/vendor/pygments-main/pygments/lexers/dsls.py +24 -35
- data/vendor/pygments-main/pygments/lexers/dylan.py +8 -16
- data/vendor/pygments-main/pygments/lexers/ecl.py +2 -3
- data/vendor/pygments-main/pygments/lexers/eiffel.py +3 -4
- data/vendor/pygments-main/pygments/lexers/elm.py +3 -4
- data/vendor/pygments-main/pygments/lexers/elpi.py +28 -21
- data/vendor/pygments-main/pygments/lexers/email.py +3 -3
- data/vendor/pygments-main/pygments/lexers/erlang.py +22 -24
- data/vendor/pygments-main/pygments/lexers/esoteric.py +11 -12
- data/vendor/pygments-main/pygments/lexers/ezhil.py +2 -3
- data/vendor/pygments-main/pygments/lexers/factor.py +2 -3
- data/vendor/pygments-main/pygments/lexers/fantom.py +3 -3
- data/vendor/pygments-main/pygments/lexers/felix.py +9 -10
- data/vendor/pygments-main/pygments/lexers/fift.py +2 -1
- data/vendor/pygments-main/pygments/lexers/floscript.py +2 -3
- data/vendor/pygments-main/pygments/lexers/forth.py +2 -3
- data/vendor/pygments-main/pygments/lexers/fortran.py +6 -7
- data/vendor/pygments-main/pygments/lexers/foxpro.py +3 -3
- data/vendor/pygments-main/pygments/lexers/freefem.py +2 -3
- data/vendor/pygments-main/pygments/lexers/func.py +3 -1
- data/vendor/pygments-main/pygments/lexers/functional.py +2 -1
- data/vendor/pygments-main/pygments/lexers/futhark.py +6 -7
- data/vendor/pygments-main/pygments/lexers/gcodelexer.py +3 -3
- data/vendor/pygments-main/pygments/lexers/gdscript.py +2 -1
- data/vendor/pygments-main/pygments/lexers/go.py +3 -4
- data/vendor/pygments-main/pygments/lexers/grammar_notation.py +6 -9
- data/vendor/pygments-main/pygments/lexers/graph.py +12 -9
- data/vendor/pygments-main/pygments/lexers/graphics.py +13 -17
- data/vendor/pygments-main/pygments/lexers/graphql.py +176 -0
- data/vendor/pygments-main/pygments/lexers/graphviz.py +2 -3
- data/vendor/pygments-main/pygments/lexers/gsql.py +2 -3
- data/vendor/pygments-main/pygments/lexers/haskell.py +27 -32
- data/vendor/pygments-main/pygments/lexers/haxe.py +3 -5
- data/vendor/pygments-main/pygments/lexers/hdl.py +8 -7
- data/vendor/pygments-main/pygments/lexers/hexdump.py +3 -3
- data/vendor/pygments-main/pygments/lexers/html.py +34 -13
- data/vendor/pygments-main/pygments/lexers/idl.py +2 -3
- data/vendor/pygments-main/pygments/lexers/igor.py +305 -290
- data/vendor/pygments-main/pygments/lexers/inferno.py +2 -3
- data/vendor/pygments-main/pygments/lexers/installers.py +7 -9
- data/vendor/pygments-main/pygments/lexers/int_fiction.py +150 -162
- data/vendor/pygments-main/pygments/lexers/iolang.py +2 -3
- data/vendor/pygments-main/pygments/lexers/j.py +2 -3
- data/vendor/pygments-main/pygments/lexers/javascript.py +18 -19
- data/vendor/pygments-main/pygments/lexers/jmespath.py +2 -1
- data/vendor/pygments-main/pygments/lexers/jslt.py +2 -3
- data/vendor/pygments-main/pygments/lexers/jsonnet.py +4 -3
- data/vendor/pygments-main/pygments/lexers/jsx.py +75 -0
- data/vendor/pygments-main/pygments/lexers/julia.py +4 -5
- data/vendor/pygments-main/pygments/lexers/jvm.py +98 -116
- data/vendor/pygments-main/pygments/lexers/kuin.py +2 -3
- data/vendor/pygments-main/pygments/lexers/kusto.py +93 -0
- data/vendor/pygments-main/pygments/lexers/ldap.py +155 -0
- data/vendor/pygments-main/pygments/lexers/lean.py +241 -0
- data/vendor/pygments-main/pygments/lexers/lilypond.py +2 -3
- data/vendor/pygments-main/pygments/lexers/lisp.py +373 -65
- data/vendor/pygments-main/pygments/lexers/macaulay2.py +53 -4
- data/vendor/pygments-main/pygments/lexers/make.py +7 -5
- data/vendor/pygments-main/pygments/lexers/markup.py +242 -91
- data/vendor/pygments-main/pygments/lexers/math.py +2 -1
- data/vendor/pygments-main/pygments/lexers/matlab.py +10 -12
- data/vendor/pygments-main/pygments/lexers/maxima.py +2 -3
- data/vendor/pygments-main/pygments/lexers/meson.py +2 -3
- data/vendor/pygments-main/pygments/lexers/mime.py +4 -4
- data/vendor/pygments-main/pygments/lexers/minecraft.py +24 -27
- data/vendor/pygments-main/pygments/lexers/mips.py +3 -1
- data/vendor/pygments-main/pygments/lexers/ml.py +59 -61
- data/vendor/pygments-main/pygments/lexers/modeling.py +19 -22
- data/vendor/pygments-main/pygments/lexers/modula2.py +2 -3
- data/vendor/pygments-main/pygments/lexers/mojo.py +704 -0
- data/vendor/pygments-main/pygments/lexers/monte.py +2 -3
- data/vendor/pygments-main/pygments/lexers/mosel.py +3 -3
- data/vendor/pygments-main/pygments/lexers/ncl.py +4 -3
- data/vendor/pygments-main/pygments/lexers/nimrod.py +7 -8
- data/vendor/pygments-main/pygments/lexers/nit.py +2 -3
- data/vendor/pygments-main/pygments/lexers/nix.py +40 -31
- data/vendor/pygments-main/pygments/lexers/oberon.py +3 -3
- data/vendor/pygments-main/pygments/lexers/objective.py +14 -6
- data/vendor/pygments-main/pygments/lexers/ooc.py +2 -3
- data/vendor/pygments-main/pygments/lexers/openscad.py +96 -0
- data/vendor/pygments-main/pygments/lexers/other.py +2 -1
- data/vendor/pygments-main/pygments/lexers/parasail.py +2 -3
- data/vendor/pygments-main/pygments/lexers/parsers.py +41 -44
- data/vendor/pygments-main/pygments/lexers/pascal.py +6 -3
- data/vendor/pygments-main/pygments/lexers/pawn.py +5 -5
- data/vendor/pygments-main/pygments/lexers/perl.py +3 -3
- data/vendor/pygments-main/pygments/lexers/phix.py +2 -3
- data/vendor/pygments-main/pygments/lexers/php.py +4 -5
- data/vendor/pygments-main/pygments/lexers/pointless.py +2 -3
- data/vendor/pygments-main/pygments/lexers/pony.py +3 -3
- data/vendor/pygments-main/pygments/lexers/praat.py +2 -3
- data/vendor/pygments-main/pygments/lexers/procfile.py +2 -3
- data/vendor/pygments-main/pygments/lexers/prolog.py +23 -9
- data/vendor/pygments-main/pygments/lexers/promql.py +2 -1
- data/vendor/pygments-main/pygments/lexers/prql.py +251 -0
- data/vendor/pygments-main/pygments/lexers/ptx.py +119 -0
- data/vendor/pygments-main/pygments/lexers/python.py +24 -24
- data/vendor/pygments-main/pygments/lexers/q.py +5 -6
- data/vendor/pygments-main/pygments/lexers/qlik.py +3 -3
- data/vendor/pygments-main/pygments/lexers/qvt.py +5 -3
- data/vendor/pygments-main/pygments/lexers/r.py +8 -6
- data/vendor/pygments-main/pygments/lexers/rdf.py +19 -13
- data/vendor/pygments-main/pygments/lexers/rebol.py +7 -7
- data/vendor/pygments-main/pygments/lexers/resource.py +5 -6
- data/vendor/pygments-main/pygments/lexers/ride.py +4 -5
- data/vendor/pygments-main/pygments/lexers/rita.py +2 -3
- data/vendor/pygments-main/pygments/lexers/rnc.py +2 -3
- data/vendor/pygments-main/pygments/lexers/roboconf.py +5 -5
- data/vendor/pygments-main/pygments/lexers/robotframework.py +2 -3
- data/vendor/pygments-main/pygments/lexers/ruby.py +8 -13
- data/vendor/pygments-main/pygments/lexers/rust.py +9 -10
- data/vendor/pygments-main/pygments/lexers/sas.py +3 -3
- data/vendor/pygments-main/pygments/lexers/savi.py +131 -130
- data/vendor/pygments-main/pygments/lexers/scdoc.py +13 -7
- data/vendor/pygments-main/pygments/lexers/scripting.py +354 -42
- data/vendor/pygments-main/pygments/lexers/sgf.py +2 -3
- data/vendor/pygments-main/pygments/lexers/shell.py +107 -129
- data/vendor/pygments-main/pygments/lexers/sieve.py +3 -3
- data/vendor/pygments-main/pygments/lexers/slash.py +4 -5
- data/vendor/pygments-main/pygments/lexers/smalltalk.py +3 -5
- data/vendor/pygments-main/pygments/lexers/smithy.py +2 -3
- data/vendor/pygments-main/pygments/lexers/smv.py +3 -3
- data/vendor/pygments-main/pygments/lexers/snobol.py +3 -3
- data/vendor/pygments-main/pygments/lexers/solidity.py +3 -3
- data/vendor/pygments-main/pygments/lexers/soong.py +78 -0
- data/vendor/pygments-main/pygments/lexers/sophia.py +3 -4
- data/vendor/pygments-main/pygments/lexers/special.py +8 -3
- data/vendor/pygments-main/pygments/lexers/spice.py +15 -16
- data/vendor/pygments-main/pygments/lexers/sql.py +24 -18
- data/vendor/pygments-main/pygments/lexers/srcinfo.py +3 -3
- data/vendor/pygments-main/pygments/lexers/stata.py +2 -3
- data/vendor/pygments-main/pygments/lexers/supercollider.py +2 -3
- data/vendor/pygments-main/pygments/lexers/tact.py +303 -0
- data/vendor/pygments-main/pygments/lexers/tal.py +13 -10
- data/vendor/pygments-main/pygments/lexers/tcl.py +2 -3
- data/vendor/pygments-main/pygments/lexers/teal.py +2 -3
- data/vendor/pygments-main/pygments/lexers/templates.py +131 -72
- data/vendor/pygments-main/pygments/lexers/teraterm.py +2 -3
- data/vendor/pygments-main/pygments/lexers/testing.py +4 -5
- data/vendor/pygments-main/pygments/lexers/text.py +2 -1
- data/vendor/pygments-main/pygments/lexers/textedit.py +9 -6
- data/vendor/pygments-main/pygments/lexers/textfmts.py +20 -15
- data/vendor/pygments-main/pygments/lexers/theorem.py +41 -115
- data/vendor/pygments-main/pygments/lexers/thingsdb.py +50 -26
- data/vendor/pygments-main/pygments/lexers/tlb.py +3 -1
- data/vendor/pygments-main/pygments/lexers/tls.py +54 -0
- data/vendor/pygments-main/pygments/lexers/tnt.py +2 -3
- data/vendor/pygments-main/pygments/lexers/trafficscript.py +3 -3
- data/vendor/pygments-main/pygments/lexers/typoscript.py +6 -7
- data/vendor/pygments-main/pygments/lexers/typst.py +104 -0
- data/vendor/pygments-main/pygments/lexers/ul4.py +47 -5
- data/vendor/pygments-main/pygments/lexers/unicon.py +9 -7
- data/vendor/pygments-main/pygments/lexers/urbi.py +3 -3
- data/vendor/pygments-main/pygments/lexers/usd.py +6 -11
- data/vendor/pygments-main/pygments/lexers/varnish.py +5 -5
- data/vendor/pygments-main/pygments/lexers/verification.py +4 -5
- data/vendor/pygments-main/pygments/lexers/verifpal.py +65 -0
- data/vendor/pygments-main/pygments/lexers/vip.py +150 -0
- data/vendor/pygments-main/pygments/lexers/vyper.py +140 -0
- data/vendor/pygments-main/pygments/lexers/web.py +2 -1
- data/vendor/pygments-main/pygments/lexers/webassembly.py +2 -3
- data/vendor/pygments-main/pygments/lexers/webidl.py +2 -3
- data/vendor/pygments-main/pygments/lexers/webmisc.py +11 -15
- data/vendor/pygments-main/pygments/lexers/wgsl.py +6 -7
- data/vendor/pygments-main/pygments/lexers/whiley.py +2 -3
- data/vendor/pygments-main/pygments/lexers/wowtoc.py +3 -3
- data/vendor/pygments-main/pygments/lexers/wren.py +3 -4
- data/vendor/pygments-main/pygments/lexers/x10.py +6 -7
- data/vendor/pygments-main/pygments/lexers/xorg.py +2 -1
- data/vendor/pygments-main/pygments/lexers/yang.py +2 -3
- data/vendor/pygments-main/pygments/lexers/yara.py +69 -0
- data/vendor/pygments-main/pygments/lexers/zig.py +2 -1
- data/vendor/pygments-main/pygments/modeline.py +4 -4
- data/vendor/pygments-main/pygments/plugin.py +3 -19
- data/vendor/pygments-main/pygments/regexopt.py +1 -1
- data/vendor/pygments-main/pygments/scanner.py +1 -1
- data/vendor/pygments-main/pygments/sphinxext.py +38 -8
- data/vendor/pygments-main/pygments/style.py +8 -2
- data/vendor/pygments-main/pygments/styles/__init__.py +17 -59
- data/vendor/pygments-main/pygments/styles/_mapping.py +54 -0
- data/vendor/pygments-main/pygments/styles/abap.py +5 -1
- data/vendor/pygments-main/pygments/styles/algol.py +5 -1
- data/vendor/pygments-main/pygments/styles/algol_nu.py +5 -1
- data/vendor/pygments-main/pygments/styles/arduino.py +76 -72
- data/vendor/pygments-main/pygments/styles/autumn.py +6 -1
- data/vendor/pygments-main/pygments/styles/borland.py +6 -1
- data/vendor/pygments-main/pygments/styles/bw.py +6 -1
- data/vendor/pygments-main/pygments/styles/coffee.py +80 -0
- data/vendor/pygments-main/pygments/styles/colorful.py +6 -1
- data/vendor/pygments-main/pygments/styles/default.py +6 -1
- data/vendor/pygments-main/pygments/styles/dracula.py +68 -80
- data/vendor/pygments-main/pygments/styles/emacs.py +6 -1
- data/vendor/pygments-main/pygments/styles/friendly.py +6 -1
- data/vendor/pygments-main/pygments/styles/friendly_grayscale.py +6 -1
- data/vendor/pygments-main/pygments/styles/fruity.py +7 -1
- data/vendor/pygments-main/pygments/styles/gh_dark.py +7 -1
- data/vendor/pygments-main/pygments/styles/gruvbox.py +10 -1
- data/vendor/pygments-main/pygments/styles/igor.py +6 -1
- data/vendor/pygments-main/pygments/styles/inkpot.py +7 -2
- data/vendor/pygments-main/pygments/styles/lightbulb.py +110 -0
- data/vendor/pygments-main/pygments/styles/lilypond.py +8 -2
- data/vendor/pygments-main/pygments/styles/lovelace.py +16 -10
- data/vendor/pygments-main/pygments/styles/manni.py +7 -2
- data/vendor/pygments-main/pygments/styles/material.py +21 -14
- data/vendor/pygments-main/pygments/styles/monokai.py +16 -10
- data/vendor/pygments-main/pygments/styles/murphy.py +7 -2
- data/vendor/pygments-main/pygments/styles/native.py +10 -5
- data/vendor/pygments-main/pygments/styles/nord.py +9 -3
- data/vendor/pygments-main/pygments/styles/onedark.py +6 -2
- data/vendor/pygments-main/pygments/styles/paraiso_dark.py +7 -2
- data/vendor/pygments-main/pygments/styles/paraiso_light.py +7 -2
- data/vendor/pygments-main/pygments/styles/pastie.py +7 -1
- data/vendor/pygments-main/pygments/styles/perldoc.py +7 -1
- data/vendor/pygments-main/pygments/styles/rainbow_dash.py +26 -19
- data/vendor/pygments-main/pygments/styles/rrt.py +8 -2
- data/vendor/pygments-main/pygments/styles/sas.py +6 -1
- data/vendor/pygments-main/pygments/styles/solarized.py +9 -1
- data/vendor/pygments-main/pygments/styles/staroffice.py +6 -1
- data/vendor/pygments-main/pygments/styles/stata_dark.py +6 -2
- data/vendor/pygments-main/pygments/styles/stata_light.py +6 -1
- data/vendor/pygments-main/pygments/styles/tango.py +7 -3
- data/vendor/pygments-main/pygments/styles/trac.py +7 -1
- data/vendor/pygments-main/pygments/styles/vim.py +7 -1
- data/vendor/pygments-main/pygments/styles/vs.py +7 -2
- data/vendor/pygments-main/pygments/styles/xcode.py +6 -1
- data/vendor/pygments-main/pygments/styles/zenburn.py +6 -1
- data/vendor/pygments-main/pygments/token.py +2 -1
- data/vendor/pygments-main/pygments/unistring.py +5 -5
- data/vendor/pygments-main/pygments/util.py +13 -19
- data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/METADATA +14 -13
- data/vendor/pygments-main/pygments-2.18.0.dist-info/RECORD +663 -0
- data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/WHEEL +1 -2
- data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info/licenses}/AUTHORS +13 -0
- metadata +39 -15
- data/vendor/pygments-main/Pygments-2.15.1.dist-info/RECORD +0 -614
- data/vendor/pygments-main/Pygments-2.15.1.dist-info/top_level.txt +0 -1
- /data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/INSTALLER +0 -0
- /data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/REQUESTED +0 -0
- /data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info}/entry_points.txt +0 -0
- /data/vendor/pygments-main/{Pygments-2.15.1.dist-info → pygments-2.18.0.dist-info/licenses}/LICENSE +0 -0
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Lexers for interactive fiction languages.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2024 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
@@ -22,14 +22,13 @@ __all__ = ['Inform6Lexer', 'Inform6TemplateLexer', 'Inform7Lexer',
|
|
22
22
|
class Inform6Lexer(RegexLexer):
|
23
23
|
"""
|
24
24
|
For Inform 6 source code.
|
25
|
-
|
26
|
-
.. versionadded:: 2.0
|
27
25
|
"""
|
28
26
|
|
29
27
|
name = 'Inform 6'
|
30
28
|
url = 'http://inform-fiction.org/'
|
31
29
|
aliases = ['inform6', 'i6']
|
32
30
|
filenames = ['*.inf']
|
31
|
+
version_added = '2.0'
|
33
32
|
|
34
33
|
flags = re.MULTILINE | re.DOTALL
|
35
34
|
|
@@ -45,13 +44,13 @@ class Inform6Lexer(RegexLexer):
|
|
45
44
|
|
46
45
|
tokens = {
|
47
46
|
'root': [
|
48
|
-
(
|
47
|
+
(rf'\A(!%[^{_newline}]*[{_newline}])+', Comment.Preproc,
|
49
48
|
'directive'),
|
50
49
|
default('directive')
|
51
50
|
],
|
52
51
|
'_whitespace': [
|
53
52
|
(r'\s+', Text),
|
54
|
-
(
|
53
|
+
(rf'![^{_newline}]*', Comment.Single)
|
55
54
|
],
|
56
55
|
'default': [
|
57
56
|
include('_whitespace'),
|
@@ -65,20 +64,20 @@ class Inform6Lexer(RegexLexer):
|
|
65
64
|
'_expression': [
|
66
65
|
include('_whitespace'),
|
67
66
|
(r'(?=sp\b)', Text, '#pop'),
|
68
|
-
(
|
67
|
+
(rf'(?=[{_dquote}{_squote}$0-9#a-zA-Z_])', Text,
|
69
68
|
('#pop', 'value')),
|
70
|
-
(
|
71
|
-
(
|
69
|
+
(rf'\+\+|[{_dash}]{{1,2}}(?!>)|~~?', Operator),
|
70
|
+
(rf'(?=[()\[{_dash},?@{{:;])', Text, '#pop')
|
72
71
|
],
|
73
72
|
'expression': [
|
74
73
|
include('_whitespace'),
|
75
74
|
(r'\(', Punctuation, ('expression', '_expression')),
|
76
75
|
(r'\)', Punctuation, '#pop'),
|
77
76
|
(r'\[', Punctuation, ('#pop', 'statements', 'locals')),
|
78
|
-
(
|
79
|
-
(
|
77
|
+
(rf'>(?=(\s+|(![^{_newline}]*))*[>;])', Punctuation),
|
78
|
+
(rf'\+\+|[{_dash}]{{2}}(?!>)', Operator),
|
80
79
|
(r',', Punctuation, '_expression'),
|
81
|
-
(
|
80
|
+
(rf'&&?|\|\|?|[=~><]?=|[{_dash}]{{1,2}}>?|\.\.?[&#]?|::|[<>+*/%]',
|
82
81
|
Operator, '_expression'),
|
83
82
|
(r'(has|hasnt|in|notin|ofclass|or|provides)\b', Operator.Word,
|
84
83
|
'_expression'),
|
@@ -90,7 +89,7 @@ class Inform6Lexer(RegexLexer):
|
|
90
89
|
'_assembly-expression': [
|
91
90
|
(r'\(', Punctuation, ('#push', '_expression')),
|
92
91
|
(r'[\[\]]', Punctuation),
|
93
|
-
(
|
92
|
+
(rf'[{_dash}]>', Punctuation, '_expression'),
|
94
93
|
(r'sp\b', Keyword.Pseudo),
|
95
94
|
(r';', Punctuation, '#pop:3'),
|
96
95
|
include('expression')
|
@@ -117,25 +116,25 @@ class Inform6Lexer(RegexLexer):
|
|
117
116
|
'value': [
|
118
117
|
include('_whitespace'),
|
119
118
|
# Strings
|
120
|
-
(
|
121
|
-
(
|
119
|
+
(rf'[{_squote}][^@][{_squote}]', String.Char, '#pop'),
|
120
|
+
(rf'([{_squote}])(@\{{[0-9a-fA-F]*\}})([{_squote}])',
|
122
121
|
bygroups(String.Char, String.Escape, String.Char), '#pop'),
|
123
|
-
(
|
122
|
+
(rf'([{_squote}])(@.{{2}})([{_squote}])',
|
124
123
|
bygroups(String.Char, String.Escape, String.Char), '#pop'),
|
125
|
-
(
|
126
|
-
(
|
124
|
+
(rf'[{_squote}]', String.Single, ('#pop', 'dictionary-word')),
|
125
|
+
(rf'[{_dquote}]', String.Double, ('#pop', 'string')),
|
127
126
|
# Numbers
|
128
|
-
(
|
127
|
+
(rf'\$[<>]?[+{_dash}][0-9]*\.?[0-9]*([eE][+{_dash}]?[0-9]+)?',
|
129
128
|
Number.Float, '#pop'),
|
130
129
|
(r'\$[0-9a-fA-F]+', Number.Hex, '#pop'),
|
131
130
|
(r'\$\$[01]+', Number.Bin, '#pop'),
|
132
131
|
(r'[0-9]+', Number.Integer, '#pop'),
|
133
132
|
# Values prefixed by hashes
|
134
|
-
(
|
135
|
-
(
|
133
|
+
(rf'(##|#a\$)({_name})', bygroups(Operator, Name), '#pop'),
|
134
|
+
(rf'(#g\$)({_name})',
|
136
135
|
bygroups(Operator, Name.Variable.Global), '#pop'),
|
137
136
|
(r'#[nw]\$', Operator, ('#pop', 'obsolete-dictionary-word')),
|
138
|
-
(
|
137
|
+
(rf'(#r\$)({_name})', bygroups(Operator, Name.Function), '#pop'),
|
139
138
|
(r'#', Name.Builtin, ('#pop', 'system-constant')),
|
140
139
|
# System functions
|
141
140
|
(words((
|
@@ -182,32 +181,31 @@ class Inform6Lexer(RegexLexer):
|
|
182
181
|
],
|
183
182
|
# Strings
|
184
183
|
'dictionary-word': [
|
185
|
-
(
|
186
|
-
(
|
187
|
-
(r'[({]', String.Single),
|
184
|
+
(rf'[~^]+|//[^{_squote}]*', String.Escape),
|
185
|
+
(rf'[^~^/\\@({{{_squote}]+', String.Single),
|
186
|
+
(r'[/({]', String.Single),
|
188
187
|
(r'@\{[0-9a-fA-F]*\}', String.Escape),
|
189
188
|
(r'@.{2}', String.Escape),
|
190
|
-
(
|
189
|
+
(rf'[{_squote}]', String.Single, '#pop')
|
191
190
|
],
|
192
191
|
'string': [
|
193
192
|
(r'[~^]+', String.Escape),
|
194
|
-
(
|
193
|
+
(rf'[^~^\\@({{{_dquote}]+', String.Double),
|
195
194
|
(r'[({]', String.Double),
|
196
195
|
(r'\\', String.Escape),
|
197
|
-
(
|
198
|
-
|
199
|
-
|
200
|
-
r'(\\\s*[%s]\s*)*[)}]' % (_newline, _newline, _newline),
|
196
|
+
(rf'@(\\\s*[{_newline}]\s*)*@((\\\s*[{_newline}]\s*)*[0-9])*', String.Escape),
|
197
|
+
(rf'@(\\\s*[{_newline}]\s*)*[({{]((\\\s*[{_newline}]\s*)*[0-9a-zA-Z_])*'
|
198
|
+
rf'(\\\s*[{_newline}]\s*)*[)}}]',
|
201
199
|
String.Escape),
|
202
|
-
(
|
200
|
+
(rf'@(\\\s*[{_newline}]\s*)*.(\\\s*[{_newline}]\s*)*.',
|
203
201
|
String.Escape),
|
204
|
-
(
|
202
|
+
(rf'[{_dquote}]', String.Double, '#pop')
|
205
203
|
],
|
206
204
|
'plain-string': [
|
207
|
-
(
|
205
|
+
(rf'[^~^\\({{\[\]{_dquote}]+', String.Double),
|
208
206
|
(r'[~^({\[\]]', String.Double),
|
209
207
|
(r'\\', String.Escape),
|
210
|
-
(
|
208
|
+
(rf'[{_dquote}]', String.Double, '#pop')
|
211
209
|
],
|
212
210
|
# Names
|
213
211
|
'_constant': [
|
@@ -326,7 +324,7 @@ class Inform6Lexer(RegexLexer):
|
|
326
324
|
default('#pop')
|
327
325
|
],
|
328
326
|
'_object-head': [
|
329
|
-
(
|
327
|
+
(rf'[{_dash}]>', Punctuation),
|
330
328
|
(r'(class|has|private|with)\b', Keyword.Declaration, '#pop'),
|
331
329
|
include('_global')
|
332
330
|
],
|
@@ -356,7 +354,7 @@ class Inform6Lexer(RegexLexer):
|
|
356
354
|
include('_whitespace'),
|
357
355
|
(r';', Punctuation, '#pop'),
|
358
356
|
(r'[/*]', Punctuation),
|
359
|
-
(
|
357
|
+
(rf'[{_dash}]>', Punctuation, 'value'),
|
360
358
|
(r'(noun|scope)\b', Keyword, '=routine'),
|
361
359
|
default('_directive-keyword')
|
362
360
|
],
|
@@ -376,12 +374,12 @@ class Inform6Lexer(RegexLexer):
|
|
376
374
|
# Include, Link, Message
|
377
375
|
'diagnostic': [
|
378
376
|
include('_whitespace'),
|
379
|
-
(
|
377
|
+
(rf'[{_dquote}]', String.Double, ('#pop', 'message-string')),
|
380
378
|
default(('#pop', 'before-plain-string?', 'directive-keyword?'))
|
381
379
|
],
|
382
380
|
'before-plain-string?': [
|
383
381
|
include('_whitespace'),
|
384
|
-
(
|
382
|
+
(rf'[{_dquote}]', String.Double, ('#pop', 'plain-string')),
|
385
383
|
default('#pop')
|
386
384
|
],
|
387
385
|
'message-string': [
|
@@ -400,7 +398,7 @@ class Inform6Lexer(RegexLexer):
|
|
400
398
|
'terminating', 'time', 'topic', 'warning', 'with'), suffix=r'\b'),
|
401
399
|
Keyword, '#pop'),
|
402
400
|
(r'static\b', Keyword),
|
403
|
-
(
|
401
|
+
(rf'[{_dash}]{{1,2}}>|[+=]', Punctuation, '#pop')
|
404
402
|
],
|
405
403
|
'_directive-keyword': [
|
406
404
|
include('_directive-keyword!'),
|
@@ -413,7 +411,7 @@ class Inform6Lexer(RegexLexer):
|
|
413
411
|
'property-keyword*': [
|
414
412
|
include('_whitespace'),
|
415
413
|
(words(('additive', 'individual', 'long'),
|
416
|
-
suffix=
|
414
|
+
suffix=rf'\b(?=(\s*|(![^{_newline}]*[{_newline}]))*[_a-zA-Z])'),
|
417
415
|
Keyword),
|
418
416
|
default('#pop')
|
419
417
|
],
|
@@ -445,7 +443,7 @@ class Inform6Lexer(RegexLexer):
|
|
445
443
|
(r'(jump|save|restore)\b', Keyword, ('default', 'label?')),
|
446
444
|
(r'objectloop\b', Keyword,
|
447
445
|
('_keyword-expression', 'variable?', '(?')),
|
448
|
-
(
|
446
|
+
(rf'print(_ret)?\b|(?=[{_dquote}])', Keyword, 'print-list'),
|
449
447
|
(r'\.', Name.Label, 'label?'),
|
450
448
|
(r'@', Keyword, 'opcode'),
|
451
449
|
(r'#(?![agrnw]\$|#)', Punctuation, 'directive'),
|
@@ -459,9 +457,9 @@ class Inform6Lexer(RegexLexer):
|
|
459
457
|
(r'(bold|fixed|from|near|off|on|reverse|roman|to|underline)\b',
|
460
458
|
Keyword, '#pop'),
|
461
459
|
(r'(a|A|an|address|char|name|number|object|property|string|the|'
|
462
|
-
|
460
|
+
rf'The)\b(?=(\s+|(![^{_newline}]*))*\))', Keyword.Pseudo,
|
463
461
|
'#pop'),
|
464
|
-
(
|
462
|
+
(rf'{_name}(?=(\s+|(![^{_newline}]*))*\))', Name.Function,
|
465
463
|
'#pop'),
|
466
464
|
default('#pop')
|
467
465
|
],
|
@@ -490,7 +488,8 @@ class Inform6Lexer(RegexLexer):
|
|
490
488
|
# Assembly
|
491
489
|
'opcode': [
|
492
490
|
include('_whitespace'),
|
493
|
-
(
|
491
|
+
(rf'[{_dquote}]', String.Double, ('operands', 'plain-string')),
|
492
|
+
(rf'[{_dash}]{{1,2}}>', Punctuation, 'operands'),
|
494
493
|
(_name, Keyword, 'operands')
|
495
494
|
],
|
496
495
|
'operands': [
|
@@ -543,21 +542,20 @@ class Inform6Lexer(RegexLexer):
|
|
543
542
|
class Inform7Lexer(RegexLexer):
|
544
543
|
"""
|
545
544
|
For Inform 7 source code.
|
546
|
-
|
547
|
-
.. versionadded:: 2.0
|
548
545
|
"""
|
549
546
|
|
550
547
|
name = 'Inform 7'
|
551
548
|
url = 'http://inform7.com/'
|
552
549
|
aliases = ['inform7', 'i7']
|
553
550
|
filenames = ['*.ni', '*.i7x']
|
551
|
+
version_added = '2.0'
|
554
552
|
|
555
553
|
flags = re.MULTILINE | re.DOTALL
|
556
554
|
|
557
555
|
_dash = Inform6Lexer._dash
|
558
556
|
_dquote = Inform6Lexer._dquote
|
559
557
|
_newline = Inform6Lexer._newline
|
560
|
-
_start =
|
558
|
+
_start = rf'\A|(?<=[{_newline}])'
|
561
559
|
|
562
560
|
# There are three variants of Inform 7, differing in how to
|
563
561
|
# interpret at signs and braces in I6T. In top-level inclusions, at
|
@@ -571,47 +569,46 @@ class Inform7Lexer(RegexLexer):
|
|
571
569
|
tokens[level] = {
|
572
570
|
'+i6-root': list(Inform6Lexer.tokens['root']),
|
573
571
|
'+i6t-root': [ # For Inform6TemplateLexer
|
574
|
-
(
|
572
|
+
(rf'[^{Inform6Lexer._newline}]*', Comment.Preproc,
|
575
573
|
('directive', '+p'))
|
576
574
|
],
|
577
575
|
'root': [
|
578
576
|
(r'(\|?\s)+', Text),
|
579
577
|
(r'\[', Comment.Multiline, '+comment'),
|
580
|
-
(
|
578
|
+
(rf'[{_dquote}]', Generic.Heading,
|
581
579
|
('+main', '+titling', '+titling-string')),
|
582
580
|
default(('+main', '+heading?'))
|
583
581
|
],
|
584
582
|
'+titling-string': [
|
585
|
-
(
|
586
|
-
(
|
583
|
+
(rf'[^{_dquote}]+', Generic.Heading),
|
584
|
+
(rf'[{_dquote}]', Generic.Heading, '#pop')
|
587
585
|
],
|
588
586
|
'+titling': [
|
589
587
|
(r'\[', Comment.Multiline, '+comment'),
|
590
|
-
(
|
591
|
-
(
|
592
|
-
(
|
588
|
+
(rf'[^{_dquote}.;:|{_newline}]+', Generic.Heading),
|
589
|
+
(rf'[{_dquote}]', Generic.Heading, '+titling-string'),
|
590
|
+
(rf'[{_newline}]{{2}}|(?<=[\s{_dquote}])\|[\s{_dquote}]',
|
593
591
|
Text, ('#pop', '+heading?')),
|
594
|
-
(
|
595
|
-
(
|
592
|
+
(rf'[.;:]|(?<=[\s{_dquote}])\|', Text, '#pop'),
|
593
|
+
(rf'[|{_newline}]', Generic.Heading)
|
596
594
|
],
|
597
595
|
'+main': [
|
598
|
-
(
|
599
|
-
(
|
596
|
+
(rf'(?i)[^{_dquote}:a\[(|{_newline}]+', Text),
|
597
|
+
(rf'[{_dquote}]', String.Double, '+text'),
|
600
598
|
(r':', Text, '+phrase-definition'),
|
601
599
|
(r'(?i)\bas\b', Text, '+use-option'),
|
602
600
|
(r'\[', Comment.Multiline, '+comment'),
|
603
|
-
(
|
601
|
+
(rf'(\([{_dash}])(.*?)([{_dash}]\))',
|
604
602
|
bygroups(Punctuation,
|
605
603
|
using(this, state=('+i6-root', 'directive'),
|
606
604
|
i6t='+i6t-not-inline'), Punctuation)),
|
607
|
-
(
|
608
|
-
|
609
|
-
(r'(?i)[a(|%s]' % _newline, Text)
|
605
|
+
(rf'({_start}|(?<=[\s;:.{_dquote}]))\|\s|[{_newline}]{{2,}}', Text, '+heading?'),
|
606
|
+
(rf'(?i)[a(|{_newline}]', Text)
|
610
607
|
],
|
611
608
|
'+phrase-definition': [
|
612
609
|
(r'\s+', Text),
|
613
610
|
(r'\[', Comment.Multiline, '+comment'),
|
614
|
-
(
|
611
|
+
(rf'(\([{_dash}])(.*?)([{_dash}]\))',
|
615
612
|
bygroups(Punctuation,
|
616
613
|
using(this, state=('+i6-root', 'directive',
|
617
614
|
'default', 'statements'),
|
@@ -621,7 +618,7 @@ class Inform7Lexer(RegexLexer):
|
|
621
618
|
'+use-option': [
|
622
619
|
(r'\s+', Text),
|
623
620
|
(r'\[', Comment.Multiline, '+comment'),
|
624
|
-
(
|
621
|
+
(rf'(\([{_dash}])(.*?)([{_dash}]\))',
|
625
622
|
bygroups(Punctuation,
|
626
623
|
using(this, state=('+i6-root', 'directive'),
|
627
624
|
i6t='+i6t-use-option'), Punctuation), '#pop'),
|
@@ -633,16 +630,16 @@ class Inform7Lexer(RegexLexer):
|
|
633
630
|
(r'\]', Comment.Multiline, '#pop')
|
634
631
|
],
|
635
632
|
'+text': [
|
636
|
-
(
|
633
|
+
(rf'[^\[{_dquote}]+', String.Double),
|
637
634
|
(r'\[.*?\]', String.Interpol),
|
638
|
-
(
|
635
|
+
(rf'[{_dquote}]', String.Double, '#pop')
|
639
636
|
],
|
640
637
|
'+heading?': [
|
641
638
|
(r'(\|?\s)+', Text),
|
642
639
|
(r'\[', Comment.Multiline, '+comment'),
|
643
|
-
(
|
644
|
-
(
|
645
|
-
(
|
640
|
+
(rf'[{_dash}]{{4}}\s+', Text, '+documentation-heading'),
|
641
|
+
(rf'[{_dash}]{{1,3}}', Text),
|
642
|
+
(rf'(?i)(volume|book|part|chapter|section)\b[^{_newline}]*',
|
646
643
|
Generic.Heading, '#pop'),
|
647
644
|
default('#pop')
|
648
645
|
],
|
@@ -655,25 +652,24 @@ class Inform7Lexer(RegexLexer):
|
|
655
652
|
'+documentation-heading2': [
|
656
653
|
(r'\s+', Text),
|
657
654
|
(r'\[', Comment.Multiline, '+comment'),
|
658
|
-
(
|
655
|
+
(rf'[{_dash}]{{4}}\s', Text, '+documentation'),
|
659
656
|
default('#pop:2')
|
660
657
|
],
|
661
658
|
'+documentation': [
|
662
|
-
(
|
663
|
-
|
664
|
-
(r'(?i)(%s)\s*section\s*:[^%s]*' % (_start, _newline),
|
659
|
+
(rf'(?i)({_start})\s*(chapter|example)\s*:[^{_newline}]*', Generic.Heading),
|
660
|
+
(rf'(?i)({_start})\s*section\s*:[^{_newline}]*',
|
665
661
|
Generic.Subheading),
|
666
|
-
(
|
662
|
+
(rf'(({_start})\t.*?[{_newline}])+',
|
667
663
|
using(this, state='+main')),
|
668
|
-
(
|
664
|
+
(rf'[^{_newline}\[]+|[{_newline}\[]', Text),
|
669
665
|
(r'\[', Comment.Multiline, '+comment'),
|
670
666
|
],
|
671
667
|
'+i6t-not-inline': [
|
672
|
-
(
|
668
|
+
(rf'({_start})@c( .*?)?([{_newline}]|\Z)',
|
673
669
|
Comment.Preproc),
|
674
|
-
(
|
670
|
+
(rf'({_start})@([{_dash}]+|Purpose:)[^{_newline}]*',
|
675
671
|
Comment.Preproc),
|
676
|
-
(
|
672
|
+
(rf'({_start})@p( .*?)?([{_newline}]|\Z)',
|
677
673
|
Generic.Heading, '+p')
|
678
674
|
],
|
679
675
|
'+i6t-use-option': [
|
@@ -686,12 +682,12 @@ class Inform7Lexer(RegexLexer):
|
|
686
682
|
Punctuation))
|
687
683
|
],
|
688
684
|
'+i6t': [
|
689
|
-
(
|
685
|
+
(rf'(\{{[{_dash}])(![^}}]*)(\}}?)',
|
690
686
|
bygroups(Punctuation, Comment.Single, Punctuation)),
|
691
|
-
(
|
687
|
+
(rf'(\{{[{_dash}])(lines)(:)([^}}]*)(\}}?)',
|
692
688
|
bygroups(Punctuation, Keyword, Punctuation, Text,
|
693
689
|
Punctuation), '+lines'),
|
694
|
-
(
|
690
|
+
(rf'(\{{[{_dash}])([^:}}]*)(:?)([^}}]*)(\}}?)',
|
695
691
|
bygroups(Punctuation, Keyword, Punctuation, Text,
|
696
692
|
Punctuation)),
|
697
693
|
(r'(\(\+)(.*?)(\+\)|\Z)',
|
@@ -700,25 +696,25 @@ class Inform7Lexer(RegexLexer):
|
|
700
696
|
],
|
701
697
|
'+p': [
|
702
698
|
(r'[^@]+', Comment.Preproc),
|
703
|
-
(
|
699
|
+
(rf'({_start})@c( .*?)?([{_newline}]|\Z)',
|
704
700
|
Comment.Preproc, '#pop'),
|
705
|
-
(
|
706
|
-
(
|
701
|
+
(rf'({_start})@([{_dash}]|Purpose:)', Comment.Preproc),
|
702
|
+
(rf'({_start})@p( .*?)?([{_newline}]|\Z)',
|
707
703
|
Generic.Heading),
|
708
704
|
(r'@', Comment.Preproc)
|
709
705
|
],
|
710
706
|
'+lines': [
|
711
|
-
(
|
707
|
+
(rf'({_start})@c( .*?)?([{_newline}]|\Z)',
|
712
708
|
Comment.Preproc),
|
713
|
-
(
|
709
|
+
(rf'({_start})@([{_dash}]|Purpose:)[^{_newline}]*',
|
714
710
|
Comment.Preproc),
|
715
|
-
(
|
711
|
+
(rf'({_start})@p( .*?)?([{_newline}]|\Z)',
|
716
712
|
Generic.Heading, '+p'),
|
717
|
-
(
|
718
|
-
(
|
719
|
-
(
|
713
|
+
(rf'({_start})@\w*[ {_newline}]', Keyword),
|
714
|
+
(rf'![^{_newline}]*', Comment.Single),
|
715
|
+
(rf'(\{{)([{_dash}]endlines)(\}})',
|
720
716
|
bygroups(Punctuation, Keyword, Punctuation), '#pop'),
|
721
|
-
(
|
717
|
+
(rf'[^@!{{]+?([{_newline}]|\Z)|.', Text)
|
722
718
|
]
|
723
719
|
}
|
724
720
|
# Inform 7 can include snippets of Inform 6 template language,
|
@@ -747,13 +743,12 @@ class Inform7Lexer(RegexLexer):
|
|
747
743
|
class Inform6TemplateLexer(Inform7Lexer):
|
748
744
|
"""
|
749
745
|
For Inform 6 template code.
|
750
|
-
|
751
|
-
.. versionadded:: 2.0
|
752
746
|
"""
|
753
747
|
|
754
748
|
name = 'Inform 6 template'
|
755
749
|
aliases = ['i6t']
|
756
750
|
filenames = ['*.i6t']
|
751
|
+
version_added = '2.0'
|
757
752
|
|
758
753
|
def get_tokens_unprocessed(self, text, stack=('+i6t-root',)):
|
759
754
|
return Inform7Lexer.get_tokens_unprocessed(self, text, stack)
|
@@ -767,6 +762,8 @@ class Tads3Lexer(RegexLexer):
|
|
767
762
|
name = 'TADS 3'
|
768
763
|
aliases = ['tads3']
|
769
764
|
filenames = ['*.t']
|
765
|
+
url = 'https://www.tads.org'
|
766
|
+
version_added = ''
|
770
767
|
|
771
768
|
flags = re.DOTALL | re.MULTILINE
|
772
769
|
|
@@ -778,55 +775,50 @@ class Tads3Lexer(RegexLexer):
|
|
778
775
|
_no_quote = r'(?=\s|\\?>)'
|
779
776
|
_operator = (r'(?:&&|\|\||\+\+|--|\?\?|::|[.,@\[\]~]|'
|
780
777
|
r'(?:[=+\-*/%!&|^]|<<?|>>?>?)=?)')
|
781
|
-
_ws =
|
782
|
-
_ws_pp =
|
778
|
+
_ws = rf'(?:\\|\s|{_comment_single}|{_comment_multiline})'
|
779
|
+
_ws_pp = rf'(?:\\\n|[^\S\n]|{_comment_single}|{_comment_multiline})'
|
783
780
|
|
784
781
|
def _make_string_state(triple, double, verbatim=None, _escape=_escape):
|
785
782
|
if verbatim:
|
786
|
-
verbatim = ''.join(['(
|
787
|
-
re.escape(c.upper()))
|
783
|
+
verbatim = ''.join([f'(?:{re.escape(c.lower())}|{re.escape(c.upper())})'
|
788
784
|
for c in verbatim])
|
789
785
|
char = r'"' if double else r"'"
|
790
786
|
token = String.Double if double else String.Single
|
791
|
-
escaped_quotes =
|
792
|
-
prefix = '
|
793
|
-
tag_state_name = '
|
787
|
+
escaped_quotes = rf'+|{char}(?!{char}{{2}})' if triple else r''
|
788
|
+
prefix = '{}{}'.format('t' if triple else '', 'd' if double else 's')
|
789
|
+
tag_state_name = f'{prefix}qt'
|
794
790
|
state = []
|
795
791
|
if triple:
|
796
792
|
state += [
|
797
|
-
(
|
798
|
-
(
|
793
|
+
(rf'{char}{{3,}}', token, '#pop'),
|
794
|
+
(rf'\\{char}+', String.Escape),
|
799
795
|
(char, token)
|
800
796
|
]
|
801
797
|
else:
|
802
798
|
state.append((char, token, '#pop'))
|
803
799
|
state += [
|
804
800
|
include('s/verbatim'),
|
805
|
-
(
|
801
|
+
(rf'[^\\<&{{}}{char}]+', token)
|
806
802
|
]
|
807
803
|
if verbatim:
|
808
804
|
# This regex can't use `(?i)` because escape sequences are
|
809
805
|
# case-sensitive. `<\XMP>` works; `<\xmp>` doesn't.
|
810
|
-
state.append((
|
811
|
-
(
|
812
|
-
Name.Tag, ('#pop', '%sqs' % prefix, tag_state_name)))
|
806
|
+
state.append((rf'\\?<(/|\\\\|(?!{_escape})\\){verbatim}(?=[\s=>])',
|
807
|
+
Name.Tag, ('#pop', f'{prefix}qs', tag_state_name)))
|
813
808
|
else:
|
814
809
|
state += [
|
815
|
-
(
|
816
|
-
(char, char, escaped_quotes, _escape), Comment.Multiline),
|
810
|
+
(rf'\\?<!([^><\\{char}]|<(?!<)|\\{char}{escaped_quotes}|{_escape}|\\.)*>?', Comment.Multiline),
|
817
811
|
(r'(?i)\\?<listing(?=[\s=>]|\\>)', Name.Tag,
|
818
|
-
('#pop', '
|
812
|
+
('#pop', f'{prefix}qs/listing', tag_state_name)),
|
819
813
|
(r'(?i)\\?<xmp(?=[\s=>]|\\>)', Name.Tag,
|
820
|
-
('#pop', '
|
821
|
-
(
|
822
|
-
(char, char, escaped_quotes, _escape), Name.Tag,
|
814
|
+
('#pop', f'{prefix}qs/xmp', tag_state_name)),
|
815
|
+
(rf'\\?<([^\s=><\\{char}]|<(?!<)|\\{char}{escaped_quotes}|{_escape}|\\.)*', Name.Tag,
|
823
816
|
tag_state_name),
|
824
817
|
include('s/entity')
|
825
818
|
]
|
826
819
|
state += [
|
827
820
|
include('s/escape'),
|
828
|
-
(
|
829
|
-
(char, char, escaped_quotes, _escape), String.Interpol),
|
821
|
+
(rf'\{{([^}}<\\{char}]|<(?!<)|\\{char}{escaped_quotes}|{_escape}|\\.)*\}}', String.Interpol),
|
830
822
|
(r'[\\&{}<]', token)
|
831
823
|
]
|
832
824
|
return state
|
@@ -834,22 +826,20 @@ class Tads3Lexer(RegexLexer):
|
|
834
826
|
def _make_tag_state(triple, double, _escape=_escape):
|
835
827
|
char = r'"' if double else r"'"
|
836
828
|
quantifier = r'{3,}' if triple else r''
|
837
|
-
state_name = '
|
829
|
+
state_name = '{}{}qt'.format('t' if triple else '', 'd' if double else 's')
|
838
830
|
token = String.Double if double else String.Single
|
839
|
-
escaped_quotes =
|
831
|
+
escaped_quotes = rf'+|{char}(?!{char}{{2}})' if triple else r''
|
840
832
|
return [
|
841
|
-
(
|
833
|
+
(rf'{char}{quantifier}', token, '#pop:2'),
|
842
834
|
(r'(\s|\\\n)+', Text),
|
843
835
|
(r'(=)(\\?")', bygroups(Punctuation, String.Double),
|
844
|
-
'dqs
|
836
|
+
f'dqs/{state_name}'),
|
845
837
|
(r"(=)(\\?')", bygroups(Punctuation, String.Single),
|
846
|
-
'sqs
|
847
|
-
(r'=', Punctuation, 'uqs
|
838
|
+
f'sqs/{state_name}'),
|
839
|
+
(r'=', Punctuation, f'uqs/{state_name}'),
|
848
840
|
(r'\\?>', Name.Tag, '#pop'),
|
849
|
-
(
|
850
|
-
|
851
|
-
(r'([^\s=><\\%s]|<(?!<)|\\%s%s|%s|\\.)+' %
|
852
|
-
(char, char, escaped_quotes, _escape), Name.Attribute),
|
841
|
+
(rf'\{{([^}}<\\{char}]|<(?!<)|\\{char}{escaped_quotes}|{_escape}|\\.)*\}}', String.Interpol),
|
842
|
+
(rf'([^\s=><\\{char}]|<(?!<)|\\{char}{escaped_quotes}|{_escape}|\\.)+', Name.Attribute),
|
853
843
|
include('s/escape'),
|
854
844
|
include('s/verbatim'),
|
855
845
|
include('s/entity'),
|
@@ -863,16 +853,15 @@ class Tads3Lexer(RegexLexer):
|
|
863
853
|
host_char = r'"' if host_double else r"'"
|
864
854
|
host_quantifier = r'{3,}' if host_triple else r''
|
865
855
|
host_token = String.Double if host_double else String.Single
|
866
|
-
escaped_quotes = (
|
856
|
+
escaped_quotes = (rf'+|{host_char}(?!{host_char}{{2}})'
|
867
857
|
if host_triple else r'')
|
868
858
|
return [
|
869
|
-
(
|
870
|
-
(r'
|
859
|
+
(rf'{host_char}{host_quantifier}', host_token, '#pop:3'),
|
860
|
+
(r'{}{}'.format(r'' if token is String.Other else r'\\?', terminator),
|
871
861
|
token, '#pop'),
|
872
862
|
include('s/verbatim'),
|
873
863
|
include('s/entity'),
|
874
|
-
(
|
875
|
-
(host_char, host_char, escaped_quotes, _escape), String.Interpol),
|
864
|
+
(rf'\{{([^}}<\\{host_char}]|<(?!<)|\\{host_char}{escaped_quotes}|{_escape}|\\.)*\}}', String.Interpol),
|
876
865
|
(r'([^\s"\'<%s{}\\&])+' % (r'>' if token is String.Other else r''),
|
877
866
|
token),
|
878
867
|
include('s/escape'),
|
@@ -888,7 +877,7 @@ class Tads3Lexer(RegexLexer):
|
|
888
877
|
r'delegated|do|else|for|foreach|finally|goto|if|inherited|'
|
889
878
|
r'invokee|local|nil|new|operator|replaced|return|self|switch|'
|
890
879
|
r'targetobj|targetprop|throw|true|try|while)\b)', Text, 'block'),
|
891
|
-
(
|
880
|
+
(rf'({_name})({_ws}*)(\()',
|
892
881
|
bygroups(Name.Function, using(this, state='whitespace'),
|
893
882
|
Punctuation),
|
894
883
|
('block?/root', 'more/parameters', 'main/parameters')),
|
@@ -911,24 +900,24 @@ class Tads3Lexer(RegexLexer):
|
|
911
900
|
(r'\{', Punctuation, '#push'),
|
912
901
|
(r'\}', Punctuation, '#pop'),
|
913
902
|
(r':', Punctuation, ('classes', 'class')),
|
914
|
-
(
|
903
|
+
(rf'({_name}?)({_ws}*)(\()',
|
915
904
|
bygroups(Name.Function, using(this, state='whitespace'),
|
916
905
|
Punctuation),
|
917
906
|
('block?', 'more/parameters', 'main/parameters')),
|
918
|
-
(
|
907
|
+
(rf'({_name})({_ws}*)(\{{)',
|
919
908
|
bygroups(Name.Function, using(this, state='whitespace'),
|
920
909
|
Punctuation), 'block'),
|
921
|
-
(
|
910
|
+
(rf'({_name})({_ws}*)(:)',
|
922
911
|
bygroups(Name.Variable, using(this, state='whitespace'),
|
923
912
|
Punctuation),
|
924
913
|
('object-body/no-braces', 'classes', 'class')),
|
925
914
|
include('whitespace'),
|
926
|
-
(
|
915
|
+
(rf'->|{_operator}', Punctuation, 'main'),
|
927
916
|
default('main/object-body')
|
928
917
|
],
|
929
918
|
'main/object-body': [
|
930
919
|
include('main/basic'),
|
931
|
-
(
|
920
|
+
(rf'({_name})({_ws}*)(=?)',
|
932
921
|
bygroups(Name.Variable, using(this, state='whitespace'),
|
933
922
|
Punctuation), ('#pop', 'more', 'main')),
|
934
923
|
default('#pop:2')
|
@@ -951,7 +940,7 @@ class Tads3Lexer(RegexLexer):
|
|
951
940
|
(r'\{', Punctuation, '#push'),
|
952
941
|
(r'\}', Punctuation, '#pop'),
|
953
942
|
(r'default\b', Keyword.Reserved),
|
954
|
-
(
|
943
|
+
(rf'({_name})({_ws}*)(:)',
|
955
944
|
bygroups(Name.Label, using(this, state='whitespace'),
|
956
945
|
Punctuation)),
|
957
946
|
include('whitespace')
|
@@ -986,23 +975,23 @@ class Tads3Lexer(RegexLexer):
|
|
986
975
|
(r'R"', String.Regex, ('#pop', 'dqr')),
|
987
976
|
(r"R'", String.Regex, ('#pop', 'sqr')),
|
988
977
|
# Two-token keywords
|
989
|
-
(
|
978
|
+
(rf'(extern)({_ws}+)(object\b)',
|
990
979
|
bygroups(Keyword.Reserved, using(this, state='whitespace'),
|
991
980
|
Keyword.Reserved)),
|
992
|
-
(
|
981
|
+
(rf'(function|method)({_ws}*)(\()',
|
993
982
|
bygroups(Keyword.Reserved, using(this, state='whitespace'),
|
994
983
|
Punctuation),
|
995
984
|
('#pop', 'block?', 'more/parameters', 'main/parameters')),
|
996
|
-
(
|
985
|
+
(rf'(modify)({_ws}+)(grammar\b)',
|
997
986
|
bygroups(Keyword.Reserved, using(this, state='whitespace'),
|
998
987
|
Keyword.Reserved),
|
999
988
|
('#pop', 'object-body/no-braces', ':', 'grammar')),
|
1000
|
-
(
|
989
|
+
(rf'(new)({_ws}+(?=(?:function|method)\b))',
|
1001
990
|
bygroups(Keyword.Reserved, using(this, state='whitespace'))),
|
1002
|
-
(
|
991
|
+
(rf'(object)({_ws}+)(template\b)',
|
1003
992
|
bygroups(Keyword.Reserved, using(this, state='whitespace'),
|
1004
993
|
Keyword.Reserved), ('#pop', 'template')),
|
1005
|
-
(
|
994
|
+
(rf'(string)({_ws}+)(template\b)',
|
1006
995
|
bygroups(Keyword, using(this, state='whitespace'),
|
1007
996
|
Keyword.Reserved), ('#pop', 'function-name')),
|
1008
997
|
# Keywords
|
@@ -1039,7 +1028,7 @@ class Tads3Lexer(RegexLexer):
|
|
1039
1028
|
(r'self\b', Name.Builtin.Pseudo, '#pop'),
|
1040
1029
|
(r'template\b', Keyword.Reserved, ('#pop', 'template')),
|
1041
1030
|
# Operators
|
1042
|
-
(
|
1031
|
+
(rf'(__objref|defined)({_ws}*)(\()',
|
1043
1032
|
bygroups(Operator.Word, using(this, state='whitespace'),
|
1044
1033
|
Operator), ('#pop', 'more/__objref', 'main')),
|
1045
1034
|
(r'delegated\b', Operator.Word),
|
@@ -1065,7 +1054,7 @@ class Tads3Lexer(RegexLexer):
|
|
1065
1054
|
include('whitespace'),
|
1066
1055
|
(_operator, Operator, 'main'),
|
1067
1056
|
(r'\?', Operator, ('main', 'more/conditional', 'main')),
|
1068
|
-
(
|
1057
|
+
(rf'(is|not)({_ws}+)(in\b)',
|
1069
1058
|
bygroups(Operator.Word, using(this, state='whitespace'),
|
1070
1059
|
Operator.Word)),
|
1071
1060
|
(r'[^\s!"%-_a-z{-~]+', Error) # Averts an infinite loop
|
@@ -1112,9 +1101,9 @@ class Tads3Lexer(RegexLexer):
|
|
1112
1101
|
],
|
1113
1102
|
# Parameter list
|
1114
1103
|
'main/parameters': [
|
1115
|
-
(
|
1104
|
+
(rf'({_name})({_ws}*)(?=:)',
|
1116
1105
|
bygroups(Name.Variable, using(this, state='whitespace')), '#pop'),
|
1117
|
-
(
|
1106
|
+
(rf'({_name})({_ws}+)({_name})',
|
1118
1107
|
bygroups(Name.Class, using(this, state='whitespace'),
|
1119
1108
|
Name.Variable), '#pop'),
|
1120
1109
|
(r'\[+', Punctuation),
|
@@ -1123,7 +1112,7 @@ class Tads3Lexer(RegexLexer):
|
|
1123
1112
|
default('#pop')
|
1124
1113
|
],
|
1125
1114
|
'more/parameters': [
|
1126
|
-
(
|
1115
|
+
(rf'(:)({_ws}*(?=[?=,:)]))',
|
1127
1116
|
bygroups(Punctuation, using(this, state='whitespace'))),
|
1128
1117
|
(r'[?\]]+', Punctuation),
|
1129
1118
|
(r'[:)]', Punctuation, ('#pop', 'multimethod?')),
|
@@ -1181,10 +1170,10 @@ class Tads3Lexer(RegexLexer):
|
|
1181
1170
|
'grammar-rules': [
|
1182
1171
|
include('string'),
|
1183
1172
|
include('whitespace'),
|
1184
|
-
(
|
1173
|
+
(rf'(\[)({_ws}*)(badness)',
|
1185
1174
|
bygroups(Punctuation, using(this, state='whitespace'), Keyword),
|
1186
1175
|
'main'),
|
1187
|
-
(
|
1176
|
+
(rf'->|{_operator}|[()]', Punctuation),
|
1188
1177
|
(_name, Name.Constant),
|
1189
1178
|
default('#pop:2')
|
1190
1179
|
],
|
@@ -1193,7 +1182,7 @@ class Tads3Lexer(RegexLexer):
|
|
1193
1182
|
],
|
1194
1183
|
'function-name': [
|
1195
1184
|
(r'(<<([^>]|>>>|>(?!>))*>>)+', String.Interpol),
|
1196
|
-
(
|
1185
|
+
(rf'(?={_name}?{_ws}*[({{])', Text, '#pop'),
|
1197
1186
|
(_name, Name.Function, '#pop'),
|
1198
1187
|
include('whitespace')
|
1199
1188
|
],
|
@@ -1219,7 +1208,7 @@ class Tads3Lexer(RegexLexer):
|
|
1219
1208
|
include('string'),
|
1220
1209
|
(r'inherited\b', Keyword.Reserved),
|
1221
1210
|
include('whitespace'),
|
1222
|
-
(
|
1211
|
+
(rf'->|\?|{_operator}', Punctuation),
|
1223
1212
|
(_name, Name.Variable)
|
1224
1213
|
],
|
1225
1214
|
|
@@ -1259,11 +1248,11 @@ class Tads3Lexer(RegexLexer):
|
|
1259
1248
|
|
1260
1249
|
# Whitespace and comments
|
1261
1250
|
'whitespace': [
|
1262
|
-
(
|
1251
|
+
(rf'^{_ws_pp}*#({_comment_multiline}|[^\n]|(?<=\\)\n)*\n?',
|
1263
1252
|
Comment.Preproc),
|
1264
1253
|
(_comment_single, Comment.Single),
|
1265
1254
|
(_comment_multiline, Comment.Multiline),
|
1266
|
-
(
|
1255
|
+
(rf'\\+\n+{_ws_pp}*#?|\n+|([^\S\n]|\\)+', Text)
|
1267
1256
|
],
|
1268
1257
|
|
1269
1258
|
# Strings
|
@@ -1274,15 +1263,15 @@ class Tads3Lexer(RegexLexer):
|
|
1274
1263
|
(r"'", String.Single, 'sqs')
|
1275
1264
|
],
|
1276
1265
|
's/escape': [
|
1277
|
-
(
|
1266
|
+
(rf'\{{\{{|\}}\}}|{_escape}', String.Escape)
|
1278
1267
|
],
|
1279
1268
|
's/verbatim': [
|
1280
1269
|
(r'<<\s*(as\s+decreasingly\s+likely\s+outcomes|cycling|else|end|'
|
1281
1270
|
r'first\s+time|one\s+of|only|or|otherwise|'
|
1282
1271
|
r'(sticky|(then\s+)?(purely\s+)?at)\s+random|stopping|'
|
1283
1272
|
r'(then\s+)?(half\s+)?shuffled|\|\|)\s*>>', String.Interpol),
|
1284
|
-
(
|
1285
|
-
r'\s*((else|otherwise)\s+)?(if|unless)\b)?'
|
1273
|
+
(rf'<<(%(_({_escape}|\\?.)|[\-+ ,#]|\[\d*\]?)*\d*\.?\d*({_escape}|\\?.)|'
|
1274
|
+
r'\s*((else|otherwise)\s+)?(if|unless)\b)?',
|
1286
1275
|
String.Interpol, ('block/embed', 'more/embed', 'main'))
|
1287
1276
|
],
|
1288
1277
|
's/entity': [
|
@@ -1345,23 +1334,22 @@ class Tads3Lexer(RegexLexer):
|
|
1345
1334
|
}
|
1346
1335
|
|
1347
1336
|
def get_tokens_unprocessed(self, text, **kwargs):
|
1348
|
-
pp =
|
1337
|
+
pp = rf'^{self._ws_pp}*#{self._ws_pp}*'
|
1349
1338
|
if_false_level = 0
|
1350
1339
|
for index, token, value in (
|
1351
1340
|
RegexLexer.get_tokens_unprocessed(self, text, **kwargs)):
|
1352
1341
|
if if_false_level == 0: # Not in a false #if
|
1353
1342
|
if (token is Comment.Preproc and
|
1354
|
-
re.match(
|
1355
|
-
(pp, self._ws_pp, self._ws_pp), value)):
|
1343
|
+
re.match(rf'{pp}if{self._ws_pp}+(0|nil){self._ws_pp}*$\n?', value)):
|
1356
1344
|
if_false_level = 1
|
1357
1345
|
else: # In a false #if
|
1358
1346
|
if token is Comment.Preproc:
|
1359
1347
|
if (if_false_level == 1 and
|
1360
|
-
re.match(
|
1348
|
+
re.match(rf'{pp}el(if|se)\b', value)):
|
1361
1349
|
if_false_level = 0
|
1362
|
-
elif re.match(
|
1350
|
+
elif re.match(rf'{pp}if', value):
|
1363
1351
|
if_false_level += 1
|
1364
|
-
elif re.match(
|
1352
|
+
elif re.match(rf'{pp}endif\b', value):
|
1365
1353
|
if_false_level -= 1
|
1366
1354
|
else:
|
1367
1355
|
token = Comment
|