snowball 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -13
- data/.gitignore +1 -3
- data/{lib/snowball → bin}/roll.js +0 -0
- data/lib/snowball/roller.rb +1 -1
- data/lib/snowball/version.rb +1 -1
- data/node_modules/.bin/browserify +161 -0
- data/node_modules/.bin/cake +7 -0
- data/node_modules/.bin/coffee +7 -0
- data/node_modules/.bin/jade +168 -0
- data/node_modules/browserify/.travis.yml +4 -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/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 +580 -0
- data/node_modules/browserify/lib/wrappers.js +10 -0
- data/node_modules/browserify/node_modules/buffer-browserify/.npmignore +1 -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 +30 -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 +46 -0
- data/node_modules/browserify/node_modules/buffer-browserify/test/buffer.js +218 -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 +47 -0
- data/node_modules/browserify/node_modules/commondir/test/dirs.js +66 -0
- data/node_modules/browserify/node_modules/crypto-browserify/.travis.yml +4 -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 +33 -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/.travis.yml +4 -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/.npmignore +2 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/.travis.yml +5 -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 +34 -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 +47 -0
- data/node_modules/browserify/node_modules/deputy/test/cache.js +58 -0
- data/node_modules/browserify/node_modules/detective/.travis.yml +4 -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/.bin/esparse +42 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/.travis.yml +5 -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 +42 -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 +47 -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/.npmignore +1 -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/.npmignore +2 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/.travis.yml +4 -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 +59 -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 +30 -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 +46 -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 +46 -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/resolve/.travis.yml +4 -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 +106 -0
- data/node_modules/browserify/node_modules/resolve/package.json +45 -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 +64 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver.js +157 -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/syntax-error/.travis.yml +4 -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/.bin/esparse +42 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/.travis.yml +5 -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 +42 -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 +49 -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 +43 -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 +78 -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.js +39 -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/comment.js +17 -0
- data/node_modules/browserify/test/comment/main.js +2 -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.js +19 -0
- data/node_modules/browserify/test/dollar/dollar/index.js +7 -0
- data/node_modules/browserify/test/entry.js +36 -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/error_code.js +24 -0
- data/node_modules/browserify/test/error_code/src.js +2 -0
- data/node_modules/browserify/test/export.js +52 -0
- data/node_modules/browserify/test/export/entry.js +1 -0
- data/node_modules/browserify/test/field.js +64 -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/global.js +19 -0
- data/node_modules/browserify/test/global/main.js +2 -0
- data/node_modules/browserify/test/jade.js +35 -0
- data/node_modules/browserify/test/json.js +17 -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/maxlisteners.js +8 -0
- data/node_modules/browserify/test/module.js +22 -0
- data/node_modules/browserify/test/multi_entry.js +20 -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_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.js +26 -0
- data/node_modules/browserify/test/subdep/index.js +1 -0
- data/node_modules/browserify/test/subdep/package.json +6 -0
- data/node_modules/browserify/test/util.js +48 -0
- data/node_modules/browserify/test/watch.js +91 -0
- data/node_modules/browserify/test/watch/a.js +1 -0
- data/node_modules/browserify/test/wrap.js +43 -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/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/coffee-script/.npmignore +11 -0
- data/node_modules/coffee-script/CNAME +1 -0
- data/node_modules/coffee-script/CONTRIBUTING.md +9 -0
- data/node_modules/coffee-script/LICENSE +22 -0
- data/node_modules/coffee-script/README +51 -0
- data/node_modules/coffee-script/Rakefile +78 -0
- data/node_modules/coffee-script/bin/cake +7 -0
- data/node_modules/coffee-script/bin/coffee +7 -0
- data/node_modules/coffee-script/extras/jsl.conf +44 -0
- data/node_modules/coffee-script/lib/coffee-script/browser.js +92 -0
- data/node_modules/coffee-script/lib/coffee-script/cake.js +113 -0
- data/node_modules/coffee-script/lib/coffee-script/coffee-script.js +171 -0
- data/node_modules/coffee-script/lib/coffee-script/command.js +502 -0
- data/node_modules/coffee-script/lib/coffee-script/grammar.js +606 -0
- data/node_modules/coffee-script/lib/coffee-script/helpers.js +88 -0
- data/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
- data/node_modules/coffee-script/lib/coffee-script/lexer.js +788 -0
- data/node_modules/coffee-script/lib/coffee-script/nodes.js +2971 -0
- data/node_modules/coffee-script/lib/coffee-script/optparse.js +138 -0
- data/node_modules/coffee-script/lib/coffee-script/parser.js +683 -0
- data/node_modules/coffee-script/lib/coffee-script/repl.js +276 -0
- data/node_modules/coffee-script/lib/coffee-script/rewriter.js +349 -0
- data/node_modules/coffee-script/lib/coffee-script/scope.js +146 -0
- data/node_modules/coffee-script/package.json +50 -0
- data/node_modules/jade-runtime/.npmignore +15 -0
- data/node_modules/jade-runtime/README.md +8 -0
- data/node_modules/jade-runtime/globals.js +32 -0
- data/node_modules/jade-runtime/index.js +2 -0
- data/node_modules/jade-runtime/jade-runtime.js +181 -0
- data/node_modules/jade-runtime/package.json +18 -0
- data/node_modules/jade/.npmignore +14 -0
- data/node_modules/jade/LICENSE +22 -0
- data/node_modules/jade/Readme.md +1299 -0
- data/node_modules/jade/bin/jade +168 -0
- data/node_modules/jade/index.js +4 -0
- data/node_modules/jade/jade.js +3586 -0
- data/node_modules/jade/jade.md +510 -0
- data/node_modules/jade/jade.min.js +2 -0
- data/node_modules/jade/lib/compiler.js +654 -0
- data/node_modules/jade/lib/doctypes.js +18 -0
- data/node_modules/jade/lib/filters.js +97 -0
- data/node_modules/jade/lib/inline-tags.js +28 -0
- data/node_modules/jade/lib/jade.js +253 -0
- data/node_modules/jade/lib/lexer.js +774 -0
- data/node_modules/jade/lib/nodes/attrs.js +77 -0
- data/node_modules/jade/lib/nodes/block-comment.js +33 -0
- data/node_modules/jade/lib/nodes/block.js +122 -0
- data/node_modules/jade/lib/nodes/case.js +43 -0
- data/node_modules/jade/lib/nodes/code.js +35 -0
- data/node_modules/jade/lib/nodes/comment.js +32 -0
- data/node_modules/jade/lib/nodes/doctype.js +29 -0
- data/node_modules/jade/lib/nodes/each.js +35 -0
- data/node_modules/jade/lib/nodes/filter.js +35 -0
- data/node_modules/jade/lib/nodes/index.js +20 -0
- data/node_modules/jade/lib/nodes/literal.js +32 -0
- data/node_modules/jade/lib/nodes/mixin.js +36 -0
- data/node_modules/jade/lib/nodes/node.js +25 -0
- data/node_modules/jade/lib/nodes/tag.js +95 -0
- data/node_modules/jade/lib/nodes/text.js +36 -0
- data/node_modules/jade/lib/parser.js +714 -0
- data/node_modules/jade/lib/runtime.js +174 -0
- data/node_modules/jade/lib/self-closing.js +19 -0
- data/node_modules/jade/lib/utils.js +49 -0
- data/node_modules/jade/node_modules/commander/.npmignore +4 -0
- data/node_modules/jade/node_modules/commander/.travis.yml +4 -0
- data/node_modules/jade/node_modules/commander/History.md +107 -0
- data/node_modules/jade/node_modules/commander/Makefile +7 -0
- data/node_modules/jade/node_modules/commander/Readme.md +262 -0
- data/node_modules/jade/node_modules/commander/index.js +2 -0
- data/node_modules/jade/node_modules/commander/lib/commander.js +1026 -0
- data/node_modules/jade/node_modules/commander/package.json +39 -0
- data/node_modules/jade/node_modules/mkdirp/.npmignore +2 -0
- data/node_modules/jade/node_modules/mkdirp/.travis.yml +4 -0
- data/node_modules/jade/node_modules/mkdirp/LICENSE +21 -0
- data/node_modules/jade/node_modules/mkdirp/README.markdown +61 -0
- data/node_modules/jade/node_modules/mkdirp/examples/pow.js +6 -0
- data/node_modules/jade/node_modules/mkdirp/index.js +82 -0
- data/node_modules/jade/node_modules/mkdirp/package.json +37 -0
- data/node_modules/jade/node_modules/mkdirp/test/chmod.js +38 -0
- data/node_modules/jade/node_modules/mkdirp/test/clobber.js +37 -0
- data/node_modules/jade/node_modules/mkdirp/test/mkdirp.js +28 -0
- data/node_modules/jade/node_modules/mkdirp/test/perm.js +32 -0
- data/node_modules/jade/node_modules/mkdirp/test/perm_sync.js +39 -0
- data/node_modules/jade/node_modules/mkdirp/test/race.js +41 -0
- data/node_modules/jade/node_modules/mkdirp/test/rel.js +32 -0
- data/node_modules/jade/node_modules/mkdirp/test/return.js +25 -0
- data/node_modules/jade/node_modules/mkdirp/test/return_sync.js +24 -0
- data/node_modules/jade/node_modules/mkdirp/test/root.js +18 -0
- data/node_modules/jade/node_modules/mkdirp/test/sync.js +32 -0
- data/node_modules/jade/node_modules/mkdirp/test/umask.js +28 -0
- data/node_modules/jade/node_modules/mkdirp/test/umask_sync.js +32 -0
- data/node_modules/jade/package.json +53 -0
- data/node_modules/jade/runtime.js +179 -0
- data/node_modules/jade/runtime.min.js +1 -0
- data/node_modules/jade/test.jade +7 -0
- data/node_modules/jade/testing/head.jade +5 -0
- data/node_modules/jade/testing/index.jade +1 -0
- data/node_modules/jade/testing/index.js +14 -0
- data/node_modules/jade/testing/layout.jade +10 -0
- data/node_modules/jade/testing/user.jade +7 -0
- data/node_modules/jade/testing/user.js +27 -0
- data/node_modules/optimist/.travis.yml +4 -0
- data/node_modules/optimist/LICENSE +21 -0
- data/node_modules/optimist/README.markdown +487 -0
- data/node_modules/optimist/example/bool.js +10 -0
- data/node_modules/optimist/example/boolean_double.js +7 -0
- data/node_modules/optimist/example/boolean_single.js +7 -0
- data/node_modules/optimist/example/default_hash.js +8 -0
- data/node_modules/optimist/example/default_singles.js +7 -0
- data/node_modules/optimist/example/divide.js +8 -0
- data/node_modules/optimist/example/line_count.js +20 -0
- data/node_modules/optimist/example/line_count_options.js +29 -0
- data/node_modules/optimist/example/line_count_wrap.js +29 -0
- data/node_modules/optimist/example/nonopt.js +4 -0
- data/node_modules/optimist/example/reflect.js +2 -0
- data/node_modules/optimist/example/short.js +3 -0
- data/node_modules/optimist/example/string.js +11 -0
- data/node_modules/optimist/example/usage-options.js +19 -0
- data/node_modules/optimist/example/xup.js +10 -0
- data/node_modules/optimist/index.js +475 -0
- data/node_modules/optimist/node_modules/wordwrap/.npmignore +1 -0
- data/node_modules/optimist/node_modules/wordwrap/README.markdown +70 -0
- data/node_modules/optimist/node_modules/wordwrap/example/center.js +10 -0
- data/node_modules/optimist/node_modules/wordwrap/example/meat.js +3 -0
- data/node_modules/optimist/node_modules/wordwrap/index.js +76 -0
- data/node_modules/optimist/node_modules/wordwrap/package.json +45 -0
- data/node_modules/optimist/node_modules/wordwrap/test/break.js +30 -0
- data/node_modules/optimist/node_modules/wordwrap/test/idleness.txt +63 -0
- data/node_modules/optimist/node_modules/wordwrap/test/wrap.js +31 -0
- data/node_modules/optimist/package.json +55 -0
- data/node_modules/optimist/test/_.js +71 -0
- data/node_modules/optimist/test/_/argv.js +2 -0
- data/node_modules/optimist/test/_/bin.js +3 -0
- data/node_modules/optimist/test/parse.js +420 -0
- data/node_modules/optimist/test/usage.js +292 -0
- data/snowball.gemspec +1 -2
- metadata +601 -21
- data/extconf.rb +0 -9
data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jsparse.js
ADDED
|
@@ -0,0 +1,1921 @@
|
|
|
1
|
+
/* -*- Mode: JS; tab-width: 4; indent-tabs-mode: nil; -*-
|
|
2
|
+
* vim: set sw=4 ts=4 et tw=78:
|
|
3
|
+
* ***** BEGIN LICENSE BLOCK *****
|
|
4
|
+
*
|
|
5
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
6
|
+
*
|
|
7
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
|
8
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
* http://www.mozilla.org/MPL/
|
|
11
|
+
*
|
|
12
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
13
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
14
|
+
* for the specific language governing rights and limitations under the
|
|
15
|
+
* License.
|
|
16
|
+
*
|
|
17
|
+
* The Original Code is the Narcissus JavaScript engine.
|
|
18
|
+
*
|
|
19
|
+
* The Initial Developer of the Original Code is
|
|
20
|
+
* Brendan Eich <brendan@mozilla.org>.
|
|
21
|
+
* Portions created by the Initial Developer are Copyright (C) 2004
|
|
22
|
+
* the Initial Developer. All Rights Reserved.
|
|
23
|
+
*
|
|
24
|
+
* Contributor(s):
|
|
25
|
+
* Tom Austin <taustin@ucsc.edu>
|
|
26
|
+
* Brendan Eich <brendan@mozilla.org>
|
|
27
|
+
* Shu-Yu Guo <shu@rfrn.org>
|
|
28
|
+
* Dave Herman <dherman@mozilla.com>
|
|
29
|
+
* Dimitris Vardoulakis <dimvar@ccs.neu.edu>
|
|
30
|
+
* Patrick Walton <pcwalton@mozilla.com>
|
|
31
|
+
*
|
|
32
|
+
* Alternatively, the contents of this file may be used under the terms of
|
|
33
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
34
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
35
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
36
|
+
* of those above. If you wish to allow use of your version of this file only
|
|
37
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
38
|
+
* use your version of this file under the terms of the MPL, indicate your
|
|
39
|
+
* decision by deleting the provisions above and replace them with the notice
|
|
40
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
41
|
+
* the provisions above, a recipient may use your version of this file under
|
|
42
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
43
|
+
*
|
|
44
|
+
* ***** END LICENSE BLOCK ***** */
|
|
45
|
+
|
|
46
|
+
/*
|
|
47
|
+
* Narcissus - JS implemented in JS.
|
|
48
|
+
*
|
|
49
|
+
* Parser.
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
Narcissus.parser = (function() {
|
|
53
|
+
|
|
54
|
+
var lexer = Narcissus.lexer;
|
|
55
|
+
var definitions = Narcissus.definitions;
|
|
56
|
+
|
|
57
|
+
const StringMap = definitions.StringMap;
|
|
58
|
+
const Stack = definitions.Stack;
|
|
59
|
+
|
|
60
|
+
// Set constants in the local scope.
|
|
61
|
+
eval(definitions.consts);
|
|
62
|
+
|
|
63
|
+
// Banned statement types by language version.
|
|
64
|
+
const blackLists = { 160: {}, 185: {}, harmony: {} };
|
|
65
|
+
blackLists[160][IMPORT] = true;
|
|
66
|
+
blackLists[160][EXPORT] = true;
|
|
67
|
+
blackLists[160][LET] = true;
|
|
68
|
+
blackLists[160][MODULE] = true;
|
|
69
|
+
blackLists[160][YIELD] = true;
|
|
70
|
+
blackLists[185][IMPORT] = true;
|
|
71
|
+
blackLists[185][EXPORT] = true;
|
|
72
|
+
blackLists[185][MODULE] = true;
|
|
73
|
+
blackLists.harmony[WITH] = true;
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
* pushDestructuringVarDecls :: (node, hoisting node) -> void
|
|
77
|
+
*
|
|
78
|
+
* Recursively add all destructured declarations to varDecls.
|
|
79
|
+
*/
|
|
80
|
+
function pushDestructuringVarDecls(n, s) {
|
|
81
|
+
for (var i in n) {
|
|
82
|
+
var sub = n[i];
|
|
83
|
+
if (sub.type === IDENTIFIER) {
|
|
84
|
+
s.varDecls.push(sub);
|
|
85
|
+
} else {
|
|
86
|
+
pushDestructuringVarDecls(sub, s);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function StaticContext(parentScript, parentBlock, inModule, inFunction) {
|
|
92
|
+
this.parentScript = parentScript;
|
|
93
|
+
this.parentBlock = parentBlock || parentScript;
|
|
94
|
+
this.inModule = inModule || false;
|
|
95
|
+
this.inFunction = inFunction || false;
|
|
96
|
+
this.inForLoopInit = false;
|
|
97
|
+
this.topLevel = true;
|
|
98
|
+
this.allLabels = new Stack();
|
|
99
|
+
this.currentLabels = new Stack();
|
|
100
|
+
this.labeledTargets = new Stack();
|
|
101
|
+
this.defaultLoopTarget = null;
|
|
102
|
+
this.defaultTarget = null;
|
|
103
|
+
this.blackList = blackLists[Narcissus.options.version];
|
|
104
|
+
Narcissus.options.ecma3OnlyMode && (this.ecma3OnlyMode = true);
|
|
105
|
+
Narcissus.options.parenFreeMode && (this.parenFreeMode = true);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
StaticContext.prototype = {
|
|
109
|
+
ecma3OnlyMode: false,
|
|
110
|
+
parenFreeMode: false,
|
|
111
|
+
// non-destructive update via prototype extension
|
|
112
|
+
update: function(ext) {
|
|
113
|
+
var desc = {};
|
|
114
|
+
for (var key in ext) {
|
|
115
|
+
desc[key] = {
|
|
116
|
+
value: ext[key],
|
|
117
|
+
writable: true,
|
|
118
|
+
enumerable: true,
|
|
119
|
+
configurable: true
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return Object.create(this, desc);
|
|
123
|
+
},
|
|
124
|
+
pushLabel: function(label) {
|
|
125
|
+
return this.update({ currentLabels: this.currentLabels.push(label),
|
|
126
|
+
allLabels: this.allLabels.push(label) });
|
|
127
|
+
},
|
|
128
|
+
pushTarget: function(target) {
|
|
129
|
+
var isDefaultLoopTarget = target.isLoop;
|
|
130
|
+
var isDefaultTarget = isDefaultLoopTarget || target.type === SWITCH;
|
|
131
|
+
|
|
132
|
+
if (this.currentLabels.isEmpty()) {
|
|
133
|
+
if (isDefaultLoopTarget) this.update({ defaultLoopTarget: target });
|
|
134
|
+
if (isDefaultTarget) this.update({ defaultTarget: target });
|
|
135
|
+
return this;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
target.labels = new StringMap();
|
|
139
|
+
this.currentLabels.forEach(function(label) {
|
|
140
|
+
target.labels.set(label, true);
|
|
141
|
+
});
|
|
142
|
+
return this.update({ currentLabels: new Stack(),
|
|
143
|
+
labeledTargets: this.labeledTargets.push(target),
|
|
144
|
+
defaultLoopTarget: isDefaultLoopTarget
|
|
145
|
+
? target
|
|
146
|
+
: this.defaultLoopTarget,
|
|
147
|
+
defaultTarget: isDefaultTarget
|
|
148
|
+
? target
|
|
149
|
+
: this.defaultTarget });
|
|
150
|
+
},
|
|
151
|
+
nest: function() {
|
|
152
|
+
return this.topLevel ? this.update({ topLevel: false }) : this;
|
|
153
|
+
},
|
|
154
|
+
allow: function(type) {
|
|
155
|
+
switch (type) {
|
|
156
|
+
case EXPORT:
|
|
157
|
+
if (!this.inModule || this.inFunction || !this.topLevel)
|
|
158
|
+
return false;
|
|
159
|
+
// FALL THROUGH
|
|
160
|
+
|
|
161
|
+
case IMPORT:
|
|
162
|
+
return !this.inFunction && this.topLevel;
|
|
163
|
+
|
|
164
|
+
case MODULE:
|
|
165
|
+
return !this.inFunction && this.topLevel;
|
|
166
|
+
|
|
167
|
+
default:
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
/*
|
|
174
|
+
* Script :: (tokenizer, boolean, boolean) -> node
|
|
175
|
+
*
|
|
176
|
+
* Parses the toplevel and module/function bodies.
|
|
177
|
+
*/
|
|
178
|
+
function Script(t, inModule, inFunction) {
|
|
179
|
+
var n = new Node(t, scriptInit());
|
|
180
|
+
Statements(t, new StaticContext(n, n, inModule, inFunction), n);
|
|
181
|
+
return n;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// We extend Array slightly with a top-of-stack method.
|
|
185
|
+
definitions.defineProperty(Array.prototype, "top",
|
|
186
|
+
function() {
|
|
187
|
+
return this.length && this[this.length-1];
|
|
188
|
+
}, false, false, true);
|
|
189
|
+
|
|
190
|
+
/*
|
|
191
|
+
* Node :: (tokenizer, optional init object) -> node
|
|
192
|
+
*/
|
|
193
|
+
function Node(t, init) {
|
|
194
|
+
var token = t.token;
|
|
195
|
+
if (token) {
|
|
196
|
+
// If init.type exists it will override token.type.
|
|
197
|
+
this.type = token.type;
|
|
198
|
+
this.value = token.value;
|
|
199
|
+
this.lineno = token.lineno;
|
|
200
|
+
|
|
201
|
+
// Start and end are file positions for error handling.
|
|
202
|
+
this.start = token.start;
|
|
203
|
+
this.end = token.end;
|
|
204
|
+
} else {
|
|
205
|
+
this.lineno = t.lineno;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Node uses a tokenizer for debugging (getSource, filename getter).
|
|
209
|
+
this.tokenizer = t;
|
|
210
|
+
this.children = [];
|
|
211
|
+
|
|
212
|
+
for (var prop in init)
|
|
213
|
+
this[prop] = init[prop];
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/*
|
|
217
|
+
* SyntheticNode :: (tokenizer, optional init object) -> node
|
|
218
|
+
*/
|
|
219
|
+
function SyntheticNode(t, init) {
|
|
220
|
+
// print("SYNTHETIC NODE");
|
|
221
|
+
// if (init.type === COMMA) {
|
|
222
|
+
// print("SYNTHETIC COMMA");
|
|
223
|
+
// print(init);
|
|
224
|
+
// }
|
|
225
|
+
this.tokenizer = t;
|
|
226
|
+
this.children = [];
|
|
227
|
+
for (var prop in init)
|
|
228
|
+
this[prop] = init[prop];
|
|
229
|
+
this.synthetic = true;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
var Np = Node.prototype = SyntheticNode.prototype = {};
|
|
233
|
+
Np.constructor = Node;
|
|
234
|
+
|
|
235
|
+
const TO_SOURCE_SKIP = {
|
|
236
|
+
type: true,
|
|
237
|
+
value: true,
|
|
238
|
+
lineno: true,
|
|
239
|
+
start: true,
|
|
240
|
+
end: true,
|
|
241
|
+
tokenizer: true,
|
|
242
|
+
assignOp: true
|
|
243
|
+
};
|
|
244
|
+
function unevalableConst(code) {
|
|
245
|
+
var token = definitions.tokens[code];
|
|
246
|
+
var constName = definitions.opTypeNames.hasOwnProperty(token)
|
|
247
|
+
? definitions.opTypeNames[token]
|
|
248
|
+
: token in definitions.keywords
|
|
249
|
+
? token.toUpperCase()
|
|
250
|
+
: token;
|
|
251
|
+
return { toSource: function() { return constName } };
|
|
252
|
+
}
|
|
253
|
+
Np.toSource = function toSource() {
|
|
254
|
+
var mock = {};
|
|
255
|
+
var self = this;
|
|
256
|
+
mock.type = unevalableConst(this.type);
|
|
257
|
+
// avoid infinite recursion in case of back-links
|
|
258
|
+
if (this.generatingSource)
|
|
259
|
+
return mock.toSource();
|
|
260
|
+
this.generatingSource = true;
|
|
261
|
+
if ("value" in this)
|
|
262
|
+
mock.value = this.value;
|
|
263
|
+
if ("lineno" in this)
|
|
264
|
+
mock.lineno = this.lineno;
|
|
265
|
+
if ("start" in this)
|
|
266
|
+
mock.start = this.start;
|
|
267
|
+
if ("end" in this)
|
|
268
|
+
mock.end = this.end;
|
|
269
|
+
if (this.assignOp)
|
|
270
|
+
mock.assignOp = unevalableConst(this.assignOp);
|
|
271
|
+
for (var key in this) {
|
|
272
|
+
if (this.hasOwnProperty(key) && !(key in TO_SOURCE_SKIP))
|
|
273
|
+
mock[key] = this[key];
|
|
274
|
+
}
|
|
275
|
+
try {
|
|
276
|
+
return mock.toSource();
|
|
277
|
+
} finally {
|
|
278
|
+
delete this.generatingSource;
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
// Always use push to add operands to an expression, to update start and end.
|
|
283
|
+
Np.push = function (kid) {
|
|
284
|
+
// kid can be null e.g. [1, , 2].
|
|
285
|
+
if (kid !== null) {
|
|
286
|
+
if (kid.start < this.start)
|
|
287
|
+
this.start = kid.start;
|
|
288
|
+
if (this.end < kid.end)
|
|
289
|
+
this.end = kid.end;
|
|
290
|
+
}
|
|
291
|
+
return this.children.push(kid);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
Node.indentLevel = 0;
|
|
295
|
+
|
|
296
|
+
function tokenString(tt) {
|
|
297
|
+
var t = definitions.tokens[tt];
|
|
298
|
+
return /^\W/.test(t) ? definitions.opTypeNames[t] : t.toUpperCase();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
Np.toString = function () {
|
|
302
|
+
var a = [];
|
|
303
|
+
for (var i in this) {
|
|
304
|
+
if (this.hasOwnProperty(i) && i !== 'type' && i !== 'target')
|
|
305
|
+
a.push({id: i, value: this[i]});
|
|
306
|
+
}
|
|
307
|
+
a.sort(function (a,b) { return (a.id < b.id) ? -1 : 1; });
|
|
308
|
+
const INDENTATION = " ";
|
|
309
|
+
var n = ++Node.indentLevel;
|
|
310
|
+
var s = "{\n" + INDENTATION.repeat(n) + "type: " + tokenString(this.type);
|
|
311
|
+
for (i = 0; i < a.length; i++)
|
|
312
|
+
s += ",\n" + INDENTATION.repeat(n) + a[i].id + ": " + a[i].value;
|
|
313
|
+
n = --Node.indentLevel;
|
|
314
|
+
s += "\n" + INDENTATION.repeat(n) + "}";
|
|
315
|
+
return s;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
Np.getSource = function () {
|
|
319
|
+
return this.tokenizer.source.slice(this.start, this.end);
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
Np.synth = function(init) {
|
|
323
|
+
var node = new SyntheticNode(this.tokenizer, init);
|
|
324
|
+
node.filename = this.filename;
|
|
325
|
+
node.lineno = this.lineno;
|
|
326
|
+
node.start = this.start;
|
|
327
|
+
node.end = this.end;
|
|
328
|
+
return node;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
/*
|
|
332
|
+
* Helper init objects for common nodes.
|
|
333
|
+
*/
|
|
334
|
+
|
|
335
|
+
const LOOP_INIT = { isLoop: true };
|
|
336
|
+
|
|
337
|
+
function blockInit() {
|
|
338
|
+
return { type: BLOCK, varDecls: [] };
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function scriptInit() {
|
|
342
|
+
return { type: SCRIPT,
|
|
343
|
+
funDecls: [],
|
|
344
|
+
varDecls: [],
|
|
345
|
+
modDefns: new StringMap(),
|
|
346
|
+
modAssns: new StringMap(),
|
|
347
|
+
modDecls: new StringMap(),
|
|
348
|
+
modLoads: new StringMap(),
|
|
349
|
+
impDecls: [],
|
|
350
|
+
expDecls: [],
|
|
351
|
+
exports: new StringMap(),
|
|
352
|
+
hasEmptyReturn: false,
|
|
353
|
+
hasReturnWithValue: false,
|
|
354
|
+
isGenerator: false };
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
definitions.defineGetter(Np, "filename",
|
|
358
|
+
function() {
|
|
359
|
+
return this.tokenizer.filename;
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
definitions.defineGetter(Np, "length",
|
|
363
|
+
function() {
|
|
364
|
+
throw new Error("Node.prototype.length is gone; " +
|
|
365
|
+
"use n.children.length instead");
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
definitions.defineProperty(String.prototype, "repeat",
|
|
369
|
+
function(n) {
|
|
370
|
+
var s = "", t = this + s;
|
|
371
|
+
while (--n >= 0)
|
|
372
|
+
s += t;
|
|
373
|
+
return s;
|
|
374
|
+
}, false, false, true);
|
|
375
|
+
|
|
376
|
+
function MaybeLeftParen(t, x) {
|
|
377
|
+
if (x.parenFreeMode)
|
|
378
|
+
return t.match(LEFT_PAREN) ? LEFT_PAREN : END;
|
|
379
|
+
return t.mustMatch(LEFT_PAREN).type;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
function MaybeRightParen(t, p) {
|
|
383
|
+
if (p === LEFT_PAREN)
|
|
384
|
+
t.mustMatch(RIGHT_PAREN);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/*
|
|
388
|
+
* Statements :: (tokenizer, compiler context, node) -> void
|
|
389
|
+
*
|
|
390
|
+
* Parses a sequence of Statements.
|
|
391
|
+
*/
|
|
392
|
+
function Statements(t, x, n) {
|
|
393
|
+
try {
|
|
394
|
+
while (!t.done && t.peek(true) !== RIGHT_CURLY)
|
|
395
|
+
n.push(Statement(t, x));
|
|
396
|
+
} catch (e) {
|
|
397
|
+
if (t.done)
|
|
398
|
+
t.unexpectedEOF = true;
|
|
399
|
+
throw e;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function Block(t, x) {
|
|
404
|
+
t.mustMatch(LEFT_CURLY);
|
|
405
|
+
var n = new Node(t, blockInit());
|
|
406
|
+
Statements(t, x.update({ parentBlock: n }).pushTarget(n), n);
|
|
407
|
+
t.mustMatch(RIGHT_CURLY);
|
|
408
|
+
return n;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
const DECLARED_FORM = 0, EXPRESSED_FORM = 1, STATEMENT_FORM = 2;
|
|
412
|
+
|
|
413
|
+
/*
|
|
414
|
+
* Export :: (binding node, boolean) -> Export
|
|
415
|
+
*
|
|
416
|
+
* Static semantic representation of a module export.
|
|
417
|
+
*/
|
|
418
|
+
function Export(node, isDefinition) {
|
|
419
|
+
this.node = node; // the AST node declaring this individual export
|
|
420
|
+
this.isDefinition = isDefinition; // is the node an 'export'-annotated definition?
|
|
421
|
+
this.resolved = null; // resolved pointer to the target of this export
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/*
|
|
425
|
+
* registerExport :: (StringMap, EXPORT node) -> void
|
|
426
|
+
*/
|
|
427
|
+
function registerExport(exports, decl) {
|
|
428
|
+
function register(name, exp) {
|
|
429
|
+
if (exports.has(name))
|
|
430
|
+
throw new SyntaxError("multiple exports of " + name);
|
|
431
|
+
exports.set(name, exp);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
switch (decl.type) {
|
|
435
|
+
case MODULE:
|
|
436
|
+
case FUNCTION:
|
|
437
|
+
register(decl.name, new Export(decl, true));
|
|
438
|
+
break;
|
|
439
|
+
|
|
440
|
+
case VAR:
|
|
441
|
+
for (var i = 0; i < decl.children.length; i++)
|
|
442
|
+
register(decl.children[i].name, new Export(decl.children[i], true));
|
|
443
|
+
break;
|
|
444
|
+
|
|
445
|
+
case LET:
|
|
446
|
+
case CONST:
|
|
447
|
+
throw new Error("NYI: " + definitions.tokens[decl.type]);
|
|
448
|
+
|
|
449
|
+
case EXPORT:
|
|
450
|
+
for (var i = 0; i < decl.pathList.length; i++) {
|
|
451
|
+
var path = decl.pathList[i];
|
|
452
|
+
switch (path.type) {
|
|
453
|
+
case OBJECT_INIT:
|
|
454
|
+
for (var j = 0; j < path.children.length; j++) {
|
|
455
|
+
// init :: IDENTIFIER | PROPERTY_INIT
|
|
456
|
+
var init = path.children[j];
|
|
457
|
+
if (init.type === IDENTIFIER)
|
|
458
|
+
register(init.value, new Export(init, false));
|
|
459
|
+
else
|
|
460
|
+
register(init.children[0].value, new Export(init.children[1], false));
|
|
461
|
+
}
|
|
462
|
+
break;
|
|
463
|
+
|
|
464
|
+
case DOT:
|
|
465
|
+
register(path.children[1].value, new Export(path, false));
|
|
466
|
+
break;
|
|
467
|
+
|
|
468
|
+
case IDENTIFIER:
|
|
469
|
+
register(path.value, new Export(path, false));
|
|
470
|
+
break;
|
|
471
|
+
|
|
472
|
+
default:
|
|
473
|
+
throw new Error("unexpected export path: " + definitions.tokens[path.type]);
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
break;
|
|
477
|
+
|
|
478
|
+
default:
|
|
479
|
+
throw new Error("unexpected export decl: " + definitions.tokens[exp.type]);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
/*
|
|
484
|
+
* Module :: (node) -> Module
|
|
485
|
+
*
|
|
486
|
+
* Static semantic representation of a module.
|
|
487
|
+
*/
|
|
488
|
+
function Module(node) {
|
|
489
|
+
var exports = node.body.exports;
|
|
490
|
+
var modDefns = node.body.modDefns;
|
|
491
|
+
|
|
492
|
+
var exportedModules = new StringMap();
|
|
493
|
+
|
|
494
|
+
exports.forEach(function(name, exp) {
|
|
495
|
+
var node = exp.node;
|
|
496
|
+
if (node.type === MODULE) {
|
|
497
|
+
exportedModules.set(name, node);
|
|
498
|
+
} else if (!exp.isDefinition && node.type === IDENTIFIER && modDefns.has(node.value)) {
|
|
499
|
+
var mod = modDefns.get(node.value);
|
|
500
|
+
exportedModules.set(name, mod);
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
this.node = node;
|
|
505
|
+
this.exports = exports;
|
|
506
|
+
this.exportedModules = exportedModules;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/*
|
|
510
|
+
* Statement :: (tokenizer, compiler context) -> node
|
|
511
|
+
*
|
|
512
|
+
* Parses a Statement.
|
|
513
|
+
*/
|
|
514
|
+
function Statement(t, x) {
|
|
515
|
+
var i, label, n, n2, p, c, ss, tt = t.get(true), tt2, x2, x3;
|
|
516
|
+
|
|
517
|
+
var comments = t.blockComments;
|
|
518
|
+
|
|
519
|
+
if (x.blackList[tt])
|
|
520
|
+
throw t.newSyntaxError(definitions.tokens[tt] + " statements only allowed in Harmony");
|
|
521
|
+
if (!x.allow(tt))
|
|
522
|
+
throw t.newSyntaxError(definitions.tokens[tt] + " statement in illegal context");
|
|
523
|
+
|
|
524
|
+
// Cases for statements ending in a right curly return early, avoiding the
|
|
525
|
+
// common semicolon insertion magic after this switch.
|
|
526
|
+
switch (tt) {
|
|
527
|
+
case IMPORT:
|
|
528
|
+
n = new Node(t);
|
|
529
|
+
n.pathList = ImportPathList(t, x);
|
|
530
|
+
x.parentScript.impDecls.push(n);
|
|
531
|
+
break;
|
|
532
|
+
|
|
533
|
+
case EXPORT:
|
|
534
|
+
switch (t.peek()) {
|
|
535
|
+
case MODULE:
|
|
536
|
+
case FUNCTION:
|
|
537
|
+
case LET:
|
|
538
|
+
case VAR:
|
|
539
|
+
case CONST:
|
|
540
|
+
n = Statement(t, x);
|
|
541
|
+
n.blockComments = comments;
|
|
542
|
+
n.exported = true;
|
|
543
|
+
x.parentScript.expDecls.push(n);
|
|
544
|
+
registerExport(x.parentScript.exports, n);
|
|
545
|
+
return n;
|
|
546
|
+
|
|
547
|
+
default:
|
|
548
|
+
n = new Node(t);
|
|
549
|
+
n.pathList = ExportPathList(t, x);
|
|
550
|
+
break;
|
|
551
|
+
}
|
|
552
|
+
x.parentScript.expDecls.push(n);
|
|
553
|
+
registerExport(x.parentScript.exports, n);
|
|
554
|
+
break;
|
|
555
|
+
|
|
556
|
+
case MODULE:
|
|
557
|
+
n = new Node(t);
|
|
558
|
+
n.blockComments = comments;
|
|
559
|
+
t.mustMatch(IDENTIFIER);
|
|
560
|
+
label = t.token.value;
|
|
561
|
+
|
|
562
|
+
if (t.match(LEFT_CURLY)) {
|
|
563
|
+
n.name = label;
|
|
564
|
+
n.body = Script(t, true, false);
|
|
565
|
+
n.module = new Module(n);
|
|
566
|
+
t.mustMatch(RIGHT_CURLY);
|
|
567
|
+
x.parentScript.modDefns.set(n.name, n);
|
|
568
|
+
return n;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
t.unget();
|
|
572
|
+
ModuleVariables(t, x, n);
|
|
573
|
+
return n;
|
|
574
|
+
|
|
575
|
+
case FUNCTION:
|
|
576
|
+
// DECLARED_FORM extends funDecls of x, STATEMENT_FORM doesn't.
|
|
577
|
+
return FunctionDefinition(t, x, true, x.topLevel ? DECLARED_FORM : STATEMENT_FORM, comments);
|
|
578
|
+
|
|
579
|
+
case LEFT_CURLY:
|
|
580
|
+
n = new Node(t, blockInit());
|
|
581
|
+
Statements(t, x.update({ parentBlock: n }).pushTarget(n).nest(), n);
|
|
582
|
+
t.mustMatch(RIGHT_CURLY);
|
|
583
|
+
return n;
|
|
584
|
+
|
|
585
|
+
case IF:
|
|
586
|
+
n = new Node(t);
|
|
587
|
+
n.condition = HeadExpression(t, x);
|
|
588
|
+
x2 = x.pushTarget(n).nest();
|
|
589
|
+
n.thenPart = Statement(t, x2);
|
|
590
|
+
n.elsePart = t.match(ELSE, true) ? Statement(t, x2) : null;
|
|
591
|
+
return n;
|
|
592
|
+
|
|
593
|
+
case SWITCH:
|
|
594
|
+
// This allows CASEs after a DEFAULT, which is in the standard.
|
|
595
|
+
n = new Node(t, { cases: [], defaultIndex: -1 });
|
|
596
|
+
n.discriminant = HeadExpression(t, x);
|
|
597
|
+
x2 = x.pushTarget(n).nest();
|
|
598
|
+
t.mustMatch(LEFT_CURLY);
|
|
599
|
+
while ((tt = t.get()) !== RIGHT_CURLY) {
|
|
600
|
+
switch (tt) {
|
|
601
|
+
case DEFAULT:
|
|
602
|
+
if (n.defaultIndex >= 0)
|
|
603
|
+
throw t.newSyntaxError("More than one switch default");
|
|
604
|
+
// FALL THROUGH
|
|
605
|
+
case CASE:
|
|
606
|
+
n2 = new Node(t);
|
|
607
|
+
if (tt === DEFAULT)
|
|
608
|
+
n.defaultIndex = n.cases.length;
|
|
609
|
+
else
|
|
610
|
+
n2.caseLabel = Expression(t, x2, COLON);
|
|
611
|
+
break;
|
|
612
|
+
|
|
613
|
+
default:
|
|
614
|
+
throw t.newSyntaxError("Invalid switch case");
|
|
615
|
+
}
|
|
616
|
+
t.mustMatch(COLON);
|
|
617
|
+
n2.statements = new Node(t, blockInit());
|
|
618
|
+
while ((tt=t.peek(true)) !== CASE && tt !== DEFAULT &&
|
|
619
|
+
tt !== RIGHT_CURLY)
|
|
620
|
+
n2.statements.push(Statement(t, x2));
|
|
621
|
+
n.cases.push(n2);
|
|
622
|
+
}
|
|
623
|
+
return n;
|
|
624
|
+
|
|
625
|
+
case FOR:
|
|
626
|
+
n = new Node(t, LOOP_INIT);
|
|
627
|
+
n.blockComments = comments;
|
|
628
|
+
if (t.match(IDENTIFIER)) {
|
|
629
|
+
if (t.token.value === "each")
|
|
630
|
+
n.isEach = true;
|
|
631
|
+
else
|
|
632
|
+
t.unget();
|
|
633
|
+
}
|
|
634
|
+
if (!x.parenFreeMode)
|
|
635
|
+
t.mustMatch(LEFT_PAREN);
|
|
636
|
+
x2 = x.pushTarget(n).nest();
|
|
637
|
+
x3 = x.update({ inForLoopInit: true });
|
|
638
|
+
n2 = null;
|
|
639
|
+
if ((tt = t.peek(true)) !== SEMICOLON) {
|
|
640
|
+
if (tt === VAR || tt === CONST) {
|
|
641
|
+
t.get();
|
|
642
|
+
n2 = Variables(t, x3);
|
|
643
|
+
} else if (tt === LET) {
|
|
644
|
+
t.get();
|
|
645
|
+
if (t.peek() === LEFT_PAREN) {
|
|
646
|
+
n2 = LetBlock(t, x3, false);
|
|
647
|
+
} else {
|
|
648
|
+
// Let in for head, we need to add an implicit block
|
|
649
|
+
// around the rest of the for.
|
|
650
|
+
x3.parentBlock = n;
|
|
651
|
+
n.varDecls = [];
|
|
652
|
+
n2 = Variables(t, x3);
|
|
653
|
+
}
|
|
654
|
+
} else {
|
|
655
|
+
n2 = Expression(t, x3);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
if (n2 && t.match(IN)) {
|
|
659
|
+
n.type = FOR_IN;
|
|
660
|
+
n.object = Expression(t, x3);
|
|
661
|
+
if (n2.type === VAR || n2.type === LET) {
|
|
662
|
+
c = n2.children;
|
|
663
|
+
|
|
664
|
+
// Destructuring turns one decl into multiples, so either
|
|
665
|
+
// there must be only one destructuring or only one
|
|
666
|
+
// decl.
|
|
667
|
+
if (c.length !== 1 && n2.destructurings.length !== 1) {
|
|
668
|
+
throw new SyntaxError("Invalid for..in left-hand side",
|
|
669
|
+
t.filename, n2.lineno);
|
|
670
|
+
}
|
|
671
|
+
if (n2.destructurings.length > 0) {
|
|
672
|
+
n.iterator = n2.destructurings[0];
|
|
673
|
+
} else {
|
|
674
|
+
n.iterator = c[0];
|
|
675
|
+
}
|
|
676
|
+
n.varDecl = n2;
|
|
677
|
+
} else {
|
|
678
|
+
if (n2.type === ARRAY_INIT || n2.type === OBJECT_INIT) {
|
|
679
|
+
n2.destructuredNames = checkDestructuring(t, x3, n2);
|
|
680
|
+
}
|
|
681
|
+
n.iterator = n2;
|
|
682
|
+
}
|
|
683
|
+
} else {
|
|
684
|
+
x3.inForLoopInit = false;
|
|
685
|
+
n.setup = n2;
|
|
686
|
+
t.mustMatch(SEMICOLON);
|
|
687
|
+
if (n.isEach)
|
|
688
|
+
throw t.newSyntaxError("Invalid for each..in loop");
|
|
689
|
+
n.condition = (t.peek(true) === SEMICOLON)
|
|
690
|
+
? null
|
|
691
|
+
: Expression(t, x3);
|
|
692
|
+
t.mustMatch(SEMICOLON);
|
|
693
|
+
tt2 = t.peek(true);
|
|
694
|
+
n.update = (x.parenFreeMode
|
|
695
|
+
? tt2 === LEFT_CURLY || definitions.isStatementStartCode[tt2]
|
|
696
|
+
: tt2 === RIGHT_PAREN)
|
|
697
|
+
? null
|
|
698
|
+
: Expression(t, x3);
|
|
699
|
+
}
|
|
700
|
+
if (!x.parenFreeMode)
|
|
701
|
+
t.mustMatch(RIGHT_PAREN);
|
|
702
|
+
n.body = Statement(t, x2);
|
|
703
|
+
return n;
|
|
704
|
+
|
|
705
|
+
case WHILE:
|
|
706
|
+
n = new Node(t, { isLoop: true });
|
|
707
|
+
n.blockComments = comments;
|
|
708
|
+
n.condition = HeadExpression(t, x);
|
|
709
|
+
n.body = Statement(t, x.pushTarget(n).nest());
|
|
710
|
+
return n;
|
|
711
|
+
|
|
712
|
+
case DO:
|
|
713
|
+
n = new Node(t, { isLoop: true });
|
|
714
|
+
n.blockComments = comments;
|
|
715
|
+
n.body = Statement(t, x.pushTarget(n).nest());
|
|
716
|
+
t.mustMatch(WHILE);
|
|
717
|
+
n.condition = HeadExpression(t, x);
|
|
718
|
+
if (!x.ecmaStrictMode) {
|
|
719
|
+
// <script language="JavaScript"> (without version hints) may need
|
|
720
|
+
// automatic semicolon insertion without a newline after do-while.
|
|
721
|
+
// See http://bugzilla.mozilla.org/show_bug.cgi?id=238945.
|
|
722
|
+
t.match(SEMICOLON);
|
|
723
|
+
return n;
|
|
724
|
+
}
|
|
725
|
+
break;
|
|
726
|
+
|
|
727
|
+
case BREAK:
|
|
728
|
+
case CONTINUE:
|
|
729
|
+
n = new Node(t);
|
|
730
|
+
n.blockComments = comments;
|
|
731
|
+
|
|
732
|
+
// handle the |foo: break foo;| corner case
|
|
733
|
+
x2 = x.pushTarget(n);
|
|
734
|
+
|
|
735
|
+
if (t.peekOnSameLine() === IDENTIFIER) {
|
|
736
|
+
t.get();
|
|
737
|
+
n.label = t.token.value;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
if (n.label) {
|
|
741
|
+
n.target = x2.labeledTargets.find(function(target) { return target.labels.has(n.label) });
|
|
742
|
+
} else if (tt === CONTINUE) {
|
|
743
|
+
n.target = x2.defaultLoopTarget;
|
|
744
|
+
} else {
|
|
745
|
+
n.target = x2.defaultTarget;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
if (!n.target)
|
|
749
|
+
throw t.newSyntaxError("Invalid " + ((tt === BREAK) ? "break" : "continue"));
|
|
750
|
+
if (!n.target.isLoop && tt === CONTINUE)
|
|
751
|
+
throw t.newSyntaxError("Invalid continue");
|
|
752
|
+
|
|
753
|
+
break;
|
|
754
|
+
|
|
755
|
+
case TRY:
|
|
756
|
+
n = new Node(t, { catchClauses: [] });
|
|
757
|
+
n.blockComments = comments;
|
|
758
|
+
n.tryBlock = Block(t, x);
|
|
759
|
+
while (t.match(CATCH)) {
|
|
760
|
+
n2 = new Node(t);
|
|
761
|
+
p = MaybeLeftParen(t, x);
|
|
762
|
+
switch (t.get()) {
|
|
763
|
+
case LEFT_BRACKET:
|
|
764
|
+
case LEFT_CURLY:
|
|
765
|
+
// Destructured catch identifiers.
|
|
766
|
+
t.unget();
|
|
767
|
+
n2.varName = DestructuringExpression(t, x, true);
|
|
768
|
+
break;
|
|
769
|
+
case IDENTIFIER:
|
|
770
|
+
n2.varName = t.token.value;
|
|
771
|
+
break;
|
|
772
|
+
default:
|
|
773
|
+
throw t.newSyntaxError("missing identifier in catch");
|
|
774
|
+
break;
|
|
775
|
+
}
|
|
776
|
+
if (t.match(IF)) {
|
|
777
|
+
if (x.ecma3OnlyMode)
|
|
778
|
+
throw t.newSyntaxError("Illegal catch guard");
|
|
779
|
+
if (n.catchClauses.length && !n.catchClauses.top().guard)
|
|
780
|
+
throw t.newSyntaxError("Guarded catch after unguarded");
|
|
781
|
+
n2.guard = Expression(t, x);
|
|
782
|
+
}
|
|
783
|
+
MaybeRightParen(t, p);
|
|
784
|
+
n2.block = Block(t, x);
|
|
785
|
+
n.catchClauses.push(n2);
|
|
786
|
+
}
|
|
787
|
+
if (t.match(FINALLY))
|
|
788
|
+
n.finallyBlock = Block(t, x);
|
|
789
|
+
if (!n.catchClauses.length && !n.finallyBlock)
|
|
790
|
+
throw t.newSyntaxError("Invalid try statement");
|
|
791
|
+
return n;
|
|
792
|
+
|
|
793
|
+
case CATCH:
|
|
794
|
+
case FINALLY:
|
|
795
|
+
throw t.newSyntaxError(definitions.tokens[tt] + " without preceding try");
|
|
796
|
+
|
|
797
|
+
case THROW:
|
|
798
|
+
n = new Node(t);
|
|
799
|
+
n.exception = Expression(t, x);
|
|
800
|
+
break;
|
|
801
|
+
|
|
802
|
+
case RETURN:
|
|
803
|
+
n = ReturnOrYield(t, x);
|
|
804
|
+
break;
|
|
805
|
+
|
|
806
|
+
case WITH:
|
|
807
|
+
n = new Node(t);
|
|
808
|
+
n.blockComments = comments;
|
|
809
|
+
n.object = HeadExpression(t, x);
|
|
810
|
+
n.body = Statement(t, x.pushTarget(n).nest());
|
|
811
|
+
return n;
|
|
812
|
+
|
|
813
|
+
case VAR:
|
|
814
|
+
case CONST:
|
|
815
|
+
n = Variables(t, x);
|
|
816
|
+
break;
|
|
817
|
+
|
|
818
|
+
case LET:
|
|
819
|
+
if (t.peek() === LEFT_PAREN)
|
|
820
|
+
n = LetBlock(t, x, true);
|
|
821
|
+
else
|
|
822
|
+
n = Variables(t, x);
|
|
823
|
+
break;
|
|
824
|
+
|
|
825
|
+
case DEBUGGER:
|
|
826
|
+
n = new Node(t);
|
|
827
|
+
break;
|
|
828
|
+
|
|
829
|
+
case NEWLINE:
|
|
830
|
+
case SEMICOLON:
|
|
831
|
+
n = new Node(t, { type: SEMICOLON });
|
|
832
|
+
n.blockComments = comments;
|
|
833
|
+
n.expression = null;
|
|
834
|
+
return n;
|
|
835
|
+
|
|
836
|
+
default:
|
|
837
|
+
if (tt === IDENTIFIER) {
|
|
838
|
+
tt = t.peek();
|
|
839
|
+
// Labeled statement.
|
|
840
|
+
if (tt === COLON) {
|
|
841
|
+
label = t.token.value;
|
|
842
|
+
if (x.allLabels.has(label))
|
|
843
|
+
throw t.newSyntaxError("Duplicate label");
|
|
844
|
+
t.get();
|
|
845
|
+
n = new Node(t, { type: LABEL, label: label });
|
|
846
|
+
n.blockComments = comments;
|
|
847
|
+
n.statement = Statement(t, x.pushLabel(label).nest());
|
|
848
|
+
n.target = (n.statement.type === LABEL) ? n.statement.target : n.statement;
|
|
849
|
+
return n;
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// Expression statement.
|
|
854
|
+
// We unget the current token to parse the expression as a whole.
|
|
855
|
+
n = new Node(t, { type: SEMICOLON });
|
|
856
|
+
t.unget();
|
|
857
|
+
n.blockComments = comments;
|
|
858
|
+
n.expression = Expression(t, x);
|
|
859
|
+
n.end = n.expression.end;
|
|
860
|
+
break;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
n.blockComments = comments;
|
|
864
|
+
MagicalSemicolon(t);
|
|
865
|
+
return n;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
/*
|
|
869
|
+
* MagicalSemicolon :: (tokenizer) -> void
|
|
870
|
+
*/
|
|
871
|
+
function MagicalSemicolon(t) {
|
|
872
|
+
var tt;
|
|
873
|
+
if (t.lineno === t.token.lineno) {
|
|
874
|
+
tt = t.peekOnSameLine();
|
|
875
|
+
if (tt !== END && tt !== NEWLINE && tt !== SEMICOLON && tt !== RIGHT_CURLY)
|
|
876
|
+
throw t.newSyntaxError("missing ; before statement");
|
|
877
|
+
}
|
|
878
|
+
t.match(SEMICOLON);
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/*
|
|
882
|
+
* ReturnOrYield :: (tokenizer, compiler context) -> (RETURN | YIELD) node
|
|
883
|
+
*/
|
|
884
|
+
function ReturnOrYield(t, x) {
|
|
885
|
+
var n, b, tt = t.token.type, tt2;
|
|
886
|
+
|
|
887
|
+
var parentScript = x.parentScript;
|
|
888
|
+
|
|
889
|
+
if (tt === RETURN) {
|
|
890
|
+
if (!x.inFunction)
|
|
891
|
+
throw t.newSyntaxError("Return not in function");
|
|
892
|
+
} else /* if (tt === YIELD) */ {
|
|
893
|
+
if (!x.inFunction)
|
|
894
|
+
throw t.newSyntaxError("Yield not in function");
|
|
895
|
+
parentScript.isGenerator = true;
|
|
896
|
+
}
|
|
897
|
+
n = new Node(t, { value: undefined });
|
|
898
|
+
|
|
899
|
+
tt2 = (tt === RETURN) ? t.peekOnSameLine(true) : t.peek(true);
|
|
900
|
+
if (tt2 !== END && tt2 !== NEWLINE &&
|
|
901
|
+
tt2 !== SEMICOLON && tt2 !== RIGHT_CURLY
|
|
902
|
+
&& (tt !== YIELD ||
|
|
903
|
+
(tt2 !== tt && tt2 !== RIGHT_BRACKET && tt2 !== RIGHT_PAREN &&
|
|
904
|
+
tt2 !== COLON && tt2 !== COMMA))) {
|
|
905
|
+
if (tt === RETURN) {
|
|
906
|
+
n.value = Expression(t, x);
|
|
907
|
+
parentScript.hasReturnWithValue = true;
|
|
908
|
+
} else {
|
|
909
|
+
n.value = AssignExpression(t, x);
|
|
910
|
+
}
|
|
911
|
+
} else if (tt === RETURN) {
|
|
912
|
+
parentScript.hasEmptyReturn = true;
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
// Disallow return v; in generator.
|
|
916
|
+
if (parentScript.hasReturnWithValue && parentScript.isGenerator)
|
|
917
|
+
throw t.newSyntaxError("Generator returns a value");
|
|
918
|
+
|
|
919
|
+
return n;
|
|
920
|
+
}
|
|
921
|
+
|
|
922
|
+
/*
|
|
923
|
+
* ModuleExpression :: (tokenizer, compiler context) -> (STRING | IDENTIFIER | DOT) node
|
|
924
|
+
*/
|
|
925
|
+
function ModuleExpression(t, x) {
|
|
926
|
+
return t.match(STRING) ? new Node(t) : QualifiedPath(t, x);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
/*
|
|
930
|
+
* ImportPathList :: (tokenizer, compiler context) -> Array[DOT node]
|
|
931
|
+
*/
|
|
932
|
+
function ImportPathList(t, x) {
|
|
933
|
+
var a = [];
|
|
934
|
+
do {
|
|
935
|
+
a.push(ImportPath(t, x));
|
|
936
|
+
} while (t.match(COMMA));
|
|
937
|
+
return a;
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/*
|
|
941
|
+
* ImportPath :: (tokenizer, compiler context) -> DOT node
|
|
942
|
+
*/
|
|
943
|
+
function ImportPath(t, x) {
|
|
944
|
+
var n = QualifiedPath(t, x);
|
|
945
|
+
if (!t.match(DOT)) {
|
|
946
|
+
if (n.type === IDENTIFIER)
|
|
947
|
+
throw t.newSyntaxError("cannot import local variable");
|
|
948
|
+
return n;
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
var n2 = new Node(t);
|
|
952
|
+
n2.push(n);
|
|
953
|
+
n2.push(ImportSpecifierSet(t, x));
|
|
954
|
+
return n2;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
/*
|
|
958
|
+
* ExplicitSpecifierSet :: (tokenizer, compiler context, (tokenizer, compiler context) -> node)
|
|
959
|
+
* -> OBJECT_INIT node
|
|
960
|
+
*/
|
|
961
|
+
function ExplicitSpecifierSet(t, x, SpecifierRHS) {
|
|
962
|
+
var n, n2, id, tt;
|
|
963
|
+
|
|
964
|
+
n = new Node(t, { type: OBJECT_INIT });
|
|
965
|
+
t.mustMatch(LEFT_CURLY);
|
|
966
|
+
|
|
967
|
+
if (!t.match(RIGHT_CURLY)) {
|
|
968
|
+
do {
|
|
969
|
+
id = Identifier(t, x);
|
|
970
|
+
if (t.match(COLON)) {
|
|
971
|
+
n2 = new Node(t, { type: PROPERTY_INIT });
|
|
972
|
+
n2.push(id);
|
|
973
|
+
n2.push(SpecifierRHS(t, x));
|
|
974
|
+
n.push(n2);
|
|
975
|
+
} else {
|
|
976
|
+
n.push(id);
|
|
977
|
+
}
|
|
978
|
+
} while (!t.match(RIGHT_CURLY) && t.mustMatch(COMMA));
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
return n;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/*
|
|
985
|
+
* ImportSpecifierSet :: (tokenizer, compiler context) -> (IDENTIFIER | OBJECT_INIT) node
|
|
986
|
+
*/
|
|
987
|
+
function ImportSpecifierSet(t, x) {
|
|
988
|
+
return t.match(MUL)
|
|
989
|
+
? new Node(t, { type: IDENTIFIER, name: "*" })
|
|
990
|
+
: ExplicitSpecifierSet(t, x, Identifier);
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
/*
|
|
994
|
+
* Identifier :: (tokenizer, compiler context) -> IDENTIFIER node
|
|
995
|
+
*/
|
|
996
|
+
function Identifier(t, x) {
|
|
997
|
+
t.mustMatch(IDENTIFIER);
|
|
998
|
+
return new Node(t, { type: IDENTIFIER });
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
/*
|
|
1002
|
+
* IdentifierName :: (tokenizer) -> IDENTIFIER node
|
|
1003
|
+
*/
|
|
1004
|
+
function IdentifierName(t) {
|
|
1005
|
+
t.mustMatch(IDENTIFIER, true);
|
|
1006
|
+
return new Node(t, { type: IDENTIFIER });
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
/*
|
|
1010
|
+
* QualifiedPath :: (tokenizer, compiler context) -> (IDENTIFIER | DOT) node
|
|
1011
|
+
*/
|
|
1012
|
+
function QualifiedPath(t, x) {
|
|
1013
|
+
var n, n2;
|
|
1014
|
+
|
|
1015
|
+
n = Identifier(t, x);
|
|
1016
|
+
|
|
1017
|
+
while (t.match(DOT)) {
|
|
1018
|
+
if (t.peek() !== IDENTIFIER) {
|
|
1019
|
+
// Unget the '.' token, which isn't part of the QualifiedPath.
|
|
1020
|
+
t.unget();
|
|
1021
|
+
break;
|
|
1022
|
+
}
|
|
1023
|
+
n2 = new Node(t);
|
|
1024
|
+
n2.push(n);
|
|
1025
|
+
n2.push(Identifier(t, x));
|
|
1026
|
+
n = n2;
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
return n;
|
|
1030
|
+
}
|
|
1031
|
+
|
|
1032
|
+
/*
|
|
1033
|
+
* ExportPath :: (tokenizer, compiler context) -> (IDENTIFIER | DOT | OBJECT_INIT) node
|
|
1034
|
+
*/
|
|
1035
|
+
function ExportPath(t, x) {
|
|
1036
|
+
if (t.peek() === LEFT_CURLY)
|
|
1037
|
+
return ExplicitSpecifierSet(t, x, QualifiedPath);
|
|
1038
|
+
return QualifiedPath(t, x);
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
/*
|
|
1042
|
+
* ExportPathList :: (tokenizer, compiler context)
|
|
1043
|
+
* -> Array[(IDENTIFIER | DOT | OBJECT_INIT) node]
|
|
1044
|
+
*/
|
|
1045
|
+
function ExportPathList(t, x) {
|
|
1046
|
+
var a = [];
|
|
1047
|
+
do {
|
|
1048
|
+
a.push(ExportPath(t, x));
|
|
1049
|
+
} while (t.match(COMMA));
|
|
1050
|
+
return a;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
/*
|
|
1054
|
+
* FunctionDefinition :: (tokenizer, compiler context, boolean,
|
|
1055
|
+
* DECLARED_FORM or EXPRESSED_FORM or STATEMENT_FORM,
|
|
1056
|
+
* [string] or null or undefined)
|
|
1057
|
+
* -> node
|
|
1058
|
+
*/
|
|
1059
|
+
function FunctionDefinition(t, x, requireName, functionForm, comments) {
|
|
1060
|
+
var tt;
|
|
1061
|
+
var f = new Node(t, { params: [], paramComments: [] });
|
|
1062
|
+
if (typeof comment === "undefined")
|
|
1063
|
+
comment = null;
|
|
1064
|
+
f.blockComments = comments;
|
|
1065
|
+
if (f.type !== FUNCTION)
|
|
1066
|
+
f.type = (f.value === "get") ? GETTER : SETTER;
|
|
1067
|
+
if (t.match(IDENTIFIER, false, true))
|
|
1068
|
+
f.name = t.token.value;
|
|
1069
|
+
else if (requireName)
|
|
1070
|
+
throw t.newSyntaxError("missing function identifier");
|
|
1071
|
+
|
|
1072
|
+
var inModule = x ? x.inModule : false;
|
|
1073
|
+
var x2 = new StaticContext(null, null, inModule, true);
|
|
1074
|
+
|
|
1075
|
+
t.mustMatch(LEFT_PAREN);
|
|
1076
|
+
if (!t.match(RIGHT_PAREN)) {
|
|
1077
|
+
do {
|
|
1078
|
+
tt = t.get();
|
|
1079
|
+
f.paramComments.push(t.lastBlockComment());
|
|
1080
|
+
switch (tt) {
|
|
1081
|
+
case LEFT_BRACKET:
|
|
1082
|
+
case LEFT_CURLY:
|
|
1083
|
+
// Destructured formal parameters.
|
|
1084
|
+
t.unget();
|
|
1085
|
+
f.params.push(DestructuringExpression(t, x2));
|
|
1086
|
+
break;
|
|
1087
|
+
case IDENTIFIER:
|
|
1088
|
+
f.params.push(t.token.value);
|
|
1089
|
+
break;
|
|
1090
|
+
default:
|
|
1091
|
+
throw t.newSyntaxError("missing formal parameter");
|
|
1092
|
+
break;
|
|
1093
|
+
}
|
|
1094
|
+
} while (t.match(COMMA));
|
|
1095
|
+
t.mustMatch(RIGHT_PAREN);
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
// Do we have an expression closure or a normal body?
|
|
1099
|
+
tt = t.get(true);
|
|
1100
|
+
if (tt !== LEFT_CURLY)
|
|
1101
|
+
t.unget();
|
|
1102
|
+
|
|
1103
|
+
if (tt !== LEFT_CURLY) {
|
|
1104
|
+
f.body = AssignExpression(t, x2);
|
|
1105
|
+
if (f.body.isGenerator)
|
|
1106
|
+
throw t.newSyntaxError("Generator returns a value");
|
|
1107
|
+
} else {
|
|
1108
|
+
f.body = Script(t, inModule, true);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
if (tt === LEFT_CURLY)
|
|
1112
|
+
t.mustMatch(RIGHT_CURLY);
|
|
1113
|
+
|
|
1114
|
+
f.end = t.token.end;
|
|
1115
|
+
f.functionForm = functionForm;
|
|
1116
|
+
if (functionForm === DECLARED_FORM)
|
|
1117
|
+
x.parentScript.funDecls.push(f);
|
|
1118
|
+
return f;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
/*
|
|
1122
|
+
* ModuleVariables :: (tokenizer, compiler context, MODULE node) -> void
|
|
1123
|
+
*
|
|
1124
|
+
* Parses a comma-separated list of module declarations (and maybe
|
|
1125
|
+
* initializations).
|
|
1126
|
+
*/
|
|
1127
|
+
function ModuleVariables(t, x, n) {
|
|
1128
|
+
var n1, n2;
|
|
1129
|
+
do {
|
|
1130
|
+
n1 = Identifier(t, x);
|
|
1131
|
+
if (t.match(ASSIGN)) {
|
|
1132
|
+
n2 = ModuleExpression(t, x);
|
|
1133
|
+
n1.initializer = n2;
|
|
1134
|
+
if (n2.type === STRING)
|
|
1135
|
+
x.parentScript.modLoads.set(n1.value, n2.value);
|
|
1136
|
+
else
|
|
1137
|
+
x.parentScript.modAssns.set(n1.value, n1);
|
|
1138
|
+
}
|
|
1139
|
+
n.push(n1);
|
|
1140
|
+
} while (t.match(COMMA));
|
|
1141
|
+
}
|
|
1142
|
+
|
|
1143
|
+
/*
|
|
1144
|
+
* Variables :: (tokenizer, compiler context) -> node
|
|
1145
|
+
*
|
|
1146
|
+
* Parses a comma-separated list of var declarations (and maybe
|
|
1147
|
+
* initializations).
|
|
1148
|
+
*/
|
|
1149
|
+
function Variables(t, x, letBlock) {
|
|
1150
|
+
var n, n2, ss, i, s, tt;
|
|
1151
|
+
|
|
1152
|
+
tt = t.token.type;
|
|
1153
|
+
switch (tt) {
|
|
1154
|
+
case VAR:
|
|
1155
|
+
case CONST:
|
|
1156
|
+
s = x.parentScript;
|
|
1157
|
+
break;
|
|
1158
|
+
case LET:
|
|
1159
|
+
s = x.parentBlock;
|
|
1160
|
+
break;
|
|
1161
|
+
case LEFT_PAREN:
|
|
1162
|
+
tt = LET;
|
|
1163
|
+
s = letBlock;
|
|
1164
|
+
break;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
n = new Node(t, { type: tt, destructurings: [] });
|
|
1168
|
+
|
|
1169
|
+
do {
|
|
1170
|
+
tt = t.get();
|
|
1171
|
+
if (tt === LEFT_BRACKET || tt === LEFT_CURLY) {
|
|
1172
|
+
// Need to unget to parse the full destructured expression.
|
|
1173
|
+
t.unget();
|
|
1174
|
+
|
|
1175
|
+
var dexp = DestructuringExpression(t, x, true);
|
|
1176
|
+
|
|
1177
|
+
n2 = new Node(t, { type: IDENTIFIER,
|
|
1178
|
+
name: dexp,
|
|
1179
|
+
readOnly: n.type === CONST });
|
|
1180
|
+
n.push(n2);
|
|
1181
|
+
pushDestructuringVarDecls(n2.name.destructuredNames, s);
|
|
1182
|
+
n.destructurings.push({ exp: dexp, decl: n2 });
|
|
1183
|
+
|
|
1184
|
+
if (x.inForLoopInit && t.peek() === IN) {
|
|
1185
|
+
continue;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
t.mustMatch(ASSIGN);
|
|
1189
|
+
if (t.token.assignOp)
|
|
1190
|
+
throw t.newSyntaxError("Invalid variable initialization");
|
|
1191
|
+
|
|
1192
|
+
n2.blockComment = t.lastBlockComment();
|
|
1193
|
+
n2.initializer = AssignExpression(t, x);
|
|
1194
|
+
|
|
1195
|
+
continue;
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
if (tt !== IDENTIFIER)
|
|
1199
|
+
throw t.newSyntaxError("missing variable name");
|
|
1200
|
+
|
|
1201
|
+
n2 = new Node(t, { type: IDENTIFIER,
|
|
1202
|
+
name: t.token.value,
|
|
1203
|
+
readOnly: n.type === CONST });
|
|
1204
|
+
n.push(n2);
|
|
1205
|
+
s.varDecls.push(n2);
|
|
1206
|
+
|
|
1207
|
+
if (t.match(ASSIGN)) {
|
|
1208
|
+
var comment = t.lastBlockComment();
|
|
1209
|
+
if (t.token.assignOp)
|
|
1210
|
+
throw t.newSyntaxError("Invalid variable initialization");
|
|
1211
|
+
|
|
1212
|
+
n2.initializer = AssignExpression(t, x);
|
|
1213
|
+
} else {
|
|
1214
|
+
var comment = t.lastBlockComment();
|
|
1215
|
+
}
|
|
1216
|
+
n2.blockComment = comment;
|
|
1217
|
+
} while (t.match(COMMA));
|
|
1218
|
+
|
|
1219
|
+
return n;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/*
|
|
1223
|
+
* LetBlock :: (tokenizer, compiler context, boolean) -> node
|
|
1224
|
+
*
|
|
1225
|
+
* Does not handle let inside of for loop init.
|
|
1226
|
+
*/
|
|
1227
|
+
function LetBlock(t, x, isStatement) {
|
|
1228
|
+
var n, n2;
|
|
1229
|
+
|
|
1230
|
+
// t.token.type must be LET
|
|
1231
|
+
n = new Node(t, { type: LET_BLOCK, varDecls: [] });
|
|
1232
|
+
t.mustMatch(LEFT_PAREN);
|
|
1233
|
+
n.variables = Variables(t, x, n);
|
|
1234
|
+
t.mustMatch(RIGHT_PAREN);
|
|
1235
|
+
|
|
1236
|
+
if (isStatement && t.peek() !== LEFT_CURLY) {
|
|
1237
|
+
/*
|
|
1238
|
+
* If this is really an expression in let statement guise, then we
|
|
1239
|
+
* need to wrap the LET_BLOCK node in a SEMICOLON node so that we pop
|
|
1240
|
+
* the return value of the expression.
|
|
1241
|
+
*/
|
|
1242
|
+
n2 = new Node(t, { type: SEMICOLON,
|
|
1243
|
+
expression: n });
|
|
1244
|
+
isStatement = false;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
if (isStatement)
|
|
1248
|
+
n.block = Block(t, x);
|
|
1249
|
+
else
|
|
1250
|
+
n.expression = AssignExpression(t, x);
|
|
1251
|
+
|
|
1252
|
+
return n;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
function checkDestructuring(t, x, n, simpleNamesOnly) {
|
|
1256
|
+
if (n.type === ARRAY_COMP)
|
|
1257
|
+
throw t.newSyntaxError("Invalid array comprehension left-hand side");
|
|
1258
|
+
if (n.type !== ARRAY_INIT && n.type !== OBJECT_INIT)
|
|
1259
|
+
return;
|
|
1260
|
+
|
|
1261
|
+
var lhss = {};
|
|
1262
|
+
var nn, n2, idx, sub, cc, c = n.children;
|
|
1263
|
+
for (var i = 0, j = c.length; i < j; i++) {
|
|
1264
|
+
if (!(nn = c[i]))
|
|
1265
|
+
continue;
|
|
1266
|
+
if (nn.type === PROPERTY_INIT) {
|
|
1267
|
+
cc = nn.children;
|
|
1268
|
+
sub = cc[1];
|
|
1269
|
+
idx = cc[0].value;
|
|
1270
|
+
} else if (n.type === OBJECT_INIT) {
|
|
1271
|
+
// Do we have destructuring shorthand {foo, bar}?
|
|
1272
|
+
sub = nn;
|
|
1273
|
+
idx = nn.value;
|
|
1274
|
+
} else {
|
|
1275
|
+
sub = nn;
|
|
1276
|
+
idx = i;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
if (sub.type === ARRAY_INIT || sub.type === OBJECT_INIT) {
|
|
1280
|
+
lhss[idx] = checkDestructuring(t, x, sub, simpleNamesOnly);
|
|
1281
|
+
} else {
|
|
1282
|
+
if (simpleNamesOnly && sub.type !== IDENTIFIER) {
|
|
1283
|
+
// In declarations, lhs must be simple names
|
|
1284
|
+
throw t.newSyntaxError("missing name in pattern");
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
lhss[idx] = sub;
|
|
1288
|
+
}
|
|
1289
|
+
}
|
|
1290
|
+
|
|
1291
|
+
return lhss;
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
function DestructuringExpression(t, x, simpleNamesOnly) {
|
|
1295
|
+
var n = PrimaryExpression(t, x);
|
|
1296
|
+
// Keep the list of lefthand sides for varDecls
|
|
1297
|
+
n.destructuredNames = checkDestructuring(t, x, n, simpleNamesOnly);
|
|
1298
|
+
return n;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
function GeneratorExpression(t, x, e) {
|
|
1302
|
+
return new Node(t, { type: GENERATOR,
|
|
1303
|
+
expression: e,
|
|
1304
|
+
tail: ComprehensionTail(t, x) });
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1307
|
+
function ComprehensionTail(t, x) {
|
|
1308
|
+
var body, n, n2, n3, p;
|
|
1309
|
+
|
|
1310
|
+
// t.token.type must be FOR
|
|
1311
|
+
body = new Node(t, { type: COMP_TAIL });
|
|
1312
|
+
|
|
1313
|
+
do {
|
|
1314
|
+
// Comprehension tails are always for..in loops.
|
|
1315
|
+
n = new Node(t, { type: FOR_IN, isLoop: true });
|
|
1316
|
+
if (t.match(IDENTIFIER)) {
|
|
1317
|
+
// But sometimes they're for each..in.
|
|
1318
|
+
if (t.token.value === "each")
|
|
1319
|
+
n.isEach = true;
|
|
1320
|
+
else
|
|
1321
|
+
t.unget();
|
|
1322
|
+
}
|
|
1323
|
+
p = MaybeLeftParen(t, x);
|
|
1324
|
+
switch(t.get()) {
|
|
1325
|
+
case LEFT_BRACKET:
|
|
1326
|
+
case LEFT_CURLY:
|
|
1327
|
+
t.unget();
|
|
1328
|
+
// Destructured left side of for in comprehension tails.
|
|
1329
|
+
n.iterator = DestructuringExpression(t, x);
|
|
1330
|
+
break;
|
|
1331
|
+
|
|
1332
|
+
case IDENTIFIER:
|
|
1333
|
+
n.iterator = n3 = new Node(t, { type: IDENTIFIER });
|
|
1334
|
+
n3.name = n3.value;
|
|
1335
|
+
n.varDecl = n2 = new Node(t, { type: VAR });
|
|
1336
|
+
n2.push(n3);
|
|
1337
|
+
x.parentScript.varDecls.push(n3);
|
|
1338
|
+
// Don't add to varDecls since the semantics of comprehensions is
|
|
1339
|
+
// such that the variables are in their own function when
|
|
1340
|
+
// desugared.
|
|
1341
|
+
break;
|
|
1342
|
+
|
|
1343
|
+
default:
|
|
1344
|
+
throw t.newSyntaxError("missing identifier");
|
|
1345
|
+
}
|
|
1346
|
+
t.mustMatch(IN);
|
|
1347
|
+
n.object = Expression(t, x);
|
|
1348
|
+
MaybeRightParen(t, p);
|
|
1349
|
+
body.push(n);
|
|
1350
|
+
} while (t.match(FOR));
|
|
1351
|
+
|
|
1352
|
+
// Optional guard.
|
|
1353
|
+
if (t.match(IF))
|
|
1354
|
+
body.guard = HeadExpression(t, x);
|
|
1355
|
+
|
|
1356
|
+
return body;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
function HeadExpression(t, x) {
|
|
1360
|
+
var p = MaybeLeftParen(t, x);
|
|
1361
|
+
var n = ParenExpression(t, x);
|
|
1362
|
+
MaybeRightParen(t, p);
|
|
1363
|
+
if (p === END && !n.parenthesized) {
|
|
1364
|
+
var tt = t.peek();
|
|
1365
|
+
if (tt !== LEFT_CURLY && !definitions.isStatementStartCode[tt])
|
|
1366
|
+
throw t.newSyntaxError("Unparenthesized head followed by unbraced body");
|
|
1367
|
+
}
|
|
1368
|
+
return n;
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
function ParenExpression(t, x) {
|
|
1372
|
+
// Always accept the 'in' operator in a parenthesized expression,
|
|
1373
|
+
// where it's unambiguous, even if we might be parsing the init of a
|
|
1374
|
+
// for statement.
|
|
1375
|
+
var n = Expression(t, x.update({ inForLoopInit: x.inForLoopInit &&
|
|
1376
|
+
(t.token.type === LEFT_PAREN) }));
|
|
1377
|
+
|
|
1378
|
+
if (t.match(FOR)) {
|
|
1379
|
+
if (n.type === YIELD && !n.parenthesized)
|
|
1380
|
+
throw t.newSyntaxError("Yield expression must be parenthesized");
|
|
1381
|
+
if (n.type === COMMA && !n.parenthesized)
|
|
1382
|
+
throw t.newSyntaxError("Generator expression must be parenthesized");
|
|
1383
|
+
n = GeneratorExpression(t, x, n);
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
return n;
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
/*
|
|
1390
|
+
* Expression :: (tokenizer, compiler context) -> node
|
|
1391
|
+
*
|
|
1392
|
+
* Top-down expression parser matched against SpiderMonkey.
|
|
1393
|
+
*/
|
|
1394
|
+
function Expression(t, x) {
|
|
1395
|
+
var n, n2;
|
|
1396
|
+
|
|
1397
|
+
n = AssignExpression(t, x);
|
|
1398
|
+
if (t.match(COMMA)) {
|
|
1399
|
+
n2 = new Node(t, { type: COMMA });
|
|
1400
|
+
n2.push(n);
|
|
1401
|
+
n = n2;
|
|
1402
|
+
do {
|
|
1403
|
+
n2 = n.children[n.children.length-1];
|
|
1404
|
+
if (n2.type === YIELD && !n2.parenthesized)
|
|
1405
|
+
throw t.newSyntaxError("Yield expression must be parenthesized");
|
|
1406
|
+
n.push(AssignExpression(t, x));
|
|
1407
|
+
} while (t.match(COMMA));
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
return n;
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
function AssignExpression(t, x) {
|
|
1414
|
+
var n, lhs;
|
|
1415
|
+
|
|
1416
|
+
// Have to treat yield like an operand because it could be the leftmost
|
|
1417
|
+
// operand of the expression.
|
|
1418
|
+
if (t.match(YIELD, true))
|
|
1419
|
+
return ReturnOrYield(t, x);
|
|
1420
|
+
|
|
1421
|
+
n = new Node(t, { type: ASSIGN });
|
|
1422
|
+
lhs = ConditionalExpression(t, x);
|
|
1423
|
+
|
|
1424
|
+
if (!t.match(ASSIGN)) {
|
|
1425
|
+
return lhs;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
n.blockComment = t.lastBlockComment();
|
|
1429
|
+
|
|
1430
|
+
switch (lhs.type) {
|
|
1431
|
+
case OBJECT_INIT:
|
|
1432
|
+
case ARRAY_INIT:
|
|
1433
|
+
lhs.destructuredNames = checkDestructuring(t, x, lhs);
|
|
1434
|
+
// FALL THROUGH
|
|
1435
|
+
case IDENTIFIER: case DOT: case INDEX: case CALL:
|
|
1436
|
+
break;
|
|
1437
|
+
default:
|
|
1438
|
+
throw t.newSyntaxError("Bad left-hand side of assignment");
|
|
1439
|
+
break;
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
n.assignOp = lhs.assignOp = t.token.assignOp;
|
|
1443
|
+
n.push(lhs);
|
|
1444
|
+
n.push(AssignExpression(t, x));
|
|
1445
|
+
|
|
1446
|
+
return n;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
function ConditionalExpression(t, x) {
|
|
1450
|
+
var n, n2;
|
|
1451
|
+
|
|
1452
|
+
n = OrExpression(t, x);
|
|
1453
|
+
if (t.match(HOOK)) {
|
|
1454
|
+
n2 = n;
|
|
1455
|
+
n = new Node(t, { type: HOOK });
|
|
1456
|
+
n.push(n2);
|
|
1457
|
+
/*
|
|
1458
|
+
* Always accept the 'in' operator in the middle clause of a ternary,
|
|
1459
|
+
* where it's unambiguous, even if we might be parsing the init of a
|
|
1460
|
+
* for statement.
|
|
1461
|
+
*/
|
|
1462
|
+
n.push(AssignExpression(t, x.update({ inForLoopInit: false })));
|
|
1463
|
+
if (!t.match(COLON))
|
|
1464
|
+
throw t.newSyntaxError("missing : after ?");
|
|
1465
|
+
n.push(AssignExpression(t, x));
|
|
1466
|
+
}
|
|
1467
|
+
|
|
1468
|
+
return n;
|
|
1469
|
+
}
|
|
1470
|
+
|
|
1471
|
+
function OrExpression(t, x) {
|
|
1472
|
+
var n, n2;
|
|
1473
|
+
|
|
1474
|
+
n = AndExpression(t, x);
|
|
1475
|
+
while (t.match(OR)) {
|
|
1476
|
+
n2 = new Node(t);
|
|
1477
|
+
n2.push(n);
|
|
1478
|
+
n2.push(AndExpression(t, x));
|
|
1479
|
+
n = n2;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
return n;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
function AndExpression(t, x) {
|
|
1486
|
+
var n, n2;
|
|
1487
|
+
|
|
1488
|
+
n = BitwiseOrExpression(t, x);
|
|
1489
|
+
while (t.match(AND)) {
|
|
1490
|
+
n2 = new Node(t);
|
|
1491
|
+
n2.push(n);
|
|
1492
|
+
n2.push(BitwiseOrExpression(t, x));
|
|
1493
|
+
n = n2;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
return n;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
function BitwiseOrExpression(t, x) {
|
|
1500
|
+
var n, n2;
|
|
1501
|
+
|
|
1502
|
+
n = BitwiseXorExpression(t, x);
|
|
1503
|
+
while (t.match(BITWISE_OR)) {
|
|
1504
|
+
n2 = new Node(t);
|
|
1505
|
+
n2.push(n);
|
|
1506
|
+
n2.push(BitwiseXorExpression(t, x));
|
|
1507
|
+
n = n2;
|
|
1508
|
+
}
|
|
1509
|
+
|
|
1510
|
+
return n;
|
|
1511
|
+
}
|
|
1512
|
+
|
|
1513
|
+
function BitwiseXorExpression(t, x) {
|
|
1514
|
+
var n, n2;
|
|
1515
|
+
|
|
1516
|
+
n = BitwiseAndExpression(t, x);
|
|
1517
|
+
while (t.match(BITWISE_XOR)) {
|
|
1518
|
+
n2 = new Node(t);
|
|
1519
|
+
n2.push(n);
|
|
1520
|
+
n2.push(BitwiseAndExpression(t, x));
|
|
1521
|
+
n = n2;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
return n;
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
function BitwiseAndExpression(t, x) {
|
|
1528
|
+
var n, n2;
|
|
1529
|
+
|
|
1530
|
+
n = EqualityExpression(t, x);
|
|
1531
|
+
while (t.match(BITWISE_AND)) {
|
|
1532
|
+
n2 = new Node(t);
|
|
1533
|
+
n2.push(n);
|
|
1534
|
+
n2.push(EqualityExpression(t, x));
|
|
1535
|
+
n = n2;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
return n;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
function EqualityExpression(t, x) {
|
|
1542
|
+
var n, n2;
|
|
1543
|
+
|
|
1544
|
+
n = RelationalExpression(t, x);
|
|
1545
|
+
while (t.match(EQ) || t.match(NE) ||
|
|
1546
|
+
t.match(STRICT_EQ) || t.match(STRICT_NE)) {
|
|
1547
|
+
n2 = new Node(t);
|
|
1548
|
+
n2.push(n);
|
|
1549
|
+
n2.push(RelationalExpression(t, x));
|
|
1550
|
+
n = n2;
|
|
1551
|
+
}
|
|
1552
|
+
|
|
1553
|
+
return n;
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
function RelationalExpression(t, x) {
|
|
1557
|
+
var n, n2;
|
|
1558
|
+
|
|
1559
|
+
/*
|
|
1560
|
+
* Uses of the in operator in shiftExprs are always unambiguous,
|
|
1561
|
+
* so unset the flag that prohibits recognizing it.
|
|
1562
|
+
*/
|
|
1563
|
+
var x2 = x.update({ inForLoopInit: false });
|
|
1564
|
+
n = ShiftExpression(t, x2);
|
|
1565
|
+
while ((t.match(LT) || t.match(LE) || t.match(GE) || t.match(GT) ||
|
|
1566
|
+
(!x.inForLoopInit && t.match(IN)) ||
|
|
1567
|
+
t.match(INSTANCEOF))) {
|
|
1568
|
+
n2 = new Node(t);
|
|
1569
|
+
n2.push(n);
|
|
1570
|
+
n2.push(ShiftExpression(t, x2));
|
|
1571
|
+
n = n2;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
return n;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
function ShiftExpression(t, x) {
|
|
1578
|
+
var n, n2;
|
|
1579
|
+
|
|
1580
|
+
n = AddExpression(t, x);
|
|
1581
|
+
while (t.match(LSH) || t.match(RSH) || t.match(URSH)) {
|
|
1582
|
+
n2 = new Node(t);
|
|
1583
|
+
n2.push(n);
|
|
1584
|
+
n2.push(AddExpression(t, x));
|
|
1585
|
+
n = n2;
|
|
1586
|
+
}
|
|
1587
|
+
|
|
1588
|
+
return n;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
function AddExpression(t, x) {
|
|
1592
|
+
var n, n2;
|
|
1593
|
+
|
|
1594
|
+
n = MultiplyExpression(t, x);
|
|
1595
|
+
while (t.match(PLUS) || t.match(MINUS)) {
|
|
1596
|
+
n2 = new Node(t);
|
|
1597
|
+
n2.push(n);
|
|
1598
|
+
n2.push(MultiplyExpression(t, x));
|
|
1599
|
+
n = n2;
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
return n;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
function MultiplyExpression(t, x) {
|
|
1606
|
+
var n, n2;
|
|
1607
|
+
|
|
1608
|
+
n = UnaryExpression(t, x);
|
|
1609
|
+
while (t.match(MUL) || t.match(DIV) || t.match(MOD)) {
|
|
1610
|
+
n2 = new Node(t);
|
|
1611
|
+
n2.push(n);
|
|
1612
|
+
n2.push(UnaryExpression(t, x));
|
|
1613
|
+
n = n2;
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
return n;
|
|
1617
|
+
}
|
|
1618
|
+
|
|
1619
|
+
function UnaryExpression(t, x) {
|
|
1620
|
+
var n, n2, tt;
|
|
1621
|
+
|
|
1622
|
+
switch (tt = t.get(true)) {
|
|
1623
|
+
case DELETE: case VOID: case TYPEOF:
|
|
1624
|
+
case NOT: case BITWISE_NOT: case PLUS: case MINUS:
|
|
1625
|
+
if (tt === PLUS)
|
|
1626
|
+
n = new Node(t, { type: UNARY_PLUS });
|
|
1627
|
+
else if (tt === MINUS)
|
|
1628
|
+
n = new Node(t, { type: UNARY_MINUS });
|
|
1629
|
+
else
|
|
1630
|
+
n = new Node(t);
|
|
1631
|
+
n.push(UnaryExpression(t, x));
|
|
1632
|
+
break;
|
|
1633
|
+
|
|
1634
|
+
case INCREMENT:
|
|
1635
|
+
case DECREMENT:
|
|
1636
|
+
// Prefix increment/decrement.
|
|
1637
|
+
n = new Node(t);
|
|
1638
|
+
n.push(MemberExpression(t, x, true));
|
|
1639
|
+
break;
|
|
1640
|
+
|
|
1641
|
+
default:
|
|
1642
|
+
t.unget();
|
|
1643
|
+
n = MemberExpression(t, x, true);
|
|
1644
|
+
|
|
1645
|
+
// Don't look across a newline boundary for a postfix {in,de}crement.
|
|
1646
|
+
if (t.tokens[(t.tokenIndex + t.lookahead - 1) & 3].lineno ===
|
|
1647
|
+
t.lineno) {
|
|
1648
|
+
if (t.match(INCREMENT) || t.match(DECREMENT)) {
|
|
1649
|
+
n2 = new Node(t, { postfix: true });
|
|
1650
|
+
n2.push(n);
|
|
1651
|
+
n = n2;
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
break;
|
|
1655
|
+
}
|
|
1656
|
+
|
|
1657
|
+
return n;
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
function MemberExpression(t, x, allowCallSyntax) {
|
|
1661
|
+
var n, n2, name, tt;
|
|
1662
|
+
|
|
1663
|
+
if (t.match(NEW)) {
|
|
1664
|
+
n = new Node(t);
|
|
1665
|
+
n.push(MemberExpression(t, x, false));
|
|
1666
|
+
if (t.match(LEFT_PAREN)) {
|
|
1667
|
+
n.type = NEW_WITH_ARGS;
|
|
1668
|
+
n.push(ArgumentList(t, x));
|
|
1669
|
+
}
|
|
1670
|
+
} else {
|
|
1671
|
+
n = PrimaryExpression(t, x);
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
while ((tt = t.get()) !== END) {
|
|
1675
|
+
switch (tt) {
|
|
1676
|
+
case DOT:
|
|
1677
|
+
n2 = new Node(t);
|
|
1678
|
+
n2.push(n);
|
|
1679
|
+
n2.push(IdentifierName(t));
|
|
1680
|
+
break;
|
|
1681
|
+
|
|
1682
|
+
case LEFT_BRACKET:
|
|
1683
|
+
n2 = new Node(t, { type: INDEX });
|
|
1684
|
+
n2.push(n);
|
|
1685
|
+
n2.push(Expression(t, x));
|
|
1686
|
+
t.mustMatch(RIGHT_BRACKET);
|
|
1687
|
+
break;
|
|
1688
|
+
|
|
1689
|
+
case LEFT_PAREN:
|
|
1690
|
+
if (allowCallSyntax) {
|
|
1691
|
+
n2 = new Node(t, { type: CALL });
|
|
1692
|
+
n2.push(n);
|
|
1693
|
+
n2.push(ArgumentList(t, x));
|
|
1694
|
+
break;
|
|
1695
|
+
}
|
|
1696
|
+
|
|
1697
|
+
// FALL THROUGH
|
|
1698
|
+
default:
|
|
1699
|
+
t.unget();
|
|
1700
|
+
return n;
|
|
1701
|
+
}
|
|
1702
|
+
|
|
1703
|
+
n = n2;
|
|
1704
|
+
}
|
|
1705
|
+
|
|
1706
|
+
return n;
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
function ArgumentList(t, x) {
|
|
1710
|
+
var n, n2;
|
|
1711
|
+
|
|
1712
|
+
n = new Node(t, { type: LIST });
|
|
1713
|
+
if (t.match(RIGHT_PAREN, true))
|
|
1714
|
+
return n;
|
|
1715
|
+
do {
|
|
1716
|
+
n2 = AssignExpression(t, x);
|
|
1717
|
+
if (n2.type === YIELD && !n2.parenthesized && t.peek() === COMMA)
|
|
1718
|
+
throw t.newSyntaxError("Yield expression must be parenthesized");
|
|
1719
|
+
if (t.match(FOR)) {
|
|
1720
|
+
n2 = GeneratorExpression(t, x, n2);
|
|
1721
|
+
if (n.children.length > 1 || t.peek(true) === COMMA)
|
|
1722
|
+
throw t.newSyntaxError("Generator expression must be parenthesized");
|
|
1723
|
+
}
|
|
1724
|
+
n.push(n2);
|
|
1725
|
+
} while (t.match(COMMA));
|
|
1726
|
+
t.mustMatch(RIGHT_PAREN);
|
|
1727
|
+
|
|
1728
|
+
return n;
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
function PrimaryExpression(t, x) {
|
|
1732
|
+
var n, n2, tt = t.get(true);
|
|
1733
|
+
|
|
1734
|
+
switch (tt) {
|
|
1735
|
+
case FUNCTION:
|
|
1736
|
+
n = FunctionDefinition(t, x, false, EXPRESSED_FORM);
|
|
1737
|
+
break;
|
|
1738
|
+
|
|
1739
|
+
case LEFT_BRACKET:
|
|
1740
|
+
n = new Node(t, { type: ARRAY_INIT });
|
|
1741
|
+
while ((tt = t.peek(true)) !== RIGHT_BRACKET) {
|
|
1742
|
+
if (tt === COMMA) {
|
|
1743
|
+
t.get();
|
|
1744
|
+
n.push(null);
|
|
1745
|
+
continue;
|
|
1746
|
+
}
|
|
1747
|
+
n.push(AssignExpression(t, x));
|
|
1748
|
+
if (tt !== COMMA && !t.match(COMMA))
|
|
1749
|
+
break;
|
|
1750
|
+
}
|
|
1751
|
+
|
|
1752
|
+
// If we matched exactly one element and got a FOR, we have an
|
|
1753
|
+
// array comprehension.
|
|
1754
|
+
if (n.children.length === 1 && t.match(FOR)) {
|
|
1755
|
+
n2 = new Node(t, { type: ARRAY_COMP,
|
|
1756
|
+
expression: n.children[0],
|
|
1757
|
+
tail: ComprehensionTail(t, x) });
|
|
1758
|
+
n = n2;
|
|
1759
|
+
}
|
|
1760
|
+
t.mustMatch(RIGHT_BRACKET);
|
|
1761
|
+
break;
|
|
1762
|
+
|
|
1763
|
+
case LEFT_CURLY:
|
|
1764
|
+
var id, fd;
|
|
1765
|
+
n = new Node(t, { type: OBJECT_INIT });
|
|
1766
|
+
|
|
1767
|
+
object_init:
|
|
1768
|
+
if (!t.match(RIGHT_CURLY)) {
|
|
1769
|
+
do {
|
|
1770
|
+
tt = t.get();
|
|
1771
|
+
if ((t.token.value === "get" || t.token.value === "set") &&
|
|
1772
|
+
t.peek() === IDENTIFIER) {
|
|
1773
|
+
if (x.ecma3OnlyMode)
|
|
1774
|
+
throw t.newSyntaxError("Illegal property accessor");
|
|
1775
|
+
n.push(FunctionDefinition(t, x, true, EXPRESSED_FORM));
|
|
1776
|
+
} else {
|
|
1777
|
+
var comments = t.blockComments;
|
|
1778
|
+
switch (tt) {
|
|
1779
|
+
case IDENTIFIER: case NUMBER: case STRING:
|
|
1780
|
+
id = new Node(t, { type: IDENTIFIER });
|
|
1781
|
+
break;
|
|
1782
|
+
case RIGHT_CURLY:
|
|
1783
|
+
if (x.ecma3OnlyMode)
|
|
1784
|
+
throw t.newSyntaxError("Illegal trailing ,");
|
|
1785
|
+
break object_init;
|
|
1786
|
+
default:
|
|
1787
|
+
if (t.token.value in definitions.keywords) {
|
|
1788
|
+
id = new Node(t, { type: IDENTIFIER });
|
|
1789
|
+
break;
|
|
1790
|
+
}
|
|
1791
|
+
throw t.newSyntaxError("Invalid property name");
|
|
1792
|
+
}
|
|
1793
|
+
if (t.match(COLON)) {
|
|
1794
|
+
n2 = new Node(t, { type: PROPERTY_INIT });
|
|
1795
|
+
n2.push(id);
|
|
1796
|
+
n2.push(AssignExpression(t, x));
|
|
1797
|
+
n2.blockComments = comments;
|
|
1798
|
+
n.push(n2);
|
|
1799
|
+
} else {
|
|
1800
|
+
// Support, e.g., |var {x, y} = o| as destructuring shorthand
|
|
1801
|
+
// for |var {x: x, y: y} = o|, per proposed JS2/ES4 for JS1.8.
|
|
1802
|
+
if (t.peek() !== COMMA && t.peek() !== RIGHT_CURLY)
|
|
1803
|
+
throw t.newSyntaxError("missing : after property");
|
|
1804
|
+
n.push(id);
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
} while (t.match(COMMA));
|
|
1808
|
+
t.mustMatch(RIGHT_CURLY);
|
|
1809
|
+
}
|
|
1810
|
+
break;
|
|
1811
|
+
|
|
1812
|
+
case LEFT_PAREN:
|
|
1813
|
+
n = ParenExpression(t, x);
|
|
1814
|
+
t.mustMatch(RIGHT_PAREN);
|
|
1815
|
+
n.parenthesized = true;
|
|
1816
|
+
break;
|
|
1817
|
+
|
|
1818
|
+
case LET:
|
|
1819
|
+
n = LetBlock(t, x, false);
|
|
1820
|
+
break;
|
|
1821
|
+
|
|
1822
|
+
case NULL: case THIS: case TRUE: case FALSE:
|
|
1823
|
+
case IDENTIFIER: case NUMBER: case STRING: case REGEXP:
|
|
1824
|
+
n = new Node(t);
|
|
1825
|
+
break;
|
|
1826
|
+
|
|
1827
|
+
default:
|
|
1828
|
+
throw t.newSyntaxError("missing operand; found " + definitions.tokens[tt]);
|
|
1829
|
+
break;
|
|
1830
|
+
}
|
|
1831
|
+
|
|
1832
|
+
return n;
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1835
|
+
/*
|
|
1836
|
+
* parse :: (source, filename, line number) -> node
|
|
1837
|
+
*/
|
|
1838
|
+
function parse(s, f, l) {
|
|
1839
|
+
var t = new lexer.Tokenizer(s, f, l);
|
|
1840
|
+
var n = Script(t, false, false);
|
|
1841
|
+
if (!t.done)
|
|
1842
|
+
throw t.newSyntaxError("Syntax error");
|
|
1843
|
+
|
|
1844
|
+
return n;
|
|
1845
|
+
}
|
|
1846
|
+
|
|
1847
|
+
/*
|
|
1848
|
+
* parseStdin :: (source, {line number}, string, (string) -> boolean) -> program node
|
|
1849
|
+
*/
|
|
1850
|
+
function parseStdin(s, ln, prefix, isCommand) {
|
|
1851
|
+
// the special .begin command is only recognized at the beginning
|
|
1852
|
+
if (s.match(/^[\s]*\.begin[\s]*$/)) {
|
|
1853
|
+
++ln.value;
|
|
1854
|
+
return parseMultiline(ln, prefix);
|
|
1855
|
+
}
|
|
1856
|
+
|
|
1857
|
+
// commands at the beginning are treated as the entire input
|
|
1858
|
+
if (isCommand(s.trim()))
|
|
1859
|
+
s = "";
|
|
1860
|
+
|
|
1861
|
+
for (;;) {
|
|
1862
|
+
try {
|
|
1863
|
+
var t = new lexer.Tokenizer(s, "stdin", ln.value);
|
|
1864
|
+
var n = Script(t, false, false);
|
|
1865
|
+
ln.value = t.lineno;
|
|
1866
|
+
return n;
|
|
1867
|
+
} catch (e) {
|
|
1868
|
+
if (!t.unexpectedEOF)
|
|
1869
|
+
throw e;
|
|
1870
|
+
|
|
1871
|
+
// commands in the middle are not treated as part of the input
|
|
1872
|
+
var more;
|
|
1873
|
+
do {
|
|
1874
|
+
if (prefix)
|
|
1875
|
+
putstr(prefix);
|
|
1876
|
+
more = readline();
|
|
1877
|
+
if (!more)
|
|
1878
|
+
throw e;
|
|
1879
|
+
} while (isCommand(more.trim()));
|
|
1880
|
+
|
|
1881
|
+
s += "\n" + more;
|
|
1882
|
+
}
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
|
|
1886
|
+
/*
|
|
1887
|
+
* parseMultiline :: ({line number}, string | null) -> program node
|
|
1888
|
+
*/
|
|
1889
|
+
function parseMultiline(ln, prefix) {
|
|
1890
|
+
var s = "";
|
|
1891
|
+
for (;;) {
|
|
1892
|
+
if (prefix)
|
|
1893
|
+
putstr(prefix);
|
|
1894
|
+
var more = readline();
|
|
1895
|
+
if (more === null)
|
|
1896
|
+
return null;
|
|
1897
|
+
// the only command recognized in multiline mode is .end
|
|
1898
|
+
if (more.match(/^[\s]*\.end[\s]*$/))
|
|
1899
|
+
break;
|
|
1900
|
+
s += "\n" + more;
|
|
1901
|
+
}
|
|
1902
|
+
var t = new lexer.Tokenizer(s, "stdin", ln.value);
|
|
1903
|
+
var n = Script(t, false, false);
|
|
1904
|
+
ln.value = t.lineno;
|
|
1905
|
+
return n;
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
return {
|
|
1909
|
+
parse: parse,
|
|
1910
|
+
parseStdin: parseStdin,
|
|
1911
|
+
Node: Node,
|
|
1912
|
+
DECLARED_FORM: DECLARED_FORM,
|
|
1913
|
+
EXPRESSED_FORM: EXPRESSED_FORM,
|
|
1914
|
+
STATEMENT_FORM: STATEMENT_FORM,
|
|
1915
|
+
Tokenizer: lexer.Tokenizer,
|
|
1916
|
+
FunctionDefinition: FunctionDefinition,
|
|
1917
|
+
Module: Module,
|
|
1918
|
+
Export: Export
|
|
1919
|
+
};
|
|
1920
|
+
|
|
1921
|
+
}());
|