gitlab-pygments.rb 0.3.2
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.
- data/.gitignore +6 -0
- data/Gemfile +2 -0
- data/README.md +91 -0
- data/Rakefile +78 -0
- data/bench.rb +22 -0
- data/cache-lexers.rb +8 -0
- data/lexers +0 -0
- data/lib/pygments/lexer.rb +148 -0
- data/lib/pygments/mentos.py +344 -0
- data/lib/pygments/popen.rb +389 -0
- data/lib/pygments/version.rb +3 -0
- data/lib/pygments.rb +8 -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 +276 -0
- data/vendor/custom_formatters/gitlab.py +171 -0
- data/vendor/custom_lexers/github.py +362 -0
- data/vendor/pygments-main/AUTHORS +115 -0
- data/vendor/pygments-main/CHANGES +762 -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 +43 -0
- data/vendor/pygments-main/docs/src/lexerdevelopment.txt +551 -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/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 +433 -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 +357 -0
- data/vendor/pygments-main/pygments/formatter.py +92 -0
- data/vendor/pygments-main/pygments/formatters/__init__.py +68 -0
- data/vendor/pygments-main/pygments/formatters/_mapping.py +94 -0
- data/vendor/pygments-main/pygments/formatters/bbcode.py +109 -0
- data/vendor/pygments-main/pygments/formatters/gitlab.py +171 -0
- data/vendor/pygments-main/pygments/formatters/html.py +750 -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 +117 -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 +697 -0
- data/vendor/pygments-main/pygments/lexers/__init__.py +229 -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/_luabuiltins.py +249 -0
- data/vendor/pygments-main/pygments/lexers/_mapping.py +298 -0
- data/vendor/pygments-main/pygments/lexers/_phpbuiltins.py +3787 -0
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +232 -0
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +29 -0
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +3 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +1803 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +360 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +2891 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +636 -0
- data/vendor/pygments-main/pygments/lexers/functional.py +1832 -0
- data/vendor/pygments-main/pygments/lexers/github.py +362 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +356 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +847 -0
- data/vendor/pygments-main/pygments/lexers/math.py +1072 -0
- data/vendor/pygments-main/pygments/lexers/other.py +3339 -0
- data/vendor/pygments-main/pygments/lexers/parsers.py +695 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +361 -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 +1631 -0
- data/vendor/pygments-main/pygments/lexers/text.py +1753 -0
- data/vendor/pygments-main/pygments/lexers/web.py +2864 -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 +130 -0
- data/vendor/pygments-main/pygments/util.py +232 -0
- data/vendor/pygments-main/scripts/check_sources.py +242 -0
- data/vendor/pygments-main/scripts/detect_missing_analyse_text.py +30 -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 +171 -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 +6 -0
- data/vendor/pygments-main/setup.py +88 -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/CPDictionary.j +611 -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/Errors.scala +18 -0
- data/vendor/pygments-main/tests/examplefiles/File.hy +174 -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/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/badcase.java +2 -0
- data/vendor/pygments-main/tests/examplefiles/batchfile.bat +49 -0
- data/vendor/pygments-main/tests/examplefiles/boot-9.scm +1557 -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 +40 -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.c +2080 -0
- data/vendor/pygments-main/tests/examplefiles/example.cls +15 -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.kt +47 -0
- data/vendor/pygments-main/tests/examplefiles/example.lua +250 -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.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.rb +1852 -0
- data/vendor/pygments-main/tests/examplefiles/example.rhtml +561 -0
- data/vendor/pygments-main/tests/examplefiles/example.sh-session +19 -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.tea +34 -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.yaml +302 -0
- data/vendor/pygments-main/tests/examplefiles/example2.aspx +29 -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/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/html+php_faulty.php +1 -0
- data/vendor/pygments-main/tests/examplefiles/http_request_example +14 -0
- data/vendor/pygments-main/tests/examplefiles/http_response_example +27 -0
- data/vendor/pygments-main/tests/examplefiles/import.hs +4 -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/lighttpd_config.conf +13 -0
- data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +47 -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 +27 -0
- data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +37 -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/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 +25 -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/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/pycon_test.pycon +14 -0
- data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +2 -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/ruby_func_def.rb +11 -0
- data/vendor/pygments-main/tests/examplefiles/scilab.sci +30 -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/test.R +119 -0
- data/vendor/pygments-main/tests/examplefiles/test.adb +211 -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.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.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.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.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/truncated.pytb +15 -0
- data/vendor/pygments-main/tests/examplefiles/type.lisp +1202 -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/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 +48 -0
- data/vendor/pygments-main/tests/support.py +15 -0
- data/vendor/pygments-main/tests/test_basic_api.py +294 -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 +97 -0
- data/vendor/pygments-main/tests/test_html_formatter.py +162 -0
- data/vendor/pygments-main/tests/test_latex_formatter.py +55 -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 +116 -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 +492 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Pygments regex lexer tests
|
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
5
|
+
|
|
6
|
+
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
|
|
7
|
+
:license: BSD, see LICENSE for details.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import time
|
|
11
|
+
import unittest
|
|
12
|
+
|
|
13
|
+
from pygments.token import String
|
|
14
|
+
from pygments.lexers.agile import PerlLexer
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class RunawayRegexTest(unittest.TestCase):
|
|
18
|
+
# A previous version of the Perl lexer would spend a great deal of
|
|
19
|
+
# time backtracking when given particular strings. These tests show that
|
|
20
|
+
# the runaway backtracking doesn't happen any more (at least for the given
|
|
21
|
+
# cases).
|
|
22
|
+
|
|
23
|
+
lexer = PerlLexer()
|
|
24
|
+
|
|
25
|
+
### Test helpers.
|
|
26
|
+
|
|
27
|
+
def assert_single_token(self, s, token):
|
|
28
|
+
"""Show that a given string generates only one token."""
|
|
29
|
+
tokens = list(self.lexer.get_tokens_unprocessed(s))
|
|
30
|
+
self.assertEqual(len(tokens), 1, tokens)
|
|
31
|
+
self.assertEqual(s, tokens[0][2])
|
|
32
|
+
self.assertEqual(token, tokens[0][1])
|
|
33
|
+
|
|
34
|
+
def assert_tokens(self, strings, expected_tokens):
|
|
35
|
+
"""Show that a given string generates the expected tokens."""
|
|
36
|
+
tokens = list(self.lexer.get_tokens_unprocessed(''.join(strings)))
|
|
37
|
+
self.assertEqual(len(tokens), len(expected_tokens), tokens)
|
|
38
|
+
for index, s in enumerate(strings):
|
|
39
|
+
self.assertEqual(s, tokens[index][2])
|
|
40
|
+
self.assertEqual(expected_tokens[index], tokens[index][1])
|
|
41
|
+
|
|
42
|
+
def assert_fast_tokenization(self, s):
|
|
43
|
+
"""Show that a given string is tokenized quickly."""
|
|
44
|
+
start = time.time()
|
|
45
|
+
tokens = list(self.lexer.get_tokens_unprocessed(s))
|
|
46
|
+
end = time.time()
|
|
47
|
+
# Isn't 10 seconds kind of a long time? Yes, but we don't want false
|
|
48
|
+
# positives when the tests are starved for CPU time.
|
|
49
|
+
if end-start > 10:
|
|
50
|
+
self.fail('tokenization took too long')
|
|
51
|
+
return tokens
|
|
52
|
+
|
|
53
|
+
### Strings.
|
|
54
|
+
|
|
55
|
+
def test_single_quote_strings(self):
|
|
56
|
+
self.assert_single_token(r"'foo\tbar\\\'baz'", String)
|
|
57
|
+
self.assert_fast_tokenization("'" + '\\'*999)
|
|
58
|
+
|
|
59
|
+
def test_double_quote_strings(self):
|
|
60
|
+
self.assert_single_token(r'"foo\tbar\\\"baz"', String)
|
|
61
|
+
self.assert_fast_tokenization('"' + '\\'*999)
|
|
62
|
+
|
|
63
|
+
def test_backtick_strings(self):
|
|
64
|
+
self.assert_single_token(r'`foo\tbar\\\`baz`', String.Backtick)
|
|
65
|
+
self.assert_fast_tokenization('`' + '\\'*999)
|
|
66
|
+
|
|
67
|
+
### Regex matches with various delimiters.
|
|
68
|
+
|
|
69
|
+
def test_match(self):
|
|
70
|
+
self.assert_single_token(r'/aa\tbb/', String.Regex)
|
|
71
|
+
self.assert_fast_tokenization('/' + '\\'*999)
|
|
72
|
+
|
|
73
|
+
def test_match_with_slash(self):
|
|
74
|
+
self.assert_tokens(['m', '/\n\\t\\\\/'], [String.Regex, String.Regex])
|
|
75
|
+
self.assert_fast_tokenization('m/xxx\n' + '\\'*999)
|
|
76
|
+
|
|
77
|
+
def test_match_with_bang(self):
|
|
78
|
+
self.assert_tokens(['m', r'!aa\t\!bb!'], [String.Regex, String.Regex])
|
|
79
|
+
self.assert_fast_tokenization('m!' + '\\'*999)
|
|
80
|
+
|
|
81
|
+
def test_match_with_brace(self):
|
|
82
|
+
self.assert_tokens(['m', r'{aa\t\}bb}'], [String.Regex, String.Regex])
|
|
83
|
+
self.assert_fast_tokenization('m{' + '\\'*999)
|
|
84
|
+
|
|
85
|
+
def test_match_with_angle_brackets(self):
|
|
86
|
+
self.assert_tokens(['m', r'<aa\t\>bb>'], [String.Regex, String.Regex])
|
|
87
|
+
self.assert_fast_tokenization('m<' + '\\'*999)
|
|
88
|
+
|
|
89
|
+
def test_match_with_parenthesis(self):
|
|
90
|
+
self.assert_tokens(['m', r'(aa\t\)bb)'], [String.Regex, String.Regex])
|
|
91
|
+
self.assert_fast_tokenization('m(' + '\\'*999)
|
|
92
|
+
|
|
93
|
+
def test_match_with_at_sign(self):
|
|
94
|
+
self.assert_tokens(['m', r'@aa\t\@bb@'], [String.Regex, String.Regex])
|
|
95
|
+
self.assert_fast_tokenization('m@' + '\\'*999)
|
|
96
|
+
|
|
97
|
+
def test_match_with_percent_sign(self):
|
|
98
|
+
self.assert_tokens(['m', r'%aa\t\%bb%'], [String.Regex, String.Regex])
|
|
99
|
+
self.assert_fast_tokenization('m%' + '\\'*999)
|
|
100
|
+
|
|
101
|
+
def test_match_with_dollar_sign(self):
|
|
102
|
+
self.assert_tokens(['m', r'$aa\t\$bb$'], [String.Regex, String.Regex])
|
|
103
|
+
self.assert_fast_tokenization('m$' + '\\'*999)
|
|
104
|
+
|
|
105
|
+
### Regex substitutions with various delimeters.
|
|
106
|
+
|
|
107
|
+
def test_substitution_with_slash(self):
|
|
108
|
+
self.assert_single_token('s/aaa/bbb/g', String.Regex)
|
|
109
|
+
self.assert_fast_tokenization('s/foo/' + '\\'*999)
|
|
110
|
+
|
|
111
|
+
def test_substitution_with_at_sign(self):
|
|
112
|
+
self.assert_single_token(r's@aaa@bbb@g', String.Regex)
|
|
113
|
+
self.assert_fast_tokenization('s@foo@' + '\\'*999)
|
|
114
|
+
|
|
115
|
+
def test_substitution_with_percent_sign(self):
|
|
116
|
+
self.assert_single_token(r's%aaa%bbb%g', String.Regex)
|
|
117
|
+
self.assert_fast_tokenization('s%foo%' + '\\'*999)
|
|
118
|
+
|
|
119
|
+
def test_substitution_with_brace(self):
|
|
120
|
+
self.assert_single_token(r's{aaa}', String.Regex)
|
|
121
|
+
self.assert_fast_tokenization('s{' + '\\'*999)
|
|
122
|
+
|
|
123
|
+
def test_substitution_with_angle_bracket(self):
|
|
124
|
+
self.assert_single_token(r's<aaa>', String.Regex)
|
|
125
|
+
self.assert_fast_tokenization('s<' + '\\'*999)
|
|
126
|
+
|
|
127
|
+
def test_substitution_with_angle_bracket(self):
|
|
128
|
+
self.assert_single_token(r's<aaa>', String.Regex)
|
|
129
|
+
self.assert_fast_tokenization('s<' + '\\'*999)
|
|
130
|
+
|
|
131
|
+
def test_substitution_with_square_bracket(self):
|
|
132
|
+
self.assert_single_token(r's[aaa]', String.Regex)
|
|
133
|
+
self.assert_fast_tokenization('s[' + '\\'*999)
|
|
134
|
+
|
|
135
|
+
def test_substitution_with_parenthesis(self):
|
|
136
|
+
self.assert_single_token(r's(aaa)', String.Regex)
|
|
137
|
+
self.assert_fast_tokenization('s(' + '\\'*999)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Pygments regex lexer tests
|
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
5
|
+
|
|
6
|
+
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
|
|
7
|
+
:license: BSD, see LICENSE for details.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import unittest
|
|
11
|
+
|
|
12
|
+
from pygments.token import Text
|
|
13
|
+
from pygments.lexer import RegexLexer
|
|
14
|
+
from pygments.lexer import bygroups
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TestLexer(RegexLexer):
|
|
18
|
+
"""Test tuple state transitions including #pop."""
|
|
19
|
+
tokens = {
|
|
20
|
+
'root': [
|
|
21
|
+
('a', Text.Root, 'rag'),
|
|
22
|
+
('e', Text.Root),
|
|
23
|
+
],
|
|
24
|
+
'beer': [
|
|
25
|
+
('d', Text.Beer, ('#pop', '#pop')),
|
|
26
|
+
],
|
|
27
|
+
'rag': [
|
|
28
|
+
('b', Text.Rag, '#push'),
|
|
29
|
+
('c', Text.Rag, ('#pop', 'beer')),
|
|
30
|
+
],
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class TupleTransTest(unittest.TestCase):
|
|
35
|
+
def test(self):
|
|
36
|
+
lx = TestLexer()
|
|
37
|
+
toks = list(lx.get_tokens_unprocessed('abcde'))
|
|
38
|
+
self.assertEqual(toks,
|
|
39
|
+
[(0, Text.Root, 'a'), (1, Text.Rag, 'b'), (2, Text.Rag, 'c'),
|
|
40
|
+
(3, Text.Beer, 'd'), (4, Text.Root, 'e')])
|
|
41
|
+
|
|
42
|
+
def test_multiline(self):
|
|
43
|
+
lx = TestLexer()
|
|
44
|
+
toks = list(lx.get_tokens_unprocessed('a\ne'))
|
|
45
|
+
self.assertEqual(toks,
|
|
46
|
+
[(0, Text.Root, 'a'), (1, Text, u'\n'),
|
|
47
|
+
(2, Text.Root, 'e')])
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Test suite for the token module
|
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
5
|
+
|
|
6
|
+
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
|
|
7
|
+
:license: BSD, see LICENSE for details.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import unittest
|
|
11
|
+
|
|
12
|
+
from pygments import token
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class TokenTest(unittest.TestCase):
|
|
16
|
+
|
|
17
|
+
def test_tokentype(self):
|
|
18
|
+
e = self.assertEqual
|
|
19
|
+
|
|
20
|
+
t = token.String
|
|
21
|
+
|
|
22
|
+
e(t.split(), [token.Token, token.Literal, token.String])
|
|
23
|
+
|
|
24
|
+
e(t.__class__, token._TokenType)
|
|
25
|
+
|
|
26
|
+
def test_functions(self):
|
|
27
|
+
self.assertTrue(token.is_token_subtype(token.String, token.String))
|
|
28
|
+
self.assertTrue(token.is_token_subtype(token.String, token.Literal))
|
|
29
|
+
self.assertFalse(token.is_token_subtype(token.Literal, token.String))
|
|
30
|
+
|
|
31
|
+
self.assertTrue(token.string_to_tokentype(token.String) is token.String)
|
|
32
|
+
self.assertTrue(token.string_to_tokentype('') is token.Token)
|
|
33
|
+
self.assertTrue(token.string_to_tokentype('String') is token.String)
|
|
34
|
+
|
|
35
|
+
def test_sanity_check(self):
|
|
36
|
+
stp = token.STANDARD_TYPES.copy()
|
|
37
|
+
stp[token.Token] = '---' # Token and Text do conflict, that is okay
|
|
38
|
+
t = {}
|
|
39
|
+
for k, v in stp.iteritems():
|
|
40
|
+
t.setdefault(v, []).append(k)
|
|
41
|
+
if len(t) == len(stp):
|
|
42
|
+
return # Okay
|
|
43
|
+
|
|
44
|
+
for k, v in t.iteritems():
|
|
45
|
+
if len(v) > 1:
|
|
46
|
+
self.fail("%r has more than one key: %r" % (k, v))
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Pygments tests for using()
|
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
5
|
+
|
|
6
|
+
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
|
|
7
|
+
:license: BSD, see LICENSE for details.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import unittest
|
|
11
|
+
|
|
12
|
+
from pygments.lexer import using, bygroups, this, RegexLexer
|
|
13
|
+
from pygments.token import String, Text, Keyword
|
|
14
|
+
|
|
15
|
+
class TestLexer(RegexLexer):
|
|
16
|
+
tokens = {
|
|
17
|
+
'root': [
|
|
18
|
+
(r'#.*',
|
|
19
|
+
using(this, state='invalid')),
|
|
20
|
+
(r'(")(.+?)(")',
|
|
21
|
+
bygroups(String, using(this, state='string'), String)),
|
|
22
|
+
(r'[^"]+', Text),
|
|
23
|
+
],
|
|
24
|
+
'string': [
|
|
25
|
+
(r'.+', Keyword),
|
|
26
|
+
],
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class UsingStateTest(unittest.TestCase):
|
|
31
|
+
def test_basic(self):
|
|
32
|
+
expected = [(Text, 'a'), (String, '"'), (Keyword, 'bcd'),
|
|
33
|
+
(String, '"'), (Text, 'e\n')]
|
|
34
|
+
t = list(TestLexer().get_tokens('a"bcd"e'))
|
|
35
|
+
self.assertEqual(t, expected)
|
|
36
|
+
|
|
37
|
+
def test_error(self):
|
|
38
|
+
def gen():
|
|
39
|
+
return list(TestLexer().get_tokens('#a'))
|
|
40
|
+
self.assertRaises(KeyError, gen)
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
"""
|
|
3
|
+
Test suite for the util module
|
|
4
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
5
|
+
|
|
6
|
+
:copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS.
|
|
7
|
+
:license: BSD, see LICENSE for details.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
import unittest
|
|
11
|
+
|
|
12
|
+
from pygments import util
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class FakeLexer(object):
|
|
16
|
+
def analyse(text):
|
|
17
|
+
return float(text)
|
|
18
|
+
analyse = util.make_analysator(analyse)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class UtilTest(unittest.TestCase):
|
|
22
|
+
|
|
23
|
+
def test_getoptions(self):
|
|
24
|
+
raises = self.assertRaises
|
|
25
|
+
equals = self.assertEqual
|
|
26
|
+
|
|
27
|
+
equals(util.get_bool_opt({}, 'a', True), True)
|
|
28
|
+
equals(util.get_bool_opt({}, 'a', 1), True)
|
|
29
|
+
equals(util.get_bool_opt({}, 'a', 'true'), True)
|
|
30
|
+
equals(util.get_bool_opt({}, 'a', 'no'), False)
|
|
31
|
+
raises(util.OptionError, util.get_bool_opt, {}, 'a', [])
|
|
32
|
+
raises(util.OptionError, util.get_bool_opt, {}, 'a', 'foo')
|
|
33
|
+
|
|
34
|
+
equals(util.get_int_opt({}, 'a', 1), 1)
|
|
35
|
+
raises(util.OptionError, util.get_int_opt, {}, 'a', [])
|
|
36
|
+
raises(util.OptionError, util.get_int_opt, {}, 'a', 'bar')
|
|
37
|
+
|
|
38
|
+
equals(util.get_list_opt({}, 'a', [1]), [1])
|
|
39
|
+
equals(util.get_list_opt({}, 'a', '1 2'), ['1', '2'])
|
|
40
|
+
raises(util.OptionError, util.get_list_opt, {}, 'a', 1)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_docstring_headline(self):
|
|
44
|
+
def f1():
|
|
45
|
+
"""
|
|
46
|
+
docstring headline
|
|
47
|
+
|
|
48
|
+
other text
|
|
49
|
+
"""
|
|
50
|
+
def f2():
|
|
51
|
+
"""
|
|
52
|
+
docstring
|
|
53
|
+
headline
|
|
54
|
+
|
|
55
|
+
other text
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
self.assertEqual(util.docstring_headline(f1), "docstring headline")
|
|
59
|
+
self.assertEqual(util.docstring_headline(f2), "docstring headline")
|
|
60
|
+
|
|
61
|
+
def test_analysator_returns_float(self):
|
|
62
|
+
# If an analysator wrapped by make_analysator returns a floating point
|
|
63
|
+
# number, then that number will be returned by the wrapper.
|
|
64
|
+
self.assertEqual(FakeLexer.analyse('0.5'), 0.5)
|
|
65
|
+
|
|
66
|
+
def test_analysator_returns_boolean(self):
|
|
67
|
+
# If an analysator wrapped by make_analysator returns a boolean value,
|
|
68
|
+
# then the wrapper will return 1.0 if the boolean was True or 0.0 if
|
|
69
|
+
# it was False.
|
|
70
|
+
self.assertEqual(FakeLexer.analyse(True), 1.0)
|
|
71
|
+
self.assertEqual(FakeLexer.analyse(False), 0.0)
|
|
72
|
+
|
|
73
|
+
def test_analysator_raises_exception(self):
|
|
74
|
+
# If an analysator wrapped by make_analysator raises an exception,
|
|
75
|
+
# then the wrapper will return 0.0.
|
|
76
|
+
class ErrorLexer(object):
|
|
77
|
+
def analyse(text):
|
|
78
|
+
raise RuntimeError('something bad happened')
|
|
79
|
+
analyse = util.make_analysator(analyse)
|
|
80
|
+
self.assertEqual(ErrorLexer.analyse(''), 0.0)
|
|
81
|
+
|
|
82
|
+
def test_analysator_value_error(self):
|
|
83
|
+
# When converting the analysator's return value to a float a
|
|
84
|
+
# ValueError may occur. If that happens 0.0 is returned instead.
|
|
85
|
+
self.assertEqual(FakeLexer.analyse('bad input'), 0.0)
|
|
86
|
+
|
|
87
|
+
def test_analysator_type_error(self):
|
|
88
|
+
# When converting the analysator's return value to a float a
|
|
89
|
+
# TypeError may occur. If that happens 0.0 is returned instead.
|
|
90
|
+
self.assertEqual(FakeLexer.analyse(None), 0.0)
|
|
91
|
+
|
|
92
|
+
def test_shebang_matches(self):
|
|
93
|
+
self.assertTrue(util.shebang_matches('#!/usr/bin/env python', r'python(2\.\d)?'))
|
|
94
|
+
self.assertTrue(util.shebang_matches('#!/usr/bin/python2.4', r'python(2\.\d)?'))
|
|
95
|
+
self.assertTrue(util.shebang_matches('#!/usr/bin/startsomethingwith python',
|
|
96
|
+
r'python(2\.\d)?'))
|
|
97
|
+
self.assertTrue(util.shebang_matches('#!C:\\Python2.4\\Python.exe',
|
|
98
|
+
r'python(2\.\d)?'))
|
|
99
|
+
|
|
100
|
+
self.assertFalse(util.shebang_matches('#!/usr/bin/python-ruby', r'python(2\.\d)?'))
|
|
101
|
+
self.assertFalse(util.shebang_matches('#!/usr/bin/python/ruby', r'python(2\.\d)?'))
|
|
102
|
+
self.assertFalse(util.shebang_matches('#!', r'python'))
|
|
103
|
+
|
|
104
|
+
def test_doctype_matches(self):
|
|
105
|
+
self.assertTrue(util.doctype_matches(
|
|
106
|
+
'<!DOCTYPE html PUBLIC "a"> <html>', 'html.*'))
|
|
107
|
+
self.assertFalse(util.doctype_matches(
|
|
108
|
+
'<?xml ?> <DOCTYPE html PUBLIC "a"> <html>', 'html.*'))
|
|
109
|
+
self.assertTrue(util.html_doctype_matches(
|
|
110
|
+
'<?xml ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">'))
|
|
111
|
+
|
|
112
|
+
def test_xml(self):
|
|
113
|
+
self.assertTrue(util.looks_like_xml(
|
|
114
|
+
'<?xml ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">'))
|
|
115
|
+
self.assertTrue(util.looks_like_xml('<html xmlns>abc</html>'))
|
|
116
|
+
self.assertFalse(util.looks_like_xml('<html>'))
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
Version 2.6.0 released 2012-06-26
|
|
2
|
+
|
|
3
|
+
* Error messages changed to match proposal for Python 3.3.1
|
|
4
|
+
http://bugs.python.org/issue5067
|
|
5
|
+
|
|
6
|
+
Version 2.5.2 released 2012-05-10
|
|
7
|
+
|
|
8
|
+
* Fix for regression introduced in 2.5.1
|
|
9
|
+
https://github.com/simplejson/simplejson/issues/35
|
|
10
|
+
|
|
11
|
+
Version 2.5.1 released 2012-05-10
|
|
12
|
+
|
|
13
|
+
* Support for use_decimal=True in environments that use Python
|
|
14
|
+
sub-interpreters such as uWSGI
|
|
15
|
+
https://github.com/simplejson/simplejson/issues/34
|
|
16
|
+
|
|
17
|
+
Version 2.5.0 released 2012-03-29
|
|
18
|
+
|
|
19
|
+
* New item_sort_key option for encoder to allow fine grained control of sorted
|
|
20
|
+
output
|
|
21
|
+
|
|
22
|
+
Version 2.4.0 released 2012-03-06
|
|
23
|
+
|
|
24
|
+
* New bigint_as_string option for encoder to trade JavaScript number precision
|
|
25
|
+
issues for type issues.
|
|
26
|
+
https://github.com/simplejson/simplejson/issues/31
|
|
27
|
+
|
|
28
|
+
Version 2.3.3 released 2012-02-27
|
|
29
|
+
|
|
30
|
+
* Allow unknown numerical types for indent parameter
|
|
31
|
+
https://github.com/simplejson/simplejson/pull/29
|
|
32
|
+
|
|
33
|
+
Version 2.3.2 released 2011-12-30
|
|
34
|
+
|
|
35
|
+
* Fix crashing regression in speedups introduced in 2.3.1
|
|
36
|
+
|
|
37
|
+
Version 2.3.1 released 2011-12-29
|
|
38
|
+
|
|
39
|
+
* namedtuple_as_object now checks _asdict to ensure that it
|
|
40
|
+
is callable.
|
|
41
|
+
https://github.com/simplejson/simplejson/issues/26
|
|
42
|
+
|
|
43
|
+
Version 2.3.0 released 2011-12-05
|
|
44
|
+
|
|
45
|
+
* Any objects with _asdict() methods are now considered for
|
|
46
|
+
namedtuple_as_object.
|
|
47
|
+
https://github.com/simplejson/simplejson/pull/22
|
|
48
|
+
|
|
49
|
+
Version 2.2.1 released 2011-09-06
|
|
50
|
+
|
|
51
|
+
* Fix MANIFEST.in issue when building a sdist from a sdist.
|
|
52
|
+
https://github.com/simplejson/simplejson/issues/16
|
|
53
|
+
|
|
54
|
+
Version 2.2.0 released 2011-09-04
|
|
55
|
+
|
|
56
|
+
* Remove setuptools requirement, reverted to pure distutils
|
|
57
|
+
* use_decimal default for encoding (dump, dumps, JSONEncoder) is now True
|
|
58
|
+
* tuple encoding as JSON objects can be turned off with new
|
|
59
|
+
tuple_as_array=False option.
|
|
60
|
+
https://github.com/simplejson/simplejson/pull/6
|
|
61
|
+
* namedtuple (or other tuple subclasses with _asdict methods) are now
|
|
62
|
+
encoded as JSON objects rather than arrays by default. Can be disabled
|
|
63
|
+
and treated as a tuple with the new namedtuple_as_object=False option.
|
|
64
|
+
https://github.com/simplejson/simplejson/pull/6
|
|
65
|
+
* JSONDecodeError is now raised instead of ValueError when a document
|
|
66
|
+
ends with an opening quote and the C speedups are in use.
|
|
67
|
+
https://github.com/simplejson/simplejson/issues/15
|
|
68
|
+
* Updated documentation with information about JSONDecodeError
|
|
69
|
+
* Force unicode linebreak characters to be escaped (U+2028 and U+2029)
|
|
70
|
+
http://timelessrepo.com/json-isnt-a-javascript-subset
|
|
71
|
+
* Moved documentation from a git submodule to
|
|
72
|
+
http://simplejson.readthedocs.org/
|
|
73
|
+
|
|
74
|
+
Version 2.1.6 released 2011-05-08
|
|
75
|
+
|
|
76
|
+
* Prevent segfaults with deeply nested JSON documents
|
|
77
|
+
https://github.com/simplejson/simplejson/issues/11
|
|
78
|
+
* Fix compatibility with Python 2.5
|
|
79
|
+
https://github.com/simplejson/simplejson/issues/5
|
|
80
|
+
|
|
81
|
+
Version 2.1.5 released 2011-04-17
|
|
82
|
+
|
|
83
|
+
* Built sdist tarball with setuptools_git installed. Argh.
|
|
84
|
+
|
|
85
|
+
Version 2.1.4 released 2011-04-17
|
|
86
|
+
|
|
87
|
+
* Does not try to build the extension when using PyPy
|
|
88
|
+
* Trailing whitespace after commas no longer emitted when indent is used
|
|
89
|
+
* Migrated to github http://github.com/simplejson/simplejson
|
|
90
|
+
|
|
91
|
+
Version 2.1.3 released 2011-01-17
|
|
92
|
+
|
|
93
|
+
* Support the sort_keys option in C encoding speedups
|
|
94
|
+
http://code.google.com/p/simplejson/issues/detail?id=86
|
|
95
|
+
* Allow use_decimal to work with dump()
|
|
96
|
+
http://code.google.com/p/simplejson/issues/detail?id=87
|
|
97
|
+
|
|
98
|
+
Version 2.1.2 released 2010-11-01
|
|
99
|
+
|
|
100
|
+
* Correct wrong end when object_pairs_hook is used
|
|
101
|
+
http://code.google.com/p/simplejson/issues/detail?id=85
|
|
102
|
+
* Correct output for indent=0
|
|
103
|
+
http://bugs.python.org/issue10019
|
|
104
|
+
* Correctly raise TypeError when non-string keys are used with speedups
|
|
105
|
+
http://code.google.com/p/simplejson/issues/detail?id=82
|
|
106
|
+
* Fix the endlineno, endcolno attributes of the JSONDecodeError exception.
|
|
107
|
+
http://code.google.com/p/simplejson/issues/detail?id=81
|
|
108
|
+
|
|
109
|
+
Version 2.1.1 released 2010-03-31
|
|
110
|
+
|
|
111
|
+
* Change how setup.py imports ez_setup.py to try and workaround old versions
|
|
112
|
+
of setuptools.
|
|
113
|
+
http://code.google.com/p/simplejson/issues/detail?id=75
|
|
114
|
+
* Fix compilation on Windows platform (and other platforms with very
|
|
115
|
+
picky compilers)
|
|
116
|
+
* Corrected simplejson.__version__ and other minor doc changes.
|
|
117
|
+
* Do not fail speedups tests if speedups could not be built.
|
|
118
|
+
http://code.google.com/p/simplejson/issues/detail?id=73
|
|
119
|
+
|
|
120
|
+
Version 2.1.0 released 2010-03-10
|
|
121
|
+
|
|
122
|
+
* Decimal serialization officially supported for encoding with
|
|
123
|
+
use_decimal=True. For encoding this encodes Decimal objects and
|
|
124
|
+
for decoding it implies parse_float=Decimal
|
|
125
|
+
* Python 2.4 no longer supported (may still work, but no longer tested)
|
|
126
|
+
* Decoding performance and memory utilization enhancements
|
|
127
|
+
http://bugs.python.org/issue7451
|
|
128
|
+
* JSONEncoderForHTML class for escaping &, <, >
|
|
129
|
+
http://code.google.com/p/simplejson/issues/detail?id=66
|
|
130
|
+
* Memoization of object keys during encoding (when using speedups)
|
|
131
|
+
* Encoder changed to use PyIter_Next for list iteration to avoid
|
|
132
|
+
potential threading issues
|
|
133
|
+
* Encoder changed to use iteritems rather than PyDict_Next in order to
|
|
134
|
+
support dict subclasses that have a well defined ordering
|
|
135
|
+
http://bugs.python.org/issue6105
|
|
136
|
+
* indent encoding parameter changed to be a string rather than an integer
|
|
137
|
+
(integer use still supported for backwards compatibility)
|
|
138
|
+
http://code.google.com/p/simplejson/issues/detail?id=56
|
|
139
|
+
* Test suite (python setup.py test) now automatically runs with and without
|
|
140
|
+
speedups
|
|
141
|
+
http://code.google.com/p/simplejson/issues/detail?id=55
|
|
142
|
+
* Fixed support for older versions of easy_install (e.g. stock Mac OS X config)
|
|
143
|
+
http://code.google.com/p/simplejson/issues/detail?id=54
|
|
144
|
+
* Fixed str/unicode mismatches when using ensure_ascii=False
|
|
145
|
+
http://code.google.com/p/simplejson/issues/detail?id=48
|
|
146
|
+
* Fixed error message when parsing an array with trailing comma with speedups
|
|
147
|
+
http://code.google.com/p/simplejson/issues/detail?id=46
|
|
148
|
+
* Refactor decoder errors to raise JSONDecodeError instead of ValueError
|
|
149
|
+
http://code.google.com/p/simplejson/issues/detail?id=45
|
|
150
|
+
* New ordered_pairs_hook feature in decoder which makes it possible to
|
|
151
|
+
preserve key order. http://bugs.python.org/issue5381
|
|
152
|
+
* Fixed containerless unicode float decoding (same bug as 2.0.4, oops!)
|
|
153
|
+
http://code.google.com/p/simplejson/issues/detail?id=43
|
|
154
|
+
* Share PosInf definition between encoder and decoder
|
|
155
|
+
* Minor reformatting to make it easier to backport simplejson changes
|
|
156
|
+
to Python 2.7/3.1 json module
|
|
157
|
+
|
|
158
|
+
Version 2.0.9 released 2009-02-18
|
|
159
|
+
|
|
160
|
+
* Adds cyclic GC to the Encoder and Scanner speedups, which could've
|
|
161
|
+
caused uncollectible cycles in some cases when using custom parser
|
|
162
|
+
or encoder functions
|
|
163
|
+
|
|
164
|
+
Version 2.0.8 released 2009-02-15
|
|
165
|
+
|
|
166
|
+
* Documentation fixes
|
|
167
|
+
* Fixes encoding True and False as keys
|
|
168
|
+
* Fixes checking for True and False by identity for several parameters
|
|
169
|
+
|
|
170
|
+
Version 2.0.7 released 2009-01-04
|
|
171
|
+
|
|
172
|
+
* Documentation fixes
|
|
173
|
+
* C extension now always returns unicode strings when the input string is
|
|
174
|
+
unicode, even for empty strings
|
|
175
|
+
|
|
176
|
+
Version 2.0.6 released 2008-12-19
|
|
177
|
+
|
|
178
|
+
* Windows build fixes
|
|
179
|
+
|
|
180
|
+
Version 2.0.5 released 2008-11-23
|
|
181
|
+
|
|
182
|
+
* Fixes a segfault in the C extension when using check_circular=False and
|
|
183
|
+
encoding an invalid document
|
|
184
|
+
|
|
185
|
+
Version 2.0.4 released 2008-10-24
|
|
186
|
+
|
|
187
|
+
* Fixes a parsing error in the C extension when the JSON document is (only)
|
|
188
|
+
a floating point number. It would consume one too few characters in that
|
|
189
|
+
case, and claim the document invalid.
|
|
190
|
+
|
|
191
|
+
Version 2.0.3 released 2008-10-11
|
|
192
|
+
|
|
193
|
+
* Fixes reference leaks in the encoding speedups (sorry about that!)
|
|
194
|
+
* Fixes doctest suite for Python 2.6
|
|
195
|
+
* More optimizations for the decoder
|
|
196
|
+
|
|
197
|
+
Version 2.0.2 released 2008-10-06
|
|
198
|
+
|
|
199
|
+
* Fixes MSVC2003 build regression
|
|
200
|
+
* Fixes Python 2.4 compatibility in _speedups.c
|
|
201
|
+
|
|
202
|
+
Version 2.0.1 released 2008-09-29
|
|
203
|
+
|
|
204
|
+
* Fixes long encoding regression introduced in 2.0.0
|
|
205
|
+
* Fixes MinGW build regression introduced in 2.0.0
|
|
206
|
+
|
|
207
|
+
Version 2.0.0 released 2008-09-27
|
|
208
|
+
|
|
209
|
+
* optimized Python encoding path
|
|
210
|
+
* optimized Python decoding path
|
|
211
|
+
* optimized C encoding path
|
|
212
|
+
* optimized C decoding path
|
|
213
|
+
* switched to sphinx docs (nearly the same as the json module in python 2.6)
|
|
214
|
+
|
|
215
|
+
Version 1.9.3 released 2008-09-23
|
|
216
|
+
|
|
217
|
+
* Decoding is significantly faster (for our internal benchmarks)
|
|
218
|
+
* Pretty-printing tool changed from simplejson to simplejson.tool for better
|
|
219
|
+
Python 2.6 comaptibility
|
|
220
|
+
* Misc. bug fixes
|
|
221
|
+
|
|
222
|
+
Version 1.9 released 2008-05-03
|
|
223
|
+
|
|
224
|
+
* Rewrote test suite with unittest and doctest (no more nosetest dependency)
|
|
225
|
+
* Better PEP 7 and PEP 8 source compliance
|
|
226
|
+
* Removed simplejson.jsonfilter demo module
|
|
227
|
+
* simplejson.jsonfilter is no longer included
|
|
228
|
+
|
|
229
|
+
Version 1.8.1 released 2008-03-24
|
|
230
|
+
|
|
231
|
+
* Optional C extension for accelerating the decoding of JSON strings
|
|
232
|
+
* Command line interface for pretty-printing JSON (via python -msimplejson)
|
|
233
|
+
* Decoding of integers and floats is now extensible (e.g. to use Decimal) via
|
|
234
|
+
parse_int, parse_float options.
|
|
235
|
+
* Subversion and issue tracker moved to google code:
|
|
236
|
+
http://code.google.com/p/simplejson/
|
|
237
|
+
* "/" is no longer escaped, so if you're embedding JSON directly in HTML
|
|
238
|
+
you'll want to use .replace("/", "\\/") to prevent a close-tag attack.
|
|
239
|
+
|
|
240
|
+
Version 1.7 released 2007-03-18
|
|
241
|
+
|
|
242
|
+
* Improves encoding performance with an optional C extension to speed up
|
|
243
|
+
str/unicode encoding (by 10-150x or so), which yields an overall speed
|
|
244
|
+
boost of 2x+ (JSON is string-heavy).
|
|
245
|
+
* Support for encoding unicode code points outside the BMP to UTF-16
|
|
246
|
+
surrogate code pairs (specified by the Strings section of RFC 4627).
|
|
247
|
+
|
|
248
|
+
Version 1.6 released 2007-03-03
|
|
249
|
+
|
|
250
|
+
* Improved str support for encoding. Previous versions of simplejson
|
|
251
|
+
integrated strings directly into the output stream, this version ensures
|
|
252
|
+
they're of a particular encoding (default is UTF-8) so that the output
|
|
253
|
+
stream is valid.
|
|
254
|
+
|
|
255
|
+
Version 1.5 released 2007-01-18
|
|
256
|
+
|
|
257
|
+
* Better Python 2.5 compatibility
|
|
258
|
+
* Better Windows compatibility
|
|
259
|
+
* indent encoding parameter for pretty printing
|
|
260
|
+
* separators encoding parameter for generating optimally compact JSON
|
|
261
|
+
|
|
262
|
+
Version 1.3 released 2006-04-01
|
|
263
|
+
|
|
264
|
+
* The optional object_hook function is called upon decoding of any JSON
|
|
265
|
+
object literal, and its return value is used instead of the dict that
|
|
266
|
+
would normally be used. This can be used to efficiently implement
|
|
267
|
+
features such as JSON-RPC class hinting, or other custom decodings of
|
|
268
|
+
JSON. See the documentation for more information.
|
|
269
|
+
|
|
270
|
+
Version 1.1 released 2005-12-31
|
|
271
|
+
|
|
272
|
+
* Renamed from simple_json to simplejson to comply with PEP 8 module naming
|
|
273
|
+
guidelines
|
|
274
|
+
* Full set of documentation
|
|
275
|
+
* More tests
|
|
276
|
+
* The encoder and decoder have been extended to understand NaN, Infinity, and
|
|
277
|
+
-Infinity (but this can be turned off via allow_nan=False for strict JSON
|
|
278
|
+
compliance)
|
|
279
|
+
* The decoder's scanner has been fixed so that it no longer accepts invalid
|
|
280
|
+
JSON documents
|
|
281
|
+
* The decoder now reports line and column information as well as character
|
|
282
|
+
numbers for easier debugging
|
|
283
|
+
* The encoder now has a circular reference checker, which can be optionally
|
|
284
|
+
disabled with check_circular=False
|
|
285
|
+
* dump, dumps, load, loads now accept an optional cls kwarg to use an
|
|
286
|
+
alternate JSONEncoder or JSONDecoder class for convenience.
|
|
287
|
+
* The read/write compatibility shim for json-py now have deprecation warnings
|
|
288
|
+
|
|
289
|
+
Version 1.0 released 2005-12-25
|
|
290
|
+
|
|
291
|
+
* Initial release
|