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,31 +4,29 @@
|
|
4
4
|
|
5
5
|
Lexers for the Factor language.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
11
|
-
import re
|
12
|
-
|
13
11
|
from pygments.lexer import RegexLexer, bygroups, default, words
|
14
|
-
from pygments.token import Text, Comment, Keyword, Name, String, Number
|
12
|
+
from pygments.token import Text, Comment, Keyword, Name, String, Number, \
|
13
|
+
Whitespace, Punctuation
|
15
14
|
|
16
15
|
__all__ = ['FactorLexer']
|
17
16
|
|
18
17
|
|
19
18
|
class FactorLexer(RegexLexer):
|
20
19
|
"""
|
21
|
-
Lexer for the
|
20
|
+
Lexer for the Factor language.
|
22
21
|
|
23
22
|
.. versionadded:: 1.4
|
24
23
|
"""
|
25
24
|
name = 'Factor'
|
25
|
+
url = 'http://factorcode.org'
|
26
26
|
aliases = ['factor']
|
27
27
|
filenames = ['*.factor']
|
28
28
|
mimetypes = ['text/x-factor']
|
29
29
|
|
30
|
-
flags = re.MULTILINE | re.UNICODE
|
31
|
-
|
32
30
|
builtin_kernel = words((
|
33
31
|
'-rot', '2bi', '2bi@', '2bi*', '2curry', '2dip', '2drop', '2dup', '2keep', '2nip',
|
34
32
|
'2over', '2tri', '2tri@', '2tri*', '3bi', '3curry', '3dip', '3drop', '3dup', '3keep',
|
@@ -43,7 +41,7 @@ class FactorLexer(RegexLexer):
|
|
43
41
|
'pick', 'prepose', 'retainstack', 'rot', 'same?', 'swap', 'swapd', 'throw',
|
44
42
|
'tri', 'tri-curry', 'tri-curry@', 'tri-curry*', 'tri@', 'tri*', 'tuple',
|
45
43
|
'tuple?', 'unless', 'unless*', 'until', 'when', 'when*', 'while', 'with',
|
46
|
-
'wrapper', 'wrapper?', 'xor'), suffix=r'\s')
|
44
|
+
'wrapper', 'wrapper?', 'xor'), suffix=r'(\s+)')
|
47
45
|
|
48
46
|
builtin_assocs = words((
|
49
47
|
'2cache', '<enum>', '>alist', '?at', '?of', 'assoc', 'assoc-all?',
|
@@ -57,7 +55,7 @@ class FactorLexer(RegexLexer):
|
|
57
55
|
'clear-assoc', 'delete-at', 'delete-at*', 'enum', 'enum?', 'extract-keys',
|
58
56
|
'inc-at', 'key?', 'keys', 'map>assoc', 'maybe-set-at', 'new-assoc', 'of',
|
59
57
|
'push-at', 'rename-at', 'set-at', 'sift-keys', 'sift-values', 'substitute',
|
60
|
-
'unzip', 'value-at', 'value-at*', 'value?', 'values', 'zip'), suffix=r'\s')
|
58
|
+
'unzip', 'value-at', 'value-at*', 'value?', 'values', 'zip'), suffix=r'(\s+)')
|
61
59
|
|
62
60
|
builtin_combinators = words((
|
63
61
|
'2cleave', '2cleave>quot', '3cleave', '3cleave>quot', '4cleave',
|
@@ -65,7 +63,7 @@ class FactorLexer(RegexLexer):
|
|
65
63
|
'case>quot', 'cleave', 'cleave>quot', 'cond', 'cond>quot', 'deep-spread>quot',
|
66
64
|
'execute-effect', 'linear-case-quot', 'no-case', 'no-case?', 'no-cond',
|
67
65
|
'no-cond?', 'recursive-hashcode', 'shallow-spread>quot', 'spread',
|
68
|
-
'to-fixed-point', 'wrong-values', 'wrong-values?'), suffix=r'\s')
|
66
|
+
'to-fixed-point', 'wrong-values', 'wrong-values?'), suffix=r'(\s+)')
|
69
67
|
|
70
68
|
builtin_math = words((
|
71
69
|
'-', '/', '/f', '/i', '/mod', '2/', '2^', '<', '<=', '<fp-nan>', '>',
|
@@ -85,7 +83,7 @@ class FactorLexer(RegexLexer):
|
|
85
83
|
'prev-float', 'ratio', 'ratio?', 'rational', 'rational?', 'real',
|
86
84
|
'real-part', 'real?', 'recip', 'rem', 'sgn', 'shift', 'sq', 'times',
|
87
85
|
'u<', 'u<=', 'u>', 'u>=', 'unless-zero', 'unordered?', 'when-zero',
|
88
|
-
'zero?'), suffix=r'\s')
|
86
|
+
'zero?'), suffix=r'(\s+)')
|
89
87
|
|
90
88
|
builtin_sequences = words((
|
91
89
|
'1sequence', '2all?', '2each', '2map', '2map-as', '2map-reduce', '2reduce',
|
@@ -129,18 +127,18 @@ class FactorLexer(RegexLexer):
|
|
129
127
|
'trim-head', 'trim-head-slice', 'trim-slice', 'trim-tail', 'trim-tail-slice',
|
130
128
|
'unclip', 'unclip-last', 'unclip-last-slice', 'unclip-slice', 'unless-empty',
|
131
129
|
'virtual-exemplar', 'virtual-sequence', 'virtual-sequence?', 'virtual@',
|
132
|
-
'when-empty'), suffix=r'\s')
|
130
|
+
'when-empty'), suffix=r'(\s+)')
|
133
131
|
|
134
132
|
builtin_namespaces = words((
|
135
133
|
'+@', 'change', 'change-global', 'counter', 'dec', 'get', 'get-global',
|
136
134
|
'global', 'inc', 'init-namespaces', 'initialize', 'is-global', 'make-assoc',
|
137
135
|
'namespace', 'namestack', 'off', 'on', 'set', 'set-global', 'set-namestack',
|
138
136
|
'toggle', 'with-global', 'with-scope', 'with-variable', 'with-variables'),
|
139
|
-
suffix=r'\s')
|
137
|
+
suffix=r'(\s+)')
|
140
138
|
|
141
139
|
builtin_arrays = words((
|
142
140
|
'1array', '2array', '3array', '4array', '<array>', '>array', 'array',
|
143
|
-
'array?', 'pair', 'pair?', 'resize-array'), suffix=r'\s')
|
141
|
+
'array?', 'pair', 'pair?', 'resize-array'), suffix=r'(\s+)')
|
144
142
|
|
145
143
|
builtin_io = words((
|
146
144
|
'(each-stream-block-slice)', '(each-stream-block)',
|
@@ -170,15 +168,15 @@ class FactorLexer(RegexLexer):
|
|
170
168
|
'with-input-stream*', 'with-output-stream', 'with-output-stream*',
|
171
169
|
'with-output>error', 'with-output+error-stream',
|
172
170
|
'with-output+error-stream*', 'with-streams', 'with-streams*',
|
173
|
-
'write', 'write1'), suffix=r'\s')
|
171
|
+
'write', 'write1'), suffix=r'(\s+)')
|
174
172
|
|
175
173
|
builtin_strings = words((
|
176
174
|
'1string', '<string>', '>string', 'resize-string', 'string',
|
177
|
-
'string?'), suffix=r'\s')
|
175
|
+
'string?'), suffix=r'(\s+)')
|
178
176
|
|
179
177
|
builtin_vectors = words((
|
180
178
|
'1vector', '<vector>', '>vector', '?push', 'vector', 'vector?'),
|
181
|
-
suffix=r'\s')
|
179
|
+
suffix=r'(\s+)')
|
182
180
|
|
183
181
|
builtin_continuations = words((
|
184
182
|
'<condition>', '<continuation>', '<restart>', 'attempt-all',
|
@@ -190,7 +188,7 @@ class FactorLexer(RegexLexer):
|
|
190
188
|
'ifcc', 'ignore-errors', 'in-callback?', 'original-error', 'recover',
|
191
189
|
'restart', 'restart?', 'restarts', 'rethrow', 'rethrow-restarts',
|
192
190
|
'return', 'return-continuation', 'thread-error-hook', 'throw-continue',
|
193
|
-
'throw-restarts', 'with-datastack', 'with-return'), suffix=r'\s')
|
191
|
+
'throw-restarts', 'with-datastack', 'with-return'), suffix=r'(\s+)')
|
194
192
|
|
195
193
|
tokens = {
|
196
194
|
'root': [
|
@@ -199,83 +197,105 @@ class FactorLexer(RegexLexer):
|
|
199
197
|
default('base'),
|
200
198
|
],
|
201
199
|
'base': [
|
202
|
-
(r'\s+',
|
200
|
+
(r'\s+', Whitespace),
|
203
201
|
|
204
202
|
# defining words
|
205
203
|
(r'((?:MACRO|MEMO|TYPED)?:[:]?)(\s+)(\S+)',
|
206
|
-
bygroups(Keyword,
|
204
|
+
bygroups(Keyword, Whitespace, Name.Function)),
|
207
205
|
(r'(M:[:]?)(\s+)(\S+)(\s+)(\S+)',
|
208
|
-
bygroups(Keyword,
|
206
|
+
bygroups(Keyword, Whitespace, Name.Class, Whitespace,
|
207
|
+
Name.Function)),
|
209
208
|
(r'(C:)(\s+)(\S+)(\s+)(\S+)',
|
210
|
-
bygroups(Keyword,
|
209
|
+
bygroups(Keyword, Whitespace, Name.Function, Whitespace,
|
210
|
+
Name.Class)),
|
211
211
|
(r'(GENERIC:)(\s+)(\S+)',
|
212
|
-
bygroups(Keyword,
|
212
|
+
bygroups(Keyword, Whitespace, Name.Function)),
|
213
213
|
(r'(HOOK:|GENERIC#)(\s+)(\S+)(\s+)(\S+)',
|
214
|
-
bygroups(Keyword,
|
215
|
-
|
216
|
-
(r'
|
214
|
+
bygroups(Keyword, Whitespace, Name.Function, Whitespace,
|
215
|
+
Name.Function)),
|
216
|
+
(r'(\()(\s)', bygroups(Name.Function, Whitespace), 'stackeffect'),
|
217
|
+
(r'(;)(\s)', bygroups(Keyword, Whitespace)),
|
217
218
|
|
218
219
|
# imports and namespaces
|
219
220
|
(r'(USING:)(\s+)',
|
220
|
-
bygroups(Keyword.Namespace,
|
221
|
+
bygroups(Keyword.Namespace, Whitespace), 'vocabs'),
|
221
222
|
(r'(USE:|UNUSE:|IN:|QUALIFIED:)(\s+)(\S+)',
|
222
|
-
bygroups(Keyword.Namespace,
|
223
|
+
bygroups(Keyword.Namespace, Whitespace, Name.Namespace)),
|
223
224
|
(r'(QUALIFIED-WITH:)(\s+)(\S+)(\s+)(\S+)',
|
224
|
-
bygroups(Keyword.Namespace,
|
225
|
+
bygroups(Keyword.Namespace, Whitespace, Name.Namespace,
|
226
|
+
Whitespace, Name.Namespace)),
|
225
227
|
(r'(FROM:|EXCLUDE:)(\s+)(\S+)(\s+=>\s)',
|
226
|
-
bygroups(Keyword.Namespace,
|
227
|
-
|
228
|
-
|
228
|
+
bygroups(Keyword.Namespace, Whitespace, Name.Namespace,
|
229
|
+
Whitespace), 'words'),
|
230
|
+
(r'(RENAME:)(\s+)(\S+)(\s+)(\S+)(\s+)(=>)(\s+)(\S+)',
|
231
|
+
bygroups(Keyword.Namespace, Whitespace, Name.Function, Whitespace,
|
232
|
+
Name.Namespace, Whitespace, Punctuation, Whitespace,
|
233
|
+
Name.Function)),
|
229
234
|
(r'(ALIAS:|TYPEDEF:)(\s+)(\S+)(\s+)(\S+)',
|
230
|
-
bygroups(Keyword.Namespace,
|
235
|
+
bygroups(Keyword.Namespace, Whitespace, Name.Function, Whitespace,
|
236
|
+
Name.Function)),
|
231
237
|
(r'(DEFER:|FORGET:|POSTPONE:)(\s+)(\S+)',
|
232
|
-
bygroups(Keyword.Namespace,
|
238
|
+
bygroups(Keyword.Namespace, Whitespace, Name.Function)),
|
233
239
|
|
234
240
|
# tuples and classes
|
235
|
-
(r'(TUPLE:|ERROR:)(\s+)(\S+)(\s
|
236
|
-
bygroups(Keyword,
|
241
|
+
(r'(TUPLE:|ERROR:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)',
|
242
|
+
bygroups(Keyword, Whitespace, Name.Class, Whitespace, Punctuation,
|
243
|
+
Whitespace, Name.Class), 'slots'),
|
237
244
|
(r'(TUPLE:|ERROR:|BUILTIN:)(\s+)(\S+)',
|
238
|
-
bygroups(Keyword,
|
245
|
+
bygroups(Keyword, Whitespace, Name.Class), 'slots'),
|
239
246
|
(r'(MIXIN:|UNION:|INTERSECTION:)(\s+)(\S+)',
|
240
|
-
bygroups(Keyword,
|
241
|
-
(r'(PREDICATE:)(\s+)(\S+)(\s
|
242
|
-
bygroups(Keyword,
|
247
|
+
bygroups(Keyword, Whitespace, Name.Class)),
|
248
|
+
(r'(PREDICATE:)(\s+)(\S+)(\s+)(<)(\s+)(\S+)',
|
249
|
+
bygroups(Keyword, Whitespace, Name.Class, Whitespace,
|
250
|
+
Punctuation, Whitespace, Name.Class)),
|
243
251
|
(r'(C:)(\s+)(\S+)(\s+)(\S+)',
|
244
|
-
bygroups(Keyword,
|
252
|
+
bygroups(Keyword, Whitespace, Name.Function, Whitespace, Name.Class)),
|
245
253
|
(r'(INSTANCE:)(\s+)(\S+)(\s+)(\S+)',
|
246
|
-
bygroups(Keyword,
|
247
|
-
(r'(SLOT:)(\s+)(\S+)', bygroups(Keyword,
|
248
|
-
(r'(SINGLETON:)(\s+)(\S+)', bygroups(Keyword,
|
254
|
+
bygroups(Keyword, Whitespace, Name.Class, Whitespace, Name.Class)),
|
255
|
+
(r'(SLOT:)(\s+)(\S+)', bygroups(Keyword, Whitespace, Name.Function)),
|
256
|
+
(r'(SINGLETON:)(\s+)(\S+)', bygroups(Keyword, Whitespace, Name.Class)),
|
249
257
|
(r'SINGLETONS:', Keyword, 'classes'),
|
250
258
|
|
251
259
|
# other syntax
|
252
260
|
(r'(CONSTANT:|SYMBOL:|MAIN:|HELP:)(\s+)(\S+)',
|
253
|
-
bygroups(Keyword,
|
254
|
-
(r'SYMBOLS
|
255
|
-
(r'SYNTAX
|
256
|
-
(r'ALIEN
|
257
|
-
(r'(STRUCT:)(\s+)(\S+)', bygroups(Keyword,
|
258
|
-
(r'(FUNCTION:)(\s
|
259
|
-
|
260
|
-
|
261
|
-
bygroups(Keyword.Namespace,
|
261
|
+
bygroups(Keyword, Whitespace, Name.Function)),
|
262
|
+
(r'(SYMBOLS:)(\s+)', bygroups(Keyword, Whitespace), 'words'),
|
263
|
+
(r'(SYNTAX:)(\s+)', bygroups(Keyword, Whitespace)),
|
264
|
+
(r'(ALIEN:)(\s+)', bygroups(Keyword, Whitespace)),
|
265
|
+
(r'(STRUCT:)(\s+)(\S+)', bygroups(Keyword, Whitespace, Name.Class)),
|
266
|
+
(r'(FUNCTION:)(\s+)'
|
267
|
+
r'(\S+)(\s+)(\S+)(\s+)'
|
268
|
+
r'(\()(\s+)([^)]+)(\))(\s)',
|
269
|
+
bygroups(Keyword.Namespace, Whitespace,
|
270
|
+
Text, Whitespace, Name.Function, Whitespace,
|
271
|
+
Punctuation, Whitespace, Text, Punctuation, Whitespace)),
|
272
|
+
(r'(FUNCTION-ALIAS:)(\s+)'
|
273
|
+
r'(\S+)(\s+)(\S+)(\s+)'
|
274
|
+
r'(\S+)(\s+)'
|
275
|
+
r'(\()(\s+)([^)]+)(\))(\s)',
|
276
|
+
bygroups(Keyword.Namespace, Whitespace,
|
277
|
+
Text, Whitespace, Name.Function, Whitespace,
|
278
|
+
Name.Function, Whitespace,
|
279
|
+
Punctuation, Whitespace, Text, Punctuation, Whitespace)),
|
262
280
|
|
263
281
|
# vocab.private
|
264
|
-
(r'(
|
282
|
+
(r'(<PRIVATE|PRIVATE>)(\s)', bygroups(Keyword.Namespace, Whitespace)),
|
265
283
|
|
266
284
|
# strings
|
267
285
|
(r'"""\s(?:.|\n)*?\s"""', String),
|
268
286
|
(r'"(?:\\\\|\\"|[^"])*"', String),
|
269
|
-
(r'\S+"\s+(?:\\\\|\\"|[^"])*"',
|
270
|
-
|
287
|
+
(r'(\S+")(\s+)((?:\\\\|\\"|[^"])*")',
|
288
|
+
bygroups(String, Whitespace, String)),
|
289
|
+
(r'(CHAR:)(\s+)(\\[\\abfnrstv]|[^\\]\S*)(\s)',
|
290
|
+
bygroups(String.Char, Whitespace, String.Char, Whitespace)),
|
271
291
|
|
272
292
|
# comments
|
273
293
|
(r'!\s+.*$', Comment),
|
274
294
|
(r'#!\s+.*$', Comment),
|
275
|
-
(r'/\*\s+(?:.|\n)*?\s
|
295
|
+
(r'/\*\s+(?:.|\n)*?\s\*/', Comment),
|
276
296
|
|
277
297
|
# boolean constants
|
278
|
-
(r'[tf]\
|
298
|
+
(r'[tf]\b', Name.Constant),
|
279
299
|
|
280
300
|
# symbols and literals
|
281
301
|
(r'[\\$]\s+\S+', Name.Constant),
|
@@ -296,48 +316,49 @@ class FactorLexer(RegexLexer):
|
|
296
316
|
Keyword),
|
297
317
|
|
298
318
|
# builtins
|
299
|
-
(builtin_kernel, Name.Builtin),
|
300
|
-
(builtin_assocs, Name.Builtin),
|
301
|
-
(builtin_combinators, Name.Builtin),
|
302
|
-
(builtin_math, Name.Builtin),
|
303
|
-
(builtin_sequences, Name.Builtin),
|
304
|
-
(builtin_namespaces, Name.Builtin),
|
305
|
-
(builtin_arrays, Name.Builtin),
|
306
|
-
(builtin_io, Name.Builtin),
|
307
|
-
(builtin_strings, Name.Builtin),
|
308
|
-
(builtin_vectors, Name.Builtin),
|
309
|
-
(builtin_continuations, Name.Builtin),
|
319
|
+
(builtin_kernel, bygroups(Name.Builtin, Whitespace)),
|
320
|
+
(builtin_assocs, bygroups(Name.Builtin, Whitespace)),
|
321
|
+
(builtin_combinators, bygroups(Name.Builtin, Whitespace)),
|
322
|
+
(builtin_math, bygroups(Name.Builtin, Whitespace)),
|
323
|
+
(builtin_sequences, bygroups(Name.Builtin, Whitespace)),
|
324
|
+
(builtin_namespaces, bygroups(Name.Builtin, Whitespace)),
|
325
|
+
(builtin_arrays, bygroups(Name.Builtin, Whitespace)),
|
326
|
+
(builtin_io, bygroups(Name.Builtin, Whitespace)),
|
327
|
+
(builtin_strings, bygroups(Name.Builtin, Whitespace)),
|
328
|
+
(builtin_vectors, bygroups(Name.Builtin, Whitespace)),
|
329
|
+
(builtin_continuations, bygroups(Name.Builtin, Whitespace)),
|
310
330
|
|
311
331
|
# everything else is text
|
312
332
|
(r'\S+', Text),
|
313
333
|
],
|
314
334
|
'stackeffect': [
|
315
|
-
(r'\s+',
|
316
|
-
(r'\(\s+', Name.Function, 'stackeffect'),
|
317
|
-
(r'\)\s', Name.Function, '#pop'),
|
318
|
-
(r'
|
335
|
+
(r'\s+', Whitespace),
|
336
|
+
(r'(\()(\s+)', bygroups(Name.Function, Whitespace), 'stackeffect'),
|
337
|
+
(r'(\))(\s+)', bygroups(Name.Function, Whitespace), '#pop'),
|
338
|
+
(r'(--)(\s+)', bygroups(Name.Function, Whitespace)),
|
319
339
|
(r'\S+', Name.Variable),
|
320
340
|
],
|
321
341
|
'slots': [
|
322
|
-
(r'\s+',
|
323
|
-
(r'
|
324
|
-
(r'(\{\s+)(\S+)(\s[^}]
|
325
|
-
bygroups(Text, Name.Variable,
|
342
|
+
(r'\s+', Whitespace),
|
343
|
+
(r'(;)(\s+)', bygroups(Keyword, Whitespace), '#pop'),
|
344
|
+
(r'(\{)(\s+)(\S+)(\s+)([^}]+)(\s+)(\})(\s+)',
|
345
|
+
bygroups(Text, Whitespace, Name.Variable, Whitespace,
|
346
|
+
Text, Whitespace, Text, Whitespace)),
|
326
347
|
(r'\S+', Name.Variable),
|
327
348
|
],
|
328
349
|
'vocabs': [
|
329
|
-
(r'\s+',
|
330
|
-
(r'
|
350
|
+
(r'\s+', Whitespace),
|
351
|
+
(r'(;)(\s+)', bygroups(Keyword, Whitespace), '#pop'),
|
331
352
|
(r'\S+', Name.Namespace),
|
332
353
|
],
|
333
354
|
'classes': [
|
334
|
-
(r'\s+',
|
335
|
-
(r'
|
355
|
+
(r'\s+', Whitespace),
|
356
|
+
(r'(;)(\s+)', bygroups(Keyword, Whitespace), '#pop'),
|
336
357
|
(r'\S+', Name.Class),
|
337
358
|
],
|
338
359
|
'words': [
|
339
|
-
(r'\s+',
|
340
|
-
(r'
|
360
|
+
(r'\s+', Whitespace),
|
361
|
+
(r'(;)(\s+)', bygroups(Keyword, Whitespace), '#pop'),
|
341
362
|
(r'\S+', Name.Function),
|
342
363
|
],
|
343
364
|
}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
Lexer for the Fantom language.
|
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
|
|
@@ -13,7 +13,7 @@ from string import Template
|
|
13
13
|
from pygments.lexer import RegexLexer, include, bygroups, using, \
|
14
14
|
this, default, words
|
15
15
|
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
16
|
-
Number, Punctuation, Literal
|
16
|
+
Number, Punctuation, Literal, Whitespace
|
17
17
|
|
18
18
|
__all__ = ['FantomLexer']
|
19
19
|
|
@@ -45,10 +45,10 @@ class FantomLexer(RegexLexer):
|
|
45
45
|
tokens = {
|
46
46
|
'comments': [
|
47
47
|
(r'(?s)/\*.*?\*/', Comment.Multiline), # Multiline
|
48
|
-
(r'
|
48
|
+
(r'//.*?$', Comment.Single), # Single line
|
49
49
|
# TODO: highlight references in fandocs
|
50
|
-
(r'
|
51
|
-
(r'
|
50
|
+
(r'\*\*.*?$', Comment.Special), # Fandoc
|
51
|
+
(r'#.*$', Comment.Single) # Shell-style
|
52
52
|
],
|
53
53
|
'literals': [
|
54
54
|
(r'\b-?[\d_]+(ns|ms|sec|min|hr|day)', Number), # Duration
|
@@ -133,21 +133,21 @@ class FantomLexer(RegexLexer):
|
|
133
133
|
include('operators'),
|
134
134
|
(r'using\b', Keyword.Namespace, 'using'), # Using stmt
|
135
135
|
(r'@\w+', Name.Decorator, 'facet'), # Symbol
|
136
|
-
(r'(class|mixin)(\s+)(\w+)', bygroups(Keyword,
|
136
|
+
(r'(class|mixin)(\s+)(\w+)', bygroups(Keyword, Whitespace, Name.Class),
|
137
137
|
'inheritance'), # Inheritance list
|
138
138
|
|
139
139
|
# Type var := val
|
140
140
|
(s(r'($type)([ \t]+)($id)(\s*)(:=)'),
|
141
|
-
bygroups(using(this, state='inType'),
|
142
|
-
Name.Variable,
|
141
|
+
bygroups(using(this, state='inType'), Whitespace,
|
142
|
+
Name.Variable, Whitespace, Operator)),
|
143
143
|
|
144
144
|
# var := val
|
145
145
|
(s(r'($id)(\s*)(:=)'),
|
146
|
-
bygroups(Name.Variable,
|
146
|
+
bygroups(Name.Variable, Whitespace, Operator)),
|
147
147
|
|
148
148
|
# .someId( or ->someId( ###
|
149
149
|
(s(r'(\.|(?:\->))($id)(\s*)(\()'),
|
150
|
-
bygroups(Operator, Name.Function,
|
150
|
+
bygroups(Operator, Name.Function, Whitespace, Punctuation),
|
151
151
|
'insideParen'),
|
152
152
|
|
153
153
|
# .someId or ->someId
|
@@ -156,42 +156,43 @@ class FantomLexer(RegexLexer):
|
|
156
156
|
|
157
157
|
# new makeXXX (
|
158
158
|
(r'(new)(\s+)(make\w*)(\s*)(\()',
|
159
|
-
bygroups(Keyword,
|
159
|
+
bygroups(Keyword, Whitespace, Name.Function, Whitespace, Punctuation),
|
160
160
|
'insideMethodDeclArgs'),
|
161
161
|
|
162
162
|
# Type name (
|
163
163
|
(s(r'($type)([ \t]+)' # Return type and whitespace
|
164
164
|
r'($id)(\s*)(\()'), # method name + open brace
|
165
|
-
bygroups(using(this, state='inType'),
|
166
|
-
Name.Function,
|
165
|
+
bygroups(using(this, state='inType'), Whitespace,
|
166
|
+
Name.Function, Whitespace, Punctuation),
|
167
167
|
'insideMethodDeclArgs'),
|
168
168
|
|
169
169
|
# ArgType argName,
|
170
170
|
(s(r'($type)(\s+)($id)(\s*)(,)'),
|
171
|
-
bygroups(using(this, state='inType'),
|
172
|
-
|
171
|
+
bygroups(using(this, state='inType'), Whitespace, Name.Variable,
|
172
|
+
Whitespace, Punctuation)),
|
173
173
|
|
174
174
|
# ArgType argName)
|
175
175
|
# Covered in 'insideParen' state
|
176
176
|
|
177
177
|
# ArgType argName -> ArgType|
|
178
178
|
(s(r'($type)(\s+)($id)(\s*)(\->)(\s*)($type)(\|)'),
|
179
|
-
bygroups(using(this, state='inType'),
|
180
|
-
|
179
|
+
bygroups(using(this, state='inType'), Whitespace, Name.Variable,
|
180
|
+
Whitespace, Punctuation, Whitespace, using(this, state='inType'),
|
181
181
|
Punctuation)),
|
182
182
|
|
183
183
|
# ArgType argName|
|
184
184
|
(s(r'($type)(\s+)($id)(\s*)(\|)'),
|
185
|
-
bygroups(using(this, state='inType'),
|
186
|
-
|
185
|
+
bygroups(using(this, state='inType'), Whitespace, Name.Variable,
|
186
|
+
Whitespace, Punctuation)),
|
187
187
|
|
188
188
|
# Type var
|
189
189
|
(s(r'($type)([ \t]+)($id)'),
|
190
|
-
bygroups(using(this, state='inType'),
|
190
|
+
bygroups(using(this, state='inType'), Whitespace,
|
191
191
|
Name.Variable)),
|
192
192
|
|
193
193
|
(r'\(', Punctuation, 'insideParen'),
|
194
194
|
(r'\{', Punctuation, 'insideBrace'),
|
195
|
+
(r'\s+', Whitespace),
|
195
196
|
(r'.', Text)
|
196
197
|
],
|
197
198
|
'insideParen': [
|
@@ -201,8 +202,8 @@ class FantomLexer(RegexLexer):
|
|
201
202
|
'insideMethodDeclArgs': [
|
202
203
|
(r'\)', Punctuation, '#pop'),
|
203
204
|
(s(r'($type)(\s+)($id)(\s*)(\))'),
|
204
|
-
bygroups(using(this, state='inType'),
|
205
|
-
|
205
|
+
bygroups(using(this, state='inType'), Whitespace, Name.Variable,
|
206
|
+
Whitespace, Punctuation), '#pop'),
|
206
207
|
include('root'),
|
207
208
|
],
|
208
209
|
'insideBrace': [
|
@@ -210,14 +211,14 @@ class FantomLexer(RegexLexer):
|
|
210
211
|
include('root'),
|
211
212
|
],
|
212
213
|
'inheritance': [
|
213
|
-
(r'\s+',
|
214
|
+
(r'\s+', Whitespace), # Whitespace
|
214
215
|
(r':|,', Punctuation),
|
215
216
|
(r'(?:(\w+)(::))?(\w+)',
|
216
217
|
bygroups(Name.Namespace, Punctuation, Name.Class)),
|
217
218
|
(r'\{', Punctuation, '#pop')
|
218
219
|
],
|
219
220
|
'using': [
|
220
|
-
(r'[ \t]+',
|
221
|
+
(r'[ \t]+', Whitespace), # consume whitespaces
|
221
222
|
(r'(\[)(\w+)(\])',
|
222
223
|
bygroups(Punctuation, Comment.Special, Punctuation)), # ffi
|
223
224
|
(r'(\")?([\w.]+)(\")?',
|
@@ -226,14 +227,14 @@ class FantomLexer(RegexLexer):
|
|
226
227
|
default('#pop')
|
227
228
|
],
|
228
229
|
'usingClass': [
|
229
|
-
(r'[ \t]+',
|
230
|
+
(r'[ \t]+', Whitespace), # consume whitespaces
|
230
231
|
(r'(as)(\s+)(\w+)',
|
231
|
-
bygroups(Keyword.Declaration,
|
232
|
+
bygroups(Keyword.Declaration, Whitespace, Name.Class), '#pop:2'),
|
232
233
|
(r'[\w$]+', Name.Class),
|
233
234
|
default('#pop:2') # jump out to root state
|
234
235
|
],
|
235
236
|
'facet': [
|
236
|
-
(r'\s+',
|
237
|
+
(r'\s+', Whitespace),
|
237
238
|
(r'\{', Punctuation, 'facetFields'),
|
238
239
|
default('#pop')
|
239
240
|
],
|
@@ -241,9 +242,10 @@ class FantomLexer(RegexLexer):
|
|
241
242
|
include('comments'),
|
242
243
|
include('literals'),
|
243
244
|
include('operators'),
|
244
|
-
(r'\s+',
|
245
|
-
(r'(\s*)(\w+)(\s*)(=)', bygroups(
|
245
|
+
(r'\s+', Whitespace),
|
246
|
+
(r'(\s*)(\w+)(\s*)(=)', bygroups(Whitespace, Name, Whitespace, Operator)),
|
246
247
|
(r'\}', Punctuation, '#pop'),
|
248
|
+
(r'\s+', Whitespace),
|
247
249
|
(r'.', Text)
|
248
250
|
],
|
249
251
|
}
|
@@ -4,26 +4,27 @@
|
|
4
4
|
|
5
5
|
Lexer for the Felix language.
|
6
6
|
|
7
|
-
:copyright: Copyright 2006-
|
7
|
+
:copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS.
|
8
8
|
:license: BSD, see LICENSE for details.
|
9
9
|
"""
|
10
10
|
|
11
11
|
from pygments.lexer import RegexLexer, include, bygroups, default, words, \
|
12
12
|
combined
|
13
13
|
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
|
14
|
-
Number, Punctuation
|
14
|
+
Number, Punctuation, Whitespace
|
15
15
|
|
16
16
|
__all__ = ['FelixLexer']
|
17
17
|
|
18
18
|
|
19
19
|
class FelixLexer(RegexLexer):
|
20
20
|
"""
|
21
|
-
For
|
21
|
+
For Felix source code.
|
22
22
|
|
23
23
|
.. versionadded:: 1.2
|
24
24
|
"""
|
25
25
|
|
26
26
|
name = 'Felix'
|
27
|
+
url = 'http://www.felix-lang.org'
|
27
28
|
aliases = ['felix', 'flx']
|
28
29
|
filenames = ['*.flx', '*.flxh']
|
29
30
|
mimetypes = ['text/x-felix']
|
@@ -157,13 +158,14 @@ class FelixLexer(RegexLexer):
|
|
157
158
|
(r'[a-zA-Z_]\w*', Name),
|
158
159
|
],
|
159
160
|
'whitespace': [
|
160
|
-
(r'\
|
161
|
-
(r'\s+', Text),
|
161
|
+
(r'\s+', Whitespace),
|
162
162
|
|
163
163
|
include('comment'),
|
164
164
|
|
165
165
|
# Preprocessor
|
166
|
-
(r'
|
166
|
+
(r'(#)(\s*)(if)(\s+)(0)',
|
167
|
+
bygroups(Comment.Preproc, Whitespace, Comment.Preproc,
|
168
|
+
Whitespace, Comment.Preproc), 'if0'),
|
167
169
|
(r'#', Comment.Preproc, 'macro'),
|
168
170
|
],
|
169
171
|
'operators': [
|
@@ -171,7 +173,7 @@ class FelixLexer(RegexLexer):
|
|
171
173
|
(r'!=|==|<<|>>|\|\||&&|[-~+/*%=<>&^|.$]', Operator),
|
172
174
|
],
|
173
175
|
'comment': [
|
174
|
-
(r'//(.*?)
|
176
|
+
(r'//(.*?)$', Comment.Single),
|
175
177
|
(r'/[*]', Comment.Multiline, 'comment2'),
|
176
178
|
],
|
177
179
|
'comment2': [
|
@@ -181,24 +183,26 @@ class FelixLexer(RegexLexer):
|
|
181
183
|
(r'[/*]', Comment.Multiline),
|
182
184
|
],
|
183
185
|
'if0': [
|
184
|
-
(r'
|
185
|
-
|
186
|
-
(r'
|
186
|
+
(r'^(\s*)(#if.*?(?<!\\))(\n)',
|
187
|
+
bygroups(Whitespace, Comment, Whitespace), '#push'),
|
188
|
+
(r'^(\s*)(#endif.*?(?<!\\))(\n)',
|
189
|
+
bygroups(Whitespace, Comment, Whitespace), '#pop'),
|
190
|
+
(r'(.*?)(\n)', bygroups(Comment, Whitespace)),
|
187
191
|
],
|
188
192
|
'macro': [
|
189
193
|
include('comment'),
|
190
194
|
(r'(import|include)(\s+)(<[^>]*?>)',
|
191
|
-
bygroups(Comment.Preproc,
|
195
|
+
bygroups(Comment.Preproc, Whitespace, String), '#pop'),
|
192
196
|
(r'(import|include)(\s+)("[^"]*?")',
|
193
|
-
bygroups(Comment.Preproc,
|
197
|
+
bygroups(Comment.Preproc, Whitespace, String), '#pop'),
|
194
198
|
(r"(import|include)(\s+)('[^']*?')",
|
195
|
-
bygroups(Comment.Preproc,
|
199
|
+
bygroups(Comment.Preproc, Whitespace, String), '#pop'),
|
196
200
|
(r'[^/\n]+', Comment.Preproc),
|
197
201
|
# (r'/[*](.|\n)*?[*]/', Comment),
|
198
202
|
# (r'//.*?\n', Comment, '#pop'),
|
199
203
|
(r'/', Comment.Preproc),
|
200
204
|
(r'(?<=\\)\n', Comment.Preproc),
|
201
|
-
(r'\n',
|
205
|
+
(r'\n', Whitespace, '#pop'),
|
202
206
|
],
|
203
207
|
'funcname': [
|
204
208
|
include('whitespace'),
|