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,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Lexers for Matlab 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
|
|
@@ -2776,7 +2776,7 @@ class MatlabSessionLexer(Lexer):
|
|
2776
2776
|
# line = "\n" + line
|
2777
2777
|
token = (0, Generic.Traceback, line)
|
2778
2778
|
insertions.append((idx, [token]))
|
2779
|
-
elif continuation:
|
2779
|
+
elif continuation and insertions:
|
2780
2780
|
# line_start is the length of the most recent prompt symbol
|
2781
2781
|
line_start = len(insertions[-1][-1][-1])
|
2782
2782
|
# Set leading spaces with the length of the prompt to be a generic prompt
|
@@ -2815,6 +2815,7 @@ class OctaveLexer(RegexLexer):
|
|
2815
2815
|
.. versionadded:: 1.5
|
2816
2816
|
"""
|
2817
2817
|
name = 'Octave'
|
2818
|
+
url = 'https://www.gnu.org/software/octave/index'
|
2818
2819
|
aliases = ['octave']
|
2819
2820
|
filenames = ['*.m']
|
2820
2821
|
mimetypes = ['text/octave']
|
@@ -3232,6 +3233,7 @@ class ScilabLexer(RegexLexer):
|
|
3232
3233
|
.. versionadded:: 1.5
|
3233
3234
|
"""
|
3234
3235
|
name = 'Scilab'
|
3236
|
+
url = 'https://www.scilab.org/'
|
3235
3237
|
aliases = ['scilab']
|
3236
3238
|
filenames = ['*.sci', '*.sce', '*.tst']
|
3237
3239
|
mimetypes = ['text/scilab']
|
@@ -3262,7 +3264,7 @@ class ScilabLexer(RegexLexer):
|
|
3262
3264
|
(r'\.\*|\*|\+|\.\^|\.\\|\.\/|\/|\\', Operator),
|
3263
3265
|
|
3264
3266
|
# punctuation:
|
3265
|
-
(r'[\[\](){}@.,=:;]', Punctuation),
|
3267
|
+
(r'[\[\](){}@.,=:;]+', Punctuation),
|
3266
3268
|
|
3267
3269
|
(r'"[^"]*"', String),
|
3268
3270
|
|
@@ -3276,6 +3278,7 @@ class ScilabLexer(RegexLexer):
|
|
3276
3278
|
(r'\d+', Number.Integer),
|
3277
3279
|
|
3278
3280
|
(r'[a-zA-Z_]\w*', Name),
|
3281
|
+
(r'\s+', Whitespace),
|
3279
3282
|
(r'.', Text),
|
3280
3283
|
],
|
3281
3284
|
'string': [
|
@@ -3291,3 +3294,15 @@ class ScilabLexer(RegexLexer):
|
|
3291
3294
|
(r'(\s*)([a-zA-Z_]\w*)', bygroups(Text, Name.Function), '#pop'),
|
3292
3295
|
],
|
3293
3296
|
}
|
3297
|
+
|
3298
|
+
# the following is needed to distinguish Scilab and GAP .tst files
|
3299
|
+
def analyse_text(text):
|
3300
|
+
score = 0.0
|
3301
|
+
|
3302
|
+
# Scilab comments (don't appear in e.g. GAP code)
|
3303
|
+
if re.search(r"^\s*//", text):
|
3304
|
+
score += 0.1
|
3305
|
+
if re.search(r"^\s*/\*", text):
|
3306
|
+
score += 0.1
|
3307
|
+
|
3308
|
+
return min(score, 1.0)
|
@@ -0,0 +1,85 @@
|
|
1
|
+
"""
|
2
|
+
pygments.lexers.maxima
|
3
|
+
~~~~~~~~~~~~~~~~~~~~~~
|
4
|
+
|
5
|
+
Lexer for the computer algebra system Maxima.
|
6
|
+
|
7
|
+
Derived from pygments/lexers/algebra.py.
|
8
|
+
|
9
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
10
|
+
:license: BSD, see LICENSE for details.
|
11
|
+
"""
|
12
|
+
|
13
|
+
import re
|
14
|
+
|
15
|
+
from pygments.lexer import RegexLexer, bygroups, words
|
16
|
+
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
17
|
+
Number, Punctuation
|
18
|
+
|
19
|
+
__all__ = ['MaximaLexer']
|
20
|
+
|
21
|
+
class MaximaLexer(RegexLexer):
|
22
|
+
"""
|
23
|
+
A Maxima lexer.
|
24
|
+
Derived from pygments.lexers.MuPADLexer.
|
25
|
+
|
26
|
+
.. versionadded:: 2.11
|
27
|
+
"""
|
28
|
+
name = 'Maxima'
|
29
|
+
url = 'http://maxima.sourceforge.net'
|
30
|
+
aliases = ['maxima', 'macsyma']
|
31
|
+
filenames = ['*.mac', '*.max']
|
32
|
+
|
33
|
+
keywords = ('if', 'then', 'else', 'elseif',
|
34
|
+
'do', 'while', 'repeat', 'until',
|
35
|
+
'for', 'from', 'to', 'downto', 'step', 'thru')
|
36
|
+
|
37
|
+
constants = ('%pi', '%e', '%phi', '%gamma', '%i',
|
38
|
+
'und', 'ind', 'infinity', 'inf', 'minf',
|
39
|
+
'true', 'false', 'unknown', 'done')
|
40
|
+
|
41
|
+
operators = (r'.', r':', r'=', r'#',
|
42
|
+
r'+', r'-', r'*', r'/', r'^',
|
43
|
+
r'@', r'>', r'<', r'|', r'!', r"'")
|
44
|
+
|
45
|
+
operator_words = ('and', 'or', 'not')
|
46
|
+
|
47
|
+
tokens = {
|
48
|
+
'root': [
|
49
|
+
(r'/\*', Comment.Multiline, 'comment'),
|
50
|
+
(r'"(?:[^"\\]|\\.)*"', String),
|
51
|
+
(r'\(|\)|\[|\]|\{|\}', Punctuation),
|
52
|
+
(r'[,;$]', Punctuation),
|
53
|
+
(words (constants), Name.Constant),
|
54
|
+
(words (keywords), Keyword),
|
55
|
+
(words (operators), Operator),
|
56
|
+
(words (operator_words), Operator.Word),
|
57
|
+
(r'''(?x)
|
58
|
+
((?:[a-zA-Z_#][\w#]*|`[^`]*`)
|
59
|
+
(?:::[a-zA-Z_#][\w#]*|`[^`]*`)*)(\s*)([(])''',
|
60
|
+
bygroups(Name.Function, Text.Whitespace, Punctuation)),
|
61
|
+
(r'''(?x)
|
62
|
+
(?:[a-zA-Z_#%][\w#%]*|`[^`]*`)
|
63
|
+
(?:::[a-zA-Z_#%][\w#%]*|`[^`]*`)*''', Name.Variable),
|
64
|
+
(r'[-+]?(\d*\.\d+([bdefls][-+]?\d+)?|\d+(\.\d*)?[bdefls][-+]?\d+)', Number.Float),
|
65
|
+
(r'[-+]?\d+', Number.Integer),
|
66
|
+
(r'\s+', Text.Whitespace),
|
67
|
+
(r'.', Text)
|
68
|
+
],
|
69
|
+
'comment': [
|
70
|
+
(r'[^*/]+', Comment.Multiline),
|
71
|
+
(r'/\*', Comment.Multiline, '#push'),
|
72
|
+
(r'\*/', Comment.Multiline, '#pop'),
|
73
|
+
(r'[*/]', Comment.Multiline)
|
74
|
+
]
|
75
|
+
}
|
76
|
+
|
77
|
+
def analyse_text (text):
|
78
|
+
strength = 0.0
|
79
|
+
# Input expression terminator.
|
80
|
+
if re.search (r'\$\s*$', text, re.MULTILINE):
|
81
|
+
strength += 0.05
|
82
|
+
# Function definition operator.
|
83
|
+
if ':=' in text:
|
84
|
+
strength += 0.02
|
85
|
+
return strength
|
@@ -4,38 +4,24 @@
|
|
4
4
|
|
5
5
|
Pygments lexer for the Meson build system
|
6
6
|
|
7
|
-
:copyright: Copyright
|
7
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
11
|
-
import
|
12
|
-
|
13
|
-
|
14
|
-
RegexLexer,
|
15
|
-
words,
|
16
|
-
include,
|
17
|
-
)
|
18
|
-
from pygments.token import (
|
19
|
-
Comment,
|
20
|
-
Name,
|
21
|
-
Number,
|
22
|
-
Punctuation,
|
23
|
-
Operator,
|
24
|
-
Keyword,
|
25
|
-
String,
|
26
|
-
Whitespace,
|
27
|
-
)
|
11
|
+
from pygments.lexer import RegexLexer, words, include
|
12
|
+
from pygments.token import Comment, Name, Number, Punctuation, Operator, \
|
13
|
+
Keyword, String, Whitespace
|
28
14
|
|
29
15
|
__all__ = ['MesonLexer']
|
30
16
|
|
31
17
|
|
32
18
|
class MesonLexer(RegexLexer):
|
33
|
-
"""
|
34
|
-
|
19
|
+
"""Meson language lexer.
|
20
|
+
|
35
21
|
The grammar definition use to transcribe the syntax was retrieved from
|
36
|
-
https://mesonbuild.com/Syntax.html#grammar for version 0.58
|
37
|
-
Some of those definitions are improperly transcribed so the Meson++
|
38
|
-
implementation was also checked: https://github.com/dcbaker/meson-plus-plus
|
22
|
+
https://mesonbuild.com/Syntax.html#grammar for version 0.58.
|
23
|
+
Some of those definitions are improperly transcribed, so the Meson++
|
24
|
+
implementation was also checked: https://github.com/dcbaker/meson-plus-plus.
|
39
25
|
|
40
26
|
.. versionadded:: 2.10
|
41
27
|
"""
|
@@ -44,12 +30,11 @@ class MesonLexer(RegexLexer):
|
|
44
30
|
# TODO keyword_arg: value inner matches
|
45
31
|
|
46
32
|
name = 'Meson'
|
33
|
+
url = 'https://mesonbuild.com/'
|
47
34
|
aliases = ['meson', 'meson.build']
|
48
35
|
filenames = ['meson.build', 'meson_options.txt']
|
49
36
|
mimetypes = ['text/x-meson']
|
50
37
|
|
51
|
-
flags = re.MULTILINE | re.UNICODE
|
52
|
-
|
53
38
|
tokens = {
|
54
39
|
'root': [
|
55
40
|
(r'#.*?$', Comment),
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Lexer for Multipurpose Internet Mail Extensions (MIME) data.
|
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
|
|
@@ -88,7 +88,7 @@ class MIMELexer(RegexLexer):
|
|
88
88
|
pos_body_start = pos_body_start + 1
|
89
89
|
entire_body = entire_body[1:]
|
90
90
|
|
91
|
-
# if it is not a
|
91
|
+
# if it is not a multipart
|
92
92
|
if not self.content_type.startswith("multipart") or not self.boundary:
|
93
93
|
for i, t, v in self.get_bodypart_tokens(entire_body):
|
94
94
|
yield pos_body_start + i, t, v
|
@@ -0,0 +1,394 @@
|
|
1
|
+
"""
|
2
|
+
pygments.lexers.minecraft
|
3
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~
|
4
|
+
|
5
|
+
Lexers for Minecraft related languages.
|
6
|
+
|
7
|
+
SNBT. A data communication format used in Minecraft.
|
8
|
+
wiki: https://minecraft.fandom.com/wiki/NBT_format
|
9
|
+
|
10
|
+
MCFunction. The Function file for Minecraft Data packs and Add-ons.
|
11
|
+
official: https://learn.microsoft.com/en-us/minecraft/creator/documents/functionsintroduction
|
12
|
+
wiki: https://minecraft.fandom.com/wiki/Function
|
13
|
+
|
14
|
+
MCSchema. A kind of data Schema for Minecraft Add-on Development.
|
15
|
+
official: https://learn.microsoft.com/en-us/minecraft/creator/reference/content/schemasreference/
|
16
|
+
community example: https://www.mcbe-dev.net/addons/data-driven/manifest.html
|
17
|
+
|
18
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
19
|
+
:license: BSD, see LICENSE for details.
|
20
|
+
"""
|
21
|
+
|
22
|
+
from pygments.lexer import RegexLexer, default, include, bygroups
|
23
|
+
from pygments.token import Comment, Keyword, Literal, Name, Number, Operator, \
|
24
|
+
Punctuation, String, Text, Whitespace
|
25
|
+
|
26
|
+
__all__ = ['SNBTLexer', 'MCFunctionLexer', 'MCSchemaLexer']
|
27
|
+
|
28
|
+
|
29
|
+
class SNBTLexer(RegexLexer):
|
30
|
+
"""Lexer for stringified NBT, a data format used in Minecraft
|
31
|
+
|
32
|
+
.. versionadded:: 2.12.0
|
33
|
+
"""
|
34
|
+
|
35
|
+
name = "SNBT"
|
36
|
+
url = "https://minecraft.fandom.com/wiki/NBT_format"
|
37
|
+
aliases = ["snbt"]
|
38
|
+
filenames = ["*.snbt"]
|
39
|
+
mimetypes = ["text/snbt"]
|
40
|
+
|
41
|
+
tokens = {
|
42
|
+
"root": [
|
43
|
+
# We only look for the open bracket here since square bracket
|
44
|
+
# is only valid in NBT pathing (which is a mcfunction idea).
|
45
|
+
(r"\{", Punctuation, "compound"),
|
46
|
+
(r"[^\{]+", Text),
|
47
|
+
],
|
48
|
+
|
49
|
+
"whitespace": [
|
50
|
+
(r"\s+", Whitespace),
|
51
|
+
],
|
52
|
+
|
53
|
+
"operators": [
|
54
|
+
(r"[,:;]", Punctuation),
|
55
|
+
],
|
56
|
+
|
57
|
+
"literals": [
|
58
|
+
(r"(true|false)", Keyword.Constant),
|
59
|
+
(r"-?\d+[eE]-?\d+", Number.Float),
|
60
|
+
(r"-?\d*\.\d+[fFdD]?", Number.Float),
|
61
|
+
(r"-?\d+[bBsSlLfFdD]?", Number.Integer),
|
62
|
+
|
63
|
+
# Separate states for both types of strings so they don't entangle
|
64
|
+
(r'"', String.Double, "literals.string_double"),
|
65
|
+
(r"'", String.Single, "literals.string_single"),
|
66
|
+
],
|
67
|
+
"literals.string_double": [
|
68
|
+
(r"\\.", String.Escape),
|
69
|
+
(r'[^\\"\n]+', String.Double),
|
70
|
+
(r'"', String.Double, "#pop"),
|
71
|
+
],
|
72
|
+
"literals.string_single": [
|
73
|
+
(r"\\.", String.Escape),
|
74
|
+
(r"[^\\'\n]+", String.Single),
|
75
|
+
(r"'", String.Single, "#pop"),
|
76
|
+
],
|
77
|
+
|
78
|
+
"compound": [
|
79
|
+
# this handles the unquoted snbt keys
|
80
|
+
# note: stringified keys still work
|
81
|
+
(r"[A-Z_a-z]+", Name.Attribute),
|
82
|
+
include("operators"),
|
83
|
+
include("whitespace"),
|
84
|
+
include("literals"),
|
85
|
+
(r"\{", Punctuation, "#push"),
|
86
|
+
(r"\[", Punctuation, "list"),
|
87
|
+
(r"\}", Punctuation, "#pop"),
|
88
|
+
],
|
89
|
+
|
90
|
+
"list": [
|
91
|
+
(r"[A-Z_a-z]+", Name.Attribute),
|
92
|
+
include("literals"),
|
93
|
+
include("operators"),
|
94
|
+
include("whitespace"),
|
95
|
+
(r"\[", Punctuation, "#push"),
|
96
|
+
(r"\{", Punctuation, "compound"),
|
97
|
+
(r"\]", Punctuation, "#pop"),
|
98
|
+
],
|
99
|
+
}
|
100
|
+
|
101
|
+
|
102
|
+
class MCFunctionLexer(RegexLexer):
|
103
|
+
"""Lexer for the mcfunction scripting language used in Minecraft
|
104
|
+
Modelled somewhat after the `GitHub mcfunction grammar <https://github.com/Arcensoth/language-mcfunction>`_.
|
105
|
+
|
106
|
+
.. versionadded:: 2.12.0
|
107
|
+
"""
|
108
|
+
|
109
|
+
name = "MCFunction"
|
110
|
+
url = "https://minecraft.fandom.com/wiki/Commands"
|
111
|
+
aliases = ["mcfunction", "mcf"]
|
112
|
+
filenames = ["*.mcfunction"]
|
113
|
+
mimetypes = ["text/mcfunction"]
|
114
|
+
|
115
|
+
# Used to denotate the start of a block comment, borrowed from Github's mcfunction
|
116
|
+
_block_comment_prefix = "[>!]"
|
117
|
+
|
118
|
+
tokens = {
|
119
|
+
"root": [
|
120
|
+
include("names"),
|
121
|
+
include("comments"),
|
122
|
+
include("literals"),
|
123
|
+
include("whitespace"),
|
124
|
+
include("property"),
|
125
|
+
include("operators"),
|
126
|
+
include("selectors"),
|
127
|
+
],
|
128
|
+
|
129
|
+
"names": [
|
130
|
+
# The start of a command (either beginning of line OR after the run keyword)
|
131
|
+
# We don't encode a list of keywords since mods, plugins, or even pre-processors
|
132
|
+
# may add new commands, so we have a 'close-enough' regex which catches them.
|
133
|
+
(r"^(\s*)([a-z_]+)", bygroups(Whitespace, Name.Builtin)),
|
134
|
+
(r"(?<=run)\s+[a-z_]+", Name.Builtin),
|
135
|
+
|
136
|
+
# UUID
|
137
|
+
(r"\b[0-9a-fA-F]+(?:-[0-9a-fA-F]+){4}\b", Name.Variable),
|
138
|
+
include("resource-name"),
|
139
|
+
# normal command names and scoreboards
|
140
|
+
# there's no way to know the differences unfortuntely
|
141
|
+
(r"[A-Za-z_][\w.#%$]+", Keyword.Constant),
|
142
|
+
(r"[#%$][\w.#%$]+", Name.Variable.Magic),
|
143
|
+
],
|
144
|
+
|
145
|
+
"resource-name": [
|
146
|
+
# resource names have to be lowercase
|
147
|
+
(r"#?[a-z_][a-z_.-]*:[a-z0-9_./-]+", Name.Function),
|
148
|
+
# similar to above except optional `:``
|
149
|
+
# a `/` must be present "somewhere"
|
150
|
+
(r"#?[a-z0-9_\.\-]+\/[a-z0-9_\.\-\/]+", Name.Function),
|
151
|
+
],
|
152
|
+
|
153
|
+
"whitespace": [
|
154
|
+
(r"\s+", Whitespace),
|
155
|
+
],
|
156
|
+
|
157
|
+
"comments": [
|
158
|
+
(rf"^\s*(#{_block_comment_prefix})", Comment.Multiline,
|
159
|
+
("comments.block", "comments.block.emphasized")),
|
160
|
+
(r"#.*$", Comment.Single),
|
161
|
+
],
|
162
|
+
"comments.block": [
|
163
|
+
(rf"^\s*#{_block_comment_prefix}", Comment.Multiline,
|
164
|
+
"comments.block.emphasized"),
|
165
|
+
(r"^\s*#", Comment.Multiline, "comments.block.normal"),
|
166
|
+
default("#pop"),
|
167
|
+
],
|
168
|
+
"comments.block.normal": [
|
169
|
+
include("comments.block.special"),
|
170
|
+
(r"\S+", Comment.Multiline),
|
171
|
+
(r"\n", Text, "#pop"),
|
172
|
+
include("whitespace"),
|
173
|
+
],
|
174
|
+
"comments.block.emphasized": [
|
175
|
+
include("comments.block.special"),
|
176
|
+
(r"\S+", String.Doc),
|
177
|
+
(r"\n", Text, "#pop"),
|
178
|
+
include("whitespace"),
|
179
|
+
],
|
180
|
+
"comments.block.special": [
|
181
|
+
# Params
|
182
|
+
(r"@\S+", Name.Decorator),
|
183
|
+
|
184
|
+
include("resource-name"),
|
185
|
+
|
186
|
+
# Scoreboard player names
|
187
|
+
(r"[#%$][\w.#%$]+", Name.Variable.Magic),
|
188
|
+
],
|
189
|
+
|
190
|
+
"operators": [
|
191
|
+
(r"[\-~%^?!+*<>\\/|&=.]", Operator),
|
192
|
+
],
|
193
|
+
|
194
|
+
"literals": [
|
195
|
+
(r"\.\.", Literal),
|
196
|
+
(r"(true|false)", Keyword.Pseudo),
|
197
|
+
|
198
|
+
# these are like unquoted strings and appear in many places
|
199
|
+
(r"[A-Za-z_]+", Name.Variable.Class),
|
200
|
+
|
201
|
+
(r"[0-7]b", Number.Byte),
|
202
|
+
(r"[+-]?\d*\.?\d+([eE]?[+-]?\d+)?[df]?\b", Number.Float),
|
203
|
+
(r"[+-]?\d+\b", Number.Integer),
|
204
|
+
(r'"', String.Double, "literals.string-double"),
|
205
|
+
(r"'", String.Single, "literals.string-single"),
|
206
|
+
],
|
207
|
+
"literals.string-double": [
|
208
|
+
(r"\\.", String.Escape),
|
209
|
+
(r'[^\\"\n]+', String.Double),
|
210
|
+
(r'"', String.Double, "#pop"),
|
211
|
+
],
|
212
|
+
"literals.string-single": [
|
213
|
+
(r"\\.", String.Escape),
|
214
|
+
(r"[^\\'\n]+", String.Single),
|
215
|
+
(r"'", String.Single, "#pop"),
|
216
|
+
],
|
217
|
+
|
218
|
+
"selectors": [
|
219
|
+
(r"@[a-z]", Name.Variable),
|
220
|
+
],
|
221
|
+
|
222
|
+
|
223
|
+
## Generic Property Container
|
224
|
+
# There are several, differing instances where the language accepts
|
225
|
+
# specific contained keys or contained key, value pairings.
|
226
|
+
#
|
227
|
+
# Property Maps:
|
228
|
+
# - Starts with either `[` or `{`
|
229
|
+
# - Key separated by `:` or `=`
|
230
|
+
# - Deliminated by `,`
|
231
|
+
#
|
232
|
+
# Property Lists:
|
233
|
+
# - Starts with `[`
|
234
|
+
# - Deliminated by `,`
|
235
|
+
#
|
236
|
+
# For simplicity, these patterns match a generic, nestable structure
|
237
|
+
# which follow a key, value pattern. For normal lists, there's only keys.
|
238
|
+
# This allow some "illegal" structures, but we'll accept those for
|
239
|
+
# sake of simplicity
|
240
|
+
#
|
241
|
+
# Examples:
|
242
|
+
# - `[facing=up, powered=true]` (blockstate)
|
243
|
+
# - `[name="hello world", nbt={key: 1b}]` (selector + nbt)
|
244
|
+
# - `[{"text": "value"}, "literal"]` (json)
|
245
|
+
##
|
246
|
+
"property": [
|
247
|
+
# This state gets included in root and also several substates
|
248
|
+
# We do this to shortcut the starting of new properties
|
249
|
+
# within other properties. Lists can have sublists and compounds
|
250
|
+
# and values can start a new property (see the `difficult_1.txt`
|
251
|
+
# snippet).
|
252
|
+
(r"\{", Punctuation, ("property.curly", "property.key")),
|
253
|
+
(r"\[", Punctuation, ("property.square", "property.key")),
|
254
|
+
],
|
255
|
+
"property.curly": [
|
256
|
+
include("whitespace"),
|
257
|
+
include("property"),
|
258
|
+
(r"\}", Punctuation, "#pop"),
|
259
|
+
],
|
260
|
+
"property.square": [
|
261
|
+
include("whitespace"),
|
262
|
+
include("property"),
|
263
|
+
(r"\]", Punctuation, "#pop"),
|
264
|
+
|
265
|
+
# lists can have sequences of items
|
266
|
+
(r",", Punctuation),
|
267
|
+
],
|
268
|
+
"property.key": [
|
269
|
+
include("whitespace"),
|
270
|
+
|
271
|
+
# resource names (for advancements)
|
272
|
+
# can omit `:` to default `minecraft:`
|
273
|
+
# must check if there is a future equals sign if `:` is in the name
|
274
|
+
(r"#?[a-z_][a-z_\.\-]*\:[a-z0-9_\.\-/]+(?=\s*\=)", Name.Attribute, "property.delimiter"),
|
275
|
+
(r"#?[a-z_][a-z0-9_\.\-/]+", Name.Attribute, "property.delimiter"),
|
276
|
+
|
277
|
+
# unquoted NBT key
|
278
|
+
(r"[A-Za-z_\-\+]+", Name.Attribute, "property.delimiter"),
|
279
|
+
|
280
|
+
# quoted JSON or NBT key
|
281
|
+
(r'"', Name.Attribute, "property.delimiter", "literals.string-double"),
|
282
|
+
(r"'", Name.Attribute, "property.delimiter", "literals.string-single"),
|
283
|
+
|
284
|
+
# index for a list
|
285
|
+
(r"-?\d+", Number.Integer, "property.delimiter"),
|
286
|
+
|
287
|
+
default("#pop"),
|
288
|
+
],
|
289
|
+
"property.key.string-double": [
|
290
|
+
(r"\\.", String.Escape),
|
291
|
+
(r'[^\\"\n]+', Name.Attribute),
|
292
|
+
(r'"', Name.Attribute, "#pop"),
|
293
|
+
],
|
294
|
+
"property.key.string-single": [
|
295
|
+
(r"\\.", String.Escape),
|
296
|
+
(r"[^\\'\n]+", Name.Attribute),
|
297
|
+
(r"'", Name.Attribute, "#pop"),
|
298
|
+
],
|
299
|
+
"property.delimiter": [
|
300
|
+
include("whitespace"),
|
301
|
+
|
302
|
+
(r"[:=]!?", Punctuation, "property.value"),
|
303
|
+
(r",", Punctuation),
|
304
|
+
|
305
|
+
default("#pop"),
|
306
|
+
],
|
307
|
+
"property.value": [
|
308
|
+
include("whitespace"),
|
309
|
+
|
310
|
+
# unquoted resource names are valid literals here
|
311
|
+
(r"#?[a-z_][a-z_\.\-]*\:[a-z0-9_\.\-/]+", Name.Tag),
|
312
|
+
(r"#?[a-z_][a-z0-9_\.\-/]+", Name.Tag),
|
313
|
+
|
314
|
+
include("literals"),
|
315
|
+
include("property"),
|
316
|
+
|
317
|
+
default("#pop"),
|
318
|
+
],
|
319
|
+
}
|
320
|
+
|
321
|
+
|
322
|
+
class MCSchemaLexer(RegexLexer):
|
323
|
+
"""Lexer for Minecraft Add-ons data Schemas, an interface structure standard used in Minecraft
|
324
|
+
|
325
|
+
.. versionadded:: 2.14.0
|
326
|
+
"""
|
327
|
+
|
328
|
+
name = 'MCSchema'
|
329
|
+
url = 'https://learn.microsoft.com/en-us/minecraft/creator/reference/content/schemasreference/'
|
330
|
+
aliases = ['mcschema']
|
331
|
+
filenames = ['*.mcschema']
|
332
|
+
mimetypes = ['text/mcschema']
|
333
|
+
|
334
|
+
tokens = {
|
335
|
+
'commentsandwhitespace': [
|
336
|
+
(r'\s+', Whitespace),
|
337
|
+
(r'//.*?$', Comment.Single),
|
338
|
+
(r'/\*.*?\*/', Comment.Multiline)
|
339
|
+
],
|
340
|
+
'slashstartsregex': [
|
341
|
+
include('commentsandwhitespace'),
|
342
|
+
(r'/(\\.|[^[/\\\n]|\[(\\.|[^\]\\\n])*])+/'
|
343
|
+
r'([gimuysd]+\b|\B)', String.Regex, '#pop'),
|
344
|
+
(r'(?=/)', Text, ('#pop', 'badregex')),
|
345
|
+
default('#pop')
|
346
|
+
],
|
347
|
+
'badregex': [
|
348
|
+
(r'\n', Whitespace, '#pop')
|
349
|
+
],
|
350
|
+
'singlestring': [
|
351
|
+
(r'\\.', String.Escape),
|
352
|
+
(r"'", String.Single, '#pop'),
|
353
|
+
(r"[^\\']+", String.Single),
|
354
|
+
],
|
355
|
+
'doublestring': [
|
356
|
+
(r'\\.', String.Escape),
|
357
|
+
(r'"', String.Double, '#pop'),
|
358
|
+
(r'[^\\"]+', String.Double),
|
359
|
+
],
|
360
|
+
'root': [
|
361
|
+
(r'^(?=\s|/|<!--)', Text, 'slashstartsregex'),
|
362
|
+
include('commentsandwhitespace'),
|
363
|
+
|
364
|
+
# keywords for optional word and field types
|
365
|
+
(r'(?<=: )opt', Operator.Word),
|
366
|
+
(r'(?<=\s)[\w-]*(?=(\s+"|\n))', Keyword.Declaration),
|
367
|
+
|
368
|
+
# numeric literals
|
369
|
+
(r'0[bB][01]+', Number.Bin),
|
370
|
+
(r'0[oO]?[0-7]+', Number.Oct),
|
371
|
+
(r'0[xX][0-9a-fA-F]+', Number.Hex),
|
372
|
+
(r'\d+', Number.Integer),
|
373
|
+
(r'(\.\d+|\d+\.\d*|\d+)([eE][-+]?\d+)?', Number.Float),
|
374
|
+
|
375
|
+
# possible punctuations
|
376
|
+
(r'\.\.\.|=>', Punctuation),
|
377
|
+
(r'\+\+|--|~|\?\?=?|\?|:|\\(?=\n)|'
|
378
|
+
r'(<<|>>>?|==?|!=?|(?:\*\*|\|\||&&|[-<>+*%&|^/]))=?', Operator, 'slashstartsregex'),
|
379
|
+
(r'[{(\[;,]', Punctuation, 'slashstartsregex'),
|
380
|
+
(r'[})\].]', Punctuation),
|
381
|
+
|
382
|
+
# strings
|
383
|
+
(r"'", String.Single, 'singlestring'),
|
384
|
+
(r'"', String.Double, 'doublestring'),
|
385
|
+
|
386
|
+
# title line
|
387
|
+
(r'[\w-]*?(?=:\{?\n)', String.Symbol),
|
388
|
+
# title line with a version code, formatted
|
389
|
+
# `major.minor.patch-prerelease+buildmeta`
|
390
|
+
(r'([\w-]*?)(:)(\d+)(?:(\.)(\d+)(?:(\.)(\d+)(?:(\-)((?:[^\W_]|-)*(?:\.(?:[^\W_]|-)*)*))?(?:(\+)((?:[^\W_]|-)+(?:\.(?:[^\W_]|-)+)*))?)?)?(?=:\{?\n)', bygroups(String.Symbol, Operator, Number.Integer, Operator, Number.Integer, Operator, Number.Integer, Operator, String, Operator, String)),
|
391
|
+
|
392
|
+
(r'.*\n', Text),
|
393
|
+
]
|
394
|
+
}
|