ruby_on_ruby 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rvmrc +1 -0
- data/Gemfile +6 -0
- data/LICENSE +22 -0
- data/README.md +66 -0
- data/Rakefile +1 -0
- data/lib/ruby_on_ruby.rb +5 -0
- data/lib/ruby_on_ruby/console.rb +7 -0
- data/lib/ruby_on_ruby/context.rb +33 -0
- data/lib/ruby_on_ruby/file_loader.rb +31 -0
- data/lib/ruby_on_ruby/ruby_stream.rb +27 -0
- data/lib/ruby_on_ruby/version.rb +3 -0
- data/lib/rubyonruby.rb +1 -0
- data/ruby_in_ruby.gemspec +19 -0
- data/vendor/javascripts/emscripted-ruby/lib/.document +106 -0
- data/vendor/javascripts/emscripted-ruby/lib/English.rb +155 -0
- data/vendor/javascripts/emscripted-ruby/lib/Env.rb +18 -0
- data/vendor/javascripts/emscripted-ruby/lib/README +96 -0
- data/vendor/javascripts/emscripted-ruby/lib/abbrev.rb +103 -0
- data/vendor/javascripts/emscripted-ruby/lib/base64.rb +133 -0
- data/vendor/javascripts/emscripted-ruby/lib/benchmark.rb +572 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi-lib.rb +272 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi.rb +2308 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi/.document +2 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi/session.rb +498 -0
- data/vendor/javascripts/emscripted-ruby/lib/cgi/session/pstore.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/complex.rb +663 -0
- data/vendor/javascripts/emscripted-ruby/lib/csv.rb +992 -0
- data/vendor/javascripts/emscripted-ruby/lib/date.rb +1767 -0
- data/vendor/javascripts/emscripted-ruby/lib/date/format.rb +1190 -0
- data/vendor/javascripts/emscripted-ruby/lib/date2.rb +5 -0
- data/vendor/javascripts/emscripted-ruby/lib/debug.rb +947 -0
- data/vendor/javascripts/emscripted-ruby/lib/delegate.rb +337 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb.rb +2 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/acl.rb +146 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/drb.rb +1782 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/eq.rb +16 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/extserv.rb +64 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/extservm.rb +89 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/gw.rb +122 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/invokemethod.rb +36 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/observer.rb +22 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/ssl.rb +190 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/timeridconv.rb +91 -0
- data/vendor/javascripts/emscripted-ruby/lib/drb/unix.rb +108 -0
- data/vendor/javascripts/emscripted-ruby/lib/e2mmap.rb +195 -0
- data/vendor/javascripts/emscripted-ruby/lib/erb.rb +880 -0
- data/vendor/javascripts/emscripted-ruby/lib/eregex.rb +37 -0
- data/vendor/javascripts/emscripted-ruby/lib/fileutils.rb +1591 -0
- data/vendor/javascripts/emscripted-ruby/lib/finalize.rb +193 -0
- data/vendor/javascripts/emscripted-ruby/lib/find.rb +79 -0
- data/vendor/javascripts/emscripted-ruby/lib/forwardable.rb +218 -0
- data/vendor/javascripts/emscripted-ruby/lib/ftools.rb +261 -0
- data/vendor/javascripts/emscripted-ruby/lib/generator.rb +418 -0
- data/vendor/javascripts/emscripted-ruby/lib/getoptlong.rb +621 -0
- data/vendor/javascripts/emscripted-ruby/lib/getopts.rb +127 -0
- data/vendor/javascripts/emscripted-ruby/lib/gserver.rb +253 -0
- data/vendor/javascripts/emscripted-ruby/lib/importenv.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/ipaddr.rb +814 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb.rb +346 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/chws.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/fork.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/help.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/load.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/nop.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/pushws.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/cmd/subirb.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/completion.rb +205 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/context.rb +255 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/change-ws.rb +62 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/history.rb +110 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/loader.rb +120 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/math-mode.rb +37 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/multi-irb.rb +241 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/save-history.rb +85 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/tracer.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/use-loader.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ext/workspaces.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/extend-command.rb +264 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/frame.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/help.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/init.rb +259 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/input-method.rb +120 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/lc/error.rb +30 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/lc/help-message +35 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/lc/ja/error.rb +27 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/lc/ja/help-message +36 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/locale.rb +184 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/notifier.rb +145 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/output-method.rb +85 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ruby-lex.rb +1149 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ruby-token.rb +273 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/slex.rb +285 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/version.rb +16 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/workspace.rb +107 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/ws-for-case-2.rb +15 -0
- data/vendor/javascripts/emscripted-ruby/lib/irb/xmp.rb +86 -0
- data/vendor/javascripts/emscripted-ruby/lib/jcode.rb +220 -0
- data/vendor/javascripts/emscripted-ruby/lib/logger.rb +703 -0
- data/vendor/javascripts/emscripted-ruby/lib/mailread.rb +62 -0
- data/vendor/javascripts/emscripted-ruby/lib/mathn.rb +308 -0
- data/vendor/javascripts/emscripted-ruby/lib/matrix.rb +1278 -0
- data/vendor/javascripts/emscripted-ruby/lib/mkmf.rb +1811 -0
- data/vendor/javascripts/emscripted-ruby/lib/monitor.rb +352 -0
- data/vendor/javascripts/emscripted-ruby/lib/mutex_m.rb +122 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/ftp.rb +927 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/http.rb +2277 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/https.rb +173 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/imap.rb +3371 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/pop.rb +999 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/protocol.rb +392 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/smtp.rb +1014 -0
- data/vendor/javascripts/emscripted-ruby/lib/net/telnet.rb +756 -0
- data/vendor/javascripts/emscripted-ruby/lib/observer.rb +192 -0
- data/vendor/javascripts/emscripted-ruby/lib/open-uri.rb +678 -0
- data/vendor/javascripts/emscripted-ruby/lib/open3.rb +101 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse.rb +1790 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/date.rb +17 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/shellwords.rb +6 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/time.rb +10 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/uri.rb +6 -0
- data/vendor/javascripts/emscripted-ruby/lib/optparse/version.rb +70 -0
- data/vendor/javascripts/emscripted-ruby/lib/ostruct.rb +146 -0
- data/vendor/javascripts/emscripted-ruby/lib/parsearg.rb +87 -0
- data/vendor/javascripts/emscripted-ruby/lib/parsedate.rb +53 -0
- data/vendor/javascripts/emscripted-ruby/lib/pathname.rb +1062 -0
- data/vendor/javascripts/emscripted-ruby/lib/ping.rb +64 -0
- data/vendor/javascripts/emscripted-ruby/lib/pp.rb +654 -0
- data/vendor/javascripts/emscripted-ruby/lib/prettyprint.rb +896 -0
- data/vendor/javascripts/emscripted-ruby/lib/profile.rb +6 -0
- data/vendor/javascripts/emscripted-ruby/lib/profiler.rb +59 -0
- data/vendor/javascripts/emscripted-ruby/lib/pstore.rb +395 -0
- data/vendor/javascripts/emscripted-ruby/lib/racc/parser.rb +442 -0
- data/vendor/javascripts/emscripted-ruby/lib/rational.rb +564 -0
- data/vendor/javascripts/emscripted-ruby/lib/readbytes.rb +41 -0
- data/vendor/javascripts/emscripted-ruby/lib/resolv-replace.rb +62 -0
- data/vendor/javascripts/emscripted-ruby/lib/resolv.rb +2210 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/attlistdecl.rb +62 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/attribute.rb +185 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/cdata.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/child.rb +96 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/comment.rb +80 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/doctype.rb +271 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/document.rb +208 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/attlistdecl.rb +10 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/dtd.rb +51 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/elementdecl.rb +17 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/entitydecl.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/dtd/notationdecl.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/element.rb +1227 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encoding.rb +71 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/CP-1252.rb +103 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/EUC-JP.rb +35 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ICONV.rb +22 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ISO-8859-1.rb +7 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/ISO-8859-15.rb +72 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/SHIFT-JIS.rb +37 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/SHIFT_JIS.rb +1 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UNILE.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/US-ASCII.rb +30 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UTF-16.rb +35 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/encodings/UTF-8.rb +18 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/entity.rb +165 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/default.rb +109 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/pretty.rb +137 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/formatters/transitive.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/functions.rb +382 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/instruction.rb +70 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/light/node.rb +196 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/namespace.rb +47 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/node.rb +75 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/output.rb +24 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parent.rb +166 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parseexception.rb +51 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/baseparser.rb +503 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/lightparser.rb +60 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/pullparser.rb +196 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/sax2parser.rb +238 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/streamparser.rb +46 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/treeparser.rb +97 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/ultralightparser.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/parsers/xpathparser.rb +698 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/quickpath.rb +266 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/rexml.rb +32 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/sax2listener.rb +97 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/source.rb +251 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/streamlistener.rb +92 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/syncenumerator.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/text.rb +344 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/undefinednamespaceexception.rb +8 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/relaxng.rb +559 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/validation.rb +155 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/validation/validationexception.rb +9 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/xmldecl.rb +119 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/xmltokens.rb +18 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/xpath.rb +66 -0
- data/vendor/javascripts/emscripted-ruby/lib/rexml/xpath_parser.rb +792 -0
- data/vendor/javascripts/emscripted-ruby/lib/rinda/rinda.rb +283 -0
- data/vendor/javascripts/emscripted-ruby/lib/rinda/ring.rb +271 -0
- data/vendor/javascripts/emscripted-ruby/lib/rinda/tuplespace.rb +642 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss.rb +19 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/0.9.rb +428 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/1.0.rb +452 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/2.0.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/atom.rb +749 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/content.rb +31 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/content/1.0.rb +10 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/content/2.0.rb +12 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/converter.rb +162 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore.rb +161 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/1.0.rb +13 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/2.0.rb +13 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/dublincore/atom.rb +17 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/image.rb +193 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/itunes.rb +410 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker.rb +44 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/0.9.rb +467 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/1.0.rb +434 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/2.0.rb +223 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/atom.rb +172 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/base.rb +868 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/content.rb +21 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/dublincore.rb +124 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/entry.rb +163 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/feed.rb +429 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/image.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/itunes.rb +242 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/slash.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/syndication.rb +18 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/taxonomy.rb +118 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/maker/trackback.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/parser.rb +541 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/rexmlparser.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/rss.rb +1312 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/slash.rb +49 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/syndication.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/taxonomy.rb +145 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/trackback.rb +288 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/utils.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/xml-stylesheet.rb +105 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/xml.rb +71 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/xmlparser.rb +93 -0
- data/vendor/javascripts/emscripted-ruby/lib/rss/xmlscanner.rb +121 -0
- data/vendor/javascripts/emscripted-ruby/lib/rubyunit.rb +6 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/assert.rb +73 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/cui/testrunner.rb +51 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/error.rb +9 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/testcase.rb +45 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/testresult.rb +44 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/testsuite.rb +26 -0
- data/vendor/javascripts/emscripted-ruby/lib/runit/topublic.rb +8 -0
- data/vendor/javascripts/emscripted-ruby/lib/scanf.rb +702 -0
- data/vendor/javascripts/emscripted-ruby/lib/securerandom.rb +137 -0
- data/vendor/javascripts/emscripted-ruby/lib/set.rb +1233 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell.rb +269 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/builtin-command.rb +154 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/command-processor.rb +592 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/error.rb +26 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/filter.rb +110 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/process-controller.rb +260 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/system-command.rb +168 -0
- data/vendor/javascripts/emscripted-ruby/lib/shell/version.rb +16 -0
- data/vendor/javascripts/emscripted-ruby/lib/shellwords.rb +172 -0
- data/vendor/javascripts/emscripted-ruby/lib/singleton.rb +360 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/attachment.rb +107 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/baseData.rb +942 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/element.rb +258 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/aspDotNetHandler.rb +213 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/handler.rb +100 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/literalHandler.rb +226 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/encodingstyle/soapHandler.rb +582 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/generator.rb +268 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/header/handler.rb +57 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/header/handlerset.rb +70 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/header/simplehandler.rb +44 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/httpconfigloader.rb +119 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping.rb +10 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/factory.rb +355 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/mapping.rb +381 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/registry.rb +541 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/rubytypeFactory.rb +475 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/typeMap.rb +50 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/wsdlencodedregistry.rb +280 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mapping/wsdlliteralregistry.rb +418 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/marshal.rb +59 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/mimemessage.rb +240 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/netHttpClient.rb +190 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/parser.rb +251 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/processor.rb +66 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/property.rb +333 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/cgistub.rb +206 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/driver.rb +254 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/element.rb +325 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/httpserver.rb +129 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/proxy.rb +497 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/router.rb +594 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/rpc.rb +25 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/soaplet.rb +162 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/rpc/standaloneServer.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/soap.rb +140 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/streamHandler.rb +229 -0
- data/vendor/javascripts/emscripted-ruby/lib/soap/wsdlDriver.rb +575 -0
- data/vendor/javascripts/emscripted-ruby/lib/sync.rb +311 -0
- data/vendor/javascripts/emscripted-ruby/lib/tempfile.rb +209 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit.rb +280 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/assertionfailederror.rb +14 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/assertions.rb +622 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/autorunner.rb +220 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector/dir.rb +107 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/collector/objectspace.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/error.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/failure.rb +51 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/testcase.rb +160 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/testresult.rb +80 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/testsuite.rb +76 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/console/testrunner.rb +127 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/fox/testrunner.rb +268 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/gtk/testrunner.rb +416 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/gtk2/testrunner.rb +465 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/testrunnermediator.rb +68 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/testrunnerutilities.rb +46 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/ui/tk/testrunner.rb +260 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/backtracefilter.rb +40 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/observable.rb +90 -0
- data/vendor/javascripts/emscripted-ruby/lib/test/unit/util/procwrapper.rb +48 -0
- data/vendor/javascripts/emscripted-ruby/lib/thread.rb +479 -0
- data/vendor/javascripts/emscripted-ruby/lib/thwait.rb +169 -0
- data/vendor/javascripts/emscripted-ruby/lib/time.rb +797 -0
- data/vendor/javascripts/emscripted-ruby/lib/timeout.rb +122 -0
- data/vendor/javascripts/emscripted-ruby/lib/tmpdir.rb +130 -0
- data/vendor/javascripts/emscripted-ruby/lib/tracer.rb +167 -0
- data/vendor/javascripts/emscripted-ruby/lib/tsort.rb +290 -0
- data/vendor/javascripts/emscripted-ruby/lib/un.rb +235 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri.rb +29 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/common.rb +611 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/ftp.rb +198 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/generic.rb +1122 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/http.rb +100 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/https.rb +20 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/ldap.rb +190 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/ldaps.rb +12 -0
- data/vendor/javascripts/emscripted-ruby/lib/uri/mailto.rb +266 -0
- data/vendor/javascripts/emscripted-ruby/lib/weakref.rb +100 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick.rb +29 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/accesslog.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/cgi.rb +257 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/compat.rb +15 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/config.rb +97 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/cookie.rb +110 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/htmlutils.rb +25 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth.rb +45 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/authenticator.rb +79 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/basicauth.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/digestauth.rb +343 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htdigest.rb +91 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htgroup.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/htpasswd.rb +83 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpauth/userdb.rb +29 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpproxy.rb +254 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httprequest.rb +365 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpresponse.rb +327 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/https.rb +63 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpserver.rb +210 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet.rb +22 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/abstract.rb +71 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/cgi_runner.rb +47 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/cgihandler.rb +108 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/erbhandler.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/filehandler.rb +435 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpservlet/prochandler.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpstatus.rb +126 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httputils.rb +399 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/httpversion.rb +49 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/log.rb +88 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/server.rb +200 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/ssl.rb +126 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/utils.rb +100 -0
- data/vendor/javascripts/emscripted-ruby/lib/webrick/version.rb +13 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/binding.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/data.rb +64 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/definitions.rb +250 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/documentation.rb +32 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/import.rb +80 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/importer.rb +38 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/info.rb +39 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/message.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/operation.rb +130 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/operationBinding.rb +108 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/param.rb +85 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/parser.rb +163 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/part.rb +52 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/port.rb +84 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/portType.rb +73 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/service.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/address.rb +40 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/binding.rb +49 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/body.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/cgiStubCreator.rb +76 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/classDefCreator.rb +314 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/classDefCreatorSupport.rb +126 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/clientSkeltonCreator.rb +78 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/complexType.rb +161 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/data.rb +42 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/definitions.rb +149 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/driverCreator.rb +95 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/element.rb +28 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/fault.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/header.rb +86 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/headerfault.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/mappingRegistryCreator.rb +92 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/methodDefCreator.rb +228 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/operation.rb +122 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/servantSkeltonCreator.rb +67 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/standaloneServerStubCreator.rb +85 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/soap/wsdl2ruby.rb +176 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/types.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/wsdl.rb +23 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/all.rb +69 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/annotation.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/any.rb +56 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/attribute.rb +127 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/choice.rb +69 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/complexContent.rb +92 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/complexType.rb +139 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/content.rb +96 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/data.rb +80 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/element.rb +154 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/enumeration.rb +36 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/import.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/importer.rb +87 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/include.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/length.rb +35 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/parser.rb +166 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/pattern.rb +36 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/schema.rb +143 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/sequence.rb +69 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleContent.rb +65 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleExtension.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleRestriction.rb +73 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/simpleType.rb +73 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/unique.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/wsdl/xmlSchema/xsd2ruby.rb +107 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/.document +1 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/README.txt +31 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/base64.rb +81 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/client.rb +624 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/config.rb +40 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/create.rb +290 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/datetime.rb +142 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/httpserver.rb +178 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/marshal.rb +76 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/parser.rb +813 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/server.rb +780 -0
- data/vendor/javascripts/emscripted-ruby/lib/xmlrpc/utils.rb +165 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/charset.rb +187 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen.rb +12 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/classdef.rb +203 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/commentdef.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/gensupport.rb +166 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/methoddef.rb +63 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/codegen/moduledef.rb +191 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/datatypes.rb +1269 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/datatypes1999.rb +20 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/iconvcharset.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/mapping.rb +42 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/namedelements.rb +95 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/ns.rb +140 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/qname.rb +78 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser.rb +61 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/parser.rb +96 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/rexmlparser.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/xmlparser.rb +50 -0
- data/vendor/javascripts/emscripted-ruby/lib/xsd/xmlparser/xmlscanner.rb +147 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml.rb +440 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/baseemitter.rb +247 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/basenode.rb +216 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/constants.rb +45 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/dbm.rb +111 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/encoding.rb +33 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/error.rb +34 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/loader.rb +14 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/rubytypes.rb +408 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/store.rb +43 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/stream.rb +40 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/stringio.rb +83 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/syck.rb +19 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/tag.rb +91 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/types.rb +192 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/yamlnode.rb +54 -0
- data/vendor/javascripts/emscripted-ruby/lib/yaml/ypath.rb +52 -0
- data/vendor/javascripts/emscripted-ruby/ruby.closure.js +7201 -0
- metadata +554 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
module REXML
|
2
|
+
class ParseException < RuntimeError
|
3
|
+
attr_accessor :source, :parser, :continued_exception
|
4
|
+
|
5
|
+
def initialize( message, source=nil, parser=nil, exception=nil )
|
6
|
+
super(message)
|
7
|
+
@source = source
|
8
|
+
@parser = parser
|
9
|
+
@continued_exception = exception
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
# Quote the original exception, if there was one
|
14
|
+
if @continued_exception
|
15
|
+
err = @continued_exception.inspect
|
16
|
+
err << "\n"
|
17
|
+
err << @continued_exception.backtrace.join("\n")
|
18
|
+
err << "\n...\n"
|
19
|
+
else
|
20
|
+
err = ""
|
21
|
+
end
|
22
|
+
|
23
|
+
# Get the stack trace and error message
|
24
|
+
err << super
|
25
|
+
|
26
|
+
# Add contextual information
|
27
|
+
if @source
|
28
|
+
err << "\nLine: #{line}\n"
|
29
|
+
err << "Position: #{position}\n"
|
30
|
+
err << "Last 80 unconsumed characters:\n"
|
31
|
+
err << @source.buffer[0..80].gsub(/\n/, ' ')
|
32
|
+
end
|
33
|
+
|
34
|
+
err
|
35
|
+
end
|
36
|
+
|
37
|
+
def position
|
38
|
+
@source.current_line[0] if @source and defined? @source.current_line and
|
39
|
+
@source.current_line
|
40
|
+
end
|
41
|
+
|
42
|
+
def line
|
43
|
+
@source.current_line[2] if @source and defined? @source.current_line and
|
44
|
+
@source.current_line
|
45
|
+
end
|
46
|
+
|
47
|
+
def context
|
48
|
+
@source.current_line
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,503 @@
|
|
1
|
+
require 'rexml/parseexception'
|
2
|
+
require 'rexml/undefinednamespaceexception'
|
3
|
+
require 'rexml/source'
|
4
|
+
require 'set'
|
5
|
+
|
6
|
+
module REXML
|
7
|
+
module Parsers
|
8
|
+
# = Using the Pull Parser
|
9
|
+
# <em>This API is experimental, and subject to change.</em>
|
10
|
+
# parser = PullParser.new( "<a>text<b att='val'/>txet</a>" )
|
11
|
+
# while parser.has_next?
|
12
|
+
# res = parser.next
|
13
|
+
# puts res[1]['att'] if res.start_tag? and res[0] == 'b'
|
14
|
+
# end
|
15
|
+
# See the PullEvent class for information on the content of the results.
|
16
|
+
# The data is identical to the arguments passed for the various events to
|
17
|
+
# the StreamListener API.
|
18
|
+
#
|
19
|
+
# Notice that:
|
20
|
+
# parser = PullParser.new( "<a>BAD DOCUMENT" )
|
21
|
+
# while parser.has_next?
|
22
|
+
# res = parser.next
|
23
|
+
# raise res[1] if res.error?
|
24
|
+
# end
|
25
|
+
#
|
26
|
+
# Nat Price gave me some good ideas for the API.
|
27
|
+
class BaseParser
|
28
|
+
NCNAME_STR= '[\w:][\-\w\d.]*'
|
29
|
+
NAME_STR= "(?:(#{NCNAME_STR}):)?(#{NCNAME_STR})"
|
30
|
+
UNAME_STR= "(?:#{NCNAME_STR}:)?#{NCNAME_STR}"
|
31
|
+
|
32
|
+
NAMECHAR = '[\-\w\d\.:]'
|
33
|
+
NAME = "([\\w:]#{NAMECHAR}*)"
|
34
|
+
NMTOKEN = "(?:#{NAMECHAR})+"
|
35
|
+
NMTOKENS = "#{NMTOKEN}(\\s+#{NMTOKEN})*"
|
36
|
+
REFERENCE = "(?:&#{NAME};|&#\\d+;|&#x[0-9a-fA-F]+;)"
|
37
|
+
REFERENCE_RE = /#{REFERENCE}/
|
38
|
+
|
39
|
+
DOCTYPE_START = /\A\s*<!DOCTYPE\s/um
|
40
|
+
DOCTYPE_PATTERN = /\s*<!DOCTYPE\s+(.*?)(\[|>)/um
|
41
|
+
ATTRIBUTE_PATTERN = /\s*(#{NAME_STR})\s*=\s*(["'])(.*?)\4/um
|
42
|
+
COMMENT_START = /\A<!--/u
|
43
|
+
COMMENT_PATTERN = /<!--(.*?)-->/um
|
44
|
+
CDATA_START = /\A<!\[CDATA\[/u
|
45
|
+
CDATA_END = /^\s*\]\s*>/um
|
46
|
+
CDATA_PATTERN = /<!\[CDATA\[(.*?)\]\]>/um
|
47
|
+
XMLDECL_START = /\A<\?xml\s/u;
|
48
|
+
XMLDECL_PATTERN = /<\?xml\s+(.*?)\?>/um
|
49
|
+
INSTRUCTION_START = /\A<\?/u
|
50
|
+
INSTRUCTION_PATTERN = /<\?(.*?)(\s+.*?)?\?>/um
|
51
|
+
TAG_MATCH = /^<((?>#{NAME_STR}))\s*((?>\s+#{UNAME_STR}\s*=\s*(["']).*?\5)*)\s*(\/)?>/um
|
52
|
+
CLOSE_MATCH = /^\s*<\/(#{NAME_STR})\s*>/um
|
53
|
+
|
54
|
+
VERSION = /\bversion\s*=\s*["'](.*?)['"]/um
|
55
|
+
ENCODING = /\bencoding\s*=\s*["'](.*?)['"]/um
|
56
|
+
STANDALONE = /\bstandalone\s*=\s["'](.*?)['"]/um
|
57
|
+
|
58
|
+
ENTITY_START = /^\s*<!ENTITY/
|
59
|
+
IDENTITY = /^([!\*\w\-]+)(\s+#{NCNAME_STR})?(\s+["'](.*?)['"])?(\s+['"](.*?)["'])?/u
|
60
|
+
ELEMENTDECL_START = /^\s*<!ELEMENT/um
|
61
|
+
ELEMENTDECL_PATTERN = /^\s*(<!ELEMENT.*?)>/um
|
62
|
+
SYSTEMENTITY = /^\s*(%.*?;)\s*$/um
|
63
|
+
ENUMERATION = "\\(\\s*#{NMTOKEN}(?:\\s*\\|\\s*#{NMTOKEN})*\\s*\\)"
|
64
|
+
NOTATIONTYPE = "NOTATION\\s+\\(\\s*#{NAME}(?:\\s*\\|\\s*#{NAME})*\\s*\\)"
|
65
|
+
ENUMERATEDTYPE = "(?:(?:#{NOTATIONTYPE})|(?:#{ENUMERATION}))"
|
66
|
+
ATTTYPE = "(CDATA|ID|IDREF|IDREFS|ENTITY|ENTITIES|NMTOKEN|NMTOKENS|#{ENUMERATEDTYPE})"
|
67
|
+
ATTVALUE = "(?:\"((?:[^<&\"]|#{REFERENCE})*)\")|(?:'((?:[^<&']|#{REFERENCE})*)')"
|
68
|
+
DEFAULTDECL = "(#REQUIRED|#IMPLIED|(?:(#FIXED\\s+)?#{ATTVALUE}))"
|
69
|
+
ATTDEF = "\\s+#{NAME}\\s+#{ATTTYPE}\\s+#{DEFAULTDECL}"
|
70
|
+
ATTDEF_RE = /#{ATTDEF}/
|
71
|
+
ATTLISTDECL_START = /^\s*<!ATTLIST/um
|
72
|
+
ATTLISTDECL_PATTERN = /^\s*<!ATTLIST\s+#{NAME}(?:#{ATTDEF})*\s*>/um
|
73
|
+
NOTATIONDECL_START = /^\s*<!NOTATION/um
|
74
|
+
PUBLIC = /^\s*<!NOTATION\s+(\w[\-\w]*)\s+(PUBLIC)\s+(["'])(.*?)\3(?:\s+(["'])(.*?)\5)?\s*>/um
|
75
|
+
SYSTEM = /^\s*<!NOTATION\s+(\w[\-\w]*)\s+(SYSTEM)\s+(["'])(.*?)\3\s*>/um
|
76
|
+
|
77
|
+
TEXT_PATTERN = /\A([^<]*)/um
|
78
|
+
|
79
|
+
# Entity constants
|
80
|
+
PUBIDCHAR = "\x20\x0D\x0Aa-zA-Z0-9\\-()+,./:=?;!*@$_%#"
|
81
|
+
SYSTEMLITERAL = %Q{((?:"[^"]*")|(?:'[^']*'))}
|
82
|
+
PUBIDLITERAL = %Q{("[#{PUBIDCHAR}']*"|'[#{PUBIDCHAR}]*')}
|
83
|
+
EXTERNALID = "(?:(?:(SYSTEM)\\s+#{SYSTEMLITERAL})|(?:(PUBLIC)\\s+#{PUBIDLITERAL}\\s+#{SYSTEMLITERAL}))"
|
84
|
+
NDATADECL = "\\s+NDATA\\s+#{NAME}"
|
85
|
+
PEREFERENCE = "%#{NAME};"
|
86
|
+
ENTITYVALUE = %Q{((?:"(?:[^%&"]|#{PEREFERENCE}|#{REFERENCE})*")|(?:'([^%&']|#{PEREFERENCE}|#{REFERENCE})*'))}
|
87
|
+
PEDEF = "(?:#{ENTITYVALUE}|#{EXTERNALID})"
|
88
|
+
ENTITYDEF = "(?:#{ENTITYVALUE}|(?:#{EXTERNALID}(#{NDATADECL})?))"
|
89
|
+
PEDECL = "<!ENTITY\\s+(%)\\s+#{NAME}\\s+#{PEDEF}\\s*>"
|
90
|
+
GEDECL = "<!ENTITY\\s+#{NAME}\\s+#{ENTITYDEF}\\s*>"
|
91
|
+
ENTITYDECL = /\s*(?:#{GEDECL})|(?:#{PEDECL})/um
|
92
|
+
|
93
|
+
EREFERENCE = /&(?!#{NAME};)/
|
94
|
+
|
95
|
+
DEFAULT_ENTITIES = {
|
96
|
+
'gt' => [/>/, '>', '>', />/],
|
97
|
+
'lt' => [/</, '<', '<', /</],
|
98
|
+
'quot' => [/"/, '"', '"', /"/],
|
99
|
+
"apos" => [/'/, "'", "'", /'/]
|
100
|
+
}
|
101
|
+
|
102
|
+
|
103
|
+
######################################################################
|
104
|
+
# These are patterns to identify common markup errors, to make the
|
105
|
+
# error messages more informative.
|
106
|
+
######################################################################
|
107
|
+
MISSING_ATTRIBUTE_QUOTES = /^<#{NAME_STR}\s+#{NAME_STR}\s*=\s*[^"']/um
|
108
|
+
|
109
|
+
def initialize( source )
|
110
|
+
self.stream = source
|
111
|
+
end
|
112
|
+
|
113
|
+
def add_listener( listener )
|
114
|
+
if !defined?(@listeners) or !@listeners
|
115
|
+
@listeners = []
|
116
|
+
instance_eval <<-EOL
|
117
|
+
alias :_old_pull :pull
|
118
|
+
def pull
|
119
|
+
event = _old_pull
|
120
|
+
@listeners.each do |listener|
|
121
|
+
listener.receive event
|
122
|
+
end
|
123
|
+
event
|
124
|
+
end
|
125
|
+
EOL
|
126
|
+
end
|
127
|
+
@listeners << listener
|
128
|
+
end
|
129
|
+
|
130
|
+
attr_reader :source
|
131
|
+
|
132
|
+
def stream=( source )
|
133
|
+
@source = SourceFactory.create_from( source )
|
134
|
+
@closed = nil
|
135
|
+
@document_status = nil
|
136
|
+
@tags = []
|
137
|
+
@stack = []
|
138
|
+
@entities = []
|
139
|
+
@nsstack = []
|
140
|
+
end
|
141
|
+
|
142
|
+
def position
|
143
|
+
if @source.respond_to? :position
|
144
|
+
@source.position
|
145
|
+
else
|
146
|
+
# FIXME
|
147
|
+
0
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# Returns true if there are no more events
|
152
|
+
def empty?
|
153
|
+
return (@source.empty? and @stack.empty?)
|
154
|
+
end
|
155
|
+
|
156
|
+
# Returns true if there are more events. Synonymous with !empty?
|
157
|
+
def has_next?
|
158
|
+
return !(@source.empty? and @stack.empty?)
|
159
|
+
end
|
160
|
+
|
161
|
+
# Push an event back on the head of the stream. This method
|
162
|
+
# has (theoretically) infinite depth.
|
163
|
+
def unshift token
|
164
|
+
@stack.unshift(token)
|
165
|
+
end
|
166
|
+
|
167
|
+
# Peek at the +depth+ event in the stack. The first element on the stack
|
168
|
+
# is at depth 0. If +depth+ is -1, will parse to the end of the input
|
169
|
+
# stream and return the last event, which is always :end_document.
|
170
|
+
# Be aware that this causes the stream to be parsed up to the +depth+
|
171
|
+
# event, so you can effectively pre-parse the entire document (pull the
|
172
|
+
# entire thing into memory) using this method.
|
173
|
+
def peek depth=0
|
174
|
+
raise %Q[Illegal argument "#{depth}"] if depth < -1
|
175
|
+
temp = []
|
176
|
+
if depth == -1
|
177
|
+
temp.push(pull()) until empty?
|
178
|
+
else
|
179
|
+
while @stack.size+temp.size < depth+1
|
180
|
+
temp.push(pull())
|
181
|
+
end
|
182
|
+
end
|
183
|
+
@stack += temp if temp.size > 0
|
184
|
+
@stack[depth]
|
185
|
+
end
|
186
|
+
|
187
|
+
# Returns the next event. This is a +PullEvent+ object.
|
188
|
+
def pull
|
189
|
+
if @closed
|
190
|
+
x, @closed = @closed, nil
|
191
|
+
return [ :end_element, x ]
|
192
|
+
end
|
193
|
+
return [ :end_document ] if empty?
|
194
|
+
return @stack.shift if @stack.size > 0
|
195
|
+
#STDERR.puts @source.encoding
|
196
|
+
@source.read if @source.buffer.size<2
|
197
|
+
#STDERR.puts "BUFFER = #{@source.buffer.inspect}"
|
198
|
+
if @document_status == nil
|
199
|
+
#@source.consume( /^\s*/um )
|
200
|
+
word = @source.match( /^((?:\s+)|(?:<[^>]*>))/um )
|
201
|
+
word = word[1] unless word.nil?
|
202
|
+
#STDERR.puts "WORD = #{word.inspect}"
|
203
|
+
case word
|
204
|
+
when COMMENT_START
|
205
|
+
return [ :comment, @source.match( COMMENT_PATTERN, true )[1] ]
|
206
|
+
when XMLDECL_START
|
207
|
+
#STDERR.puts "XMLDECL"
|
208
|
+
results = @source.match( XMLDECL_PATTERN, true )[1]
|
209
|
+
version = VERSION.match( results )
|
210
|
+
version = version[1] unless version.nil?
|
211
|
+
encoding = ENCODING.match(results)
|
212
|
+
encoding = encoding[1] unless encoding.nil?
|
213
|
+
@source.encoding = encoding
|
214
|
+
standalone = STANDALONE.match(results)
|
215
|
+
standalone = standalone[1] unless standalone.nil?
|
216
|
+
return [ :xmldecl, version, encoding, standalone ]
|
217
|
+
when INSTRUCTION_START
|
218
|
+
return [ :processing_instruction, *@source.match(INSTRUCTION_PATTERN, true)[1,2] ]
|
219
|
+
when DOCTYPE_START
|
220
|
+
md = @source.match( DOCTYPE_PATTERN, true )
|
221
|
+
@nsstack.unshift(curr_ns=Set.new)
|
222
|
+
identity = md[1]
|
223
|
+
close = md[2]
|
224
|
+
identity =~ IDENTITY
|
225
|
+
name = $1
|
226
|
+
raise REXML::ParseException.new("DOCTYPE is missing a name") if name.nil?
|
227
|
+
pub_sys = $2.nil? ? nil : $2.strip
|
228
|
+
long_name = $4.nil? ? nil : $4.strip
|
229
|
+
uri = $6.nil? ? nil : $6.strip
|
230
|
+
args = [ :start_doctype, name, pub_sys, long_name, uri ]
|
231
|
+
if close == ">"
|
232
|
+
@document_status = :after_doctype
|
233
|
+
@source.read if @source.buffer.size<2
|
234
|
+
md = @source.match(/^\s*/um, true)
|
235
|
+
@stack << [ :end_doctype ]
|
236
|
+
else
|
237
|
+
@document_status = :in_doctype
|
238
|
+
end
|
239
|
+
return args
|
240
|
+
when /^\s+/
|
241
|
+
else
|
242
|
+
@document_status = :after_doctype
|
243
|
+
@source.read if @source.buffer.size<2
|
244
|
+
md = @source.match(/\s*/um, true)
|
245
|
+
end
|
246
|
+
end
|
247
|
+
if @document_status == :in_doctype
|
248
|
+
md = @source.match(/\s*(.*?>)/um)
|
249
|
+
case md[1]
|
250
|
+
when SYSTEMENTITY
|
251
|
+
match = @source.match( SYSTEMENTITY, true )[1]
|
252
|
+
return [ :externalentity, match ]
|
253
|
+
|
254
|
+
when ELEMENTDECL_START
|
255
|
+
return [ :elementdecl, @source.match( ELEMENTDECL_PATTERN, true )[1] ]
|
256
|
+
|
257
|
+
when ENTITY_START
|
258
|
+
match = @source.match( ENTITYDECL, true ).to_a.compact
|
259
|
+
match[0] = :entitydecl
|
260
|
+
ref = false
|
261
|
+
if match[1] == '%'
|
262
|
+
ref = true
|
263
|
+
match.delete_at 1
|
264
|
+
end
|
265
|
+
# Now we have to sort out what kind of entity reference this is
|
266
|
+
if match[2] == 'SYSTEM'
|
267
|
+
# External reference
|
268
|
+
match[3] = match[3][1..-2] # PUBID
|
269
|
+
match.delete_at(4) if match.size > 4 # Chop out NDATA decl
|
270
|
+
# match is [ :entity, name, SYSTEM, pubid(, ndata)? ]
|
271
|
+
elsif match[2] == 'PUBLIC'
|
272
|
+
# External reference
|
273
|
+
match[3] = match[3][1..-2] # PUBID
|
274
|
+
match[4] = match[4][1..-2] # HREF
|
275
|
+
# match is [ :entity, name, PUBLIC, pubid, href ]
|
276
|
+
else
|
277
|
+
match[2] = match[2][1..-2]
|
278
|
+
match.pop if match.size == 4
|
279
|
+
# match is [ :entity, name, value ]
|
280
|
+
end
|
281
|
+
match << '%' if ref
|
282
|
+
return match
|
283
|
+
when ATTLISTDECL_START
|
284
|
+
md = @source.match( ATTLISTDECL_PATTERN, true )
|
285
|
+
raise REXML::ParseException.new( "Bad ATTLIST declaration!", @source ) if md.nil?
|
286
|
+
element = md[1]
|
287
|
+
contents = md[0]
|
288
|
+
|
289
|
+
pairs = {}
|
290
|
+
values = md[0].scan( ATTDEF_RE )
|
291
|
+
values.each do |attdef|
|
292
|
+
unless attdef[3] == "#IMPLIED"
|
293
|
+
attdef.compact!
|
294
|
+
val = attdef[3]
|
295
|
+
val = attdef[4] if val == "#FIXED "
|
296
|
+
pairs[attdef[0]] = val
|
297
|
+
if attdef[0] =~ /^xmlns:(.*)/
|
298
|
+
@nsstack[0] << $1
|
299
|
+
end
|
300
|
+
end
|
301
|
+
end
|
302
|
+
return [ :attlistdecl, element, pairs, contents ]
|
303
|
+
when NOTATIONDECL_START
|
304
|
+
md = nil
|
305
|
+
if @source.match( PUBLIC )
|
306
|
+
md = @source.match( PUBLIC, true )
|
307
|
+
vals = [md[1],md[2],md[4],md[6]]
|
308
|
+
elsif @source.match( SYSTEM )
|
309
|
+
md = @source.match( SYSTEM, true )
|
310
|
+
vals = [md[1],md[2],nil,md[4]]
|
311
|
+
else
|
312
|
+
raise REXML::ParseException.new( "error parsing notation: no matching pattern", @source )
|
313
|
+
end
|
314
|
+
return [ :notationdecl, *vals ]
|
315
|
+
when CDATA_END
|
316
|
+
@document_status = :after_doctype
|
317
|
+
@source.match( CDATA_END, true )
|
318
|
+
return [ :end_doctype ]
|
319
|
+
end
|
320
|
+
end
|
321
|
+
begin
|
322
|
+
if @source.buffer[0] == ?<
|
323
|
+
if @source.buffer[1] == ?/
|
324
|
+
@nsstack.shift
|
325
|
+
last_tag = @tags.pop
|
326
|
+
#md = @source.match_to_consume( '>', CLOSE_MATCH)
|
327
|
+
md = @source.match( CLOSE_MATCH, true )
|
328
|
+
raise REXML::ParseException.new( "Missing end tag for "+
|
329
|
+
"'#{last_tag}' (got \"#{md[1]}\")",
|
330
|
+
@source) unless last_tag == md[1]
|
331
|
+
return [ :end_element, last_tag ]
|
332
|
+
elsif @source.buffer[1] == ?!
|
333
|
+
md = @source.match(/\A(\s*[^>]*>)/um)
|
334
|
+
#STDERR.puts "SOURCE BUFFER = #{source.buffer}, #{source.buffer.size}"
|
335
|
+
raise REXML::ParseException.new("Malformed node", @source) unless md
|
336
|
+
if md[0][2] == ?-
|
337
|
+
md = @source.match( COMMENT_PATTERN, true )
|
338
|
+
return [ :comment, md[1] ] if md
|
339
|
+
else
|
340
|
+
md = @source.match( CDATA_PATTERN, true )
|
341
|
+
return [ :cdata, md[1] ] if md
|
342
|
+
end
|
343
|
+
raise REXML::ParseException.new( "Declarations can only occur "+
|
344
|
+
"in the doctype declaration.", @source)
|
345
|
+
elsif @source.buffer[1] == ??
|
346
|
+
md = @source.match( INSTRUCTION_PATTERN, true )
|
347
|
+
return [ :processing_instruction, md[1], md[2] ] if md
|
348
|
+
raise REXML::ParseException.new( "Bad instruction declaration",
|
349
|
+
@source)
|
350
|
+
else
|
351
|
+
# Get the next tag
|
352
|
+
md = @source.match(TAG_MATCH, true)
|
353
|
+
unless md
|
354
|
+
# Check for missing attribute quotes
|
355
|
+
raise REXML::ParseException.new("missing attribute quote", @source) if @source.match(MISSING_ATTRIBUTE_QUOTES )
|
356
|
+
raise REXML::ParseException.new("malformed XML: missing tag start", @source)
|
357
|
+
end
|
358
|
+
attributes = {}
|
359
|
+
prefixes = Set.new
|
360
|
+
prefixes << md[2] if md[2]
|
361
|
+
@nsstack.unshift(curr_ns=Set.new)
|
362
|
+
if md[4].size > 0
|
363
|
+
attrs = md[4].scan( ATTRIBUTE_PATTERN )
|
364
|
+
raise REXML::ParseException.new( "error parsing attributes: [#{attrs.join ', '}], excess = \"#$'\"", @source) if $' and $'.strip.size > 0
|
365
|
+
attrs.each { |a,b,c,d,e|
|
366
|
+
if b == "xmlns"
|
367
|
+
if c == "xml"
|
368
|
+
if d != "http://www.w3.org/XML/1998/namespace"
|
369
|
+
msg = "The 'xml' prefix must not be bound to any other namespace "+
|
370
|
+
"(http://www.w3.org/TR/REC-xml-names/#ns-decl)"
|
371
|
+
raise REXML::ParseException.new( msg, @source, self )
|
372
|
+
end
|
373
|
+
elsif c == "xmlns"
|
374
|
+
msg = "The 'xmlns' prefix must not be declared "+
|
375
|
+
"(http://www.w3.org/TR/REC-xml-names/#ns-decl)"
|
376
|
+
raise REXML::ParseException.new( msg, @source, self)
|
377
|
+
end
|
378
|
+
curr_ns << c
|
379
|
+
elsif b
|
380
|
+
prefixes << b unless b == "xml"
|
381
|
+
end
|
382
|
+
attributes[a] = e
|
383
|
+
}
|
384
|
+
end
|
385
|
+
|
386
|
+
# Verify that all of the prefixes have been defined
|
387
|
+
for prefix in prefixes
|
388
|
+
unless @nsstack.find{|k| k.member?(prefix)}
|
389
|
+
raise UndefinedNamespaceException.new(prefix,@source,self)
|
390
|
+
end
|
391
|
+
end
|
392
|
+
|
393
|
+
if md[6]
|
394
|
+
@closed = md[1]
|
395
|
+
@nsstack.shift
|
396
|
+
else
|
397
|
+
@tags.push( md[1] )
|
398
|
+
end
|
399
|
+
return [ :start_element, md[1], attributes ]
|
400
|
+
end
|
401
|
+
else
|
402
|
+
md = @source.match( TEXT_PATTERN, true )
|
403
|
+
if md[0].length == 0
|
404
|
+
@source.match( /(\s+)/, true )
|
405
|
+
end
|
406
|
+
#STDERR.puts "GOT #{md[1].inspect}" unless md[0].length == 0
|
407
|
+
#return [ :text, "" ] if md[0].length == 0
|
408
|
+
# unnormalized = Text::unnormalize( md[1], self )
|
409
|
+
# return PullEvent.new( :text, md[1], unnormalized )
|
410
|
+
return [ :text, md[1] ]
|
411
|
+
end
|
412
|
+
rescue REXML::UndefinedNamespaceException
|
413
|
+
raise
|
414
|
+
rescue REXML::ParseException
|
415
|
+
raise
|
416
|
+
rescue Exception, NameError => error
|
417
|
+
raise REXML::ParseException.new( "Exception parsing",
|
418
|
+
@source, self, (error ? error : $!) )
|
419
|
+
end
|
420
|
+
return [ :dummy ]
|
421
|
+
end
|
422
|
+
|
423
|
+
def entity( reference, entities )
|
424
|
+
value = nil
|
425
|
+
value = entities[ reference ] if entities
|
426
|
+
if not value
|
427
|
+
value = DEFAULT_ENTITIES[ reference ]
|
428
|
+
value = value[2] if value
|
429
|
+
end
|
430
|
+
unnormalize( value, entities ) if value
|
431
|
+
end
|
432
|
+
|
433
|
+
# Escapes all possible entities
|
434
|
+
def normalize( input, entities=nil, entity_filter=nil )
|
435
|
+
copy = input.clone
|
436
|
+
# Doing it like this rather than in a loop improves the speed
|
437
|
+
copy.gsub!( EREFERENCE, '&' )
|
438
|
+
entities.each do |key, value|
|
439
|
+
copy.gsub!( value, "&#{key};" ) unless entity_filter and
|
440
|
+
entity_filter.include?(entity)
|
441
|
+
end if entities
|
442
|
+
copy.gsub!( EREFERENCE, '&' )
|
443
|
+
DEFAULT_ENTITIES.each do |key, value|
|
444
|
+
copy.gsub!( value[3], value[1] )
|
445
|
+
end
|
446
|
+
copy
|
447
|
+
end
|
448
|
+
|
449
|
+
# Unescapes all possible entities
|
450
|
+
def unnormalize( string, entities=nil, filter=nil )
|
451
|
+
rv = string.clone
|
452
|
+
rv.gsub!( /\r\n?/, "\n" )
|
453
|
+
matches = rv.scan( REFERENCE_RE )
|
454
|
+
return rv if matches.size == 0
|
455
|
+
rv.gsub!( /�*((?:\d+)|(?:x[a-fA-F0-9]+));/ ) {|m|
|
456
|
+
m=$1
|
457
|
+
m = "0#{m}" if m[0] == ?x
|
458
|
+
[Integer(m)].pack('U*')
|
459
|
+
}
|
460
|
+
matches.collect!{|x|x[0]}.compact!
|
461
|
+
if matches.size > 0
|
462
|
+
matches.each do |entity_reference|
|
463
|
+
unless filter and filter.include?(entity_reference)
|
464
|
+
entity_value = entity( entity_reference, entities )
|
465
|
+
if entity_value
|
466
|
+
re = /&#{entity_reference};/
|
467
|
+
rv.gsub!( re, entity_value )
|
468
|
+
end
|
469
|
+
end
|
470
|
+
end
|
471
|
+
matches.each do |entity_reference|
|
472
|
+
unless filter and filter.include?(entity_reference)
|
473
|
+
er = DEFAULT_ENTITIES[entity_reference]
|
474
|
+
rv.gsub!( er[0], er[2] ) if er
|
475
|
+
end
|
476
|
+
end
|
477
|
+
rv.gsub!( /&/, '&' )
|
478
|
+
end
|
479
|
+
rv
|
480
|
+
end
|
481
|
+
end
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
=begin
|
486
|
+
case event[0]
|
487
|
+
when :start_element
|
488
|
+
when :text
|
489
|
+
when :end_element
|
490
|
+
when :processing_instruction
|
491
|
+
when :cdata
|
492
|
+
when :comment
|
493
|
+
when :xmldecl
|
494
|
+
when :start_doctype
|
495
|
+
when :end_doctype
|
496
|
+
when :externalentity
|
497
|
+
when :elementdecl
|
498
|
+
when :entity
|
499
|
+
when :attlistdecl
|
500
|
+
when :notationdecl
|
501
|
+
when :end_doctype
|
502
|
+
end
|
503
|
+
=end
|