sprockets-browserify 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +70 -0
- data/Rakefile +38 -0
- data/lib/sprockets/browserify/engine.rb +15 -0
- data/lib/sprockets/browserify.rb +37 -0
- data/lib/sprockets-browserify.rb +2 -0
- data/lib/tasks/sprockets-browserify_tasks.rake +4 -0
- data/node_modules/JSONStream/LICENSE.APACHE2 +15 -0
- data/node_modules/JSONStream/LICENSE.MIT +24 -0
- data/node_modules/JSONStream/examples/all_docs.js +13 -0
- data/node_modules/JSONStream/index.js +189 -0
- data/node_modules/JSONStream/node_modules/jsonparse/LICENSE +24 -0
- data/node_modules/JSONStream/node_modules/jsonparse/README.markdown +11 -0
- data/node_modules/JSONStream/node_modules/jsonparse/bench.js +26 -0
- data/node_modules/JSONStream/node_modules/jsonparse/examples/twitterfeed.js +30 -0
- data/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js +379 -0
- data/node_modules/JSONStream/node_modules/jsonparse/package.json +34 -0
- data/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic.json +167 -0
- data/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic2.json +180 -0
- data/node_modules/JSONStream/node_modules/jsonparse/test/primitives.js +54 -0
- data/node_modules/JSONStream/node_modules/jsonparse/test/utf8.js +38 -0
- data/node_modules/JSONStream/package.json +38 -0
- data/node_modules/JSONStream/readme.markdown +145 -0
- data/node_modules/JSONStream/test/bool.js +41 -0
- data/node_modules/JSONStream/test/destroy_missing.js +22 -0
- data/node_modules/JSONStream/test/empty.js +44 -0
- data/node_modules/JSONStream/test/fixtures/all_npm.json +4030 -0
- data/node_modules/JSONStream/test/fn.js +39 -0
- data/node_modules/JSONStream/test/memory.js +69 -0
- data/node_modules/JSONStream/test/multiple_objects.js +42 -0
- data/node_modules/JSONStream/test/multiple_objects_error.js +35 -0
- data/node_modules/JSONStream/test/parsejson.js +28 -0
- data/node_modules/JSONStream/test/stringify.js +41 -0
- data/node_modules/JSONStream/test/stringify_object.js +47 -0
- data/node_modules/JSONStream/test/test.js +35 -0
- data/node_modules/JSONStream/test/test2.js +29 -0
- data/node_modules/JSONStream/test/two-ways.js +41 -0
- data/node_modules/browserify/LICENSE +63 -0
- data/node_modules/browserify/README.markdown +172 -0
- data/node_modules/browserify/bin/cmd.js +161 -0
- data/node_modules/browserify/builtins/__browserify_process.js +55 -0
- data/node_modules/browserify/builtins/assert.js +314 -0
- data/node_modules/browserify/builtins/child_process.js +2 -0
- data/node_modules/browserify/builtins/events.js +178 -0
- data/node_modules/browserify/builtins/fs.js +1 -0
- data/node_modules/browserify/builtins/https.js +1 -0
- data/node_modules/browserify/builtins/net.js +1 -0
- data/node_modules/browserify/builtins/path.js +175 -0
- data/node_modules/browserify/builtins/querystring.js +250 -0
- data/node_modules/browserify/builtins/stream.js +119 -0
- data/node_modules/browserify/builtins/string_decoder.js +161 -0
- data/node_modules/browserify/builtins/sys.js +1 -0
- data/node_modules/browserify/builtins/timers.js +39 -0
- data/node_modules/browserify/builtins/tls.js +1 -0
- data/node_modules/browserify/builtins/tty.js +2 -0
- data/node_modules/browserify/builtins/url.js +604 -0
- data/node_modules/browserify/builtins/util.js +351 -0
- data/node_modules/browserify/doc/methods.markdown +182 -0
- data/node_modules/browserify/doc/recipes.markdown +62 -0
- data/node_modules/browserify/example/debug/browserify.js +219 -0
- data/node_modules/browserify/example/debug/build.sh +3 -0
- data/node_modules/browserify/example/debug/index.html +7 -0
- data/node_modules/browserify/example/debug/js/entry.js +2 -0
- data/node_modules/browserify/example/debug/js/thrower.js +3 -0
- data/node_modules/browserify/example/debug/server.js +9 -0
- data/node_modules/browserify/example/simple-build/browserify.js +368 -0
- data/node_modules/browserify/example/simple-build/build.sh +3 -0
- data/node_modules/browserify/example/simple-build/index.html +9 -0
- data/node_modules/browserify/example/simple-build/js/bar.js +3 -0
- data/node_modules/browserify/example/simple-build/js/entry.js +5 -0
- data/node_modules/browserify/example/simple-build/js/foo.js +5 -0
- data/node_modules/browserify/example/simple-build/server.js +9 -0
- data/node_modules/browserify/example/test/b.js +5 -0
- data/node_modules/browserify/example/test/bar.js +3 -0
- data/node_modules/browserify/example/test/foo.js +3 -0
- data/node_modules/browserify/example/test/m.js +3 -0
- data/node_modules/browserify/example/test/n.js +3 -0
- data/node_modules/browserify/example/using-http/bundle.js +813 -0
- data/node_modules/browserify/example/using-http/entry.js +25 -0
- data/node_modules/browserify/example/using-http/index.html +9 -0
- data/node_modules/browserify/example/using-http/server.js +28 -0
- data/node_modules/browserify/index.js +202 -0
- data/node_modules/browserify/lib/watch.js +75 -0
- data/node_modules/browserify/lib/wrap.js +583 -0
- data/node_modules/browserify/lib/wrappers.js +10 -0
- data/node_modules/browserify/node_modules/buffer-browserify/README.md +11 -0
- data/node_modules/browserify/node_modules/buffer-browserify/buffer_ieee754.js +84 -0
- data/node_modules/browserify/node_modules/buffer-browserify/index.js +1317 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/README.md +14 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/lib/b64.js +84 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/package.json +26 -0
- data/node_modules/browserify/node_modules/buffer-browserify/node_modules/base64-js/test/runner.js +50 -0
- data/node_modules/browserify/node_modules/buffer-browserify/package.json +42 -0
- data/node_modules/browserify/node_modules/buffer-browserify/test/buffer.js +218 -0
- data/node_modules/browserify/node_modules/coffee-script/CNAME +1 -0
- data/node_modules/browserify/node_modules/coffee-script/CONTRIBUTING.md +9 -0
- data/node_modules/browserify/node_modules/coffee-script/LICENSE +22 -0
- data/node_modules/browserify/node_modules/coffee-script/README +51 -0
- data/node_modules/browserify/node_modules/coffee-script/Rakefile +79 -0
- data/node_modules/browserify/node_modules/coffee-script/bin/cake +7 -0
- data/node_modules/browserify/node_modules/coffee-script/bin/coffee +7 -0
- data/node_modules/browserify/node_modules/coffee-script/extras/jsl.conf +44 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/browser.js +101 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/cake.js +113 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/coffee-script.js +218 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/command.js +506 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/grammar.js +623 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/helpers.js +150 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/lexer.js +905 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/nodes.js +3088 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/optparse.js +138 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/parser.js +608 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/repl.js +104 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/rewriter.js +478 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/scope.js +147 -0
- data/node_modules/browserify/node_modules/coffee-script/lib/coffee-script/sourcemap.js +237 -0
- data/node_modules/browserify/node_modules/coffee-script/package.json +48 -0
- data/node_modules/browserify/node_modules/commondir/README.markdown +45 -0
- data/node_modules/browserify/node_modules/commondir/example/base.js +3 -0
- data/node_modules/browserify/node_modules/commondir/example/dir.js +3 -0
- data/node_modules/browserify/node_modules/commondir/index.js +29 -0
- data/node_modules/browserify/node_modules/commondir/package.json +43 -0
- data/node_modules/browserify/node_modules/commondir/test/dirs.js +66 -0
- data/node_modules/browserify/node_modules/console-browserify/LICENCE +19 -0
- data/node_modules/browserify/node_modules/console-browserify/README.md +32 -0
- data/node_modules/browserify/node_modules/console-browserify/index.js +85 -0
- data/node_modules/browserify/node_modules/console-browserify/package.json +76 -0
- data/node_modules/browserify/node_modules/console-browserify/test/index.js +67 -0
- data/node_modules/browserify/node_modules/console-browserify/test/static/index.html +12 -0
- data/node_modules/browserify/node_modules/console-browserify/test/static/test-adapter.js +53 -0
- data/node_modules/browserify/node_modules/crypto-browserify/example/bundle.js +637 -0
- data/node_modules/browserify/node_modules/crypto-browserify/example/index.html +12 -0
- data/node_modules/browserify/node_modules/crypto-browserify/example/test.js +4 -0
- data/node_modules/browserify/node_modules/crypto-browserify/index.js +74 -0
- data/node_modules/browserify/node_modules/crypto-browserify/md5.js +384 -0
- data/node_modules/browserify/node_modules/crypto-browserify/package.json +30 -0
- data/node_modules/browserify/node_modules/crypto-browserify/readme.markdown +20 -0
- data/node_modules/browserify/node_modules/crypto-browserify/rng.js +37 -0
- data/node_modules/browserify/node_modules/crypto-browserify/sha.js +210 -0
- data/node_modules/browserify/node_modules/crypto-browserify/test/simple.js +35 -0
- data/node_modules/browserify/node_modules/deputy/README.markdown +55 -0
- data/node_modules/browserify/node_modules/deputy/example/cache.js +5 -0
- data/node_modules/browserify/node_modules/deputy/index.js +46 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/LICENSE +21 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/examples/pow.js +6 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/index.js +82 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/package.json +30 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/readme.markdown +63 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/chmod.js +38 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/clobber.js +37 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/mkdirp.js +28 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/perm.js +32 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/perm_sync.js +39 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/race.js +41 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/rel.js +32 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/return.js +25 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/return_sync.js +24 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/root.js +18 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/sync.js +32 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/umask.js +28 -0
- data/node_modules/browserify/node_modules/deputy/node_modules/mkdirp/test/umask_sync.js +32 -0
- data/node_modules/browserify/node_modules/deputy/package.json +43 -0
- data/node_modules/browserify/node_modules/deputy/test/cache.js +58 -0
- data/node_modules/browserify/node_modules/detective/README.markdown +66 -0
- data/node_modules/browserify/node_modules/detective/example/strings.js +6 -0
- data/node_modules/browserify/node_modules/detective/example/strings_src.js +3 -0
- data/node_modules/browserify/node_modules/detective/index.js +60 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/LICENSE.BSD +19 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/README.md +74 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/codemirror.css +112 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/codemirror.js +2972 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/codemirror/javascript.js +360 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/json2.js +487 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/style.css +164 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview-min.js +12 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview-sprite.gif +0 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/treeview.css +7 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/assets/yui/yahoo-dom-event.js +14 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/bin/esparse.js +42 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/changes +92 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/cm +696 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/checkenv.js +42 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/collector.html +82 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/collector.js +170 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/functiontrace.html +106 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/functiontrace.js +123 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/parse.css +82 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/parse.html +352 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/precedence.html +225 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/rewrite.html +120 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/demo/rewrite.js +71 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/esprima.js +3577 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/index.html +103 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/package.json +39 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/Tokenizer.js +646 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/XMLHttpRequest.js +509 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ZeParser.js +2185 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/backbone-0.5.3.js +1158 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/benchmark.js +3261 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/escodegen.js +906 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/esmorph.js +240 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ext-core-3.0.0.js +6579 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/ext-core-3.1.0.js +10255 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery-1.6.4.js +9046 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery-1.7.1.js +9266 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jquery.mobile-1.0.js +6951 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jsdefs.js +731 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jslex.js +588 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/jsparse.js +1921 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/mootools-1.3.2.js +5952 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/mootools-1.4.1.js +6297 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/parse-js.js +1342 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/platform.js +878 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/prototype-1.6.1.js +4874 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/prototype-1.7.0.0.js +6082 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/3rdparty/underscore-1.2.3.js +981 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/benchmarks.html +58 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/benchmarks.js +328 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compare.html +140 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compare.js +270 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compat.html +40 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/compat.js +239 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.footer.html +3 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.header.html +37 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/coverage.html +3617 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/index.html +36 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/reflect.js +403 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/run.js +66 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/test/test.js +16659 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/tools/generate-unicode-regex.py +164 -0
- data/node_modules/browserify/node_modules/detective/node_modules/esprima/tools/update-coverage.sh +28 -0
- data/node_modules/browserify/node_modules/detective/package.json +43 -0
- data/node_modules/browserify/node_modules/detective/test/both.js +11 -0
- data/node_modules/browserify/node_modules/detective/test/chained.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/files/both.js +4 -0
- data/node_modules/browserify/node_modules/detective/test/files/chained.js +5 -0
- data/node_modules/browserify/node_modules/detective/test/files/nested.js +22 -0
- data/node_modules/browserify/node_modules/detective/test/files/skip.js +7 -0
- data/node_modules/browserify/node_modules/detective/test/files/strings.js +13 -0
- data/node_modules/browserify/node_modules/detective/test/files/word.js +13 -0
- data/node_modules/browserify/node_modules/detective/test/nested.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/skip.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/strings.js +9 -0
- data/node_modules/browserify/node_modules/detective/test/word.js +12 -0
- data/node_modules/browserify/node_modules/http-browserify/example/get/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/get/main.js +14 -0
- data/node_modules/browserify/node_modules/http-browserify/example/get/server.js +12 -0
- data/node_modules/browserify/node_modules/http-browserify/example/headers/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/headers/main.js +18 -0
- data/node_modules/browserify/node_modules/http-browserify/example/headers/server.js +15 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/data.json +139 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/main.js +13 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/LICENSE.APACHE2 +15 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/LICENSE.MIT +24 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/examples/all_docs.js +13 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/index.js +189 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/LICENSE +24 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/README.markdown +11 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/bench.js +26 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/examples/twitterfeed.js +30 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/jsonparse.js +379 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/package.json +36 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic.json +167 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/samplejson/basic2.json +180 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/test/primitives.js +54 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/node_modules/jsonparse/test/utf8.js +38 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/package.json +40 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/readme.markdown +145 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/bool.js +41 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/destroy_missing.js +22 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/empty.js +44 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/fixtures/all_npm.json +4030 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/fn.js +39 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/memory.js +69 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects.js +42 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/multiple_objects_error.js +35 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/parsejson.js +28 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/stringify.js +41 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/stringify_object.js +47 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/test.js +35 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/test2.js +29 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/node_modules/JSONStream/test/two-ways.js +41 -0
- data/node_modules/browserify/node_modules/http-browserify/example/json-stream/server.js +10 -0
- data/node_modules/browserify/node_modules/http-browserify/example/post/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/post/main.js +16 -0
- data/node_modules/browserify/node_modules/http-browserify/example/post/server.js +19 -0
- data/node_modules/browserify/node_modules/http-browserify/example/streaming/index.html +9 -0
- data/node_modules/browserify/node_modules/http-browserify/example/streaming/main.js +16 -0
- data/node_modules/browserify/node_modules/http-browserify/example/streaming/server.js +21 -0
- data/node_modules/browserify/node_modules/http-browserify/index.js +60 -0
- data/node_modules/browserify/node_modules/http-browserify/lib/request.js +128 -0
- data/node_modules/browserify/node_modules/http-browserify/lib/response.js +119 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/index.js +48 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/package.json +29 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/readme.md +31 -0
- data/node_modules/browserify/node_modules/http-browserify/node_modules/concat-stream/test.js +34 -0
- data/node_modules/browserify/node_modules/http-browserify/package.json +42 -0
- data/node_modules/browserify/node_modules/http-browserify/readme.markdown +128 -0
- data/node_modules/browserify/node_modules/nub/README.markdown +23 -0
- data/node_modules/browserify/node_modules/nub/index.js +64 -0
- data/node_modules/browserify/node_modules/nub/package.json +42 -0
- data/node_modules/browserify/node_modules/nub/test/by.js +51 -0
- data/node_modules/browserify/node_modules/nub/test/nub.js +46 -0
- data/node_modules/browserify/node_modules/optimist/LICENSE +21 -0
- data/node_modules/browserify/node_modules/optimist/README.markdown +487 -0
- data/node_modules/browserify/node_modules/optimist/example/bool.js +10 -0
- data/node_modules/browserify/node_modules/optimist/example/boolean_double.js +7 -0
- data/node_modules/browserify/node_modules/optimist/example/boolean_single.js +7 -0
- data/node_modules/browserify/node_modules/optimist/example/default_hash.js +8 -0
- data/node_modules/browserify/node_modules/optimist/example/default_singles.js +7 -0
- data/node_modules/browserify/node_modules/optimist/example/divide.js +8 -0
- data/node_modules/browserify/node_modules/optimist/example/line_count.js +20 -0
- data/node_modules/browserify/node_modules/optimist/example/line_count_options.js +29 -0
- data/node_modules/browserify/node_modules/optimist/example/line_count_wrap.js +29 -0
- data/node_modules/browserify/node_modules/optimist/example/nonopt.js +4 -0
- data/node_modules/browserify/node_modules/optimist/example/reflect.js +2 -0
- data/node_modules/browserify/node_modules/optimist/example/short.js +3 -0
- data/node_modules/browserify/node_modules/optimist/example/string.js +11 -0
- data/node_modules/browserify/node_modules/optimist/example/usage-options.js +19 -0
- data/node_modules/browserify/node_modules/optimist/example/xup.js +10 -0
- data/node_modules/browserify/node_modules/optimist/index.js +475 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/README.markdown +70 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/example/center.js +10 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/example/meat.js +3 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/index.js +76 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/package.json +41 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/test/break.js +30 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/test/idleness.txt +63 -0
- data/node_modules/browserify/node_modules/optimist/node_modules/wordwrap/test/wrap.js +31 -0
- data/node_modules/browserify/node_modules/optimist/package.json +47 -0
- data/node_modules/browserify/node_modules/optimist/test/_/argv.js +2 -0
- data/node_modules/browserify/node_modules/optimist/test/_/bin.js +3 -0
- data/node_modules/browserify/node_modules/optimist/test/_.js +71 -0
- data/node_modules/browserify/node_modules/optimist/test/parse.js +433 -0
- data/node_modules/browserify/node_modules/optimist/test/usage.js +292 -0
- data/node_modules/browserify/node_modules/optimist/x.js +1 -0
- data/node_modules/browserify/node_modules/resolve/LICENSE +18 -0
- data/node_modules/browserify/node_modules/resolve/README.markdown +47 -0
- data/node_modules/browserify/node_modules/resolve/index.js +109 -0
- data/node_modules/browserify/node_modules/resolve/package.json +41 -0
- data/node_modules/browserify/node_modules/resolve/test/core.js +12 -0
- data/node_modules/browserify/node_modules/resolve/test/filter.js +15 -0
- data/node_modules/browserify/node_modules/resolve/test/mock.js +68 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/baz/doom.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/baz/package.json +3 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/baz/quux.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/cup.coffee +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/foo.js +1 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/mug.coffee +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/mug.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/other_path/lib/other-lib.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver/other_path/root.js +0 -0
- data/node_modules/browserify/node_modules/resolve/test/resolver.js +157 -0
- data/node_modules/browserify/node_modules/syntax-error/LICENSE +18 -0
- data/node_modules/browserify/node_modules/syntax-error/example/check.js +12 -0
- data/node_modules/browserify/node_modules/syntax-error/example/src.js +9 -0
- data/node_modules/browserify/node_modules/syntax-error/index.js +54 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/LICENSE.BSD +19 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/README.md +74 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/codemirror.css +112 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/codemirror.js +2972 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/codemirror/javascript.js +360 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/json2.js +487 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/style.css +164 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview-min.js +12 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview-sprite.gif +0 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/treeview.css +7 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/assets/yui/yahoo-dom-event.js +14 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/bin/esparse.js +42 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/changes +92 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/cm +696 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/checkenv.js +42 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/collector.html +82 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/collector.js +170 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/functiontrace.html +106 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/functiontrace.js +123 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/parse.css +82 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/parse.html +352 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/precedence.html +225 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/rewrite.html +120 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/demo/rewrite.js +71 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/esprima.js +3577 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/index.html +103 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/package.json +39 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/Tokenizer.js +646 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/XMLHttpRequest.js +509 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ZeParser.js +2185 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/backbone-0.5.3.js +1158 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/benchmark.js +3261 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/escodegen.js +906 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/esmorph.js +240 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ext-core-3.0.0.js +6579 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/ext-core-3.1.0.js +10255 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery-1.6.4.js +9046 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery-1.7.1.js +9266 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jquery.mobile-1.0.js +6951 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jsdefs.js +731 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jslex.js +588 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/jsparse.js +1921 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/mootools-1.3.2.js +5952 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/mootools-1.4.1.js +6297 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/parse-js.js +1342 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/platform.js +878 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/prototype-1.6.1.js +4874 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/prototype-1.7.0.0.js +6082 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/3rdparty/underscore-1.2.3.js +981 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/benchmarks.html +58 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/benchmarks.js +328 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compare.html +140 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compare.js +270 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compat.html +40 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/compat.js +239 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.footer.html +3 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.header.html +37 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/coverage.html +3617 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/index.html +36 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/reflect.js +403 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/run.js +66 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/test/test.js +16659 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/tools/generate-unicode-regex.py +164 -0
- data/node_modules/browserify/node_modules/syntax-error/node_modules/esprima/tools/update-coverage.sh +28 -0
- data/node_modules/browserify/node_modules/syntax-error/package.json +46 -0
- data/node_modules/browserify/node_modules/syntax-error/readme.markdown +87 -0
- data/node_modules/browserify/node_modules/syntax-error/test/check.js +17 -0
- data/node_modules/browserify/node_modules/syntax-error/test/sources/check.js +9 -0
- data/node_modules/browserify/node_modules/vm-browserify/README.markdown +103 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/bundle.js +473 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/entry.js +6 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/index.html +9 -0
- data/node_modules/browserify/node_modules/vm-browserify/example/run/server.js +6 -0
- data/node_modules/browserify/node_modules/vm-browserify/index.js +85 -0
- data/node_modules/browserify/node_modules/vm-browserify/package.json +39 -0
- data/node_modules/browserify/node_modules/vm-browserify/testling/run.js +22 -0
- data/node_modules/browserify/node_modules/vm-browserify/testling/test.sh +11 -0
- data/node_modules/browserify/package.json +71 -0
- data/node_modules/browserify/test/alias.js +58 -0
- data/node_modules/browserify/test/backbone.js +21 -0
- data/node_modules/browserify/test/bin.js +39 -0
- data/node_modules/browserify/test/buffer.js +99 -0
- data/node_modules/browserify/test/bundle.js +32 -0
- data/node_modules/browserify/test/cache.js +28 -0
- data/node_modules/browserify/test/coffee/bar.js +1 -0
- data/node_modules/browserify/test/coffee/baz.coffee +1 -0
- data/node_modules/browserify/test/coffee/entry.coffee +1 -0
- data/node_modules/browserify/test/coffee/foo.coffee +1 -0
- data/node_modules/browserify/test/coffee/index.coffee +5 -0
- data/node_modules/browserify/test/coffee/nested/nested.coffee +2 -0
- data/node_modules/browserify/test/coffee.js +39 -0
- data/node_modules/browserify/test/comment/main.js +2 -0
- data/node_modules/browserify/test/comment.js +17 -0
- data/node_modules/browserify/test/crypto.js +37 -0
- data/node_modules/browserify/test/dnode.js +27 -0
- data/node_modules/browserify/test/dollar/dollar/index.js +7 -0
- data/node_modules/browserify/test/dollar.js +19 -0
- data/node_modules/browserify/test/entry/main.js +1 -0
- data/node_modules/browserify/test/entry/one.js +1 -0
- data/node_modules/browserify/test/entry/two.js +1 -0
- data/node_modules/browserify/test/entry.js +36 -0
- data/node_modules/browserify/test/error_code/src.js +2 -0
- data/node_modules/browserify/test/error_code.js +24 -0
- data/node_modules/browserify/test/export/entry.js +1 -0
- data/node_modules/browserify/test/export.js +52 -0
- data/node_modules/browserify/test/field/miss.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-miss/browser.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-miss/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-miss/package.json +4 -0
- data/node_modules/browserify/test/field/node_modules/z-object/browser.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-object/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-object/package.json +6 -0
- data/node_modules/browserify/test/field/node_modules/z-string/browser.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-string/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-string/package.json +4 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/browser/a.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/browser/b.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/main.js +1 -0
- data/node_modules/browserify/test/field/node_modules/z-sub/package.json +4 -0
- data/node_modules/browserify/test/field/object.js +1 -0
- data/node_modules/browserify/test/field/string.js +1 -0
- data/node_modules/browserify/test/field/sub.js +1 -0
- data/node_modules/browserify/test/field.js +64 -0
- data/node_modules/browserify/test/global/main.js +2 -0
- data/node_modules/browserify/test/global.js +19 -0
- data/node_modules/browserify/test/jade.js +35 -0
- data/node_modules/browserify/test/json/beep.json +4 -0
- data/node_modules/browserify/test/json/main.js +1 -0
- data/node_modules/browserify/test/json.js +17 -0
- data/node_modules/browserify/test/maxlisteners.js +8 -0
- data/node_modules/browserify/test/module.js +22 -0
- data/node_modules/browserify/test/multi_entry/a.js +2 -0
- data/node_modules/browserify/test/multi_entry/b.js +2 -0
- data/node_modules/browserify/test/multi_entry/c.js +3 -0
- data/node_modules/browserify/test/multi_entry.js +20 -0
- data/node_modules/browserify/test/multi_ignore.js +23 -0
- data/node_modules/browserify/test/node_modules/beep/index.js +1 -0
- data/node_modules/browserify/test/require_cache.js +18 -0
- data/node_modules/browserify/test/retarget.js +27 -0
- data/node_modules/browserify/test/seq.js +47 -0
- data/node_modules/browserify/test/subdep/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/b.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/ignore_me.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/a/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/a/package.json +5 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/c/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/c/package.json +5 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/f/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/node_modules/z/index.js +1 -0
- data/node_modules/browserify/test/subdep/node_modules/qq/package.json +3 -0
- data/node_modules/browserify/test/subdep/package.json +6 -0
- data/node_modules/browserify/test/subdep.js +26 -0
- data/node_modules/browserify/test/util.js +48 -0
- data/node_modules/browserify/test/watch/a.js +1 -0
- data/node_modules/browserify/test/watch.js +91 -0
- data/node_modules/browserify/test/wrap/a.js +2 -0
- data/node_modules/browserify/test/wrap/c.js +1 -0
- data/node_modules/browserify/test/wrap/node_modules/b/main.js +1 -0
- data/node_modules/browserify/test/wrap/node_modules/b/package.json +3 -0
- data/node_modules/browserify/test/wrap/node_modules/skipmetoo/index.js +1 -0
- data/node_modules/browserify/test/wrap/skipme.js +1 -0
- data/node_modules/browserify/test/wrap/x.js +0 -0
- data/node_modules/browserify/test/wrap.js +43 -0
- data/node_modules/browserify/testling/README.markdown +29 -0
- data/node_modules/browserify/testling/test.sh +37 -0
- data/node_modules/browserify/testling/tick.js +9 -0
- data/node_modules/browserify/testling/timers.js +50 -0
- data/node_modules/browserify/testling/util.js +24 -0
- data/node_modules/browserify/v2.markdown +41 -0
- data/node_modules/browserify/wrappers/alias.js +1 -0
- data/node_modules/browserify/wrappers/body.js +2 -0
- data/node_modules/browserify/wrappers/body_debug.js +2 -0
- data/node_modules/browserify/wrappers/entry.js +3 -0
- data/node_modules/browserify/wrappers/entry_debug.js +3 -0
- data/node_modules/browserify/wrappers/package.js +3 -0
- data/node_modules/browserify/wrappers/prelude.js +196 -0
- data/node_modules/module-deps/LICENSE +18 -0
- data/node_modules/module-deps/cmd.js +8 -0
- data/node_modules/module-deps/example/deps.js +8 -0
- data/node_modules/module-deps/example/files/bar.js +3 -0
- data/node_modules/module-deps/example/files/foo.js +5 -0
- data/node_modules/module-deps/example/files/main.js +2 -0
- data/node_modules/module-deps/example/files/xyz.js +2 -0
- data/node_modules/module-deps/index.js +142 -0
- data/node_modules/module-deps/node_modules/browser-resolve/README.md +14 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/assert.js +314 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/child_process.js +2 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/events.js +183 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/fs.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/https.js +13 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/net.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/path.js +175 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/process.js +55 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/querystring.js +250 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/stream.js +119 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/string_decoder.js +161 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/sys.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/timers.js +39 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/tls.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/tty.js +2 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/url.js +604 -0
- data/node_modules/module-deps/node_modules/browser-resolve/builtin/util.js +351 -0
- data/node_modules/module-deps/node_modules/browser-resolve/index.js +144 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/README.md +11 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/buffer_ieee754.js +84 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/index.js +1282 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/README.md +14 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/lib/b64.js +84 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/package.json +26 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/node_modules/base64-js/test/runner.js +50 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/package.json +42 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/buffer-browserify/test/buffer.js +121 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/LICENCE +19 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/README.md +32 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/index.js +85 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/package.json +76 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/test/index.js +67 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/test/static/index.html +12 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/console-browserify/test/static/test-adapter.js +53 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/example/bundle.js +637 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/example/index.html +12 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/example/test.js +4 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/index.js +74 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/md5.js +384 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/package.json +30 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/readme.markdown +20 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/rng.js +37 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/sha.js +210 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/crypto-browserify/test/simple.js +35 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/README.markdown +128 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/get/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/get/main.js +14 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/get/server.js +12 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/headers/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/headers/main.js +18 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/headers/server.js +15 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/post/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/post/main.js +16 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/post/server.js +19 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/streaming/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/streaming/main.js +16 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/example/streaming/server.js +21 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/index.js +59 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/lib/request.js +122 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/lib/response.js +119 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/index.js +48 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/package.json +29 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/readme.md +31 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/node_modules/concat-stream/test.js +34 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/http-browserify/package.json +42 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/README.markdown +103 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/bundle.js +473 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/entry.js +6 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/index.html +9 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/example/run/server.js +6 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/index.js +85 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/package.json +39 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/testling/run.js +22 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/vm-browserify/testling/test.sh +11 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/index.js +43 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/package.json +33 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/readme.md +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/test/zlib.test.js +65 -0
- data/node_modules/module-deps/node_modules/browser-resolve/node_modules/zlib-browserify/zlib.js +55 -0
- data/node_modules/module-deps/node_modules/browser-resolve/package.json +38 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/core.js +20 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/fixtures/foo.js +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/local.js +15 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/mocha.opts +1 -0
- data/node_modules/module-deps/node_modules/browser-resolve/test/modules.js +99 -0
- data/node_modules/module-deps/node_modules/detective/LICENSE +18 -0
- data/node_modules/module-deps/node_modules/detective/example/strings.js +6 -0
- data/node_modules/module-deps/node_modules/detective/example/strings_src.js +3 -0
- data/node_modules/module-deps/node_modules/detective/index.js +62 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/LICENSE.BSD +19 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/LICENSE.source-map +27 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/README.md +99 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/bin/escodegen.js +43 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/bin/esgenerate.js +43 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/escodegen.js +2245 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/LICENSE +28 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/Makefile.dryice.js +165 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/README.md +268 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/assert-shim.js +56 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/mini-require.js +152 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/prefix-source-map.jsm +20 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/prefix-utils.jsm +18 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/suffix-browser.js +8 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/suffix-source-map.jsm +6 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/suffix-utils.jsm +20 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/test-prefix.js +8 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/build/test-suffix.js +3 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/array-set.js +107 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/base64.js +42 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/binary-search.js +81 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/source-map-consumer.js +379 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/source-map-generator.js +202 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/source-node.js +199 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map/util.js +40 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/lib/source-map.js +8 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/README.md +119 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/package.json +29 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/package.json +38 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/run-tests.js +72 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-api.js +26 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-array-set.js +71 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-base64.js +35 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-consumer.js +142 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js +187 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-node.js +163 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/util.js +78 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/escodegen/package.json +48 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/ChangeLog +18 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/LICENSE.BSD +19 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/README.md +73 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/bin/esparse.js +117 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/bin/esvalidate.js +177 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/component.json +14 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/doc/index.html +473 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/esprima.js +3895 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/detectnestedternary.js +106 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/findbooleantrap.js +173 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/examples/tokendist.js +33 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/index.html +102 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/package.json +40 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/benchmarks.html +58 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/benchmarks.js +334 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compare.html +69 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compare.js +328 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compat.html +40 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/compat.js +239 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/coverage.footer.html +3 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/coverage.header.html +37 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/coverage.html +4676 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/index.html +37 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/module.html +36 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/module.js +129 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/reflect.js +422 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/run.js +66 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/runner.js +387 -0
- data/node_modules/module-deps/node_modules/detective/node_modules/esprima/test/test.js +19764 -0
- data/node_modules/module-deps/node_modules/detective/package.json +36 -0
- data/node_modules/module-deps/node_modules/detective/readme.markdown +70 -0
- data/node_modules/module-deps/node_modules/detective/test/both.js +11 -0
- data/node_modules/module-deps/node_modules/detective/test/chained.js +9 -0
- data/node_modules/module-deps/node_modules/detective/test/files/both.js +4 -0
- data/node_modules/module-deps/node_modules/detective/test/files/chained.js +5 -0
- data/node_modules/module-deps/node_modules/detective/test/files/nested.js +22 -0
- data/node_modules/module-deps/node_modules/detective/test/files/shebang.js +5 -0
- data/node_modules/module-deps/node_modules/detective/test/files/strings.js +13 -0
- data/node_modules/module-deps/node_modules/detective/test/files/word.js +13 -0
- data/node_modules/module-deps/node_modules/detective/test/nested.js +9 -0
- data/node_modules/module-deps/node_modules/detective/test/shebang.js +9 -0
- data/node_modules/module-deps/node_modules/detective/test/strings.js +9 -0
- data/node_modules/module-deps/node_modules/detective/test/word.js +12 -0
- data/node_modules/module-deps/node_modules/resolve/LICENSE +18 -0
- data/node_modules/module-deps/node_modules/resolve/example/async.js +5 -0
- data/node_modules/module-deps/node_modules/resolve/example/sync.js +3 -0
- data/node_modules/module-deps/node_modules/resolve/index.js +5 -0
- data/node_modules/module-deps/node_modules/resolve/lib/async.js +131 -0
- data/node_modules/module-deps/node_modules/resolve/lib/core.js +4 -0
- data/node_modules/module-deps/node_modules/resolve/lib/core.json +38 -0
- data/node_modules/module-deps/node_modules/resolve/lib/sync.js +98 -0
- data/node_modules/module-deps/node_modules/resolve/package.json +32 -0
- data/node_modules/module-deps/node_modules/resolve/readme.markdown +134 -0
- data/node_modules/module-deps/node_modules/resolve/test/core.js +12 -0
- data/node_modules/module-deps/node_modules/resolve/test/filter.js +17 -0
- data/node_modules/module-deps/node_modules/resolve/test/filter_sync.js +15 -0
- data/node_modules/module-deps/node_modules/resolve/test/mock.js +68 -0
- data/node_modules/module-deps/node_modules/resolve/test/mock_sync.js +68 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/bar/node_modules/foo/index.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/baz/doom.js +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/baz/package.json +3 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/baz/quux.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/biz/node_modules/grux/index.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/biz/node_modules/tiv/index.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/cup.coffee +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/foo.js +1 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/mug.coffee +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/mug.js +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/other_path/lib/other-lib.js +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver/other_path/root.js +0 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver.js +144 -0
- data/node_modules/module-deps/node_modules/resolve/test/resolver_sync.js +157 -0
- data/node_modules/module-deps/package.json +47 -0
- data/node_modules/module-deps/readme.markdown +128 -0
- data/node_modules/module-deps/test/bundle.js +21 -0
- data/node_modules/module-deps/test/deps.js +42 -0
- data/node_modules/module-deps/test/files/bar.js +3 -0
- data/node_modules/module-deps/test/files/foo.js +5 -0
- data/node_modules/module-deps/test/files/main.js +2 -0
- data/node_modules/module-deps/test/files/tr_module/f.js +1 -0
- data/node_modules/module-deps/test/files/tr_module/main.js +7 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/g/index.js +1 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/g/node_modules/insert-ggg/index.js +7 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/g/package.json +6 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/insert-aaa/index.js +7 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/insert-bbb/index.js +7 -0
- data/node_modules/module-deps/test/files/tr_module/node_modules/m/index.js +3 -0
- data/node_modules/module-deps/test/files/tr_sh/f.js +1 -0
- data/node_modules/module-deps/test/files/tr_sh/main.js +7 -0
- data/node_modules/module-deps/test/files/tr_sh/node_modules/g/index.js +1 -0
- data/node_modules/module-deps/test/files/tr_sh/node_modules/g/package.json +6 -0
- data/node_modules/module-deps/test/files/tr_sh/node_modules/g/tr_g.js +6 -0
- data/node_modules/module-deps/test/files/tr_sh/node_modules/m/index.js +3 -0
- data/node_modules/module-deps/test/files/tr_sh/tr_a.js +6 -0
- data/node_modules/module-deps/test/files/tr_sh/tr_b.js +6 -0
- data/node_modules/module-deps/test/files/xyz.js +2 -0
- data/node_modules/module-deps/test/tr_fn.js +29 -0
- data/node_modules/module-deps/test/tr_module.js +21 -0
- data/node_modules/module-deps/test/tr_sh.js +21 -0
- data/node_modules/through/LICENSE.APACHE2 +15 -0
- data/node_modules/through/LICENSE.MIT +24 -0
- data/node_modules/through/index.js +103 -0
- data/node_modules/through/package.json +35 -0
- data/node_modules/through/readme.markdown +43 -0
- data/node_modules/through/test/buffering.js +71 -0
- data/node_modules/through/test/end.js +27 -0
- data/node_modules/through/test/index.js +113 -0
- data/package.json +11 -0
- metadata +846 -0
@@ -0,0 +1,3617 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang="en">
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<title>Esprima: Coverage Analysis Report</title>
|
6
|
+
<link rel="stylesheet" type="text/css" href="../assets/style.css"/>
|
7
|
+
</head>
|
8
|
+
<style>
|
9
|
+
span.covered {
|
10
|
+
}
|
11
|
+
|
12
|
+
span.uncovered {
|
13
|
+
background: #FDD;
|
14
|
+
}
|
15
|
+
|
16
|
+
span.partial {
|
17
|
+
background: #FFA;
|
18
|
+
}
|
19
|
+
</style>
|
20
|
+
<body>
|
21
|
+
<div class="container">
|
22
|
+
|
23
|
+
<div class="topbar">
|
24
|
+
<ul class="nav">
|
25
|
+
<li><a href="../index.html">← Home</a></li>
|
26
|
+
<li><a href="http://github.com/ariya/esprima">Code</a></li>
|
27
|
+
<li><a href="http://wiki.esprima.org">Documentation</a></li>
|
28
|
+
<li><a href="http://issues.esprima.org">Issues</a></li>
|
29
|
+
</ul>
|
30
|
+
</div>
|
31
|
+
|
32
|
+
<h1>Coverage Analysis <small>ensures systematic exercise of the parser</small></h1>
|
33
|
+
|
34
|
+
<p><strong>Note</strong>: This is not a live (in-browser) code coverage report.
|
35
|
+
The analysis is <a href="http://code.google.com/p/esprima/wiki/Testing#Code_coverage_test">performed</a> offline
|
36
|
+
(using <a href="https://github.com/itay/node-cover">node-cover</a>).<br>
|
37
|
+
|
38
|
+
Tested revision: <a href='https://github.com/ariya/esprima/commit/ab71a29'>ab71a29</a>
|
39
|
+
(dated 24 Mar 2012).</p>
|
40
|
+
<pre>
|
41
|
+
<span class='covered'>/*
|
42
|
+
<span class='covered'> Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com></span>
|
43
|
+
<span class='covered'> Copyright (C) 2012 Mathias Bynens <mathias@qiwi.be></span>
|
44
|
+
<span class='covered'> Copyright (C) 2012 Joost-Wim Boekesteijn <joost-wim@boekesteijn.nl></span>
|
45
|
+
<span class='covered'> Copyright (C) 2012 Kris Kowal <kris.kowal@cixar.com></span>
|
46
|
+
<span class='covered'> Copyright (C) 2012 Yusuke Suzuki <utatane.tea@gmail.com></span>
|
47
|
+
<span class='covered'> Copyright (C) 2012 Arpad Borsos <arpad.borsos@googlemail.com></span>
|
48
|
+
<span class='covered'> Copyright (C) 2011 Ariya Hidayat <ariya.hidayat@gmail.com></span>
|
49
|
+
<span class='covered'> </span>
|
50
|
+
<span class='covered'> Redistribution and use in source and binary forms, with or without</span>
|
51
|
+
<span class='covered'> modification, are permitted provided that the following conditions are met:</span>
|
52
|
+
<span class='covered'> </span>
|
53
|
+
<span class='covered'> * Redistributions of source code must retain the above copyright</span>
|
54
|
+
<span class='covered'> notice, this list of conditions and the following disclaimer.</span>
|
55
|
+
<span class='covered'> * Redistributions in binary form must reproduce the above copyright</span>
|
56
|
+
<span class='covered'> notice, this list of conditions and the following disclaimer in the</span>
|
57
|
+
<span class='covered'> documentation and/or other materials provided with the distribution.</span>
|
58
|
+
<span class='covered'> </span>
|
59
|
+
<span class='covered'> THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"</span>
|
60
|
+
<span class='covered'> AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE</span>
|
61
|
+
<span class='covered'> IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE</span>
|
62
|
+
<span class='covered'> ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY</span>
|
63
|
+
<span class='covered'> DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES</span>
|
64
|
+
<span class='covered'> (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</span>
|
65
|
+
<span class='covered'> LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</span>
|
66
|
+
<span class='covered'> ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span>
|
67
|
+
<span class='covered'> (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF</span>
|
68
|
+
<span class='covered'> THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span>
|
69
|
+
<span class='covered'> */</span>
|
70
|
+
<span class='covered'> </span>
|
71
|
+
<span class='covered'> /*jslint bitwise:true plusplus:true */</span>
|
72
|
+
<span class='covered'> /*global esprima:true, exports:true,</span>
|
73
|
+
<span class='covered'> throwError: true, createLiteral: true, generateStatement: true,</span>
|
74
|
+
<span class='covered'> parseAssignmentExpression: true, parseBlock: true, parseExpression: true,</span>
|
75
|
+
<span class='covered'> parseFunctionDeclaration: true, parseFunctionExpression: true,</span>
|
76
|
+
<span class='covered'> parseFunctionSourceElements: true, parseVariableIdentifier: true,</span>
|
77
|
+
<span class='covered'> parseLeftHandSideExpression: true,</span>
|
78
|
+
<span class='covered'> parseStatement: true, parseSourceElement: true */</span>
|
79
|
+
<span class='covered'> </span>
|
80
|
+
<span class='covered'> (function (exports) {</span>
|
81
|
+
<span class='covered'> 'use strict';</span>
|
82
|
+
<span class='covered'> </span>
|
83
|
+
<span class='covered'> var Token,</span>
|
84
|
+
<span class='covered'> TokenName,</span>
|
85
|
+
<span class='covered'> Syntax,</span>
|
86
|
+
<span class='covered'> PropertyKind,</span>
|
87
|
+
<span class='covered'> Messages,</span>
|
88
|
+
<span class='covered'> Regex,</span>
|
89
|
+
<span class='covered'> source,</span>
|
90
|
+
<span class='covered'> allowIn,</span>
|
91
|
+
<span class='covered'> lastParenthesized,</span>
|
92
|
+
<span class='covered'> strict,</span>
|
93
|
+
<span class='covered'> index,</span>
|
94
|
+
<span class='covered'> lineNumber,</span>
|
95
|
+
<span class='covered'> lineStart,</span>
|
96
|
+
<span class='covered'> length,</span>
|
97
|
+
<span class='covered'> buffer,</span>
|
98
|
+
<span class='covered'> extra,</span>
|
99
|
+
<span class='covered'> labelSet,</span>
|
100
|
+
<span class='covered'> inIteration,</span>
|
101
|
+
<span class='covered'> inSwitch,</span>
|
102
|
+
<span class='covered'> inFunctionBody;</span>
|
103
|
+
<span class='covered'> </span>
|
104
|
+
<span class='covered'> Token = {</span>
|
105
|
+
<span class='covered'> BooleanLiteral: 1,</span>
|
106
|
+
<span class='covered'> EOF: 2,</span>
|
107
|
+
<span class='covered'> Identifier: 3,</span>
|
108
|
+
<span class='covered'> Keyword: 4,</span>
|
109
|
+
<span class='covered'> NullLiteral: 5,</span>
|
110
|
+
<span class='covered'> NumericLiteral: 6,</span>
|
111
|
+
<span class='covered'> Punctuator: 7,</span>
|
112
|
+
<span class='covered'> StringLiteral: 8</span>
|
113
|
+
<span class='covered'> };</span>
|
114
|
+
<span class='covered'> </span>
|
115
|
+
<span class='covered'> TokenName = {};</span>
|
116
|
+
<span class='covered'> TokenName[Token.BooleanLiteral] = 'Boolean';</span>
|
117
|
+
<span class='covered'> TokenName[Token.EOF] = '<end>';</span>
|
118
|
+
<span class='covered'> TokenName[Token.Identifier] = 'Identifier';</span>
|
119
|
+
<span class='covered'> TokenName[Token.Keyword] = 'Keyword';</span>
|
120
|
+
<span class='covered'> TokenName[Token.NullLiteral] = 'Null';</span>
|
121
|
+
<span class='covered'> TokenName[Token.NumericLiteral] = 'Numeric';</span>
|
122
|
+
<span class='covered'> TokenName[Token.Punctuator] = 'Punctuator';</span>
|
123
|
+
<span class='covered'> TokenName[Token.StringLiteral] = 'String';</span>
|
124
|
+
<span class='covered'> </span>
|
125
|
+
<span class='covered'> Syntax = {</span>
|
126
|
+
<span class='covered'> AssignmentExpression: 'AssignmentExpression',</span>
|
127
|
+
<span class='covered'> ArrayExpression: 'ArrayExpression',</span>
|
128
|
+
<span class='covered'> BlockStatement: 'BlockStatement',</span>
|
129
|
+
<span class='covered'> BinaryExpression: 'BinaryExpression',</span>
|
130
|
+
<span class='covered'> BreakStatement: 'BreakStatement',</span>
|
131
|
+
<span class='covered'> CallExpression: 'CallExpression',</span>
|
132
|
+
<span class='covered'> CatchClause: 'CatchClause',</span>
|
133
|
+
<span class='covered'> ConditionalExpression: 'ConditionalExpression',</span>
|
134
|
+
<span class='covered'> ContinueStatement: 'ContinueStatement',</span>
|
135
|
+
<span class='covered'> DoWhileStatement: 'DoWhileStatement',</span>
|
136
|
+
<span class='covered'> DebuggerStatement: 'DebuggerStatement',</span>
|
137
|
+
<span class='covered'> EmptyStatement: 'EmptyStatement',</span>
|
138
|
+
<span class='covered'> ExpressionStatement: 'ExpressionStatement',</span>
|
139
|
+
<span class='covered'> ForStatement: 'ForStatement',</span>
|
140
|
+
<span class='covered'> ForInStatement: 'ForInStatement',</span>
|
141
|
+
<span class='covered'> FunctionDeclaration: 'FunctionDeclaration',</span>
|
142
|
+
<span class='covered'> FunctionExpression: 'FunctionExpression',</span>
|
143
|
+
<span class='covered'> Identifier: 'Identifier',</span>
|
144
|
+
<span class='covered'> IfStatement: 'IfStatement',</span>
|
145
|
+
<span class='covered'> Literal: 'Literal',</span>
|
146
|
+
<span class='covered'> LabeledStatement: 'LabeledStatement',</span>
|
147
|
+
<span class='covered'> LogicalExpression: 'LogicalExpression',</span>
|
148
|
+
<span class='covered'> MemberExpression: 'MemberExpression',</span>
|
149
|
+
<span class='covered'> NewExpression: 'NewExpression',</span>
|
150
|
+
<span class='covered'> ObjectExpression: 'ObjectExpression',</span>
|
151
|
+
<span class='covered'> Program: 'Program',</span>
|
152
|
+
<span class='covered'> Property: 'Property',</span>
|
153
|
+
<span class='covered'> ReturnStatement: 'ReturnStatement',</span>
|
154
|
+
<span class='covered'> SequenceExpression: 'SequenceExpression',</span>
|
155
|
+
<span class='covered'> SwitchStatement: 'SwitchStatement',</span>
|
156
|
+
<span class='covered'> SwitchCase: 'SwitchCase',</span>
|
157
|
+
<span class='covered'> ThisExpression: 'ThisExpression',</span>
|
158
|
+
<span class='covered'> ThrowStatement: 'ThrowStatement',</span>
|
159
|
+
<span class='covered'> TryStatement: 'TryStatement',</span>
|
160
|
+
<span class='covered'> UnaryExpression: 'UnaryExpression',</span>
|
161
|
+
<span class='covered'> UpdateExpression: 'UpdateExpression',</span>
|
162
|
+
<span class='covered'> VariableDeclaration: 'VariableDeclaration',</span>
|
163
|
+
<span class='covered'> VariableDeclarator: 'VariableDeclarator',</span>
|
164
|
+
<span class='covered'> WhileStatement: 'WhileStatement',</span>
|
165
|
+
<span class='covered'> WithStatement: 'WithStatement'</span>
|
166
|
+
<span class='covered'> };</span>
|
167
|
+
<span class='covered'> </span>
|
168
|
+
<span class='covered'> PropertyKind = {</span>
|
169
|
+
<span class='covered'> Data: 1,</span>
|
170
|
+
<span class='covered'> Get: 2,</span>
|
171
|
+
<span class='covered'> Set: 4</span>
|
172
|
+
<span class='covered'> };</span>
|
173
|
+
<span class='covered'> </span>
|
174
|
+
<span class='covered'> // Error messages should be identical to V8.</span>
|
175
|
+
<span class='covered'> Messages = {</span>
|
176
|
+
<span class='covered'> UnexpectedToken: 'Unexpected token %0',</span>
|
177
|
+
<span class='covered'> UnexpectedNumber: 'Unexpected number',</span>
|
178
|
+
<span class='covered'> UnexpectedString: 'Unexpected string',</span>
|
179
|
+
<span class='covered'> UnexpectedIdentifier: 'Unexpected identifier',</span>
|
180
|
+
<span class='covered'> UnexpectedReserved: 'Unexpected reserved word',</span>
|
181
|
+
<span class='covered'> UnexpectedEOS: 'Unexpected end of input',</span>
|
182
|
+
<span class='covered'> NewlineAfterThrow: 'Illegal newline after throw',</span>
|
183
|
+
<span class='covered'> InvalidRegExp: 'Invalid regular expression',</span>
|
184
|
+
<span class='covered'> UnterminatedRegExp: 'Invalid regular expression: missing /',</span>
|
185
|
+
<span class='covered'> InvalidLHSInAssignment: 'Invalid left-hand side in assignment',</span>
|
186
|
+
<span class='covered'> InvalidLHSInForIn: 'Invalid left-hand side in for-in',</span>
|
187
|
+
<span class='covered'> NoCatchOrFinally: 'Missing catch or finally after try',</span>
|
188
|
+
<span class='covered'> UnknownLabel: 'Undefined label \'%0\'',</span>
|
189
|
+
<span class='covered'> Redeclaration: '%0 \'%1\' has already been declared',</span>
|
190
|
+
<span class='covered'> IllegalContinue: 'Illegal continue statement',</span>
|
191
|
+
<span class='covered'> IllegalBreak: 'Illegal break statement',</span>
|
192
|
+
<span class='covered'> IllegalReturn: 'Illegal return statement',</span>
|
193
|
+
<span class='covered'> StrictModeWith: 'Strict mode code may not include a with statement',</span>
|
194
|
+
<span class='covered'> StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',</span>
|
195
|
+
<span class='covered'> StrictVarName: 'Variable name may not be eval or arguments in strict mode',</span>
|
196
|
+
<span class='covered'> StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',</span>
|
197
|
+
<span class='covered'> StrictParamDupe: 'Strict mode function may not have duplicate parameter names',</span>
|
198
|
+
<span class='covered'> StrictFunctionName: 'Function name may not be eval or arguments in strict mode',</span>
|
199
|
+
<span class='covered'> StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',</span>
|
200
|
+
<span class='covered'> StrictDelete: 'Delete of an unqualified identifier in strict mode.',</span>
|
201
|
+
<span class='covered'> StrictDuplicateProperty: 'Duplicate data property in object literal not allowed in strict mode',</span>
|
202
|
+
<span class='covered'> AccessorDataProperty: 'Object literal may not have data and accessor property with the same name',</span>
|
203
|
+
<span class='covered'> AccessorGetSet: 'Object literal may not have multiple get/set accessors with the same name',</span>
|
204
|
+
<span class='covered'> StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',</span>
|
205
|
+
<span class='covered'> StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',</span>
|
206
|
+
<span class='covered'> StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',</span>
|
207
|
+
<span class='covered'> StrictReservedWord: 'Use of future reserved word in strict mode'</span>
|
208
|
+
<span class='covered'> };</span>
|
209
|
+
<span class='covered'> </span>
|
210
|
+
<span class='covered'> // See also tools/generate-unicode-regex.py.</span>
|
211
|
+
<span class='covered'> Regex = {</span>
|
212
|
+
<span class='covered'> NonAsciiIdentifierStart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0370-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05d0-\u05ea\u05f0-\u05f2\u0620-\u064a\u066e\u066f\u0671-\u06d3\u06d5\u06e5\u06e6\u06ee\u06ef\u06fa-\u06fc\u06ff\u0710\u0712-\u072f\u074d-\u07a5\u07b1\u07ca-\u07ea\u07f4\u07f5\u07fa\u0800-\u0815\u081a\u0824\u0828\u0840-\u0858\u08a0\u08a2-\u08ac\u0904-\u0939\u093d\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097f\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bd\u09ce\u09dc\u09dd\u09df-\u09e1\u09f0\u09f1\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a59-\u0a5c\u0a5e\u0a72-\u0a74\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abd\u0ad0\u0ae0\u0ae1\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3d\u0b5c\u0b5d\u0b5f-\u0b61\u0b71\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bd0\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d\u0c58\u0c59\u0c60\u0c61\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d60\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb0\u0eb2\u0eb3\u0ebd\u0ec0-\u0ec4\u0ec6\u0edc-\u0edf\u0f00\u0f40-\u0f47\u0f49-\u0f6c\u0f88-\u0f8c\u1000-\u102a\u103f\u1050-\u1055\u105a-\u105d\u1061\u1065\u1066\u106e-\u1070\u1075-\u1081\u108e\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1877\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191c\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19c1-\u19c7\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4b\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1ce9-\u1cec\u1cee-\u1cf1\u1cf5\u1cf6\u1d00-\u1dbf\u1e00-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u2071\u207f\u2090-\u209c\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cee\u2cf2\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d80-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2e2f\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303c\u3041-\u3096\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua697\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua90a-\ua925\ua930-\ua946\ua960-\ua97c\ua984-\ua9b2\ua9cf\uaa00-\uaa28\uaa40-\uaa42\uaa44-\uaa4b\uaa60-\uaa76\uaa7a\uaa80-\uaaaf\uaab1\uaab5\uaab6\uaab9-\uaabd\uaac0\uaac2\uaadb-\uaadd\uaae0-\uaaea\uaaf2-\uaaf4\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabe2\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d\ufb1f-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe70-\ufe74\ufe76-\ufefc\uff21-\uff3a\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]'),</span>
|
213
|
+
<span class='covered'> NonAsciiIdentifierPart: new RegExp('[\xaa\xb5\xba\xc0-\xd6\xd8-\xf6\xf8-\u02c1\u02c6-\u02d1\u02e0-\u02e4\u02ec\u02ee\u0300-\u0374\u0376\u0377\u037a-\u037d\u0386\u0388-\u038a\u038c\u038e-\u03a1\u03a3-\u03f5\u03f7-\u0481\u0483-\u0487\u048a-\u0527\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u05d0-\u05ea\u05f0-\u05f2\u0610-\u061a\u0620-\u0669\u066e-\u06d3\u06d5-\u06dc\u06df-\u06e8\u06ea-\u06fc\u06ff\u0710-\u074a\u074d-\u07b1\u07c0-\u07f5\u07fa\u0800-\u082d\u0840-\u085b\u08a0\u08a2-\u08ac\u08e4-\u08fe\u0900-\u0963\u0966-\u096f\u0971-\u0977\u0979-\u097f\u0981-\u0983\u0985-\u098c\u098f\u0990\u0993-\u09a8\u09aa-\u09b0\u09b2\u09b6-\u09b9\u09bc-\u09c4\u09c7\u09c8\u09cb-\u09ce\u09d7\u09dc\u09dd\u09df-\u09e3\u09e6-\u09f1\u0a01-\u0a03\u0a05-\u0a0a\u0a0f\u0a10\u0a13-\u0a28\u0a2a-\u0a30\u0a32\u0a33\u0a35\u0a36\u0a38\u0a39\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a59-\u0a5c\u0a5e\u0a66-\u0a75\u0a81-\u0a83\u0a85-\u0a8d\u0a8f-\u0a91\u0a93-\u0aa8\u0aaa-\u0ab0\u0ab2\u0ab3\u0ab5-\u0ab9\u0abc-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ad0\u0ae0-\u0ae3\u0ae6-\u0aef\u0b01-\u0b03\u0b05-\u0b0c\u0b0f\u0b10\u0b13-\u0b28\u0b2a-\u0b30\u0b32\u0b33\u0b35-\u0b39\u0b3c-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b56\u0b57\u0b5c\u0b5d\u0b5f-\u0b63\u0b66-\u0b6f\u0b71\u0b82\u0b83\u0b85-\u0b8a\u0b8e-\u0b90\u0b92-\u0b95\u0b99\u0b9a\u0b9c\u0b9e\u0b9f\u0ba3\u0ba4\u0ba8-\u0baa\u0bae-\u0bb9\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd0\u0bd7\u0be6-\u0bef\u0c01-\u0c03\u0c05-\u0c0c\u0c0e-\u0c10\u0c12-\u0c28\u0c2a-\u0c33\u0c35-\u0c39\u0c3d-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c58\u0c59\u0c60-\u0c63\u0c66-\u0c6f\u0c82\u0c83\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbc-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0cde\u0ce0-\u0ce3\u0ce6-\u0cef\u0cf1\u0cf2\u0d02\u0d03\u0d05-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d-\u0d44\u0d46-\u0d48\u0d4a-\u0d4e\u0d57\u0d60-\u0d63\u0d66-\u0d6f\u0d7a-\u0d7f\u0d82\u0d83\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0df2\u0df3\u0e01-\u0e3a\u0e40-\u0e4e\u0e50-\u0e59\u0e81\u0e82\u0e84\u0e87\u0e88\u0e8a\u0e8d\u0e94-\u0e97\u0e99-\u0e9f\u0ea1-\u0ea3\u0ea5\u0ea7\u0eaa\u0eab\u0ead-\u0eb9\u0ebb-\u0ebd\u0ec0-\u0ec4\u0ec6\u0ec8-\u0ecd\u0ed0-\u0ed9\u0edc-\u0edf\u0f00\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e-\u0f47\u0f49-\u0f6c\u0f71-\u0f84\u0f86-\u0f97\u0f99-\u0fbc\u0fc6\u1000-\u1049\u1050-\u109d\u10a0-\u10c5\u10c7\u10cd\u10d0-\u10fa\u10fc-\u1248\u124a-\u124d\u1250-\u1256\u1258\u125a-\u125d\u1260-\u1288\u128a-\u128d\u1290-\u12b0\u12b2-\u12b5\u12b8-\u12be\u12c0\u12c2-\u12c5\u12c8-\u12d6\u12d8-\u1310\u1312-\u1315\u1318-\u135a\u135d-\u135f\u1380-\u138f\u13a0-\u13f4\u1401-\u166c\u166f-\u167f\u1681-\u169a\u16a0-\u16ea\u16ee-\u16f0\u1700-\u170c\u170e-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176c\u176e-\u1770\u1772\u1773\u1780-\u17d3\u17d7\u17dc\u17dd\u17e0-\u17e9\u180b-\u180d\u1810-\u1819\u1820-\u1877\u1880-\u18aa\u18b0-\u18f5\u1900-\u191c\u1920-\u192b\u1930-\u193b\u1946-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u19d0-\u19d9\u1a00-\u1a1b\u1a20-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1aa7\u1b00-\u1b4b\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1bf3\u1c00-\u1c37\u1c40-\u1c49\u1c4d-\u1c7d\u1cd0-\u1cd2\u1cd4-\u1cf6\u1d00-\u1de6\u1dfc-\u1f15\u1f18-\u1f1d\u1f20-\u1f45\u1f48-\u1f4d\u1f50-\u1f57\u1f59\u1f5b\u1f5d\u1f5f-\u1f7d\u1f80-\u1fb4\u1fb6-\u1fbc\u1fbe\u1fc2-\u1fc4\u1fc6-\u1fcc\u1fd0-\u1fd3\u1fd6-\u1fdb\u1fe0-\u1fec\u1ff2-\u1ff4\u1ff6-\u1ffc\u200c\u200d\u203f\u2040\u2054\u2071\u207f\u2090-\u209c\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2102\u2107\u210a-\u2113\u2115\u2119-\u211d\u2124\u2126\u2128\u212a-\u212d\u212f-\u2139\u213c-\u213f\u2145-\u2149\u214e\u2160-\u2188\u2c00-\u2c2e\u2c30-\u2c5e\u2c60-\u2ce4\u2ceb-\u2cf3\u2d00-\u2d25\u2d27\u2d2d\u2d30-\u2d67\u2d6f\u2d7f-\u2d96\u2da0-\u2da6\u2da8-\u2dae\u2db0-\u2db6\u2db8-\u2dbe\u2dc0-\u2dc6\u2dc8-\u2dce\u2dd0-\u2dd6\u2dd8-\u2dde\u2de0-\u2dff\u2e2f\u3005-\u3007\u3021-\u302f\u3031-\u3035\u3038-\u303c\u3041-\u3096\u3099\u309a\u309d-\u309f\u30a1-\u30fa\u30fc-\u30ff\u3105-\u312d\u3131-\u318e\u31a0-\u31ba\u31f0-\u31ff\u3400-\u4db5\u4e00-\u9fcc\ua000-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua62b\ua640-\ua66f\ua674-\ua67d\ua67f-\ua697\ua69f-\ua6f1\ua717-\ua71f\ua722-\ua788\ua78b-\ua78e\ua790-\ua793\ua7a0-\ua7aa\ua7f8-\ua827\ua840-\ua873\ua880-\ua8c4\ua8d0-\ua8d9\ua8e0-\ua8f7\ua8fb\ua900-\ua92d\ua930-\ua953\ua960-\ua97c\ua980-\ua9c0\ua9cf-\ua9d9\uaa00-\uaa36\uaa40-\uaa4d\uaa50-\uaa59\uaa60-\uaa76\uaa7a\uaa7b\uaa80-\uaac2\uaadb-\uaadd\uaae0-\uaaef\uaaf2-\uaaf6\uab01-\uab06\uab09-\uab0e\uab11-\uab16\uab20-\uab26\uab28-\uab2e\uabc0-\uabea\uabec\uabed\uabf0-\uabf9\uac00-\ud7a3\ud7b0-\ud7c6\ud7cb-\ud7fb\uf900-\ufa6d\ufa70-\ufad9\ufb00-\ufb06\ufb13-\ufb17\ufb1d-\ufb28\ufb2a-\ufb36\ufb38-\ufb3c\ufb3e\ufb40\ufb41\ufb43\ufb44\ufb46-\ufbb1\ufbd3-\ufd3d\ufd50-\ufd8f\ufd92-\ufdc7\ufdf0-\ufdfb\ufe00-\ufe0f\ufe20-\ufe26\ufe33\ufe34\ufe4d-\ufe4f\ufe70-\ufe74\ufe76-\ufefc\uff10-\uff19\uff21-\uff3a\uff3f\uff41-\uff5a\uff66-\uffbe\uffc2-\uffc7\uffca-\uffcf\uffd2-\uffd7\uffda-\uffdc]')</span>
|
214
|
+
<span class='covered'> };</span>
|
215
|
+
<span class='covered'> </span>
|
216
|
+
<span class='covered'> // Ensure the condition is true, otherwise throw an error.</span>
|
217
|
+
<span class='covered'> // This is only to have a better contract semantic, i.e. another safety net</span>
|
218
|
+
<span class='covered'> // to catch a logic error. The condition shall be fulfilled in normal case.</span>
|
219
|
+
<span class='covered'> // Do NOT use this to enforce a certain condition on any user input.</span>
|
220
|
+
<span class='covered'> </span>
|
221
|
+
<span class='covered'> function assert(condition, message) {</span>
|
222
|
+
<span class='covered'> if (!condition) {</span>
|
223
|
+
<span class='uncovered'> throw new Error('ASSERT: ' + message);</span>
|
224
|
+
<span class='covered'> }</span>
|
225
|
+
<span class='covered'> }</span>
|
226
|
+
<span class='covered'> </span>
|
227
|
+
<span class='covered'> function sliceSource(from, to) {</span>
|
228
|
+
<span class='covered'> return source.slice(from, to);</span>
|
229
|
+
<span class='covered'> }</span>
|
230
|
+
<span class='covered'> </span>
|
231
|
+
<span class='covered'> if (typeof 'esprima'[0] === 'undefined') {</span>
|
232
|
+
<span class='uncovered'> sliceSource = function sliceArraySource(from, to) {</span>
|
233
|
+
<span class='uncovered'> return source.slice(from, to).join('');</span>
|
234
|
+
<span class='uncovered'> };</span>
|
235
|
+
<span class='covered'> }</span>
|
236
|
+
<span class='covered'> </span>
|
237
|
+
<span class='covered'> function isDecimalDigit(ch) {</span>
|
238
|
+
<span class='covered'> return '0123456789'.indexOf(ch) >= 0;</span>
|
239
|
+
<span class='covered'> }</span>
|
240
|
+
<span class='covered'> </span>
|
241
|
+
<span class='covered'> function isHexDigit(ch) {</span>
|
242
|
+
<span class='covered'> return '0123456789abcdefABCDEF'.indexOf(ch) >= 0;</span>
|
243
|
+
<span class='covered'> }</span>
|
244
|
+
<span class='covered'> </span>
|
245
|
+
<span class='covered'> function isOctalDigit(ch) {</span>
|
246
|
+
<span class='covered'> return '01234567'.indexOf(ch) >= 0;</span>
|
247
|
+
<span class='covered'> }</span>
|
248
|
+
<span class='covered'> </span>
|
249
|
+
<span class='covered'> </span>
|
250
|
+
<span class='covered'> // 7.2 White Space</span>
|
251
|
+
<span class='covered'> </span>
|
252
|
+
<span class='covered'> function isWhiteSpace(ch) {</span>
|
253
|
+
<span class='covered'> return (ch === ' ') || (ch === '\u0009') || (ch === '\u000B') ||</span>
|
254
|
+
<span class='covered'> (ch === '\u000C') || (ch === '\u00A0') ||</span>
|
255
|
+
<span class='covered'> (ch.charCodeAt(0) >= 0x1680 &&</span>
|
256
|
+
<span class='covered'> '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFF'.indexOf(ch) >= 0);</span>
|
257
|
+
<span class='covered'> }</span>
|
258
|
+
<span class='covered'> </span>
|
259
|
+
<span class='covered'> // 7.3 Line Terminators</span>
|
260
|
+
<span class='covered'> </span>
|
261
|
+
<span class='covered'> function isLineTerminator(ch) {</span>
|
262
|
+
<span class='covered'> return (ch === '\n' || ch === '\r' || ch === '\u2028' || ch === '\u2029');</span>
|
263
|
+
<span class='covered'> }</span>
|
264
|
+
<span class='covered'> </span>
|
265
|
+
<span class='covered'> // 7.6 Identifier Names and Identifiers</span>
|
266
|
+
<span class='covered'> </span>
|
267
|
+
<span class='covered'> function isIdentifierStart(ch) {</span>
|
268
|
+
<span class='covered'> return (ch === '$') || (ch === '_') || (ch === '\\') ||</span>
|
269
|
+
<span class='covered'> (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||</span>
|
270
|
+
<span class='covered'> ((ch.charCodeAt(0) >= 0x80) && Regex.NonAsciiIdentifierStart.test(ch));</span>
|
271
|
+
<span class='covered'> }</span>
|
272
|
+
<span class='covered'> </span>
|
273
|
+
<span class='covered'> function isIdentifierPart(ch) {</span>
|
274
|
+
<span class='covered'> return (ch === '$') || (ch === '_') || (ch === '\\') ||</span>
|
275
|
+
<span class='covered'> (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||</span>
|
276
|
+
<span class='covered'> ((ch >= '0') && (ch <= '9')) ||</span>
|
277
|
+
<span class='covered'> ((ch.charCodeAt(0) >= 0x80) && Regex.NonAsciiIdentifierPart.test(ch));</span>
|
278
|
+
<span class='covered'> }</span>
|
279
|
+
<span class='covered'> </span>
|
280
|
+
<span class='covered'> // 7.6.1.2 Future Reserved Words</span>
|
281
|
+
<span class='covered'> </span>
|
282
|
+
<span class='covered'> function isFutureReservedWord(id) {</span>
|
283
|
+
<span class='covered'> switch (id) {</span>
|
284
|
+
<span class='covered'> </span>
|
285
|
+
<span class='covered'> // Future reserved words.</span>
|
286
|
+
<span class='covered'> case 'class':</span>
|
287
|
+
<span class='covered'> case 'enum':</span>
|
288
|
+
<span class='covered'> case 'export':</span>
|
289
|
+
<span class='covered'> case 'extends':</span>
|
290
|
+
<span class='covered'> case 'import':</span>
|
291
|
+
<span class='covered'> case 'super':</span>
|
292
|
+
<span class='covered'> return true;</span>
|
293
|
+
<span class='covered'> }</span>
|
294
|
+
<span class='covered'> </span>
|
295
|
+
<span class='covered'> return false;</span>
|
296
|
+
<span class='covered'> }</span>
|
297
|
+
<span class='covered'> </span>
|
298
|
+
<span class='covered'> function isStrictModeReservedWord(id) {</span>
|
299
|
+
<span class='covered'> switch (id) {</span>
|
300
|
+
<span class='covered'> </span>
|
301
|
+
<span class='covered'> // Strict Mode reserved words.</span>
|
302
|
+
<span class='covered'> case 'implements':</span>
|
303
|
+
<span class='covered'> case 'interface':</span>
|
304
|
+
<span class='covered'> case 'package':</span>
|
305
|
+
<span class='covered'> case 'private':</span>
|
306
|
+
<span class='covered'> case 'protected':</span>
|
307
|
+
<span class='covered'> case 'public':</span>
|
308
|
+
<span class='covered'> case 'static':</span>
|
309
|
+
<span class='covered'> case 'yield':</span>
|
310
|
+
<span class='covered'> case 'let':</span>
|
311
|
+
<span class='covered'> return true;</span>
|
312
|
+
<span class='covered'> }</span>
|
313
|
+
<span class='covered'> </span>
|
314
|
+
<span class='covered'> return false;</span>
|
315
|
+
<span class='covered'> }</span>
|
316
|
+
<span class='covered'> </span>
|
317
|
+
<span class='covered'> function isRestrictedWord(id) {</span>
|
318
|
+
<span class='covered'> return id === 'eval' || id === 'arguments';</span>
|
319
|
+
<span class='covered'> }</span>
|
320
|
+
<span class='covered'> </span>
|
321
|
+
<span class='covered'> // 7.6.1.1 Keywords</span>
|
322
|
+
<span class='covered'> </span>
|
323
|
+
<span class='covered'> function isKeyword(id) {</span>
|
324
|
+
<span class='covered'> var keyword = false;</span>
|
325
|
+
<span class='covered'> switch (id.length) {</span>
|
326
|
+
<span class='covered'> case 2:</span>
|
327
|
+
<span class='covered'> keyword = (id === 'if') || (id === 'in') || (id === 'do');</span>
|
328
|
+
<span class='covered'> break;</span>
|
329
|
+
<span class='covered'> case 3:</span>
|
330
|
+
<span class='covered'> keyword = (id === 'var') || (id === 'for') || (id === 'new') || (id === 'try');</span>
|
331
|
+
<span class='covered'> break;</span>
|
332
|
+
<span class='covered'> case 4:</span>
|
333
|
+
<span class='covered'> keyword = (id === 'this') || (id === 'else') || (id === 'case') || (id === 'void') || (id === 'with');</span>
|
334
|
+
<span class='covered'> break;</span>
|
335
|
+
<span class='covered'> case 5:</span>
|
336
|
+
<span class='covered'> keyword = (id === 'while') || (id === 'break') || (id === 'catch') || (id === 'throw');</span>
|
337
|
+
<span class='covered'> break;</span>
|
338
|
+
<span class='covered'> case 6:</span>
|
339
|
+
<span class='covered'> keyword = (id === 'return') || (id === 'typeof') || (id === 'delete') || (id === 'switch');</span>
|
340
|
+
<span class='covered'> break;</span>
|
341
|
+
<span class='covered'> case 7:</span>
|
342
|
+
<span class='covered'> keyword = (id === 'default') || (id === 'finally');</span>
|
343
|
+
<span class='covered'> break;</span>
|
344
|
+
<span class='covered'> case 8:</span>
|
345
|
+
<span class='covered'> keyword = (id === 'function') || (id === 'continue') || (id === 'debugger');</span>
|
346
|
+
<span class='covered'> break;</span>
|
347
|
+
<span class='covered'> case 10:</span>
|
348
|
+
<span class='covered'> keyword = (id === 'instanceof');</span>
|
349
|
+
<span class='covered'> break;</span>
|
350
|
+
<span class='covered'> }</span>
|
351
|
+
<span class='covered'> </span>
|
352
|
+
<span class='covered'> if (keyword) {</span>
|
353
|
+
<span class='covered'> return true;</span>
|
354
|
+
<span class='covered'> }</span>
|
355
|
+
<span class='covered'> </span>
|
356
|
+
<span class='covered'> switch (id) {</span>
|
357
|
+
<span class='covered'> // Future reserved words.</span>
|
358
|
+
<span class='covered'> // 'const' is specialized as Keyword in V8.</span>
|
359
|
+
<span class='covered'> case 'const':</span>
|
360
|
+
<span class='covered'> return true;</span>
|
361
|
+
<span class='covered'> </span>
|
362
|
+
<span class='covered'> // For compatiblity to SpiderMonkey and ES.next</span>
|
363
|
+
<span class='covered'> case 'yield':</span>
|
364
|
+
<span class='covered'> case 'let':</span>
|
365
|
+
<span class='covered'> return true;</span>
|
366
|
+
<span class='covered'> }</span>
|
367
|
+
<span class='covered'> </span>
|
368
|
+
<span class='covered'> if (strict && isStrictModeReservedWord(id)) {</span>
|
369
|
+
<span class='covered'> return true;</span>
|
370
|
+
<span class='covered'> }</span>
|
371
|
+
<span class='covered'> </span>
|
372
|
+
<span class='covered'> return isFutureReservedWord(id);</span>
|
373
|
+
<span class='covered'> }</span>
|
374
|
+
<span class='covered'> </span>
|
375
|
+
<span class='covered'> // Return the next character and move forward.</span>
|
376
|
+
<span class='covered'> </span>
|
377
|
+
<span class='covered'> function nextChar() {</span>
|
378
|
+
<span class='covered'> return source[index++];</span>
|
379
|
+
<span class='covered'> }</span>
|
380
|
+
<span class='covered'> </span>
|
381
|
+
<span class='covered'> // 7.4 Comments</span>
|
382
|
+
<span class='covered'> </span>
|
383
|
+
<span class='covered'> function skipComment() {</span>
|
384
|
+
<span class='covered'> var ch, blockComment, lineComment;</span>
|
385
|
+
<span class='covered'> </span>
|
386
|
+
<span class='covered'> blockComment = false;</span>
|
387
|
+
<span class='covered'> lineComment = false;</span>
|
388
|
+
<span class='covered'> </span>
|
389
|
+
<span class='covered'> while (index < length) {</span>
|
390
|
+
<span class='covered'> ch = source[index];</span>
|
391
|
+
<span class='covered'> </span>
|
392
|
+
<span class='covered'> if (lineComment) {</span>
|
393
|
+
<span class='covered'> ch = nextChar();</span>
|
394
|
+
<span class='covered'> if (isLineTerminator(ch)) {</span>
|
395
|
+
<span class='covered'> lineComment = false;</span>
|
396
|
+
<span class='covered'> if (ch === '\r' && source[index] === '\n') {</span>
|
397
|
+
<span class='covered'> ++index;</span>
|
398
|
+
<span class='covered'> }</span>
|
399
|
+
<span class='covered'> ++lineNumber;</span>
|
400
|
+
<span class='covered'> lineStart = index;</span>
|
401
|
+
<span class='covered'> }</span>
|
402
|
+
<span class='covered'> } else if (blockComment) {</span>
|
403
|
+
<span class='covered'> if (isLineTerminator(ch)) {</span>
|
404
|
+
<span class='covered'> if (ch === '\r' && source[index + 1] === '\n') {</span>
|
405
|
+
<span class='covered'> ++index;</span>
|
406
|
+
<span class='covered'> }</span>
|
407
|
+
<span class='covered'> ++lineNumber;</span>
|
408
|
+
<span class='covered'> ++index;</span>
|
409
|
+
<span class='covered'> lineStart = index;</span>
|
410
|
+
<span class='covered'> if (index >= length) {</span>
|
411
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
412
|
+
<span class='covered'> }</span>
|
413
|
+
<span class='covered'> } else {</span>
|
414
|
+
<span class='covered'> ch = nextChar();</span>
|
415
|
+
<span class='covered'> if (index >= length) {</span>
|
416
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
417
|
+
<span class='covered'> }</span>
|
418
|
+
<span class='covered'> if (ch === '*') {</span>
|
419
|
+
<span class='covered'> ch = source[index];</span>
|
420
|
+
<span class='covered'> if (ch === '/') {</span>
|
421
|
+
<span class='covered'> ++index;</span>
|
422
|
+
<span class='covered'> blockComment = false;</span>
|
423
|
+
<span class='covered'> }</span>
|
424
|
+
<span class='covered'> }</span>
|
425
|
+
<span class='covered'> }</span>
|
426
|
+
<span class='covered'> } else if (ch === '/') {</span>
|
427
|
+
<span class='covered'> ch = source[index + 1];</span>
|
428
|
+
<span class='covered'> if (ch === '/') {</span>
|
429
|
+
<span class='covered'> index += 2;</span>
|
430
|
+
<span class='covered'> lineComment = true;</span>
|
431
|
+
<span class='covered'> } else if (ch === '*') {</span>
|
432
|
+
<span class='covered'> index += 2;</span>
|
433
|
+
<span class='covered'> blockComment = true;</span>
|
434
|
+
<span class='covered'> if (index >= length) {</span>
|
435
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
436
|
+
<span class='covered'> }</span>
|
437
|
+
<span class='covered'> } else {</span>
|
438
|
+
<span class='covered'> break;</span>
|
439
|
+
<span class='covered'> }</span>
|
440
|
+
<span class='covered'> } else if (isWhiteSpace(ch)) {</span>
|
441
|
+
<span class='covered'> ++index;</span>
|
442
|
+
<span class='covered'> } else if (isLineTerminator(ch)) {</span>
|
443
|
+
<span class='covered'> ++index;</span>
|
444
|
+
<span class='covered'> if (ch === '\r' && source[index] === '\n') {</span>
|
445
|
+
<span class='covered'> ++index;</span>
|
446
|
+
<span class='covered'> }</span>
|
447
|
+
<span class='covered'> ++lineNumber;</span>
|
448
|
+
<span class='covered'> lineStart = index;</span>
|
449
|
+
<span class='covered'> } else {</span>
|
450
|
+
<span class='covered'> break;</span>
|
451
|
+
<span class='covered'> }</span>
|
452
|
+
<span class='covered'> }</span>
|
453
|
+
<span class='covered'> }</span>
|
454
|
+
<span class='covered'> </span>
|
455
|
+
<span class='covered'> function scanHexEscape(prefix) {</span>
|
456
|
+
<span class='covered'> var i, len, ch, code = 0;</span>
|
457
|
+
<span class='covered'> </span>
|
458
|
+
<span class='covered'> len = (prefix === 'u') ? 4 : 2;</span>
|
459
|
+
<span class='covered'> for (i = 0; i < len; ++i) {</span>
|
460
|
+
<span class='covered'> if (index < length && isHexDigit(source[index])) {</span>
|
461
|
+
<span class='covered'> ch = nextChar();</span>
|
462
|
+
<span class='covered'> code = code * 16 + '0123456789abcdef'.indexOf(ch.toLowerCase());</span>
|
463
|
+
<span class='covered'> } else {</span>
|
464
|
+
<span class='covered'> return '';</span>
|
465
|
+
<span class='covered'> }</span>
|
466
|
+
<span class='covered'> }</span>
|
467
|
+
<span class='covered'> return String.fromCharCode(code);</span>
|
468
|
+
<span class='covered'> }</span>
|
469
|
+
<span class='covered'> </span>
|
470
|
+
<span class='covered'> function scanIdentifier() {</span>
|
471
|
+
<span class='covered'> var ch, start, id, restore;</span>
|
472
|
+
<span class='covered'> </span>
|
473
|
+
<span class='covered'> ch = source[index];</span>
|
474
|
+
<span class='covered'> if (!isIdentifierStart(ch)) {</span>
|
475
|
+
<span class='covered'> return;</span>
|
476
|
+
<span class='covered'> }</span>
|
477
|
+
<span class='covered'> </span>
|
478
|
+
<span class='covered'> start = index;</span>
|
479
|
+
<span class='covered'> if (ch === '\\') {</span>
|
480
|
+
<span class='covered'> ++index;</span>
|
481
|
+
<span class='covered'> if (source[index] !== 'u') {</span>
|
482
|
+
<span class='covered'> return;</span>
|
483
|
+
<span class='covered'> }</span>
|
484
|
+
<span class='covered'> ++index;</span>
|
485
|
+
<span class='covered'> restore = index;</span>
|
486
|
+
<span class='covered'> ch = scanHexEscape('u');</span>
|
487
|
+
<span class='covered'> if (ch) {</span>
|
488
|
+
<span class='covered'> if (ch === '\\' || !isIdentifierStart(ch)) {</span>
|
489
|
+
<span class='covered'> return;</span>
|
490
|
+
<span class='covered'> }</span>
|
491
|
+
<span class='covered'> id = ch;</span>
|
492
|
+
<span class='covered'> } else {</span>
|
493
|
+
<span class='covered'> index = restore;</span>
|
494
|
+
<span class='covered'> id = 'u';</span>
|
495
|
+
<span class='covered'> }</span>
|
496
|
+
<span class='covered'> } else {</span>
|
497
|
+
<span class='covered'> id = nextChar();</span>
|
498
|
+
<span class='covered'> }</span>
|
499
|
+
<span class='covered'> </span>
|
500
|
+
<span class='covered'> while (index < length) {</span>
|
501
|
+
<span class='covered'> ch = source[index];</span>
|
502
|
+
<span class='covered'> if (!isIdentifierPart(ch)) {</span>
|
503
|
+
<span class='covered'> break;</span>
|
504
|
+
<span class='covered'> }</span>
|
505
|
+
<span class='covered'> if (ch === '\\') {</span>
|
506
|
+
<span class='covered'> ++index;</span>
|
507
|
+
<span class='covered'> if (source[index] !== 'u') {</span>
|
508
|
+
<span class='covered'> return;</span>
|
509
|
+
<span class='covered'> }</span>
|
510
|
+
<span class='covered'> ++index;</span>
|
511
|
+
<span class='covered'> restore = index;</span>
|
512
|
+
<span class='covered'> ch = scanHexEscape('u');</span>
|
513
|
+
<span class='covered'> if (ch) {</span>
|
514
|
+
<span class='covered'> if (ch === '\\' || !isIdentifierPart(ch)) {</span>
|
515
|
+
<span class='covered'> return;</span>
|
516
|
+
<span class='covered'> }</span>
|
517
|
+
<span class='covered'> id += ch;</span>
|
518
|
+
<span class='covered'> } else {</span>
|
519
|
+
<span class='covered'> index = restore;</span>
|
520
|
+
<span class='covered'> id += 'u';</span>
|
521
|
+
<span class='covered'> }</span>
|
522
|
+
<span class='covered'> } else {</span>
|
523
|
+
<span class='covered'> id += nextChar();</span>
|
524
|
+
<span class='covered'> }</span>
|
525
|
+
<span class='covered'> }</span>
|
526
|
+
<span class='covered'> </span>
|
527
|
+
<span class='covered'> // There is no keyword or literal with only one character.</span>
|
528
|
+
<span class='covered'> // Thus, it must be an identifier.</span>
|
529
|
+
<span class='covered'> if (id.length === 1) {</span>
|
530
|
+
<span class='covered'> return {</span>
|
531
|
+
<span class='covered'> type: Token.Identifier,</span>
|
532
|
+
<span class='covered'> value: id,</span>
|
533
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
534
|
+
<span class='covered'> lineStart: lineStart,</span>
|
535
|
+
<span class='covered'> range: [start, index]</span>
|
536
|
+
<span class='covered'> };</span>
|
537
|
+
<span class='covered'> }</span>
|
538
|
+
<span class='covered'> </span>
|
539
|
+
<span class='covered'> if (isKeyword(id)) {</span>
|
540
|
+
<span class='covered'> return {</span>
|
541
|
+
<span class='covered'> type: Token.Keyword,</span>
|
542
|
+
<span class='covered'> value: id,</span>
|
543
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
544
|
+
<span class='covered'> lineStart: lineStart,</span>
|
545
|
+
<span class='covered'> range: [start, index]</span>
|
546
|
+
<span class='covered'> };</span>
|
547
|
+
<span class='covered'> }</span>
|
548
|
+
<span class='covered'> </span>
|
549
|
+
<span class='covered'> // 7.8.1 Null Literals</span>
|
550
|
+
<span class='covered'> </span>
|
551
|
+
<span class='covered'> if (id === 'null') {</span>
|
552
|
+
<span class='covered'> return {</span>
|
553
|
+
<span class='covered'> type: Token.NullLiteral,</span>
|
554
|
+
<span class='covered'> value: id,</span>
|
555
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
556
|
+
<span class='covered'> lineStart: lineStart,</span>
|
557
|
+
<span class='covered'> range: [start, index]</span>
|
558
|
+
<span class='covered'> };</span>
|
559
|
+
<span class='covered'> }</span>
|
560
|
+
<span class='covered'> </span>
|
561
|
+
<span class='covered'> // 7.8.2 Boolean Literals</span>
|
562
|
+
<span class='covered'> </span>
|
563
|
+
<span class='covered'> if (id === 'true' || id === 'false') {</span>
|
564
|
+
<span class='covered'> return {</span>
|
565
|
+
<span class='covered'> type: Token.BooleanLiteral,</span>
|
566
|
+
<span class='covered'> value: id,</span>
|
567
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
568
|
+
<span class='covered'> lineStart: lineStart,</span>
|
569
|
+
<span class='covered'> range: [start, index]</span>
|
570
|
+
<span class='covered'> };</span>
|
571
|
+
<span class='covered'> }</span>
|
572
|
+
<span class='covered'> </span>
|
573
|
+
<span class='covered'> return {</span>
|
574
|
+
<span class='covered'> type: Token.Identifier,</span>
|
575
|
+
<span class='covered'> value: id,</span>
|
576
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
577
|
+
<span class='covered'> lineStart: lineStart,</span>
|
578
|
+
<span class='covered'> range: [start, index]</span>
|
579
|
+
<span class='covered'> };</span>
|
580
|
+
<span class='covered'> }</span>
|
581
|
+
<span class='covered'> </span>
|
582
|
+
<span class='covered'> // 7.7 Punctuators</span>
|
583
|
+
<span class='covered'> </span>
|
584
|
+
<span class='covered'> function scanPunctuator() {</span>
|
585
|
+
<span class='covered'> var start = index,</span>
|
586
|
+
<span class='covered'> ch1 = source[index],</span>
|
587
|
+
<span class='covered'> ch2,</span>
|
588
|
+
<span class='covered'> ch3,</span>
|
589
|
+
<span class='covered'> ch4;</span>
|
590
|
+
<span class='covered'> </span>
|
591
|
+
<span class='covered'> // Check for most common single-character punctuators.</span>
|
592
|
+
<span class='covered'> </span>
|
593
|
+
<span class='covered'> if (ch1 === ';' || ch1 === '{' || ch1 === '}') {</span>
|
594
|
+
<span class='covered'> ++index;</span>
|
595
|
+
<span class='covered'> return {</span>
|
596
|
+
<span class='covered'> type: Token.Punctuator,</span>
|
597
|
+
<span class='covered'> value: ch1,</span>
|
598
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
599
|
+
<span class='covered'> lineStart: lineStart,</span>
|
600
|
+
<span class='covered'> range: [start, index]</span>
|
601
|
+
<span class='covered'> };</span>
|
602
|
+
<span class='covered'> }</span>
|
603
|
+
<span class='covered'> </span>
|
604
|
+
<span class='covered'> if (ch1 === ',' || ch1 === '(' || ch1 === ')') {</span>
|
605
|
+
<span class='covered'> ++index;</span>
|
606
|
+
<span class='covered'> return {</span>
|
607
|
+
<span class='covered'> type: Token.Punctuator,</span>
|
608
|
+
<span class='covered'> value: ch1,</span>
|
609
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
610
|
+
<span class='covered'> lineStart: lineStart,</span>
|
611
|
+
<span class='covered'> range: [start, index]</span>
|
612
|
+
<span class='covered'> };</span>
|
613
|
+
<span class='covered'> }</span>
|
614
|
+
<span class='covered'> </span>
|
615
|
+
<span class='covered'> // Dot (.) can also start a floating-point number, hence the need</span>
|
616
|
+
<span class='covered'> // to check the next character.</span>
|
617
|
+
<span class='covered'> </span>
|
618
|
+
<span class='covered'> ch2 = source[index + 1];</span>
|
619
|
+
<span class='covered'> if (ch1 === '.' && !isDecimalDigit(ch2)) {</span>
|
620
|
+
<span class='covered'> return {</span>
|
621
|
+
<span class='covered'> type: Token.Punctuator,</span>
|
622
|
+
<span class='covered'> value: nextChar(),</span>
|
623
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
624
|
+
<span class='covered'> lineStart: lineStart,</span>
|
625
|
+
<span class='covered'> range: [start, index]</span>
|
626
|
+
<span class='covered'> };</span>
|
627
|
+
<span class='covered'> }</span>
|
628
|
+
<span class='covered'> </span>
|
629
|
+
<span class='covered'> // Peek more characters.</span>
|
630
|
+
<span class='covered'> </span>
|
631
|
+
<span class='covered'> ch3 = source[index + 2];</span>
|
632
|
+
<span class='covered'> ch4 = source[index + 3];</span>
|
633
|
+
<span class='covered'> </span>
|
634
|
+
<span class='covered'> // 4-character punctuator: >>>=</span>
|
635
|
+
<span class='covered'> </span>
|
636
|
+
<span class='covered'> if (ch1 === '>' && ch2 === '>' && ch3 === '>') {</span>
|
637
|
+
<span class='covered'> if (ch4 === '=') {</span>
|
638
|
+
<span class='covered'> index += 4;</span>
|
639
|
+
<span class='covered'> return {</span>
|
640
|
+
<span class='covered'> type: Token.Punctuator,</span>
|
641
|
+
<span class='covered'> value: '>>>=',</span>
|
642
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
643
|
+
<span class='covered'> lineStart: lineStart,</span>
|
644
|
+
<span class='covered'> range: [start, index]</span>
|
645
|
+
<span class='covered'> };</span>
|
646
|
+
<span class='covered'> }</span>
|
647
|
+
<span class='covered'> }</span>
|
648
|
+
<span class='covered'> </span>
|
649
|
+
<span class='covered'> // 3-character punctuators: === !== >>> <<= >>=</span>
|
650
|
+
<span class='covered'> </span>
|
651
|
+
<span class='covered'> if (ch1 === '=' && ch2 === '=' && ch3 === '=') {</span>
|
652
|
+
<span class='covered'> index += 3;</span>
|
653
|
+
<span class='covered'> return {</span>
|
654
|
+
<span class='covered'> type: Token.Punctuator,</span>
|
655
|
+
<span class='covered'> value: '===',</span>
|
656
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
657
|
+
<span class='covered'> lineStart: lineStart,</span>
|
658
|
+
<span class='covered'> range: [start, index]</span>
|
659
|
+
<span class='covered'> };</span>
|
660
|
+
<span class='covered'> }</span>
|
661
|
+
<span class='covered'> </span>
|
662
|
+
<span class='covered'> if (ch1 === '!' && ch2 === '=' && ch3 === '=') {</span>
|
663
|
+
<span class='covered'> index += 3;</span>
|
664
|
+
<span class='covered'> return {</span>
|
665
|
+
<span class='covered'> type: Token.Punctuator,</span>
|
666
|
+
<span class='covered'> value: '!==',</span>
|
667
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
668
|
+
<span class='covered'> lineStart: lineStart,</span>
|
669
|
+
<span class='covered'> range: [start, index]</span>
|
670
|
+
<span class='covered'> };</span>
|
671
|
+
<span class='covered'> }</span>
|
672
|
+
<span class='covered'> </span>
|
673
|
+
<span class='covered'> if (ch1 === '>' && ch2 === '>' && ch3 === '>') {</span>
|
674
|
+
<span class='covered'> index += 3;</span>
|
675
|
+
<span class='covered'> return {</span>
|
676
|
+
<span class='covered'> type: Token.Punctuator,</span>
|
677
|
+
<span class='covered'> value: '>>>',</span>
|
678
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
679
|
+
<span class='covered'> lineStart: lineStart,</span>
|
680
|
+
<span class='covered'> range: [start, index]</span>
|
681
|
+
<span class='covered'> };</span>
|
682
|
+
<span class='covered'> }</span>
|
683
|
+
<span class='covered'> </span>
|
684
|
+
<span class='covered'> if (ch1 === '<' && ch2 === '<' && ch3 === '=') {</span>
|
685
|
+
<span class='covered'> index += 3;</span>
|
686
|
+
<span class='covered'> return {</span>
|
687
|
+
<span class='covered'> type: Token.Punctuator,</span>
|
688
|
+
<span class='covered'> value: '<<=',</span>
|
689
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
690
|
+
<span class='covered'> lineStart: lineStart,</span>
|
691
|
+
<span class='covered'> range: [start, index]</span>
|
692
|
+
<span class='covered'> };</span>
|
693
|
+
<span class='covered'> }</span>
|
694
|
+
<span class='covered'> </span>
|
695
|
+
<span class='covered'> if (ch1 === '>' && ch2 === '>' && ch3 === '=') {</span>
|
696
|
+
<span class='covered'> index += 3;</span>
|
697
|
+
<span class='covered'> return {</span>
|
698
|
+
<span class='covered'> type: Token.Punctuator,</span>
|
699
|
+
<span class='covered'> value: '>>=',</span>
|
700
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
701
|
+
<span class='covered'> lineStart: lineStart,</span>
|
702
|
+
<span class='covered'> range: [start, index]</span>
|
703
|
+
<span class='covered'> };</span>
|
704
|
+
<span class='covered'> }</span>
|
705
|
+
<span class='covered'> </span>
|
706
|
+
<span class='covered'> // 2-character punctuators: <= >= == != ++ -- << >> && ||</span>
|
707
|
+
<span class='covered'> // += -= *= %= &= |= ^= /=</span>
|
708
|
+
<span class='covered'> </span>
|
709
|
+
<span class='covered'> if (ch2 === '=') {</span>
|
710
|
+
<span class='covered'> if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {</span>
|
711
|
+
<span class='covered'> index += 2;</span>
|
712
|
+
<span class='covered'> return {</span>
|
713
|
+
<span class='covered'> type: Token.Punctuator,</span>
|
714
|
+
<span class='covered'> value: ch1 + ch2,</span>
|
715
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
716
|
+
<span class='covered'> lineStart: lineStart,</span>
|
717
|
+
<span class='covered'> range: [start, index]</span>
|
718
|
+
<span class='covered'> };</span>
|
719
|
+
<span class='covered'> }</span>
|
720
|
+
<span class='covered'> }</span>
|
721
|
+
<span class='covered'> </span>
|
722
|
+
<span class='covered'> if (ch1 === ch2 && ('+-<>&|'.indexOf(ch1) >= 0)) {</span>
|
723
|
+
<span class='covered'> if ('+-<>&|'.indexOf(ch2) >= 0) {</span>
|
724
|
+
<span class='covered'> index += 2;</span>
|
725
|
+
<span class='covered'> return {</span>
|
726
|
+
<span class='covered'> type: Token.Punctuator,</span>
|
727
|
+
<span class='covered'> value: ch1 + ch2,</span>
|
728
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
729
|
+
<span class='covered'> lineStart: lineStart,</span>
|
730
|
+
<span class='covered'> range: [start, index]</span>
|
731
|
+
<span class='covered'> };</span>
|
732
|
+
<span class='covered'> }</span>
|
733
|
+
<span class='covered'> }</span>
|
734
|
+
<span class='covered'> </span>
|
735
|
+
<span class='covered'> // The remaining 1-character punctuators.</span>
|
736
|
+
<span class='covered'> </span>
|
737
|
+
<span class='covered'> if ('[]<>+-*%&|^!~?:=/'.indexOf(ch1) >= 0) {</span>
|
738
|
+
<span class='covered'> return {</span>
|
739
|
+
<span class='covered'> type: Token.Punctuator,</span>
|
740
|
+
<span class='covered'> value: nextChar(),</span>
|
741
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
742
|
+
<span class='covered'> lineStart: lineStart,</span>
|
743
|
+
<span class='covered'> range: [start, index]</span>
|
744
|
+
<span class='covered'> };</span>
|
745
|
+
<span class='covered'> }</span>
|
746
|
+
<span class='covered'> }</span>
|
747
|
+
<span class='covered'> </span>
|
748
|
+
<span class='covered'> // 7.8.3 Numeric Literals</span>
|
749
|
+
<span class='covered'> </span>
|
750
|
+
<span class='covered'> function scanNumericLiteral() {</span>
|
751
|
+
<span class='covered'> var number, start, ch;</span>
|
752
|
+
<span class='covered'> </span>
|
753
|
+
<span class='covered'> ch = source[index];</span>
|
754
|
+
<span class='covered'> assert(isDecimalDigit(ch) || (ch === '.'),</span>
|
755
|
+
<span class='covered'> 'Numeric literal must start with a decimal digit or a decimal point');</span>
|
756
|
+
<span class='covered'> </span>
|
757
|
+
<span class='covered'> start = index;</span>
|
758
|
+
<span class='covered'> number = '';</span>
|
759
|
+
<span class='covered'> if (ch !== '.') {</span>
|
760
|
+
<span class='covered'> number = nextChar();</span>
|
761
|
+
<span class='covered'> ch = source[index];</span>
|
762
|
+
<span class='covered'> </span>
|
763
|
+
<span class='covered'> // Hex number starts with '0x'.</span>
|
764
|
+
<span class='covered'> // Octal number starts with '0'.</span>
|
765
|
+
<span class='covered'> if (number === '0') {</span>
|
766
|
+
<span class='covered'> if (ch === 'x' || ch === 'X') {</span>
|
767
|
+
<span class='covered'> number += nextChar();</span>
|
768
|
+
<span class='covered'> while (index < length) {</span>
|
769
|
+
<span class='covered'> ch = source[index];</span>
|
770
|
+
<span class='covered'> if (!isHexDigit(ch)) {</span>
|
771
|
+
<span class='covered'> break;</span>
|
772
|
+
<span class='covered'> }</span>
|
773
|
+
<span class='covered'> number += nextChar();</span>
|
774
|
+
<span class='covered'> }</span>
|
775
|
+
<span class='covered'> </span>
|
776
|
+
<span class='covered'> if (number.length <= 2) {</span>
|
777
|
+
<span class='covered'> // only 0x</span>
|
778
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
779
|
+
<span class='covered'> }</span>
|
780
|
+
<span class='covered'> </span>
|
781
|
+
<span class='covered'> if (index < length) {</span>
|
782
|
+
<span class='covered'> ch = source[index];</span>
|
783
|
+
<span class='covered'> if (isIdentifierStart(ch)) {</span>
|
784
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
785
|
+
<span class='covered'> }</span>
|
786
|
+
<span class='covered'> }</span>
|
787
|
+
<span class='covered'> return {</span>
|
788
|
+
<span class='covered'> type: Token.NumericLiteral,</span>
|
789
|
+
<span class='covered'> value: parseInt(number, 16),</span>
|
790
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
791
|
+
<span class='covered'> lineStart: lineStart,</span>
|
792
|
+
<span class='covered'> range: [start, index]</span>
|
793
|
+
<span class='covered'> };</span>
|
794
|
+
<span class='covered'> } else if (isOctalDigit(ch)) {</span>
|
795
|
+
<span class='covered'> number += nextChar();</span>
|
796
|
+
<span class='covered'> while (index < length) {</span>
|
797
|
+
<span class='covered'> ch = source[index];</span>
|
798
|
+
<span class='covered'> if (!isOctalDigit(ch)) {</span>
|
799
|
+
<span class='covered'> break;</span>
|
800
|
+
<span class='covered'> }</span>
|
801
|
+
<span class='covered'> number += nextChar();</span>
|
802
|
+
<span class='covered'> }</span>
|
803
|
+
<span class='covered'> </span>
|
804
|
+
<span class='covered'> if (index < length) {</span>
|
805
|
+
<span class='covered'> ch = source[index];</span>
|
806
|
+
<span class='covered'> if (isIdentifierStart(ch) || isDecimalDigit(ch)) {</span>
|
807
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
808
|
+
<span class='covered'> }</span>
|
809
|
+
<span class='covered'> }</span>
|
810
|
+
<span class='covered'> return {</span>
|
811
|
+
<span class='covered'> type: Token.NumericLiteral,</span>
|
812
|
+
<span class='covered'> value: parseInt(number, 8),</span>
|
813
|
+
<span class='covered'> octal: true,</span>
|
814
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
815
|
+
<span class='covered'> lineStart: lineStart,</span>
|
816
|
+
<span class='covered'> range: [start, index]</span>
|
817
|
+
<span class='covered'> };</span>
|
818
|
+
<span class='covered'> }</span>
|
819
|
+
<span class='covered'> </span>
|
820
|
+
<span class='covered'> // decimal number starts with '0' such as '09' is illegal.</span>
|
821
|
+
<span class='covered'> if (isDecimalDigit(ch)) {</span>
|
822
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
823
|
+
<span class='covered'> }</span>
|
824
|
+
<span class='covered'> }</span>
|
825
|
+
<span class='covered'> </span>
|
826
|
+
<span class='covered'> while (index < length) {</span>
|
827
|
+
<span class='covered'> ch = source[index];</span>
|
828
|
+
<span class='covered'> if (!isDecimalDigit(ch)) {</span>
|
829
|
+
<span class='covered'> break;</span>
|
830
|
+
<span class='covered'> }</span>
|
831
|
+
<span class='covered'> number += nextChar();</span>
|
832
|
+
<span class='covered'> }</span>
|
833
|
+
<span class='covered'> }</span>
|
834
|
+
<span class='covered'> </span>
|
835
|
+
<span class='covered'> if (ch === '.') {</span>
|
836
|
+
<span class='covered'> number += nextChar();</span>
|
837
|
+
<span class='covered'> while (index < length) {</span>
|
838
|
+
<span class='covered'> ch = source[index];</span>
|
839
|
+
<span class='covered'> if (!isDecimalDigit(ch)) {</span>
|
840
|
+
<span class='covered'> break;</span>
|
841
|
+
<span class='covered'> }</span>
|
842
|
+
<span class='covered'> number += nextChar();</span>
|
843
|
+
<span class='covered'> }</span>
|
844
|
+
<span class='covered'> }</span>
|
845
|
+
<span class='covered'> </span>
|
846
|
+
<span class='covered'> if (ch === 'e' || ch === 'E') {</span>
|
847
|
+
<span class='covered'> number += nextChar();</span>
|
848
|
+
<span class='covered'> </span>
|
849
|
+
<span class='covered'> ch = source[index];</span>
|
850
|
+
<span class='covered'> if (ch === '+' || ch === '-') {</span>
|
851
|
+
<span class='covered'> number += nextChar();</span>
|
852
|
+
<span class='covered'> }</span>
|
853
|
+
<span class='covered'> </span>
|
854
|
+
<span class='covered'> ch = source[index];</span>
|
855
|
+
<span class='covered'> if (isDecimalDigit(ch)) {</span>
|
856
|
+
<span class='covered'> number += nextChar();</span>
|
857
|
+
<span class='covered'> while (index < length) {</span>
|
858
|
+
<span class='covered'> ch = source[index];</span>
|
859
|
+
<span class='covered'> if (!isDecimalDigit(ch)) {</span>
|
860
|
+
<span class='covered'> break;</span>
|
861
|
+
<span class='covered'> }</span>
|
862
|
+
<span class='covered'> number += nextChar();</span>
|
863
|
+
<span class='covered'> }</span>
|
864
|
+
<span class='covered'> } else {</span>
|
865
|
+
<span class='covered'> ch = 'character ' + ch;</span>
|
866
|
+
<span class='covered'> if (index >= length) {</span>
|
867
|
+
<span class='covered'> ch = '<end>';</span>
|
868
|
+
<span class='covered'> }</span>
|
869
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
870
|
+
<span class='covered'> }</span>
|
871
|
+
<span class='covered'> }</span>
|
872
|
+
<span class='covered'> </span>
|
873
|
+
<span class='covered'> if (index < length) {</span>
|
874
|
+
<span class='covered'> ch = source[index];</span>
|
875
|
+
<span class='covered'> if (isIdentifierStart(ch)) {</span>
|
876
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
877
|
+
<span class='covered'> }</span>
|
878
|
+
<span class='covered'> }</span>
|
879
|
+
<span class='covered'> </span>
|
880
|
+
<span class='covered'> return {</span>
|
881
|
+
<span class='covered'> type: Token.NumericLiteral,</span>
|
882
|
+
<span class='covered'> value: parseFloat(number),</span>
|
883
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
884
|
+
<span class='covered'> lineStart: lineStart,</span>
|
885
|
+
<span class='covered'> range: [start, index]</span>
|
886
|
+
<span class='covered'> };</span>
|
887
|
+
<span class='covered'> }</span>
|
888
|
+
<span class='covered'> </span>
|
889
|
+
<span class='covered'> // 7.8.4 String Literals</span>
|
890
|
+
<span class='covered'> </span>
|
891
|
+
<span class='covered'> function scanStringLiteral() {</span>
|
892
|
+
<span class='covered'> var str = '', quote, start, ch, code, unescaped, restore, octal = false;</span>
|
893
|
+
<span class='covered'> </span>
|
894
|
+
<span class='covered'> quote = source[index];</span>
|
895
|
+
<span class='covered'> assert((quote === '\'' || quote === '"'),</span>
|
896
|
+
<span class='covered'> 'String literal must starts with a quote');</span>
|
897
|
+
<span class='covered'> </span>
|
898
|
+
<span class='covered'> start = index;</span>
|
899
|
+
<span class='covered'> ++index;</span>
|
900
|
+
<span class='covered'> </span>
|
901
|
+
<span class='covered'> while (index < length) {</span>
|
902
|
+
<span class='covered'> ch = nextChar();</span>
|
903
|
+
<span class='covered'> </span>
|
904
|
+
<span class='covered'> if (ch === quote) {</span>
|
905
|
+
<span class='covered'> quote = '';</span>
|
906
|
+
<span class='covered'> break;</span>
|
907
|
+
<span class='covered'> } else if (ch === '\\') {</span>
|
908
|
+
<span class='covered'> ch = nextChar();</span>
|
909
|
+
<span class='covered'> if (!isLineTerminator(ch)) {</span>
|
910
|
+
<span class='covered'> switch (ch) {</span>
|
911
|
+
<span class='covered'> case 'n':</span>
|
912
|
+
<span class='covered'> str += '\n';</span>
|
913
|
+
<span class='covered'> break;</span>
|
914
|
+
<span class='covered'> case 'r':</span>
|
915
|
+
<span class='covered'> str += '\r';</span>
|
916
|
+
<span class='covered'> break;</span>
|
917
|
+
<span class='covered'> case 't':</span>
|
918
|
+
<span class='covered'> str += '\t';</span>
|
919
|
+
<span class='covered'> break;</span>
|
920
|
+
<span class='covered'> case 'u':</span>
|
921
|
+
<span class='covered'> case 'x':</span>
|
922
|
+
<span class='covered'> restore = index;</span>
|
923
|
+
<span class='covered'> unescaped = scanHexEscape(ch);</span>
|
924
|
+
<span class='covered'> if (unescaped) {</span>
|
925
|
+
<span class='covered'> str += unescaped;</span>
|
926
|
+
<span class='covered'> } else {</span>
|
927
|
+
<span class='covered'> index = restore;</span>
|
928
|
+
<span class='covered'> str += ch;</span>
|
929
|
+
<span class='covered'> }</span>
|
930
|
+
<span class='covered'> break;</span>
|
931
|
+
<span class='covered'> case 'b':</span>
|
932
|
+
<span class='covered'> str += '\b';</span>
|
933
|
+
<span class='covered'> break;</span>
|
934
|
+
<span class='covered'> case 'f':</span>
|
935
|
+
<span class='covered'> str += '\f';</span>
|
936
|
+
<span class='covered'> break;</span>
|
937
|
+
<span class='covered'> case 'v':</span>
|
938
|
+
<span class='covered'> str += '\v';</span>
|
939
|
+
<span class='covered'> break;</span>
|
940
|
+
<span class='covered'> </span>
|
941
|
+
<span class='covered'> default:</span>
|
942
|
+
<span class='covered'> if (isOctalDigit(ch)) {</span>
|
943
|
+
<span class='covered'> code = '01234567'.indexOf(ch);</span>
|
944
|
+
<span class='covered'> </span>
|
945
|
+
<span class='covered'> // \0 is not octal escape sequence</span>
|
946
|
+
<span class='covered'> if (code !== 0) {</span>
|
947
|
+
<span class='covered'> octal = true;</span>
|
948
|
+
<span class='covered'> }</span>
|
949
|
+
<span class='covered'> </span>
|
950
|
+
<span class='covered'> if (index < length && isOctalDigit(source[index])) {</span>
|
951
|
+
<span class='covered'> octal = true;</span>
|
952
|
+
<span class='covered'> code = code * 8 + '01234567'.indexOf(nextChar());</span>
|
953
|
+
<span class='covered'> </span>
|
954
|
+
<span class='covered'> // 3 digits are only allowed when string starts</span>
|
955
|
+
<span class='covered'> // with 0, 1, 2, 3</span>
|
956
|
+
<span class='covered'> if ('0123'.indexOf(ch) >= 0 &&</span>
|
957
|
+
<span class='covered'> index < length &&</span>
|
958
|
+
<span class='covered'> isOctalDigit(source[index])) {</span>
|
959
|
+
<span class='covered'> code = code * 8 + '01234567'.indexOf(nextChar());</span>
|
960
|
+
<span class='covered'> }</span>
|
961
|
+
<span class='covered'> }</span>
|
962
|
+
<span class='covered'> str += String.fromCharCode(code);</span>
|
963
|
+
<span class='covered'> } else {</span>
|
964
|
+
<span class='covered'> str += ch;</span>
|
965
|
+
<span class='covered'> }</span>
|
966
|
+
<span class='covered'> break;</span>
|
967
|
+
<span class='covered'> }</span>
|
968
|
+
<span class='covered'> } else {</span>
|
969
|
+
<span class='covered'> ++lineNumber;</span>
|
970
|
+
<span class='covered'> if (ch === '\r' && source[index] === '\n') {</span>
|
971
|
+
<span class='covered'> ++index;</span>
|
972
|
+
<span class='covered'> }</span>
|
973
|
+
<span class='covered'> }</span>
|
974
|
+
<span class='covered'> } else if (isLineTerminator(ch)) {</span>
|
975
|
+
<span class='covered'> break;</span>
|
976
|
+
<span class='covered'> } else {</span>
|
977
|
+
<span class='covered'> str += ch;</span>
|
978
|
+
<span class='covered'> }</span>
|
979
|
+
<span class='covered'> }</span>
|
980
|
+
<span class='covered'> </span>
|
981
|
+
<span class='covered'> if (quote !== '') {</span>
|
982
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
983
|
+
<span class='covered'> }</span>
|
984
|
+
<span class='covered'> </span>
|
985
|
+
<span class='covered'> return {</span>
|
986
|
+
<span class='covered'> type: Token.StringLiteral,</span>
|
987
|
+
<span class='covered'> value: str,</span>
|
988
|
+
<span class='covered'> octal: octal,</span>
|
989
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
990
|
+
<span class='covered'> lineStart: lineStart,</span>
|
991
|
+
<span class='covered'> range: [start, index]</span>
|
992
|
+
<span class='covered'> };</span>
|
993
|
+
<span class='covered'> }</span>
|
994
|
+
<span class='covered'> </span>
|
995
|
+
<span class='covered'> function scanRegExp() {</span>
|
996
|
+
<span class='covered'> var str = '', ch, start, pattern, flags, value, classMarker = false, restore;</span>
|
997
|
+
<span class='covered'> </span>
|
998
|
+
<span class='covered'> buffer = null;</span>
|
999
|
+
<span class='covered'> skipComment();</span>
|
1000
|
+
<span class='covered'> </span>
|
1001
|
+
<span class='covered'> start = index;</span>
|
1002
|
+
<span class='covered'> ch = source[index];</span>
|
1003
|
+
<span class='covered'> assert(ch === '/', 'Regular expression literal must start with a slash');</span>
|
1004
|
+
<span class='covered'> str = nextChar();</span>
|
1005
|
+
<span class='covered'> </span>
|
1006
|
+
<span class='covered'> while (index < length) {</span>
|
1007
|
+
<span class='covered'> ch = nextChar();</span>
|
1008
|
+
<span class='covered'> str += ch;</span>
|
1009
|
+
<span class='covered'> if (classMarker) {</span>
|
1010
|
+
<span class='covered'> if (ch === ']') {</span>
|
1011
|
+
<span class='covered'> classMarker = false;</span>
|
1012
|
+
<span class='covered'> }</span>
|
1013
|
+
<span class='covered'> } else {</span>
|
1014
|
+
<span class='covered'> if (ch === '\\') {</span>
|
1015
|
+
<span class='covered'> str += nextChar();</span>
|
1016
|
+
<span class='covered'> }</span>
|
1017
|
+
<span class='covered'> if (ch === '/') {</span>
|
1018
|
+
<span class='covered'> break;</span>
|
1019
|
+
<span class='covered'> }</span>
|
1020
|
+
<span class='covered'> if (ch === '[') {</span>
|
1021
|
+
<span class='covered'> classMarker = true;</span>
|
1022
|
+
<span class='covered'> }</span>
|
1023
|
+
<span class='covered'> if (isLineTerminator(ch)) {</span>
|
1024
|
+
<span class='covered'> throwError({}, Messages.UnterminatedRegExp);</span>
|
1025
|
+
<span class='covered'> }</span>
|
1026
|
+
<span class='covered'> }</span>
|
1027
|
+
<span class='covered'> }</span>
|
1028
|
+
<span class='covered'> </span>
|
1029
|
+
<span class='covered'> if (str.length === 1) {</span>
|
1030
|
+
<span class='covered'> throwError({}, Messages.UnterminatedRegExp);</span>
|
1031
|
+
<span class='covered'> }</span>
|
1032
|
+
<span class='covered'> </span>
|
1033
|
+
<span class='covered'> // Exclude leading and trailing slash.</span>
|
1034
|
+
<span class='covered'> pattern = str.substr(1, str.length - 2);</span>
|
1035
|
+
<span class='covered'> </span>
|
1036
|
+
<span class='covered'> flags = '';</span>
|
1037
|
+
<span class='covered'> while (index < length) {</span>
|
1038
|
+
<span class='covered'> ch = source[index];</span>
|
1039
|
+
<span class='covered'> if (!isIdentifierPart(ch)) {</span>
|
1040
|
+
<span class='covered'> break;</span>
|
1041
|
+
<span class='covered'> }</span>
|
1042
|
+
<span class='covered'> </span>
|
1043
|
+
<span class='covered'> ++index;</span>
|
1044
|
+
<span class='covered'> if (ch === '\\' && index < length) {</span>
|
1045
|
+
<span class='covered'> ch = source[index];</span>
|
1046
|
+
<span class='covered'> if (ch === 'u') {</span>
|
1047
|
+
<span class='covered'> ++index;</span>
|
1048
|
+
<span class='covered'> restore = index;</span>
|
1049
|
+
<span class='covered'> ch = scanHexEscape('u');</span>
|
1050
|
+
<span class='covered'> if (ch) {</span>
|
1051
|
+
<span class='covered'> flags += ch;</span>
|
1052
|
+
<span class='covered'> str += '\\u';</span>
|
1053
|
+
<span class='covered'> for (; restore < index; ++restore) {</span>
|
1054
|
+
<span class='covered'> str += source[restore];</span>
|
1055
|
+
<span class='covered'> }</span>
|
1056
|
+
<span class='covered'> } else {</span>
|
1057
|
+
<span class='covered'> index = restore;</span>
|
1058
|
+
<span class='covered'> flags += 'u';</span>
|
1059
|
+
<span class='covered'> str += '\\u';</span>
|
1060
|
+
<span class='covered'> }</span>
|
1061
|
+
<span class='covered'> } else {</span>
|
1062
|
+
<span class='covered'> str += '\\';</span>
|
1063
|
+
<span class='covered'> }</span>
|
1064
|
+
<span class='covered'> } else {</span>
|
1065
|
+
<span class='covered'> flags += ch;</span>
|
1066
|
+
<span class='covered'> str += ch;</span>
|
1067
|
+
<span class='covered'> }</span>
|
1068
|
+
<span class='covered'> }</span>
|
1069
|
+
<span class='covered'> </span>
|
1070
|
+
<span class='covered'> try {</span>
|
1071
|
+
<span class='covered'> value = new RegExp(pattern, flags);</span>
|
1072
|
+
<span class='covered'> } catch (e) {</span>
|
1073
|
+
<span class='covered'> throwError({}, Messages.InvalidRegExp);</span>
|
1074
|
+
<span class='covered'> }</span>
|
1075
|
+
<span class='covered'> </span>
|
1076
|
+
<span class='covered'> return {</span>
|
1077
|
+
<span class='covered'> literal: str,</span>
|
1078
|
+
<span class='covered'> value: value,</span>
|
1079
|
+
<span class='covered'> range: [start, index]</span>
|
1080
|
+
<span class='covered'> };</span>
|
1081
|
+
<span class='covered'> }</span>
|
1082
|
+
<span class='covered'> </span>
|
1083
|
+
<span class='covered'> function isIdentifierName(token) {</span>
|
1084
|
+
<span class='covered'> return token.type === Token.Identifier ||</span>
|
1085
|
+
<span class='covered'> token.type === Token.Keyword ||</span>
|
1086
|
+
<span class='covered'> token.type === Token.BooleanLiteral ||</span>
|
1087
|
+
<span class='covered'> token.type === Token.NullLiteral;</span>
|
1088
|
+
<span class='covered'> }</span>
|
1089
|
+
<span class='covered'> </span>
|
1090
|
+
<span class='covered'> function advance() {</span>
|
1091
|
+
<span class='covered'> var ch, token;</span>
|
1092
|
+
<span class='covered'> </span>
|
1093
|
+
<span class='covered'> skipComment();</span>
|
1094
|
+
<span class='covered'> </span>
|
1095
|
+
<span class='covered'> if (index >= length) {</span>
|
1096
|
+
<span class='covered'> return {</span>
|
1097
|
+
<span class='covered'> type: Token.EOF,</span>
|
1098
|
+
<span class='covered'> lineNumber: lineNumber,</span>
|
1099
|
+
<span class='covered'> lineStart: lineStart,</span>
|
1100
|
+
<span class='covered'> range: [index, index]</span>
|
1101
|
+
<span class='covered'> };</span>
|
1102
|
+
<span class='covered'> }</span>
|
1103
|
+
<span class='covered'> </span>
|
1104
|
+
<span class='covered'> token = scanPunctuator();</span>
|
1105
|
+
<span class='covered'> if (typeof token !== 'undefined') {</span>
|
1106
|
+
<span class='covered'> return token;</span>
|
1107
|
+
<span class='covered'> }</span>
|
1108
|
+
<span class='covered'> </span>
|
1109
|
+
<span class='covered'> ch = source[index];</span>
|
1110
|
+
<span class='covered'> </span>
|
1111
|
+
<span class='covered'> if (ch === '\'' || ch === '"') {</span>
|
1112
|
+
<span class='covered'> return scanStringLiteral();</span>
|
1113
|
+
<span class='covered'> }</span>
|
1114
|
+
<span class='covered'> </span>
|
1115
|
+
<span class='covered'> if (ch === '.' || isDecimalDigit(ch)) {</span>
|
1116
|
+
<span class='covered'> return scanNumericLiteral();</span>
|
1117
|
+
<span class='covered'> }</span>
|
1118
|
+
<span class='covered'> </span>
|
1119
|
+
<span class='covered'> token = scanIdentifier();</span>
|
1120
|
+
<span class='covered'> if (typeof token !== 'undefined') {</span>
|
1121
|
+
<span class='covered'> return token;</span>
|
1122
|
+
<span class='covered'> }</span>
|
1123
|
+
<span class='covered'> </span>
|
1124
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
1125
|
+
<span class='covered'> }</span>
|
1126
|
+
<span class='covered'> </span>
|
1127
|
+
<span class='covered'> function lex() {</span>
|
1128
|
+
<span class='covered'> var token;</span>
|
1129
|
+
<span class='covered'> </span>
|
1130
|
+
<span class='covered'> if (buffer) {</span>
|
1131
|
+
<span class='covered'> index = buffer.range[1];</span>
|
1132
|
+
<span class='covered'> lineNumber = buffer.lineNumber;</span>
|
1133
|
+
<span class='covered'> lineStart = buffer.lineStart;</span>
|
1134
|
+
<span class='covered'> token = buffer;</span>
|
1135
|
+
<span class='covered'> buffer = null;</span>
|
1136
|
+
<span class='covered'> return token;</span>
|
1137
|
+
<span class='covered'> }</span>
|
1138
|
+
<span class='covered'> </span>
|
1139
|
+
<span class='covered'> buffer = null;</span>
|
1140
|
+
<span class='covered'> return advance();</span>
|
1141
|
+
<span class='covered'> }</span>
|
1142
|
+
<span class='covered'> </span>
|
1143
|
+
<span class='covered'> function lookahead() {</span>
|
1144
|
+
<span class='covered'> var pos, line, start;</span>
|
1145
|
+
<span class='covered'> </span>
|
1146
|
+
<span class='covered'> if (buffer !== null) {</span>
|
1147
|
+
<span class='covered'> return buffer;</span>
|
1148
|
+
<span class='covered'> }</span>
|
1149
|
+
<span class='covered'> </span>
|
1150
|
+
<span class='covered'> pos = index;</span>
|
1151
|
+
<span class='covered'> line = lineNumber;</span>
|
1152
|
+
<span class='covered'> start = lineStart;</span>
|
1153
|
+
<span class='covered'> buffer = advance();</span>
|
1154
|
+
<span class='covered'> index = pos;</span>
|
1155
|
+
<span class='covered'> lineNumber = line;</span>
|
1156
|
+
<span class='covered'> lineStart = start;</span>
|
1157
|
+
<span class='covered'> </span>
|
1158
|
+
<span class='covered'> return buffer;</span>
|
1159
|
+
<span class='covered'> }</span>
|
1160
|
+
<span class='covered'> </span>
|
1161
|
+
<span class='covered'> // Return true if there is a line terminator before the next token.</span>
|
1162
|
+
<span class='covered'> </span>
|
1163
|
+
<span class='covered'> function peekLineTerminator() {</span>
|
1164
|
+
<span class='covered'> var pos, line, start, found;</span>
|
1165
|
+
<span class='covered'> </span>
|
1166
|
+
<span class='covered'> pos = index;</span>
|
1167
|
+
<span class='covered'> line = lineNumber;</span>
|
1168
|
+
<span class='covered'> start = lineStart;</span>
|
1169
|
+
<span class='covered'> skipComment();</span>
|
1170
|
+
<span class='covered'> found = lineNumber !== line;</span>
|
1171
|
+
<span class='covered'> index = pos;</span>
|
1172
|
+
<span class='covered'> lineNumber = line;</span>
|
1173
|
+
<span class='covered'> lineStart = start;</span>
|
1174
|
+
<span class='covered'> </span>
|
1175
|
+
<span class='covered'> return found;</span>
|
1176
|
+
<span class='covered'> }</span>
|
1177
|
+
<span class='covered'> </span>
|
1178
|
+
<span class='covered'> // Throw an exception</span>
|
1179
|
+
<span class='covered'> </span>
|
1180
|
+
<span class='covered'> function throwError(token, messageFormat) {</span>
|
1181
|
+
<span class='covered'> var error,</span>
|
1182
|
+
<span class='covered'> args = Array.prototype.slice.call(arguments, 2),</span>
|
1183
|
+
<span class='covered'> msg = messageFormat.replace(</span>
|
1184
|
+
<span class='covered'> /%(\d)/g,</span>
|
1185
|
+
<span class='covered'> function (whole, index) {</span>
|
1186
|
+
<span class='covered'> return args[index] || '';</span>
|
1187
|
+
<span class='covered'> }</span>
|
1188
|
+
<span class='covered'> );</span>
|
1189
|
+
<span class='covered'> </span>
|
1190
|
+
<span class='covered'> if (typeof token.lineNumber === 'number') {</span>
|
1191
|
+
<span class='covered'> error = new Error('Line ' + token.lineNumber + ': ' + msg);</span>
|
1192
|
+
<span class='covered'> error.index = token.range[0];</span>
|
1193
|
+
<span class='covered'> error.lineNumber = token.lineNumber;</span>
|
1194
|
+
<span class='covered'> error.column = token.range[0] - lineStart + 1;</span>
|
1195
|
+
<span class='covered'> } else {</span>
|
1196
|
+
<span class='covered'> error = new Error('Line ' + lineNumber + ': ' + msg);</span>
|
1197
|
+
<span class='covered'> error.index = index;</span>
|
1198
|
+
<span class='covered'> error.lineNumber = lineNumber;</span>
|
1199
|
+
<span class='covered'> error.column = index - lineStart + 1;</span>
|
1200
|
+
<span class='covered'> }</span>
|
1201
|
+
<span class='covered'> </span>
|
1202
|
+
<span class='covered'> throw error;</span>
|
1203
|
+
<span class='covered'> }</span>
|
1204
|
+
<span class='covered'> </span>
|
1205
|
+
<span class='covered'> function throwErrorTolerant() {</span>
|
1206
|
+
<span class='covered'> var error;</span>
|
1207
|
+
<span class='covered'> try {</span>
|
1208
|
+
<span class='covered'> throwError.apply(null, arguments);</span>
|
1209
|
+
<span class='covered'> } catch (e) {</span>
|
1210
|
+
<span class='covered'> if (extra.errors) {</span>
|
1211
|
+
<span class='covered'> extra.errors.push(e);</span>
|
1212
|
+
<span class='covered'> } else {</span>
|
1213
|
+
<span class='covered'> throw e;</span>
|
1214
|
+
<span class='covered'> }</span>
|
1215
|
+
<span class='covered'> }</span>
|
1216
|
+
<span class='covered'> }</span>
|
1217
|
+
<span class='covered'> </span>
|
1218
|
+
<span class='covered'> </span>
|
1219
|
+
<span class='covered'> // Throw an exception because of the token.</span>
|
1220
|
+
<span class='covered'> </span>
|
1221
|
+
<span class='covered'> function throwUnexpected(token) {</span>
|
1222
|
+
<span class='covered'> var s;</span>
|
1223
|
+
<span class='covered'> </span>
|
1224
|
+
<span class='covered'> if (token.type === Token.EOF) {</span>
|
1225
|
+
<span class='covered'> throwError(token, Messages.UnexpectedEOS);</span>
|
1226
|
+
<span class='covered'> }</span>
|
1227
|
+
<span class='covered'> </span>
|
1228
|
+
<span class='covered'> if (token.type === Token.NumericLiteral) {</span>
|
1229
|
+
<span class='covered'> throwError(token, Messages.UnexpectedNumber);</span>
|
1230
|
+
<span class='covered'> }</span>
|
1231
|
+
<span class='covered'> </span>
|
1232
|
+
<span class='covered'> if (token.type === Token.StringLiteral) {</span>
|
1233
|
+
<span class='covered'> throwError(token, Messages.UnexpectedString);</span>
|
1234
|
+
<span class='covered'> }</span>
|
1235
|
+
<span class='covered'> </span>
|
1236
|
+
<span class='covered'> if (token.type === Token.Identifier) {</span>
|
1237
|
+
<span class='covered'> throwError(token, Messages.UnexpectedIdentifier);</span>
|
1238
|
+
<span class='covered'> }</span>
|
1239
|
+
<span class='covered'> </span>
|
1240
|
+
<span class='covered'> if (token.type === Token.Keyword) {</span>
|
1241
|
+
<span class='covered'> if (isFutureReservedWord(token.value)) {</span>
|
1242
|
+
<span class='covered'> throwError(token, Messages.UnexpectedReserved);</span>
|
1243
|
+
<span class='covered'> } else if (strict && isStrictModeReservedWord(token.value)) {</span>
|
1244
|
+
<span class='covered'> throwError(token, Messages.StrictReservedWord);</span>
|
1245
|
+
<span class='covered'> }</span>
|
1246
|
+
<span class='covered'> throwError(token, Messages.UnexpectedToken, token.value);</span>
|
1247
|
+
<span class='covered'> }</span>
|
1248
|
+
<span class='covered'> </span>
|
1249
|
+
<span class='covered'> // BooleanLiteral, NullLiteral, or Punctuator.</span>
|
1250
|
+
<span class='covered'> throwError(token, Messages.UnexpectedToken, token.value);</span>
|
1251
|
+
<span class='covered'> }</span>
|
1252
|
+
<span class='covered'> </span>
|
1253
|
+
<span class='covered'> // Expect the next token to match the specified punctuator.</span>
|
1254
|
+
<span class='covered'> // If not, an exception will be thrown.</span>
|
1255
|
+
<span class='covered'> </span>
|
1256
|
+
<span class='covered'> function expect(value) {</span>
|
1257
|
+
<span class='covered'> var token = lex();</span>
|
1258
|
+
<span class='covered'> if (token.type !== Token.Punctuator || token.value !== value) {</span>
|
1259
|
+
<span class='covered'> throwUnexpected(token);</span>
|
1260
|
+
<span class='covered'> }</span>
|
1261
|
+
<span class='covered'> }</span>
|
1262
|
+
<span class='covered'> </span>
|
1263
|
+
<span class='covered'> // Expect the next token to match the specified keyword.</span>
|
1264
|
+
<span class='covered'> // If not, an exception will be thrown.</span>
|
1265
|
+
<span class='covered'> </span>
|
1266
|
+
<span class='covered'> function expectKeyword(keyword) {</span>
|
1267
|
+
<span class='covered'> var token = lex();</span>
|
1268
|
+
<span class='covered'> if (token.type !== Token.Keyword || token.value !== keyword) {</span>
|
1269
|
+
<span class='covered'> throwUnexpected(token);</span>
|
1270
|
+
<span class='covered'> }</span>
|
1271
|
+
<span class='covered'> }</span>
|
1272
|
+
<span class='covered'> </span>
|
1273
|
+
<span class='covered'> // Return true if the next token matches the specified punctuator.</span>
|
1274
|
+
<span class='covered'> </span>
|
1275
|
+
<span class='covered'> function match(value) {</span>
|
1276
|
+
<span class='covered'> var token = lookahead();</span>
|
1277
|
+
<span class='covered'> return token.type === Token.Punctuator && token.value === value;</span>
|
1278
|
+
<span class='covered'> }</span>
|
1279
|
+
<span class='covered'> </span>
|
1280
|
+
<span class='covered'> // Return true if the next token matches the specified keyword</span>
|
1281
|
+
<span class='covered'> </span>
|
1282
|
+
<span class='covered'> function matchKeyword(keyword) {</span>
|
1283
|
+
<span class='covered'> var token = lookahead();</span>
|
1284
|
+
<span class='covered'> return token.type === Token.Keyword && token.value === keyword;</span>
|
1285
|
+
<span class='covered'> }</span>
|
1286
|
+
<span class='covered'> </span>
|
1287
|
+
<span class='covered'> // Return true if the next token is an assignment operator</span>
|
1288
|
+
<span class='covered'> </span>
|
1289
|
+
<span class='covered'> function matchAssign() {</span>
|
1290
|
+
<span class='covered'> var token = lookahead(),</span>
|
1291
|
+
<span class='covered'> op = token.value;</span>
|
1292
|
+
<span class='covered'> </span>
|
1293
|
+
<span class='covered'> if (token.type !== Token.Punctuator) {</span>
|
1294
|
+
<span class='covered'> return false;</span>
|
1295
|
+
<span class='covered'> }</span>
|
1296
|
+
<span class='covered'> return op === '=' ||</span>
|
1297
|
+
<span class='covered'> op === '*=' ||</span>
|
1298
|
+
<span class='covered'> op === '/=' ||</span>
|
1299
|
+
<span class='covered'> op === '%=' ||</span>
|
1300
|
+
<span class='covered'> op === '+=' ||</span>
|
1301
|
+
<span class='covered'> op === '-=' ||</span>
|
1302
|
+
<span class='covered'> op === '<<=' ||</span>
|
1303
|
+
<span class='covered'> op === '>>=' ||</span>
|
1304
|
+
<span class='covered'> op === '>>>=' ||</span>
|
1305
|
+
<span class='covered'> op === '&=' ||</span>
|
1306
|
+
<span class='covered'> op === '^=' ||</span>
|
1307
|
+
<span class='covered'> op === '|=';</span>
|
1308
|
+
<span class='covered'> }</span>
|
1309
|
+
<span class='covered'> </span>
|
1310
|
+
<span class='covered'> function consumeSemicolon() {</span>
|
1311
|
+
<span class='covered'> var token, line;</span>
|
1312
|
+
<span class='covered'> </span>
|
1313
|
+
<span class='covered'> // Catch the very common case first.</span>
|
1314
|
+
<span class='covered'> if (source[index] === ';') {</span>
|
1315
|
+
<span class='covered'> lex();</span>
|
1316
|
+
<span class='covered'> return;</span>
|
1317
|
+
<span class='covered'> }</span>
|
1318
|
+
<span class='covered'> </span>
|
1319
|
+
<span class='covered'> line = lineNumber;</span>
|
1320
|
+
<span class='covered'> skipComment();</span>
|
1321
|
+
<span class='covered'> if (lineNumber !== line) {</span>
|
1322
|
+
<span class='covered'> return;</span>
|
1323
|
+
<span class='covered'> }</span>
|
1324
|
+
<span class='covered'> </span>
|
1325
|
+
<span class='covered'> if (match(';')) {</span>
|
1326
|
+
<span class='covered'> lex();</span>
|
1327
|
+
<span class='covered'> return;</span>
|
1328
|
+
<span class='covered'> }</span>
|
1329
|
+
<span class='covered'> </span>
|
1330
|
+
<span class='covered'> token = lookahead();</span>
|
1331
|
+
<span class='covered'> if (token.type !== Token.EOF && !match('}')) {</span>
|
1332
|
+
<span class='covered'> throwUnexpected(token);</span>
|
1333
|
+
<span class='covered'> }</span>
|
1334
|
+
<span class='covered'> return;</span>
|
1335
|
+
<span class='covered'> }</span>
|
1336
|
+
<span class='covered'> </span>
|
1337
|
+
<span class='covered'> // Return true if provided expression is LeftHandSideExpression</span>
|
1338
|
+
<span class='covered'> </span>
|
1339
|
+
<span class='covered'> function isLeftHandSide(expr) {</span>
|
1340
|
+
<span class='covered'> switch (expr.type) {</span>
|
1341
|
+
<span class='covered'> case 'AssignmentExpression':</span>
|
1342
|
+
<span class='covered'> case 'BinaryExpression':</span>
|
1343
|
+
<span class='covered'> case 'ConditionalExpression':</span>
|
1344
|
+
<span class='covered'> case 'LogicalExpression':</span>
|
1345
|
+
<span class='covered'> case 'SequenceExpression':</span>
|
1346
|
+
<span class='covered'> case 'UnaryExpression':</span>
|
1347
|
+
<span class='covered'> case 'UpdateExpression':</span>
|
1348
|
+
<span class='covered'> return false;</span>
|
1349
|
+
<span class='covered'> }</span>
|
1350
|
+
<span class='covered'> return true;</span>
|
1351
|
+
<span class='covered'> }</span>
|
1352
|
+
<span class='covered'> </span>
|
1353
|
+
<span class='covered'> // 11.1.4 Array Initialiser</span>
|
1354
|
+
<span class='covered'> </span>
|
1355
|
+
<span class='covered'> function parseArrayInitialiser() {</span>
|
1356
|
+
<span class='covered'> var elements = [],</span>
|
1357
|
+
<span class='covered'> undef;</span>
|
1358
|
+
<span class='covered'> </span>
|
1359
|
+
<span class='covered'> expect('[');</span>
|
1360
|
+
<span class='covered'> </span>
|
1361
|
+
<span class='covered'> while (!match(']')) {</span>
|
1362
|
+
<span class='covered'> if (match(',')) {</span>
|
1363
|
+
<span class='covered'> lex();</span>
|
1364
|
+
<span class='covered'> elements.push(undef);</span>
|
1365
|
+
<span class='covered'> } else {</span>
|
1366
|
+
<span class='covered'> elements.push(parseAssignmentExpression());</span>
|
1367
|
+
<span class='covered'> </span>
|
1368
|
+
<span class='covered'> if (!match(']')) {</span>
|
1369
|
+
<span class='covered'> expect(',');</span>
|
1370
|
+
<span class='covered'> }</span>
|
1371
|
+
<span class='covered'> }</span>
|
1372
|
+
<span class='covered'> }</span>
|
1373
|
+
<span class='covered'> </span>
|
1374
|
+
<span class='covered'> expect(']');</span>
|
1375
|
+
<span class='covered'> </span>
|
1376
|
+
<span class='covered'> return {</span>
|
1377
|
+
<span class='covered'> type: Syntax.ArrayExpression,</span>
|
1378
|
+
<span class='covered'> elements: elements</span>
|
1379
|
+
<span class='covered'> };</span>
|
1380
|
+
<span class='covered'> }</span>
|
1381
|
+
<span class='covered'> </span>
|
1382
|
+
<span class='covered'> // 11.1.5 Object Initialiser</span>
|
1383
|
+
<span class='covered'> </span>
|
1384
|
+
<span class='covered'> function parsePropertyFunction(param, first) {</span>
|
1385
|
+
<span class='covered'> var previousStrict, body;</span>
|
1386
|
+
<span class='covered'> </span>
|
1387
|
+
<span class='covered'> previousStrict = strict;</span>
|
1388
|
+
<span class='covered'> body = parseFunctionSourceElements();</span>
|
1389
|
+
<span class='covered'> if (first && strict && isRestrictedWord(param[0].name)) {</span>
|
1390
|
+
<span class='covered'> throwError(first, Messages.StrictParamName);</span>
|
1391
|
+
<span class='covered'> }</span>
|
1392
|
+
<span class='covered'> strict = previousStrict;</span>
|
1393
|
+
<span class='covered'> </span>
|
1394
|
+
<span class='covered'> return {</span>
|
1395
|
+
<span class='covered'> type: Syntax.FunctionExpression,</span>
|
1396
|
+
<span class='covered'> id: null,</span>
|
1397
|
+
<span class='covered'> params: param,</span>
|
1398
|
+
<span class='covered'> body: body</span>
|
1399
|
+
<span class='covered'> };</span>
|
1400
|
+
<span class='covered'> }</span>
|
1401
|
+
<span class='covered'> </span>
|
1402
|
+
<span class='covered'> function parseObjectPropertyKey() {</span>
|
1403
|
+
<span class='covered'> var token = lex(),</span>
|
1404
|
+
<span class='covered'> key;</span>
|
1405
|
+
<span class='covered'> </span>
|
1406
|
+
<span class='covered'> switch (token.type) {</span>
|
1407
|
+
<span class='covered'> </span>
|
1408
|
+
<span class='covered'> case Token.StringLiteral:</span>
|
1409
|
+
<span class='covered'> case Token.NumericLiteral:</span>
|
1410
|
+
<span class='covered'> if (strict && token.octal) {</span>
|
1411
|
+
<span class='covered'> throwError(token, Messages.StrictOctalLiteral);</span>
|
1412
|
+
<span class='covered'> }</span>
|
1413
|
+
<span class='covered'> key = createLiteral(token);</span>
|
1414
|
+
<span class='covered'> break;</span>
|
1415
|
+
<span class='covered'> </span>
|
1416
|
+
<span class='covered'> case Token.Identifier:</span>
|
1417
|
+
<span class='covered'> case Token.Keyword:</span>
|
1418
|
+
<span class='covered'> case Token.BooleanLiteral:</span>
|
1419
|
+
<span class='covered'> case Token.NullLiteral:</span>
|
1420
|
+
<span class='covered'> key = {</span>
|
1421
|
+
<span class='covered'> type: Syntax.Identifier,</span>
|
1422
|
+
<span class='covered'> name: token.value</span>
|
1423
|
+
<span class='covered'> };</span>
|
1424
|
+
<span class='covered'> break;</span>
|
1425
|
+
<span class='covered'> </span>
|
1426
|
+
<span class='covered'> default:</span>
|
1427
|
+
<span class='covered'> // Unreachable, since parseObjectProperty() will not call this</span>
|
1428
|
+
<span class='covered'> // function with any other type of token.</span>
|
1429
|
+
<span class='covered'> }</span>
|
1430
|
+
<span class='covered'> </span>
|
1431
|
+
<span class='covered'> return key;</span>
|
1432
|
+
<span class='covered'> }</span>
|
1433
|
+
<span class='covered'> </span>
|
1434
|
+
<span class='covered'> function parseObjectProperty() {</span>
|
1435
|
+
<span class='covered'> var token, property, key, id, param;</span>
|
1436
|
+
<span class='covered'> </span>
|
1437
|
+
<span class='covered'> token = lookahead();</span>
|
1438
|
+
<span class='covered'> </span>
|
1439
|
+
<span class='covered'> switch (token.type) {</span>
|
1440
|
+
<span class='covered'> </span>
|
1441
|
+
<span class='covered'> case Token.Identifier:</span>
|
1442
|
+
<span class='covered'> id = parseObjectPropertyKey();</span>
|
1443
|
+
<span class='covered'> </span>
|
1444
|
+
<span class='covered'> // Property Assignment: Getter and Setter.</span>
|
1445
|
+
<span class='covered'> </span>
|
1446
|
+
<span class='covered'> if (token.value === 'get' && !match(':')) {</span>
|
1447
|
+
<span class='covered'> key = parseObjectPropertyKey();</span>
|
1448
|
+
<span class='covered'> expect('(');</span>
|
1449
|
+
<span class='covered'> expect(')');</span>
|
1450
|
+
<span class='covered'> property = {</span>
|
1451
|
+
<span class='covered'> type: Syntax.Property,</span>
|
1452
|
+
<span class='covered'> key: key,</span>
|
1453
|
+
<span class='covered'> value: parsePropertyFunction([]),</span>
|
1454
|
+
<span class='covered'> kind: 'get'</span>
|
1455
|
+
<span class='covered'> };</span>
|
1456
|
+
<span class='covered'> } else if (token.value === 'set' && !match(':')) {</span>
|
1457
|
+
<span class='covered'> key = parseObjectPropertyKey();</span>
|
1458
|
+
<span class='covered'> expect('(');</span>
|
1459
|
+
<span class='covered'> token = lookahead();</span>
|
1460
|
+
<span class='covered'> if (token.type !== Token.Identifier) {</span>
|
1461
|
+
<span class='covered'> throwUnexpected(lex());</span>
|
1462
|
+
<span class='covered'> }</span>
|
1463
|
+
<span class='covered'> param = [ parseVariableIdentifier() ];</span>
|
1464
|
+
<span class='covered'> expect(')');</span>
|
1465
|
+
<span class='covered'> property = {</span>
|
1466
|
+
<span class='covered'> type: Syntax.Property,</span>
|
1467
|
+
<span class='covered'> key: key,</span>
|
1468
|
+
<span class='covered'> value: parsePropertyFunction(param, token),</span>
|
1469
|
+
<span class='covered'> kind: 'set'</span>
|
1470
|
+
<span class='covered'> };</span>
|
1471
|
+
<span class='covered'> } else {</span>
|
1472
|
+
<span class='covered'> expect(':');</span>
|
1473
|
+
<span class='covered'> property = {</span>
|
1474
|
+
<span class='covered'> type: Syntax.Property,</span>
|
1475
|
+
<span class='covered'> key: id,</span>
|
1476
|
+
<span class='covered'> value: parseAssignmentExpression(),</span>
|
1477
|
+
<span class='covered'> kind: 'init'</span>
|
1478
|
+
<span class='covered'> };</span>
|
1479
|
+
<span class='covered'> }</span>
|
1480
|
+
<span class='covered'> break;</span>
|
1481
|
+
<span class='covered'> </span>
|
1482
|
+
<span class='covered'> case Token.Keyword:</span>
|
1483
|
+
<span class='covered'> case Token.BooleanLiteral:</span>
|
1484
|
+
<span class='covered'> case Token.NullLiteral:</span>
|
1485
|
+
<span class='covered'> case Token.StringLiteral:</span>
|
1486
|
+
<span class='covered'> case Token.NumericLiteral:</span>
|
1487
|
+
<span class='covered'> key = parseObjectPropertyKey();</span>
|
1488
|
+
<span class='covered'> expect(':');</span>
|
1489
|
+
<span class='covered'> property = {</span>
|
1490
|
+
<span class='covered'> type: Syntax.Property,</span>
|
1491
|
+
<span class='covered'> key: key,</span>
|
1492
|
+
<span class='covered'> value: parseAssignmentExpression(),</span>
|
1493
|
+
<span class='covered'> kind: 'init'</span>
|
1494
|
+
<span class='covered'> };</span>
|
1495
|
+
<span class='covered'> break;</span>
|
1496
|
+
<span class='covered'> </span>
|
1497
|
+
<span class='covered'> default:</span>
|
1498
|
+
<span class='covered'> throwUnexpected(token);</span>
|
1499
|
+
<span class='covered'> }</span>
|
1500
|
+
<span class='covered'> </span>
|
1501
|
+
<span class='covered'> return property;</span>
|
1502
|
+
<span class='covered'> }</span>
|
1503
|
+
<span class='covered'> </span>
|
1504
|
+
<span class='covered'> function parseObjectInitialiser() {</span>
|
1505
|
+
<span class='covered'> var token, properties = [], property, name, kind, map = {}, toString = String;</span>
|
1506
|
+
<span class='covered'> </span>
|
1507
|
+
<span class='covered'> expect('{');</span>
|
1508
|
+
<span class='covered'> </span>
|
1509
|
+
<span class='covered'> while (!match('}')) {</span>
|
1510
|
+
<span class='covered'> property = parseObjectProperty();</span>
|
1511
|
+
<span class='covered'> </span>
|
1512
|
+
<span class='covered'> if (property.key.type === Syntax.Identifier) {</span>
|
1513
|
+
<span class='covered'> name = property.key.name;</span>
|
1514
|
+
<span class='covered'> } else {</span>
|
1515
|
+
<span class='covered'> name = toString(property.key.value);</span>
|
1516
|
+
<span class='covered'> }</span>
|
1517
|
+
<span class='covered'> kind = (property.kind === 'init') ? PropertyKind.Data : (property.kind === 'get') ? PropertyKind.Get : PropertyKind.Set;</span>
|
1518
|
+
<span class='covered'> if (Object.prototype.hasOwnProperty.call(map, name)) {</span>
|
1519
|
+
<span class='covered'> if (map[name] === PropertyKind.Data) {</span>
|
1520
|
+
<span class='covered'> if (strict && kind === PropertyKind.Data) {</span>
|
1521
|
+
<span class='covered'> throwError({}, Messages.StrictDuplicateProperty);</span>
|
1522
|
+
<span class='covered'> } else if (kind !== PropertyKind.Data) {</span>
|
1523
|
+
<span class='covered'> throwError({}, Messages.AccessorDataProperty);</span>
|
1524
|
+
<span class='covered'> }</span>
|
1525
|
+
<span class='covered'> } else {</span>
|
1526
|
+
<span class='covered'> if (kind === PropertyKind.Data) {</span>
|
1527
|
+
<span class='covered'> throwError({}, Messages.AccessorDataProperty);</span>
|
1528
|
+
<span class='covered'> } else if (map[name] & kind) {</span>
|
1529
|
+
<span class='covered'> throwError({}, Messages.AccessorGetSet);</span>
|
1530
|
+
<span class='covered'> }</span>
|
1531
|
+
<span class='covered'> }</span>
|
1532
|
+
<span class='covered'> map[name] |= kind;</span>
|
1533
|
+
<span class='covered'> } else {</span>
|
1534
|
+
<span class='covered'> map[name] = kind;</span>
|
1535
|
+
<span class='covered'> }</span>
|
1536
|
+
<span class='covered'> </span>
|
1537
|
+
<span class='covered'> properties.push(property);</span>
|
1538
|
+
<span class='covered'> </span>
|
1539
|
+
<span class='covered'> if (!match('}')) {</span>
|
1540
|
+
<span class='covered'> expect(',');</span>
|
1541
|
+
<span class='covered'> }</span>
|
1542
|
+
<span class='covered'> }</span>
|
1543
|
+
<span class='covered'> </span>
|
1544
|
+
<span class='covered'> expect('}');</span>
|
1545
|
+
<span class='covered'> </span>
|
1546
|
+
<span class='covered'> return {</span>
|
1547
|
+
<span class='covered'> type: Syntax.ObjectExpression,</span>
|
1548
|
+
<span class='covered'> properties: properties</span>
|
1549
|
+
<span class='covered'> };</span>
|
1550
|
+
<span class='covered'> }</span>
|
1551
|
+
<span class='covered'> </span>
|
1552
|
+
<span class='covered'> // 11.1 Primary Expressions</span>
|
1553
|
+
<span class='covered'> </span>
|
1554
|
+
<span class='covered'> function parsePrimaryExpression() {</span>
|
1555
|
+
<span class='covered'> var expr,</span>
|
1556
|
+
<span class='covered'> token = lookahead(),</span>
|
1557
|
+
<span class='covered'> type = token.type;</span>
|
1558
|
+
<span class='covered'> </span>
|
1559
|
+
<span class='covered'> if (type === Token.Identifier) {</span>
|
1560
|
+
<span class='covered'> return {</span>
|
1561
|
+
<span class='covered'> type: Syntax.Identifier,</span>
|
1562
|
+
<span class='covered'> name: lex().value</span>
|
1563
|
+
<span class='covered'> };</span>
|
1564
|
+
<span class='covered'> }</span>
|
1565
|
+
<span class='covered'> </span>
|
1566
|
+
<span class='covered'> if (type === Token.StringLiteral || type === Token.NumericLiteral) {</span>
|
1567
|
+
<span class='covered'> if (strict && token.octal) {</span>
|
1568
|
+
<span class='covered'> throwError(token, Messages.StrictOctalLiteral);</span>
|
1569
|
+
<span class='covered'> }</span>
|
1570
|
+
<span class='covered'> return createLiteral(lex());</span>
|
1571
|
+
<span class='covered'> }</span>
|
1572
|
+
<span class='covered'> </span>
|
1573
|
+
<span class='covered'> if (type === Token.Keyword) {</span>
|
1574
|
+
<span class='covered'> if (matchKeyword('this')) {</span>
|
1575
|
+
<span class='covered'> lex();</span>
|
1576
|
+
<span class='covered'> return {</span>
|
1577
|
+
<span class='covered'> type: Syntax.ThisExpression</span>
|
1578
|
+
<span class='covered'> };</span>
|
1579
|
+
<span class='covered'> }</span>
|
1580
|
+
<span class='covered'> </span>
|
1581
|
+
<span class='covered'> if (matchKeyword('function')) {</span>
|
1582
|
+
<span class='covered'> return parseFunctionExpression();</span>
|
1583
|
+
<span class='covered'> }</span>
|
1584
|
+
<span class='covered'> }</span>
|
1585
|
+
<span class='covered'> </span>
|
1586
|
+
<span class='covered'> if (type === Token.BooleanLiteral) {</span>
|
1587
|
+
<span class='covered'> lex();</span>
|
1588
|
+
<span class='covered'> token.value = (token.value === 'true');</span>
|
1589
|
+
<span class='covered'> return createLiteral(token);</span>
|
1590
|
+
<span class='covered'> }</span>
|
1591
|
+
<span class='covered'> </span>
|
1592
|
+
<span class='covered'> if (type === Token.NullLiteral) {</span>
|
1593
|
+
<span class='covered'> lex();</span>
|
1594
|
+
<span class='covered'> token.value = null;</span>
|
1595
|
+
<span class='covered'> return createLiteral(token);</span>
|
1596
|
+
<span class='covered'> }</span>
|
1597
|
+
<span class='covered'> </span>
|
1598
|
+
<span class='covered'> if (match('[')) {</span>
|
1599
|
+
<span class='covered'> return parseArrayInitialiser();</span>
|
1600
|
+
<span class='covered'> }</span>
|
1601
|
+
<span class='covered'> </span>
|
1602
|
+
<span class='covered'> if (match('{')) {</span>
|
1603
|
+
<span class='covered'> return parseObjectInitialiser();</span>
|
1604
|
+
<span class='covered'> }</span>
|
1605
|
+
<span class='covered'> </span>
|
1606
|
+
<span class='covered'> if (match('(')) {</span>
|
1607
|
+
<span class='covered'> lex();</span>
|
1608
|
+
<span class='covered'> lastParenthesized = expr = parseExpression();</span>
|
1609
|
+
<span class='covered'> expect(')');</span>
|
1610
|
+
<span class='covered'> return expr;</span>
|
1611
|
+
<span class='covered'> }</span>
|
1612
|
+
<span class='covered'> </span>
|
1613
|
+
<span class='covered'> if (match('/') || match('/=')) {</span>
|
1614
|
+
<span class='covered'> return createLiteral(scanRegExp());</span>
|
1615
|
+
<span class='covered'> }</span>
|
1616
|
+
<span class='covered'> </span>
|
1617
|
+
<span class='covered'> return throwUnexpected(lex());</span>
|
1618
|
+
<span class='covered'> }</span>
|
1619
|
+
<span class='covered'> </span>
|
1620
|
+
<span class='covered'> // 11.2 Left-Hand-Side Expressions</span>
|
1621
|
+
<span class='covered'> </span>
|
1622
|
+
<span class='covered'> function parseArguments() {</span>
|
1623
|
+
<span class='covered'> var args = [];</span>
|
1624
|
+
<span class='covered'> </span>
|
1625
|
+
<span class='covered'> expect('(');</span>
|
1626
|
+
<span class='covered'> </span>
|
1627
|
+
<span class='covered'> if (!match(')')) {</span>
|
1628
|
+
<span class='covered'> while (index < length) {</span>
|
1629
|
+
<span class='covered'> args.push(parseAssignmentExpression());</span>
|
1630
|
+
<span class='covered'> if (match(')')) {</span>
|
1631
|
+
<span class='covered'> break;</span>
|
1632
|
+
<span class='covered'> }</span>
|
1633
|
+
<span class='covered'> expect(',');</span>
|
1634
|
+
<span class='covered'> }</span>
|
1635
|
+
<span class='covered'> }</span>
|
1636
|
+
<span class='covered'> </span>
|
1637
|
+
<span class='covered'> expect(')');</span>
|
1638
|
+
<span class='covered'> </span>
|
1639
|
+
<span class='covered'> return args;</span>
|
1640
|
+
<span class='covered'> }</span>
|
1641
|
+
<span class='covered'> </span>
|
1642
|
+
<span class='covered'> function parseNonComputedProperty() {</span>
|
1643
|
+
<span class='covered'> var token = lex();</span>
|
1644
|
+
<span class='covered'> </span>
|
1645
|
+
<span class='covered'> if (!isIdentifierName(token)) {</span>
|
1646
|
+
<span class='covered'> throwUnexpected(token);</span>
|
1647
|
+
<span class='covered'> }</span>
|
1648
|
+
<span class='covered'> </span>
|
1649
|
+
<span class='covered'> return {</span>
|
1650
|
+
<span class='covered'> type: Syntax.Identifier,</span>
|
1651
|
+
<span class='covered'> name: token.value</span>
|
1652
|
+
<span class='covered'> };</span>
|
1653
|
+
<span class='covered'> }</span>
|
1654
|
+
<span class='covered'> </span>
|
1655
|
+
<span class='covered'> function parseNonComputedMember(object) {</span>
|
1656
|
+
<span class='covered'> return {</span>
|
1657
|
+
<span class='covered'> type: Syntax.MemberExpression,</span>
|
1658
|
+
<span class='covered'> computed: false,</span>
|
1659
|
+
<span class='covered'> object: object,</span>
|
1660
|
+
<span class='covered'> property: parseNonComputedProperty()</span>
|
1661
|
+
<span class='covered'> };</span>
|
1662
|
+
<span class='covered'> }</span>
|
1663
|
+
<span class='covered'> </span>
|
1664
|
+
<span class='covered'> function parseComputedMember(object) {</span>
|
1665
|
+
<span class='covered'> var property, expr;</span>
|
1666
|
+
<span class='covered'> </span>
|
1667
|
+
<span class='covered'> expect('[');</span>
|
1668
|
+
<span class='covered'> property = parseExpression();</span>
|
1669
|
+
<span class='covered'> expr = {</span>
|
1670
|
+
<span class='covered'> type: Syntax.MemberExpression,</span>
|
1671
|
+
<span class='covered'> computed: true,</span>
|
1672
|
+
<span class='covered'> object: object,</span>
|
1673
|
+
<span class='covered'> property: property</span>
|
1674
|
+
<span class='covered'> };</span>
|
1675
|
+
<span class='covered'> expect(']');</span>
|
1676
|
+
<span class='covered'> return expr;</span>
|
1677
|
+
<span class='covered'> }</span>
|
1678
|
+
<span class='covered'> </span>
|
1679
|
+
<span class='covered'> function parseCallMember(object) {</span>
|
1680
|
+
<span class='covered'> return {</span>
|
1681
|
+
<span class='covered'> type: Syntax.CallExpression,</span>
|
1682
|
+
<span class='covered'> callee: object,</span>
|
1683
|
+
<span class='covered'> 'arguments': parseArguments()</span>
|
1684
|
+
<span class='covered'> };</span>
|
1685
|
+
<span class='covered'> }</span>
|
1686
|
+
<span class='covered'> </span>
|
1687
|
+
<span class='covered'> function parseNewExpression() {</span>
|
1688
|
+
<span class='covered'> var expr;</span>
|
1689
|
+
<span class='covered'> </span>
|
1690
|
+
<span class='covered'> expectKeyword('new');</span>
|
1691
|
+
<span class='covered'> </span>
|
1692
|
+
<span class='covered'> expr = {</span>
|
1693
|
+
<span class='covered'> type: Syntax.NewExpression,</span>
|
1694
|
+
<span class='covered'> callee: parseLeftHandSideExpression(),</span>
|
1695
|
+
<span class='covered'> 'arguments': []</span>
|
1696
|
+
<span class='covered'> };</span>
|
1697
|
+
<span class='covered'> </span>
|
1698
|
+
<span class='covered'> if (match('(')) {</span>
|
1699
|
+
<span class='covered'> expr['arguments'] = parseArguments();</span>
|
1700
|
+
<span class='covered'> }</span>
|
1701
|
+
<span class='covered'> </span>
|
1702
|
+
<span class='covered'> return expr;</span>
|
1703
|
+
<span class='covered'> }</span>
|
1704
|
+
<span class='covered'> </span>
|
1705
|
+
<span class='covered'> function parseLeftHandSideExpressionAllowCall() {</span>
|
1706
|
+
<span class='covered'> var useNew, expr;</span>
|
1707
|
+
<span class='covered'> </span>
|
1708
|
+
<span class='covered'> useNew = matchKeyword('new');</span>
|
1709
|
+
<span class='covered'> expr = useNew ? parseNewExpression() : parsePrimaryExpression();</span>
|
1710
|
+
<span class='covered'> </span>
|
1711
|
+
<span class='covered'> while (index < length) {</span>
|
1712
|
+
<span class='covered'> if (match('.')) {</span>
|
1713
|
+
<span class='covered'> lex();</span>
|
1714
|
+
<span class='covered'> expr = parseNonComputedMember(expr);</span>
|
1715
|
+
<span class='covered'> } else if (match('[')) {</span>
|
1716
|
+
<span class='covered'> expr = parseComputedMember(expr);</span>
|
1717
|
+
<span class='covered'> } else if (match('(')) {</span>
|
1718
|
+
<span class='covered'> expr = parseCallMember(expr);</span>
|
1719
|
+
<span class='covered'> } else {</span>
|
1720
|
+
<span class='covered'> break;</span>
|
1721
|
+
<span class='covered'> }</span>
|
1722
|
+
<span class='covered'> }</span>
|
1723
|
+
<span class='covered'> </span>
|
1724
|
+
<span class='covered'> return expr;</span>
|
1725
|
+
<span class='covered'> }</span>
|
1726
|
+
<span class='covered'> </span>
|
1727
|
+
<span class='covered'> function parseLeftHandSideExpression() {</span>
|
1728
|
+
<span class='covered'> var useNew, expr;</span>
|
1729
|
+
<span class='covered'> </span>
|
1730
|
+
<span class='covered'> useNew = matchKeyword('new');</span>
|
1731
|
+
<span class='covered'> expr = useNew ? parseNewExpression() : parsePrimaryExpression();</span>
|
1732
|
+
<span class='covered'> </span>
|
1733
|
+
<span class='covered'> while (index < length) {</span>
|
1734
|
+
<span class='covered'> if (match('.')) {</span>
|
1735
|
+
<span class='covered'> lex();</span>
|
1736
|
+
<span class='covered'> expr = parseNonComputedMember(expr);</span>
|
1737
|
+
<span class='covered'> } else if (match('[')) {</span>
|
1738
|
+
<span class='covered'> expr = parseComputedMember(expr);</span>
|
1739
|
+
<span class='covered'> } else {</span>
|
1740
|
+
<span class='covered'> break;</span>
|
1741
|
+
<span class='covered'> }</span>
|
1742
|
+
<span class='covered'> }</span>
|
1743
|
+
<span class='covered'> </span>
|
1744
|
+
<span class='covered'> return expr;</span>
|
1745
|
+
<span class='covered'> }</span>
|
1746
|
+
<span class='covered'> </span>
|
1747
|
+
<span class='covered'> // 11.3 Postfix Expressions</span>
|
1748
|
+
<span class='covered'> </span>
|
1749
|
+
<span class='covered'> function parsePostfixExpression() {</span>
|
1750
|
+
<span class='covered'> var expr = parseLeftHandSideExpressionAllowCall();</span>
|
1751
|
+
<span class='covered'> </span>
|
1752
|
+
<span class='covered'> if ((match('++') || match('--')) && !peekLineTerminator()) {</span>
|
1753
|
+
<span class='covered'> // 11.3.1, 11.3.2</span>
|
1754
|
+
<span class='covered'> if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {</span>
|
1755
|
+
<span class='covered'> throwError({}, Messages.StrictLHSPostfix);</span>
|
1756
|
+
<span class='covered'> }</span>
|
1757
|
+
<span class='covered'> expr = {</span>
|
1758
|
+
<span class='covered'> type: Syntax.UpdateExpression,</span>
|
1759
|
+
<span class='covered'> operator: lex().value,</span>
|
1760
|
+
<span class='covered'> argument: expr,</span>
|
1761
|
+
<span class='covered'> prefix: false</span>
|
1762
|
+
<span class='covered'> };</span>
|
1763
|
+
<span class='covered'> }</span>
|
1764
|
+
<span class='covered'> </span>
|
1765
|
+
<span class='covered'> return expr;</span>
|
1766
|
+
<span class='covered'> }</span>
|
1767
|
+
<span class='covered'> </span>
|
1768
|
+
<span class='covered'> // 11.4 Unary Operators</span>
|
1769
|
+
<span class='covered'> </span>
|
1770
|
+
<span class='covered'> function parseUnaryExpression() {</span>
|
1771
|
+
<span class='covered'> var token, expr;</span>
|
1772
|
+
<span class='covered'> </span>
|
1773
|
+
<span class='covered'> if (match('++') || match('--')) {</span>
|
1774
|
+
<span class='covered'> token = lex();</span>
|
1775
|
+
<span class='covered'> expr = parseUnaryExpression();</span>
|
1776
|
+
<span class='covered'> // 11.4.4, 11.4.5</span>
|
1777
|
+
<span class='covered'> if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {</span>
|
1778
|
+
<span class='covered'> throwError({}, Messages.StrictLHSPrefix);</span>
|
1779
|
+
<span class='covered'> }</span>
|
1780
|
+
<span class='covered'> expr = {</span>
|
1781
|
+
<span class='covered'> type: Syntax.UpdateExpression,</span>
|
1782
|
+
<span class='covered'> operator: token.value,</span>
|
1783
|
+
<span class='covered'> argument: expr,</span>
|
1784
|
+
<span class='covered'> prefix: true</span>
|
1785
|
+
<span class='covered'> };</span>
|
1786
|
+
<span class='covered'> return expr;</span>
|
1787
|
+
<span class='covered'> }</span>
|
1788
|
+
<span class='covered'> </span>
|
1789
|
+
<span class='covered'> if (match('+') || match('-') || match('~') || match('!')) {</span>
|
1790
|
+
<span class='covered'> expr = {</span>
|
1791
|
+
<span class='covered'> type: Syntax.UnaryExpression,</span>
|
1792
|
+
<span class='covered'> operator: lex().value,</span>
|
1793
|
+
<span class='covered'> argument: parseUnaryExpression()</span>
|
1794
|
+
<span class='covered'> };</span>
|
1795
|
+
<span class='covered'> return expr;</span>
|
1796
|
+
<span class='covered'> }</span>
|
1797
|
+
<span class='covered'> </span>
|
1798
|
+
<span class='covered'> if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {</span>
|
1799
|
+
<span class='covered'> expr = {</span>
|
1800
|
+
<span class='covered'> type: Syntax.UnaryExpression,</span>
|
1801
|
+
<span class='covered'> operator: lex().value,</span>
|
1802
|
+
<span class='covered'> argument: parseUnaryExpression()</span>
|
1803
|
+
<span class='covered'> };</span>
|
1804
|
+
<span class='covered'> if (strict && expr.operator === 'delete' && expr.argument.type === Syntax.Identifier) {</span>
|
1805
|
+
<span class='covered'> throwError({}, Messages.StrictDelete);</span>
|
1806
|
+
<span class='covered'> }</span>
|
1807
|
+
<span class='covered'> return expr;</span>
|
1808
|
+
<span class='covered'> }</span>
|
1809
|
+
<span class='covered'> </span>
|
1810
|
+
<span class='covered'> return parsePostfixExpression();</span>
|
1811
|
+
<span class='covered'> }</span>
|
1812
|
+
<span class='covered'> </span>
|
1813
|
+
<span class='covered'> // 11.5 Multiplicative Operators</span>
|
1814
|
+
<span class='covered'> </span>
|
1815
|
+
<span class='covered'> function parseMultiplicativeExpression() {</span>
|
1816
|
+
<span class='covered'> var expr = parseUnaryExpression();</span>
|
1817
|
+
<span class='covered'> </span>
|
1818
|
+
<span class='covered'> while (match('*') || match('/') || match('%')) {</span>
|
1819
|
+
<span class='covered'> expr = {</span>
|
1820
|
+
<span class='covered'> type: Syntax.BinaryExpression,</span>
|
1821
|
+
<span class='covered'> operator: lex().value,</span>
|
1822
|
+
<span class='covered'> left: expr,</span>
|
1823
|
+
<span class='covered'> right: parseUnaryExpression()</span>
|
1824
|
+
<span class='covered'> };</span>
|
1825
|
+
<span class='covered'> }</span>
|
1826
|
+
<span class='covered'> </span>
|
1827
|
+
<span class='covered'> return expr;</span>
|
1828
|
+
<span class='covered'> }</span>
|
1829
|
+
<span class='covered'> </span>
|
1830
|
+
<span class='covered'> // 11.6 Additive Operators</span>
|
1831
|
+
<span class='covered'> </span>
|
1832
|
+
<span class='covered'> function parseAdditiveExpression() {</span>
|
1833
|
+
<span class='covered'> var expr = parseMultiplicativeExpression();</span>
|
1834
|
+
<span class='covered'> </span>
|
1835
|
+
<span class='covered'> while (match('+') || match('-')) {</span>
|
1836
|
+
<span class='covered'> expr = {</span>
|
1837
|
+
<span class='covered'> type: Syntax.BinaryExpression,</span>
|
1838
|
+
<span class='covered'> operator: lex().value,</span>
|
1839
|
+
<span class='covered'> left: expr,</span>
|
1840
|
+
<span class='covered'> right: parseMultiplicativeExpression()</span>
|
1841
|
+
<span class='covered'> };</span>
|
1842
|
+
<span class='covered'> }</span>
|
1843
|
+
<span class='covered'> </span>
|
1844
|
+
<span class='covered'> return expr;</span>
|
1845
|
+
<span class='covered'> }</span>
|
1846
|
+
<span class='covered'> </span>
|
1847
|
+
<span class='covered'> // 11.7 Bitwise Shift Operators</span>
|
1848
|
+
<span class='covered'> </span>
|
1849
|
+
<span class='covered'> function parseShiftExpression() {</span>
|
1850
|
+
<span class='covered'> var expr = parseAdditiveExpression();</span>
|
1851
|
+
<span class='covered'> </span>
|
1852
|
+
<span class='covered'> while (match('<<') || match('>>') || match('>>>')) {</span>
|
1853
|
+
<span class='covered'> expr = {</span>
|
1854
|
+
<span class='covered'> type: Syntax.BinaryExpression,</span>
|
1855
|
+
<span class='covered'> operator: lex().value,</span>
|
1856
|
+
<span class='covered'> left: expr,</span>
|
1857
|
+
<span class='covered'> right: parseAdditiveExpression()</span>
|
1858
|
+
<span class='covered'> };</span>
|
1859
|
+
<span class='covered'> }</span>
|
1860
|
+
<span class='covered'> </span>
|
1861
|
+
<span class='covered'> return expr;</span>
|
1862
|
+
<span class='covered'> }</span>
|
1863
|
+
<span class='covered'> // 11.8 Relational Operators</span>
|
1864
|
+
<span class='covered'> </span>
|
1865
|
+
<span class='covered'> function parseRelationalExpression() {</span>
|
1866
|
+
<span class='covered'> var expr, previousAllowIn;</span>
|
1867
|
+
<span class='covered'> </span>
|
1868
|
+
<span class='covered'> previousAllowIn = allowIn;</span>
|
1869
|
+
<span class='covered'> allowIn = true;</span>
|
1870
|
+
<span class='covered'> expr = parseShiftExpression();</span>
|
1871
|
+
<span class='covered'> allowIn = previousAllowIn;</span>
|
1872
|
+
<span class='covered'> </span>
|
1873
|
+
<span class='covered'> if (match('<') || match('>') || match('<=') || match('>=')) {</span>
|
1874
|
+
<span class='covered'> expr = {</span>
|
1875
|
+
<span class='covered'> type: Syntax.BinaryExpression,</span>
|
1876
|
+
<span class='covered'> operator: lex().value,</span>
|
1877
|
+
<span class='covered'> left: expr,</span>
|
1878
|
+
<span class='covered'> right: parseRelationalExpression()</span>
|
1879
|
+
<span class='covered'> };</span>
|
1880
|
+
<span class='covered'> } else if (allowIn && matchKeyword('in')) {</span>
|
1881
|
+
<span class='covered'> lex();</span>
|
1882
|
+
<span class='covered'> expr = {</span>
|
1883
|
+
<span class='covered'> type: Syntax.BinaryExpression,</span>
|
1884
|
+
<span class='covered'> operator: 'in',</span>
|
1885
|
+
<span class='covered'> left: expr,</span>
|
1886
|
+
<span class='covered'> right: parseRelationalExpression()</span>
|
1887
|
+
<span class='covered'> };</span>
|
1888
|
+
<span class='covered'> } else if (matchKeyword('instanceof')) {</span>
|
1889
|
+
<span class='covered'> lex();</span>
|
1890
|
+
<span class='covered'> expr = {</span>
|
1891
|
+
<span class='covered'> type: Syntax.BinaryExpression,</span>
|
1892
|
+
<span class='covered'> operator: 'instanceof',</span>
|
1893
|
+
<span class='covered'> left: expr,</span>
|
1894
|
+
<span class='covered'> right: parseRelationalExpression()</span>
|
1895
|
+
<span class='covered'> };</span>
|
1896
|
+
<span class='covered'> }</span>
|
1897
|
+
<span class='covered'> </span>
|
1898
|
+
<span class='covered'> return expr;</span>
|
1899
|
+
<span class='covered'> }</span>
|
1900
|
+
<span class='covered'> </span>
|
1901
|
+
<span class='covered'> // 11.9 Equality Operators</span>
|
1902
|
+
<span class='covered'> </span>
|
1903
|
+
<span class='covered'> function parseEqualityExpression() {</span>
|
1904
|
+
<span class='covered'> var expr = parseRelationalExpression();</span>
|
1905
|
+
<span class='covered'> </span>
|
1906
|
+
<span class='covered'> while (match('==') || match('!=') || match('===') || match('!==')) {</span>
|
1907
|
+
<span class='covered'> expr = {</span>
|
1908
|
+
<span class='covered'> type: Syntax.BinaryExpression,</span>
|
1909
|
+
<span class='covered'> operator: lex().value,</span>
|
1910
|
+
<span class='covered'> left: expr,</span>
|
1911
|
+
<span class='covered'> right: parseRelationalExpression()</span>
|
1912
|
+
<span class='covered'> };</span>
|
1913
|
+
<span class='covered'> }</span>
|
1914
|
+
<span class='covered'> </span>
|
1915
|
+
<span class='covered'> return expr;</span>
|
1916
|
+
<span class='covered'> }</span>
|
1917
|
+
<span class='covered'> </span>
|
1918
|
+
<span class='covered'> // 11.10 Binary Bitwise Operators</span>
|
1919
|
+
<span class='covered'> </span>
|
1920
|
+
<span class='covered'> function parseBitwiseANDExpression() {</span>
|
1921
|
+
<span class='covered'> var expr = parseEqualityExpression();</span>
|
1922
|
+
<span class='covered'> </span>
|
1923
|
+
<span class='covered'> while (match('&')) {</span>
|
1924
|
+
<span class='covered'> lex();</span>
|
1925
|
+
<span class='covered'> expr = {</span>
|
1926
|
+
<span class='covered'> type: Syntax.BinaryExpression,</span>
|
1927
|
+
<span class='covered'> operator: '&',</span>
|
1928
|
+
<span class='covered'> left: expr,</span>
|
1929
|
+
<span class='covered'> right: parseEqualityExpression()</span>
|
1930
|
+
<span class='covered'> };</span>
|
1931
|
+
<span class='covered'> }</span>
|
1932
|
+
<span class='covered'> </span>
|
1933
|
+
<span class='covered'> return expr;</span>
|
1934
|
+
<span class='covered'> }</span>
|
1935
|
+
<span class='covered'> </span>
|
1936
|
+
<span class='covered'> function parseBitwiseORExpression() {</span>
|
1937
|
+
<span class='covered'> var expr = parseBitwiseANDExpression();</span>
|
1938
|
+
<span class='covered'> </span>
|
1939
|
+
<span class='covered'> while (match('|')) {</span>
|
1940
|
+
<span class='covered'> lex();</span>
|
1941
|
+
<span class='covered'> expr = {</span>
|
1942
|
+
<span class='covered'> type: Syntax.BinaryExpression,</span>
|
1943
|
+
<span class='covered'> operator: '|',</span>
|
1944
|
+
<span class='covered'> left: expr,</span>
|
1945
|
+
<span class='covered'> right: parseBitwiseANDExpression()</span>
|
1946
|
+
<span class='covered'> };</span>
|
1947
|
+
<span class='covered'> }</span>
|
1948
|
+
<span class='covered'> </span>
|
1949
|
+
<span class='covered'> return expr;</span>
|
1950
|
+
<span class='covered'> }</span>
|
1951
|
+
<span class='covered'> </span>
|
1952
|
+
<span class='covered'> function parseBitwiseXORExpression() {</span>
|
1953
|
+
<span class='covered'> var expr = parseBitwiseORExpression();</span>
|
1954
|
+
<span class='covered'> </span>
|
1955
|
+
<span class='covered'> while (match('^')) {</span>
|
1956
|
+
<span class='covered'> lex();</span>
|
1957
|
+
<span class='covered'> expr = {</span>
|
1958
|
+
<span class='covered'> type: Syntax.BinaryExpression,</span>
|
1959
|
+
<span class='covered'> operator: '^',</span>
|
1960
|
+
<span class='covered'> left: expr,</span>
|
1961
|
+
<span class='covered'> right: parseBitwiseORExpression()</span>
|
1962
|
+
<span class='covered'> };</span>
|
1963
|
+
<span class='covered'> }</span>
|
1964
|
+
<span class='covered'> </span>
|
1965
|
+
<span class='covered'> return expr;</span>
|
1966
|
+
<span class='covered'> }</span>
|
1967
|
+
<span class='covered'> </span>
|
1968
|
+
<span class='covered'> // 11.11 Binary Logical Operators</span>
|
1969
|
+
<span class='covered'> </span>
|
1970
|
+
<span class='covered'> function parseLogicalANDExpression() {</span>
|
1971
|
+
<span class='covered'> var expr = parseBitwiseXORExpression();</span>
|
1972
|
+
<span class='covered'> </span>
|
1973
|
+
<span class='covered'> while (match('&&')) {</span>
|
1974
|
+
<span class='covered'> lex();</span>
|
1975
|
+
<span class='covered'> expr = {</span>
|
1976
|
+
<span class='covered'> type: Syntax.LogicalExpression,</span>
|
1977
|
+
<span class='covered'> operator: '&&',</span>
|
1978
|
+
<span class='covered'> left: expr,</span>
|
1979
|
+
<span class='covered'> right: parseBitwiseXORExpression()</span>
|
1980
|
+
<span class='covered'> };</span>
|
1981
|
+
<span class='covered'> }</span>
|
1982
|
+
<span class='covered'> </span>
|
1983
|
+
<span class='covered'> return expr;</span>
|
1984
|
+
<span class='covered'> }</span>
|
1985
|
+
<span class='covered'> </span>
|
1986
|
+
<span class='covered'> function parseLogicalORExpression() {</span>
|
1987
|
+
<span class='covered'> var expr = parseLogicalANDExpression();</span>
|
1988
|
+
<span class='covered'> </span>
|
1989
|
+
<span class='covered'> while (match('||')) {</span>
|
1990
|
+
<span class='covered'> lex();</span>
|
1991
|
+
<span class='covered'> expr = {</span>
|
1992
|
+
<span class='covered'> type: Syntax.LogicalExpression,</span>
|
1993
|
+
<span class='covered'> operator: '||',</span>
|
1994
|
+
<span class='covered'> left: expr,</span>
|
1995
|
+
<span class='covered'> right: parseLogicalANDExpression()</span>
|
1996
|
+
<span class='covered'> };</span>
|
1997
|
+
<span class='covered'> }</span>
|
1998
|
+
<span class='covered'> </span>
|
1999
|
+
<span class='covered'> return expr;</span>
|
2000
|
+
<span class='covered'> }</span>
|
2001
|
+
<span class='covered'> </span>
|
2002
|
+
<span class='covered'> // 11.12 Conditional Operator</span>
|
2003
|
+
<span class='covered'> </span>
|
2004
|
+
<span class='covered'> function parseConditionalExpression() {</span>
|
2005
|
+
<span class='covered'> var expr, previousAllowIn, consequent;</span>
|
2006
|
+
<span class='covered'> </span>
|
2007
|
+
<span class='covered'> expr = parseLogicalORExpression();</span>
|
2008
|
+
<span class='covered'> </span>
|
2009
|
+
<span class='covered'> if (match('?')) {</span>
|
2010
|
+
<span class='covered'> lex();</span>
|
2011
|
+
<span class='covered'> previousAllowIn = allowIn;</span>
|
2012
|
+
<span class='covered'> allowIn = true;</span>
|
2013
|
+
<span class='covered'> consequent = parseAssignmentExpression();</span>
|
2014
|
+
<span class='covered'> allowIn = previousAllowIn;</span>
|
2015
|
+
<span class='covered'> expect(':');</span>
|
2016
|
+
<span class='covered'> </span>
|
2017
|
+
<span class='covered'> expr = {</span>
|
2018
|
+
<span class='covered'> type: Syntax.ConditionalExpression,</span>
|
2019
|
+
<span class='covered'> test: expr,</span>
|
2020
|
+
<span class='covered'> consequent: consequent,</span>
|
2021
|
+
<span class='covered'> alternate: parseAssignmentExpression()</span>
|
2022
|
+
<span class='covered'> };</span>
|
2023
|
+
<span class='covered'> }</span>
|
2024
|
+
<span class='covered'> </span>
|
2025
|
+
<span class='covered'> return expr;</span>
|
2026
|
+
<span class='covered'> }</span>
|
2027
|
+
<span class='covered'> </span>
|
2028
|
+
<span class='covered'> // 11.13 Assignment Operators</span>
|
2029
|
+
<span class='covered'> </span>
|
2030
|
+
<span class='covered'> function parseAssignmentExpression() {</span>
|
2031
|
+
<span class='covered'> var expr;</span>
|
2032
|
+
<span class='covered'> </span>
|
2033
|
+
<span class='covered'> expr = parseConditionalExpression();</span>
|
2034
|
+
<span class='covered'> </span>
|
2035
|
+
<span class='covered'> if (matchAssign()) {</span>
|
2036
|
+
<span class='covered'> // LeftHandSideExpression</span>
|
2037
|
+
<span class='covered'> if (lastParenthesized !== expr && !isLeftHandSide(expr)) {</span>
|
2038
|
+
<span class='covered'> throwError({}, Messages.InvalidLHSInAssignment);</span>
|
2039
|
+
<span class='covered'> }</span>
|
2040
|
+
<span class='covered'> </span>
|
2041
|
+
<span class='covered'> // 11.13.1</span>
|
2042
|
+
<span class='covered'> if (strict && expr.type === Syntax.Identifier && isRestrictedWord(expr.name)) {</span>
|
2043
|
+
<span class='covered'> throwError({}, Messages.StrictLHSAssignment);</span>
|
2044
|
+
<span class='covered'> }</span>
|
2045
|
+
<span class='covered'> </span>
|
2046
|
+
<span class='covered'> expr = {</span>
|
2047
|
+
<span class='covered'> type: Syntax.AssignmentExpression,</span>
|
2048
|
+
<span class='covered'> operator: lex().value,</span>
|
2049
|
+
<span class='covered'> left: expr,</span>
|
2050
|
+
<span class='covered'> right: parseAssignmentExpression()</span>
|
2051
|
+
<span class='covered'> };</span>
|
2052
|
+
<span class='covered'> }</span>
|
2053
|
+
<span class='covered'> </span>
|
2054
|
+
<span class='covered'> return expr;</span>
|
2055
|
+
<span class='covered'> }</span>
|
2056
|
+
<span class='covered'> </span>
|
2057
|
+
<span class='covered'> // 11.14 Comma Operator</span>
|
2058
|
+
<span class='covered'> </span>
|
2059
|
+
<span class='covered'> function parseExpression() {</span>
|
2060
|
+
<span class='covered'> var expr = parseAssignmentExpression();</span>
|
2061
|
+
<span class='covered'> </span>
|
2062
|
+
<span class='covered'> if (match(',')) {</span>
|
2063
|
+
<span class='covered'> expr = {</span>
|
2064
|
+
<span class='covered'> type: Syntax.SequenceExpression,</span>
|
2065
|
+
<span class='covered'> expressions: [ expr ]</span>
|
2066
|
+
<span class='covered'> };</span>
|
2067
|
+
<span class='covered'> </span>
|
2068
|
+
<span class='covered'> while (index < length) {</span>
|
2069
|
+
<span class='covered'> if (!match(',')) {</span>
|
2070
|
+
<span class='covered'> break;</span>
|
2071
|
+
<span class='covered'> }</span>
|
2072
|
+
<span class='covered'> lex();</span>
|
2073
|
+
<span class='covered'> expr.expressions.push(parseAssignmentExpression());</span>
|
2074
|
+
<span class='covered'> }</span>
|
2075
|
+
<span class='covered'> </span>
|
2076
|
+
<span class='covered'> }</span>
|
2077
|
+
<span class='covered'> return expr;</span>
|
2078
|
+
<span class='covered'> }</span>
|
2079
|
+
<span class='covered'> </span>
|
2080
|
+
<span class='covered'> // 12.1 Block</span>
|
2081
|
+
<span class='covered'> </span>
|
2082
|
+
<span class='covered'> function parseStatementList() {</span>
|
2083
|
+
<span class='covered'> var list = [],</span>
|
2084
|
+
<span class='covered'> statement;</span>
|
2085
|
+
<span class='covered'> </span>
|
2086
|
+
<span class='covered'> while (index < length) {</span>
|
2087
|
+
<span class='covered'> if (match('}')) {</span>
|
2088
|
+
<span class='covered'> break;</span>
|
2089
|
+
<span class='covered'> }</span>
|
2090
|
+
<span class='covered'> statement = parseSourceElement();</span>
|
2091
|
+
<span class='covered'> if (typeof statement === 'undefined') {</span>
|
2092
|
+
<span class='covered'> break;</span>
|
2093
|
+
<span class='covered'> }</span>
|
2094
|
+
<span class='covered'> list.push(statement);</span>
|
2095
|
+
<span class='covered'> }</span>
|
2096
|
+
<span class='covered'> </span>
|
2097
|
+
<span class='covered'> return list;</span>
|
2098
|
+
<span class='covered'> }</span>
|
2099
|
+
<span class='covered'> </span>
|
2100
|
+
<span class='covered'> function parseBlock() {</span>
|
2101
|
+
<span class='covered'> var block;</span>
|
2102
|
+
<span class='covered'> </span>
|
2103
|
+
<span class='covered'> expect('{');</span>
|
2104
|
+
<span class='covered'> </span>
|
2105
|
+
<span class='covered'> block = parseStatementList();</span>
|
2106
|
+
<span class='covered'> </span>
|
2107
|
+
<span class='covered'> expect('}');</span>
|
2108
|
+
<span class='covered'> </span>
|
2109
|
+
<span class='covered'> return {</span>
|
2110
|
+
<span class='covered'> type: Syntax.BlockStatement,</span>
|
2111
|
+
<span class='covered'> body: block</span>
|
2112
|
+
<span class='covered'> };</span>
|
2113
|
+
<span class='covered'> }</span>
|
2114
|
+
<span class='covered'> </span>
|
2115
|
+
<span class='covered'> // 12.2 Variable Statement</span>
|
2116
|
+
<span class='covered'> </span>
|
2117
|
+
<span class='covered'> function parseVariableIdentifier() {</span>
|
2118
|
+
<span class='covered'> var token = lex();</span>
|
2119
|
+
<span class='covered'> </span>
|
2120
|
+
<span class='covered'> if (token.type !== Token.Identifier) {</span>
|
2121
|
+
<span class='covered'> throwUnexpected(token);</span>
|
2122
|
+
<span class='covered'> }</span>
|
2123
|
+
<span class='covered'> </span>
|
2124
|
+
<span class='covered'> return {</span>
|
2125
|
+
<span class='covered'> type: Syntax.Identifier,</span>
|
2126
|
+
<span class='covered'> name: token.value</span>
|
2127
|
+
<span class='covered'> };</span>
|
2128
|
+
<span class='covered'> }</span>
|
2129
|
+
<span class='covered'> </span>
|
2130
|
+
<span class='covered'> function parseVariableDeclaration(kind) {</span>
|
2131
|
+
<span class='covered'> var id = parseVariableIdentifier(),</span>
|
2132
|
+
<span class='covered'> init = null;</span>
|
2133
|
+
<span class='covered'> </span>
|
2134
|
+
<span class='covered'> // 12.2.1</span>
|
2135
|
+
<span class='covered'> if (strict && isRestrictedWord(id.name)) {</span>
|
2136
|
+
<span class='covered'> throwError({}, Messages.StrictVarName);</span>
|
2137
|
+
<span class='covered'> }</span>
|
2138
|
+
<span class='covered'> </span>
|
2139
|
+
<span class='covered'> if (kind === 'const') {</span>
|
2140
|
+
<span class='covered'> expect('=');</span>
|
2141
|
+
<span class='covered'> init = parseAssignmentExpression();</span>
|
2142
|
+
<span class='covered'> } else if (match('=')) {</span>
|
2143
|
+
<span class='covered'> lex();</span>
|
2144
|
+
<span class='covered'> init = parseAssignmentExpression();</span>
|
2145
|
+
<span class='covered'> }</span>
|
2146
|
+
<span class='covered'> </span>
|
2147
|
+
<span class='covered'> return {</span>
|
2148
|
+
<span class='covered'> type: Syntax.VariableDeclarator,</span>
|
2149
|
+
<span class='covered'> id: id,</span>
|
2150
|
+
<span class='covered'> init: init</span>
|
2151
|
+
<span class='covered'> };</span>
|
2152
|
+
<span class='covered'> }</span>
|
2153
|
+
<span class='covered'> </span>
|
2154
|
+
<span class='covered'> function parseVariableDeclarationList(kind) {</span>
|
2155
|
+
<span class='covered'> var list = [];</span>
|
2156
|
+
<span class='covered'> </span>
|
2157
|
+
<span class='covered'> while (index < length) {</span>
|
2158
|
+
<span class='covered'> list.push(parseVariableDeclaration(kind));</span>
|
2159
|
+
<span class='covered'> if (!match(',')) {</span>
|
2160
|
+
<span class='covered'> break;</span>
|
2161
|
+
<span class='covered'> }</span>
|
2162
|
+
<span class='covered'> lex();</span>
|
2163
|
+
<span class='covered'> }</span>
|
2164
|
+
<span class='covered'> </span>
|
2165
|
+
<span class='covered'> return list;</span>
|
2166
|
+
<span class='covered'> }</span>
|
2167
|
+
<span class='covered'> </span>
|
2168
|
+
<span class='covered'> function parseVariableStatement() {</span>
|
2169
|
+
<span class='covered'> var declarations;</span>
|
2170
|
+
<span class='covered'> </span>
|
2171
|
+
<span class='covered'> expectKeyword('var');</span>
|
2172
|
+
<span class='covered'> </span>
|
2173
|
+
<span class='covered'> declarations = parseVariableDeclarationList();</span>
|
2174
|
+
<span class='covered'> </span>
|
2175
|
+
<span class='covered'> consumeSemicolon();</span>
|
2176
|
+
<span class='covered'> </span>
|
2177
|
+
<span class='covered'> return {</span>
|
2178
|
+
<span class='covered'> type: Syntax.VariableDeclaration,</span>
|
2179
|
+
<span class='covered'> declarations: declarations,</span>
|
2180
|
+
<span class='covered'> kind: 'var'</span>
|
2181
|
+
<span class='covered'> };</span>
|
2182
|
+
<span class='covered'> }</span>
|
2183
|
+
<span class='covered'> </span>
|
2184
|
+
<span class='covered'> // kind may be `const` or `let`</span>
|
2185
|
+
<span class='covered'> // Both are experimental and not in the specification yet.</span>
|
2186
|
+
<span class='covered'> // see http://wiki.ecmascript.org/doku.php?id=harmony:const</span>
|
2187
|
+
<span class='covered'> // and http://wiki.ecmascript.org/doku.php?id=harmony:let</span>
|
2188
|
+
<span class='covered'> function parseConstLetDeclaration(kind) {</span>
|
2189
|
+
<span class='covered'> var declarations;</span>
|
2190
|
+
<span class='covered'> </span>
|
2191
|
+
<span class='covered'> expectKeyword(kind);</span>
|
2192
|
+
<span class='covered'> </span>
|
2193
|
+
<span class='covered'> declarations = parseVariableDeclarationList(kind);</span>
|
2194
|
+
<span class='covered'> </span>
|
2195
|
+
<span class='covered'> consumeSemicolon();</span>
|
2196
|
+
<span class='covered'> </span>
|
2197
|
+
<span class='covered'> return {</span>
|
2198
|
+
<span class='covered'> type: Syntax.VariableDeclaration,</span>
|
2199
|
+
<span class='covered'> declarations: declarations,</span>
|
2200
|
+
<span class='covered'> kind: kind</span>
|
2201
|
+
<span class='covered'> };</span>
|
2202
|
+
<span class='covered'> }</span>
|
2203
|
+
<span class='covered'> </span>
|
2204
|
+
<span class='covered'> // 12.3 Empty Statement</span>
|
2205
|
+
<span class='covered'> </span>
|
2206
|
+
<span class='covered'> function parseEmptyStatement() {</span>
|
2207
|
+
<span class='covered'> expect(';');</span>
|
2208
|
+
<span class='covered'> </span>
|
2209
|
+
<span class='covered'> return {</span>
|
2210
|
+
<span class='covered'> type: Syntax.EmptyStatement</span>
|
2211
|
+
<span class='covered'> };</span>
|
2212
|
+
<span class='covered'> }</span>
|
2213
|
+
<span class='covered'> </span>
|
2214
|
+
<span class='covered'> // 12.4 Expression Statement</span>
|
2215
|
+
<span class='covered'> </span>
|
2216
|
+
<span class='covered'> function parseExpressionStatement() {</span>
|
2217
|
+
<span class='covered'> var expr = parseExpression();</span>
|
2218
|
+
<span class='covered'> </span>
|
2219
|
+
<span class='covered'> consumeSemicolon();</span>
|
2220
|
+
<span class='covered'> </span>
|
2221
|
+
<span class='covered'> return {</span>
|
2222
|
+
<span class='covered'> type: Syntax.ExpressionStatement,</span>
|
2223
|
+
<span class='covered'> expression: expr</span>
|
2224
|
+
<span class='covered'> };</span>
|
2225
|
+
<span class='covered'> }</span>
|
2226
|
+
<span class='covered'> </span>
|
2227
|
+
<span class='covered'> // 12.5 If statement</span>
|
2228
|
+
<span class='covered'> </span>
|
2229
|
+
<span class='covered'> function parseIfStatement() {</span>
|
2230
|
+
<span class='covered'> var test, consequent, alternate;</span>
|
2231
|
+
<span class='covered'> </span>
|
2232
|
+
<span class='covered'> expectKeyword('if');</span>
|
2233
|
+
<span class='covered'> </span>
|
2234
|
+
<span class='covered'> expect('(');</span>
|
2235
|
+
<span class='covered'> </span>
|
2236
|
+
<span class='covered'> test = parseExpression();</span>
|
2237
|
+
<span class='covered'> </span>
|
2238
|
+
<span class='covered'> expect(')');</span>
|
2239
|
+
<span class='covered'> </span>
|
2240
|
+
<span class='covered'> consequent = parseStatement();</span>
|
2241
|
+
<span class='covered'> </span>
|
2242
|
+
<span class='covered'> if (matchKeyword('else')) {</span>
|
2243
|
+
<span class='covered'> lex();</span>
|
2244
|
+
<span class='covered'> alternate = parseStatement();</span>
|
2245
|
+
<span class='covered'> } else {</span>
|
2246
|
+
<span class='covered'> alternate = null;</span>
|
2247
|
+
<span class='covered'> }</span>
|
2248
|
+
<span class='covered'> </span>
|
2249
|
+
<span class='covered'> return {</span>
|
2250
|
+
<span class='covered'> type: Syntax.IfStatement,</span>
|
2251
|
+
<span class='covered'> test: test,</span>
|
2252
|
+
<span class='covered'> consequent: consequent,</span>
|
2253
|
+
<span class='covered'> alternate: alternate</span>
|
2254
|
+
<span class='covered'> };</span>
|
2255
|
+
<span class='covered'> }</span>
|
2256
|
+
<span class='covered'> </span>
|
2257
|
+
<span class='covered'> // 12.6 Iteration Statements</span>
|
2258
|
+
<span class='covered'> </span>
|
2259
|
+
<span class='covered'> function parseDoWhileStatement() {</span>
|
2260
|
+
<span class='covered'> var body, test, oldInIteration;</span>
|
2261
|
+
<span class='covered'> </span>
|
2262
|
+
<span class='covered'> expectKeyword('do');</span>
|
2263
|
+
<span class='covered'> </span>
|
2264
|
+
<span class='covered'> oldInIteration = inIteration;</span>
|
2265
|
+
<span class='covered'> inIteration = true;</span>
|
2266
|
+
<span class='covered'> </span>
|
2267
|
+
<span class='covered'> body = parseStatement();</span>
|
2268
|
+
<span class='covered'> </span>
|
2269
|
+
<span class='covered'> inIteration = oldInIteration;</span>
|
2270
|
+
<span class='covered'> </span>
|
2271
|
+
<span class='covered'> expectKeyword('while');</span>
|
2272
|
+
<span class='covered'> </span>
|
2273
|
+
<span class='covered'> expect('(');</span>
|
2274
|
+
<span class='covered'> </span>
|
2275
|
+
<span class='covered'> test = parseExpression();</span>
|
2276
|
+
<span class='covered'> </span>
|
2277
|
+
<span class='covered'> expect(')');</span>
|
2278
|
+
<span class='covered'> </span>
|
2279
|
+
<span class='covered'> if (match(';')) {</span>
|
2280
|
+
<span class='covered'> lex();</span>
|
2281
|
+
<span class='covered'> }</span>
|
2282
|
+
<span class='covered'> </span>
|
2283
|
+
<span class='covered'> return {</span>
|
2284
|
+
<span class='covered'> type: Syntax.DoWhileStatement,</span>
|
2285
|
+
<span class='covered'> body: body,</span>
|
2286
|
+
<span class='covered'> test: test</span>
|
2287
|
+
<span class='covered'> };</span>
|
2288
|
+
<span class='covered'> }</span>
|
2289
|
+
<span class='covered'> </span>
|
2290
|
+
<span class='covered'> function parseWhileStatement() {</span>
|
2291
|
+
<span class='covered'> var test, body, oldInIteration;</span>
|
2292
|
+
<span class='covered'> </span>
|
2293
|
+
<span class='covered'> expectKeyword('while');</span>
|
2294
|
+
<span class='covered'> </span>
|
2295
|
+
<span class='covered'> expect('(');</span>
|
2296
|
+
<span class='covered'> </span>
|
2297
|
+
<span class='covered'> test = parseExpression();</span>
|
2298
|
+
<span class='covered'> </span>
|
2299
|
+
<span class='covered'> expect(')');</span>
|
2300
|
+
<span class='covered'> </span>
|
2301
|
+
<span class='covered'> oldInIteration = inIteration;</span>
|
2302
|
+
<span class='covered'> inIteration = true;</span>
|
2303
|
+
<span class='covered'> </span>
|
2304
|
+
<span class='covered'> body = parseStatement();</span>
|
2305
|
+
<span class='covered'> </span>
|
2306
|
+
<span class='covered'> inIteration = oldInIteration;</span>
|
2307
|
+
<span class='covered'> </span>
|
2308
|
+
<span class='covered'> return {</span>
|
2309
|
+
<span class='covered'> type: Syntax.WhileStatement,</span>
|
2310
|
+
<span class='covered'> test: test,</span>
|
2311
|
+
<span class='covered'> body: body</span>
|
2312
|
+
<span class='covered'> };</span>
|
2313
|
+
<span class='covered'> }</span>
|
2314
|
+
<span class='covered'> </span>
|
2315
|
+
<span class='covered'> function parseForVariableDeclaration() {</span>
|
2316
|
+
<span class='covered'> var token = lex();</span>
|
2317
|
+
<span class='covered'> </span>
|
2318
|
+
<span class='covered'> return {</span>
|
2319
|
+
<span class='covered'> type: Syntax.VariableDeclaration,</span>
|
2320
|
+
<span class='covered'> declarations: parseVariableDeclarationList(),</span>
|
2321
|
+
<span class='covered'> kind: token.value</span>
|
2322
|
+
<span class='covered'> };</span>
|
2323
|
+
<span class='covered'> }</span>
|
2324
|
+
<span class='covered'> </span>
|
2325
|
+
<span class='covered'> function parseForStatement() {</span>
|
2326
|
+
<span class='covered'> var init, test, update, left, right, body, oldInIteration;</span>
|
2327
|
+
<span class='covered'> </span>
|
2328
|
+
<span class='covered'> init = test = update = null;</span>
|
2329
|
+
<span class='covered'> </span>
|
2330
|
+
<span class='covered'> expectKeyword('for');</span>
|
2331
|
+
<span class='covered'> </span>
|
2332
|
+
<span class='covered'> expect('(');</span>
|
2333
|
+
<span class='covered'> </span>
|
2334
|
+
<span class='covered'> if (match(';')) {</span>
|
2335
|
+
<span class='covered'> lex();</span>
|
2336
|
+
<span class='covered'> } else {</span>
|
2337
|
+
<span class='covered'> if (matchKeyword('var') || matchKeyword('let')) {</span>
|
2338
|
+
<span class='covered'> allowIn = false;</span>
|
2339
|
+
<span class='covered'> init = parseForVariableDeclaration();</span>
|
2340
|
+
<span class='covered'> allowIn = true;</span>
|
2341
|
+
<span class='covered'> </span>
|
2342
|
+
<span class='covered'> if (init.declarations.length === 1 && matchKeyword('in')) {</span>
|
2343
|
+
<span class='covered'> lex();</span>
|
2344
|
+
<span class='covered'> left = init;</span>
|
2345
|
+
<span class='covered'> right = parseExpression();</span>
|
2346
|
+
<span class='covered'> init = null;</span>
|
2347
|
+
<span class='covered'> }</span>
|
2348
|
+
<span class='covered'> } else {</span>
|
2349
|
+
<span class='covered'> allowIn = false;</span>
|
2350
|
+
<span class='covered'> init = parseExpression();</span>
|
2351
|
+
<span class='covered'> allowIn = true;</span>
|
2352
|
+
<span class='covered'> </span>
|
2353
|
+
<span class='covered'> if (matchKeyword('in')) {</span>
|
2354
|
+
<span class='covered'> // LeftHandSideExpression</span>
|
2355
|
+
<span class='covered'> if (matchKeyword('in') && (lastParenthesized !== init && !isLeftHandSide(init))) {</span>
|
2356
|
+
<span class='covered'> throwError({}, Messages.InvalidLHSInForIn);</span>
|
2357
|
+
<span class='covered'> }</span>
|
2358
|
+
<span class='covered'> lex();</span>
|
2359
|
+
<span class='covered'> left = init;</span>
|
2360
|
+
<span class='covered'> right = parseExpression();</span>
|
2361
|
+
<span class='covered'> init = null;</span>
|
2362
|
+
<span class='covered'> }</span>
|
2363
|
+
<span class='covered'> }</span>
|
2364
|
+
<span class='covered'> </span>
|
2365
|
+
<span class='covered'> if (typeof left === 'undefined') {</span>
|
2366
|
+
<span class='covered'> expect(';');</span>
|
2367
|
+
<span class='covered'> }</span>
|
2368
|
+
<span class='covered'> }</span>
|
2369
|
+
<span class='covered'> </span>
|
2370
|
+
<span class='covered'> if (typeof left === 'undefined') {</span>
|
2371
|
+
<span class='covered'> </span>
|
2372
|
+
<span class='covered'> if (!match(';')) {</span>
|
2373
|
+
<span class='covered'> test = parseExpression();</span>
|
2374
|
+
<span class='covered'> }</span>
|
2375
|
+
<span class='covered'> expect(';');</span>
|
2376
|
+
<span class='covered'> </span>
|
2377
|
+
<span class='covered'> if (!match(')')) {</span>
|
2378
|
+
<span class='covered'> update = parseExpression();</span>
|
2379
|
+
<span class='covered'> }</span>
|
2380
|
+
<span class='covered'> }</span>
|
2381
|
+
<span class='covered'> </span>
|
2382
|
+
<span class='covered'> expect(')');</span>
|
2383
|
+
<span class='covered'> </span>
|
2384
|
+
<span class='covered'> oldInIteration = inIteration;</span>
|
2385
|
+
<span class='covered'> inIteration = true;</span>
|
2386
|
+
<span class='covered'> </span>
|
2387
|
+
<span class='covered'> body = parseStatement();</span>
|
2388
|
+
<span class='covered'> </span>
|
2389
|
+
<span class='covered'> inIteration = oldInIteration;</span>
|
2390
|
+
<span class='covered'> </span>
|
2391
|
+
<span class='covered'> if (typeof left === 'undefined') {</span>
|
2392
|
+
<span class='covered'> return {</span>
|
2393
|
+
<span class='covered'> type: Syntax.ForStatement,</span>
|
2394
|
+
<span class='covered'> init: init,</span>
|
2395
|
+
<span class='covered'> test: test,</span>
|
2396
|
+
<span class='covered'> update: update,</span>
|
2397
|
+
<span class='covered'> body: body</span>
|
2398
|
+
<span class='covered'> };</span>
|
2399
|
+
<span class='covered'> }</span>
|
2400
|
+
<span class='covered'> </span>
|
2401
|
+
<span class='covered'> return {</span>
|
2402
|
+
<span class='covered'> type: Syntax.ForInStatement,</span>
|
2403
|
+
<span class='covered'> left: left,</span>
|
2404
|
+
<span class='covered'> right: right,</span>
|
2405
|
+
<span class='covered'> body: body,</span>
|
2406
|
+
<span class='covered'> each: false</span>
|
2407
|
+
<span class='covered'> };</span>
|
2408
|
+
<span class='covered'> }</span>
|
2409
|
+
<span class='covered'> </span>
|
2410
|
+
<span class='covered'> // 12.7 The continue statement</span>
|
2411
|
+
<span class='covered'> </span>
|
2412
|
+
<span class='covered'> function parseContinueStatement() {</span>
|
2413
|
+
<span class='covered'> var token, label = null;</span>
|
2414
|
+
<span class='covered'> </span>
|
2415
|
+
<span class='covered'> expectKeyword('continue');</span>
|
2416
|
+
<span class='covered'> </span>
|
2417
|
+
<span class='covered'> // Optimize the most common form: 'continue;'.</span>
|
2418
|
+
<span class='covered'> if (source[index] === ';') {</span>
|
2419
|
+
<span class='covered'> lex();</span>
|
2420
|
+
<span class='covered'> </span>
|
2421
|
+
<span class='covered'> if (!inIteration) {</span>
|
2422
|
+
<span class='covered'> throwError({}, Messages.IllegalContinue);</span>
|
2423
|
+
<span class='covered'> }</span>
|
2424
|
+
<span class='covered'> </span>
|
2425
|
+
<span class='covered'> return {</span>
|
2426
|
+
<span class='covered'> type: Syntax.ContinueStatement,</span>
|
2427
|
+
<span class='covered'> label: null</span>
|
2428
|
+
<span class='covered'> };</span>
|
2429
|
+
<span class='covered'> }</span>
|
2430
|
+
<span class='covered'> </span>
|
2431
|
+
<span class='covered'> if (peekLineTerminator()) {</span>
|
2432
|
+
<span class='covered'> if (!inIteration) {</span>
|
2433
|
+
<span class='covered'> throwError({}, Messages.IllegalContinue);</span>
|
2434
|
+
<span class='covered'> }</span>
|
2435
|
+
<span class='covered'> </span>
|
2436
|
+
<span class='covered'> return {</span>
|
2437
|
+
<span class='covered'> type: Syntax.ContinueStatement,</span>
|
2438
|
+
<span class='covered'> label: null</span>
|
2439
|
+
<span class='covered'> };</span>
|
2440
|
+
<span class='covered'> }</span>
|
2441
|
+
<span class='covered'> </span>
|
2442
|
+
<span class='covered'> token = lookahead();</span>
|
2443
|
+
<span class='covered'> if (token.type === Token.Identifier) {</span>
|
2444
|
+
<span class='covered'> label = parseVariableIdentifier();</span>
|
2445
|
+
<span class='covered'> </span>
|
2446
|
+
<span class='covered'> if (!Object.prototype.hasOwnProperty.call(labelSet, label.name)) {</span>
|
2447
|
+
<span class='covered'> throwError({}, Messages.UnknownLabel, label.name);</span>
|
2448
|
+
<span class='covered'> }</span>
|
2449
|
+
<span class='covered'> }</span>
|
2450
|
+
<span class='covered'> </span>
|
2451
|
+
<span class='covered'> consumeSemicolon();</span>
|
2452
|
+
<span class='covered'> </span>
|
2453
|
+
<span class='covered'> if (label === null && !inIteration) {</span>
|
2454
|
+
<span class='covered'> throwError({}, Messages.IllegalContinue);</span>
|
2455
|
+
<span class='covered'> }</span>
|
2456
|
+
<span class='covered'> </span>
|
2457
|
+
<span class='covered'> return {</span>
|
2458
|
+
<span class='covered'> type: Syntax.ContinueStatement,</span>
|
2459
|
+
<span class='covered'> label: label</span>
|
2460
|
+
<span class='covered'> };</span>
|
2461
|
+
<span class='covered'> }</span>
|
2462
|
+
<span class='covered'> </span>
|
2463
|
+
<span class='covered'> // 12.8 The break statement</span>
|
2464
|
+
<span class='covered'> </span>
|
2465
|
+
<span class='covered'> function parseBreakStatement() {</span>
|
2466
|
+
<span class='covered'> var token, label = null;</span>
|
2467
|
+
<span class='covered'> </span>
|
2468
|
+
<span class='covered'> expectKeyword('break');</span>
|
2469
|
+
<span class='covered'> </span>
|
2470
|
+
<span class='covered'> // Optimize the most common form: 'break;'.</span>
|
2471
|
+
<span class='covered'> if (source[index] === ';') {</span>
|
2472
|
+
<span class='covered'> lex();</span>
|
2473
|
+
<span class='covered'> </span>
|
2474
|
+
<span class='covered'> if (!(inIteration || inSwitch)) {</span>
|
2475
|
+
<span class='covered'> throwError({}, Messages.IllegalBreak);</span>
|
2476
|
+
<span class='covered'> }</span>
|
2477
|
+
<span class='covered'> </span>
|
2478
|
+
<span class='covered'> return {</span>
|
2479
|
+
<span class='covered'> type: Syntax.BreakStatement,</span>
|
2480
|
+
<span class='covered'> label: null</span>
|
2481
|
+
<span class='covered'> };</span>
|
2482
|
+
<span class='covered'> }</span>
|
2483
|
+
<span class='covered'> </span>
|
2484
|
+
<span class='covered'> if (peekLineTerminator()) {</span>
|
2485
|
+
<span class='covered'> if (!(inIteration || inSwitch)) {</span>
|
2486
|
+
<span class='covered'> throwError({}, Messages.IllegalBreak);</span>
|
2487
|
+
<span class='covered'> }</span>
|
2488
|
+
<span class='covered'> </span>
|
2489
|
+
<span class='covered'> return {</span>
|
2490
|
+
<span class='covered'> type: Syntax.BreakStatement,</span>
|
2491
|
+
<span class='covered'> label: null</span>
|
2492
|
+
<span class='covered'> };</span>
|
2493
|
+
<span class='covered'> }</span>
|
2494
|
+
<span class='covered'> </span>
|
2495
|
+
<span class='covered'> token = lookahead();</span>
|
2496
|
+
<span class='covered'> if (token.type === Token.Identifier) {</span>
|
2497
|
+
<span class='covered'> label = parseVariableIdentifier();</span>
|
2498
|
+
<span class='covered'> </span>
|
2499
|
+
<span class='covered'> if (!Object.prototype.hasOwnProperty.call(labelSet, label.name)) {</span>
|
2500
|
+
<span class='covered'> throwError({}, Messages.UnknownLabel, label.name);</span>
|
2501
|
+
<span class='covered'> }</span>
|
2502
|
+
<span class='covered'> }</span>
|
2503
|
+
<span class='covered'> </span>
|
2504
|
+
<span class='covered'> consumeSemicolon();</span>
|
2505
|
+
<span class='covered'> </span>
|
2506
|
+
<span class='covered'> if (label === null && !(inIteration || inSwitch)) {</span>
|
2507
|
+
<span class='covered'> throwError({}, Messages.IllegalBreak);</span>
|
2508
|
+
<span class='covered'> }</span>
|
2509
|
+
<span class='covered'> </span>
|
2510
|
+
<span class='covered'> return {</span>
|
2511
|
+
<span class='covered'> type: Syntax.BreakStatement,</span>
|
2512
|
+
<span class='covered'> label: label</span>
|
2513
|
+
<span class='covered'> };</span>
|
2514
|
+
<span class='covered'> }</span>
|
2515
|
+
<span class='covered'> </span>
|
2516
|
+
<span class='covered'> // 12.9 The return statement</span>
|
2517
|
+
<span class='covered'> </span>
|
2518
|
+
<span class='covered'> function parseReturnStatement() {</span>
|
2519
|
+
<span class='covered'> var token, argument = null;</span>
|
2520
|
+
<span class='covered'> </span>
|
2521
|
+
<span class='covered'> expectKeyword('return');</span>
|
2522
|
+
<span class='covered'> </span>
|
2523
|
+
<span class='covered'> if (!inFunctionBody) {</span>
|
2524
|
+
<span class='covered'> throwErrorTolerant({}, Messages.IllegalReturn);</span>
|
2525
|
+
<span class='covered'> }</span>
|
2526
|
+
<span class='covered'> </span>
|
2527
|
+
<span class='covered'> // 'return' followed by a space and an identifier is very common.</span>
|
2528
|
+
<span class='covered'> if (source[index] === ' ') {</span>
|
2529
|
+
<span class='covered'> if (isIdentifierStart(source[index + 1])) {</span>
|
2530
|
+
<span class='covered'> argument = parseExpression();</span>
|
2531
|
+
<span class='covered'> consumeSemicolon();</span>
|
2532
|
+
<span class='covered'> return {</span>
|
2533
|
+
<span class='covered'> type: Syntax.ReturnStatement,</span>
|
2534
|
+
<span class='covered'> argument: argument</span>
|
2535
|
+
<span class='covered'> };</span>
|
2536
|
+
<span class='covered'> }</span>
|
2537
|
+
<span class='covered'> }</span>
|
2538
|
+
<span class='covered'> </span>
|
2539
|
+
<span class='covered'> if (peekLineTerminator()) {</span>
|
2540
|
+
<span class='covered'> return {</span>
|
2541
|
+
<span class='covered'> type: Syntax.ReturnStatement,</span>
|
2542
|
+
<span class='covered'> argument: null</span>
|
2543
|
+
<span class='covered'> };</span>
|
2544
|
+
<span class='covered'> }</span>
|
2545
|
+
<span class='covered'> </span>
|
2546
|
+
<span class='covered'> if (!match(';')) {</span>
|
2547
|
+
<span class='covered'> token = lookahead();</span>
|
2548
|
+
<span class='covered'> if (!match('}') && token.type !== Token.EOF) {</span>
|
2549
|
+
<span class='covered'> argument = parseExpression();</span>
|
2550
|
+
<span class='covered'> }</span>
|
2551
|
+
<span class='covered'> }</span>
|
2552
|
+
<span class='covered'> </span>
|
2553
|
+
<span class='covered'> consumeSemicolon();</span>
|
2554
|
+
<span class='covered'> </span>
|
2555
|
+
<span class='covered'> return {</span>
|
2556
|
+
<span class='covered'> type: Syntax.ReturnStatement,</span>
|
2557
|
+
<span class='covered'> argument: argument</span>
|
2558
|
+
<span class='covered'> };</span>
|
2559
|
+
<span class='covered'> }</span>
|
2560
|
+
<span class='covered'> </span>
|
2561
|
+
<span class='covered'> // 12.10 The with statement</span>
|
2562
|
+
<span class='covered'> </span>
|
2563
|
+
<span class='covered'> function parseWithStatement() {</span>
|
2564
|
+
<span class='covered'> var object, body;</span>
|
2565
|
+
<span class='covered'> </span>
|
2566
|
+
<span class='covered'> if (strict) {</span>
|
2567
|
+
<span class='covered'> throwErrorTolerant({}, Messages.StrictModeWith);</span>
|
2568
|
+
<span class='covered'> }</span>
|
2569
|
+
<span class='covered'> </span>
|
2570
|
+
<span class='covered'> expectKeyword('with');</span>
|
2571
|
+
<span class='covered'> </span>
|
2572
|
+
<span class='covered'> expect('(');</span>
|
2573
|
+
<span class='covered'> </span>
|
2574
|
+
<span class='covered'> object = parseExpression();</span>
|
2575
|
+
<span class='covered'> </span>
|
2576
|
+
<span class='covered'> expect(')');</span>
|
2577
|
+
<span class='covered'> </span>
|
2578
|
+
<span class='covered'> body = parseStatement();</span>
|
2579
|
+
<span class='covered'> </span>
|
2580
|
+
<span class='covered'> return {</span>
|
2581
|
+
<span class='covered'> type: Syntax.WithStatement,</span>
|
2582
|
+
<span class='covered'> object: object,</span>
|
2583
|
+
<span class='covered'> body: body</span>
|
2584
|
+
<span class='covered'> };</span>
|
2585
|
+
<span class='covered'> }</span>
|
2586
|
+
<span class='covered'> </span>
|
2587
|
+
<span class='covered'> // 12.10 The swith statement</span>
|
2588
|
+
<span class='covered'> </span>
|
2589
|
+
<span class='covered'> function parseSwitchCase(test) {</span>
|
2590
|
+
<span class='covered'> var consequent = [],</span>
|
2591
|
+
<span class='covered'> statement;</span>
|
2592
|
+
<span class='covered'> </span>
|
2593
|
+
<span class='covered'> while (index < length) {</span>
|
2594
|
+
<span class='covered'> if (match('}') || matchKeyword('default') || matchKeyword('case')) {</span>
|
2595
|
+
<span class='covered'> break;</span>
|
2596
|
+
<span class='covered'> }</span>
|
2597
|
+
<span class='covered'> statement = parseStatement();</span>
|
2598
|
+
<span class='covered'> if (typeof statement === 'undefined') {</span>
|
2599
|
+
<span class='covered'> break;</span>
|
2600
|
+
<span class='covered'> }</span>
|
2601
|
+
<span class='covered'> consequent.push(statement);</span>
|
2602
|
+
<span class='covered'> }</span>
|
2603
|
+
<span class='covered'> </span>
|
2604
|
+
<span class='covered'> return {</span>
|
2605
|
+
<span class='covered'> type: Syntax.SwitchCase,</span>
|
2606
|
+
<span class='covered'> test: test,</span>
|
2607
|
+
<span class='covered'> consequent: consequent</span>
|
2608
|
+
<span class='covered'> };</span>
|
2609
|
+
<span class='covered'> }</span>
|
2610
|
+
<span class='covered'> </span>
|
2611
|
+
<span class='covered'> function parseSwitchStatement() {</span>
|
2612
|
+
<span class='covered'> var discriminant, cases, test, oldInSwitch;</span>
|
2613
|
+
<span class='covered'> </span>
|
2614
|
+
<span class='covered'> expectKeyword('switch');</span>
|
2615
|
+
<span class='covered'> </span>
|
2616
|
+
<span class='covered'> expect('(');</span>
|
2617
|
+
<span class='covered'> </span>
|
2618
|
+
<span class='covered'> discriminant = parseExpression();</span>
|
2619
|
+
<span class='covered'> </span>
|
2620
|
+
<span class='covered'> expect(')');</span>
|
2621
|
+
<span class='covered'> </span>
|
2622
|
+
<span class='covered'> expect('{');</span>
|
2623
|
+
<span class='covered'> </span>
|
2624
|
+
<span class='covered'> if (match('}')) {</span>
|
2625
|
+
<span class='covered'> lex();</span>
|
2626
|
+
<span class='covered'> return {</span>
|
2627
|
+
<span class='covered'> type: Syntax.SwitchStatement,</span>
|
2628
|
+
<span class='covered'> discriminant: discriminant</span>
|
2629
|
+
<span class='covered'> };</span>
|
2630
|
+
<span class='covered'> }</span>
|
2631
|
+
<span class='covered'> </span>
|
2632
|
+
<span class='covered'> cases = [];</span>
|
2633
|
+
<span class='covered'> </span>
|
2634
|
+
<span class='covered'> oldInSwitch = inSwitch;</span>
|
2635
|
+
<span class='covered'> inSwitch = true;</span>
|
2636
|
+
<span class='covered'> </span>
|
2637
|
+
<span class='covered'> while (index < length) {</span>
|
2638
|
+
<span class='covered'> if (match('}')) {</span>
|
2639
|
+
<span class='covered'> break;</span>
|
2640
|
+
<span class='covered'> }</span>
|
2641
|
+
<span class='covered'> </span>
|
2642
|
+
<span class='covered'> if (matchKeyword('default')) {</span>
|
2643
|
+
<span class='covered'> lex();</span>
|
2644
|
+
<span class='covered'> test = null;</span>
|
2645
|
+
<span class='covered'> } else {</span>
|
2646
|
+
<span class='covered'> expectKeyword('case');</span>
|
2647
|
+
<span class='covered'> test = parseExpression();</span>
|
2648
|
+
<span class='covered'> }</span>
|
2649
|
+
<span class='covered'> expect(':');</span>
|
2650
|
+
<span class='covered'> </span>
|
2651
|
+
<span class='covered'> cases.push(parseSwitchCase(test));</span>
|
2652
|
+
<span class='covered'> }</span>
|
2653
|
+
<span class='covered'> </span>
|
2654
|
+
<span class='covered'> inSwitch = oldInSwitch;</span>
|
2655
|
+
<span class='covered'> </span>
|
2656
|
+
<span class='covered'> expect('}');</span>
|
2657
|
+
<span class='covered'> </span>
|
2658
|
+
<span class='covered'> return {</span>
|
2659
|
+
<span class='covered'> type: Syntax.SwitchStatement,</span>
|
2660
|
+
<span class='covered'> discriminant: discriminant,</span>
|
2661
|
+
<span class='covered'> cases: cases</span>
|
2662
|
+
<span class='covered'> };</span>
|
2663
|
+
<span class='covered'> }</span>
|
2664
|
+
<span class='covered'> </span>
|
2665
|
+
<span class='covered'> // 12.13 The throw statement</span>
|
2666
|
+
<span class='covered'> </span>
|
2667
|
+
<span class='covered'> function parseThrowStatement() {</span>
|
2668
|
+
<span class='covered'> var argument;</span>
|
2669
|
+
<span class='covered'> </span>
|
2670
|
+
<span class='covered'> expectKeyword('throw');</span>
|
2671
|
+
<span class='covered'> </span>
|
2672
|
+
<span class='covered'> if (peekLineTerminator()) {</span>
|
2673
|
+
<span class='covered'> throwError({}, Messages.NewlineAfterThrow);</span>
|
2674
|
+
<span class='covered'> }</span>
|
2675
|
+
<span class='covered'> </span>
|
2676
|
+
<span class='covered'> argument = parseExpression();</span>
|
2677
|
+
<span class='covered'> </span>
|
2678
|
+
<span class='covered'> consumeSemicolon();</span>
|
2679
|
+
<span class='covered'> </span>
|
2680
|
+
<span class='covered'> return {</span>
|
2681
|
+
<span class='covered'> type: Syntax.ThrowStatement,</span>
|
2682
|
+
<span class='covered'> argument: argument</span>
|
2683
|
+
<span class='covered'> };</span>
|
2684
|
+
<span class='covered'> }</span>
|
2685
|
+
<span class='covered'> </span>
|
2686
|
+
<span class='covered'> // 12.14 The try statement</span>
|
2687
|
+
<span class='covered'> </span>
|
2688
|
+
<span class='covered'> function parseCatchClause() {</span>
|
2689
|
+
<span class='covered'> var param;</span>
|
2690
|
+
<span class='covered'> </span>
|
2691
|
+
<span class='covered'> expectKeyword('catch');</span>
|
2692
|
+
<span class='covered'> </span>
|
2693
|
+
<span class='covered'> expect('(');</span>
|
2694
|
+
<span class='covered'> if (!match(')')) {</span>
|
2695
|
+
<span class='covered'> param = parseExpression();</span>
|
2696
|
+
<span class='covered'> // 12.14.1</span>
|
2697
|
+
<span class='covered'> if (strict && param.type === Syntax.Identifier && isRestrictedWord(param.name)) {</span>
|
2698
|
+
<span class='covered'> throwError({}, Messages.StrictCatchVariable);</span>
|
2699
|
+
<span class='covered'> }</span>
|
2700
|
+
<span class='covered'> }</span>
|
2701
|
+
<span class='covered'> expect(')');</span>
|
2702
|
+
<span class='covered'> </span>
|
2703
|
+
<span class='covered'> return {</span>
|
2704
|
+
<span class='covered'> type: Syntax.CatchClause,</span>
|
2705
|
+
<span class='covered'> param: param,</span>
|
2706
|
+
<span class='covered'> guard: null,</span>
|
2707
|
+
<span class='covered'> body: parseBlock()</span>
|
2708
|
+
<span class='covered'> };</span>
|
2709
|
+
<span class='covered'> }</span>
|
2710
|
+
<span class='covered'> </span>
|
2711
|
+
<span class='covered'> function parseTryStatement() {</span>
|
2712
|
+
<span class='covered'> var block, handlers = [], finalizer = null;</span>
|
2713
|
+
<span class='covered'> </span>
|
2714
|
+
<span class='covered'> expectKeyword('try');</span>
|
2715
|
+
<span class='covered'> </span>
|
2716
|
+
<span class='covered'> block = parseBlock();</span>
|
2717
|
+
<span class='covered'> </span>
|
2718
|
+
<span class='covered'> if (matchKeyword('catch')) {</span>
|
2719
|
+
<span class='covered'> handlers.push(parseCatchClause());</span>
|
2720
|
+
<span class='covered'> }</span>
|
2721
|
+
<span class='covered'> </span>
|
2722
|
+
<span class='covered'> if (matchKeyword('finally')) {</span>
|
2723
|
+
<span class='covered'> lex();</span>
|
2724
|
+
<span class='covered'> finalizer = parseBlock();</span>
|
2725
|
+
<span class='covered'> }</span>
|
2726
|
+
<span class='covered'> </span>
|
2727
|
+
<span class='covered'> if (handlers.length === 0 && !finalizer) {</span>
|
2728
|
+
<span class='covered'> throwError({}, Messages.NoCatchOrFinally);</span>
|
2729
|
+
<span class='covered'> }</span>
|
2730
|
+
<span class='covered'> </span>
|
2731
|
+
<span class='covered'> return {</span>
|
2732
|
+
<span class='covered'> type: Syntax.TryStatement,</span>
|
2733
|
+
<span class='covered'> block: block,</span>
|
2734
|
+
<span class='covered'> handlers: handlers,</span>
|
2735
|
+
<span class='covered'> finalizer: finalizer</span>
|
2736
|
+
<span class='covered'> };</span>
|
2737
|
+
<span class='covered'> }</span>
|
2738
|
+
<span class='covered'> </span>
|
2739
|
+
<span class='covered'> // 12.15 The debugger statement</span>
|
2740
|
+
<span class='covered'> </span>
|
2741
|
+
<span class='covered'> function parseDebuggerStatement() {</span>
|
2742
|
+
<span class='covered'> expectKeyword('debugger');</span>
|
2743
|
+
<span class='covered'> </span>
|
2744
|
+
<span class='covered'> consumeSemicolon();</span>
|
2745
|
+
<span class='covered'> </span>
|
2746
|
+
<span class='covered'> return {</span>
|
2747
|
+
<span class='covered'> type: Syntax.DebuggerStatement</span>
|
2748
|
+
<span class='covered'> };</span>
|
2749
|
+
<span class='covered'> }</span>
|
2750
|
+
<span class='covered'> </span>
|
2751
|
+
<span class='covered'> // 12 Statements</span>
|
2752
|
+
<span class='covered'> </span>
|
2753
|
+
<span class='covered'> function parseStatement() {</span>
|
2754
|
+
<span class='covered'> var token = lookahead(),</span>
|
2755
|
+
<span class='covered'> expr,</span>
|
2756
|
+
<span class='covered'> labeledBody;</span>
|
2757
|
+
<span class='covered'> </span>
|
2758
|
+
<span class='covered'> if (token.type === Token.EOF) {</span>
|
2759
|
+
<span class='covered'> throwUnexpected(token);</span>
|
2760
|
+
<span class='covered'> }</span>
|
2761
|
+
<span class='covered'> </span>
|
2762
|
+
<span class='covered'> if (token.type === Token.Punctuator) {</span>
|
2763
|
+
<span class='covered'> switch (token.value) {</span>
|
2764
|
+
<span class='covered'> case ';':</span>
|
2765
|
+
<span class='covered'> return parseEmptyStatement();</span>
|
2766
|
+
<span class='covered'> case '{':</span>
|
2767
|
+
<span class='covered'> return parseBlock();</span>
|
2768
|
+
<span class='covered'> case '(':</span>
|
2769
|
+
<span class='covered'> return parseExpressionStatement();</span>
|
2770
|
+
<span class='covered'> default:</span>
|
2771
|
+
<span class='covered'> break;</span>
|
2772
|
+
<span class='covered'> }</span>
|
2773
|
+
<span class='covered'> }</span>
|
2774
|
+
<span class='covered'> </span>
|
2775
|
+
<span class='covered'> if (token.type === Token.Keyword) {</span>
|
2776
|
+
<span class='covered'> switch (token.value) {</span>
|
2777
|
+
<span class='covered'> case 'break':</span>
|
2778
|
+
<span class='covered'> return parseBreakStatement();</span>
|
2779
|
+
<span class='covered'> case 'continue':</span>
|
2780
|
+
<span class='covered'> return parseContinueStatement();</span>
|
2781
|
+
<span class='covered'> case 'debugger':</span>
|
2782
|
+
<span class='covered'> return parseDebuggerStatement();</span>
|
2783
|
+
<span class='covered'> case 'do':</span>
|
2784
|
+
<span class='covered'> return parseDoWhileStatement();</span>
|
2785
|
+
<span class='covered'> case 'for':</span>
|
2786
|
+
<span class='covered'> return parseForStatement();</span>
|
2787
|
+
<span class='covered'> case 'function':</span>
|
2788
|
+
<span class='covered'> return parseFunctionDeclaration();</span>
|
2789
|
+
<span class='covered'> case 'if':</span>
|
2790
|
+
<span class='covered'> return parseIfStatement();</span>
|
2791
|
+
<span class='covered'> case 'return':</span>
|
2792
|
+
<span class='covered'> return parseReturnStatement();</span>
|
2793
|
+
<span class='covered'> case 'switch':</span>
|
2794
|
+
<span class='covered'> return parseSwitchStatement();</span>
|
2795
|
+
<span class='covered'> case 'throw':</span>
|
2796
|
+
<span class='covered'> return parseThrowStatement();</span>
|
2797
|
+
<span class='covered'> case 'try':</span>
|
2798
|
+
<span class='covered'> return parseTryStatement();</span>
|
2799
|
+
<span class='covered'> case 'var':</span>
|
2800
|
+
<span class='covered'> return parseVariableStatement();</span>
|
2801
|
+
<span class='covered'> case 'while':</span>
|
2802
|
+
<span class='covered'> return parseWhileStatement();</span>
|
2803
|
+
<span class='covered'> case 'with':</span>
|
2804
|
+
<span class='covered'> return parseWithStatement();</span>
|
2805
|
+
<span class='covered'> default:</span>
|
2806
|
+
<span class='covered'> break;</span>
|
2807
|
+
<span class='covered'> }</span>
|
2808
|
+
<span class='covered'> }</span>
|
2809
|
+
<span class='covered'> </span>
|
2810
|
+
<span class='covered'> expr = parseExpression();</span>
|
2811
|
+
<span class='covered'> </span>
|
2812
|
+
<span class='covered'> // 12.12 Labelled Statements</span>
|
2813
|
+
<span class='covered'> if ((expr.type === Syntax.Identifier) && match(':')) {</span>
|
2814
|
+
<span class='covered'> lex();</span>
|
2815
|
+
<span class='covered'> </span>
|
2816
|
+
<span class='covered'> if (Object.prototype.hasOwnProperty.call(labelSet, expr.name)) {</span>
|
2817
|
+
<span class='covered'> throwError({}, Messages.Redeclaration, 'Label', expr.name);</span>
|
2818
|
+
<span class='covered'> }</span>
|
2819
|
+
<span class='covered'> </span>
|
2820
|
+
<span class='covered'> labelSet[expr.name] = true;</span>
|
2821
|
+
<span class='covered'> labeledBody = parseStatement();</span>
|
2822
|
+
<span class='covered'> delete labelSet[expr.name];</span>
|
2823
|
+
<span class='covered'> </span>
|
2824
|
+
<span class='covered'> return {</span>
|
2825
|
+
<span class='covered'> type: Syntax.LabeledStatement,</span>
|
2826
|
+
<span class='covered'> label: expr,</span>
|
2827
|
+
<span class='covered'> body: labeledBody</span>
|
2828
|
+
<span class='covered'> };</span>
|
2829
|
+
<span class='covered'> }</span>
|
2830
|
+
<span class='covered'> </span>
|
2831
|
+
<span class='covered'> consumeSemicolon();</span>
|
2832
|
+
<span class='covered'> </span>
|
2833
|
+
<span class='covered'> return {</span>
|
2834
|
+
<span class='covered'> type: Syntax.ExpressionStatement,</span>
|
2835
|
+
<span class='covered'> expression: expr</span>
|
2836
|
+
<span class='covered'> };</span>
|
2837
|
+
<span class='covered'> }</span>
|
2838
|
+
<span class='covered'> </span>
|
2839
|
+
<span class='covered'> // 13 Function Definition</span>
|
2840
|
+
<span class='covered'> </span>
|
2841
|
+
<span class='covered'> function parseFunctionSourceElements() {</span>
|
2842
|
+
<span class='covered'> var sourceElement, sourceElements = [], token, directive, firstRestricted, oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody;</span>
|
2843
|
+
<span class='covered'> </span>
|
2844
|
+
<span class='covered'> expect('{');</span>
|
2845
|
+
<span class='covered'> </span>
|
2846
|
+
<span class='covered'> while (index < length) {</span>
|
2847
|
+
<span class='covered'> token = lookahead();</span>
|
2848
|
+
<span class='covered'> if (token.type !== Token.StringLiteral) {</span>
|
2849
|
+
<span class='covered'> break;</span>
|
2850
|
+
<span class='covered'> }</span>
|
2851
|
+
<span class='covered'> </span>
|
2852
|
+
<span class='covered'> sourceElement = parseSourceElement();</span>
|
2853
|
+
<span class='covered'> sourceElements.push(sourceElement);</span>
|
2854
|
+
<span class='covered'> if (sourceElement.expression.type !== Syntax.Literal) {</span>
|
2855
|
+
<span class='covered'> // this is not directive</span>
|
2856
|
+
<span class='covered'> break;</span>
|
2857
|
+
<span class='covered'> }</span>
|
2858
|
+
<span class='covered'> directive = sliceSource(token.range[0] + 1, token.range[1] - 1);</span>
|
2859
|
+
<span class='covered'> if (directive === 'use strict') {</span>
|
2860
|
+
<span class='covered'> strict = true;</span>
|
2861
|
+
<span class='covered'> if (firstRestricted) {</span>
|
2862
|
+
<span class='covered'> throwError(firstRestricted, Messages.StrictOctalLiteral);</span>
|
2863
|
+
<span class='covered'> }</span>
|
2864
|
+
<span class='covered'> } else {</span>
|
2865
|
+
<span class='covered'> if (!firstRestricted && token.octal) {</span>
|
2866
|
+
<span class='covered'> firstRestricted = token;</span>
|
2867
|
+
<span class='covered'> }</span>
|
2868
|
+
<span class='covered'> }</span>
|
2869
|
+
<span class='covered'> }</span>
|
2870
|
+
<span class='covered'> </span>
|
2871
|
+
<span class='covered'> oldLabelSet = labelSet;</span>
|
2872
|
+
<span class='covered'> oldInIteration = inIteration;</span>
|
2873
|
+
<span class='covered'> oldInSwitch = inSwitch;</span>
|
2874
|
+
<span class='covered'> oldInFunctionBody = inFunctionBody;</span>
|
2875
|
+
<span class='covered'> </span>
|
2876
|
+
<span class='covered'> labelSet = {};</span>
|
2877
|
+
<span class='covered'> inIteration = false;</span>
|
2878
|
+
<span class='covered'> inSwitch = false;</span>
|
2879
|
+
<span class='covered'> inFunctionBody = true;</span>
|
2880
|
+
<span class='covered'> </span>
|
2881
|
+
<span class='covered'> while (index < length) {</span>
|
2882
|
+
<span class='covered'> if (match('}')) {</span>
|
2883
|
+
<span class='covered'> break;</span>
|
2884
|
+
<span class='covered'> }</span>
|
2885
|
+
<span class='covered'> sourceElement = parseSourceElement();</span>
|
2886
|
+
<span class='covered'> if (typeof sourceElement === 'undefined') {</span>
|
2887
|
+
<span class='covered'> break;</span>
|
2888
|
+
<span class='covered'> }</span>
|
2889
|
+
<span class='covered'> sourceElements.push(sourceElement);</span>
|
2890
|
+
<span class='covered'> }</span>
|
2891
|
+
<span class='covered'> </span>
|
2892
|
+
<span class='covered'> expect('}');</span>
|
2893
|
+
<span class='covered'> </span>
|
2894
|
+
<span class='covered'> labelSet = oldLabelSet;</span>
|
2895
|
+
<span class='covered'> inIteration = oldInIteration;</span>
|
2896
|
+
<span class='covered'> inSwitch = oldInSwitch;</span>
|
2897
|
+
<span class='covered'> inFunctionBody = oldInFunctionBody;</span>
|
2898
|
+
<span class='covered'> </span>
|
2899
|
+
<span class='covered'> return {</span>
|
2900
|
+
<span class='covered'> type: Syntax.BlockStatement,</span>
|
2901
|
+
<span class='covered'> body: sourceElements</span>
|
2902
|
+
<span class='covered'> };</span>
|
2903
|
+
<span class='covered'> }</span>
|
2904
|
+
<span class='covered'> </span>
|
2905
|
+
<span class='covered'> function parseFunctionDeclaration() {</span>
|
2906
|
+
<span class='covered'> var id, param, params = [], body, token, firstRestricted, message, previousStrict, paramSet;</span>
|
2907
|
+
<span class='covered'> </span>
|
2908
|
+
<span class='covered'> expectKeyword('function');</span>
|
2909
|
+
<span class='covered'> token = lookahead();</span>
|
2910
|
+
<span class='covered'> id = parseVariableIdentifier();</span>
|
2911
|
+
<span class='covered'> if (strict) {</span>
|
2912
|
+
<span class='covered'> if (isRestrictedWord(token.value)) {</span>
|
2913
|
+
<span class='covered'> throwError(token, Messages.StrictFunctionName);</span>
|
2914
|
+
<span class='covered'> }</span>
|
2915
|
+
<span class='covered'> } else {</span>
|
2916
|
+
<span class='covered'> if (isRestrictedWord(token.value)) {</span>
|
2917
|
+
<span class='covered'> firstRestricted = token;</span>
|
2918
|
+
<span class='covered'> message = Messages.StrictFunctionName;</span>
|
2919
|
+
<span class='covered'> } else if (isStrictModeReservedWord(token.value)) {</span>
|
2920
|
+
<span class='covered'> firstRestricted = token;</span>
|
2921
|
+
<span class='covered'> message = Messages.StrictReservedWord;</span>
|
2922
|
+
<span class='covered'> }</span>
|
2923
|
+
<span class='covered'> }</span>
|
2924
|
+
<span class='covered'> </span>
|
2925
|
+
<span class='covered'> expect('(');</span>
|
2926
|
+
<span class='covered'> </span>
|
2927
|
+
<span class='covered'> if (!match(')')) {</span>
|
2928
|
+
<span class='covered'> paramSet = {};</span>
|
2929
|
+
<span class='covered'> while (index < length) {</span>
|
2930
|
+
<span class='covered'> token = lookahead();</span>
|
2931
|
+
<span class='covered'> param = parseVariableIdentifier();</span>
|
2932
|
+
<span class='covered'> if (strict) {</span>
|
2933
|
+
<span class='covered'> if (isRestrictedWord(token.value)) {</span>
|
2934
|
+
<span class='covered'> throwError(token, Messages.StrictParamName);</span>
|
2935
|
+
<span class='covered'> }</span>
|
2936
|
+
<span class='covered'> if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) {</span>
|
2937
|
+
<span class='covered'> throwError(token, Messages.StrictParamDupe);</span>
|
2938
|
+
<span class='covered'> }</span>
|
2939
|
+
<span class='covered'> } else if (!firstRestricted) {</span>
|
2940
|
+
<span class='covered'> if (isRestrictedWord(token.value)) {</span>
|
2941
|
+
<span class='covered'> firstRestricted = token;</span>
|
2942
|
+
<span class='covered'> message = Messages.StrictParamName;</span>
|
2943
|
+
<span class='covered'> } else if (isStrictModeReservedWord(token.value)) {</span>
|
2944
|
+
<span class='covered'> firstRestricted = token;</span>
|
2945
|
+
<span class='covered'> message = Messages.StrictReservedWord;</span>
|
2946
|
+
<span class='covered'> } else if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) {</span>
|
2947
|
+
<span class='covered'> firstRestricted = token;</span>
|
2948
|
+
<span class='covered'> message = Messages.StrictParamDupe;</span>
|
2949
|
+
<span class='covered'> }</span>
|
2950
|
+
<span class='covered'> }</span>
|
2951
|
+
<span class='covered'> params.push(param);</span>
|
2952
|
+
<span class='covered'> paramSet[param.name] = true;</span>
|
2953
|
+
<span class='covered'> if (match(')')) {</span>
|
2954
|
+
<span class='covered'> break;</span>
|
2955
|
+
<span class='covered'> }</span>
|
2956
|
+
<span class='covered'> expect(',');</span>
|
2957
|
+
<span class='covered'> }</span>
|
2958
|
+
<span class='covered'> }</span>
|
2959
|
+
<span class='covered'> </span>
|
2960
|
+
<span class='covered'> expect(')');</span>
|
2961
|
+
<span class='covered'> </span>
|
2962
|
+
<span class='covered'> previousStrict = strict;</span>
|
2963
|
+
<span class='covered'> body = parseFunctionSourceElements();</span>
|
2964
|
+
<span class='covered'> if (strict && firstRestricted) {</span>
|
2965
|
+
<span class='covered'> throwError(firstRestricted, message);</span>
|
2966
|
+
<span class='covered'> }</span>
|
2967
|
+
<span class='covered'> strict = previousStrict;</span>
|
2968
|
+
<span class='covered'> </span>
|
2969
|
+
<span class='covered'> return {</span>
|
2970
|
+
<span class='covered'> type: Syntax.FunctionDeclaration,</span>
|
2971
|
+
<span class='covered'> id: id,</span>
|
2972
|
+
<span class='covered'> params: params,</span>
|
2973
|
+
<span class='covered'> body: body</span>
|
2974
|
+
<span class='covered'> };</span>
|
2975
|
+
<span class='covered'> }</span>
|
2976
|
+
<span class='covered'> </span>
|
2977
|
+
<span class='covered'> function parseFunctionExpression() {</span>
|
2978
|
+
<span class='covered'> var token, id = null, firstRestricted, message, param, params = [], body, previousStrict, paramSet;</span>
|
2979
|
+
<span class='covered'> </span>
|
2980
|
+
<span class='covered'> expectKeyword('function');</span>
|
2981
|
+
<span class='covered'> </span>
|
2982
|
+
<span class='covered'> if (!match('(')) {</span>
|
2983
|
+
<span class='covered'> token = lookahead();</span>
|
2984
|
+
<span class='covered'> id = parseVariableIdentifier();</span>
|
2985
|
+
<span class='covered'> if (strict) {</span>
|
2986
|
+
<span class='covered'> if (isRestrictedWord(token.value)) {</span>
|
2987
|
+
<span class='covered'> throwError(token, Messages.StrictFunctionName);</span>
|
2988
|
+
<span class='covered'> }</span>
|
2989
|
+
<span class='covered'> } else {</span>
|
2990
|
+
<span class='covered'> if (isRestrictedWord(token.value)) {</span>
|
2991
|
+
<span class='covered'> firstRestricted = token;</span>
|
2992
|
+
<span class='covered'> message = Messages.StrictFunctionName;</span>
|
2993
|
+
<span class='covered'> } else if (isStrictModeReservedWord(token.value)) {</span>
|
2994
|
+
<span class='covered'> firstRestricted = token;</span>
|
2995
|
+
<span class='covered'> message = Messages.StrictReservedWord;</span>
|
2996
|
+
<span class='covered'> }</span>
|
2997
|
+
<span class='covered'> }</span>
|
2998
|
+
<span class='covered'> }</span>
|
2999
|
+
<span class='covered'> </span>
|
3000
|
+
<span class='covered'> expect('(');</span>
|
3001
|
+
<span class='covered'> </span>
|
3002
|
+
<span class='covered'> if (!match(')')) {</span>
|
3003
|
+
<span class='covered'> paramSet = {};</span>
|
3004
|
+
<span class='covered'> while (index < length) {</span>
|
3005
|
+
<span class='covered'> token = lookahead();</span>
|
3006
|
+
<span class='covered'> param = parseVariableIdentifier();</span>
|
3007
|
+
<span class='covered'> if (strict) {</span>
|
3008
|
+
<span class='covered'> if (isRestrictedWord(token.value)) {</span>
|
3009
|
+
<span class='covered'> throwError(token, Messages.StrictParamName);</span>
|
3010
|
+
<span class='covered'> }</span>
|
3011
|
+
<span class='covered'> if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) {</span>
|
3012
|
+
<span class='covered'> throwError(token, Messages.StrictParamDupe);</span>
|
3013
|
+
<span class='covered'> }</span>
|
3014
|
+
<span class='covered'> } else if (!firstRestricted) {</span>
|
3015
|
+
<span class='covered'> if (isRestrictedWord(token.value)) {</span>
|
3016
|
+
<span class='covered'> firstRestricted = token;</span>
|
3017
|
+
<span class='covered'> message = Messages.StrictParamName;</span>
|
3018
|
+
<span class='covered'> } else if (isStrictModeReservedWord(token.value)) {</span>
|
3019
|
+
<span class='covered'> firstRestricted = token;</span>
|
3020
|
+
<span class='covered'> message = Messages.StrictReservedWord;</span>
|
3021
|
+
<span class='covered'> } else if (Object.prototype.hasOwnProperty.call(paramSet, token.value)) {</span>
|
3022
|
+
<span class='covered'> firstRestricted = token;</span>
|
3023
|
+
<span class='covered'> message = Messages.StrictParamDupe;</span>
|
3024
|
+
<span class='covered'> }</span>
|
3025
|
+
<span class='covered'> }</span>
|
3026
|
+
<span class='covered'> params.push(param);</span>
|
3027
|
+
<span class='covered'> paramSet[param.name] = true;</span>
|
3028
|
+
<span class='covered'> if (match(')')) {</span>
|
3029
|
+
<span class='covered'> break;</span>
|
3030
|
+
<span class='covered'> }</span>
|
3031
|
+
<span class='covered'> expect(',');</span>
|
3032
|
+
<span class='covered'> }</span>
|
3033
|
+
<span class='covered'> }</span>
|
3034
|
+
<span class='covered'> </span>
|
3035
|
+
<span class='covered'> expect(')');</span>
|
3036
|
+
<span class='covered'> </span>
|
3037
|
+
<span class='covered'> previousStrict = strict;</span>
|
3038
|
+
<span class='covered'> body = parseFunctionSourceElements();</span>
|
3039
|
+
<span class='covered'> if (strict && firstRestricted) {</span>
|
3040
|
+
<span class='covered'> throwError(firstRestricted, message);</span>
|
3041
|
+
<span class='covered'> }</span>
|
3042
|
+
<span class='covered'> strict = previousStrict;</span>
|
3043
|
+
<span class='covered'> </span>
|
3044
|
+
<span class='covered'> return {</span>
|
3045
|
+
<span class='covered'> type: Syntax.FunctionExpression,</span>
|
3046
|
+
<span class='covered'> id: id,</span>
|
3047
|
+
<span class='covered'> params: params,</span>
|
3048
|
+
<span class='covered'> body: body</span>
|
3049
|
+
<span class='covered'> };</span>
|
3050
|
+
<span class='covered'> }</span>
|
3051
|
+
<span class='covered'> </span>
|
3052
|
+
<span class='covered'> // 14 Program</span>
|
3053
|
+
<span class='covered'> </span>
|
3054
|
+
<span class='covered'> function parseSourceElement() {</span>
|
3055
|
+
<span class='covered'> var token = lookahead();</span>
|
3056
|
+
<span class='covered'> </span>
|
3057
|
+
<span class='covered'> if (token.type === Token.Keyword) {</span>
|
3058
|
+
<span class='covered'> switch (token.value) {</span>
|
3059
|
+
<span class='covered'> case 'const':</span>
|
3060
|
+
<span class='covered'> case 'let':</span>
|
3061
|
+
<span class='covered'> return parseConstLetDeclaration(token.value);</span>
|
3062
|
+
<span class='covered'> case 'function':</span>
|
3063
|
+
<span class='covered'> return parseFunctionDeclaration();</span>
|
3064
|
+
<span class='covered'> default:</span>
|
3065
|
+
<span class='covered'> return parseStatement();</span>
|
3066
|
+
<span class='covered'> }</span>
|
3067
|
+
<span class='covered'> }</span>
|
3068
|
+
<span class='covered'> </span>
|
3069
|
+
<span class='covered'> if (token.type !== Token.EOF) {</span>
|
3070
|
+
<span class='covered'> return parseStatement();</span>
|
3071
|
+
<span class='covered'> }</span>
|
3072
|
+
<span class='covered'> }</span>
|
3073
|
+
<span class='covered'> </span>
|
3074
|
+
<span class='covered'> function parseSourceElements() {</span>
|
3075
|
+
<span class='covered'> var sourceElement, sourceElements = [], token, directive, firstRestricted;</span>
|
3076
|
+
<span class='covered'> </span>
|
3077
|
+
<span class='covered'> while (index < length) {</span>
|
3078
|
+
<span class='covered'> token = lookahead();</span>
|
3079
|
+
<span class='covered'> if (token.type !== Token.StringLiteral) {</span>
|
3080
|
+
<span class='covered'> break;</span>
|
3081
|
+
<span class='covered'> }</span>
|
3082
|
+
<span class='covered'> </span>
|
3083
|
+
<span class='covered'> sourceElement = parseSourceElement();</span>
|
3084
|
+
<span class='covered'> sourceElements.push(sourceElement);</span>
|
3085
|
+
<span class='covered'> if (sourceElement.expression.type !== Syntax.Literal) {</span>
|
3086
|
+
<span class='covered'> // this is not directive</span>
|
3087
|
+
<span class='covered'> break;</span>
|
3088
|
+
<span class='covered'> }</span>
|
3089
|
+
<span class='covered'> directive = sliceSource(token.range[0] + 1, token.range[1] - 1);</span>
|
3090
|
+
<span class='covered'> if (directive === 'use strict') {</span>
|
3091
|
+
<span class='covered'> strict = true;</span>
|
3092
|
+
<span class='covered'> if (firstRestricted) {</span>
|
3093
|
+
<span class='covered'> throwError(firstRestricted, Messages.StrictOctalLiteral);</span>
|
3094
|
+
<span class='covered'> }</span>
|
3095
|
+
<span class='covered'> } else {</span>
|
3096
|
+
<span class='covered'> if (!firstRestricted && token.octal) {</span>
|
3097
|
+
<span class='covered'> firstRestricted = token;</span>
|
3098
|
+
<span class='covered'> }</span>
|
3099
|
+
<span class='covered'> }</span>
|
3100
|
+
<span class='covered'> }</span>
|
3101
|
+
<span class='covered'> </span>
|
3102
|
+
<span class='covered'> while (index < length) {</span>
|
3103
|
+
<span class='covered'> sourceElement = parseSourceElement();</span>
|
3104
|
+
<span class='covered'> if (typeof sourceElement === 'undefined') {</span>
|
3105
|
+
<span class='covered'> break;</span>
|
3106
|
+
<span class='covered'> }</span>
|
3107
|
+
<span class='covered'> sourceElements.push(sourceElement);</span>
|
3108
|
+
<span class='covered'> }</span>
|
3109
|
+
<span class='covered'> return sourceElements;</span>
|
3110
|
+
<span class='covered'> }</span>
|
3111
|
+
<span class='covered'> </span>
|
3112
|
+
<span class='covered'> function parseProgram() {</span>
|
3113
|
+
<span class='covered'> var program;</span>
|
3114
|
+
<span class='covered'> strict = false;</span>
|
3115
|
+
<span class='covered'> program = {</span>
|
3116
|
+
<span class='covered'> type: Syntax.Program,</span>
|
3117
|
+
<span class='covered'> body: parseSourceElements()</span>
|
3118
|
+
<span class='covered'> };</span>
|
3119
|
+
<span class='covered'> return program;</span>
|
3120
|
+
<span class='covered'> }</span>
|
3121
|
+
<span class='covered'> </span>
|
3122
|
+
<span class='covered'> // The following functions are needed only when the option to preserve</span>
|
3123
|
+
<span class='covered'> // the comments is active.</span>
|
3124
|
+
<span class='covered'> </span>
|
3125
|
+
<span class='covered'> function addComment(start, end, type, value) {</span>
|
3126
|
+
<span class='covered'> assert(typeof start === 'number', 'Comment must have valid position');</span>
|
3127
|
+
<span class='covered'> </span>
|
3128
|
+
<span class='covered'> // Because the way the actual token is scanned, often the comments</span>
|
3129
|
+
<span class='covered'> // (if any) are skipped twice during the lexical analysis.</span>
|
3130
|
+
<span class='covered'> // Thus, we need to skip adding a comment if the comment array already</span>
|
3131
|
+
<span class='covered'> // handled it.</span>
|
3132
|
+
<span class='covered'> if (extra.comments.length > 0) {</span>
|
3133
|
+
<span class='covered'> if (extra.comments[extra.comments.length - 1].range[1] > start) {</span>
|
3134
|
+
<span class='covered'> return;</span>
|
3135
|
+
<span class='covered'> }</span>
|
3136
|
+
<span class='covered'> }</span>
|
3137
|
+
<span class='covered'> </span>
|
3138
|
+
<span class='covered'> extra.comments.push({</span>
|
3139
|
+
<span class='covered'> range: [start, end],</span>
|
3140
|
+
<span class='covered'> type: type,</span>
|
3141
|
+
<span class='covered'> value: value</span>
|
3142
|
+
<span class='covered'> });</span>
|
3143
|
+
<span class='covered'> }</span>
|
3144
|
+
<span class='covered'> </span>
|
3145
|
+
<span class='covered'> function scanComment() {</span>
|
3146
|
+
<span class='covered'> var comment, ch, start, blockComment, lineComment;</span>
|
3147
|
+
<span class='covered'> </span>
|
3148
|
+
<span class='covered'> comment = '';</span>
|
3149
|
+
<span class='covered'> blockComment = false;</span>
|
3150
|
+
<span class='covered'> lineComment = false;</span>
|
3151
|
+
<span class='covered'> </span>
|
3152
|
+
<span class='covered'> while (index < length) {</span>
|
3153
|
+
<span class='covered'> ch = source[index];</span>
|
3154
|
+
<span class='covered'> </span>
|
3155
|
+
<span class='covered'> if (lineComment) {</span>
|
3156
|
+
<span class='covered'> ch = nextChar();</span>
|
3157
|
+
<span class='covered'> if (isLineTerminator(ch)) {</span>
|
3158
|
+
<span class='covered'> lineComment = false;</span>
|
3159
|
+
<span class='covered'> addComment(start, index - 1, 'Line', comment);</span>
|
3160
|
+
<span class='covered'> if (ch === '\r' && source[index] === '\n') {</span>
|
3161
|
+
<span class='covered'> ++index;</span>
|
3162
|
+
<span class='covered'> }</span>
|
3163
|
+
<span class='covered'> ++lineNumber;</span>
|
3164
|
+
<span class='covered'> lineStart = index;</span>
|
3165
|
+
<span class='covered'> comment = '';</span>
|
3166
|
+
<span class='covered'> } else {</span>
|
3167
|
+
<span class='covered'> comment += ch;</span>
|
3168
|
+
<span class='covered'> }</span>
|
3169
|
+
<span class='covered'> } else if (blockComment) {</span>
|
3170
|
+
<span class='covered'> if (isLineTerminator(ch)) {</span>
|
3171
|
+
<span class='covered'> if (ch === '\r' && source[index + 1] === '\n') {</span>
|
3172
|
+
<span class='covered'> ++index;</span>
|
3173
|
+
<span class='covered'> comment += '\r\n';</span>
|
3174
|
+
<span class='covered'> } else {</span>
|
3175
|
+
<span class='covered'> comment += ch;</span>
|
3176
|
+
<span class='covered'> }</span>
|
3177
|
+
<span class='covered'> ++lineNumber;</span>
|
3178
|
+
<span class='covered'> ++index;</span>
|
3179
|
+
<span class='covered'> lineStart = index;</span>
|
3180
|
+
<span class='covered'> if (index >= length) {</span>
|
3181
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
3182
|
+
<span class='covered'> }</span>
|
3183
|
+
<span class='covered'> } else {</span>
|
3184
|
+
<span class='covered'> ch = nextChar();</span>
|
3185
|
+
<span class='covered'> if (index >= length) {</span>
|
3186
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
3187
|
+
<span class='covered'> }</span>
|
3188
|
+
<span class='covered'> comment += ch;</span>
|
3189
|
+
<span class='covered'> if (ch === '*') {</span>
|
3190
|
+
<span class='covered'> ch = source[index];</span>
|
3191
|
+
<span class='covered'> if (ch === '/') {</span>
|
3192
|
+
<span class='covered'> comment = comment.substr(0, comment.length - 1);</span>
|
3193
|
+
<span class='covered'> blockComment = false;</span>
|
3194
|
+
<span class='covered'> ++index;</span>
|
3195
|
+
<span class='covered'> addComment(start, index - 1, 'Block', comment);</span>
|
3196
|
+
<span class='covered'> comment = '';</span>
|
3197
|
+
<span class='covered'> }</span>
|
3198
|
+
<span class='covered'> }</span>
|
3199
|
+
<span class='covered'> }</span>
|
3200
|
+
<span class='covered'> } else if (ch === '/') {</span>
|
3201
|
+
<span class='covered'> ch = source[index + 1];</span>
|
3202
|
+
<span class='covered'> if (ch === '/') {</span>
|
3203
|
+
<span class='covered'> start = index;</span>
|
3204
|
+
<span class='covered'> index += 2;</span>
|
3205
|
+
<span class='covered'> lineComment = true;</span>
|
3206
|
+
<span class='covered'> } else if (ch === '*') {</span>
|
3207
|
+
<span class='covered'> start = index;</span>
|
3208
|
+
<span class='covered'> index += 2;</span>
|
3209
|
+
<span class='covered'> blockComment = true;</span>
|
3210
|
+
<span class='covered'> if (index >= length) {</span>
|
3211
|
+
<span class='covered'> throwError({}, Messages.UnexpectedToken, 'ILLEGAL');</span>
|
3212
|
+
<span class='covered'> }</span>
|
3213
|
+
<span class='covered'> } else {</span>
|
3214
|
+
<span class='covered'> break;</span>
|
3215
|
+
<span class='covered'> }</span>
|
3216
|
+
<span class='covered'> } else if (isWhiteSpace(ch)) {</span>
|
3217
|
+
<span class='covered'> ++index;</span>
|
3218
|
+
<span class='covered'> } else if (isLineTerminator(ch)) {</span>
|
3219
|
+
<span class='covered'> ++index;</span>
|
3220
|
+
<span class='covered'> if (ch === '\r' && source[index] === '\n') {</span>
|
3221
|
+
<span class='covered'> ++index;</span>
|
3222
|
+
<span class='covered'> }</span>
|
3223
|
+
<span class='covered'> ++lineNumber;</span>
|
3224
|
+
<span class='covered'> lineStart = index;</span>
|
3225
|
+
<span class='covered'> } else {</span>
|
3226
|
+
<span class='covered'> break;</span>
|
3227
|
+
<span class='covered'> }</span>
|
3228
|
+
<span class='covered'> }</span>
|
3229
|
+
<span class='covered'> }</span>
|
3230
|
+
<span class='covered'> </span>
|
3231
|
+
<span class='covered'> function collectToken() {</span>
|
3232
|
+
<span class='covered'> var token = extra.advance(),</span>
|
3233
|
+
<span class='covered'> range,</span>
|
3234
|
+
<span class='covered'> value;</span>
|
3235
|
+
<span class='covered'> </span>
|
3236
|
+
<span class='covered'> if (token.type !== Token.EOF) {</span>
|
3237
|
+
<span class='covered'> range = [token.range[0], token.range[1] - 1];</span>
|
3238
|
+
<span class='covered'> value = sliceSource(token.range[0], token.range[1]);</span>
|
3239
|
+
<span class='covered'> extra.tokens.push({</span>
|
3240
|
+
<span class='covered'> type: TokenName[token.type],</span>
|
3241
|
+
<span class='covered'> value: value,</span>
|
3242
|
+
<span class='covered'> range: range</span>
|
3243
|
+
<span class='covered'> });</span>
|
3244
|
+
<span class='covered'> }</span>
|
3245
|
+
<span class='covered'> </span>
|
3246
|
+
<span class='covered'> return token;</span>
|
3247
|
+
<span class='covered'> }</span>
|
3248
|
+
<span class='covered'> </span>
|
3249
|
+
<span class='covered'> function collectRegex() {</span>
|
3250
|
+
<span class='covered'> var pos, regex, token;</span>
|
3251
|
+
<span class='covered'> </span>
|
3252
|
+
<span class='covered'> skipComment();</span>
|
3253
|
+
<span class='covered'> </span>
|
3254
|
+
<span class='covered'> pos = index;</span>
|
3255
|
+
<span class='covered'> regex = extra.scanRegExp();</span>
|
3256
|
+
<span class='covered'> </span>
|
3257
|
+
<span class='covered'> // Pop the previous token, which is likely '/' or '/='</span>
|
3258
|
+
<span class='covered'> if (extra.tokens.length > 0) {</span>
|
3259
|
+
<span class='covered'> token = extra.tokens[extra.tokens.length - 1];</span>
|
3260
|
+
<span class='covered'> if (token.range[0] === pos && token.type === 'Punctuator') {</span>
|
3261
|
+
<span class='covered'> if (token.value === '/' || token.value === '/=') {</span>
|
3262
|
+
<span class='covered'> extra.tokens.pop();</span>
|
3263
|
+
<span class='covered'> }</span>
|
3264
|
+
<span class='covered'> }</span>
|
3265
|
+
<span class='covered'> }</span>
|
3266
|
+
<span class='covered'> </span>
|
3267
|
+
<span class='covered'> extra.tokens.push({</span>
|
3268
|
+
<span class='covered'> type: 'RegularExpression',</span>
|
3269
|
+
<span class='covered'> value: regex.literal,</span>
|
3270
|
+
<span class='covered'> range: [pos, index - 1]</span>
|
3271
|
+
<span class='covered'> });</span>
|
3272
|
+
<span class='covered'> </span>
|
3273
|
+
<span class='covered'> return regex;</span>
|
3274
|
+
<span class='covered'> }</span>
|
3275
|
+
<span class='covered'> </span>
|
3276
|
+
<span class='covered'> function createLiteral(token) {</span>
|
3277
|
+
<span class='covered'> return {</span>
|
3278
|
+
<span class='covered'> type: Syntax.Literal,</span>
|
3279
|
+
<span class='covered'> value: token.value</span>
|
3280
|
+
<span class='covered'> };</span>
|
3281
|
+
<span class='covered'> }</span>
|
3282
|
+
<span class='covered'> </span>
|
3283
|
+
<span class='covered'> function createRawLiteral(token) {</span>
|
3284
|
+
<span class='covered'> return {</span>
|
3285
|
+
<span class='covered'> type: Syntax.Literal,</span>
|
3286
|
+
<span class='covered'> value: token.value,</span>
|
3287
|
+
<span class='covered'> raw: sliceSource(token.range[0], token.range[1])</span>
|
3288
|
+
<span class='covered'> };</span>
|
3289
|
+
<span class='covered'> }</span>
|
3290
|
+
<span class='covered'> </span>
|
3291
|
+
<span class='covered'> function wrapTrackingFunction(range, loc) {</span>
|
3292
|
+
<span class='covered'> </span>
|
3293
|
+
<span class='covered'> return function (parseFunction) {</span>
|
3294
|
+
<span class='covered'> </span>
|
3295
|
+
<span class='covered'> function isBinary(node) {</span>
|
3296
|
+
<span class='covered'> return node.type === Syntax.LogicalExpression ||</span>
|
3297
|
+
<span class='covered'> node.type === Syntax.BinaryExpression;</span>
|
3298
|
+
<span class='covered'> }</span>
|
3299
|
+
<span class='covered'> </span>
|
3300
|
+
<span class='covered'> function visit(node) {</span>
|
3301
|
+
<span class='covered'> if (isBinary(node.left)) {</span>
|
3302
|
+
<span class='covered'> visit(node.left);</span>
|
3303
|
+
<span class='covered'> }</span>
|
3304
|
+
<span class='covered'> if (isBinary(node.right)) {</span>
|
3305
|
+
<span class='covered'> visit(node.right);</span>
|
3306
|
+
<span class='covered'> }</span>
|
3307
|
+
<span class='covered'> </span>
|
3308
|
+
<span class='covered'> if (range && typeof node.range === 'undefined') {</span>
|
3309
|
+
<span class='covered'> node.range = [node.left.range[0], node.right.range[1]];</span>
|
3310
|
+
<span class='covered'> }</span>
|
3311
|
+
<span class='covered'> if (loc && typeof node.loc === 'undefined') {</span>
|
3312
|
+
<span class='covered'> node.loc = {</span>
|
3313
|
+
<span class='covered'> start: node.left.loc.start,</span>
|
3314
|
+
<span class='covered'> end: node.right.loc.end</span>
|
3315
|
+
<span class='covered'> };</span>
|
3316
|
+
<span class='covered'> }</span>
|
3317
|
+
<span class='covered'> }</span>
|
3318
|
+
<span class='covered'> </span>
|
3319
|
+
<span class='covered'> return function () {</span>
|
3320
|
+
<span class='covered'> var node, rangeInfo, locInfo;</span>
|
3321
|
+
<span class='covered'> </span>
|
3322
|
+
<span class='covered'> skipComment();</span>
|
3323
|
+
<span class='covered'> rangeInfo = [index, 0];</span>
|
3324
|
+
<span class='covered'> locInfo = {</span>
|
3325
|
+
<span class='covered'> start: {</span>
|
3326
|
+
<span class='covered'> line: lineNumber,</span>
|
3327
|
+
<span class='covered'> column: index - lineStart</span>
|
3328
|
+
<span class='covered'> }</span>
|
3329
|
+
<span class='covered'> };</span>
|
3330
|
+
<span class='covered'> </span>
|
3331
|
+
<span class='covered'> node = parseFunction.apply(null, arguments);</span>
|
3332
|
+
<span class='covered'> if (typeof node !== 'undefined') {</span>
|
3333
|
+
<span class='covered'> </span>
|
3334
|
+
<span class='covered'> if (range) {</span>
|
3335
|
+
<span class='covered'> rangeInfo[1] = index - 1;</span>
|
3336
|
+
<span class='covered'> node.range = rangeInfo;</span>
|
3337
|
+
<span class='covered'> }</span>
|
3338
|
+
<span class='covered'> </span>
|
3339
|
+
<span class='covered'> if (loc) {</span>
|
3340
|
+
<span class='covered'> locInfo.end = {</span>
|
3341
|
+
<span class='covered'> line: lineNumber,</span>
|
3342
|
+
<span class='covered'> column: index - lineStart</span>
|
3343
|
+
<span class='covered'> };</span>
|
3344
|
+
<span class='covered'> node.loc = locInfo;</span>
|
3345
|
+
<span class='covered'> }</span>
|
3346
|
+
<span class='covered'> </span>
|
3347
|
+
<span class='covered'> if (isBinary(node)) {</span>
|
3348
|
+
<span class='covered'> visit(node);</span>
|
3349
|
+
<span class='covered'> }</span>
|
3350
|
+
<span class='covered'> </span>
|
3351
|
+
<span class='covered'> if (node.type === Syntax.MemberExpression) {</span>
|
3352
|
+
<span class='covered'> if (typeof node.object.range !== 'undefined') {</span>
|
3353
|
+
<span class='covered'> node.range[0] = node.object.range[0];</span>
|
3354
|
+
<span class='covered'> }</span>
|
3355
|
+
<span class='covered'> if (typeof node.object.loc !== 'undefined') {</span>
|
3356
|
+
<span class='covered'> node.loc.start = node.object.loc.start;</span>
|
3357
|
+
<span class='covered'> }</span>
|
3358
|
+
<span class='covered'> }</span>
|
3359
|
+
<span class='covered'> return node;</span>
|
3360
|
+
<span class='covered'> }</span>
|
3361
|
+
<span class='covered'> };</span>
|
3362
|
+
<span class='covered'> </span>
|
3363
|
+
<span class='covered'> };</span>
|
3364
|
+
<span class='covered'> }</span>
|
3365
|
+
<span class='covered'> </span>
|
3366
|
+
<span class='covered'> function patch() {</span>
|
3367
|
+
<span class='covered'> </span>
|
3368
|
+
<span class='covered'> var wrapTracking;</span>
|
3369
|
+
<span class='covered'> </span>
|
3370
|
+
<span class='covered'> if (extra.comments) {</span>
|
3371
|
+
<span class='covered'> extra.skipComment = skipComment;</span>
|
3372
|
+
<span class='covered'> skipComment = scanComment;</span>
|
3373
|
+
<span class='covered'> }</span>
|
3374
|
+
<span class='covered'> </span>
|
3375
|
+
<span class='covered'> if (extra.raw) {</span>
|
3376
|
+
<span class='covered'> extra.createLiteral = createLiteral;</span>
|
3377
|
+
<span class='covered'> createLiteral = createRawLiteral;</span>
|
3378
|
+
<span class='covered'> }</span>
|
3379
|
+
<span class='covered'> </span>
|
3380
|
+
<span class='covered'> if (extra.range || extra.loc) {</span>
|
3381
|
+
<span class='covered'> </span>
|
3382
|
+
<span class='covered'> wrapTracking = wrapTrackingFunction(extra.range, extra.loc);</span>
|
3383
|
+
<span class='covered'> </span>
|
3384
|
+
<span class='covered'> extra.parseAdditiveExpression = parseAdditiveExpression;</span>
|
3385
|
+
<span class='covered'> extra.parseAssignmentExpression = parseAssignmentExpression;</span>
|
3386
|
+
<span class='covered'> extra.parseBitwiseANDExpression = parseBitwiseANDExpression;</span>
|
3387
|
+
<span class='covered'> extra.parseBitwiseORExpression = parseBitwiseORExpression;</span>
|
3388
|
+
<span class='covered'> extra.parseBitwiseXORExpression = parseBitwiseXORExpression;</span>
|
3389
|
+
<span class='covered'> extra.parseBlock = parseBlock;</span>
|
3390
|
+
<span class='covered'> extra.parseFunctionSourceElements = parseFunctionSourceElements;</span>
|
3391
|
+
<span class='covered'> extra.parseCallMember = parseCallMember;</span>
|
3392
|
+
<span class='covered'> extra.parseCatchClause = parseCatchClause;</span>
|
3393
|
+
<span class='covered'> extra.parseComputedMember = parseComputedMember;</span>
|
3394
|
+
<span class='covered'> extra.parseConditionalExpression = parseConditionalExpression;</span>
|
3395
|
+
<span class='covered'> extra.parseConstLetDeclaration = parseConstLetDeclaration;</span>
|
3396
|
+
<span class='covered'> extra.parseEqualityExpression = parseEqualityExpression;</span>
|
3397
|
+
<span class='covered'> extra.parseExpression = parseExpression;</span>
|
3398
|
+
<span class='covered'> extra.parseForVariableDeclaration = parseForVariableDeclaration;</span>
|
3399
|
+
<span class='covered'> extra.parseFunctionDeclaration = parseFunctionDeclaration;</span>
|
3400
|
+
<span class='covered'> extra.parseFunctionExpression = parseFunctionExpression;</span>
|
3401
|
+
<span class='covered'> extra.parseLogicalANDExpression = parseLogicalANDExpression;</span>
|
3402
|
+
<span class='covered'> extra.parseLogicalORExpression = parseLogicalORExpression;</span>
|
3403
|
+
<span class='covered'> extra.parseMultiplicativeExpression = parseMultiplicativeExpression;</span>
|
3404
|
+
<span class='covered'> extra.parseNewExpression = parseNewExpression;</span>
|
3405
|
+
<span class='covered'> extra.parseNonComputedMember = parseNonComputedMember;</span>
|
3406
|
+
<span class='covered'> extra.parseNonComputedProperty = parseNonComputedProperty;</span>
|
3407
|
+
<span class='covered'> extra.parseObjectProperty = parseObjectProperty;</span>
|
3408
|
+
<span class='covered'> extra.parseObjectPropertyKey = parseObjectPropertyKey;</span>
|
3409
|
+
<span class='covered'> extra.parsePostfixExpression = parsePostfixExpression;</span>
|
3410
|
+
<span class='covered'> extra.parsePrimaryExpression = parsePrimaryExpression;</span>
|
3411
|
+
<span class='covered'> extra.parseProgram = parseProgram;</span>
|
3412
|
+
<span class='covered'> extra.parsePropertyFunction = parsePropertyFunction;</span>
|
3413
|
+
<span class='covered'> extra.parseRelationalExpression = parseRelationalExpression;</span>
|
3414
|
+
<span class='covered'> extra.parseStatement = parseStatement;</span>
|
3415
|
+
<span class='covered'> extra.parseShiftExpression = parseShiftExpression;</span>
|
3416
|
+
<span class='covered'> extra.parseSwitchCase = parseSwitchCase;</span>
|
3417
|
+
<span class='covered'> extra.parseUnaryExpression = parseUnaryExpression;</span>
|
3418
|
+
<span class='covered'> extra.parseVariableDeclaration = parseVariableDeclaration;</span>
|
3419
|
+
<span class='covered'> extra.parseVariableIdentifier = parseVariableIdentifier;</span>
|
3420
|
+
<span class='covered'> </span>
|
3421
|
+
<span class='covered'> parseAdditiveExpression = wrapTracking(extra.parseAdditiveExpression);</span>
|
3422
|
+
<span class='covered'> parseAssignmentExpression = wrapTracking(extra.parseAssignmentExpression);</span>
|
3423
|
+
<span class='covered'> parseBitwiseANDExpression = wrapTracking(extra.parseBitwiseANDExpression);</span>
|
3424
|
+
<span class='covered'> parseBitwiseORExpression = wrapTracking(extra.parseBitwiseORExpression);</span>
|
3425
|
+
<span class='covered'> parseBitwiseXORExpression = wrapTracking(extra.parseBitwiseXORExpression);</span>
|
3426
|
+
<span class='covered'> parseBlock = wrapTracking(extra.parseBlock);</span>
|
3427
|
+
<span class='covered'> parseFunctionSourceElements = wrapTracking(extra.parseFunctionSourceElements);</span>
|
3428
|
+
<span class='covered'> parseCallMember = wrapTracking(extra.parseCallMember);</span>
|
3429
|
+
<span class='covered'> parseCatchClause = wrapTracking(extra.parseCatchClause);</span>
|
3430
|
+
<span class='covered'> parseComputedMember = wrapTracking(extra.parseComputedMember);</span>
|
3431
|
+
<span class='covered'> parseConditionalExpression = wrapTracking(extra.parseConditionalExpression);</span>
|
3432
|
+
<span class='covered'> parseConstLetDeclaration = wrapTracking(extra.parseConstLetDeclaration);</span>
|
3433
|
+
<span class='covered'> parseEqualityExpression = wrapTracking(extra.parseEqualityExpression);</span>
|
3434
|
+
<span class='covered'> parseExpression = wrapTracking(extra.parseExpression);</span>
|
3435
|
+
<span class='covered'> parseForVariableDeclaration = wrapTracking(extra.parseForVariableDeclaration);</span>
|
3436
|
+
<span class='covered'> parseFunctionDeclaration = wrapTracking(extra.parseFunctionDeclaration);</span>
|
3437
|
+
<span class='covered'> parseFunctionExpression = wrapTracking(extra.parseFunctionExpression);</span>
|
3438
|
+
<span class='covered'> parseLogicalANDExpression = wrapTracking(extra.parseLogicalANDExpression);</span>
|
3439
|
+
<span class='covered'> parseLogicalORExpression = wrapTracking(extra.parseLogicalORExpression);</span>
|
3440
|
+
<span class='covered'> parseMultiplicativeExpression = wrapTracking(extra.parseMultiplicativeExpression);</span>
|
3441
|
+
<span class='covered'> parseNewExpression = wrapTracking(extra.parseNewExpression);</span>
|
3442
|
+
<span class='covered'> parseNonComputedMember = wrapTracking(extra.parseNonComputedMember);</span>
|
3443
|
+
<span class='covered'> parseNonComputedProperty = wrapTracking(extra.parseNonComputedProperty);</span>
|
3444
|
+
<span class='covered'> parseObjectProperty = wrapTracking(extra.parseObjectProperty);</span>
|
3445
|
+
<span class='covered'> parseObjectPropertyKey = wrapTracking(extra.parseObjectPropertyKey);</span>
|
3446
|
+
<span class='covered'> parsePostfixExpression = wrapTracking(extra.parsePostfixExpression);</span>
|
3447
|
+
<span class='covered'> parsePrimaryExpression = wrapTracking(extra.parsePrimaryExpression);</span>
|
3448
|
+
<span class='covered'> parseProgram = wrapTracking(extra.parseProgram);</span>
|
3449
|
+
<span class='covered'> parsePropertyFunction = wrapTracking(extra.parsePropertyFunction);</span>
|
3450
|
+
<span class='covered'> parseRelationalExpression = wrapTracking(extra.parseRelationalExpression);</span>
|
3451
|
+
<span class='covered'> parseStatement = wrapTracking(extra.parseStatement);</span>
|
3452
|
+
<span class='covered'> parseShiftExpression = wrapTracking(extra.parseShiftExpression);</span>
|
3453
|
+
<span class='covered'> parseSwitchCase = wrapTracking(extra.parseSwitchCase);</span>
|
3454
|
+
<span class='covered'> parseUnaryExpression = wrapTracking(extra.parseUnaryExpression);</span>
|
3455
|
+
<span class='covered'> parseVariableDeclaration = wrapTracking(extra.parseVariableDeclaration);</span>
|
3456
|
+
<span class='covered'> parseVariableIdentifier = wrapTracking(extra.parseVariableIdentifier);</span>
|
3457
|
+
<span class='covered'> }</span>
|
3458
|
+
<span class='covered'> </span>
|
3459
|
+
<span class='covered'> if (typeof extra.tokens !== 'undefined') {</span>
|
3460
|
+
<span class='covered'> extra.advance = advance;</span>
|
3461
|
+
<span class='covered'> extra.scanRegExp = scanRegExp;</span>
|
3462
|
+
<span class='covered'> </span>
|
3463
|
+
<span class='covered'> advance = collectToken;</span>
|
3464
|
+
<span class='covered'> scanRegExp = collectRegex;</span>
|
3465
|
+
<span class='covered'> }</span>
|
3466
|
+
<span class='covered'> }</span>
|
3467
|
+
<span class='covered'> </span>
|
3468
|
+
<span class='covered'> function unpatch() {</span>
|
3469
|
+
<span class='covered'> if (typeof extra.skipComment === 'function') {</span>
|
3470
|
+
<span class='covered'> skipComment = extra.skipComment;</span>
|
3471
|
+
<span class='covered'> }</span>
|
3472
|
+
<span class='covered'> </span>
|
3473
|
+
<span class='covered'> if (extra.raw) {</span>
|
3474
|
+
<span class='covered'> createLiteral = extra.createLiteral;</span>
|
3475
|
+
<span class='covered'> }</span>
|
3476
|
+
<span class='covered'> </span>
|
3477
|
+
<span class='covered'> if (extra.range || extra.loc) {</span>
|
3478
|
+
<span class='covered'> parseAdditiveExpression = extra.parseAdditiveExpression;</span>
|
3479
|
+
<span class='covered'> parseAssignmentExpression = extra.parseAssignmentExpression;</span>
|
3480
|
+
<span class='covered'> parseBitwiseANDExpression = extra.parseBitwiseANDExpression;</span>
|
3481
|
+
<span class='covered'> parseBitwiseORExpression = extra.parseBitwiseORExpression;</span>
|
3482
|
+
<span class='covered'> parseBitwiseXORExpression = extra.parseBitwiseXORExpression;</span>
|
3483
|
+
<span class='covered'> parseBlock = extra.parseBlock;</span>
|
3484
|
+
<span class='covered'> parseFunctionSourceElements = extra.parseFunctionSourceElements;</span>
|
3485
|
+
<span class='covered'> parseCallMember = extra.parseCallMember;</span>
|
3486
|
+
<span class='covered'> parseCatchClause = extra.parseCatchClause;</span>
|
3487
|
+
<span class='covered'> parseComputedMember = extra.parseComputedMember;</span>
|
3488
|
+
<span class='covered'> parseConditionalExpression = extra.parseConditionalExpression;</span>
|
3489
|
+
<span class='covered'> parseConstLetDeclaration = extra.parseConstLetDeclaration;</span>
|
3490
|
+
<span class='covered'> parseEqualityExpression = extra.parseEqualityExpression;</span>
|
3491
|
+
<span class='covered'> parseExpression = extra.parseExpression;</span>
|
3492
|
+
<span class='covered'> parseForVariableDeclaration = extra.parseForVariableDeclaration;</span>
|
3493
|
+
<span class='covered'> parseFunctionDeclaration = extra.parseFunctionDeclaration;</span>
|
3494
|
+
<span class='covered'> parseFunctionExpression = extra.parseFunctionExpression;</span>
|
3495
|
+
<span class='covered'> parseLogicalANDExpression = extra.parseLogicalANDExpression;</span>
|
3496
|
+
<span class='covered'> parseLogicalORExpression = extra.parseLogicalORExpression;</span>
|
3497
|
+
<span class='covered'> parseMultiplicativeExpression = extra.parseMultiplicativeExpression;</span>
|
3498
|
+
<span class='covered'> parseNewExpression = extra.parseNewExpression;</span>
|
3499
|
+
<span class='covered'> parseNonComputedMember = extra.parseNonComputedMember;</span>
|
3500
|
+
<span class='covered'> parseNonComputedProperty = extra.parseNonComputedProperty;</span>
|
3501
|
+
<span class='covered'> parseObjectProperty = extra.parseObjectProperty;</span>
|
3502
|
+
<span class='covered'> parseObjectPropertyKey = extra.parseObjectPropertyKey;</span>
|
3503
|
+
<span class='covered'> parsePrimaryExpression = extra.parsePrimaryExpression;</span>
|
3504
|
+
<span class='covered'> parsePostfixExpression = extra.parsePostfixExpression;</span>
|
3505
|
+
<span class='covered'> parseProgram = extra.parseProgram;</span>
|
3506
|
+
<span class='covered'> parsePropertyFunction = extra.parsePropertyFunction;</span>
|
3507
|
+
<span class='covered'> parseRelationalExpression = extra.parseRelationalExpression;</span>
|
3508
|
+
<span class='covered'> parseStatement = extra.parseStatement;</span>
|
3509
|
+
<span class='covered'> parseShiftExpression = extra.parseShiftExpression;</span>
|
3510
|
+
<span class='covered'> parseSwitchCase = extra.parseSwitchCase;</span>
|
3511
|
+
<span class='covered'> parseUnaryExpression = extra.parseUnaryExpression;</span>
|
3512
|
+
<span class='covered'> parseVariableDeclaration = extra.parseVariableDeclaration;</span>
|
3513
|
+
<span class='covered'> parseVariableIdentifier = extra.parseVariableIdentifier;</span>
|
3514
|
+
<span class='covered'> }</span>
|
3515
|
+
<span class='covered'> </span>
|
3516
|
+
<span class='covered'> if (typeof extra.scanRegExp === 'function') {</span>
|
3517
|
+
<span class='covered'> advance = extra.advance;</span>
|
3518
|
+
<span class='covered'> scanRegExp = extra.scanRegExp;</span>
|
3519
|
+
<span class='covered'> }</span>
|
3520
|
+
<span class='covered'> }</span>
|
3521
|
+
<span class='covered'> </span>
|
3522
|
+
<span class='covered'> function stringToArray(str) {</span>
|
3523
|
+
<span class='uncovered'> var length = str.length,</span>
|
3524
|
+
<span class='uncovered'> result = [],</span>
|
3525
|
+
<span class='uncovered'> i;</span>
|
3526
|
+
<span class='uncovered'> for (i = 0; i < length; ++i) {</span>
|
3527
|
+
<span class='uncovered'> result[i] = str.charAt(i);</span>
|
3528
|
+
<span class='covered'> }</span>
|
3529
|
+
<span class='uncovered'> return result;</span>
|
3530
|
+
<span class='covered'> }</span>
|
3531
|
+
<span class='covered'> </span>
|
3532
|
+
<span class='covered'> function parse(code, options) {</span>
|
3533
|
+
<span class='covered'> var program, toString;</span>
|
3534
|
+
<span class='covered'> </span>
|
3535
|
+
<span class='covered'> toString = String;</span>
|
3536
|
+
<span class='covered'> if (typeof code !== 'string' && !(code instanceof String)) {</span>
|
3537
|
+
<span class='covered'> code = toString(code);</span>
|
3538
|
+
<span class='covered'> }</span>
|
3539
|
+
<span class='covered'> </span>
|
3540
|
+
<span class='covered'> source = code;</span>
|
3541
|
+
<span class='covered'> index = 0;</span>
|
3542
|
+
<span class='covered'> lineNumber = (source.length > 0) ? 1 : 0;</span>
|
3543
|
+
<span class='covered'> lineStart = 0;</span>
|
3544
|
+
<span class='covered'> length = source.length;</span>
|
3545
|
+
<span class='covered'> buffer = null;</span>
|
3546
|
+
<span class='covered'> allowIn = true;</span>
|
3547
|
+
<span class='covered'> labelSet = {};</span>
|
3548
|
+
<span class='covered'> inSwitch = false;</span>
|
3549
|
+
<span class='covered'> inIteration = false;</span>
|
3550
|
+
<span class='covered'> lastParenthesized = null;</span>
|
3551
|
+
<span class='covered'> inFunctionBody = false;</span>
|
3552
|
+
<span class='covered'> </span>
|
3553
|
+
<span class='covered'> extra = {};</span>
|
3554
|
+
<span class='covered'> if (typeof options !== 'undefined') {</span>
|
3555
|
+
<span class='covered'> extra.range = (typeof options.range === 'boolean') && options.range;</span>
|
3556
|
+
<span class='covered'> extra.loc = (typeof options.loc === 'boolean') && options.loc;</span>
|
3557
|
+
<span class='covered'> extra.raw = (typeof options.raw === 'boolean') && options.raw;</span>
|
3558
|
+
<span class='covered'> if (typeof options.tokens === 'boolean' && options.tokens) {</span>
|
3559
|
+
<span class='covered'> extra.tokens = [];</span>
|
3560
|
+
<span class='covered'> }</span>
|
3561
|
+
<span class='covered'> if (typeof options.comment === 'boolean' && options.comment) {</span>
|
3562
|
+
<span class='covered'> extra.comments = [];</span>
|
3563
|
+
<span class='covered'> }</span>
|
3564
|
+
<span class='covered'> if (typeof options.tolerant === 'boolean' && options.tolerant) {</span>
|
3565
|
+
<span class='covered'> extra.errors = [];</span>
|
3566
|
+
<span class='covered'> }</span>
|
3567
|
+
<span class='covered'> }</span>
|
3568
|
+
<span class='covered'> </span>
|
3569
|
+
<span class='covered'> if (length > 0) {</span>
|
3570
|
+
<span class='covered'> if (typeof source[0] === 'undefined') {</span>
|
3571
|
+
<span class='covered'> // Try first to convert to a string. This is good as fast path</span>
|
3572
|
+
<span class='covered'> // for old IE which understands string indexing for string</span>
|
3573
|
+
<span class='covered'> // literals only and not for string object.</span>
|
3574
|
+
<span class='uncovered'> if (code instanceof String) {</span>
|
3575
|
+
<span class='uncovered'> source = code.valueOf();</span>
|
3576
|
+
<span class='covered'> }</span>
|
3577
|
+
<span class='covered'> </span>
|
3578
|
+
<span class='covered'> // Force accessing the characters via an array.</span>
|
3579
|
+
<span class='uncovered'> if (typeof source[0] === 'undefined') {</span>
|
3580
|
+
<span class='uncovered'> source = stringToArray(code);</span>
|
3581
|
+
<span class='covered'> }</span>
|
3582
|
+
<span class='covered'> }</span>
|
3583
|
+
<span class='covered'> }</span>
|
3584
|
+
<span class='covered'> </span>
|
3585
|
+
<span class='covered'> patch();</span>
|
3586
|
+
<span class='covered'> try {</span>
|
3587
|
+
<span class='covered'> program = parseProgram();</span>
|
3588
|
+
<span class='covered'> if (typeof extra.comments !== 'undefined') {</span>
|
3589
|
+
<span class='covered'> program.comments = extra.comments;</span>
|
3590
|
+
<span class='covered'> }</span>
|
3591
|
+
<span class='covered'> if (typeof extra.tokens !== 'undefined') {</span>
|
3592
|
+
<span class='covered'> program.tokens = extra.tokens;</span>
|
3593
|
+
<span class='covered'> }</span>
|
3594
|
+
<span class='covered'> if (typeof extra.errors !== 'undefined') {</span>
|
3595
|
+
<span class='covered'> program.errors = extra.errors;</span>
|
3596
|
+
<span class='covered'> }</span>
|
3597
|
+
<span class='covered'> } catch (e) {</span>
|
3598
|
+
<span class='covered'> throw e;</span>
|
3599
|
+
<span class='covered'> } finally {</span>
|
3600
|
+
<span class='covered'> unpatch();</span>
|
3601
|
+
<span class='covered'> extra = {};</span>
|
3602
|
+
<span class='covered'> }</span>
|
3603
|
+
<span class='covered'> </span>
|
3604
|
+
<span class='covered'> return program;</span>
|
3605
|
+
<span class='covered'> }</span>
|
3606
|
+
<span class='covered'> </span>
|
3607
|
+
<span class='covered'> // Sync with package.json.</span>
|
3608
|
+
<span class='covered'> exports.version = '0.9.9-dev';</span>
|
3609
|
+
<span class='covered'> </span>
|
3610
|
+
<span class='covered'> exports.parse = parse;</span>
|
3611
|
+
<span class='covered'> </span>
|
3612
|
+
<span class='partial'> }(typeof exports === 'undefined' ? <span class='partialuncovered'>(esprima = {}) </span>: exports));</span>
|
3613
|
+
<span class='covered'> /* vim: set sw=4 ts=4 et tw=80 : */</span></pre></td>
|
3614
|
+
</pre>
|
3615
|
+
</div>
|
3616
|
+
</body>
|
3617
|
+
</html>
|