pygments.rb-jruby 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/CHANGELOG.md +71 -0
- data/Gemfile +2 -0
- data/LICENSE +17 -0
- data/README.md +118 -0
- data/Rakefile +66 -0
- data/bench.rb +22 -0
- data/cache-lexers.rb +8 -0
- data/lexers +0 -0
- data/lib/pygments.rb +8 -0
- data/lib/pygments/lexer.rb +148 -0
- data/lib/pygments/mentos.py +351 -0
- data/lib/pygments/popen.rb +404 -0
- data/lib/pygments/version.rb +3 -0
- data/pygments.rb.gemspec +24 -0
- data/test/test_data.c +2581 -0
- data/test/test_data.py +514 -0
- data/test/test_data_generated +2582 -0
- data/test/test_pygments.rb +287 -0
- data/vendor/custom_lexers/github.py +565 -0
- data/vendor/pygments-main/AUTHORS +153 -0
- data/vendor/pygments-main/CHANGES +889 -0
- data/vendor/pygments-main/LICENSE +25 -0
- data/vendor/pygments-main/MANIFEST.in +6 -0
- data/vendor/pygments-main/Makefile +59 -0
- data/vendor/pygments-main/REVISION +1 -0
- data/vendor/pygments-main/TODO +15 -0
- data/vendor/pygments-main/docs/generate.py +472 -0
- data/vendor/pygments-main/docs/pygmentize.1 +94 -0
- data/vendor/pygments-main/docs/src/api.txt +270 -0
- data/vendor/pygments-main/docs/src/authors.txt +5 -0
- data/vendor/pygments-main/docs/src/changelog.txt +5 -0
- data/vendor/pygments-main/docs/src/cmdline.txt +147 -0
- data/vendor/pygments-main/docs/src/filterdevelopment.txt +70 -0
- data/vendor/pygments-main/docs/src/filters.txt +42 -0
- data/vendor/pygments-main/docs/src/formatterdevelopment.txt +169 -0
- data/vendor/pygments-main/docs/src/formatters.txt +48 -0
- data/vendor/pygments-main/docs/src/index.txt +69 -0
- data/vendor/pygments-main/docs/src/installation.txt +71 -0
- data/vendor/pygments-main/docs/src/integrate.txt +48 -0
- data/vendor/pygments-main/docs/src/java.txt +70 -0
- data/vendor/pygments-main/docs/src/lexerdevelopment.txt +603 -0
- data/vendor/pygments-main/docs/src/lexers.txt +67 -0
- data/vendor/pygments-main/docs/src/moinmoin.txt +39 -0
- data/vendor/pygments-main/docs/src/plugins.txt +93 -0
- data/vendor/pygments-main/docs/src/quickstart.txt +202 -0
- data/vendor/pygments-main/docs/src/rstdirective.txt +22 -0
- data/vendor/pygments-main/docs/src/styles.txt +143 -0
- data/vendor/pygments-main/docs/src/tokens.txt +349 -0
- data/vendor/pygments-main/docs/src/unicode.txt +49 -0
- data/vendor/pygments-main/external/autopygmentize +64 -0
- data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +144 -0
- data/vendor/pygments-main/external/markdown-processor.py +67 -0
- data/vendor/pygments-main/external/moin-parser.py +112 -0
- data/vendor/pygments-main/external/pygments.bashcomp +38 -0
- data/vendor/pygments-main/external/rst-directive-old.py +77 -0
- data/vendor/pygments-main/external/rst-directive.py +83 -0
- data/vendor/pygments-main/ez_setup.py +276 -0
- data/vendor/pygments-main/pygmentize +7 -0
- data/vendor/pygments-main/pygments/__init__.py +91 -0
- data/vendor/pygments-main/pygments/cmdline.py +441 -0
- data/vendor/pygments-main/pygments/console.py +74 -0
- data/vendor/pygments-main/pygments/filter.py +74 -0
- data/vendor/pygments-main/pygments/filters/__init__.py +356 -0
- data/vendor/pygments-main/pygments/formatter.py +95 -0
- data/vendor/pygments-main/pygments/formatters/__init__.py +68 -0
- data/vendor/pygments-main/pygments/formatters/_mapping.py +92 -0
- data/vendor/pygments-main/pygments/formatters/bbcode.py +109 -0
- data/vendor/pygments-main/pygments/formatters/html.py +821 -0
- data/vendor/pygments-main/pygments/formatters/img.py +553 -0
- data/vendor/pygments-main/pygments/formatters/latex.py +378 -0
- data/vendor/pygments-main/pygments/formatters/other.py +115 -0
- data/vendor/pygments-main/pygments/formatters/rtf.py +136 -0
- data/vendor/pygments-main/pygments/formatters/svg.py +154 -0
- data/vendor/pygments-main/pygments/formatters/terminal.py +112 -0
- data/vendor/pygments-main/pygments/formatters/terminal256.py +222 -0
- data/vendor/pygments-main/pygments/lexer.py +765 -0
- data/vendor/pygments-main/pygments/lexers/__init__.py +240 -0
- data/vendor/pygments-main/pygments/lexers/_asybuiltins.py +1645 -0
- data/vendor/pygments-main/pygments/lexers/_clbuiltins.py +232 -0
- data/vendor/pygments-main/pygments/lexers/_lassobuiltins.py +5172 -0
- data/vendor/pygments-main/pygments/lexers/_luabuiltins.py +249 -0
- data/vendor/pygments-main/pygments/lexers/_mapping.py +354 -0
- data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +562 -0
- data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +3787 -0
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +233 -0
- data/vendor/pygments-main/pygments/lexers/_robotframeworklexer.py +557 -0
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +40 -0
- data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +1072 -0
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +360 -0
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +13 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +2290 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +398 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +3723 -0
- data/vendor/pygments-main/pygments/lexers/dalvik.py +104 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +671 -0
- data/vendor/pygments-main/pygments/lexers/foxpro.py +428 -0
- data/vendor/pygments-main/pygments/lexers/functional.py +2731 -0
- data/vendor/pygments-main/pygments/lexers/github.py +565 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +356 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +1112 -0
- data/vendor/pygments-main/pygments/lexers/math.py +1918 -0
- data/vendor/pygments-main/pygments/lexers/other.py +3778 -0
- data/vendor/pygments-main/pygments/lexers/parsers.py +778 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +424 -0
- data/vendor/pygments-main/pygments/lexers/special.py +100 -0
- data/vendor/pygments-main/pygments/lexers/sql.py +559 -0
- data/vendor/pygments-main/pygments/lexers/templates.py +1742 -0
- data/vendor/pygments-main/pygments/lexers/text.py +1893 -0
- data/vendor/pygments-main/pygments/lexers/web.py +4045 -0
- data/vendor/pygments-main/pygments/modeline.py +40 -0
- data/vendor/pygments-main/pygments/plugin.py +74 -0
- data/vendor/pygments-main/pygments/scanner.py +104 -0
- data/vendor/pygments-main/pygments/style.py +117 -0
- data/vendor/pygments-main/pygments/styles/__init__.py +70 -0
- data/vendor/pygments-main/pygments/styles/autumn.py +65 -0
- data/vendor/pygments-main/pygments/styles/borland.py +51 -0
- data/vendor/pygments-main/pygments/styles/bw.py +49 -0
- data/vendor/pygments-main/pygments/styles/colorful.py +81 -0
- data/vendor/pygments-main/pygments/styles/default.py +73 -0
- data/vendor/pygments-main/pygments/styles/emacs.py +72 -0
- data/vendor/pygments-main/pygments/styles/friendly.py +72 -0
- data/vendor/pygments-main/pygments/styles/fruity.py +42 -0
- data/vendor/pygments-main/pygments/styles/manni.py +75 -0
- data/vendor/pygments-main/pygments/styles/monokai.py +106 -0
- data/vendor/pygments-main/pygments/styles/murphy.py +80 -0
- data/vendor/pygments-main/pygments/styles/native.py +65 -0
- data/vendor/pygments-main/pygments/styles/pastie.py +75 -0
- data/vendor/pygments-main/pygments/styles/perldoc.py +69 -0
- data/vendor/pygments-main/pygments/styles/rrt.py +33 -0
- data/vendor/pygments-main/pygments/styles/tango.py +141 -0
- data/vendor/pygments-main/pygments/styles/trac.py +63 -0
- data/vendor/pygments-main/pygments/styles/vim.py +63 -0
- data/vendor/pygments-main/pygments/styles/vs.py +38 -0
- data/vendor/pygments-main/pygments/token.py +195 -0
- data/vendor/pygments-main/pygments/unistring.py +140 -0
- data/vendor/pygments-main/pygments/util.py +277 -0
- data/vendor/pygments-main/scripts/check_sources.py +242 -0
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +32 -0
- data/vendor/pygments-main/scripts/epydoc.css +280 -0
- data/vendor/pygments-main/scripts/find_codetags.py +205 -0
- data/vendor/pygments-main/scripts/find_error.py +170 -0
- data/vendor/pygments-main/scripts/get_vimkw.py +43 -0
- data/vendor/pygments-main/scripts/pylintrc +301 -0
- data/vendor/pygments-main/scripts/reindent.py +291 -0
- data/vendor/pygments-main/scripts/vim2pygments.py +933 -0
- data/vendor/pygments-main/setup.cfg +7 -0
- data/vendor/pygments-main/setup.py +90 -0
- data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +37 -0
- data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +869 -0
- data/vendor/pygments-main/tests/dtds/HTML4.dcl +88 -0
- data/vendor/pygments-main/tests/dtds/HTML4.dtd +1092 -0
- data/vendor/pygments-main/tests/dtds/HTML4.soc +9 -0
- data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +195 -0
- data/vendor/pygments-main/tests/dtds/HTMLspec.ent +77 -0
- data/vendor/pygments-main/tests/dtds/HTMLsym.ent +241 -0
- data/vendor/pygments-main/tests/examplefiles/ANTLRv3.g +608 -0
- data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +209 -0
- data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +102 -0
- data/vendor/pygments-main/tests/examplefiles/BOM.js +1 -0
- data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +611 -0
- data/vendor/pygments-main/tests/examplefiles/Config.in.cache +1973 -0
- data/vendor/pygments-main/tests/examplefiles/Constants.mo +158 -0
- data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +411 -0
- data/vendor/pygments-main/tests/examplefiles/Deflate.fs +578 -0
- data/vendor/pygments-main/tests/examplefiles/Errors.scala +18 -0
- data/vendor/pygments-main/tests/examplefiles/File.hy +174 -0
- data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +66 -0
- data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +104 -0
- data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +671 -0
- data/vendor/pygments-main/tests/examplefiles/Intro.java +1660 -0
- data/vendor/pygments-main/tests/examplefiles/Makefile +1131 -0
- data/vendor/pygments-main/tests/examplefiles/Object.st +4394 -0
- data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +584 -0
- data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +23 -0
- data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +378 -0
- data/vendor/pygments-main/tests/examplefiles/Sorting.mod +470 -0
- data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +382 -0
- data/vendor/pygments-main/tests/examplefiles/addressbook.proto +30 -0
- data/vendor/pygments-main/tests/examplefiles/antlr_throws +1 -0
- data/vendor/pygments-main/tests/examplefiles/apache2.conf +393 -0
- data/vendor/pygments-main/tests/examplefiles/as3_test.as +143 -0
- data/vendor/pygments-main/tests/examplefiles/as3_test2.as +46 -0
- data/vendor/pygments-main/tests/examplefiles/as3_test3.as +3 -0
- data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +27 -0
- data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +25 -0
- data/vendor/pygments-main/tests/examplefiles/badcase.java +2 -0
- data/vendor/pygments-main/tests/examplefiles/batchfile.bat +49 -0
- data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +308 -0
- data/vendor/pygments-main/tests/examplefiles/boot-9.scm +1557 -0
- data/vendor/pygments-main/tests/examplefiles/ca65_example +284 -0
- data/vendor/pygments-main/tests/examplefiles/cbmbas_example +9 -0
- data/vendor/pygments-main/tests/examplefiles/cells.ps +515 -0
- data/vendor/pygments-main/tests/examplefiles/ceval.c +2604 -0
- data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +13 -0
- data/vendor/pygments-main/tests/examplefiles/classes.dylan +125 -0
- data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +10 -0
- data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +447 -0
- data/vendor/pygments-main/tests/examplefiles/database.pytb +20 -0
- data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +2461 -0
- data/vendor/pygments-main/tests/examplefiles/demo.ahk +181 -0
- data/vendor/pygments-main/tests/examplefiles/demo.cfm +38 -0
- data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +68 -0
- data/vendor/pygments-main/tests/examplefiles/dwarf.cw +17 -0
- data/vendor/pygments-main/tests/examplefiles/erl_session +10 -0
- data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +1 -0
- data/vendor/pygments-main/tests/examplefiles/evil_regex.js +48 -0
- data/vendor/pygments-main/tests/examplefiles/example.Rd +78 -0
- data/vendor/pygments-main/tests/examplefiles/example.bug +54 -0
- data/vendor/pygments-main/tests/examplefiles/example.c +2080 -0
- data/vendor/pygments-main/tests/examplefiles/example.ceylon +52 -0
- data/vendor/pygments-main/tests/examplefiles/example.clay +33 -0
- data/vendor/pygments-main/tests/examplefiles/example.cls +15 -0
- data/vendor/pygments-main/tests/examplefiles/example.cob +3556 -0
- data/vendor/pygments-main/tests/examplefiles/example.cpp +2363 -0
- data/vendor/pygments-main/tests/examplefiles/example.gs +106 -0
- data/vendor/pygments-main/tests/examplefiles/example.gst +7 -0
- data/vendor/pygments-main/tests/examplefiles/example.hx +142 -0
- data/vendor/pygments-main/tests/examplefiles/example.jag +48 -0
- data/vendor/pygments-main/tests/examplefiles/example.kt +47 -0
- data/vendor/pygments-main/tests/examplefiles/example.lagda +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.lua +250 -0
- data/vendor/pygments-main/tests/examplefiles/example.monkey +152 -0
- data/vendor/pygments-main/tests/examplefiles/example.moo +26 -0
- data/vendor/pygments-main/tests/examplefiles/example.moon +629 -0
- data/vendor/pygments-main/tests/examplefiles/example.msc +43 -0
- data/vendor/pygments-main/tests/examplefiles/example.nim +1010 -0
- data/vendor/pygments-main/tests/examplefiles/example.ns2 +69 -0
- data/vendor/pygments-main/tests/examplefiles/example.p +34 -0
- data/vendor/pygments-main/tests/examplefiles/example.pas +2708 -0
- data/vendor/pygments-main/tests/examplefiles/example.prg +161 -0
- data/vendor/pygments-main/tests/examplefiles/example.rb +1852 -0
- data/vendor/pygments-main/tests/examplefiles/example.reg +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.rexx +50 -0
- data/vendor/pygments-main/tests/examplefiles/example.rhtml +561 -0
- data/vendor/pygments-main/tests/examplefiles/example.rkt +95 -0
- data/vendor/pygments-main/tests/examplefiles/example.rpf +4 -0
- data/vendor/pygments-main/tests/examplefiles/example.sh-session +19 -0
- data/vendor/pygments-main/tests/examplefiles/example.shell-session +45 -0
- data/vendor/pygments-main/tests/examplefiles/example.sml +156 -0
- data/vendor/pygments-main/tests/examplefiles/example.snobol +15 -0
- data/vendor/pygments-main/tests/examplefiles/example.stan +108 -0
- data/vendor/pygments-main/tests/examplefiles/example.tea +34 -0
- data/vendor/pygments-main/tests/examplefiles/example.ts +28 -0
- data/vendor/pygments-main/tests/examplefiles/example.u +548 -0
- data/vendor/pygments-main/tests/examplefiles/example.weechatlog +9 -0
- data/vendor/pygments-main/tests/examplefiles/example.xhtml +376 -0
- data/vendor/pygments-main/tests/examplefiles/example.xtend +34 -0
- data/vendor/pygments-main/tests/examplefiles/example.yaml +302 -0
- data/vendor/pygments-main/tests/examplefiles/example2.aspx +29 -0
- data/vendor/pygments-main/tests/examplefiles/example2.msc +79 -0
- data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +363 -0
- data/vendor/pygments-main/tests/examplefiles/example_file.fy +128 -0
- data/vendor/pygments-main/tests/examplefiles/firefox.mak +586 -0
- data/vendor/pygments-main/tests/examplefiles/flipflop.sv +19 -0
- data/vendor/pygments-main/tests/examplefiles/foo.sce +6 -0
- data/vendor/pygments-main/tests/examplefiles/format.ml +1213 -0
- data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +77 -0
- data/vendor/pygments-main/tests/examplefiles/function.mu +1 -0
- data/vendor/pygments-main/tests/examplefiles/functional.rst +1472 -0
- data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +133 -0
- data/vendor/pygments-main/tests/examplefiles/genclass.clj +510 -0
- data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +193 -0
- data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +33 -0
- data/vendor/pygments-main/tests/examplefiles/glsl.frag +7 -0
- data/vendor/pygments-main/tests/examplefiles/glsl.vert +13 -0
- data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +22 -0
- data/vendor/pygments-main/tests/examplefiles/hello.smali +40 -0
- data/vendor/pygments-main/tests/examplefiles/hello.sp +9 -0
- data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +1 -0
- data/vendor/pygments-main/tests/examplefiles/http_request_example +15 -0
- data/vendor/pygments-main/tests/examplefiles/http_response_example +29 -0
- data/vendor/pygments-main/tests/examplefiles/import.hs +4 -0
- data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +71 -0
- data/vendor/pygments-main/tests/examplefiles/intro.ik +24 -0
- data/vendor/pygments-main/tests/examplefiles/ints.php +10 -0
- data/vendor/pygments-main/tests/examplefiles/intsyn.fun +675 -0
- data/vendor/pygments-main/tests/examplefiles/intsyn.sig +286 -0
- data/vendor/pygments-main/tests/examplefiles/irb_heredoc +8 -0
- data/vendor/pygments-main/tests/examplefiles/irc.lsp +214 -0
- data/vendor/pygments-main/tests/examplefiles/java.properties +16 -0
- data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +28 -0
- data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +45 -0
- data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +713 -0
- data/vendor/pygments-main/tests/examplefiles/json.lasso +301 -0
- data/vendor/pygments-main/tests/examplefiles/json.lasso9 +213 -0
- data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +13 -0
- data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +47 -0
- data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +41 -0
- data/vendor/pygments-main/tests/examplefiles/logos_example.xm +28 -0
- data/vendor/pygments-main/tests/examplefiles/ltmain.sh +2849 -0
- data/vendor/pygments-main/tests/examplefiles/main.cmake +42 -0
- data/vendor/pygments-main/tests/examplefiles/markdown.lsp +679 -0
- data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +3 -0
- data/vendor/pygments-main/tests/examplefiles/matlab_sample +30 -0
- data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +37 -0
- data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +455 -0
- data/vendor/pygments-main/tests/examplefiles/mg_sample.pro +73 -0
- data/vendor/pygments-main/tests/examplefiles/minehunt.qml +112 -0
- data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +4 -0
- data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +340 -0
- data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +38 -0
- data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +95 -0
- data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +96 -0
- data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +30 -0
- data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +87 -0
- data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +118 -0
- data/vendor/pygments-main/tests/examplefiles/numbers.c +12 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +32 -0
- data/vendor/pygments-main/tests/examplefiles/objc_example2.m +24 -0
- data/vendor/pygments-main/tests/examplefiles/perl_misc +62 -0
- data/vendor/pygments-main/tests/examplefiles/perl_perl5db +998 -0
- data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +120 -0
- data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +856 -0
- data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +163 -0
- data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +567 -0
- data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +1223 -0
- data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +47 -0
- data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +10 -0
- data/vendor/pygments-main/tests/examplefiles/psql_session.txt +122 -0
- data/vendor/pygments-main/tests/examplefiles/py3_test.txt +2 -0
- data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +4 -0
- data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +14 -0
- data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +2 -0
- data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +4 -0
- data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +234 -0
- data/vendor/pygments-main/tests/examplefiles/qsort.prolog +13 -0
- data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +38 -0
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +280 -0
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +2 -0
- data/vendor/pygments-main/tests/examplefiles/regex.js +22 -0
- data/vendor/pygments-main/tests/examplefiles/reversi.lsp +427 -0
- data/vendor/pygments-main/tests/examplefiles/robotframework.txt +39 -0
- data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +11 -0
- data/vendor/pygments-main/tests/examplefiles/rust_example.rs +233 -0
- data/vendor/pygments-main/tests/examplefiles/scilab.sci +30 -0
- data/vendor/pygments-main/tests/examplefiles/session.dylan-console +9 -0
- data/vendor/pygments-main/tests/examplefiles/sibling.prolog +19 -0
- data/vendor/pygments-main/tests/examplefiles/simple.md +747 -0
- data/vendor/pygments-main/tests/examplefiles/smarty_example.html +209 -0
- data/vendor/pygments-main/tests/examplefiles/source.lgt +343 -0
- data/vendor/pygments-main/tests/examplefiles/sources.list +62 -0
- data/vendor/pygments-main/tests/examplefiles/sphere.pov +18 -0
- data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +27 -0
- data/vendor/pygments-main/tests/examplefiles/squid.conf +30 -0
- data/vendor/pygments-main/tests/examplefiles/string.jl +1031 -0
- data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +21 -0
- data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +3 -0
- data/vendor/pygments-main/tests/examplefiles/swig_java.swg +1329 -0
- data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +225 -0
- data/vendor/pygments-main/tests/examplefiles/test.R +153 -0
- data/vendor/pygments-main/tests/examplefiles/test.adb +211 -0
- data/vendor/pygments-main/tests/examplefiles/test.agda +102 -0
- data/vendor/pygments-main/tests/examplefiles/test.asy +131 -0
- data/vendor/pygments-main/tests/examplefiles/test.awk +121 -0
- data/vendor/pygments-main/tests/examplefiles/test.bas +29 -0
- data/vendor/pygments-main/tests/examplefiles/test.bb +95 -0
- data/vendor/pygments-main/tests/examplefiles/test.bmx +145 -0
- data/vendor/pygments-main/tests/examplefiles/test.boo +39 -0
- data/vendor/pygments-main/tests/examplefiles/test.bro +250 -0
- data/vendor/pygments-main/tests/examplefiles/test.cs +374 -0
- data/vendor/pygments-main/tests/examplefiles/test.css +54 -0
- data/vendor/pygments-main/tests/examplefiles/test.cu +36 -0
- data/vendor/pygments-main/tests/examplefiles/test.d +135 -0
- data/vendor/pygments-main/tests/examplefiles/test.dart +23 -0
- data/vendor/pygments-main/tests/examplefiles/test.dtd +89 -0
- data/vendor/pygments-main/tests/examplefiles/test.ebnf +31 -0
- data/vendor/pygments-main/tests/examplefiles/test.ec +605 -0
- data/vendor/pygments-main/tests/examplefiles/test.ecl +58 -0
- data/vendor/pygments-main/tests/examplefiles/test.eh +315 -0
- data/vendor/pygments-main/tests/examplefiles/test.erl +169 -0
- data/vendor/pygments-main/tests/examplefiles/test.evoque +33 -0
- data/vendor/pygments-main/tests/examplefiles/test.fan +818 -0
- data/vendor/pygments-main/tests/examplefiles/test.flx +57 -0
- data/vendor/pygments-main/tests/examplefiles/test.gdc +13 -0
- data/vendor/pygments-main/tests/examplefiles/test.groovy +97 -0
- data/vendor/pygments-main/tests/examplefiles/test.html +339 -0
- data/vendor/pygments-main/tests/examplefiles/test.ini +10 -0
- data/vendor/pygments-main/tests/examplefiles/test.java +653 -0
- data/vendor/pygments-main/tests/examplefiles/test.jsp +24 -0
- data/vendor/pygments-main/tests/examplefiles/test.maql +45 -0
- data/vendor/pygments-main/tests/examplefiles/test.mod +374 -0
- data/vendor/pygments-main/tests/examplefiles/test.moo +51 -0
- data/vendor/pygments-main/tests/examplefiles/test.myt +166 -0
- data/vendor/pygments-main/tests/examplefiles/test.nim +93 -0
- data/vendor/pygments-main/tests/examplefiles/test.opa +10 -0
- data/vendor/pygments-main/tests/examplefiles/test.p6 +252 -0
- data/vendor/pygments-main/tests/examplefiles/test.pas +743 -0
- data/vendor/pygments-main/tests/examplefiles/test.php +505 -0
- data/vendor/pygments-main/tests/examplefiles/test.plot +333 -0
- data/vendor/pygments-main/tests/examplefiles/test.ps1 +108 -0
- data/vendor/pygments-main/tests/examplefiles/test.pypylog +1839 -0
- data/vendor/pygments-main/tests/examplefiles/test.r3 +94 -0
- data/vendor/pygments-main/tests/examplefiles/test.rb +177 -0
- data/vendor/pygments-main/tests/examplefiles/test.rhtml +43 -0
- data/vendor/pygments-main/tests/examplefiles/test.scaml +8 -0
- data/vendor/pygments-main/tests/examplefiles/test.ssp +12 -0
- data/vendor/pygments-main/tests/examplefiles/test.tcsh +830 -0
- data/vendor/pygments-main/tests/examplefiles/test.vb +407 -0
- data/vendor/pygments-main/tests/examplefiles/test.vhdl +161 -0
- data/vendor/pygments-main/tests/examplefiles/test.xqy +138 -0
- data/vendor/pygments-main/tests/examplefiles/test.xsl +23 -0
- data/vendor/pygments-main/tests/examplefiles/test2.pypylog +120 -0
- data/vendor/pygments-main/tests/examplefiles/truncated.pytb +15 -0
- data/vendor/pygments-main/tests/examplefiles/type.lisp +1218 -0
- data/vendor/pygments-main/tests/examplefiles/underscore.coffee +603 -0
- data/vendor/pygments-main/tests/examplefiles/unicode.applescript +5 -0
- data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +11 -0
- data/vendor/pygments-main/tests/examplefiles/unix-io.lid +37 -0
- data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +3 -0
- data/vendor/pygments-main/tests/examplefiles/while.pov +13 -0
- data/vendor/pygments-main/tests/examplefiles/wiki.factor +384 -0
- data/vendor/pygments-main/tests/examplefiles/xml_example +1897 -0
- data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +798 -0
- data/vendor/pygments-main/tests/old_run.py +138 -0
- data/vendor/pygments-main/tests/run.py +49 -0
- data/vendor/pygments-main/tests/support.py +15 -0
- data/vendor/pygments-main/tests/support/tags +36 -0
- data/vendor/pygments-main/tests/test_basic_api.py +295 -0
- data/vendor/pygments-main/tests/test_clexer.py +31 -0
- data/vendor/pygments-main/tests/test_cmdline.py +105 -0
- data/vendor/pygments-main/tests/test_examplefiles.py +99 -0
- data/vendor/pygments-main/tests/test_html_formatter.py +178 -0
- data/vendor/pygments-main/tests/test_latex_formatter.py +55 -0
- data/vendor/pygments-main/tests/test_lexers_other.py +68 -0
- data/vendor/pygments-main/tests/test_perllexer.py +137 -0
- data/vendor/pygments-main/tests/test_regexlexer.py +47 -0
- data/vendor/pygments-main/tests/test_token.py +46 -0
- data/vendor/pygments-main/tests/test_using_api.py +40 -0
- data/vendor/pygments-main/tests/test_util.py +135 -0
- data/vendor/simplejson/.gitignore +10 -0
- data/vendor/simplejson/.travis.yml +5 -0
- data/vendor/simplejson/CHANGES.txt +291 -0
- data/vendor/simplejson/LICENSE.txt +19 -0
- data/vendor/simplejson/MANIFEST.in +5 -0
- data/vendor/simplejson/README.rst +19 -0
- data/vendor/simplejson/conf.py +179 -0
- data/vendor/simplejson/index.rst +628 -0
- data/vendor/simplejson/scripts/make_docs.py +18 -0
- data/vendor/simplejson/setup.py +104 -0
- data/vendor/simplejson/simplejson/__init__.py +510 -0
- data/vendor/simplejson/simplejson/_speedups.c +2745 -0
- data/vendor/simplejson/simplejson/decoder.py +425 -0
- data/vendor/simplejson/simplejson/encoder.py +567 -0
- data/vendor/simplejson/simplejson/ordered_dict.py +119 -0
- data/vendor/simplejson/simplejson/scanner.py +77 -0
- data/vendor/simplejson/simplejson/tests/__init__.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_bigint_as_string.py +55 -0
- data/vendor/simplejson/simplejson/tests/test_check_circular.py +30 -0
- data/vendor/simplejson/simplejson/tests/test_decimal.py +66 -0
- data/vendor/simplejson/simplejson/tests/test_decode.py +83 -0
- data/vendor/simplejson/simplejson/tests/test_default.py +9 -0
- data/vendor/simplejson/simplejson/tests/test_dump.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_encode_basestring_ascii.py +46 -0
- data/vendor/simplejson/simplejson/tests/test_encode_for_html.py +32 -0
- data/vendor/simplejson/simplejson/tests/test_errors.py +34 -0
- data/vendor/simplejson/simplejson/tests/test_fail.py +91 -0
- data/vendor/simplejson/simplejson/tests/test_float.py +19 -0
- data/vendor/simplejson/simplejson/tests/test_indent.py +86 -0
- data/vendor/simplejson/simplejson/tests/test_item_sort_key.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_namedtuple.py +121 -0
- data/vendor/simplejson/simplejson/tests/test_pass1.py +76 -0
- data/vendor/simplejson/simplejson/tests/test_pass2.py +14 -0
- data/vendor/simplejson/simplejson/tests/test_pass3.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_recursion.py +67 -0
- data/vendor/simplejson/simplejson/tests/test_scanstring.py +117 -0
- data/vendor/simplejson/simplejson/tests/test_separators.py +42 -0
- data/vendor/simplejson/simplejson/tests/test_speedups.py +20 -0
- data/vendor/simplejson/simplejson/tests/test_tuple.py +49 -0
- data/vendor/simplejson/simplejson/tests/test_unicode.py +109 -0
- data/vendor/simplejson/simplejson/tool.py +39 -0
- metadata +557 -0
@@ -0,0 +1,349 @@
|
|
1
|
+
.. -*- mode: rst -*-
|
2
|
+
|
3
|
+
==============
|
4
|
+
Builtin Tokens
|
5
|
+
==============
|
6
|
+
|
7
|
+
Inside the `pygments.token` module, there is a special object called `Token`
|
8
|
+
that is used to create token types.
|
9
|
+
|
10
|
+
You can create a new token type by accessing an attribute of `Token`:
|
11
|
+
|
12
|
+
.. sourcecode:: pycon
|
13
|
+
|
14
|
+
>>> from pygments.token import Token
|
15
|
+
>>> Token.String
|
16
|
+
Token.String
|
17
|
+
>>> Token.String is Token.String
|
18
|
+
True
|
19
|
+
|
20
|
+
Note that tokens are singletons so you can use the ``is`` operator for comparing
|
21
|
+
token types.
|
22
|
+
|
23
|
+
As of Pygments 0.7 you can also use the ``in`` operator to perform set tests:
|
24
|
+
|
25
|
+
.. sourcecode:: pycon
|
26
|
+
|
27
|
+
>>> from pygments.token import Comment
|
28
|
+
>>> Comment.Single in Comment
|
29
|
+
True
|
30
|
+
>>> Comment in Comment.Multi
|
31
|
+
False
|
32
|
+
|
33
|
+
This can be useful in `filters`_ and if you write lexers on your own without
|
34
|
+
using the base lexers.
|
35
|
+
|
36
|
+
You can also split a token type into a hierarchy, and get the parent of it:
|
37
|
+
|
38
|
+
.. sourcecode:: pycon
|
39
|
+
|
40
|
+
>>> String.split()
|
41
|
+
[Token, Token.Literal, Token.Literal.String]
|
42
|
+
>>> String.parent
|
43
|
+
Token.Literal
|
44
|
+
|
45
|
+
In principle, you can create an unlimited number of token types but nobody can
|
46
|
+
guarantee that a style would define style rules for a token type. Because of
|
47
|
+
that, Pygments proposes some global token types defined in the
|
48
|
+
`pygments.token.STANDARD_TYPES` dict.
|
49
|
+
|
50
|
+
For some tokens aliases are already defined:
|
51
|
+
|
52
|
+
.. sourcecode:: pycon
|
53
|
+
|
54
|
+
>>> from pygments.token import String
|
55
|
+
>>> String
|
56
|
+
Token.Literal.String
|
57
|
+
|
58
|
+
Inside the `pygments.token` module the following aliases are defined:
|
59
|
+
|
60
|
+
============= ============================ ====================================
|
61
|
+
`Text` `Token.Text` for any type of text data
|
62
|
+
`Whitespace` `Token.Text.Whitespace` for specially highlighted whitespace
|
63
|
+
`Error` `Token.Error` represents lexer errors
|
64
|
+
`Other` `Token.Other` special token for data not
|
65
|
+
matched by a parser (e.g. HTML
|
66
|
+
markup in PHP code)
|
67
|
+
`Keyword` `Token.Keyword` any kind of keywords
|
68
|
+
`Name` `Token.Name` variable/function names
|
69
|
+
`Literal` `Token.Literal` Any literals
|
70
|
+
`String` `Token.Literal.String` string literals
|
71
|
+
`Number` `Token.Literal.Number` number literals
|
72
|
+
`Operator` `Token.Operator` operators (``+``, ``not``...)
|
73
|
+
`Punctuation` `Token.Punctuation` punctuation (``[``, ``(``...)
|
74
|
+
`Comment` `Token.Comment` any kind of comments
|
75
|
+
`Generic` `Token.Generic` generic tokens (have a look at
|
76
|
+
the explanation below)
|
77
|
+
============= ============================ ====================================
|
78
|
+
|
79
|
+
The `Whitespace` token type is new in Pygments 0.8. It is used only by the
|
80
|
+
`VisibleWhitespaceFilter` currently.
|
81
|
+
|
82
|
+
Normally you just create token types using the already defined aliases. For each
|
83
|
+
of those token aliases, a number of subtypes exists (excluding the special tokens
|
84
|
+
`Token.Text`, `Token.Error` and `Token.Other`)
|
85
|
+
|
86
|
+
The `is_token_subtype()` function in the `pygments.token` module can be used to
|
87
|
+
test if a token type is a subtype of another (such as `Name.Tag` and `Name`).
|
88
|
+
(This is the same as ``Name.Tag in Name``. The overloaded `in` operator was newly
|
89
|
+
introduced in Pygments 0.7, the function still exists for backwards
|
90
|
+
compatiblity.)
|
91
|
+
|
92
|
+
With Pygments 0.7, it's also possible to convert strings to token types (for example
|
93
|
+
if you want to supply a token from the command line):
|
94
|
+
|
95
|
+
.. sourcecode:: pycon
|
96
|
+
|
97
|
+
>>> from pygments.token import String, string_to_tokentype
|
98
|
+
>>> string_to_tokentype("String")
|
99
|
+
Token.Literal.String
|
100
|
+
>>> string_to_tokentype("Token.Literal.String")
|
101
|
+
Token.Literal.String
|
102
|
+
>>> string_to_tokentype(String)
|
103
|
+
Token.Literal.String
|
104
|
+
|
105
|
+
|
106
|
+
Keyword Tokens
|
107
|
+
==============
|
108
|
+
|
109
|
+
`Keyword`
|
110
|
+
For any kind of keyword (especially if it doesn't match any of the
|
111
|
+
subtypes of course).
|
112
|
+
|
113
|
+
`Keyword.Constant`
|
114
|
+
For keywords that are constants (e.g. ``None`` in future Python versions).
|
115
|
+
|
116
|
+
`Keyword.Declaration`
|
117
|
+
For keywords used for variable declaration (e.g. ``var`` in some programming
|
118
|
+
languages like JavaScript).
|
119
|
+
|
120
|
+
`Keyword.Namespace`
|
121
|
+
For keywords used for namespace declarations (e.g. ``import`` in Python and
|
122
|
+
Java and ``package`` in Java).
|
123
|
+
|
124
|
+
`Keyword.Pseudo`
|
125
|
+
For keywords that aren't really keywords (e.g. ``None`` in old Python
|
126
|
+
versions).
|
127
|
+
|
128
|
+
`Keyword.Reserved`
|
129
|
+
For reserved keywords.
|
130
|
+
|
131
|
+
`Keyword.Type`
|
132
|
+
For builtin types that can't be used as identifiers (e.g. ``int``,
|
133
|
+
``char`` etc. in C).
|
134
|
+
|
135
|
+
|
136
|
+
Name Tokens
|
137
|
+
===========
|
138
|
+
|
139
|
+
`Name`
|
140
|
+
For any name (variable names, function names, classes).
|
141
|
+
|
142
|
+
`Name.Attribute`
|
143
|
+
For all attributes (e.g. in HTML tags).
|
144
|
+
|
145
|
+
`Name.Builtin`
|
146
|
+
Builtin names; names that are available in the global namespace.
|
147
|
+
|
148
|
+
`Name.Builtin.Pseudo`
|
149
|
+
Builtin names that are implicit (e.g. ``self`` in Ruby, ``this`` in Java).
|
150
|
+
|
151
|
+
`Name.Class`
|
152
|
+
Class names. Because no lexer can know if a name is a class or a function
|
153
|
+
or something else this token is meant for class declarations.
|
154
|
+
|
155
|
+
`Name.Constant`
|
156
|
+
Token type for constants. In some languages you can recognise a token by the
|
157
|
+
way it's defined (the value after a ``const`` keyword for example). In
|
158
|
+
other languages constants are uppercase by definition (Ruby).
|
159
|
+
|
160
|
+
`Name.Decorator`
|
161
|
+
Token type for decorators. Decorators are synatic elements in the Python
|
162
|
+
language. Similar syntax elements exist in C# and Java.
|
163
|
+
|
164
|
+
`Name.Entity`
|
165
|
+
Token type for special entities. (e.g. `` `` in HTML).
|
166
|
+
|
167
|
+
`Name.Exception`
|
168
|
+
Token type for exception names (e.g. ``RuntimeError`` in Python). Some languages
|
169
|
+
define exceptions in the function signature (Java). You can highlight
|
170
|
+
the name of that exception using this token then.
|
171
|
+
|
172
|
+
`Name.Function`
|
173
|
+
Token type for function names.
|
174
|
+
|
175
|
+
`Name.Label`
|
176
|
+
Token type for label names (e.g. in languages that support ``goto``).
|
177
|
+
|
178
|
+
`Name.Namespace`
|
179
|
+
Token type for namespaces. (e.g. import paths in Java/Python), names following
|
180
|
+
the ``module``/``namespace`` keyword in other languages.
|
181
|
+
|
182
|
+
`Name.Other`
|
183
|
+
Other names. Normally unused.
|
184
|
+
|
185
|
+
`Name.Tag`
|
186
|
+
Tag names (in HTML/XML markup or configuration files).
|
187
|
+
|
188
|
+
`Name.Variable`
|
189
|
+
Token type for variables. Some languages have prefixes for variable names
|
190
|
+
(PHP, Ruby, Perl). You can highlight them using this token.
|
191
|
+
|
192
|
+
`Name.Variable.Class`
|
193
|
+
same as `Name.Variable` but for class variables (also static variables).
|
194
|
+
|
195
|
+
`Name.Variable.Global`
|
196
|
+
same as `Name.Variable` but for global variables (used in Ruby, for
|
197
|
+
example).
|
198
|
+
|
199
|
+
`Name.Variable.Instance`
|
200
|
+
same as `Name.Variable` but for instance variables.
|
201
|
+
|
202
|
+
|
203
|
+
Literals
|
204
|
+
========
|
205
|
+
|
206
|
+
`Literal`
|
207
|
+
For any literal (if not further defined).
|
208
|
+
|
209
|
+
`Literal.Date`
|
210
|
+
for date literals (e.g. ``42d`` in Boo).
|
211
|
+
|
212
|
+
|
213
|
+
`String`
|
214
|
+
For any string literal.
|
215
|
+
|
216
|
+
`String.Backtick`
|
217
|
+
Token type for strings enclosed in backticks.
|
218
|
+
|
219
|
+
`String.Char`
|
220
|
+
Token type for single characters (e.g. Java, C).
|
221
|
+
|
222
|
+
`String.Doc`
|
223
|
+
Token type for documentation strings (for example Python).
|
224
|
+
|
225
|
+
`String.Double`
|
226
|
+
Double quoted strings.
|
227
|
+
|
228
|
+
`String.Escape`
|
229
|
+
Token type for escape sequences in strings.
|
230
|
+
|
231
|
+
`String.Heredoc`
|
232
|
+
Token type for "heredoc" strings (e.g. in Ruby or Perl).
|
233
|
+
|
234
|
+
`String.Interpol`
|
235
|
+
Token type for interpolated parts in strings (e.g. ``#{foo}`` in Ruby).
|
236
|
+
|
237
|
+
`String.Other`
|
238
|
+
Token type for any other strings (for example ``%q{foo}`` string constructs
|
239
|
+
in Ruby).
|
240
|
+
|
241
|
+
`String.Regex`
|
242
|
+
Token type for regular expression literals (e.g. ``/foo/`` in JavaScript).
|
243
|
+
|
244
|
+
`String.Single`
|
245
|
+
Token type for single quoted strings.
|
246
|
+
|
247
|
+
`String.Symbol`
|
248
|
+
Token type for symbols (e.g. ``:foo`` in LISP or Ruby).
|
249
|
+
|
250
|
+
|
251
|
+
`Number`
|
252
|
+
Token type for any number literal.
|
253
|
+
|
254
|
+
`Number.Float`
|
255
|
+
Token type for float literals (e.g. ``42.0``).
|
256
|
+
|
257
|
+
`Number.Hex`
|
258
|
+
Token type for hexadecimal number literals (e.g. ``0xdeadbeef``).
|
259
|
+
|
260
|
+
`Number.Integer`
|
261
|
+
Token type for integer literals (e.g. ``42``).
|
262
|
+
|
263
|
+
`Number.Integer.Long`
|
264
|
+
Token type for long integer literals (e.g. ``42L`` in Python).
|
265
|
+
|
266
|
+
`Number.Oct`
|
267
|
+
Token type for octal literals.
|
268
|
+
|
269
|
+
|
270
|
+
Operators
|
271
|
+
=========
|
272
|
+
|
273
|
+
`Operator`
|
274
|
+
For any punctuation operator (e.g. ``+``, ``-``).
|
275
|
+
|
276
|
+
`Operator.Word`
|
277
|
+
For any operator that is a word (e.g. ``not``).
|
278
|
+
|
279
|
+
|
280
|
+
Punctuation
|
281
|
+
===========
|
282
|
+
|
283
|
+
*New in Pygments 0.7.*
|
284
|
+
|
285
|
+
`Punctuation`
|
286
|
+
For any punctuation which is not an operator (e.g. ``[``, ``(``...)
|
287
|
+
|
288
|
+
|
289
|
+
Comments
|
290
|
+
========
|
291
|
+
|
292
|
+
`Comment`
|
293
|
+
Token type for any comment.
|
294
|
+
|
295
|
+
`Comment.Multiline`
|
296
|
+
Token type for multiline comments.
|
297
|
+
|
298
|
+
`Comment.Preproc`
|
299
|
+
Token type for preprocessor comments (also ``<?php``/``<%`` constructs).
|
300
|
+
|
301
|
+
`Comment.Single`
|
302
|
+
Token type for comments that end at the end of a line (e.g. ``# foo``).
|
303
|
+
|
304
|
+
`Comment.Special`
|
305
|
+
Special data in comments. For example code tags, author and license
|
306
|
+
information, etc.
|
307
|
+
|
308
|
+
|
309
|
+
Generic Tokens
|
310
|
+
==============
|
311
|
+
|
312
|
+
Generic tokens are for special lexers like the `DiffLexer` that doesn't really
|
313
|
+
highlight a programming language but a patch file.
|
314
|
+
|
315
|
+
|
316
|
+
`Generic`
|
317
|
+
A generic, unstyled token. Normally you don't use this token type.
|
318
|
+
|
319
|
+
`Generic.Deleted`
|
320
|
+
Marks the token value as deleted.
|
321
|
+
|
322
|
+
`Generic.Emph`
|
323
|
+
Marks the token value as emphasized.
|
324
|
+
|
325
|
+
`Generic.Error`
|
326
|
+
Marks the token value as an error message.
|
327
|
+
|
328
|
+
`Generic.Heading`
|
329
|
+
Marks the token value as headline.
|
330
|
+
|
331
|
+
`Generic.Inserted`
|
332
|
+
Marks the token value as inserted.
|
333
|
+
|
334
|
+
`Generic.Output`
|
335
|
+
Marks the token value as program output (e.g. for python cli lexer).
|
336
|
+
|
337
|
+
`Generic.Prompt`
|
338
|
+
Marks the token value as command prompt (e.g. bash lexer).
|
339
|
+
|
340
|
+
`Generic.Strong`
|
341
|
+
Marks the token value as bold (e.g. for rst lexer).
|
342
|
+
|
343
|
+
`Generic.Subheading`
|
344
|
+
Marks the token value as subheadline.
|
345
|
+
|
346
|
+
`Generic.Traceback`
|
347
|
+
Marks the token value as a part of an error traceback.
|
348
|
+
|
349
|
+
.. _filters: filters.txt
|
@@ -0,0 +1,49 @@
|
|
1
|
+
=====================
|
2
|
+
Unicode and Encodings
|
3
|
+
=====================
|
4
|
+
|
5
|
+
Since Pygments 0.6, all lexers use unicode strings internally. Because of that
|
6
|
+
you might encounter the occasional `UnicodeDecodeError` if you pass strings with the
|
7
|
+
wrong encoding.
|
8
|
+
|
9
|
+
Per default all lexers have their input encoding set to `latin1`.
|
10
|
+
If you pass a lexer a string object (not unicode), it tries to decode the data
|
11
|
+
using this encoding.
|
12
|
+
You can override the encoding using the `encoding` lexer option. If you have the
|
13
|
+
`chardet`_ library installed and set the encoding to ``chardet`` if will ananlyse
|
14
|
+
the text and use the encoding it thinks is the right one automatically:
|
15
|
+
|
16
|
+
.. sourcecode:: python
|
17
|
+
|
18
|
+
from pygments.lexers import PythonLexer
|
19
|
+
lexer = PythonLexer(encoding='chardet')
|
20
|
+
|
21
|
+
The best way is to pass Pygments unicode objects. In that case you can't get
|
22
|
+
unexpected output.
|
23
|
+
|
24
|
+
The formatters now send Unicode objects to the stream if you don't set the
|
25
|
+
output encoding. You can do so by passing the formatters an `encoding` option:
|
26
|
+
|
27
|
+
.. sourcecode:: python
|
28
|
+
|
29
|
+
from pygments.formatters import HtmlFormatter
|
30
|
+
f = HtmlFormatter(encoding='utf-8')
|
31
|
+
|
32
|
+
**You will have to set this option if you have non-ASCII characters in the
|
33
|
+
source and the output stream does not accept Unicode written to it!**
|
34
|
+
This is the case for all regular files and for terminals.
|
35
|
+
|
36
|
+
Note: The Terminal formatter tries to be smart: if its output stream has an
|
37
|
+
`encoding` attribute, and you haven't set the option, it will encode any
|
38
|
+
Unicode string with this encoding before writing it. This is the case for
|
39
|
+
`sys.stdout`, for example. The other formatters don't have that behavior.
|
40
|
+
|
41
|
+
Another note: If you call Pygments via the command line (`pygmentize`),
|
42
|
+
encoding is handled differently, see `the command line docs <cmdline.txt>`_.
|
43
|
+
|
44
|
+
*New in Pygments 0.7*: the formatters now also accept an `outencoding` option
|
45
|
+
which will override the `encoding` option if given. This makes it possible to
|
46
|
+
use a single options dict with lexers and formatters, and still have different
|
47
|
+
input and output encodings.
|
48
|
+
|
49
|
+
.. _chardet: http://chardet.feedparser.org/
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# Best effort auto-pygmentization with transparent decompression
|
3
|
+
# (c) Reuben Thomas 2012-2013
|
4
|
+
# This program is in the public domain.
|
5
|
+
|
6
|
+
# Strategy: first see if pygmentize can find a lexer; if not, ask file; if that finds nothing, fail
|
7
|
+
# Set the environment variable PYGMENTIZE_OPTS to configure pygments.
|
8
|
+
|
9
|
+
# This program can be used as a .lessfilter for the less pager to auto-color less's output
|
10
|
+
|
11
|
+
lexer=`pygmentize -N "$1"`
|
12
|
+
if [ "$lexer" = "text" ]; then
|
13
|
+
file_common_opts="--brief --dereference --uncompress"
|
14
|
+
|
15
|
+
unset lexer
|
16
|
+
case `file --mime-type $file_common_opts "$1"` in
|
17
|
+
application/xml|image/svg+xml) lexer=xml;;
|
18
|
+
text/html) lexer=html;;
|
19
|
+
text/troff) lexer=nroff;;
|
20
|
+
text/x-asm) lexer=nasm;;
|
21
|
+
text/x-awk) lexer=awk;;
|
22
|
+
text/x-c) lexer=c;;
|
23
|
+
text/x-c++) lexer=cpp;;
|
24
|
+
text/x-diff) lexer=diff;;
|
25
|
+
text/x-fortran) lexer=fortran;;
|
26
|
+
text/x-gawk) lexer=gawk;;
|
27
|
+
text/x-java) lexer=java;;
|
28
|
+
text/x-lisp) lexer=common-lisp;;
|
29
|
+
text/x-lua) lexer=lua;;
|
30
|
+
text/x-makefile) lexer=make;;
|
31
|
+
text/x-msdos-batch) lexer=bat;;
|
32
|
+
text/x-nawk) lexer=nawk;;
|
33
|
+
text/x-pascal) lexer=pascal;;
|
34
|
+
text/x-perl) lexer=perl;;
|
35
|
+
text/x-php) lexer=php;;
|
36
|
+
text/x-po) lexer=po;;
|
37
|
+
text/x-python) lexer=python;;
|
38
|
+
text/x-ruby) lexer=ruby;;
|
39
|
+
text/x-shellscript) lexer=sh;;
|
40
|
+
text/x-tcl) lexer=tcl;;
|
41
|
+
text/x-tex|text/x-texinfo) lexer=latex;; # FIXME: texinfo really needs its own lexer
|
42
|
+
|
43
|
+
# Types that file outputs which pygmentize didn't support as of file 5.11, pygments 1.6rc1
|
44
|
+
# text/calendar
|
45
|
+
# text/PGP
|
46
|
+
# text/rtf
|
47
|
+
# text/texmacs
|
48
|
+
# text/x-bcpl
|
49
|
+
# text/x-info
|
50
|
+
# text/x-m4
|
51
|
+
# text/x-vcard
|
52
|
+
# text/x-xmcd
|
53
|
+
esac
|
54
|
+
fi
|
55
|
+
|
56
|
+
encoding=`file --brief --mime-encoding $file_common_opts "$1"`
|
57
|
+
|
58
|
+
if [ -n "$lexer" ]; then
|
59
|
+
# FIXME: Specify input encoding rather than output encoding https://bitbucket.org/birkenfeld/pygments-main/issue/800
|
60
|
+
zcat "$1" | pygmentize -O encoding=$encoding,outencoding=UTF-8 $PYGMENTIZE_OPTS -l $lexer
|
61
|
+
exit 0
|
62
|
+
fi
|
63
|
+
|
64
|
+
exit 1
|