pygments.rb 0.6.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +11 -0
- data/README.md +6 -6
- data/Rakefile +2 -1
- data/cache-lexers.rb +1 -1
- data/circle.yml +7 -0
- data/lib/pygments/lexer.rb +3 -3
- data/lib/pygments/popen.rb +67 -30
- data/lib/pygments/version.rb +1 -1
- data/pygments.rb.gemspec +2 -1
- data/test/test_pygments.rb +16 -16
- data/vendor/pygments-main/AUTHORS +54 -8
- data/vendor/pygments-main/CHANGES +247 -25
- data/vendor/pygments-main/LICENSE +1 -1
- data/vendor/pygments-main/Makefile +15 -6
- data/vendor/pygments-main/README.rst +39 -0
- data/vendor/pygments-main/REVISION +1 -1
- data/vendor/pygments-main/TODO +0 -3
- data/vendor/pygments-main/doc/_themes/pygments14/layout.html +1 -1
- data/vendor/pygments-main/doc/_themes/pygments14/static/pygments14.css_t +1 -1
- data/vendor/pygments-main/doc/conf.py +3 -11
- data/vendor/pygments-main/doc/docs/api.rst +15 -0
- data/vendor/pygments-main/doc/docs/cmdline.rst +6 -2
- data/vendor/pygments-main/doc/docs/filterdevelopment.rst +4 -3
- data/vendor/pygments-main/doc/docs/integrate.rst +11 -15
- data/vendor/pygments-main/doc/docs/java.rst +7 -7
- data/vendor/pygments-main/doc/docs/lexerdevelopment.rst +258 -171
- data/vendor/pygments-main/doc/docs/lexers.rst +2 -2
- data/vendor/pygments-main/doc/docs/styles.rst +58 -0
- data/vendor/pygments-main/doc/docs/tokens.rst +22 -2
- data/vendor/pygments-main/doc/docs/unicode.rst +15 -7
- data/vendor/pygments-main/doc/faq.rst +17 -21
- data/vendor/pygments-main/doc/index.rst +12 -11
- data/vendor/pygments-main/doc/languages.rst +10 -7
- data/vendor/pygments-main/external/autopygmentize +9 -6
- data/vendor/pygments-main/external/lasso-builtins-generator-9.lasso +70 -52
- data/vendor/pygments-main/external/markdown-processor.py +1 -1
- data/vendor/pygments-main/external/moin-parser.py +1 -1
- data/vendor/pygments-main/external/rst-directive.py +1 -1
- data/vendor/pygments-main/pygmentize +2 -1
- data/vendor/pygments-main/pygments/__init__.py +14 -15
- data/vendor/pygments-main/pygments/cmdline.py +188 -113
- data/vendor/pygments-main/pygments/console.py +13 -13
- data/vendor/pygments-main/pygments/filter.py +7 -7
- data/vendor/pygments-main/pygments/filters/__init__.py +24 -32
- data/vendor/pygments-main/pygments/formatter.py +5 -5
- data/vendor/pygments-main/pygments/formatters/__init__.py +92 -44
- data/vendor/pygments-main/pygments/formatters/_mapping.py +51 -69
- data/vendor/pygments-main/pygments/formatters/bbcode.py +1 -1
- data/vendor/pygments-main/pygments/formatters/html.py +63 -51
- data/vendor/pygments-main/pygments/formatters/img.py +25 -22
- data/vendor/pygments-main/pygments/formatters/irc.py +182 -0
- data/vendor/pygments-main/pygments/formatters/latex.py +34 -22
- data/vendor/pygments-main/pygments/formatters/other.py +5 -7
- data/vendor/pygments-main/pygments/formatters/rtf.py +28 -31
- data/vendor/pygments-main/pygments/formatters/svg.py +1 -2
- data/vendor/pygments-main/pygments/formatters/terminal.py +29 -45
- data/vendor/pygments-main/pygments/formatters/terminal256.py +118 -31
- data/vendor/pygments-main/pygments/lexer.py +120 -34
- data/vendor/pygments-main/pygments/lexers/__init__.py +85 -53
- data/vendor/pygments-main/pygments/lexers/{_asybuiltins.py → _asy_builtins.py} +7 -7
- data/vendor/pygments-main/pygments/lexers/{_clbuiltins.py → _cl_builtins.py} +17 -17
- data/vendor/pygments-main/pygments/lexers/_cocoa_builtins.py +72 -0
- data/vendor/pygments-main/pygments/lexers/_csound_builtins.py +1346 -0
- data/vendor/pygments-main/pygments/lexers/{_lassobuiltins.py → _lasso_builtins.py} +4699 -4561
- data/vendor/pygments-main/pygments/lexers/{_luabuiltins.py → _lua_builtins.py} +91 -51
- data/vendor/pygments-main/pygments/lexers/_mapping.py +342 -242
- data/vendor/pygments-main/pygments/lexers/_mql_builtins.py +1172 -0
- data/vendor/pygments-main/pygments/lexers/_openedge_builtins.py +2547 -0
- data/vendor/pygments-main/pygments/lexers/{_phpbuiltins.py → _php_builtins.py} +350 -353
- data/vendor/pygments-main/pygments/lexers/_postgres_builtins.py +600 -212
- data/vendor/pygments-main/pygments/lexers/_scilab_builtins.py +3084 -30
- data/vendor/pygments-main/pygments/lexers/_sourcemod_builtins.py +1163 -0
- data/vendor/pygments-main/pygments/lexers/_stan_builtins.py +91 -13
- data/vendor/pygments-main/pygments/lexers/_stata_builtins.py +419 -0
- data/vendor/pygments-main/pygments/lexers/_tsql_builtins.py +1004 -0
- data/vendor/pygments-main/pygments/lexers/_vim_builtins.py +1939 -0
- data/vendor/pygments-main/pygments/lexers/actionscript.py +240 -0
- data/vendor/pygments-main/pygments/lexers/agile.py +14 -2542
- data/vendor/pygments-main/pygments/lexers/algebra.py +221 -0
- data/vendor/pygments-main/pygments/lexers/ambient.py +76 -0
- data/vendor/pygments-main/pygments/lexers/ampl.py +87 -0
- data/vendor/pygments-main/pygments/lexers/apl.py +101 -0
- data/vendor/pygments-main/pygments/lexers/archetype.py +318 -0
- data/vendor/pygments-main/pygments/lexers/asm.py +276 -81
- data/vendor/pygments-main/pygments/lexers/automation.py +374 -0
- data/vendor/pygments-main/pygments/lexers/basic.py +500 -0
- data/vendor/pygments-main/pygments/lexers/bibtex.py +156 -0
- data/vendor/pygments-main/pygments/lexers/business.py +594 -0
- data/vendor/pygments-main/pygments/lexers/c_cpp.py +252 -0
- data/vendor/pygments-main/pygments/lexers/c_like.py +541 -0
- data/vendor/pygments-main/pygments/lexers/capnproto.py +79 -0
- data/vendor/pygments-main/pygments/lexers/chapel.py +101 -0
- data/vendor/pygments-main/pygments/lexers/clean.py +288 -0
- data/vendor/pygments-main/pygments/lexers/compiled.py +24 -5182
- data/vendor/pygments-main/pygments/lexers/configs.py +833 -0
- data/vendor/pygments-main/pygments/lexers/console.py +114 -0
- data/vendor/pygments-main/pygments/lexers/crystal.py +384 -0
- data/vendor/pygments-main/pygments/lexers/csound.py +366 -0
- data/vendor/pygments-main/pygments/lexers/css.py +689 -0
- data/vendor/pygments-main/pygments/lexers/d.py +251 -0
- data/vendor/pygments-main/pygments/lexers/dalvik.py +6 -6
- data/vendor/pygments-main/pygments/lexers/data.py +555 -0
- data/vendor/pygments-main/pygments/lexers/diff.py +165 -0
- data/vendor/pygments-main/pygments/lexers/dotnet.py +96 -88
- data/vendor/pygments-main/pygments/lexers/dsls.py +878 -0
- data/vendor/pygments-main/pygments/lexers/dylan.py +289 -0
- data/vendor/pygments-main/pygments/lexers/ecl.py +125 -0
- data/vendor/pygments-main/pygments/lexers/eiffel.py +65 -0
- data/vendor/pygments-main/pygments/lexers/elm.py +121 -0
- data/vendor/pygments-main/pygments/lexers/erlang.py +533 -0
- data/vendor/pygments-main/pygments/lexers/esoteric.py +275 -0
- data/vendor/pygments-main/pygments/lexers/ezhil.py +68 -0
- data/vendor/pygments-main/pygments/lexers/factor.py +344 -0
- data/vendor/pygments-main/pygments/lexers/fantom.py +250 -0
- data/vendor/pygments-main/pygments/lexers/felix.py +273 -0
- data/vendor/pygments-main/pygments/lexers/forth.py +177 -0
- data/vendor/pygments-main/pygments/lexers/fortran.py +205 -0
- data/vendor/pygments-main/pygments/lexers/foxpro.py +1 -1
- data/vendor/pygments-main/pygments/lexers/functional.py +11 -3661
- data/vendor/pygments-main/pygments/lexers/go.py +101 -0
- data/vendor/pygments-main/pygments/lexers/grammar_notation.py +213 -0
- data/vendor/pygments-main/pygments/lexers/graph.py +7 -8
- data/vendor/pygments-main/pygments/lexers/graphics.py +553 -0
- data/vendor/pygments-main/pygments/lexers/haskell.py +840 -0
- data/vendor/pygments-main/pygments/lexers/haxe.py +936 -0
- data/vendor/pygments-main/pygments/lexers/hdl.py +172 -145
- data/vendor/pygments-main/pygments/lexers/hexdump.py +97 -0
- data/vendor/pygments-main/pygments/lexers/html.py +602 -0
- data/vendor/pygments-main/pygments/lexers/idl.py +270 -0
- data/vendor/pygments-main/pygments/lexers/igor.py +288 -0
- data/vendor/pygments-main/pygments/lexers/inferno.py +3 -3
- data/vendor/pygments-main/pygments/lexers/installers.py +322 -0
- data/vendor/pygments-main/pygments/lexers/int_fiction.py +1343 -0
- data/vendor/pygments-main/pygments/lexers/iolang.py +63 -0
- data/vendor/pygments-main/pygments/lexers/j.py +146 -0
- data/vendor/pygments-main/pygments/lexers/javascript.py +1506 -0
- data/vendor/pygments-main/pygments/lexers/julia.py +333 -0
- data/vendor/pygments-main/pygments/lexers/jvm.py +232 -186
- data/vendor/pygments-main/pygments/lexers/lisp.py +2621 -0
- data/vendor/pygments-main/pygments/lexers/make.py +202 -0
- data/vendor/pygments-main/pygments/lexers/markup.py +595 -0
- data/vendor/pygments-main/pygments/lexers/math.py +11 -2276
- data/vendor/pygments-main/pygments/lexers/matlab.py +663 -0
- data/vendor/pygments-main/pygments/lexers/ml.py +769 -0
- data/vendor/pygments-main/pygments/lexers/modeling.py +358 -0
- data/vendor/pygments-main/pygments/lexers/modula2.py +1561 -0
- data/vendor/pygments-main/pygments/lexers/monte.py +203 -0
- data/vendor/pygments-main/pygments/lexers/ncl.py +1053 -0
- data/vendor/pygments-main/pygments/lexers/nimrod.py +159 -0
- data/vendor/pygments-main/pygments/lexers/nit.py +64 -0
- data/vendor/pygments-main/pygments/lexers/nix.py +136 -0
- data/vendor/pygments-main/pygments/lexers/oberon.py +105 -0
- data/vendor/pygments-main/pygments/lexers/objective.py +504 -0
- data/vendor/pygments-main/pygments/lexers/ooc.py +85 -0
- data/vendor/pygments-main/pygments/lexers/other.py +30 -4481
- data/vendor/pygments-main/pygments/lexers/parasail.py +79 -0
- data/vendor/pygments-main/pygments/lexers/parsers.py +171 -114
- data/vendor/pygments-main/pygments/lexers/pascal.py +644 -0
- data/vendor/pygments-main/pygments/lexers/pawn.py +199 -0
- data/vendor/pygments-main/pygments/lexers/perl.py +616 -0
- data/vendor/pygments-main/pygments/lexers/php.py +267 -0
- data/vendor/pygments-main/pygments/lexers/praat.py +294 -0
- data/vendor/pygments-main/pygments/lexers/prolog.py +306 -0
- data/vendor/pygments-main/pygments/lexers/python.py +938 -0
- data/vendor/pygments-main/pygments/lexers/qvt.py +152 -0
- data/vendor/pygments-main/pygments/lexers/r.py +453 -0
- data/vendor/pygments-main/pygments/lexers/rdf.py +195 -24
- data/vendor/pygments-main/pygments/lexers/rebol.py +431 -0
- data/vendor/pygments-main/pygments/lexers/resource.py +85 -0
- data/vendor/pygments-main/pygments/lexers/rnc.py +67 -0
- data/vendor/pygments-main/pygments/lexers/roboconf.py +82 -0
- data/vendor/pygments-main/pygments/lexers/{_robotframeworklexer.py → robotframework.py} +20 -18
- data/vendor/pygments-main/pygments/lexers/ruby.py +519 -0
- data/vendor/pygments-main/pygments/lexers/rust.py +209 -0
- data/vendor/pygments-main/pygments/lexers/sas.py +228 -0
- data/vendor/pygments-main/pygments/lexers/scripting.py +1222 -0
- data/vendor/pygments-main/pygments/lexers/shell.py +478 -115
- data/vendor/pygments-main/pygments/lexers/smalltalk.py +195 -0
- data/vendor/pygments-main/pygments/lexers/smv.py +75 -0
- data/vendor/pygments-main/pygments/lexers/snobol.py +83 -0
- data/vendor/pygments-main/pygments/lexers/special.py +6 -2
- data/vendor/pygments-main/pygments/lexers/sql.py +209 -120
- data/vendor/pygments-main/pygments/lexers/stata.py +106 -0
- data/vendor/pygments-main/pygments/lexers/supercollider.py +90 -0
- data/vendor/pygments-main/pygments/lexers/tcl.py +145 -0
- data/vendor/pygments-main/pygments/lexers/templates.py +282 -90
- data/vendor/pygments-main/pygments/lexers/testing.py +207 -0
- data/vendor/pygments-main/pygments/lexers/text.py +15 -2045
- data/vendor/pygments-main/pygments/lexers/textedit.py +169 -0
- data/vendor/pygments-main/pygments/lexers/textfmts.py +297 -0
- data/vendor/pygments-main/pygments/lexers/theorem.py +458 -0
- data/vendor/pygments-main/pygments/lexers/trafficscript.py +54 -0
- data/vendor/pygments-main/pygments/lexers/typoscript.py +225 -0
- data/vendor/pygments-main/pygments/lexers/urbi.py +133 -0
- data/vendor/pygments-main/pygments/lexers/varnish.py +190 -0
- data/vendor/pygments-main/pygments/lexers/verification.py +111 -0
- data/vendor/pygments-main/pygments/lexers/web.py +13 -4499
- data/vendor/pygments-main/pygments/lexers/webmisc.py +979 -0
- data/vendor/pygments-main/pygments/lexers/whiley.py +117 -0
- data/vendor/pygments-main/pygments/lexers/x10.py +69 -0
- data/vendor/pygments-main/pygments/modeline.py +5 -2
- data/vendor/pygments-main/pygments/plugin.py +1 -1
- data/vendor/pygments-main/pygments/regexopt.py +92 -0
- data/vendor/pygments-main/pygments/scanner.py +3 -2
- data/vendor/pygments-main/pygments/sphinxext.py +11 -6
- data/vendor/pygments-main/pygments/style.py +41 -4
- data/vendor/pygments-main/pygments/styles/__init__.py +5 -1
- data/vendor/pygments-main/pygments/styles/algol.py +63 -0
- data/vendor/pygments-main/pygments/styles/algol_nu.py +63 -0
- data/vendor/pygments-main/pygments/styles/arduino.py +98 -0
- data/vendor/pygments-main/pygments/styles/autumn.py +1 -1
- data/vendor/pygments-main/pygments/styles/borland.py +1 -1
- data/vendor/pygments-main/pygments/styles/bw.py +1 -1
- data/vendor/pygments-main/pygments/styles/colorful.py +1 -1
- data/vendor/pygments-main/pygments/styles/default.py +1 -1
- data/vendor/pygments-main/pygments/styles/emacs.py +1 -1
- data/vendor/pygments-main/pygments/styles/friendly.py +1 -1
- data/vendor/pygments-main/pygments/styles/fruity.py +1 -1
- data/vendor/pygments-main/pygments/styles/igor.py +1 -1
- data/vendor/pygments-main/pygments/styles/lovelace.py +97 -0
- data/vendor/pygments-main/pygments/styles/manni.py +1 -1
- data/vendor/pygments-main/pygments/styles/monokai.py +1 -1
- data/vendor/pygments-main/pygments/styles/murphy.py +1 -1
- data/vendor/pygments-main/pygments/styles/native.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_dark.py +1 -1
- data/vendor/pygments-main/pygments/styles/paraiso_light.py +1 -1
- data/vendor/pygments-main/pygments/styles/pastie.py +1 -1
- data/vendor/pygments-main/pygments/styles/perldoc.py +2 -2
- data/vendor/pygments-main/pygments/styles/rrt.py +1 -1
- data/vendor/pygments-main/pygments/styles/sas.py +41 -0
- data/vendor/pygments-main/pygments/styles/stata.py +37 -0
- data/vendor/pygments-main/pygments/styles/tango.py +1 -1
- data/vendor/pygments-main/pygments/styles/trac.py +1 -1
- data/vendor/pygments-main/pygments/styles/vim.py +1 -1
- data/vendor/pygments-main/pygments/styles/vs.py +1 -1
- data/vendor/pygments-main/pygments/styles/xcode.py +1 -1
- data/vendor/pygments-main/pygments/token.py +31 -16
- data/vendor/pygments-main/pygments/unistring.py +141 -65
- data/vendor/pygments-main/pygments/util.py +129 -33
- data/vendor/pygments-main/requirements.txt +5 -0
- data/vendor/pygments-main/scripts/check_sources.py +25 -40
- data/vendor/pygments-main/scripts/debug_lexer.py +246 -0
- data/vendor/pygments-main/scripts/find_error.py +1 -0
- data/vendor/pygments-main/scripts/get_vimkw.py +35 -4
- data/vendor/pygments-main/setup.cfg +3 -0
- data/vendor/pygments-main/setup.py +17 -30
- data/vendor/pygments-main/tox.ini +7 -0
- metadata +159 -387
- data/vendor/pygments-main/ez_setup.py +0 -382
- data/vendor/pygments-main/pygments/lexers/_cocoabuiltins.py +0 -73
- data/vendor/pygments-main/pygments/lexers/_openedgebuiltins.py +0 -562
- data/vendor/pygments-main/pygments/lexers/_sourcemodbuiltins.py +0 -1077
- data/vendor/pygments-main/pygments/lexers/_vimbuiltins.py +0 -13
- data/vendor/pygments-main/pygments/lexers/qbasic.py +0 -157
- data/vendor/pygments-main/scripts/find_codetags.py +0 -213
- data/vendor/pygments-main/scripts/find_error.py +0 -173
- data/vendor/pygments-main/tests/dtds/HTML4-f.dtd +0 -37
- data/vendor/pygments-main/tests/dtds/HTML4-s.dtd +0 -869
- data/vendor/pygments-main/tests/dtds/HTML4.dcl +0 -88
- data/vendor/pygments-main/tests/dtds/HTML4.dtd +0 -1092
- data/vendor/pygments-main/tests/dtds/HTML4.soc +0 -9
- data/vendor/pygments-main/tests/dtds/HTMLlat1.ent +0 -195
- data/vendor/pygments-main/tests/dtds/HTMLspec.ent +0 -77
- data/vendor/pygments-main/tests/dtds/HTMLsym.ent +0 -241
- data/vendor/pygments-main/tests/examplefiles/99_bottles_of_beer.chpl +0 -118
- data/vendor/pygments-main/tests/examplefiles/AcidStateAdvanced.hs +0 -209
- data/vendor/pygments-main/tests/examplefiles/AlternatingGroup.mu +0 -102
- data/vendor/pygments-main/tests/examplefiles/BOM.js +0 -1
- data/vendor/pygments-main/tests/examplefiles/CPDictionary.j +0 -611
- data/vendor/pygments-main/tests/examplefiles/Config.in.cache +0 -1973
- data/vendor/pygments-main/tests/examplefiles/Constants.mo +0 -158
- data/vendor/pygments-main/tests/examplefiles/DancingSudoku.lhs +0 -411
- data/vendor/pygments-main/tests/examplefiles/Deflate.fs +0 -578
- data/vendor/pygments-main/tests/examplefiles/Error.pmod +0 -38
- data/vendor/pygments-main/tests/examplefiles/Errors.scala +0 -18
- data/vendor/pygments-main/tests/examplefiles/FakeFile.pike +0 -360
- data/vendor/pygments-main/tests/examplefiles/Get-CommandDefinitionHtml.ps1 +0 -66
- data/vendor/pygments-main/tests/examplefiles/IPDispatchC.nc +0 -104
- data/vendor/pygments-main/tests/examplefiles/IPDispatchP.nc +0 -671
- data/vendor/pygments-main/tests/examplefiles/Intro.java +0 -1660
- data/vendor/pygments-main/tests/examplefiles/Makefile +0 -1131
- data/vendor/pygments-main/tests/examplefiles/Object.st +0 -4394
- data/vendor/pygments-main/tests/examplefiles/OrderedMap.hx +0 -584
- data/vendor/pygments-main/tests/examplefiles/RoleQ.pm6 +0 -23
- data/vendor/pygments-main/tests/examplefiles/SmallCheck.hs +0 -378
- data/vendor/pygments-main/tests/examplefiles/Sorting.mod +0 -470
- data/vendor/pygments-main/tests/examplefiles/Sudoku.lhs +0 -382
- data/vendor/pygments-main/tests/examplefiles/addressbook.proto +0 -30
- data/vendor/pygments-main/tests/examplefiles/antlr_ANTLRv3.g +0 -608
- data/vendor/pygments-main/tests/examplefiles/antlr_throws +0 -1
- data/vendor/pygments-main/tests/examplefiles/apache2.conf +0 -393
- data/vendor/pygments-main/tests/examplefiles/as3_test.as +0 -143
- data/vendor/pygments-main/tests/examplefiles/as3_test2.as +0 -46
- data/vendor/pygments-main/tests/examplefiles/as3_test3.as +0 -3
- data/vendor/pygments-main/tests/examplefiles/aspx-cs_example +0 -27
- data/vendor/pygments-main/tests/examplefiles/autoit_submit.au3 +0 -25
- data/vendor/pygments-main/tests/examplefiles/badcase.java +0 -2
- data/vendor/pygments-main/tests/examplefiles/batchfile.bat +0 -49
- data/vendor/pygments-main/tests/examplefiles/bigtest.nsi +0 -308
- data/vendor/pygments-main/tests/examplefiles/boot-9.scm +0 -1557
- data/vendor/pygments-main/tests/examplefiles/ca65_example +0 -284
- data/vendor/pygments-main/tests/examplefiles/cbmbas_example +0 -9
- data/vendor/pygments-main/tests/examplefiles/cells.ps +0 -515
- data/vendor/pygments-main/tests/examplefiles/ceval.c +0 -2604
- data/vendor/pygments-main/tests/examplefiles/cheetah_example.html +0 -13
- data/vendor/pygments-main/tests/examplefiles/classes.dylan +0 -125
- data/vendor/pygments-main/tests/examplefiles/clojure-weird-keywords.clj +0 -5
- data/vendor/pygments-main/tests/examplefiles/condensed_ruby.rb +0 -10
- data/vendor/pygments-main/tests/examplefiles/coq_RelationClasses +0 -447
- data/vendor/pygments-main/tests/examplefiles/core.cljs +0 -52
- data/vendor/pygments-main/tests/examplefiles/database.pytb +0 -20
- data/vendor/pygments-main/tests/examplefiles/de.MoinMoin.po +0 -2461
- data/vendor/pygments-main/tests/examplefiles/demo.ahk +0 -181
- data/vendor/pygments-main/tests/examplefiles/demo.cfm +0 -50
- data/vendor/pygments-main/tests/examplefiles/demo.hbs +0 -12
- data/vendor/pygments-main/tests/examplefiles/django_sample.html+django +0 -68
- data/vendor/pygments-main/tests/examplefiles/dwarf.cw +0 -17
- data/vendor/pygments-main/tests/examplefiles/ember.handlebars +0 -33
- data/vendor/pygments-main/tests/examplefiles/erl_session +0 -10
- data/vendor/pygments-main/tests/examplefiles/escape_semicolon.clj +0 -1
- data/vendor/pygments-main/tests/examplefiles/evil_regex.js +0 -48
- data/vendor/pygments-main/tests/examplefiles/example.Rd +0 -78
- data/vendor/pygments-main/tests/examplefiles/example.als +0 -217
- data/vendor/pygments-main/tests/examplefiles/example.bug +0 -54
- data/vendor/pygments-main/tests/examplefiles/example.c +0 -2080
- data/vendor/pygments-main/tests/examplefiles/example.ceylon +0 -52
- data/vendor/pygments-main/tests/examplefiles/example.chai +0 -6
- data/vendor/pygments-main/tests/examplefiles/example.clay +0 -33
- data/vendor/pygments-main/tests/examplefiles/example.cls +0 -15
- data/vendor/pygments-main/tests/examplefiles/example.cob +0 -3556
- data/vendor/pygments-main/tests/examplefiles/example.coffee +0 -27
- data/vendor/pygments-main/tests/examplefiles/example.cpp +0 -2363
- data/vendor/pygments-main/tests/examplefiles/example.e +0 -124
- data/vendor/pygments-main/tests/examplefiles/example.f90 +0 -8
- data/vendor/pygments-main/tests/examplefiles/example.feature +0 -16
- data/vendor/pygments-main/tests/examplefiles/example.gd +0 -23
- data/vendor/pygments-main/tests/examplefiles/example.gi +0 -64
- data/vendor/pygments-main/tests/examplefiles/example.groovy +0 -2
- data/vendor/pygments-main/tests/examplefiles/example.gs +0 -106
- data/vendor/pygments-main/tests/examplefiles/example.gst +0 -7
- data/vendor/pygments-main/tests/examplefiles/example.hs +0 -27
- data/vendor/pygments-main/tests/examplefiles/example.hx +0 -185
- data/vendor/pygments-main/tests/examplefiles/example.i6t +0 -32
- data/vendor/pygments-main/tests/examplefiles/example.i7x +0 -45
- data/vendor/pygments-main/tests/examplefiles/example.inf +0 -374
- data/vendor/pygments-main/tests/examplefiles/example.j +0 -564
- data/vendor/pygments-main/tests/examplefiles/example.jag +0 -48
- data/vendor/pygments-main/tests/examplefiles/example.java +0 -16
- data/vendor/pygments-main/tests/examplefiles/example.kal +0 -75
- data/vendor/pygments-main/tests/examplefiles/example.kt +0 -47
- data/vendor/pygments-main/tests/examplefiles/example.lagda +0 -19
- data/vendor/pygments-main/tests/examplefiles/example.liquid +0 -42
- data/vendor/pygments-main/tests/examplefiles/example.lua +0 -250
- data/vendor/pygments-main/tests/examplefiles/example.ma +0 -8
- data/vendor/pygments-main/tests/examplefiles/example.monkey +0 -152
- data/vendor/pygments-main/tests/examplefiles/example.moo +0 -26
- data/vendor/pygments-main/tests/examplefiles/example.moon +0 -629
- data/vendor/pygments-main/tests/examplefiles/example.mq4 +0 -187
- data/vendor/pygments-main/tests/examplefiles/example.mqh +0 -123
- data/vendor/pygments-main/tests/examplefiles/example.msc +0 -43
- data/vendor/pygments-main/tests/examplefiles/example.ni +0 -57
- data/vendor/pygments-main/tests/examplefiles/example.nim +0 -1010
- data/vendor/pygments-main/tests/examplefiles/example.nix +0 -80
- data/vendor/pygments-main/tests/examplefiles/example.ns2 +0 -69
- data/vendor/pygments-main/tests/examplefiles/example.pas +0 -2708
- data/vendor/pygments-main/tests/examplefiles/example.pp +0 -8
- data/vendor/pygments-main/tests/examplefiles/example.prg +0 -161
- data/vendor/pygments-main/tests/examplefiles/example.rb +0 -1852
- data/vendor/pygments-main/tests/examplefiles/example.red +0 -257
- data/vendor/pygments-main/tests/examplefiles/example.reds +0 -150
- data/vendor/pygments-main/tests/examplefiles/example.reg +0 -19
- data/vendor/pygments-main/tests/examplefiles/example.rexx +0 -50
- data/vendor/pygments-main/tests/examplefiles/example.rhtml +0 -561
- data/vendor/pygments-main/tests/examplefiles/example.rkt +0 -743
- data/vendor/pygments-main/tests/examplefiles/example.rpf +0 -4
- data/vendor/pygments-main/tests/examplefiles/example.sh +0 -22
- data/vendor/pygments-main/tests/examplefiles/example.sh-session +0 -19
- data/vendor/pygments-main/tests/examplefiles/example.shell-session +0 -45
- data/vendor/pygments-main/tests/examplefiles/example.slim +0 -31
- data/vendor/pygments-main/tests/examplefiles/example.sls +0 -51
- data/vendor/pygments-main/tests/examplefiles/example.sml +0 -156
- data/vendor/pygments-main/tests/examplefiles/example.snobol +0 -15
- data/vendor/pygments-main/tests/examplefiles/example.stan +0 -110
- data/vendor/pygments-main/tests/examplefiles/example.tea +0 -34
- data/vendor/pygments-main/tests/examplefiles/example.todotxt +0 -9
- data/vendor/pygments-main/tests/examplefiles/example.ts +0 -28
- data/vendor/pygments-main/tests/examplefiles/example.u +0 -548
- data/vendor/pygments-main/tests/examplefiles/example.weechatlog +0 -9
- data/vendor/pygments-main/tests/examplefiles/example.xhtml +0 -376
- data/vendor/pygments-main/tests/examplefiles/example.xtend +0 -34
- data/vendor/pygments-main/tests/examplefiles/example.yaml +0 -302
- data/vendor/pygments-main/tests/examplefiles/example2.aspx +0 -29
- data/vendor/pygments-main/tests/examplefiles/example2.msc +0 -79
- data/vendor/pygments-main/tests/examplefiles/exampleScript.cfc +0 -241
- data/vendor/pygments-main/tests/examplefiles/exampleTag.cfc +0 -18
- data/vendor/pygments-main/tests/examplefiles/example_elixir.ex +0 -205
- data/vendor/pygments-main/tests/examplefiles/example_file.fy +0 -128
- data/vendor/pygments-main/tests/examplefiles/firefox.mak +0 -586
- data/vendor/pygments-main/tests/examplefiles/flipflop.sv +0 -19
- data/vendor/pygments-main/tests/examplefiles/foo.sce +0 -6
- data/vendor/pygments-main/tests/examplefiles/format.ml +0 -1213
- data/vendor/pygments-main/tests/examplefiles/fucked_up.rb +0 -77
- data/vendor/pygments-main/tests/examplefiles/function.mu +0 -1
- data/vendor/pygments-main/tests/examplefiles/functional.rst +0 -1472
- data/vendor/pygments-main/tests/examplefiles/garcia-wachs.kk +0 -133
- data/vendor/pygments-main/tests/examplefiles/genclass.clj +0 -510
- data/vendor/pygments-main/tests/examplefiles/genshi_example.xml+genshi +0 -193
- data/vendor/pygments-main/tests/examplefiles/genshitext_example.genshitext +0 -33
- data/vendor/pygments-main/tests/examplefiles/glsl.frag +0 -7
- data/vendor/pygments-main/tests/examplefiles/glsl.vert +0 -13
- data/vendor/pygments-main/tests/examplefiles/grammar-test.p6 +0 -22
- data/vendor/pygments-main/tests/examplefiles/hash_syntax.rb +0 -5
- data/vendor/pygments-main/tests/examplefiles/hello.at +0 -6
- data/vendor/pygments-main/tests/examplefiles/hello.golo +0 -5
- data/vendor/pygments-main/tests/examplefiles/hello.lsl +0 -12
- data/vendor/pygments-main/tests/examplefiles/hello.smali +0 -40
- data/vendor/pygments-main/tests/examplefiles/hello.sp +0 -9
- data/vendor/pygments-main/tests/examplefiles/html+php_faulty.php +0 -1
- data/vendor/pygments-main/tests/examplefiles/http_request_example +0 -15
- data/vendor/pygments-main/tests/examplefiles/http_response_example +0 -29
- data/vendor/pygments-main/tests/examplefiles/hybris_File.hy +0 -174
- data/vendor/pygments-main/tests/examplefiles/idl_sample.pro +0 -73
- data/vendor/pygments-main/tests/examplefiles/iex_example +0 -23
- data/vendor/pygments-main/tests/examplefiles/inet_pton6.dg +0 -71
- data/vendor/pygments-main/tests/examplefiles/intro.ik +0 -24
- data/vendor/pygments-main/tests/examplefiles/ints.php +0 -10
- data/vendor/pygments-main/tests/examplefiles/intsyn.fun +0 -675
- data/vendor/pygments-main/tests/examplefiles/intsyn.sig +0 -286
- data/vendor/pygments-main/tests/examplefiles/irb_heredoc +0 -8
- data/vendor/pygments-main/tests/examplefiles/irc.lsp +0 -214
- data/vendor/pygments-main/tests/examplefiles/java.properties +0 -16
- data/vendor/pygments-main/tests/examplefiles/jbst_example1.jbst +0 -28
- data/vendor/pygments-main/tests/examplefiles/jbst_example2.jbst +0 -45
- data/vendor/pygments-main/tests/examplefiles/jinjadesignerdoc.rst +0 -713
- data/vendor/pygments-main/tests/examplefiles/json.lasso +0 -301
- data/vendor/pygments-main/tests/examplefiles/json.lasso9 +0 -213
- data/vendor/pygments-main/tests/examplefiles/language.hy +0 -165
- data/vendor/pygments-main/tests/examplefiles/lighttpd_config.conf +0 -13
- data/vendor/pygments-main/tests/examplefiles/limbo.b +0 -456
- data/vendor/pygments-main/tests/examplefiles/linecontinuation.py +0 -47
- data/vendor/pygments-main/tests/examplefiles/livescript-demo.ls +0 -43
- data/vendor/pygments-main/tests/examplefiles/logos_example.xm +0 -28
- data/vendor/pygments-main/tests/examplefiles/ltmain.sh +0 -2849
- data/vendor/pygments-main/tests/examplefiles/main.cmake +0 -44
- data/vendor/pygments-main/tests/examplefiles/markdown.lsp +0 -679
- data/vendor/pygments-main/tests/examplefiles/matlab_noreturn +0 -3
- data/vendor/pygments-main/tests/examplefiles/matlab_sample +0 -30
- data/vendor/pygments-main/tests/examplefiles/matlabsession_sample.txt +0 -37
- data/vendor/pygments-main/tests/examplefiles/metagrammar.treetop +0 -455
- data/vendor/pygments-main/tests/examplefiles/minehunt.qml +0 -112
- data/vendor/pygments-main/tests/examplefiles/minimal.ns2 +0 -4
- data/vendor/pygments-main/tests/examplefiles/moin_SyntaxReference.txt +0 -340
- data/vendor/pygments-main/tests/examplefiles/multiline_regexes.rb +0 -38
- data/vendor/pygments-main/tests/examplefiles/nanomsg.intr +0 -95
- data/vendor/pygments-main/tests/examplefiles/nasm_aoutso.asm +0 -96
- data/vendor/pygments-main/tests/examplefiles/nasm_objexe.asm +0 -30
- data/vendor/pygments-main/tests/examplefiles/nemerle_sample.n +0 -87
- data/vendor/pygments-main/tests/examplefiles/nginx_nginx.conf +0 -118
- data/vendor/pygments-main/tests/examplefiles/numbers.c +0 -12
- data/vendor/pygments-main/tests/examplefiles/objc_example.m +0 -179
- data/vendor/pygments-main/tests/examplefiles/openedge_example +0 -34
- data/vendor/pygments-main/tests/examplefiles/pawn_example +0 -25
- data/vendor/pygments-main/tests/examplefiles/perl_misc +0 -62
- data/vendor/pygments-main/tests/examplefiles/perl_perl5db +0 -998
- data/vendor/pygments-main/tests/examplefiles/perl_regex-delims +0 -120
- data/vendor/pygments-main/tests/examplefiles/perlfunc.1 +0 -856
- data/vendor/pygments-main/tests/examplefiles/phpMyAdmin.spec +0 -163
- data/vendor/pygments-main/tests/examplefiles/phpcomplete.vim +0 -567
- data/vendor/pygments-main/tests/examplefiles/pleac.in.rb +0 -1223
- data/vendor/pygments-main/tests/examplefiles/postgresql_test.txt +0 -47
- data/vendor/pygments-main/tests/examplefiles/pppoe.applescript +0 -10
- data/vendor/pygments-main/tests/examplefiles/psql_session.txt +0 -122
- data/vendor/pygments-main/tests/examplefiles/py3_test.txt +0 -2
- data/vendor/pygments-main/tests/examplefiles/py3tb_test.py3tb +0 -4
- data/vendor/pygments-main/tests/examplefiles/pycon_test.pycon +0 -14
- data/vendor/pygments-main/tests/examplefiles/pytb_test2.pytb +0 -2
- data/vendor/pygments-main/tests/examplefiles/pytb_test3.pytb +0 -4
- data/vendor/pygments-main/tests/examplefiles/python25-bsd.mak +0 -234
- data/vendor/pygments-main/tests/examplefiles/qbasic_example +0 -2
- data/vendor/pygments-main/tests/examplefiles/qsort.prolog +0 -13
- data/vendor/pygments-main/tests/examplefiles/r-console-transcript.Rout +0 -38
- data/vendor/pygments-main/tests/examplefiles/r6rs-comments.scm +0 -23
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_rlscan +0 -280
- data/vendor/pygments-main/tests/examplefiles/ragel-cpp_snippet +0 -2
- data/vendor/pygments-main/tests/examplefiles/regex.js +0 -22
- data/vendor/pygments-main/tests/examplefiles/reversi.lsp +0 -427
- data/vendor/pygments-main/tests/examplefiles/robotframework_test.txt +0 -39
- data/vendor/pygments-main/tests/examplefiles/rql-queries.rql +0 -34
- data/vendor/pygments-main/tests/examplefiles/ruby_func_def.rb +0 -11
- data/vendor/pygments-main/tests/examplefiles/rust_example.rs +0 -233
- data/vendor/pygments-main/tests/examplefiles/scilab.sci +0 -30
- data/vendor/pygments-main/tests/examplefiles/scope.cirru +0 -43
- data/vendor/pygments-main/tests/examplefiles/session.dylan-console +0 -9
- data/vendor/pygments-main/tests/examplefiles/sibling.prolog +0 -19
- data/vendor/pygments-main/tests/examplefiles/simple.md +0 -747
- data/vendor/pygments-main/tests/examplefiles/smarty_example.html +0 -209
- data/vendor/pygments-main/tests/examplefiles/source.lgt +0 -343
- data/vendor/pygments-main/tests/examplefiles/sources.list +0 -62
- data/vendor/pygments-main/tests/examplefiles/sparql.rq +0 -23
- data/vendor/pygments-main/tests/examplefiles/sphere.pov +0 -18
- data/vendor/pygments-main/tests/examplefiles/sqlite3.sqlite3-console +0 -27
- data/vendor/pygments-main/tests/examplefiles/squid.conf +0 -30
- data/vendor/pygments-main/tests/examplefiles/string.jl +0 -1031
- data/vendor/pygments-main/tests/examplefiles/string_delimiters.d +0 -21
- data/vendor/pygments-main/tests/examplefiles/stripheredoc.sh +0 -3
- data/vendor/pygments-main/tests/examplefiles/swig_java.swg +0 -1329
- data/vendor/pygments-main/tests/examplefiles/swig_std_vector.i +0 -225
- data/vendor/pygments-main/tests/examplefiles/test.R +0 -185
- data/vendor/pygments-main/tests/examplefiles/test.adb +0 -211
- data/vendor/pygments-main/tests/examplefiles/test.agda +0 -102
- data/vendor/pygments-main/tests/examplefiles/test.apl +0 -26
- data/vendor/pygments-main/tests/examplefiles/test.asy +0 -131
- data/vendor/pygments-main/tests/examplefiles/test.awk +0 -121
- data/vendor/pygments-main/tests/examplefiles/test.bb +0 -95
- data/vendor/pygments-main/tests/examplefiles/test.bmx +0 -145
- data/vendor/pygments-main/tests/examplefiles/test.boo +0 -39
- data/vendor/pygments-main/tests/examplefiles/test.bro +0 -250
- data/vendor/pygments-main/tests/examplefiles/test.cs +0 -374
- data/vendor/pygments-main/tests/examplefiles/test.css +0 -54
- data/vendor/pygments-main/tests/examplefiles/test.cu +0 -36
- data/vendor/pygments-main/tests/examplefiles/test.cyp +0 -123
- data/vendor/pygments-main/tests/examplefiles/test.d +0 -135
- data/vendor/pygments-main/tests/examplefiles/test.dart +0 -23
- data/vendor/pygments-main/tests/examplefiles/test.dtd +0 -89
- data/vendor/pygments-main/tests/examplefiles/test.ebnf +0 -31
- data/vendor/pygments-main/tests/examplefiles/test.ec +0 -605
- data/vendor/pygments-main/tests/examplefiles/test.ecl +0 -58
- data/vendor/pygments-main/tests/examplefiles/test.eh +0 -315
- data/vendor/pygments-main/tests/examplefiles/test.erl +0 -169
- data/vendor/pygments-main/tests/examplefiles/test.evoque +0 -33
- data/vendor/pygments-main/tests/examplefiles/test.fan +0 -818
- data/vendor/pygments-main/tests/examplefiles/test.flx +0 -57
- data/vendor/pygments-main/tests/examplefiles/test.gdc +0 -13
- data/vendor/pygments-main/tests/examplefiles/test.groovy +0 -97
- data/vendor/pygments-main/tests/examplefiles/test.html +0 -339
- data/vendor/pygments-main/tests/examplefiles/test.idr +0 -93
- data/vendor/pygments-main/tests/examplefiles/test.ini +0 -10
- data/vendor/pygments-main/tests/examplefiles/test.java +0 -653
- data/vendor/pygments-main/tests/examplefiles/test.jsp +0 -24
- data/vendor/pygments-main/tests/examplefiles/test.maql +0 -45
- data/vendor/pygments-main/tests/examplefiles/test.mask +0 -41
- data/vendor/pygments-main/tests/examplefiles/test.mod +0 -374
- data/vendor/pygments-main/tests/examplefiles/test.moo +0 -51
- data/vendor/pygments-main/tests/examplefiles/test.myt +0 -166
- data/vendor/pygments-main/tests/examplefiles/test.nim +0 -93
- data/vendor/pygments-main/tests/examplefiles/test.opa +0 -10
- data/vendor/pygments-main/tests/examplefiles/test.p6 +0 -252
- data/vendor/pygments-main/tests/examplefiles/test.pan +0 -54
- data/vendor/pygments-main/tests/examplefiles/test.pas +0 -743
- data/vendor/pygments-main/tests/examplefiles/test.php +0 -507
- data/vendor/pygments-main/tests/examplefiles/test.pig +0 -148
- data/vendor/pygments-main/tests/examplefiles/test.plot +0 -333
- data/vendor/pygments-main/tests/examplefiles/test.ps1 +0 -108
- data/vendor/pygments-main/tests/examplefiles/test.pwn +0 -253
- data/vendor/pygments-main/tests/examplefiles/test.pypylog +0 -1839
- data/vendor/pygments-main/tests/examplefiles/test.r3 +0 -114
- data/vendor/pygments-main/tests/examplefiles/test.rb +0 -177
- data/vendor/pygments-main/tests/examplefiles/test.rhtml +0 -43
- data/vendor/pygments-main/tests/examplefiles/test.rsl +0 -111
- data/vendor/pygments-main/tests/examplefiles/test.scaml +0 -8
- data/vendor/pygments-main/tests/examplefiles/test.ssp +0 -12
- data/vendor/pygments-main/tests/examplefiles/test.swift +0 -65
- data/vendor/pygments-main/tests/examplefiles/test.tcsh +0 -830
- data/vendor/pygments-main/tests/examplefiles/test.vb +0 -407
- data/vendor/pygments-main/tests/examplefiles/test.vhdl +0 -161
- data/vendor/pygments-main/tests/examplefiles/test.xqy +0 -138
- data/vendor/pygments-main/tests/examplefiles/test.xsl +0 -23
- data/vendor/pygments-main/tests/examplefiles/test.zep +0 -33
- data/vendor/pygments-main/tests/examplefiles/test2.pypylog +0 -120
- data/vendor/pygments-main/tests/examplefiles/truncated.pytb +0 -15
- data/vendor/pygments-main/tests/examplefiles/type.lisp +0 -1218
- data/vendor/pygments-main/tests/examplefiles/underscore.coffee +0 -603
- data/vendor/pygments-main/tests/examplefiles/unicode.applescript +0 -5
- data/vendor/pygments-main/tests/examplefiles/unicode.go +0 -10
- data/vendor/pygments-main/tests/examplefiles/unicodedoc.py +0 -11
- data/vendor/pygments-main/tests/examplefiles/unix-io.lid +0 -37
- data/vendor/pygments-main/tests/examplefiles/vbnet_test.bas +0 -29
- data/vendor/pygments-main/tests/examplefiles/vctreestatus_hg +0 -4
- data/vendor/pygments-main/tests/examplefiles/vimrc +0 -21
- data/vendor/pygments-main/tests/examplefiles/webkit-transition.css +0 -3
- data/vendor/pygments-main/tests/examplefiles/while.pov +0 -13
- data/vendor/pygments-main/tests/examplefiles/wiki.factor +0 -384
- data/vendor/pygments-main/tests/examplefiles/xml_example +0 -1897
- data/vendor/pygments-main/tests/examplefiles/zmlrpc.f90 +0 -798
- data/vendor/pygments-main/tests/run.py +0 -44
- data/vendor/pygments-main/tests/string_asserts.py +0 -22
- data/vendor/pygments-main/tests/support.py +0 -15
- data/vendor/pygments-main/tests/support/tags +0 -36
- data/vendor/pygments-main/tests/test_basic_api.py +0 -309
- data/vendor/pygments-main/tests/test_cfm.py +0 -46
- data/vendor/pygments-main/tests/test_clexer.py +0 -236
- data/vendor/pygments-main/tests/test_cmdline.py +0 -106
- data/vendor/pygments-main/tests/test_examplefiles.py +0 -110
- data/vendor/pygments-main/tests/test_html_formatter.py +0 -180
- data/vendor/pygments-main/tests/test_latex_formatter.py +0 -57
- data/vendor/pygments-main/tests/test_lexers_other.py +0 -68
- data/vendor/pygments-main/tests/test_objectiveclexer.py +0 -81
- data/vendor/pygments-main/tests/test_perllexer.py +0 -137
- data/vendor/pygments-main/tests/test_qbasiclexer.py +0 -43
- data/vendor/pygments-main/tests/test_regexlexer.py +0 -54
- data/vendor/pygments-main/tests/test_rtf_formatter.py +0 -109
- data/vendor/pygments-main/tests/test_string_asserts.py +0 -39
- data/vendor/pygments-main/tests/test_token.py +0 -46
- data/vendor/pygments-main/tests/test_using_api.py +0 -40
- data/vendor/pygments-main/tests/test_util.py +0 -135
@@ -1,23 +0,0 @@
|
|
1
|
-
role q {
|
2
|
-
token stopper { \' }
|
3
|
-
|
4
|
-
token escape:sym<\\> { <sym> <item=.backslash> }
|
5
|
-
|
6
|
-
token backslash:sym<qq> { <?before 'q'> <quote=.LANG('MAIN','quote')> }
|
7
|
-
token backslash:sym<\\> { <text=.sym> }
|
8
|
-
token backslash:sym<stopper> { <text=.stopper> }
|
9
|
-
|
10
|
-
token backslash:sym<miscq> { {} . }
|
11
|
-
|
12
|
-
method tweak_q($v) { self.panic("Too late for :q") }
|
13
|
-
method tweak_qq($v) { self.panic("Too late for :qq") }
|
14
|
-
}
|
15
|
-
|
16
|
-
role qq does b1 does c1 does s1 does a1 does h1 does f1 {
|
17
|
-
token stopper { \" }
|
18
|
-
token backslash:sym<unrec> { {} (\w) { self.throw_unrecog_backslash_seq: $/[0].Str } }
|
19
|
-
token backslash:sym<misc> { \W }
|
20
|
-
|
21
|
-
method tweak_q($v) { self.panic("Too late for :q") }
|
22
|
-
method tweak_qq($v) { self.panic("Too late for :qq") }
|
23
|
-
}
|
@@ -1,378 +0,0 @@
|
|
1
|
-
---------------------------------------------------------------------
|
2
|
-
-- SmallCheck: another lightweight testing library.
|
3
|
-
-- Colin Runciman, August 2006
|
4
|
-
-- Version 0.2 (November 2006)
|
5
|
-
--
|
6
|
-
-- After QuickCheck, by Koen Claessen and John Hughes (2000-2004).
|
7
|
-
---------------------------------------------------------------------
|
8
|
-
|
9
|
-
module SmallCheck (
|
10
|
-
smallCheck, depthCheck,
|
11
|
-
Property, Testable,
|
12
|
-
forAll, forAllElem,
|
13
|
-
exists, existsDeeperBy, thereExists, thereExistsElem,
|
14
|
-
(==>),
|
15
|
-
Series, Serial(..),
|
16
|
-
(\/), (><), two, three, four,
|
17
|
-
cons0, cons1, cons2, cons3, cons4,
|
18
|
-
alts0, alts1, alts2, alts3, alts4,
|
19
|
-
N(..), Nat, Natural,
|
20
|
-
depth, inc, dec
|
21
|
-
) where
|
22
|
-
|
23
|
-
import Data.List (intersperse)
|
24
|
-
import Control.Monad (when)
|
25
|
-
import System.IO (stdout, hFlush)
|
26
|
-
|
27
|
-
------------------ <Series of depth-bounded values> -----------------
|
28
|
-
|
29
|
-
-- Series arguments should be interpreted as a depth bound (>=0)
|
30
|
-
-- Series results should have finite length
|
31
|
-
|
32
|
-
type Series a = Int -> [a]
|
33
|
-
|
34
|
-
-- sum
|
35
|
-
infixr 7 \/
|
36
|
-
(\/) :: Series a -> Series a -> Series a
|
37
|
-
s1 \/ s2 = \d -> s1 d ++ s2 d
|
38
|
-
|
39
|
-
-- product
|
40
|
-
infixr 8 ><
|
41
|
-
(><) :: Series a -> Series b -> Series (a,b)
|
42
|
-
s1 >< s2 = \d -> [(x,y) | x <- s1 d, y <- s2 d]
|
43
|
-
|
44
|
-
------------------- <methods for type enumeration> ------------------
|
45
|
-
|
46
|
-
-- enumerated data values should be finite and fully defined
|
47
|
-
-- enumerated functional values should be total and strict
|
48
|
-
|
49
|
-
-- bounds:
|
50
|
-
-- for data values, the depth of nested constructor applications
|
51
|
-
-- for functional values, both the depth of nested case analysis
|
52
|
-
-- and the depth of results
|
53
|
-
|
54
|
-
class Serial a where
|
55
|
-
series :: Series a
|
56
|
-
coseries :: Serial b => Series (a->b)
|
57
|
-
|
58
|
-
instance Serial () where
|
59
|
-
series _ = [()]
|
60
|
-
coseries d = [ \() -> b
|
61
|
-
| b <- series d ]
|
62
|
-
|
63
|
-
instance Serial Int where
|
64
|
-
series d = [(-d)..d]
|
65
|
-
coseries d = [ \i -> if i > 0 then f (N (i - 1))
|
66
|
-
else if i < 0 then g (N (abs i - 1))
|
67
|
-
else z
|
68
|
-
| z <- alts0 d, f <- alts1 d, g <- alts1 d ]
|
69
|
-
|
70
|
-
instance Serial Integer where
|
71
|
-
series d = [ toInteger (i :: Int)
|
72
|
-
| i <- series d ]
|
73
|
-
coseries d = [ f . (fromInteger :: Integer->Int)
|
74
|
-
| f <- series d ]
|
75
|
-
|
76
|
-
newtype N a = N a
|
77
|
-
|
78
|
-
instance Show a => Show (N a) where
|
79
|
-
show (N i) = show i
|
80
|
-
|
81
|
-
instance (Integral a, Serial a) => Serial (N a) where
|
82
|
-
series d = map N [0..d']
|
83
|
-
where
|
84
|
-
d' = fromInteger (toInteger d)
|
85
|
-
coseries d = [ \(N i) -> if i > 0 then f (N (i - 1))
|
86
|
-
else z
|
87
|
-
| z <- alts0 d, f <- alts1 d ]
|
88
|
-
|
89
|
-
type Nat = N Int
|
90
|
-
type Natural = N Integer
|
91
|
-
|
92
|
-
instance Serial Float where
|
93
|
-
series d = [ encodeFloat sig exp
|
94
|
-
| (sig,exp) <- series d,
|
95
|
-
odd sig || sig==0 && exp==0 ]
|
96
|
-
coseries d = [ f . decodeFloat
|
97
|
-
| f <- series d ]
|
98
|
-
|
99
|
-
instance Serial Double where
|
100
|
-
series d = [ frac (x :: Float)
|
101
|
-
| x <- series d ]
|
102
|
-
coseries d = [ f . (frac :: Double->Float)
|
103
|
-
| f <- series d ]
|
104
|
-
|
105
|
-
frac :: (Real a, Fractional a, Real b, Fractional b) => a -> b
|
106
|
-
frac = fromRational . toRational
|
107
|
-
|
108
|
-
instance Serial Char where
|
109
|
-
series d = take (d+1) ['a'..'z']
|
110
|
-
coseries d = [ \c -> f (N (fromEnum c - fromEnum 'a'))
|
111
|
-
| f <- series d ]
|
112
|
-
|
113
|
-
instance (Serial a, Serial b) =>
|
114
|
-
Serial (a,b) where
|
115
|
-
series = series >< series
|
116
|
-
coseries = map uncurry . coseries
|
117
|
-
|
118
|
-
instance (Serial a, Serial b, Serial c) =>
|
119
|
-
Serial (a,b,c) where
|
120
|
-
series = \d -> [(a,b,c) | (a,(b,c)) <- series d]
|
121
|
-
coseries = map uncurry3 . coseries
|
122
|
-
|
123
|
-
instance (Serial a, Serial b, Serial c, Serial d) =>
|
124
|
-
Serial (a,b,c,d) where
|
125
|
-
series = \d -> [(a,b,c,d) | (a,(b,(c,d))) <- series d]
|
126
|
-
coseries = map uncurry4 . coseries
|
127
|
-
|
128
|
-
uncurry3 :: (a->b->c->d) -> ((a,b,c)->d)
|
129
|
-
uncurry3 f (x,y,z) = f x y z
|
130
|
-
|
131
|
-
uncurry4 :: (a->b->c->d->e) -> ((a,b,c,d)->e)
|
132
|
-
uncurry4 f (w,x,y,z) = f w x y z
|
133
|
-
|
134
|
-
two :: Series a -> Series (a,a)
|
135
|
-
two s = s >< s
|
136
|
-
|
137
|
-
three :: Series a -> Series (a,a,a)
|
138
|
-
three s = \d -> [(x,y,z) | (x,(y,z)) <- (s >< s >< s) d]
|
139
|
-
|
140
|
-
four :: Series a -> Series (a,a,a,a)
|
141
|
-
four s = \d -> [(w,x,y,z) | (w,(x,(y,z))) <- (s >< s >< s >< s) d]
|
142
|
-
|
143
|
-
cons0 ::
|
144
|
-
a -> Series a
|
145
|
-
cons0 c _ = [c]
|
146
|
-
|
147
|
-
cons1 :: Serial a =>
|
148
|
-
(a->b) -> Series b
|
149
|
-
cons1 c d = [c z | d > 0, z <- series (d-1)]
|
150
|
-
|
151
|
-
cons2 :: (Serial a, Serial b) =>
|
152
|
-
(a->b->c) -> Series c
|
153
|
-
cons2 c d = [c y z | d > 0, (y,z) <- series (d-1)]
|
154
|
-
|
155
|
-
cons3 :: (Serial a, Serial b, Serial c) =>
|
156
|
-
(a->b->c->d) -> Series d
|
157
|
-
cons3 c d = [c x y z | d > 0, (x,y,z) <- series (d-1)]
|
158
|
-
|
159
|
-
cons4 :: (Serial a, Serial b, Serial c, Serial d) =>
|
160
|
-
(a->b->c->d->e) -> Series e
|
161
|
-
cons4 c d = [c w x y z | d > 0, (w,x,y,z) <- series (d-1)]
|
162
|
-
|
163
|
-
alts0 :: Serial a =>
|
164
|
-
Series a
|
165
|
-
alts0 d = series d
|
166
|
-
|
167
|
-
alts1 :: (Serial a, Serial b) =>
|
168
|
-
Series (a->b)
|
169
|
-
alts1 d = if d > 0 then series (dec d)
|
170
|
-
else [\_ -> x | x <- series d]
|
171
|
-
|
172
|
-
alts2 :: (Serial a, Serial b, Serial c) =>
|
173
|
-
Series (a->b->c)
|
174
|
-
alts2 d = if d > 0 then series (dec d)
|
175
|
-
else [\_ _ -> x | x <- series d]
|
176
|
-
|
177
|
-
alts3 :: (Serial a, Serial b, Serial c, Serial d) =>
|
178
|
-
Series (a->b->c->d)
|
179
|
-
alts3 d = if d > 0 then series (dec d)
|
180
|
-
else [\_ _ _ -> x | x <- series d]
|
181
|
-
|
182
|
-
alts4 :: (Serial a, Serial b, Serial c, Serial d, Serial e) =>
|
183
|
-
Series (a->b->c->d->e)
|
184
|
-
alts4 d = if d > 0 then series (dec d)
|
185
|
-
else [\_ _ _ _ -> x | x <- series d]
|
186
|
-
|
187
|
-
instance Serial Bool where
|
188
|
-
series = cons0 True \/ cons0 False
|
189
|
-
coseries d = [ \x -> if x then b1 else b2
|
190
|
-
| (b1,b2) <- series d ]
|
191
|
-
|
192
|
-
instance Serial a => Serial (Maybe a) where
|
193
|
-
series = cons0 Nothing \/ cons1 Just
|
194
|
-
coseries d = [ \m -> case m of
|
195
|
-
Nothing -> z
|
196
|
-
Just x -> f x
|
197
|
-
| z <- alts0 d ,
|
198
|
-
f <- alts1 d ]
|
199
|
-
|
200
|
-
instance (Serial a, Serial b) => Serial (Either a b) where
|
201
|
-
series = cons1 Left \/ cons1 Right
|
202
|
-
coseries d = [ \e -> case e of
|
203
|
-
Left x -> f x
|
204
|
-
Right y -> g y
|
205
|
-
| f <- alts1 d ,
|
206
|
-
g <- alts1 d ]
|
207
|
-
|
208
|
-
instance Serial a => Serial [a] where
|
209
|
-
series = cons0 [] \/ cons2 (:)
|
210
|
-
coseries d = [ \xs -> case xs of
|
211
|
-
[] -> y
|
212
|
-
(x:xs') -> f x xs'
|
213
|
-
| y <- alts0 d ,
|
214
|
-
f <- alts2 d ]
|
215
|
-
|
216
|
-
-- Warning: the coseries instance here may generate duplicates.
|
217
|
-
instance (Serial a, Serial b) => Serial (a->b) where
|
218
|
-
series = coseries
|
219
|
-
coseries d = [ \f -> g [f x | x <- series d]
|
220
|
-
| g <- series d ]
|
221
|
-
|
222
|
-
-- For customising the depth measure. Use with care!
|
223
|
-
|
224
|
-
depth :: Int -> Int -> Int
|
225
|
-
depth d d' | d >= 0 = d'+1-d
|
226
|
-
| otherwise = error "SmallCheck.depth: argument < 0"
|
227
|
-
|
228
|
-
dec :: Int -> Int
|
229
|
-
dec d | d > 0 = d-1
|
230
|
-
| otherwise = error "SmallCheck.dec: argument <= 0"
|
231
|
-
|
232
|
-
inc :: Int -> Int
|
233
|
-
inc d = d+1
|
234
|
-
|
235
|
-
-- show the extension of a function (in part, bounded both by
|
236
|
-
-- the number and depth of arguments)
|
237
|
-
instance (Serial a, Show a, Show b) => Show (a->b) where
|
238
|
-
show f =
|
239
|
-
if maxarheight == 1
|
240
|
-
&& sumarwidth + length ars * length "->;" < widthLimit then
|
241
|
-
"{"++(
|
242
|
-
concat $ intersperse ";" $ [a++"->"++r | (a,r) <- ars]
|
243
|
-
)++"}"
|
244
|
-
else
|
245
|
-
concat $ [a++"->\n"++indent r | (a,r) <- ars]
|
246
|
-
where
|
247
|
-
ars = take lengthLimit [ (show x, show (f x))
|
248
|
-
| x <- series depthLimit ]
|
249
|
-
maxarheight = maximum [ max (height a) (height r)
|
250
|
-
| (a,r) <- ars ]
|
251
|
-
sumarwidth = sum [ length a + length r
|
252
|
-
| (a,r) <- ars]
|
253
|
-
indent = unlines . map (" "++) . lines
|
254
|
-
height = length . lines
|
255
|
-
(widthLimit,lengthLimit,depthLimit) = (80,20,3)::(Int,Int,Int)
|
256
|
-
|
257
|
-
---------------- <properties and their evaluation> ------------------
|
258
|
-
|
259
|
-
-- adapted from QuickCheck originals: here results come in lists,
|
260
|
-
-- properties have depth arguments, stamps (for classifying random
|
261
|
-
-- tests) are omitted, existentials are introduced
|
262
|
-
|
263
|
-
newtype PR = Prop [Result]
|
264
|
-
|
265
|
-
data Result = Result {ok :: Maybe Bool, arguments :: [String]}
|
266
|
-
|
267
|
-
nothing :: Result
|
268
|
-
nothing = Result {ok = Nothing, arguments = []}
|
269
|
-
|
270
|
-
result :: Result -> PR
|
271
|
-
result res = Prop [res]
|
272
|
-
|
273
|
-
newtype Property = Property (Int -> PR)
|
274
|
-
|
275
|
-
class Testable a where
|
276
|
-
property :: a -> Int -> PR
|
277
|
-
|
278
|
-
instance Testable Bool where
|
279
|
-
property b _ = Prop [Result (Just b) []]
|
280
|
-
|
281
|
-
instance Testable PR where
|
282
|
-
property prop _ = prop
|
283
|
-
|
284
|
-
instance (Serial a, Show a, Testable b) => Testable (a->b) where
|
285
|
-
property f = f' where Property f' = forAll series f
|
286
|
-
|
287
|
-
instance Testable Property where
|
288
|
-
property (Property f) d = f d
|
289
|
-
|
290
|
-
evaluate :: Testable a => a -> Series Result
|
291
|
-
evaluate x d = rs where Prop rs = property x d
|
292
|
-
|
293
|
-
forAll :: (Show a, Testable b) => Series a -> (a->b) -> Property
|
294
|
-
forAll xs f = Property $ \d -> Prop $
|
295
|
-
[ r{arguments = show x : arguments r}
|
296
|
-
| x <- xs d, r <- evaluate (f x) d ]
|
297
|
-
|
298
|
-
forAllElem :: (Show a, Testable b) => [a] -> (a->b) -> Property
|
299
|
-
forAllElem xs = forAll (const xs)
|
300
|
-
|
301
|
-
thereExists :: Testable b => Series a -> (a->b) -> Property
|
302
|
-
thereExists xs f = Property $ \d -> Prop $
|
303
|
-
[ Result
|
304
|
-
( Just $ or [ all pass (evaluate (f x) d)
|
305
|
-
| x <- xs d ] )
|
306
|
-
[] ]
|
307
|
-
where
|
308
|
-
pass (Result Nothing _) = True
|
309
|
-
pass (Result (Just b) _) = b
|
310
|
-
|
311
|
-
thereExistsElem :: Testable b => [a] -> (a->b) -> Property
|
312
|
-
thereExistsElem xs = thereExists (const xs)
|
313
|
-
|
314
|
-
exists :: (Serial a, Testable b) =>
|
315
|
-
(a->b) -> Property
|
316
|
-
exists = thereExists series
|
317
|
-
|
318
|
-
existsDeeperBy :: (Serial a, Testable b) =>
|
319
|
-
(Int->Int) -> (a->b) -> Property
|
320
|
-
existsDeeperBy f = thereExists (series . f)
|
321
|
-
|
322
|
-
infixr 0 ==>
|
323
|
-
|
324
|
-
(==>) :: Testable a => Bool -> a -> Property
|
325
|
-
True ==> x = Property (property x)
|
326
|
-
False ==> x = Property (const (result nothing))
|
327
|
-
|
328
|
-
--------------------- <top-level test drivers> ----------------------
|
329
|
-
|
330
|
-
-- similar in spirit to QuickCheck but with iterative deepening
|
331
|
-
|
332
|
-
-- test for values of depths 0..d stopping when a property
|
333
|
-
-- fails or when it has been checked for all these values
|
334
|
-
smallCheck :: Testable a => Int -> a -> IO String
|
335
|
-
smallCheck d = iterCheck 0 (Just d)
|
336
|
-
|
337
|
-
depthCheck :: Testable a => Int -> a -> IO String
|
338
|
-
depthCheck d = iterCheck d (Just d)
|
339
|
-
|
340
|
-
iterCheck :: Testable a => Int -> Maybe Int -> a -> IO String
|
341
|
-
iterCheck dFrom mdTo t = iter dFrom
|
342
|
-
where
|
343
|
-
iter :: Int -> IO String
|
344
|
-
iter d = do
|
345
|
-
let Prop results = property t d
|
346
|
-
(ok,s) <- check (mdTo==Nothing) 0 0 True results
|
347
|
-
maybe (iter (d+1))
|
348
|
-
(\dTo -> if ok && d < dTo
|
349
|
-
then iter (d+1)
|
350
|
-
else return s)
|
351
|
-
mdTo
|
352
|
-
|
353
|
-
check :: Bool -> Int -> Int -> Bool -> [Result] -> IO (Bool, String)
|
354
|
-
check i n x ok rs | null rs = do
|
355
|
-
let s = " Completed "++show n++" test(s)"
|
356
|
-
y = if i then "." else " without failure."
|
357
|
-
z | x > 0 = " But "++show x++" did not meet ==> condition."
|
358
|
-
| otherwise = ""
|
359
|
-
return (ok, s ++ y ++ z)
|
360
|
-
|
361
|
-
check i n x ok (Result Nothing _ : rs) = do
|
362
|
-
progressReport i n x
|
363
|
-
check i (n+1) (x+1) ok rs
|
364
|
-
|
365
|
-
check i n x f (Result (Just True) _ : rs) = do
|
366
|
-
progressReport i n x
|
367
|
-
check i (n+1) x f rs
|
368
|
-
|
369
|
-
check i n x f (Result (Just False) args : rs) = do
|
370
|
-
let s = " Failed test no. "++show (n+1)++". Test values follow."
|
371
|
-
s' = s ++ ": " ++ concat (intersperse ", " args)
|
372
|
-
if i then
|
373
|
-
check i (n+1) x False rs
|
374
|
-
else
|
375
|
-
return (False, s')
|
376
|
-
|
377
|
-
progressReport :: Bool -> Int -> Int -> IO ()
|
378
|
-
progressReport _ _ _ = return ()
|
@@ -1,470 +0,0 @@
|
|
1
|
-
IMPLEMENTATION MODULE Sorting;
|
2
|
-
|
3
|
-
(* J. Andrea, Dec.16/91 *)
|
4
|
-
(* This code may be freely used and distributed, it may not be sold. *)
|
5
|
-
|
6
|
-
(* Adapted to ISO Module-2 by Frank Schoonjans Feb 2004 *)
|
7
|
-
|
8
|
-
FROM Storage IMPORT ALLOCATE;
|
9
|
-
|
10
|
-
CONST
|
11
|
-
max_stack = 20;
|
12
|
-
n_small = 6; (* use a simple sort for this size and smaller *)
|
13
|
-
|
14
|
-
VAR
|
15
|
-
rtemp :REAL;
|
16
|
-
ctemp :CARDINAL;
|
17
|
-
|
18
|
-
L, R, n :INTEGER;
|
19
|
-
top, bottom, lastflip :INTEGER;
|
20
|
-
|
21
|
-
tos :CARDINAL;
|
22
|
-
Lstack, Rstack :ARRAY [1..max_stack] OF INTEGER;
|
23
|
-
|
24
|
-
(* --------------------------------------------------- *)
|
25
|
-
PROCEDURE CardQSortIndex( x :ARRAY OF CARDINAL; array_len :CARDINAL;
|
26
|
-
VAR index :ARRAY OF CARDINAL );
|
27
|
-
|
28
|
-
VAR
|
29
|
-
median : CARDINAL;
|
30
|
-
i,j : INTEGER;
|
31
|
-
BEGIN
|
32
|
-
|
33
|
-
n := VAL(INTEGER,array_len) - 1; (* back to zero offset *)
|
34
|
-
|
35
|
-
(* initialize the index *)
|
36
|
-
FOR i := 0 TO n DO
|
37
|
-
index[i] := VAL(CARDINAL,i);
|
38
|
-
END;
|
39
|
-
|
40
|
-
tos := 0;
|
41
|
-
|
42
|
-
L := 0; R := n;
|
43
|
-
|
44
|
-
(* PUSH very first set *)
|
45
|
-
tos := tos + 1; Lstack[tos] := L; Rstack[tos] := R;
|
46
|
-
|
47
|
-
REPEAT
|
48
|
-
|
49
|
-
(* POP *)
|
50
|
-
L := Lstack[tos]; R := Rstack[tos]; tos := tos - 1;
|
51
|
-
|
52
|
-
IF R - L + 1 > n_small THEN
|
53
|
-
|
54
|
-
REPEAT
|
55
|
-
i := L; j := R; median := x[index[( L + R ) DIV 2]];
|
56
|
-
|
57
|
-
REPEAT
|
58
|
-
WHILE x[index[i]] < median DO
|
59
|
-
i := i + 1;
|
60
|
-
END;
|
61
|
-
WHILE median < x[index[j]] DO
|
62
|
-
j := j - 1;
|
63
|
-
END;
|
64
|
-
|
65
|
-
IF i <= j THEN (* swap *)
|
66
|
-
ctemp := index[i]; index[i] := index[j]; index[j] := ctemp;
|
67
|
-
i := i + 1; j := j - 1;
|
68
|
-
END;
|
69
|
-
UNTIL i > j;
|
70
|
-
|
71
|
-
IF j - L < R - i THEN
|
72
|
-
IF i < R THEN (* PUSH *)
|
73
|
-
tos := tos + 1; Lstack[tos] := i; Rstack[tos] := R;
|
74
|
-
END;
|
75
|
-
R := j;
|
76
|
-
ELSE
|
77
|
-
IF L < j THEN (* push *)
|
78
|
-
tos := tos + 1; Lstack[tos] := L; Rstack[tos] := j;
|
79
|
-
END;
|
80
|
-
L := i;
|
81
|
-
END;
|
82
|
-
|
83
|
-
UNTIL L >= R;
|
84
|
-
|
85
|
-
ELSE
|
86
|
-
|
87
|
-
(* small sort for small number of values *)
|
88
|
-
FOR i := L TO R - 1 DO
|
89
|
-
FOR j := i TO R DO
|
90
|
-
IF x[index[i]] > x[index[j]] THEN
|
91
|
-
ctemp := index[i];
|
92
|
-
index[i] := index[j];
|
93
|
-
index[j] := ctemp
|
94
|
-
END;
|
95
|
-
END;
|
96
|
-
END;
|
97
|
-
|
98
|
-
END; (* check for small *)
|
99
|
-
|
100
|
-
UNTIL tos = 0;
|
101
|
-
|
102
|
-
END CardQSortIndex;
|
103
|
-
|
104
|
-
(* --------------------------------------------------- *)
|
105
|
-
PROCEDURE RealQSortIndex( x :ARRAY OF REAL; array_len :CARDINAL;
|
106
|
-
VAR index :ARRAY OF CARDINAL );
|
107
|
-
|
108
|
-
VAR
|
109
|
-
median :REAL;
|
110
|
-
i,j :INTEGER;
|
111
|
-
BEGIN
|
112
|
-
|
113
|
-
n := VAL(INTEGER,array_len) - 1; (* back to zero offset *)
|
114
|
-
|
115
|
-
(* initialize the index *)
|
116
|
-
FOR i := 0 TO n DO
|
117
|
-
index[i] := VAL(CARDINAL,i);
|
118
|
-
END;
|
119
|
-
|
120
|
-
tos := 0;
|
121
|
-
|
122
|
-
L := 0; R := n;
|
123
|
-
|
124
|
-
(* PUSH very first set *)
|
125
|
-
tos := tos + 1; Lstack[tos] := L; Rstack[tos] := R;
|
126
|
-
|
127
|
-
REPEAT
|
128
|
-
|
129
|
-
(* POP *)
|
130
|
-
L := Lstack[tos]; R := Rstack[tos]; tos := tos - 1;
|
131
|
-
|
132
|
-
IF R - L + 1 > n_small THEN
|
133
|
-
|
134
|
-
REPEAT
|
135
|
-
i := L; j := R; median := x[index[( L + R ) DIV 2]];
|
136
|
-
|
137
|
-
REPEAT
|
138
|
-
WHILE x[index[i]] < median DO
|
139
|
-
i := i + 1;
|
140
|
-
END;
|
141
|
-
WHILE median < x[index[j]] DO
|
142
|
-
j := j - 1;
|
143
|
-
END;
|
144
|
-
|
145
|
-
IF i <= j THEN (* swap *)
|
146
|
-
ctemp := index[i]; index[i] := index[j]; index[j] := ctemp;
|
147
|
-
i := i + 1; j := j - 1;
|
148
|
-
END;
|
149
|
-
UNTIL i > j;
|
150
|
-
|
151
|
-
IF j - L < R - i THEN
|
152
|
-
IF i < R THEN (* PUSH *)
|
153
|
-
tos := tos + 1; Lstack[tos] := i; Rstack[tos] := R;
|
154
|
-
END;
|
155
|
-
R := j;
|
156
|
-
ELSE
|
157
|
-
IF L < j THEN (* push *)
|
158
|
-
tos := tos + 1; Lstack[tos] := L; Rstack[tos] := j;
|
159
|
-
END;
|
160
|
-
L := i;
|
161
|
-
END;
|
162
|
-
|
163
|
-
UNTIL L >= R;
|
164
|
-
|
165
|
-
ELSE
|
166
|
-
|
167
|
-
(* small sort for small number of values *)
|
168
|
-
FOR i := L TO R - 1 DO
|
169
|
-
FOR j := i TO R DO
|
170
|
-
IF x[index[i]] > x[index[j]] THEN
|
171
|
-
ctemp := index[i];
|
172
|
-
index[i] := index[j];
|
173
|
-
index[j] := ctemp
|
174
|
-
END;
|
175
|
-
END;
|
176
|
-
END;
|
177
|
-
|
178
|
-
END; (* check for small *)
|
179
|
-
|
180
|
-
UNTIL tos = 0;
|
181
|
-
|
182
|
-
END RealQSortIndex;
|
183
|
-
|
184
|
-
(* --------------------------------------------------- *)
|
185
|
-
PROCEDURE CardQSort( VAR x :ARRAY OF CARDINAL; array_len :CARDINAL );
|
186
|
-
|
187
|
-
VAR
|
188
|
-
median : CARDINAL;
|
189
|
-
n,i,j : INTEGER;
|
190
|
-
BEGIN
|
191
|
-
|
192
|
-
n := VAL(INTEGER,array_len) - 1; (* back to zero offset *)
|
193
|
-
|
194
|
-
tos := 0;
|
195
|
-
|
196
|
-
L := 0; R := n;
|
197
|
-
|
198
|
-
(* PUSH very first set *)
|
199
|
-
tos := tos + 1; Lstack[tos] := L; Rstack[tos] := R;
|
200
|
-
|
201
|
-
REPEAT
|
202
|
-
|
203
|
-
(* POP *)
|
204
|
-
L := Lstack[tos]; R := Rstack[tos]; tos := tos - 1;
|
205
|
-
|
206
|
-
IF R - L + 1 > n_small THEN
|
207
|
-
|
208
|
-
REPEAT
|
209
|
-
i := L; j := R; median := x[( L + R ) DIV 2];
|
210
|
-
|
211
|
-
REPEAT
|
212
|
-
WHILE x[i] < median DO
|
213
|
-
i := i + 1;
|
214
|
-
END;
|
215
|
-
WHILE median < x[j] DO
|
216
|
-
j := j - 1;
|
217
|
-
END;
|
218
|
-
|
219
|
-
IF i <= j THEN (* swap *)
|
220
|
-
ctemp := x[i]; x[i] := x[j]; x[j] := ctemp;
|
221
|
-
i := i + 1; j := j - 1;
|
222
|
-
END;
|
223
|
-
UNTIL i > j;
|
224
|
-
|
225
|
-
IF j - L < R - i THEN
|
226
|
-
IF i < R THEN (* PUSH *)
|
227
|
-
tos := tos + 1; Lstack[tos] := i; Rstack[tos] := R;
|
228
|
-
END;
|
229
|
-
R := j;
|
230
|
-
ELSE
|
231
|
-
IF L < j THEN (* push *)
|
232
|
-
tos := tos + 1; Lstack[tos] := L; Rstack[tos] := j;
|
233
|
-
END;
|
234
|
-
L := i;
|
235
|
-
END;
|
236
|
-
|
237
|
-
UNTIL L >= R;
|
238
|
-
|
239
|
-
ELSE
|
240
|
-
|
241
|
-
(* small sort for small number of values *)
|
242
|
-
FOR i := L TO R - 1 DO
|
243
|
-
FOR j := i TO R DO
|
244
|
-
IF x[i] > x[j] THEN
|
245
|
-
ctemp := x[i];
|
246
|
-
x[i] := x[j];
|
247
|
-
x[j] := ctemp
|
248
|
-
END;
|
249
|
-
END;
|
250
|
-
END;
|
251
|
-
|
252
|
-
END; (* check for small *)
|
253
|
-
|
254
|
-
UNTIL tos = 0;
|
255
|
-
|
256
|
-
END CardQSort;
|
257
|
-
|
258
|
-
(* ----------------------------------------------------- *)
|
259
|
-
PROCEDURE CardBSort( VAR x :ARRAY OF CARDINAL; array_len :CARDINAL );
|
260
|
-
VAR i,j : INTEGER;
|
261
|
-
BEGIN
|
262
|
-
top := 0; (* open arrays are zero offset *)
|
263
|
-
bottom := VAL(INTEGER,array_len) - 1;
|
264
|
-
|
265
|
-
WHILE top < bottom DO
|
266
|
-
|
267
|
-
lastflip := top;
|
268
|
-
|
269
|
-
FOR i := top TO bottom-1 DO
|
270
|
-
IF x[i] > x[i+1] THEN (* flip *)
|
271
|
-
ctemp := x[i];
|
272
|
-
x[i] := x[i+1];
|
273
|
-
x[i+1] := ctemp;
|
274
|
-
lastflip := i;
|
275
|
-
END;
|
276
|
-
END;
|
277
|
-
|
278
|
-
bottom := lastflip;
|
279
|
-
|
280
|
-
IF bottom > top THEN
|
281
|
-
|
282
|
-
i := bottom - 1;
|
283
|
-
FOR j := top TO bottom-1 DO
|
284
|
-
IF x[i] > x[i+1] THEN (* flip *)
|
285
|
-
ctemp := x[i];
|
286
|
-
x[i] := x[i+1];
|
287
|
-
x[i+1] := ctemp;
|
288
|
-
lastflip := i;
|
289
|
-
END;
|
290
|
-
i := i - 1;
|
291
|
-
END;
|
292
|
-
|
293
|
-
top := lastflip + 1;
|
294
|
-
|
295
|
-
ELSE
|
296
|
-
(* force a loop failure *)
|
297
|
-
top := bottom + 1;
|
298
|
-
END;
|
299
|
-
|
300
|
-
END;
|
301
|
-
|
302
|
-
END CardBSort;
|
303
|
-
|
304
|
-
|
305
|
-
(* ----------------------------------------------------- *)
|
306
|
-
PROCEDURE RealBSort( VAR x :ARRAY OF REAL; array_len :CARDINAL );
|
307
|
-
VAR bottom,top : INTEGER;
|
308
|
-
i,j : INTEGER;
|
309
|
-
BEGIN
|
310
|
-
top := 0; (* open arrays are zero offset *)
|
311
|
-
bottom := VAL(INTEGER,array_len) - 1;
|
312
|
-
|
313
|
-
WHILE top < bottom DO
|
314
|
-
|
315
|
-
lastflip := top;
|
316
|
-
|
317
|
-
FOR i := top TO bottom-1 DO
|
318
|
-
IF x[i] > x[i+1] THEN (* flip *)
|
319
|
-
rtemp := x[i];
|
320
|
-
x[i] := x[i+1];
|
321
|
-
x[i+1] := rtemp;
|
322
|
-
lastflip := i;
|
323
|
-
END;
|
324
|
-
END;
|
325
|
-
|
326
|
-
bottom := lastflip;
|
327
|
-
|
328
|
-
IF bottom > top THEN
|
329
|
-
|
330
|
-
i := bottom - 1;
|
331
|
-
FOR j := top TO bottom-1 DO
|
332
|
-
IF x[i] > x[i+1] THEN (* flip *)
|
333
|
-
rtemp := x[i];
|
334
|
-
x[i] := x[i+1];
|
335
|
-
x[i+1] := rtemp;
|
336
|
-
lastflip := i;
|
337
|
-
END;
|
338
|
-
i := i - 1;
|
339
|
-
END;
|
340
|
-
|
341
|
-
top := lastflip + 1;
|
342
|
-
|
343
|
-
ELSE
|
344
|
-
(* force a loop failure *)
|
345
|
-
top := bottom + 1;
|
346
|
-
END;
|
347
|
-
|
348
|
-
END;
|
349
|
-
|
350
|
-
END RealBSort;
|
351
|
-
|
352
|
-
|
353
|
-
(* ----------------------------------------------------- *)
|
354
|
-
PROCEDURE TopoSort( x, y :ARRAY OF CARDINAL; n_pairs :CARDINAL;
|
355
|
-
VAR solution :ARRAY OF CARDINAL; VAR n_solution :CARDINAL;
|
356
|
-
VAR error, sorted :BOOLEAN );
|
357
|
-
(*
|
358
|
-
This procedure needs some garbage collection added, i've tried but
|
359
|
-
will little success. J. Andrea, Dec.18/91
|
360
|
-
*)
|
361
|
-
|
362
|
-
TYPE
|
363
|
-
LPtr = POINTER TO Leader;
|
364
|
-
TPtr = POINTER TO Trailer;
|
365
|
-
|
366
|
-
Leader = RECORD
|
367
|
-
key :CARDINAL;
|
368
|
-
count :INTEGER;
|
369
|
-
trail :TPtr;
|
370
|
-
next :LPtr;
|
371
|
-
END;
|
372
|
-
|
373
|
-
Trailer = RECORD
|
374
|
-
id :LPtr;
|
375
|
-
next :TPtr;
|
376
|
-
END;
|
377
|
-
|
378
|
-
VAR
|
379
|
-
p, q, head, tail :LPtr;
|
380
|
-
t :TPtr;
|
381
|
-
i, max_solutions :CARDINAL;
|
382
|
-
|
383
|
-
(* -------------------------------------------- *)
|
384
|
-
PROCEDURE Find( w :CARDINAL ) :LPtr;
|
385
|
-
VAR h :LPtr;
|
386
|
-
BEGIN
|
387
|
-
h := head; tail^.key := w; (* sentinel *)
|
388
|
-
WHILE h^.key # w DO
|
389
|
-
h := h^.next;
|
390
|
-
END;
|
391
|
-
IF h = tail THEN
|
392
|
-
NEW( tail );
|
393
|
-
n := n + 1;
|
394
|
-
h^.count := 0;
|
395
|
-
h^.trail := NIL;
|
396
|
-
h^.next := tail;
|
397
|
-
END;
|
398
|
-
RETURN h;
|
399
|
-
END Find;
|
400
|
-
|
401
|
-
BEGIN
|
402
|
-
|
403
|
-
error := FALSE;
|
404
|
-
n_solution := 0;
|
405
|
-
|
406
|
-
IF n_pairs < 2 THEN
|
407
|
-
error := TRUE;
|
408
|
-
ELSE
|
409
|
-
|
410
|
-
max_solutions := HIGH( solution ) + 1;
|
411
|
-
|
412
|
-
NEW( head ); tail := head; n := 0;
|
413
|
-
|
414
|
-
(* add all of the given pairs *)
|
415
|
-
|
416
|
-
FOR i := 0 TO n_pairs - 1 DO
|
417
|
-
p := Find( x[i] ); q := Find( y[i] );
|
418
|
-
NEW(t);
|
419
|
-
t^.id := q;
|
420
|
-
t^.next := p^.trail;
|
421
|
-
p^.trail := t;
|
422
|
-
q^.count := q^.count + 1;
|
423
|
-
END;
|
424
|
-
|
425
|
-
(* search for leaders without predecessors *)
|
426
|
-
|
427
|
-
p := head; head := NIL;
|
428
|
-
WHILE p # tail DO
|
429
|
-
q := p; p := q^.next;
|
430
|
-
IF q^.count = 0 THEN
|
431
|
-
(* insert q^ in new chain *)
|
432
|
-
q^.next := head; head := q;
|
433
|
-
END;
|
434
|
-
END;
|
435
|
-
|
436
|
-
(* output phase *)
|
437
|
-
|
438
|
-
q := head;
|
439
|
-
WHILE ( NOT error ) & ( q # NIL ) DO
|
440
|
-
n_solution := n_solution + 1;
|
441
|
-
IF n_solution > max_solutions THEN
|
442
|
-
error := TRUE;
|
443
|
-
ELSE
|
444
|
-
|
445
|
-
solution[n_solution-1] := q^.key;
|
446
|
-
n := n - 1;
|
447
|
-
t := q^.trail; q := q^.next;
|
448
|
-
WHILE t # NIL DO
|
449
|
-
p := t^.id; p^.count := p^.count - 1;
|
450
|
-
IF p^.count = 0 THEN
|
451
|
-
(* insert p^ in leader list *)
|
452
|
-
p^.next := q; q := p;
|
453
|
-
END;
|
454
|
-
t := t^.next;
|
455
|
-
END;
|
456
|
-
END;
|
457
|
-
END;
|
458
|
-
|
459
|
-
IF n # 0 THEN
|
460
|
-
sorted := FALSE;
|
461
|
-
ELSE
|
462
|
-
sorted := TRUE;
|
463
|
-
END;
|
464
|
-
|
465
|
-
END;
|
466
|
-
|
467
|
-
END TopoSort;
|
468
|
-
|
469
|
-
BEGIN
|
470
|
-
END Sorting.
|