opal 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codeclimate.yml +19 -0
- data/.gitmodules +1 -1
- data/.jshintrc +1 -2
- data/.rspec +1 -2
- data/.travis.yml +42 -20
- data/.yardopts +3 -1
- data/CHANGELOG.md +164 -1
- data/Gemfile +16 -9
- data/HACKING.md +4 -2
- data/README.md +11 -11
- data/Rakefile +1 -1
- data/appveyor.yml +29 -0
- data/benchmark/bm_constant_lookup_big.rb +799 -0
- data/benchmark/bm_constant_lookup_small.rb +59 -0
- data/benchmark/bm_module_definition_big.rb +400 -0
- data/benchmark/bm_module_definition_small.rb +30 -0
- data/benchmark-ips/bm_case.rb +33 -0
- data/benchmark-ips/bm_constants_lookup.rb +13 -0
- data/benchmark-ips/bm_is_number.rb +29 -0
- data/benchmark-ips/bm_symbol_to_proc.rb +19 -0
- data/bin +1 -0
- data/docs/compiled_ruby.md +16 -14
- data/docs/faq.md +3 -3
- data/docs/headless_chrome.md +105 -0
- data/docs/rspec.md +4 -20
- data/docs/unsupported_features.md +6 -4
- data/examples/rack/Gemfile +1 -0
- data/examples/rack/Gemfile.lock +11 -7
- data/examples/rack/app/application.rb +14 -3
- data/examples/rack/app/user.rb +2 -0
- data/examples/rack/config.ru +1 -1
- data/examples/rack/index.html.erb +1 -0
- data/examples/sinatra/Gemfile +1 -1
- data/examples/sinatra/Gemfile.lock +8 -11
- data/examples/sinatra/app/application.rb +2 -0
- data/{bin → exe}/opal +4 -2
- data/{bin → exe}/opal-repl +23 -1
- data/lib/opal/ast/builder.rb +13 -0
- data/lib/opal/ast/node.rb +30 -0
- data/lib/opal/builder.rb +82 -17
- data/lib/opal/builder_processors.rb +9 -7
- data/lib/opal/cli.rb +45 -59
- data/lib/opal/cli_options.rb +19 -12
- data/lib/opal/cli_runners/applescript.rb +3 -4
- data/lib/opal/cli_runners/chrome.js +135 -0
- data/lib/opal/cli_runners/chrome.rb +100 -0
- data/lib/opal/cli_runners/nashorn.rb +1 -1
- data/lib/opal/cli_runners/node_modules/.bin/chrome-remote-interface +1 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/LICENSE +18 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/README.md +843 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/bin/client.js +326 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/chrome-remote-interface.js +11 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/index.js +39 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/api.js +84 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/chrome.js +289 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/defaults.js +4 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/devtools.js +245 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/external-request.js +23 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/protocol.json +13303 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/lib/websocket-wrapper.js +32 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/package.json +128 -0
- data/lib/opal/cli_runners/node_modules/chrome-remote-interface/webpack.config.js +55 -0
- data/lib/opal/cli_runners/node_modules/commander/Readme.md +195 -0
- data/lib/opal/cli_runners/node_modules/commander/index.js +851 -0
- data/lib/opal/cli_runners/node_modules/commander/package.json +92 -0
- data/{stdlib/nodejs/node_modules/js-yaml/node_modules/argparse → lib/opal/cli_runners/node_modules/ultron}/LICENSE +7 -6
- data/lib/opal/cli_runners/node_modules/ultron/index.js +138 -0
- data/lib/opal/cli_runners/node_modules/ultron/package.json +112 -0
- data/{stdlib/nodejs/node_modules/js-yaml → lib/opal/cli_runners/node_modules/ws}/LICENSE +6 -6
- data/lib/opal/cli_runners/node_modules/ws/README.md +259 -0
- data/lib/opal/cli_runners/node_modules/ws/SECURITY.md +33 -0
- data/lib/opal/cli_runners/node_modules/ws/index.js +15 -0
- data/lib/opal/cli_runners/node_modules/ws/lib/BufferUtil.fallback.js +56 -0
- data/lib/opal/cli_runners/node_modules/ws/lib/BufferUtil.js +15 -0
- data/lib/opal/cli_runners/node_modules/ws/lib/ErrorCodes.js +28 -0
- data/lib/opal/cli_runners/node_modules/ws/lib/EventTarget.js +158 -0
- data/lib/opal/cli_runners/node_modules/ws/lib/Extensions.js +69 -0
- data/lib/opal/cli_runners/node_modules/ws/lib/PerMessageDeflate.js +339 -0
- data/lib/opal/cli_runners/node_modules/ws/lib/Receiver.js +520 -0
- data/lib/opal/cli_runners/node_modules/ws/lib/Sender.js +438 -0
- data/lib/opal/cli_runners/node_modules/ws/lib/Validation.fallback.js +9 -0
- data/lib/opal/cli_runners/node_modules/ws/lib/Validation.js +17 -0
- data/lib/opal/cli_runners/node_modules/ws/lib/WebSocket.js +705 -0
- data/lib/opal/cli_runners/node_modules/ws/lib/WebSocketServer.js +336 -0
- data/lib/opal/cli_runners/node_modules/ws/package.json +122 -0
- data/lib/opal/cli_runners/nodejs.rb +4 -2
- data/lib/opal/cli_runners/package.json +5 -0
- data/lib/opal/cli_runners/server.rb +1 -1
- data/lib/opal/cli_runners.rb +2 -1
- data/lib/opal/compiler.rb +136 -95
- data/lib/opal/config.rb +114 -36
- data/lib/opal/deprecations.rb +18 -0
- data/lib/opal/eof_content.rb +36 -0
- data/lib/opal/erb.rb +1 -0
- data/lib/opal/errors.rb +1 -0
- data/lib/opal/fragment.rb +1 -0
- data/lib/opal/nodes/arglist.rb +2 -1
- data/lib/opal/nodes/args/initialize_kwargs.rb +1 -0
- data/lib/opal/nodes/args/kwarg.rb +9 -7
- data/lib/opal/nodes/args/kwoptarg.rb +13 -8
- data/lib/opal/nodes/args/kwrestarg.rb +5 -5
- data/lib/opal/nodes/args/mlhsarg.rb +3 -2
- data/lib/opal/nodes/args/normarg.rb +6 -7
- data/lib/opal/nodes/args/optarg.rb +5 -7
- data/lib/opal/nodes/args/post_args.rb +6 -5
- data/lib/opal/nodes/args/post_kwargs.rb +1 -0
- data/lib/opal/nodes/args/restarg.rb +7 -7
- data/lib/opal/nodes/array.rb +1 -0
- data/lib/opal/nodes/base.rb +24 -3
- data/lib/opal/nodes/call.rb +168 -155
- data/lib/opal/nodes/call_special.rb +37 -214
- data/lib/opal/nodes/case.rb +36 -22
- data/lib/opal/nodes/class.rb +4 -3
- data/lib/opal/nodes/constants.rb +28 -48
- data/lib/opal/nodes/csend.rb +25 -0
- data/lib/opal/nodes/def.rb +57 -17
- data/lib/opal/nodes/defined.rb +170 -60
- data/lib/opal/nodes/definitions.rb +42 -133
- data/lib/opal/nodes/defs.rb +29 -0
- data/lib/opal/nodes/hash.rb +12 -35
- data/lib/opal/nodes/helpers.rb +31 -62
- data/lib/opal/nodes/if.rb +21 -32
- data/lib/opal/nodes/inline_args.rb +12 -13
- data/lib/opal/nodes/iter.rb +61 -36
- data/lib/opal/nodes/literal.rb +206 -114
- data/lib/opal/nodes/logic.rb +39 -57
- data/lib/opal/nodes/masgn.rb +20 -18
- data/lib/opal/nodes/module.rb +10 -11
- data/lib/opal/nodes/node_with_args.rb +15 -18
- data/lib/opal/nodes/rescue.rb +37 -70
- data/lib/opal/nodes/runtime_helpers.rb +8 -3
- data/lib/opal/nodes/scope.rb +10 -5
- data/lib/opal/nodes/singleton_class.rb +4 -3
- data/lib/opal/nodes/super.rb +112 -88
- data/lib/opal/nodes/top.rb +7 -2
- data/lib/opal/nodes/variables.rb +57 -35
- data/lib/opal/nodes/while.rb +11 -1
- data/lib/opal/nodes/yield.rb +1 -17
- data/lib/opal/nodes.rb +3 -1
- data/lib/opal/parser.rb +29 -766
- data/lib/opal/path_reader.rb +22 -5
- data/lib/opal/paths.rb +10 -4
- data/lib/opal/regexp_anchors.rb +1 -0
- data/lib/opal/rewriter.rb +64 -0
- data/lib/opal/rewriters/base.rb +63 -0
- data/lib/opal/rewriters/binary_operator_assignment.rb +141 -0
- data/lib/opal/rewriters/block_to_iter.rb +17 -0
- data/lib/opal/rewriters/break_finder.rb +34 -0
- data/lib/opal/rewriters/dot_js_syntax.rb +60 -0
- data/lib/opal/rewriters/explicit_writer_return.rb +58 -0
- data/lib/opal/rewriters/for_rewriter.rb +93 -0
- data/lib/opal/rewriters/hashes/key_duplicates_rewriter.rb +58 -0
- data/lib/opal/rewriters/js_reserved_words.rb +108 -0
- data/lib/opal/rewriters/logical_operator_assignment.rb +154 -0
- data/lib/opal/rewriters/opal_engine_check.rb +42 -0
- data/lib/opal/rewriters/rubyspec/filters_rewriter.rb +67 -0
- data/lib/opal/server.rb +4 -0
- data/lib/opal/simple_server.rb +101 -0
- data/lib/opal/source_map.rb +1 -1
- data/lib/opal/util.rb +6 -6
- data/lib/opal/version.rb +2 -1
- data/lib/opal.rb +7 -1
- data/lib/tilt/opal.rb +1 -0
- data/opal/README.md +1 -1
- data/opal/corelib/array.rb +184 -107
- data/opal/corelib/basic_object.rb +6 -6
- data/opal/corelib/boolean.rb +11 -3
- data/opal/corelib/class.rb +14 -11
- data/opal/corelib/comparable.rb +16 -0
- data/opal/corelib/complex.rb +5 -1
- data/opal/corelib/constants.rb +3 -3
- data/opal/corelib/enumerable.rb +176 -11
- data/opal/corelib/error.rb +35 -17
- data/opal/corelib/file.rb +114 -176
- data/opal/corelib/hash.rb +226 -13
- data/opal/corelib/helpers.rb +12 -15
- data/opal/corelib/io.rb +3 -2
- data/opal/corelib/kernel.rb +68 -32
- data/opal/corelib/marshal/read_buffer.rb +288 -150
- data/opal/corelib/marshal/write_buffer.rb +27 -2
- data/opal/corelib/method.rb +33 -13
- data/opal/corelib/module.rb +134 -82
- data/opal/corelib/nil.rb +11 -3
- data/opal/corelib/number.rb +220 -34
- data/opal/corelib/numeric.rb +3 -11
- data/opal/corelib/process.rb +44 -4
- data/opal/corelib/random/seedrandom.js.rb +15 -0
- data/opal/corelib/random.rb +117 -0
- data/opal/corelib/range.rb +147 -24
- data/opal/corelib/regexp.rb +82 -13
- data/opal/corelib/runtime.js +623 -397
- data/opal/corelib/string/encoding.rb +67 -31
- data/opal/corelib/string/inheritance.rb +1 -1
- data/opal/corelib/string.rb +40 -9
- data/opal/corelib/struct.rb +18 -3
- data/opal/corelib/time.rb +3 -3
- data/opal/corelib/variables.rb +1 -1
- data/opal/opal.rb +1 -0
- data/opal.gemspec +32 -29
- data/stdlib/base64.rb +4 -2
- data/stdlib/bigdecimal/bignumber.js.rb +1 -1
- data/stdlib/buffer/array.rb +4 -2
- data/stdlib/date.rb +64 -31
- data/stdlib/headless_chrome.rb +11 -0
- data/stdlib/json.rb +16 -4
- data/stdlib/nashorn/file.rb +15 -0
- data/stdlib/native.rb +21 -12
- data/stdlib/nodejs/dir.rb +1 -1
- data/stdlib/nodejs/file.rb +77 -23
- data/stdlib/nodejs/io.rb +30 -1
- data/stdlib/nodejs/{node_modules/js-yaml/dist/js-yaml.js → js-yaml-3-6-1.js} +815 -626
- data/stdlib/nodejs/kernel.rb +3 -1
- data/stdlib/nodejs/package.json +0 -1
- data/stdlib/nodejs/stacktrace.rb +179 -0
- data/stdlib/nodejs/yaml.rb +2 -1
- data/stdlib/opal/platform.rb +6 -14
- data/stdlib/opal-builder.rb +1 -0
- data/stdlib/opal-platform.rb +15 -0
- data/stdlib/pathname.rb +1 -1
- data/stdlib/rbconfig.rb +1 -1
- data/stdlib/securerandom.rb +1 -1
- data/stdlib/strscan.rb +15 -1
- data/stdlib/yaml.rb +1 -1
- data/tasks/benchmarking.rake +9 -0
- data/tasks/building.rake +24 -20
- data/tasks/linting.rake +24 -13
- data/tasks/testing/mspec_special_calls.rb +44 -15
- data/tasks/testing/opal_rspec_smoketest.Gemfile +6 -0
- data/tasks/testing.rake +351 -202
- metadata +135 -915
- data/lib/opal/cli_runners/phantom.js +0 -70
- data/lib/opal/cli_runners/phantomjs.rb +0 -28
- data/lib/opal/hike_path_finder.rb +0 -18
- data/lib/opal/nodes/for.rb +0 -48
- data/lib/opal/parser/grammar.rb +0 -6157
- data/lib/opal/parser/grammar.y +0 -2011
- data/lib/opal/parser/keywords.rb +0 -66
- data/lib/opal/parser/lexer.rb +0 -1352
- data/lib/opal/parser/parser_scope.rb +0 -28
- data/lib/opal/parser/sexp.rb +0 -90
- data/lib/opal/sprockets/environment.rb +0 -23
- data/lib/opal/sprockets/erb.rb +0 -23
- data/lib/opal/sprockets/path_reader.rb +0 -36
- data/lib/opal/sprockets/processor.rb +0 -145
- data/lib/opal/sprockets/server.rb +0 -133
- data/lib/opal/sprockets/source_map_header_patch.rb +0 -41
- data/lib/opal/sprockets/source_map_server.rb +0 -115
- data/lib/opal/sprockets.rb +0 -91
- data/spec/README.md +0 -10
- data/spec/filters/bugs/array.rb +0 -12
- data/spec/filters/bugs/basicobject.rb +0 -16
- data/spec/filters/bugs/bigdecimal.rb +0 -160
- data/spec/filters/bugs/class.rb +0 -10
- data/spec/filters/bugs/compiler_opal.rb +0 -5
- data/spec/filters/bugs/complex.rb +0 -3
- data/spec/filters/bugs/date.rb +0 -94
- data/spec/filters/bugs/enumerable.rb +0 -50
- data/spec/filters/bugs/enumerator.rb +0 -42
- data/spec/filters/bugs/exception.rb +0 -58
- data/spec/filters/bugs/float.rb +0 -33
- data/spec/filters/bugs/hash.rb +0 -11
- data/spec/filters/bugs/inheritance.rb +0 -5
- data/spec/filters/bugs/integer.rb +0 -28
- data/spec/filters/bugs/kernel.rb +0 -297
- data/spec/filters/bugs/language.rb +0 -275
- data/spec/filters/bugs/language_opal.rb +0 -88
- data/spec/filters/bugs/marshal.rb +0 -43
- data/spec/filters/bugs/method.rb +0 -84
- data/spec/filters/bugs/module.rb +0 -196
- data/spec/filters/bugs/numeric.rb +0 -127
- data/spec/filters/bugs/pathname.rb +0 -5
- data/spec/filters/bugs/proc.rb +0 -36
- data/spec/filters/bugs/range.rb +0 -144
- data/spec/filters/bugs/rational.rb +0 -4
- data/spec/filters/bugs/regexp.rb +0 -196
- data/spec/filters/bugs/set.rb +0 -42
- data/spec/filters/bugs/singleton.rb +0 -6
- data/spec/filters/bugs/string.rb +0 -101
- data/spec/filters/bugs/stringscanner.rb +0 -79
- data/spec/filters/bugs/struct.rb +0 -4
- data/spec/filters/bugs/time.rb +0 -29
- data/spec/filters/bugs/unboundmethod.rb +0 -27
- data/spec/filters/unsupported/array.rb +0 -163
- data/spec/filters/unsupported/basicobject.rb +0 -14
- data/spec/filters/unsupported/bignum.rb +0 -52
- data/spec/filters/unsupported/class.rb +0 -4
- data/spec/filters/unsupported/delegator.rb +0 -5
- data/spec/filters/unsupported/enumerable.rb +0 -11
- data/spec/filters/unsupported/enumerator.rb +0 -13
- data/spec/filters/unsupported/fixnum.rb +0 -14
- data/spec/filters/unsupported/float.rb +0 -43
- data/spec/filters/unsupported/freeze.rb +0 -53
- data/spec/filters/unsupported/hash.rb +0 -51
- data/spec/filters/unsupported/integer.rb +0 -3
- data/spec/filters/unsupported/kernel.rb +0 -31
- data/spec/filters/unsupported/language.rb +0 -17
- data/spec/filters/unsupported/marshal.rb +0 -46
- data/spec/filters/unsupported/matchdata.rb +0 -30
- data/spec/filters/unsupported/math.rb +0 -3
- data/spec/filters/unsupported/module.rb +0 -8
- data/spec/filters/unsupported/pathname.rb +0 -3
- data/spec/filters/unsupported/privacy.rb +0 -147
- data/spec/filters/unsupported/proc.rb +0 -3
- data/spec/filters/unsupported/regexp.rb +0 -59
- data/spec/filters/unsupported/set.rb +0 -4
- data/spec/filters/unsupported/singleton.rb +0 -6
- data/spec/filters/unsupported/string.rb +0 -537
- data/spec/filters/unsupported/struct.rb +0 -6
- data/spec/filters/unsupported/symbol.rb +0 -19
- data/spec/filters/unsupported/taint.rb +0 -15
- data/spec/filters/unsupported/thread.rb +0 -7
- data/spec/filters/unsupported/time.rb +0 -202
- data/spec/lib/builder_processors_spec.rb +0 -27
- data/spec/lib/builder_spec.rb +0 -72
- data/spec/lib/cli_runners/phantomjs_spec.rb +0 -39
- data/spec/lib/cli_spec.rb +0 -211
- data/spec/lib/compiler/call_spec.rb +0 -700
- data/spec/lib/compiler/pre_processed_conditionals_spec.rb +0 -87
- data/spec/lib/compiler_spec.rb +0 -285
- data/spec/lib/config_spec.rb +0 -13
- data/spec/lib/dependency_resolver_spec.rb +0 -40
- data/spec/lib/fixtures/complex_sprockets.js.rb.erb +0 -4
- data/spec/lib/fixtures/file_with_directives.js +0 -2
- data/spec/lib/fixtures/jst_file.js.jst +0 -1
- data/spec/lib/fixtures/no_requires.rb +0 -1
- data/spec/lib/fixtures/opal_file.rb +0 -2
- data/spec/lib/fixtures/require_tree_test.rb +0 -3
- data/spec/lib/fixtures/required_file.js +0 -1
- data/spec/lib/fixtures/required_tree_test/required_file1.rb +0 -1
- data/spec/lib/fixtures/required_tree_test/required_file2.rb +0 -1
- data/spec/lib/fixtures/requires.rb +0 -7
- data/spec/lib/fixtures/source_map/subfolder/other_file.rb +0 -1
- data/spec/lib/fixtures/source_map.rb +0 -1
- data/spec/lib/fixtures/sprockets_file.js.rb +0 -3
- data/spec/lib/fixtures/sprockets_require_tree_test.rb +0 -3
- data/spec/lib/hike_path_finder_spec.rb +0 -23
- data/spec/lib/lexer_spec.rb +0 -110
- data/spec/lib/parser/alias_spec.rb +0 -26
- data/spec/lib/parser/and_spec.rb +0 -13
- data/spec/lib/parser/aref_spec.rb +0 -10
- data/spec/lib/parser/attrasgn_spec.rb +0 -28
- data/spec/lib/parser/begin_spec.rb +0 -42
- data/spec/lib/parser/block_spec.rb +0 -12
- data/spec/lib/parser/break_spec.rb +0 -17
- data/spec/lib/parser/call_spec.rb +0 -201
- data/spec/lib/parser/class_spec.rb +0 -35
- data/spec/lib/parser/comments_spec.rb +0 -11
- data/spec/lib/parser/def_spec.rb +0 -109
- data/spec/lib/parser/if_spec.rb +0 -26
- data/spec/lib/parser/iter_spec.rb +0 -59
- data/spec/lib/parser/lambda_spec.rb +0 -219
- data/spec/lib/parser/literal_spec.rb +0 -118
- data/spec/lib/parser/masgn_spec.rb +0 -37
- data/spec/lib/parser/module_spec.rb +0 -27
- data/spec/lib/parser/not_spec.rb +0 -21
- data/spec/lib/parser/op_asgn1_spec.rb +0 -23
- data/spec/lib/parser/op_asgn2_spec.rb +0 -23
- data/spec/lib/parser/op_asgn_spec.rb +0 -17
- data/spec/lib/parser/or_spec.rb +0 -13
- data/spec/lib/parser/return_spec.rb +0 -22
- data/spec/lib/parser/sclass_spec.rb +0 -21
- data/spec/lib/parser/string_spec.rb +0 -286
- data/spec/lib/parser/super_spec.rb +0 -20
- data/spec/lib/parser/unary_spec.rb +0 -52
- data/spec/lib/parser/undef_spec.rb +0 -19
- data/spec/lib/parser/unless_spec.rb +0 -13
- data/spec/lib/parser/variables_spec.rb +0 -116
- data/spec/lib/parser/while_spec.rb +0 -15
- data/spec/lib/parser/yield_spec.rb +0 -20
- data/spec/lib/path_reader_spec.rb +0 -36
- data/spec/lib/paths_spec.rb +0 -18
- data/spec/lib/shared/path_finder_shared.rb +0 -19
- data/spec/lib/shared/path_reader_shared.rb +0 -31
- data/spec/lib/spec_helper.rb +0 -16
- data/spec/lib/sprockets/erb_spec.rb +0 -38
- data/spec/lib/sprockets/path_reader_spec.rb +0 -41
- data/spec/lib/sprockets/processor_spec.rb +0 -79
- data/spec/lib/sprockets/server_spec.rb +0 -102
- data/spec/lib/sprockets_spec.rb +0 -32
- data/spec/lib/tilt/opal_spec.rb +0 -37
- data/spec/mspec-opal/formatters.rb +0 -188
- data/spec/mspec-opal/runner.rb +0 -193
- data/spec/opal/compiler/irb_spec.rb +0 -44
- data/spec/opal/core/arity_spec.rb +0 -142
- data/spec/opal/core/array/intersection_spec.rb +0 -38
- data/spec/opal/core/array/minus_spec.rb +0 -38
- data/spec/opal/core/array/select_spec.rb +0 -14
- data/spec/opal/core/array/set_range_to_array_spec.rb +0 -7
- data/spec/opal/core/array/union_spec.rb +0 -38
- data/spec/opal/core/array/uniq_spec.rb +0 -49
- data/spec/opal/core/date_spec.rb +0 -177
- data/spec/opal/core/enumerable/all_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/any_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/collect_break_spec.rb +0 -13
- data/spec/opal/core/enumerable/count_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/detect_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/drop_while_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/each_slice_break.rb +0 -6
- data/spec/opal/core/enumerable/each_with_index_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/each_with_object_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/find_all_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/find_index_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/grep_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/max_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/max_by_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/min_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/min_by_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/none_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/one_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/reduce_break_spec.rb +0 -5
- data/spec/opal/core/enumerable/take_while_break_spec.rb +0 -5
- data/spec/opal/core/enumerator/with_index_spec.rb +0 -6
- data/spec/opal/core/exception_spec.rb +0 -20
- data/spec/opal/core/fixtures/class.rb +0 -124
- data/spec/opal/core/fixtures/class_variables.rb +0 -0
- data/spec/opal/core/fixtures/constants.rb +0 -33
- data/spec/opal/core/fixtures/require_tree_files/file 1.rb +0 -1
- data/spec/opal/core/fixtures/require_tree_files/file 2.rb +0 -1
- data/spec/opal/core/fixtures/require_tree_files/file 3.rb +0 -1
- data/spec/opal/core/fixtures/require_tree_files/file 4.rb +0 -1
- data/spec/opal/core/fixtures/require_tree_files/file 5.rb +0 -1
- data/spec/opal/core/fixtures/require_tree_files/nested/nested 1.rb +0 -1
- data/spec/opal/core/fixtures/require_tree_files/nested/nested 2.rb +0 -1
- data/spec/opal/core/fixtures/require_tree_files/other/other 1.rb +0 -1
- data/spec/opal/core/fixtures/require_tree_with_dot/file 1.rb +0 -1
- data/spec/opal/core/fixtures/require_tree_with_dot/file 2.rb +0 -1
- data/spec/opal/core/fixtures/require_tree_with_dot/file 3.rb +0 -1
- data/spec/opal/core/fixtures/require_tree_with_dot/index.rb +0 -3
- data/spec/opal/core/hash/has_value_spec.rb +0 -13
- data/spec/opal/core/hash/internals_spec.rb +0 -332
- data/spec/opal/core/helpers_spec.rb +0 -14
- data/spec/opal/core/kernel/Array_spec.rb +0 -10
- data/spec/opal/core/kernel/at_exit_spec.rb +0 -70
- data/spec/opal/core/kernel/block_given_spec.rb +0 -30
- data/spec/opal/core/kernel/class_spec.rb +0 -6
- data/spec/opal/core/kernel/define_singleton_method_spec.rb +0 -21
- data/spec/opal/core/kernel/equal_value_spec.rb +0 -12
- data/spec/opal/core/kernel/extend_spec.rb +0 -21
- data/spec/opal/core/kernel/format_spec.rb +0 -122
- data/spec/opal/core/kernel/freeze_spec.rb +0 -15
- data/spec/opal/core/kernel/instance_eval_spec.rb +0 -28
- data/spec/opal/core/kernel/instance_variable_defined_spec.rb +0 -15
- data/spec/opal/core/kernel/instance_variable_get_spec.rb +0 -14
- data/spec/opal/core/kernel/instance_variable_set_spec.rb +0 -10
- data/spec/opal/core/kernel/instance_variables_spec.rb +0 -110
- data/spec/opal/core/kernel/loop_spec.rb +0 -23
- data/spec/opal/core/kernel/match_spec.rb +0 -5
- data/spec/opal/core/kernel/method_spec.rb +0 -31
- data/spec/opal/core/kernel/methods_spec.rb +0 -25
- data/spec/opal/core/kernel/nil_spec.rb +0 -7
- data/spec/opal/core/kernel/p_spec.rb +0 -15
- data/spec/opal/core/kernel/printf_spec.rb +0 -11
- data/spec/opal/core/kernel/proc_spec.rb +0 -13
- data/spec/opal/core/kernel/raise_spec.rb +0 -13
- data/spec/opal/core/kernel/rand_spec.rb +0 -23
- data/spec/opal/core/kernel/require_tree_spec.rb +0 -18
- data/spec/opal/core/kernel/respond_to_spec.rb +0 -41
- data/spec/opal/core/kernel/send_spec.rb +0 -56
- data/spec/opal/core/kernel/sprintf_spec.rb +0 -5
- data/spec/opal/core/language/arguments/mlhs_arg_spec.rb +0 -19
- data/spec/opal/core/language/block_spec.rb +0 -538
- data/spec/opal/core/language/class_spec.rb +0 -55
- data/spec/opal/core/language/equal_spec.rb +0 -8
- data/spec/opal/core/language/fixtures/array.rb +0 -11
- data/spec/opal/core/language/fixtures/block.rb +0 -57
- data/spec/opal/core/language/fixtures/break.rb +0 -240
- data/spec/opal/core/language/fixtures/ensure.rb +0 -72
- data/spec/opal/core/language/fixtures/literal_lambda.rb +0 -7
- data/spec/opal/core/language/fixtures/metaclass.rb +0 -33
- data/spec/opal/core/language/fixtures/module.rb +0 -24
- data/spec/opal/core/language/fixtures/next.rb +0 -128
- data/spec/opal/core/language/fixtures/return.rb +0 -118
- data/spec/opal/core/language/fixtures/send.rb +0 -111
- data/spec/opal/core/language/fixtures/send_1.9.rb +0 -22
- data/spec/opal/core/language/fixtures/super.rb +0 -308
- data/spec/opal/core/language/fixtures/variables.rb +0 -58
- data/spec/opal/core/language/fixtures/yield.rb +0 -28
- data/spec/opal/core/language/heredoc_spec.rb +0 -42
- data/spec/opal/core/language/keyword_arguments_spec.rb +0 -11
- data/spec/opal/core/language/predefined_spec.rb +0 -138
- data/spec/opal/core/language/proc_spec.rb +0 -263
- data/spec/opal/core/language/regexp_spec.rb +0 -20
- data/spec/opal/core/language/rescue_spec.rb +0 -18
- data/spec/opal/core/language/send_spec.rb +0 -230
- data/spec/opal/core/language/string_spec.rb +0 -44
- data/spec/opal/core/language/ternary_operator_spec.rb +0 -20
- data/spec/opal/core/language/variables_spec.rb +0 -1366
- data/spec/opal/core/language/versions/array_1.9.rb +0 -39
- data/spec/opal/core/language/versions/block_1.9.rb +0 -0
- data/spec/opal/core/language/versions/break_1.9.rb +0 -0
- data/spec/opal/core/language/versions/case_1.9.rb +0 -20
- data/spec/opal/core/language/versions/def_2_0_spec.rb +0 -62
- data/spec/opal/core/language/versions/hash_1_9_spec.rb +0 -23
- data/spec/opal/core/language/versions/literal_lambda_1.9.rb +0 -143
- data/spec/opal/core/language/versions/not_1.9.rb +0 -22
- data/spec/opal/core/language/versions/send_1.9.rb +0 -241
- data/spec/opal/core/language/versions/symbol_1.9.rb +0 -15
- data/spec/opal/core/language/versions/variables_1.9.rb +0 -8
- data/spec/opal/core/language_spec.rb +0 -45
- data/spec/opal/core/marshal/dump_spec.rb +0 -53
- data/spec/opal/core/marshal/load_spec.rb +0 -7
- data/spec/opal/core/method/to_proc_spec.rb +0 -28
- data/spec/opal/core/module/alias_method_spec.rb +0 -28
- data/spec/opal/core/module/ancestors_spec.rb +0 -11
- data/spec/opal/core/module/append_features_spec.rb +0 -14
- data/spec/opal/core/module/attr_accessor_spec.rb +0 -26
- data/spec/opal/core/module/const_defined_spec.rb +0 -84
- data/spec/opal/core/module/const_get_spec.rb +0 -85
- data/spec/opal/core/module/const_missing_spec.rb +0 -17
- data/spec/opal/core/module/const_set_spec.rb +0 -64
- data/spec/opal/core/module/constants_spec.rb +0 -49
- data/spec/opal/core/module/fixtures/classes.rb +0 -444
- data/spec/opal/core/module/method_defined_spec.rb +0 -48
- data/spec/opal/core/module/method_lookup_spec.rb +0 -13
- data/spec/opal/core/module/module_function_spec.rb +0 -25
- data/spec/opal/core/module/name_spec.rb +0 -41
- data/spec/opal/core/module/public_method_defined_spec.rb +0 -18
- data/spec/opal/core/module/remove_const_spec.rb +0 -22
- data/spec/opal/core/module/undef_method_spec.rb +0 -66
- data/spec/opal/core/numeric/bit_and_spec.rb +0 -7
- data/spec/opal/core/numeric/bit_or_spec.rb +0 -8
- data/spec/opal/core/numeric/bit_xor_spec.rb +0 -6
- data/spec/opal/core/numeric/ceil_spec.rb +0 -8
- data/spec/opal/core/numeric/chr_spec.rb +0 -8
- data/spec/opal/core/numeric/comparison_spec.rb +0 -24
- data/spec/opal/core/numeric/complement_spec.rb +0 -8
- data/spec/opal/core/numeric/divide_spec.rb +0 -10
- data/spec/opal/core/numeric/eql_spec.rb +0 -9
- data/spec/opal/core/numeric/exponent_spec.rb +0 -33
- data/spec/opal/core/numeric/floor_spec.rb +0 -8
- data/spec/opal/core/numeric/gt_spec.rb +0 -11
- data/spec/opal/core/numeric/gte_spec.rb +0 -12
- data/spec/opal/core/numeric/integer_spec.rb +0 -9
- data/spec/opal/core/numeric/left_shift_spec.rb +0 -21
- data/spec/opal/core/numeric/lt_spec.rb +0 -11
- data/spec/opal/core/numeric/lte_spec.rb +0 -12
- data/spec/opal/core/numeric/minus_spec.rb +0 -8
- data/spec/opal/core/numeric/modulo_spec.rb +0 -19
- data/spec/opal/core/numeric/multiply_spec.rb +0 -9
- data/spec/opal/core/numeric/next_spec.rb +0 -9
- data/spec/opal/core/numeric/ord_spec.rb +0 -9
- data/spec/opal/core/numeric/plus_spec.rb +0 -8
- data/spec/opal/core/numeric/pred_spec.rb +0 -7
- data/spec/opal/core/numeric/right_shift_spec.rb +0 -25
- data/spec/opal/core/numeric/step_spec.rb +0 -11
- data/spec/opal/core/numeric/succ_spec.rb +0 -9
- data/spec/opal/core/numeric/times_spec.rb +0 -36
- data/spec/opal/core/numeric/to_f_spec.rb +0 -7
- data/spec/opal/core/numeric/to_i_spec.rb +0 -7
- data/spec/opal/core/numeric/to_json_spec.rb +0 -8
- data/spec/opal/core/numeric/to_s_spec.rb +0 -26
- data/spec/opal/core/numeric/uminus_spec.rb +0 -9
- data/spec/opal/core/numeric/upto_spec.rb +0 -19
- data/spec/opal/core/numeric/zero_spec.rb +0 -7
- data/spec/opal/core/object_id_spec.rb +0 -56
- data/spec/opal/core/proc/call_spec.rb +0 -21
- data/spec/opal/core/proc/element_reference_spec.rb +0 -21
- data/spec/opal/core/proc/proc_tricks_spec.rb +0 -7
- data/spec/opal/core/runtime/begin_spec.rb +0 -39
- data/spec/opal/core/runtime/block_send_spec.rb +0 -28
- data/spec/opal/core/runtime/block_spec.rb +0 -23
- data/spec/opal/core/runtime/bridged_classes_spec.rb +0 -123
- data/spec/opal/core/runtime/constants_spec.rb +0 -13
- data/spec/opal/core/runtime/donate_spec.rb +0 -53
- data/spec/opal/core/runtime/eval_spec.rb +0 -5
- data/spec/opal/core/runtime/main_methods_spec.rb +0 -27
- data/spec/opal/core/runtime/method_missing_spec.rb +0 -68
- data/spec/opal/core/runtime/method_spec.rb +0 -31
- data/spec/opal/core/runtime/operator_call_spec.rb +0 -13
- data/spec/opal/core/runtime/paren_spec.rb +0 -14
- data/spec/opal/core/runtime/rescue_spec.rb +0 -71
- data/spec/opal/core/runtime/return_spec.rb +0 -38
- data/spec/opal/core/runtime/send_spec.rb +0 -34
- data/spec/opal/core/runtime/singleton_class_spec.rb +0 -13
- data/spec/opal/core/runtime/super_spec.rb +0 -223
- data/spec/opal/core/runtime/truthy_spec.rb +0 -63
- data/spec/opal/core/runtime/variables_spec.rb +0 -20
- data/spec/opal/core/runtime_spec.rb +0 -58
- data/spec/opal/core/source_map_spec.rb +0 -49
- data/spec/opal/core/string_spec.rb +0 -32
- data/spec/opal/javascript_api_spec.rb +0 -16
- data/spec/opal/stdlib/erb/erb_spec.rb +0 -30
- data/spec/opal/stdlib/erb/inline_block.opalerb +0 -3
- data/spec/opal/stdlib/erb/quoted.opalerb +0 -1
- data/spec/opal/stdlib/erb/simple.opalerb +0 -1
- data/spec/opal/stdlib/js_spec.rb +0 -66
- data/spec/opal/stdlib/json/ext_spec.rb +0 -48
- data/spec/opal/stdlib/json/parse_spec.rb +0 -33
- data/spec/opal/stdlib/native/alias_native_spec.rb +0 -27
- data/spec/opal/stdlib/native/array_spec.rb +0 -11
- data/spec/opal/stdlib/native/each_spec.rb +0 -13
- data/spec/opal/stdlib/native/element_reference_spec.rb +0 -16
- data/spec/opal/stdlib/native/exposure_spec.rb +0 -33
- data/spec/opal/stdlib/native/ext_spec.rb +0 -19
- data/spec/opal/stdlib/native/hash_spec.rb +0 -51
- data/spec/opal/stdlib/native/initialize_spec.rb +0 -17
- data/spec/opal/stdlib/native/method_missing_spec.rb +0 -51
- data/spec/opal/stdlib/native/native_alias_spec.rb +0 -19
- data/spec/opal/stdlib/native/native_class_spec.rb +0 -18
- data/spec/opal/stdlib/native/native_module_spec.rb +0 -13
- data/spec/opal/stdlib/native/native_reader_spec.rb +0 -22
- data/spec/opal/stdlib/native/native_writer_spec.rb +0 -30
- data/spec/opal/stdlib/native/new_spec.rb +0 -92
- data/spec/opal/stdlib/native/struct_spec.rb +0 -12
- data/spec/opal/stdlib/promise/always_spec.rb +0 -49
- data/spec/opal/stdlib/promise/error_spec.rb +0 -15
- data/spec/opal/stdlib/promise/rescue_spec.rb +0 -53
- data/spec/opal/stdlib/promise/then_spec.rb +0 -79
- data/spec/opal/stdlib/promise/trace_spec.rb +0 -51
- data/spec/opal/stdlib/promise/value_spec.rb +0 -15
- data/spec/opal/stdlib/promise/when_spec.rb +0 -34
- data/spec/opal/stdlib/source_map_spec.rb +0 -8
- data/spec/opal/stdlib/strscan/scan_spec.rb +0 -11
- data/spec/opal/stdlib/template/paths_spec.rb +0 -10
- data/spec/opal/stdlib/thread/mutex_spec.rb +0 -40
- data/spec/opal/stdlib/thread/thread_queue_spec.rb +0 -32
- data/spec/opal/stdlib/thread/thread_spec.rb +0 -60
- data/spec/ruby_specs +0 -121
- data/spec/spec_helper.rb +0 -26
- data/spec/support/match_helpers.rb +0 -57
- data/spec/support/mspec_rspec_adapter.rb +0 -33
- data/spec/support/parser_helpers.rb +0 -37
- data/stdlib/nodejs/node_modules/js-yaml/HISTORY.md +0 -277
- data/stdlib/nodejs/node_modules/js-yaml/README.md +0 -288
- data/stdlib/nodejs/node_modules/js-yaml/bin/js-yaml.js +0 -140
- data/stdlib/nodejs/node_modules/js-yaml/bower.json +0 -23
- data/stdlib/nodejs/node_modules/js-yaml/dist/js-yaml.min.js +0 -3
- data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.js +0 -102
- data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.yml +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.js +0 -31
- data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.json +0 -22
- data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.js +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.yml +0 -197
- data/stdlib/nodejs/node_modules/js-yaml/index.js +0 -7
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/common.js +0 -62
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/dumper.js +0 -554
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/exception.js +0 -25
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/loader.js +0 -1581
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/mark.js +0 -78
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/core.js +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +0 -25
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +0 -28
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +0 -17
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/json.js +0 -25
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema.js +0 -103
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/binary.js +0 -133
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/bool.js +0 -37
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/float.js +0 -110
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/int.js +0 -183
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/function.js +0 -85
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +0 -84
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +0 -27
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/map.js +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/merge.js +0 -12
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/null.js +0 -36
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/omap.js +0 -56
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/pairs.js +0 -61
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/seq.js +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/set.js +0 -33
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/str.js +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +0 -98
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type.js +0 -61
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml.js +0 -39
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/HISTORY.md +0 -115
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/README.md +0 -239
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/arguments.js +0 -36
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/choice.js +0 -22
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/constants.js +0 -59
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/help.js +0 -13
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/nargs.js +0 -33
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/parents.js +0 -28
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/prefix_chars.js +0 -23
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sub_commands.js +0 -49
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sum.js +0 -35
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/testformatters.js +0 -270
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/index.js +0 -1
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js +0 -47
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append.js +0 -55
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/count.js +0 -40
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/help.js +0 -48
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js +0 -43
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/false.js +0 -27
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/true.js +0 -26
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store.js +0 -50
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/subparsers.js +0 -148
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/version.js +0 -50
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action.js +0 -146
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action_container.js +0 -481
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argparse.js +0 -14
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/error.js +0 -50
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/exclusive.js +0 -54
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/group.js +0 -75
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument_parser.js +0 -1168
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/const.js +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/added_formatters.js +0 -88
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/formatter.js +0 -798
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/namespace.js +0 -77
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/LICENSE +0 -23
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/README.md +0 -22
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/package.json +0 -69
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore-min.js +0 -6
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore.js +0 -1415
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.npmignore +0 -2
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.travis.yml +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/README.markdown +0 -825
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/bower.json +0 -33
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/component.json +0 -11
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/foo.js +0 -10
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/gulpfile.js +0 -26
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/lib/underscore.string.js +0 -673
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/libpeerconnection.log +0 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/package.json +0 -107
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/package.json +0 -62
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/README.md +0 -73
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esparse.js +0 -117
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esvalidate.js +0 -177
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/esprima.js +0 -3908
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/package.json +0 -69
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/compat.js +0 -239
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/reflect.js +0 -422
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/run.js +0 -66
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/runner.js +0 -387
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/test.js +0 -20238
- data/stdlib/nodejs/node_modules/js-yaml/package.json +0 -83
- data/stdlib/phantomjs.rb +0 -17
- data/tasks/testing/sprockets-phantomjs.js +0 -54
- data/test/nodejs/test_dir.rb +0 -17
- data/test/nodejs/test_file.rb +0 -30
- data/test/opal/test_keyword.rb +0 -590
- data/test/opal/unsupported_and_bugs.rb +0 -30
- /data/{CODE_OF_CONDUCT.md → CONDUCT.md} +0 -0
- /data/{bin → exe}/opal-build +0 -0
- /data/{bin → exe}/opal-mspec +0 -0
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// https://github.com/nodeca/js-yaml/blob/3.6.1/dist/js-yaml.js (c76b837cacc69de6b86a0781db31a9bb7a193875)
|
|
2
|
+
|
|
3
|
+
/* jshint ignore:start */
|
|
4
|
+
/* js-yaml 3.6.1 https://github.com/nodeca/js-yaml */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsyaml = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
|
2
5
|
'use strict';
|
|
3
6
|
|
|
4
7
|
|
|
@@ -28,7 +31,7 @@ module.exports.dump = dumper.dump;
|
|
|
28
31
|
module.exports.safeDump = dumper.safeDump;
|
|
29
32
|
module.exports.YAMLException = require('./js-yaml/exception');
|
|
30
33
|
|
|
31
|
-
//
|
|
34
|
+
// Deprecated schema names from JS-YAML 2.0.x
|
|
32
35
|
module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');
|
|
33
36
|
module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
|
|
34
37
|
module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');
|
|
@@ -44,23 +47,20 @@ module.exports.addConstructor = deprecated('addConstructor');
|
|
|
44
47
|
|
|
45
48
|
|
|
46
49
|
function isNothing(subject) {
|
|
47
|
-
return (
|
|
50
|
+
return (typeof subject === 'undefined') || (subject === null);
|
|
48
51
|
}
|
|
49
52
|
|
|
50
53
|
|
|
51
54
|
function isObject(subject) {
|
|
52
|
-
return ('object'
|
|
55
|
+
return (typeof subject === 'object') && (subject !== null);
|
|
53
56
|
}
|
|
54
57
|
|
|
55
58
|
|
|
56
59
|
function toArray(sequence) {
|
|
57
|
-
if (Array.isArray(sequence))
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
} else {
|
|
62
|
-
return [ sequence ];
|
|
63
|
-
}
|
|
60
|
+
if (Array.isArray(sequence)) return sequence;
|
|
61
|
+
else if (isNothing(sequence)) return [];
|
|
62
|
+
|
|
63
|
+
return [ sequence ];
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
|
|
@@ -92,7 +92,7 @@ function repeat(string, count) {
|
|
|
92
92
|
|
|
93
93
|
|
|
94
94
|
function isNegativeZero(number) {
|
|
95
|
-
return (
|
|
95
|
+
return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
|
|
@@ -106,20 +106,18 @@ module.exports.extend = extend;
|
|
|
106
106
|
},{}],3:[function(require,module,exports){
|
|
107
107
|
'use strict';
|
|
108
108
|
|
|
109
|
+
/*eslint-disable no-use-before-define*/
|
|
109
110
|
|
|
110
111
|
var common = require('./common');
|
|
111
112
|
var YAMLException = require('./exception');
|
|
112
113
|
var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
|
|
113
114
|
var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
|
|
114
115
|
|
|
115
|
-
|
|
116
116
|
var _toString = Object.prototype.toString;
|
|
117
117
|
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
118
118
|
|
|
119
|
-
|
|
120
119
|
var CHAR_TAB = 0x09; /* Tab */
|
|
121
120
|
var CHAR_LINE_FEED = 0x0A; /* LF */
|
|
122
|
-
var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
|
|
123
121
|
var CHAR_SPACE = 0x20; /* Space */
|
|
124
122
|
var CHAR_EXCLAMATION = 0x21; /* ! */
|
|
125
123
|
var CHAR_DOUBLE_QUOTE = 0x22; /* " */
|
|
@@ -141,7 +139,6 @@ var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
|
|
|
141
139
|
var CHAR_VERTICAL_LINE = 0x7C; /* | */
|
|
142
140
|
var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
|
|
143
141
|
|
|
144
|
-
|
|
145
142
|
var ESCAPE_SEQUENCES = {};
|
|
146
143
|
|
|
147
144
|
ESCAPE_SEQUENCES[0x00] = '\\0';
|
|
@@ -160,19 +157,15 @@ ESCAPE_SEQUENCES[0xA0] = '\\_';
|
|
|
160
157
|
ESCAPE_SEQUENCES[0x2028] = '\\L';
|
|
161
158
|
ESCAPE_SEQUENCES[0x2029] = '\\P';
|
|
162
159
|
|
|
163
|
-
|
|
164
160
|
var DEPRECATED_BOOLEANS_SYNTAX = [
|
|
165
161
|
'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
|
|
166
162
|
'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
|
|
167
163
|
];
|
|
168
164
|
|
|
169
|
-
|
|
170
165
|
function compileStyleMap(schema, map) {
|
|
171
166
|
var result, keys, index, length, tag, style, type;
|
|
172
167
|
|
|
173
|
-
if (
|
|
174
|
-
return {};
|
|
175
|
-
}
|
|
168
|
+
if (map === null) return {};
|
|
176
169
|
|
|
177
170
|
result = {};
|
|
178
171
|
keys = Object.keys(map);
|
|
@@ -181,7 +174,7 @@ function compileStyleMap(schema, map) {
|
|
|
181
174
|
tag = keys[index];
|
|
182
175
|
style = String(map[tag]);
|
|
183
176
|
|
|
184
|
-
if (
|
|
177
|
+
if (tag.slice(0, 2) === '!!') {
|
|
185
178
|
tag = 'tag:yaml.org,2002:' + tag.slice(2);
|
|
186
179
|
}
|
|
187
180
|
|
|
@@ -197,7 +190,6 @@ function compileStyleMap(schema, map) {
|
|
|
197
190
|
return result;
|
|
198
191
|
}
|
|
199
192
|
|
|
200
|
-
|
|
201
193
|
function encodeHex(character) {
|
|
202
194
|
var string, handle, length;
|
|
203
195
|
|
|
@@ -219,13 +211,16 @@ function encodeHex(character) {
|
|
|
219
211
|
return '\\' + handle + common.repeat('0', length - string.length) + string;
|
|
220
212
|
}
|
|
221
213
|
|
|
222
|
-
|
|
223
214
|
function State(options) {
|
|
224
|
-
this.schema
|
|
225
|
-
this.indent
|
|
226
|
-
this.skipInvalid
|
|
227
|
-
this.flowLevel
|
|
228
|
-
this.styleMap
|
|
215
|
+
this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
|
|
216
|
+
this.indent = Math.max(1, (options['indent'] || 2));
|
|
217
|
+
this.skipInvalid = options['skipInvalid'] || false;
|
|
218
|
+
this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
|
|
219
|
+
this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
|
|
220
|
+
this.sortKeys = options['sortKeys'] || false;
|
|
221
|
+
this.lineWidth = options['lineWidth'] || 80;
|
|
222
|
+
this.noRefs = options['noRefs'] || false;
|
|
223
|
+
this.noCompatMode = options['noCompatMode'] || false;
|
|
229
224
|
|
|
230
225
|
this.implicitTypes = this.schema.compiledImplicit;
|
|
231
226
|
this.explicitTypes = this.schema.compiledExplicit;
|
|
@@ -237,6 +232,32 @@ function State(options) {
|
|
|
237
232
|
this.usedDuplicates = null;
|
|
238
233
|
}
|
|
239
234
|
|
|
235
|
+
// Indents every line in a string. Empty lines (\n only) are not indented.
|
|
236
|
+
function indentString(string, spaces) {
|
|
237
|
+
var ind = common.repeat(' ', spaces),
|
|
238
|
+
position = 0,
|
|
239
|
+
next = -1,
|
|
240
|
+
result = '',
|
|
241
|
+
line,
|
|
242
|
+
length = string.length;
|
|
243
|
+
|
|
244
|
+
while (position < length) {
|
|
245
|
+
next = string.indexOf('\n', position);
|
|
246
|
+
if (next === -1) {
|
|
247
|
+
line = string.slice(position);
|
|
248
|
+
position = length;
|
|
249
|
+
} else {
|
|
250
|
+
line = string.slice(position, next + 1);
|
|
251
|
+
position = next + 1;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
if (line.length && line !== '\n') result += ind;
|
|
255
|
+
|
|
256
|
+
result += line;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return result;
|
|
260
|
+
}
|
|
240
261
|
|
|
241
262
|
function generateNextLine(state, level) {
|
|
242
263
|
return '\n' + common.repeat(' ', state.indent * level);
|
|
@@ -256,81 +277,308 @@ function testImplicitResolving(state, str) {
|
|
|
256
277
|
return false;
|
|
257
278
|
}
|
|
258
279
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
280
|
+
// [33] s-white ::= s-space | s-tab
|
|
281
|
+
function isWhitespace(c) {
|
|
282
|
+
return c === CHAR_SPACE || c === CHAR_TAB;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Returns true if the character can be printed without escaping.
|
|
286
|
+
// From YAML 1.2: "any allowed characters known to be non-printable
|
|
287
|
+
// should also be escaped. [However,] This isn’t mandatory"
|
|
288
|
+
// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
|
|
289
|
+
function isPrintable(c) {
|
|
290
|
+
return (0x00020 <= c && c <= 0x00007E)
|
|
291
|
+
|| ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
|
|
292
|
+
|| ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */)
|
|
293
|
+
|| (0x10000 <= c && c <= 0x10FFFF);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// Simplified test for values allowed after the first character in plain style.
|
|
297
|
+
function isPlainSafe(c) {
|
|
298
|
+
// Uses a subset of nb-char - c-flow-indicator - ":" - "#"
|
|
299
|
+
// where nb-char ::= c-printable - b-char - c-byte-order-mark.
|
|
300
|
+
return isPrintable(c) && c !== 0xFEFF
|
|
301
|
+
// - c-flow-indicator
|
|
302
|
+
&& c !== CHAR_COMMA
|
|
303
|
+
&& c !== CHAR_LEFT_SQUARE_BRACKET
|
|
304
|
+
&& c !== CHAR_RIGHT_SQUARE_BRACKET
|
|
305
|
+
&& c !== CHAR_LEFT_CURLY_BRACKET
|
|
306
|
+
&& c !== CHAR_RIGHT_CURLY_BRACKET
|
|
307
|
+
// - ":" - "#"
|
|
308
|
+
&& c !== CHAR_COLON
|
|
309
|
+
&& c !== CHAR_SHARP;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// Simplified test for values allowed as the first character in plain style.
|
|
313
|
+
function isPlainSafeFirst(c) {
|
|
314
|
+
// Uses a subset of ns-char - c-indicator
|
|
315
|
+
// where ns-char = nb-char - s-white.
|
|
316
|
+
return isPrintable(c) && c !== 0xFEFF
|
|
317
|
+
&& !isWhitespace(c) // - s-white
|
|
318
|
+
// - (c-indicator ::=
|
|
319
|
+
// “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
|
|
320
|
+
&& c !== CHAR_MINUS
|
|
321
|
+
&& c !== CHAR_QUESTION
|
|
322
|
+
&& c !== CHAR_COLON
|
|
323
|
+
&& c !== CHAR_COMMA
|
|
324
|
+
&& c !== CHAR_LEFT_SQUARE_BRACKET
|
|
325
|
+
&& c !== CHAR_RIGHT_SQUARE_BRACKET
|
|
326
|
+
&& c !== CHAR_LEFT_CURLY_BRACKET
|
|
327
|
+
&& c !== CHAR_RIGHT_CURLY_BRACKET
|
|
328
|
+
// | “#” | “&” | “*” | “!” | “|” | “>” | “'” | “"”
|
|
329
|
+
&& c !== CHAR_SHARP
|
|
330
|
+
&& c !== CHAR_AMPERSAND
|
|
331
|
+
&& c !== CHAR_ASTERISK
|
|
332
|
+
&& c !== CHAR_EXCLAMATION
|
|
333
|
+
&& c !== CHAR_VERTICAL_LINE
|
|
334
|
+
&& c !== CHAR_GREATER_THAN
|
|
335
|
+
&& c !== CHAR_SINGLE_QUOTE
|
|
336
|
+
&& c !== CHAR_DOUBLE_QUOTE
|
|
337
|
+
// | “%” | “@” | “`”)
|
|
338
|
+
&& c !== CHAR_PERCENT
|
|
339
|
+
&& c !== CHAR_COMMERCIAL_AT
|
|
340
|
+
&& c !== CHAR_GRAVE_ACCENT;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
var STYLE_PLAIN = 1,
|
|
344
|
+
STYLE_SINGLE = 2,
|
|
345
|
+
STYLE_LITERAL = 3,
|
|
346
|
+
STYLE_FOLDED = 4,
|
|
347
|
+
STYLE_DOUBLE = 5;
|
|
348
|
+
|
|
349
|
+
// Determines which scalar styles are possible and returns the preferred style.
|
|
350
|
+
// lineWidth = -1 => no limit.
|
|
351
|
+
// Pre-conditions: str.length > 0.
|
|
352
|
+
// Post-conditions:
|
|
353
|
+
// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
|
|
354
|
+
// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
|
|
355
|
+
// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
|
|
356
|
+
function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
|
|
357
|
+
var i;
|
|
358
|
+
var char;
|
|
359
|
+
var hasLineBreak = false;
|
|
360
|
+
var hasFoldableLine = false; // only checked if shouldTrackWidth
|
|
361
|
+
var shouldTrackWidth = lineWidth !== -1;
|
|
362
|
+
var previousLineBreak = -1; // count the first line correctly
|
|
363
|
+
var plain = isPlainSafeFirst(string.charCodeAt(0))
|
|
364
|
+
&& !isWhitespace(string.charCodeAt(string.length - 1));
|
|
365
|
+
|
|
366
|
+
if (singleLineOnly) {
|
|
367
|
+
// Case: no block styles.
|
|
368
|
+
// Check for disallowed characters to rule out plain and single.
|
|
369
|
+
for (i = 0; i < string.length; i++) {
|
|
370
|
+
char = string.charCodeAt(i);
|
|
371
|
+
if (!isPrintable(char)) {
|
|
372
|
+
return STYLE_DOUBLE;
|
|
307
373
|
}
|
|
374
|
+
plain = plain && isPlainSafe(char);
|
|
308
375
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
376
|
+
} else {
|
|
377
|
+
// Case: block styles permitted.
|
|
378
|
+
for (i = 0; i < string.length; i++) {
|
|
379
|
+
char = string.charCodeAt(i);
|
|
380
|
+
if (char === CHAR_LINE_FEED) {
|
|
381
|
+
hasLineBreak = true;
|
|
382
|
+
// Check if any line can be folded.
|
|
383
|
+
if (shouldTrackWidth) {
|
|
384
|
+
hasFoldableLine = hasFoldableLine ||
|
|
385
|
+
// Foldable line = too long, and not more-indented.
|
|
386
|
+
(i - previousLineBreak - 1 > lineWidth &&
|
|
387
|
+
string[previousLineBreak + 1] !== ' ');
|
|
388
|
+
previousLineBreak = i;
|
|
389
|
+
}
|
|
390
|
+
} else if (!isPrintable(char)) {
|
|
391
|
+
return STYLE_DOUBLE;
|
|
392
|
+
}
|
|
393
|
+
plain = plain && isPlainSafe(char);
|
|
394
|
+
}
|
|
395
|
+
// in case the end is missing a \n
|
|
396
|
+
hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
|
|
397
|
+
(i - previousLineBreak - 1 > lineWidth &&
|
|
398
|
+
string[previousLineBreak + 1] !== ' '));
|
|
399
|
+
}
|
|
400
|
+
// Although every style can represent \n without escaping, prefer block styles
|
|
401
|
+
// for multiline, since they're more readable and they don't add empty lines.
|
|
402
|
+
// Also prefer folding a super-long line.
|
|
403
|
+
if (!hasLineBreak && !hasFoldableLine) {
|
|
404
|
+
// Strings interpretable as another type have to be quoted;
|
|
405
|
+
// e.g. the string 'true' vs. the boolean true.
|
|
406
|
+
return plain && !testAmbiguousType(string)
|
|
407
|
+
? STYLE_PLAIN : STYLE_SINGLE;
|
|
408
|
+
}
|
|
409
|
+
// Edge case: block indentation indicator can only have one digit.
|
|
410
|
+
if (string[0] === ' ' && indentPerLevel > 9) {
|
|
411
|
+
return STYLE_DOUBLE;
|
|
412
|
+
}
|
|
413
|
+
// At this point we know block styles are valid.
|
|
414
|
+
// Prefer literal style unless we want to fold.
|
|
415
|
+
return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// Note: line breaking/folding is implemented for only the folded style.
|
|
419
|
+
// NB. We drop the last trailing newline (if any) of a returned block scalar
|
|
420
|
+
// since the dumper adds its own newline. This always works:
|
|
421
|
+
// • No ending newline => unaffected; already using strip "-" chomping.
|
|
422
|
+
// • Ending newline => removed then restored.
|
|
423
|
+
// Importantly, this keeps the "+" chomp indicator from gaining an extra line.
|
|
424
|
+
function writeScalar(state, string, level, iskey) {
|
|
425
|
+
state.dump = (function () {
|
|
426
|
+
if (string.length === 0) {
|
|
427
|
+
return "''";
|
|
428
|
+
}
|
|
429
|
+
if (!state.noCompatMode &&
|
|
430
|
+
DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
|
|
431
|
+
return "'" + string + "'";
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
var indent = state.indent * Math.max(1, level); // no 0-indent scalars
|
|
435
|
+
// As indentation gets deeper, let the width decrease monotonically
|
|
436
|
+
// to the lower bound min(state.lineWidth, 40).
|
|
437
|
+
// Note that this implies
|
|
438
|
+
// state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.
|
|
439
|
+
// state.lineWidth > 40 + state.indent: width decreases until the lower bound.
|
|
440
|
+
// This behaves better than a constant minimum width which disallows narrower options,
|
|
441
|
+
// or an indent threshold which causes the width to suddenly increase.
|
|
442
|
+
var lineWidth = state.lineWidth === -1
|
|
443
|
+
? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
|
|
444
|
+
|
|
445
|
+
// Without knowing if keys are implicit/explicit, assume implicit for safety.
|
|
446
|
+
var singleLineOnly = iskey
|
|
447
|
+
// No block styles in flow mode.
|
|
448
|
+
|| (state.flowLevel > -1 && level >= state.flowLevel);
|
|
449
|
+
function testAmbiguity(string) {
|
|
450
|
+
return testImplicitResolving(state, string);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
|
|
454
|
+
case STYLE_PLAIN:
|
|
455
|
+
return string;
|
|
456
|
+
case STYLE_SINGLE:
|
|
457
|
+
return "'" + string.replace(/'/g, "''") + "'";
|
|
458
|
+
case STYLE_LITERAL:
|
|
459
|
+
return '|' + blockHeader(string, state.indent)
|
|
460
|
+
+ dropEndingNewline(indentString(string, indent));
|
|
461
|
+
case STYLE_FOLDED:
|
|
462
|
+
return '>' + blockHeader(string, state.indent)
|
|
463
|
+
+ dropEndingNewline(indentString(foldString(string, lineWidth), indent));
|
|
464
|
+
case STYLE_DOUBLE:
|
|
465
|
+
return '"' + escapeString(string, lineWidth) + '"';
|
|
466
|
+
default:
|
|
467
|
+
throw new YAMLException('impossible error: invalid scalar style');
|
|
468
|
+
}
|
|
469
|
+
}());
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
|
|
473
|
+
function blockHeader(string, indentPerLevel) {
|
|
474
|
+
var indentIndicator = (string[0] === ' ') ? String(indentPerLevel) : '';
|
|
475
|
+
|
|
476
|
+
// note the special case: the string '\n' counts as a "trailing" empty line.
|
|
477
|
+
var clip = string[string.length - 1] === '\n';
|
|
478
|
+
var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
|
|
479
|
+
var chomp = keep ? '+' : (clip ? '' : '-');
|
|
480
|
+
|
|
481
|
+
return indentIndicator + chomp + '\n';
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
// (See the note for writeScalar.)
|
|
485
|
+
function dropEndingNewline(string) {
|
|
486
|
+
return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
// Note: a long line without a suitable break point will exceed the width limit.
|
|
490
|
+
// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
|
|
491
|
+
function foldString(string, width) {
|
|
492
|
+
// In folded style, $k$ consecutive newlines output as $k+1$ newlines—
|
|
493
|
+
// unless they're before or after a more-indented line, or at the very
|
|
494
|
+
// beginning or end, in which case $k$ maps to $k$.
|
|
495
|
+
// Therefore, parse each chunk as newline(s) followed by a content line.
|
|
496
|
+
var lineRe = /(\n+)([^\n]*)/g;
|
|
497
|
+
|
|
498
|
+
// first line (possibly an empty line)
|
|
499
|
+
var result = (function () {
|
|
500
|
+
var nextLF = string.indexOf('\n');
|
|
501
|
+
nextLF = nextLF !== -1 ? nextLF : string.length;
|
|
502
|
+
lineRe.lastIndex = nextLF;
|
|
503
|
+
return foldLine(string.slice(0, nextLF), width);
|
|
504
|
+
}());
|
|
505
|
+
// If we haven't reached the first content line yet, don't add an extra \n.
|
|
506
|
+
var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
|
|
507
|
+
var moreIndented;
|
|
508
|
+
|
|
509
|
+
// rest of the lines
|
|
510
|
+
var match;
|
|
511
|
+
while ((match = lineRe.exec(string))) {
|
|
512
|
+
var prefix = match[1], line = match[2];
|
|
513
|
+
moreIndented = (line[0] === ' ');
|
|
514
|
+
result += prefix
|
|
515
|
+
+ (!prevMoreIndented && !moreIndented && line !== ''
|
|
516
|
+
? '\n' : '')
|
|
517
|
+
+ foldLine(line, width);
|
|
518
|
+
prevMoreIndented = moreIndented;
|
|
321
519
|
}
|
|
322
520
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
521
|
+
return result;
|
|
522
|
+
}
|
|
326
523
|
|
|
327
|
-
|
|
328
|
-
|
|
524
|
+
// Greedy line breaking.
|
|
525
|
+
// Picks the longest line under the limit each time,
|
|
526
|
+
// otherwise settles for the shortest line over the limit.
|
|
527
|
+
// NB. More-indented lines *cannot* be folded, as that would add an extra \n.
|
|
528
|
+
function foldLine(line, width) {
|
|
529
|
+
if (line === '' || line[0] === ' ') return line;
|
|
530
|
+
|
|
531
|
+
// Since a more-indented line adds a \n, breaks can't be followed by a space.
|
|
532
|
+
var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
|
|
533
|
+
var match;
|
|
534
|
+
// start is an inclusive index. end, curr, and next are exclusive.
|
|
535
|
+
var start = 0, end, curr = 0, next = 0;
|
|
536
|
+
var result = '';
|
|
537
|
+
|
|
538
|
+
// Invariants: 0 <= start <= length-1.
|
|
539
|
+
// 0 <= curr <= next <= max(0, length-2). curr - start <= width.
|
|
540
|
+
// Inside the loop:
|
|
541
|
+
// A match implies length >= 2, so curr and next are <= length-2.
|
|
542
|
+
while ((match = breakRe.exec(line))) {
|
|
543
|
+
next = match.index;
|
|
544
|
+
// maintain invariant: curr - start <= width
|
|
545
|
+
if (next - start > width) {
|
|
546
|
+
end = (curr > start) ? curr : next; // derive end <= length-2
|
|
547
|
+
result += '\n' + line.slice(start, end);
|
|
548
|
+
// skip the space that was output as \n
|
|
549
|
+
start = end + 1; // derive start <= length-1
|
|
550
|
+
}
|
|
551
|
+
curr = next;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
// By the invariants, start <= length-1, so there is something left over.
|
|
555
|
+
// It is either the whole string or a part starting from non-whitespace.
|
|
556
|
+
result += '\n';
|
|
557
|
+
// Insert a break if the remainder is too long and there is a break available.
|
|
558
|
+
if (line.length - start > width && curr > start) {
|
|
559
|
+
result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
|
|
560
|
+
} else {
|
|
561
|
+
result += line.slice(start);
|
|
329
562
|
}
|
|
330
563
|
|
|
331
|
-
|
|
332
|
-
|
|
564
|
+
return result.slice(1); // drop extra \n joiner
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
// Escapes a double-quoted string.
|
|
568
|
+
function escapeString(string) {
|
|
569
|
+
var result = '';
|
|
570
|
+
var char;
|
|
571
|
+
var escapeSeq;
|
|
572
|
+
|
|
573
|
+
for (var i = 0; i < string.length; i++) {
|
|
574
|
+
char = string.charCodeAt(i);
|
|
575
|
+
escapeSeq = ESCAPE_SEQUENCES[char];
|
|
576
|
+
result += !escapeSeq && isPrintable(char)
|
|
577
|
+
? string[i]
|
|
578
|
+
: escapeSeq || encodeHex(char);
|
|
333
579
|
}
|
|
580
|
+
|
|
581
|
+
return result;
|
|
334
582
|
}
|
|
335
583
|
|
|
336
584
|
function writeFlowSequence(state, level, object) {
|
|
@@ -342,9 +590,7 @@ function writeFlowSequence(state, level, object) {
|
|
|
342
590
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
343
591
|
// Write only valid elements.
|
|
344
592
|
if (writeNode(state, level, object[index], false, false)) {
|
|
345
|
-
if (
|
|
346
|
-
_result += ', ';
|
|
347
|
-
}
|
|
593
|
+
if (index !== 0) _result += ', ';
|
|
348
594
|
_result += state.dump;
|
|
349
595
|
}
|
|
350
596
|
}
|
|
@@ -362,7 +608,7 @@ function writeBlockSequence(state, level, object, compact) {
|
|
|
362
608
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
363
609
|
// Write only valid elements.
|
|
364
610
|
if (writeNode(state, level + 1, object[index], true, true)) {
|
|
365
|
-
if (!compact ||
|
|
611
|
+
if (!compact || index !== 0) {
|
|
366
612
|
_result += generateNextLine(state, level);
|
|
367
613
|
}
|
|
368
614
|
_result += '- ' + state.dump;
|
|
@@ -386,9 +632,7 @@ function writeFlowMapping(state, level, object) {
|
|
|
386
632
|
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
387
633
|
pairBuffer = '';
|
|
388
634
|
|
|
389
|
-
if (
|
|
390
|
-
pairBuffer += ', ';
|
|
391
|
-
}
|
|
635
|
+
if (index !== 0) pairBuffer += ', ';
|
|
392
636
|
|
|
393
637
|
objectKey = objectKeyList[index];
|
|
394
638
|
objectValue = object[objectKey];
|
|
@@ -397,9 +641,7 @@ function writeFlowMapping(state, level, object) {
|
|
|
397
641
|
continue; // Skip this pair because of invalid key;
|
|
398
642
|
}
|
|
399
643
|
|
|
400
|
-
if (state.dump.length > 1024)
|
|
401
|
-
pairBuffer += '? ';
|
|
402
|
-
}
|
|
644
|
+
if (state.dump.length > 1024) pairBuffer += '? ';
|
|
403
645
|
|
|
404
646
|
pairBuffer += state.dump + ': ';
|
|
405
647
|
|
|
@@ -428,21 +670,33 @@ function writeBlockMapping(state, level, object, compact) {
|
|
|
428
670
|
explicitPair,
|
|
429
671
|
pairBuffer;
|
|
430
672
|
|
|
673
|
+
// Allow sorting keys so that the output file is deterministic
|
|
674
|
+
if (state.sortKeys === true) {
|
|
675
|
+
// Default sorting
|
|
676
|
+
objectKeyList.sort();
|
|
677
|
+
} else if (typeof state.sortKeys === 'function') {
|
|
678
|
+
// Custom sort function
|
|
679
|
+
objectKeyList.sort(state.sortKeys);
|
|
680
|
+
} else if (state.sortKeys) {
|
|
681
|
+
// Something is wrong
|
|
682
|
+
throw new YAMLException('sortKeys must be a boolean or a function');
|
|
683
|
+
}
|
|
684
|
+
|
|
431
685
|
for (index = 0, length = objectKeyList.length; index < length; index += 1) {
|
|
432
686
|
pairBuffer = '';
|
|
433
687
|
|
|
434
|
-
if (!compact ||
|
|
688
|
+
if (!compact || index !== 0) {
|
|
435
689
|
pairBuffer += generateNextLine(state, level);
|
|
436
690
|
}
|
|
437
691
|
|
|
438
692
|
objectKey = objectKeyList[index];
|
|
439
693
|
objectValue = object[objectKey];
|
|
440
694
|
|
|
441
|
-
if (!writeNode(state, level + 1, objectKey, true, true)) {
|
|
695
|
+
if (!writeNode(state, level + 1, objectKey, true, true, true)) {
|
|
442
696
|
continue; // Skip this pair because of invalid key.
|
|
443
697
|
}
|
|
444
698
|
|
|
445
|
-
explicitPair = (
|
|
699
|
+
explicitPair = (state.tag !== null && state.tag !== '?') ||
|
|
446
700
|
(state.dump && state.dump.length > 1024);
|
|
447
701
|
|
|
448
702
|
if (explicitPair) {
|
|
@@ -488,7 +742,7 @@ function detectType(state, object, explicit) {
|
|
|
488
742
|
type = typeList[index];
|
|
489
743
|
|
|
490
744
|
if ((type.instanceOf || type.predicate) &&
|
|
491
|
-
(!type.instanceOf || ((
|
|
745
|
+
(!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
|
|
492
746
|
(!type.predicate || type.predicate(object))) {
|
|
493
747
|
|
|
494
748
|
state.tag = explicit ? type.tag : '?';
|
|
@@ -496,7 +750,7 @@ function detectType(state, object, explicit) {
|
|
|
496
750
|
if (type.represent) {
|
|
497
751
|
style = state.styleMap[type.tag] || type.defaultStyle;
|
|
498
752
|
|
|
499
|
-
if (
|
|
753
|
+
if (_toString.call(type.represent) === '[object Function]') {
|
|
500
754
|
_result = type.represent(object, style);
|
|
501
755
|
} else if (_hasOwnProperty.call(type.represent, style)) {
|
|
502
756
|
_result = type.represent[style](object, style);
|
|
@@ -517,7 +771,7 @@ function detectType(state, object, explicit) {
|
|
|
517
771
|
// Serializes `object` and writes it to global `result`.
|
|
518
772
|
// Returns true on success, or false on invalid object.
|
|
519
773
|
//
|
|
520
|
-
function writeNode(state, level, object, block, compact) {
|
|
774
|
+
function writeNode(state, level, object, block, compact, iskey) {
|
|
521
775
|
state.tag = null;
|
|
522
776
|
state.dump = object;
|
|
523
777
|
|
|
@@ -528,14 +782,10 @@ function writeNode(state, level, object, block, compact) {
|
|
|
528
782
|
var type = _toString.call(state.dump);
|
|
529
783
|
|
|
530
784
|
if (block) {
|
|
531
|
-
block = (
|
|
785
|
+
block = (state.flowLevel < 0 || state.flowLevel > level);
|
|
532
786
|
}
|
|
533
787
|
|
|
534
|
-
|
|
535
|
-
compact = false;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
var objectOrArray = '[object Object]' === type || '[object Array]' === type,
|
|
788
|
+
var objectOrArray = type === '[object Object]' || type === '[object Array]',
|
|
539
789
|
duplicateIndex,
|
|
540
790
|
duplicate;
|
|
541
791
|
|
|
@@ -544,17 +794,21 @@ function writeNode(state, level, object, block, compact) {
|
|
|
544
794
|
duplicate = duplicateIndex !== -1;
|
|
545
795
|
}
|
|
546
796
|
|
|
797
|
+
if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
|
|
798
|
+
compact = false;
|
|
799
|
+
}
|
|
800
|
+
|
|
547
801
|
if (duplicate && state.usedDuplicates[duplicateIndex]) {
|
|
548
802
|
state.dump = '*ref_' + duplicateIndex;
|
|
549
803
|
} else {
|
|
550
804
|
if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
|
|
551
805
|
state.usedDuplicates[duplicateIndex] = true;
|
|
552
806
|
}
|
|
553
|
-
if ('[object Object]'
|
|
554
|
-
if (block && (
|
|
807
|
+
if (type === '[object Object]') {
|
|
808
|
+
if (block && (Object.keys(state.dump).length !== 0)) {
|
|
555
809
|
writeBlockMapping(state, level, state.dump, compact);
|
|
556
810
|
if (duplicate) {
|
|
557
|
-
state.dump = '&ref_' + duplicateIndex +
|
|
811
|
+
state.dump = '&ref_' + duplicateIndex + state.dump;
|
|
558
812
|
}
|
|
559
813
|
} else {
|
|
560
814
|
writeFlowMapping(state, level, state.dump);
|
|
@@ -562,11 +816,11 @@ function writeNode(state, level, object, block, compact) {
|
|
|
562
816
|
state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
|
|
563
817
|
}
|
|
564
818
|
}
|
|
565
|
-
} else if ('[object Array]'
|
|
566
|
-
if (block && (
|
|
819
|
+
} else if (type === '[object Array]') {
|
|
820
|
+
if (block && (state.dump.length !== 0)) {
|
|
567
821
|
writeBlockSequence(state, level, state.dump, compact);
|
|
568
822
|
if (duplicate) {
|
|
569
|
-
state.dump = '&ref_' + duplicateIndex +
|
|
823
|
+
state.dump = '&ref_' + duplicateIndex + state.dump;
|
|
570
824
|
}
|
|
571
825
|
} else {
|
|
572
826
|
writeFlowSequence(state, level, state.dump);
|
|
@@ -574,17 +828,16 @@ function writeNode(state, level, object, block, compact) {
|
|
|
574
828
|
state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
|
|
575
829
|
}
|
|
576
830
|
}
|
|
577
|
-
} else if ('[object String]'
|
|
578
|
-
if ('?'
|
|
579
|
-
writeScalar(state, state.dump);
|
|
831
|
+
} else if (type === '[object String]') {
|
|
832
|
+
if (state.tag !== '?') {
|
|
833
|
+
writeScalar(state, state.dump, level, iskey);
|
|
580
834
|
}
|
|
581
|
-
} else if (state.skipInvalid) {
|
|
582
|
-
return false;
|
|
583
835
|
} else {
|
|
836
|
+
if (state.skipInvalid) return false;
|
|
584
837
|
throw new YAMLException('unacceptable kind of an object to dump ' + type);
|
|
585
838
|
}
|
|
586
839
|
|
|
587
|
-
if (
|
|
840
|
+
if (state.tag !== null && state.tag !== '?') {
|
|
588
841
|
state.dump = '!<' + state.tag + '> ' + state.dump;
|
|
589
842
|
}
|
|
590
843
|
}
|
|
@@ -607,21 +860,20 @@ function getDuplicateReferences(object, state) {
|
|
|
607
860
|
}
|
|
608
861
|
|
|
609
862
|
function inspectNode(object, objects, duplicatesIndexes) {
|
|
610
|
-
var
|
|
611
|
-
objectKeyList,
|
|
863
|
+
var objectKeyList,
|
|
612
864
|
index,
|
|
613
865
|
length;
|
|
614
866
|
|
|
615
|
-
if (
|
|
867
|
+
if (object !== null && typeof object === 'object') {
|
|
616
868
|
index = objects.indexOf(object);
|
|
617
|
-
if (
|
|
618
|
-
if (
|
|
869
|
+
if (index !== -1) {
|
|
870
|
+
if (duplicatesIndexes.indexOf(index) === -1) {
|
|
619
871
|
duplicatesIndexes.push(index);
|
|
620
872
|
}
|
|
621
873
|
} else {
|
|
622
874
|
objects.push(object);
|
|
623
|
-
|
|
624
|
-
if(Array.isArray(object)) {
|
|
875
|
+
|
|
876
|
+
if (Array.isArray(object)) {
|
|
625
877
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
626
878
|
inspectNode(object[index], objects, duplicatesIndexes);
|
|
627
879
|
}
|
|
@@ -641,40 +893,54 @@ function dump(input, options) {
|
|
|
641
893
|
|
|
642
894
|
var state = new State(options);
|
|
643
895
|
|
|
644
|
-
getDuplicateReferences(input, state);
|
|
896
|
+
if (!state.noRefs) getDuplicateReferences(input, state);
|
|
645
897
|
|
|
646
|
-
if (writeNode(state, 0, input, true, true))
|
|
647
|
-
return state.dump + '\n';
|
|
648
|
-
} else {
|
|
649
|
-
return '';
|
|
650
|
-
}
|
|
651
|
-
}
|
|
898
|
+
if (writeNode(state, 0, input, true, true)) return state.dump + '\n';
|
|
652
899
|
|
|
900
|
+
return '';
|
|
901
|
+
}
|
|
653
902
|
|
|
654
903
|
function safeDump(input, options) {
|
|
655
904
|
return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
|
|
656
905
|
}
|
|
657
906
|
|
|
658
|
-
|
|
659
907
|
module.exports.dump = dump;
|
|
660
908
|
module.exports.safeDump = safeDump;
|
|
661
909
|
|
|
662
910
|
},{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(require,module,exports){
|
|
911
|
+
// YAML error class. http://stackoverflow.com/questions/8458984
|
|
912
|
+
//
|
|
663
913
|
'use strict';
|
|
664
914
|
|
|
665
|
-
|
|
666
915
|
function YAMLException(reason, mark) {
|
|
667
|
-
|
|
668
|
-
this
|
|
669
|
-
|
|
670
|
-
|
|
916
|
+
// Super constructor
|
|
917
|
+
Error.call(this);
|
|
918
|
+
|
|
919
|
+
// Include stack trace in error object
|
|
920
|
+
if (Error.captureStackTrace) {
|
|
921
|
+
// Chrome and NodeJS
|
|
922
|
+
Error.captureStackTrace(this, this.constructor);
|
|
923
|
+
} else {
|
|
924
|
+
// FF, IE 10+ and Safari 6+. Fallback for others
|
|
925
|
+
this.stack = (new Error()).stack || '';
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
this.name = 'YAMLException';
|
|
929
|
+
this.reason = reason;
|
|
930
|
+
this.mark = mark;
|
|
931
|
+
this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
|
|
671
932
|
}
|
|
672
933
|
|
|
673
934
|
|
|
935
|
+
// Inherit from Error
|
|
936
|
+
YAMLException.prototype = Object.create(Error.prototype);
|
|
937
|
+
YAMLException.prototype.constructor = YAMLException;
|
|
938
|
+
|
|
939
|
+
|
|
674
940
|
YAMLException.prototype.toString = function toString(compact) {
|
|
675
|
-
var result;
|
|
941
|
+
var result = this.name + ': ';
|
|
676
942
|
|
|
677
|
-
result
|
|
943
|
+
result += this.reason || '(unknown reason)';
|
|
678
944
|
|
|
679
945
|
if (!compact && this.mark) {
|
|
680
946
|
result += ' ' + this.mark.toString();
|
|
@@ -689,6 +955,7 @@ module.exports = YAMLException;
|
|
|
689
955
|
},{}],5:[function(require,module,exports){
|
|
690
956
|
'use strict';
|
|
691
957
|
|
|
958
|
+
/*eslint-disable max-len,no-use-before-define*/
|
|
692
959
|
|
|
693
960
|
var common = require('./common');
|
|
694
961
|
var YAMLException = require('./exception');
|
|
@@ -711,7 +978,7 @@ var CHOMPING_STRIP = 2;
|
|
|
711
978
|
var CHOMPING_KEEP = 3;
|
|
712
979
|
|
|
713
980
|
|
|
714
|
-
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uD800-\uDFFF\
|
|
981
|
+
var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
|
|
715
982
|
var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
|
|
716
983
|
var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
|
|
717
984
|
var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
|
|
@@ -734,11 +1001,11 @@ function is_WS_OR_EOL(c) {
|
|
|
734
1001
|
}
|
|
735
1002
|
|
|
736
1003
|
function is_FLOW_INDICATOR(c) {
|
|
737
|
-
return 0x2C/* , */
|
|
738
|
-
0x5B/* [ */
|
|
739
|
-
0x5D/* ] */
|
|
740
|
-
0x7B/* { */
|
|
741
|
-
0x7D/* }
|
|
1004
|
+
return c === 0x2C/* , */ ||
|
|
1005
|
+
c === 0x5B/* [ */ ||
|
|
1006
|
+
c === 0x5D/* ] */ ||
|
|
1007
|
+
c === 0x7B/* { */ ||
|
|
1008
|
+
c === 0x7D/* } */;
|
|
742
1009
|
}
|
|
743
1010
|
|
|
744
1011
|
function fromHexCode(c) {
|
|
@@ -748,7 +1015,9 @@ function fromHexCode(c) {
|
|
|
748
1015
|
return c - 0x30;
|
|
749
1016
|
}
|
|
750
1017
|
|
|
1018
|
+
/*eslint-disable no-bitwise*/
|
|
751
1019
|
lc = c | 0x20;
|
|
1020
|
+
|
|
752
1021
|
if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
|
|
753
1022
|
return lc - 0x61 + 10;
|
|
754
1023
|
}
|
|
@@ -772,7 +1041,7 @@ function fromDecimalCode(c) {
|
|
|
772
1041
|
}
|
|
773
1042
|
|
|
774
1043
|
function simpleEscapeSequence(c) {
|
|
775
|
-
|
|
1044
|
+
return (c === 0x30/* 0 */) ? '\x00' :
|
|
776
1045
|
(c === 0x61/* a */) ? '\x07' :
|
|
777
1046
|
(c === 0x62/* b */) ? '\x08' :
|
|
778
1047
|
(c === 0x74/* t */) ? '\x09' :
|
|
@@ -795,12 +1064,11 @@ function simpleEscapeSequence(c) {
|
|
|
795
1064
|
function charFromCodepoint(c) {
|
|
796
1065
|
if (c <= 0xFFFF) {
|
|
797
1066
|
return String.fromCharCode(c);
|
|
798
|
-
} else {
|
|
799
|
-
// Encode UTF-16 surrogate pair
|
|
800
|
-
// https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
|
|
801
|
-
return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800,
|
|
802
|
-
((c - 0x010000) & 0x03FF) + 0xDC00);
|
|
803
1067
|
}
|
|
1068
|
+
// Encode UTF-16 surrogate pair
|
|
1069
|
+
// https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
|
|
1070
|
+
return String.fromCharCode(((c - 0x010000) >> 10) + 0xD800,
|
|
1071
|
+
((c - 0x010000) & 0x03FF) + 0xDC00);
|
|
804
1072
|
}
|
|
805
1073
|
|
|
806
1074
|
var simpleEscapeCheck = new Array(256); // integer, for fast access
|
|
@@ -818,6 +1086,8 @@ function State(input, options) {
|
|
|
818
1086
|
this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
|
|
819
1087
|
this.onWarning = options['onWarning'] || null;
|
|
820
1088
|
this.legacy = options['legacy'] || false;
|
|
1089
|
+
this.json = options['json'] || false;
|
|
1090
|
+
this.listener = options['listener'] || null;
|
|
821
1091
|
|
|
822
1092
|
this.implicitTypes = this.schema.compiledImplicit;
|
|
823
1093
|
this.typeMap = this.schema.compiledTypeMap;
|
|
@@ -854,76 +1124,72 @@ function throwError(state, message) {
|
|
|
854
1124
|
}
|
|
855
1125
|
|
|
856
1126
|
function throwWarning(state, message) {
|
|
857
|
-
var error = generateError(state, message);
|
|
858
|
-
|
|
859
1127
|
if (state.onWarning) {
|
|
860
|
-
state.onWarning.call(null,
|
|
861
|
-
} else {
|
|
862
|
-
throw error;
|
|
1128
|
+
state.onWarning.call(null, generateError(state, message));
|
|
863
1129
|
}
|
|
864
1130
|
}
|
|
865
1131
|
|
|
866
1132
|
|
|
867
1133
|
var directiveHandlers = {
|
|
868
1134
|
|
|
869
|
-
|
|
1135
|
+
YAML: function handleYamlDirective(state, name, args) {
|
|
870
1136
|
|
|
871
|
-
|
|
1137
|
+
var match, major, minor;
|
|
872
1138
|
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
1139
|
+
if (state.version !== null) {
|
|
1140
|
+
throwError(state, 'duplication of %YAML directive');
|
|
1141
|
+
}
|
|
876
1142
|
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
1143
|
+
if (args.length !== 1) {
|
|
1144
|
+
throwError(state, 'YAML directive accepts exactly one argument');
|
|
1145
|
+
}
|
|
880
1146
|
|
|
881
|
-
|
|
1147
|
+
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
882
1148
|
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
1149
|
+
if (match === null) {
|
|
1150
|
+
throwError(state, 'ill-formed argument of the YAML directive');
|
|
1151
|
+
}
|
|
886
1152
|
|
|
887
|
-
|
|
888
|
-
|
|
1153
|
+
major = parseInt(match[1], 10);
|
|
1154
|
+
minor = parseInt(match[2], 10);
|
|
889
1155
|
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
state.version = args[0];
|
|
895
|
-
state.checkLineBreaks = (minor < 2);
|
|
1156
|
+
if (major !== 1) {
|
|
1157
|
+
throwError(state, 'unacceptable YAML version of the document');
|
|
1158
|
+
}
|
|
896
1159
|
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
}
|
|
900
|
-
},
|
|
1160
|
+
state.version = args[0];
|
|
1161
|
+
state.checkLineBreaks = (minor < 2);
|
|
901
1162
|
|
|
902
|
-
|
|
1163
|
+
if (minor !== 1 && minor !== 2) {
|
|
1164
|
+
throwWarning(state, 'unsupported YAML version of the document');
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
903
1167
|
|
|
904
|
-
|
|
1168
|
+
TAG: function handleTagDirective(state, name, args) {
|
|
905
1169
|
|
|
906
|
-
|
|
907
|
-
throwError(state, 'TAG directive accepts exactly two arguments');
|
|
908
|
-
}
|
|
1170
|
+
var handle, prefix;
|
|
909
1171
|
|
|
910
|
-
|
|
911
|
-
|
|
1172
|
+
if (args.length !== 2) {
|
|
1173
|
+
throwError(state, 'TAG directive accepts exactly two arguments');
|
|
1174
|
+
}
|
|
912
1175
|
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
}
|
|
1176
|
+
handle = args[0];
|
|
1177
|
+
prefix = args[1];
|
|
916
1178
|
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
1179
|
+
if (!PATTERN_TAG_HANDLE.test(handle)) {
|
|
1180
|
+
throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
|
|
1181
|
+
}
|
|
920
1182
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
1183
|
+
if (_hasOwnProperty.call(state.tagMap, handle)) {
|
|
1184
|
+
throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
|
|
1185
|
+
}
|
|
924
1186
|
|
|
925
|
-
|
|
1187
|
+
if (!PATTERN_TAG_URI.test(prefix)) {
|
|
1188
|
+
throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
|
|
926
1189
|
}
|
|
1190
|
+
|
|
1191
|
+
state.tagMap[handle] = prefix;
|
|
1192
|
+
}
|
|
927
1193
|
};
|
|
928
1194
|
|
|
929
1195
|
|
|
@@ -938,18 +1204,20 @@ function captureSegment(state, start, end, checkJson) {
|
|
|
938
1204
|
_position < _length;
|
|
939
1205
|
_position += 1) {
|
|
940
1206
|
_character = _result.charCodeAt(_position);
|
|
941
|
-
if (!(
|
|
942
|
-
0x20 <= _character && _character <= 0x10FFFF)) {
|
|
1207
|
+
if (!(_character === 0x09 ||
|
|
1208
|
+
(0x20 <= _character && _character <= 0x10FFFF))) {
|
|
943
1209
|
throwError(state, 'expected valid JSON character');
|
|
944
1210
|
}
|
|
945
1211
|
}
|
|
1212
|
+
} else if (PATTERN_NON_PRINTABLE.test(_result)) {
|
|
1213
|
+
throwError(state, 'the stream contains non-printable characters');
|
|
946
1214
|
}
|
|
947
1215
|
|
|
948
1216
|
state.result += _result;
|
|
949
1217
|
}
|
|
950
1218
|
}
|
|
951
1219
|
|
|
952
|
-
function mergeMappings(state, destination, source) {
|
|
1220
|
+
function mergeMappings(state, destination, source, overridableKeys) {
|
|
953
1221
|
var sourceKeys, key, index, quantity;
|
|
954
1222
|
|
|
955
1223
|
if (!common.isObject(source)) {
|
|
@@ -963,29 +1231,36 @@ function mergeMappings(state, destination, source) {
|
|
|
963
1231
|
|
|
964
1232
|
if (!_hasOwnProperty.call(destination, key)) {
|
|
965
1233
|
destination[key] = source[key];
|
|
1234
|
+
overridableKeys[key] = true;
|
|
966
1235
|
}
|
|
967
1236
|
}
|
|
968
1237
|
}
|
|
969
1238
|
|
|
970
|
-
function storeMappingPair(state, _result, keyTag, keyNode, valueNode) {
|
|
1239
|
+
function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode) {
|
|
971
1240
|
var index, quantity;
|
|
972
1241
|
|
|
973
1242
|
keyNode = String(keyNode);
|
|
974
1243
|
|
|
975
|
-
if (
|
|
1244
|
+
if (_result === null) {
|
|
976
1245
|
_result = {};
|
|
977
1246
|
}
|
|
978
1247
|
|
|
979
|
-
if ('tag:yaml.org,2002:merge'
|
|
1248
|
+
if (keyTag === 'tag:yaml.org,2002:merge') {
|
|
980
1249
|
if (Array.isArray(valueNode)) {
|
|
981
1250
|
for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
982
|
-
mergeMappings(state, _result, valueNode[index]);
|
|
1251
|
+
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
983
1252
|
}
|
|
984
1253
|
} else {
|
|
985
|
-
mergeMappings(state, _result, valueNode);
|
|
1254
|
+
mergeMappings(state, _result, valueNode, overridableKeys);
|
|
986
1255
|
}
|
|
987
1256
|
} else {
|
|
1257
|
+
if (!state.json &&
|
|
1258
|
+
!_hasOwnProperty.call(overridableKeys, keyNode) &&
|
|
1259
|
+
_hasOwnProperty.call(_result, keyNode)) {
|
|
1260
|
+
throwError(state, 'duplicated mapping key');
|
|
1261
|
+
}
|
|
988
1262
|
_result[keyNode] = valueNode;
|
|
1263
|
+
delete overridableKeys[keyNode];
|
|
989
1264
|
}
|
|
990
1265
|
|
|
991
1266
|
return _result;
|
|
@@ -996,11 +1271,11 @@ function readLineBreak(state) {
|
|
|
996
1271
|
|
|
997
1272
|
ch = state.input.charCodeAt(state.position);
|
|
998
1273
|
|
|
999
|
-
if (0x0A/* LF */
|
|
1274
|
+
if (ch === 0x0A/* LF */) {
|
|
1000
1275
|
state.position++;
|
|
1001
|
-
} else if (0x0D/* CR */
|
|
1276
|
+
} else if (ch === 0x0D/* CR */) {
|
|
1002
1277
|
state.position++;
|
|
1003
|
-
if (
|
|
1278
|
+
if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
|
|
1004
1279
|
state.position++;
|
|
1005
1280
|
}
|
|
1006
1281
|
} else {
|
|
@@ -1015,15 +1290,15 @@ function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
|
1015
1290
|
var lineBreaks = 0,
|
|
1016
1291
|
ch = state.input.charCodeAt(state.position);
|
|
1017
1292
|
|
|
1018
|
-
while (
|
|
1293
|
+
while (ch !== 0) {
|
|
1019
1294
|
while (is_WHITE_SPACE(ch)) {
|
|
1020
1295
|
ch = state.input.charCodeAt(++state.position);
|
|
1021
1296
|
}
|
|
1022
1297
|
|
|
1023
|
-
if (allowComments && 0x23/* # */
|
|
1298
|
+
if (allowComments && ch === 0x23/* # */) {
|
|
1024
1299
|
do {
|
|
1025
1300
|
ch = state.input.charCodeAt(++state.position);
|
|
1026
|
-
} while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ &&
|
|
1301
|
+
} while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
|
|
1027
1302
|
}
|
|
1028
1303
|
|
|
1029
1304
|
if (is_EOL(ch)) {
|
|
@@ -1033,7 +1308,7 @@ function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
|
1033
1308
|
lineBreaks++;
|
|
1034
1309
|
state.lineIndent = 0;
|
|
1035
1310
|
|
|
1036
|
-
while (0x20/* Space */
|
|
1311
|
+
while (ch === 0x20/* Space */) {
|
|
1037
1312
|
state.lineIndent++;
|
|
1038
1313
|
ch = state.input.charCodeAt(++state.position);
|
|
1039
1314
|
}
|
|
@@ -1042,7 +1317,7 @@ function skipSeparationSpace(state, allowComments, checkIndent) {
|
|
|
1042
1317
|
}
|
|
1043
1318
|
}
|
|
1044
1319
|
|
|
1045
|
-
if (
|
|
1320
|
+
if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
|
|
1046
1321
|
throwWarning(state, 'deficient indentation');
|
|
1047
1322
|
}
|
|
1048
1323
|
|
|
@@ -1057,9 +1332,9 @@ function testDocumentSeparator(state) {
|
|
|
1057
1332
|
|
|
1058
1333
|
// Condition state.position === state.lineStart is tested
|
|
1059
1334
|
// in parent on each call, for efficiency. No needs to test here again.
|
|
1060
|
-
if ((0x2D/* - */
|
|
1061
|
-
state.input.charCodeAt(_position + 1)
|
|
1062
|
-
state.input.charCodeAt(_position+ 2)
|
|
1335
|
+
if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
|
|
1336
|
+
ch === state.input.charCodeAt(_position + 1) &&
|
|
1337
|
+
ch === state.input.charCodeAt(_position + 2)) {
|
|
1063
1338
|
|
|
1064
1339
|
_position += 3;
|
|
1065
1340
|
|
|
@@ -1074,7 +1349,7 @@ function testDocumentSeparator(state) {
|
|
|
1074
1349
|
}
|
|
1075
1350
|
|
|
1076
1351
|
function writeFoldedLines(state, count) {
|
|
1077
|
-
if (
|
|
1352
|
+
if (count === 1) {
|
|
1078
1353
|
state.result += ' ';
|
|
1079
1354
|
} else if (count > 1) {
|
|
1080
1355
|
state.result += common.repeat('\n', count - 1);
|
|
@@ -1097,23 +1372,23 @@ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
|
1097
1372
|
|
|
1098
1373
|
ch = state.input.charCodeAt(state.position);
|
|
1099
1374
|
|
|
1100
|
-
if (is_WS_OR_EOL(ch)
|
|
1101
|
-
is_FLOW_INDICATOR(ch)
|
|
1102
|
-
0x23/* # */
|
|
1103
|
-
0x26/* & */
|
|
1104
|
-
0x2A/* * */
|
|
1105
|
-
0x21/* ! */
|
|
1106
|
-
0x7C/* | */
|
|
1107
|
-
0x3E/* > */
|
|
1108
|
-
0x27/* ' */
|
|
1109
|
-
0x22/* " */
|
|
1110
|
-
0x25/* % */
|
|
1111
|
-
0x40/* @ */
|
|
1112
|
-
0x60/* ` */
|
|
1375
|
+
if (is_WS_OR_EOL(ch) ||
|
|
1376
|
+
is_FLOW_INDICATOR(ch) ||
|
|
1377
|
+
ch === 0x23/* # */ ||
|
|
1378
|
+
ch === 0x26/* & */ ||
|
|
1379
|
+
ch === 0x2A/* * */ ||
|
|
1380
|
+
ch === 0x21/* ! */ ||
|
|
1381
|
+
ch === 0x7C/* | */ ||
|
|
1382
|
+
ch === 0x3E/* > */ ||
|
|
1383
|
+
ch === 0x27/* ' */ ||
|
|
1384
|
+
ch === 0x22/* " */ ||
|
|
1385
|
+
ch === 0x25/* % */ ||
|
|
1386
|
+
ch === 0x40/* @ */ ||
|
|
1387
|
+
ch === 0x60/* ` */) {
|
|
1113
1388
|
return false;
|
|
1114
1389
|
}
|
|
1115
1390
|
|
|
1116
|
-
if (0x3F/* ? */
|
|
1391
|
+
if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
|
|
1117
1392
|
following = state.input.charCodeAt(state.position + 1);
|
|
1118
1393
|
|
|
1119
1394
|
if (is_WS_OR_EOL(following) ||
|
|
@@ -1127,16 +1402,16 @@ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
|
1127
1402
|
captureStart = captureEnd = state.position;
|
|
1128
1403
|
hasPendingContent = false;
|
|
1129
1404
|
|
|
1130
|
-
while (
|
|
1131
|
-
if (0x3A/* : */
|
|
1132
|
-
following = state.input.charCodeAt(state.position+1);
|
|
1405
|
+
while (ch !== 0) {
|
|
1406
|
+
if (ch === 0x3A/* : */) {
|
|
1407
|
+
following = state.input.charCodeAt(state.position + 1);
|
|
1133
1408
|
|
|
1134
1409
|
if (is_WS_OR_EOL(following) ||
|
|
1135
1410
|
withinFlowCollection && is_FLOW_INDICATOR(following)) {
|
|
1136
1411
|
break;
|
|
1137
1412
|
}
|
|
1138
1413
|
|
|
1139
|
-
} else if (0x23/* # */
|
|
1414
|
+
} else if (ch === 0x23/* # */) {
|
|
1140
1415
|
preceding = state.input.charCodeAt(state.position - 1);
|
|
1141
1416
|
|
|
1142
1417
|
if (is_WS_OR_EOL(preceding)) {
|
|
@@ -1184,11 +1459,11 @@ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
|
|
|
1184
1459
|
|
|
1185
1460
|
if (state.result) {
|
|
1186
1461
|
return true;
|
|
1187
|
-
} else {
|
|
1188
|
-
state.kind = _kind;
|
|
1189
|
-
state.result = _result;
|
|
1190
|
-
return false;
|
|
1191
1462
|
}
|
|
1463
|
+
|
|
1464
|
+
state.kind = _kind;
|
|
1465
|
+
state.result = _result;
|
|
1466
|
+
return false;
|
|
1192
1467
|
}
|
|
1193
1468
|
|
|
1194
1469
|
function readSingleQuotedScalar(state, nodeIndent) {
|
|
@@ -1197,7 +1472,7 @@ function readSingleQuotedScalar(state, nodeIndent) {
|
|
|
1197
1472
|
|
|
1198
1473
|
ch = state.input.charCodeAt(state.position);
|
|
1199
1474
|
|
|
1200
|
-
if (0x27/* ' */
|
|
1475
|
+
if (ch !== 0x27/* ' */) {
|
|
1201
1476
|
return false;
|
|
1202
1477
|
}
|
|
1203
1478
|
|
|
@@ -1206,12 +1481,12 @@ function readSingleQuotedScalar(state, nodeIndent) {
|
|
|
1206
1481
|
state.position++;
|
|
1207
1482
|
captureStart = captureEnd = state.position;
|
|
1208
1483
|
|
|
1209
|
-
while (
|
|
1210
|
-
if (0x27/* ' */
|
|
1484
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1485
|
+
if (ch === 0x27/* ' */) {
|
|
1211
1486
|
captureSegment(state, captureStart, state.position, true);
|
|
1212
1487
|
ch = state.input.charCodeAt(++state.position);
|
|
1213
1488
|
|
|
1214
|
-
if (0x27/* ' */
|
|
1489
|
+
if (ch === 0x27/* ' */) {
|
|
1215
1490
|
captureStart = captureEnd = state.position;
|
|
1216
1491
|
state.position++;
|
|
1217
1492
|
} else {
|
|
@@ -1240,12 +1515,12 @@ function readDoubleQuotedScalar(state, nodeIndent) {
|
|
|
1240
1515
|
captureEnd,
|
|
1241
1516
|
hexLength,
|
|
1242
1517
|
hexResult,
|
|
1243
|
-
tmp,
|
|
1518
|
+
tmp,
|
|
1244
1519
|
ch;
|
|
1245
1520
|
|
|
1246
1521
|
ch = state.input.charCodeAt(state.position);
|
|
1247
1522
|
|
|
1248
|
-
if (0x22/* " */
|
|
1523
|
+
if (ch !== 0x22/* " */) {
|
|
1249
1524
|
return false;
|
|
1250
1525
|
}
|
|
1251
1526
|
|
|
@@ -1254,20 +1529,20 @@ function readDoubleQuotedScalar(state, nodeIndent) {
|
|
|
1254
1529
|
state.position++;
|
|
1255
1530
|
captureStart = captureEnd = state.position;
|
|
1256
1531
|
|
|
1257
|
-
while (
|
|
1258
|
-
if (0x22/* " */
|
|
1532
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
1533
|
+
if (ch === 0x22/* " */) {
|
|
1259
1534
|
captureSegment(state, captureStart, state.position, true);
|
|
1260
1535
|
state.position++;
|
|
1261
1536
|
return true;
|
|
1262
1537
|
|
|
1263
|
-
} else if (0x5C/* \ */
|
|
1538
|
+
} else if (ch === 0x5C/* \ */) {
|
|
1264
1539
|
captureSegment(state, captureStart, state.position, true);
|
|
1265
1540
|
ch = state.input.charCodeAt(++state.position);
|
|
1266
1541
|
|
|
1267
1542
|
if (is_EOL(ch)) {
|
|
1268
1543
|
skipSeparationSpace(state, false, nodeIndent);
|
|
1269
1544
|
|
|
1270
|
-
//TODO: rework to inline fn with no type cast?
|
|
1545
|
+
// TODO: rework to inline fn with no type cast?
|
|
1271
1546
|
} else if (ch < 256 && simpleEscapeCheck[ch]) {
|
|
1272
1547
|
state.result += simpleEscapeMap[ch];
|
|
1273
1548
|
state.position++;
|
|
@@ -1325,6 +1600,7 @@ function readFlowCollection(state, nodeIndent) {
|
|
|
1325
1600
|
isPair,
|
|
1326
1601
|
isExplicitPair,
|
|
1327
1602
|
isMapping,
|
|
1603
|
+
overridableKeys = {},
|
|
1328
1604
|
keyNode,
|
|
1329
1605
|
keyTag,
|
|
1330
1606
|
valueNode,
|
|
@@ -1333,24 +1609,24 @@ function readFlowCollection(state, nodeIndent) {
|
|
|
1333
1609
|
ch = state.input.charCodeAt(state.position);
|
|
1334
1610
|
|
|
1335
1611
|
if (ch === 0x5B/* [ */) {
|
|
1336
|
-
terminator = 0x5D
|
|
1612
|
+
terminator = 0x5D;/* ] */
|
|
1337
1613
|
isMapping = false;
|
|
1338
1614
|
_result = [];
|
|
1339
1615
|
} else if (ch === 0x7B/* { */) {
|
|
1340
|
-
terminator = 0x7D
|
|
1616
|
+
terminator = 0x7D;/* } */
|
|
1341
1617
|
isMapping = true;
|
|
1342
1618
|
_result = {};
|
|
1343
1619
|
} else {
|
|
1344
1620
|
return false;
|
|
1345
1621
|
}
|
|
1346
1622
|
|
|
1347
|
-
if (
|
|
1623
|
+
if (state.anchor !== null) {
|
|
1348
1624
|
state.anchorMap[state.anchor] = _result;
|
|
1349
1625
|
}
|
|
1350
1626
|
|
|
1351
1627
|
ch = state.input.charCodeAt(++state.position);
|
|
1352
1628
|
|
|
1353
|
-
while (
|
|
1629
|
+
while (ch !== 0) {
|
|
1354
1630
|
skipSeparationSpace(state, true, nodeIndent);
|
|
1355
1631
|
|
|
1356
1632
|
ch = state.input.charCodeAt(state.position);
|
|
@@ -1369,7 +1645,7 @@ function readFlowCollection(state, nodeIndent) {
|
|
|
1369
1645
|
keyTag = keyNode = valueNode = null;
|
|
1370
1646
|
isPair = isExplicitPair = false;
|
|
1371
1647
|
|
|
1372
|
-
if (0x3F/* ? */
|
|
1648
|
+
if (ch === 0x3F/* ? */) {
|
|
1373
1649
|
following = state.input.charCodeAt(state.position + 1);
|
|
1374
1650
|
|
|
1375
1651
|
if (is_WS_OR_EOL(following)) {
|
|
@@ -1387,7 +1663,7 @@ function readFlowCollection(state, nodeIndent) {
|
|
|
1387
1663
|
|
|
1388
1664
|
ch = state.input.charCodeAt(state.position);
|
|
1389
1665
|
|
|
1390
|
-
if ((isExplicitPair || state.line === _line) && 0x3A/* : */
|
|
1666
|
+
if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
|
|
1391
1667
|
isPair = true;
|
|
1392
1668
|
ch = state.input.charCodeAt(++state.position);
|
|
1393
1669
|
skipSeparationSpace(state, true, nodeIndent);
|
|
@@ -1396,9 +1672,9 @@ function readFlowCollection(state, nodeIndent) {
|
|
|
1396
1672
|
}
|
|
1397
1673
|
|
|
1398
1674
|
if (isMapping) {
|
|
1399
|
-
storeMappingPair(state, _result, keyTag, keyNode, valueNode);
|
|
1675
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
|
|
1400
1676
|
} else if (isPair) {
|
|
1401
|
-
_result.push(storeMappingPair(state, null, keyTag, keyNode, valueNode));
|
|
1677
|
+
_result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
|
|
1402
1678
|
} else {
|
|
1403
1679
|
_result.push(keyNode);
|
|
1404
1680
|
}
|
|
@@ -1407,7 +1683,7 @@ function readFlowCollection(state, nodeIndent) {
|
|
|
1407
1683
|
|
|
1408
1684
|
ch = state.input.charCodeAt(state.position);
|
|
1409
1685
|
|
|
1410
|
-
if (0x2C/* , */
|
|
1686
|
+
if (ch === 0x2C/* , */) {
|
|
1411
1687
|
readNext = true;
|
|
1412
1688
|
ch = state.input.charCodeAt(++state.position);
|
|
1413
1689
|
} else {
|
|
@@ -1422,6 +1698,7 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
1422
1698
|
var captureStart,
|
|
1423
1699
|
folding,
|
|
1424
1700
|
chomping = CHOMPING_CLIP,
|
|
1701
|
+
didReadContent = false,
|
|
1425
1702
|
detectedIndent = false,
|
|
1426
1703
|
textIndent = nodeIndent,
|
|
1427
1704
|
emptyLines = 0,
|
|
@@ -1442,12 +1719,12 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
1442
1719
|
state.kind = 'scalar';
|
|
1443
1720
|
state.result = '';
|
|
1444
1721
|
|
|
1445
|
-
while (
|
|
1722
|
+
while (ch !== 0) {
|
|
1446
1723
|
ch = state.input.charCodeAt(++state.position);
|
|
1447
1724
|
|
|
1448
|
-
if (0x2B/* + */
|
|
1725
|
+
if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
|
|
1449
1726
|
if (CHOMPING_CLIP === chomping) {
|
|
1450
|
-
chomping = (0x2B/* + */
|
|
1727
|
+
chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
|
|
1451
1728
|
} else {
|
|
1452
1729
|
throwError(state, 'repeat of a chomping mode identifier');
|
|
1453
1730
|
}
|
|
@@ -1471,20 +1748,20 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
1471
1748
|
do { ch = state.input.charCodeAt(++state.position); }
|
|
1472
1749
|
while (is_WHITE_SPACE(ch));
|
|
1473
1750
|
|
|
1474
|
-
if (0x23/* # */
|
|
1751
|
+
if (ch === 0x23/* # */) {
|
|
1475
1752
|
do { ch = state.input.charCodeAt(++state.position); }
|
|
1476
|
-
while (!is_EOL(ch) && (
|
|
1753
|
+
while (!is_EOL(ch) && (ch !== 0));
|
|
1477
1754
|
}
|
|
1478
1755
|
}
|
|
1479
1756
|
|
|
1480
|
-
while (
|
|
1757
|
+
while (ch !== 0) {
|
|
1481
1758
|
readLineBreak(state);
|
|
1482
1759
|
state.lineIndent = 0;
|
|
1483
1760
|
|
|
1484
1761
|
ch = state.input.charCodeAt(state.position);
|
|
1485
1762
|
|
|
1486
1763
|
while ((!detectedIndent || state.lineIndent < textIndent) &&
|
|
1487
|
-
(0x20/* Space */
|
|
1764
|
+
(ch === 0x20/* Space */)) {
|
|
1488
1765
|
state.lineIndent++;
|
|
1489
1766
|
ch = state.input.charCodeAt(++state.position);
|
|
1490
1767
|
}
|
|
@@ -1503,9 +1780,9 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
1503
1780
|
|
|
1504
1781
|
// Perform the chomping.
|
|
1505
1782
|
if (chomping === CHOMPING_KEEP) {
|
|
1506
|
-
state.result += common.repeat('\n', emptyLines);
|
|
1783
|
+
state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
|
|
1507
1784
|
} else if (chomping === CHOMPING_CLIP) {
|
|
1508
|
-
if (
|
|
1785
|
+
if (didReadContent) { // i.e. only if the scalar is not empty.
|
|
1509
1786
|
state.result += '\n';
|
|
1510
1787
|
}
|
|
1511
1788
|
}
|
|
@@ -1520,7 +1797,8 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
1520
1797
|
// Lines starting with white space characters (more-indented lines) are not folded.
|
|
1521
1798
|
if (is_WHITE_SPACE(ch)) {
|
|
1522
1799
|
atMoreIndented = true;
|
|
1523
|
-
|
|
1800
|
+
// except for the first content line (cf. Example 8.1)
|
|
1801
|
+
state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
|
|
1524
1802
|
|
|
1525
1803
|
// End of more-indented block.
|
|
1526
1804
|
} else if (atMoreIndented) {
|
|
@@ -1528,8 +1806,8 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
1528
1806
|
state.result += common.repeat('\n', emptyLines + 1);
|
|
1529
1807
|
|
|
1530
1808
|
// Just one line break - perceive as the same line.
|
|
1531
|
-
} else if (
|
|
1532
|
-
if (
|
|
1809
|
+
} else if (emptyLines === 0) {
|
|
1810
|
+
if (didReadContent) { // i.e. only if we have already read some scalar content.
|
|
1533
1811
|
state.result += ' ';
|
|
1534
1812
|
}
|
|
1535
1813
|
|
|
@@ -1540,23 +1818,18 @@ function readBlockScalar(state, nodeIndent) {
|
|
|
1540
1818
|
|
|
1541
1819
|
// Literal style: just add exact number of line breaks between content lines.
|
|
1542
1820
|
} else {
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
if (detectedIndent) {
|
|
1546
|
-
state.result += common.repeat('\n', emptyLines + 1);
|
|
1547
|
-
|
|
1548
|
-
// In case of the first content line - count only empty lines.
|
|
1549
|
-
} else {
|
|
1550
|
-
state.result += common.repeat('\n', emptyLines);
|
|
1551
|
-
}
|
|
1821
|
+
// Keep all line breaks except the header line break.
|
|
1822
|
+
state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
|
|
1552
1823
|
}
|
|
1553
1824
|
|
|
1825
|
+
didReadContent = true;
|
|
1554
1826
|
detectedIndent = true;
|
|
1555
1827
|
emptyLines = 0;
|
|
1556
1828
|
captureStart = state.position;
|
|
1557
1829
|
|
|
1558
|
-
while (!is_EOL(ch) && (
|
|
1559
|
-
|
|
1830
|
+
while (!is_EOL(ch) && (ch !== 0)) {
|
|
1831
|
+
ch = state.input.charCodeAt(++state.position);
|
|
1832
|
+
}
|
|
1560
1833
|
|
|
1561
1834
|
captureSegment(state, captureStart, state.position, false);
|
|
1562
1835
|
}
|
|
@@ -1573,15 +1846,15 @@ function readBlockSequence(state, nodeIndent) {
|
|
|
1573
1846
|
detected = false,
|
|
1574
1847
|
ch;
|
|
1575
1848
|
|
|
1576
|
-
if (
|
|
1849
|
+
if (state.anchor !== null) {
|
|
1577
1850
|
state.anchorMap[state.anchor] = _result;
|
|
1578
1851
|
}
|
|
1579
1852
|
|
|
1580
1853
|
ch = state.input.charCodeAt(state.position);
|
|
1581
1854
|
|
|
1582
|
-
while (
|
|
1855
|
+
while (ch !== 0) {
|
|
1583
1856
|
|
|
1584
|
-
if (0x2D/* - */
|
|
1857
|
+
if (ch !== 0x2D/* - */) {
|
|
1585
1858
|
break;
|
|
1586
1859
|
}
|
|
1587
1860
|
|
|
@@ -1609,7 +1882,7 @@ function readBlockSequence(state, nodeIndent) {
|
|
|
1609
1882
|
|
|
1610
1883
|
ch = state.input.charCodeAt(state.position);
|
|
1611
1884
|
|
|
1612
|
-
if ((state.line === _line || state.lineIndent > nodeIndent) && (
|
|
1885
|
+
if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
|
|
1613
1886
|
throwError(state, 'bad indentation of a sequence entry');
|
|
1614
1887
|
} else if (state.lineIndent < nodeIndent) {
|
|
1615
1888
|
break;
|
|
@@ -1622,9 +1895,8 @@ function readBlockSequence(state, nodeIndent) {
|
|
|
1622
1895
|
state.kind = 'sequence';
|
|
1623
1896
|
state.result = _result;
|
|
1624
1897
|
return true;
|
|
1625
|
-
} else {
|
|
1626
|
-
return false;
|
|
1627
1898
|
}
|
|
1899
|
+
return false;
|
|
1628
1900
|
}
|
|
1629
1901
|
|
|
1630
1902
|
function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
@@ -1634,6 +1906,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
1634
1906
|
_tag = state.tag,
|
|
1635
1907
|
_anchor = state.anchor,
|
|
1636
1908
|
_result = {},
|
|
1909
|
+
overridableKeys = {},
|
|
1637
1910
|
keyTag = null,
|
|
1638
1911
|
keyNode = null,
|
|
1639
1912
|
valueNode = null,
|
|
@@ -1641,13 +1914,13 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
1641
1914
|
detected = false,
|
|
1642
1915
|
ch;
|
|
1643
1916
|
|
|
1644
|
-
if (
|
|
1917
|
+
if (state.anchor !== null) {
|
|
1645
1918
|
state.anchorMap[state.anchor] = _result;
|
|
1646
1919
|
}
|
|
1647
1920
|
|
|
1648
1921
|
ch = state.input.charCodeAt(state.position);
|
|
1649
1922
|
|
|
1650
|
-
while (
|
|
1923
|
+
while (ch !== 0) {
|
|
1651
1924
|
following = state.input.charCodeAt(state.position + 1);
|
|
1652
1925
|
_line = state.line; // Save the current line.
|
|
1653
1926
|
|
|
@@ -1655,11 +1928,11 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
1655
1928
|
// Explicit notation case. There are two separate blocks:
|
|
1656
1929
|
// first for the key (denoted by "?") and second for the value (denoted by ":")
|
|
1657
1930
|
//
|
|
1658
|
-
if ((0x3F/* ? */
|
|
1931
|
+
if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
|
|
1659
1932
|
|
|
1660
|
-
if (0x3F/* ? */
|
|
1933
|
+
if (ch === 0x3F/* ? */) {
|
|
1661
1934
|
if (atExplicitKey) {
|
|
1662
|
-
storeMappingPair(state, _result, keyTag, keyNode, null);
|
|
1935
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
1663
1936
|
keyTag = keyNode = valueNode = null;
|
|
1664
1937
|
}
|
|
1665
1938
|
|
|
@@ -1691,7 +1964,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
1691
1964
|
ch = state.input.charCodeAt(++state.position);
|
|
1692
1965
|
}
|
|
1693
1966
|
|
|
1694
|
-
if (0x3A/* : */
|
|
1967
|
+
if (ch === 0x3A/* : */) {
|
|
1695
1968
|
ch = state.input.charCodeAt(++state.position);
|
|
1696
1969
|
|
|
1697
1970
|
if (!is_WS_OR_EOL(ch)) {
|
|
@@ -1699,7 +1972,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
1699
1972
|
}
|
|
1700
1973
|
|
|
1701
1974
|
if (atExplicitKey) {
|
|
1702
|
-
storeMappingPair(state, _result, keyTag, keyNode, null);
|
|
1975
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
1703
1976
|
keyTag = keyNode = valueNode = null;
|
|
1704
1977
|
}
|
|
1705
1978
|
|
|
@@ -1744,7 +2017,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
1744
2017
|
}
|
|
1745
2018
|
|
|
1746
2019
|
if (!atExplicitKey) {
|
|
1747
|
-
storeMappingPair(state, _result, keyTag, keyNode, valueNode);
|
|
2020
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
|
|
1748
2021
|
keyTag = keyNode = valueNode = null;
|
|
1749
2022
|
}
|
|
1750
2023
|
|
|
@@ -1752,7 +2025,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
1752
2025
|
ch = state.input.charCodeAt(state.position);
|
|
1753
2026
|
}
|
|
1754
2027
|
|
|
1755
|
-
if (state.lineIndent > nodeIndent && (
|
|
2028
|
+
if (state.lineIndent > nodeIndent && (ch !== 0)) {
|
|
1756
2029
|
throwError(state, 'bad indentation of a mapping entry');
|
|
1757
2030
|
} else if (state.lineIndent < nodeIndent) {
|
|
1758
2031
|
break;
|
|
@@ -1765,7 +2038,7 @@ function readBlockMapping(state, nodeIndent, flowIndent) {
|
|
|
1765
2038
|
|
|
1766
2039
|
// Special case: last mapping's node contains only the key in explicit notation.
|
|
1767
2040
|
if (atExplicitKey) {
|
|
1768
|
-
storeMappingPair(state, _result, keyTag, keyNode, null);
|
|
2041
|
+
storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
|
|
1769
2042
|
}
|
|
1770
2043
|
|
|
1771
2044
|
// Expose the resulting mapping.
|
|
@@ -1789,21 +2062,19 @@ function readTagProperty(state) {
|
|
|
1789
2062
|
|
|
1790
2063
|
ch = state.input.charCodeAt(state.position);
|
|
1791
2064
|
|
|
1792
|
-
if (0x21/* ! */
|
|
1793
|
-
return false;
|
|
1794
|
-
}
|
|
2065
|
+
if (ch !== 0x21/* ! */) return false;
|
|
1795
2066
|
|
|
1796
|
-
if (
|
|
2067
|
+
if (state.tag !== null) {
|
|
1797
2068
|
throwError(state, 'duplication of a tag property');
|
|
1798
2069
|
}
|
|
1799
2070
|
|
|
1800
2071
|
ch = state.input.charCodeAt(++state.position);
|
|
1801
2072
|
|
|
1802
|
-
if (0x3C/* < */
|
|
2073
|
+
if (ch === 0x3C/* < */) {
|
|
1803
2074
|
isVerbatim = true;
|
|
1804
2075
|
ch = state.input.charCodeAt(++state.position);
|
|
1805
2076
|
|
|
1806
|
-
} else if (0x21/* ! */
|
|
2077
|
+
} else if (ch === 0x21/* ! */) {
|
|
1807
2078
|
isNamed = true;
|
|
1808
2079
|
tagHandle = '!!';
|
|
1809
2080
|
ch = state.input.charCodeAt(++state.position);
|
|
@@ -1816,7 +2087,7 @@ function readTagProperty(state) {
|
|
|
1816
2087
|
|
|
1817
2088
|
if (isVerbatim) {
|
|
1818
2089
|
do { ch = state.input.charCodeAt(++state.position); }
|
|
1819
|
-
while (
|
|
2090
|
+
while (ch !== 0 && ch !== 0x3E/* > */);
|
|
1820
2091
|
|
|
1821
2092
|
if (state.position < state.length) {
|
|
1822
2093
|
tagName = state.input.slice(_position, state.position);
|
|
@@ -1825,9 +2096,9 @@ function readTagProperty(state) {
|
|
|
1825
2096
|
throwError(state, 'unexpected end of the stream within a verbatim tag');
|
|
1826
2097
|
}
|
|
1827
2098
|
} else {
|
|
1828
|
-
while (
|
|
2099
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
1829
2100
|
|
|
1830
|
-
if (0x21/* ! */
|
|
2101
|
+
if (ch === 0x21/* ! */) {
|
|
1831
2102
|
if (!isNamed) {
|
|
1832
2103
|
tagHandle = state.input.slice(_position - 1, state.position + 1);
|
|
1833
2104
|
|
|
@@ -1862,10 +2133,10 @@ function readTagProperty(state) {
|
|
|
1862
2133
|
} else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
|
|
1863
2134
|
state.tag = state.tagMap[tagHandle] + tagName;
|
|
1864
2135
|
|
|
1865
|
-
} else if ('!'
|
|
2136
|
+
} else if (tagHandle === '!') {
|
|
1866
2137
|
state.tag = '!' + tagName;
|
|
1867
2138
|
|
|
1868
|
-
} else if ('!!'
|
|
2139
|
+
} else if (tagHandle === '!!') {
|
|
1869
2140
|
state.tag = 'tag:yaml.org,2002:' + tagName;
|
|
1870
2141
|
|
|
1871
2142
|
} else {
|
|
@@ -1881,18 +2152,16 @@ function readAnchorProperty(state) {
|
|
|
1881
2152
|
|
|
1882
2153
|
ch = state.input.charCodeAt(state.position);
|
|
1883
2154
|
|
|
1884
|
-
if (0x26/* & */
|
|
1885
|
-
return false;
|
|
1886
|
-
}
|
|
2155
|
+
if (ch !== 0x26/* & */) return false;
|
|
1887
2156
|
|
|
1888
|
-
if (
|
|
2157
|
+
if (state.anchor !== null) {
|
|
1889
2158
|
throwError(state, 'duplication of an anchor property');
|
|
1890
2159
|
}
|
|
1891
2160
|
|
|
1892
2161
|
ch = state.input.charCodeAt(++state.position);
|
|
1893
2162
|
_position = state.position;
|
|
1894
2163
|
|
|
1895
|
-
while (
|
|
2164
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
1896
2165
|
ch = state.input.charCodeAt(++state.position);
|
|
1897
2166
|
}
|
|
1898
2167
|
|
|
@@ -1906,20 +2175,16 @@ function readAnchorProperty(state) {
|
|
|
1906
2175
|
|
|
1907
2176
|
function readAlias(state) {
|
|
1908
2177
|
var _position, alias,
|
|
1909
|
-
len = state.length,
|
|
1910
|
-
input = state.input,
|
|
1911
2178
|
ch;
|
|
1912
2179
|
|
|
1913
2180
|
ch = state.input.charCodeAt(state.position);
|
|
1914
2181
|
|
|
1915
|
-
if (0x2A/* * */
|
|
1916
|
-
return false;
|
|
1917
|
-
}
|
|
2182
|
+
if (ch !== 0x2A/* * */) return false;
|
|
1918
2183
|
|
|
1919
2184
|
ch = state.input.charCodeAt(++state.position);
|
|
1920
2185
|
_position = state.position;
|
|
1921
2186
|
|
|
1922
|
-
while (
|
|
2187
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
|
|
1923
2188
|
ch = state.input.charCodeAt(++state.position);
|
|
1924
2189
|
}
|
|
1925
2190
|
|
|
@@ -1949,8 +2214,11 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
1949
2214
|
typeQuantity,
|
|
1950
2215
|
type,
|
|
1951
2216
|
flowIndent,
|
|
1952
|
-
blockIndent
|
|
1953
|
-
|
|
2217
|
+
blockIndent;
|
|
2218
|
+
|
|
2219
|
+
if (state.listener !== null) {
|
|
2220
|
+
state.listener('open', state);
|
|
2221
|
+
}
|
|
1954
2222
|
|
|
1955
2223
|
state.tag = null;
|
|
1956
2224
|
state.anchor = null;
|
|
@@ -1975,7 +2243,7 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
1975
2243
|
}
|
|
1976
2244
|
}
|
|
1977
2245
|
|
|
1978
|
-
if (
|
|
2246
|
+
if (indentStatus === 1) {
|
|
1979
2247
|
while (readTagProperty(state) || readAnchorProperty(state)) {
|
|
1980
2248
|
if (skipSeparationSpace(state, true, -1)) {
|
|
1981
2249
|
atNewLine = true;
|
|
@@ -1998,7 +2266,7 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
1998
2266
|
allowBlockCollections = atNewLine || allowCompact;
|
|
1999
2267
|
}
|
|
2000
2268
|
|
|
2001
|
-
if (
|
|
2269
|
+
if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
|
|
2002
2270
|
if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
|
|
2003
2271
|
flowIndent = parentIndent;
|
|
2004
2272
|
} else {
|
|
@@ -2007,7 +2275,7 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
2007
2275
|
|
|
2008
2276
|
blockIndent = state.position - state.lineStart;
|
|
2009
2277
|
|
|
2010
|
-
if (
|
|
2278
|
+
if (indentStatus === 1) {
|
|
2011
2279
|
if (allowBlockCollections &&
|
|
2012
2280
|
(readBlockSequence(state, blockIndent) ||
|
|
2013
2281
|
readBlockMapping(state, blockIndent, flowIndent)) ||
|
|
@@ -2022,31 +2290,31 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
2022
2290
|
} else if (readAlias(state)) {
|
|
2023
2291
|
hasContent = true;
|
|
2024
2292
|
|
|
2025
|
-
if (
|
|
2293
|
+
if (state.tag !== null || state.anchor !== null) {
|
|
2026
2294
|
throwError(state, 'alias node should not have any properties');
|
|
2027
2295
|
}
|
|
2028
2296
|
|
|
2029
2297
|
} else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
|
|
2030
2298
|
hasContent = true;
|
|
2031
2299
|
|
|
2032
|
-
if (
|
|
2300
|
+
if (state.tag === null) {
|
|
2033
2301
|
state.tag = '?';
|
|
2034
2302
|
}
|
|
2035
2303
|
}
|
|
2036
2304
|
|
|
2037
|
-
if (
|
|
2305
|
+
if (state.anchor !== null) {
|
|
2038
2306
|
state.anchorMap[state.anchor] = state.result;
|
|
2039
2307
|
}
|
|
2040
2308
|
}
|
|
2041
|
-
} else if (
|
|
2309
|
+
} else if (indentStatus === 0) {
|
|
2042
2310
|
// Special case: block sequences are allowed to have same indentation level as the parent.
|
|
2043
2311
|
// http://www.yaml.org/spec/1.2/spec.html#id2799784
|
|
2044
2312
|
hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
|
|
2045
2313
|
}
|
|
2046
2314
|
}
|
|
2047
2315
|
|
|
2048
|
-
if (
|
|
2049
|
-
if ('?'
|
|
2316
|
+
if (state.tag !== null && state.tag !== '!') {
|
|
2317
|
+
if (state.tag === '?') {
|
|
2050
2318
|
for (typeIndex = 0, typeQuantity = state.implicitTypes.length;
|
|
2051
2319
|
typeIndex < typeQuantity;
|
|
2052
2320
|
typeIndex += 1) {
|
|
@@ -2059,7 +2327,7 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
2059
2327
|
if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
|
|
2060
2328
|
state.result = type.construct(state.result);
|
|
2061
2329
|
state.tag = type.tag;
|
|
2062
|
-
if (
|
|
2330
|
+
if (state.anchor !== null) {
|
|
2063
2331
|
state.anchorMap[state.anchor] = state.result;
|
|
2064
2332
|
}
|
|
2065
2333
|
break;
|
|
@@ -2068,7 +2336,7 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
2068
2336
|
} else if (_hasOwnProperty.call(state.typeMap, state.tag)) {
|
|
2069
2337
|
type = state.typeMap[state.tag];
|
|
2070
2338
|
|
|
2071
|
-
if (
|
|
2339
|
+
if (state.result !== null && type.kind !== state.kind) {
|
|
2072
2340
|
throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
|
|
2073
2341
|
}
|
|
2074
2342
|
|
|
@@ -2076,16 +2344,19 @@ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact
|
|
|
2076
2344
|
throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
|
|
2077
2345
|
} else {
|
|
2078
2346
|
state.result = type.construct(state.result);
|
|
2079
|
-
if (
|
|
2347
|
+
if (state.anchor !== null) {
|
|
2080
2348
|
state.anchorMap[state.anchor] = state.result;
|
|
2081
2349
|
}
|
|
2082
2350
|
}
|
|
2083
2351
|
} else {
|
|
2084
|
-
|
|
2352
|
+
throwError(state, 'unknown tag !<' + state.tag + '>');
|
|
2085
2353
|
}
|
|
2086
2354
|
}
|
|
2087
2355
|
|
|
2088
|
-
|
|
2356
|
+
if (state.listener !== null) {
|
|
2357
|
+
state.listener('close', state);
|
|
2358
|
+
}
|
|
2359
|
+
return state.tag !== null || state.anchor !== null || hasContent;
|
|
2089
2360
|
}
|
|
2090
2361
|
|
|
2091
2362
|
function readDocument(state) {
|
|
@@ -2101,12 +2372,12 @@ function readDocument(state) {
|
|
|
2101
2372
|
state.tagMap = {};
|
|
2102
2373
|
state.anchorMap = {};
|
|
2103
2374
|
|
|
2104
|
-
while (
|
|
2375
|
+
while ((ch = state.input.charCodeAt(state.position)) !== 0) {
|
|
2105
2376
|
skipSeparationSpace(state, true, -1);
|
|
2106
2377
|
|
|
2107
2378
|
ch = state.input.charCodeAt(state.position);
|
|
2108
2379
|
|
|
2109
|
-
if (state.lineIndent > 0 || 0x25/* % */
|
|
2380
|
+
if (state.lineIndent > 0 || ch !== 0x25/* % */) {
|
|
2110
2381
|
break;
|
|
2111
2382
|
}
|
|
2112
2383
|
|
|
@@ -2114,7 +2385,7 @@ function readDocument(state) {
|
|
|
2114
2385
|
ch = state.input.charCodeAt(++state.position);
|
|
2115
2386
|
_position = state.position;
|
|
2116
2387
|
|
|
2117
|
-
while (
|
|
2388
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2118
2389
|
ch = state.input.charCodeAt(++state.position);
|
|
2119
2390
|
}
|
|
2120
2391
|
|
|
@@ -2125,33 +2396,29 @@ function readDocument(state) {
|
|
|
2125
2396
|
throwError(state, 'directive name must not be less than one character in length');
|
|
2126
2397
|
}
|
|
2127
2398
|
|
|
2128
|
-
while (
|
|
2399
|
+
while (ch !== 0) {
|
|
2129
2400
|
while (is_WHITE_SPACE(ch)) {
|
|
2130
2401
|
ch = state.input.charCodeAt(++state.position);
|
|
2131
2402
|
}
|
|
2132
2403
|
|
|
2133
|
-
if (0x23/* # */
|
|
2404
|
+
if (ch === 0x23/* # */) {
|
|
2134
2405
|
do { ch = state.input.charCodeAt(++state.position); }
|
|
2135
|
-
while (
|
|
2406
|
+
while (ch !== 0 && !is_EOL(ch));
|
|
2136
2407
|
break;
|
|
2137
2408
|
}
|
|
2138
2409
|
|
|
2139
|
-
if (is_EOL(ch))
|
|
2140
|
-
break;
|
|
2141
|
-
}
|
|
2410
|
+
if (is_EOL(ch)) break;
|
|
2142
2411
|
|
|
2143
2412
|
_position = state.position;
|
|
2144
2413
|
|
|
2145
|
-
while (
|
|
2414
|
+
while (ch !== 0 && !is_WS_OR_EOL(ch)) {
|
|
2146
2415
|
ch = state.input.charCodeAt(++state.position);
|
|
2147
2416
|
}
|
|
2148
2417
|
|
|
2149
2418
|
directiveArgs.push(state.input.slice(_position, state.position));
|
|
2150
2419
|
}
|
|
2151
2420
|
|
|
2152
|
-
if (
|
|
2153
|
-
readLineBreak(state);
|
|
2154
|
-
}
|
|
2421
|
+
if (ch !== 0) readLineBreak(state);
|
|
2155
2422
|
|
|
2156
2423
|
if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
|
|
2157
2424
|
directiveHandlers[directiveName](state, directiveName, directiveArgs);
|
|
@@ -2162,10 +2429,10 @@ function readDocument(state) {
|
|
|
2162
2429
|
|
|
2163
2430
|
skipSeparationSpace(state, true, -1);
|
|
2164
2431
|
|
|
2165
|
-
if (
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2432
|
+
if (state.lineIndent === 0 &&
|
|
2433
|
+
state.input.charCodeAt(state.position) === 0x2D/* - */ &&
|
|
2434
|
+
state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
|
|
2435
|
+
state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
|
|
2169
2436
|
state.position += 3;
|
|
2170
2437
|
skipSeparationSpace(state, true, -1);
|
|
2171
2438
|
|
|
@@ -2185,7 +2452,7 @@ function readDocument(state) {
|
|
|
2185
2452
|
|
|
2186
2453
|
if (state.position === state.lineStart && testDocumentSeparator(state)) {
|
|
2187
2454
|
|
|
2188
|
-
if (
|
|
2455
|
+
if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
|
|
2189
2456
|
state.position += 3;
|
|
2190
2457
|
skipSeparationSpace(state, true, -1);
|
|
2191
2458
|
}
|
|
@@ -2204,22 +2471,26 @@ function loadDocuments(input, options) {
|
|
|
2204
2471
|
input = String(input);
|
|
2205
2472
|
options = options || {};
|
|
2206
2473
|
|
|
2207
|
-
if (
|
|
2208
|
-
0x0A/* LF */ !== input.charCodeAt(input.length - 1) &&
|
|
2209
|
-
0x0D/* CR */ !== input.charCodeAt(input.length - 1)) {
|
|
2210
|
-
input += '\n';
|
|
2211
|
-
}
|
|
2474
|
+
if (input.length !== 0) {
|
|
2212
2475
|
|
|
2213
|
-
|
|
2476
|
+
// Add tailing `\n` if not exists
|
|
2477
|
+
if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
|
|
2478
|
+
input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
|
|
2479
|
+
input += '\n';
|
|
2480
|
+
}
|
|
2214
2481
|
|
|
2215
|
-
|
|
2216
|
-
|
|
2482
|
+
// Strip BOM
|
|
2483
|
+
if (input.charCodeAt(0) === 0xFEFF) {
|
|
2484
|
+
input = input.slice(1);
|
|
2485
|
+
}
|
|
2217
2486
|
}
|
|
2218
2487
|
|
|
2488
|
+
var state = new State(input, options);
|
|
2489
|
+
|
|
2219
2490
|
// Use 0 as string terminator. That significantly simplifies bounds check.
|
|
2220
2491
|
state.input += '\0';
|
|
2221
2492
|
|
|
2222
|
-
while (
|
|
2493
|
+
while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
|
|
2223
2494
|
state.lineIndent += 1;
|
|
2224
2495
|
state.position += 1;
|
|
2225
2496
|
}
|
|
@@ -2242,15 +2513,15 @@ function loadAll(input, iterator, options) {
|
|
|
2242
2513
|
|
|
2243
2514
|
|
|
2244
2515
|
function load(input, options) {
|
|
2245
|
-
var documents = loadDocuments(input, options)
|
|
2516
|
+
var documents = loadDocuments(input, options);
|
|
2246
2517
|
|
|
2247
|
-
if (
|
|
2518
|
+
if (documents.length === 0) {
|
|
2519
|
+
/*eslint-disable no-undefined*/
|
|
2248
2520
|
return undefined;
|
|
2249
|
-
} else if (
|
|
2521
|
+
} else if (documents.length === 1) {
|
|
2250
2522
|
return documents[0];
|
|
2251
|
-
} else {
|
|
2252
|
-
throw new YAMLException('expected a single document in the stream, but found more');
|
|
2253
2523
|
}
|
|
2524
|
+
throw new YAMLException('expected a single document in the stream, but found more');
|
|
2254
2525
|
}
|
|
2255
2526
|
|
|
2256
2527
|
|
|
@@ -2288,9 +2559,7 @@ function Mark(name, buffer, position, line, column) {
|
|
|
2288
2559
|
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
|
|
2289
2560
|
var head, start, tail, end, snippet;
|
|
2290
2561
|
|
|
2291
|
-
if (!this.buffer)
|
|
2292
|
-
return null;
|
|
2293
|
-
}
|
|
2562
|
+
if (!this.buffer) return null;
|
|
2294
2563
|
|
|
2295
2564
|
indent = indent || 4;
|
|
2296
2565
|
maxLength = maxLength || 75;
|
|
@@ -2298,7 +2567,7 @@ Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
|
|
|
2298
2567
|
head = '';
|
|
2299
2568
|
start = this.position;
|
|
2300
2569
|
|
|
2301
|
-
while (start > 0 &&
|
|
2570
|
+
while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {
|
|
2302
2571
|
start -= 1;
|
|
2303
2572
|
if (this.position - start > (maxLength / 2 - 1)) {
|
|
2304
2573
|
head = ' ... ';
|
|
@@ -2310,7 +2579,7 @@ Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
|
|
|
2310
2579
|
tail = '';
|
|
2311
2580
|
end = this.position;
|
|
2312
2581
|
|
|
2313
|
-
while (end < this.buffer.length &&
|
|
2582
|
+
while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) {
|
|
2314
2583
|
end += 1;
|
|
2315
2584
|
if (end - this.position > (maxLength / 2 - 1)) {
|
|
2316
2585
|
tail = ' ... ';
|
|
@@ -2352,6 +2621,7 @@ module.exports = Mark;
|
|
|
2352
2621
|
},{"./common":2}],7:[function(require,module,exports){
|
|
2353
2622
|
'use strict';
|
|
2354
2623
|
|
|
2624
|
+
/*eslint-disable max-len*/
|
|
2355
2625
|
|
|
2356
2626
|
var common = require('./common');
|
|
2357
2627
|
var YAMLException = require('./exception');
|
|
@@ -2376,7 +2646,7 @@ function compileList(schema, name, result) {
|
|
|
2376
2646
|
});
|
|
2377
2647
|
|
|
2378
2648
|
return result.filter(function (type, index) {
|
|
2379
|
-
return
|
|
2649
|
+
return exclude.indexOf(index) === -1;
|
|
2380
2650
|
});
|
|
2381
2651
|
}
|
|
2382
2652
|
|
|
@@ -2402,7 +2672,7 @@ function Schema(definition) {
|
|
|
2402
2672
|
this.explicit = definition.explicit || [];
|
|
2403
2673
|
|
|
2404
2674
|
this.implicit.forEach(function (type) {
|
|
2405
|
-
if (type.loadKind && 'scalar'
|
|
2675
|
+
if (type.loadKind && type.loadKind !== 'scalar') {
|
|
2406
2676
|
throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
|
|
2407
2677
|
}
|
|
2408
2678
|
});
|
|
@@ -2420,18 +2690,18 @@ Schema.create = function createSchema() {
|
|
|
2420
2690
|
var schemas, types;
|
|
2421
2691
|
|
|
2422
2692
|
switch (arguments.length) {
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2693
|
+
case 1:
|
|
2694
|
+
schemas = Schema.DEFAULT;
|
|
2695
|
+
types = arguments[0];
|
|
2696
|
+
break;
|
|
2427
2697
|
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2698
|
+
case 2:
|
|
2699
|
+
schemas = arguments[0];
|
|
2700
|
+
types = arguments[1];
|
|
2701
|
+
break;
|
|
2432
2702
|
|
|
2433
|
-
|
|
2434
|
-
|
|
2703
|
+
default:
|
|
2704
|
+
throw new YAMLException('Wrong number of arguments for Schema.create function');
|
|
2435
2705
|
}
|
|
2436
2706
|
|
|
2437
2707
|
schemas = common.toArray(schemas);
|
|
@@ -2602,7 +2872,7 @@ var YAML_NODE_KINDS = [
|
|
|
2602
2872
|
function compileStyleAliases(map) {
|
|
2603
2873
|
var result = {};
|
|
2604
2874
|
|
|
2605
|
-
if (
|
|
2875
|
+
if (map !== null) {
|
|
2606
2876
|
Object.keys(map).forEach(function (style) {
|
|
2607
2877
|
map[style].forEach(function (alias) {
|
|
2608
2878
|
result[String(alias)] = style;
|
|
@@ -2617,7 +2887,7 @@ function Type(tag, options) {
|
|
|
2617
2887
|
options = options || {};
|
|
2618
2888
|
|
|
2619
2889
|
Object.keys(options).forEach(function (name) {
|
|
2620
|
-
if (
|
|
2890
|
+
if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
|
|
2621
2891
|
throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
|
|
2622
2892
|
}
|
|
2623
2893
|
});
|
|
@@ -2633,7 +2903,7 @@ function Type(tag, options) {
|
|
|
2633
2903
|
this.defaultStyle = options['defaultStyle'] || null;
|
|
2634
2904
|
this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
|
|
2635
2905
|
|
|
2636
|
-
if (
|
|
2906
|
+
if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
|
|
2637
2907
|
throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
2638
2908
|
}
|
|
2639
2909
|
}
|
|
@@ -2643,10 +2913,16 @@ module.exports = Type;
|
|
|
2643
2913
|
},{"./exception":4}],14:[function(require,module,exports){
|
|
2644
2914
|
'use strict';
|
|
2645
2915
|
|
|
2916
|
+
/*eslint-disable no-bitwise*/
|
|
2917
|
+
|
|
2918
|
+
var NodeBuffer;
|
|
2919
|
+
|
|
2920
|
+
try {
|
|
2921
|
+
// A trick for browserified version, to not include `Buffer` shim
|
|
2922
|
+
var _require = require;
|
|
2923
|
+
NodeBuffer = _require('buffer').Buffer;
|
|
2924
|
+
} catch (__) {}
|
|
2646
2925
|
|
|
2647
|
-
// A trick for browserified version.
|
|
2648
|
-
// Since we make browserifier to ignore `buffer` module, NodeBuffer will be undefined
|
|
2649
|
-
var NodeBuffer = require('buffer').Buffer;
|
|
2650
2926
|
var Type = require('../type');
|
|
2651
2927
|
|
|
2652
2928
|
|
|
@@ -2655,21 +2931,19 @@ var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
|
|
|
2655
2931
|
|
|
2656
2932
|
|
|
2657
2933
|
function resolveYamlBinary(data) {
|
|
2658
|
-
if (
|
|
2659
|
-
return false;
|
|
2660
|
-
}
|
|
2934
|
+
if (data === null) return false;
|
|
2661
2935
|
|
|
2662
|
-
var code, idx, bitlen = 0,
|
|
2936
|
+
var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
|
|
2663
2937
|
|
|
2664
2938
|
// Convert one by one.
|
|
2665
|
-
for (idx = 0; idx < max; idx
|
|
2939
|
+
for (idx = 0; idx < max; idx++) {
|
|
2666
2940
|
code = map.indexOf(data.charAt(idx));
|
|
2667
2941
|
|
|
2668
2942
|
// Skip CR/LF
|
|
2669
|
-
if (code > 64)
|
|
2943
|
+
if (code > 64) continue;
|
|
2670
2944
|
|
|
2671
2945
|
// Fail on illegal characters
|
|
2672
|
-
if (code < 0)
|
|
2946
|
+
if (code < 0) return false;
|
|
2673
2947
|
|
|
2674
2948
|
bitlen += 6;
|
|
2675
2949
|
}
|
|
@@ -2679,7 +2953,7 @@ function resolveYamlBinary(data) {
|
|
|
2679
2953
|
}
|
|
2680
2954
|
|
|
2681
2955
|
function constructYamlBinary(data) {
|
|
2682
|
-
var
|
|
2956
|
+
var idx, tailbits,
|
|
2683
2957
|
input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
|
|
2684
2958
|
max = input.length,
|
|
2685
2959
|
map = BASE64_MAP,
|
|
@@ -2700,7 +2974,7 @@ function constructYamlBinary(data) {
|
|
|
2700
2974
|
|
|
2701
2975
|
// Dump tail
|
|
2702
2976
|
|
|
2703
|
-
tailbits = (max % 4)*6;
|
|
2977
|
+
tailbits = (max % 4) * 6;
|
|
2704
2978
|
|
|
2705
2979
|
if (tailbits === 0) {
|
|
2706
2980
|
result.push((bits >> 16) & 0xFF);
|
|
@@ -2714,9 +2988,7 @@ function constructYamlBinary(data) {
|
|
|
2714
2988
|
}
|
|
2715
2989
|
|
|
2716
2990
|
// Wrap into Buffer for NodeJS and leave Array for browser
|
|
2717
|
-
if (NodeBuffer)
|
|
2718
|
-
return new NodeBuffer(result);
|
|
2719
|
-
}
|
|
2991
|
+
if (NodeBuffer) return new NodeBuffer(result);
|
|
2720
2992
|
|
|
2721
2993
|
return result;
|
|
2722
2994
|
}
|
|
@@ -2775,15 +3047,13 @@ module.exports = new Type('tag:yaml.org,2002:binary', {
|
|
|
2775
3047
|
represent: representYamlBinary
|
|
2776
3048
|
});
|
|
2777
3049
|
|
|
2778
|
-
},{"../type":13
|
|
3050
|
+
},{"../type":13}],15:[function(require,module,exports){
|
|
2779
3051
|
'use strict';
|
|
2780
3052
|
|
|
2781
3053
|
var Type = require('../type');
|
|
2782
3054
|
|
|
2783
3055
|
function resolveYamlBoolean(data) {
|
|
2784
|
-
if (
|
|
2785
|
-
return false;
|
|
2786
|
-
}
|
|
3056
|
+
if (data === null) return false;
|
|
2787
3057
|
|
|
2788
3058
|
var max = data.length;
|
|
2789
3059
|
|
|
@@ -2798,7 +3068,7 @@ function constructYamlBoolean(data) {
|
|
|
2798
3068
|
}
|
|
2799
3069
|
|
|
2800
3070
|
function isBoolean(object) {
|
|
2801
|
-
return
|
|
3071
|
+
return Object.prototype.toString.call(object) === '[object Boolean]';
|
|
2802
3072
|
}
|
|
2803
3073
|
|
|
2804
3074
|
module.exports = new Type('tag:yaml.org,2002:bool', {
|
|
@@ -2828,15 +3098,10 @@ var YAML_FLOAT_PATTERN = new RegExp(
|
|
|
2828
3098
|
'|\\.(?:nan|NaN|NAN))$');
|
|
2829
3099
|
|
|
2830
3100
|
function resolveYamlFloat(data) {
|
|
2831
|
-
if (
|
|
2832
|
-
return false;
|
|
2833
|
-
}
|
|
3101
|
+
if (data === null) return false;
|
|
2834
3102
|
|
|
2835
|
-
|
|
3103
|
+
if (!YAML_FLOAT_PATTERN.test(data)) return false;
|
|
2836
3104
|
|
|
2837
|
-
if (!YAML_FLOAT_PATTERN.test(data)) {
|
|
2838
|
-
return false;
|
|
2839
|
-
}
|
|
2840
3105
|
return true;
|
|
2841
3106
|
}
|
|
2842
3107
|
|
|
@@ -2844,20 +3109,20 @@ function constructYamlFloat(data) {
|
|
|
2844
3109
|
var value, sign, base, digits;
|
|
2845
3110
|
|
|
2846
3111
|
value = data.replace(/_/g, '').toLowerCase();
|
|
2847
|
-
sign =
|
|
3112
|
+
sign = value[0] === '-' ? -1 : 1;
|
|
2848
3113
|
digits = [];
|
|
2849
3114
|
|
|
2850
|
-
if (
|
|
3115
|
+
if ('+-'.indexOf(value[0]) >= 0) {
|
|
2851
3116
|
value = value.slice(1);
|
|
2852
3117
|
}
|
|
2853
3118
|
|
|
2854
|
-
if ('.inf'
|
|
2855
|
-
return (
|
|
3119
|
+
if (value === '.inf') {
|
|
3120
|
+
return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
|
|
2856
3121
|
|
|
2857
|
-
} else if ('.nan'
|
|
3122
|
+
} else if (value === '.nan') {
|
|
2858
3123
|
return NaN;
|
|
2859
3124
|
|
|
2860
|
-
} else if (
|
|
3125
|
+
} else if (value.indexOf(':') >= 0) {
|
|
2861
3126
|
value.split(':').forEach(function (v) {
|
|
2862
3127
|
digits.unshift(parseFloat(v, 10));
|
|
2863
3128
|
});
|
|
@@ -2872,49 +3137,49 @@ function constructYamlFloat(data) {
|
|
|
2872
3137
|
|
|
2873
3138
|
return sign * value;
|
|
2874
3139
|
|
|
2875
|
-
} else {
|
|
2876
|
-
return sign * parseFloat(value, 10);
|
|
2877
3140
|
}
|
|
3141
|
+
return sign * parseFloat(value, 10);
|
|
2878
3142
|
}
|
|
2879
3143
|
|
|
3144
|
+
|
|
3145
|
+
var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
|
|
3146
|
+
|
|
2880
3147
|
function representYamlFloat(object, style) {
|
|
3148
|
+
var res;
|
|
3149
|
+
|
|
2881
3150
|
if (isNaN(object)) {
|
|
2882
3151
|
switch (style) {
|
|
2883
|
-
|
|
2884
|
-
return '.
|
|
2885
|
-
|
|
2886
|
-
return '.NAN';
|
|
2887
|
-
case 'camelcase':
|
|
2888
|
-
return '.NaN';
|
|
3152
|
+
case 'lowercase': return '.nan';
|
|
3153
|
+
case 'uppercase': return '.NAN';
|
|
3154
|
+
case 'camelcase': return '.NaN';
|
|
2889
3155
|
}
|
|
2890
3156
|
} else if (Number.POSITIVE_INFINITY === object) {
|
|
2891
3157
|
switch (style) {
|
|
2892
|
-
|
|
2893
|
-
return '.
|
|
2894
|
-
|
|
2895
|
-
return '.INF';
|
|
2896
|
-
case 'camelcase':
|
|
2897
|
-
return '.Inf';
|
|
3158
|
+
case 'lowercase': return '.inf';
|
|
3159
|
+
case 'uppercase': return '.INF';
|
|
3160
|
+
case 'camelcase': return '.Inf';
|
|
2898
3161
|
}
|
|
2899
3162
|
} else if (Number.NEGATIVE_INFINITY === object) {
|
|
2900
3163
|
switch (style) {
|
|
2901
|
-
|
|
2902
|
-
return '-.
|
|
2903
|
-
|
|
2904
|
-
return '-.INF';
|
|
2905
|
-
case 'camelcase':
|
|
2906
|
-
return '-.Inf';
|
|
3164
|
+
case 'lowercase': return '-.inf';
|
|
3165
|
+
case 'uppercase': return '-.INF';
|
|
3166
|
+
case 'camelcase': return '-.Inf';
|
|
2907
3167
|
}
|
|
2908
3168
|
} else if (common.isNegativeZero(object)) {
|
|
2909
3169
|
return '-0.0';
|
|
2910
|
-
} else {
|
|
2911
|
-
return object.toString(10);
|
|
2912
3170
|
}
|
|
3171
|
+
|
|
3172
|
+
res = object.toString(10);
|
|
3173
|
+
|
|
3174
|
+
// JS stringifier can build scientific format without dots: 5e-100,
|
|
3175
|
+
// while YAML requres dot: 5.e-100. Fix it with simple hack
|
|
3176
|
+
|
|
3177
|
+
return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
|
|
2913
3178
|
}
|
|
2914
3179
|
|
|
2915
3180
|
function isFloat(object) {
|
|
2916
|
-
return (
|
|
2917
|
-
(
|
|
3181
|
+
return (Object.prototype.toString.call(object) === '[object Number]') &&
|
|
3182
|
+
(object % 1 !== 0 || common.isNegativeZero(object));
|
|
2918
3183
|
}
|
|
2919
3184
|
|
|
2920
3185
|
module.exports = new Type('tag:yaml.org,2002:float', {
|
|
@@ -2947,16 +3212,14 @@ function isDecCode(c) {
|
|
|
2947
3212
|
}
|
|
2948
3213
|
|
|
2949
3214
|
function resolveYamlInteger(data) {
|
|
2950
|
-
if (
|
|
2951
|
-
return false;
|
|
2952
|
-
}
|
|
3215
|
+
if (data === null) return false;
|
|
2953
3216
|
|
|
2954
3217
|
var max = data.length,
|
|
2955
3218
|
index = 0,
|
|
2956
3219
|
hasDigits = false,
|
|
2957
3220
|
ch;
|
|
2958
3221
|
|
|
2959
|
-
if (!max)
|
|
3222
|
+
if (!max) return false;
|
|
2960
3223
|
|
|
2961
3224
|
ch = data[index];
|
|
2962
3225
|
|
|
@@ -2967,7 +3230,7 @@ function resolveYamlInteger(data) {
|
|
|
2967
3230
|
|
|
2968
3231
|
if (ch === '0') {
|
|
2969
3232
|
// 0
|
|
2970
|
-
if (index+1 === max)
|
|
3233
|
+
if (index + 1 === max) return true;
|
|
2971
3234
|
ch = data[++index];
|
|
2972
3235
|
|
|
2973
3236
|
// base 2, base 8, base 16
|
|
@@ -2978,10 +3241,8 @@ function resolveYamlInteger(data) {
|
|
|
2978
3241
|
|
|
2979
3242
|
for (; index < max; index++) {
|
|
2980
3243
|
ch = data[index];
|
|
2981
|
-
if (ch === '_')
|
|
2982
|
-
if (ch !== '0' && ch !== '1')
|
|
2983
|
-
return false;
|
|
2984
|
-
}
|
|
3244
|
+
if (ch === '_') continue;
|
|
3245
|
+
if (ch !== '0' && ch !== '1') return false;
|
|
2985
3246
|
hasDigits = true;
|
|
2986
3247
|
}
|
|
2987
3248
|
return hasDigits;
|
|
@@ -2994,10 +3255,8 @@ function resolveYamlInteger(data) {
|
|
|
2994
3255
|
|
|
2995
3256
|
for (; index < max; index++) {
|
|
2996
3257
|
ch = data[index];
|
|
2997
|
-
if (ch === '_')
|
|
2998
|
-
if (!isHexCode(data.charCodeAt(index)))
|
|
2999
|
-
return false;
|
|
3000
|
-
}
|
|
3258
|
+
if (ch === '_') continue;
|
|
3259
|
+
if (!isHexCode(data.charCodeAt(index))) return false;
|
|
3001
3260
|
hasDigits = true;
|
|
3002
3261
|
}
|
|
3003
3262
|
return hasDigits;
|
|
@@ -3006,10 +3265,8 @@ function resolveYamlInteger(data) {
|
|
|
3006
3265
|
// base 8
|
|
3007
3266
|
for (; index < max; index++) {
|
|
3008
3267
|
ch = data[index];
|
|
3009
|
-
if (ch === '_')
|
|
3010
|
-
if (!isOctCode(data.charCodeAt(index)))
|
|
3011
|
-
return false;
|
|
3012
|
-
}
|
|
3268
|
+
if (ch === '_') continue;
|
|
3269
|
+
if (!isOctCode(data.charCodeAt(index))) return false;
|
|
3013
3270
|
hasDigits = true;
|
|
3014
3271
|
}
|
|
3015
3272
|
return hasDigits;
|
|
@@ -3019,18 +3276,18 @@ function resolveYamlInteger(data) {
|
|
|
3019
3276
|
|
|
3020
3277
|
for (; index < max; index++) {
|
|
3021
3278
|
ch = data[index];
|
|
3022
|
-
if (ch === '_')
|
|
3023
|
-
if (ch === ':')
|
|
3279
|
+
if (ch === '_') continue;
|
|
3280
|
+
if (ch === ':') break;
|
|
3024
3281
|
if (!isDecCode(data.charCodeAt(index))) {
|
|
3025
3282
|
return false;
|
|
3026
3283
|
}
|
|
3027
3284
|
hasDigits = true;
|
|
3028
3285
|
}
|
|
3029
3286
|
|
|
3030
|
-
if (!hasDigits)
|
|
3287
|
+
if (!hasDigits) return false;
|
|
3031
3288
|
|
|
3032
3289
|
// if !base60 - done;
|
|
3033
|
-
if (ch !== ':')
|
|
3290
|
+
if (ch !== ':') return true;
|
|
3034
3291
|
|
|
3035
3292
|
// base60 almost not used, no needs to optimize
|
|
3036
3293
|
return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
|
|
@@ -3046,24 +3303,17 @@ function constructYamlInteger(data) {
|
|
|
3046
3303
|
ch = value[0];
|
|
3047
3304
|
|
|
3048
3305
|
if (ch === '-' || ch === '+') {
|
|
3049
|
-
if (ch === '-')
|
|
3306
|
+
if (ch === '-') sign = -1;
|
|
3050
3307
|
value = value.slice(1);
|
|
3051
3308
|
ch = value[0];
|
|
3052
3309
|
}
|
|
3053
3310
|
|
|
3054
|
-
if ('0'
|
|
3055
|
-
return 0;
|
|
3056
|
-
}
|
|
3311
|
+
if (value === '0') return 0;
|
|
3057
3312
|
|
|
3058
3313
|
if (ch === '0') {
|
|
3059
|
-
if (value[1] === 'b')
|
|
3060
|
-
|
|
3061
|
-
}
|
|
3062
|
-
if (value[1] === 'x') {
|
|
3063
|
-
return sign * parseInt(value, 16);
|
|
3064
|
-
}
|
|
3314
|
+
if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
|
|
3315
|
+
if (value[1] === 'x') return sign * parseInt(value, 16);
|
|
3065
3316
|
return sign * parseInt(value, 8);
|
|
3066
|
-
|
|
3067
3317
|
}
|
|
3068
3318
|
|
|
3069
3319
|
if (value.indexOf(':') !== -1) {
|
|
@@ -3087,8 +3337,8 @@ function constructYamlInteger(data) {
|
|
|
3087
3337
|
}
|
|
3088
3338
|
|
|
3089
3339
|
function isInteger(object) {
|
|
3090
|
-
return (
|
|
3091
|
-
(
|
|
3340
|
+
return (Object.prototype.toString.call(object)) === '[object Number]' &&
|
|
3341
|
+
(object % 1 === 0 && !common.isNegativeZero(object));
|
|
3092
3342
|
}
|
|
3093
3343
|
|
|
3094
3344
|
module.exports = new Type('tag:yaml.org,2002:int', {
|
|
@@ -3124,29 +3374,27 @@ var esprima;
|
|
|
3124
3374
|
// found too - then fail to parse.
|
|
3125
3375
|
//
|
|
3126
3376
|
try {
|
|
3127
|
-
|
|
3377
|
+
// workaround to exclude package from browserify list.
|
|
3378
|
+
var _require = require;
|
|
3379
|
+
esprima = _require('esprima');
|
|
3128
3380
|
} catch (_) {
|
|
3129
3381
|
/*global window */
|
|
3130
|
-
if (typeof window !== 'undefined')
|
|
3382
|
+
if (typeof window !== 'undefined') esprima = window.esprima;
|
|
3131
3383
|
}
|
|
3132
3384
|
|
|
3133
3385
|
var Type = require('../../type');
|
|
3134
3386
|
|
|
3135
3387
|
function resolveJavascriptFunction(data) {
|
|
3136
|
-
if (
|
|
3137
|
-
return false;
|
|
3138
|
-
}
|
|
3388
|
+
if (data === null) return false;
|
|
3139
3389
|
|
|
3140
3390
|
try {
|
|
3141
3391
|
var source = '(' + data + ')',
|
|
3142
|
-
ast = esprima.parse(source, { range: true })
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
'ExpressionStatement' !== ast.body[0].type ||
|
|
3149
|
-
'FunctionExpression' !== ast.body[0].expression.type) {
|
|
3392
|
+
ast = esprima.parse(source, { range: true });
|
|
3393
|
+
|
|
3394
|
+
if (ast.type !== 'Program' ||
|
|
3395
|
+
ast.body.length !== 1 ||
|
|
3396
|
+
ast.body[0].type !== 'ExpressionStatement' ||
|
|
3397
|
+
ast.body[0].expression.type !== 'FunctionExpression') {
|
|
3150
3398
|
return false;
|
|
3151
3399
|
}
|
|
3152
3400
|
|
|
@@ -3164,10 +3412,10 @@ function constructJavascriptFunction(data) {
|
|
|
3164
3412
|
params = [],
|
|
3165
3413
|
body;
|
|
3166
3414
|
|
|
3167
|
-
if ('Program'
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
|
|
3415
|
+
if (ast.type !== 'Program' ||
|
|
3416
|
+
ast.body.length !== 1 ||
|
|
3417
|
+
ast.body[0].type !== 'ExpressionStatement' ||
|
|
3418
|
+
ast.body[0].expression.type !== 'FunctionExpression') {
|
|
3171
3419
|
throw new Error('Failed to resolve function');
|
|
3172
3420
|
}
|
|
3173
3421
|
|
|
@@ -3179,7 +3427,8 @@ function constructJavascriptFunction(data) {
|
|
|
3179
3427
|
|
|
3180
3428
|
// Esprima's ranges include the first '{' and the last '}' characters on
|
|
3181
3429
|
// function expressions. So cut them out.
|
|
3182
|
-
|
|
3430
|
+
/*eslint-disable no-new-func*/
|
|
3431
|
+
return new Function(params, source.slice(body[0] + 1, body[1] - 1));
|
|
3183
3432
|
}
|
|
3184
3433
|
|
|
3185
3434
|
function representJavascriptFunction(object /*, style*/) {
|
|
@@ -3187,7 +3436,7 @@ function representJavascriptFunction(object /*, style*/) {
|
|
|
3187
3436
|
}
|
|
3188
3437
|
|
|
3189
3438
|
function isFunction(object) {
|
|
3190
|
-
return
|
|
3439
|
+
return Object.prototype.toString.call(object) === '[object Function]';
|
|
3191
3440
|
}
|
|
3192
3441
|
|
|
3193
3442
|
module.exports = new Type('tag:yaml.org,2002:js/function', {
|
|
@@ -3198,19 +3447,14 @@ module.exports = new Type('tag:yaml.org,2002:js/function', {
|
|
|
3198
3447
|
represent: representJavascriptFunction
|
|
3199
3448
|
});
|
|
3200
3449
|
|
|
3201
|
-
},{"../../type":13
|
|
3450
|
+
},{"../../type":13}],19:[function(require,module,exports){
|
|
3202
3451
|
'use strict';
|
|
3203
3452
|
|
|
3204
3453
|
var Type = require('../../type');
|
|
3205
3454
|
|
|
3206
3455
|
function resolveJavascriptRegExp(data) {
|
|
3207
|
-
if (
|
|
3208
|
-
|
|
3209
|
-
}
|
|
3210
|
-
|
|
3211
|
-
if (0 === data.length) {
|
|
3212
|
-
return false;
|
|
3213
|
-
}
|
|
3456
|
+
if (data === null) return false;
|
|
3457
|
+
if (data.length === 0) return false;
|
|
3214
3458
|
|
|
3215
3459
|
var regexp = data,
|
|
3216
3460
|
tail = /\/([gim]*)$/.exec(data),
|
|
@@ -3218,24 +3462,15 @@ function resolveJavascriptRegExp(data) {
|
|
|
3218
3462
|
|
|
3219
3463
|
// if regexp starts with '/' it can have modifiers and must be properly closed
|
|
3220
3464
|
// `/foo/gim` - modifiers tail can be maximum 3 chars
|
|
3221
|
-
if (
|
|
3222
|
-
if (tail)
|
|
3223
|
-
modifiers = tail[1];
|
|
3224
|
-
}
|
|
3465
|
+
if (regexp[0] === '/') {
|
|
3466
|
+
if (tail) modifiers = tail[1];
|
|
3225
3467
|
|
|
3226
|
-
if (modifiers.length > 3)
|
|
3468
|
+
if (modifiers.length > 3) return false;
|
|
3227
3469
|
// if expression starts with /, is should be properly terminated
|
|
3228
|
-
if (regexp[regexp.length - modifiers.length - 1] !== '/')
|
|
3229
|
-
|
|
3230
|
-
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
|
3470
|
+
if (regexp[regexp.length - modifiers.length - 1] !== '/') return false;
|
|
3231
3471
|
}
|
|
3232
3472
|
|
|
3233
|
-
|
|
3234
|
-
var dummy = new RegExp(regexp, modifiers);
|
|
3235
|
-
return true;
|
|
3236
|
-
} catch (error) {
|
|
3237
|
-
return false;
|
|
3238
|
-
}
|
|
3473
|
+
return true;
|
|
3239
3474
|
}
|
|
3240
3475
|
|
|
3241
3476
|
function constructJavascriptRegExp(data) {
|
|
@@ -3244,10 +3479,8 @@ function constructJavascriptRegExp(data) {
|
|
|
3244
3479
|
modifiers = '';
|
|
3245
3480
|
|
|
3246
3481
|
// `/foo/gim` - tail can be maximum 4 chars
|
|
3247
|
-
if (
|
|
3248
|
-
if (tail)
|
|
3249
|
-
modifiers = tail[1];
|
|
3250
|
-
}
|
|
3482
|
+
if (regexp[0] === '/') {
|
|
3483
|
+
if (tail) modifiers = tail[1];
|
|
3251
3484
|
regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
|
|
3252
3485
|
}
|
|
3253
3486
|
|
|
@@ -3257,23 +3490,15 @@ function constructJavascriptRegExp(data) {
|
|
|
3257
3490
|
function representJavascriptRegExp(object /*, style*/) {
|
|
3258
3491
|
var result = '/' + object.source + '/';
|
|
3259
3492
|
|
|
3260
|
-
if (object.global)
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
if (object.multiline) {
|
|
3265
|
-
result += 'm';
|
|
3266
|
-
}
|
|
3267
|
-
|
|
3268
|
-
if (object.ignoreCase) {
|
|
3269
|
-
result += 'i';
|
|
3270
|
-
}
|
|
3493
|
+
if (object.global) result += 'g';
|
|
3494
|
+
if (object.multiline) result += 'm';
|
|
3495
|
+
if (object.ignoreCase) result += 'i';
|
|
3271
3496
|
|
|
3272
3497
|
return result;
|
|
3273
3498
|
}
|
|
3274
3499
|
|
|
3275
3500
|
function isRegExp(object) {
|
|
3276
|
-
return
|
|
3501
|
+
return Object.prototype.toString.call(object) === '[object RegExp]';
|
|
3277
3502
|
}
|
|
3278
3503
|
|
|
3279
3504
|
module.exports = new Type('tag:yaml.org,2002:js/regexp', {
|
|
@@ -3294,6 +3519,7 @@ function resolveJavascriptUndefined() {
|
|
|
3294
3519
|
}
|
|
3295
3520
|
|
|
3296
3521
|
function constructJavascriptUndefined() {
|
|
3522
|
+
/*eslint-disable no-undefined*/
|
|
3297
3523
|
return undefined;
|
|
3298
3524
|
}
|
|
3299
3525
|
|
|
@@ -3302,7 +3528,7 @@ function representJavascriptUndefined() {
|
|
|
3302
3528
|
}
|
|
3303
3529
|
|
|
3304
3530
|
function isUndefined(object) {
|
|
3305
|
-
return 'undefined'
|
|
3531
|
+
return typeof object === 'undefined';
|
|
3306
3532
|
}
|
|
3307
3533
|
|
|
3308
3534
|
module.exports = new Type('tag:yaml.org,2002:js/undefined', {
|
|
@@ -3320,7 +3546,7 @@ var Type = require('../type');
|
|
|
3320
3546
|
|
|
3321
3547
|
module.exports = new Type('tag:yaml.org,2002:map', {
|
|
3322
3548
|
kind: 'mapping',
|
|
3323
|
-
construct: function (data) { return
|
|
3549
|
+
construct: function (data) { return data !== null ? data : {}; }
|
|
3324
3550
|
});
|
|
3325
3551
|
|
|
3326
3552
|
},{"../type":13}],22:[function(require,module,exports){
|
|
@@ -3329,7 +3555,7 @@ module.exports = new Type('tag:yaml.org,2002:map', {
|
|
|
3329
3555
|
var Type = require('../type');
|
|
3330
3556
|
|
|
3331
3557
|
function resolveYamlMerge(data) {
|
|
3332
|
-
return '<<'
|
|
3558
|
+
return data === '<<' || data === null;
|
|
3333
3559
|
}
|
|
3334
3560
|
|
|
3335
3561
|
module.exports = new Type('tag:yaml.org,2002:merge', {
|
|
@@ -3343,9 +3569,7 @@ module.exports = new Type('tag:yaml.org,2002:merge', {
|
|
|
3343
3569
|
var Type = require('../type');
|
|
3344
3570
|
|
|
3345
3571
|
function resolveYamlNull(data) {
|
|
3346
|
-
if (
|
|
3347
|
-
return true;
|
|
3348
|
-
}
|
|
3572
|
+
if (data === null) return true;
|
|
3349
3573
|
|
|
3350
3574
|
var max = data.length;
|
|
3351
3575
|
|
|
@@ -3358,7 +3582,7 @@ function constructYamlNull() {
|
|
|
3358
3582
|
}
|
|
3359
3583
|
|
|
3360
3584
|
function isNull(object) {
|
|
3361
|
-
return
|
|
3585
|
+
return object === null;
|
|
3362
3586
|
}
|
|
3363
3587
|
|
|
3364
3588
|
module.exports = new Type('tag:yaml.org,2002:null', {
|
|
@@ -3384,9 +3608,7 @@ var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
|
3384
3608
|
var _toString = Object.prototype.toString;
|
|
3385
3609
|
|
|
3386
3610
|
function resolveYamlOmap(data) {
|
|
3387
|
-
if (
|
|
3388
|
-
return true;
|
|
3389
|
-
}
|
|
3611
|
+
if (data === null) return true;
|
|
3390
3612
|
|
|
3391
3613
|
var objectKeys = [], index, length, pair, pairKey, pairHasKey,
|
|
3392
3614
|
object = data;
|
|
@@ -3395,36 +3617,26 @@ function resolveYamlOmap(data) {
|
|
|
3395
3617
|
pair = object[index];
|
|
3396
3618
|
pairHasKey = false;
|
|
3397
3619
|
|
|
3398
|
-
if ('[object Object]'
|
|
3399
|
-
return false;
|
|
3400
|
-
}
|
|
3620
|
+
if (_toString.call(pair) !== '[object Object]') return false;
|
|
3401
3621
|
|
|
3402
3622
|
for (pairKey in pair) {
|
|
3403
3623
|
if (_hasOwnProperty.call(pair, pairKey)) {
|
|
3404
|
-
if (!pairHasKey)
|
|
3405
|
-
|
|
3406
|
-
} else {
|
|
3407
|
-
return false;
|
|
3408
|
-
}
|
|
3624
|
+
if (!pairHasKey) pairHasKey = true;
|
|
3625
|
+
else return false;
|
|
3409
3626
|
}
|
|
3410
3627
|
}
|
|
3411
3628
|
|
|
3412
|
-
if (!pairHasKey)
|
|
3413
|
-
return false;
|
|
3414
|
-
}
|
|
3629
|
+
if (!pairHasKey) return false;
|
|
3415
3630
|
|
|
3416
|
-
if (-1
|
|
3417
|
-
|
|
3418
|
-
} else {
|
|
3419
|
-
return false;
|
|
3420
|
-
}
|
|
3631
|
+
if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
|
|
3632
|
+
else return false;
|
|
3421
3633
|
}
|
|
3422
3634
|
|
|
3423
3635
|
return true;
|
|
3424
3636
|
}
|
|
3425
3637
|
|
|
3426
3638
|
function constructYamlOmap(data) {
|
|
3427
|
-
return
|
|
3639
|
+
return data !== null ? data : [];
|
|
3428
3640
|
}
|
|
3429
3641
|
|
|
3430
3642
|
module.exports = new Type('tag:yaml.org,2002:omap', {
|
|
@@ -3441,9 +3653,7 @@ var Type = require('../type');
|
|
|
3441
3653
|
var _toString = Object.prototype.toString;
|
|
3442
3654
|
|
|
3443
3655
|
function resolveYamlPairs(data) {
|
|
3444
|
-
if (
|
|
3445
|
-
return true;
|
|
3446
|
-
}
|
|
3656
|
+
if (data === null) return true;
|
|
3447
3657
|
|
|
3448
3658
|
var index, length, pair, keys, result,
|
|
3449
3659
|
object = data;
|
|
@@ -3453,15 +3663,11 @@ function resolveYamlPairs(data) {
|
|
|
3453
3663
|
for (index = 0, length = object.length; index < length; index += 1) {
|
|
3454
3664
|
pair = object[index];
|
|
3455
3665
|
|
|
3456
|
-
if ('[object Object]'
|
|
3457
|
-
return false;
|
|
3458
|
-
}
|
|
3666
|
+
if (_toString.call(pair) !== '[object Object]') return false;
|
|
3459
3667
|
|
|
3460
3668
|
keys = Object.keys(pair);
|
|
3461
3669
|
|
|
3462
|
-
if (
|
|
3463
|
-
return false;
|
|
3464
|
-
}
|
|
3670
|
+
if (keys.length !== 1) return false;
|
|
3465
3671
|
|
|
3466
3672
|
result[index] = [ keys[0], pair[keys[0]] ];
|
|
3467
3673
|
}
|
|
@@ -3470,9 +3676,7 @@ function resolveYamlPairs(data) {
|
|
|
3470
3676
|
}
|
|
3471
3677
|
|
|
3472
3678
|
function constructYamlPairs(data) {
|
|
3473
|
-
if (
|
|
3474
|
-
return [];
|
|
3475
|
-
}
|
|
3679
|
+
if (data === null) return [];
|
|
3476
3680
|
|
|
3477
3681
|
var index, length, pair, keys, result,
|
|
3478
3682
|
object = data;
|
|
@@ -3503,7 +3707,7 @@ var Type = require('../type');
|
|
|
3503
3707
|
|
|
3504
3708
|
module.exports = new Type('tag:yaml.org,2002:seq', {
|
|
3505
3709
|
kind: 'sequence',
|
|
3506
|
-
construct: function (data) { return
|
|
3710
|
+
construct: function (data) { return data !== null ? data : []; }
|
|
3507
3711
|
});
|
|
3508
3712
|
|
|
3509
3713
|
},{"../type":13}],27:[function(require,module,exports){
|
|
@@ -3514,17 +3718,13 @@ var Type = require('../type');
|
|
|
3514
3718
|
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
3515
3719
|
|
|
3516
3720
|
function resolveYamlSet(data) {
|
|
3517
|
-
if (
|
|
3518
|
-
return true;
|
|
3519
|
-
}
|
|
3721
|
+
if (data === null) return true;
|
|
3520
3722
|
|
|
3521
3723
|
var key, object = data;
|
|
3522
3724
|
|
|
3523
3725
|
for (key in object) {
|
|
3524
3726
|
if (_hasOwnProperty.call(object, key)) {
|
|
3525
|
-
if (
|
|
3526
|
-
return false;
|
|
3527
|
-
}
|
|
3727
|
+
if (object[key] !== null) return false;
|
|
3528
3728
|
}
|
|
3529
3729
|
}
|
|
3530
3730
|
|
|
@@ -3532,7 +3732,7 @@ function resolveYamlSet(data) {
|
|
|
3532
3732
|
}
|
|
3533
3733
|
|
|
3534
3734
|
function constructYamlSet(data) {
|
|
3535
|
-
return
|
|
3735
|
+
return data !== null ? data : {};
|
|
3536
3736
|
}
|
|
3537
3737
|
|
|
3538
3738
|
module.exports = new Type('tag:yaml.org,2002:set', {
|
|
@@ -3548,7 +3748,7 @@ var Type = require('../type');
|
|
|
3548
3748
|
|
|
3549
3749
|
module.exports = new Type('tag:yaml.org,2002:str', {
|
|
3550
3750
|
kind: 'scalar',
|
|
3551
|
-
construct: function (data) { return
|
|
3751
|
+
construct: function (data) { return data !== null ? data : ''; }
|
|
3552
3752
|
});
|
|
3553
3753
|
|
|
3554
3754
|
},{"../type":13}],29:[function(require,module,exports){
|
|
@@ -3556,44 +3756,38 @@ module.exports = new Type('tag:yaml.org,2002:str', {
|
|
|
3556
3756
|
|
|
3557
3757
|
var Type = require('../type');
|
|
3558
3758
|
|
|
3759
|
+
var YAML_DATE_REGEXP = new RegExp(
|
|
3760
|
+
'^([0-9][0-9][0-9][0-9])' + // [1] year
|
|
3761
|
+
'-([0-9][0-9])' + // [2] month
|
|
3762
|
+
'-([0-9][0-9])$'); // [3] day
|
|
3763
|
+
|
|
3559
3764
|
var YAML_TIMESTAMP_REGEXP = new RegExp(
|
|
3560
3765
|
'^([0-9][0-9][0-9][0-9])' + // [1] year
|
|
3561
3766
|
'-([0-9][0-9]?)' + // [2] month
|
|
3562
3767
|
'-([0-9][0-9]?)' + // [3] day
|
|
3563
|
-
'(?:
|
|
3768
|
+
'(?:[Tt]|[ \\t]+)' + // ...
|
|
3564
3769
|
'([0-9][0-9]?)' + // [4] hour
|
|
3565
3770
|
':([0-9][0-9])' + // [5] minute
|
|
3566
3771
|
':([0-9][0-9])' + // [6] second
|
|
3567
3772
|
'(?:\\.([0-9]*))?' + // [7] fraction
|
|
3568
3773
|
'(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
|
|
3569
|
-
'(?::([0-9][0-9]))?))
|
|
3774
|
+
'(?::([0-9][0-9]))?))?$'); // [11] tz_minute
|
|
3570
3775
|
|
|
3571
3776
|
function resolveYamlTimestamp(data) {
|
|
3572
|
-
if (
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
var match, year, month, day, hour, minute, second, fraction = 0,
|
|
3577
|
-
delta = null, tz_hour, tz_minute, date;
|
|
3578
|
-
|
|
3579
|
-
match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
3580
|
-
|
|
3581
|
-
if (null === match) {
|
|
3582
|
-
return false;
|
|
3583
|
-
}
|
|
3584
|
-
|
|
3585
|
-
return true;
|
|
3777
|
+
if (data === null) return false;
|
|
3778
|
+
if (YAML_DATE_REGEXP.exec(data) !== null) return true;
|
|
3779
|
+
if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
|
|
3780
|
+
return false;
|
|
3586
3781
|
}
|
|
3587
3782
|
|
|
3588
3783
|
function constructYamlTimestamp(data) {
|
|
3589
3784
|
var match, year, month, day, hour, minute, second, fraction = 0,
|
|
3590
3785
|
delta = null, tz_hour, tz_minute, date;
|
|
3591
3786
|
|
|
3592
|
-
match =
|
|
3787
|
+
match = YAML_DATE_REGEXP.exec(data);
|
|
3788
|
+
if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
3593
3789
|
|
|
3594
|
-
if (
|
|
3595
|
-
throw new Error('Date resolve error');
|
|
3596
|
-
}
|
|
3790
|
+
if (match === null) throw new Error('Date resolve error');
|
|
3597
3791
|
|
|
3598
3792
|
// match: [1] year [2] month [3] day
|
|
3599
3793
|
|
|
@@ -3625,16 +3819,12 @@ function constructYamlTimestamp(data) {
|
|
|
3625
3819
|
tz_hour = +(match[10]);
|
|
3626
3820
|
tz_minute = +(match[11] || 0);
|
|
3627
3821
|
delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
|
|
3628
|
-
if (
|
|
3629
|
-
delta = -delta;
|
|
3630
|
-
}
|
|
3822
|
+
if (match[9] === '-') delta = -delta;
|
|
3631
3823
|
}
|
|
3632
3824
|
|
|
3633
3825
|
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
3634
3826
|
|
|
3635
|
-
if (delta)
|
|
3636
|
-
date.setTime(date.getTime() - delta);
|
|
3637
|
-
}
|
|
3827
|
+
if (delta) date.setTime(date.getTime() - delta);
|
|
3638
3828
|
|
|
3639
3829
|
return date;
|
|
3640
3830
|
}
|
|
@@ -3651,9 +3841,7 @@ module.exports = new Type('tag:yaml.org,2002:timestamp', {
|
|
|
3651
3841
|
represent: representYamlTimestamp
|
|
3652
3842
|
});
|
|
3653
3843
|
|
|
3654
|
-
},{"../type":13}],
|
|
3655
|
-
|
|
3656
|
-
},{}],"/":[function(require,module,exports){
|
|
3844
|
+
},{"../type":13}],"/":[function(require,module,exports){
|
|
3657
3845
|
'use strict';
|
|
3658
3846
|
|
|
3659
3847
|
|
|
@@ -3663,4 +3851,5 @@ var yaml = require('./lib/js-yaml.js');
|
|
|
3663
3851
|
module.exports = yaml;
|
|
3664
3852
|
|
|
3665
3853
|
},{"./lib/js-yaml.js":1}]},{},[])("/")
|
|
3666
|
-
});
|
|
3854
|
+
});
|
|
3855
|
+
/* jshint ignore:end */
|