sprockets-browserify 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +70 -0
- data/Rakefile +38 -0
- data/lib/sprockets/browserify/engine.rb +15 -0
- data/lib/sprockets/browserify.rb +37 -0
- data/lib/sprockets-browserify.rb +2 -0
- data/lib/tasks/sprockets-browserify_tasks.rake +4 -0
- data/node_modules/JSONStream/LICENSE.APACHE2 +15 -0
- data/node_modules/JSONStream/LICENSE.MIT +24 -0
- data/node_modules/JSONStream/examples/all_docs.js +13 -0
- data/node_modules/JSONStream/index.js +189 -0
- data/node_modules/JSONStream/node_modules/jsonparse/LICENSE +24 -0
- data/node_modules/JSONStream/node_modules/jsonparse/README.markdown +11 -0
- data/node_modules/JSONStream/node_modules/jsonparse/bench.js +26 -0
- data/node_modules/JSONStream/node_modules/jsonparse/examples/twitterfeed.js +30 -0
- data/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js +379 -0
- data/node_modules/JSONStream/node_modules/jsonparse/package.json +34 -0
- data/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic.json +167 -0
- data/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic2.json +180 -0
- data/node_modules/JSONStream/node_modules/jsonparse/test/primitives.js +54 -0
- data/node_modules/JSONStream/node_modules/jsonparse/test/utf8.js +38 -0
- data/node_modules/JSONStream/package.json +38 -0
- data/node_modules/JSONStream/readme.markdown +145 -0
- data/node_modules/JSONStream/test/bool.js +41 -0
- data/node_modules/JSONStream/test/destroy_missing.js +22 -0
- data/node_modules/JSONStream/test/empty.js +44 -0
- data/node_modules/JSONStream/test/fixtures/all_npm.json +4030 -0
- data/node_modules/JSONStream/test/fn.js +39 -0
- data/node_modules/JSONStream/test/memory.js +69 -0
- data/node_modules/JSONStream/test/multiple_objects.js +42 -0
- data/node_modules/JSONStream/test/multiple_objects_error.js +35 -0
- data/node_modules/JSONStream/test/parsejson.js +28 -0
- data/node_modules/JSONStream/test/stringify.js +41 -0
- data/node_modules/JSONStream/test/stringify_object.js +47 -0
- data/node_modules/JSONStream/test/test.js +35 -0
- data/node_modules/JSONStream/test/test2.js +29 -0
- data/node_modules/JSONStream/test/two-ways.js +41 -0
- data/node_modules/browserify/LICENSE +63 -0
- data/node_modules/browserify/README.markdown +172 -0
- data/node_modules/browserify/bin/cmd.js +161 -0
- data/node_modules/browserify/builtins/__browserify_process.js +55 -0
- data/node_modules/browserify/builtins/assert.js +314 -0
- data/node_modules/browserify/builtins/child_process.js +2 -0
- data/node_modules/browserify/builtins/events.js +178 -0
- data/node_modules/browserify/builtins/fs.js +1 -0
- data/node_modules/browserify/builtins/https.js +1 -0
- data/node_modules/browserify/builtins/net.js +1 -0
- data/node_modules/browserify/builtins/path.js +175 -0
- data/node_modules/browserify/builtins/querystring.js +250 -0
- data/node_modules/browserify/builtins/stream.js +119 -0
- data/node_modules/browserify/builtins/string_decoder.js +161 -0
- data/node_modules/browserify/builtins/sys.js +1 -0
- data/node_modules/browserify/builtins/timers.js +39 -0
- data/node_modules/browserify/builtins/tls.js +1 -0
- data/node_modules/browserify/builtins/tty.js +2 -0
- data/node_modules/browserify/builtins/url.js +604 -0
- data/node_modules/browserify/builtins/util.js +351 -0
- data/node_modules/browserify/doc/methods.markdown +182 -0
- data/node_modules/browserify/doc/recipes.markdown +62 -0
- data/node_modules/browserify/example/debug/browserify.js +219 -0
- data/node_modules/browserify/example/debug/build.sh +3 -0
- data/node_modules/browserify/example/debug/index.html +7 -0
- data/node_modules/browserify/example/debug/js/entry.js +2 -0
- data/node_modules/browserify/example/debug/js/thrower.js +3 -0
- data/node_modules/browserify/example/debug/server.js +9 -0
- data/node_modules/browserify/example/simple-build/browserify.js +368 -0
- data/node_modules/browserify/example/simple-build/build.sh +3 -0
- data/node_modules/browserify/example/simple-build/index.html +9 -0
- data/node_modules/browserify/example/simple-build/js/bar.js +3 -0
- data/node_modules/browserify/example/simple-build/js/entry.js +5 -0
- data/node_modules/browserify/example/simple-build/js/foo.js +5 -0
- data/node_modules/browserify/example/simple-build/server.js +9 -0
- data/node_modules/browserify/example/test/b.js +5 -0
- data/node_modules/browserify/example/test/bar.js +3 -0
- data/node_modules/browserify/example/test/foo.js +3 -0
- data/node_modules/browserify/example/test/m.js +3 -0
- data/node_modules/browserify/example/test/n.js +3 -0
- data/node_modules/browserify/example/using-http/bundle.js +813 -0
- data/node_modules/browserify/example/using-http/entry.js +25 -0
- data/node_modules/browserify/example/using-http/index.html +9 -0
- data/node_modules/browserify/example/using-http/server.js +28 -0
- data/node_modules/browserify/index.js +202 -0
- data/node_modules/browserify/lib/watch.js +75 -0
- data/node_modules/browserify/lib/wrap.js +583 -0
- data/node_modules/browserify/lib/wrappers.js +10 -0
- data/node_modules/browserify/node_modules/buffer-browserify/README.md +11 -0
- data/node_modules/browserify/node_modules/buffer-browserify/buffer_ieee754.js +84 -0
- data/node_modules/browserify/node_modules/buffer-browserify/index.js +1317 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/README.md +14 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/lib/b64.js +84 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/package.json +26 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/test/runner.js +50 -0
- data/node_modules/browserify/node_modules/buffer-browserify/package.json +42 -0
- data/node_modules/browserify/node_modules/buffer-browserify/test/buffer.js +218 -0
- data/node_modules/browserify/node_modules/coffee-script/CNAME +1 -0
- data/node_modules/browserify/node_modules/coffee-script/CONTRIBUTING.md +9 -0
- data/node_modules/browserify/node_modules/coffee-script/LICENSE +22 -0
- data/node_modules/browserify/node_modules/coffee-script/README +51 -0
- data/node_modules/browserify/node_modules/coffee-script/Rakefile +79 -0
- data/node_modules/browserify/node_modules/coffee-script/bin/cake +7 -0
- data/node_modules/browserify/node_modules/coffee-script/bin/coffee +7 -0
- data/node_modules/browserify/node_modules/coffee-script/extras/jsl.conf +44 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/browser.js +101 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/cake.js +113 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/coffee-script.js +218 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/command.js +506 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/grammar.js +623 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/helpers.js +150 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/lexer.js +905 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/nodes.js +3088 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/optparse.js +138 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/parser.js +608 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/repl.js +104 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/rewriter.js +478 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/scope.js +147 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/sourcemap.js +237 -0
- data/node_modules/browserify/node_modules/coffee-script/package.json +48 -0
- data/node_modules/browserify/node_modules/commondir/README.markdown +45 -0
- data/node_modules/browserify/node_modules/commondir/example/base.js +3 -0
- data/node_modules/browserify/node_modules/commondir/example/dir.js +3 -0
- data/node_modules/browserify/node_modules/commondir/index.js +29 -0
- data/node_modules/browserify/node_modules/commondir/package.json +43 -0
- data/node_modules/browserify/node_modules/commondir/test/dirs.js +66 -0
- data/node_modules/browserify/node_modules/console-browserify/LICENCE +19 -0
- data/node_modules/browserify/node_modules/console-browserify/README.md +32 -0
- data/node_modules/browserify/node_modules/console-browserify/index.js +85 -0
- data/node_modules/browserify/node_modules/console-browserify/package.json +76 -0
- data/node_modules/browserify/node_modules/console-browserify/test/index.js +67 -0
- data/node_modules/browserify/node_modules/console-browserify/test/static/index.html +12 -0
- data/node_modules/browserify/node_modules/console-browserify/test/static/test-adapter.js +53 -0
- data/node_modules/browserify/node_modules/crypto-browserify/example/bundle.js +637 -0
- data/node_modules/browserify/node_modules/crypto-browserify/example/index.html +12 -0
- data/node_modules/browserify/node_modules/crypto-browserify/example/test.js +4 -0
- data/node_modules/browserify/node_modules/crypto-browserify/index.js +74 -0
- data/node_modules/browserify/node_modules/crypto-browserify/md5.js +384 -0
- data/node_modules/browserify/node_modules/crypto-browserify/package.json +30 -0
- data/node_modules/browserify/node_modules/crypto-browserify/readme.markdown +20 -0
- data/node_modules/browserify/node_modules/crypto-browserify/rng.js +37 -0
- data/node_modules/browserify/node_modules/crypto-browserify/sha.js +210 -0
- data/node_modules/browserify/node_modules/crypto-browserify/test/simple.js +35 -0
- data/node_modules/browserify/node_modules/deputy/README.markdown +55 -0
- data/node_modules/browserify/node_modules/deputy/example/cache.js +5 -0
- data/node_modules/browserify/node_modules/deputy/index.js +46 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/LICENSE +21 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/examples/pow.js +6 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/index.js +82 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/package.json +30 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/readme.markdown +63 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/chmod.js +38 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/clobber.js +37 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/mkdirp.js +28 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/perm.js +32 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/perm_sync.js +39 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/race.js +41 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/rel.js +32 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/return.js +25 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/return_sync.js +24 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/root.js +18 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/sync.js +32 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/umask.js +28 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/umask_sync.js +32 -0
- data/node_modules/browserify/node_modules/deputy/package.json +43 -0
- data/node_modules/browserify/node_modules/deputy/test/cache.js +58 -0
- data/node_modules/browserify/node_modules/detective/README.markdown +66 -0
- data/node_modules/browserify/node_modules/detective/example/strings.js +6 -0
- data/node_modules/browserify/node_modules/detective/example/strings_src.js +3 -0
- data/node_modules/browserify/node_modules/detective/index.js +60 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/LICENSE.BSD +19 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/README.md +74 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/codemirror.css +112 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/codemirror.js +2972 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/javascript.js +360 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/json2.js +487 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/style.css +164 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview-min.js +12 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview-sprite.gif +0 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview.css +7 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/yahoo-dom-event.js +14 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/bin/esparse.js +42 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/changes +92 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/cm +696 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/checkenv.js +42 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/collector.html +82 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/collector.js +170 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/functiontrace.html +106 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/functiontrace.js +123 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/parse.css +82 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/parse.html +352 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/precedence.html +225 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/rewrite.html +120 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/rewrite.js +71 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/esprima.js +3577 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/index.html +103 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/package.json +39 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/Tokenizer.js +646 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/XMLHttpRequest.js +509 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ZeParser.js +2185 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/backbone-0.5.3.js +1158 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/benchmark.js +3261 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/escodegen.js +906 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/esmorph.js +240 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ext-core-3.0.0.js +6579 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ext-core-3.1.0.js +10255 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery-1.6.4.js +9046 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery-1.7.1.js +9266 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery.mobile-1.0.js +6951 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jsdefs.js +731 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jslex.js +588 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jsparse.js +1921 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/mootools-1.3.2.js +5952 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/mootools-1.4.1.js +6297 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/parse-js.js +1342 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/platform.js +878 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/prototype-1.6.1.js +4874 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/prototype-1.7.0.0.js +6082 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/underscore-1.2.3.js +981 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/benchmarks.html +58 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/benchmarks.js +328 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compare.html +140 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compare.js +270 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compat.html +40 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compat.js +239 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.footer.html +3 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.header.html +37 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.html +3617 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/index.html +36 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/reflect.js +403 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/run.js +66 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/test.js +16659 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/tools/generate-unicode-regex.py +164 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/tools/update-coverage.sh +28 -0
- data/node_modules/browserify/node_modules/detective/package.json +43 -0
- data/node_modules/browserify/node_modules/detective/test/both.js +11 -0
- data/node_modules/browserify/node_modules/detective/test/chained.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/files/both.js +4 -0
- data/node_modules/browserify/node_modules/detective/test/files/chained.js +5 -0
- data/node_modules/browserify/node_modules/detective/test/files/nested.js +22 -0
- data/node_modules/browserify/node_modules/detective/test/files/skip.js +7 -0
- data/node_modules/browserify/node_modules/detective/test/files/strings.js +13 -0
- data/node_modules/browserify/node_modules/detective/test/files/word.js +13 -0
- data/node_modules/browserify/node_modules/detective/test/nested.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/skip.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/strings.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/word.js +12 -0
- data/node_modules/browserify/node_modules/http-browserify/example/get/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/get/main.js +14 -0
- data/node_modules/browserify/node_modules/http-browserify/example/get/server.js +12 -0
- data/node_modules/browserify/node_modules/http-browserify/example/headers/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/headers/main.js +18 -0
- data/node_modules/browserify/node_modules/http-browserify/example/headers/server.js +15 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/data.json +139 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/main.js +13 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/LICENSE.APACHE2 +15 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/LICENSE.MIT +24 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/examples/all_docs.js +13 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/index.js +189 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/LICENSE +24 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/README.markdown +11 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/bench.js +26 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/examples/twitterfeed.js +30 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js +379 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/package.json +36 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic.json +167 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic2.json +180 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/test/primitives.js +54 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/test/utf8.js +38 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/package.json +40 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/readme.markdown +145 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/bool.js +41 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/destroy_missing.js +22 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/empty.js +44 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/fixtures/all_npm.json +4030 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/fn.js +39 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/memory.js +69 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects.js +42 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects_error.js +35 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/parsejson.js +28 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/stringify.js +41 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/stringify_object.js +47 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/test.js +35 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/test2.js +29 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/two-ways.js +41 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/server.js +10 -0
- data/node_modules/browserify/node_modules/http-browserify/example/post/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/post/main.js +16 -0
- data/node_modules/browserify/node_modules/http-browserify/example/post/server.js +19 -0
- data/node_modules/browserify/node_modules/http-browserify/example/streaming/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/streaming/main.js +16 -0
- data/node_modules/browserify/node_modules/http-browserify/example/streaming/server.js +21 -0
- data/node_modules/browserify/node_modules/http-browserify/index.js +60 -0
- data/node_modules/browserify/node_modules/http-browserify/lib/request.js +128 -0
- data/node_modules/browserify/node_modules/http-browserify/lib/response.js +119 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/index.js +48 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/package.json +29 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/readme.md +31 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/test.js +34 -0
- data/node_modules/browserify/node_modules/http-browserify/package.json +42 -0
- data/node_modules/browserify/node_modules/http-browserify/readme.markdown +128 -0
- data/node_modules/browserify/node_modules/nub/README.markdown +23 -0
- data/node_modules/browserify/node_modules/nub/index.js +64 -0
- data/node_modules/browserify/node_modules/nub/package.json +42 -0
- data/node_modules/browserify/node_modules/nub/test/by.js +51 -0
- data/node_modules/browserify/node_modules/nub/test/nub.js +46 -0
- data/node_modules/browserify/node_modules/optimist/LICENSE +21 -0
- data/node_modules/browserify/node_modules/optimist/README.markdown +487 -0
- data/node_modules/browserify/node_modules/optimist/example/bool.js +10 -0
- data/node_modules/browserify/node_modules/optimist/example/boolean_double.js +7 -0
- data/node_modules/browserify/node_modules/optimist/example/boolean_single.js +7 -0
- data/node_modules/browserify/node_modules/optimist/example/default_hash.js +8 -0
- data/node_modules/browserify/node_modules/optimist/example/default_singles.js +7 -0
- data/node_modules/browserify/node_modules/optimist/example/divide.js +8 -0
- data/node_modules/browserify/node_modules/optimist/example/line_count.js +20 -0
- data/node_modules/browserify/node_modules/optimist/example/line_count_options.js +29 -0
- data/node_modules/browserify/node_modules/optimist/example/line_count_wrap.js +29 -0
- data/node_modules/browserify/node_modules/optimist/example/nonopt.js +4 -0
- data/node_modules/browserify/node_modules/optimist/example/reflect.js +2 -0
- data/node_modules/browserify/node_modules/optimist/example/short.js +3 -0
- data/node_modules/browserify/node_modules/optimist/example/string.js +11 -0
- data/node_modules/browserify/node_modules/optimist/example/usage-options.js +19 -0
- data/node_modules/browserify/node_modules/optimist/example/xup.js +10 -0
- data/node_modules/browserify/node_modules/optimist/index.js +475 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/README.markdown +70 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/example/center.js +10 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/example/meat.js +3 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/index.js +76 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/package.json +41 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/test/break.js +30 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/test/idleness.txt +63 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/test/wrap.js +31 -0
- data/node_modules/browserify/node_modules/optimist/package.json +47 -0
- data/node_modules/browserify/node_modules/optimist/test/_/argv.js +2 -0
- data/node_modules/browserify/node_modules/optimist/test/_/bin.js +3 -0
- data/node_modules/browserify/node_modules/optimist/test/_.js +71 -0
- data/node_modules/browserify/node_modules/optimist/test/parse.js +433 -0
- data/node_modules/browserify/node_modules/optimist/test/usage.js +292 -0
- data/node_modules/browserify/node_modules/optimist/x.js +1 -0
- data/node_modules/browserify/node_modules/resolve/LICENSE +18 -0
- data/node_modules/browserify/node_modules/resolve/README.markdown +47 -0
- data/node_modules/browserify/node_modules/resolve/index.js +109 -0
- data/node_modules/browserify/node_modules/resolve/package.json +41 -0
- data/node_modules/browserify/node_modules/resolve/test/core.js +12 -0
- data/node_modules/browserify/node_modules/resolve/test/filter.js +15 -0
- data/node_modules/browserify/node_modules/resolve/test/mock.js +68 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/baz/doom.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/baz/package.json +3 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/baz/quux.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/cup.coffee +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/foo.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/mug.coffee +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/mug.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/other_path/lib/other-lib.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/other_path/root.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver.js +157 -0
- data/node_modules/browserify/node_modules/syntax-error/LICENSE +18 -0
- data/node_modules/browserify/node_modules/syntax-error/example/check.js +12 -0
- data/node_modules/browserify/node_modules/syntax-error/example/src.js +9 -0
- data/node_modules/browserify/node_modules/syntax-error/index.js +54 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/LICENSE.BSD +19 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/README.md +74 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/codemirror.css +112 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/codemirror.js +2972 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/javascript.js +360 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/json2.js +487 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/style.css +164 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview-min.js +12 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview-sprite.gif +0 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview.css +7 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/yahoo-dom-event.js +14 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/bin/esparse.js +42 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/changes +92 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/cm +696 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/checkenv.js +42 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/collector.html +82 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/collector.js +170 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/functiontrace.html +106 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/functiontrace.js +123 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/parse.css +82 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/parse.html +352 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/precedence.html +225 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/rewrite.html +120 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/rewrite.js +71 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/esprima.js +3577 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/index.html +103 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/package.json +39 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/Tokenizer.js +646 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/XMLHttpRequest.js +509 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ZeParser.js +2185 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/backbone-0.5.3.js +1158 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/benchmark.js +3261 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/escodegen.js +906 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/esmorph.js +240 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ext-core-3.0.0.js +6579 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ext-core-3.1.0.js +10255 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery-1.6.4.js +9046 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery-1.7.1.js +9266 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery.mobile-1.0.js +6951 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jsdefs.js +731 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jslex.js +588 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jsparse.js +1921 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/mootools-1.3.2.js +5952 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/mootools-1.4.1.js +6297 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/parse-js.js +1342 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/platform.js +878 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/prototype-1.6.1.js +4874 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/prototype-1.7.0.0.js +6082 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/underscore-1.2.3.js +981 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/benchmarks.html +58 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/benchmarks.js +328 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compare.html +140 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compare.js +270 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compat.html +40 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compat.js +239 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.footer.html +3 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.header.html +37 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.html +3617 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/index.html +36 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/reflect.js +403 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/run.js +66 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/test.js +16659 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/tools/generate-unicode-regex.py +164 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/tools/update-coverage.sh +28 -0
- data/node_modules/browserify/node_modules/syntax-error/package.json +46 -0
- data/node_modules/browserify/node_modules/syntax-error/readme.markdown +87 -0
- data/node_modules/browserify/node_modules/syntax-error/test/check.js +17 -0
- data/node_modules/browserify/node_modules/syntax-error/test/sources/check.js +9 -0
- data/node_modules/browserify/node_modules/vm-browserify/README.markdown +103 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/bundle.js +473 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/entry.js +6 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/index.html +9 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/server.js +6 -0
- data/node_modules/browserify/node_modules/vm-browserify/index.js +85 -0
- data/node_modules/browserify/node_modules/vm-browserify/package.json +39 -0
- data/node_modules/browserify/node_modules/vm-browserify/testling/run.js +22 -0
- data/node_modules/browserify/node_modules/vm-browserify/testling/test.sh +11 -0
- data/node_modules/browserify/package.json +71 -0
- data/node_modules/browserify/test/alias.js +58 -0
- data/node_modules/browserify/test/backbone.js +21 -0
- data/node_modules/browserify/test/bin.js +39 -0
- data/node_modules/browserify/test/buffer.js +99 -0
- data/node_modules/browserify/test/bundle.js +32 -0
- data/node_modules/browserify/test/cache.js +28 -0
- data/node_modules/browserify/test/coffee/bar.js +1 -0
- data/node_modules/browserify/test/coffee/baz.coffee +1 -0
- data/node_modules/browserify/test/coffee/entry.coffee +1 -0
- data/node_modules/browserify/test/coffee/foo.coffee +1 -0
- data/node_modules/browserify/test/coffee/index.coffee +5 -0
- data/node_modules/browserify/test/coffee/nested/nested.coffee +2 -0
- data/node_modules/browserify/test/coffee.js +39 -0
- data/node_modules/browserify/test/comment/main.js +2 -0
- data/node_modules/browserify/test/comment.js +17 -0
- data/node_modules/browserify/test/crypto.js +37 -0
- data/node_modules/browserify/test/dnode.js +27 -0
- data/node_modules/browserify/test/dollar/dollar/index.js +7 -0
- data/node_modules/browserify/test/dollar.js +19 -0
- data/node_modules/browserify/test/entry/main.js +1 -0
- data/node_modules/browserify/test/entry/one.js +1 -0
- data/node_modules/browserify/test/entry/two.js +1 -0
- data/node_modules/browserify/test/entry.js +36 -0
- data/node_modules/browserify/test/error_code/src.js +2 -0
- data/node_modules/browserify/test/error_code.js +24 -0
- data/node_modules/browserify/test/export/entry.js +1 -0
- data/node_modules/browserify/test/export.js +52 -0
- data/node_modules/browserify/test/field/miss.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-miss/browser.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-miss/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-miss/package.json +4 -0
- data/node_modules/browserify/test/field/node_modules/z-object/browser.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-object/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-object/package.json +6 -0
- data/node_modules/browserify/test/field/node_modules/z-string/browser.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-string/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-string/package.json +4 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/browser/a.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/browser/b.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/package.json +4 -0
- data/node_modules/browserify/test/field/object.js +1 -0
- data/node_modules/browserify/test/field/string.js +1 -0
- data/node_modules/browserify/test/field/sub.js +1 -0
- data/node_modules/browserify/test/field.js +64 -0
- data/node_modules/browserify/test/global/main.js +2 -0
- data/node_modules/browserify/test/global.js +19 -0
- data/node_modules/browserify/test/jade.js +35 -0
- data/node_modules/browserify/test/json/beep.json +4 -0
- data/node_modules/browserify/test/json/main.js +1 -0
- data/node_modules/browserify/test/json.js +17 -0
- data/node_modules/browserify/test/maxlisteners.js +8 -0
- data/node_modules/browserify/test/module.js +22 -0
- data/node_modules/browserify/test/multi_entry/a.js +2 -0
- data/node_modules/browserify/test/multi_entry/b.js +2 -0
- data/node_modules/browserify/test/multi_entry/c.js +3 -0
- data/node_modules/browserify/test/multi_entry.js +20 -0
- data/node_modules/browserify/test/multi_ignore.js +23 -0
- data/node_modules/browserify/test/node_modules/beep/index.js +1 -0
- data/node_modules/browserify/test/require_cache.js +18 -0
- data/node_modules/browserify/test/retarget.js +27 -0
- data/node_modules/browserify/test/seq.js +47 -0
- data/node_modules/browserify/test/subdep/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/b.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/ignore_me.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/a/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/a/package.json +5 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/c/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/c/package.json +5 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/f/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/z/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/package.json +3 -0
- data/node_modules/browserify/test/subdep/package.json +6 -0
- data/node_modules/browserify/test/subdep.js +26 -0
- data/node_modules/browserify/test/util.js +48 -0
- data/node_modules/browserify/test/watch/a.js +1 -0
- data/node_modules/browserify/test/watch.js +91 -0
- data/node_modules/browserify/test/wrap/a.js +2 -0
- data/node_modules/browserify/test/wrap/c.js +1 -0
- data/node_modules/browserify/test/wrap/node_modules/b/main.js +1 -0
- data/node_modules/browserify/test/wrap/node_modules/b/package.json +3 -0
- data/node_modules/browserify/test/wrap/node_modules/skipmetoo/index.js +1 -0
- data/node_modules/browserify/test/wrap/skipme.js +1 -0
- data/node_modules/browserify/test/wrap/x.js +0 -0
- data/node_modules/browserify/test/wrap.js +43 -0
- data/node_modules/browserify/testling/README.markdown +29 -0
- data/node_modules/browserify/testling/test.sh +37 -0
- data/node_modules/browserify/testling/tick.js +9 -0
- data/node_modules/browserify/testling/timers.js +50 -0
- data/node_modules/browserify/testling/util.js +24 -0
- data/node_modules/browserify/v2.markdown +41 -0
- data/node_modules/browserify/wrappers/alias.js +1 -0
- data/node_modules/browserify/wrappers/body.js +2 -0
- data/node_modules/browserify/wrappers/body_debug.js +2 -0
- data/node_modules/browserify/wrappers/entry.js +3 -0
- data/node_modules/browserify/wrappers/entry_debug.js +3 -0
- data/node_modules/browserify/wrappers/package.js +3 -0
- data/node_modules/browserify/wrappers/prelude.js +196 -0
- data/node_modules/module-deps/LICENSE +18 -0
- data/node_modules/module-deps/cmd.js +8 -0
- data/node_modules/module-deps/example/deps.js +8 -0
- data/node_modules/module-deps/example/files/bar.js +3 -0
- data/node_modules/module-deps/example/files/foo.js +5 -0
- data/node_modules/module-deps/example/files/main.js +2 -0
- data/node_modules/module-deps/example/files/xyz.js +2 -0
- data/node_modules/module-deps/index.js +142 -0
- data/node_modules/module-deps/node_modules/browser-resolve/README.md +14 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/assert.js +314 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/child_process.js +2 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/events.js +183 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/fs.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/https.js +13 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/net.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/path.js +175 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/process.js +55 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/querystring.js +250 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/stream.js +119 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/string_decoder.js +161 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/sys.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/timers.js +39 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/tls.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/tty.js +2 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/url.js +604 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/util.js +351 -0
- data/node_modules/module-deps/node_modules/browser-resolve/index.js +144 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/README.md +11 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/buffer_ieee754.js +84 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/index.js +1282 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/README.md +14 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/lib/b64.js +84 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/package.json +26 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/test/runner.js +50 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/package.json +42 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/test/buffer.js +121 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/LICENCE +19 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/README.md +32 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/index.js +85 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/package.json +76 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/test/index.js +67 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/test/static/index.html +12 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/test/static/test-adapter.js +53 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/example/bundle.js +637 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/example/index.html +12 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/example/test.js +4 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/index.js +74 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/md5.js +384 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/package.json +30 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/readme.markdown +20 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/rng.js +37 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/sha.js +210 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/test/simple.js +35 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/README.markdown +128 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/get/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/get/main.js +14 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/get/server.js +12 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/headers/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/headers/main.js +18 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/headers/server.js +15 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/post/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/post/main.js +16 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/post/server.js +19 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/streaming/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/streaming/main.js +16 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/streaming/server.js +21 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/index.js +59 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/lib/request.js +122 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/lib/response.js +119 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/index.js +48 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/package.json +29 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/readme.md +31 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/test.js +34 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/package.json +42 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/README.markdown +103 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/bundle.js +473 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/entry.js +6 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/server.js +6 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/index.js +85 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/package.json +39 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/testling/run.js +22 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/testling/test.sh +11 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/index.js +43 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/package.json +33 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/readme.md +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/test/zlib.test.js +65 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/zlib.js +55 -0
- data/node_modules/module-deps/node_modules/browser-resolve/package.json +38 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/core.js +20 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/fixtures/foo.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/local.js +15 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/mocha.opts +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/modules.js +99 -0
- data/node_modules/module-deps/node_modules/detective/LICENSE +18 -0
- data/node_modules/module-deps/node_modules/detective/example/strings.js +6 -0
- data/node_modules/module-deps/node_modules/detective/example/strings_src.js +3 -0
- data/node_modules/module-deps/node_modules/detective/index.js +62 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/LICENSE.BSD +19 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/LICENSE.source-map +27 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/README.md +99 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/bin/escodegen.js +43 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/bin/esgenerate.js +43 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/escodegen.js +2245 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/LICENSE +28 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/Makefile.dryice.js +165 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/README.md +268 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/assert-shim.js +56 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/mini-require.js +152 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/prefix-source-map.jsm +20 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/prefix-utils.jsm +18 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/suffix-browser.js +8 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/suffix-source-map.jsm +6 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/suffix-utils.jsm +20 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/test-prefix.js +8 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/test-suffix.js +3 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/array-set.js +107 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/base64.js +42 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/binary-search.js +81 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/source-map-consumer.js +379 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/source-map-generator.js +202 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/source-node.js +199 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/util.js +40 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map.js +8 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/README.md +119 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/package.json +29 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/package.json +38 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/run-tests.js +72 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-api.js +26 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-array-set.js +71 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-base64.js +35 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-consumer.js +142 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js +187 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-node.js +163 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/util.js +78 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/package.json +48 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/ChangeLog +18 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/LICENSE.BSD +19 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/README.md +73 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/bin/esparse.js +117 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/bin/esvalidate.js +177 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/component.json +14 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/doc/index.html +473 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/esprima.js +3895 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/detectnestedternary.js +106 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/findbooleantrap.js +173 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/tokendist.js +33 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/index.html +102 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/package.json +40 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/benchmarks.html +58 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/benchmarks.js +334 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compare.html +69 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compare.js +328 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compat.html +40 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compat.js +239 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/coverage.footer.html +3 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/coverage.header.html +37 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/coverage.html +4676 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/index.html +37 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/module.html +36 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/module.js +129 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/reflect.js +422 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/run.js +66 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/runner.js +387 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/test.js +19764 -0
- data/node_modules/module-deps/node_modules/detective/package.json +36 -0
- data/node_modules/module-deps/node_modules/detective/readme.markdown +70 -0
- data/node_modules/module-deps/node_modules/detective/test/both.js +11 -0
- data/node_modules/module-deps/node_modules/detective/test/chained.js +9 -0
- data/node_modules/module-deps/node_modules/detective/test/files/both.js +4 -0
- data/node_modules/module-deps/node_modules/detective/test/files/chained.js +5 -0
- data/node_modules/module-deps/node_modules/detective/test/files/nested.js +22 -0
- data/node_modules/module-deps/node_modules/detective/test/files/shebang.js +5 -0
- data/node_modules/module-deps/node_modules/detective/test/files/strings.js +13 -0
- data/node_modules/module-deps/node_modules/detective/test/files/word.js +13 -0
- data/node_modules/module-deps/node_modules/detective/test/nested.js +9 -0
- data/node_modules/module-deps/node_modules/detective/test/shebang.js +9 -0
- data/node_modules/module-deps/node_modules/detective/test/strings.js +9 -0
- data/node_modules/module-deps/node_modules/detective/test/word.js +12 -0
- data/node_modules/module-deps/node_modules/resolve/LICENSE +18 -0
- data/node_modules/module-deps/node_modules/resolve/example/async.js +5 -0
- data/node_modules/module-deps/node_modules/resolve/example/sync.js +3 -0
- data/node_modules/module-deps/node_modules/resolve/index.js +5 -0
- data/node_modules/module-deps/node_modules/resolve/lib/async.js +131 -0
- data/node_modules/module-deps/node_modules/resolve/lib/core.js +4 -0
- data/node_modules/module-deps/node_modules/resolve/lib/core.json +38 -0
- data/node_modules/module-deps/node_modules/resolve/lib/sync.js +98 -0
- data/node_modules/module-deps/node_modules/resolve/package.json +32 -0
- data/node_modules/module-deps/node_modules/resolve/readme.markdown +134 -0
- data/node_modules/module-deps/node_modules/resolve/test/core.js +12 -0
- data/node_modules/module-deps/node_modules/resolve/test/filter.js +17 -0
- data/node_modules/module-deps/node_modules/resolve/test/filter_sync.js +15 -0
- data/node_modules/module-deps/node_modules/resolve/test/mock.js +68 -0
- data/node_modules/module-deps/node_modules/resolve/test/mock_sync.js +68 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/baz/doom.js +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/baz/package.json +3 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/baz/quux.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/cup.coffee +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/foo.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/mug.coffee +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/mug.js +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/other_path/lib/other-lib.js +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/other_path/root.js +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver.js +144 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver_sync.js +157 -0
- data/node_modules/module-deps/package.json +47 -0
- data/node_modules/module-deps/readme.markdown +128 -0
- data/node_modules/module-deps/test/bundle.js +21 -0
- data/node_modules/module-deps/test/deps.js +42 -0
- data/node_modules/module-deps/test/files/bar.js +3 -0
- data/node_modules/module-deps/test/files/foo.js +5 -0
- data/node_modules/module-deps/test/files/main.js +2 -0
- data/node_modules/module-deps/test/files/tr_module/f.js +1 -0
- data/node_modules/module-deps/test/files/tr_module/main.js +7 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/g/index.js +1 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/g/node_modules/insert-ggg/index.js +7 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/g/package.json +6 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/insert-aaa/index.js +7 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/insert-bbb/index.js +7 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/m/index.js +3 -0
- data/node_modules/module-deps/test/files/tr_sh/f.js +1 -0
- data/node_modules/module-deps/test/files/tr_sh/main.js +7 -0
- data/node_modules/module-deps/test/files/tr_sh/node_modules/g/index.js +1 -0
- data/node_modules/module-deps/test/files/tr_sh/node_modules/g/package.json +6 -0
- data/node_modules/module-deps/test/files/tr_sh/node_modules/g/tr_g.js +6 -0
- data/node_modules/module-deps/test/files/tr_sh/node_modules/m/index.js +3 -0
- data/node_modules/module-deps/test/files/tr_sh/tr_a.js +6 -0
- data/node_modules/module-deps/test/files/tr_sh/tr_b.js +6 -0
- data/node_modules/module-deps/test/files/xyz.js +2 -0
- data/node_modules/module-deps/test/tr_fn.js +29 -0
- data/node_modules/module-deps/test/tr_module.js +21 -0
- data/node_modules/module-deps/test/tr_sh.js +21 -0
- data/node_modules/through/LICENSE.APACHE2 +15 -0
- data/node_modules/through/LICENSE.MIT +24 -0
- data/node_modules/through/index.js +103 -0
- data/node_modules/through/package.json +35 -0
- data/node_modules/through/readme.markdown +43 -0
- data/node_modules/through/test/buffering.js +71 -0
- data/node_modules/through/test/end.js +27 -0
- data/node_modules/through/test/index.js +113 -0
- data/package.json +11 -0
- metadata +846 -0
data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ZeParser.js
ADDED
@@ -0,0 +1,2185 @@
|
|
1
|
+
if (typeof exports !== 'undefined') {
|
2
|
+
var Tokenizer = require('./Tokenizer').Tokenizer;
|
3
|
+
exports.ZeParser = ZeParser;
|
4
|
+
}
|
5
|
+
|
6
|
+
/**
|
7
|
+
* This is my js Parser: Ze. It's actually the post-dev pre-cleanup version. Clearly.
|
8
|
+
* Some optimizations have been applied :)
|
9
|
+
* (c) Peter van der Zee, qfox.nl
|
10
|
+
* @param {String} inp Input
|
11
|
+
* @param {Tokenizer} tok
|
12
|
+
* @param {Array} stack The tokens will be put in this array. If you're looking for the AST, this would be it :)
|
13
|
+
*/
|
14
|
+
function ZeParser(inp, tok, stack, simple){
|
15
|
+
this.input = inp;
|
16
|
+
this.tokenizer = tok;
|
17
|
+
this.stack = stack;
|
18
|
+
this.stack.root = true;
|
19
|
+
this.scope = stack.scope = [{value:'this', isDeclared:true, isEcma:true, thisIsGlobal:true}]; // names of variables
|
20
|
+
this.scope.global = true;
|
21
|
+
this.statementLabels = [];
|
22
|
+
|
23
|
+
this.errorStack = [];
|
24
|
+
|
25
|
+
stack.scope = this.scope; // hook root
|
26
|
+
stack.labels = this.statementLabels;
|
27
|
+
|
28
|
+
this.regexLhsStart = ZeParser.regexLhsStart;
|
29
|
+
/*
|
30
|
+
this.regexStartKeyword = ZeParser.regexStartKeyword;
|
31
|
+
this.regexKeyword = ZeParser.regexKeyword;
|
32
|
+
this.regexStartReserved = ZeParser.regexStartReserved;
|
33
|
+
this.regexReserved = ZeParser.regexReserved;
|
34
|
+
*/
|
35
|
+
this.regexStartKeyOrReserved = ZeParser.regexStartKeyOrReserved;
|
36
|
+
this.hashStartKeyOrReserved = ZeParser.hashStartKeyOrReserved;
|
37
|
+
this.regexIsKeywordOrReserved = ZeParser.regexIsKeywordOrReserved;
|
38
|
+
this.regexAssignments = ZeParser.regexAssignments;
|
39
|
+
this.regexNonAssignmentBinaryExpressionOperators = ZeParser.regexNonAssignmentBinaryExpressionOperators;
|
40
|
+
this.regexUnaryKeywords = ZeParser.regexUnaryKeywords;
|
41
|
+
this.hashUnaryKeywordStart = ZeParser.hashUnaryKeywordStart;
|
42
|
+
this.regexUnaryOperators = ZeParser.regexUnaryOperators;
|
43
|
+
this.regexLiteralKeywords = ZeParser.regexLiteralKeywords;
|
44
|
+
this.testing = {'this':1,'null':1,'true':1,'false':1};
|
45
|
+
|
46
|
+
this.ast = !simple; ///#define FULL_AST
|
47
|
+
};
|
48
|
+
/**
|
49
|
+
* Returns just a stacked parse tree (regular array)
|
50
|
+
* @param {string} input
|
51
|
+
* @param {boolean} simple=false
|
52
|
+
* @return {Array}
|
53
|
+
*/
|
54
|
+
ZeParser.parse = function(input, simple){
|
55
|
+
var tok = new Tokenizer(input);
|
56
|
+
var stack = [];
|
57
|
+
try {
|
58
|
+
var parser = new ZeParser(input, tok, stack);
|
59
|
+
if (simple) parser.ast = false;
|
60
|
+
parser.parse();
|
61
|
+
return stack;
|
62
|
+
} catch (e) {
|
63
|
+
console.log("Parser has a bug for this input, please report it :)", e);
|
64
|
+
return null;
|
65
|
+
}
|
66
|
+
};
|
67
|
+
/**
|
68
|
+
* Returns a new parser instance with parse details for input
|
69
|
+
* @param {string} input
|
70
|
+
* @returns {ZeParser}
|
71
|
+
*/
|
72
|
+
ZeParser.createParser = function(input){
|
73
|
+
var tok = new Tokenizer(input);
|
74
|
+
var stack = [];
|
75
|
+
try {
|
76
|
+
var parser = new ZeParser(input, tok, stack);
|
77
|
+
parser.parse();
|
78
|
+
return parser;
|
79
|
+
} catch (e) {
|
80
|
+
console.log("Parser has a bug for this input, please report it :)", e);
|
81
|
+
return null;
|
82
|
+
}
|
83
|
+
};
|
84
|
+
ZeParser.prototype = {
|
85
|
+
input: null,
|
86
|
+
tokenizer: null,
|
87
|
+
stack: null,
|
88
|
+
scope: null,
|
89
|
+
statementLabels: null,
|
90
|
+
errorStack: null,
|
91
|
+
|
92
|
+
ast: null,
|
93
|
+
|
94
|
+
parse: function(match){
|
95
|
+
if (match) match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, this.stack); // meh
|
96
|
+
else match = this.tokenizer.storeCurrentAndFetchNextToken(false, null, this.stack, true); // initialization step, dont store the match (there isnt any!)
|
97
|
+
|
98
|
+
match = this.eatSourceElements(match, this.stack);
|
99
|
+
|
100
|
+
var cycled = false;
|
101
|
+
do {
|
102
|
+
if (match && match.name != 12/*eof*/) {
|
103
|
+
// if not already an error, insert an error before it
|
104
|
+
if (match.name != 14/*error*/) this.failignore('UnexpectedToken', match, this.stack);
|
105
|
+
// just parse the token as is and continue.
|
106
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, this.stack);
|
107
|
+
cycled = true;
|
108
|
+
}
|
109
|
+
|
110
|
+
// keep gobbling any errors...
|
111
|
+
} while (match && match.name == 14/*error*/);
|
112
|
+
|
113
|
+
// now try again (but only if we gobbled at least one token)...
|
114
|
+
if (cycled && match && match.name != 12/*eof*/) match = this.parse(match);
|
115
|
+
|
116
|
+
// pop the last token off the stack if it caused an error at eof
|
117
|
+
if (this.tokenizer.errorEscape) {
|
118
|
+
this.stack.push(this.tokenizer.errorEscape);
|
119
|
+
this.tokenizer.errorEscape = null;
|
120
|
+
}
|
121
|
+
|
122
|
+
return match;
|
123
|
+
},
|
124
|
+
|
125
|
+
eatSemiColon: function(match, stack){
|
126
|
+
//this.stats.eatSemiColon = (+//this.stats.eatSemiColon||0)+1;
|
127
|
+
if (match.value == ';') match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
128
|
+
else {
|
129
|
+
// try asi
|
130
|
+
// only if:
|
131
|
+
// - this token was preceeded by at least one newline (match.newline) or next token is }
|
132
|
+
// - this is EOF
|
133
|
+
// - prev token was one of return,continue,break,throw (restricted production), not checked here.
|
134
|
+
|
135
|
+
// the exceptions to this rule are
|
136
|
+
// - if the next line is a regex
|
137
|
+
// - the semi is part of the for-header.
|
138
|
+
// these exceptions are automatically caught by the way the parser is built
|
139
|
+
|
140
|
+
// not eof and just parsed semi or no newline preceeding and next isnt }
|
141
|
+
if (match.name != 12/*EOF*/ && (match.semi || (!match.newline && match.value != '}')) && !(match.newline && (match.value == '++' || match.value == '--'))) {
|
142
|
+
this.failignore('NoASI', match, stack);
|
143
|
+
} else {
|
144
|
+
// ASI
|
145
|
+
// (match is actually the match _after_ this asi, so the position of asi is match.start, not stop (!)
|
146
|
+
var asi = {start:match.start,stop:match.start,name:13/*ASI*/};
|
147
|
+
stack.push(asi);
|
148
|
+
|
149
|
+
// slip it in the stream, before the current match.
|
150
|
+
// for the other tokens see the tokenizer near the end of the main parsing function
|
151
|
+
this.tokenizer.addTokenToStreamBefore(asi, match);
|
152
|
+
}
|
153
|
+
}
|
154
|
+
match.semi = true;
|
155
|
+
return match;
|
156
|
+
},
|
157
|
+
/**
|
158
|
+
* Eat one or more "AssignmentExpression"s. May also eat a labeled statement if
|
159
|
+
* the parameters are set that way. This is the only way to linearly distinct between
|
160
|
+
* an expression-statement and a labeled-statement without double lookahead. (ok, maybe not "only")
|
161
|
+
* @param {boolean} mayParseLabeledStatementInstead=false If the first token is an identifier and the second a colon, accept this match as a labeled statement instead... Only true if the match in the parameter is an (unreserved) identifier (so no need to validate that further)
|
162
|
+
* @param {Object} match
|
163
|
+
* @param {Array} stack
|
164
|
+
* @param {boolean} onlyOne=false Only parse a AssignmentExpression
|
165
|
+
* @param {boolean} forHeader=false Do not allow the `in` operator
|
166
|
+
* @param {boolean} isBreakOrContinueArg=false The argument for break or continue is always a single identifier
|
167
|
+
* @return {Object}
|
168
|
+
*/
|
169
|
+
eatExpressions: function(mayParseLabeledStatementInstead, match, stack, onlyOne, forHeader, isBreakOrContinueArg){
|
170
|
+
if (this.ast) { //#ifdef FULL_AST
|
171
|
+
var pstack = stack;
|
172
|
+
stack = [];
|
173
|
+
stack.desc = 'expressions';
|
174
|
+
stack.nextBlack = match.tokposb;
|
175
|
+
pstack.push(stack);
|
176
|
+
|
177
|
+
var parsedExpressions = 0;
|
178
|
+
} //#endif
|
179
|
+
|
180
|
+
var first = true;
|
181
|
+
do {
|
182
|
+
var parsedNonAssignmentOperator = false; // once we parse a non-assignment, this expression can no longer parse an assignment
|
183
|
+
// TOFIX: can probably get the regex out somehow...
|
184
|
+
if (!first) {
|
185
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
186
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value))) match = this.failsafe('ExpectedAnotherExpressionComma', match);
|
187
|
+
}
|
188
|
+
|
189
|
+
if (this.ast) { //#ifdef FULL_AST
|
190
|
+
++parsedExpressions;
|
191
|
+
|
192
|
+
var astack = stack;
|
193
|
+
stack = [];
|
194
|
+
stack.desc = 'expression';
|
195
|
+
stack.nextBlack = match.tokposb;
|
196
|
+
astack.push(stack);
|
197
|
+
} //#endif
|
198
|
+
|
199
|
+
// start of expression is given: match
|
200
|
+
// it should indeed be a properly allowed lhs
|
201
|
+
// first eat all unary operators
|
202
|
+
// they can be added to the stack, but we need to ensure they have indeed a valid operator
|
203
|
+
|
204
|
+
var parseAnotherExpression = true;
|
205
|
+
while (parseAnotherExpression) { // keep parsing lhs+operator as long as there is an operator after the lhs.
|
206
|
+
if (this.ast) { //#ifdef FULL_AST
|
207
|
+
var estack = stack;
|
208
|
+
stack = [];
|
209
|
+
stack.desc = 'sub-expression';
|
210
|
+
stack.nextBlack = match.tokposb;
|
211
|
+
estack.push(stack);
|
212
|
+
|
213
|
+
var news = 0; // encountered new operators waiting for parenthesis
|
214
|
+
} //#endif
|
215
|
+
|
216
|
+
// start checking lhs
|
217
|
+
// if lhs is identifier (new/call expression), allow to parse an assignment operator next
|
218
|
+
// otherwise keep eating unary expressions and then any "value"
|
219
|
+
// after that search for a binary operator. if we only ate a new/call expression then
|
220
|
+
// also allow to eat assignments. repeat for the rhs.
|
221
|
+
var parsedUnaryOperator = false;
|
222
|
+
var isUnary = null;
|
223
|
+
while (
|
224
|
+
!isBreakOrContinueArg && // no unary for break/continue
|
225
|
+
(isUnary =
|
226
|
+
(match.value && this.hashUnaryKeywordStart[match.value[0]] && this.regexUnaryKeywords.test(match.value)) || // (match.value == 'delete' || match.value == 'void' || match.value == 'typeof' || match.value == 'new') ||
|
227
|
+
(match.name == 11/*PUNCTUATOR*/ && this.regexUnaryOperators.test(match.value))
|
228
|
+
)
|
229
|
+
) {
|
230
|
+
if (isUnary) match.isUnaryOp = true;
|
231
|
+
if (this.ast) { //#ifdef FULL_AST
|
232
|
+
// find parenthesis
|
233
|
+
if (match.value == 'new') ++news;
|
234
|
+
} //#endif
|
235
|
+
|
236
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
237
|
+
// ensure that it is in fact a valid lhs-start
|
238
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value))) match = this.failsafe('ExpectedAnotherExpressionRhs', match);
|
239
|
+
// not allowed to parse assignment
|
240
|
+
parsedUnaryOperator = true;
|
241
|
+
};
|
242
|
+
|
243
|
+
// if we parsed any kind of unary operator, we cannot be parsing a labeled statement
|
244
|
+
if (parsedUnaryOperator) mayParseLabeledStatementInstead = false;
|
245
|
+
|
246
|
+
// so now we know match is a valid lhs-start and not a unary operator
|
247
|
+
// it must be a string, number, regex, identifier
|
248
|
+
// or the start of an object literal ({), array literal ([) or group operator (().
|
249
|
+
|
250
|
+
var acceptAssignment = false;
|
251
|
+
|
252
|
+
// take care of the "open" cases first (group, array, object)
|
253
|
+
if (match.value == '(') {
|
254
|
+
if (this.ast) { //#ifdef FULL_AST
|
255
|
+
var groupStack = stack;
|
256
|
+
stack = [];
|
257
|
+
stack.desc = 'grouped';
|
258
|
+
stack.nextBlack = match.tokposb;
|
259
|
+
groupStack.push(stack);
|
260
|
+
|
261
|
+
var lhp = match;
|
262
|
+
|
263
|
+
match.isGroupStart = true;
|
264
|
+
} //#endif
|
265
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
266
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value))) match = this.failsafe('GroupingShouldStartWithExpression', match);
|
267
|
+
// keep parsing expressions as long as they are followed by a comma
|
268
|
+
match = this.eatExpressions(false, match, stack);
|
269
|
+
|
270
|
+
if (match.value != ')') match = this.failsafe('UnclosedGroupingOperator', match);
|
271
|
+
if (this.ast) { //#ifdef FULL_AST
|
272
|
+
match.twin = lhp;
|
273
|
+
lhp.twin = match;
|
274
|
+
|
275
|
+
match.isGroupStop = true;
|
276
|
+
|
277
|
+
if (stack[stack.length-1].desc == 'expressions') {
|
278
|
+
// create ref to this expression group to the opening paren
|
279
|
+
lhp.expressionArg = stack[stack.length-1];
|
280
|
+
}
|
281
|
+
} //#endif
|
282
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(true, match, stack); // might be div
|
283
|
+
|
284
|
+
if (this.ast) { //#ifdef FULL_AST
|
285
|
+
stack = groupStack;
|
286
|
+
} //#endif
|
287
|
+
// you can assign to group results. and as long as the group does not contain a comma (and valid ref), it will work too :)
|
288
|
+
acceptAssignment = true;
|
289
|
+
// there's an extra rule for [ namely that, it must start with an expression but after that, expressions are optional
|
290
|
+
} else if (match.value == '[') {
|
291
|
+
if (this.ast) { //#ifdef FULL_AST
|
292
|
+
stack.sub = 'array literal';
|
293
|
+
stack.hasArrayLiteral = true;
|
294
|
+
var lhsb = match;
|
295
|
+
|
296
|
+
match.isArrayLiteralStart = true;
|
297
|
+
|
298
|
+
if (!this.scope.arrays) this.scope.arrays = [];
|
299
|
+
match.arrayId = this.scope.arrays.length;
|
300
|
+
this.scope.arrays.push(match);
|
301
|
+
|
302
|
+
match.targetScope = this.scope;
|
303
|
+
} //#endif
|
304
|
+
// keep parsing expressions as long as they are followed by a comma
|
305
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
306
|
+
|
307
|
+
// arrays may start with "elided" commas
|
308
|
+
while (match.value == ',') match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
309
|
+
|
310
|
+
var foundAtLeastOneComma = true; // for entry in while
|
311
|
+
while (foundAtLeastOneComma && match.value != ']') {
|
312
|
+
foundAtLeastOneComma = false;
|
313
|
+
|
314
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value)) && match.name != 14/*error*/) match = this.failsafe('ArrayShouldStartWithExpression', match);
|
315
|
+
match = this.eatExpressions(false, match, stack, true);
|
316
|
+
|
317
|
+
while (match.value == ',') {
|
318
|
+
foundAtLeastOneComma = true;
|
319
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
320
|
+
}
|
321
|
+
}
|
322
|
+
if (match.value != ']') {
|
323
|
+
match = this.failsafe('UnclosedPropertyBracket', match);
|
324
|
+
}
|
325
|
+
if (this.ast) { //#ifdef FULL_AST
|
326
|
+
match.twin = lhsb;
|
327
|
+
lhsb.twin = match;
|
328
|
+
|
329
|
+
match.isArrayLiteralStop = true;
|
330
|
+
} //#endif
|
331
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(true, match, stack); // might be div
|
332
|
+
while (match.value == '++' || match.value == '--') {
|
333
|
+
// gobble and ignore?
|
334
|
+
this.failignore('InvalidPostfixOperandArray', match, stack);
|
335
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
336
|
+
}
|
337
|
+
// object literals need seperate handling...
|
338
|
+
} else if (match.value == '{') {
|
339
|
+
if (this.ast) { //#ifdef FULL_AST
|
340
|
+
stack.sub = 'object literal';
|
341
|
+
stack.hasObjectLiteral = true;
|
342
|
+
|
343
|
+
match.isObjectLiteralStart = true;
|
344
|
+
|
345
|
+
if (!this.scope.objects) this.scope.objects = [];
|
346
|
+
match.objectId = this.scope.objects.length;
|
347
|
+
this.scope.objects.push(match);
|
348
|
+
|
349
|
+
var targetObject = match;
|
350
|
+
match.targetScope = this.scope;
|
351
|
+
|
352
|
+
var lhc = match;
|
353
|
+
} //#endif
|
354
|
+
|
355
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
356
|
+
if (match.name == 12/*eof*/) {
|
357
|
+
match = this.failsafe('ObjectLiteralExpectsColonAfterName', match);
|
358
|
+
}
|
359
|
+
// ObjectLiteral
|
360
|
+
// PropertyNameAndValueList
|
361
|
+
|
362
|
+
while (match.value != '}' && match.name != 14/*error*/) { // will stop if next token is } or throw if not and no comma is found
|
363
|
+
// expecting a string, number, or identifier
|
364
|
+
//if (match.name != 5/*STRING_SINGLE*/ && match.name != 6/*STRING_DOUBLE*/ && match.name != 3/*NUMERIC_HEX*/ && match.name != 4/*NUMERIC_DEC*/ && match.name != 2/*IDENTIFIER*/) {
|
365
|
+
// TOFIX: more specific errors depending on type...
|
366
|
+
if (!match.isNumber && !match.isString && match.name != 2/*IDENTIFIER*/) {
|
367
|
+
match = this.failsafe('IllegalPropertyNameToken', match);
|
368
|
+
}
|
369
|
+
|
370
|
+
if (this.ast) { //#ifdef FULL_AST
|
371
|
+
var objLitStack = stack;
|
372
|
+
stack = [];
|
373
|
+
stack.desc = 'objlit pair';
|
374
|
+
stack.isObjectLiteralPair = true;
|
375
|
+
stack.nextBlack = match.tokposb;
|
376
|
+
objLitStack.push(stack);
|
377
|
+
|
378
|
+
var propNameStack = stack;
|
379
|
+
stack = [];
|
380
|
+
stack.desc = 'objlit pair name';
|
381
|
+
stack.nextBlack = match.tokposb;
|
382
|
+
propNameStack.push(stack);
|
383
|
+
|
384
|
+
propNameStack.sub = 'data';
|
385
|
+
|
386
|
+
var propName = match;
|
387
|
+
propName.isPropertyName = true;
|
388
|
+
} //#endif
|
389
|
+
|
390
|
+
var getset = match.value;
|
391
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
392
|
+
if (this.ast) { //#ifdef FULL_AST
|
393
|
+
stack = propNameStack;
|
394
|
+
} //#endif
|
395
|
+
|
396
|
+
// for get/set we parse a function-like definition. but only if it's immediately followed by an identifier (otherwise it'll just be the property 'get' or 'set')
|
397
|
+
if (getset == 'get') {
|
398
|
+
// "get" PropertyName "(" ")" "{" FunctionBody "}"
|
399
|
+
if (match.value == ':') {
|
400
|
+
if (this.ast) { //#ifdef FULL_AST
|
401
|
+
propName.isPropertyOf = targetObject;
|
402
|
+
} //#endif
|
403
|
+
match = this.eatObjectLiteralColonAndBody(match, stack);
|
404
|
+
} else {
|
405
|
+
if (this.ast) { //#ifdef FULL_AST
|
406
|
+
match.isPropertyOf = targetObject;
|
407
|
+
propNameStack.sub = 'getter';
|
408
|
+
propNameStack.isAccessor = true;
|
409
|
+
} //#endif
|
410
|
+
// if (match.name != 2/*IDENTIFIER*/ && match.name != 5/*STRING_SINGLE*/ && match.name != 6/*STRING_DOUBLE*/ && match.name != 3/*NUMERIC_HEX*/ && match.name != 4/*NUMERIC_DEC*/) {
|
411
|
+
if (!match.isNumber && !match.isString && match.name != 2/*IDENTIFIER*/) match = this.failsafe('IllegalGetterSetterNameToken', match, true);
|
412
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
413
|
+
if (match.value != '(') match = this.failsafe('GetterSetterNameFollowedByOpenParen', match);
|
414
|
+
if (this.ast) { //#ifdef FULL_AST
|
415
|
+
var lhp = match;
|
416
|
+
} //#endif
|
417
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
418
|
+
if (match.value != ')') match = this.failsafe('GetterHasNoArguments', match);
|
419
|
+
if (this.ast) { //#ifdef FULL_AST
|
420
|
+
match.twin = lhp;
|
421
|
+
lhp.twin = match;
|
422
|
+
} //#endif
|
423
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
424
|
+
match = this.eatFunctionBody(match, stack);
|
425
|
+
}
|
426
|
+
} else if (getset == 'set') {
|
427
|
+
// "set" PropertyName "(" PropertySetParameterList ")" "{" FunctionBody "}"
|
428
|
+
if (match.value == ':') {
|
429
|
+
if (this.ast) { //#ifdef FULL_AST
|
430
|
+
propName.isPropertyOf = targetObject;
|
431
|
+
} //#endif
|
432
|
+
match = this.eatObjectLiteralColonAndBody(match, stack);
|
433
|
+
} else {
|
434
|
+
if (this.ast) { //#ifdef FULL_AST
|
435
|
+
match.isPropertyOf = targetObject;
|
436
|
+
propNameStack.sub = 'setter';
|
437
|
+
propNameStack.isAccessor = true;
|
438
|
+
} //#endif
|
439
|
+
if (!match.isNumber && !match.isString && match.name != 2/*IDENTIFIER*/) match = this.failsafe('IllegalGetterSetterNameToken', match);
|
440
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
441
|
+
if (match.value != '(') match = this.failsafe('GetterSetterNameFollowedByOpenParen', match);
|
442
|
+
if (this.ast) { //#ifdef FULL_AST
|
443
|
+
var lhp = match;
|
444
|
+
} //#endif
|
445
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
446
|
+
if (match.name != 2/*IDENTIFIER*/) {
|
447
|
+
if (match.value == ')') match = this.failsafe('SettersMustHaveArgument', match);
|
448
|
+
else match = this.failsafe('IllegalSetterArgumentNameToken', match);
|
449
|
+
}
|
450
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
451
|
+
if (match.value != ')') {
|
452
|
+
if (match.value == ',') match = this.failsafe('SettersOnlyGetOneArgument', match);
|
453
|
+
else match = this.failsafe('SetterHeaderShouldHaveClosingParen', match);
|
454
|
+
}
|
455
|
+
if (this.ast) { //#ifdef FULL_AST
|
456
|
+
match.twin = lhp;
|
457
|
+
lhp.twin = match;
|
458
|
+
} //#endif
|
459
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
460
|
+
match = this.eatFunctionBody(match, stack);
|
461
|
+
}
|
462
|
+
} else {
|
463
|
+
// PropertyName ":" AssignmentExpression
|
464
|
+
if (this.ast) { //#ifdef FULL_AST
|
465
|
+
propName.isPropertyOf = targetObject;
|
466
|
+
} //#endif
|
467
|
+
match = this.eatObjectLiteralColonAndBody(match, stack);
|
468
|
+
}
|
469
|
+
|
470
|
+
if (this.ast) { //#ifdef FULL_AST
|
471
|
+
stack = objLitStack;
|
472
|
+
} //#endif
|
473
|
+
|
474
|
+
// one trailing comma allowed
|
475
|
+
if (match.value == ',') {
|
476
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
477
|
+
if (match.value == ',') match = this.failsafe('IllegalDoubleCommaInObjectLiteral', match);
|
478
|
+
} else if (match.value != '}') match = this.failsafe('UnclosedObjectLiteral', match);
|
479
|
+
|
480
|
+
// either the next token is } and the loop breaks or
|
481
|
+
// the next token is the start of the next PropertyAssignment...
|
482
|
+
}
|
483
|
+
// closing curly
|
484
|
+
if (this.ast) { //#ifdef FULL_AST
|
485
|
+
match.twin = lhc;
|
486
|
+
lhc.twin = match;
|
487
|
+
|
488
|
+
match.isObjectLiteralStop = true;
|
489
|
+
} //#endif
|
490
|
+
|
491
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(true, match, stack); // next may be div
|
492
|
+
while (match.value == '++' || match.value == '--') {
|
493
|
+
this.failignore('InvalidPostfixOperandObject', match, stack);
|
494
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
495
|
+
}
|
496
|
+
} else if (match.value == 'function') { // function expression
|
497
|
+
if (this.ast) { //#ifdef FULL_AST
|
498
|
+
var oldstack = stack;
|
499
|
+
stack = [];
|
500
|
+
stack.desc = 'func expr';
|
501
|
+
stack.isFunction = true;
|
502
|
+
stack.nextBlack = match.tokposb;
|
503
|
+
if (!this.scope.functions) this.scope.functions = [];
|
504
|
+
match.functionId = this.scope.functions.length;
|
505
|
+
this.scope.functions.push(match);
|
506
|
+
oldstack.push(stack);
|
507
|
+
var oldscope = this.scope;
|
508
|
+
// add new scope
|
509
|
+
match.scope = stack.scope = this.scope = [
|
510
|
+
this.scope,
|
511
|
+
{value:'this', isDeclared:true, isEcma:true, functionStack: stack},
|
512
|
+
{value:'arguments', isDeclared:true, isEcma:true, varType:['Object']}
|
513
|
+
]; // add the current scope (to build chain up-down)
|
514
|
+
this.scope.upper = oldscope;
|
515
|
+
// ref to back to function that's the cause for this scope
|
516
|
+
this.scope.scopeFor = match;
|
517
|
+
match.targetScope = oldscope; // consistency
|
518
|
+
match.isFuncExprKeyword = true;
|
519
|
+
match.functionStack = stack;
|
520
|
+
} //#endif
|
521
|
+
var funcExprToken = match;
|
522
|
+
|
523
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
524
|
+
if (mayParseLabeledStatementInstead && match.value == ':') match = this.failsafe('LabelsMayNotBeReserved', match);
|
525
|
+
if (match.name == 2/*IDENTIFIER*/) {
|
526
|
+
funcExprToken.funcName = match;
|
527
|
+
match.meta = "func expr name";
|
528
|
+
match.varType = ['Function'];
|
529
|
+
match.functionStack = stack; // ref to the stack, in case we detect the var being a constructor
|
530
|
+
if (this.ast) { //#ifdef FULL_AST
|
531
|
+
// name is only available to inner scope
|
532
|
+
this.scope.push({value:match.value});
|
533
|
+
} //#endif
|
534
|
+
if (this.hashStartKeyOrReserved[match.value[0]] /*this.regexStartKeyOrReserved.test(match.value[0])*/ && this.regexIsKeywordOrReserved.test(match.value)) match = this.failsafe('FunctionNameMustNotBeReserved', match);
|
535
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
536
|
+
}
|
537
|
+
match = this.eatFunctionParametersAndBody(match, stack, true, funcExprToken); // first token after func-expr is div
|
538
|
+
|
539
|
+
while (match.value == '++' || match.value == '--') {
|
540
|
+
this.failignore('InvalidPostfixOperandFunction', match, stack);
|
541
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
542
|
+
}
|
543
|
+
|
544
|
+
if (this.ast) { //#ifdef FULL_AST
|
545
|
+
// restore stack and scope
|
546
|
+
stack = oldstack;
|
547
|
+
this.scope = oldscope;
|
548
|
+
} //#endif
|
549
|
+
} else if (match.name <= 6) { // IDENTIFIER STRING_SINGLE STRING_DOUBLE NUMERIC_HEX NUMERIC_DEC REG_EX
|
550
|
+
// save it in case it turns out to be a label.
|
551
|
+
var possibleLabel = match;
|
552
|
+
|
553
|
+
// validate the identifier, if any
|
554
|
+
if (match.name == 2/*IDENTIFIER*/) {
|
555
|
+
if (
|
556
|
+
// this, null, true, false are actually allowed here
|
557
|
+
!this.regexLiteralKeywords.test(match.value) &&
|
558
|
+
// other reserved words are not
|
559
|
+
this.hashStartKeyOrReserved[match.value[0]] /*this.regexStartKeyOrReserved.test(match.value[0])*/ && this.regexIsKeywordOrReserved.test(match.value)
|
560
|
+
) {
|
561
|
+
// if break/continue, we skipped the unary operator check so throw the proper error here
|
562
|
+
if (isBreakOrContinueArg) {
|
563
|
+
this.failignore('BreakOrContinueArgMustBeJustIdentifier', match, stack);
|
564
|
+
} else if (match.value == 'else') {
|
565
|
+
this.failignore('DidNotExpectElseHere', match, stack);
|
566
|
+
} else {
|
567
|
+
//if (mayParseLabeledStatementInstead) {new ZeParser.Error('LabelsMayNotBeReserved', match);
|
568
|
+
// TOFIX: lookahead to see if colon is following. throw label error instead if that's the case
|
569
|
+
// any forbidden keyword at this point is likely to be a statement start.
|
570
|
+
// its likely that the parser will take a while to recover from this point...
|
571
|
+
this.failignore('UnexpectedToken', match, stack);
|
572
|
+
// TOFIX: maybe i should just return at this point. cut my losses and hope for the best.
|
573
|
+
}
|
574
|
+
}
|
575
|
+
|
576
|
+
// only accept assignments after a member expression (identifier or ending with a [] suffix)
|
577
|
+
acceptAssignment = true;
|
578
|
+
} else if (isBreakOrContinueArg) match = this.failsafe('BreakOrContinueArgMustBeJustIdentifier', match);
|
579
|
+
|
580
|
+
// the current match is the lead value being queried. tag it that way
|
581
|
+
if (this.ast) { //#ifdef FULL_AST
|
582
|
+
// dont mark labels
|
583
|
+
if (!isBreakOrContinueArg) {
|
584
|
+
match.meta = 'lead value';
|
585
|
+
match.leadValue = true;
|
586
|
+
}
|
587
|
+
} //#endif
|
588
|
+
|
589
|
+
|
590
|
+
// ok. gobble it.
|
591
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(true, match, stack); // division allowed
|
592
|
+
|
593
|
+
// now check for labeled statement (if mayParseLabeledStatementInstead then the first token for this expression must be an (unreserved) identifier)
|
594
|
+
if (mayParseLabeledStatementInstead && match.value == ':') {
|
595
|
+
if (possibleLabel.name != 2/*IDENTIFIER*/) {
|
596
|
+
// label was not an identifier
|
597
|
+
// TOFIX: this colon might be a different type of error... more analysis required
|
598
|
+
this.failignore('LabelsMayOnlyBeIdentifiers', match, stack);
|
599
|
+
}
|
600
|
+
|
601
|
+
mayParseLabeledStatementInstead = true; // mark label parsed (TOFIX:speed?)
|
602
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
603
|
+
|
604
|
+
possibleLabel.isLabel = true;
|
605
|
+
if (this.ast) { //#ifdef FULL_AST
|
606
|
+
delete possibleLabel.meta; // oh oops, it's not a lead value.
|
607
|
+
|
608
|
+
possibleLabel.isLabelDeclaration = true;
|
609
|
+
this.statementLabels.push(possibleLabel.value);
|
610
|
+
|
611
|
+
stack.desc = 'labeled statement';
|
612
|
+
} //#endif
|
613
|
+
|
614
|
+
var errorIdToReplace = this.errorStack.length;
|
615
|
+
// eat another statement now, its the body of the labeled statement (like if and while)
|
616
|
+
match = this.eatStatement(false, match, stack);
|
617
|
+
|
618
|
+
// if no statement was found, check here now and correct error
|
619
|
+
if (match.error && match.error.msg == ZeParser.Errors.UnableToParseStatement.msg) {
|
620
|
+
// replace with better error...
|
621
|
+
match.error = new ZeParser.Error('LabelRequiresStatement');
|
622
|
+
// also replace on stack
|
623
|
+
this.errorStack[errorIdToReplace] = match.error;
|
624
|
+
}
|
625
|
+
|
626
|
+
match.wasLabel = true;
|
627
|
+
|
628
|
+
return match;
|
629
|
+
}
|
630
|
+
|
631
|
+
mayParseLabeledStatementInstead = false;
|
632
|
+
} else if (match.value == '}') {
|
633
|
+
// ignore... its certainly the end of this expression, but maybe asi can be applied...
|
634
|
+
// it might also be an object literal expecting more, but that case has been covered else where.
|
635
|
+
// if it turns out the } is bad after all, .parse() will try to recover
|
636
|
+
} else if (match.name == 14/*error*/) {
|
637
|
+
do {
|
638
|
+
if (match.tokenError) {
|
639
|
+
var pe = new ZeParser.Error('TokenizerError', match);
|
640
|
+
pe.msg += ': '+match.error.msg;
|
641
|
+
this.errorStack.push(pe);
|
642
|
+
|
643
|
+
this.failSpecial({start:match.start,stop:match.start,name:14/*error*/,error:pe}, match, stack)
|
644
|
+
}
|
645
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
646
|
+
} while (match.name == 14/*error*/);
|
647
|
+
} else if (match.name == 12/*eof*/) {
|
648
|
+
// cant parse any further. you're probably just typing...
|
649
|
+
return match;
|
650
|
+
} else {
|
651
|
+
//if (!this.errorStack.length && match.name != 12/*eof*/) console.log(["unknown token", match, stack, Gui.escape(this.input)]);
|
652
|
+
this.failignore('UnknownToken', match, stack);
|
653
|
+
// we cant really ignore this. eat the token and try again. possibly you're just typing?
|
654
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
655
|
+
}
|
656
|
+
|
657
|
+
// search for "value" suffix. property access and call parens.
|
658
|
+
while (match.value == '.' || match.value == '[' || match.value == '(') {
|
659
|
+
if (isBreakOrContinueArg) match = this.failsafe('BreakOrContinueArgMustBeJustIdentifier', match);
|
660
|
+
|
661
|
+
if (match.value == '.') {
|
662
|
+
// property access. read in an IdentifierName (no keyword checks). allow assignments
|
663
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
664
|
+
if (match.name != 2/*IDENTIFIER*/) this.failignore('PropertyNamesMayOnlyBeIdentifiers', match, stack);
|
665
|
+
if (this.ast) { //#ifdef FULL_AST
|
666
|
+
match.isPropertyName = true;
|
667
|
+
} //#endif
|
668
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(true, match, stack); // may parse div
|
669
|
+
acceptAssignment = true;
|
670
|
+
} else if (match.value == '[') {
|
671
|
+
if (this.ast) { //#ifdef FULL_AST
|
672
|
+
var lhsb = match;
|
673
|
+
match.propertyAccessStart = true;
|
674
|
+
} //#endif
|
675
|
+
// property access, read expression list. allow assignments
|
676
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
677
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value))) {
|
678
|
+
if (match.value == ']') match = this.failsafe('SquareBracketsMayNotBeEmpty', match);
|
679
|
+
else match = this.failsafe('SquareBracketExpectsExpression', match);
|
680
|
+
}
|
681
|
+
match = this.eatExpressions(false, match, stack);
|
682
|
+
if (match.value != ']') match = this.failsafe('UnclosedSquareBrackets', match);
|
683
|
+
if (this.ast) { //#ifdef FULL_AST
|
684
|
+
match.twin = lhsb;
|
685
|
+
match.propertyAccessStop = true;
|
686
|
+
lhsb.twin = match;
|
687
|
+
|
688
|
+
if (stack[stack.length-1].desc == 'expressions') {
|
689
|
+
// create ref to this expression group to the opening bracket
|
690
|
+
lhsb.expressionArg = stack[stack.length-1];
|
691
|
+
}
|
692
|
+
} //#endif
|
693
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(true, match, stack); // might be div
|
694
|
+
acceptAssignment = true;
|
695
|
+
} else if (match.value == '(') {
|
696
|
+
if (this.ast) { //#ifdef FULL_AST
|
697
|
+
var lhp = match;
|
698
|
+
match.isCallExpressionStart = true;
|
699
|
+
if (news) {
|
700
|
+
match.parensBelongToNew = true;
|
701
|
+
--news;
|
702
|
+
}
|
703
|
+
} //#endif
|
704
|
+
// call expression, eat optional expression list, disallow assignments
|
705
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
706
|
+
if (/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value)) match = this.eatExpressions(false, match, stack); // arguments are optional
|
707
|
+
if (match.value != ')') match = this.failsafe('UnclosedCallParens', match);
|
708
|
+
if (this.ast) { //#ifdef FULL_AST
|
709
|
+
match.twin = lhp;
|
710
|
+
lhp.twin = match;
|
711
|
+
match.isCallExpressionStop = true;
|
712
|
+
|
713
|
+
if (stack[stack.length-1].desc == 'expressions') {
|
714
|
+
// create ref to this expression group to the opening bracket
|
715
|
+
lhp.expressionArg = stack[stack.length-1];
|
716
|
+
}
|
717
|
+
} //#endif
|
718
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(true, match, stack); // might be div
|
719
|
+
acceptAssignment = false;
|
720
|
+
}
|
721
|
+
}
|
722
|
+
|
723
|
+
// check for postfix operators ++ and --
|
724
|
+
// they are stronger than the + or - binary operators
|
725
|
+
// they can be applied to any lhs (even when it wouldnt make sense)
|
726
|
+
// if there was a newline, it should get an ASI
|
727
|
+
if ((match.value == '++' || match.value == '--') && !match.newline) {
|
728
|
+
if (isBreakOrContinueArg) match = this.failsafe('BreakOrContinueArgMustBeJustIdentifier', match);
|
729
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(true, match, stack); // may parse div
|
730
|
+
}
|
731
|
+
|
732
|
+
if (this.ast) { //#ifdef FULL_AST
|
733
|
+
// restore "expression" stack
|
734
|
+
stack = estack;
|
735
|
+
} //#endif
|
736
|
+
// now see if there is an operator following...
|
737
|
+
|
738
|
+
do { // this do allows us to parse multiple ternary expressions in succession without screwing up.
|
739
|
+
var ternary = false;
|
740
|
+
if (
|
741
|
+
(!forHeader && match.value == 'in') || // one of two named binary operators, may not be first expression in for-header (when semi's occur in the for-header)
|
742
|
+
(match.value == 'instanceof') || // only other named binary operator
|
743
|
+
((match.name == 11/*PUNCTUATOR*/) && // we can only expect a punctuator now
|
744
|
+
(match.isAssignment = this.regexAssignments.test(match.value)) || // assignments are only okay with proper lhs
|
745
|
+
this.regexNonAssignmentBinaryExpressionOperators.test(match.value) // test all other binary operators
|
746
|
+
)
|
747
|
+
) {
|
748
|
+
if (match.isAssignment) {
|
749
|
+
if (!acceptAssignment) this.failignore('IllegalLhsForAssignment', match, stack);
|
750
|
+
else if (parsedNonAssignmentOperator) this.failignore('AssignmentNotAllowedAfterNonAssignmentInExpression', match, stack);
|
751
|
+
}
|
752
|
+
if (isBreakOrContinueArg) match = this.failsafe('BreakOrContinueArgMustBeJustIdentifier', match);
|
753
|
+
|
754
|
+
if (!match.isAssignment) parsedNonAssignmentOperator = true; // last allowed assignment
|
755
|
+
if (this.ast) { //#ifdef FULL_AST
|
756
|
+
match.isBinaryOperator = true;
|
757
|
+
// we build a stack to ensure any whitespace doesnt break the 1+(n*2) children rule for expressions
|
758
|
+
var ostack = stack;
|
759
|
+
stack = [];
|
760
|
+
stack.desc = 'operator-expression';
|
761
|
+
stack.isBinaryOperator = true;
|
762
|
+
stack.sub = match.value;
|
763
|
+
stack.nextBlack = match.tokposb;
|
764
|
+
ostack.sub = match.value;
|
765
|
+
stack.isAssignment = match.isAssignment;
|
766
|
+
ostack.push(stack);
|
767
|
+
} //#endif
|
768
|
+
ternary = match.value == '?';
|
769
|
+
// math, logic, assignment or in or instanceof
|
770
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
771
|
+
|
772
|
+
if (this.ast) { //#ifdef FULL_AST
|
773
|
+
// restore "expression" stack
|
774
|
+
stack = ostack;
|
775
|
+
} //#endif
|
776
|
+
|
777
|
+
// minor exception to ternary operator, we need to parse two expressions nao. leave the trailing expression to the loop.
|
778
|
+
if (ternary) {
|
779
|
+
// LogicalORExpression "?" AssignmentExpression ":" AssignmentExpression
|
780
|
+
// so that means just one expression center and right.
|
781
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value))) this.failignore('InvalidCenterTernaryExpression', match, stack);
|
782
|
+
match = this.eatExpressions(false, match, stack, true, forHeader); // only one expression allowed inside ternary center/right
|
783
|
+
|
784
|
+
if (match.value != ':') {
|
785
|
+
if (match.value == ',') match = this.failsafe('TernarySecondExpressionCanNotContainComma', match);
|
786
|
+
else match = this.failsafe('UnfinishedTernaryOperator', match);
|
787
|
+
}
|
788
|
+
if (this.ast) { //#ifdef FULL_AST
|
789
|
+
// we build a stack to ensure any whitespace doesnt break the 1+(n*2) children rule for expressions
|
790
|
+
var ostack = stack;
|
791
|
+
stack = [];
|
792
|
+
stack.desc = 'operator-expression';
|
793
|
+
stack.sub = match.value;
|
794
|
+
stack.nextBlack = match.tokposb;
|
795
|
+
ostack.sub = match.value;
|
796
|
+
stack.isAssignment = match.isAssignment;
|
797
|
+
ostack.push(stack);
|
798
|
+
} //#endif
|
799
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
800
|
+
if (this.ast) { //#ifdef FULL_AST
|
801
|
+
stack = ostack;
|
802
|
+
} //#endif
|
803
|
+
// rhs of the ternary can not contain a comma either
|
804
|
+
match = this.eatExpressions(false, match, stack, true, forHeader); // only one expression allowed inside ternary center/right
|
805
|
+
}
|
806
|
+
} else {
|
807
|
+
parseAnotherExpression = false;
|
808
|
+
}
|
809
|
+
} while (ternary); // if we just parsed a ternary expression, we need to check _again_ whether the next token is a binary operator.
|
810
|
+
|
811
|
+
// start over. match is the rhs for the lhs we just parsed, but lhs for the next expression
|
812
|
+
if (parseAnotherExpression && !(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value))) {
|
813
|
+
// no idea what to do now. lets just ignore and see where it ends. TOFIX: maybe just break the loop or return?
|
814
|
+
this.failignore('InvalidRhsExpression', match, stack);
|
815
|
+
}
|
816
|
+
}
|
817
|
+
|
818
|
+
if (this.ast) { //#ifdef FULL_AST
|
819
|
+
// restore "expressions" stack
|
820
|
+
stack = astack;
|
821
|
+
} //#endif
|
822
|
+
|
823
|
+
// at this point we should have parsed one AssignmentExpression
|
824
|
+
// lets see if we can parse another one...
|
825
|
+
mayParseLabeledStatementInstead = first = false;
|
826
|
+
} while (!onlyOne && match.value == ',');
|
827
|
+
|
828
|
+
if (this.ast) { //#ifdef FULL_AST
|
829
|
+
// remove empty array
|
830
|
+
if (!stack.length) pstack.length = pstack.length-1;
|
831
|
+
pstack.numberOfExpressions = parsedExpressions;
|
832
|
+
if (pstack[0]) pstack[0].numberOfExpressions = parsedExpressions;
|
833
|
+
stack.expressionCount = parsedExpressions;
|
834
|
+
} //#endif
|
835
|
+
return match;
|
836
|
+
},
|
837
|
+
eatFunctionDeclaration: function(match, stack){
|
838
|
+
if (this.ast) { //#ifdef FULL_AST
|
839
|
+
stack.push(stack = []);
|
840
|
+
var prevscope = this.scope;
|
841
|
+
stack.desc = 'func decl';
|
842
|
+
stack.isFunction = true;
|
843
|
+
stack.nextBlack = match.tokposb;
|
844
|
+
if (!this.scope.functions) this.scope.functions = [];
|
845
|
+
match.functionId = this.scope.functions.length;
|
846
|
+
this.scope.functions.push(match);
|
847
|
+
// add new scope
|
848
|
+
match.scope = stack.scope = this.scope = [
|
849
|
+
this.scope, // add current scope (build scope chain up-down)
|
850
|
+
// Object.create(null,
|
851
|
+
{value:'this', isDeclared:true, isEcma:true, functionStack:stack},
|
852
|
+
// Object.create(null,
|
853
|
+
{value:'arguments', isDeclared:true, isEcma:true, varType:['Object']}
|
854
|
+
];
|
855
|
+
// ref to back to function that's the cause for this scope
|
856
|
+
this.scope.scopeFor = match;
|
857
|
+
match.targetScope = prevscope; // consistency
|
858
|
+
|
859
|
+
match.functionStack = stack;
|
860
|
+
|
861
|
+
match.isFuncDeclKeyword = true;
|
862
|
+
} //#endif
|
863
|
+
// only place that this function is used already checks whether next token is function
|
864
|
+
var functionKeyword = match;
|
865
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
866
|
+
if (match.name != 2/*IDENTIFIER*/) match = this.failsafe('FunctionDeclarationsMustHaveName', match);
|
867
|
+
if (this.hashStartKeyOrReserved[match.value[0]] /*this.regexStartKeyOrReserved.test(match.value[0])*/ && this.regexIsKeywordOrReserved.test(match.value)) this.failignore('FunctionNameMayNotBeReserved', match, stack);
|
868
|
+
if (this.ast) { //#ifdef FULL_AST
|
869
|
+
functionKeyword.funcName = match;
|
870
|
+
prevscope.push({value:match.value});
|
871
|
+
match.meta = 'func decl name'; // that's what it is, really
|
872
|
+
match.varType = ['Function'];
|
873
|
+
match.functionStack = stack;
|
874
|
+
} //#endif
|
875
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
876
|
+
match = this.eatFunctionParametersAndBody(match, stack, false, functionKeyword); // first token after func-decl is regex
|
877
|
+
if (this.ast) { //#ifdef FULL_AST
|
878
|
+
// restore previous scope
|
879
|
+
this.scope = prevscope;
|
880
|
+
} //#endif
|
881
|
+
return match;
|
882
|
+
},
|
883
|
+
eatObjectLiteralColonAndBody: function(match, stack){
|
884
|
+
if (this.ast) { //#ifdef FULL_AST
|
885
|
+
var propValueStack = stack;
|
886
|
+
stack = [];
|
887
|
+
stack.desc = 'objlit pair colon';
|
888
|
+
stack.nextBlack = match.tokposb;
|
889
|
+
propValueStack.push(stack);
|
890
|
+
} //#endif
|
891
|
+
if (match.value != ':') match = this.failsafe('ObjectLiteralExpectsColonAfterName', match);
|
892
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
893
|
+
if (this.ast) { //#ifdef FULL_AST
|
894
|
+
stack = propValueStack;
|
895
|
+
} //#endif
|
896
|
+
|
897
|
+
// this might actually fail due to ASI optimization.
|
898
|
+
// if the property name does not exist and it is the last item
|
899
|
+
// of the objlit, the expression parser will see an unexpected
|
900
|
+
// } and ignore it, giving some leeway to apply ASI. of course,
|
901
|
+
// that doesnt work for objlits. but we dont want to break the
|
902
|
+
// existing mechanisms. so we check this differently... :)
|
903
|
+
var prevMatch = match;
|
904
|
+
match = this.eatExpressions(false, match, stack, true); // only one expression
|
905
|
+
if (match == prevMatch) match = this.failsafe('ObjectLiteralMissingPropertyValue', match);
|
906
|
+
|
907
|
+
return match;
|
908
|
+
},
|
909
|
+
eatFunctionParametersAndBody: function(match, stack, div, funcToken){
|
910
|
+
// div: the first token _after_ a function expression may be a division...
|
911
|
+
if (match.value != '(') match = this.failsafe('ExpectingFunctionHeaderStart', match);
|
912
|
+
else if (this.ast) { //#ifdef FULL_AST
|
913
|
+
var lhp = match;
|
914
|
+
funcToken.lhp = match;
|
915
|
+
} //#endif
|
916
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
917
|
+
if (match.name == 2/*IDENTIFIER*/) { // params
|
918
|
+
if (this.hashStartKeyOrReserved[match.value[0]] /*this.regexStartKeyOrReserved.test(match.value[0])*/ && this.regexIsKeywordOrReserved.test(match.value)) this.failignore('FunctionArgumentsCanNotBeReserved', match, stack);
|
919
|
+
if (this.ast) { //#ifdef FULL_AST
|
920
|
+
if (!funcToken.paramNames) funcToken.paramNames = [];
|
921
|
+
stack.paramNames = funcToken.paramNames;
|
922
|
+
funcToken.paramNames.push(match);
|
923
|
+
this.scope.push({value:match.value}); // add param name to scope
|
924
|
+
match.meta = 'parameter';
|
925
|
+
} //#endif
|
926
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
927
|
+
while (match.value == ',') {
|
928
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
929
|
+
if (match.name != 2/*IDENTIFIER*/) {
|
930
|
+
// example: if name is 12, the source is incomplete...
|
931
|
+
this.failignore('FunctionParametersMustBeIdentifiers', match, stack);
|
932
|
+
} else if (this.hashStartKeyOrReserved[match.value[0]] /*this.regexStartKeyOrReserved.test(match.value[0])*/ && this.regexIsKeywordOrReserved.test(match.value)) {
|
933
|
+
this.failignore('FunctionArgumentsCanNotBeReserved', match, stack);
|
934
|
+
}
|
935
|
+
if (this.ast) { //#ifdef FULL_AST
|
936
|
+
// Object.create(null,
|
937
|
+
this.scope.push({value:match.value}); // add param name to scope
|
938
|
+
match.meta = 'parameter';
|
939
|
+
if (match.name == 2/*IDENTIFIER*/) funcToken.paramNames.push(match);
|
940
|
+
} //#endif
|
941
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
942
|
+
}
|
943
|
+
}
|
944
|
+
if (this.ast) { //#ifdef FULL_AST
|
945
|
+
if (lhp) {
|
946
|
+
match.twin = lhp;
|
947
|
+
lhp.twin = match;
|
948
|
+
funcToken.rhp = match;
|
949
|
+
}
|
950
|
+
} //#endif
|
951
|
+
if (match.value != ')') match = this.failsafe('ExpectedFunctionHeaderClose', match); // TOFIX: can be various things here...
|
952
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
953
|
+
match = this.eatFunctionBody(match, stack, div, funcToken);
|
954
|
+
return match;
|
955
|
+
},
|
956
|
+
eatFunctionBody: function(match, stack, div, funcToken){
|
957
|
+
if (this.ast) { //#ifdef FULL_AST
|
958
|
+
stack.push(stack = []);
|
959
|
+
stack.desc = 'func body';
|
960
|
+
stack.nextBlack = match.tokposb;
|
961
|
+
|
962
|
+
// create EMPTY list of functions. labels cannot cross function boundaries
|
963
|
+
var labelBackup = this.statementLabels;
|
964
|
+
this.statementLabels = [];
|
965
|
+
stack.labels = this.statementLabels;
|
966
|
+
} //#endif
|
967
|
+
|
968
|
+
// if div, a division can occur _after_ this function expression
|
969
|
+
//this.stats.eatFunctionBody = (+//this.stats.eatFunctionBody||0)+1;
|
970
|
+
if (match.value != '{') match = this.failsafe('ExpectedFunctionBodyCurlyOpen', match);
|
971
|
+
if (this.ast) { //#ifdef FULL_AST
|
972
|
+
var lhc = match;
|
973
|
+
if (funcToken) funcToken.lhc = lhc;
|
974
|
+
} //#endif
|
975
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
976
|
+
match = this.eatSourceElements(match, stack);
|
977
|
+
if (match.value != '}') match = this.failsafe('ExpectedFunctionBodyCurlyClose', match);
|
978
|
+
if (this.ast) { //#ifdef FULL_AST
|
979
|
+
match.twin = lhc;
|
980
|
+
lhc.twin = match;
|
981
|
+
if (funcToken) funcToken.rhc = match;
|
982
|
+
} //#endif
|
983
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(div, match, stack);
|
984
|
+
|
985
|
+
if (this.ast) { //#ifdef FULL_AST
|
986
|
+
// restore label set
|
987
|
+
this.statementLabels = labelBackup;
|
988
|
+
} //#endif
|
989
|
+
|
990
|
+
return match;
|
991
|
+
},
|
992
|
+
eatVar: function(match, stack){
|
993
|
+
if (this.ast) { //#ifdef FULL_AST
|
994
|
+
stack.push(stack = []);
|
995
|
+
stack.desc = 'statement';
|
996
|
+
stack.sub = 'var';
|
997
|
+
stack.nextBlack = match.tokposb;
|
998
|
+
match.stack = stack;
|
999
|
+
match.isVarKeyword = true;
|
1000
|
+
} //#endif
|
1001
|
+
match = this.eatVarDecl(match, stack);
|
1002
|
+
match = this.eatSemiColon(match, stack);
|
1003
|
+
|
1004
|
+
return match;
|
1005
|
+
},
|
1006
|
+
eatVarDecl: function(match, stack, forHeader){
|
1007
|
+
// assumes match is indeed the identifier 'var'
|
1008
|
+
if (this.ast) { //#ifdef FULL_AST
|
1009
|
+
stack.push(stack = []);
|
1010
|
+
stack.desc = 'var decl';
|
1011
|
+
stack.nextBlack = match.tokposb;
|
1012
|
+
|
1013
|
+
var targetScope = this.scope;
|
1014
|
+
while (targetScope.catchScope) targetScope = targetScope[0];
|
1015
|
+
} //#endif
|
1016
|
+
var first = true;
|
1017
|
+
var varsDeclared = 0;
|
1018
|
+
do {
|
1019
|
+
++varsDeclared;
|
1020
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack); // start: var, iteration: comma
|
1021
|
+
if (this.ast) { //#ifdef FULL_AST
|
1022
|
+
var declStack = stack;
|
1023
|
+
var stack = [];
|
1024
|
+
stack.desc = 'single var decl';
|
1025
|
+
stack.varStack = declStack; // reference to the var statement stack, it might hook to jsdoc needed for these vars
|
1026
|
+
stack.nextBlack = match.tokposb;
|
1027
|
+
declStack.push(stack);
|
1028
|
+
|
1029
|
+
var singleDecStack = stack;
|
1030
|
+
stack = [];
|
1031
|
+
stack.desc = 'sub-expression';
|
1032
|
+
stack.nextBlack = match.tokposb;
|
1033
|
+
singleDecStack.push(stack);
|
1034
|
+
} //#endif
|
1035
|
+
|
1036
|
+
// next token should be a valid identifier
|
1037
|
+
if (match.name == 12/*eof*/) {
|
1038
|
+
if (first) match = this.failsafe('VarKeywordMissingName', match);
|
1039
|
+
// else, ignore. TOFIX: return?
|
1040
|
+
else match = this.failsafe('IllegalTrailingComma', match);
|
1041
|
+
} else if (match.name != 2/*IDENTIFIER*/) {
|
1042
|
+
match = this.failsafe('VarNamesMayOnlyBeIdentifiers', match);
|
1043
|
+
} else if (this.hashStartKeyOrReserved[match.value[0]] /*this.regexStartKeyOrReserved.test(match.value[0])*/ && this.regexIsKeywordOrReserved.test(match.value)) {
|
1044
|
+
match = this.failsafe('VarNamesCanNotBeReserved', match);
|
1045
|
+
}
|
1046
|
+
// mark the match as being a variable name. we need it for lookup later :)
|
1047
|
+
if (this.ast) { //#ifdef FULL_AST
|
1048
|
+
match.meta = 'var name';
|
1049
|
+
targetScope.push({value:match.value});
|
1050
|
+
} //#endif
|
1051
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1052
|
+
|
1053
|
+
if (this.ast) { //#ifdef FULL_AST
|
1054
|
+
stack = singleDecStack;
|
1055
|
+
} //#endif
|
1056
|
+
|
1057
|
+
// next token should either be a = , or ;
|
1058
|
+
// if = parse an expression and optionally a comma
|
1059
|
+
if (match.value == '=') {
|
1060
|
+
if (this.ast) { //#ifdef FULL_AST
|
1061
|
+
singleDecStack = stack;
|
1062
|
+
stack = [];
|
1063
|
+
stack.desc = 'operator-expression';
|
1064
|
+
stack.sub = '=';
|
1065
|
+
stack.nextBlack = match.tokposb;
|
1066
|
+
singleDecStack.push(stack);
|
1067
|
+
|
1068
|
+
stack.isAssignment = true;
|
1069
|
+
} //#endif
|
1070
|
+
match.isInitialiser = true;
|
1071
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1072
|
+
if (this.ast) { //#ifdef FULL_AST
|
1073
|
+
stack = singleDecStack;
|
1074
|
+
} //#endif
|
1075
|
+
|
1076
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || match.name == 14/*error*/ || this.regexLhsStart.test(match.value))) match = this.failsafe('VarInitialiserExpressionExpected', match);
|
1077
|
+
match = this.eatExpressions(false, match, stack, true, forHeader); // only one expression
|
1078
|
+
// var statement: comma or semi now
|
1079
|
+
// for statement: semi, comma or 'in'
|
1080
|
+
}
|
1081
|
+
if (this.ast) { //#ifdef FULL_AST
|
1082
|
+
stack = declStack;
|
1083
|
+
} //#endif
|
1084
|
+
|
1085
|
+
// determines proper error message in one case
|
1086
|
+
first = false;
|
1087
|
+
// keep parsing name(=expression) sequences as long as you see a comma here
|
1088
|
+
} while (match.value == ',');
|
1089
|
+
|
1090
|
+
if (this.ast) { //#ifdef FULL_AST
|
1091
|
+
stack.varsDeclared = varsDeclared;
|
1092
|
+
} //#endif
|
1093
|
+
|
1094
|
+
return match;
|
1095
|
+
},
|
1096
|
+
|
1097
|
+
eatIf: function(match, stack){
|
1098
|
+
if (this.ast) { //#ifdef FULL_AST
|
1099
|
+
stack.push(stack = []);
|
1100
|
+
stack.desc = 'statement';
|
1101
|
+
stack.sub = 'if';
|
1102
|
+
stack.hasElse = false;
|
1103
|
+
stack.nextBlack = match.tokposb;
|
1104
|
+
} //#endif
|
1105
|
+
// (
|
1106
|
+
// expression
|
1107
|
+
// )
|
1108
|
+
// statement
|
1109
|
+
// [else statement]
|
1110
|
+
var ifKeyword = match;
|
1111
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1112
|
+
if (match.value != '(') match = this.failsafe('ExpectedStatementHeaderOpen', match);
|
1113
|
+
if (this.ast) { //#ifdef FULL_AST
|
1114
|
+
var lhp = match;
|
1115
|
+
match.statementHeaderStart = true;
|
1116
|
+
} //#endif
|
1117
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1118
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value))) match = this.failsafe('StatementHeaderIsNotOptional', match);
|
1119
|
+
match = this.eatExpressions(false, match, stack);
|
1120
|
+
if (match.value != ')') match = this.failsafe('ExpectedStatementHeaderClose', match);
|
1121
|
+
if (this.ast) { //#ifdef FULL_AST
|
1122
|
+
match.twin = lhp;
|
1123
|
+
match.statementHeaderStop = true;
|
1124
|
+
lhp.twin = match;
|
1125
|
+
|
1126
|
+
if (stack[stack.length-1].desc == 'expressions') {
|
1127
|
+
// create ref to this expression group to the opening bracket
|
1128
|
+
lhp.expressionArg = stack[stack.length-1];
|
1129
|
+
}
|
1130
|
+
} //#endif
|
1131
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1132
|
+
match = this.eatStatement(false, match, stack);
|
1133
|
+
|
1134
|
+
// match might be null here... (if the if-statement was end part of the source)
|
1135
|
+
if (match && match.value == 'else') {
|
1136
|
+
if (this.ast) { //#ifdef FULL_AST
|
1137
|
+
ifKeyword.hasElse = match;
|
1138
|
+
} //#endif
|
1139
|
+
match = this.eatElse(match, stack);
|
1140
|
+
}
|
1141
|
+
|
1142
|
+
return match;
|
1143
|
+
},
|
1144
|
+
eatElse: function(match, stack){
|
1145
|
+
if (this.ast) { //#ifdef FULL_AST
|
1146
|
+
stack.hasElse = true;
|
1147
|
+
stack.push(stack = []);
|
1148
|
+
stack.desc = 'statement';
|
1149
|
+
stack.sub = 'else';
|
1150
|
+
stack.nextBlack = match.tokposb;
|
1151
|
+
} //#endif
|
1152
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1153
|
+
match = this.eatStatement(false, match, stack);
|
1154
|
+
|
1155
|
+
return match;
|
1156
|
+
},
|
1157
|
+
eatDo: function(match, stack){
|
1158
|
+
if (this.ast) { //#ifdef FULL_AST
|
1159
|
+
stack.push(stack = []);
|
1160
|
+
stack.desc = 'statement';
|
1161
|
+
stack.sub = 'do';
|
1162
|
+
stack.isIteration = true;
|
1163
|
+
stack.nextBlack = match.tokposb;
|
1164
|
+
this.statementLabels.push(''); // add "empty"
|
1165
|
+
var doToken = match;
|
1166
|
+
} //#endif
|
1167
|
+
// statement
|
1168
|
+
// while
|
1169
|
+
// (
|
1170
|
+
// expression
|
1171
|
+
// )
|
1172
|
+
// semi-colon
|
1173
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1174
|
+
match = this.eatStatement(false, match, stack);
|
1175
|
+
if (match.value != 'while') match = this.failsafe('DoShouldBeFollowedByWhile', match);
|
1176
|
+
if (this.ast) { //#ifdef FULL_AST
|
1177
|
+
match.hasDo = doToken;
|
1178
|
+
} //#endif
|
1179
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1180
|
+
if (match.value != '(') match = this.failsafe('ExpectedStatementHeaderOpen', match);
|
1181
|
+
if (this.ast) { //#ifdef FULL_AST
|
1182
|
+
var lhp = match;
|
1183
|
+
match.statementHeaderStart = true;
|
1184
|
+
} //#endif
|
1185
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1186
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value))) match = this.failsafe('StatementHeaderIsNotOptional', match);
|
1187
|
+
match = this.eatExpressions(false, match, stack);
|
1188
|
+
if (match.value != ')') match = this.failsafe('ExpectedStatementHeaderClose', match);
|
1189
|
+
if (this.ast) { //#ifdef FULL_AST
|
1190
|
+
match.twin = lhp;
|
1191
|
+
match.statementHeaderStop = true;
|
1192
|
+
match.isForDoWhile = true; // prevents missing block warnings
|
1193
|
+
lhp.twin = match;
|
1194
|
+
|
1195
|
+
if (stack[stack.length-1].desc == 'expressions') {
|
1196
|
+
// create ref to this expression group to the opening bracket
|
1197
|
+
lhp.expressionArg = stack[stack.length-1];
|
1198
|
+
}
|
1199
|
+
} //#endif
|
1200
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1201
|
+
match = this.eatSemiColon(match, stack); // TOFIX: this is not optional according to the spec, but browsers apply ASI anyways
|
1202
|
+
|
1203
|
+
return match;
|
1204
|
+
},
|
1205
|
+
eatWhile: function(match, stack){
|
1206
|
+
if (this.ast) { //#ifdef FULL_AST
|
1207
|
+
stack.push(stack = []);
|
1208
|
+
stack.desc = 'statement';
|
1209
|
+
stack.sub = 'while';
|
1210
|
+
stack.isIteration = true;
|
1211
|
+
stack.nextBlack = match.tokposb;
|
1212
|
+
this.statementLabels.push(''); // add "empty"
|
1213
|
+
} //#endif
|
1214
|
+
|
1215
|
+
// (
|
1216
|
+
// expression
|
1217
|
+
// )
|
1218
|
+
// statement
|
1219
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1220
|
+
if (match.value != '(') match = this.failsafe('ExpectedStatementHeaderOpen', match);
|
1221
|
+
if (this.ast) { //#ifdef FULL_AST
|
1222
|
+
var lhp = match;
|
1223
|
+
match.statementHeaderStart = true;
|
1224
|
+
} //#endif
|
1225
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1226
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value))) match = this.failsafe('StatementHeaderIsNotOptional', match);
|
1227
|
+
match = this.eatExpressions(false, match, stack);
|
1228
|
+
if (match.value != ')') match = this.failsafe('ExpectedStatementHeaderClose', match);
|
1229
|
+
if (this.ast) { //#ifdef FULL_AST
|
1230
|
+
match.twin = lhp;
|
1231
|
+
match.statementHeaderStop = true;
|
1232
|
+
lhp.twin = match;
|
1233
|
+
|
1234
|
+
if (stack[stack.length-1].desc == 'expressions') {
|
1235
|
+
// create ref to this expression group to the opening bracket
|
1236
|
+
lhp.expressionArg = stack[stack.length-1];
|
1237
|
+
}
|
1238
|
+
} //#endif
|
1239
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1240
|
+
match = this.eatStatement(false, match, stack);
|
1241
|
+
|
1242
|
+
return match;
|
1243
|
+
},
|
1244
|
+
|
1245
|
+
eatFor: function(match, stack){
|
1246
|
+
if (this.ast) { //#ifdef FULL_AST
|
1247
|
+
stack.push(stack = []);
|
1248
|
+
stack.desc = 'statement';
|
1249
|
+
stack.sub = 'for';
|
1250
|
+
stack.isIteration = true;
|
1251
|
+
stack.nextBlack = match.tokposb;
|
1252
|
+
this.statementLabels.push(''); // add "empty"
|
1253
|
+
} //#endif
|
1254
|
+
// either a for(..in..) or for(..;..;..)
|
1255
|
+
// start eating an expression but refuse to parse
|
1256
|
+
// 'in' on the top-level of that expression. they are fine
|
1257
|
+
// in sub-levels (group, array, etc). Now the expression
|
1258
|
+
// must be followed by either ';' or 'in'. Else throw.
|
1259
|
+
// Branch on that case, ; requires two.
|
1260
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1261
|
+
if (match.value != '(') match = this.failsafe('ExpectedStatementHeaderOpen', match);
|
1262
|
+
if (this.ast) { //#ifdef FULL_AST
|
1263
|
+
var lhp = match;
|
1264
|
+
match.statementHeaderStart = true;
|
1265
|
+
match.forHeaderStart = true;
|
1266
|
+
} //#endif
|
1267
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1268
|
+
|
1269
|
+
// for (either case) may start with var, in which case you'll parse a var declaration before encountering the 'in' or first semi.
|
1270
|
+
if (match.value == 'var') {
|
1271
|
+
match = this.eatVarDecl(match, stack, true);
|
1272
|
+
} else if (match.value != ';') { // expressions are optional in for-each
|
1273
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value))) {
|
1274
|
+
this.failignore('StatementHeaderIsNotOptional', match, stack);
|
1275
|
+
}
|
1276
|
+
match = this.eatExpressions(false, match, stack, false, true); // can parse multiple expressions, in is not ok here
|
1277
|
+
}
|
1278
|
+
|
1279
|
+
// now we parsed an expression if it existed. the next token should be either ';' or 'in'. branch accordingly
|
1280
|
+
if (match.value == 'in') {
|
1281
|
+
var declStack = stack[stack.length-1];
|
1282
|
+
if (declStack.varsDeclared > 1) {
|
1283
|
+
// disallowed. for-in var decls can only have one var name declared
|
1284
|
+
this.failignore('ForInCanOnlyDeclareOnVar', match, stack);
|
1285
|
+
}
|
1286
|
+
|
1287
|
+
if (this.ast) { //#ifdef FULL_AST
|
1288
|
+
stack.forType = 'in';
|
1289
|
+
match.forFor = true; // make easy distinction between conditional and iterational operator
|
1290
|
+
} //#endif
|
1291
|
+
|
1292
|
+
// just parse another expression, where 'in' is allowed.
|
1293
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1294
|
+
match = this.eatExpressions(false, match, stack);
|
1295
|
+
} else {
|
1296
|
+
if (match.value != ';') match = this.failsafe('ForHeaderShouldHaveSemisOrIn', match);
|
1297
|
+
|
1298
|
+
if (this.ast) { //#ifdef FULL_AST
|
1299
|
+
stack.forType = 'each';
|
1300
|
+
match.forEachHeaderStart = true;
|
1301
|
+
} //#endif
|
1302
|
+
// parse another optional no-in expression, another semi and then one more optional no-in expression
|
1303
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1304
|
+
if (/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value)) match = this.eatExpressions(false, match, stack); // in is ok here
|
1305
|
+
if (match.value != ';') match = this.failsafe('ExpectedSecondSemiOfForHeader', match);
|
1306
|
+
if (this.ast) { //#ifdef FULL_AST
|
1307
|
+
match.forEachHeaderStop = true;
|
1308
|
+
} //#endif
|
1309
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1310
|
+
if (/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value)) match = this.eatExpressions(false, match, stack); // in is ok here
|
1311
|
+
}
|
1312
|
+
|
1313
|
+
if (match.value != ')') match = this.failsafe('ExpectedStatementHeaderClose', match);
|
1314
|
+
if (this.ast) { //#ifdef FULL_AST
|
1315
|
+
match.twin = lhp;
|
1316
|
+
match.statementHeaderStop = true;
|
1317
|
+
match.forHeaderStop = true;
|
1318
|
+
lhp.twin = match;
|
1319
|
+
|
1320
|
+
if (match.forType == 'in' && stack[stack.length-1].desc == 'expressions') {
|
1321
|
+
// create ref to this expression group to the opening bracket
|
1322
|
+
lhp.expressionArg = stack[stack.length-1];
|
1323
|
+
}
|
1324
|
+
} //#endif
|
1325
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1326
|
+
|
1327
|
+
match = this.eatStatement(false, match, stack);
|
1328
|
+
|
1329
|
+
return match;
|
1330
|
+
},
|
1331
|
+
eatContinue: function(match, stack){
|
1332
|
+
if (this.ast) { //#ifdef FULL_AST
|
1333
|
+
stack.push(stack = []);
|
1334
|
+
stack.desc = 'statement';
|
1335
|
+
stack.sub = 'continue';
|
1336
|
+
stack.nextBlack = match.tokposb;
|
1337
|
+
|
1338
|
+
match.restricted = true;
|
1339
|
+
} //#endif
|
1340
|
+
// (no-line-break identifier)
|
1341
|
+
// ;
|
1342
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack); // may not have line terminator...
|
1343
|
+
if (!match.newline && match.value != ';' && match.name != 12/*EOF*/ && match.value != '}') {
|
1344
|
+
if (this.ast) { //#ifdef FULL_AST
|
1345
|
+
match.isLabel = true;
|
1346
|
+
match.isLabelTarget = true;
|
1347
|
+
|
1348
|
+
var continueArg = match; // remember to see if this continue parsed a label
|
1349
|
+
} //#endif
|
1350
|
+
// may only parse exactly an identifier at this point
|
1351
|
+
match = this.eatExpressions(false, match, stack, true, false, true); // first true=onlyOne, second: continue/break arg
|
1352
|
+
if (this.ast) { //#ifdef FULL_AST
|
1353
|
+
stack.hasLabel = continueArg != match;
|
1354
|
+
} //#endif
|
1355
|
+
if (match.value != ';' && !match.newline && match.name != 12/*eof*/ && match.value != '}') match = this.failsafe('BreakOrContinueArgMustBeJustIdentifier', match);
|
1356
|
+
}
|
1357
|
+
match = this.eatSemiColon(match, stack);
|
1358
|
+
|
1359
|
+
return match;
|
1360
|
+
},
|
1361
|
+
eatBreak: function(match, stack){
|
1362
|
+
if (this.ast) { //#ifdef FULL_AST
|
1363
|
+
var parentstack = stack
|
1364
|
+
stack = [];
|
1365
|
+
stack.desc = 'statement';
|
1366
|
+
stack.sub = 'break';
|
1367
|
+
stack.nextBlack = match.tokposb;
|
1368
|
+
|
1369
|
+
parentstack.push(stack);
|
1370
|
+
|
1371
|
+
match.restricted = true;
|
1372
|
+
} //#endif
|
1373
|
+
// (no-line-break identifier)
|
1374
|
+
// ;
|
1375
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack); // may not have line terminator...
|
1376
|
+
if (!match.newline && match.value != ';' && match.name != 12/*EOF*/ && match.value != '}') {
|
1377
|
+
if (this.ast) { //#ifdef FULL_AST
|
1378
|
+
match.isLabel = true;
|
1379
|
+
match.isLabelTarget = true;
|
1380
|
+
var breakArg = match; // remember to see if this break parsed a label
|
1381
|
+
} //#endif
|
1382
|
+
// may only parse exactly an identifier at this point
|
1383
|
+
match = this.eatExpressions(false, match, stack, true, false, true); // first true=onlyOne, second: continue/break arg
|
1384
|
+
if (this.ast) { //#ifdef FULL_AST
|
1385
|
+
stack.hasLabel = breakArg != match;
|
1386
|
+
} //#endif
|
1387
|
+
|
1388
|
+
if (match.value != ';' && !match.newline && match.name != 12/*eof*/ && match.value != '}') match = this.failsafe('BreakOrContinueArgMustBeJustIdentifier', match);
|
1389
|
+
}
|
1390
|
+
match = this.eatSemiColon(match, stack);
|
1391
|
+
|
1392
|
+
return match;
|
1393
|
+
},
|
1394
|
+
eatReturn: function(match, stack){
|
1395
|
+
if (this.ast) { //#ifdef FULL_AST
|
1396
|
+
stack.push(stack = []);
|
1397
|
+
stack.desc = 'statement';
|
1398
|
+
stack.sub = 'return';
|
1399
|
+
stack.nextBlack = match.tokposb;
|
1400
|
+
stack.returnFor = this.scope.scopeFor;
|
1401
|
+
|
1402
|
+
match.restricted = true;
|
1403
|
+
} //#endif
|
1404
|
+
// (no-line-break expression)
|
1405
|
+
// ;
|
1406
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack); // may not have line terminator...
|
1407
|
+
if (!match.newline && match.value != ';' && match.name != 12/*EOF*/ && match.value != '}') {
|
1408
|
+
match = this.eatExpressions(false, match, stack);
|
1409
|
+
}
|
1410
|
+
match = this.eatSemiColon(match, stack);
|
1411
|
+
|
1412
|
+
return match;
|
1413
|
+
},
|
1414
|
+
eatThrow: function(match, stack){
|
1415
|
+
if (this.ast) { //#ifdef FULL_AST
|
1416
|
+
stack.push(stack = []);
|
1417
|
+
stack.desc = 'statement';
|
1418
|
+
stack.sub = 'throw';
|
1419
|
+
stack.nextBlack = match.tokposb;
|
1420
|
+
|
1421
|
+
match.restricted = true;
|
1422
|
+
} //#endif
|
1423
|
+
// (no-line-break expression)
|
1424
|
+
// ;
|
1425
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack); // may not have line terminator...
|
1426
|
+
if (match.newline) match = this.failsafe('ThrowCannotHaveReturn', match);
|
1427
|
+
if (match.value == ';') match = this.failsafe('ThrowMustHaveArgument', match);
|
1428
|
+
match = this.eatExpressions(false, match, stack);
|
1429
|
+
match = this.eatSemiColon(match, stack);
|
1430
|
+
|
1431
|
+
return match;
|
1432
|
+
},
|
1433
|
+
eatSwitch: function(match, stack){
|
1434
|
+
if (this.ast) { //#ifdef FULL_AST
|
1435
|
+
stack.push(stack = []);
|
1436
|
+
stack.desc = 'statement';
|
1437
|
+
stack.sub = 'switch';
|
1438
|
+
stack.nextBlack = match.tokposb;
|
1439
|
+
|
1440
|
+
this.statementLabels.push(''); // add "empty"
|
1441
|
+
} //#endif
|
1442
|
+
// meh.
|
1443
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1444
|
+
if (match.value != '(') match = this.failsafe('ExpectedStatementHeaderOpen', match);
|
1445
|
+
if (this.ast) { //#ifdef FULL_AST
|
1446
|
+
var lhp = match;
|
1447
|
+
match.statementHeaderStart = true;
|
1448
|
+
} //#endif
|
1449
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1450
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value))) {
|
1451
|
+
this.failignore('StatementHeaderIsNotOptional', match, stack);
|
1452
|
+
}
|
1453
|
+
match = this.eatExpressions(false, match, stack);
|
1454
|
+
if (match.value != ')') match = this.failsafe('ExpectedStatementHeaderClose', match);
|
1455
|
+
if (this.ast) { //#ifdef FULL_AST
|
1456
|
+
match.twin = lhp;
|
1457
|
+
match.statementHeaderStop = true;
|
1458
|
+
lhp.twin = match;
|
1459
|
+
|
1460
|
+
if (stack[stack.length-1].desc == 'expressions') {
|
1461
|
+
// create ref to this expression group to the opening bracket
|
1462
|
+
lhp.expressionArg = stack[stack.length-1];
|
1463
|
+
}
|
1464
|
+
} //#endif
|
1465
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1466
|
+
if (match.value != '{') match = this.failsafe('SwitchBodyStartsWithCurly', match);
|
1467
|
+
|
1468
|
+
if (this.ast) { //#ifdef FULL_AST
|
1469
|
+
var lhc = match;
|
1470
|
+
} //#endif
|
1471
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1472
|
+
|
1473
|
+
// you may parse a default case, and only once per switch. but you may do so anywhere.
|
1474
|
+
var parsedAnything = false;
|
1475
|
+
|
1476
|
+
while (match.value == 'case' || (!stack.parsedSwitchDefault && match.value == 'default')) {
|
1477
|
+
parsedAnything = true;
|
1478
|
+
if (match.value == 'default') stack.parsedSwitchDefault = true;
|
1479
|
+
|
1480
|
+
match = this.eatSwitchClause(match, stack);
|
1481
|
+
}
|
1482
|
+
|
1483
|
+
// if you didnt parse anything but not encountering a closing curly now, you might be thinking that switches may start with silly stuff
|
1484
|
+
if (!parsedAnything && match.value != '}') {
|
1485
|
+
match = this.failsafe('SwitchBodyMustStartWithClause', match);
|
1486
|
+
}
|
1487
|
+
|
1488
|
+
if (stack.parsedSwitchDefault && match.value == 'default') {
|
1489
|
+
this.failignore('SwitchCannotHaveDoubleDefault', match, stack);
|
1490
|
+
}
|
1491
|
+
|
1492
|
+
if (match.value != '}' && match.name != 14/*error*/) match = this.failsafe('SwitchBodyEndsWithCurly', match);
|
1493
|
+
|
1494
|
+
if (this.ast) { //#ifdef FULL_AST
|
1495
|
+
match.twin = lhc;
|
1496
|
+
lhc.twin = match;
|
1497
|
+
} //#endif
|
1498
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1499
|
+
|
1500
|
+
return match;
|
1501
|
+
},
|
1502
|
+
eatSwitchClause: function(match, stack){
|
1503
|
+
match = this.eatSwitchHeader(match, stack);
|
1504
|
+
match = this.eatSwitchBody(match, stack);
|
1505
|
+
|
1506
|
+
return match;
|
1507
|
+
},
|
1508
|
+
eatSwitchHeader: function(match, stack){
|
1509
|
+
if (this.ast) { //#ifdef FULL_AST
|
1510
|
+
// collect whitespace...
|
1511
|
+
var switchHeaderStack = stack
|
1512
|
+
stack.push(stack = []);
|
1513
|
+
stack.desc = 'switch clause header';
|
1514
|
+
stack.nextBlack = match.tokposb;
|
1515
|
+
} //#endif
|
1516
|
+
|
1517
|
+
if (match.value == 'case') {
|
1518
|
+
match = this.eatSwitchCaseHead(match, stack);
|
1519
|
+
} else { // default
|
1520
|
+
if (this.ast) { //#ifdef FULL_AST
|
1521
|
+
switchHeaderStack.hasDefaultClause = true;
|
1522
|
+
} //#endif
|
1523
|
+
match = this.eatSwitchDefaultHead(match, stack);
|
1524
|
+
}
|
1525
|
+
|
1526
|
+
if (this.ast) { //#ifdef FULL_AST
|
1527
|
+
// just to group whitespace (makes certain navigation easier..)
|
1528
|
+
stack.push(stack = []);
|
1529
|
+
stack.desc = 'colon';
|
1530
|
+
stack.nextBlack = match.tokposb;
|
1531
|
+
} //#endif
|
1532
|
+
|
1533
|
+
if (match.value != ':') {
|
1534
|
+
match = this.failsafe('SwitchClausesEndWithColon', match);
|
1535
|
+
}
|
1536
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1537
|
+
|
1538
|
+
return match;
|
1539
|
+
},
|
1540
|
+
eatSwitchBody: function(match, stack){
|
1541
|
+
if (this.ast) { //#ifdef FULL_AST
|
1542
|
+
stack.push(stack = []);
|
1543
|
+
stack.desc = 'switch clause body';
|
1544
|
+
stack.nextBlack = match.tokposb;
|
1545
|
+
} //#endif
|
1546
|
+
|
1547
|
+
// parse body of case or default, just so long case and default keywords are not seen and end of switch is not reached
|
1548
|
+
// (clause bodies may be empty, for instance to fall through)
|
1549
|
+
var lastMatch = null;
|
1550
|
+
while (match.value != 'default' && match.value != 'case' && match.value != '}' && match.name != 14/*error*/ && match.name != 12/*eof*/ && lastMatch != match) {
|
1551
|
+
lastMatch = match; // prevents endless loops on error ;)
|
1552
|
+
match = this.eatStatement(true, match, stack);
|
1553
|
+
}
|
1554
|
+
if (lastMatch == match) this.failsafe('UnexpectedInputSwitch', match);
|
1555
|
+
|
1556
|
+
return match;
|
1557
|
+
},
|
1558
|
+
eatSwitchCaseHead: function(match, stack){
|
1559
|
+
if (this.ast) { //#ifdef FULL_AST
|
1560
|
+
stack.sub = 'case';
|
1561
|
+
var caseHeadStack = stack;
|
1562
|
+
|
1563
|
+
stack.push(stack = []);
|
1564
|
+
stack.desc = 'case';
|
1565
|
+
stack.nextBlack = match.tokposb;
|
1566
|
+
|
1567
|
+
match.isCase = true;
|
1568
|
+
} //#endif
|
1569
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1570
|
+
|
1571
|
+
if (match.value == ':') {
|
1572
|
+
this.failignore('CaseMissingExpression', match, stack);
|
1573
|
+
} else {
|
1574
|
+
if (this.ast) { //#ifdef FULL_AST
|
1575
|
+
caseHeadStack.push(stack = []);
|
1576
|
+
stack.desc = 'case arg';
|
1577
|
+
stack.nextBlack = match.tokposb;
|
1578
|
+
} //#endif
|
1579
|
+
match = this.eatExpressions(false, match, stack);
|
1580
|
+
}
|
1581
|
+
|
1582
|
+
return match;
|
1583
|
+
},
|
1584
|
+
eatSwitchDefaultHead: function(match, stack){
|
1585
|
+
if (this.ast) { //#ifdef FULL_AST
|
1586
|
+
stack.sub = 'default';
|
1587
|
+
|
1588
|
+
stack.push(stack = []);
|
1589
|
+
stack.desc = 'case';
|
1590
|
+
stack.nextBlack = match.tokposb;
|
1591
|
+
|
1592
|
+
match.isDefault = true;
|
1593
|
+
} //#endif
|
1594
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1595
|
+
|
1596
|
+
return match;
|
1597
|
+
},
|
1598
|
+
eatTryCatchFinally: function(match, stack){
|
1599
|
+
if (this.ast) { //#ifdef FULL_AST
|
1600
|
+
stack.push(stack = []);
|
1601
|
+
stack.desc = 'statement';
|
1602
|
+
stack.sub = 'try';
|
1603
|
+
stack.nextBlack = match.tokposb;
|
1604
|
+
} //#endif
|
1605
|
+
|
1606
|
+
match = this.eatTry(match, stack);
|
1607
|
+
|
1608
|
+
if (match.value == 'catch') {
|
1609
|
+
if (this.ast) { //#ifdef FULL_AST
|
1610
|
+
stack.hasCatch = true;
|
1611
|
+
} //#endif
|
1612
|
+
match = this.eatCatch(match, stack);
|
1613
|
+
}
|
1614
|
+
if (match.value == 'finally') {
|
1615
|
+
if (this.ast) { //#ifdef FULL_AST
|
1616
|
+
stack.hasFinally = true;
|
1617
|
+
} //#endif
|
1618
|
+
match = this.eatFinally(match, stack);
|
1619
|
+
}
|
1620
|
+
|
1621
|
+
// at least a catch or finally block must follow. may be both.
|
1622
|
+
if (!stack.tryHasCatchOrFinally) {
|
1623
|
+
this.failignore('TryMustHaveCatchOrFinally', match, stack);
|
1624
|
+
}
|
1625
|
+
|
1626
|
+
return match;
|
1627
|
+
},
|
1628
|
+
eatTry: function(match, stack){
|
1629
|
+
// block
|
1630
|
+
// (catch ( identifier ) block )
|
1631
|
+
// (finally block)
|
1632
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1633
|
+
if (match.value != '{') match = this.failsafe('MissingTryBlockCurlyOpen', match);
|
1634
|
+
|
1635
|
+
if (this.ast) { //#ifdef FULL_AST
|
1636
|
+
stack.push(stack = []);
|
1637
|
+
stack.desc = 'statement';
|
1638
|
+
stack.sub = 'tryblock';
|
1639
|
+
stack.nextBlack = match.tokposb;
|
1640
|
+
var lhc = match;
|
1641
|
+
} //#endif
|
1642
|
+
|
1643
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1644
|
+
if (match.value != '}') match = this.eatStatements(match, stack);
|
1645
|
+
if (match.value != '}') match = this.failsafe('MissingTryBlockCurlyClose', match);
|
1646
|
+
|
1647
|
+
if (this.ast) { //#ifdef FULL_AST
|
1648
|
+
match.twin = lhc;
|
1649
|
+
lhc.twin = match;
|
1650
|
+
} //#endif
|
1651
|
+
|
1652
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1653
|
+
|
1654
|
+
return match;
|
1655
|
+
},
|
1656
|
+
eatCatch: function(match, stack){
|
1657
|
+
stack.tryHasCatchOrFinally = true;
|
1658
|
+
if (this.ast) { //#ifdef FULL_AST
|
1659
|
+
stack.push(stack = []);
|
1660
|
+
stack.desc = 'statement';
|
1661
|
+
stack.sub = 'catch';
|
1662
|
+
stack.nextBlack = match.tokposb;
|
1663
|
+
|
1664
|
+
// the catch block has a header which can contain at most one parameter
|
1665
|
+
// this parameter is bound to a local stack. formally, if that parameter
|
1666
|
+
// shadows another variable, changes made to the variable inside the catch
|
1667
|
+
// should not be reflected by the variable being shadowed. however, this
|
1668
|
+
// is not very safe to rely on so there ought to be a warning. note that
|
1669
|
+
// only this parameter gets bound to this inner scope, other parameters.
|
1670
|
+
|
1671
|
+
var catchScopeBackup = this.scope;
|
1672
|
+
match.scope = this.scope = stack.scope = [this.scope];
|
1673
|
+
this.scope.catchScope = true; // mark this as being a catchScope
|
1674
|
+
|
1675
|
+
// find first function scope or global scope object...
|
1676
|
+
var nonCatchScope = catchScopeBackup;
|
1677
|
+
while (nonCatchScope.catchScope) nonCatchScope = nonCatchScope[0];
|
1678
|
+
|
1679
|
+
// get catch id, which is governed by the function/global scope only
|
1680
|
+
if (!nonCatchScope.catches) nonCatchScope.catches = [];
|
1681
|
+
match.catchId = nonCatchScope.catches.length;
|
1682
|
+
nonCatchScope.catches.push(match);
|
1683
|
+
match.targetScope = nonCatchScope;
|
1684
|
+
match.catchScope = this.scope;
|
1685
|
+
|
1686
|
+
// ref to back to function that's the cause for this scope
|
1687
|
+
this.scope.scopeFor = match;
|
1688
|
+
// catch clauses dont have a special `this` or `arguments`, map them to their parent scope
|
1689
|
+
if (catchScopeBackup.global) this.scope.push(catchScopeBackup[0]); // global (has no `arguments` but always a `this`)
|
1690
|
+
else if (catchScopeBackup.catchScope) {
|
1691
|
+
// tricky. there will at least be a this
|
1692
|
+
this.scope.push(catchScopeBackup[1]);
|
1693
|
+
// but there might not be an arguments
|
1694
|
+
if (catchScopeBackup[2] && catchScopeBackup[2].value == 'arguments') this.scope.push(catchScopeBackup[2]);
|
1695
|
+
} else this.scope.push(catchScopeBackup[1], catchScopeBackup[2]); // function scope, copy this and arguments
|
1696
|
+
} //#endif
|
1697
|
+
|
1698
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1699
|
+
if (match.value != '(') match = this.failsafe('CatchHeaderMissingOpen', match);
|
1700
|
+
if (this.ast) { //#ifdef FULL_AST
|
1701
|
+
var lhp = match;
|
1702
|
+
} //#endif
|
1703
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1704
|
+
if (match.name != 2/*IDENTIFIER*/) match = this.failsafe('MissingCatchParameter', match);
|
1705
|
+
if (this.hashStartKeyOrReserved[match.value[0]] /*this.regexStartKeyOrReserved.test(match.value[0])*/ && this.regexIsKeywordOrReserved.test(match.value)) {
|
1706
|
+
this.failignore('CatchParameterNameMayNotBeReserved', match, stack);
|
1707
|
+
}
|
1708
|
+
|
1709
|
+
if (this.ast) { //#ifdef FULL_AST
|
1710
|
+
match.meta = 'var name';
|
1711
|
+
// this is the catch variable. bind it to a scope but keep the scope as
|
1712
|
+
// it currently is.
|
1713
|
+
this.scope.push(match);
|
1714
|
+
match.isCatchVar = true;
|
1715
|
+
} //#endif
|
1716
|
+
|
1717
|
+
// now the catch body will use the outer scope to bind new variables. the problem is that
|
1718
|
+
// inner scopes, if any, should have access to the scope variable, so their scope should
|
1719
|
+
// be linked to the catch scope. this is a problem in the current architecture but the
|
1720
|
+
// idea is to pass on the catchScope as the scope to the eatStatements call, etc.
|
1721
|
+
|
1722
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1723
|
+
if (match.value != ')') match = this.failsafe('CatchHeaderMissingClose', match);
|
1724
|
+
if (this.ast) { //#ifdef FULL_AST
|
1725
|
+
match.twin = lhp;
|
1726
|
+
lhp.twin = match;
|
1727
|
+
} //#endif
|
1728
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1729
|
+
if (match.value != '{') match = this.failsafe('MissingCatchBlockCurlyOpen', match);
|
1730
|
+
if (this.ast) { //#ifdef FULL_AST
|
1731
|
+
var lhc = match;
|
1732
|
+
} //#endif
|
1733
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1734
|
+
|
1735
|
+
// catch body. statements are optional.
|
1736
|
+
if (match.value != '}') match = this.eatStatements(match, stack);
|
1737
|
+
|
1738
|
+
if (match.value != '}') match = this.failsafe('MissingCatchBlockCurlyClose', match);
|
1739
|
+
if (this.ast) { //#ifdef FULL_AST
|
1740
|
+
match.twin = lhc;
|
1741
|
+
lhc.twin = match;
|
1742
|
+
} //#endif
|
1743
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1744
|
+
|
1745
|
+
if (this.ast) { //#ifdef FULL_AST
|
1746
|
+
this.scope = catchScopeBackup;
|
1747
|
+
} //#endif
|
1748
|
+
|
1749
|
+
return match;
|
1750
|
+
},
|
1751
|
+
eatFinally: function(match, stack){
|
1752
|
+
stack.tryHasCatchOrFinally = true;
|
1753
|
+
if (this.ast) { //#ifdef FULL_AST
|
1754
|
+
stack.push(stack = []);
|
1755
|
+
stack.desc = 'statement';
|
1756
|
+
stack.sub = 'finally';
|
1757
|
+
stack.nextBlack = match.tokposb;
|
1758
|
+
} //#endif
|
1759
|
+
|
1760
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1761
|
+
if (match.value != '{') match = this.failsafe('MissingFinallyBlockCurlyOpen', match);
|
1762
|
+
if (this.ast) { //#ifdef FULL_AST
|
1763
|
+
var lhc = match;
|
1764
|
+
} //#endif
|
1765
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1766
|
+
if (match.value != '}') match = this.eatStatements(match, stack);
|
1767
|
+
if (match.value != '}') match = this.failsafe('MissingFinallyBlockCurlyClose', match);
|
1768
|
+
if (this.ast) { //#ifdef FULL_AST
|
1769
|
+
match.twin = lhc;
|
1770
|
+
lhc.twin = match;
|
1771
|
+
} //#endif
|
1772
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1773
|
+
|
1774
|
+
return match;
|
1775
|
+
},
|
1776
|
+
eatDebugger: function(match, stack){
|
1777
|
+
if (this.ast) { //#ifdef FULL_AST
|
1778
|
+
stack.push(stack = []);
|
1779
|
+
stack.desc = 'statement';
|
1780
|
+
stack.sub = 'debugger';
|
1781
|
+
stack.nextBlack = match.tokposb;
|
1782
|
+
} //#endif
|
1783
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1784
|
+
match = this.eatSemiColon(match, stack);
|
1785
|
+
|
1786
|
+
return match;
|
1787
|
+
},
|
1788
|
+
eatWith: function(match, stack){
|
1789
|
+
if (this.ast) { //#ifdef FULL_AST
|
1790
|
+
stack.push(stack = []);
|
1791
|
+
stack.desc = 'statement';
|
1792
|
+
stack.sub = 'with';
|
1793
|
+
stack.nextBlack = match.tokposb;
|
1794
|
+
} //#endif
|
1795
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1796
|
+
if (match.value != '(') match = this.failsafe('ExpectedStatementHeaderOpen', match);
|
1797
|
+
if (this.ast) { //#ifdef FULL_AST
|
1798
|
+
var lhp = match;
|
1799
|
+
match.statementHeaderStart = true;
|
1800
|
+
} //#endif
|
1801
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1802
|
+
if (!(/*is left hand side start?*/ match.name <= 6 || this.regexLhsStart.test(match.value))) match = this.failsafe('StatementHeaderIsNotOptional', match);
|
1803
|
+
match = this.eatExpressions(false, match, stack);
|
1804
|
+
if (match.value != ')') match = this.failsafe('ExpectedStatementHeaderClose', match);
|
1805
|
+
if (this.ast) { //#ifdef FULL_AST
|
1806
|
+
match.twin = lhp;
|
1807
|
+
match.statementHeaderStop = true;
|
1808
|
+
lhp.twin = match;
|
1809
|
+
|
1810
|
+
if (stack[stack.length-1].desc == 'expressions') {
|
1811
|
+
// create ref to this expression group to the opening bracket
|
1812
|
+
lhp.expressionArg = stack[stack.length-1];
|
1813
|
+
}
|
1814
|
+
} //#endif
|
1815
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1816
|
+
match = this.eatStatement(false, match, stack);
|
1817
|
+
|
1818
|
+
return match;
|
1819
|
+
},
|
1820
|
+
eatFunction: function(match, stack){
|
1821
|
+
var pe = new ZeParser.Error
|
1822
|
+
this.errorStack.push(pe);
|
1823
|
+
// ignore. browsers will accept it anyways
|
1824
|
+
var error = {start:match.stop,stop:match.stop,name:14/*error*/,error:pe};
|
1825
|
+
this.specialError(error, match, stack);
|
1826
|
+
// now try parsing a function declaration...
|
1827
|
+
match = this.eatFunctionDeclaration(match, stack);
|
1828
|
+
|
1829
|
+
return match;
|
1830
|
+
},
|
1831
|
+
eatLabelOrExpression: function(match, stack){
|
1832
|
+
if (this.ast) { //#ifdef FULL_AST
|
1833
|
+
var parentstack = stack;
|
1834
|
+
|
1835
|
+
stack = [];
|
1836
|
+
stack.desc = 'statement';
|
1837
|
+
stack.sub = 'expression';
|
1838
|
+
stack.nextBlack = match.tokposb;
|
1839
|
+
parentstack.push(stack);
|
1840
|
+
} //#endif
|
1841
|
+
// must be an expression or a labeled statement.
|
1842
|
+
// in order to prevent very weird return constructs, we'll first check the first match
|
1843
|
+
// if that's an identifier, we'll gobble it here and move on to the second.
|
1844
|
+
// if that's a colon, we'll gobble it as a labeled statement. otherwise, we'll pass on
|
1845
|
+
// control to eatExpression, with the note that we've already gobbled a
|
1846
|
+
|
1847
|
+
match = this.eatExpressions(true, match, stack);
|
1848
|
+
// if we parsed a label, the returned match (colon) will have this property
|
1849
|
+
if (match.wasLabel) {
|
1850
|
+
if (this.ast) { //#ifdef FULL_AST
|
1851
|
+
stack.sub = 'labeled';
|
1852
|
+
} //#endif
|
1853
|
+
// it will have already eaten another statement for the label
|
1854
|
+
} else {
|
1855
|
+
if (this.ast) { //#ifdef FULL_AST
|
1856
|
+
stack.sub = 'expression';
|
1857
|
+
} //#endif
|
1858
|
+
// only parse semi if we didnt parse a label just now...
|
1859
|
+
match = this.eatSemiColon(match, stack);
|
1860
|
+
}
|
1861
|
+
|
1862
|
+
return match;
|
1863
|
+
},
|
1864
|
+
eatBlock: function(match, stack){
|
1865
|
+
if (this.ast) { //#ifdef FULL_AST
|
1866
|
+
stack.sub = 'block';
|
1867
|
+
var lhc = match;
|
1868
|
+
} //#endif
|
1869
|
+
|
1870
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1871
|
+
|
1872
|
+
if (match.value == '}') {
|
1873
|
+
if (this.ast) { //#ifdef FULL_AST
|
1874
|
+
stack.isEmptyBlock = true;
|
1875
|
+
} //#endif
|
1876
|
+
} else {
|
1877
|
+
match = this.eatStatements(match, stack);
|
1878
|
+
}
|
1879
|
+
if (match.value != '}') match = this.failsafe('BlockCurlyClose', match);
|
1880
|
+
if (this.ast) { //#ifdef FULL_AST
|
1881
|
+
match.twin = lhc;
|
1882
|
+
lhc.twin = match;
|
1883
|
+
} //#endif
|
1884
|
+
match = this.tokenizer.storeCurrentAndFetchNextToken(false, match, stack);
|
1885
|
+
|
1886
|
+
return match;
|
1887
|
+
},
|
1888
|
+
|
1889
|
+
eatStatements: function(match, stack){
|
1890
|
+
//this.stats.eatStatements = (+//this.stats.eatStatements||0)+1;
|
1891
|
+
// detecting the start of a statement "quickly" is virtually impossible.
|
1892
|
+
// instead we keep eating statements until the match stops changing
|
1893
|
+
// the first argument indicates that the statement is optional. if that
|
1894
|
+
// statement was not found, the input match will also be the output.
|
1895
|
+
|
1896
|
+
while (match != (match = this.eatStatement(true, match, stack)));
|
1897
|
+
return match;
|
1898
|
+
},
|
1899
|
+
eatStatement: function(isOptional, match, stack){
|
1900
|
+
if (!match && isOptional) return match; // eof
|
1901
|
+
|
1902
|
+
if (this.ast) { //#ifdef FULL_AST
|
1903
|
+
match.statementStart = true;
|
1904
|
+
var pstack = stack;
|
1905
|
+
stack = [];
|
1906
|
+
stack.desc = 'statement-parent';
|
1907
|
+
stack.nextBlack = match.tokposb;
|
1908
|
+
pstack.push(stack);
|
1909
|
+
|
1910
|
+
// list of labels, these are bound to statements (and can access any label higher up, but not cross functions)
|
1911
|
+
var labelBackup = this.statementLabels;
|
1912
|
+
this.statementLabels = [labelBackup]; // make ref like tree. we need this to catch labels parsed beyond the current position (not yet known to use)
|
1913
|
+
stack.labels = this.statementLabels;
|
1914
|
+
} //#endif
|
1915
|
+
|
1916
|
+
if (match.name == 2/*IDENTIFIER*/) {
|
1917
|
+
// try to determine whether it's a statement
|
1918
|
+
// (block/empty statements come later, this branch is only for identifiers)
|
1919
|
+
switch (match.value) {
|
1920
|
+
case 'var':
|
1921
|
+
match = this.eatVar(match, stack);
|
1922
|
+
break;
|
1923
|
+
case 'if':
|
1924
|
+
match = this.eatIf(match, stack);
|
1925
|
+
break;
|
1926
|
+
case 'do':
|
1927
|
+
match = this.eatDo(match, stack);
|
1928
|
+
break;
|
1929
|
+
case 'while':
|
1930
|
+
match = this.eatWhile(match, stack);
|
1931
|
+
break;
|
1932
|
+
case 'for':
|
1933
|
+
match = this.eatFor(match, stack);
|
1934
|
+
break;
|
1935
|
+
case 'continue':
|
1936
|
+
match = this.eatContinue(match, stack);
|
1937
|
+
break;
|
1938
|
+
case 'break':
|
1939
|
+
match = this.eatBreak(match, stack);
|
1940
|
+
break;
|
1941
|
+
case 'return':
|
1942
|
+
match = this.eatReturn(match, stack);
|
1943
|
+
break;
|
1944
|
+
case 'throw':
|
1945
|
+
match = this.eatThrow(match, stack);
|
1946
|
+
break;
|
1947
|
+
case 'switch':
|
1948
|
+
match = this.eatSwitch(match, stack);
|
1949
|
+
break;
|
1950
|
+
case 'try':
|
1951
|
+
match = this.eatTryCatchFinally(match, stack);
|
1952
|
+
break;
|
1953
|
+
case 'debugger':
|
1954
|
+
match = this.eatDebugger(match, stack);
|
1955
|
+
break;
|
1956
|
+
case 'with':
|
1957
|
+
match = this.eatWith(match, stack);
|
1958
|
+
break;
|
1959
|
+
case 'function':
|
1960
|
+
// I'm not sure whether this is at all possible.... (but it's bad, either way ;)
|
1961
|
+
// so add an error token, but parse the function as if it was a declaration.
|
1962
|
+
this.failignore('StatementMayNotStartWithFunction', match, stack);
|
1963
|
+
|
1964
|
+
// now parse as declaration... (most likely?)
|
1965
|
+
match = this.eatFunctionDeclaration(match, stack);
|
1966
|
+
|
1967
|
+
break;
|
1968
|
+
default: // either a label or an expression-statement
|
1969
|
+
match = this.eatLabelOrExpression(match, stack);
|
1970
|
+
}
|
1971
|
+
} else if (match.value == '{') { // Block (make sure you do this before checking for expression...)
|
1972
|
+
match = this.eatBlock(match, stack);
|
1973
|
+
} else if (
|
1974
|
+
// expression statements:
|
1975
|
+
match.isString ||
|
1976
|
+
match.isNumber ||
|
1977
|
+
match.name == 1/*REG_EX*/ ||
|
1978
|
+
this.regexLhsStart.test(match.value)
|
1979
|
+
) {
|
1980
|
+
match = this.eatExpressions(false, match,stack);
|
1981
|
+
match = this.eatSemiColon(match, stack);
|
1982
|
+
} else if (match.value == ';') { // empty statement
|
1983
|
+
match.emptyStatement = true;
|
1984
|
+
match = this.eatSemiColon(match, stack);
|
1985
|
+
} else if (!isOptional) {
|
1986
|
+
if (this.ast) { //#ifdef FULL_AST
|
1987
|
+
// unmark token as being start of a statement, since it's obviously not
|
1988
|
+
match.statementStart = false;
|
1989
|
+
} //#endif
|
1990
|
+
match = this.failsafe('UnableToParseStatement', match);
|
1991
|
+
} else {
|
1992
|
+
// unmark token as being start of a statement, since it's obviously not
|
1993
|
+
if (this.ast) match.statementStart = true;
|
1994
|
+
}
|
1995
|
+
|
1996
|
+
if (this.ast) { //#ifdef FULL_AST
|
1997
|
+
if (!stack.length) pstack.length = pstack.length-1;
|
1998
|
+
|
1999
|
+
// restore label set
|
2000
|
+
this.statementLabels = labelBackup;
|
2001
|
+
} //#endif
|
2002
|
+
|
2003
|
+
return match;
|
2004
|
+
},
|
2005
|
+
|
2006
|
+
eatSourceElements: function(match, stack){
|
2007
|
+
//this.stats.eatSourceElements = (+//this.stats.eatSourceElements||0)+1;
|
2008
|
+
// detecting the start of a statement "quickly" is virtually impossible.
|
2009
|
+
// instead we keep eating statements until the match stops changing
|
2010
|
+
// the first argument indicates that the statement is optional. if that
|
2011
|
+
// statement was not found, the input match will also be the output.
|
2012
|
+
while (match != oldMatch) { // difficult to determine whether ` && match.name != 12/*EOF*/` is actually speeding things up. it's an extra check vs one less call to eatStatement...
|
2013
|
+
var oldMatch = match;
|
2014
|
+
// always try to eat function declaration first. otherwise 'function' at the start might cause eatStatement to throw up
|
2015
|
+
if (match.value == 'function') match = this.eatFunctionDeclaration(match, stack);
|
2016
|
+
else match = this.eatStatement(true, match, stack);
|
2017
|
+
}
|
2018
|
+
return match;
|
2019
|
+
},
|
2020
|
+
|
2021
|
+
failsafe: function(name, match, doNotAddMatch){
|
2022
|
+
var pe = new ZeParser.Error(name, match);
|
2023
|
+
this.errorStack.push(pe);
|
2024
|
+
|
2025
|
+
if (!doNotAddMatch) {
|
2026
|
+
// the match was bad, but add it to the ast anyways. in most cases this is the case but in some its not.
|
2027
|
+
// the tokenizer will pick up on the errorEscape property and add it after the match we passed on.
|
2028
|
+
if (this.tokenizer.errorEscape) this.stack.push(this.tokenizer.errorEscape);
|
2029
|
+
this.tokenizer.errorEscape = match;
|
2030
|
+
}
|
2031
|
+
var error = {start:match.start,stop:match.start,len:0, name:14/*error*/,error:pe, value:''};
|
2032
|
+
this.tokenizer.addTokenToStreamBefore(error, match);
|
2033
|
+
return error;
|
2034
|
+
},
|
2035
|
+
failignore: function(name, match, stack){
|
2036
|
+
var pe = new ZeParser.Error(name, match);
|
2037
|
+
this.errorStack.push(pe);
|
2038
|
+
// ignore the error (this will screw up :)
|
2039
|
+
var error = {start:match.start,stop:match.start,len:0,name:14/*error*/,error:pe, value:''};
|
2040
|
+
stack.push(error);
|
2041
|
+
this.tokenizer.addTokenToStreamBefore(error, match);
|
2042
|
+
},
|
2043
|
+
failSpecial: function(error, match, stack){
|
2044
|
+
// we cant really ignore this. eat the token
|
2045
|
+
stack.push(error);
|
2046
|
+
this.tokenizer.addTokenToStreamBefore(error, match);
|
2047
|
+
},
|
2048
|
+
|
2049
|
+
0:0};
|
2050
|
+
|
2051
|
+
//#ifdef TEST_SUITE
|
2052
|
+
ZeParser.testSuite = function(tests){
|
2053
|
+
var ok = 0;
|
2054
|
+
var fail = 0;
|
2055
|
+
var start = +new Date;
|
2056
|
+
for (var i = 0; i < tests.length; ++i) {
|
2057
|
+
var test = tests[i], input = test[0], outputLen = test[1].length ? test[1][1] : test[1], desc = test[test.length - 1], stack = [];
|
2058
|
+
try {
|
2059
|
+
var result = ZeParser.parse(input, true);
|
2060
|
+
if (result.length == outputLen) {
|
2061
|
+
++ok;
|
2062
|
+
} else {
|
2063
|
+
++fail;
|
2064
|
+
}
|
2065
|
+
} catch (e) {
|
2066
|
+
++fail;
|
2067
|
+
}
|
2068
|
+
document.getElementsByTagName('div')[0].innerHTML = ('Ze parser test suite finished ('+(+new Date - start)+' ms). ok:'+ok+', fail:'+fail);
|
2069
|
+
};
|
2070
|
+
};
|
2071
|
+
//#endif
|
2072
|
+
|
2073
|
+
ZeParser.regexLhsStart = /[\+\-\~\!\(\{\[]/;
|
2074
|
+
/*
|
2075
|
+
ZeParser.regexStartKeyword = /[bcdefinrstvw]/;
|
2076
|
+
ZeParser.regexKeyword = /^break$|^catch$|^continue$|^debugger$|^default$|^delete$|^do$|^else$|^finally$|^for$|^function$|^if$|^in$|^instanceof$|^new$|^return$|^switch$|^this$|^throw$|^try$|^typeof$|^var$|^void$|^while$|^with$/;
|
2077
|
+
ZeParser.regexStartReserved = /[ceis]/;
|
2078
|
+
ZeParser.regexReserved = /^class$|^const$|^enum$|^export$|^extends$|^import$|^super$/;
|
2079
|
+
*/
|
2080
|
+
ZeParser.regexStartKeyOrReserved = /[bcdefinrstvw]/;
|
2081
|
+
ZeParser.hashStartKeyOrReserved = Object.create ? Object.create(null, {b:{value:1},c:{value:1},d:{value:1},e:{value:1},f:{value:1},i:{value:1},n:{value:1},r:{value:1},s:{value:1},t:{value:1},v:{value:1},w:{value:1}}) : {b:1,c:1,d:1,e:1,f:1,i:1,n:1,r:1,s:1,t:1,v:1,w:1};
|
2082
|
+
ZeParser.regexIsKeywordOrReserved = /^break$|^catch$|^continue$|^debugger$|^default$|^delete$|^do$|^else$|^finally$|^for$|^function$|^if$|^in$|^instanceof$|^new$|^return$|^switch$|^case$|^this$|^true$|^false$|^null$|^throw$|^try$|^typeof$|^var$|^void$|^while$|^with$|^class$|^const$|^enum$|^export$|^extends$|^import$|^super$/;
|
2083
|
+
ZeParser.regexAssignments = /^[\+\-\*\%\&\|\^\/]?=$|^\<\<\=$|^\>{2,3}\=$/;
|
2084
|
+
ZeParser.regexNonAssignmentBinaryExpressionOperators = /^[\+\-\*\%\|\^\&\?\/]$|^[\<\>]\=?$|^[\=\!]\=\=?$|^\<\<|\>\>\>?$|^\&\&$|^\|\|$/;
|
2085
|
+
ZeParser.regexUnaryKeywords = /^delete$|^void$|^typeof$|^new$/;
|
2086
|
+
ZeParser.hashUnaryKeywordStart = Object.create ? Object.create(null, {d:{value:1},v:{value:1},t:{value:1},n:{value:1}}) : {d:1,v:1,t:1,n:1};
|
2087
|
+
ZeParser.regexUnaryOperators = /[\+\-\~\!]/;
|
2088
|
+
ZeParser.regexLiteralKeywords = /^this$|^null$|^true$|^false$/;
|
2089
|
+
|
2090
|
+
ZeParser.Error = function(type, match){
|
2091
|
+
//if (type == 'BreakOrContinueArgMustBeJustIdentifier') throw here;
|
2092
|
+
this.msg = ZeParser.Errors[type].msg;
|
2093
|
+
this.before = ZeParser.Errors[type].before;
|
2094
|
+
this.match = match;
|
2095
|
+
};
|
2096
|
+
|
2097
|
+
ZeParser.Errors = {
|
2098
|
+
NoASI: {msg:'Expected semi-colon, was unable to apply ASI'},
|
2099
|
+
ExpectedAnotherExpressionComma: {msg:'expecting another (left hand sided) expression after the comma'},
|
2100
|
+
ExpectedAnotherExpressionRhs: {msg:"expected a rhs expression"},
|
2101
|
+
UnclosedGroupingOperator: {msg:"Unclosed grouping operator"},
|
2102
|
+
GroupingShouldStartWithExpression: {msg:'The grouping operator (`(`) should start with a left hand sided expression'},
|
2103
|
+
ArrayShouldStartWithExpression: {msg:'The array literal (`[`) should start with a left hand sided expression'},
|
2104
|
+
UnclosedPropertyBracket: {msg:'Property bracket was not closed after expression (expecting `]`)'},
|
2105
|
+
IllegalPropertyNameToken: {msg:'Object literal property names can only be assigned as strings, numbers or identifiers'},
|
2106
|
+
IllegalGetterSetterNameToken: {msg:'Name of a getter/setter can only be assigned as strings, numbers or identifiers'},
|
2107
|
+
GetterSetterNameFollowedByOpenParen: {msg:'The name of the getter/setter should immediately be followed by the opening parenthesis `(`'},
|
2108
|
+
GetterHasNoArguments: {msg:'The opening parenthesis `(` of the getter should be immediately followed by the closing parenthesis `)`, the getter cannot have an argument'},
|
2109
|
+
IllegalSetterArgumentNameToken: {msg:'Expecting the name of the argument of a setter, can only be assigned as strings, numbers or identifiers'},
|
2110
|
+
SettersOnlyGetOneArgument: {msg:'Setters have one and only one argument, missing the closing parenthesis `)`'},
|
2111
|
+
SetterHeaderShouldHaveClosingParen: {msg:'After the first argument of a setter should come a closing parenthesis `)`'},
|
2112
|
+
SettersMustHaveArgument: {msg:'Setters must have exactly one argument defined'},
|
2113
|
+
UnclosedObjectLiteral: {msg:'Expected to find a comma `,` for the next expression or a closing curly brace `}` to end the object literal'},
|
2114
|
+
FunctionNameMustNotBeReserved: {msg:'Function name may not be a keyword or a reserved word'},
|
2115
|
+
ExpressionMayNotStartWithKeyword: {msg:'Expressions may not start with keywords or reserved words that are not in this list: [this, null, true, false, void, typeof, delete, new]'},
|
2116
|
+
LabelsMayOnlyBeIdentifiers: {msg:'Label names may only be defined as an identifier'},
|
2117
|
+
LabelsMayNotBeReserved: {msg:'Labels may not be a keyword or a reserved word'},
|
2118
|
+
UnknownToken: {msg:'Unknown token encountered, dont know how to proceed'},
|
2119
|
+
PropertyNamesMayOnlyBeIdentifiers: {msg:'The tokens of property names accessed through the dot operator may only be identifiers'},
|
2120
|
+
SquareBracketExpectsExpression: {msg:'The square bracket property access expects an expression'},
|
2121
|
+
SquareBracketsMayNotBeEmpty: {msg:'Square brackets may never be empty, expecting an expression'},
|
2122
|
+
UnclosedSquareBrackets: {msg:'Unclosed square bracket encountered, was expecting `]` after the expression'},
|
2123
|
+
UnclosedCallParens: {msg:'Unclosed call parenthesis, expecting `)` after the optional expression'},
|
2124
|
+
InvalidCenterTernaryExpression: {msg:'Center expression of ternary operator should be a regular expression (but may not contain the comma operator directly)'},
|
2125
|
+
UnfinishedTernaryOperator: {msg:'Encountered a ternary operator start (`?`) but did not find the required colon (`:`) after the center expression'},
|
2126
|
+
TernarySecondExpressionCanNotContainComma: {msg:'The second and third expressions of the ternary operator can/may not "directly" contain a comma operator'},
|
2127
|
+
InvalidRhsExpression: {msg:'Expected a right hand side expression after the operator (which should also be a valid lhs) but did not find one'},
|
2128
|
+
FunctionDeclarationsMustHaveName: {msg:'Function declaration must have name'},
|
2129
|
+
FunctionNameMayNotBeReserved: {msg:'Function name may not be a keyword or reserved word'},
|
2130
|
+
ExpectingFunctionHeaderStart: {msg:'Expected the opening parenthesis of the function header'},
|
2131
|
+
FunctionArgumentsCanNotBeReserved: {msg:'Function arguments may not be keywords or reserved words'},
|
2132
|
+
FunctionParametersMustBeIdentifiers: {msg:'Function arguments must be identifiers'},
|
2133
|
+
ExpectedFunctionHeaderClose: {msg:'Expected the closing parenthesis `)` of the function header'},
|
2134
|
+
ExpectedFunctionBodyCurlyOpen: {msg:'Expected the opening curly brace `{` for the function body'},
|
2135
|
+
ExpectedFunctionBodyCurlyClose: {msg:'Expected the closing curly brace `}` for the function body'},
|
2136
|
+
VarNamesMayOnlyBeIdentifiers: {msg:'Missing variable name, must be a proper identifier'},
|
2137
|
+
VarNamesCanNotBeReserved: {msg:'Variable names may not be keywords or reserved words'},
|
2138
|
+
VarInitialiserExpressionExpected: {msg:'The initialiser of the variable statement should be an expression without comma'},
|
2139
|
+
ExpectedStatementHeaderOpen: {msg:'Expected opening parenthesis `(` for statement header'},
|
2140
|
+
StatementHeaderIsNotOptional: {msg:'Statement header must not be empty'},
|
2141
|
+
ExpectedStatementHeaderClose: {msg:'Expected closing parenthesis `)` for statement header'},
|
2142
|
+
DoShouldBeFollowedByWhile: {msg:'The do-while statement requires the `while` keyword after the expression'},
|
2143
|
+
ExpectedSecondSemiOfForHeader: {msg:'Expected the second semi-colon of the for-each header'},
|
2144
|
+
ForHeaderShouldHaveSemisOrIn: {msg:'The for-header should contain at least the `in` operator or two semi-colons (`;`)'},
|
2145
|
+
SwitchBodyStartsWithCurly: {msg:'The body of a switch statement starts with a curly brace `{`'},
|
2146
|
+
SwitchClausesEndWithColon: {msg:'Switch clauses (`case` and `default`) end with a colon (`:`)'},
|
2147
|
+
SwitchCannotHaveDoubleDefault: {msg:'Switches cannot have more than one `default` clause'},
|
2148
|
+
SwitchBodyEndsWithCurly: {msg:'The body of a switch statement ends with a curly brace `}`'},
|
2149
|
+
MissingTryBlockCurlyOpen: {msg:'Missing the opening curly brace (`{`) for the block of the try statement'},
|
2150
|
+
MissingTryBlockCurlyClose: {msg:'Missing the closing curly brace (`}`) for the block of the try statement'},
|
2151
|
+
CatchHeaderMissingOpen: {msg:'Missing the opening parenthesis of the catch header'},
|
2152
|
+
MissingCatchParameter: {msg:'Catch clauses should have exactly one argument which will be bound to the error object being thrown'},
|
2153
|
+
CatchParameterNameMayNotBeReserved: {msg:'Catch clause parameter may not be a keyword or reserved word'},
|
2154
|
+
CatchHeaderMissingClose: {msg:'Missing the closing parenthesis of the catch header'},
|
2155
|
+
MissingCatchBlockCurlyOpen: {msg:'Missing the opening curly brace (`{`) for the block of the catch statement'},
|
2156
|
+
MissingCatchBlockCurlyClose: {msg:'Missing the closing curly brace (`}`) for the block of the catch statement'},
|
2157
|
+
MissingFinallyBlockCurlyOpen: {msg:'Missing the opening curly brace (`{`) for the block of the finally statement'},
|
2158
|
+
MissingFinallyBlockCurlyClose: {msg:'Missing the closing curly brace (`}`) for the block of the finally statement'},
|
2159
|
+
StatementMayNotStartWithFunction: {msg:'statements may not start with function...', before:true},
|
2160
|
+
BlockCurlyClose: {msg:'Expected the closing curly (`}`) for a block statement'},
|
2161
|
+
BlockCurlyOpen: {msg:'Expected the closing curly (`}`) for a block statement'},
|
2162
|
+
UnableToParseStatement: {msg:'Was unable to find a statement when it was requested'},
|
2163
|
+
IllegalDoubleCommaInObjectLiteral: {msg:'A double comma in object literals is not allowed'},
|
2164
|
+
ObjectLiteralExpectsColonAfterName: {msg:'After every property name (identifier, string or number) a colon (`:`) should follow'},
|
2165
|
+
ThrowMustHaveArgument: {msg:'The expression argument for throw is not optional'},
|
2166
|
+
ThrowCannotHaveReturn: {msg:'There may not be a return between throw and the start of its expression argument'},
|
2167
|
+
SwitchBodyMustStartWithClause: {msg:'The body of a switch clause must start with at a case or default clause (but may be empty, which would be silly)'},
|
2168
|
+
BreakOrContinueArgMustBeJustIdentifier: {msg:'The argument to a break or continue statement must be exactly and only an identifier (an existing label)'},
|
2169
|
+
AssignmentNotAllowedAfterNonAssignmentInExpression: {msg:'An assignment is not allowed if it is preceeded by a non-expression operator in the same expression-level'},
|
2170
|
+
IllegalLhsForAssignment: {msg:'Illegal left hand side for assignment (you cannot assign to things like string literals, number literals or function calls}'},
|
2171
|
+
VarKeywordMissingName: {msg:'Var keyword should be followed by a variable name'},
|
2172
|
+
IllegalTrailingComma: {msg:'Illegal trailing comma found'},
|
2173
|
+
ObjectLiteralMissingPropertyValue: {msg:'Missing object literal property value'},
|
2174
|
+
TokenizerError: {msg:'Tokenizer encountered unexpected input'},
|
2175
|
+
LabelRequiresStatement: {msg:'Saw a label without the (required) statement following'},
|
2176
|
+
DidNotExpectElseHere: {msg:'Did not expect an else here. To what if should it belong? Maybe you put a ; after the if-block? (if(x){};else{})'},
|
2177
|
+
UnexpectedToken: {msg:'Found an unexpected token and have no idea why'},
|
2178
|
+
InvalidPostfixOperandArray: {msg:'You cannot apply ++ or -- to an array'},
|
2179
|
+
InvalidPostfixOperandObject: {msg:'You cannot apply ++ or -- to an object'},
|
2180
|
+
InvalidPostfixOperandFunction: {msg:'You cannot apply ++ or -- to a function'},
|
2181
|
+
CaseMissingExpression: {msg:'Case expects an expression before the colon'},
|
2182
|
+
TryMustHaveCatchOrFinally: {msg:'The try statement must have a catch or finally block'},
|
2183
|
+
UnexpectedInputSwitch: {msg:'Unexpected input while parsing a switch clause...'},
|
2184
|
+
ForInCanOnlyDeclareOnVar: {msg:'For-in header can only introduce one new variable'}
|
2185
|
+
};
|