pygments.rb 0.6.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +11 -0
- data/README.md +6 -6
- data/Rakefile +2 -1
- data/cache-lexers.rb +1 -1
- data/circle.yml +7 -0
- data/lib/pygments/lexer.rb +3 -3
- data/lib/pygments/popen.rb +67 -30
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +2 -1
- data/test/test_pygments.rb +16 -16
- data/vendor/pygments-main/AUTHORS +54 -8
- data/vendor/pygments-main/CHANGES +247 -25
- data/vendor/pygments-main/LICENSE +1 -1
- data/vendor/pygments-main/Makefile +15 -6
- data/vendor/pygments-main/README.rst +39 -0
- data/vendor/pygments-main/REVISION +1 -1
- data/vendor/pygments-main/TODO +0 -3
- data/vendor/pygments-main/doc/_themes/pygments14/layout.html +1 -1
- data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +1 -1
- data/vendor/pygments-main/doc/conf.py +3 -11
- data/vendor/pygments-main/doc/docs/api.rst +15 -0
- data/vendor/pygments-main/doc/docs/cmdline.rst +6 -2
- data/vendor/pygments-main/doc/docs/filterdevelopment.rst +4 -3
- data/vendor/pygments-main/doc/docs/integrate.rst +11 -15
- data/vendor/pygments-main/doc/docs/java.rst +7 -7
- data/vendor/pygments-main/doc/docs/lexerdevelopment.rst +258 -171
- data/vendor/pygments-main/doc/docs/lexers.rst +2 -2
- data/vendor/pygments-main/doc/docs/styles.rst +58 -0
- data/vendor/pygments-main/doc/docs/tokens.rst +22 -2
- data/vendor/pygments-main/doc/docs/unicode.rst +15 -7
- data/vendor/pygments-main/doc/faq.rst +17 -21
- data/vendor/pygments-main/doc/index.rst +12 -11
- data/vendor/pygments-main/doc/languages.rst +10 -7
- data/vendor/pygments-main/external/autopygmentize +9 -6
- data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +70 -52
- data/vendor/pygments-main/external/markdown-processor.py +1 -1
- data/vendor/pygments-main/external/moin-parser.py +1 -1
- data/vendor/pygments-main/external/rst-directive.py +1 -1
- data/vendor/pygments-main/pygmentize +2 -1
- data/vendor/pygments-main/pygments/__init__.py +14 -15
- data/vendor/pygments-main/pygments/cmdline.py +188 -113
- data/vendor/pygments-main/pygments/console.py +13 -13
- data/vendor/pygments-main/pygments/filter.py +7 -7
- data/vendor/pygments-main/pygments/filters/__init__.py +24 -32
- data/vendor/pygments-main/pygments/formatter.py +5 -5
- data/vendor/pygments-main/pygments/formatters/__init__.py +92 -44
- data/vendor/pygments-main/pygments/formatters/_mapping.py +51 -69
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/html.py +63 -51
- data/vendor/pygments-main/pygments/formatters/img.py +25 -22
- data/vendor/pygments-main/pygments/formatters/irc.py +182 -0
- data/vendor/pygments-main/pygments/formatters/latex.py +34 -22
- data/vendor/pygments-main/pygments/formatters/other.py +5 -7
- data/vendor/pygments-main/pygments/formatters/rtf.py +28 -31
- data/vendor/pygments-main/pygments/formatters/svg.py +1 -2
- data/vendor/pygments-main/pygments/formatters/terminal.py +29 -45
- data/vendor/pygments-main/pygments/formatters/terminal256.py +118 -31
- data/vendor/pygments-main/pygments/lexer.py +120 -34
- data/vendor/pygments-main/pygments/lexers/__init__.py +85 -53
- data/vendor/pygments-main/pygments/lexers/{_asybuiltins.py → _asy_builtins.py} +7 -7
- data/vendor/pygments-main/pygments/lexers/{_clbuiltins.py → _cl_builtins.py} +17 -17
- data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +72 -0
- data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +1346 -0
- data/vendor/pygments-main/pygments/lexers/{_lassobuiltins.py → _lasso_builtins.py} +4699 -4561
- data/vendor/pygments-main/pygments/lexers/{_luabuiltins.py → _lua_builtins.py} +91 -51
- data/vendor/pygments-main/pygments/lexers/_mapping.py +342 -242
- data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1172 -0
- data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +2547 -0
- data/vendor/pygments-main/pygments/lexers/{_phpbuiltins.py → _php_builtins.py} +350 -353
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +600 -212
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +3084 -30
- data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +1163 -0
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +91 -13
- data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +419 -0
- data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1004 -0
- data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1939 -0
- data/vendor/pygments-main/pygments/lexers/actionscript.py +240 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +14 -2542
- data/vendor/pygments-main/pygments/lexers/algebra.py +221 -0
- data/vendor/pygments-main/pygments/lexers/ambient.py +76 -0
- data/vendor/pygments-main/pygments/lexers/ampl.py +87 -0
- data/vendor/pygments-main/pygments/lexers/apl.py +101 -0
- data/vendor/pygments-main/pygments/lexers/archetype.py +318 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +276 -81
- data/vendor/pygments-main/pygments/lexers/automation.py +374 -0
- data/vendor/pygments-main/pygments/lexers/basic.py +500 -0
- data/vendor/pygments-main/pygments/lexers/bibtex.py +156 -0
- data/vendor/pygments-main/pygments/lexers/business.py +594 -0
- data/vendor/pygments-main/pygments/lexers/c_cpp.py +252 -0
- data/vendor/pygments-main/pygments/lexers/c_like.py +541 -0
- data/vendor/pygments-main/pygments/lexers/capnproto.py +79 -0
- data/vendor/pygments-main/pygments/lexers/chapel.py +101 -0
- data/vendor/pygments-main/pygments/lexers/clean.py +288 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +24 -5182
- data/vendor/pygments-main/pygments/lexers/configs.py +833 -0
- data/vendor/pygments-main/pygments/lexers/console.py +114 -0
- data/vendor/pygments-main/pygments/lexers/crystal.py +384 -0
- data/vendor/pygments-main/pygments/lexers/csound.py +366 -0
- data/vendor/pygments-main/pygments/lexers/css.py +689 -0
- data/vendor/pygments-main/pygments/lexers/d.py +251 -0
- data/vendor/pygments-main/pygments/lexers/dalvik.py +6 -6
- data/vendor/pygments-main/pygments/lexers/data.py +555 -0
- data/vendor/pygments-main/pygments/lexers/diff.py +165 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +96 -88
- data/vendor/pygments-main/pygments/lexers/dsls.py +878 -0
- data/vendor/pygments-main/pygments/lexers/dylan.py +289 -0
- data/vendor/pygments-main/pygments/lexers/ecl.py +125 -0
- data/vendor/pygments-main/pygments/lexers/eiffel.py +65 -0
- data/vendor/pygments-main/pygments/lexers/elm.py +121 -0
- data/vendor/pygments-main/pygments/lexers/erlang.py +533 -0
- data/vendor/pygments-main/pygments/lexers/esoteric.py +275 -0
- data/vendor/pygments-main/pygments/lexers/ezhil.py +68 -0
- data/vendor/pygments-main/pygments/lexers/factor.py +344 -0
- data/vendor/pygments-main/pygments/lexers/fantom.py +250 -0
- data/vendor/pygments-main/pygments/lexers/felix.py +273 -0
- data/vendor/pygments-main/pygments/lexers/forth.py +177 -0
- data/vendor/pygments-main/pygments/lexers/fortran.py +205 -0
- data/vendor/pygments-main/pygments/lexers/foxpro.py +1 -1
- data/vendor/pygments-main/pygments/lexers/functional.py +11 -3661
- data/vendor/pygments-main/pygments/lexers/go.py +101 -0
- data/vendor/pygments-main/pygments/lexers/grammar_notation.py +213 -0
- data/vendor/pygments-main/pygments/lexers/graph.py +7 -8
- data/vendor/pygments-main/pygments/lexers/graphics.py +553 -0
- data/vendor/pygments-main/pygments/lexers/haskell.py +840 -0
- data/vendor/pygments-main/pygments/lexers/haxe.py +936 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +172 -145
- data/vendor/pygments-main/pygments/lexers/hexdump.py +97 -0
- data/vendor/pygments-main/pygments/lexers/html.py +602 -0
- data/vendor/pygments-main/pygments/lexers/idl.py +270 -0
- data/vendor/pygments-main/pygments/lexers/igor.py +288 -0
- data/vendor/pygments-main/pygments/lexers/inferno.py +3 -3
- data/vendor/pygments-main/pygments/lexers/installers.py +322 -0
- data/vendor/pygments-main/pygments/lexers/int_fiction.py +1343 -0
- data/vendor/pygments-main/pygments/lexers/iolang.py +63 -0
- data/vendor/pygments-main/pygments/lexers/j.py +146 -0
- data/vendor/pygments-main/pygments/lexers/javascript.py +1506 -0
- data/vendor/pygments-main/pygments/lexers/julia.py +333 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +232 -186
- data/vendor/pygments-main/pygments/lexers/lisp.py +2621 -0
- data/vendor/pygments-main/pygments/lexers/make.py +202 -0
- data/vendor/pygments-main/pygments/lexers/markup.py +595 -0
- data/vendor/pygments-main/pygments/lexers/math.py +11 -2276
- data/vendor/pygments-main/pygments/lexers/matlab.py +663 -0
- data/vendor/pygments-main/pygments/lexers/ml.py +769 -0
- data/vendor/pygments-main/pygments/lexers/modeling.py +358 -0
- data/vendor/pygments-main/pygments/lexers/modula2.py +1561 -0
- data/vendor/pygments-main/pygments/lexers/monte.py +203 -0
- data/vendor/pygments-main/pygments/lexers/ncl.py +1053 -0
- data/vendor/pygments-main/pygments/lexers/nimrod.py +159 -0
- data/vendor/pygments-main/pygments/lexers/nit.py +64 -0
- data/vendor/pygments-main/pygments/lexers/nix.py +136 -0
- data/vendor/pygments-main/pygments/lexers/oberon.py +105 -0
- data/vendor/pygments-main/pygments/lexers/objective.py +504 -0
- data/vendor/pygments-main/pygments/lexers/ooc.py +85 -0
- data/vendor/pygments-main/pygments/lexers/other.py +30 -4481
- data/vendor/pygments-main/pygments/lexers/parasail.py +79 -0
- data/vendor/pygments-main/pygments/lexers/parsers.py +171 -114
- data/vendor/pygments-main/pygments/lexers/pascal.py +644 -0
- data/vendor/pygments-main/pygments/lexers/pawn.py +199 -0
- data/vendor/pygments-main/pygments/lexers/perl.py +616 -0
- data/vendor/pygments-main/pygments/lexers/php.py +267 -0
- data/vendor/pygments-main/pygments/lexers/praat.py +294 -0
- data/vendor/pygments-main/pygments/lexers/prolog.py +306 -0
- data/vendor/pygments-main/pygments/lexers/python.py +938 -0
- data/vendor/pygments-main/pygments/lexers/qvt.py +152 -0
- data/vendor/pygments-main/pygments/lexers/r.py +453 -0
- data/vendor/pygments-main/pygments/lexers/rdf.py +195 -24
- data/vendor/pygments-main/pygments/lexers/rebol.py +431 -0
- data/vendor/pygments-main/pygments/lexers/resource.py +85 -0
- data/vendor/pygments-main/pygments/lexers/rnc.py +67 -0
- data/vendor/pygments-main/pygments/lexers/roboconf.py +82 -0
- data/vendor/pygments-main/pygments/lexers/{_robotframeworklexer.py → robotframework.py} +20 -18
- data/vendor/pygments-main/pygments/lexers/ruby.py +519 -0
- data/vendor/pygments-main/pygments/lexers/rust.py +209 -0
- data/vendor/pygments-main/pygments/lexers/sas.py +228 -0
- data/vendor/pygments-main/pygments/lexers/scripting.py +1222 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +478 -115
- data/vendor/pygments-main/pygments/lexers/smalltalk.py +195 -0
- data/vendor/pygments-main/pygments/lexers/smv.py +75 -0
- data/vendor/pygments-main/pygments/lexers/snobol.py +83 -0
- data/vendor/pygments-main/pygments/lexers/special.py +6 -2
- data/vendor/pygments-main/pygments/lexers/sql.py +209 -120
- data/vendor/pygments-main/pygments/lexers/stata.py +106 -0
- data/vendor/pygments-main/pygments/lexers/supercollider.py +90 -0
- data/vendor/pygments-main/pygments/lexers/tcl.py +145 -0
- data/vendor/pygments-main/pygments/lexers/templates.py +282 -90
- data/vendor/pygments-main/pygments/lexers/testing.py +207 -0
- data/vendor/pygments-main/pygments/lexers/text.py +15 -2045
- data/vendor/pygments-main/pygments/lexers/textedit.py +169 -0
- data/vendor/pygments-main/pygments/lexers/textfmts.py +297 -0
- data/vendor/pygments-main/pygments/lexers/theorem.py +458 -0
- data/vendor/pygments-main/pygments/lexers/trafficscript.py +54 -0
- data/vendor/pygments-main/pygments/lexers/typoscript.py +225 -0
- data/vendor/pygments-main/pygments/lexers/urbi.py +133 -0
- data/vendor/pygments-main/pygments/lexers/varnish.py +190 -0
- data/vendor/pygments-main/pygments/lexers/verification.py +111 -0
- data/vendor/pygments-main/pygments/lexers/web.py +13 -4499
- data/vendor/pygments-main/pygments/lexers/webmisc.py +979 -0
- data/vendor/pygments-main/pygments/lexers/whiley.py +117 -0
- data/vendor/pygments-main/pygments/lexers/x10.py +69 -0
- data/vendor/pygments-main/pygments/modeline.py +5 -2
- data/vendor/pygments-main/pygments/plugin.py +1 -1
- data/vendor/pygments-main/pygments/regexopt.py +92 -0
- data/vendor/pygments-main/pygments/scanner.py +3 -2
- data/vendor/pygments-main/pygments/sphinxext.py +11 -6
- data/vendor/pygments-main/pygments/style.py +41 -4
- data/vendor/pygments-main/pygments/styles/__init__.py +5 -1
- data/vendor/pygments-main/pygments/styles/algol.py +63 -0
- data/vendor/pygments-main/pygments/styles/algol_nu.py +63 -0
- data/vendor/pygments-main/pygments/styles/arduino.py +98 -0
- 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/lovelace.py +97 -0
- data/vendor/pygments-main/pygments/styles/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/monokai.py +1 -1
- 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 +2 -2
- data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
- data/vendor/pygments-main/pygments/styles/sas.py +41 -0
- data/vendor/pygments-main/pygments/styles/stata.py +37 -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 +31 -16
- data/vendor/pygments-main/pygments/unistring.py +141 -65
- data/vendor/pygments-main/pygments/util.py +129 -33
- data/vendor/pygments-main/requirements.txt +5 -0
- data/vendor/pygments-main/scripts/check_sources.py +25 -40
- data/vendor/pygments-main/scripts/debug_lexer.py +246 -0
- data/vendor/pygments-main/scripts/find_error.py +1 -0
- data/vendor/pygments-main/scripts/get_vimkw.py +35 -4
- data/vendor/pygments-main/setup.cfg +3 -0
- data/vendor/pygments-main/setup.py +17 -30
- data/vendor/pygments-main/tox.ini +7 -0
- metadata +159 -387
- data/vendor/pygments-main/ez_setup.py +0 -382
- data/vendor/pygments-main/pygments/lexers/_cocoabuiltins.py +0 -73
- data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +0 -562
- data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +0 -1077
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +0 -13
- data/vendor/pygments-main/pygments/lexers/qbasic.py +0 -157
- data/vendor/pygments-main/scripts/find_codetags.py +0 -213
- data/vendor/pygments-main/scripts/find_error.py +0 -173
- data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +0 -37
- data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +0 -869
- data/vendor/pygments-main/tests/dtds/HTML4.dcl +0 -88
- data/vendor/pygments-main/tests/dtds/HTML4.dtd +0 -1092
- data/vendor/pygments-main/tests/dtds/HTML4.soc +0 -9
- data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +0 -195
- data/vendor/pygments-main/tests/dtds/HTMLspec.ent +0 -77
- data/vendor/pygments-main/tests/dtds/HTMLsym.ent +0 -241
- data/vendor/pygments-main/tests/examplefiles/99_bottles_of_beer.chpl +0 -118
- data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +0 -209
- data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +0 -102
- data/vendor/pygments-main/tests/examplefiles/BOM.js +0 -1
- data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +0 -611
- data/vendor/pygments-main/tests/examplefiles/Config.in.cache +0 -1973
- data/vendor/pygments-main/tests/examplefiles/Constants.mo +0 -158
- data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +0 -411
- data/vendor/pygments-main/tests/examplefiles/Deflate.fs +0 -578
- data/vendor/pygments-main/tests/examplefiles/Error.pmod +0 -38
- data/vendor/pygments-main/tests/examplefiles/Errors.scala +0 -18
- data/vendor/pygments-main/tests/examplefiles/FakeFile.pike +0 -360
- data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +0 -66
- data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +0 -104
- data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +0 -671
- data/vendor/pygments-main/tests/examplefiles/Intro.java +0 -1660
- data/vendor/pygments-main/tests/examplefiles/Makefile +0 -1131
- data/vendor/pygments-main/tests/examplefiles/Object.st +0 -4394
- data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +0 -584
- data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +0 -23
- data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +0 -378
- data/vendor/pygments-main/tests/examplefiles/Sorting.mod +0 -470
- data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +0 -382
- data/vendor/pygments-main/tests/examplefiles/addressbook.proto +0 -30
- data/vendor/pygments-main/tests/examplefiles/antlr_ANTLRv3.g +0 -608
- data/vendor/pygments-main/tests/examplefiles/antlr_throws +0 -1
- data/vendor/pygments-main/tests/examplefiles/apache2.conf +0 -393
- data/vendor/pygments-main/tests/examplefiles/as3_test.as +0 -143
- data/vendor/pygments-main/tests/examplefiles/as3_test2.as +0 -46
- data/vendor/pygments-main/tests/examplefiles/as3_test3.as +0 -3
- data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +0 -27
- data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +0 -25
- data/vendor/pygments-main/tests/examplefiles/badcase.java +0 -2
- data/vendor/pygments-main/tests/examplefiles/batchfile.bat +0 -49
- data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +0 -308
- data/vendor/pygments-main/tests/examplefiles/boot-9.scm +0 -1557
- data/vendor/pygments-main/tests/examplefiles/ca65_example +0 -284
- data/vendor/pygments-main/tests/examplefiles/cbmbas_example +0 -9
- data/vendor/pygments-main/tests/examplefiles/cells.ps +0 -515
- data/vendor/pygments-main/tests/examplefiles/ceval.c +0 -2604
- data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +0 -13
- data/vendor/pygments-main/tests/examplefiles/classes.dylan +0 -125
- data/vendor/pygments-main/tests/examplefiles/clojure-weird-keywords.clj +0 -5
- data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +0 -10
- data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +0 -447
- data/vendor/pygments-main/tests/examplefiles/core.cljs +0 -52
- data/vendor/pygments-main/tests/examplefiles/database.pytb +0 -20
- data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +0 -2461
- data/vendor/pygments-main/tests/examplefiles/demo.ahk +0 -181
- data/vendor/pygments-main/tests/examplefiles/demo.cfm +0 -50
- data/vendor/pygments-main/tests/examplefiles/demo.hbs +0 -12
- data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +0 -68
- data/vendor/pygments-main/tests/examplefiles/dwarf.cw +0 -17
- data/vendor/pygments-main/tests/examplefiles/ember.handlebars +0 -33
- data/vendor/pygments-main/tests/examplefiles/erl_session +0 -10
- data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +0 -1
- data/vendor/pygments-main/tests/examplefiles/evil_regex.js +0 -48
- data/vendor/pygments-main/tests/examplefiles/example.Rd +0 -78
- data/vendor/pygments-main/tests/examplefiles/example.als +0 -217
- data/vendor/pygments-main/tests/examplefiles/example.bug +0 -54
- data/vendor/pygments-main/tests/examplefiles/example.c +0 -2080
- data/vendor/pygments-main/tests/examplefiles/example.ceylon +0 -52
- data/vendor/pygments-main/tests/examplefiles/example.chai +0 -6
- data/vendor/pygments-main/tests/examplefiles/example.clay +0 -33
- data/vendor/pygments-main/tests/examplefiles/example.cls +0 -15
- data/vendor/pygments-main/tests/examplefiles/example.cob +0 -3556
- data/vendor/pygments-main/tests/examplefiles/example.coffee +0 -27
- data/vendor/pygments-main/tests/examplefiles/example.cpp +0 -2363
- data/vendor/pygments-main/tests/examplefiles/example.e +0 -124
- data/vendor/pygments-main/tests/examplefiles/example.f90 +0 -8
- data/vendor/pygments-main/tests/examplefiles/example.feature +0 -16
- data/vendor/pygments-main/tests/examplefiles/example.gd +0 -23
- data/vendor/pygments-main/tests/examplefiles/example.gi +0 -64
- data/vendor/pygments-main/tests/examplefiles/example.groovy +0 -2
- data/vendor/pygments-main/tests/examplefiles/example.gs +0 -106
- data/vendor/pygments-main/tests/examplefiles/example.gst +0 -7
- data/vendor/pygments-main/tests/examplefiles/example.hs +0 -27
- data/vendor/pygments-main/tests/examplefiles/example.hx +0 -185
- data/vendor/pygments-main/tests/examplefiles/example.i6t +0 -32
- data/vendor/pygments-main/tests/examplefiles/example.i7x +0 -45
- data/vendor/pygments-main/tests/examplefiles/example.inf +0 -374
- data/vendor/pygments-main/tests/examplefiles/example.j +0 -564
- data/vendor/pygments-main/tests/examplefiles/example.jag +0 -48
- data/vendor/pygments-main/tests/examplefiles/example.java +0 -16
- data/vendor/pygments-main/tests/examplefiles/example.kal +0 -75
- data/vendor/pygments-main/tests/examplefiles/example.kt +0 -47
- data/vendor/pygments-main/tests/examplefiles/example.lagda +0 -19
- data/vendor/pygments-main/tests/examplefiles/example.liquid +0 -42
- data/vendor/pygments-main/tests/examplefiles/example.lua +0 -250
- data/vendor/pygments-main/tests/examplefiles/example.ma +0 -8
- data/vendor/pygments-main/tests/examplefiles/example.monkey +0 -152
- data/vendor/pygments-main/tests/examplefiles/example.moo +0 -26
- data/vendor/pygments-main/tests/examplefiles/example.moon +0 -629
- data/vendor/pygments-main/tests/examplefiles/example.mq4 +0 -187
- data/vendor/pygments-main/tests/examplefiles/example.mqh +0 -123
- data/vendor/pygments-main/tests/examplefiles/example.msc +0 -43
- data/vendor/pygments-main/tests/examplefiles/example.ni +0 -57
- data/vendor/pygments-main/tests/examplefiles/example.nim +0 -1010
- data/vendor/pygments-main/tests/examplefiles/example.nix +0 -80
- data/vendor/pygments-main/tests/examplefiles/example.ns2 +0 -69
- data/vendor/pygments-main/tests/examplefiles/example.pas +0 -2708
- data/vendor/pygments-main/tests/examplefiles/example.pp +0 -8
- data/vendor/pygments-main/tests/examplefiles/example.prg +0 -161
- data/vendor/pygments-main/tests/examplefiles/example.rb +0 -1852
- data/vendor/pygments-main/tests/examplefiles/example.red +0 -257
- data/vendor/pygments-main/tests/examplefiles/example.reds +0 -150
- data/vendor/pygments-main/tests/examplefiles/example.reg +0 -19
- data/vendor/pygments-main/tests/examplefiles/example.rexx +0 -50
- data/vendor/pygments-main/tests/examplefiles/example.rhtml +0 -561
- data/vendor/pygments-main/tests/examplefiles/example.rkt +0 -743
- data/vendor/pygments-main/tests/examplefiles/example.rpf +0 -4
- data/vendor/pygments-main/tests/examplefiles/example.sh +0 -22
- data/vendor/pygments-main/tests/examplefiles/example.sh-session +0 -19
- data/vendor/pygments-main/tests/examplefiles/example.shell-session +0 -45
- data/vendor/pygments-main/tests/examplefiles/example.slim +0 -31
- data/vendor/pygments-main/tests/examplefiles/example.sls +0 -51
- data/vendor/pygments-main/tests/examplefiles/example.sml +0 -156
- data/vendor/pygments-main/tests/examplefiles/example.snobol +0 -15
- data/vendor/pygments-main/tests/examplefiles/example.stan +0 -110
- data/vendor/pygments-main/tests/examplefiles/example.tea +0 -34
- data/vendor/pygments-main/tests/examplefiles/example.todotxt +0 -9
- data/vendor/pygments-main/tests/examplefiles/example.ts +0 -28
- data/vendor/pygments-main/tests/examplefiles/example.u +0 -548
- data/vendor/pygments-main/tests/examplefiles/example.weechatlog +0 -9
- data/vendor/pygments-main/tests/examplefiles/example.xhtml +0 -376
- data/vendor/pygments-main/tests/examplefiles/example.xtend +0 -34
- data/vendor/pygments-main/tests/examplefiles/example.yaml +0 -302
- data/vendor/pygments-main/tests/examplefiles/example2.aspx +0 -29
- data/vendor/pygments-main/tests/examplefiles/example2.msc +0 -79
- data/vendor/pygments-main/tests/examplefiles/exampleScript.cfc +0 -241
- data/vendor/pygments-main/tests/examplefiles/exampleTag.cfc +0 -18
- data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +0 -205
- data/vendor/pygments-main/tests/examplefiles/example_file.fy +0 -128
- data/vendor/pygments-main/tests/examplefiles/firefox.mak +0 -586
- data/vendor/pygments-main/tests/examplefiles/flipflop.sv +0 -19
- data/vendor/pygments-main/tests/examplefiles/foo.sce +0 -6
- data/vendor/pygments-main/tests/examplefiles/format.ml +0 -1213
- data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +0 -77
- data/vendor/pygments-main/tests/examplefiles/function.mu +0 -1
- data/vendor/pygments-main/tests/examplefiles/functional.rst +0 -1472
- data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +0 -133
- data/vendor/pygments-main/tests/examplefiles/genclass.clj +0 -510
- data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +0 -193
- data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +0 -33
- data/vendor/pygments-main/tests/examplefiles/glsl.frag +0 -7
- data/vendor/pygments-main/tests/examplefiles/glsl.vert +0 -13
- data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +0 -22
- data/vendor/pygments-main/tests/examplefiles/hash_syntax.rb +0 -5
- data/vendor/pygments-main/tests/examplefiles/hello.at +0 -6
- data/vendor/pygments-main/tests/examplefiles/hello.golo +0 -5
- data/vendor/pygments-main/tests/examplefiles/hello.lsl +0 -12
- data/vendor/pygments-main/tests/examplefiles/hello.smali +0 -40
- data/vendor/pygments-main/tests/examplefiles/hello.sp +0 -9
- data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +0 -1
- data/vendor/pygments-main/tests/examplefiles/http_request_example +0 -15
- data/vendor/pygments-main/tests/examplefiles/http_response_example +0 -29
- data/vendor/pygments-main/tests/examplefiles/hybris_File.hy +0 -174
- data/vendor/pygments-main/tests/examplefiles/idl_sample.pro +0 -73
- data/vendor/pygments-main/tests/examplefiles/iex_example +0 -23
- data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +0 -71
- data/vendor/pygments-main/tests/examplefiles/intro.ik +0 -24
- data/vendor/pygments-main/tests/examplefiles/ints.php +0 -10
- data/vendor/pygments-main/tests/examplefiles/intsyn.fun +0 -675
- data/vendor/pygments-main/tests/examplefiles/intsyn.sig +0 -286
- data/vendor/pygments-main/tests/examplefiles/irb_heredoc +0 -8
- data/vendor/pygments-main/tests/examplefiles/irc.lsp +0 -214
- data/vendor/pygments-main/tests/examplefiles/java.properties +0 -16
- data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +0 -28
- data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +0 -45
- data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +0 -713
- data/vendor/pygments-main/tests/examplefiles/json.lasso +0 -301
- data/vendor/pygments-main/tests/examplefiles/json.lasso9 +0 -213
- data/vendor/pygments-main/tests/examplefiles/language.hy +0 -165
- data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +0 -13
- data/vendor/pygments-main/tests/examplefiles/limbo.b +0 -456
- data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +0 -47
- data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +0 -43
- data/vendor/pygments-main/tests/examplefiles/logos_example.xm +0 -28
- data/vendor/pygments-main/tests/examplefiles/ltmain.sh +0 -2849
- data/vendor/pygments-main/tests/examplefiles/main.cmake +0 -44
- data/vendor/pygments-main/tests/examplefiles/markdown.lsp +0 -679
- data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +0 -3
- data/vendor/pygments-main/tests/examplefiles/matlab_sample +0 -30
- data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +0 -37
- data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +0 -455
- data/vendor/pygments-main/tests/examplefiles/minehunt.qml +0 -112
- data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +0 -4
- data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +0 -340
- data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +0 -38
- data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +0 -95
- data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +0 -96
- data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +0 -30
- data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +0 -87
- data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +0 -118
- data/vendor/pygments-main/tests/examplefiles/numbers.c +0 -12
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +0 -179
- data/vendor/pygments-main/tests/examplefiles/openedge_example +0 -34
- data/vendor/pygments-main/tests/examplefiles/pawn_example +0 -25
- data/vendor/pygments-main/tests/examplefiles/perl_misc +0 -62
- data/vendor/pygments-main/tests/examplefiles/perl_perl5db +0 -998
- data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +0 -120
- data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +0 -856
- data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +0 -163
- data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +0 -567
- data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +0 -1223
- data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +0 -47
- data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +0 -10
- data/vendor/pygments-main/tests/examplefiles/psql_session.txt +0 -122
- data/vendor/pygments-main/tests/examplefiles/py3_test.txt +0 -2
- data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +0 -4
- data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +0 -14
- data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +0 -2
- data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +0 -4
- data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +0 -234
- data/vendor/pygments-main/tests/examplefiles/qbasic_example +0 -2
- data/vendor/pygments-main/tests/examplefiles/qsort.prolog +0 -13
- data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +0 -38
- data/vendor/pygments-main/tests/examplefiles/r6rs-comments.scm +0 -23
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +0 -280
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +0 -2
- data/vendor/pygments-main/tests/examplefiles/regex.js +0 -22
- data/vendor/pygments-main/tests/examplefiles/reversi.lsp +0 -427
- data/vendor/pygments-main/tests/examplefiles/robotframework_test.txt +0 -39
- data/vendor/pygments-main/tests/examplefiles/rql-queries.rql +0 -34
- data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +0 -11
- data/vendor/pygments-main/tests/examplefiles/rust_example.rs +0 -233
- data/vendor/pygments-main/tests/examplefiles/scilab.sci +0 -30
- data/vendor/pygments-main/tests/examplefiles/scope.cirru +0 -43
- data/vendor/pygments-main/tests/examplefiles/session.dylan-console +0 -9
- data/vendor/pygments-main/tests/examplefiles/sibling.prolog +0 -19
- data/vendor/pygments-main/tests/examplefiles/simple.md +0 -747
- data/vendor/pygments-main/tests/examplefiles/smarty_example.html +0 -209
- data/vendor/pygments-main/tests/examplefiles/source.lgt +0 -343
- data/vendor/pygments-main/tests/examplefiles/sources.list +0 -62
- data/vendor/pygments-main/tests/examplefiles/sparql.rq +0 -23
- data/vendor/pygments-main/tests/examplefiles/sphere.pov +0 -18
- data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +0 -27
- data/vendor/pygments-main/tests/examplefiles/squid.conf +0 -30
- data/vendor/pygments-main/tests/examplefiles/string.jl +0 -1031
- data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +0 -21
- data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +0 -3
- data/vendor/pygments-main/tests/examplefiles/swig_java.swg +0 -1329
- data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +0 -225
- data/vendor/pygments-main/tests/examplefiles/test.R +0 -185
- data/vendor/pygments-main/tests/examplefiles/test.adb +0 -211
- data/vendor/pygments-main/tests/examplefiles/test.agda +0 -102
- data/vendor/pygments-main/tests/examplefiles/test.apl +0 -26
- data/vendor/pygments-main/tests/examplefiles/test.asy +0 -131
- data/vendor/pygments-main/tests/examplefiles/test.awk +0 -121
- data/vendor/pygments-main/tests/examplefiles/test.bb +0 -95
- data/vendor/pygments-main/tests/examplefiles/test.bmx +0 -145
- data/vendor/pygments-main/tests/examplefiles/test.boo +0 -39
- data/vendor/pygments-main/tests/examplefiles/test.bro +0 -250
- data/vendor/pygments-main/tests/examplefiles/test.cs +0 -374
- data/vendor/pygments-main/tests/examplefiles/test.css +0 -54
- data/vendor/pygments-main/tests/examplefiles/test.cu +0 -36
- data/vendor/pygments-main/tests/examplefiles/test.cyp +0 -123
- data/vendor/pygments-main/tests/examplefiles/test.d +0 -135
- data/vendor/pygments-main/tests/examplefiles/test.dart +0 -23
- data/vendor/pygments-main/tests/examplefiles/test.dtd +0 -89
- data/vendor/pygments-main/tests/examplefiles/test.ebnf +0 -31
- data/vendor/pygments-main/tests/examplefiles/test.ec +0 -605
- data/vendor/pygments-main/tests/examplefiles/test.ecl +0 -58
- data/vendor/pygments-main/tests/examplefiles/test.eh +0 -315
- data/vendor/pygments-main/tests/examplefiles/test.erl +0 -169
- data/vendor/pygments-main/tests/examplefiles/test.evoque +0 -33
- data/vendor/pygments-main/tests/examplefiles/test.fan +0 -818
- data/vendor/pygments-main/tests/examplefiles/test.flx +0 -57
- data/vendor/pygments-main/tests/examplefiles/test.gdc +0 -13
- data/vendor/pygments-main/tests/examplefiles/test.groovy +0 -97
- data/vendor/pygments-main/tests/examplefiles/test.html +0 -339
- data/vendor/pygments-main/tests/examplefiles/test.idr +0 -93
- data/vendor/pygments-main/tests/examplefiles/test.ini +0 -10
- data/vendor/pygments-main/tests/examplefiles/test.java +0 -653
- data/vendor/pygments-main/tests/examplefiles/test.jsp +0 -24
- data/vendor/pygments-main/tests/examplefiles/test.maql +0 -45
- data/vendor/pygments-main/tests/examplefiles/test.mask +0 -41
- data/vendor/pygments-main/tests/examplefiles/test.mod +0 -374
- data/vendor/pygments-main/tests/examplefiles/test.moo +0 -51
- data/vendor/pygments-main/tests/examplefiles/test.myt +0 -166
- data/vendor/pygments-main/tests/examplefiles/test.nim +0 -93
- data/vendor/pygments-main/tests/examplefiles/test.opa +0 -10
- data/vendor/pygments-main/tests/examplefiles/test.p6 +0 -252
- data/vendor/pygments-main/tests/examplefiles/test.pan +0 -54
- data/vendor/pygments-main/tests/examplefiles/test.pas +0 -743
- data/vendor/pygments-main/tests/examplefiles/test.php +0 -507
- data/vendor/pygments-main/tests/examplefiles/test.pig +0 -148
- data/vendor/pygments-main/tests/examplefiles/test.plot +0 -333
- data/vendor/pygments-main/tests/examplefiles/test.ps1 +0 -108
- data/vendor/pygments-main/tests/examplefiles/test.pwn +0 -253
- data/vendor/pygments-main/tests/examplefiles/test.pypylog +0 -1839
- data/vendor/pygments-main/tests/examplefiles/test.r3 +0 -114
- data/vendor/pygments-main/tests/examplefiles/test.rb +0 -177
- data/vendor/pygments-main/tests/examplefiles/test.rhtml +0 -43
- data/vendor/pygments-main/tests/examplefiles/test.rsl +0 -111
- data/vendor/pygments-main/tests/examplefiles/test.scaml +0 -8
- data/vendor/pygments-main/tests/examplefiles/test.ssp +0 -12
- data/vendor/pygments-main/tests/examplefiles/test.swift +0 -65
- data/vendor/pygments-main/tests/examplefiles/test.tcsh +0 -830
- data/vendor/pygments-main/tests/examplefiles/test.vb +0 -407
- data/vendor/pygments-main/tests/examplefiles/test.vhdl +0 -161
- data/vendor/pygments-main/tests/examplefiles/test.xqy +0 -138
- data/vendor/pygments-main/tests/examplefiles/test.xsl +0 -23
- data/vendor/pygments-main/tests/examplefiles/test.zep +0 -33
- data/vendor/pygments-main/tests/examplefiles/test2.pypylog +0 -120
- data/vendor/pygments-main/tests/examplefiles/truncated.pytb +0 -15
- data/vendor/pygments-main/tests/examplefiles/type.lisp +0 -1218
- data/vendor/pygments-main/tests/examplefiles/underscore.coffee +0 -603
- data/vendor/pygments-main/tests/examplefiles/unicode.applescript +0 -5
- data/vendor/pygments-main/tests/examplefiles/unicode.go +0 -10
- data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +0 -11
- data/vendor/pygments-main/tests/examplefiles/unix-io.lid +0 -37
- data/vendor/pygments-main/tests/examplefiles/vbnet_test.bas +0 -29
- data/vendor/pygments-main/tests/examplefiles/vctreestatus_hg +0 -4
- data/vendor/pygments-main/tests/examplefiles/vimrc +0 -21
- data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +0 -3
- data/vendor/pygments-main/tests/examplefiles/while.pov +0 -13
- data/vendor/pygments-main/tests/examplefiles/wiki.factor +0 -384
- data/vendor/pygments-main/tests/examplefiles/xml_example +0 -1897
- data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +0 -798
- data/vendor/pygments-main/tests/run.py +0 -44
- data/vendor/pygments-main/tests/string_asserts.py +0 -22
- data/vendor/pygments-main/tests/support.py +0 -15
- data/vendor/pygments-main/tests/support/tags +0 -36
- data/vendor/pygments-main/tests/test_basic_api.py +0 -309
- data/vendor/pygments-main/tests/test_cfm.py +0 -46
- data/vendor/pygments-main/tests/test_clexer.py +0 -236
- data/vendor/pygments-main/tests/test_cmdline.py +0 -106
- data/vendor/pygments-main/tests/test_examplefiles.py +0 -110
- data/vendor/pygments-main/tests/test_html_formatter.py +0 -180
- data/vendor/pygments-main/tests/test_latex_formatter.py +0 -57
- data/vendor/pygments-main/tests/test_lexers_other.py +0 -68
- data/vendor/pygments-main/tests/test_objectiveclexer.py +0 -81
- data/vendor/pygments-main/tests/test_perllexer.py +0 -137
- data/vendor/pygments-main/tests/test_qbasiclexer.py +0 -43
- data/vendor/pygments-main/tests/test_regexlexer.py +0 -54
- data/vendor/pygments-main/tests/test_rtf_formatter.py +0 -109
- data/vendor/pygments-main/tests/test_string_asserts.py +0 -39
- data/vendor/pygments-main/tests/test_token.py +0 -46
- data/vendor/pygments-main/tests/test_using_api.py +0 -40
- data/vendor/pygments-main/tests/test_util.py +0 -135
@@ -4,7 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# Combines scripts for common tasks.
|
6
6
|
#
|
7
|
-
# :copyright: Copyright 2006-
|
7
|
+
# :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
|
8
8
|
# :license: BSD, see LICENSE for details.
|
9
9
|
#
|
10
10
|
|
@@ -19,9 +19,9 @@ all: clean-pyc check test
|
|
19
19
|
|
20
20
|
check:
|
21
21
|
@$(PYTHON) scripts/detect_missing_analyse_text.py || true
|
22
|
+
@pyflakes pygments | grep -v 'but unused' || true
|
22
23
|
@$(PYTHON) scripts/check_sources.py -i build -i dist -i pygments/lexers/_mapping.py \
|
23
|
-
-i docs/build -i pygments/formatters/_mapping.py -i pygments/unistring.py
|
24
|
-
-i pygments/lexers/_vimbuiltins.py
|
24
|
+
-i docs/build -i pygments/formatters/_mapping.py -i pygments/unistring.py
|
25
25
|
|
26
26
|
clean: clean-pyc
|
27
27
|
-rm -rf build
|
@@ -40,8 +40,8 @@ docs:
|
|
40
40
|
make -C doc html
|
41
41
|
|
42
42
|
mapfiles:
|
43
|
-
(cd pygments/lexers; $(PYTHON) _mapping.py)
|
44
43
|
(cd pygments/formatters; $(PYTHON) _mapping.py)
|
44
|
+
(cd pygments/lexers; $(PYTHON) _mapping.py)
|
45
45
|
|
46
46
|
pylint:
|
47
47
|
@pylint --rcfile scripts/pylintrc pygments
|
@@ -50,7 +50,16 @@ reindent:
|
|
50
50
|
@$(PYTHON) scripts/reindent.py -r -B .
|
51
51
|
|
52
52
|
test:
|
53
|
-
@$(PYTHON) tests/run.py $(TEST)
|
53
|
+
@$(PYTHON) tests/run.py -d $(TEST)
|
54
54
|
|
55
55
|
test-coverage:
|
56
|
-
@$(PYTHON) tests/run.py -
|
56
|
+
@$(PYTHON) tests/run.py -d --with-coverage --cover-package=pygments --cover-erase $(TEST)
|
57
|
+
|
58
|
+
test-examplefiles:
|
59
|
+
nosetests tests/test_examplefiles.py
|
60
|
+
|
61
|
+
tox-test:
|
62
|
+
@tox -- $(TEST)
|
63
|
+
|
64
|
+
tox-test-coverage:
|
65
|
+
@tox -- --with-coverage --cover-package=pygments --cover-erase $(TEST)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
README for Pygments
|
2
|
+
===================
|
3
|
+
|
4
|
+
This is the source of Pygments. It is a generic syntax highlighter that
|
5
|
+
supports over 300 languages and text formats, for use in code hosting, forums,
|
6
|
+
wikis or other applications that need to prettify source code.
|
7
|
+
|
8
|
+
Installing
|
9
|
+
----------
|
10
|
+
|
11
|
+
... works as usual, use ``python setup.py install``.
|
12
|
+
|
13
|
+
Documentation
|
14
|
+
-------------
|
15
|
+
|
16
|
+
... can be found online at http://pygments.org/ or created by ::
|
17
|
+
|
18
|
+
cd doc
|
19
|
+
make html
|
20
|
+
|
21
|
+
Development
|
22
|
+
-----------
|
23
|
+
|
24
|
+
... takes place on `Bitbucket
|
25
|
+
<https://bitbucket.org/birkenfeld/pygments-main>`_, where the Mercurial
|
26
|
+
repository, tickets and pull requests can be viewed.
|
27
|
+
|
28
|
+
Continuous testing runs on drone.io:
|
29
|
+
|
30
|
+
.. image:: https://drone.io/bitbucket.org/birkenfeld/pygments-main/status.png
|
31
|
+
:target: https://drone.io/bitbucket.org/birkenfeld/pygments-main
|
32
|
+
|
33
|
+
The authors
|
34
|
+
-----------
|
35
|
+
|
36
|
+
Pygments is maintained by **Georg Brandl**, e-mail address *georg*\ *@*\ *python.org*.
|
37
|
+
|
38
|
+
Many lexers and fixes have been contributed by **Armin Ronacher**, the rest of
|
39
|
+
the `Pocoo <http://dev.pocoo.org/>`_ team and **Tim Hatch**.
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
a042025b350c
|
data/vendor/pygments-main/TODO
CHANGED
@@ -82,7 +82,7 @@
|
|
82
82
|
|
83
83
|
{% block footer %}
|
84
84
|
<div class="footer" role="contentinfo">
|
85
|
-
© Copyright
|
85
|
+
© Copyright 2006-2015, Georg Brandl and Pygments contributors.
|
86
86
|
Created using <a href="http://sphinx-doc.org/">Sphinx</a> {{
|
87
87
|
sphinx_version }}. <br/>
|
88
88
|
Pygments logo created by <a href="http://joelunger.com">Joel Unger</a>.
|
@@ -4,7 +4,7 @@
|
|
4
4
|
*
|
5
5
|
* Sphinx stylesheet -- pygments14 theme. Heavily copied from sphinx13.
|
6
6
|
*
|
7
|
-
* :copyright: Copyright 2006-
|
7
|
+
* :copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
|
8
8
|
* :license: BSD, see LICENSE for details.
|
9
9
|
*
|
10
10
|
*/
|
@@ -1,15 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
#
|
3
|
-
# Pygments documentation build configuration file
|
4
|
-
# sphinx-quickstart on Sat Jan 18 17:07:37 2014.
|
3
|
+
# Pygments documentation build configuration file
|
5
4
|
#
|
6
|
-
# This file is execfile()d with the current directory set to its containing dir.
|
7
|
-
#
|
8
|
-
# Note that not all possible configuration values are present in this
|
9
|
-
# autogenerated file.
|
10
|
-
#
|
11
|
-
# All configuration values have a default; values that are commented out
|
12
|
-
# serve to show the default.
|
13
5
|
|
14
6
|
import sys, os
|
15
7
|
|
@@ -43,7 +35,7 @@ master_doc = 'index'
|
|
43
35
|
|
44
36
|
# General information about the project.
|
45
37
|
project = u'Pygments'
|
46
|
-
copyright = u'
|
38
|
+
copyright = u'2015, Georg Brandl'
|
47
39
|
|
48
40
|
# The version info for the project you're documenting, acts as replacement for
|
49
41
|
# |version| and |release|, also used in various other places throughout the
|
@@ -117,7 +109,7 @@ html_theme_path = ['_themes']
|
|
117
109
|
# The name of an image file (within the static path) to use as favicon of the
|
118
110
|
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
119
111
|
# pixels large.
|
120
|
-
html_favicon = 'favicon.ico'
|
112
|
+
html_favicon = '_static/favicon.ico'
|
121
113
|
|
122
114
|
# Add any paths that contain custom static files (such as style sheets) here,
|
123
115
|
# relative to this directory. They are copied after the builtin static files,
|
@@ -89,6 +89,21 @@ Functions from :mod:`pygments.lexers`:
|
|
89
89
|
|
90
90
|
.. versionadded:: 0.6
|
91
91
|
|
92
|
+
.. function:: find_lexer_class_by_name(alias)
|
93
|
+
|
94
|
+
Return the `Lexer` subclass that has `alias` in its aliases list, without
|
95
|
+
instantiating it.
|
96
|
+
|
97
|
+
Will raise :exc:`pygments.util.ClassNotFound` if no lexer with that alias is
|
98
|
+
found.
|
99
|
+
|
100
|
+
.. versionadded:: 2.2
|
101
|
+
|
102
|
+
.. function:: find_lexer_class(name)
|
103
|
+
|
104
|
+
Return the `Lexer` subclass that with the *name* attribute as given by
|
105
|
+
the *name* argument.
|
106
|
+
|
92
107
|
|
93
108
|
.. module:: pygments.formatters
|
94
109
|
|
@@ -136,9 +136,13 @@ Pygments tries to be smart regarding encodings in the formatting process:
|
|
136
136
|
* If you give an ``outencoding`` option, it will override ``encoding``
|
137
137
|
as the output encoding.
|
138
138
|
|
139
|
+
* If you give an ``inencoding`` option, it will override ``encoding``
|
140
|
+
as the input encoding.
|
141
|
+
|
139
142
|
* If you don't give an encoding and have given an output file, the default
|
140
|
-
encoding for lexer and formatter is
|
141
|
-
|
143
|
+
encoding for lexer and formatter is the terminal encoding or the default
|
144
|
+
locale encoding of the system. As a last resort, ``latin1`` is used (which
|
145
|
+
will pass through all non-ASCII characters).
|
142
146
|
|
143
147
|
* If you don't give an encoding and haven't given an output file (that means
|
144
148
|
output is written to the console), the default encoding for lexer and
|
@@ -8,7 +8,7 @@ Write your own filter
|
|
8
8
|
|
9
9
|
Writing own filters is very easy. All you have to do is to subclass
|
10
10
|
the `Filter` class and override the `filter` method. Additionally a
|
11
|
-
filter is
|
11
|
+
filter is instantiated with some keyword arguments you can use to
|
12
12
|
adjust the behavior of your filter.
|
13
13
|
|
14
14
|
|
@@ -58,7 +58,7 @@ You can also use the `simplefilter` decorator from the `pygments.filter` module:
|
|
58
58
|
|
59
59
|
|
60
60
|
@simplefilter
|
61
|
-
def uncolor(lexer, stream, options):
|
61
|
+
def uncolor(self, lexer, stream, options):
|
62
62
|
class_too = get_bool_opt(options, 'classtoo')
|
63
63
|
for ttype, value in stream:
|
64
64
|
if ttype is Name.Function or (class_too and
|
@@ -67,4 +67,5 @@ You can also use the `simplefilter` decorator from the `pygments.filter` module:
|
|
67
67
|
yield ttype, value
|
68
68
|
|
69
69
|
The decorator automatically subclasses an internal filter class and uses the
|
70
|
-
decorated function for filtering.
|
70
|
+
decorated function as a method for filtering. (That's why there is a `self`
|
71
|
+
argument that you probably won't end up using in the method.)
|
@@ -4,21 +4,6 @@
|
|
4
4
|
Using Pygments in various scenarios
|
5
5
|
===================================
|
6
6
|
|
7
|
-
PyGtk
|
8
|
-
-----
|
9
|
-
|
10
|
-
Armin has written a piece of sample code that shows how to create a Gtk
|
11
|
-
`TextBuffer` object containing Pygments-highlighted text.
|
12
|
-
|
13
|
-
See the article here: http://lucumr.pocoo.org/cogitations/2007/05/30/pygments-gtk-rendering/
|
14
|
-
|
15
|
-
Wordpress
|
16
|
-
---------
|
17
|
-
|
18
|
-
He also has a snippet that shows how to use Pygments in WordPress:
|
19
|
-
|
20
|
-
http://lucumr.pocoo.org/cogitations/2007/05/30/pygments-in-wordpress/
|
21
|
-
|
22
7
|
Markdown
|
23
8
|
--------
|
24
9
|
|
@@ -42,3 +27,14 @@ Bash completion
|
|
42
27
|
|
43
28
|
The source distribution contains a file ``external/pygments.bashcomp`` that
|
44
29
|
sets up completion for the ``pygmentize`` command in bash.
|
30
|
+
|
31
|
+
Wrappers for other languages
|
32
|
+
----------------------------
|
33
|
+
|
34
|
+
These libraries provide Pygments highlighting for users of other languages
|
35
|
+
than Python:
|
36
|
+
|
37
|
+
* `pygments.rb <https://github.com/tmm1/pygments.rb>`_, a pygments wrapper for Ruby
|
38
|
+
* `Clygments <https://github.com/bfontaine/clygments>`_, a pygments wrapper for
|
39
|
+
Clojure
|
40
|
+
* `PHPygments <https://github.com/capynet/PHPygments>`_, a pygments wrapper for PHP
|
@@ -2,18 +2,18 @@
|
|
2
2
|
Use Pygments in Java
|
3
3
|
=====================
|
4
4
|
|
5
|
-
Thanks to `Jython <http://www.jython.org>`
|
5
|
+
Thanks to `Jython <http://www.jython.org>`_ it is possible to use Pygments in
|
6
6
|
Java.
|
7
7
|
|
8
|
-
This page is a simple tutorial to get an idea of how this
|
9
|
-
then look at the `Jython documentation <http://www.jython.org/docs/>`
|
10
|
-
advanced
|
8
|
+
This page is a simple tutorial to get an idea of how this works. You can
|
9
|
+
then look at the `Jython documentation <http://www.jython.org/docs/>`_ for more
|
10
|
+
advanced uses.
|
11
11
|
|
12
12
|
Since version 1.5, Pygments is deployed on `Maven Central
|
13
|
-
<http://repo1.maven.org/maven2/org/pygments/pygments/>`
|
14
|
-
which makes it a lot easier to create
|
13
|
+
<http://repo1.maven.org/maven2/org/pygments/pygments/>`_ as a JAR, as is Jython
|
14
|
+
which makes it a lot easier to create a Java project.
|
15
15
|
|
16
|
-
Here is an example of a `Maven <http://www.maven.org>`
|
16
|
+
Here is an example of a `Maven <http://www.maven.org>`_ ``pom.xml`` file for a
|
17
17
|
project running Pygments:
|
18
18
|
|
19
19
|
.. sourcecode:: xml
|
@@ -1,55 +1,56 @@
|
|
1
1
|
.. -*- mode: rst -*-
|
2
2
|
|
3
|
+
.. highlight:: python
|
4
|
+
|
3
5
|
====================
|
4
6
|
Write your own lexer
|
5
7
|
====================
|
6
8
|
|
7
|
-
If a lexer for your favorite language is missing in the Pygments package, you
|
8
|
-
easily write your own and extend Pygments.
|
9
|
+
If a lexer for your favorite language is missing in the Pygments package, you
|
10
|
+
can easily write your own and extend Pygments.
|
9
11
|
|
10
|
-
All you need can be found inside the :mod:`pygments.lexer` module.
|
12
|
+
All you need can be found inside the :mod:`pygments.lexer` module. As you can
|
11
13
|
read in the :doc:`API documentation <api>`, a lexer is a class that is
|
12
14
|
initialized with some keyword arguments (the lexer options) and that provides a
|
13
15
|
:meth:`.get_tokens_unprocessed()` method which is given a string or unicode
|
14
|
-
object with the data to
|
16
|
+
object with the data to lex.
|
15
17
|
|
16
18
|
The :meth:`.get_tokens_unprocessed()` method must return an iterator or iterable
|
17
|
-
containing tuples in the form ``(index, token, value)``.
|
18
|
-
to do this since there are
|
19
|
+
containing tuples in the form ``(index, token, value)``. Normally you don't
|
20
|
+
need to do this since there are base lexers that do most of the work and that
|
21
|
+
you can subclass.
|
19
22
|
|
20
23
|
|
21
24
|
RegexLexer
|
22
25
|
==========
|
23
26
|
|
24
|
-
|
25
|
-
|
26
|
-
expressions* for different *states*.
|
27
|
+
The lexer base class used by almost all of Pygments' lexers is the
|
28
|
+
:class:`RegexLexer`. This class allows you to define lexing rules in terms of
|
29
|
+
*regular expressions* for different *states*.
|
27
30
|
|
28
31
|
States are groups of regular expressions that are matched against the input
|
29
|
-
string at the *current position*.
|
30
|
-
corresponding action is performed (
|
31
|
-
type), the current position is set to where the last match
|
32
|
-
matching process continues with the first regex of the current
|
32
|
+
string at the *current position*. If one of these expressions matches, a
|
33
|
+
corresponding action is performed (such as yielding a token with a specific
|
34
|
+
type, or changing state), the current position is set to where the last match
|
35
|
+
ended and the matching process continues with the first regex of the current
|
36
|
+
state.
|
33
37
|
|
34
|
-
Lexer states are kept
|
35
|
-
|
36
|
-
|
38
|
+
Lexer states are kept on a stack: each time a new state is entered, the new
|
39
|
+
state is pushed onto the stack. The most basic lexers (like the `DiffLexer`)
|
40
|
+
just need one state.
|
37
41
|
|
38
42
|
Each state is defined as a list of tuples in the form (`regex`, `action`,
|
39
43
|
`new_state`) where the last item is optional. In the most basic form, `action`
|
40
44
|
is a token type (like `Name.Builtin`). That means: When `regex` matches, emit a
|
41
45
|
token with the match text and type `tokentype` and push `new_state` on the state
|
42
46
|
stack. If the new state is ``'#pop'``, the topmost state is popped from the
|
43
|
-
stack instead.
|
44
|
-
``'#push'`` is a synonym for pushing the current state on the
|
45
|
-
stack.
|
47
|
+
stack instead. To pop more than one state, use ``'#pop:2'`` and so on.
|
48
|
+
``'#push'`` is a synonym for pushing the current state on the stack.
|
46
49
|
|
47
|
-
The following example shows the `DiffLexer` from the builtin lexers.
|
50
|
+
The following example shows the `DiffLexer` from the builtin lexers. Note that
|
48
51
|
it contains some additional attributes `name`, `aliases` and `filenames` which
|
49
|
-
aren't required for a lexer.
|
50
|
-
functions.
|
51
|
-
|
52
|
-
.. sourcecode:: python
|
52
|
+
aren't required for a lexer. They are used by the builtin lexer lookup
|
53
|
+
functions. ::
|
53
54
|
|
54
55
|
from pygments.lexer import RegexLexer
|
55
56
|
from pygments.token import *
|
@@ -72,56 +73,65 @@ functions.
|
|
72
73
|
}
|
73
74
|
|
74
75
|
As you can see this lexer only uses one state. When the lexer starts scanning
|
75
|
-
the text, it first checks if the current character is a space.
|
76
|
-
it scans everything until newline and returns the
|
76
|
+
the text, it first checks if the current character is a space. If this is true
|
77
|
+
it scans everything until newline and returns the data as a `Text` token (which
|
78
|
+
is the "no special highlighting" token).
|
77
79
|
|
78
80
|
If this rule doesn't match, it checks if the current char is a plus sign. And
|
79
81
|
so on.
|
80
82
|
|
81
83
|
If no rule matches at the current position, the current char is emitted as an
|
82
|
-
`Error` token that indicates a
|
83
|
-
|
84
|
+
`Error` token that indicates a lexing error, and the position is increased by
|
85
|
+
one.
|
84
86
|
|
85
87
|
|
86
88
|
Adding and testing a new lexer
|
87
89
|
==============================
|
88
90
|
|
89
|
-
|
90
|
-
|
91
|
+
Using a lexer that is not part of Pygments can be done via the Python API. You
|
92
|
+
can import and instantiate the lexer, and pass it to :func:`pygments.highlight`.
|
91
93
|
|
92
|
-
|
94
|
+
To prepare your new lexer for inclusion in the Pygments distribution, so that it
|
95
|
+
will be found when passing filenames or lexer aliases from the command line, you
|
96
|
+
have to perform the following steps.
|
93
97
|
|
94
|
-
|
98
|
+
First, change to the current directory containing the Pygments source code. You
|
99
|
+
will need to have either an unpacked source tarball, or (preferably) a copy
|
100
|
+
cloned from BitBucket.
|
101
|
+
|
102
|
+
.. code-block:: console
|
95
103
|
|
96
104
|
$ cd .../pygments-main
|
97
105
|
|
98
|
-
|
99
|
-
|
106
|
+
Select a matching module under ``pygments/lexers``, or create a new module for
|
107
|
+
your lexer class.
|
100
108
|
|
101
|
-
|
109
|
+
Next, make sure the lexer is known from outside of the module. All modules in
|
110
|
+
the ``pygments.lexers`` package specify ``__all__``. For example,
|
111
|
+
``esoteric.py`` sets::
|
102
112
|
|
103
113
|
__all__ = ['BrainfuckLexer', 'BefungeLexer', ...]
|
104
114
|
|
105
|
-
|
115
|
+
Add the name of your lexer class to this list (or create the list if your lexer
|
116
|
+
is the only class in the module).
|
106
117
|
|
107
|
-
Finally the lexer can be made
|
108
|
-
mapping:
|
118
|
+
Finally the lexer can be made publicly known by rebuilding the lexer mapping:
|
109
119
|
|
110
|
-
..
|
120
|
+
.. code-block:: console
|
111
121
|
|
112
122
|
$ make mapfiles
|
113
123
|
|
114
124
|
To test the new lexer, store an example file with the proper extension in
|
115
|
-
``tests/examplefiles``.
|
125
|
+
``tests/examplefiles``. For example, to test your ``DiffLexer``, add a
|
116
126
|
``tests/examplefiles/example.diff`` containing a sample diff output.
|
117
127
|
|
118
128
|
Now you can use pygmentize to render your example to HTML:
|
119
129
|
|
120
|
-
..
|
130
|
+
.. code-block:: console
|
121
131
|
|
122
132
|
$ ./pygmentize -O full -f html -o /tmp/example.html tests/examplefiles/example.diff
|
123
133
|
|
124
|
-
Note that this
|
134
|
+
Note that this explicitly calls the ``pygmentize`` in the current directory
|
125
135
|
by preceding it with ``./``. This ensures your modifications are used.
|
126
136
|
Otherwise a possibly already installed, unmodified version without your new
|
127
137
|
lexer would have been called from the system search path (``$PATH``).
|
@@ -130,29 +140,35 @@ To view the result, open ``/tmp/example.html`` in your browser.
|
|
130
140
|
|
131
141
|
Once the example renders as expected, you should run the complete test suite:
|
132
142
|
|
133
|
-
..
|
143
|
+
.. code-block:: console
|
134
144
|
|
135
145
|
$ make test
|
136
146
|
|
147
|
+
It also tests that your lexer fulfills the lexer API and certain invariants,
|
148
|
+
such as that the concatenation of all token text is the same as the input text.
|
149
|
+
|
137
150
|
|
138
151
|
Regex Flags
|
139
152
|
===========
|
140
153
|
|
141
|
-
You can either define regex flags in the regex (``r'(?x)foo bar'``) or
|
142
|
-
a `flags` attribute to your lexer class.
|
143
|
-
to `re.MULTILINE`.
|
144
|
-
`regular expressions`_
|
154
|
+
You can either define regex flags locally in the regex (``r'(?x)foo bar'``) or
|
155
|
+
globally by adding a `flags` attribute to your lexer class. If no attribute is
|
156
|
+
defined, it defaults to `re.MULTILINE`. For more information about regular
|
157
|
+
expression flags see the page about `regular expressions`_ in the Python
|
158
|
+
documentation.
|
145
159
|
|
146
|
-
.. _regular expressions: http://docs.python.org/
|
160
|
+
.. _regular expressions: http://docs.python.org/library/re.html#regular-expression-syntax
|
147
161
|
|
148
162
|
|
149
163
|
Scanning multiple tokens at once
|
150
164
|
================================
|
151
165
|
|
152
|
-
|
153
|
-
|
166
|
+
So far, the `action` element in the rule tuple of regex, action and state has
|
167
|
+
been a single token type. Now we look at the first of several other possible
|
168
|
+
values.
|
154
169
|
|
155
|
-
|
170
|
+
Here is a more complex lexer that highlights INI files. INI files consist of
|
171
|
+
sections, comments and ``key = value`` pairs::
|
156
172
|
|
157
173
|
from pygments.lexer import RegexLexer, bygroups
|
158
174
|
from pygments.token import *
|
@@ -172,43 +188,41 @@ sections, comments and key = value pairs:
|
|
172
188
|
]
|
173
189
|
}
|
174
190
|
|
175
|
-
The lexer first looks for whitespace, comments and section names.
|
191
|
+
The lexer first looks for whitespace, comments and section names. Later it
|
176
192
|
looks for a line that looks like a key, value pair, separated by an ``'='``
|
177
193
|
sign, and optional whitespace.
|
178
194
|
|
179
|
-
The `bygroups` helper
|
180
|
-
token type.
|
195
|
+
The `bygroups` helper yields each capturing group in the regex with a different
|
196
|
+
token type. First the `Name.Attribute` token, then a `Text` token for the
|
181
197
|
optional whitespace, after that a `Operator` token for the equals sign. Then a
|
182
|
-
`Text` token for the whitespace again.
|
198
|
+
`Text` token for the whitespace again. The rest of the line is returned as
|
183
199
|
`String`.
|
184
200
|
|
185
201
|
Note that for this to work, every part of the match must be inside a capturing
|
186
202
|
group (a ``(...)``), and there must not be any nested capturing groups. If you
|
187
203
|
nevertheless need a group, use a non-capturing group defined using this syntax:
|
188
|
-
``
|
204
|
+
``(?:some|words|here)`` (note the ``?:`` after the beginning parenthesis).
|
189
205
|
|
190
|
-
If you find yourself needing a capturing group inside the regex which
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
output.
|
206
|
+
If you find yourself needing a capturing group inside the regex which shouldn't
|
207
|
+
be part of the output but is used in the regular expressions for backreferencing
|
208
|
+
(eg: ``r'(<(foo|bar)>)(.*?)(</\2>)'``), you can pass `None` to the bygroups
|
209
|
+
function and that group will be skipped in the output.
|
195
210
|
|
196
211
|
|
197
212
|
Changing states
|
198
213
|
===============
|
199
214
|
|
200
|
-
Many lexers need multiple states to work as expected.
|
201
|
-
languages allow multiline comments to be nested.
|
215
|
+
Many lexers need multiple states to work as expected. For example, some
|
216
|
+
languages allow multiline comments to be nested. Since this is a recursive
|
202
217
|
pattern it's impossible to lex just using regular expressions.
|
203
218
|
|
204
|
-
Here is
|
205
|
-
|
206
|
-
.. sourcecode:: python
|
219
|
+
Here is a lexer that recognizes C++ style comments (multi-line with ``/* */``
|
220
|
+
and single-line with ``//`` until end of line)::
|
207
221
|
|
208
222
|
from pygments.lexer import RegexLexer
|
209
223
|
from pygments.token import *
|
210
224
|
|
211
|
-
class
|
225
|
+
class CppCommentLexer(RegexLexer):
|
212
226
|
name = 'Example Lexer with states'
|
213
227
|
|
214
228
|
tokens = {
|
@@ -227,28 +241,29 @@ Here is the solution:
|
|
227
241
|
}
|
228
242
|
|
229
243
|
This lexer starts lexing in the ``'root'`` state. It tries to match as much as
|
230
|
-
possible until it finds a slash (``'/'``).
|
231
|
-
is
|
232
|
-
stream marked as `Comment.Multiline` and continues
|
244
|
+
possible until it finds a slash (``'/'``). If the next character after the slash
|
245
|
+
is an asterisk (``'*'``) the `RegexLexer` sends those two characters to the
|
246
|
+
output stream marked as `Comment.Multiline` and continues lexing with the rules
|
233
247
|
defined in the ``'comment'`` state.
|
234
248
|
|
235
|
-
If there wasn't
|
236
|
-
|
237
|
-
case it must be a single slash
|
238
|
-
be given, else the slash would be marked as
|
249
|
+
If there wasn't an asterisk after the slash, the `RegexLexer` checks if it's a
|
250
|
+
Singleline comment (i.e. followed by a second slash). If this also wasn't the
|
251
|
+
case it must be a single slash, which is not a comment starter (the separate
|
252
|
+
regex for a single slash must also be given, else the slash would be marked as
|
253
|
+
an error token).
|
239
254
|
|
240
|
-
Inside the ``'comment'`` state, we do the same thing again.
|
241
|
-
finds a star or slash.
|
242
|
-
``'comment'`` state on the stack and continue scanning, again in the
|
243
|
-
``'comment'`` state. Else, check if it's the end of the multiline comment.
|
255
|
+
Inside the ``'comment'`` state, we do the same thing again. Scan until the
|
256
|
+
lexer finds a star or slash. If it's the opening of a multiline comment, push
|
257
|
+
the ``'comment'`` state on the stack and continue scanning, again in the
|
258
|
+
``'comment'`` state. Else, check if it's the end of the multiline comment. If
|
244
259
|
yes, pop one state from the stack.
|
245
260
|
|
246
|
-
Note: If you pop from an empty stack you'll get an `IndexError`.
|
261
|
+
Note: If you pop from an empty stack you'll get an `IndexError`. (There is an
|
247
262
|
easy way to prevent this from happening: don't ``'#pop'`` in the root state).
|
248
263
|
|
249
264
|
If the `RegexLexer` encounters a newline that is flagged as an error token, the
|
250
|
-
stack is emptied and the lexer continues scanning in the ``'root'`` state.
|
251
|
-
|
265
|
+
stack is emptied and the lexer continues scanning in the ``'root'`` state. This
|
266
|
+
can help producing error-tolerant highlighting for erroneous input, e.g. when a
|
252
267
|
single-line string is not closed.
|
253
268
|
|
254
269
|
|
@@ -258,14 +273,14 @@ Advanced state tricks
|
|
258
273
|
There are a few more things you can do with states:
|
259
274
|
|
260
275
|
- You can push multiple states onto the stack if you give a tuple instead of a
|
261
|
-
simple string as the third item in a rule tuple.
|
262
|
-
match a comment containing a directive, something like
|
276
|
+
simple string as the third item in a rule tuple. For example, if you want to
|
277
|
+
match a comment containing a directive, something like:
|
263
278
|
|
264
|
-
|
279
|
+
.. code-block:: text
|
265
280
|
|
266
|
-
|
281
|
+
/* <processing directive> rest of comment */
|
267
282
|
|
268
|
-
|
283
|
+
you can use this rule::
|
269
284
|
|
270
285
|
tokens = {
|
271
286
|
'root': [
|
@@ -286,7 +301,7 @@ There are a few more things you can do with states:
|
|
286
301
|
When this encounters the above sample, first ``'comment'`` and ``'directive'``
|
287
302
|
are pushed onto the stack, then the lexer continues in the directive state
|
288
303
|
until it finds the closing ``>``, then it continues in the comment state until
|
289
|
-
the closing ``*/``.
|
304
|
+
the closing ``*/``. Then, both states are popped from the stack again and
|
290
305
|
lexing continues in the root state.
|
291
306
|
|
292
307
|
.. versionadded:: 0.9
|
@@ -295,9 +310,7 @@ There are a few more things you can do with states:
|
|
295
310
|
|
296
311
|
|
297
312
|
- You can include the rules of a state in the definition of another. This is
|
298
|
-
done by using `include` from `pygments.lexer
|
299
|
-
|
300
|
-
.. sourcecode:: python
|
313
|
+
done by using `include` from `pygments.lexer`::
|
301
314
|
|
302
315
|
from pygments.lexer import RegexLexer, bygroups, include
|
303
316
|
from pygments.token import *
|
@@ -318,20 +331,19 @@ There are a few more things you can do with states:
|
|
318
331
|
(r'[^}/]+', Text),
|
319
332
|
include('comments'),
|
320
333
|
(r'/', Text),
|
321
|
-
(r'}', Keyword, '#pop'),
|
334
|
+
(r'\}', Keyword, '#pop'),
|
322
335
|
]
|
323
336
|
}
|
324
337
|
|
325
338
|
This is a hypothetical lexer for a language that consist of functions and
|
326
|
-
comments.
|
327
|
-
rules for comments in both states.
|
339
|
+
comments. Because comments can occur at toplevel and in functions, we need
|
340
|
+
rules for comments in both states. As you can see, the `include` helper saves
|
328
341
|
repeating rules that occur more than once (in this example, the state
|
329
342
|
``'comment'`` will never be entered by the lexer, as it's only there to be
|
330
343
|
included in ``'root'`` and ``'function'``).
|
331
344
|
|
332
|
-
|
333
345
|
- Sometimes, you may want to "combine" a state from existing ones. This is
|
334
|
-
possible with the `
|
346
|
+
possible with the `combined` helper from `pygments.lexer`.
|
335
347
|
|
336
348
|
If you, instead of a new state, write ``combined('state1', 'state2')`` as the
|
337
349
|
third item of a rule tuple, a new anonymous state will be formed from state1
|
@@ -340,45 +352,101 @@ There are a few more things you can do with states:
|
|
340
352
|
This is not used very often, but can be helpful in some cases, such as the
|
341
353
|
`PythonLexer`'s string literal processing.
|
342
354
|
|
343
|
-
- If you want your lexer to start lexing in a different state you can modify
|
344
|
-
|
345
|
-
|
346
|
-
.. sourcecode:: python
|
355
|
+
- If you want your lexer to start lexing in a different state you can modify the
|
356
|
+
stack by overriding the `get_tokens_unprocessed()` method::
|
347
357
|
|
348
358
|
from pygments.lexer import RegexLexer
|
349
359
|
|
350
|
-
class
|
360
|
+
class ExampleLexer(RegexLexer):
|
351
361
|
tokens = {...}
|
352
362
|
|
353
|
-
def get_tokens_unprocessed(self, text):
|
354
|
-
stack = ['root', 'otherstate']
|
363
|
+
def get_tokens_unprocessed(self, text, stack=('root', 'otherstate')):
|
355
364
|
for item in RegexLexer.get_tokens_unprocessed(text, stack):
|
356
365
|
yield item
|
357
366
|
|
358
367
|
Some lexers like the `PhpLexer` use this to make the leading ``<?php``
|
359
|
-
preprocessor comments optional.
|
360
|
-
|
368
|
+
preprocessor comments optional. Note that you can crash the lexer easily by
|
369
|
+
putting values into the stack that don't exist in the token map. Also
|
361
370
|
removing ``'root'`` from the stack can result in strange errors!
|
362
371
|
|
363
|
-
-
|
364
|
-
|
372
|
+
- In some lexers, a state should be popped if anything is encountered that isn't
|
373
|
+
matched by a rule in the state. You could use an empty regex at the end of
|
374
|
+
the state list, but Pygments provides a more obvious way of spelling that:
|
375
|
+
``default('#pop')`` is equivalent to ``('', Text, '#pop')``.
|
376
|
+
|
377
|
+
.. versionadded:: 2.0
|
378
|
+
|
379
|
+
|
380
|
+
Subclassing lexers derived from RegexLexer
|
381
|
+
==========================================
|
382
|
+
|
383
|
+
.. versionadded:: 1.6
|
384
|
+
|
385
|
+
Sometimes multiple languages are very similar, but should still be lexed by
|
386
|
+
different lexer classes.
|
387
|
+
|
388
|
+
When subclassing a lexer derived from RegexLexer, the ``tokens`` dictionaries
|
389
|
+
defined in the parent and child class are merged. For example::
|
390
|
+
|
391
|
+
from pygments.lexer import RegexLexer, inherit
|
392
|
+
from pygments.token import *
|
393
|
+
|
394
|
+
class BaseLexer(RegexLexer):
|
395
|
+
tokens = {
|
396
|
+
'root': [
|
397
|
+
('[a-z]+', Name),
|
398
|
+
(r'/\*', Comment, 'comment'),
|
399
|
+
('"', String, 'string'),
|
400
|
+
('\s+', Text),
|
401
|
+
],
|
402
|
+
'string': [
|
403
|
+
('[^"]+', String),
|
404
|
+
('"', String, '#pop'),
|
405
|
+
],
|
406
|
+
'comment': [
|
407
|
+
...
|
408
|
+
],
|
409
|
+
}
|
410
|
+
|
411
|
+
class DerivedLexer(BaseLexer):
|
412
|
+
tokens = {
|
413
|
+
'root': [
|
414
|
+
('[0-9]+', Number),
|
415
|
+
inherit,
|
416
|
+
],
|
417
|
+
'string': [
|
418
|
+
(r'[^"\\]+', String),
|
419
|
+
(r'\\.', String.Escape),
|
420
|
+
('"', String, '#pop'),
|
421
|
+
],
|
422
|
+
}
|
423
|
+
|
424
|
+
The `BaseLexer` defines two states, lexing names and strings. The
|
425
|
+
`DerivedLexer` defines its own tokens dictionary, which extends the definitions
|
426
|
+
of the base lexer:
|
427
|
+
|
428
|
+
* The "root" state has an additional rule and then the special object `inherit`,
|
429
|
+
which tells Pygments to insert the token definitions of the parent class at
|
430
|
+
that point.
|
431
|
+
|
432
|
+
* The "string" state is replaced entirely, since there is not `inherit` rule.
|
433
|
+
|
434
|
+
* The "comment" state is inherited entirely.
|
365
435
|
|
366
436
|
|
367
437
|
Using multiple lexers
|
368
438
|
=====================
|
369
439
|
|
370
|
-
Using multiple lexers for the same input can be tricky.
|
371
|
-
combination techniques is shown here: You can replace the
|
372
|
-
|
373
|
-
|
440
|
+
Using multiple lexers for the same input can be tricky. One of the easiest
|
441
|
+
combination techniques is shown here: You can replace the action entry in a rule
|
442
|
+
tuple with a lexer class. The matched text will then be lexed with that lexer,
|
443
|
+
and the resulting tokens will be yielded.
|
374
444
|
|
375
|
-
For example, look at this stripped-down HTML lexer
|
376
|
-
|
377
|
-
.. sourcecode:: python
|
445
|
+
For example, look at this stripped-down HTML lexer::
|
378
446
|
|
379
447
|
from pygments.lexer import RegexLexer, bygroups, using
|
380
448
|
from pygments.token import *
|
381
|
-
from pygments.lexers.
|
449
|
+
from pygments.lexers.javascript import JavascriptLexer
|
382
450
|
|
383
451
|
class HtmlLexer(RegexLexer):
|
384
452
|
name = 'HTML'
|
@@ -402,26 +470,29 @@ For example, look at this stripped-down HTML lexer:
|
|
402
470
|
}
|
403
471
|
|
404
472
|
Here the content of a ``<script>`` tag is passed to a newly created instance of
|
405
|
-
a `JavascriptLexer` and not processed by the `HtmlLexer`.
|
406
|
-
`using` helper that takes the other lexer class as its parameter.
|
407
|
-
|
408
|
-
Note the combination of `bygroups` and `using`. This makes sure that the content
|
409
|
-
up to the ``</script>`` end tag is processed by the `JavascriptLexer`, while the
|
410
|
-
end tag is yielded as a normal token with the `Name.Tag` type.
|
473
|
+
a `JavascriptLexer` and not processed by the `HtmlLexer`. This is done using
|
474
|
+
the `using` helper that takes the other lexer class as its parameter.
|
411
475
|
|
412
|
-
|
413
|
-
|
414
|
-
|
476
|
+
Note the combination of `bygroups` and `using`. This makes sure that the
|
477
|
+
content up to the ``</script>`` end tag is processed by the `JavascriptLexer`,
|
478
|
+
while the end tag is yielded as a normal token with the `Name.Tag` type.
|
415
479
|
|
416
480
|
Also note the ``(r'<\s*script\s*', Name.Tag, ('script-content', 'tag'))`` rule.
|
417
481
|
Here, two states are pushed onto the state stack, ``'script-content'`` and
|
418
|
-
``'tag'``. That means that first ``'tag'`` is processed, which will
|
482
|
+
``'tag'``. That means that first ``'tag'`` is processed, which will lex
|
419
483
|
attributes and the closing ``>``, then the ``'tag'`` state is popped and the
|
420
484
|
next state on top of the stack will be ``'script-content'``.
|
421
485
|
|
486
|
+
Since you cannot refer to the class currently being defined, use `this`
|
487
|
+
(imported from `pygments.lexer`) to refer to the current lexer class, i.e.
|
488
|
+
``using(this)``. This construct may seem unnecessary, but this is often the
|
489
|
+
most obvious way of lexing arbitrary syntax between fixed delimiters without
|
490
|
+
introducing deeply nested states.
|
491
|
+
|
422
492
|
The `using()` helper has a special keyword argument, `state`, which works as
|
423
493
|
follows: if given, the lexer to use initially is not in the ``"root"`` state,
|
424
|
-
but in the state given by this argument.
|
494
|
+
but in the state given by this argument. This does not work with advanced
|
495
|
+
`RegexLexer` subclasses such as `ExtendedRegexLexer` (see below).
|
425
496
|
|
426
497
|
Any other keywords arguments passed to `using()` are added to the keyword
|
427
498
|
arguments used to create the lexer.
|
@@ -430,17 +501,15 @@ arguments used to create the lexer.
|
|
430
501
|
Delegating Lexer
|
431
502
|
================
|
432
503
|
|
433
|
-
Another approach for nested lexers is the `DelegatingLexer` which is for
|
434
|
-
|
435
|
-
|
504
|
+
Another approach for nested lexers is the `DelegatingLexer` which is for example
|
505
|
+
used for the template engine lexers. It takes two lexers as arguments on
|
506
|
+
initialisation: a `root_lexer` and a `language_lexer`.
|
436
507
|
|
437
508
|
The input is processed as follows: First, the whole text is lexed with the
|
438
|
-
`language_lexer`.
|
439
|
-
concatenated and given to the `root_lexer`.
|
440
|
-
`language_lexer` are then inserted into the `root_lexer`'s token stream
|
441
|
-
|
442
|
-
|
443
|
-
.. sourcecode:: python
|
509
|
+
`language_lexer`. All tokens yielded with the special type of ``Other`` are
|
510
|
+
then concatenated and given to the `root_lexer`. The language tokens of the
|
511
|
+
`language_lexer` are then inserted into the `root_lexer`'s token stream at the
|
512
|
+
appropriate positions. ::
|
444
513
|
|
445
514
|
from pygments.lexer import DelegatingLexer
|
446
515
|
from pygments.lexers.web import HtmlLexer, PhpLexer
|
@@ -452,10 +521,8 @@ at the appropriate positions.
|
|
452
521
|
This procedure ensures that e.g. HTML with template tags in it is highlighted
|
453
522
|
correctly even if the template tags are put into HTML tags or attributes.
|
454
523
|
|
455
|
-
If you want to change the needle token ``Other`` to something else, you can
|
456
|
-
|
457
|
-
|
458
|
-
.. sourcecode:: python
|
524
|
+
If you want to change the needle token ``Other`` to something else, you can give
|
525
|
+
the lexer another token type as the third parameter::
|
459
526
|
|
460
527
|
DelegatingLexer.__init__(MyLexer, OtherLexer, Text, **options)
|
461
528
|
|
@@ -464,24 +531,22 @@ Callbacks
|
|
464
531
|
=========
|
465
532
|
|
466
533
|
Sometimes the grammar of a language is so complex that a lexer would be unable
|
467
|
-
to
|
534
|
+
to process it just by using regular expressions and stacks.
|
468
535
|
|
469
536
|
For this, the `RegexLexer` allows callbacks to be given in rule tuples, instead
|
470
537
|
of token types (`bygroups` and `using` are nothing else but preimplemented
|
471
|
-
callbacks).
|
538
|
+
callbacks). The callback must be a function taking two arguments:
|
472
539
|
|
473
540
|
* the lexer itself
|
474
541
|
* the match object for the last matched rule
|
475
542
|
|
476
543
|
The callback must then return an iterable of (or simply yield) ``(index,
|
477
544
|
tokentype, value)`` tuples, which are then just passed through by
|
478
|
-
`get_tokens_unprocessed()`.
|
545
|
+
`get_tokens_unprocessed()`. The ``index`` here is the position of the token in
|
479
546
|
the input string, ``tokentype`` is the normal token type (like `Name.Builtin`),
|
480
547
|
and ``value`` the associated part of the input string.
|
481
548
|
|
482
|
-
You can see an example here
|
483
|
-
|
484
|
-
.. sourcecode:: python
|
549
|
+
You can see an example here::
|
485
550
|
|
486
551
|
from pygments.lexer import RegexLexer
|
487
552
|
from pygments.token import Generic
|
@@ -499,26 +564,25 @@ You can see an example here:
|
|
499
564
|
]
|
500
565
|
}
|
501
566
|
|
502
|
-
If the regex for the `headline_callback` matches, the function is called with
|
503
|
-
match object.
|
504
|
-
normally, that is, after the end of the previous match.
|
567
|
+
If the regex for the `headline_callback` matches, the function is called with
|
568
|
+
the match object. Note that after the callback is done, processing continues
|
569
|
+
normally, that is, after the end of the previous match. The callback has no
|
505
570
|
possibility to influence the position.
|
506
571
|
|
507
572
|
There are not really any simple examples for lexer callbacks, but you can see
|
508
|
-
them in action e.g. in the `
|
509
|
-
`JavaLexer` classes.
|
573
|
+
them in action e.g. in the `SMLLexer` class in `ml.py`_.
|
510
574
|
|
511
|
-
..
|
575
|
+
.. _ml.py: http://bitbucket.org/birkenfeld/pygments-main/src/tip/pygments/lexers/ml.py
|
512
576
|
|
513
577
|
|
514
578
|
The ExtendedRegexLexer class
|
515
579
|
============================
|
516
580
|
|
517
581
|
The `RegexLexer`, even with callbacks, unfortunately isn't powerful enough for
|
518
|
-
the funky syntax rules of
|
582
|
+
the funky syntax rules of languages such as Ruby.
|
519
583
|
|
520
584
|
But fear not; even then you don't have to abandon the regular expression
|
521
|
-
approach
|
585
|
+
approach: Pygments has a subclass of `RegexLexer`, the `ExtendedRegexLexer`.
|
522
586
|
All features known from RegexLexers are available here too, and the tokens are
|
523
587
|
specified in exactly the same way, *except* for one detail:
|
524
588
|
|
@@ -542,9 +606,7 @@ creating a new one for the string argument.
|
|
542
606
|
Note that because you can set the current position to anything in the callback,
|
543
607
|
it won't be automatically be set by the caller after the callback is finished.
|
544
608
|
For example, this is how the hypothetical lexer above would be written with the
|
545
|
-
`ExtendedRegexLexer
|
546
|
-
|
547
|
-
.. sourcecode:: python
|
609
|
+
`ExtendedRegexLexer`::
|
548
610
|
|
549
611
|
from pygments.lexer import ExtendedRegexLexer
|
550
612
|
from pygments.token import Generic
|
@@ -564,31 +626,58 @@ For example, this is how the hypothetical lexer above would be written with the
|
|
564
626
|
}
|
565
627
|
|
566
628
|
This might sound confusing (and it can really be). But it is needed, and for an
|
567
|
-
example look at the Ruby lexer in `
|
629
|
+
example look at the Ruby lexer in `ruby.py`_.
|
568
630
|
|
569
|
-
..
|
631
|
+
.. _ruby.py: https://bitbucket.org/birkenfeld/pygments-main/src/tip/pygments/lexers/ruby.py
|
570
632
|
|
571
633
|
|
572
|
-
|
634
|
+
Handling Lists of Keywords
|
635
|
+
==========================
|
636
|
+
|
637
|
+
For a relatively short list (hundreds) you can construct an optimized regular
|
638
|
+
expression directly using ``words()`` (longer lists, see next section). This
|
639
|
+
function handles a few things for you automatically, including escaping
|
640
|
+
metacharacters and Python's first-match rather than longest-match in
|
641
|
+
alternations. Feel free to put the lists themselves in
|
642
|
+
``pygments/lexers/_$lang_builtins.py`` (see examples there), and generated by
|
643
|
+
code if possible.
|
644
|
+
|
645
|
+
An example of using ``words()`` is something like::
|
646
|
+
|
647
|
+
from pygments.lexer import RegexLexer, words, Name
|
648
|
+
|
649
|
+
class MyLexer(RegexLexer):
|
650
|
+
|
651
|
+
tokens = {
|
652
|
+
'root': [
|
653
|
+
(words(('else', 'elseif'), suffix=r'\b'), Name.Builtin),
|
654
|
+
(r'\w+', Name),
|
655
|
+
],
|
656
|
+
}
|
657
|
+
|
658
|
+
As you can see, you can add ``prefix`` and ``suffix`` parts to the constructed
|
659
|
+
regex.
|
660
|
+
|
661
|
+
|
662
|
+
Modifying Token Streams
|
573
663
|
=======================
|
574
664
|
|
575
|
-
Some languages ship a lot of builtin functions (for example PHP).
|
665
|
+
Some languages ship a lot of builtin functions (for example PHP). The total
|
576
666
|
amount of those functions differs from system to system because not everybody
|
577
|
-
has every extension installed.
|
578
|
-
functions.
|
579
|
-
|
580
|
-
|
581
|
-
But because only `Name` tokens can be function names it's solvable by overriding
|
582
|
-
the ``get_tokens_unprocessed()`` method. The following lexer subclasses the
|
583
|
-
`PythonLexer` so that it highlights some additional names as pseudo keywords:
|
667
|
+
has every extension installed. In the case of PHP there are over 3000 builtin
|
668
|
+
functions. That's an incredibly huge amount of functions, much more than you
|
669
|
+
want to put into a regular expression.
|
584
670
|
|
585
|
-
|
671
|
+
But because only `Name` tokens can be function names this is solvable by
|
672
|
+
overriding the ``get_tokens_unprocessed()`` method. The following lexer
|
673
|
+
subclasses the `PythonLexer` so that it highlights some additional names as
|
674
|
+
pseudo keywords::
|
586
675
|
|
587
|
-
from pygments.lexers.
|
676
|
+
from pygments.lexers.python import PythonLexer
|
588
677
|
from pygments.token import Name, Keyword
|
589
678
|
|
590
679
|
class MyPythonLexer(PythonLexer):
|
591
|
-
EXTRA_KEYWORDS =
|
680
|
+
EXTRA_KEYWORDS = set(('foo', 'bar', 'foobar', 'barfoo', 'spam', 'eggs'))
|
592
681
|
|
593
682
|
def get_tokens_unprocessed(self, text):
|
594
683
|
for index, token, value in PythonLexer.get_tokens_unprocessed(self, text):
|
@@ -598,5 +687,3 @@ the ``get_tokens_unprocessed()`` method. The following lexer subclasses the
|
|
598
687
|
yield index, token, value
|
599
688
|
|
600
689
|
The `PhpLexer` and `LuaLexer` use this method to resolve builtin functions.
|
601
|
-
|
602
|
-
.. note:: Do not confuse this with the :doc:`filter <filters>` system.
|