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,138 +0,0 @@
|
|
1
|
-
(: made up functions, etc just to test xquery parsing (: even embedded comments
|
2
|
-
on multiple :)
|
3
|
-
lines
|
4
|
-
:)
|
5
|
-
xquery version "1.0";
|
6
|
-
|
7
|
-
module namespace xqueryexample "http://example.com/namespace";
|
8
|
-
import module namespace importedns = "http://example.com/ns/imported" at "no/such/file.xqy";
|
9
|
-
|
10
|
-
declare namespace sess = "com.example.session";
|
11
|
-
|
12
|
-
declare variable $amazing := "awesome";
|
13
|
-
declare variable $SESSIONS as element(sess:session)* := c:sessions();
|
14
|
-
|
15
|
-
declare option sess:clear "false";
|
16
|
-
|
17
|
-
define function whatsit($param as xs:string) as xs:string {
|
18
|
-
let $var1 := 1
|
19
|
-
let $var2 := 2
|
20
|
-
return (1 + 2 div ($var1 + $var2))
|
21
|
-
|
22
|
-
let $let := <x>"test"</x>
|
23
|
-
return (: some whitespace :) element element {
|
24
|
-
attribute attribute { 1 },
|
25
|
-
element test { 'a' },
|
26
|
-
attribute foo { "bar" },
|
27
|
-
fn:doc()[ foo/@bar eq $let ],
|
28
|
-
//x/with/another/*/*:version/xpath/@attr }
|
29
|
-
};
|
30
|
-
|
31
|
-
let $bride := "Bride"
|
32
|
-
let $test := validate lax { <some>html</some> }
|
33
|
-
let $test := validate strict { <some>html</some> }
|
34
|
-
let $test := validate { <some>html</some> }
|
35
|
-
let $test := $var1/*:Article (: comment here :) [fn:not()]
|
36
|
-
let $test := $var1/@*:name/fn:string()
|
37
|
-
|
38
|
-
let $noop := ordered { $test }
|
39
|
-
let $noop := unordered { $test }
|
40
|
-
|
41
|
-
let $noop :=
|
42
|
-
for $version at $i in $versions/version
|
43
|
-
let $row := if($i mod 2 eq 0) then "even" else "odd"
|
44
|
-
order by $version descending
|
45
|
-
return
|
46
|
-
|
47
|
-
return
|
48
|
-
<html xmlns="http://www.w3.org/1999/xhtml">
|
49
|
-
{
|
50
|
-
<outer>
|
51
|
-
<movie>
|
52
|
-
<title>The Princess { fn:capitalize($bride) }</title>
|
53
|
-
</movie>
|
54
|
-
<form action="" method="post" id="session-form" call="callsomething()">
|
55
|
-
<input type="hidden" name="{$d:DEBUG-FIELD}" value="{$d:DEBUG}"/>
|
56
|
-
{
|
57
|
-
(: placeholder for local sessions :)
|
58
|
-
element div {
|
59
|
-
attribute id { "sessions-local" },
|
60
|
-
attribute class { "hidden" },
|
61
|
-
element h1 { "Local Sessions" },
|
62
|
-
element p {
|
63
|
-
'These sessions use storage provided by your browser.',
|
64
|
-
'You can also ',
|
65
|
-
element a {
|
66
|
-
attribute href { 'session-import-local.xqy' },
|
67
|
-
'import' },
|
68
|
-
' sessions from local XML files.'
|
69
|
-
}
|
70
|
-
}
|
71
|
-
}
|
72
|
-
{
|
73
|
-
for $i in $sessions
|
74
|
-
let $id := c:session-id($i)
|
75
|
-
let $uri := c:session-uri($i)
|
76
|
-
(: we only care about the lock that expires last :)
|
77
|
-
let $conflicting := c:conflicting-locks($uri, 1)
|
78
|
-
let $name as xs:string := ($i/sess:name, "(unnamed)")[1]
|
79
|
-
return element tr {
|
80
|
-
element td { $name },
|
81
|
-
element td { string($i/sec:user) },
|
82
|
-
element td { data($i/sess:created) },
|
83
|
-
element td { data($i/sess:last-modified) },
|
84
|
-
element td {
|
85
|
-
if (empty($conflicting)) then () else
|
86
|
-
text {
|
87
|
-
"by", $conflicting/lock:owner,
|
88
|
-
"until", adjust-dateTime-to-timezone(
|
89
|
-
x:epoch-seconds-to-dateTime(
|
90
|
-
$conflicting/lock:timestamp + $conflicting/lock:timeout
|
91
|
-
)
|
92
|
-
)
|
93
|
-
},
|
94
|
-
(: only show resume button if there are no conflicting locks :)
|
95
|
-
element input {
|
96
|
-
attribute type { "button" },
|
97
|
-
attribute title {
|
98
|
-
data($i/sess:query-buffers/sess:query[1]) },
|
99
|
-
attribute onclick {
|
100
|
-
concat("list.resumeSession('", $id, "')") },
|
101
|
-
attribute value {
|
102
|
-
"Resume", (' ', $id)[ $d:DEBUG ] }
|
103
|
-
}[ not($conflicting) ],
|
104
|
-
$x:NBSP,
|
105
|
-
(: clone button :)
|
106
|
-
element input {
|
107
|
-
attribute type { "button" },
|
108
|
-
attribute title { "clone this session" },
|
109
|
-
attribute onclick {
|
110
|
-
concat("list.cloneSession('", $id, "', this)") },
|
111
|
-
attribute value { "Clone", (' ', $id)[ $d:DEBUG ] }
|
112
|
-
},
|
113
|
-
$x:NBSP,
|
114
|
-
(: export button :)
|
115
|
-
element input {
|
116
|
-
attribute type { "button" },
|
117
|
-
attribute title { "export this session" },
|
118
|
-
attribute onclick {
|
119
|
-
concat("list.exportServerSession('", $id, "', this)") },
|
120
|
-
attribute value { "Export", (' ', $id)[ $d:DEBUG ] }
|
121
|
-
},
|
122
|
-
$x:NBSP,
|
123
|
-
(: only show delete button if there are no conflicting locks :)
|
124
|
-
element input {
|
125
|
-
attribute type { "button" },
|
126
|
-
attribute title { "permanently delete this session" },
|
127
|
-
attribute onclick {
|
128
|
-
concat("list.deleteSession('", $id, "', this)") },
|
129
|
-
attribute value { "Delete", (' ', $id)[ $d:DEBUG ] }
|
130
|
-
}[ not($conflicting) ]
|
131
|
-
}
|
132
|
-
}
|
133
|
-
}
|
134
|
-
</form>
|
135
|
-
</outer>
|
136
|
-
}
|
137
|
-
<tr><td><!-- some commented things--> </td></tr>
|
138
|
-
</html>
|
@@ -1,23 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
3
|
-
<xsl:output method="xml"/>
|
4
|
-
<xsl:template match="/">
|
5
|
-
<customers>
|
6
|
-
<xsl:apply-templates select="customers/customer[@Country='Germany']"/>
|
7
|
-
</customers>
|
8
|
-
</xsl:template>
|
9
|
-
<xsl:template match="customers">
|
10
|
-
<xsl:apply-templates/>
|
11
|
-
|
12
|
-
</xsl:template>
|
13
|
-
<xsl:template match="customer">
|
14
|
-
<customer>
|
15
|
-
<xsl:attribute name="CompanyName"><xsl:value-of select="@CompanyName"/></xsl:attribute>
|
16
|
-
<xsl:attribute name="CustomerID"><xsl:value-of select="@CustomerID"/></xsl:attribute>
|
17
|
-
<xsl:attribute name="Country"><xsl:value-of select="@Country"/></xsl:attribute>
|
18
|
-
</customer>
|
19
|
-
<xsl:apply-templates/>
|
20
|
-
</xsl:template>
|
21
|
-
|
22
|
-
</xsl:stylesheet>
|
23
|
-
|
@@ -1,33 +0,0 @@
|
|
1
|
-
namespace Test;
|
2
|
-
|
3
|
-
use Test\Foo;
|
4
|
-
|
5
|
-
class Bar
|
6
|
-
{
|
7
|
-
protected a;
|
8
|
-
private b;
|
9
|
-
public c {set, get};
|
10
|
-
|
11
|
-
public function __construct(string str, boolean bool)
|
12
|
-
{
|
13
|
-
let this->c = str;
|
14
|
-
this->setC(bool);
|
15
|
-
let this->b = [];
|
16
|
-
}
|
17
|
-
|
18
|
-
public function sayHello(string name)
|
19
|
-
{
|
20
|
-
echo "Hello " . name;
|
21
|
-
}
|
22
|
-
|
23
|
-
protected function loops()
|
24
|
-
{
|
25
|
-
for a in b {
|
26
|
-
echo a;
|
27
|
-
}
|
28
|
-
loop {
|
29
|
-
return "boo!";
|
30
|
-
}
|
31
|
-
}
|
32
|
-
|
33
|
-
}
|
@@ -1,120 +0,0 @@
|
|
1
|
-
[2f1dd6c3b8b7] {jit-log-opt-loop
|
2
|
-
# Loop 0 (<Function object at 0xb720e550> ds1dr4 dsdr3 ds1dr4) : loop with 115 ops
|
3
|
-
[p0, p1]
|
4
|
-
+33: label(p0, p1, descr=TargetToken(-1223434224))
|
5
|
-
debug_merge_point(0, 0, '<Function object at 0xb710b120> ds1dr4 dsdr3 ds1dr4')
|
6
|
-
+33: guard_nonnull_class(p1, 138371488, descr=<Guard2>) [p1, p0]
|
7
|
-
+54: p3 = getfield_gc_pure(p1, descr=<FieldP pyhaskell.interpreter.haskell.Substitution.inst_rhs 8>)
|
8
|
-
+57: guard_value(p3, ConstPtr(ptr4), descr=<Guard3>) [p1, p0, p3]
|
9
|
-
+69: p5 = getfield_gc_pure(p1, descr=<FieldP pyhaskell.interpreter.haskell.Substitution.inst_subst 12>)
|
10
|
-
+72: p7 = getarrayitem_gc(p5, 0, descr=<ArrayP 4>)
|
11
|
-
+75: guard_class(p7, 138371552, descr=<Guard4>) [p0, p5, p7]
|
12
|
-
+88: p9 = getfield_gc(p7, descr=<FieldP pyhaskell.interpreter.haskell.Thunk.inst_application 8>)
|
13
|
-
+91: guard_nonnull_class(p9, 138373024, descr=<Guard5>) [p0, p5, p7, p9]
|
14
|
-
+109: p12 = getarrayitem_gc(p5, 1, descr=<ArrayP 4>)
|
15
|
-
+112: guard_class(p12, 138371552, descr=<Guard6>) [p0, p5, p12, p7]
|
16
|
-
+125: p14 = getfield_gc(p12, descr=<FieldP pyhaskell.interpreter.haskell.Thunk.inst_application 8>)
|
17
|
-
+128: guard_nonnull_class(p14, 138373024, descr=<Guard7>) [p0, p5, p12, p14, p7]
|
18
|
-
debug_merge_point(0, 0, 'None')
|
19
|
-
debug_merge_point(0, 0, 'None')
|
20
|
-
+146: p16 = getfield_gc_pure(p9, descr=<FieldP pyhaskell.interpreter.haskell.Application.inst_function 8>)
|
21
|
-
+149: guard_value(p16, ConstPtr(ptr17), descr=<Guard8>) [p16, p9, p0, p12, p7]
|
22
|
-
+161: p18 = getfield_gc_pure(p9, descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg0 12>)
|
23
|
-
+164: guard_class(p18, 138371648, descr=<Guard9>) [p18, p9, p0, p12, p7]
|
24
|
-
+177: p20 = getfield_gc_pure(p9, descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg1 16>)
|
25
|
-
+180: guard_class(p20, 138371648, descr=<Guard10>) [p20, p9, p18, p0, p12, p7]
|
26
|
-
+193: p22 = getfield_gc_pure(p9, descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg2 20>)
|
27
|
-
+196: guard_class(p22, 138371936, descr=<Guard11>) [p22, p9, p20, p18, p0, p12, p7]
|
28
|
-
debug_merge_point(0, 0, 'None')
|
29
|
-
+209: p24 = getfield_gc_pure(p22, descr=<FieldP pyhaskell.interpreter.haskell.Application.inst_function 8>)
|
30
|
-
+215: guard_value(p24, ConstPtr(ptr25), descr=<Guard12>) [p24, p22, p9, None, None, p0, p12, p7]
|
31
|
-
+227: p27 = getfield_gc_pure(p22, descr=<FieldP pyhaskell.interpreter.haskell.Application1.inst_arg0 12>)
|
32
|
-
+230: guard_class(p27, 138371648, descr=<Guard13>) [p22, p27, p9, None, None, p0, p12, p7]
|
33
|
-
debug_merge_point(0, 0, '_')
|
34
|
-
debug_merge_point(0, 0, 'None')
|
35
|
-
+243: p30 = getfield_gc(ConstPtr(ptr29), descr=<FieldP pyhaskell.interpreter.module.CoreMod.inst_qvars 24>)
|
36
|
-
+249: i34 = call(ConstClass(ll_dict_lookup_trampoline__v64___simple_call__function_ll), p30, ConstPtr(ptr32), 360200661, descr=<Calli 4 rri EF=4>)
|
37
|
-
+281: guard_no_exception(, descr=<Guard14>) [p27, p20, p18, i34, p30, None, None, None, p0, p12, p7]
|
38
|
-
+294: i36 = int_and(i34, -2147483648)
|
39
|
-
+302: i37 = int_is_true(i36)
|
40
|
-
guard_false(i37, descr=<Guard15>) [p27, p20, p18, i34, p30, None, None, None, p0, p12, p7]
|
41
|
-
+311: p38 = getfield_gc(p30, descr=<FieldP dicttable.entries 12>)
|
42
|
-
+314: p39 = getinteriorfield_gc(p38, i34, descr=<InteriorFieldDescr <FieldP dictentry.value 4>>)
|
43
|
-
+318: i40 = instance_ptr_eq(p18, p39)
|
44
|
-
guard_true(i40, descr=<Guard16>) [p27, p20, None, None, None, p0, p12, p7]
|
45
|
-
debug_merge_point(0, 0, 'None')
|
46
|
-
+327: i41 = getfield_gc_pure(p20, descr=<FieldS pyhaskell.interpreter.primtype.Int.inst_value 8>)
|
47
|
-
+330: i42 = getfield_gc_pure(p27, descr=<FieldS pyhaskell.interpreter.primtype.Int.inst_value 8>)
|
48
|
-
+333: i43 = int_sub(i41, i42)
|
49
|
-
debug_merge_point(0, 0, 'None')
|
50
|
-
debug_merge_point(0, 0, 'None')
|
51
|
-
debug_merge_point(0, 0, 'None')
|
52
|
-
+335: i45 = int_eq(0, i43)
|
53
|
-
guard_false(i45, descr=<Guard17>) [p0, i43, None, None, None, None, p12, p7]
|
54
|
-
p47 = new_with_vtable(138371648)
|
55
|
-
+393: setfield_gc(p47, i43, descr=<FieldS pyhaskell.interpreter.primtype.Int.inst_value 8>)
|
56
|
-
setfield_gc(p7, p47, descr=<FieldP pyhaskell.interpreter.haskell.Thunk.inst_application 8>)
|
57
|
-
+414: p48 = getfield_gc(p12, descr=<FieldP pyhaskell.interpreter.haskell.Thunk.inst_application 8>)
|
58
|
-
+420: guard_nonnull_class(p48, 138371648, descr=<Guard18>) [p0, p48, p12, p47, p7]
|
59
|
-
debug_merge_point(0, 0, '<PrimFunction object at 0x83f3f6c> 1 <Function object at 0xb710b3b0> 1 <Function object at 0xb710b3c0> <PrimFunction object at 0x83f3f3c> 1 dsdr3 <Function object at 0xb710b210> 1')
|
60
|
-
debug_merge_point(0, 0, 'None')
|
61
|
-
debug_merge_point(0, 0, '_')
|
62
|
-
debug_merge_point(0, 0, 'None')
|
63
|
-
debug_merge_point(0, 0, 'None')
|
64
|
-
debug_merge_point(0, 0, '<Function object at 0xb710b3d0> dsdr3 dsdr3')
|
65
|
-
debug_merge_point(0, 0, '<Function object at 0xb710b120> ds1dr4 dsdr3 ds1dr4')
|
66
|
-
+438: label(p0, p48, p30, p38, descr=TargetToken(-1223434176))
|
67
|
-
debug_merge_point(0, 0, '<Function object at 0xb710b120> ds1dr4 dsdr3 ds1dr4')
|
68
|
-
debug_merge_point(0, 0, 'None')
|
69
|
-
debug_merge_point(0, 0, 'None')
|
70
|
-
debug_merge_point(0, 0, 'None')
|
71
|
-
debug_merge_point(0, 0, '_')
|
72
|
-
debug_merge_point(0, 0, 'None')
|
73
|
-
+438: i50 = call(ConstClass(ll_dict_lookup_trampoline__v64___simple_call__function_ll), p30, ConstPtr(ptr32), 360200661, descr=<Calli 4 rri EF=4>)
|
74
|
-
+464: guard_no_exception(, descr=<Guard19>) [p48, i50, p30, p0]
|
75
|
-
+477: i51 = int_and(i50, -2147483648)
|
76
|
-
+485: i52 = int_is_true(i51)
|
77
|
-
guard_false(i52, descr=<Guard20>) [p48, i50, p30, p0]
|
78
|
-
+494: p53 = getinteriorfield_gc(p38, i50, descr=<InteriorFieldDescr <FieldP dictentry.value 4>>)
|
79
|
-
+501: i55 = instance_ptr_eq(ConstPtr(ptr54), p53)
|
80
|
-
guard_true(i55, descr=<Guard21>) [p48, p0]
|
81
|
-
debug_merge_point(0, 0, 'None')
|
82
|
-
+513: i56 = getfield_gc_pure(p48, descr=<FieldS pyhaskell.interpreter.primtype.Int.inst_value 8>)
|
83
|
-
+516: i58 = int_sub(i56, 1)
|
84
|
-
debug_merge_point(0, 0, 'None')
|
85
|
-
debug_merge_point(0, 0, 'None')
|
86
|
-
debug_merge_point(0, 0, 'None')
|
87
|
-
+519: i59 = int_eq(0, i58)
|
88
|
-
guard_false(i59, descr=<Guard22>) [i58, p48, p0]
|
89
|
-
debug_merge_point(0, 0, '<PrimFunction object at 0x83f3f6c> 1 <Function object at 0xb710b3b0> 1 <Function object at 0xb710b3c0> <PrimFunction object at 0x83f3f3c> 1 dsdr3 <Function object at 0xb710b210> 1')
|
90
|
-
debug_merge_point(0, 0, 'None')
|
91
|
-
debug_merge_point(0, 0, '_')
|
92
|
-
debug_merge_point(0, 0, 'None')
|
93
|
-
debug_merge_point(0, 0, 'None')
|
94
|
-
debug_merge_point(0, 0, '<Function object at 0xb710b3d0> dsdr3 dsdr3')
|
95
|
-
debug_merge_point(0, 0, '<Function object at 0xb710b120> ds1dr4 dsdr3 ds1dr4')
|
96
|
-
p61 = new_with_vtable(138371700)
|
97
|
-
p63 = new_with_vtable(138373024)
|
98
|
-
p65 = new_with_vtable(138371936)
|
99
|
-
+606: setfield_gc(p63, ConstPtr(ptr66), descr=<FieldP pyhaskell.interpreter.haskell.Application.inst_function 8>)
|
100
|
-
p68 = new_with_vtable(138373024)
|
101
|
-
+632: setfield_gc(p65, ConstPtr(ptr69), descr=<FieldP pyhaskell.interpreter.haskell.Application.inst_function 8>)
|
102
|
-
p71 = new_with_vtable(138371936)
|
103
|
-
+658: setfield_gc(p68, ConstPtr(ptr17), descr=<FieldP pyhaskell.interpreter.haskell.Application.inst_function 8>)
|
104
|
-
+665: setfield_gc(p71, ConstPtr(ptr72), descr=<FieldP pyhaskell.interpreter.haskell.Application1.inst_arg0 12>)
|
105
|
-
+672: setfield_gc(p68, p71, descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg2 20>)
|
106
|
-
+675: setfield_gc(p68, p48, descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg1 16>)
|
107
|
-
+678: setfield_gc(p68, ConstPtr(ptr54), descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg0 12>)
|
108
|
-
p73 = new_with_vtable(138371648)
|
109
|
-
+701: setfield_gc(p61, p0, descr=<FieldP pyhaskell.interpreter.haskell.StackElement.inst_next 8>)
|
110
|
-
+716: setfield_gc(p61, 2, descr=<FieldS pyhaskell.interpreter.haskell.CopyStackElement.inst_index 16>)
|
111
|
-
+723: setfield_gc(p71, ConstPtr(ptr25), descr=<FieldP pyhaskell.interpreter.haskell.Application.inst_function 8>)
|
112
|
-
+730: setfield_gc(p65, p68, descr=<FieldP pyhaskell.interpreter.haskell.Application1.inst_arg0 12>)
|
113
|
-
+733: setfield_gc(p63, p65, descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg2 20>)
|
114
|
-
+736: setfield_gc(p63, ConstPtr(ptr75), descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg1 16>)
|
115
|
-
+743: setfield_gc(p63, ConstPtr(ptr54), descr=<FieldP pyhaskell.interpreter.haskell.Application3.inst_arg0 12>)
|
116
|
-
+750: setfield_gc(p61, p63, descr=<FieldP pyhaskell.interpreter.haskell.CopyStackElement.inst_application 12>)
|
117
|
-
+753: setfield_gc(p73, i58, descr=<FieldS pyhaskell.interpreter.primtype.Int.inst_value 8>)
|
118
|
-
+762: jump(p61, p73, p30, p38, descr=TargetToken(-1223434176))
|
119
|
-
+775: --end of the loop--
|
120
|
-
[2f1dd6da3b99] jit-log-opt-loop}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 314, in dispatch_request
|
2
|
-
dispatcher.dispatch(req)
|
3
|
-
File "/usr/lib/python2.3/site-packages/trac/web/main.py", line 186, in dispatch
|
4
|
-
req.session = Session(self.env, req)
|
5
|
-
File "/usr/lib/python2.3/site-packages/trac/web/session.py", line 52, in __init__
|
6
|
-
self.promote_session(sid)
|
7
|
-
File "/usr/lib/python2.3/site-packages/trac/web/session.py", line 125, in promote_session
|
8
|
-
"AND authenticated=0", (sid,))
|
9
|
-
File "/usr/lib/python2.3/site-packages/trac/db/util.py", line 47, in execute
|
10
|
-
return self.cursor.execute(sql_escape_percent(sql), args)
|
11
|
-
File "/usr/lib/python2.3/site-packages/trac/db/sqlite_backend.py", line 44, in execute
|
12
|
-
args or [])
|
13
|
-
File "/usr/lib/python2.3/site-packages/trac/db/sqlite_backend.py", line 36, in _rollback_on_error
|
14
|
-
return function(self, *args, **kwargs)
|
15
|
-
OperationalError: database is locked
|
@@ -1,1218 +0,0 @@
|
|
1
|
-
;;;; TYPEP und Verwandtes
|
2
|
-
;;;; Michael Stoll, 21. 10. 1988
|
3
|
-
;;;; Bruno Haible, 10.6.1989
|
4
|
-
;;;; Sam Steingold 2000-2005
|
5
|
-
|
6
|
-
;;; Datenstrukturen für TYPEP:
|
7
|
-
;;; - Ein Type-Specifier-Symbol hat auf seiner Propertyliste unter dem
|
8
|
-
;;; Indikator SYS::TYPE-SYMBOL eine Funktion von einem Argument, die
|
9
|
-
;;; testet, ob ein Objekt vom richtigen Typ ist.
|
10
|
-
;;; - Ein Symbol, das eine Type-Specifier-Liste beginnen kann, hat auf seiner
|
11
|
-
;;; Propertyliste unter dem Indikator SYS::TYPE-LIST eine Funktion von
|
12
|
-
;;; einem Argument für das zu testende Objekt und zusätzlichen Argumenten
|
13
|
-
;;; für die Listenelemente.
|
14
|
-
;;; - Ein Symbol, das als Typmacro definiert wurde, hat auf seiner Property-
|
15
|
-
;;; liste unter dem Indikator SYSTEM::DEFTYPE-EXPANDER den zugehörigen
|
16
|
-
;;; Expander: eine Funktion, die den zu expandierenden Type-Specifier (eine
|
17
|
-
;;; mindestens einelementige Liste) als Argument bekommt.
|
18
|
-
|
19
|
-
(in-package "EXT")
|
20
|
-
(export '(type-expand))
|
21
|
-
(in-package "SYSTEM")
|
22
|
-
|
23
|
-
; vorläufig, solange bis clos.lisp geladen wird:
|
24
|
-
(eval-when (eval)
|
25
|
-
(predefun clos::built-in-class-p (object) (declare (ignore object)) nil))
|
26
|
-
(unless (fboundp 'clos::class-name)
|
27
|
-
(defun clos::class-name (c) (declare (ignore c)) nil)
|
28
|
-
)
|
29
|
-
|
30
|
-
(defun typespec-error (fun type)
|
31
|
-
(error-of-type 'error
|
32
|
-
(TEXT "~S: invalid type specification ~S")
|
33
|
-
fun type
|
34
|
-
) )
|
35
|
-
|
36
|
-
;; ============================================================================
|
37
|
-
|
38
|
-
;; return the CLOS class named by TYPESPEC or NIL
|
39
|
-
(defun clos-class (typespec)
|
40
|
-
(let ((cc (get typespec 'CLOS::CLOSCLASS)))
|
41
|
-
(when (and cc (clos::defined-class-p cc) (eq (clos:class-name cc) typespec))
|
42
|
-
cc)))
|
43
|
-
|
44
|
-
;;; TYPEP, CLTL S. 72, S. 42-51
|
45
|
-
(defun typep (x y &optional env &aux f) ; x = Objekt, y = Typ
|
46
|
-
(declare (ignore env))
|
47
|
-
(setq y (expand-deftype y))
|
48
|
-
(cond
|
49
|
-
((symbolp y)
|
50
|
-
(cond ((setq f (get y 'TYPE-SYMBOL)) (funcall f x))
|
51
|
-
((setq f (get y 'TYPE-LIST)) (funcall f x))
|
52
|
-
((setq f (get y 'DEFSTRUCT-DESCRIPTION)) (ds-typep x y f))
|
53
|
-
((setq f (clos-class y))
|
54
|
-
; It's not worth handling structure classes specially here.
|
55
|
-
(clos::typep-class x f))
|
56
|
-
(t (typespec-error 'typep y))
|
57
|
-
) )
|
58
|
-
((and (consp y) (symbolp (first y)))
|
59
|
-
(cond
|
60
|
-
((and (eq (first y) 'SATISFIES) (eql (length y) 2))
|
61
|
-
(unless (symbolp (second y))
|
62
|
-
(error-of-type 'error
|
63
|
-
(TEXT "~S: argument to SATISFIES must be a symbol: ~S")
|
64
|
-
'typep (second y)
|
65
|
-
) )
|
66
|
-
(if (funcall (symbol-function (second y)) x) t nil)
|
67
|
-
)
|
68
|
-
((eq (first y) 'MEMBER)
|
69
|
-
(if (member x (rest y)) t nil)
|
70
|
-
)
|
71
|
-
((and (eq (first y) 'EQL) (eql (length y) 2))
|
72
|
-
(eql x (second y))
|
73
|
-
)
|
74
|
-
((and (eq (first y) 'NOT) (eql (length y) 2))
|
75
|
-
(not (typep x (second y)))
|
76
|
-
)
|
77
|
-
((eq (first y) 'AND)
|
78
|
-
(dolist (type (rest y) t)
|
79
|
-
(unless (typep x type) (return nil))
|
80
|
-
) )
|
81
|
-
((eq (first y) 'OR)
|
82
|
-
(dolist (type (rest y) nil)
|
83
|
-
(when (typep x type) (return t))
|
84
|
-
) )
|
85
|
-
((setq f (get (first y) 'TYPE-LIST)) (apply f x (rest y)))
|
86
|
-
(t (typespec-error 'typep y))
|
87
|
-
) )
|
88
|
-
((clos::defined-class-p y) (clos::typep-class x y))
|
89
|
-
((clos::eql-specializer-p y) (eql x (clos::eql-specializer-singleton y)))
|
90
|
-
((encodingp y) (charset-typep x y))
|
91
|
-
(t (typespec-error 'typep y))
|
92
|
-
) )
|
93
|
-
|
94
|
-
;; ----------------------------------------------------------------------------
|
95
|
-
|
96
|
-
;; UPGRADED-ARRAY-ELEMENT-TYPE is a lattice homomorphism, see
|
97
|
-
;; ANSI CL 15.1.2.1.
|
98
|
-
(defun upgraded-array-element-type (type &optional environment)
|
99
|
-
(declare (ignore environment))
|
100
|
-
;; see array.d
|
101
|
-
(case type
|
102
|
-
((BIT) 'BIT)
|
103
|
-
((CHARACTER) 'CHARACTER)
|
104
|
-
((T) 'T)
|
105
|
-
((NIL) 'NIL)
|
106
|
-
(t (if (subtypep type 'NIL)
|
107
|
-
'NIL
|
108
|
-
(multiple-value-bind (low high) (sys::subtype-integer type)
|
109
|
-
; Es gilt (or (null low) (subtypep type `(INTEGER ,low ,high)))
|
110
|
-
(if (and (integerp low) (not (minusp low)) (integerp high))
|
111
|
-
(let ((l (integer-length high)))
|
112
|
-
; Es gilt (subtypep type `(UNSIGNED-BYTE ,l))
|
113
|
-
(cond ((<= l 1) 'BIT)
|
114
|
-
((<= l 2) '(UNSIGNED-BYTE 2))
|
115
|
-
((<= l 4) '(UNSIGNED-BYTE 4))
|
116
|
-
((<= l 8) '(UNSIGNED-BYTE 8))
|
117
|
-
((<= l 16) '(UNSIGNED-BYTE 16))
|
118
|
-
((<= l 32) '(UNSIGNED-BYTE 32))
|
119
|
-
(t 'T)))
|
120
|
-
(if (subtypep type 'CHARACTER)
|
121
|
-
'CHARACTER
|
122
|
-
'T)))))))
|
123
|
-
|
124
|
-
;; ----------------------------------------------------------------------------
|
125
|
-
|
126
|
-
;; UPGRADED-COMPLEX-PART-TYPE is a lattice homomorphism, see
|
127
|
-
;; HyperSpec/Body/fun_complex.html and HyperSpec/Body/syscla_complex.html,
|
128
|
-
;; and an idempotent. Therefore
|
129
|
-
;; (subtypep (upgraded-complex-part-type T1) (upgraded-complex-part-type T2))
|
130
|
-
;; is equivalent to
|
131
|
-
;; (subtypep T1 (upgraded-complex-part-type T2))
|
132
|
-
;; (Proof: Let U T be an abbreviation for (upgraded-complex-part-type T).
|
133
|
-
;; If U T1 <= U T2, then T1 <= U T1 <= U T2.
|
134
|
-
;; If T1 <= U T2, then by homomorphism U T1 <= U U T2 = U T2.)
|
135
|
-
;;
|
136
|
-
;; For _any_ CL implementation, you could define
|
137
|
-
;; (defun upgraded-complex-part-type (type) 'REAL)
|
138
|
-
;; Likewise for _any_ CL implementation, you could define
|
139
|
-
;; (defun upgraded-complex-part-type (type) type)
|
140
|
-
;; or - again for _any_ CL implementation:
|
141
|
-
;; (defun upgraded-complex-part-type (type)
|
142
|
-
;; (cond ((subtypep type 'NIL) 'NIL)
|
143
|
-
;; ((subtypep type 'SHORT-FLOAT) 'SHORT-FLOAT)
|
144
|
-
;; ((subtypep type 'SINGLE-FLOAT) 'SINGLE-FLOAT)
|
145
|
-
;; ((subtypep type 'DOUBLE-FLOAT) 'DOUBLE-FLOAT)
|
146
|
-
;; ((subtypep type 'LONG-FLOAT) 'LONG-FLOAT)
|
147
|
-
;; ((subtypep type 'RATIONAL) 'RATIONAL)
|
148
|
-
;; ((subtypep type 'REAL) 'REAL)
|
149
|
-
;; (t (error ...))))
|
150
|
-
;; The reason is that a complex number is immutable: no setters for the
|
151
|
-
;; realpart and imagpart exist.
|
152
|
-
;;
|
153
|
-
;; We choose the second implementation because it allows the most precise
|
154
|
-
;; type inference.
|
155
|
-
(defun upgraded-complex-part-type (type &optional environment)
|
156
|
-
(declare (ignore environment))
|
157
|
-
(if (subtypep type 'REAL)
|
158
|
-
type
|
159
|
-
(error-of-type 'error
|
160
|
-
(TEXT "~S: type ~S is not a subtype of ~S")
|
161
|
-
'upgraded-complex-part-type type 'real)))
|
162
|
-
|
163
|
-
;; ----------------------------------------------------------------------------
|
164
|
-
|
165
|
-
;; Macros for defining the various built-in "atomic type specifier"s and
|
166
|
-
;; "compound type specifier"s. The following macros add information for both
|
167
|
-
;; the TYPEP function above and the c-TYPEP in the compiler.
|
168
|
-
|
169
|
-
; Alist symbol -> funname, used by the compiler.
|
170
|
-
(defparameter c-typep-alist1 '())
|
171
|
-
; Alist symbol -> lambdabody, used by the compiler.
|
172
|
-
(defparameter c-typep-alist2 '())
|
173
|
-
; Alist symbol -> expander function, used by the compiler.
|
174
|
-
(defparameter c-typep-alist3 '())
|
175
|
-
|
176
|
-
; (def-atomic-type symbol function-name)
|
177
|
-
; defines an atomic type. The function-name designates a function taking one
|
178
|
-
; argument and returning a generalized boolean value. It can be either a
|
179
|
-
; symbol or a lambda expression.
|
180
|
-
(defmacro def-atomic-type (symbol funname)
|
181
|
-
(let ((lambdap (and (consp funname) (eq (car funname) 'LAMBDA))))
|
182
|
-
`(PROGN
|
183
|
-
(SETF (GET ',symbol 'TYPE-SYMBOL)
|
184
|
-
,(if lambdap
|
185
|
-
`(FUNCTION ,(concat-pnames "TYPE-SYMBOL-" symbol) ,funname)
|
186
|
-
`(FUNCTION ,funname)
|
187
|
-
)
|
188
|
-
)
|
189
|
-
,(if lambdap
|
190
|
-
`(SETQ C-TYPEP-ALIST2
|
191
|
-
(NCONC C-TYPEP-ALIST2 (LIST (CONS ',symbol ',(cdr funname))))
|
192
|
-
)
|
193
|
-
`(SETQ C-TYPEP-ALIST1
|
194
|
-
(NCONC C-TYPEP-ALIST1 (LIST (CONS ',symbol ',funname)))
|
195
|
-
)
|
196
|
-
)
|
197
|
-
',symbol
|
198
|
-
)
|
199
|
-
) )
|
200
|
-
|
201
|
-
; (def-compound-type symbol lambda-list (x) check-form typep-form c-typep-form)
|
202
|
-
; defines a compound type. The lambda-list is of the form (&optional ...)
|
203
|
-
; where the arguments come from the CDR of the type specifier.
|
204
|
-
; For typep-form, x is an object.
|
205
|
-
; For c-typep-form, x is a multiply evaluatable form (actually a gensym).
|
206
|
-
; check-form is a form performing error checking, may call `error'.
|
207
|
-
; typep-form should return a generalized boolean value.
|
208
|
-
; c-typep-form should produce a form returning a generalized boolean value.
|
209
|
-
(defmacro def-compound-type (symbol lambdalist (var) check-form typep-form c-typep-form)
|
210
|
-
`(PROGN
|
211
|
-
(SETF (GET ',symbol 'TYPE-LIST)
|
212
|
-
(FUNCTION ,(concat-pnames "TYPE-LIST-" symbol)
|
213
|
-
(LAMBDA (,var ,@lambdalist)
|
214
|
-
,@(if check-form
|
215
|
-
`((MACROLET ((ERROR (&REST ERROR-ARGS)
|
216
|
-
(LIST* 'ERROR-OF-TYPE ''ERROR ERROR-ARGS)
|
217
|
-
))
|
218
|
-
,check-form
|
219
|
-
))
|
220
|
-
)
|
221
|
-
,typep-form
|
222
|
-
) ) )
|
223
|
-
(SETQ C-TYPEP-ALIST3
|
224
|
-
(NCONC C-TYPEP-ALIST3
|
225
|
-
(LIST (CONS ',symbol
|
226
|
-
#'(LAMBDA (,var ,@lambdalist &REST ILLEGAL-ARGS)
|
227
|
-
(DECLARE (IGNORE ILLEGAL-ARGS))
|
228
|
-
,@(if check-form
|
229
|
-
`((MACROLET ((ERROR (&REST ERROR-ARGS)
|
230
|
-
(LIST 'PROGN
|
231
|
-
(LIST* 'C-WARN ERROR-ARGS)
|
232
|
-
'(THROW 'C-TYPEP NIL)
|
233
|
-
)) )
|
234
|
-
,check-form
|
235
|
-
))
|
236
|
-
)
|
237
|
-
,c-typep-form
|
238
|
-
)
|
239
|
-
) ) ) )
|
240
|
-
',symbol
|
241
|
-
)
|
242
|
-
)
|
243
|
-
|
244
|
-
; CLtL1 p. 43
|
245
|
-
(def-atomic-type ARRAY arrayp)
|
246
|
-
(def-atomic-type ATOM atom)
|
247
|
-
(def-atomic-type BASE-CHAR
|
248
|
-
#+BASE-CHAR=CHARACTER
|
249
|
-
characterp
|
250
|
-
#-BASE-CHAR=CHARACTER
|
251
|
-
(lambda (x) (and (characterp x) (base-char-p x)))
|
252
|
-
)
|
253
|
-
(def-atomic-type BASE-STRING
|
254
|
-
(lambda (x)
|
255
|
-
(and (stringp x)
|
256
|
-
(eq (array-element-type x)
|
257
|
-
#+BASE-CHAR=CHARACTER 'CHARACTER #-BASE-CHAR=CHARACTER 'BASE-CHAR
|
258
|
-
) ) ) )
|
259
|
-
(def-atomic-type BIGNUM
|
260
|
-
(lambda (x) (and (integerp x) (not (fixnump x))))
|
261
|
-
)
|
262
|
-
(def-atomic-type BIT
|
263
|
-
(lambda (x) (or (eql x 0) (eql x 1)))
|
264
|
-
)
|
265
|
-
(def-atomic-type BIT-VECTOR bit-vector-p)
|
266
|
-
(def-atomic-type BOOLEAN
|
267
|
-
(lambda (x) (or (eq x 'nil) (eq x 't)))
|
268
|
-
)
|
269
|
-
(def-atomic-type CHARACTER characterp)
|
270
|
-
(def-atomic-type COMPILED-FUNCTION compiled-function-p)
|
271
|
-
(def-atomic-type COMPLEX complexp)
|
272
|
-
(def-atomic-type CONS consp)
|
273
|
-
(def-atomic-type DOUBLE-FLOAT double-float-p)
|
274
|
-
(def-atomic-type ENCODING encodingp)
|
275
|
-
(def-atomic-type EXTENDED-CHAR
|
276
|
-
#+BASE-CHAR=CHARACTER
|
277
|
-
(lambda (x) (declare (ignore x)) nil)
|
278
|
-
#-BASE-CHAR=CHARACTER
|
279
|
-
(lambda (x) (and (characterp x) (not (base-char-p x))))
|
280
|
-
)
|
281
|
-
(def-atomic-type FIXNUM fixnump)
|
282
|
-
(def-atomic-type FLOAT floatp)
|
283
|
-
(def-atomic-type FUNCTION functionp)
|
284
|
-
(def-atomic-type HASH-TABLE hash-table-p)
|
285
|
-
(def-atomic-type INTEGER integerp)
|
286
|
-
(def-atomic-type KEYWORD keywordp)
|
287
|
-
(def-atomic-type LIST listp)
|
288
|
-
#+LOGICAL-PATHNAMES
|
289
|
-
(def-atomic-type LOGICAL-PATHNAME logical-pathname-p)
|
290
|
-
(def-atomic-type LONG-FLOAT long-float-p)
|
291
|
-
(def-atomic-type NIL
|
292
|
-
(lambda (x) (declare (ignore x)) nil)
|
293
|
-
)
|
294
|
-
(def-atomic-type NULL null)
|
295
|
-
(def-atomic-type NUMBER numberp)
|
296
|
-
(def-atomic-type PACKAGE packagep)
|
297
|
-
(def-atomic-type PATHNAME pathnamep)
|
298
|
-
(def-atomic-type RANDOM-STATE random-state-p)
|
299
|
-
(def-atomic-type RATIO
|
300
|
-
(lambda (x) (and (rationalp x) (not (integerp x))))
|
301
|
-
)
|
302
|
-
(def-atomic-type RATIONAL rationalp)
|
303
|
-
(def-atomic-type READTABLE readtablep)
|
304
|
-
(def-atomic-type REAL realp)
|
305
|
-
(def-atomic-type SEQUENCE sequencep)
|
306
|
-
(def-atomic-type SHORT-FLOAT short-float-p)
|
307
|
-
(def-atomic-type SIMPLE-ARRAY simple-array-p)
|
308
|
-
(def-atomic-type SIMPLE-BASE-STRING
|
309
|
-
(lambda (x)
|
310
|
-
(and (simple-string-p x)
|
311
|
-
(eq (array-element-type x)
|
312
|
-
#+BASE-CHAR=CHARACTER 'CHARACTER #-BASE-CHAR=CHARACTER 'BASE-CHAR
|
313
|
-
) ) ) )
|
314
|
-
(def-atomic-type SIMPLE-BIT-VECTOR simple-bit-vector-p)
|
315
|
-
(def-atomic-type SIMPLE-STRING simple-string-p)
|
316
|
-
(def-atomic-type SIMPLE-VECTOR simple-vector-p)
|
317
|
-
(def-atomic-type SINGLE-FLOAT single-float-p)
|
318
|
-
(defun %standard-char-p (x) (and (characterp x) (standard-char-p x))) ; ABI
|
319
|
-
(def-atomic-type STANDARD-CHAR %standard-char-p)
|
320
|
-
(def-atomic-type CLOS:STANDARD-OBJECT clos::std-instance-p)
|
321
|
-
(def-atomic-type STREAM streamp)
|
322
|
-
(def-atomic-type FILE-STREAM file-stream-p)
|
323
|
-
(def-atomic-type SYNONYM-STREAM synonym-stream-p)
|
324
|
-
(def-atomic-type BROADCAST-STREAM broadcast-stream-p)
|
325
|
-
(def-atomic-type CONCATENATED-STREAM concatenated-stream-p)
|
326
|
-
(def-atomic-type TWO-WAY-STREAM two-way-stream-p)
|
327
|
-
(def-atomic-type ECHO-STREAM echo-stream-p)
|
328
|
-
(def-atomic-type STRING-STREAM string-stream-p)
|
329
|
-
(def-atomic-type STRING stringp)
|
330
|
-
(def-atomic-type STRING-CHAR characterp)
|
331
|
-
(def-atomic-type CLOS:STRUCTURE-OBJECT clos::structure-object-p)
|
332
|
-
(def-atomic-type SYMBOL symbolp)
|
333
|
-
(def-atomic-type T (lambda (x) (declare (ignore x)) t))
|
334
|
-
;; foreign1.lisp is loaded after this file,
|
335
|
-
;; so these symbols are not external yet
|
336
|
-
#+ffi
|
337
|
-
(def-atomic-type ffi::foreign-function
|
338
|
-
(lambda (x) (eq 'ffi::foreign-function (type-of x))))
|
339
|
-
#+ffi
|
340
|
-
(def-atomic-type ffi::foreign-variable
|
341
|
-
(lambda (x) (eq 'ffi::foreign-variable (type-of x))))
|
342
|
-
#+ffi
|
343
|
-
(def-atomic-type ffi::foreign-address
|
344
|
-
(lambda (x) (eq 'ffi::foreign-address (type-of x))))
|
345
|
-
;; see lispbibl.d (#define FOREIGN) and predtype.d (TYPE-OF):
|
346
|
-
#+(or unix ffi affi win32)
|
347
|
-
(def-atomic-type foreign-pointer
|
348
|
-
(lambda (x) (eq 'foreign-pointer (type-of x))))
|
349
|
-
(def-atomic-type VECTOR vectorp)
|
350
|
-
(def-atomic-type PLIST
|
351
|
-
(lambda (x) (multiple-value-bind (length tail) (list-length-dotted x)
|
352
|
-
(and (null tail) (evenp length)))))
|
353
|
-
|
354
|
-
(defmacro ensure-dim (type dim)
|
355
|
-
;; make sure DIM is a valid dimension
|
356
|
-
`(unless (or (eq ,dim '*) (typep ,dim `(INTEGER 0 (,ARRAY-DIMENSION-LIMIT))))
|
357
|
-
(error (TEXT "~S: dimension ~S is invalid") ',type ,dim)))
|
358
|
-
|
359
|
-
(defmacro ensure-rank (type rank)
|
360
|
-
;; make sure RANK is a valid rank
|
361
|
-
`(unless (typep ,rank `(INTEGER 0 (,ARRAY-RANK-LIMIT)))
|
362
|
-
(error (TEXT "~S: rank ~S is invalid") ',type ,rank)))
|
363
|
-
|
364
|
-
; CLtL1 p. 46-50
|
365
|
-
(defun c-typep-array (tester el-type dims x)
|
366
|
-
`(AND (,tester ,x)
|
367
|
-
,@(if (eq el-type '*)
|
368
|
-
'()
|
369
|
-
`((EQUAL (ARRAY-ELEMENT-TYPE ,x) ',(upgraded-array-element-type el-type)))
|
370
|
-
)
|
371
|
-
,@(if (eq dims '*)
|
372
|
-
'()
|
373
|
-
(if (numberp dims)
|
374
|
-
`((EQL ,dims (ARRAY-RANK ,x)))
|
375
|
-
`((EQL ,(length dims) (ARRAY-RANK ,x))
|
376
|
-
,@(let ((i 0))
|
377
|
-
(mapcap #'(lambda (dim)
|
378
|
-
(prog1
|
379
|
-
(if (eq dim '*)
|
380
|
-
'()
|
381
|
-
`((EQL ',dim (ARRAY-DIMENSION ,x ,i)))
|
382
|
-
)
|
383
|
-
(incf i)
|
384
|
-
) )
|
385
|
-
dims
|
386
|
-
) )
|
387
|
-
)
|
388
|
-
) )
|
389
|
-
)
|
390
|
-
)
|
391
|
-
(defun c-typep-vector (tester size x)
|
392
|
-
`(AND (,tester ,x)
|
393
|
-
,@(if (eq size '*)
|
394
|
-
'()
|
395
|
-
`((EQL ',size (ARRAY-DIMENSION ,x 0)))
|
396
|
-
)
|
397
|
-
)
|
398
|
-
)
|
399
|
-
(defun typep-number-test (x low high test type)
|
400
|
-
(and (funcall test x)
|
401
|
-
(cond ((eq low '*))
|
402
|
-
((funcall test low) (<= low x))
|
403
|
-
((and (consp low) (null (rest low)) (funcall test (first low)))
|
404
|
-
(< (first low) x)
|
405
|
-
)
|
406
|
-
(t (error-of-type 'error
|
407
|
-
#1=(TEXT "~S: argument to ~S must be *, ~S or a list of ~S: ~S")
|
408
|
-
'typep type type type low
|
409
|
-
) ) )
|
410
|
-
(cond ((eq high '*))
|
411
|
-
((funcall test high) (>= high x))
|
412
|
-
((and (consp high) (null (rest high)) (funcall test (first high)))
|
413
|
-
(> (first high) x)
|
414
|
-
)
|
415
|
-
(t (error-of-type 'error
|
416
|
-
#1# 'typep type type type high
|
417
|
-
) ) ) ) )
|
418
|
-
(defun c-typep-number (caller tester low high x)
|
419
|
-
`(AND (,tester ,x)
|
420
|
-
,@(cond ((eq low '*) '())
|
421
|
-
((funcall tester low) `((<= ,low ,x)))
|
422
|
-
((and (consp low) (null (rest low)) (funcall tester (first low)))
|
423
|
-
`((< ,(first low) ,x))
|
424
|
-
)
|
425
|
-
(t (c-warn #1=(TEXT "~S: argument to ~S must be *, ~S or a list of ~S: ~S")
|
426
|
-
'typep caller caller caller low
|
427
|
-
)
|
428
|
-
(throw 'c-TYPEP nil)
|
429
|
-
) )
|
430
|
-
,@(cond ((eq high '*) '())
|
431
|
-
((funcall tester high) `((>= ,high ,x)))
|
432
|
-
((and (consp high) (null (rest high)) (funcall tester (first high)))
|
433
|
-
`((> ,(first high) ,x))
|
434
|
-
)
|
435
|
-
(t (c-warn #1# 'typep caller caller caller high)
|
436
|
-
(throw 'c-TYPEP nil)
|
437
|
-
) )
|
438
|
-
)
|
439
|
-
)
|
440
|
-
(def-compound-type ARRAY (&optional (el-type '*) (dims '*)) (x)
|
441
|
-
(unless (eq dims '*)
|
442
|
-
(if (numberp dims)
|
443
|
-
(ensure-rank ARRAY dims)
|
444
|
-
(dolist (dim dims) (ensure-dim ARRAY dim))))
|
445
|
-
(and (arrayp x)
|
446
|
-
(or (eq el-type '*)
|
447
|
-
(equal (array-element-type x) (upgraded-array-element-type el-type))
|
448
|
-
)
|
449
|
-
(or (eq dims '*)
|
450
|
-
(if (numberp dims)
|
451
|
-
(eql dims (array-rank x))
|
452
|
-
(and (eql (length dims) (array-rank x))
|
453
|
-
(every #'(lambda (a b) (or (eq a '*) (eql a b)))
|
454
|
-
dims (array-dimensions x)
|
455
|
-
) ) ) ) )
|
456
|
-
(c-typep-array 'ARRAYP el-type dims x)
|
457
|
-
)
|
458
|
-
(def-compound-type SIMPLE-ARRAY (&optional (el-type '*) (dims '*)) (x)
|
459
|
-
(unless (eq dims '*)
|
460
|
-
(if (numberp dims)
|
461
|
-
(ensure-rank SIMPLE-ARRAY dims)
|
462
|
-
(dolist (dim dims) (ensure-dim SIMPLE-ARRAY dim))))
|
463
|
-
(and (simple-array-p x)
|
464
|
-
(or (eq el-type '*)
|
465
|
-
(equal (array-element-type x) (upgraded-array-element-type el-type))
|
466
|
-
)
|
467
|
-
(or (eq dims '*)
|
468
|
-
(if (numberp dims)
|
469
|
-
(eql dims (array-rank x))
|
470
|
-
(and (eql (length dims) (array-rank x))
|
471
|
-
(every #'(lambda (a b) (or (eq a '*) (eql a b)))
|
472
|
-
dims (array-dimensions x)
|
473
|
-
) ) ) ) )
|
474
|
-
(c-typep-array 'SIMPLE-ARRAY-P el-type dims x)
|
475
|
-
)
|
476
|
-
(def-compound-type VECTOR (&optional (el-type '*) (size '*)) (x)
|
477
|
-
(ensure-dim VECTOR size)
|
478
|
-
(and (vectorp x)
|
479
|
-
(or (eq el-type '*)
|
480
|
-
(equal (array-element-type x) (upgraded-array-element-type el-type))
|
481
|
-
)
|
482
|
-
(or (eq size '*) (eql (array-dimension x 0) size))
|
483
|
-
)
|
484
|
-
`(AND (VECTORP ,x)
|
485
|
-
,@(if (eq el-type '*)
|
486
|
-
'()
|
487
|
-
`((EQUAL (ARRAY-ELEMENT-TYPE ,x) ',(upgraded-array-element-type el-type)))
|
488
|
-
)
|
489
|
-
,@(if (eq size '*)
|
490
|
-
'()
|
491
|
-
`((EQL (ARRAY-DIMENSION ,x 0) ',size))
|
492
|
-
)
|
493
|
-
)
|
494
|
-
)
|
495
|
-
(def-compound-type SIMPLE-VECTOR (&optional (size '*)) (x)
|
496
|
-
(ensure-dim SIMLPE-VECTOR size)
|
497
|
-
(and (simple-vector-p x)
|
498
|
-
(or (eq size '*) (eql size (array-dimension x 0)))
|
499
|
-
)
|
500
|
-
(c-typep-vector 'SIMPLE-VECTOR-P size x)
|
501
|
-
)
|
502
|
-
(def-compound-type COMPLEX (&optional (rtype '*) (itype rtype)) (x)
|
503
|
-
nil
|
504
|
-
(and (complexp x)
|
505
|
-
(or (eq rtype '*)
|
506
|
-
(typep (realpart x) (upgraded-complex-part-type rtype)))
|
507
|
-
(or (eq itype '*)
|
508
|
-
(typep (imagpart x) (upgraded-complex-part-type itype))))
|
509
|
-
`(AND (COMPLEXP ,x)
|
510
|
-
,@(if (eq rtype '*)
|
511
|
-
'()
|
512
|
-
`((TYPEP (REALPART ,x) ',(upgraded-complex-part-type rtype))))
|
513
|
-
,@(if (eq itype '*)
|
514
|
-
'()
|
515
|
-
`((TYPEP (IMAGPART ,x) ',(upgraded-complex-part-type itype))))))
|
516
|
-
(def-compound-type INTEGER (&optional (low '*) (high '*)) (x)
|
517
|
-
nil
|
518
|
-
(typep-number-test x low high #'integerp 'INTEGER)
|
519
|
-
(c-typep-number 'INTEGER 'INTEGERP low high x)
|
520
|
-
)
|
521
|
-
(def-compound-type MOD (n) (x)
|
522
|
-
(unless (integerp n)
|
523
|
-
(error (TEXT "~S: argument to MOD must be an integer: ~S")
|
524
|
-
'typep n
|
525
|
-
) )
|
526
|
-
(and (integerp x) (<= 0 x) (< x n))
|
527
|
-
`(AND (INTEGERP ,x) (NOT (MINUSP ,x)) (< ,x ,n))
|
528
|
-
)
|
529
|
-
(def-compound-type SIGNED-BYTE (&optional (n '*)) (x)
|
530
|
-
(unless (or (eq n '*) (integerp n))
|
531
|
-
(error (TEXT "~S: argument to SIGNED-BYTE must be an integer or * : ~S")
|
532
|
-
'typep n
|
533
|
-
) )
|
534
|
-
(and (integerp x) (or (eq n '*) (< (integer-length x) n)))
|
535
|
-
`(AND (INTEGERP ,x)
|
536
|
-
,@(if (eq n '*) '() `((< (INTEGER-LENGTH ,x) ,n)))
|
537
|
-
)
|
538
|
-
)
|
539
|
-
(def-compound-type UNSIGNED-BYTE (&optional (n '*)) (x)
|
540
|
-
(unless (or (eq n '*) (integerp n))
|
541
|
-
(error (TEXT "~S: argument to UNSIGNED-BYTE must be an integer or * : ~S")
|
542
|
-
'typep n
|
543
|
-
) )
|
544
|
-
(and (integerp x)
|
545
|
-
(not (minusp x))
|
546
|
-
(or (eq n '*) (<= (integer-length x) n))
|
547
|
-
)
|
548
|
-
`(AND (INTEGERP ,x) (NOT (MINUSP ,x))
|
549
|
-
,@(if (eq n '*) '() `((<= (INTEGER-LENGTH ,x) ,n)))
|
550
|
-
)
|
551
|
-
)
|
552
|
-
(def-compound-type REAL (&optional (low '*) (high '*)) (x)
|
553
|
-
nil
|
554
|
-
(typep-number-test x low high #'realp 'REAL)
|
555
|
-
(c-typep-number 'REAL 'REALP low high x)
|
556
|
-
)
|
557
|
-
(def-compound-type RATIONAL (&optional (low '*) (high '*)) (x)
|
558
|
-
nil
|
559
|
-
(typep-number-test x low high #'rationalp 'RATIONAL)
|
560
|
-
(c-typep-number 'RATIONAL 'RATIONALP low high x)
|
561
|
-
)
|
562
|
-
(def-compound-type FLOAT (&optional (low '*) (high '*)) (x)
|
563
|
-
nil
|
564
|
-
(typep-number-test x low high #'floatp 'FLOAT)
|
565
|
-
(c-typep-number 'FLOAT 'FLOATP low high x)
|
566
|
-
)
|
567
|
-
(def-compound-type SHORT-FLOAT (&optional (low '*) (high '*)) (x)
|
568
|
-
nil
|
569
|
-
(typep-number-test x low high #'short-float-p 'SHORT-FLOAT)
|
570
|
-
(c-typep-number 'SHORT-FLOAT 'SHORT-FLOAT-P low high x)
|
571
|
-
)
|
572
|
-
(def-compound-type SINGLE-FLOAT (&optional (low '*) (high '*)) (x)
|
573
|
-
nil
|
574
|
-
(typep-number-test x low high #'single-float-p 'SINGLE-FLOAT)
|
575
|
-
(c-typep-number 'SINGLE-FLOAT 'SINGLE-FLOAT-P low high x)
|
576
|
-
)
|
577
|
-
(def-compound-type DOUBLE-FLOAT (&optional (low '*) (high '*)) (x)
|
578
|
-
nil
|
579
|
-
(typep-number-test x low high #'double-float-p 'DOUBLE-FLOAT)
|
580
|
-
(c-typep-number 'DOUBLE-FLOAT 'DOUBLE-FLOAT-P low high x)
|
581
|
-
)
|
582
|
-
(def-compound-type LONG-FLOAT (&optional (low '*) (high '*)) (x)
|
583
|
-
nil
|
584
|
-
(typep-number-test x low high #'long-float-p 'LONG-FLOAT)
|
585
|
-
(c-typep-number 'LONG-FLOAT 'LONG-FLOAT-P low high x)
|
586
|
-
)
|
587
|
-
(def-compound-type STRING (&optional (size '*)) (x)
|
588
|
-
(ensure-dim STRING size)
|
589
|
-
(and (stringp x)
|
590
|
-
(or (eq size '*) (eql size (array-dimension x 0)))
|
591
|
-
)
|
592
|
-
(c-typep-vector 'STRINGP size x)
|
593
|
-
)
|
594
|
-
(def-compound-type SIMPLE-STRING (&optional (size '*)) (x)
|
595
|
-
(ensure-dim SIMPLE-STRING size)
|
596
|
-
(and (simple-string-p x)
|
597
|
-
(or (eq size '*) (eql size (array-dimension x 0)))
|
598
|
-
)
|
599
|
-
(c-typep-vector 'SIMPLE-STRING-P size x)
|
600
|
-
)
|
601
|
-
(def-compound-type BASE-STRING (&optional (size '*)) (x)
|
602
|
-
(ensure-dim BASE-STRING size)
|
603
|
-
(and (stringp x)
|
604
|
-
(or (eq size '*) (eql size (array-dimension x 0)))
|
605
|
-
)
|
606
|
-
(c-typep-vector 'STRINGP size x)
|
607
|
-
)
|
608
|
-
(def-compound-type SIMPLE-BASE-STRING (&optional (size '*)) (x)
|
609
|
-
(ensure-dim SIMPLE-BASE-STRING size)
|
610
|
-
(and (simple-string-p x)
|
611
|
-
(or (eq size '*) (eql size (array-dimension x 0)))
|
612
|
-
)
|
613
|
-
(c-typep-vector 'SIMPLE-STRING-P size x)
|
614
|
-
)
|
615
|
-
(def-compound-type BIT-VECTOR (&optional (size '*)) (x)
|
616
|
-
(ensure-dim BIT-VECTOR size)
|
617
|
-
(and (bit-vector-p x)
|
618
|
-
(or (eq size '*) (eql size (array-dimension x 0)))
|
619
|
-
)
|
620
|
-
(c-typep-vector 'BIT-VECTOR-P size x)
|
621
|
-
)
|
622
|
-
(def-compound-type SIMPLE-BIT-VECTOR (&optional (size '*)) (x)
|
623
|
-
(ensure-dim SIMPLE-BIT-VECTOR size)
|
624
|
-
(and (simple-bit-vector-p x)
|
625
|
-
(or (eq size '*) (eql size (array-dimension x 0)))
|
626
|
-
)
|
627
|
-
(c-typep-vector 'SIMPLE-BIT-VECTOR-P size x)
|
628
|
-
)
|
629
|
-
(def-compound-type CONS (&optional (car-type '*) (cdr-type '*)) (x)
|
630
|
-
nil
|
631
|
-
(and (consp x)
|
632
|
-
(or (eq car-type '*) (typep (car x) car-type))
|
633
|
-
(or (eq cdr-type '*) (typep (cdr x) cdr-type))
|
634
|
-
)
|
635
|
-
`(AND (CONSP ,x)
|
636
|
-
,@(if (eq car-type '*) '() `((TYPEP (CAR ,x) ',car-type)))
|
637
|
-
,@(if (eq cdr-type '*) '() `((TYPEP (CDR ,x) ',cdr-type)))
|
638
|
-
)
|
639
|
-
)
|
640
|
-
|
641
|
-
(fmakunbound 'def-compound-type)
|
642
|
-
|
643
|
-
;; ----------------------------------------------------------------------------
|
644
|
-
|
645
|
-
; Typtest ohne Gefahr einer Fehlermeldung. Für SIGNAL und HANDLER-BIND.
|
646
|
-
(defun safe-typep (x y &optional env)
|
647
|
-
(let ((*error-handler*
|
648
|
-
#'(lambda (&rest error-args)
|
649
|
-
(declare (ignore error-args))
|
650
|
-
(return-from safe-typep (values nil nil))
|
651
|
-
)) )
|
652
|
-
(values (typep x y env) t)
|
653
|
-
) )
|
654
|
-
|
655
|
-
; Umwandlung eines "type for declaration" in einen "type for discrimination".
|
656
|
-
(defun type-for-discrimination (y &optional (notp nil) &aux f)
|
657
|
-
(cond ((symbolp y)
|
658
|
-
(cond ((get y 'TYPE-SYMBOL) y)
|
659
|
-
((get y 'TYPE-LIST) y)
|
660
|
-
((setq f (get y 'DEFTYPE-EXPANDER))
|
661
|
-
(let* ((z (funcall f (list y)))
|
662
|
-
(zx (type-for-discrimination z notp)))
|
663
|
-
(if (eql zx z) y zx)
|
664
|
-
))
|
665
|
-
(t y)
|
666
|
-
) )
|
667
|
-
((and (consp y) (symbolp (first y)))
|
668
|
-
(case (first y)
|
669
|
-
((SATISFIES MEMBER EQL) y)
|
670
|
-
(NOT
|
671
|
-
(let* ((z (second y))
|
672
|
-
(zx (type-for-discrimination z (not notp))))
|
673
|
-
(if (eql zx z) y `(NOT ,zx))
|
674
|
-
))
|
675
|
-
((AND OR COMPLEX VALUES)
|
676
|
-
(let* ((z (rest y))
|
677
|
-
(zx (mapcar #'(lambda (x) (type-for-discrimination x notp)) z)))
|
678
|
-
(if (every #'eql z zx) y (cons (first y) zx))
|
679
|
-
))
|
680
|
-
(FUNCTION
|
681
|
-
;; (FUNCTION arg-types res-type) is somewhere between
|
682
|
-
;; NIL and FUNCTION, but undecidable.
|
683
|
-
(if notp 'NIL 'FUNCTION)
|
684
|
-
)
|
685
|
-
(t (cond ((get (first y) 'TYPE-LIST) y)
|
686
|
-
((setq f (get (first y) 'DEFTYPE-EXPANDER))
|
687
|
-
(let* ((z (funcall f y))
|
688
|
-
(zx (type-for-discrimination z notp)))
|
689
|
-
(if (eql zx z) y zx)
|
690
|
-
))
|
691
|
-
(t y)
|
692
|
-
) ) ) )
|
693
|
-
(t y)
|
694
|
-
) )
|
695
|
-
|
696
|
-
; Testet eine Liste von Werten auf Erfüllen eines Type-Specifiers. Für THE.
|
697
|
-
(defun %the (values type) ; ABI
|
698
|
-
(macrolet ((near-typep (objform typform)
|
699
|
-
;; near-typep ist wie typep, nur dass das Objekt auch ein
|
700
|
-
;; Read-Label sein darf. Das tritt z.B. auf bei
|
701
|
-
;; (read-from-string "#1=#S(FOO :X #1#)")
|
702
|
-
;; im Konstruktor MAKE-FOO. Die Implementation ist aber
|
703
|
-
;; nicht gezwungen, bei fehlerhaftem THE zwingend einen
|
704
|
-
;; Fehler zu melden, darum ist ein lascherer Typcheck hier
|
705
|
-
;; erlaubt.
|
706
|
-
(let ((g (gensym)))
|
707
|
-
`(let ((,g ,objform))
|
708
|
-
(or (typep ,g ,typform) (eq (type-of ,g) 'READ-LABEL))))))
|
709
|
-
(if (and (consp type) (eq (car type) 'VALUES))
|
710
|
-
;; The VALUES type specifier is ill-defined in ANSI CL.
|
711
|
-
;;
|
712
|
-
;; There are two possibilities to define a VALUES type specifier in a
|
713
|
-
;; sane way:
|
714
|
-
;; - (EXACT-VALUES type1 ... [&optional ...]) describes the exact shape
|
715
|
-
;; of the values list, as received by MULTIPLE-VALUE-LIST.
|
716
|
-
;; For example, (EXACT-VALUES SYMBOL) is matched by (values 'a) but not
|
717
|
-
;; by (values 'a 'b) or (values).
|
718
|
-
;; - (ASSIGNABLE-VALUES type1 ... [&optional ...]) describes the values
|
719
|
-
;; as received by a set of variables through MULTIPLE-VALUE-BIND or
|
720
|
-
;; MULTIPLE-VALUE-SETQ. For example, (ASSIGNABLE-VALUES SYMBOL) is
|
721
|
-
;; defined by whether
|
722
|
-
;; (MULTIPLE-VALUE-BIND (var1) values (DECLARE (TYPE SYMBOL var1)) ...)
|
723
|
-
;; is valid or not; therefore (ASSIGNABLE-VALUES SYMBOL) is matched by
|
724
|
-
;; (values 'a) and (values 'a 'b) and (values).
|
725
|
-
;; Note that &OPTIONAL is actually redundant here:
|
726
|
-
;; (ASSIGNABLE-VALUES type1 ... &optional otype1 ...)
|
727
|
-
;; is equivalent to
|
728
|
-
;; (ASSIGNABLE-VALUES type1 ... (OR NULL otype1) ...)
|
729
|
-
;; HyperSpec/Body/typspe_values.html indicates that VALUES means
|
730
|
-
;; EXACT-VALUES; however, HyperSpec/Body/speope_the.html indicates that
|
731
|
-
;; VALUES means ASSIGNABLE-VALUES.
|
732
|
-
;;
|
733
|
-
;; SBCL interprets the VALUES type specifier to mean EXACT-VALUES when
|
734
|
-
;; it contains &OPTIONAL or &REST, but ASSIGNABLE-VALUES when it has
|
735
|
-
;; only a tuple of type specifiers. This is utter nonsense, in particular
|
736
|
-
;; because it makes (VALUES type1 ... typek &OPTIONAL)
|
737
|
-
;; different from (VALUES type1 ... typek).
|
738
|
-
;;
|
739
|
-
;; Here we use the ASSIGNABLE-VALUES interpretation.
|
740
|
-
;; In SUBTYPEP we just punt and don't assume any interpretation.
|
741
|
-
(let ((vals values) (types (cdr type)))
|
742
|
-
;; required:
|
743
|
-
(loop
|
744
|
-
(when (or (atom types) (atom vals)) (return-from %the t))
|
745
|
-
(when (memq (car types) lambda-list-keywords) (return))
|
746
|
-
(unless (near-typep (pop vals) (pop types))
|
747
|
-
(return-from %the nil)))
|
748
|
-
;; &optional:
|
749
|
-
(when (and (consp types) (eq (car types) '&optional))
|
750
|
-
(setq types (cdr types))
|
751
|
-
(loop
|
752
|
-
(when (or (atom types) (atom vals)) (return-from %the t))
|
753
|
-
(when (memq (car types) lambda-list-keywords) (return))
|
754
|
-
(unless (near-typep (pop vals) (pop types))
|
755
|
-
(return-from %the nil))))
|
756
|
-
;; &rest &key:
|
757
|
-
(case (car types)
|
758
|
-
(&rest
|
759
|
-
(setq types (cdr types))
|
760
|
-
(when (atom types) (typespec-error 'the type))
|
761
|
-
(unless (near-typep (pop vals) (pop types))
|
762
|
-
(return-from %the nil)))
|
763
|
-
(&key)
|
764
|
-
(t (typespec-error 'the type)))
|
765
|
-
(if (eq (car types) '&key)
|
766
|
-
(progn
|
767
|
-
(setq types (cdr types))
|
768
|
-
(when (oddp (length vals)) (return-from %the nil))
|
769
|
-
(let ((keywords nil))
|
770
|
-
(loop
|
771
|
-
(when (or (atom types) (atom vals)) (return-from %the t))
|
772
|
-
(when (memq (car types) lambda-list-keywords) (return))
|
773
|
-
(let ((item (pop types)))
|
774
|
-
(unless (and (listp item) (eql (length item) 2)
|
775
|
-
(symbolp (first item)))
|
776
|
-
(typespec-error 'the type))
|
777
|
-
(let ((kw (symbol-to-keyword (first item))))
|
778
|
-
(unless (near-typep (getf vals kw) (second item))
|
779
|
-
(return-from %the nil))
|
780
|
-
(push kw keywords))))
|
781
|
-
(if (and (consp types) (eq (car types) '&allow-other-keys))
|
782
|
-
(setq types (cdr types))
|
783
|
-
(unless (getf vals ':allow-other-keys)
|
784
|
-
(do ((L vals (cddr L)))
|
785
|
-
((atom L))
|
786
|
-
(unless (memq (car L) keywords)
|
787
|
-
(return-from %the nil)))))))
|
788
|
-
(when (consp types) (typespec-error 'the type)))
|
789
|
-
t)
|
790
|
-
(near-typep (if (consp values) (car values) nil) type))))
|
791
|
-
|
792
|
-
;;; ===========================================================================
|
793
|
-
|
794
|
-
;; SUBTYPEP
|
795
|
-
(load "subtypep")
|
796
|
-
|
797
|
-
|
798
|
-
;; Returns the number of bytes that are needed to represent #\Null in a
|
799
|
-
;; given encoding.
|
800
|
-
(defun encoding-zeroes (encoding)
|
801
|
-
#+UNICODE
|
802
|
-
;; this should use min_bytes_per_char for cache, not the hash table
|
803
|
-
(let ((name (ext:encoding-charset encoding))
|
804
|
-
(table #.(make-hash-table :key-type '(or string symbol) :value-type 'fixnum
|
805
|
-
:test 'stablehash-equal :warn-if-needs-rehash-after-gc t
|
806
|
-
:initial-contents '(("UTF-7" . 1))))
|
807
|
-
(tester #.(make-string 2 :initial-element (code-char 0))))
|
808
|
-
(or (gethash name table)
|
809
|
-
(setf (gethash name table)
|
810
|
-
(- (length (ext:convert-string-to-bytes tester encoding))
|
811
|
-
(length (ext:convert-string-to-bytes tester encoding
|
812
|
-
:end 1))))))
|
813
|
-
#-UNICODE 1)
|
814
|
-
|
815
|
-
;; Determines two values low,high such that
|
816
|
-
;; (subtypep type `(INTEGER ,low ,high))
|
817
|
-
;; holds and low is as large as possible and high is as small as possible.
|
818
|
-
;; low = * means -infinity, high = * means infinity.
|
819
|
-
;; When (subtypep type 'INTEGER) is false, the values NIL,NIL are returned.
|
820
|
-
;; We need this function only for MAKE-ARRAY, UPGRADED-ARRAY-ELEMENT-TYPE and
|
821
|
-
;; OPEN and can therefore w.l.o.g. replace
|
822
|
-
;; type with `(OR ,type (MEMBER 0))
|
823
|
-
#| ;; The original implementation calls canonicalize-type and then applies
|
824
|
-
;; a particular SUBTYPE variant:
|
825
|
-
(defun subtype-integer (type)
|
826
|
-
(macrolet ((yes () '(return-from subtype-integer (values low high)))
|
827
|
-
(no () '(return-from subtype-integer nil))
|
828
|
-
(unknown () '(return-from subtype-integer nil)))
|
829
|
-
(setq type (canonicalize-type type))
|
830
|
-
(if (consp type)
|
831
|
-
(case (first type)
|
832
|
-
(MEMBER ; (MEMBER &rest objects)
|
833
|
-
;; All elements must be of type INTEGER.
|
834
|
-
(let ((low 0) (high 0)) ; wlog!
|
835
|
-
(dolist (x (rest type) (yes))
|
836
|
-
(unless (typep x 'INTEGER) (return (no)))
|
837
|
-
(setq low (min low x) high (max high x)))))
|
838
|
-
(OR ; (OR type*)
|
839
|
-
;; Every type must be subtype of INTEGER.
|
840
|
-
(let ((low 0) (high 0)) ; wlog!
|
841
|
-
(dolist (type1 (rest type) (yes))
|
842
|
-
(multiple-value-bind (low1 high1) (subtype-integer type1)
|
843
|
-
(unless low1 (return (no)))
|
844
|
-
(setq low (if (or (eq low '*) (eq low1 '*)) '* (min low low1))
|
845
|
-
high (if (or (eq high '*) (eq high1 '*))
|
846
|
-
'* (max high high1)))))))
|
847
|
-
(AND ; (AND type*)
|
848
|
-
;; If one of the types is subtype of INTEGER, then yes,
|
849
|
-
;; otherwise unknown.
|
850
|
-
(let ((low nil) (high nil))
|
851
|
-
(dolist (type1 (rest type))
|
852
|
-
(multiple-value-bind (low1 high1) (subtype-integer type1)
|
853
|
-
(when low1
|
854
|
-
(if low
|
855
|
-
(setq low (if (eq low '*) low1 (if (eq low1 '*) low (max low low1)))
|
856
|
-
high (if (eq high '*) high1 (if (eq high1 '*) high (min high high1))))
|
857
|
-
(setq low low1 high high1)))))
|
858
|
-
(if low
|
859
|
-
(progn
|
860
|
-
(when (and (numberp low) (numberp high) (not (<= low high)))
|
861
|
-
(setq low 0 high 0) ; type equivalent to NIL)
|
862
|
-
(yes))
|
863
|
-
(unknown)))))
|
864
|
-
(setq type (list type)))
|
865
|
-
(if (eq (first type) 'INTEGER)
|
866
|
-
(let ((low (if (rest type) (second type) '*))
|
867
|
-
(high (if (cddr type) (third type) '*)))
|
868
|
-
(when (consp low)
|
869
|
-
(setq low (first low))
|
870
|
-
(when (numberp low) (incf low)))
|
871
|
-
(when (consp high)
|
872
|
-
(setq high (first high))
|
873
|
-
(when (numberp high) (decf high)))
|
874
|
-
(when (and (numberp low) (numberp high) (not (<= low high))) ; type leer?
|
875
|
-
(setq low 0 high 0))
|
876
|
-
(yes))
|
877
|
-
(if (and (eq (first type) 'INTERVALS) (eq (second type) 'INTEGER))
|
878
|
-
(let ((low (third type))
|
879
|
-
(high (car (last type))))
|
880
|
-
(when (consp low)
|
881
|
-
(setq low (first low))
|
882
|
-
(when (numberp low) (incf low)))
|
883
|
-
(when (consp high)
|
884
|
-
(setq high (first high))
|
885
|
-
(when (numberp high) (decf high)))
|
886
|
-
(yes))
|
887
|
-
(unknown)))))
|
888
|
-
|# ;; This implementation inlines the (tail-recursive) canonicalize-type
|
889
|
-
;; function. Its advantage is that it doesn't cons as much.
|
890
|
-
;; (For example, (subtype-integer '(UNSIGNED-BYTE 8)) doesn't cons.)
|
891
|
-
(defun subtype-integer (type)
|
892
|
-
(macrolet ((yes () '(return-from subtype-integer (values low high)))
|
893
|
-
(no () '(return-from subtype-integer nil))
|
894
|
-
(unknown () '(return-from subtype-integer nil)))
|
895
|
-
(setq type (expand-deftype type))
|
896
|
-
(cond ((symbolp type)
|
897
|
-
(case type
|
898
|
-
(BIT (let ((low 0) (high 1)) (yes)))
|
899
|
-
(FIXNUM
|
900
|
-
(let ((low '#,most-negative-fixnum)
|
901
|
-
(high '#,most-positive-fixnum))
|
902
|
-
(yes)))
|
903
|
-
((INTEGER BIGNUM SIGNED-BYTE)
|
904
|
-
(let ((low '*) (high '*)) (yes)))
|
905
|
-
(UNSIGNED-BYTE
|
906
|
-
(let ((low 0) (high '*)) (yes)))
|
907
|
-
((NIL)
|
908
|
-
(let ((low 0) (high 0)) (yes))) ; wlog!
|
909
|
-
(t (no))))
|
910
|
-
((and (consp type) (symbolp (first type)))
|
911
|
-
(unless (and (list-length type) (null (cdr (last type))))
|
912
|
-
(typespec-error 'subtypep type))
|
913
|
-
(case (first type)
|
914
|
-
(MEMBER ; (MEMBER &rest objects)
|
915
|
-
;; All elements must be of type INTEGER.
|
916
|
-
(let ((low 0) (high 0)) ; wlog!
|
917
|
-
(dolist (x (rest type) (yes))
|
918
|
-
(unless (typep x 'INTEGER) (return (no)))
|
919
|
-
(setq low (min low x) high (max high x)))))
|
920
|
-
(EQL ; (EQL object)
|
921
|
-
(let ((x (second type)))
|
922
|
-
(if (typep x 'INTEGER)
|
923
|
-
(let ((low (min 0 x)) (high (max 0 x))) (yes))
|
924
|
-
(no))))
|
925
|
-
(OR ; (OR type*)
|
926
|
-
;; Every type must be subtype of INTEGER.
|
927
|
-
(let ((low 0) (high 0)) ; wlog!
|
928
|
-
(dolist (type1 (rest type) (yes))
|
929
|
-
(multiple-value-bind (low1 high1) (subtype-integer type1)
|
930
|
-
(unless low1 (return (no)))
|
931
|
-
(setq low (if (or (eq low '*) (eq low1 '*))
|
932
|
-
'* (min low low1))
|
933
|
-
high (if (or (eq high '*) (eq high1 '*))
|
934
|
-
'* (max high high1)))))))
|
935
|
-
(AND ; (AND type*)
|
936
|
-
;; If one of the types is subtype of INTEGER, then yes,
|
937
|
-
;; otherwise unknown.
|
938
|
-
(let ((low nil) (high nil))
|
939
|
-
(dolist (type1 (rest type))
|
940
|
-
(multiple-value-bind (low1 high1) (subtype-integer type1)
|
941
|
-
(when low1
|
942
|
-
(if low
|
943
|
-
(setq low (if (eq low '*) low1
|
944
|
-
(if (eq low1 '*) low
|
945
|
-
(max low low1)))
|
946
|
-
high (if (eq high '*) high1
|
947
|
-
(if (eq high1 '*) high
|
948
|
-
(min high high1))))
|
949
|
-
(setq low low1
|
950
|
-
high high1)))))
|
951
|
-
(if low
|
952
|
-
(progn
|
953
|
-
(when (and (numberp low) (numberp high)
|
954
|
-
(not (<= low high)))
|
955
|
-
(setq low 0 high 0)) ; type equivalent to NIL
|
956
|
-
(yes))
|
957
|
-
(unknown))))
|
958
|
-
(INTEGER
|
959
|
-
(let ((low (if (rest type) (second type) '*))
|
960
|
-
(high (if (cddr type) (third type) '*)))
|
961
|
-
(when (consp low)
|
962
|
-
(setq low (first low))
|
963
|
-
(when (numberp low) (incf low)))
|
964
|
-
(when (consp high)
|
965
|
-
(setq high (first high))
|
966
|
-
(when (numberp high) (decf high)))
|
967
|
-
(when (and (numberp low) (numberp high) (not (<= low high)))
|
968
|
-
(setq low 0 high 0)) ; type equivalent to NIL
|
969
|
-
(yes)))
|
970
|
-
(INTERVALS
|
971
|
-
(if (eq (second type) 'INTEGER)
|
972
|
-
(let ((low (third type))
|
973
|
-
(high (car (last type))))
|
974
|
-
(when (consp low)
|
975
|
-
(setq low (first low))
|
976
|
-
(when (numberp low) (incf low)))
|
977
|
-
(when (consp high)
|
978
|
-
(setq high (first high))
|
979
|
-
(when (numberp high) (decf high)))
|
980
|
-
(yes))
|
981
|
-
(unknown)))
|
982
|
-
(MOD ; (MOD n)
|
983
|
-
(let ((n (second type)))
|
984
|
-
(unless (and (integerp n) (>= n 0))
|
985
|
-
(typespec-error 'subtypep type))
|
986
|
-
(if (eql n 0)
|
987
|
-
(no)
|
988
|
-
(let ((low 0) (high (1- n)))
|
989
|
-
(yes)))))
|
990
|
-
(SIGNED-BYTE ; (SIGNED-BYTE &optional s)
|
991
|
-
(let ((s (if (cdr type) (second type) '*)))
|
992
|
-
(if (eq s '*)
|
993
|
-
(let ((low '*) (high '*)) (yes))
|
994
|
-
(progn
|
995
|
-
(unless (and (integerp s) (plusp s))
|
996
|
-
(typespec-error 'subtypep type))
|
997
|
-
(let ((n (ash 1 (1- s)))) ; (ash 1 *) == (expt 2 *)
|
998
|
-
(let ((low (- n)) (high (1- n)))
|
999
|
-
(yes)))))))
|
1000
|
-
(UNSIGNED-BYTE ; (UNSIGNED-BYTE &optional s)
|
1001
|
-
(let ((s (if (cdr type) (second type) '*)))
|
1002
|
-
(if (eq s '*)
|
1003
|
-
(let ((low 0) (high '*)) (yes))
|
1004
|
-
(progn
|
1005
|
-
(unless (and (integerp s) (>= s 0))
|
1006
|
-
(typespec-error 'subtypep type))
|
1007
|
-
(let ((n (ash 1 s))) ; (ash 1 *) == (expt 2 *)
|
1008
|
-
(let ((low 0) (high (1- n)))
|
1009
|
-
(yes)))))))
|
1010
|
-
(t (no))))
|
1011
|
-
((clos::defined-class-p type)
|
1012
|
-
(if (and (clos::built-in-class-p type)
|
1013
|
-
(eq (get (clos:class-name type) 'CLOS::CLOSCLASS) type))
|
1014
|
-
(return-from subtype-integer
|
1015
|
-
(subtype-integer (clos:class-name type)))
|
1016
|
-
(no)))
|
1017
|
-
((clos::eql-specializer-p type)
|
1018
|
-
(let ((x (clos::eql-specializer-singleton type)))
|
1019
|
-
(if (typep x 'INTEGER)
|
1020
|
-
(let ((low (min 0 x)) (high (max 0 x))) (yes))
|
1021
|
-
(no))))
|
1022
|
-
((encodingp type) (no))
|
1023
|
-
(t (typespec-error 'subtypep type)))))
|
1024
|
-
|
1025
|
-
#| TODO: Fix subtype-integer such that this works.
|
1026
|
-
Henry Baker:
|
1027
|
-
(defun type-null (x)
|
1028
|
-
(values (and (eq 'bit (upgraded-array-element-type `(or bit ,x)))
|
1029
|
-
(not (typep 0 x))
|
1030
|
-
(not (typep 1 x)))
|
1031
|
-
t))
|
1032
|
-
(type-null '(and symbol number))
|
1033
|
-
(type-null '(and integer symbol))
|
1034
|
-
(type-null '(and integer character))
|
1035
|
-
|#
|
1036
|
-
|
1037
|
-
;; Determines a sequence kind (an atom, as defined in defseq.lisp: one of
|
1038
|
-
;; LIST - stands for LIST
|
1039
|
-
;; VECTOR - stands for (VECTOR T)
|
1040
|
-
;; STRING - stands for (VECTOR CHARACTER)
|
1041
|
-
;; 1, 2, 4, 8, 16, 32 - stands for (VECTOR (UNSIGNED-BYTE n))
|
1042
|
-
;; 0 - stands for (VECTOR NIL))
|
1043
|
-
;; that indicates the sequence type meant by the given type. Other possible
|
1044
|
-
;; return values are
|
1045
|
-
;; SEQUENCE - denoting a type whose intersection with (OR LIST VECTOR) is not
|
1046
|
-
;; subtype of LIST or VECTOR, or
|
1047
|
-
;; NIL - indicating a type whose intersection with (OR LIST VECTOR) is empty.
|
1048
|
-
;; When the type is (OR (VECTOR eltype1) ... (VECTOR eltypeN)), the chosen
|
1049
|
-
;; element type is the smallest element type that contains all of eltype1 ...
|
1050
|
-
;; eltypeN.
|
1051
|
-
;;
|
1052
|
-
;; User-defined sequence types are not supported here.
|
1053
|
-
;;
|
1054
|
-
;; This implementation inlines the (tail-recursive) canonicalize-type
|
1055
|
-
;; function. Its advantage is that it doesn't cons as much. Also it employs
|
1056
|
-
;; some heuristics and does not have the full power of SUBTYPEP.
|
1057
|
-
(defun subtype-sequence (type)
|
1058
|
-
(setq type (expand-deftype type))
|
1059
|
-
(cond ((symbolp type)
|
1060
|
-
(case type
|
1061
|
-
((LIST CONS NULL) 'LIST)
|
1062
|
-
((NIL) 'NIL)
|
1063
|
-
((BIT-VECTOR SIMPLE-BIT-VECTOR) '1)
|
1064
|
-
((STRING SIMPLE-STRING BASE-STRING SIMPLE-BASE-STRING) 'STRING)
|
1065
|
-
((VECTOR SIMPLE-VECTOR ARRAY SIMPLE-ARRAY) 'VECTOR)
|
1066
|
-
((SEQUENCE) 'SEQUENCE)
|
1067
|
-
(t 'NIL)))
|
1068
|
-
((and (consp type) (symbolp (first type)))
|
1069
|
-
(unless (and (list-length type) (null (cdr (last type))))
|
1070
|
-
(typespec-error 'subtypep type))
|
1071
|
-
(case (first type)
|
1072
|
-
(MEMBER ; (MEMBER &rest objects)
|
1073
|
-
(let ((kind 'NIL))
|
1074
|
-
(dolist (x (rest type))
|
1075
|
-
(setq kind (sequence-type-union kind (type-of-sequence x))))
|
1076
|
-
kind))
|
1077
|
-
(EQL ; (EQL object)
|
1078
|
-
(unless (eql (length type) 2)
|
1079
|
-
(typespec-error 'subtypep type))
|
1080
|
-
(type-of-sequence (second type)))
|
1081
|
-
(OR ; (OR type*)
|
1082
|
-
(let ((kind 'NIL))
|
1083
|
-
(dolist (x (rest type))
|
1084
|
-
(setq kind (sequence-type-union kind (subtype-sequence x))))
|
1085
|
-
kind))
|
1086
|
-
(AND ; (AND type*)
|
1087
|
-
(let ((kind 'SEQUENCE))
|
1088
|
-
(dolist (x (rest type))
|
1089
|
-
(setq kind (sequence-type-intersection kind (subtype-sequence x))))
|
1090
|
-
kind))
|
1091
|
-
((SIMPLE-BIT-VECTOR BIT-VECTOR) ; (SIMPLE-BIT-VECTOR &optional size)
|
1092
|
-
(when (cddr type)
|
1093
|
-
(typespec-error 'subtypep type))
|
1094
|
-
'1)
|
1095
|
-
((SIMPLE-STRING STRING SIMPLE-BASE-STRING BASE-STRING) ; (SIMPLE-STRING &optional size)
|
1096
|
-
(when (cddr type)
|
1097
|
-
(typespec-error 'subtypep type))
|
1098
|
-
'STRING)
|
1099
|
-
(SIMPLE-VECTOR ; (SIMPLE-VECTOR &optional size)
|
1100
|
-
(when (cddr type)
|
1101
|
-
(typespec-error 'subtypep type))
|
1102
|
-
'VECTOR)
|
1103
|
-
((VECTOR ARRAY SIMPLE-ARRAY) ; (VECTOR &optional el-type size), (ARRAY &optional el-type dimensions)
|
1104
|
-
(when (cdddr type)
|
1105
|
-
(typespec-error 'subtypep type))
|
1106
|
-
(let ((el-type (if (cdr type) (second type) '*)))
|
1107
|
-
(if (eq el-type '*)
|
1108
|
-
'VECTOR
|
1109
|
-
(let ((eltype (upgraded-array-element-type el-type)))
|
1110
|
-
(cond ((eq eltype 'T) 'VECTOR)
|
1111
|
-
((eq eltype 'CHARACTER) 'STRING)
|
1112
|
-
((eq eltype 'BIT) '1)
|
1113
|
-
((and (consp eltype) (eq (first eltype) 'UNSIGNED-BYTE)) (second eltype))
|
1114
|
-
((eq eltype 'NIL) '0)
|
1115
|
-
(t (error (TEXT "~S is not up-to-date with ~S for element type ~S")
|
1116
|
-
'subtypep-sequence 'upgraded-array-element-type eltype)))))))
|
1117
|
-
((CONS) ; (CONS &optional cartype cdrtype)
|
1118
|
-
(when (cdddr type)
|
1119
|
-
(typespec-error 'subtypep type))
|
1120
|
-
'LIST)
|
1121
|
-
(t 'NIL)))
|
1122
|
-
((clos::defined-class-p type)
|
1123
|
-
(if (and (clos::built-in-class-p type)
|
1124
|
-
(eq (get (clos:class-name type) 'CLOS::CLOSCLASS) type))
|
1125
|
-
(subtype-sequence (clos:class-name type))
|
1126
|
-
'NIL))
|
1127
|
-
((clos::eql-specializer-p type)
|
1128
|
-
(type-of-sequence (clos::eql-specializer-singleton type)))
|
1129
|
-
(t 'NIL)))
|
1130
|
-
(defun type-of-sequence (x)
|
1131
|
-
(cond ((listp x) 'LIST)
|
1132
|
-
((vectorp x)
|
1133
|
-
(let ((eltype (array-element-type x)))
|
1134
|
-
(cond ((eq eltype 'T) 'VECTOR)
|
1135
|
-
((eq eltype 'CHARACTER) 'STRING)
|
1136
|
-
((eq eltype 'BIT) '1)
|
1137
|
-
((and (consp eltype) (eq (first eltype) 'UNSIGNED-BYTE)) (second eltype))
|
1138
|
-
((eq eltype 'NIL) '0)
|
1139
|
-
(t (error (TEXT "~S is not up-to-date with ~S for element type ~S")
|
1140
|
-
'type-of-sequence 'array-element-type eltype)))))
|
1141
|
-
(t 'NIL)))
|
1142
|
-
(defun sequence-type-union (t1 t2)
|
1143
|
-
(cond ; Simple general rules.
|
1144
|
-
((eql t1 t2) t1)
|
1145
|
-
((eq t1 'NIL) t2)
|
1146
|
-
((eq t2 'NIL) t1)
|
1147
|
-
; Now the union of two different types.
|
1148
|
-
((or (eq t1 'SEQUENCE) (eq t2 'SEQUENCE)) 'SEQUENCE)
|
1149
|
-
((or (eq t1 'LIST) (eq t2 'LIST))
|
1150
|
-
; union of LIST and a vector type
|
1151
|
-
'SEQUENCE)
|
1152
|
-
((or (eq t1 'VECTOR) (eq t2 'VECTOR)) 'VECTOR)
|
1153
|
-
((eql t1 0) t2)
|
1154
|
-
((eql t2 0) t1)
|
1155
|
-
((or (eq t1 'STRING) (eq t2 'STRING))
|
1156
|
-
; union of STRING and an integer-vector type
|
1157
|
-
'VECTOR)
|
1158
|
-
(t (max t1 t2))))
|
1159
|
-
(defun sequence-type-intersection (t1 t2)
|
1160
|
-
(cond ; Simple general rules.
|
1161
|
-
((eql t1 t2) t1)
|
1162
|
-
((or (eq t1 'NIL) (eq t2 'NIL)) 'NIL)
|
1163
|
-
; Now the intersection of two different types.
|
1164
|
-
((eq t1 'SEQUENCE) t2)
|
1165
|
-
((eq t2 'SEQUENCE) t1)
|
1166
|
-
((or (eq t1 'LIST) (eq t2 'LIST))
|
1167
|
-
; intersection of LIST and a vector type
|
1168
|
-
'NIL)
|
1169
|
-
((eq t1 'VECTOR) t2)
|
1170
|
-
((eq t2 'VECTOR) t1)
|
1171
|
-
((or (eql t1 0) (eql t2 0)) '0)
|
1172
|
-
((or (eq t1 'STRING) (eq t2 'STRING))
|
1173
|
-
; intersection of STRING and an integer-vector type
|
1174
|
-
'0)
|
1175
|
-
(t (min t1 t2))))
|
1176
|
-
|
1177
|
-
;; ============================================================================
|
1178
|
-
|
1179
|
-
(defun type-expand (typespec &optional once-p)
|
1180
|
-
(multiple-value-bind (expanded user-defined-p)
|
1181
|
-
(expand-deftype typespec once-p)
|
1182
|
-
(if user-defined-p (values expanded user-defined-p)
|
1183
|
-
(cond ((symbolp typespec)
|
1184
|
-
(cond ((or (get typespec 'TYPE-SYMBOL) (get typespec 'TYPE-LIST))
|
1185
|
-
(values typespec nil))
|
1186
|
-
((or (get typespec 'DEFSTRUCT-DESCRIPTION)
|
1187
|
-
(clos-class typespec))
|
1188
|
-
(values typespec nil))
|
1189
|
-
(t (typespec-error 'type-expand typespec))))
|
1190
|
-
((and (consp typespec) (symbolp (first typespec)))
|
1191
|
-
(case (first typespec)
|
1192
|
-
((SATISFIES MEMBER EQL NOT AND OR) (values typespec nil))
|
1193
|
-
(t (cond ((get (first typespec) 'TYPE-LIST)
|
1194
|
-
(values typespec nil))
|
1195
|
-
(t (typespec-error 'type-expand typespec))))))
|
1196
|
-
((clos::defined-class-p typespec) (values typespec nil))
|
1197
|
-
(t (typespec-error 'type-expand typespec))))))
|
1198
|
-
|
1199
|
-
;; ============================================================================
|
1200
|
-
|
1201
|
-
(unless (clos::funcallable-instance-p #'clos::class-name)
|
1202
|
-
(fmakunbound 'clos::class-name))
|
1203
|
-
|
1204
|
-
|
1205
|
-
(keywordp :junk)
|
1206
|
-
T
|
1207
|
-
|
1208
|
-
(keywordp ::junk)
|
1209
|
-
T
|
1210
|
-
|
1211
|
-
(symbol-name ::junk)
|
1212
|
-
"JUNK"
|
1213
|
-
|
1214
|
-
(symbol-name :#junk)
|
1215
|
-
"#JUNK"
|
1216
|
-
|
1217
|
-
(symbol-name :#.junk)
|
1218
|
-
"#.JUNK"
|