pygments.rb 1.1.0 → 2.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/dependabot.yml +13 -0
- data/.github/workflows/ci.yml +28 -0
- data/.github/workflows/release.yml +24 -0
- data/.gitignore +5 -5
- data/CHANGELOG.adoc +119 -0
- data/Gemfile +3 -1
- data/LICENSE +1 -1
- data/README.adoc +161 -0
- data/Rakefile +12 -19
- data/bench.rb +8 -7
- data/cache-lexers.rb +3 -2
- data/lexers +0 -0
- data/lib/pygments.rb +11 -16
- data/lib/pygments/lexer.rb +6 -4
- data/lib/pygments/mentos.py +23 -66
- data/lib/pygments/popen.rb +155 -207
- data/lib/pygments/version.rb +3 -1
- data/pygments.rb.gemspec +11 -9
- data/test/test_pygments.rb +53 -83
- data/vendor/pygments-main/{AUTHORS → Pygments-2.7.3.dist-info/AUTHORS} +23 -3
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/INSTALLER +1 -0
- data/vendor/pygments-main/{LICENSE → Pygments-2.7.3.dist-info/LICENSE} +1 -1
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/METADATA +49 -0
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/RECORD +482 -0
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/REQUESTED +0 -0
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/WHEEL +5 -0
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/entry_points.txt +3 -0
- data/vendor/pygments-main/Pygments-2.7.3.dist-info/top_level.txt +1 -0
- data/vendor/pygments-main/bin/pygmentize +8 -0
- data/vendor/pygments-main/pygments/__init__.py +6 -11
- data/vendor/pygments-main/pygments/__main__.py +18 -0
- data/vendor/pygments-main/pygments/cmdline.py +94 -41
- data/vendor/pygments-main/pygments/console.py +6 -9
- data/vendor/pygments-main/pygments/filter.py +4 -6
- data/vendor/pygments-main/pygments/filters/__init__.py +609 -21
- data/vendor/pygments-main/pygments/formatter.py +4 -4
- data/vendor/pygments-main/pygments/formatters/__init__.py +42 -6
- data/vendor/pygments-main/pygments/formatters/_mapping.py +1 -3
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/html.py +223 -135
- data/vendor/pygments-main/pygments/formatters/img.py +102 -38
- data/vendor/pygments-main/pygments/formatters/irc.py +39 -39
- data/vendor/pygments-main/pygments/formatters/latex.py +56 -26
- data/vendor/pygments-main/pygments/formatters/other.py +12 -8
- data/vendor/pygments-main/pygments/formatters/rtf.py +29 -29
- data/vendor/pygments-main/pygments/formatters/svg.py +38 -4
- data/vendor/pygments-main/pygments/formatters/terminal.py +25 -31
- data/vendor/pygments-main/pygments/formatters/terminal256.py +22 -12
- data/vendor/pygments-main/pygments/lexer.py +41 -39
- data/vendor/pygments-main/pygments/lexers/__init__.py +62 -15
- data/vendor/pygments-main/pygments/lexers/_asy_builtins.py +5 -5
- data/vendor/pygments-main/pygments/lexers/_cl_builtins.py +15 -15
- data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +11 -12
- data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +1717 -1338
- data/vendor/pygments-main/pygments/lexers/_lasso_builtins.py +8 -1
- data/vendor/pygments-main/pygments/lexers/_lua_builtins.py +2 -4
- data/vendor/pygments-main/pygments/lexers/_mapping.py +79 -33
- data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +2 -2
- data/vendor/pygments-main/pygments/lexers/_mysql_builtins.py +1282 -0
- data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_php_builtins.py +17 -20
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +73 -16
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +2 -2
- data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +1 -3
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +151 -125
- data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +6 -4
- data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/_usd_builtins.py +113 -0
- data/vendor/pygments-main/pygments/lexers/_vbscript_builtins.py +280 -0
- data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1 -1
- data/vendor/pygments-main/pygments/lexers/actionscript.py +8 -3
- data/vendor/pygments-main/pygments/lexers/agile.py +1 -1
- data/vendor/pygments-main/pygments/lexers/algebra.py +20 -1
- data/vendor/pygments-main/pygments/lexers/ambient.py +1 -1
- data/vendor/pygments-main/pygments/lexers/ampl.py +3 -3
- data/vendor/pygments-main/pygments/lexers/apl.py +15 -15
- data/vendor/pygments-main/pygments/lexers/archetype.py +3 -3
- data/vendor/pygments-main/pygments/lexers/arrow.py +117 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +445 -70
- data/vendor/pygments-main/pygments/lexers/automation.py +3 -3
- data/vendor/pygments-main/pygments/lexers/bare.py +104 -0
- data/vendor/pygments-main/pygments/lexers/basic.py +166 -4
- data/vendor/pygments-main/pygments/lexers/bibtex.py +13 -9
- data/vendor/pygments-main/pygments/lexers/boa.py +102 -0
- data/vendor/pygments-main/pygments/lexers/business.py +69 -36
- data/vendor/pygments-main/pygments/lexers/c_cpp.py +137 -45
- data/vendor/pygments-main/pygments/lexers/c_like.py +68 -43
- data/vendor/pygments-main/pygments/lexers/capnproto.py +20 -21
- data/vendor/pygments-main/pygments/lexers/chapel.py +25 -14
- data/vendor/pygments-main/pygments/lexers/clean.py +135 -244
- data/vendor/pygments-main/pygments/lexers/compiled.py +1 -1
- data/vendor/pygments-main/pygments/lexers/configs.py +188 -37
- data/vendor/pygments-main/pygments/lexers/console.py +1 -1
- data/vendor/pygments-main/pygments/lexers/crystal.py +31 -23
- data/vendor/pygments-main/pygments/lexers/csound.py +288 -187
- data/vendor/pygments-main/pygments/lexers/css.py +18 -16
- data/vendor/pygments-main/pygments/lexers/d.py +10 -5
- data/vendor/pygments-main/pygments/lexers/dalvik.py +1 -1
- data/vendor/pygments-main/pygments/lexers/data.py +240 -97
- data/vendor/pygments-main/pygments/lexers/devicetree.py +109 -0
- data/vendor/pygments-main/pygments/lexers/diff.py +4 -4
- data/vendor/pygments-main/pygments/lexers/dotnet.py +40 -24
- data/vendor/pygments-main/pygments/lexers/dsls.py +147 -65
- data/vendor/pygments-main/pygments/lexers/dylan.py +16 -18
- data/vendor/pygments-main/pygments/lexers/ecl.py +16 -2
- data/vendor/pygments-main/pygments/lexers/eiffel.py +1 -1
- data/vendor/pygments-main/pygments/lexers/elm.py +5 -5
- data/vendor/pygments-main/pygments/lexers/email.py +151 -0
- data/vendor/pygments-main/pygments/lexers/erlang.py +29 -32
- data/vendor/pygments-main/pygments/lexers/esoteric.py +54 -25
- data/vendor/pygments-main/pygments/lexers/ezhil.py +24 -15
- data/vendor/pygments-main/pygments/lexers/factor.py +1 -1
- data/vendor/pygments-main/pygments/lexers/fantom.py +1 -1
- data/vendor/pygments-main/pygments/lexers/felix.py +1 -1
- data/vendor/pygments-main/pygments/lexers/floscript.py +83 -0
- data/vendor/pygments-main/pygments/lexers/forth.py +41 -40
- data/vendor/pygments-main/pygments/lexers/fortran.py +5 -4
- data/vendor/pygments-main/pygments/lexers/foxpro.py +2 -2
- data/vendor/pygments-main/pygments/lexers/freefem.py +898 -0
- data/vendor/pygments-main/pygments/lexers/functional.py +1 -1
- data/vendor/pygments-main/pygments/lexers/gdscript.py +346 -0
- data/vendor/pygments-main/pygments/lexers/go.py +1 -1
- data/vendor/pygments-main/pygments/lexers/grammar_notation.py +63 -6
- data/vendor/pygments-main/pygments/lexers/graph.py +14 -9
- data/vendor/pygments-main/pygments/lexers/graphics.py +272 -25
- data/vendor/pygments-main/pygments/lexers/haskell.py +52 -22
- data/vendor/pygments-main/pygments/lexers/haxe.py +6 -6
- data/vendor/pygments-main/pygments/lexers/hdl.py +176 -86
- data/vendor/pygments-main/pygments/lexers/hexdump.py +18 -12
- data/vendor/pygments-main/pygments/lexers/html.py +31 -19
- data/vendor/pygments-main/pygments/lexers/idl.py +20 -9
- data/vendor/pygments-main/pygments/lexers/igor.py +244 -112
- data/vendor/pygments-main/pygments/lexers/inferno.py +2 -2
- data/vendor/pygments-main/pygments/lexers/installers.py +1 -1
- data/vendor/pygments-main/pygments/lexers/int_fiction.py +40 -15
- data/vendor/pygments-main/pygments/lexers/iolang.py +2 -2
- data/vendor/pygments-main/pygments/lexers/j.py +3 -3
- data/vendor/pygments-main/pygments/lexers/javascript.py +100 -66
- data/vendor/pygments-main/pygments/lexers/julia.py +46 -48
- data/vendor/pygments-main/pygments/lexers/jvm.py +265 -165
- data/vendor/pygments-main/pygments/lexers/lisp.py +882 -804
- data/vendor/pygments-main/pygments/lexers/make.py +10 -6
- data/vendor/pygments-main/pygments/lexers/markup.py +213 -43
- data/vendor/pygments-main/pygments/lexers/math.py +1 -1
- data/vendor/pygments-main/pygments/lexers/matlab.py +98 -41
- data/vendor/pygments-main/pygments/lexers/mime.py +226 -0
- data/vendor/pygments-main/pygments/lexers/ml.py +198 -9
- data/vendor/pygments-main/pygments/lexers/modeling.py +26 -18
- data/vendor/pygments-main/pygments/lexers/modula2.py +25 -6
- data/vendor/pygments-main/pygments/lexers/monte.py +4 -3
- data/vendor/pygments-main/pygments/lexers/mosel.py +448 -0
- data/vendor/pygments-main/pygments/lexers/ncl.py +85 -244
- data/vendor/pygments-main/pygments/lexers/nimrod.py +4 -4
- data/vendor/pygments-main/pygments/lexers/nit.py +1 -1
- data/vendor/pygments-main/pygments/lexers/nix.py +1 -1
- data/vendor/pygments-main/pygments/lexers/oberon.py +17 -1
- data/vendor/pygments-main/pygments/lexers/objective.py +16 -16
- data/vendor/pygments-main/pygments/lexers/ooc.py +1 -1
- data/vendor/pygments-main/pygments/lexers/other.py +1 -1
- data/vendor/pygments-main/pygments/lexers/parasail.py +1 -1
- data/vendor/pygments-main/pygments/lexers/parsers.py +23 -58
- data/vendor/pygments-main/pygments/lexers/pascal.py +23 -23
- data/vendor/pygments-main/pygments/lexers/pawn.py +30 -24
- data/vendor/pygments-main/pygments/lexers/perl.py +276 -160
- data/vendor/pygments-main/pygments/lexers/php.py +64 -10
- data/vendor/pygments-main/pygments/lexers/pointless.py +71 -0
- data/vendor/pygments-main/pygments/lexers/pony.py +94 -0
- data/vendor/pygments-main/pygments/lexers/praat.py +38 -30
- data/vendor/pygments-main/pygments/lexers/prolog.py +36 -36
- data/vendor/pygments-main/pygments/lexers/promql.py +183 -0
- data/vendor/pygments-main/pygments/lexers/python.py +439 -226
- data/vendor/pygments-main/pygments/lexers/qvt.py +6 -6
- data/vendor/pygments-main/pygments/lexers/r.py +13 -275
- data/vendor/pygments-main/pygments/lexers/rdf.py +232 -39
- data/vendor/pygments-main/pygments/lexers/rebol.py +8 -8
- data/vendor/pygments-main/pygments/lexers/resource.py +2 -2
- data/vendor/pygments-main/pygments/lexers/ride.py +139 -0
- data/vendor/pygments-main/pygments/lexers/rnc.py +1 -1
- data/vendor/pygments-main/pygments/lexers/roboconf.py +1 -1
- data/vendor/pygments-main/pygments/lexers/robotframework.py +23 -31
- data/vendor/pygments-main/pygments/lexers/ruby.py +22 -24
- data/vendor/pygments-main/pygments/lexers/rust.py +86 -71
- data/vendor/pygments-main/pygments/lexers/sas.py +7 -7
- data/vendor/pygments-main/pygments/lexers/scdoc.py +83 -0
- data/vendor/pygments-main/pygments/lexers/scripting.py +75 -13
- data/vendor/pygments-main/pygments/lexers/sgf.py +61 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +175 -51
- data/vendor/pygments-main/pygments/lexers/sieve.py +69 -0
- data/vendor/pygments-main/pygments/lexers/slash.py +185 -0
- data/vendor/pygments-main/pygments/lexers/smalltalk.py +2 -2
- data/vendor/pygments-main/pygments/lexers/smv.py +30 -26
- data/vendor/pygments-main/pygments/lexers/snobol.py +1 -1
- data/vendor/pygments-main/pygments/lexers/solidity.py +92 -0
- data/vendor/pygments-main/pygments/lexers/special.py +5 -3
- data/vendor/pygments-main/pygments/lexers/sql.py +333 -177
- data/vendor/pygments-main/pygments/lexers/stata.py +107 -42
- data/vendor/pygments-main/pygments/lexers/supercollider.py +6 -1
- data/vendor/pygments-main/pygments/lexers/tcl.py +1 -1
- data/vendor/pygments-main/pygments/lexers/templates.py +144 -132
- data/vendor/pygments-main/pygments/lexers/teraterm.py +335 -0
- data/vendor/pygments-main/pygments/lexers/testing.py +6 -6
- data/vendor/pygments-main/pygments/lexers/text.py +2 -1
- data/vendor/pygments-main/pygments/lexers/textedit.py +4 -4
- data/vendor/pygments-main/pygments/lexers/textfmts.py +146 -13
- data/vendor/pygments-main/pygments/lexers/theorem.py +69 -53
- data/vendor/pygments-main/pygments/lexers/tnt.py +263 -0
- data/vendor/pygments-main/pygments/lexers/trafficscript.py +1 -1
- data/vendor/pygments-main/pygments/lexers/typoscript.py +8 -14
- data/vendor/pygments-main/pygments/lexers/unicon.py +412 -0
- data/vendor/pygments-main/pygments/lexers/urbi.py +14 -1
- data/vendor/pygments-main/pygments/lexers/usd.py +90 -0
- data/vendor/pygments-main/pygments/lexers/varnish.py +5 -5
- data/vendor/pygments-main/pygments/lexers/verification.py +15 -12
- data/vendor/pygments-main/pygments/lexers/web.py +1 -1
- data/vendor/pygments-main/pygments/lexers/webidl.py +299 -0
- data/vendor/pygments-main/pygments/lexers/webmisc.py +50 -38
- data/vendor/pygments-main/pygments/lexers/whiley.py +11 -12
- data/vendor/pygments-main/pygments/lexers/x10.py +1 -1
- data/vendor/pygments-main/pygments/lexers/xorg.py +37 -0
- data/vendor/pygments-main/pygments/lexers/yang.py +104 -0
- data/vendor/pygments-main/pygments/lexers/zig.py +124 -0
- data/vendor/pygments-main/pygments/modeline.py +6 -5
- data/vendor/pygments-main/pygments/plugin.py +14 -18
- 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 +2 -4
- data/vendor/pygments-main/pygments/style.py +61 -24
- data/vendor/pygments-main/pygments/styles/__init__.py +13 -5
- data/vendor/pygments-main/pygments/styles/abap.py +29 -0
- data/vendor/pygments-main/pygments/styles/algol.py +1 -1
- data/vendor/pygments-main/pygments/styles/algol_nu.py +1 -1
- data/vendor/pygments-main/pygments/styles/arduino.py +2 -2
- data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
- data/vendor/pygments-main/pygments/styles/borland.py +1 -1
- data/vendor/pygments-main/pygments/styles/bw.py +1 -1
- data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
- data/vendor/pygments-main/pygments/styles/default.py +1 -1
- data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
- data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
- data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
- data/vendor/pygments-main/pygments/styles/igor.py +1 -1
- data/vendor/pygments-main/pygments/styles/inkpot.py +67 -0
- data/vendor/pygments-main/pygments/styles/lovelace.py +1 -1
- data/vendor/pygments-main/pygments/styles/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/monokai.py +4 -3
- data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
- data/vendor/pygments-main/pygments/styles/native.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_dark.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_light.py +1 -1
- data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
- data/vendor/pygments-main/pygments/styles/perldoc.py +1 -1
- data/vendor/pygments-main/pygments/styles/rainbow_dash.py +89 -0
- data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
- data/vendor/pygments-main/pygments/styles/sas.py +3 -0
- data/vendor/pygments-main/pygments/styles/solarized.py +134 -0
- data/vendor/pygments-main/pygments/styles/stata_dark.py +41 -0
- data/vendor/pygments-main/pygments/styles/stata_light.py +39 -0
- data/vendor/pygments-main/pygments/styles/tango.py +1 -1
- data/vendor/pygments-main/pygments/styles/trac.py +1 -1
- data/vendor/pygments-main/pygments/styles/vim.py +1 -1
- data/vendor/pygments-main/pygments/styles/vs.py +1 -1
- data/vendor/pygments-main/pygments/styles/xcode.py +1 -1
- data/vendor/pygments-main/pygments/token.py +1 -1
- data/vendor/pygments-main/pygments/unistring.py +47 -108
- data/vendor/pygments-main/pygments/util.py +19 -95
- metadata +72 -137
- data/CHANGELOG.md +0 -89
- data/README.md +0 -121
- data/circle.yml +0 -20
- data/test/test_data.py +0 -514
- data/test/test_data_generated +0 -2582
- data/vendor/custom_lexers/github.py +0 -565
- data/vendor/pygments-main/CHANGES +0 -1163
- data/vendor/pygments-main/MANIFEST.in +0 -6
- data/vendor/pygments-main/Makefile +0 -65
- data/vendor/pygments-main/README.rst +0 -39
- data/vendor/pygments-main/REVISION +0 -1
- data/vendor/pygments-main/TODO +0 -12
- data/vendor/pygments-main/doc/Makefile +0 -153
- data/vendor/pygments-main/doc/_static/favicon.ico +0 -0
- data/vendor/pygments-main/doc/_static/logo_new.png +0 -0
- data/vendor/pygments-main/doc/_static/logo_only.png +0 -0
- data/vendor/pygments-main/doc/_templates/docssidebar.html +0 -3
- data/vendor/pygments-main/doc/_templates/indexsidebar.html +0 -25
- data/vendor/pygments-main/doc/_themes/pygments14/layout.html +0 -98
- data/vendor/pygments-main/doc/_themes/pygments14/static/bodybg.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/docbg.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/listitem.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/logo.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/pocoo.png +0 -0
- data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +0 -401
- data/vendor/pygments-main/doc/_themes/pygments14/theme.conf +0 -15
- data/vendor/pygments-main/doc/conf.py +0 -241
- data/vendor/pygments-main/doc/docs/api.rst +0 -331
- data/vendor/pygments-main/doc/docs/authors.rst +0 -4
- data/vendor/pygments-main/doc/docs/changelog.rst +0 -1
- data/vendor/pygments-main/doc/docs/cmdline.rst +0 -149
- data/vendor/pygments-main/doc/docs/filterdevelopment.rst +0 -71
- data/vendor/pygments-main/doc/docs/filters.rst +0 -41
- data/vendor/pygments-main/doc/docs/formatterdevelopment.rst +0 -169
- data/vendor/pygments-main/doc/docs/formatters.rst +0 -48
- data/vendor/pygments-main/doc/docs/index.rst +0 -66
- data/vendor/pygments-main/doc/docs/integrate.rst +0 -40
- data/vendor/pygments-main/doc/docs/java.rst +0 -70
- data/vendor/pygments-main/doc/docs/lexerdevelopment.rst +0 -689
- data/vendor/pygments-main/doc/docs/lexers.rst +0 -69
- data/vendor/pygments-main/doc/docs/moinmoin.rst +0 -39
- data/vendor/pygments-main/doc/docs/plugins.rst +0 -93
- data/vendor/pygments-main/doc/docs/quickstart.rst +0 -205
- data/vendor/pygments-main/doc/docs/rstdirective.rst +0 -22
- data/vendor/pygments-main/doc/docs/styles.rst +0 -201
- data/vendor/pygments-main/doc/docs/tokens.rst +0 -372
- data/vendor/pygments-main/doc/docs/unicode.rst +0 -58
- data/vendor/pygments-main/doc/download.rst +0 -41
- data/vendor/pygments-main/doc/faq.rst +0 -139
- data/vendor/pygments-main/doc/index.rst +0 -54
- data/vendor/pygments-main/doc/languages.rst +0 -154
- data/vendor/pygments-main/doc/make.bat +0 -190
- data/vendor/pygments-main/doc/pygmentize.1 +0 -94
- data/vendor/pygments-main/external/autopygmentize +0 -84
- data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +0 -162
- data/vendor/pygments-main/external/markdown-processor.py +0 -67
- data/vendor/pygments-main/external/moin-parser.py +0 -112
- data/vendor/pygments-main/external/pygments.bashcomp +0 -38
- data/vendor/pygments-main/external/rst-directive.py +0 -82
- data/vendor/pygments-main/pygmentize +0 -8
- data/vendor/pygments-main/pygments/lexers/github.py +0 -565
- data/vendor/pygments-main/pygments/styles/stata.py +0 -37
- data/vendor/pygments-main/requirements.txt +0 -5
- data/vendor/pygments-main/scripts/check_sources.py +0 -211
- data/vendor/pygments-main/scripts/debug_lexer.py +0 -246
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +0 -33
- data/vendor/pygments-main/scripts/epydoc.css +0 -280
- data/vendor/pygments-main/scripts/find_error.py +0 -1
- data/vendor/pygments-main/scripts/get_vimkw.py +0 -74
- data/vendor/pygments-main/scripts/pylintrc +0 -301
- data/vendor/pygments-main/scripts/vim2pygments.py +0 -935
- data/vendor/pygments-main/setup.cfg +0 -10
- data/vendor/pygments-main/setup.py +0 -77
- data/vendor/pygments-main/tox.ini +0 -7
- data/vendor/simplejson/.gitignore +0 -10
- data/vendor/simplejson/.travis.yml +0 -5
- data/vendor/simplejson/CHANGES.txt +0 -291
- data/vendor/simplejson/LICENSE.txt +0 -19
- data/vendor/simplejson/MANIFEST.in +0 -5
- data/vendor/simplejson/README.rst +0 -19
- data/vendor/simplejson/conf.py +0 -179
- data/vendor/simplejson/index.rst +0 -628
- data/vendor/simplejson/scripts/make_docs.py +0 -18
- data/vendor/simplejson/setup.py +0 -104
- data/vendor/simplejson/simplejson/__init__.py +0 -510
- data/vendor/simplejson/simplejson/_speedups.c +0 -2745
- data/vendor/simplejson/simplejson/decoder.py +0 -425
- data/vendor/simplejson/simplejson/encoder.py +0 -567
- data/vendor/simplejson/simplejson/ordered_dict.py +0 -119
- data/vendor/simplejson/simplejson/scanner.py +0 -77
- data/vendor/simplejson/simplejson/tests/__init__.py +0 -67
- data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +0 -55
- data/vendor/simplejson/simplejson/tests/test_check_circular.py +0 -30
- data/vendor/simplejson/simplejson/tests/test_decimal.py +0 -66
- data/vendor/simplejson/simplejson/tests/test_decode.py +0 -83
- data/vendor/simplejson/simplejson/tests/test_default.py +0 -9
- data/vendor/simplejson/simplejson/tests/test_dump.py +0 -67
- data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +0 -46
- data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +0 -32
- data/vendor/simplejson/simplejson/tests/test_errors.py +0 -34
- data/vendor/simplejson/simplejson/tests/test_fail.py +0 -91
- data/vendor/simplejson/simplejson/tests/test_float.py +0 -19
- data/vendor/simplejson/simplejson/tests/test_indent.py +0 -86
- data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +0 -20
- data/vendor/simplejson/simplejson/tests/test_namedtuple.py +0 -121
- data/vendor/simplejson/simplejson/tests/test_pass1.py +0 -76
- data/vendor/simplejson/simplejson/tests/test_pass2.py +0 -14
- data/vendor/simplejson/simplejson/tests/test_pass3.py +0 -20
- data/vendor/simplejson/simplejson/tests/test_recursion.py +0 -67
- data/vendor/simplejson/simplejson/tests/test_scanstring.py +0 -117
- data/vendor/simplejson/simplejson/tests/test_separators.py +0 -42
- data/vendor/simplejson/simplejson/tests/test_speedups.py +0 -20
- data/vendor/simplejson/simplejson/tests/test_tuple.py +0 -49
- data/vendor/simplejson/simplejson/tests/test_unicode.py +0 -109
- data/vendor/simplejson/simplejson/tool.py +0 -39
@@ -5,11 +5,12 @@
|
|
5
5
|
|
6
6
|
Lexer for Stata
|
7
7
|
|
8
|
-
:copyright: Copyright 2006-
|
8
|
+
:copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
|
9
9
|
:license: BSD, see LICENSE for details.
|
10
10
|
"""
|
11
11
|
|
12
|
-
|
12
|
+
import re
|
13
|
+
from pygments.lexer import RegexLexer, default, include, words
|
13
14
|
from pygments.token import Comment, Keyword, Name, Number, \
|
14
15
|
String, Text, Operator
|
15
16
|
|
@@ -17,6 +18,7 @@ from pygments.lexers._stata_builtins import builtins_base, builtins_functions
|
|
17
18
|
|
18
19
|
__all__ = ['StataLexer']
|
19
20
|
|
21
|
+
|
20
22
|
class StataLexer(RegexLexer):
|
21
23
|
"""
|
22
24
|
For `Stata <http://www.stata.com/>`_ do files.
|
@@ -25,62 +27,125 @@ class StataLexer(RegexLexer):
|
|
25
27
|
"""
|
26
28
|
# Syntax based on
|
27
29
|
# - http://fmwww.bc.edu/RePEc/bocode/s/synlightlist.ado
|
28
|
-
# -
|
29
|
-
# -
|
30
|
+
# - https://github.com/isagalaev/highlight.js/blob/master/src/languages/stata.js
|
31
|
+
# - https://github.com/jpitblado/vim-stata/blob/master/syntax/stata.vim
|
30
32
|
|
31
33
|
name = 'Stata'
|
32
34
|
aliases = ['stata', 'do']
|
33
35
|
filenames = ['*.do', '*.ado']
|
34
36
|
mimetypes = ['text/x-stata', 'text/stata', 'application/x-stata']
|
37
|
+
flags = re.MULTILINE | re.DOTALL
|
35
38
|
|
36
39
|
tokens = {
|
37
40
|
'root': [
|
38
41
|
include('comments'),
|
39
|
-
include('
|
42
|
+
include('strings'),
|
43
|
+
include('macros'),
|
40
44
|
include('numbers'),
|
41
45
|
include('keywords'),
|
46
|
+
include('operators'),
|
47
|
+
include('format'),
|
42
48
|
(r'.', Text),
|
43
49
|
],
|
44
|
-
#
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
(r'
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
(r'
|
56
|
-
|
57
|
-
|
58
|
-
(r'
|
59
|
-
|
60
|
-
|
50
|
+
# Comments are a complicated beast in Stata because they can be
|
51
|
+
# nested and there are a few corner cases with that. See:
|
52
|
+
# - github.com/kylebarron/language-stata/issues/90
|
53
|
+
# - statalist.org/forums/forum/general-stata-discussion/general/1448244
|
54
|
+
'comments': [
|
55
|
+
(r'(^//|(?<=\s)//)(?!/)', Comment.Single, 'comments-double-slash'),
|
56
|
+
(r'^\s*\*', Comment.Single, 'comments-star'),
|
57
|
+
(r'/\*', Comment.Multiline, 'comments-block'),
|
58
|
+
(r'(^///|(?<=\s)///)', Comment.Special, 'comments-triple-slash')
|
59
|
+
],
|
60
|
+
'comments-block': [
|
61
|
+
(r'/\*', Comment.Multiline, '#push'),
|
62
|
+
# this ends and restarts a comment block. but need to catch this so
|
63
|
+
# that it doesn\'t start _another_ level of comment blocks
|
64
|
+
(r'\*/\*', Comment.Multiline),
|
65
|
+
(r'(\*/\s+\*(?!/)[^\n]*)|(\*/)', Comment.Multiline, '#pop'),
|
66
|
+
# Match anything else as a character inside the comment
|
67
|
+
(r'.', Comment.Multiline),
|
68
|
+
],
|
69
|
+
'comments-star': [
|
70
|
+
(r'///.*?\n', Comment.Single,
|
71
|
+
('#pop', 'comments-triple-slash')),
|
72
|
+
(r'(^//|(?<=\s)//)(?!/)', Comment.Single,
|
73
|
+
('#pop', 'comments-double-slash')),
|
74
|
+
(r'/\*', Comment.Multiline, 'comments-block'),
|
75
|
+
(r'.(?=\n)', Comment.Single, '#pop'),
|
76
|
+
(r'.', Comment.Single),
|
77
|
+
],
|
78
|
+
'comments-triple-slash': [
|
79
|
+
(r'\n', Comment.Special, '#pop'),
|
80
|
+
# A // breaks out of a comment for the rest of the line
|
81
|
+
(r'//.*?(?=\n)', Comment.Single, '#pop'),
|
82
|
+
(r'.', Comment.Special),
|
83
|
+
],
|
84
|
+
'comments-double-slash': [
|
85
|
+
(r'\n', Text, '#pop'),
|
86
|
+
(r'.', Comment.Single),
|
87
|
+
],
|
88
|
+
# `"compound string"' and regular "string"; note the former are
|
89
|
+
# nested.
|
90
|
+
'strings': [
|
91
|
+
(r'`"', String, 'string-compound'),
|
92
|
+
(r'(?<!`)"', String, 'string-regular'),
|
93
|
+
],
|
94
|
+
'string-compound': [
|
95
|
+
(r'`"', String, '#push'),
|
61
96
|
(r'"\'', String, '#pop'),
|
62
|
-
(r'\\\\|\\"
|
63
|
-
(
|
64
|
-
(r'
|
65
|
-
(r'[^$\$`"\\]+', String),
|
66
|
-
(r'[$"\\]', String),
|
97
|
+
(r'\\\\|\\"|\\\$|\\`|\\\n', String.Escape),
|
98
|
+
include('macros'),
|
99
|
+
(r'.', String)
|
67
100
|
],
|
68
|
-
'
|
69
|
-
(r'
|
101
|
+
'string-regular': [
|
102
|
+
(r'(")(?!\')|(?=\n)', String, '#pop'),
|
103
|
+
(r'\\\\|\\"|\\\$|\\`|\\\n', String.Escape),
|
104
|
+
include('macros'),
|
105
|
+
(r'.', String)
|
70
106
|
],
|
71
|
-
|
72
|
-
|
107
|
+
# A local is usually
|
108
|
+
# `\w{0,31}'
|
109
|
+
# `:extended macro'
|
110
|
+
# `=expression'
|
111
|
+
# `[rsen](results)'
|
112
|
+
# `(++--)scalar(++--)'
|
113
|
+
#
|
114
|
+
# However, there are all sorts of weird rules wrt edge
|
115
|
+
# cases. Instead of writing 27 exceptions, anything inside
|
116
|
+
# `' is a local.
|
117
|
+
#
|
118
|
+
# A global is more restricted, so we do follow rules. Note only
|
119
|
+
# locals explicitly enclosed ${} can be nested.
|
120
|
+
'macros': [
|
121
|
+
(r'\$(\{|(?=[$`]))', Name.Variable.Global, 'macro-global-nested'),
|
122
|
+
(r'\$', Name.Variable.Global, 'macro-global-name'),
|
123
|
+
(r'`', Name.Variable, 'macro-local'),
|
73
124
|
],
|
74
|
-
|
75
|
-
|
76
|
-
(r'
|
77
|
-
(r'
|
78
|
-
(r'
|
79
|
-
(r'
|
125
|
+
'macro-local': [
|
126
|
+
(r'`', Name.Variable, '#push'),
|
127
|
+
(r"'", Name.Variable, '#pop'),
|
128
|
+
(r'\$(\{|(?=[$`]))', Name.Variable.Global, 'macro-global-nested'),
|
129
|
+
(r'\$', Name.Variable.Global, 'macro-global-name'),
|
130
|
+
(r'.', Name.Variable), # fallback
|
131
|
+
],
|
132
|
+
'macro-global-nested': [
|
133
|
+
(r'\$(\{|(?=[$`]))', Name.Variable.Global, '#push'),
|
134
|
+
(r'\}', Name.Variable.Global, '#pop'),
|
135
|
+
(r'\$', Name.Variable.Global, 'macro-global-name'),
|
136
|
+
(r'`', Name.Variable, 'macro-local'),
|
137
|
+
(r'\w', Name.Variable.Global), # fallback
|
138
|
+
default('#pop'),
|
139
|
+
],
|
140
|
+
'macro-global-name': [
|
141
|
+
(r'\$(\{|(?=[$`]))', Name.Variable.Global, 'macro-global-nested', '#pop'),
|
142
|
+
(r'\$', Name.Variable.Global, 'macro-global-name', '#pop'),
|
143
|
+
(r'`', Name.Variable, 'macro-local', '#pop'),
|
144
|
+
(r'\w{1,32}', Name.Variable.Global, '#pop'),
|
80
145
|
],
|
81
146
|
# Built in functions and statements
|
82
147
|
'keywords': [
|
83
|
-
(words(builtins_functions, prefix = r'\b', suffix = r'
|
148
|
+
(words(builtins_functions, prefix = r'\b', suffix = r'(?=\()'),
|
84
149
|
Name.Function),
|
85
150
|
(words(builtins_base, prefix = r'(^\s*|\s)', suffix = r'\b'),
|
86
151
|
Keyword),
|
@@ -98,9 +163,9 @@ class StataLexer(RegexLexer):
|
|
98
163
|
],
|
99
164
|
# Stata formats
|
100
165
|
'format': [
|
101
|
-
(r'%-?\d{1,2}(\.\d{1,2})?[gfe]c?', Name.
|
102
|
-
(r'%(21x|16H|16L|8H|8L)', Name.
|
103
|
-
(r'%-?(tc|tC|td|tw|tm|tq|th|ty|tg)
|
104
|
-
(r'%[-~]?\d{1,4}s', Name.
|
166
|
+
(r'%-?\d{1,2}(\.\d{1,2})?[gfe]c?', Name.Other),
|
167
|
+
(r'%(21x|16H|16L|8H|8L)', Name.Other),
|
168
|
+
(r'%-?(tc|tC|td|tw|tm|tq|th|ty|tg)\S{0,32}', Name.Other),
|
169
|
+
(r'%[-~]?\d{1,4}s', Name.Other),
|
105
170
|
]
|
106
171
|
}
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Lexer for SuperCollider
|
7
7
|
|
8
|
-
:copyright: Copyright 2006-
|
8
|
+
:copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
|
9
9
|
:license: BSD, see LICENSE for details.
|
10
10
|
"""
|
11
11
|
|
@@ -88,3 +88,8 @@ class SuperColliderLexer(RegexLexer):
|
|
88
88
|
(r"'(\\\\|\\'|[^'])*'", String.Single),
|
89
89
|
]
|
90
90
|
}
|
91
|
+
|
92
|
+
def analyse_text(text):
|
93
|
+
"""We're searching for a common function and a unique keyword here."""
|
94
|
+
if 'SinOsc' in text or 'thisFunctionDef' in text:
|
95
|
+
return 0.1
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Lexers for various template engines' markup.
|
7
7
|
|
8
|
-
:copyright: Copyright 2006-
|
8
|
+
:copyright: Copyright 2006-2020 by the Pygments team, see AUTHORS.
|
9
9
|
:license: BSD, see LICENSE for details.
|
10
10
|
"""
|
11
11
|
|
@@ -187,13 +187,13 @@ class SmartyLexer(RegexLexer):
|
|
187
187
|
|
188
188
|
def analyse_text(text):
|
189
189
|
rv = 0.0
|
190
|
-
if re.search('\{if\s+.*?\}.*?\{/if\}', text):
|
190
|
+
if re.search(r'\{if\s+.*?\}.*?\{/if\}', text):
|
191
191
|
rv += 0.15
|
192
|
-
if re.search('\{include\s+file=.*?\}', text):
|
192
|
+
if re.search(r'\{include\s+file=.*?\}', text):
|
193
193
|
rv += 0.15
|
194
|
-
if re.search('\{foreach\s+.*?\}.*?\{/foreach\}', text):
|
194
|
+
if re.search(r'\{foreach\s+.*?\}.*?\{/foreach\}', text):
|
195
195
|
rv += 0.15
|
196
|
-
if re.search('\{\$.*?\}', text):
|
196
|
+
if re.search(r'\{\$.*?\}', text):
|
197
197
|
rv += 0.01
|
198
198
|
return rv
|
199
199
|
|
@@ -226,7 +226,7 @@ class VelocityLexer(RegexLexer):
|
|
226
226
|
'directiveparams'),
|
227
227
|
(r'(#\{?)(' + identifier + r')(\}|\b)',
|
228
228
|
bygroups(Comment.Preproc, Name.Function, Comment.Preproc)),
|
229
|
-
(r'
|
229
|
+
(r'\$!?\{?', Punctuation, 'variable')
|
230
230
|
],
|
231
231
|
'variable': [
|
232
232
|
(identifier, Name.Variable),
|
@@ -249,7 +249,7 @@ class VelocityLexer(RegexLexer):
|
|
249
249
|
(r'\]', Operator, '#pop')
|
250
250
|
],
|
251
251
|
'funcparams': [
|
252
|
-
(r'
|
252
|
+
(r'\$!?\{?', Punctuation, 'variable'),
|
253
253
|
(r'\s+', Text),
|
254
254
|
(r'[,:]', Punctuation),
|
255
255
|
(r'"(\\\\|\\"|[^"])*"', String.Double),
|
@@ -274,7 +274,7 @@ class VelocityLexer(RegexLexer):
|
|
274
274
|
rv += 0.15
|
275
275
|
if re.search(r'#\{?foreach\}?\(.+?\).*?#\{?end\}?', text):
|
276
276
|
rv += 0.15
|
277
|
-
if re.search(r'
|
277
|
+
if re.search(r'\$!?\{?[a-zA-Z_]\w*(\([^)]*\))?'
|
278
278
|
r'(\.\w+(\([^)]*\))?)*\}?', text):
|
279
279
|
rv += 0.01
|
280
280
|
return rv
|
@@ -293,8 +293,7 @@ class VelocityHtmlLexer(DelegatingLexer):
|
|
293
293
|
mimetypes = ['text/html+velocity']
|
294
294
|
|
295
295
|
def __init__(self, **options):
|
296
|
-
super(
|
297
|
-
**options)
|
296
|
+
super().__init__(HtmlLexer, VelocityLexer, **options)
|
298
297
|
|
299
298
|
|
300
299
|
class VelocityXmlLexer(DelegatingLexer):
|
@@ -310,8 +309,7 @@ class VelocityXmlLexer(DelegatingLexer):
|
|
310
309
|
mimetypes = ['application/xml+velocity']
|
311
310
|
|
312
311
|
def __init__(self, **options):
|
313
|
-
super(
|
314
|
-
**options)
|
312
|
+
super().__init__(XmlLexer, VelocityLexer, **options)
|
315
313
|
|
316
314
|
def analyse_text(text):
|
317
315
|
rv = VelocityLexer.analyse_text(text) - 0.01
|
@@ -323,7 +321,7 @@ class VelocityXmlLexer(DelegatingLexer):
|
|
323
321
|
class DjangoLexer(RegexLexer):
|
324
322
|
"""
|
325
323
|
Generic `django <http://www.djangoproject.com/documentation/templates/>`_
|
326
|
-
and `jinja <
|
324
|
+
and `jinja <https://jinja.pocoo.org/jinja/>`_ template lexer.
|
327
325
|
|
328
326
|
It just highlights django/jinja code between the preprocessor directives,
|
329
327
|
other data is left untouched by the lexer.
|
@@ -340,7 +338,7 @@ class DjangoLexer(RegexLexer):
|
|
340
338
|
(r'[^{]+', Other),
|
341
339
|
(r'\{\{', Comment.Preproc, 'var'),
|
342
340
|
# jinja/django comments
|
343
|
-
(r'\{
|
341
|
+
(r'\{#.*?#\}', Comment),
|
344
342
|
# django comments
|
345
343
|
(r'(\{%)(-?\s*)(comment)(\s*-?)(%\})(.*?)'
|
346
344
|
r'(\{%)(-?\s*)(endcomment)(\s*-?)(%\})',
|
@@ -375,7 +373,7 @@ class DjangoLexer(RegexLexer):
|
|
375
373
|
(r'\.\w+', Name.Variable),
|
376
374
|
(r':?"(\\\\|\\"|[^"])*"', String.Double),
|
377
375
|
(r":?'(\\\\|\\'|[^'])*'", String.Single),
|
378
|
-
(r'([{}()\[\]
|
376
|
+
(r'([{}()\[\]+\-*/%,:~]|[><=]=?|!=)', Operator),
|
379
377
|
(r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
|
380
378
|
r"0[xX][0-9a-fA-F]+[Ll]?", Number),
|
381
379
|
],
|
@@ -421,18 +419,18 @@ class MyghtyLexer(RegexLexer):
|
|
421
419
|
tokens = {
|
422
420
|
'root': [
|
423
421
|
(r'\s+', Text),
|
424
|
-
(r'(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)
|
422
|
+
(r'(?s)(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)',
|
425
423
|
bygroups(Name.Tag, Text, Name.Function, Name.Tag,
|
426
424
|
using(this), Name.Tag)),
|
427
|
-
(r'(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)
|
425
|
+
(r'(?s)(<%\w+)(.*?)(>)(.*?)(</%\2\s*>)',
|
428
426
|
bygroups(Name.Tag, Name.Function, Name.Tag,
|
429
427
|
using(PythonLexer), Name.Tag)),
|
430
428
|
(r'(<&[^|])(.*?)(,.*?)?(&>)',
|
431
429
|
bygroups(Name.Tag, Name.Function, using(PythonLexer), Name.Tag)),
|
432
|
-
(r'(<&\|)(.*?)(,.*?)?(&>)
|
430
|
+
(r'(?s)(<&\|)(.*?)(,.*?)?(&>)',
|
433
431
|
bygroups(Name.Tag, Name.Function, using(PythonLexer), Name.Tag)),
|
434
432
|
(r'</&>', Name.Tag),
|
435
|
-
(r'(<%!?)(.*?)(%>)
|
433
|
+
(r'(?s)(<%!?)(.*?)(%>)',
|
436
434
|
bygroups(Name.Tag, using(PythonLexer), Name.Tag)),
|
437
435
|
(r'(?<=^)#[^\n]*(\n|\Z)', Comment),
|
438
436
|
(r'(?<=^)(%)([^\n]*)(\n|\Z)',
|
@@ -464,8 +462,7 @@ class MyghtyHtmlLexer(DelegatingLexer):
|
|
464
462
|
mimetypes = ['text/html+myghty']
|
465
463
|
|
466
464
|
def __init__(self, **options):
|
467
|
-
super(
|
468
|
-
**options)
|
465
|
+
super().__init__(HtmlLexer, MyghtyLexer, **options)
|
469
466
|
|
470
467
|
|
471
468
|
class MyghtyXmlLexer(DelegatingLexer):
|
@@ -481,8 +478,7 @@ class MyghtyXmlLexer(DelegatingLexer):
|
|
481
478
|
mimetypes = ['application/xml+myghty']
|
482
479
|
|
483
480
|
def __init__(self, **options):
|
484
|
-
super(
|
485
|
-
**options)
|
481
|
+
super().__init__(XmlLexer, MyghtyLexer, **options)
|
486
482
|
|
487
483
|
|
488
484
|
class MyghtyJavascriptLexer(DelegatingLexer):
|
@@ -500,8 +496,7 @@ class MyghtyJavascriptLexer(DelegatingLexer):
|
|
500
496
|
'text/javascript+mygthy']
|
501
497
|
|
502
498
|
def __init__(self, **options):
|
503
|
-
super(
|
504
|
-
MyghtyLexer, **options)
|
499
|
+
super().__init__(JavascriptLexer, MyghtyLexer, **options)
|
505
500
|
|
506
501
|
|
507
502
|
class MyghtyCssLexer(DelegatingLexer):
|
@@ -517,8 +512,7 @@ class MyghtyCssLexer(DelegatingLexer):
|
|
517
512
|
mimetypes = ['text/css+myghty']
|
518
513
|
|
519
514
|
def __init__(self, **options):
|
520
|
-
super(
|
521
|
-
**options)
|
515
|
+
super().__init__(CssLexer, MyghtyLexer, **options)
|
522
516
|
|
523
517
|
|
524
518
|
class MasonLexer(RegexLexer):
|
@@ -538,20 +532,19 @@ class MasonLexer(RegexLexer):
|
|
538
532
|
tokens = {
|
539
533
|
'root': [
|
540
534
|
(r'\s+', Text),
|
541
|
-
(r'(<%doc>)(.*?)(</%doc>)
|
535
|
+
(r'(?s)(<%doc>)(.*?)(</%doc>)',
|
542
536
|
bygroups(Name.Tag, Comment.Multiline, Name.Tag)),
|
543
|
-
(r'(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)
|
537
|
+
(r'(?s)(<%(?:def|method))(\s*)(.*?)(>)(.*?)(</%\2\s*>)',
|
544
538
|
bygroups(Name.Tag, Text, Name.Function, Name.Tag,
|
545
539
|
using(this), Name.Tag)),
|
546
|
-
(r'(
|
547
|
-
bygroups(Name.Tag,
|
548
|
-
|
549
|
-
(r'(<&[^|])(.*?)(,.*?)?(&>)(?s)',
|
540
|
+
(r'(?s)(<%(\w+)(.*?)(>))(.*?)(</%\2\s*>)',
|
541
|
+
bygroups(Name.Tag, None, None, None, using(PerlLexer), Name.Tag)),
|
542
|
+
(r'(?s)(<&[^|])(.*?)(,.*?)?(&>)',
|
550
543
|
bygroups(Name.Tag, Name.Function, using(PerlLexer), Name.Tag)),
|
551
|
-
(r'(<&\|)(.*?)(,.*?)?(&>)
|
544
|
+
(r'(?s)(<&\|)(.*?)(,.*?)?(&>)',
|
552
545
|
bygroups(Name.Tag, Name.Function, using(PerlLexer), Name.Tag)),
|
553
546
|
(r'</&>', Name.Tag),
|
554
|
-
(r'(<%!?)(.*?)(%>)
|
547
|
+
(r'(?s)(<%!?)(.*?)(%>)',
|
555
548
|
bygroups(Name.Tag, using(PerlLexer), Name.Tag)),
|
556
549
|
(r'(?<=^)#[^\n]*(\n|\Z)', Comment),
|
557
550
|
(r'(?<=^)(%)([^\n]*)(\n|\Z)',
|
@@ -571,7 +564,7 @@ class MasonLexer(RegexLexer):
|
|
571
564
|
|
572
565
|
def analyse_text(text):
|
573
566
|
result = 0.0
|
574
|
-
if re.search(r'</%(class|doc|init)
|
567
|
+
if re.search(r'</%(class|doc|init)>', text) is not None:
|
575
568
|
result = 1.0
|
576
569
|
elif re.search(r'<&.+&>', text, re.DOTALL) is not None:
|
577
570
|
result = 0.11
|
@@ -607,7 +600,7 @@ class MakoLexer(RegexLexer):
|
|
607
600
|
(r'(</%)([\w.:]+)(>)',
|
608
601
|
bygroups(Comment.Preproc, Name.Builtin, Comment.Preproc)),
|
609
602
|
(r'<%(?=([\w.:]+))', Comment.Preproc, 'ondeftags'),
|
610
|
-
(r'(<%(?:!?))(.*?)(%>)
|
603
|
+
(r'(?s)(<%(?:!?))(.*?)(%>)',
|
611
604
|
bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
|
612
605
|
(r'(\$\{)(.*?)(\})',
|
613
606
|
bygroups(Comment.Preproc, using(PythonLexer), Comment.Preproc)),
|
@@ -659,8 +652,7 @@ class MakoHtmlLexer(DelegatingLexer):
|
|
659
652
|
mimetypes = ['text/html+mako']
|
660
653
|
|
661
654
|
def __init__(self, **options):
|
662
|
-
super(
|
663
|
-
**options)
|
655
|
+
super().__init__(HtmlLexer, MakoLexer, **options)
|
664
656
|
|
665
657
|
|
666
658
|
class MakoXmlLexer(DelegatingLexer):
|
@@ -676,8 +668,7 @@ class MakoXmlLexer(DelegatingLexer):
|
|
676
668
|
mimetypes = ['application/xml+mako']
|
677
669
|
|
678
670
|
def __init__(self, **options):
|
679
|
-
super(
|
680
|
-
**options)
|
671
|
+
super().__init__(XmlLexer, MakoLexer, **options)
|
681
672
|
|
682
673
|
|
683
674
|
class MakoJavascriptLexer(DelegatingLexer):
|
@@ -695,8 +686,7 @@ class MakoJavascriptLexer(DelegatingLexer):
|
|
695
686
|
'text/javascript+mako']
|
696
687
|
|
697
688
|
def __init__(self, **options):
|
698
|
-
super(
|
699
|
-
MakoLexer, **options)
|
689
|
+
super().__init__(JavascriptLexer, MakoLexer, **options)
|
700
690
|
|
701
691
|
|
702
692
|
class MakoCssLexer(DelegatingLexer):
|
@@ -712,8 +702,7 @@ class MakoCssLexer(DelegatingLexer):
|
|
712
702
|
mimetypes = ['text/css+mako']
|
713
703
|
|
714
704
|
def __init__(self, **options):
|
715
|
-
super(
|
716
|
-
**options)
|
705
|
+
super().__init__(CssLexer, MakoLexer, **options)
|
717
706
|
|
718
707
|
|
719
708
|
# Genshi and Cheetah lexers courtesy of Matt Good.
|
@@ -759,7 +748,7 @@ class CheetahLexer(RegexLexer):
|
|
759
748
|
# TODO support other Python syntax like $foo['bar']
|
760
749
|
(r'(\$)([a-zA-Z_][\w.]*\w)',
|
761
750
|
bygroups(Comment.Preproc, using(CheetahPythonLexer))),
|
762
|
-
(r'(\$\{!?)(.*?)(\})
|
751
|
+
(r'(?s)(\$\{!?)(.*?)(\})',
|
763
752
|
bygroups(Comment.Preproc, using(CheetahPythonLexer),
|
764
753
|
Comment.Preproc)),
|
765
754
|
(r'''(?sx)
|
@@ -786,8 +775,7 @@ class CheetahHtmlLexer(DelegatingLexer):
|
|
786
775
|
mimetypes = ['text/html+cheetah', 'text/html+spitfire']
|
787
776
|
|
788
777
|
def __init__(self, **options):
|
789
|
-
super(
|
790
|
-
**options)
|
778
|
+
super().__init__(HtmlLexer, CheetahLexer, **options)
|
791
779
|
|
792
780
|
|
793
781
|
class CheetahXmlLexer(DelegatingLexer):
|
@@ -801,8 +789,7 @@ class CheetahXmlLexer(DelegatingLexer):
|
|
801
789
|
mimetypes = ['application/xml+cheetah', 'application/xml+spitfire']
|
802
790
|
|
803
791
|
def __init__(self, **options):
|
804
|
-
super(
|
805
|
-
**options)
|
792
|
+
super().__init__(XmlLexer, CheetahLexer, **options)
|
806
793
|
|
807
794
|
|
808
795
|
class CheetahJavascriptLexer(DelegatingLexer):
|
@@ -822,8 +809,7 @@ class CheetahJavascriptLexer(DelegatingLexer):
|
|
822
809
|
'text/javascript+spitfire']
|
823
810
|
|
824
811
|
def __init__(self, **options):
|
825
|
-
super(
|
826
|
-
CheetahLexer, **options)
|
812
|
+
super().__init__(JavascriptLexer, CheetahLexer, **options)
|
827
813
|
|
828
814
|
|
829
815
|
class GenshiTextLexer(RegexLexer):
|
@@ -937,14 +923,13 @@ class HtmlGenshiLexer(DelegatingLexer):
|
|
937
923
|
mimetypes = ['text/html+genshi']
|
938
924
|
|
939
925
|
def __init__(self, **options):
|
940
|
-
super(
|
941
|
-
**options)
|
926
|
+
super().__init__(HtmlLexer, GenshiMarkupLexer, **options)
|
942
927
|
|
943
928
|
def analyse_text(text):
|
944
929
|
rv = 0.0
|
945
|
-
if re.search('\$\{.*?\}', text) is not None:
|
930
|
+
if re.search(r'\$\{.*?\}', text) is not None:
|
946
931
|
rv += 0.2
|
947
|
-
if re.search('py:(.*?)=["\']', text) is not None:
|
932
|
+
if re.search(r'py:(.*?)=["\']', text) is not None:
|
948
933
|
rv += 0.2
|
949
934
|
return rv + HtmlLexer.analyse_text(text) - 0.01
|
950
935
|
|
@@ -962,14 +947,13 @@ class GenshiLexer(DelegatingLexer):
|
|
962
947
|
mimetypes = ['application/x-genshi', 'application/x-kid']
|
963
948
|
|
964
949
|
def __init__(self, **options):
|
965
|
-
super(
|
966
|
-
**options)
|
950
|
+
super().__init__(XmlLexer, GenshiMarkupLexer, **options)
|
967
951
|
|
968
952
|
def analyse_text(text):
|
969
953
|
rv = 0.0
|
970
|
-
if re.search('\$\{.*?\}', text) is not None:
|
954
|
+
if re.search(r'\$\{.*?\}', text) is not None:
|
971
955
|
rv += 0.2
|
972
|
-
if re.search('py:(.*?)=["\']', text) is not None:
|
956
|
+
if re.search(r'py:(.*?)=["\']', text) is not None:
|
973
957
|
rv += 0.2
|
974
958
|
return rv + XmlLexer.analyse_text(text) - 0.01
|
975
959
|
|
@@ -988,9 +972,7 @@ class JavascriptGenshiLexer(DelegatingLexer):
|
|
988
972
|
'text/javascript+genshi']
|
989
973
|
|
990
974
|
def __init__(self, **options):
|
991
|
-
super(
|
992
|
-
GenshiTextLexer,
|
993
|
-
**options)
|
975
|
+
super().__init__(JavascriptLexer, GenshiTextLexer, **options)
|
994
976
|
|
995
977
|
def analyse_text(text):
|
996
978
|
return GenshiLexer.analyse_text(text) - 0.05
|
@@ -1007,8 +989,7 @@ class CssGenshiLexer(DelegatingLexer):
|
|
1007
989
|
mimetypes = ['text/css+genshi']
|
1008
990
|
|
1009
991
|
def __init__(self, **options):
|
1010
|
-
super(
|
1011
|
-
**options)
|
992
|
+
super().__init__(CssLexer, GenshiTextLexer, **options)
|
1012
993
|
|
1013
994
|
def analyse_text(text):
|
1014
995
|
return GenshiLexer.analyse_text(text) - 0.05
|
@@ -1029,7 +1010,7 @@ class RhtmlLexer(DelegatingLexer):
|
|
1029
1010
|
mimetypes = ['text/html+ruby']
|
1030
1011
|
|
1031
1012
|
def __init__(self, **options):
|
1032
|
-
super(
|
1013
|
+
super().__init__(HtmlLexer, ErbLexer, **options)
|
1033
1014
|
|
1034
1015
|
def analyse_text(text):
|
1035
1016
|
rv = ErbLexer.analyse_text(text) - 0.01
|
@@ -1051,7 +1032,7 @@ class XmlErbLexer(DelegatingLexer):
|
|
1051
1032
|
mimetypes = ['application/xml+ruby']
|
1052
1033
|
|
1053
1034
|
def __init__(self, **options):
|
1054
|
-
super(
|
1035
|
+
super().__init__(XmlLexer, ErbLexer, **options)
|
1055
1036
|
|
1056
1037
|
def analyse_text(text):
|
1057
1038
|
rv = ErbLexer.analyse_text(text) - 0.01
|
@@ -1071,7 +1052,7 @@ class CssErbLexer(DelegatingLexer):
|
|
1071
1052
|
mimetypes = ['text/css+ruby']
|
1072
1053
|
|
1073
1054
|
def __init__(self, **options):
|
1074
|
-
super(
|
1055
|
+
super().__init__(CssLexer, ErbLexer, **options)
|
1075
1056
|
|
1076
1057
|
def analyse_text(text):
|
1077
1058
|
return ErbLexer.analyse_text(text) - 0.05
|
@@ -1091,8 +1072,7 @@ class JavascriptErbLexer(DelegatingLexer):
|
|
1091
1072
|
'text/javascript+ruby']
|
1092
1073
|
|
1093
1074
|
def __init__(self, **options):
|
1094
|
-
super(
|
1095
|
-
**options)
|
1075
|
+
super().__init__(JavascriptLexer, ErbLexer, **options)
|
1096
1076
|
|
1097
1077
|
def analyse_text(text):
|
1098
1078
|
return ErbLexer.analyse_text(text) - 0.05
|
@@ -1115,7 +1095,7 @@ class HtmlPhpLexer(DelegatingLexer):
|
|
1115
1095
|
'application/x-httpd-php4', 'application/x-httpd-php5']
|
1116
1096
|
|
1117
1097
|
def __init__(self, **options):
|
1118
|
-
super(
|
1098
|
+
super().__init__(HtmlLexer, PhpLexer, **options)
|
1119
1099
|
|
1120
1100
|
def analyse_text(text):
|
1121
1101
|
rv = PhpLexer.analyse_text(text) - 0.01
|
@@ -1135,7 +1115,7 @@ class XmlPhpLexer(DelegatingLexer):
|
|
1135
1115
|
mimetypes = ['application/xml+php']
|
1136
1116
|
|
1137
1117
|
def __init__(self, **options):
|
1138
|
-
super(
|
1118
|
+
super().__init__(XmlLexer, PhpLexer, **options)
|
1139
1119
|
|
1140
1120
|
def analyse_text(text):
|
1141
1121
|
rv = PhpLexer.analyse_text(text) - 0.01
|
@@ -1155,7 +1135,7 @@ class CssPhpLexer(DelegatingLexer):
|
|
1155
1135
|
mimetypes = ['text/css+php']
|
1156
1136
|
|
1157
1137
|
def __init__(self, **options):
|
1158
|
-
super(
|
1138
|
+
super().__init__(CssLexer, PhpLexer, **options)
|
1159
1139
|
|
1160
1140
|
def analyse_text(text):
|
1161
1141
|
return PhpLexer.analyse_text(text) - 0.05
|
@@ -1175,8 +1155,7 @@ class JavascriptPhpLexer(DelegatingLexer):
|
|
1175
1155
|
'text/javascript+php']
|
1176
1156
|
|
1177
1157
|
def __init__(self, **options):
|
1178
|
-
super(
|
1179
|
-
**options)
|
1158
|
+
super().__init__(JavascriptLexer, PhpLexer, **options)
|
1180
1159
|
|
1181
1160
|
def analyse_text(text):
|
1182
1161
|
return PhpLexer.analyse_text(text)
|
@@ -1196,7 +1175,7 @@ class HtmlSmartyLexer(DelegatingLexer):
|
|
1196
1175
|
mimetypes = ['text/html+smarty']
|
1197
1176
|
|
1198
1177
|
def __init__(self, **options):
|
1199
|
-
super(
|
1178
|
+
super().__init__(HtmlLexer, SmartyLexer, **options)
|
1200
1179
|
|
1201
1180
|
def analyse_text(text):
|
1202
1181
|
rv = SmartyLexer.analyse_text(text) - 0.01
|
@@ -1217,7 +1196,7 @@ class XmlSmartyLexer(DelegatingLexer):
|
|
1217
1196
|
mimetypes = ['application/xml+smarty']
|
1218
1197
|
|
1219
1198
|
def __init__(self, **options):
|
1220
|
-
super(
|
1199
|
+
super().__init__(XmlLexer, SmartyLexer, **options)
|
1221
1200
|
|
1222
1201
|
def analyse_text(text):
|
1223
1202
|
rv = SmartyLexer.analyse_text(text) - 0.01
|
@@ -1238,7 +1217,7 @@ class CssSmartyLexer(DelegatingLexer):
|
|
1238
1217
|
mimetypes = ['text/css+smarty']
|
1239
1218
|
|
1240
1219
|
def __init__(self, **options):
|
1241
|
-
super(
|
1220
|
+
super().__init__(CssLexer, SmartyLexer, **options)
|
1242
1221
|
|
1243
1222
|
def analyse_text(text):
|
1244
1223
|
return SmartyLexer.analyse_text(text) - 0.05
|
@@ -1258,8 +1237,7 @@ class JavascriptSmartyLexer(DelegatingLexer):
|
|
1258
1237
|
'text/javascript+smarty']
|
1259
1238
|
|
1260
1239
|
def __init__(self, **options):
|
1261
|
-
super(
|
1262
|
-
**options)
|
1240
|
+
super().__init__(JavascriptLexer, SmartyLexer, **options)
|
1263
1241
|
|
1264
1242
|
def analyse_text(text):
|
1265
1243
|
return SmartyLexer.analyse_text(text) - 0.05
|
@@ -1279,7 +1257,7 @@ class HtmlDjangoLexer(DelegatingLexer):
|
|
1279
1257
|
mimetypes = ['text/html+django', 'text/html+jinja']
|
1280
1258
|
|
1281
1259
|
def __init__(self, **options):
|
1282
|
-
super(
|
1260
|
+
super().__init__(HtmlLexer, DjangoLexer, **options)
|
1283
1261
|
|
1284
1262
|
def analyse_text(text):
|
1285
1263
|
rv = DjangoLexer.analyse_text(text) - 0.01
|
@@ -1300,7 +1278,7 @@ class XmlDjangoLexer(DelegatingLexer):
|
|
1300
1278
|
mimetypes = ['application/xml+django', 'application/xml+jinja']
|
1301
1279
|
|
1302
1280
|
def __init__(self, **options):
|
1303
|
-
super(
|
1281
|
+
super().__init__(XmlLexer, DjangoLexer, **options)
|
1304
1282
|
|
1305
1283
|
def analyse_text(text):
|
1306
1284
|
rv = DjangoLexer.analyse_text(text) - 0.01
|
@@ -1321,7 +1299,7 @@ class CssDjangoLexer(DelegatingLexer):
|
|
1321
1299
|
mimetypes = ['text/css+django', 'text/css+jinja']
|
1322
1300
|
|
1323
1301
|
def __init__(self, **options):
|
1324
|
-
super(
|
1302
|
+
super().__init__(CssLexer, DjangoLexer, **options)
|
1325
1303
|
|
1326
1304
|
def analyse_text(text):
|
1327
1305
|
return DjangoLexer.analyse_text(text) - 0.05
|
@@ -1345,8 +1323,7 @@ class JavascriptDjangoLexer(DelegatingLexer):
|
|
1345
1323
|
'text/javascript+jinja']
|
1346
1324
|
|
1347
1325
|
def __init__(self, **options):
|
1348
|
-
super(
|
1349
|
-
**options)
|
1326
|
+
super().__init__(JavascriptLexer, DjangoLexer, **options)
|
1350
1327
|
|
1351
1328
|
def analyse_text(text):
|
1352
1329
|
return DjangoLexer.analyse_text(text) - 0.05
|
@@ -1389,7 +1366,7 @@ class JspLexer(DelegatingLexer):
|
|
1389
1366
|
mimetypes = ['application/x-jsp']
|
1390
1367
|
|
1391
1368
|
def __init__(self, **options):
|
1392
|
-
super(
|
1369
|
+
super().__init__(XmlLexer, JspRootLexer, **options)
|
1393
1370
|
|
1394
1371
|
def analyse_text(text):
|
1395
1372
|
rv = JavaLexer.analyse_text(text) - 0.01
|
@@ -1452,6 +1429,10 @@ class EvoqueLexer(RegexLexer):
|
|
1452
1429
|
],
|
1453
1430
|
}
|
1454
1431
|
|
1432
|
+
def analyse_text(text):
|
1433
|
+
"""Evoque templates use $evoque, which is unique."""
|
1434
|
+
if '$evoque' in text:
|
1435
|
+
return 1
|
1455
1436
|
|
1456
1437
|
class EvoqueHtmlLexer(DelegatingLexer):
|
1457
1438
|
"""
|
@@ -1466,8 +1447,10 @@ class EvoqueHtmlLexer(DelegatingLexer):
|
|
1466
1447
|
mimetypes = ['text/html+evoque']
|
1467
1448
|
|
1468
1449
|
def __init__(self, **options):
|
1469
|
-
super(
|
1470
|
-
|
1450
|
+
super().__init__(HtmlLexer, EvoqueLexer, **options)
|
1451
|
+
|
1452
|
+
def analyse_text(text):
|
1453
|
+
return EvoqueLexer.analyse_text(text)
|
1471
1454
|
|
1472
1455
|
|
1473
1456
|
class EvoqueXmlLexer(DelegatingLexer):
|
@@ -1483,8 +1466,10 @@ class EvoqueXmlLexer(DelegatingLexer):
|
|
1483
1466
|
mimetypes = ['application/xml+evoque']
|
1484
1467
|
|
1485
1468
|
def __init__(self, **options):
|
1486
|
-
super(
|
1487
|
-
|
1469
|
+
super().__init__(XmlLexer, EvoqueLexer, **options)
|
1470
|
+
|
1471
|
+
def analyse_text(text):
|
1472
|
+
return EvoqueLexer.analyse_text(text)
|
1488
1473
|
|
1489
1474
|
|
1490
1475
|
class ColdfusionLexer(RegexLexer):
|
@@ -1591,8 +1576,7 @@ class ColdfusionHtmlLexer(DelegatingLexer):
|
|
1591
1576
|
mimetypes = ['application/x-coldfusion']
|
1592
1577
|
|
1593
1578
|
def __init__(self, **options):
|
1594
|
-
super(
|
1595
|
-
**options)
|
1579
|
+
super().__init__(HtmlLexer, ColdfusionMarkupLexer, **options)
|
1596
1580
|
|
1597
1581
|
|
1598
1582
|
class ColdfusionCFCLexer(DelegatingLexer):
|
@@ -1607,8 +1591,7 @@ class ColdfusionCFCLexer(DelegatingLexer):
|
|
1607
1591
|
mimetypes = []
|
1608
1592
|
|
1609
1593
|
def __init__(self, **options):
|
1610
|
-
super(
|
1611
|
-
**options)
|
1594
|
+
super().__init__(ColdfusionHtmlLexer, ColdfusionLexer, **options)
|
1612
1595
|
|
1613
1596
|
|
1614
1597
|
class SspLexer(DelegatingLexer):
|
@@ -1623,11 +1606,11 @@ class SspLexer(DelegatingLexer):
|
|
1623
1606
|
mimetypes = ['application/x-ssp']
|
1624
1607
|
|
1625
1608
|
def __init__(self, **options):
|
1626
|
-
super(
|
1609
|
+
super().__init__(XmlLexer, JspRootLexer, **options)
|
1627
1610
|
|
1628
1611
|
def analyse_text(text):
|
1629
1612
|
rv = 0.0
|
1630
|
-
if re.search('val \w+\s*:', text):
|
1613
|
+
if re.search(r'val \w+\s*:', text):
|
1631
1614
|
rv += 0.6
|
1632
1615
|
if looks_like_xml(text):
|
1633
1616
|
rv += 0.2
|
@@ -1670,8 +1653,7 @@ class TeaTemplateLexer(DelegatingLexer):
|
|
1670
1653
|
mimetypes = ['text/x-tea']
|
1671
1654
|
|
1672
1655
|
def __init__(self, **options):
|
1673
|
-
super(
|
1674
|
-
TeaTemplateRootLexer, **options)
|
1656
|
+
super().__init__(XmlLexer, TeaTemplateRootLexer, **options)
|
1675
1657
|
|
1676
1658
|
def analyse_text(text):
|
1677
1659
|
rv = TeaLangLexer.analyse_text(text) - 0.01
|
@@ -1701,7 +1683,7 @@ class LassoHtmlLexer(DelegatingLexer):
|
|
1701
1683
|
'application/x-httpd-lasso[89]']
|
1702
1684
|
|
1703
1685
|
def __init__(self, **options):
|
1704
|
-
super(
|
1686
|
+
super().__init__(HtmlLexer, LassoLexer, **options)
|
1705
1687
|
|
1706
1688
|
def analyse_text(text):
|
1707
1689
|
rv = LassoLexer.analyse_text(text) - 0.01
|
@@ -1725,7 +1707,7 @@ class LassoXmlLexer(DelegatingLexer):
|
|
1725
1707
|
mimetypes = ['application/xml+lasso']
|
1726
1708
|
|
1727
1709
|
def __init__(self, **options):
|
1728
|
-
super(
|
1710
|
+
super().__init__(XmlLexer, LassoLexer, **options)
|
1729
1711
|
|
1730
1712
|
def analyse_text(text):
|
1731
1713
|
rv = LassoLexer.analyse_text(text) - 0.01
|
@@ -1749,7 +1731,7 @@ class LassoCssLexer(DelegatingLexer):
|
|
1749
1731
|
|
1750
1732
|
def __init__(self, **options):
|
1751
1733
|
options['requiredelimiters'] = True
|
1752
|
-
super(
|
1734
|
+
super().__init__(CssLexer, LassoLexer, **options)
|
1753
1735
|
|
1754
1736
|
def analyse_text(text):
|
1755
1737
|
rv = LassoLexer.analyse_text(text) - 0.05
|
@@ -1777,8 +1759,7 @@ class LassoJavascriptLexer(DelegatingLexer):
|
|
1777
1759
|
|
1778
1760
|
def __init__(self, **options):
|
1779
1761
|
options['requiredelimiters'] = True
|
1780
|
-
super(
|
1781
|
-
**options)
|
1762
|
+
super().__init__(JavascriptLexer, LassoLexer, **options)
|
1782
1763
|
|
1783
1764
|
def analyse_text(text):
|
1784
1765
|
rv = LassoLexer.analyse_text(text) - 0.05
|
@@ -1802,32 +1783,59 @@ class HandlebarsLexer(RegexLexer):
|
|
1802
1783
|
'root': [
|
1803
1784
|
(r'[^{]+', Other),
|
1804
1785
|
|
1786
|
+
# Comment start {{! }} or {{!--
|
1805
1787
|
(r'\{\{!.*\}\}', Comment),
|
1806
1788
|
|
1789
|
+
# HTML Escaping open {{{expression
|
1807
1790
|
(r'(\{\{\{)(\s*)', bygroups(Comment.Special, Text), 'tag'),
|
1791
|
+
|
1792
|
+
# {{blockOpen {{#blockOpen {{/blockClose with optional tilde ~
|
1793
|
+
(r'(\{\{)([#~/]+)([^\s}]*)',
|
1794
|
+
bygroups(Comment.Preproc, Number.Attribute, Number.Attribute), 'tag'),
|
1808
1795
|
(r'(\{\{)(\s*)', bygroups(Comment.Preproc, Text), 'tag'),
|
1809
1796
|
],
|
1810
1797
|
|
1811
1798
|
'tag': [
|
1812
1799
|
(r'\s+', Text),
|
1800
|
+
# HTML Escaping close }}}
|
1813
1801
|
(r'\}\}\}', Comment.Special, '#pop'),
|
1814
|
-
|
1802
|
+
# blockClose}}, includes optional tilde ~
|
1803
|
+
(r'(~?)(\}\})', bygroups(Number, Comment.Preproc), '#pop'),
|
1815
1804
|
|
1816
|
-
#
|
1817
|
-
(r'([
|
1818
|
-
Keyword)),
|
1805
|
+
# {{opt=something}}
|
1806
|
+
(r'([^\s}]+)(=)', bygroups(Name.Attribute, Operator)),
|
1819
1807
|
|
1820
|
-
#
|
1821
|
-
(r'(
|
1808
|
+
# Partials {{> ...}}
|
1809
|
+
(r'(>)(\s*)(@partial-block)', bygroups(Keyword, Text, Keyword)),
|
1810
|
+
(r'(#?>)(\s*)([\w-]+)', bygroups(Keyword, Text, Name.Variable)),
|
1811
|
+
(r'(>)(\s*)(\()', bygroups(Keyword, Text, Punctuation),
|
1812
|
+
'dynamic-partial'),
|
1822
1813
|
|
1823
|
-
|
1824
|
-
|
1814
|
+
include('generic'),
|
1815
|
+
],
|
1816
|
+
'dynamic-partial': [
|
1817
|
+
(r'\s+', Text),
|
1818
|
+
(r'\)', Punctuation, '#pop'),
|
1819
|
+
|
1820
|
+
(r'(lookup)(\s+)(\.|this)(\s+)', bygroups(Keyword, Text,
|
1821
|
+
Name.Variable, Text)),
|
1822
|
+
(r'(lookup)(\s+)(\S+)', bygroups(Keyword, Text,
|
1823
|
+
using(this, state='variable'))),
|
1824
|
+
(r'[\w-]+', Name.Function),
|
1825
|
+
|
1826
|
+
include('generic'),
|
1827
|
+
],
|
1828
|
+
'variable': [
|
1829
|
+
(r'[()/@a-zA-Z][\w-]*', Name.Variable),
|
1830
|
+
(r'\.[\w-]+', Name.Variable),
|
1831
|
+
(r'(this\/|\.\/|(\.\.\/)+)[\w-]+', Name.Variable),
|
1832
|
+
],
|
1833
|
+
'generic': [
|
1834
|
+
include('variable'),
|
1825
1835
|
|
1826
1836
|
# borrowed from DjangoLexer
|
1827
1837
|
(r':?"(\\\\|\\"|[^"])*"', String.Double),
|
1828
1838
|
(r":?'(\\\\|\\'|[^'])*'", String.Single),
|
1829
|
-
(r'[a-zA-Z][\w-]*', Name.Variable),
|
1830
|
-
(r'\.[\w-]+', Name.Variable),
|
1831
1839
|
(r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
|
1832
1840
|
r"0[xX][0-9a-fA-F]+[Ll]?", Number),
|
1833
1841
|
]
|
@@ -1848,7 +1856,7 @@ class HandlebarsHtmlLexer(DelegatingLexer):
|
|
1848
1856
|
mimetypes = ['text/html+handlebars', 'text/x-handlebars-template']
|
1849
1857
|
|
1850
1858
|
def __init__(self, **options):
|
1851
|
-
super(
|
1859
|
+
super().__init__(HtmlLexer, HandlebarsLexer, **options)
|
1852
1860
|
|
1853
1861
|
|
1854
1862
|
class YamlJinjaLexer(DelegatingLexer):
|
@@ -1867,7 +1875,7 @@ class YamlJinjaLexer(DelegatingLexer):
|
|
1867
1875
|
mimetypes = ['text/x-yaml+jinja', 'text/x-sls']
|
1868
1876
|
|
1869
1877
|
def __init__(self, **options):
|
1870
|
-
super(
|
1878
|
+
super().__init__(YamlLexer, DjangoLexer, **options)
|
1871
1879
|
|
1872
1880
|
|
1873
1881
|
class LiquidLexer(RegexLexer):
|
@@ -1928,7 +1936,7 @@ class LiquidLexer(RegexLexer):
|
|
1928
1936
|
|
1929
1937
|
'output': [
|
1930
1938
|
include('whitespace'),
|
1931
|
-
('\}\}', Punctuation, '#pop'), # end of output
|
1939
|
+
(r'\}\}', Punctuation, '#pop'), # end of output
|
1932
1940
|
|
1933
1941
|
(r'\|', Punctuation, 'filters')
|
1934
1942
|
],
|
@@ -2173,18 +2181,20 @@ class TwigHtmlLexer(DelegatingLexer):
|
|
2173
2181
|
mimetypes = ['text/html+twig']
|
2174
2182
|
|
2175
2183
|
def __init__(self, **options):
|
2176
|
-
super(
|
2184
|
+
super().__init__(HtmlLexer, TwigLexer, **options)
|
2185
|
+
|
2177
2186
|
|
2178
|
-
|
2179
2187
|
class Angular2Lexer(RegexLexer):
|
2180
2188
|
"""
|
2181
|
-
Generic
|
2189
|
+
Generic
|
2190
|
+
`angular2 <http://victorsavkin.com/post/119943127151/angular-2-template-syntax>`_
|
2191
|
+
template lexer.
|
2182
2192
|
|
2183
|
-
Highlights only the Angular template tags (stuff between `{{` and `}}` and
|
2193
|
+
Highlights only the Angular template tags (stuff between `{{` and `}}` and
|
2184
2194
|
special attributes: '(event)=', '[property]=', '[(twoWayBinding)]=').
|
2185
2195
|
Everything else is left for a delegating lexer.
|
2186
2196
|
|
2187
|
-
.. versionadded:: 2.
|
2197
|
+
.. versionadded:: 2.1
|
2188
2198
|
"""
|
2189
2199
|
|
2190
2200
|
name = "Angular2"
|
@@ -2196,37 +2206,39 @@ class Angular2Lexer(RegexLexer):
|
|
2196
2206
|
|
2197
2207
|
# {{meal.name}}
|
2198
2208
|
(r'(\{\{)(\s*)', bygroups(Comment.Preproc, Text), 'ngExpression'),
|
2199
|
-
|
2209
|
+
|
2200
2210
|
# (click)="deleteOrder()"; [value]="test"; [(twoWayTest)]="foo.bar"
|
2201
2211
|
(r'([([]+)([\w:.-]+)([\])]+)(\s*)(=)(\s*)',
|
2202
|
-
bygroups(Punctuation, Name.Attribute, Punctuation, Text, Operator, Text),
|
2212
|
+
bygroups(Punctuation, Name.Attribute, Punctuation, Text, Operator, Text),
|
2213
|
+
'attr'),
|
2203
2214
|
(r'([([]+)([\w:.-]+)([\])]+)(\s*)',
|
2204
2215
|
bygroups(Punctuation, Name.Attribute, Punctuation, Text)),
|
2205
|
-
|
2216
|
+
|
2206
2217
|
# *ngIf="..."; #f="ngForm"
|
2207
2218
|
(r'([*#])([\w:.-]+)(\s*)(=)(\s*)',
|
2208
|
-
bygroups(Punctuation, Name.Attribute,
|
2219
|
+
bygroups(Punctuation, Name.Attribute, Text, Operator, Text), 'attr'),
|
2209
2220
|
(r'([*#])([\w:.-]+)(\s*)',
|
2210
|
-
bygroups(Punctuation, Name.Attribute,
|
2221
|
+
bygroups(Punctuation, Name.Attribute, Text)),
|
2211
2222
|
],
|
2212
|
-
|
2223
|
+
|
2213
2224
|
'ngExpression': [
|
2214
2225
|
(r'\s+(\|\s+)?', Text),
|
2215
2226
|
(r'\}\}', Comment.Preproc, '#pop'),
|
2216
|
-
|
2227
|
+
|
2217
2228
|
# Literals
|
2218
2229
|
(r':?(true|false)', String.Boolean),
|
2219
2230
|
(r':?"(\\\\|\\"|[^"])*"', String.Double),
|
2220
2231
|
(r":?'(\\\\|\\'|[^'])*'", String.Single),
|
2221
2232
|
(r"[0-9](\.[0-9]*)?(eE[+-][0-9])?[flFLdD]?|"
|
2222
2233
|
r"0[xX][0-9a-fA-F]+[Ll]?", Number),
|
2223
|
-
|
2234
|
+
|
2224
2235
|
# Variabletext
|
2225
2236
|
(r'[a-zA-Z][\w-]*(\(.*\))?', Name.Variable),
|
2226
2237
|
(r'\.[\w-]+(\(.*\))?', Name.Variable),
|
2227
|
-
|
2238
|
+
|
2228
2239
|
# inline If
|
2229
|
-
(r'(\?)(\s*)([^}\s]+)(\s*)(:)(\s*)([^}\s]+)(\s*)',
|
2240
|
+
(r'(\?)(\s*)([^}\s]+)(\s*)(:)(\s*)([^}\s]+)(\s*)',
|
2241
|
+
bygroups(Operator, Text, String, Text, Operator, Text, String, Text)),
|
2230
2242
|
],
|
2231
2243
|
'attr': [
|
2232
2244
|
('".*?"', String, '#pop'),
|
@@ -2249,4 +2261,4 @@ class Angular2HtmlLexer(DelegatingLexer):
|
|
2249
2261
|
filenames = ['*.ng2']
|
2250
2262
|
|
2251
2263
|
def __init__(self, **options):
|
2252
|
-
super(
|
2264
|
+
super().__init__(HtmlLexer, Angular2Lexer, **options)
|