opal-wedge 0.9.0.dev

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.
Files changed (830) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +14 -0
  3. data/.gitmodules +7 -0
  4. data/.inch.yml +19 -0
  5. data/.jshintrc +48 -0
  6. data/.rspec +3 -0
  7. data/.spectator +2 -0
  8. data/.spectator-mspec +3 -0
  9. data/.travis.yml +60 -0
  10. data/.yardopts +6 -0
  11. data/CHANGELOG.md +571 -0
  12. data/CODE_OF_CONDUCT.md +15 -0
  13. data/CONTRIBUTING.md +192 -0
  14. data/Gemfile +26 -0
  15. data/Guardfile +77 -0
  16. data/LICENSE +19 -0
  17. data/README.md +167 -0
  18. data/Rakefile +15 -0
  19. data/benchmark/benchmarks +103 -0
  20. data/benchmark/bm_array_intersection_numbers.rb +7 -0
  21. data/benchmark/bm_array_intersection_objects.rb +7 -0
  22. data/benchmark/bm_array_intersection_strings.rb +7 -0
  23. data/benchmark/bm_array_minus_numbers.rb +7 -0
  24. data/benchmark/bm_array_minus_objects.rb +7 -0
  25. data/benchmark/bm_array_minus_strings.rb +7 -0
  26. data/benchmark/bm_array_union_numbers.rb +7 -0
  27. data/benchmark/bm_array_union_objects.rb +7 -0
  28. data/benchmark/bm_array_union_strings.rb +7 -0
  29. data/benchmark/bm_array_uniq_bang_numbers.rb +5 -0
  30. data/benchmark/bm_array_uniq_bang_objects.rb +5 -0
  31. data/benchmark/bm_array_uniq_bang_strings.rb +5 -0
  32. data/benchmark/bm_array_uniq_numbers.rb +5 -0
  33. data/benchmark/bm_array_uniq_objects.rb +5 -0
  34. data/benchmark/bm_array_uniq_strings.rb +5 -0
  35. data/benchmark/bm_dispatch_bind_table.rb +57 -0
  36. data/benchmark/bm_dispatch_code_gen.rb +65 -0
  37. data/benchmark/bm_dispatch_code_gen_if.rb +64 -0
  38. data/benchmark/bm_dispatch_hardcoded.rb +44 -0
  39. data/benchmark/bm_dispatch_send.rb +38 -0
  40. data/benchmark/bm_dispatch_send_table.rb +57 -0
  41. data/benchmark/bm_hash_assoc_object.rb +11 -0
  42. data/benchmark/bm_hash_assoc_string.rb +9 -0
  43. data/benchmark/bm_hash_clone_object.rb +9 -0
  44. data/benchmark/bm_hash_clone_string.rb +9 -0
  45. data/benchmark/bm_hash_delete_object.rb +11 -0
  46. data/benchmark/bm_hash_delete_string.rb +9 -0
  47. data/benchmark/bm_hash_each_key_object.rb +9 -0
  48. data/benchmark/bm_hash_each_key_string.rb +9 -0
  49. data/benchmark/bm_hash_each_object.rb +9 -0
  50. data/benchmark/bm_hash_each_string.rb +9 -0
  51. data/benchmark/bm_hash_each_value_object.rb +9 -0
  52. data/benchmark/bm_hash_each_value_string.rb +9 -0
  53. data/benchmark/bm_hash_element_reference_object.rb +11 -0
  54. data/benchmark/bm_hash_element_reference_string.rb +9 -0
  55. data/benchmark/bm_hash_element_set_object.rb +5 -0
  56. data/benchmark/bm_hash_element_set_string.rb +5 -0
  57. data/benchmark/bm_hash_equal_value_object.rb +14 -0
  58. data/benchmark/bm_hash_equal_value_string.rb +11 -0
  59. data/benchmark/bm_hash_fetch_object.rb +11 -0
  60. data/benchmark/bm_hash_fetch_string.rb +9 -0
  61. data/benchmark/bm_hash_flatten_object.rb +9 -0
  62. data/benchmark/bm_hash_flatten_string.rb +9 -0
  63. data/benchmark/bm_hash_has_key_object.rb +11 -0
  64. data/benchmark/bm_hash_has_key_string.rb +9 -0
  65. data/benchmark/bm_hash_has_value_object.rb +9 -0
  66. data/benchmark/bm_hash_has_value_string.rb +9 -0
  67. data/benchmark/bm_hash_hash_object.rb +9 -0
  68. data/benchmark/bm_hash_hash_string.rb +9 -0
  69. data/benchmark/bm_hash_inspect_object.rb +9 -0
  70. data/benchmark/bm_hash_inspect_string.rb +9 -0
  71. data/benchmark/bm_hash_invert_object.rb +9 -0
  72. data/benchmark/bm_hash_invert_string.rb +9 -0
  73. data/benchmark/bm_hash_keep_if_object.rb +9 -0
  74. data/benchmark/bm_hash_keep_if_string.rb +9 -0
  75. data/benchmark/bm_hash_key_object.rb +9 -0
  76. data/benchmark/bm_hash_key_string.rb +9 -0
  77. data/benchmark/bm_hash_keys_object.rb +9 -0
  78. data/benchmark/bm_hash_keys_string.rb +9 -0
  79. data/benchmark/bm_hash_literal_mixed_large.rb +3 -0
  80. data/benchmark/bm_hash_literal_mixed_small.rb +3 -0
  81. data/benchmark/bm_hash_literal_object_large.rb +4 -0
  82. data/benchmark/bm_hash_literal_object_small.rb +3 -0
  83. data/benchmark/bm_hash_literal_string_large.rb +4 -0
  84. data/benchmark/bm_hash_literal_string_small.rb +3 -0
  85. data/benchmark/bm_hash_merge_object.rb +22 -0
  86. data/benchmark/bm_hash_merge_string.rb +18 -0
  87. data/benchmark/bm_hash_rassoc_object.rb +9 -0
  88. data/benchmark/bm_hash_rassoc_string.rb +9 -0
  89. data/benchmark/bm_hash_rehash_object.rb +9 -0
  90. data/benchmark/bm_hash_rehash_string.rb +9 -0
  91. data/benchmark/bm_hash_reject_bang_object.rb +9 -0
  92. data/benchmark/bm_hash_reject_bang_string.rb +9 -0
  93. data/benchmark/bm_hash_reject_object.rb +9 -0
  94. data/benchmark/bm_hash_reject_string.rb +9 -0
  95. data/benchmark/bm_hash_replace_object.rb +18 -0
  96. data/benchmark/bm_hash_replace_string.rb +14 -0
  97. data/benchmark/bm_hash_select_bang_object.rb +9 -0
  98. data/benchmark/bm_hash_select_bang_string.rb +9 -0
  99. data/benchmark/bm_hash_select_object.rb +9 -0
  100. data/benchmark/bm_hash_select_string.rb +9 -0
  101. data/benchmark/bm_hash_shift_object.rb +10 -0
  102. data/benchmark/bm_hash_shift_string.rb +10 -0
  103. data/benchmark/bm_hash_to_a_object.rb +9 -0
  104. data/benchmark/bm_hash_to_a_string.rb +9 -0
  105. data/benchmark/bm_hash_to_h_object.rb +10 -0
  106. data/benchmark/bm_hash_to_h_string.rb +10 -0
  107. data/benchmark/bm_hash_values_object.rb +9 -0
  108. data/benchmark/bm_hash_values_string.rb +9 -0
  109. data/benchmark/run.rb +37 -0
  110. data/bin/opal +27 -0
  111. data/bin/opal-build +77 -0
  112. data/bin/opal-mspec +10 -0
  113. data/bin/opal-repl +72 -0
  114. data/config.ru +14 -0
  115. data/docs/compiler_directives.md +127 -0
  116. data/examples/rack/.gitignore +1 -0
  117. data/examples/rack/Gemfile +3 -0
  118. data/examples/rack/app/application.rb +13 -0
  119. data/examples/rack/app/user.rb +22 -0
  120. data/examples/rack/config.ru +20 -0
  121. data/examples/rack/index.html.erb +10 -0
  122. data/examples/sinatra/Gemfile +5 -0
  123. data/examples/sinatra/app/application.rb +7 -0
  124. data/examples/sinatra/config.ru +38 -0
  125. data/lib/mspec/opal/main.rb.erb +9 -0
  126. data/lib/mspec/opal/new.html.erb +1 -0
  127. data/lib/mspec/opal/rake_task.rb +248 -0
  128. data/lib/mspec/opal/runner.rb +281 -0
  129. data/lib/mspec/opal/special_calls.rb +44 -0
  130. data/lib/mspec/opal/sprockets.js +57 -0
  131. data/lib/opal-wedge.rb +4 -0
  132. data/lib/opal.rb +11 -0
  133. data/lib/opal/builder.rb +161 -0
  134. data/lib/opal/builder_processors.rb +149 -0
  135. data/lib/opal/cli.rb +162 -0
  136. data/lib/opal/cli_options.rb +158 -0
  137. data/lib/opal/cli_runners.rb +11 -0
  138. data/lib/opal/cli_runners/apple_script.rb +65 -0
  139. data/lib/opal/cli_runners/nodejs.rb +63 -0
  140. data/lib/opal/cli_runners/phantom.js +44 -0
  141. data/lib/opal/cli_runners/phantomjs.rb +28 -0
  142. data/lib/opal/cli_runners/server.rb +56 -0
  143. data/lib/opal/compiler.rb +381 -0
  144. data/lib/opal/config.rb +48 -0
  145. data/lib/opal/erb.rb +84 -0
  146. data/lib/opal/fragment.rb +53 -0
  147. data/lib/opal/hike_path_finder.rb +18 -0
  148. data/lib/opal/nodes.rb +26 -0
  149. data/lib/opal/nodes/arglist.rb +56 -0
  150. data/lib/opal/nodes/array.rb +54 -0
  151. data/lib/opal/nodes/base.rb +151 -0
  152. data/lib/opal/nodes/call.rb +290 -0
  153. data/lib/opal/nodes/call_special.rb +252 -0
  154. data/lib/opal/nodes/case.rb +96 -0
  155. data/lib/opal/nodes/class.rb +42 -0
  156. data/lib/opal/nodes/constants.rb +78 -0
  157. data/lib/opal/nodes/def.rb +281 -0
  158. data/lib/opal/nodes/defined.rb +113 -0
  159. data/lib/opal/nodes/definitions.rb +168 -0
  160. data/lib/opal/nodes/for.rb +48 -0
  161. data/lib/opal/nodes/hash.rb +67 -0
  162. data/lib/opal/nodes/helpers.rb +116 -0
  163. data/lib/opal/nodes/if.rb +81 -0
  164. data/lib/opal/nodes/iter.rb +136 -0
  165. data/lib/opal/nodes/literal.rb +247 -0
  166. data/lib/opal/nodes/logic.rb +217 -0
  167. data/lib/opal/nodes/masgn.rb +62 -0
  168. data/lib/opal/nodes/module.rb +45 -0
  169. data/lib/opal/nodes/rescue.rb +143 -0
  170. data/lib/opal/nodes/runtime_helpers.rb +45 -0
  171. data/lib/opal/nodes/scope.rb +281 -0
  172. data/lib/opal/nodes/singleton_class.rb +26 -0
  173. data/lib/opal/nodes/super.rb +97 -0
  174. data/lib/opal/nodes/top.rb +103 -0
  175. data/lib/opal/nodes/variables.rb +191 -0
  176. data/lib/opal/nodes/while.rb +65 -0
  177. data/lib/opal/nodes/yield.rb +95 -0
  178. data/lib/opal/parser.rb +742 -0
  179. data/lib/opal/parser/grammar.rb +5723 -0
  180. data/lib/opal/parser/grammar.y +1787 -0
  181. data/lib/opal/parser/keywords.rb +66 -0
  182. data/lib/opal/parser/lexer.rb +1260 -0
  183. data/lib/opal/parser/parser_scope.rb +28 -0
  184. data/lib/opal/parser/sexp.rb +81 -0
  185. data/lib/opal/path_reader.rb +35 -0
  186. data/lib/opal/paths.rb +55 -0
  187. data/lib/opal/regexp_anchors.rb +5 -0
  188. data/lib/opal/source_map.rb +70 -0
  189. data/lib/opal/sprockets.rb +3 -0
  190. data/lib/opal/sprockets/cache_key_fix.rb +17 -0
  191. data/lib/opal/sprockets/environment.rb +31 -0
  192. data/lib/opal/sprockets/erb.rb +23 -0
  193. data/lib/opal/sprockets/path_reader.rb +36 -0
  194. data/lib/opal/sprockets/processor.rb +167 -0
  195. data/lib/opal/sprockets/server.rb +160 -0
  196. data/lib/opal/sprockets/source_map_header_patch.rb +41 -0
  197. data/lib/opal/sprockets/source_map_server.rb +115 -0
  198. data/lib/opal/util.rb +69 -0
  199. data/lib/opal/version.rb +5 -0
  200. data/lib/tilt/opal.rb +54 -0
  201. data/opal.gemspec +37 -0
  202. data/opal/README.md +6 -0
  203. data/opal/corelib/array.rb +2073 -0
  204. data/opal/corelib/array/inheritance.rb +127 -0
  205. data/opal/corelib/basic_object.rb +82 -0
  206. data/opal/corelib/boolean.rb +47 -0
  207. data/opal/corelib/class.rb +55 -0
  208. data/opal/corelib/comparable.rb +57 -0
  209. data/opal/corelib/complex.rb +3 -0
  210. data/opal/corelib/dir.rb +20 -0
  211. data/opal/corelib/enumerable.rb +1138 -0
  212. data/opal/corelib/enumerator.rb +426 -0
  213. data/opal/corelib/error.rb +77 -0
  214. data/opal/corelib/file.rb +59 -0
  215. data/opal/corelib/hash.rb +951 -0
  216. data/opal/corelib/helpers.rb +102 -0
  217. data/opal/corelib/io.rb +73 -0
  218. data/opal/corelib/kernel.rb +1124 -0
  219. data/opal/corelib/main.rb +7 -0
  220. data/opal/corelib/match_data.rb +128 -0
  221. data/opal/corelib/method.rb +62 -0
  222. data/opal/corelib/module.rb +553 -0
  223. data/opal/corelib/nil_class.rb +57 -0
  224. data/opal/corelib/numeric.rb +564 -0
  225. data/opal/corelib/proc.rb +105 -0
  226. data/opal/corelib/process.rb +27 -0
  227. data/opal/corelib/range.rb +116 -0
  228. data/opal/corelib/rational.rb +3 -0
  229. data/opal/corelib/regexp.rb +203 -0
  230. data/opal/corelib/runtime.js +1637 -0
  231. data/opal/corelib/string.rb +1762 -0
  232. data/opal/corelib/string/inheritance.rb +117 -0
  233. data/opal/corelib/struct.rb +159 -0
  234. data/opal/corelib/time.rb +746 -0
  235. data/opal/corelib/variables.rb +28 -0
  236. data/opal/opal.rb +33 -0
  237. data/spec/README.md +8 -0
  238. data/spec/filters/bugs/array.rb +77 -0
  239. data/spec/filters/bugs/basicobject.rb +33 -0
  240. data/spec/filters/bugs/class.rb +15 -0
  241. data/spec/filters/bugs/comparable.rb +4 -0
  242. data/spec/filters/bugs/date.rb +173 -0
  243. data/spec/filters/bugs/enumerable.rb +62 -0
  244. data/spec/filters/bugs/enumerator.rb +45 -0
  245. data/spec/filters/bugs/exception.rb +84 -0
  246. data/spec/filters/bugs/fixnum.rb +35 -0
  247. data/spec/filters/bugs/float.rb +100 -0
  248. data/spec/filters/bugs/hash.rb +17 -0
  249. data/spec/filters/bugs/integer.rb +63 -0
  250. data/spec/filters/bugs/kernel.rb +395 -0
  251. data/spec/filters/bugs/language.rb +246 -0
  252. data/spec/filters/bugs/math.rb +89 -0
  253. data/spec/filters/bugs/method.rb +5 -0
  254. data/spec/filters/bugs/module.rb +372 -0
  255. data/spec/filters/bugs/nil.rb +7 -0
  256. data/spec/filters/bugs/numeric.rb +123 -0
  257. data/spec/filters/bugs/proc.rb +65 -0
  258. data/spec/filters/bugs/range.rb +148 -0
  259. data/spec/filters/bugs/regexp.rb +252 -0
  260. data/spec/filters/bugs/set.rb +51 -0
  261. data/spec/filters/bugs/singleton.rb +6 -0
  262. data/spec/filters/bugs/string.rb +99 -0
  263. data/spec/filters/bugs/strscan.rb +106 -0
  264. data/spec/filters/bugs/struct.rb +22 -0
  265. data/spec/filters/bugs/time.rb +28 -0
  266. data/spec/filters/bugs/unboundmethod.rb +22 -0
  267. data/spec/filters/unsupported/array.rb +176 -0
  268. data/spec/filters/unsupported/basicobject.rb +12 -0
  269. data/spec/filters/unsupported/class.rb +4 -0
  270. data/spec/filters/unsupported/delegator.rb +5 -0
  271. data/spec/filters/unsupported/enumerable.rb +8 -0
  272. data/spec/filters/unsupported/enumerator.rb +13 -0
  273. data/spec/filters/unsupported/fixnum.rb +15 -0
  274. data/spec/filters/unsupported/float.rb +6 -0
  275. data/spec/filters/unsupported/hash.rb +55 -0
  276. data/spec/filters/unsupported/integer.rb +3 -0
  277. data/spec/filters/unsupported/kernel.rb +22 -0
  278. data/spec/filters/unsupported/language.rb +31 -0
  279. data/spec/filters/unsupported/matchdata.rb +33 -0
  280. data/spec/filters/unsupported/math.rb +3 -0
  281. data/spec/filters/unsupported/module.rb +36 -0
  282. data/spec/filters/unsupported/pathname.rb +3 -0
  283. data/spec/filters/unsupported/regexp.rb +94 -0
  284. data/spec/filters/unsupported/set.rb +4 -0
  285. data/spec/filters/unsupported/singleton.rb +6 -0
  286. data/spec/filters/unsupported/string.rb +538 -0
  287. data/spec/filters/unsupported/struct.rb +3 -0
  288. data/spec/filters/unsupported/time.rb +208 -0
  289. data/spec/lib/builder_processors_spec.rb +27 -0
  290. data/spec/lib/builder_spec.rb +72 -0
  291. data/spec/lib/cli_spec.rb +150 -0
  292. data/spec/lib/compiler/pre_processed_conditionals_spec.rb +87 -0
  293. data/spec/lib/compiler_spec.rb +131 -0
  294. data/spec/lib/dependency_resolver_spec.rb +40 -0
  295. data/spec/lib/fixtures/complex_sprockets.js.rb.erb +4 -0
  296. data/spec/lib/fixtures/file_with_directives.js +2 -0
  297. data/spec/lib/fixtures/jst_file.js.jst +1 -0
  298. data/spec/lib/fixtures/no_requires.rb +1 -0
  299. data/spec/lib/fixtures/opal_file.rb +2 -0
  300. data/spec/lib/fixtures/require_tree_test.rb +3 -0
  301. data/spec/lib/fixtures/required_file.js +1 -0
  302. data/spec/lib/fixtures/required_tree_test/required_file1.rb +1 -0
  303. data/spec/lib/fixtures/required_tree_test/required_file2.rb +1 -0
  304. data/spec/lib/fixtures/requires.rb +7 -0
  305. data/spec/lib/fixtures/source_map.rb +1 -0
  306. data/spec/lib/fixtures/source_map/subfolder/other_file.rb +1 -0
  307. data/spec/lib/fixtures/sprockets_file.js.rb +3 -0
  308. data/spec/lib/fixtures/sprockets_require_tree_test.rb +3 -0
  309. data/spec/lib/hike_path_finder_spec.rb +23 -0
  310. data/spec/lib/lexer_spec.rb +110 -0
  311. data/spec/lib/parser/alias_spec.rb +26 -0
  312. data/spec/lib/parser/and_spec.rb +13 -0
  313. data/spec/lib/parser/attrasgn_spec.rb +28 -0
  314. data/spec/lib/parser/begin_spec.rb +42 -0
  315. data/spec/lib/parser/block_spec.rb +12 -0
  316. data/spec/lib/parser/break_spec.rb +17 -0
  317. data/spec/lib/parser/call_spec.rb +165 -0
  318. data/spec/lib/parser/class_spec.rb +35 -0
  319. data/spec/lib/parser/comments_spec.rb +11 -0
  320. data/spec/lib/parser/def_spec.rb +80 -0
  321. data/spec/lib/parser/if_spec.rb +26 -0
  322. data/spec/lib/parser/iter_spec.rb +59 -0
  323. data/spec/lib/parser/lambda_spec.rb +64 -0
  324. data/spec/lib/parser/literal_spec.rb +118 -0
  325. data/spec/lib/parser/masgn_spec.rb +37 -0
  326. data/spec/lib/parser/module_spec.rb +27 -0
  327. data/spec/lib/parser/not_spec.rb +21 -0
  328. data/spec/lib/parser/op_asgn1_spec.rb +23 -0
  329. data/spec/lib/parser/op_asgn2_spec.rb +23 -0
  330. data/spec/lib/parser/or_spec.rb +13 -0
  331. data/spec/lib/parser/return_spec.rb +17 -0
  332. data/spec/lib/parser/sclass_spec.rb +21 -0
  333. data/spec/lib/parser/string_spec.rb +276 -0
  334. data/spec/lib/parser/super_spec.rb +20 -0
  335. data/spec/lib/parser/unary_spec.rb +48 -0
  336. data/spec/lib/parser/undef_spec.rb +15 -0
  337. data/spec/lib/parser/unless_spec.rb +13 -0
  338. data/spec/lib/parser/variables_spec.rb +92 -0
  339. data/spec/lib/parser/while_spec.rb +15 -0
  340. data/spec/lib/parser/yield_spec.rb +20 -0
  341. data/spec/lib/path_reader_spec.rb +36 -0
  342. data/spec/lib/shared/path_finder_shared.rb +19 -0
  343. data/spec/lib/shared/path_reader_shared.rb +31 -0
  344. data/spec/lib/spec_helper.rb +9 -0
  345. data/spec/lib/sprockets/erb_spec.rb +38 -0
  346. data/spec/lib/sprockets/path_reader_spec.rb +41 -0
  347. data/spec/lib/sprockets/processor_spec.rb +67 -0
  348. data/spec/lib/sprockets/server_spec.rb +102 -0
  349. data/spec/lib/tilt/opal_spec.rb +37 -0
  350. data/spec/opal/compiler/irb_spec.rb +44 -0
  351. data/spec/opal/core/array/intersection_spec.rb +38 -0
  352. data/spec/opal/core/array/minus_spec.rb +38 -0
  353. data/spec/opal/core/array/select_spec.rb +14 -0
  354. data/spec/opal/core/array/set_range_to_array_spec.rb +7 -0
  355. data/spec/opal/core/array/union_spec.rb +38 -0
  356. data/spec/opal/core/array/uniq_spec.rb +49 -0
  357. data/spec/opal/core/date_spec.rb +177 -0
  358. data/spec/opal/core/enumerable/all_break_spec.rb +5 -0
  359. data/spec/opal/core/enumerable/any_break_spec.rb +5 -0
  360. data/spec/opal/core/enumerable/collect_break_spec.rb +13 -0
  361. data/spec/opal/core/enumerable/count_break_spec.rb +5 -0
  362. data/spec/opal/core/enumerable/detect_break_spec.rb +5 -0
  363. data/spec/opal/core/enumerable/drop_while_break_spec.rb +5 -0
  364. data/spec/opal/core/enumerable/each_slice_break.rb +6 -0
  365. data/spec/opal/core/enumerable/each_with_index_break_spec.rb +5 -0
  366. data/spec/opal/core/enumerable/each_with_object_break_spec.rb +5 -0
  367. data/spec/opal/core/enumerable/find_all_break_spec.rb +5 -0
  368. data/spec/opal/core/enumerable/find_index_break_spec.rb +5 -0
  369. data/spec/opal/core/enumerable/grep_break_spec.rb +5 -0
  370. data/spec/opal/core/enumerable/max_break_spec.rb +5 -0
  371. data/spec/opal/core/enumerable/max_by_break_spec.rb +5 -0
  372. data/spec/opal/core/enumerable/min_break_spec.rb +5 -0
  373. data/spec/opal/core/enumerable/min_by_break_spec.rb +5 -0
  374. data/spec/opal/core/enumerable/none_break_spec.rb +5 -0
  375. data/spec/opal/core/enumerable/one_break_spec.rb +5 -0
  376. data/spec/opal/core/enumerable/reduce_break_spec.rb +5 -0
  377. data/spec/opal/core/enumerable/take_while_break_spec.rb +5 -0
  378. data/spec/opal/core/exception_spec.rb +13 -0
  379. data/spec/opal/core/fixtures/class.rb +124 -0
  380. data/spec/opal/core/fixtures/class_variables.rb +0 -0
  381. data/spec/opal/core/fixtures/constants.rb +33 -0
  382. data/spec/opal/core/fixtures/require_tree_files/file 1.rb +1 -0
  383. data/spec/opal/core/fixtures/require_tree_files/file 2.rb +1 -0
  384. data/spec/opal/core/fixtures/require_tree_files/file 3.rb +1 -0
  385. data/spec/opal/core/fixtures/require_tree_files/file 4.rb +1 -0
  386. data/spec/opal/core/fixtures/require_tree_files/file 5.rb +1 -0
  387. data/spec/opal/core/fixtures/require_tree_files/nested/nested 1.rb +1 -0
  388. data/spec/opal/core/fixtures/require_tree_files/nested/nested 2.rb +1 -0
  389. data/spec/opal/core/fixtures/require_tree_files/other/other 1.rb +1 -0
  390. data/spec/opal/core/fixtures/require_tree_with_dot/file 1.rb +1 -0
  391. data/spec/opal/core/fixtures/require_tree_with_dot/file 2.rb +1 -0
  392. data/spec/opal/core/fixtures/require_tree_with_dot/file 3.rb +1 -0
  393. data/spec/opal/core/fixtures/require_tree_with_dot/index.rb +3 -0
  394. data/spec/opal/core/hash/has_value_spec.rb +13 -0
  395. data/spec/opal/core/hash/internals_spec.rb +332 -0
  396. data/spec/opal/core/kernel/Array_spec.rb +10 -0
  397. data/spec/opal/core/kernel/block_given_spec.rb +30 -0
  398. data/spec/opal/core/kernel/class_spec.rb +6 -0
  399. data/spec/opal/core/kernel/define_singleton_method_spec.rb +21 -0
  400. data/spec/opal/core/kernel/equal_value_spec.rb +12 -0
  401. data/spec/opal/core/kernel/extend_spec.rb +21 -0
  402. data/spec/opal/core/kernel/format_spec.rb +122 -0
  403. data/spec/opal/core/kernel/freeze_spec.rb +15 -0
  404. data/spec/opal/core/kernel/instance_eval_spec.rb +28 -0
  405. data/spec/opal/core/kernel/instance_variable_defined_spec.rb +15 -0
  406. data/spec/opal/core/kernel/instance_variable_get_spec.rb +14 -0
  407. data/spec/opal/core/kernel/instance_variable_set_spec.rb +10 -0
  408. data/spec/opal/core/kernel/loop_spec.rb +23 -0
  409. data/spec/opal/core/kernel/match_spec.rb +5 -0
  410. data/spec/opal/core/kernel/method_spec.rb +31 -0
  411. data/spec/opal/core/kernel/methods_spec.rb +25 -0
  412. data/spec/opal/core/kernel/nil_spec.rb +7 -0
  413. data/spec/opal/core/kernel/p_spec.rb +15 -0
  414. data/spec/opal/core/kernel/printf_spec.rb +11 -0
  415. data/spec/opal/core/kernel/proc_spec.rb +13 -0
  416. data/spec/opal/core/kernel/rand_spec.rb +23 -0
  417. data/spec/opal/core/kernel/require_tree_spec.rb +18 -0
  418. data/spec/opal/core/kernel/respond_to_spec.rb +41 -0
  419. data/spec/opal/core/kernel/send_spec.rb +56 -0
  420. data/spec/opal/core/kernel/sprintf_spec.rb +5 -0
  421. data/spec/opal/core/language/block_spec.rb +538 -0
  422. data/spec/opal/core/language/fixtures/array.rb +11 -0
  423. data/spec/opal/core/language/fixtures/block.rb +57 -0
  424. data/spec/opal/core/language/fixtures/break.rb +240 -0
  425. data/spec/opal/core/language/fixtures/ensure.rb +72 -0
  426. data/spec/opal/core/language/fixtures/literal_lambda.rb +7 -0
  427. data/spec/opal/core/language/fixtures/metaclass.rb +33 -0
  428. data/spec/opal/core/language/fixtures/module.rb +24 -0
  429. data/spec/opal/core/language/fixtures/next.rb +128 -0
  430. data/spec/opal/core/language/fixtures/return.rb +118 -0
  431. data/spec/opal/core/language/fixtures/send.rb +110 -0
  432. data/spec/opal/core/language/fixtures/send_1.9.rb +22 -0
  433. data/spec/opal/core/language/fixtures/super.rb +308 -0
  434. data/spec/opal/core/language/fixtures/variables.rb +58 -0
  435. data/spec/opal/core/language/fixtures/yield.rb +28 -0
  436. data/spec/opal/core/language/predefined_spec.rb +138 -0
  437. data/spec/opal/core/language/proc_spec.rb +263 -0
  438. data/spec/opal/core/language/regexp_spec.rb +20 -0
  439. data/spec/opal/core/language/send_spec.rb +225 -0
  440. data/spec/opal/core/language/string_spec.rb +44 -0
  441. data/spec/opal/core/language/variables_spec.rb +1366 -0
  442. data/spec/opal/core/language/versions/array_1.9.rb +39 -0
  443. data/spec/opal/core/language/versions/block_1.9.rb +0 -0
  444. data/spec/opal/core/language/versions/break_1.9.rb +0 -0
  445. data/spec/opal/core/language/versions/case_1.9.rb +20 -0
  446. data/spec/opal/core/language/versions/def_2_0_spec.rb +62 -0
  447. data/spec/opal/core/language/versions/hash_1.9.rb +18 -0
  448. data/spec/opal/core/language/versions/literal_lambda_1.9.rb +143 -0
  449. data/spec/opal/core/language/versions/not_1.9.rb +22 -0
  450. data/spec/opal/core/language/versions/send_1.9.rb +241 -0
  451. data/spec/opal/core/language/versions/symbol_1.9.rb +15 -0
  452. data/spec/opal/core/language/versions/variables_1.9.rb +8 -0
  453. data/spec/opal/core/language_spec.rb +23 -0
  454. data/spec/opal/core/method/to_proc_spec.rb +28 -0
  455. data/spec/opal/core/module/alias_method_spec.rb +28 -0
  456. data/spec/opal/core/module/ancestors_spec.rb +11 -0
  457. data/spec/opal/core/module/append_features_spec.rb +14 -0
  458. data/spec/opal/core/module/attr_accessor_spec.rb +26 -0
  459. data/spec/opal/core/module/const_defined_spec.rb +85 -0
  460. data/spec/opal/core/module/const_get_spec.rb +85 -0
  461. data/spec/opal/core/module/const_missing_spec.rb +17 -0
  462. data/spec/opal/core/module/const_set_spec.rb +64 -0
  463. data/spec/opal/core/module/constants_spec.rb +49 -0
  464. data/spec/opal/core/module/fixtures/classes.rb +434 -0
  465. data/spec/opal/core/module/method_defined_spec.rb +48 -0
  466. data/spec/opal/core/module/module_function_spec.rb +25 -0
  467. data/spec/opal/core/module/name_spec.rb +52 -0
  468. data/spec/opal/core/module/public_method_defined_spec.rb +18 -0
  469. data/spec/opal/core/module/remove_const_spec.rb +22 -0
  470. data/spec/opal/core/module/undef_method_spec.rb +66 -0
  471. data/spec/opal/core/numeric/bit_and_spec.rb +7 -0
  472. data/spec/opal/core/numeric/bit_or_spec.rb +8 -0
  473. data/spec/opal/core/numeric/bit_xor_spec.rb +6 -0
  474. data/spec/opal/core/numeric/ceil_spec.rb +8 -0
  475. data/spec/opal/core/numeric/chr_spec.rb +8 -0
  476. data/spec/opal/core/numeric/comparison_spec.rb +24 -0
  477. data/spec/opal/core/numeric/complement_spec.rb +8 -0
  478. data/spec/opal/core/numeric/divide_spec.rb +10 -0
  479. data/spec/opal/core/numeric/eql_spec.rb +9 -0
  480. data/spec/opal/core/numeric/exponent_spec.rb +33 -0
  481. data/spec/opal/core/numeric/floor_spec.rb +8 -0
  482. data/spec/opal/core/numeric/gt_spec.rb +11 -0
  483. data/spec/opal/core/numeric/gte_spec.rb +12 -0
  484. data/spec/opal/core/numeric/integer_spec.rb +9 -0
  485. data/spec/opal/core/numeric/left_shift_spec.rb +21 -0
  486. data/spec/opal/core/numeric/lt_spec.rb +11 -0
  487. data/spec/opal/core/numeric/lte_spec.rb +12 -0
  488. data/spec/opal/core/numeric/minus_spec.rb +8 -0
  489. data/spec/opal/core/numeric/modulo_spec.rb +19 -0
  490. data/spec/opal/core/numeric/multiply_spec.rb +9 -0
  491. data/spec/opal/core/numeric/next_spec.rb +9 -0
  492. data/spec/opal/core/numeric/ord_spec.rb +9 -0
  493. data/spec/opal/core/numeric/plus_spec.rb +8 -0
  494. data/spec/opal/core/numeric/pred_spec.rb +7 -0
  495. data/spec/opal/core/numeric/right_shift_spec.rb +25 -0
  496. data/spec/opal/core/numeric/step_spec.rb +11 -0
  497. data/spec/opal/core/numeric/succ_spec.rb +9 -0
  498. data/spec/opal/core/numeric/times_spec.rb +36 -0
  499. data/spec/opal/core/numeric/to_f_spec.rb +7 -0
  500. data/spec/opal/core/numeric/to_i_spec.rb +7 -0
  501. data/spec/opal/core/numeric/to_json_spec.rb +8 -0
  502. data/spec/opal/core/numeric/to_s_spec.rb +26 -0
  503. data/spec/opal/core/numeric/uminus_spec.rb +9 -0
  504. data/spec/opal/core/numeric/upto_spec.rb +19 -0
  505. data/spec/opal/core/numeric/zero_spec.rb +7 -0
  506. data/spec/opal/core/object_id_spec.rb +56 -0
  507. data/spec/opal/core/proc/call_spec.rb +21 -0
  508. data/spec/opal/core/proc/element_reference_spec.rb +21 -0
  509. data/spec/opal/core/proc/proc_tricks_spec.rb +7 -0
  510. data/spec/opal/core/runtime/begin_spec.rb +39 -0
  511. data/spec/opal/core/runtime/block_send_spec.rb +28 -0
  512. data/spec/opal/core/runtime/block_spec.rb +23 -0
  513. data/spec/opal/core/runtime/bridged_classes_spec.rb +111 -0
  514. data/spec/opal/core/runtime/constants_spec.rb +13 -0
  515. data/spec/opal/core/runtime/donate_spec.rb +53 -0
  516. data/spec/opal/core/runtime/eval_spec.rb +5 -0
  517. data/spec/opal/core/runtime/main_methods_spec.rb +27 -0
  518. data/spec/opal/core/runtime/method_missing_spec.rb +62 -0
  519. data/spec/opal/core/runtime/method_spec.rb +31 -0
  520. data/spec/opal/core/runtime/operator_call_spec.rb +13 -0
  521. data/spec/opal/core/runtime/paren_spec.rb +14 -0
  522. data/spec/opal/core/runtime/rescue_spec.rb +38 -0
  523. data/spec/opal/core/runtime/return_spec.rb +38 -0
  524. data/spec/opal/core/runtime/send_spec.rb +34 -0
  525. data/spec/opal/core/runtime/singleton_class_spec.rb +13 -0
  526. data/spec/opal/core/runtime/super_spec.rb +212 -0
  527. data/spec/opal/core/runtime/truthy_spec.rb +23 -0
  528. data/spec/opal/core/runtime/variables_spec.rb +20 -0
  529. data/spec/opal/core/runtime_spec.rb +58 -0
  530. data/spec/opal/core/source_map_spec.rb +15 -0
  531. data/spec/opal/core/string_spec.rb +11 -0
  532. data/spec/opal/stdlib/erb/erb_spec.rb +30 -0
  533. data/spec/opal/stdlib/erb/inline_block.opalerb +3 -0
  534. data/spec/opal/stdlib/erb/quoted.opalerb +1 -0
  535. data/spec/opal/stdlib/erb/simple.opalerb +1 -0
  536. data/spec/opal/stdlib/js_spec.rb +66 -0
  537. data/spec/opal/stdlib/json/ext_spec.rb +48 -0
  538. data/spec/opal/stdlib/json/parse_spec.rb +33 -0
  539. data/spec/opal/stdlib/native/alias_native_spec.rb +27 -0
  540. data/spec/opal/stdlib/native/each_spec.rb +13 -0
  541. data/spec/opal/stdlib/native/element_reference_spec.rb +16 -0
  542. data/spec/opal/stdlib/native/exposure_spec.rb +33 -0
  543. data/spec/opal/stdlib/native/ext_spec.rb +19 -0
  544. data/spec/opal/stdlib/native/initialize_spec.rb +17 -0
  545. data/spec/opal/stdlib/native/method_missing_spec.rb +51 -0
  546. data/spec/opal/stdlib/native/native_alias_spec.rb +19 -0
  547. data/spec/opal/stdlib/native/native_class_spec.rb +18 -0
  548. data/spec/opal/stdlib/native/native_module_spec.rb +13 -0
  549. data/spec/opal/stdlib/native/native_reader_spec.rb +22 -0
  550. data/spec/opal/stdlib/native/native_writer_spec.rb +30 -0
  551. data/spec/opal/stdlib/native/new_spec.rb +8 -0
  552. data/spec/opal/stdlib/promise/always_spec.rb +30 -0
  553. data/spec/opal/stdlib/promise/error_spec.rb +15 -0
  554. data/spec/opal/stdlib/promise/rescue_spec.rb +44 -0
  555. data/spec/opal/stdlib/promise/then_spec.rb +71 -0
  556. data/spec/opal/stdlib/promise/trace_spec.rb +52 -0
  557. data/spec/opal/stdlib/promise/value_spec.rb +15 -0
  558. data/spec/opal/stdlib/promise/when_spec.rb +34 -0
  559. data/spec/opal/stdlib/template/paths_spec.rb +10 -0
  560. data/spec/opal/stdlib/thread/mutex_spec.rb +40 -0
  561. data/spec/opal/stdlib/thread/thread_queue_spec.rb +32 -0
  562. data/spec/opal/stdlib/thread/thread_spec.rb +60 -0
  563. data/spec/rubyspecs +144 -0
  564. data/spec/spec_helper.rb +53 -0
  565. data/spec/support/mspec_rspec_adapter.rb +33 -0
  566. data/spec/support/parser_helpers.rb +37 -0
  567. data/stdlib/README.md +3 -0
  568. data/stdlib/base64.rb +152 -0
  569. data/stdlib/benchmark.rb +557 -0
  570. data/stdlib/buffer.rb +41 -0
  571. data/stdlib/buffer/array.rb +66 -0
  572. data/stdlib/buffer/view.rb +70 -0
  573. data/stdlib/date.rb +248 -0
  574. data/stdlib/delegate.rb +29 -0
  575. data/stdlib/dir.rb +1 -0
  576. data/stdlib/encoding.rb +170 -0
  577. data/stdlib/enumerator.rb +1 -0
  578. data/stdlib/erb.rb +16 -0
  579. data/stdlib/file.rb +1 -0
  580. data/stdlib/fileutils.rb +0 -0
  581. data/stdlib/forwardable.rb +71 -0
  582. data/stdlib/iconv.rb +0 -0
  583. data/stdlib/js.rb +56 -0
  584. data/stdlib/json.rb +190 -0
  585. data/stdlib/math.rb +370 -0
  586. data/stdlib/native.rb +530 -0
  587. data/stdlib/nodejs.rb +7 -0
  588. data/stdlib/nodejs/dir.rb +13 -0
  589. data/stdlib/nodejs/file.rb +98 -0
  590. data/stdlib/nodejs/fileutils.rb +26 -0
  591. data/stdlib/nodejs/io.rb +2 -0
  592. data/stdlib/nodejs/irb.rb +45 -0
  593. data/stdlib/nodejs/kernel.rb +33 -0
  594. data/stdlib/nodejs/node_modules/.bin/js-yaml +140 -0
  595. data/stdlib/nodejs/node_modules/glob/LICENSE +15 -0
  596. data/stdlib/nodejs/node_modules/glob/README.md +357 -0
  597. data/stdlib/nodejs/node_modules/glob/common.js +177 -0
  598. data/stdlib/nodejs/node_modules/glob/glob.js +649 -0
  599. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
  600. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/LICENSE +15 -0
  601. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/README.md +37 -0
  602. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/inflight.js +44 -0
  603. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
  604. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
  605. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +52 -0
  606. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
  607. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
  608. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/package.json +61 -0
  609. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/test.js +97 -0
  610. data/stdlib/nodejs/node_modules/glob/node_modules/inherits/LICENSE +16 -0
  611. data/stdlib/nodejs/node_modules/glob/node_modules/inherits/README.md +42 -0
  612. data/stdlib/nodejs/node_modules/glob/node_modules/inherits/inherits.js +1 -0
  613. data/stdlib/nodejs/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
  614. data/stdlib/nodejs/node_modules/glob/node_modules/inherits/package.json +51 -0
  615. data/stdlib/nodejs/node_modules/glob/node_modules/inherits/test.js +25 -0
  616. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/.npmignore +1 -0
  617. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/.travis.yml +4 -0
  618. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
  619. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/README.md +216 -0
  620. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/benchmark.js +15 -0
  621. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/browser.js +1181 -0
  622. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/minimatch.js +845 -0
  623. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +2 -0
  624. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +3 -0
  625. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +121 -0
  626. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
  627. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
  628. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
  629. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml +4 -0
  630. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
  631. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
  632. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
  633. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
  634. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +73 -0
  635. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
  636. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml +4 -0
  637. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
  638. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
  639. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
  640. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
  641. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +83 -0
  642. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
  643. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +75 -0
  644. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +32 -0
  645. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +1075 -0
  646. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +182 -0
  647. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +9 -0
  648. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +10 -0
  649. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +24 -0
  650. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +15 -0
  651. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +16 -0
  652. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +10 -0
  653. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +13 -0
  654. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +7 -0
  655. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +50 -0
  656. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/package.json +60 -0
  657. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
  658. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/test/brace-expand.js +45 -0
  659. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
  660. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
  661. data/stdlib/nodejs/node_modules/glob/node_modules/once/LICENSE +27 -0
  662. data/stdlib/nodejs/node_modules/glob/node_modules/once/README.md +51 -0
  663. data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
  664. data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
  665. data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +52 -0
  666. data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
  667. data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
  668. data/stdlib/nodejs/node_modules/glob/node_modules/once/once.js +21 -0
  669. data/stdlib/nodejs/node_modules/glob/node_modules/once/package.json +60 -0
  670. data/stdlib/nodejs/node_modules/glob/node_modules/once/test/once.js +23 -0
  671. data/stdlib/nodejs/node_modules/glob/package.json +72 -0
  672. data/stdlib/nodejs/node_modules/glob/sync.js +409 -0
  673. data/stdlib/nodejs/node_modules/js-yaml/HISTORY.md +277 -0
  674. data/stdlib/nodejs/node_modules/js-yaml/LICENSE +21 -0
  675. data/stdlib/nodejs/node_modules/js-yaml/README.md +288 -0
  676. data/stdlib/nodejs/node_modules/js-yaml/bin/js-yaml.js +140 -0
  677. data/stdlib/nodejs/node_modules/js-yaml/bower.json +23 -0
  678. data/stdlib/nodejs/node_modules/js-yaml/dist/js-yaml.js +3666 -0
  679. data/stdlib/nodejs/node_modules/js-yaml/dist/js-yaml.min.js +3 -0
  680. data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.js +102 -0
  681. data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.yml +18 -0
  682. data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.js +31 -0
  683. data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.json +22 -0
  684. data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.js +18 -0
  685. data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.yml +197 -0
  686. data/stdlib/nodejs/node_modules/js-yaml/index.js +7 -0
  687. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml.js +39 -0
  688. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/common.js +62 -0
  689. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/dumper.js +554 -0
  690. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/exception.js +25 -0
  691. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/loader.js +1581 -0
  692. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/mark.js +78 -0
  693. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema.js +103 -0
  694. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/core.js +18 -0
  695. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +25 -0
  696. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +28 -0
  697. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +17 -0
  698. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/json.js +25 -0
  699. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type.js +61 -0
  700. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/binary.js +133 -0
  701. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/bool.js +37 -0
  702. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/float.js +110 -0
  703. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/int.js +183 -0
  704. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/function.js +85 -0
  705. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +84 -0
  706. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +27 -0
  707. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/map.js +8 -0
  708. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/merge.js +12 -0
  709. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/null.js +36 -0
  710. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/omap.js +56 -0
  711. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/pairs.js +61 -0
  712. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/seq.js +8 -0
  713. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/set.js +33 -0
  714. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/str.js +8 -0
  715. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +98 -0
  716. data/stdlib/nodejs/node_modules/js-yaml/node_modules/.bin/esparse +117 -0
  717. data/stdlib/nodejs/node_modules/js-yaml/node_modules/.bin/esvalidate +177 -0
  718. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/HISTORY.md +115 -0
  719. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/LICENSE +21 -0
  720. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/README.md +239 -0
  721. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/arguments.js +36 -0
  722. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/choice.js +22 -0
  723. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/constants.js +59 -0
  724. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/help.js +13 -0
  725. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/nargs.js +33 -0
  726. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/parents.js +28 -0
  727. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/prefix_chars.js +23 -0
  728. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sub_commands.js +49 -0
  729. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sum.js +35 -0
  730. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/testformatters.js +270 -0
  731. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/index.js +1 -0
  732. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action.js +146 -0
  733. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append.js +55 -0
  734. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js +47 -0
  735. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/count.js +40 -0
  736. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/help.js +48 -0
  737. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store.js +50 -0
  738. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js +43 -0
  739. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/false.js +27 -0
  740. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/true.js +26 -0
  741. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/subparsers.js +148 -0
  742. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/version.js +50 -0
  743. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action_container.js +481 -0
  744. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argparse.js +14 -0
  745. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/error.js +50 -0
  746. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/exclusive.js +54 -0
  747. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/group.js +75 -0
  748. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument_parser.js +1168 -0
  749. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/const.js +18 -0
  750. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/added_formatters.js +88 -0
  751. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/formatter.js +798 -0
  752. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/namespace.js +77 -0
  753. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.npmignore +2 -0
  754. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.travis.yml +8 -0
  755. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/README.markdown +825 -0
  756. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/bower.json +33 -0
  757. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/component.json +11 -0
  758. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/foo.js +10 -0
  759. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/gulpfile.js +26 -0
  760. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/lib/underscore.string.js +673 -0
  761. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/libpeerconnection.log +0 -0
  762. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/package.json +107 -0
  763. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/LICENSE +23 -0
  764. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/README.md +22 -0
  765. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/package.json +69 -0
  766. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore-min.js +6 -0
  767. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore.js +1415 -0
  768. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/package.json +62 -0
  769. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/README.md +73 -0
  770. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esparse.js +117 -0
  771. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esvalidate.js +177 -0
  772. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/esprima.js +3908 -0
  773. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/package.json +69 -0
  774. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/compat.js +239 -0
  775. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/reflect.js +422 -0
  776. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/run.js +66 -0
  777. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/runner.js +387 -0
  778. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/test.js +20238 -0
  779. data/stdlib/nodejs/node_modules/js-yaml/package.json +83 -0
  780. data/stdlib/nodejs/package.json +6 -0
  781. data/stdlib/nodejs/require.rb +30 -0
  782. data/stdlib/nodejs/rubygems.rb +68 -0
  783. data/stdlib/nodejs/yaml.rb +11 -0
  784. data/stdlib/observer.rb +202 -0
  785. data/stdlib/opal-parser.rb +54 -0
  786. data/stdlib/opal-source-maps.rb +2 -0
  787. data/stdlib/ostruct.rb +69 -0
  788. data/stdlib/pathname.rb +55 -0
  789. data/stdlib/phantomjs.rb +3 -0
  790. data/stdlib/pp.rb +35 -0
  791. data/stdlib/promise.rb +427 -0
  792. data/stdlib/racc/parser.rb +215 -0
  793. data/stdlib/rbconfig.rb +18 -0
  794. data/stdlib/securerandom.rb +12 -0
  795. data/stdlib/set.rb +170 -0
  796. data/stdlib/singleton.rb +40 -0
  797. data/stdlib/source_map.rb +5 -0
  798. data/stdlib/source_map/map.rb +220 -0
  799. data/stdlib/source_map/mapping.rb +26 -0
  800. data/stdlib/source_map/offset.rb +88 -0
  801. data/stdlib/source_map/version.rb +3 -0
  802. data/stdlib/source_map/vlq.rb +98 -0
  803. data/stdlib/sourcemap.rb +1 -0
  804. data/stdlib/stringio.rb +181 -0
  805. data/stdlib/strscan.rb +166 -0
  806. data/stdlib/template.rb +46 -0
  807. data/stdlib/thread.rb +164 -0
  808. data/stdlib/time.rb +9 -0
  809. data/stdlib/yaml.rb +1 -0
  810. data/tasks/benchmarking.rake +88 -0
  811. data/tasks/building.rake +58 -0
  812. data/tasks/documenting.rake +37 -0
  813. data/tasks/github.rake +19 -0
  814. data/tasks/linting.rake +18 -0
  815. data/tasks/testing.rake +125 -0
  816. data/vendored-minitest/minitest.rb +780 -0
  817. data/vendored-minitest/minitest/assertions.rb +662 -0
  818. data/vendored-minitest/minitest/autorun.rb +12 -0
  819. data/vendored-minitest/minitest/benchmark.rb +426 -0
  820. data/vendored-minitest/minitest/expectations.rb +281 -0
  821. data/vendored-minitest/minitest/hell.rb +11 -0
  822. data/vendored-minitest/minitest/mock.rb +220 -0
  823. data/vendored-minitest/minitest/parallel.rb +65 -0
  824. data/vendored-minitest/minitest/pride.rb +4 -0
  825. data/vendored-minitest/minitest/pride_plugin.rb +142 -0
  826. data/vendored-minitest/minitest/spec.rb +310 -0
  827. data/vendored-minitest/minitest/test.rb +293 -0
  828. data/vendored-minitest/minitest/unit.rb +45 -0
  829. data/vendored-minitest/test/unit.rb +28 -0
  830. metadata +1058 -0
@@ -0,0 +1,140 @@
1
+ #!/usr/bin/env node
2
+
3
+
4
+ 'use strict';
5
+
6
+
7
+ // stdlib
8
+ var fs = require('fs');
9
+
10
+
11
+ // 3rd-party
12
+ var argparse = require('argparse');
13
+
14
+
15
+ // internal
16
+ var yaml = require('..');
17
+
18
+
19
+ ////////////////////////////////////////////////////////////////////////////////
20
+
21
+
22
+ var cli = new argparse.ArgumentParser({
23
+ prog: 'js-yaml',
24
+ version: require('../package.json').version,
25
+ addHelp: true
26
+ });
27
+
28
+
29
+ cli.addArgument(['-c', '--compact'], {
30
+ help: 'Display errors in compact mode',
31
+ action: 'storeTrue'
32
+ });
33
+
34
+
35
+ // deprecated (not needed after we removed output colors)
36
+ // option suppressed, but not completely removed for compatibility
37
+ cli.addArgument(['-j', '--to-json'], {
38
+ help: argparse.Const.SUPPRESS,
39
+ dest: 'json',
40
+ action: 'storeTrue'
41
+ });
42
+
43
+
44
+ cli.addArgument(['-t', '--trace'], {
45
+ help: 'Show stack trace on error',
46
+ action: 'storeTrue'
47
+ });
48
+
49
+ cli.addArgument(['file'], {
50
+ help: 'File to read, utf-8 encoded without BOM',
51
+ nargs: '?',
52
+ defaultValue: '-'
53
+ });
54
+
55
+
56
+ ////////////////////////////////////////////////////////////////////////////////
57
+
58
+
59
+ var options = cli.parseArgs();
60
+
61
+
62
+ ////////////////////////////////////////////////////////////////////////////////
63
+
64
+ function readFile(filename, encoding, callback) {
65
+ if (options.file === '-') {
66
+ // read from stdin
67
+
68
+ var chunks = [];
69
+
70
+ process.stdin.on('data', function(chunk) {
71
+ chunks.push(chunk);
72
+ });
73
+
74
+ process.stdin.on('end', function() {
75
+ return callback(null, Buffer.concat(chunks).toString(encoding));
76
+ });
77
+ } else {
78
+ fs.readFile(filename, encoding, callback);
79
+ }
80
+ }
81
+
82
+ readFile(options.file, 'utf8', function (error, input) {
83
+ var output, isYaml;
84
+
85
+ if (error) {
86
+ if ('ENOENT' === error.code) {
87
+ console.error('File not found: ' + options.file);
88
+ process.exit(2);
89
+ }
90
+
91
+ console.error(
92
+ options.trace && error.stack ||
93
+ error.message ||
94
+ String(error));
95
+
96
+ process.exit(1);
97
+ }
98
+
99
+ try {
100
+ output = JSON.parse(input);
101
+ isYaml = false;
102
+ } catch (error) {
103
+ if (error instanceof SyntaxError) {
104
+ try {
105
+ output = [];
106
+ yaml.loadAll(input, function (doc) { output.push(doc); }, {});
107
+ isYaml = true;
108
+
109
+ if (0 === output.length) {
110
+ output = null;
111
+ } else if (1 === output.length) {
112
+ output = output[0];
113
+ }
114
+ } catch (error) {
115
+ if (options.trace && error.stack) {
116
+ console.error(error.stack);
117
+ } else {
118
+ console.error(error.toString(options.compact));
119
+ }
120
+
121
+ process.exit(1);
122
+ }
123
+ } else {
124
+ console.error(
125
+ options.trace && error.stack ||
126
+ error.message ||
127
+ String(error));
128
+
129
+ process.exit(1);
130
+ }
131
+ }
132
+
133
+ if (isYaml) {
134
+ console.log(JSON.stringify(output, null, ' '));
135
+ } else {
136
+ console.log(yaml.dump(output));
137
+ }
138
+
139
+ process.exit(0);
140
+ });
@@ -0,0 +1,23 @@
1
+
2
+ {
3
+ "name": "js-yaml",
4
+ "main": "dist/js-yaml.js",
5
+ "homepage": "https://github.com/nodeca/js-yaml",
6
+ "authors": [ "Dervus Grim <dervus.grim@gmail.com>",
7
+ "Vitaly Puzrin <vitaly@rcdesign.ru>",
8
+ "Aleksey V Zapparov <ixti@member.fsf.org>",
9
+ "Martin Grenfell <martin.grenfell@gmail.com>" ],
10
+ "description": "YAML 1.2 parser and serializer",
11
+ "keywords": ["yaml", "parser", "serializer", "pyyaml"],
12
+ "license": "MIT",
13
+ "ignore": [
14
+ "**/.*",
15
+ "node_modules",
16
+ "benchmark",
17
+ "bower_components",
18
+ "test",
19
+ "Makefile",
20
+ "index*",
21
+ "package.json"
22
+ ]
23
+ }
@@ -0,0 +1,3666 @@
1
+ /* js-yaml 3.2.6 https://github.com/nodeca/js-yaml */!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.jsyaml=e()}}(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
+ 'use strict';
3
+
4
+
5
+ var loader = require('./js-yaml/loader');
6
+ var dumper = require('./js-yaml/dumper');
7
+
8
+
9
+ function deprecated(name) {
10
+ return function () {
11
+ throw new Error('Function ' + name + ' is deprecated and cannot be used.');
12
+ };
13
+ }
14
+
15
+
16
+ module.exports.Type = require('./js-yaml/type');
17
+ module.exports.Schema = require('./js-yaml/schema');
18
+ module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe');
19
+ module.exports.JSON_SCHEMA = require('./js-yaml/schema/json');
20
+ module.exports.CORE_SCHEMA = require('./js-yaml/schema/core');
21
+ module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
22
+ module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full');
23
+ module.exports.load = loader.load;
24
+ module.exports.loadAll = loader.loadAll;
25
+ module.exports.safeLoad = loader.safeLoad;
26
+ module.exports.safeLoadAll = loader.safeLoadAll;
27
+ module.exports.dump = dumper.dump;
28
+ module.exports.safeDump = dumper.safeDump;
29
+ module.exports.YAMLException = require('./js-yaml/exception');
30
+
31
+ // Deprecared schema names from JS-YAML 2.0.x
32
+ module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');
33
+ module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
34
+ module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');
35
+
36
+ // Deprecated functions from JS-YAML 1.x.x
37
+ module.exports.scan = deprecated('scan');
38
+ module.exports.parse = deprecated('parse');
39
+ module.exports.compose = deprecated('compose');
40
+ module.exports.addConstructor = deprecated('addConstructor');
41
+
42
+ },{"./js-yaml/dumper":3,"./js-yaml/exception":4,"./js-yaml/loader":5,"./js-yaml/schema":7,"./js-yaml/schema/core":8,"./js-yaml/schema/default_full":9,"./js-yaml/schema/default_safe":10,"./js-yaml/schema/failsafe":11,"./js-yaml/schema/json":12,"./js-yaml/type":13}],2:[function(require,module,exports){
43
+ 'use strict';
44
+
45
+
46
+ function isNothing(subject) {
47
+ return (undefined === subject) || (null === subject);
48
+ }
49
+
50
+
51
+ function isObject(subject) {
52
+ return ('object' === typeof subject) && (null !== subject);
53
+ }
54
+
55
+
56
+ function toArray(sequence) {
57
+ if (Array.isArray(sequence)) {
58
+ return sequence;
59
+ } else if (isNothing(sequence)) {
60
+ return [];
61
+ } else {
62
+ return [ sequence ];
63
+ }
64
+ }
65
+
66
+
67
+ function extend(target, source) {
68
+ var index, length, key, sourceKeys;
69
+
70
+ if (source) {
71
+ sourceKeys = Object.keys(source);
72
+
73
+ for (index = 0, length = sourceKeys.length; index < length; index += 1) {
74
+ key = sourceKeys[index];
75
+ target[key] = source[key];
76
+ }
77
+ }
78
+
79
+ return target;
80
+ }
81
+
82
+
83
+ function repeat(string, count) {
84
+ var result = '', cycle;
85
+
86
+ for (cycle = 0; cycle < count; cycle += 1) {
87
+ result += string;
88
+ }
89
+
90
+ return result;
91
+ }
92
+
93
+
94
+ function isNegativeZero(number) {
95
+ return (0 === number) && (Number.NEGATIVE_INFINITY === 1 / number);
96
+ }
97
+
98
+
99
+ module.exports.isNothing = isNothing;
100
+ module.exports.isObject = isObject;
101
+ module.exports.toArray = toArray;
102
+ module.exports.repeat = repeat;
103
+ module.exports.isNegativeZero = isNegativeZero;
104
+ module.exports.extend = extend;
105
+
106
+ },{}],3:[function(require,module,exports){
107
+ 'use strict';
108
+
109
+
110
+ var common = require('./common');
111
+ var YAMLException = require('./exception');
112
+ var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
113
+ var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
114
+
115
+
116
+ var _toString = Object.prototype.toString;
117
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
118
+
119
+
120
+ var CHAR_TAB = 0x09; /* Tab */
121
+ var CHAR_LINE_FEED = 0x0A; /* LF */
122
+ var CHAR_CARRIAGE_RETURN = 0x0D; /* CR */
123
+ var CHAR_SPACE = 0x20; /* Space */
124
+ var CHAR_EXCLAMATION = 0x21; /* ! */
125
+ var CHAR_DOUBLE_QUOTE = 0x22; /* " */
126
+ var CHAR_SHARP = 0x23; /* # */
127
+ var CHAR_PERCENT = 0x25; /* % */
128
+ var CHAR_AMPERSAND = 0x26; /* & */
129
+ var CHAR_SINGLE_QUOTE = 0x27; /* ' */
130
+ var CHAR_ASTERISK = 0x2A; /* * */
131
+ var CHAR_COMMA = 0x2C; /* , */
132
+ var CHAR_MINUS = 0x2D; /* - */
133
+ var CHAR_COLON = 0x3A; /* : */
134
+ var CHAR_GREATER_THAN = 0x3E; /* > */
135
+ var CHAR_QUESTION = 0x3F; /* ? */
136
+ var CHAR_COMMERCIAL_AT = 0x40; /* @ */
137
+ var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
138
+ var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
139
+ var CHAR_GRAVE_ACCENT = 0x60; /* ` */
140
+ var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
141
+ var CHAR_VERTICAL_LINE = 0x7C; /* | */
142
+ var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
143
+
144
+
145
+ var ESCAPE_SEQUENCES = {};
146
+
147
+ ESCAPE_SEQUENCES[0x00] = '\\0';
148
+ ESCAPE_SEQUENCES[0x07] = '\\a';
149
+ ESCAPE_SEQUENCES[0x08] = '\\b';
150
+ ESCAPE_SEQUENCES[0x09] = '\\t';
151
+ ESCAPE_SEQUENCES[0x0A] = '\\n';
152
+ ESCAPE_SEQUENCES[0x0B] = '\\v';
153
+ ESCAPE_SEQUENCES[0x0C] = '\\f';
154
+ ESCAPE_SEQUENCES[0x0D] = '\\r';
155
+ ESCAPE_SEQUENCES[0x1B] = '\\e';
156
+ ESCAPE_SEQUENCES[0x22] = '\\"';
157
+ ESCAPE_SEQUENCES[0x5C] = '\\\\';
158
+ ESCAPE_SEQUENCES[0x85] = '\\N';
159
+ ESCAPE_SEQUENCES[0xA0] = '\\_';
160
+ ESCAPE_SEQUENCES[0x2028] = '\\L';
161
+ ESCAPE_SEQUENCES[0x2029] = '\\P';
162
+
163
+
164
+ var DEPRECATED_BOOLEANS_SYNTAX = [
165
+ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
166
+ 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
167
+ ];
168
+
169
+
170
+ function compileStyleMap(schema, map) {
171
+ var result, keys, index, length, tag, style, type;
172
+
173
+ if (null === map) {
174
+ return {};
175
+ }
176
+
177
+ result = {};
178
+ keys = Object.keys(map);
179
+
180
+ for (index = 0, length = keys.length; index < length; index += 1) {
181
+ tag = keys[index];
182
+ style = String(map[tag]);
183
+
184
+ if ('!!' === tag.slice(0, 2)) {
185
+ tag = 'tag:yaml.org,2002:' + tag.slice(2);
186
+ }
187
+
188
+ type = schema.compiledTypeMap[tag];
189
+
190
+ if (type && _hasOwnProperty.call(type.styleAliases, style)) {
191
+ style = type.styleAliases[style];
192
+ }
193
+
194
+ result[tag] = style;
195
+ }
196
+
197
+ return result;
198
+ }
199
+
200
+
201
+ function encodeHex(character) {
202
+ var string, handle, length;
203
+
204
+ string = character.toString(16).toUpperCase();
205
+
206
+ if (character <= 0xFF) {
207
+ handle = 'x';
208
+ length = 2;
209
+ } else if (character <= 0xFFFF) {
210
+ handle = 'u';
211
+ length = 4;
212
+ } else if (character <= 0xFFFFFFFF) {
213
+ handle = 'U';
214
+ length = 8;
215
+ } else {
216
+ throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
217
+ }
218
+
219
+ return '\\' + handle + common.repeat('0', length - string.length) + string;
220
+ }
221
+
222
+
223
+ function State(options) {
224
+ this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
225
+ this.indent = Math.max(1, (options['indent'] || 2));
226
+ this.skipInvalid = options['skipInvalid'] || false;
227
+ this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
228
+ this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
229
+
230
+ this.implicitTypes = this.schema.compiledImplicit;
231
+ this.explicitTypes = this.schema.compiledExplicit;
232
+
233
+ this.tag = null;
234
+ this.result = '';
235
+
236
+ this.duplicates = [];
237
+ this.usedDuplicates = null;
238
+ }
239
+
240
+
241
+ function generateNextLine(state, level) {
242
+ return '\n' + common.repeat(' ', state.indent * level);
243
+ }
244
+
245
+ function testImplicitResolving(state, str) {
246
+ var index, length, type;
247
+
248
+ for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
249
+ type = state.implicitTypes[index];
250
+
251
+ if (type.resolve(str)) {
252
+ return true;
253
+ }
254
+ }
255
+
256
+ return false;
257
+ }
258
+
259
+ function writeScalar(state, object) {
260
+ var isQuoted, checkpoint, position, length, character, first;
261
+
262
+ state.dump = '';
263
+ isQuoted = false;
264
+ checkpoint = 0;
265
+ first = object.charCodeAt(0) || 0;
266
+
267
+ if (-1 !== DEPRECATED_BOOLEANS_SYNTAX.indexOf(object)) {
268
+ // Ensure compatibility with YAML 1.0/1.1 loaders.
269
+ isQuoted = true;
270
+ } else if (0 === object.length) {
271
+ // Quote empty string
272
+ isQuoted = true;
273
+ } else if (CHAR_SPACE === first ||
274
+ CHAR_SPACE === object.charCodeAt(object.length - 1)) {
275
+ isQuoted = true;
276
+ } else if (CHAR_MINUS === first ||
277
+ CHAR_QUESTION === first) {
278
+ // Don't check second symbol for simplicity
279
+ isQuoted = true;
280
+ }
281
+
282
+ for (position = 0, length = object.length; position < length; position += 1) {
283
+ character = object.charCodeAt(position);
284
+
285
+ if (!isQuoted) {
286
+ if (CHAR_TAB === character ||
287
+ CHAR_LINE_FEED === character ||
288
+ CHAR_CARRIAGE_RETURN === character ||
289
+ CHAR_COMMA === character ||
290
+ CHAR_LEFT_SQUARE_BRACKET === character ||
291
+ CHAR_RIGHT_SQUARE_BRACKET === character ||
292
+ CHAR_LEFT_CURLY_BRACKET === character ||
293
+ CHAR_RIGHT_CURLY_BRACKET === character ||
294
+ CHAR_SHARP === character ||
295
+ CHAR_AMPERSAND === character ||
296
+ CHAR_ASTERISK === character ||
297
+ CHAR_EXCLAMATION === character ||
298
+ CHAR_VERTICAL_LINE === character ||
299
+ CHAR_GREATER_THAN === character ||
300
+ CHAR_SINGLE_QUOTE === character ||
301
+ CHAR_DOUBLE_QUOTE === character ||
302
+ CHAR_PERCENT === character ||
303
+ CHAR_COMMERCIAL_AT === character ||
304
+ CHAR_COLON === character ||
305
+ CHAR_GRAVE_ACCENT === character) {
306
+ isQuoted = true;
307
+ }
308
+ }
309
+
310
+ if (ESCAPE_SEQUENCES[character] ||
311
+ !((0x00020 <= character && character <= 0x00007E) ||
312
+ (0x00085 === character) ||
313
+ (0x000A0 <= character && character <= 0x00D7FF) ||
314
+ (0x0E000 <= character && character <= 0x00FFFD) ||
315
+ (0x10000 <= character && character <= 0x10FFFF))) {
316
+ state.dump += object.slice(checkpoint, position);
317
+ state.dump += ESCAPE_SEQUENCES[character] || encodeHex(character);
318
+ checkpoint = position + 1;
319
+ isQuoted = true;
320
+ }
321
+ }
322
+
323
+ if (checkpoint < position) {
324
+ state.dump += object.slice(checkpoint, position);
325
+ }
326
+
327
+ if (!isQuoted && testImplicitResolving(state, state.dump)) {
328
+ isQuoted = true;
329
+ }
330
+
331
+ if (isQuoted) {
332
+ state.dump = '"' + state.dump + '"';
333
+ }
334
+ }
335
+
336
+ function writeFlowSequence(state, level, object) {
337
+ var _result = '',
338
+ _tag = state.tag,
339
+ index,
340
+ length;
341
+
342
+ for (index = 0, length = object.length; index < length; index += 1) {
343
+ // Write only valid elements.
344
+ if (writeNode(state, level, object[index], false, false)) {
345
+ if (0 !== index) {
346
+ _result += ', ';
347
+ }
348
+ _result += state.dump;
349
+ }
350
+ }
351
+
352
+ state.tag = _tag;
353
+ state.dump = '[' + _result + ']';
354
+ }
355
+
356
+ function writeBlockSequence(state, level, object, compact) {
357
+ var _result = '',
358
+ _tag = state.tag,
359
+ index,
360
+ length;
361
+
362
+ for (index = 0, length = object.length; index < length; index += 1) {
363
+ // Write only valid elements.
364
+ if (writeNode(state, level + 1, object[index], true, true)) {
365
+ if (!compact || 0 !== index) {
366
+ _result += generateNextLine(state, level);
367
+ }
368
+ _result += '- ' + state.dump;
369
+ }
370
+ }
371
+
372
+ state.tag = _tag;
373
+ state.dump = _result || '[]'; // Empty sequence if no valid values.
374
+ }
375
+
376
+ function writeFlowMapping(state, level, object) {
377
+ var _result = '',
378
+ _tag = state.tag,
379
+ objectKeyList = Object.keys(object),
380
+ index,
381
+ length,
382
+ objectKey,
383
+ objectValue,
384
+ pairBuffer;
385
+
386
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
387
+ pairBuffer = '';
388
+
389
+ if (0 !== index) {
390
+ pairBuffer += ', ';
391
+ }
392
+
393
+ objectKey = objectKeyList[index];
394
+ objectValue = object[objectKey];
395
+
396
+ if (!writeNode(state, level, objectKey, false, false)) {
397
+ continue; // Skip this pair because of invalid key;
398
+ }
399
+
400
+ if (state.dump.length > 1024) {
401
+ pairBuffer += '? ';
402
+ }
403
+
404
+ pairBuffer += state.dump + ': ';
405
+
406
+ if (!writeNode(state, level, objectValue, false, false)) {
407
+ continue; // Skip this pair because of invalid value.
408
+ }
409
+
410
+ pairBuffer += state.dump;
411
+
412
+ // Both key and value are valid.
413
+ _result += pairBuffer;
414
+ }
415
+
416
+ state.tag = _tag;
417
+ state.dump = '{' + _result + '}';
418
+ }
419
+
420
+ function writeBlockMapping(state, level, object, compact) {
421
+ var _result = '',
422
+ _tag = state.tag,
423
+ objectKeyList = Object.keys(object),
424
+ index,
425
+ length,
426
+ objectKey,
427
+ objectValue,
428
+ explicitPair,
429
+ pairBuffer;
430
+
431
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
432
+ pairBuffer = '';
433
+
434
+ if (!compact || 0 !== index) {
435
+ pairBuffer += generateNextLine(state, level);
436
+ }
437
+
438
+ objectKey = objectKeyList[index];
439
+ objectValue = object[objectKey];
440
+
441
+ if (!writeNode(state, level + 1, objectKey, true, true)) {
442
+ continue; // Skip this pair because of invalid key.
443
+ }
444
+
445
+ explicitPair = (null !== state.tag && '?' !== state.tag) ||
446
+ (state.dump && state.dump.length > 1024);
447
+
448
+ if (explicitPair) {
449
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
450
+ pairBuffer += '?';
451
+ } else {
452
+ pairBuffer += '? ';
453
+ }
454
+ }
455
+
456
+ pairBuffer += state.dump;
457
+
458
+ if (explicitPair) {
459
+ pairBuffer += generateNextLine(state, level);
460
+ }
461
+
462
+ if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
463
+ continue; // Skip this pair because of invalid value.
464
+ }
465
+
466
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
467
+ pairBuffer += ':';
468
+ } else {
469
+ pairBuffer += ': ';
470
+ }
471
+
472
+ pairBuffer += state.dump;
473
+
474
+ // Both key and value are valid.
475
+ _result += pairBuffer;
476
+ }
477
+
478
+ state.tag = _tag;
479
+ state.dump = _result || '{}'; // Empty mapping if no valid pairs.
480
+ }
481
+
482
+ function detectType(state, object, explicit) {
483
+ var _result, typeList, index, length, type, style;
484
+
485
+ typeList = explicit ? state.explicitTypes : state.implicitTypes;
486
+
487
+ for (index = 0, length = typeList.length; index < length; index += 1) {
488
+ type = typeList[index];
489
+
490
+ if ((type.instanceOf || type.predicate) &&
491
+ (!type.instanceOf || (('object' === typeof object) && (object instanceof type.instanceOf))) &&
492
+ (!type.predicate || type.predicate(object))) {
493
+
494
+ state.tag = explicit ? type.tag : '?';
495
+
496
+ if (type.represent) {
497
+ style = state.styleMap[type.tag] || type.defaultStyle;
498
+
499
+ if ('[object Function]' === _toString.call(type.represent)) {
500
+ _result = type.represent(object, style);
501
+ } else if (_hasOwnProperty.call(type.represent, style)) {
502
+ _result = type.represent[style](object, style);
503
+ } else {
504
+ throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
505
+ }
506
+
507
+ state.dump = _result;
508
+ }
509
+
510
+ return true;
511
+ }
512
+ }
513
+
514
+ return false;
515
+ }
516
+
517
+ // Serializes `object` and writes it to global `result`.
518
+ // Returns true on success, or false on invalid object.
519
+ //
520
+ function writeNode(state, level, object, block, compact) {
521
+ state.tag = null;
522
+ state.dump = object;
523
+
524
+ if (!detectType(state, object, false)) {
525
+ detectType(state, object, true);
526
+ }
527
+
528
+ var type = _toString.call(state.dump);
529
+
530
+ if (block) {
531
+ block = (0 > state.flowLevel || state.flowLevel > level);
532
+ }
533
+
534
+ if ((null !== state.tag && '?' !== state.tag) || (2 !== state.indent && level > 0)) {
535
+ compact = false;
536
+ }
537
+
538
+ var objectOrArray = '[object Object]' === type || '[object Array]' === type,
539
+ duplicateIndex,
540
+ duplicate;
541
+
542
+ if (objectOrArray) {
543
+ duplicateIndex = state.duplicates.indexOf(object);
544
+ duplicate = duplicateIndex !== -1;
545
+ }
546
+
547
+ if (duplicate && state.usedDuplicates[duplicateIndex]) {
548
+ state.dump = '*ref_' + duplicateIndex;
549
+ } else {
550
+ if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
551
+ state.usedDuplicates[duplicateIndex] = true;
552
+ }
553
+ if ('[object Object]' === type) {
554
+ if (block && (0 !== Object.keys(state.dump).length)) {
555
+ writeBlockMapping(state, level, state.dump, compact);
556
+ if (duplicate) {
557
+ state.dump = '&ref_' + duplicateIndex + (0 === level ? '\n' : '') + state.dump;
558
+ }
559
+ } else {
560
+ writeFlowMapping(state, level, state.dump);
561
+ if (duplicate) {
562
+ state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
563
+ }
564
+ }
565
+ } else if ('[object Array]' === type) {
566
+ if (block && (0 !== state.dump.length)) {
567
+ writeBlockSequence(state, level, state.dump, compact);
568
+ if (duplicate) {
569
+ state.dump = '&ref_' + duplicateIndex + (0 === level ? '\n' : '') + state.dump;
570
+ }
571
+ } else {
572
+ writeFlowSequence(state, level, state.dump);
573
+ if (duplicate) {
574
+ state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
575
+ }
576
+ }
577
+ } else if ('[object String]' === type) {
578
+ if ('?' !== state.tag) {
579
+ writeScalar(state, state.dump);
580
+ }
581
+ } else if (state.skipInvalid) {
582
+ return false;
583
+ } else {
584
+ throw new YAMLException('unacceptable kind of an object to dump ' + type);
585
+ }
586
+
587
+ if (null !== state.tag && '?' !== state.tag) {
588
+ state.dump = '!<' + state.tag + '> ' + state.dump;
589
+ }
590
+ }
591
+
592
+ return true;
593
+ }
594
+
595
+ function getDuplicateReferences(object, state) {
596
+ var objects = [],
597
+ duplicatesIndexes = [],
598
+ index,
599
+ length;
600
+
601
+ inspectNode(object, objects, duplicatesIndexes);
602
+
603
+ for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
604
+ state.duplicates.push(objects[duplicatesIndexes[index]]);
605
+ }
606
+ state.usedDuplicates = new Array(length);
607
+ }
608
+
609
+ function inspectNode(object, objects, duplicatesIndexes) {
610
+ var type = _toString.call(object),
611
+ objectKeyList,
612
+ index,
613
+ length;
614
+
615
+ if (null !== object && 'object' === typeof object) {
616
+ index = objects.indexOf(object);
617
+ if (-1 !== index) {
618
+ if (-1 === duplicatesIndexes.indexOf(index)) {
619
+ duplicatesIndexes.push(index);
620
+ }
621
+ } else {
622
+ objects.push(object);
623
+
624
+ if(Array.isArray(object)) {
625
+ for (index = 0, length = object.length; index < length; index += 1) {
626
+ inspectNode(object[index], objects, duplicatesIndexes);
627
+ }
628
+ } else {
629
+ objectKeyList = Object.keys(object);
630
+
631
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
632
+ inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
633
+ }
634
+ }
635
+ }
636
+ }
637
+ }
638
+
639
+ function dump(input, options) {
640
+ options = options || {};
641
+
642
+ var state = new State(options);
643
+
644
+ getDuplicateReferences(input, state);
645
+
646
+ if (writeNode(state, 0, input, true, true)) {
647
+ return state.dump + '\n';
648
+ } else {
649
+ return '';
650
+ }
651
+ }
652
+
653
+
654
+ function safeDump(input, options) {
655
+ return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
656
+ }
657
+
658
+
659
+ module.exports.dump = dump;
660
+ module.exports.safeDump = safeDump;
661
+
662
+ },{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(require,module,exports){
663
+ 'use strict';
664
+
665
+
666
+ function YAMLException(reason, mark) {
667
+ this.name = 'YAMLException';
668
+ this.reason = reason;
669
+ this.mark = mark;
670
+ this.message = this.toString(false);
671
+ }
672
+
673
+
674
+ YAMLException.prototype.toString = function toString(compact) {
675
+ var result;
676
+
677
+ result = 'JS-YAML: ' + (this.reason || '(unknown reason)');
678
+
679
+ if (!compact && this.mark) {
680
+ result += ' ' + this.mark.toString();
681
+ }
682
+
683
+ return result;
684
+ };
685
+
686
+
687
+ module.exports = YAMLException;
688
+
689
+ },{}],5:[function(require,module,exports){
690
+ 'use strict';
691
+
692
+
693
+ var common = require('./common');
694
+ var YAMLException = require('./exception');
695
+ var Mark = require('./mark');
696
+ var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
697
+ var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
698
+
699
+
700
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
701
+
702
+
703
+ var CONTEXT_FLOW_IN = 1;
704
+ var CONTEXT_FLOW_OUT = 2;
705
+ var CONTEXT_BLOCK_IN = 3;
706
+ var CONTEXT_BLOCK_OUT = 4;
707
+
708
+
709
+ var CHOMPING_CLIP = 1;
710
+ var CHOMPING_STRIP = 2;
711
+ var CHOMPING_KEEP = 3;
712
+
713
+
714
+ var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uD800-\uDFFF\uFFFE\uFFFF]/;
715
+ var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
716
+ var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
717
+ var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
718
+ var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
719
+
720
+
721
+ function is_EOL(c) {
722
+ return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
723
+ }
724
+
725
+ function is_WHITE_SPACE(c) {
726
+ return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
727
+ }
728
+
729
+ function is_WS_OR_EOL(c) {
730
+ return (c === 0x09/* Tab */) ||
731
+ (c === 0x20/* Space */) ||
732
+ (c === 0x0A/* LF */) ||
733
+ (c === 0x0D/* CR */);
734
+ }
735
+
736
+ function is_FLOW_INDICATOR(c) {
737
+ return 0x2C/* , */ === c ||
738
+ 0x5B/* [ */ === c ||
739
+ 0x5D/* ] */ === c ||
740
+ 0x7B/* { */ === c ||
741
+ 0x7D/* } */ === c;
742
+ }
743
+
744
+ function fromHexCode(c) {
745
+ var lc;
746
+
747
+ if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
748
+ return c - 0x30;
749
+ }
750
+
751
+ lc = c | 0x20;
752
+ if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
753
+ return lc - 0x61 + 10;
754
+ }
755
+
756
+ return -1;
757
+ }
758
+
759
+ function escapedHexLen(c) {
760
+ if (c === 0x78/* x */) { return 2; }
761
+ if (c === 0x75/* u */) { return 4; }
762
+ if (c === 0x55/* U */) { return 8; }
763
+ return 0;
764
+ }
765
+
766
+ function fromDecimalCode(c) {
767
+ if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
768
+ return c - 0x30;
769
+ }
770
+
771
+ return -1;
772
+ }
773
+
774
+ function simpleEscapeSequence(c) {
775
+ return (c === 0x30/* 0 */) ? '\x00' :
776
+ (c === 0x61/* a */) ? '\x07' :
777
+ (c === 0x62/* b */) ? '\x08' :
778
+ (c === 0x74/* t */) ? '\x09' :
779
+ (c === 0x09/* Tab */) ? '\x09' :
780
+ (c === 0x6E/* n */) ? '\x0A' :
781
+ (c === 0x76/* v */) ? '\x0B' :
782
+ (c === 0x66/* f */) ? '\x0C' :
783
+ (c === 0x72/* r */) ? '\x0D' :
784
+ (c === 0x65/* e */) ? '\x1B' :
785
+ (c === 0x20/* Space */) ? ' ' :
786
+ (c === 0x22/* " */) ? '\x22' :
787
+ (c === 0x2F/* / */) ? '/' :
788
+ (c === 0x5C/* \ */) ? '\x5C' :
789
+ (c === 0x4E/* N */) ? '\x85' :
790
+ (c === 0x5F/* _ */) ? '\xA0' :
791
+ (c === 0x4C/* L */) ? '\u2028' :
792
+ (c === 0x50/* P */) ? '\u2029' : '';
793
+ }
794
+
795
+ function charFromCodepoint(c) {
796
+ if (c <= 0xFFFF) {
797
+ 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
+ }
804
+ }
805
+
806
+ var simpleEscapeCheck = new Array(256); // integer, for fast access
807
+ var simpleEscapeMap = new Array(256);
808
+ for (var i = 0; i < 256; i++) {
809
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
810
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
811
+ }
812
+
813
+
814
+ function State(input, options) {
815
+ this.input = input;
816
+
817
+ this.filename = options['filename'] || null;
818
+ this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
819
+ this.onWarning = options['onWarning'] || null;
820
+ this.legacy = options['legacy'] || false;
821
+
822
+ this.implicitTypes = this.schema.compiledImplicit;
823
+ this.typeMap = this.schema.compiledTypeMap;
824
+
825
+ this.length = input.length;
826
+ this.position = 0;
827
+ this.line = 0;
828
+ this.lineStart = 0;
829
+ this.lineIndent = 0;
830
+
831
+ this.documents = [];
832
+
833
+ /*
834
+ this.version;
835
+ this.checkLineBreaks;
836
+ this.tagMap;
837
+ this.anchorMap;
838
+ this.tag;
839
+ this.anchor;
840
+ this.kind;
841
+ this.result;*/
842
+
843
+ }
844
+
845
+
846
+ function generateError(state, message) {
847
+ return new YAMLException(
848
+ message,
849
+ new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
850
+ }
851
+
852
+ function throwError(state, message) {
853
+ throw generateError(state, message);
854
+ }
855
+
856
+ function throwWarning(state, message) {
857
+ var error = generateError(state, message);
858
+
859
+ if (state.onWarning) {
860
+ state.onWarning.call(null, error);
861
+ } else {
862
+ throw error;
863
+ }
864
+ }
865
+
866
+
867
+ var directiveHandlers = {
868
+
869
+ 'YAML': function handleYamlDirective(state, name, args) {
870
+
871
+ var match, major, minor;
872
+
873
+ if (null !== state.version) {
874
+ throwError(state, 'duplication of %YAML directive');
875
+ }
876
+
877
+ if (1 !== args.length) {
878
+ throwError(state, 'YAML directive accepts exactly one argument');
879
+ }
880
+
881
+ match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
882
+
883
+ if (null === match) {
884
+ throwError(state, 'ill-formed argument of the YAML directive');
885
+ }
886
+
887
+ major = parseInt(match[1], 10);
888
+ minor = parseInt(match[2], 10);
889
+
890
+ if (1 !== major) {
891
+ throwError(state, 'unacceptable YAML version of the document');
892
+ }
893
+
894
+ state.version = args[0];
895
+ state.checkLineBreaks = (minor < 2);
896
+
897
+ if (1 !== minor && 2 !== minor) {
898
+ throwWarning(state, 'unsupported YAML version of the document');
899
+ }
900
+ },
901
+
902
+ 'TAG': function handleTagDirective(state, name, args) {
903
+
904
+ var handle, prefix;
905
+
906
+ if (2 !== args.length) {
907
+ throwError(state, 'TAG directive accepts exactly two arguments');
908
+ }
909
+
910
+ handle = args[0];
911
+ prefix = args[1];
912
+
913
+ if (!PATTERN_TAG_HANDLE.test(handle)) {
914
+ throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
915
+ }
916
+
917
+ if (_hasOwnProperty.call(state.tagMap, handle)) {
918
+ throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
919
+ }
920
+
921
+ if (!PATTERN_TAG_URI.test(prefix)) {
922
+ throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
923
+ }
924
+
925
+ state.tagMap[handle] = prefix;
926
+ }
927
+ };
928
+
929
+
930
+ function captureSegment(state, start, end, checkJson) {
931
+ var _position, _length, _character, _result;
932
+
933
+ if (start < end) {
934
+ _result = state.input.slice(start, end);
935
+
936
+ if (checkJson) {
937
+ for (_position = 0, _length = _result.length;
938
+ _position < _length;
939
+ _position += 1) {
940
+ _character = _result.charCodeAt(_position);
941
+ if (!(0x09 === _character ||
942
+ 0x20 <= _character && _character <= 0x10FFFF)) {
943
+ throwError(state, 'expected valid JSON character');
944
+ }
945
+ }
946
+ }
947
+
948
+ state.result += _result;
949
+ }
950
+ }
951
+
952
+ function mergeMappings(state, destination, source) {
953
+ var sourceKeys, key, index, quantity;
954
+
955
+ if (!common.isObject(source)) {
956
+ throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
957
+ }
958
+
959
+ sourceKeys = Object.keys(source);
960
+
961
+ for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
962
+ key = sourceKeys[index];
963
+
964
+ if (!_hasOwnProperty.call(destination, key)) {
965
+ destination[key] = source[key];
966
+ }
967
+ }
968
+ }
969
+
970
+ function storeMappingPair(state, _result, keyTag, keyNode, valueNode) {
971
+ var index, quantity;
972
+
973
+ keyNode = String(keyNode);
974
+
975
+ if (null === _result) {
976
+ _result = {};
977
+ }
978
+
979
+ if ('tag:yaml.org,2002:merge' === keyTag) {
980
+ if (Array.isArray(valueNode)) {
981
+ for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
982
+ mergeMappings(state, _result, valueNode[index]);
983
+ }
984
+ } else {
985
+ mergeMappings(state, _result, valueNode);
986
+ }
987
+ } else {
988
+ _result[keyNode] = valueNode;
989
+ }
990
+
991
+ return _result;
992
+ }
993
+
994
+ function readLineBreak(state) {
995
+ var ch;
996
+
997
+ ch = state.input.charCodeAt(state.position);
998
+
999
+ if (0x0A/* LF */ === ch) {
1000
+ state.position++;
1001
+ } else if (0x0D/* CR */ === ch) {
1002
+ state.position++;
1003
+ if (0x0A/* LF */ === state.input.charCodeAt(state.position)) {
1004
+ state.position++;
1005
+ }
1006
+ } else {
1007
+ throwError(state, 'a line break is expected');
1008
+ }
1009
+
1010
+ state.line += 1;
1011
+ state.lineStart = state.position;
1012
+ }
1013
+
1014
+ function skipSeparationSpace(state, allowComments, checkIndent) {
1015
+ var lineBreaks = 0,
1016
+ ch = state.input.charCodeAt(state.position);
1017
+
1018
+ while (0 !== ch) {
1019
+ while (is_WHITE_SPACE(ch)) {
1020
+ ch = state.input.charCodeAt(++state.position);
1021
+ }
1022
+
1023
+ if (allowComments && 0x23/* # */ === ch) {
1024
+ do {
1025
+ ch = state.input.charCodeAt(++state.position);
1026
+ } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && 0 !== ch);
1027
+ }
1028
+
1029
+ if (is_EOL(ch)) {
1030
+ readLineBreak(state);
1031
+
1032
+ ch = state.input.charCodeAt(state.position);
1033
+ lineBreaks++;
1034
+ state.lineIndent = 0;
1035
+
1036
+ while (0x20/* Space */ === ch) {
1037
+ state.lineIndent++;
1038
+ ch = state.input.charCodeAt(++state.position);
1039
+ }
1040
+ } else {
1041
+ break;
1042
+ }
1043
+ }
1044
+
1045
+ if (-1 !== checkIndent && 0 !== lineBreaks && state.lineIndent < checkIndent) {
1046
+ throwWarning(state, 'deficient indentation');
1047
+ }
1048
+
1049
+ return lineBreaks;
1050
+ }
1051
+
1052
+ function testDocumentSeparator(state) {
1053
+ var _position = state.position,
1054
+ ch;
1055
+
1056
+ ch = state.input.charCodeAt(_position);
1057
+
1058
+ // Condition state.position === state.lineStart is tested
1059
+ // in parent on each call, for efficiency. No needs to test here again.
1060
+ if ((0x2D/* - */ === ch || 0x2E/* . */ === ch) &&
1061
+ state.input.charCodeAt(_position + 1) === ch &&
1062
+ state.input.charCodeAt(_position+ 2) === ch) {
1063
+
1064
+ _position += 3;
1065
+
1066
+ ch = state.input.charCodeAt(_position);
1067
+
1068
+ if (ch === 0 || is_WS_OR_EOL(ch)) {
1069
+ return true;
1070
+ }
1071
+ }
1072
+
1073
+ return false;
1074
+ }
1075
+
1076
+ function writeFoldedLines(state, count) {
1077
+ if (1 === count) {
1078
+ state.result += ' ';
1079
+ } else if (count > 1) {
1080
+ state.result += common.repeat('\n', count - 1);
1081
+ }
1082
+ }
1083
+
1084
+
1085
+ function readPlainScalar(state, nodeIndent, withinFlowCollection) {
1086
+ var preceding,
1087
+ following,
1088
+ captureStart,
1089
+ captureEnd,
1090
+ hasPendingContent,
1091
+ _line,
1092
+ _lineStart,
1093
+ _lineIndent,
1094
+ _kind = state.kind,
1095
+ _result = state.result,
1096
+ ch;
1097
+
1098
+ ch = state.input.charCodeAt(state.position);
1099
+
1100
+ if (is_WS_OR_EOL(ch) ||
1101
+ is_FLOW_INDICATOR(ch) ||
1102
+ 0x23/* # */ === ch ||
1103
+ 0x26/* & */ === ch ||
1104
+ 0x2A/* * */ === ch ||
1105
+ 0x21/* ! */ === ch ||
1106
+ 0x7C/* | */ === ch ||
1107
+ 0x3E/* > */ === ch ||
1108
+ 0x27/* ' */ === ch ||
1109
+ 0x22/* " */ === ch ||
1110
+ 0x25/* % */ === ch ||
1111
+ 0x40/* @ */ === ch ||
1112
+ 0x60/* ` */ === ch) {
1113
+ return false;
1114
+ }
1115
+
1116
+ if (0x3F/* ? */ === ch || 0x2D/* - */ === ch) {
1117
+ following = state.input.charCodeAt(state.position + 1);
1118
+
1119
+ if (is_WS_OR_EOL(following) ||
1120
+ withinFlowCollection && is_FLOW_INDICATOR(following)) {
1121
+ return false;
1122
+ }
1123
+ }
1124
+
1125
+ state.kind = 'scalar';
1126
+ state.result = '';
1127
+ captureStart = captureEnd = state.position;
1128
+ hasPendingContent = false;
1129
+
1130
+ while (0 !== ch) {
1131
+ if (0x3A/* : */ === ch) {
1132
+ following = state.input.charCodeAt(state.position+1);
1133
+
1134
+ if (is_WS_OR_EOL(following) ||
1135
+ withinFlowCollection && is_FLOW_INDICATOR(following)) {
1136
+ break;
1137
+ }
1138
+
1139
+ } else if (0x23/* # */ === ch) {
1140
+ preceding = state.input.charCodeAt(state.position - 1);
1141
+
1142
+ if (is_WS_OR_EOL(preceding)) {
1143
+ break;
1144
+ }
1145
+
1146
+ } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
1147
+ withinFlowCollection && is_FLOW_INDICATOR(ch)) {
1148
+ break;
1149
+
1150
+ } else if (is_EOL(ch)) {
1151
+ _line = state.line;
1152
+ _lineStart = state.lineStart;
1153
+ _lineIndent = state.lineIndent;
1154
+ skipSeparationSpace(state, false, -1);
1155
+
1156
+ if (state.lineIndent >= nodeIndent) {
1157
+ hasPendingContent = true;
1158
+ ch = state.input.charCodeAt(state.position);
1159
+ continue;
1160
+ } else {
1161
+ state.position = captureEnd;
1162
+ state.line = _line;
1163
+ state.lineStart = _lineStart;
1164
+ state.lineIndent = _lineIndent;
1165
+ break;
1166
+ }
1167
+ }
1168
+
1169
+ if (hasPendingContent) {
1170
+ captureSegment(state, captureStart, captureEnd, false);
1171
+ writeFoldedLines(state, state.line - _line);
1172
+ captureStart = captureEnd = state.position;
1173
+ hasPendingContent = false;
1174
+ }
1175
+
1176
+ if (!is_WHITE_SPACE(ch)) {
1177
+ captureEnd = state.position + 1;
1178
+ }
1179
+
1180
+ ch = state.input.charCodeAt(++state.position);
1181
+ }
1182
+
1183
+ captureSegment(state, captureStart, captureEnd, false);
1184
+
1185
+ if (state.result) {
1186
+ return true;
1187
+ } else {
1188
+ state.kind = _kind;
1189
+ state.result = _result;
1190
+ return false;
1191
+ }
1192
+ }
1193
+
1194
+ function readSingleQuotedScalar(state, nodeIndent) {
1195
+ var ch,
1196
+ captureStart, captureEnd;
1197
+
1198
+ ch = state.input.charCodeAt(state.position);
1199
+
1200
+ if (0x27/* ' */ !== ch) {
1201
+ return false;
1202
+ }
1203
+
1204
+ state.kind = 'scalar';
1205
+ state.result = '';
1206
+ state.position++;
1207
+ captureStart = captureEnd = state.position;
1208
+
1209
+ while (0 !== (ch = state.input.charCodeAt(state.position))) {
1210
+ if (0x27/* ' */ === ch) {
1211
+ captureSegment(state, captureStart, state.position, true);
1212
+ ch = state.input.charCodeAt(++state.position);
1213
+
1214
+ if (0x27/* ' */ === ch) {
1215
+ captureStart = captureEnd = state.position;
1216
+ state.position++;
1217
+ } else {
1218
+ return true;
1219
+ }
1220
+
1221
+ } else if (is_EOL(ch)) {
1222
+ captureSegment(state, captureStart, captureEnd, true);
1223
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1224
+ captureStart = captureEnd = state.position;
1225
+
1226
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1227
+ throwError(state, 'unexpected end of the document within a single quoted scalar');
1228
+
1229
+ } else {
1230
+ state.position++;
1231
+ captureEnd = state.position;
1232
+ }
1233
+ }
1234
+
1235
+ throwError(state, 'unexpected end of the stream within a single quoted scalar');
1236
+ }
1237
+
1238
+ function readDoubleQuotedScalar(state, nodeIndent) {
1239
+ var captureStart,
1240
+ captureEnd,
1241
+ hexLength,
1242
+ hexResult,
1243
+ tmp, tmpEsc,
1244
+ ch;
1245
+
1246
+ ch = state.input.charCodeAt(state.position);
1247
+
1248
+ if (0x22/* " */ !== ch) {
1249
+ return false;
1250
+ }
1251
+
1252
+ state.kind = 'scalar';
1253
+ state.result = '';
1254
+ state.position++;
1255
+ captureStart = captureEnd = state.position;
1256
+
1257
+ while (0 !== (ch = state.input.charCodeAt(state.position))) {
1258
+ if (0x22/* " */ === ch) {
1259
+ captureSegment(state, captureStart, state.position, true);
1260
+ state.position++;
1261
+ return true;
1262
+
1263
+ } else if (0x5C/* \ */ === ch) {
1264
+ captureSegment(state, captureStart, state.position, true);
1265
+ ch = state.input.charCodeAt(++state.position);
1266
+
1267
+ if (is_EOL(ch)) {
1268
+ skipSeparationSpace(state, false, nodeIndent);
1269
+
1270
+ //TODO: rework to inline fn with no type cast?
1271
+ } else if (ch < 256 && simpleEscapeCheck[ch]) {
1272
+ state.result += simpleEscapeMap[ch];
1273
+ state.position++;
1274
+
1275
+ } else if ((tmp = escapedHexLen(ch)) > 0) {
1276
+ hexLength = tmp;
1277
+ hexResult = 0;
1278
+
1279
+ for (; hexLength > 0; hexLength--) {
1280
+ ch = state.input.charCodeAt(++state.position);
1281
+
1282
+ if ((tmp = fromHexCode(ch)) >= 0) {
1283
+ hexResult = (hexResult << 4) + tmp;
1284
+
1285
+ } else {
1286
+ throwError(state, 'expected hexadecimal character');
1287
+ }
1288
+ }
1289
+
1290
+ state.result += charFromCodepoint(hexResult);
1291
+
1292
+ state.position++;
1293
+
1294
+ } else {
1295
+ throwError(state, 'unknown escape sequence');
1296
+ }
1297
+
1298
+ captureStart = captureEnd = state.position;
1299
+
1300
+ } else if (is_EOL(ch)) {
1301
+ captureSegment(state, captureStart, captureEnd, true);
1302
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
1303
+ captureStart = captureEnd = state.position;
1304
+
1305
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
1306
+ throwError(state, 'unexpected end of the document within a double quoted scalar');
1307
+
1308
+ } else {
1309
+ state.position++;
1310
+ captureEnd = state.position;
1311
+ }
1312
+ }
1313
+
1314
+ throwError(state, 'unexpected end of the stream within a double quoted scalar');
1315
+ }
1316
+
1317
+ function readFlowCollection(state, nodeIndent) {
1318
+ var readNext = true,
1319
+ _line,
1320
+ _tag = state.tag,
1321
+ _result,
1322
+ _anchor = state.anchor,
1323
+ following,
1324
+ terminator,
1325
+ isPair,
1326
+ isExplicitPair,
1327
+ isMapping,
1328
+ keyNode,
1329
+ keyTag,
1330
+ valueNode,
1331
+ ch;
1332
+
1333
+ ch = state.input.charCodeAt(state.position);
1334
+
1335
+ if (ch === 0x5B/* [ */) {
1336
+ terminator = 0x5D/* ] */;
1337
+ isMapping = false;
1338
+ _result = [];
1339
+ } else if (ch === 0x7B/* { */) {
1340
+ terminator = 0x7D/* } */;
1341
+ isMapping = true;
1342
+ _result = {};
1343
+ } else {
1344
+ return false;
1345
+ }
1346
+
1347
+ if (null !== state.anchor) {
1348
+ state.anchorMap[state.anchor] = _result;
1349
+ }
1350
+
1351
+ ch = state.input.charCodeAt(++state.position);
1352
+
1353
+ while (0 !== ch) {
1354
+ skipSeparationSpace(state, true, nodeIndent);
1355
+
1356
+ ch = state.input.charCodeAt(state.position);
1357
+
1358
+ if (ch === terminator) {
1359
+ state.position++;
1360
+ state.tag = _tag;
1361
+ state.anchor = _anchor;
1362
+ state.kind = isMapping ? 'mapping' : 'sequence';
1363
+ state.result = _result;
1364
+ return true;
1365
+ } else if (!readNext) {
1366
+ throwError(state, 'missed comma between flow collection entries');
1367
+ }
1368
+
1369
+ keyTag = keyNode = valueNode = null;
1370
+ isPair = isExplicitPair = false;
1371
+
1372
+ if (0x3F/* ? */ === ch) {
1373
+ following = state.input.charCodeAt(state.position + 1);
1374
+
1375
+ if (is_WS_OR_EOL(following)) {
1376
+ isPair = isExplicitPair = true;
1377
+ state.position++;
1378
+ skipSeparationSpace(state, true, nodeIndent);
1379
+ }
1380
+ }
1381
+
1382
+ _line = state.line;
1383
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1384
+ keyTag = state.tag;
1385
+ keyNode = state.result;
1386
+ skipSeparationSpace(state, true, nodeIndent);
1387
+
1388
+ ch = state.input.charCodeAt(state.position);
1389
+
1390
+ if ((isExplicitPair || state.line === _line) && 0x3A/* : */ === ch) {
1391
+ isPair = true;
1392
+ ch = state.input.charCodeAt(++state.position);
1393
+ skipSeparationSpace(state, true, nodeIndent);
1394
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
1395
+ valueNode = state.result;
1396
+ }
1397
+
1398
+ if (isMapping) {
1399
+ storeMappingPair(state, _result, keyTag, keyNode, valueNode);
1400
+ } else if (isPair) {
1401
+ _result.push(storeMappingPair(state, null, keyTag, keyNode, valueNode));
1402
+ } else {
1403
+ _result.push(keyNode);
1404
+ }
1405
+
1406
+ skipSeparationSpace(state, true, nodeIndent);
1407
+
1408
+ ch = state.input.charCodeAt(state.position);
1409
+
1410
+ if (0x2C/* , */ === ch) {
1411
+ readNext = true;
1412
+ ch = state.input.charCodeAt(++state.position);
1413
+ } else {
1414
+ readNext = false;
1415
+ }
1416
+ }
1417
+
1418
+ throwError(state, 'unexpected end of the stream within a flow collection');
1419
+ }
1420
+
1421
+ function readBlockScalar(state, nodeIndent) {
1422
+ var captureStart,
1423
+ folding,
1424
+ chomping = CHOMPING_CLIP,
1425
+ detectedIndent = false,
1426
+ textIndent = nodeIndent,
1427
+ emptyLines = 0,
1428
+ atMoreIndented = false,
1429
+ tmp,
1430
+ ch;
1431
+
1432
+ ch = state.input.charCodeAt(state.position);
1433
+
1434
+ if (ch === 0x7C/* | */) {
1435
+ folding = false;
1436
+ } else if (ch === 0x3E/* > */) {
1437
+ folding = true;
1438
+ } else {
1439
+ return false;
1440
+ }
1441
+
1442
+ state.kind = 'scalar';
1443
+ state.result = '';
1444
+
1445
+ while (0 !== ch) {
1446
+ ch = state.input.charCodeAt(++state.position);
1447
+
1448
+ if (0x2B/* + */ === ch || 0x2D/* - */ === ch) {
1449
+ if (CHOMPING_CLIP === chomping) {
1450
+ chomping = (0x2B/* + */ === ch) ? CHOMPING_KEEP : CHOMPING_STRIP;
1451
+ } else {
1452
+ throwError(state, 'repeat of a chomping mode identifier');
1453
+ }
1454
+
1455
+ } else if ((tmp = fromDecimalCode(ch)) >= 0) {
1456
+ if (tmp === 0) {
1457
+ throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
1458
+ } else if (!detectedIndent) {
1459
+ textIndent = nodeIndent + tmp - 1;
1460
+ detectedIndent = true;
1461
+ } else {
1462
+ throwError(state, 'repeat of an indentation width identifier');
1463
+ }
1464
+
1465
+ } else {
1466
+ break;
1467
+ }
1468
+ }
1469
+
1470
+ if (is_WHITE_SPACE(ch)) {
1471
+ do { ch = state.input.charCodeAt(++state.position); }
1472
+ while (is_WHITE_SPACE(ch));
1473
+
1474
+ if (0x23/* # */ === ch) {
1475
+ do { ch = state.input.charCodeAt(++state.position); }
1476
+ while (!is_EOL(ch) && (0 !== ch));
1477
+ }
1478
+ }
1479
+
1480
+ while (0 !== ch) {
1481
+ readLineBreak(state);
1482
+ state.lineIndent = 0;
1483
+
1484
+ ch = state.input.charCodeAt(state.position);
1485
+
1486
+ while ((!detectedIndent || state.lineIndent < textIndent) &&
1487
+ (0x20/* Space */ === ch)) {
1488
+ state.lineIndent++;
1489
+ ch = state.input.charCodeAt(++state.position);
1490
+ }
1491
+
1492
+ if (!detectedIndent && state.lineIndent > textIndent) {
1493
+ textIndent = state.lineIndent;
1494
+ }
1495
+
1496
+ if (is_EOL(ch)) {
1497
+ emptyLines++;
1498
+ continue;
1499
+ }
1500
+
1501
+ // End of the scalar.
1502
+ if (state.lineIndent < textIndent) {
1503
+
1504
+ // Perform the chomping.
1505
+ if (chomping === CHOMPING_KEEP) {
1506
+ state.result += common.repeat('\n', emptyLines);
1507
+ } else if (chomping === CHOMPING_CLIP) {
1508
+ if (detectedIndent) { // i.e. only if the scalar is not empty.
1509
+ state.result += '\n';
1510
+ }
1511
+ }
1512
+
1513
+ // Break this `while` cycle and go to the funciton's epilogue.
1514
+ break;
1515
+ }
1516
+
1517
+ // Folded style: use fancy rules to handle line breaks.
1518
+ if (folding) {
1519
+
1520
+ // Lines starting with white space characters (more-indented lines) are not folded.
1521
+ if (is_WHITE_SPACE(ch)) {
1522
+ atMoreIndented = true;
1523
+ state.result += common.repeat('\n', emptyLines + 1);
1524
+
1525
+ // End of more-indented block.
1526
+ } else if (atMoreIndented) {
1527
+ atMoreIndented = false;
1528
+ state.result += common.repeat('\n', emptyLines + 1);
1529
+
1530
+ // Just one line break - perceive as the same line.
1531
+ } else if (0 === emptyLines) {
1532
+ if (detectedIndent) { // i.e. only if we have already read some scalar content.
1533
+ state.result += ' ';
1534
+ }
1535
+
1536
+ // Several line breaks - perceive as different lines.
1537
+ } else {
1538
+ state.result += common.repeat('\n', emptyLines);
1539
+ }
1540
+
1541
+ // Literal style: just add exact number of line breaks between content lines.
1542
+ } else {
1543
+
1544
+ // If current line isn't the first one - count line break from the last content line.
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
+ }
1552
+ }
1553
+
1554
+ detectedIndent = true;
1555
+ emptyLines = 0;
1556
+ captureStart = state.position;
1557
+
1558
+ while (!is_EOL(ch) && (0 !== ch))
1559
+ { ch = state.input.charCodeAt(++state.position); }
1560
+
1561
+ captureSegment(state, captureStart, state.position, false);
1562
+ }
1563
+
1564
+ return true;
1565
+ }
1566
+
1567
+ function readBlockSequence(state, nodeIndent) {
1568
+ var _line,
1569
+ _tag = state.tag,
1570
+ _anchor = state.anchor,
1571
+ _result = [],
1572
+ following,
1573
+ detected = false,
1574
+ ch;
1575
+
1576
+ if (null !== state.anchor) {
1577
+ state.anchorMap[state.anchor] = _result;
1578
+ }
1579
+
1580
+ ch = state.input.charCodeAt(state.position);
1581
+
1582
+ while (0 !== ch) {
1583
+
1584
+ if (0x2D/* - */ !== ch) {
1585
+ break;
1586
+ }
1587
+
1588
+ following = state.input.charCodeAt(state.position + 1);
1589
+
1590
+ if (!is_WS_OR_EOL(following)) {
1591
+ break;
1592
+ }
1593
+
1594
+ detected = true;
1595
+ state.position++;
1596
+
1597
+ if (skipSeparationSpace(state, true, -1)) {
1598
+ if (state.lineIndent <= nodeIndent) {
1599
+ _result.push(null);
1600
+ ch = state.input.charCodeAt(state.position);
1601
+ continue;
1602
+ }
1603
+ }
1604
+
1605
+ _line = state.line;
1606
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
1607
+ _result.push(state.result);
1608
+ skipSeparationSpace(state, true, -1);
1609
+
1610
+ ch = state.input.charCodeAt(state.position);
1611
+
1612
+ if ((state.line === _line || state.lineIndent > nodeIndent) && (0 !== ch)) {
1613
+ throwError(state, 'bad indentation of a sequence entry');
1614
+ } else if (state.lineIndent < nodeIndent) {
1615
+ break;
1616
+ }
1617
+ }
1618
+
1619
+ if (detected) {
1620
+ state.tag = _tag;
1621
+ state.anchor = _anchor;
1622
+ state.kind = 'sequence';
1623
+ state.result = _result;
1624
+ return true;
1625
+ } else {
1626
+ return false;
1627
+ }
1628
+ }
1629
+
1630
+ function readBlockMapping(state, nodeIndent, flowIndent) {
1631
+ var following,
1632
+ allowCompact,
1633
+ _line,
1634
+ _tag = state.tag,
1635
+ _anchor = state.anchor,
1636
+ _result = {},
1637
+ keyTag = null,
1638
+ keyNode = null,
1639
+ valueNode = null,
1640
+ atExplicitKey = false,
1641
+ detected = false,
1642
+ ch;
1643
+
1644
+ if (null !== state.anchor) {
1645
+ state.anchorMap[state.anchor] = _result;
1646
+ }
1647
+
1648
+ ch = state.input.charCodeAt(state.position);
1649
+
1650
+ while (0 !== ch) {
1651
+ following = state.input.charCodeAt(state.position + 1);
1652
+ _line = state.line; // Save the current line.
1653
+
1654
+ //
1655
+ // Explicit notation case. There are two separate blocks:
1656
+ // first for the key (denoted by "?") and second for the value (denoted by ":")
1657
+ //
1658
+ if ((0x3F/* ? */ === ch || 0x3A/* : */ === ch) && is_WS_OR_EOL(following)) {
1659
+
1660
+ if (0x3F/* ? */ === ch) {
1661
+ if (atExplicitKey) {
1662
+ storeMappingPair(state, _result, keyTag, keyNode, null);
1663
+ keyTag = keyNode = valueNode = null;
1664
+ }
1665
+
1666
+ detected = true;
1667
+ atExplicitKey = true;
1668
+ allowCompact = true;
1669
+
1670
+ } else if (atExplicitKey) {
1671
+ // i.e. 0x3A/* : */ === character after the explicit key.
1672
+ atExplicitKey = false;
1673
+ allowCompact = true;
1674
+
1675
+ } else {
1676
+ throwError(state, 'incomplete explicit mapping pair; a key node is missed');
1677
+ }
1678
+
1679
+ state.position += 1;
1680
+ ch = following;
1681
+
1682
+ //
1683
+ // Implicit notation case. Flow-style node as the key first, then ":", and the value.
1684
+ //
1685
+ } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
1686
+
1687
+ if (state.line === _line) {
1688
+ ch = state.input.charCodeAt(state.position);
1689
+
1690
+ while (is_WHITE_SPACE(ch)) {
1691
+ ch = state.input.charCodeAt(++state.position);
1692
+ }
1693
+
1694
+ if (0x3A/* : */ === ch) {
1695
+ ch = state.input.charCodeAt(++state.position);
1696
+
1697
+ if (!is_WS_OR_EOL(ch)) {
1698
+ throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
1699
+ }
1700
+
1701
+ if (atExplicitKey) {
1702
+ storeMappingPair(state, _result, keyTag, keyNode, null);
1703
+ keyTag = keyNode = valueNode = null;
1704
+ }
1705
+
1706
+ detected = true;
1707
+ atExplicitKey = false;
1708
+ allowCompact = false;
1709
+ keyTag = state.tag;
1710
+ keyNode = state.result;
1711
+
1712
+ } else if (detected) {
1713
+ throwError(state, 'can not read an implicit mapping pair; a colon is missed');
1714
+
1715
+ } else {
1716
+ state.tag = _tag;
1717
+ state.anchor = _anchor;
1718
+ return true; // Keep the result of `composeNode`.
1719
+ }
1720
+
1721
+ } else if (detected) {
1722
+ throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
1723
+
1724
+ } else {
1725
+ state.tag = _tag;
1726
+ state.anchor = _anchor;
1727
+ return true; // Keep the result of `composeNode`.
1728
+ }
1729
+
1730
+ } else {
1731
+ break; // Reading is done. Go to the epilogue.
1732
+ }
1733
+
1734
+ //
1735
+ // Common reading code for both explicit and implicit notations.
1736
+ //
1737
+ if (state.line === _line || state.lineIndent > nodeIndent) {
1738
+ if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
1739
+ if (atExplicitKey) {
1740
+ keyNode = state.result;
1741
+ } else {
1742
+ valueNode = state.result;
1743
+ }
1744
+ }
1745
+
1746
+ if (!atExplicitKey) {
1747
+ storeMappingPair(state, _result, keyTag, keyNode, valueNode);
1748
+ keyTag = keyNode = valueNode = null;
1749
+ }
1750
+
1751
+ skipSeparationSpace(state, true, -1);
1752
+ ch = state.input.charCodeAt(state.position);
1753
+ }
1754
+
1755
+ if (state.lineIndent > nodeIndent && (0 !== ch)) {
1756
+ throwError(state, 'bad indentation of a mapping entry');
1757
+ } else if (state.lineIndent < nodeIndent) {
1758
+ break;
1759
+ }
1760
+ }
1761
+
1762
+ //
1763
+ // Epilogue.
1764
+ //
1765
+
1766
+ // Special case: last mapping's node contains only the key in explicit notation.
1767
+ if (atExplicitKey) {
1768
+ storeMappingPair(state, _result, keyTag, keyNode, null);
1769
+ }
1770
+
1771
+ // Expose the resulting mapping.
1772
+ if (detected) {
1773
+ state.tag = _tag;
1774
+ state.anchor = _anchor;
1775
+ state.kind = 'mapping';
1776
+ state.result = _result;
1777
+ }
1778
+
1779
+ return detected;
1780
+ }
1781
+
1782
+ function readTagProperty(state) {
1783
+ var _position,
1784
+ isVerbatim = false,
1785
+ isNamed = false,
1786
+ tagHandle,
1787
+ tagName,
1788
+ ch;
1789
+
1790
+ ch = state.input.charCodeAt(state.position);
1791
+
1792
+ if (0x21/* ! */ !== ch) {
1793
+ return false;
1794
+ }
1795
+
1796
+ if (null !== state.tag) {
1797
+ throwError(state, 'duplication of a tag property');
1798
+ }
1799
+
1800
+ ch = state.input.charCodeAt(++state.position);
1801
+
1802
+ if (0x3C/* < */ === ch) {
1803
+ isVerbatim = true;
1804
+ ch = state.input.charCodeAt(++state.position);
1805
+
1806
+ } else if (0x21/* ! */ === ch) {
1807
+ isNamed = true;
1808
+ tagHandle = '!!';
1809
+ ch = state.input.charCodeAt(++state.position);
1810
+
1811
+ } else {
1812
+ tagHandle = '!';
1813
+ }
1814
+
1815
+ _position = state.position;
1816
+
1817
+ if (isVerbatim) {
1818
+ do { ch = state.input.charCodeAt(++state.position); }
1819
+ while (0 !== ch && 0x3E/* > */ !== ch);
1820
+
1821
+ if (state.position < state.length) {
1822
+ tagName = state.input.slice(_position, state.position);
1823
+ ch = state.input.charCodeAt(++state.position);
1824
+ } else {
1825
+ throwError(state, 'unexpected end of the stream within a verbatim tag');
1826
+ }
1827
+ } else {
1828
+ while (0 !== ch && !is_WS_OR_EOL(ch)) {
1829
+
1830
+ if (0x21/* ! */ === ch) {
1831
+ if (!isNamed) {
1832
+ tagHandle = state.input.slice(_position - 1, state.position + 1);
1833
+
1834
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
1835
+ throwError(state, 'named tag handle cannot contain such characters');
1836
+ }
1837
+
1838
+ isNamed = true;
1839
+ _position = state.position + 1;
1840
+ } else {
1841
+ throwError(state, 'tag suffix cannot contain exclamation marks');
1842
+ }
1843
+ }
1844
+
1845
+ ch = state.input.charCodeAt(++state.position);
1846
+ }
1847
+
1848
+ tagName = state.input.slice(_position, state.position);
1849
+
1850
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) {
1851
+ throwError(state, 'tag suffix cannot contain flow indicator characters');
1852
+ }
1853
+ }
1854
+
1855
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) {
1856
+ throwError(state, 'tag name cannot contain such characters: ' + tagName);
1857
+ }
1858
+
1859
+ if (isVerbatim) {
1860
+ state.tag = tagName;
1861
+
1862
+ } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
1863
+ state.tag = state.tagMap[tagHandle] + tagName;
1864
+
1865
+ } else if ('!' === tagHandle) {
1866
+ state.tag = '!' + tagName;
1867
+
1868
+ } else if ('!!' === tagHandle) {
1869
+ state.tag = 'tag:yaml.org,2002:' + tagName;
1870
+
1871
+ } else {
1872
+ throwError(state, 'undeclared tag handle "' + tagHandle + '"');
1873
+ }
1874
+
1875
+ return true;
1876
+ }
1877
+
1878
+ function readAnchorProperty(state) {
1879
+ var _position,
1880
+ ch;
1881
+
1882
+ ch = state.input.charCodeAt(state.position);
1883
+
1884
+ if (0x26/* & */ !== ch) {
1885
+ return false;
1886
+ }
1887
+
1888
+ if (null !== state.anchor) {
1889
+ throwError(state, 'duplication of an anchor property');
1890
+ }
1891
+
1892
+ ch = state.input.charCodeAt(++state.position);
1893
+ _position = state.position;
1894
+
1895
+ while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
1896
+ ch = state.input.charCodeAt(++state.position);
1897
+ }
1898
+
1899
+ if (state.position === _position) {
1900
+ throwError(state, 'name of an anchor node must contain at least one character');
1901
+ }
1902
+
1903
+ state.anchor = state.input.slice(_position, state.position);
1904
+ return true;
1905
+ }
1906
+
1907
+ function readAlias(state) {
1908
+ var _position, alias,
1909
+ len = state.length,
1910
+ input = state.input,
1911
+ ch;
1912
+
1913
+ ch = state.input.charCodeAt(state.position);
1914
+
1915
+ if (0x2A/* * */ !== ch) {
1916
+ return false;
1917
+ }
1918
+
1919
+ ch = state.input.charCodeAt(++state.position);
1920
+ _position = state.position;
1921
+
1922
+ while (0 !== ch && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
1923
+ ch = state.input.charCodeAt(++state.position);
1924
+ }
1925
+
1926
+ if (state.position === _position) {
1927
+ throwError(state, 'name of an alias node must contain at least one character');
1928
+ }
1929
+
1930
+ alias = state.input.slice(_position, state.position);
1931
+
1932
+ if (!state.anchorMap.hasOwnProperty(alias)) {
1933
+ throwError(state, 'unidentified alias "' + alias + '"');
1934
+ }
1935
+
1936
+ state.result = state.anchorMap[alias];
1937
+ skipSeparationSpace(state, true, -1);
1938
+ return true;
1939
+ }
1940
+
1941
+ function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
1942
+ var allowBlockStyles,
1943
+ allowBlockScalars,
1944
+ allowBlockCollections,
1945
+ indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
1946
+ atNewLine = false,
1947
+ hasContent = false,
1948
+ typeIndex,
1949
+ typeQuantity,
1950
+ type,
1951
+ flowIndent,
1952
+ blockIndent,
1953
+ _result;
1954
+
1955
+ state.tag = null;
1956
+ state.anchor = null;
1957
+ state.kind = null;
1958
+ state.result = null;
1959
+
1960
+ allowBlockStyles = allowBlockScalars = allowBlockCollections =
1961
+ CONTEXT_BLOCK_OUT === nodeContext ||
1962
+ CONTEXT_BLOCK_IN === nodeContext;
1963
+
1964
+ if (allowToSeek) {
1965
+ if (skipSeparationSpace(state, true, -1)) {
1966
+ atNewLine = true;
1967
+
1968
+ if (state.lineIndent > parentIndent) {
1969
+ indentStatus = 1;
1970
+ } else if (state.lineIndent === parentIndent) {
1971
+ indentStatus = 0;
1972
+ } else if (state.lineIndent < parentIndent) {
1973
+ indentStatus = -1;
1974
+ }
1975
+ }
1976
+ }
1977
+
1978
+ if (1 === indentStatus) {
1979
+ while (readTagProperty(state) || readAnchorProperty(state)) {
1980
+ if (skipSeparationSpace(state, true, -1)) {
1981
+ atNewLine = true;
1982
+ allowBlockCollections = allowBlockStyles;
1983
+
1984
+ if (state.lineIndent > parentIndent) {
1985
+ indentStatus = 1;
1986
+ } else if (state.lineIndent === parentIndent) {
1987
+ indentStatus = 0;
1988
+ } else if (state.lineIndent < parentIndent) {
1989
+ indentStatus = -1;
1990
+ }
1991
+ } else {
1992
+ allowBlockCollections = false;
1993
+ }
1994
+ }
1995
+ }
1996
+
1997
+ if (allowBlockCollections) {
1998
+ allowBlockCollections = atNewLine || allowCompact;
1999
+ }
2000
+
2001
+ if (1 === indentStatus || CONTEXT_BLOCK_OUT === nodeContext) {
2002
+ if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
2003
+ flowIndent = parentIndent;
2004
+ } else {
2005
+ flowIndent = parentIndent + 1;
2006
+ }
2007
+
2008
+ blockIndent = state.position - state.lineStart;
2009
+
2010
+ if (1 === indentStatus) {
2011
+ if (allowBlockCollections &&
2012
+ (readBlockSequence(state, blockIndent) ||
2013
+ readBlockMapping(state, blockIndent, flowIndent)) ||
2014
+ readFlowCollection(state, flowIndent)) {
2015
+ hasContent = true;
2016
+ } else {
2017
+ if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
2018
+ readSingleQuotedScalar(state, flowIndent) ||
2019
+ readDoubleQuotedScalar(state, flowIndent)) {
2020
+ hasContent = true;
2021
+
2022
+ } else if (readAlias(state)) {
2023
+ hasContent = true;
2024
+
2025
+ if (null !== state.tag || null !== state.anchor) {
2026
+ throwError(state, 'alias node should not have any properties');
2027
+ }
2028
+
2029
+ } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
2030
+ hasContent = true;
2031
+
2032
+ if (null === state.tag) {
2033
+ state.tag = '?';
2034
+ }
2035
+ }
2036
+
2037
+ if (null !== state.anchor) {
2038
+ state.anchorMap[state.anchor] = state.result;
2039
+ }
2040
+ }
2041
+ } else if (0 === indentStatus) {
2042
+ // Special case: block sequences are allowed to have same indentation level as the parent.
2043
+ // http://www.yaml.org/spec/1.2/spec.html#id2799784
2044
+ hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
2045
+ }
2046
+ }
2047
+
2048
+ if (null !== state.tag && '!' !== state.tag) {
2049
+ if ('?' === state.tag) {
2050
+ for (typeIndex = 0, typeQuantity = state.implicitTypes.length;
2051
+ typeIndex < typeQuantity;
2052
+ typeIndex += 1) {
2053
+ type = state.implicitTypes[typeIndex];
2054
+
2055
+ // Implicit resolving is not allowed for non-scalar types, and '?'
2056
+ // non-specific tag is only assigned to plain scalars. So, it isn't
2057
+ // needed to check for 'kind' conformity.
2058
+
2059
+ if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
2060
+ state.result = type.construct(state.result);
2061
+ state.tag = type.tag;
2062
+ if (null !== state.anchor) {
2063
+ state.anchorMap[state.anchor] = state.result;
2064
+ }
2065
+ break;
2066
+ }
2067
+ }
2068
+ } else if (_hasOwnProperty.call(state.typeMap, state.tag)) {
2069
+ type = state.typeMap[state.tag];
2070
+
2071
+ if (null !== state.result && type.kind !== state.kind) {
2072
+ throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
2073
+ }
2074
+
2075
+ if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
2076
+ throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
2077
+ } else {
2078
+ state.result = type.construct(state.result);
2079
+ if (null !== state.anchor) {
2080
+ state.anchorMap[state.anchor] = state.result;
2081
+ }
2082
+ }
2083
+ } else {
2084
+ throwWarning(state, 'unknown tag !<' + state.tag + '>');
2085
+ }
2086
+ }
2087
+
2088
+ return null !== state.tag || null !== state.anchor || hasContent;
2089
+ }
2090
+
2091
+ function readDocument(state) {
2092
+ var documentStart = state.position,
2093
+ _position,
2094
+ directiveName,
2095
+ directiveArgs,
2096
+ hasDirectives = false,
2097
+ ch;
2098
+
2099
+ state.version = null;
2100
+ state.checkLineBreaks = state.legacy;
2101
+ state.tagMap = {};
2102
+ state.anchorMap = {};
2103
+
2104
+ while (0 !== (ch = state.input.charCodeAt(state.position))) {
2105
+ skipSeparationSpace(state, true, -1);
2106
+
2107
+ ch = state.input.charCodeAt(state.position);
2108
+
2109
+ if (state.lineIndent > 0 || 0x25/* % */ !== ch) {
2110
+ break;
2111
+ }
2112
+
2113
+ hasDirectives = true;
2114
+ ch = state.input.charCodeAt(++state.position);
2115
+ _position = state.position;
2116
+
2117
+ while (0 !== ch && !is_WS_OR_EOL(ch)) {
2118
+ ch = state.input.charCodeAt(++state.position);
2119
+ }
2120
+
2121
+ directiveName = state.input.slice(_position, state.position);
2122
+ directiveArgs = [];
2123
+
2124
+ if (directiveName.length < 1) {
2125
+ throwError(state, 'directive name must not be less than one character in length');
2126
+ }
2127
+
2128
+ while (0 !== ch) {
2129
+ while (is_WHITE_SPACE(ch)) {
2130
+ ch = state.input.charCodeAt(++state.position);
2131
+ }
2132
+
2133
+ if (0x23/* # */ === ch) {
2134
+ do { ch = state.input.charCodeAt(++state.position); }
2135
+ while (0 !== ch && !is_EOL(ch));
2136
+ break;
2137
+ }
2138
+
2139
+ if (is_EOL(ch)) {
2140
+ break;
2141
+ }
2142
+
2143
+ _position = state.position;
2144
+
2145
+ while (0 !== ch && !is_WS_OR_EOL(ch)) {
2146
+ ch = state.input.charCodeAt(++state.position);
2147
+ }
2148
+
2149
+ directiveArgs.push(state.input.slice(_position, state.position));
2150
+ }
2151
+
2152
+ if (0 !== ch) {
2153
+ readLineBreak(state);
2154
+ }
2155
+
2156
+ if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
2157
+ directiveHandlers[directiveName](state, directiveName, directiveArgs);
2158
+ } else {
2159
+ throwWarning(state, 'unknown document directive "' + directiveName + '"');
2160
+ }
2161
+ }
2162
+
2163
+ skipSeparationSpace(state, true, -1);
2164
+
2165
+ if (0 === state.lineIndent &&
2166
+ 0x2D/* - */ === state.input.charCodeAt(state.position) &&
2167
+ 0x2D/* - */ === state.input.charCodeAt(state.position + 1) &&
2168
+ 0x2D/* - */ === state.input.charCodeAt(state.position + 2)) {
2169
+ state.position += 3;
2170
+ skipSeparationSpace(state, true, -1);
2171
+
2172
+ } else if (hasDirectives) {
2173
+ throwError(state, 'directives end mark is expected');
2174
+ }
2175
+
2176
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
2177
+ skipSeparationSpace(state, true, -1);
2178
+
2179
+ if (state.checkLineBreaks &&
2180
+ PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
2181
+ throwWarning(state, 'non-ASCII line breaks are interpreted as content');
2182
+ }
2183
+
2184
+ state.documents.push(state.result);
2185
+
2186
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
2187
+
2188
+ if (0x2E/* . */ === state.input.charCodeAt(state.position)) {
2189
+ state.position += 3;
2190
+ skipSeparationSpace(state, true, -1);
2191
+ }
2192
+ return;
2193
+ }
2194
+
2195
+ if (state.position < (state.length - 1)) {
2196
+ throwError(state, 'end of the stream or a document separator is expected');
2197
+ } else {
2198
+ return;
2199
+ }
2200
+ }
2201
+
2202
+
2203
+ function loadDocuments(input, options) {
2204
+ input = String(input);
2205
+ options = options || {};
2206
+
2207
+ if (0 !== input.length &&
2208
+ 0x0A/* LF */ !== input.charCodeAt(input.length - 1) &&
2209
+ 0x0D/* CR */ !== input.charCodeAt(input.length - 1)) {
2210
+ input += '\n';
2211
+ }
2212
+
2213
+ var state = new State(input, options);
2214
+
2215
+ if (PATTERN_NON_PRINTABLE.test(state.input)) {
2216
+ throwError(state, 'the stream contains non-printable characters');
2217
+ }
2218
+
2219
+ // Use 0 as string terminator. That significantly simplifies bounds check.
2220
+ state.input += '\0';
2221
+
2222
+ while (0x20/* Space */ === state.input.charCodeAt(state.position)) {
2223
+ state.lineIndent += 1;
2224
+ state.position += 1;
2225
+ }
2226
+
2227
+ while (state.position < (state.length - 1)) {
2228
+ readDocument(state);
2229
+ }
2230
+
2231
+ return state.documents;
2232
+ }
2233
+
2234
+
2235
+ function loadAll(input, iterator, options) {
2236
+ var documents = loadDocuments(input, options), index, length;
2237
+
2238
+ for (index = 0, length = documents.length; index < length; index += 1) {
2239
+ iterator(documents[index]);
2240
+ }
2241
+ }
2242
+
2243
+
2244
+ function load(input, options) {
2245
+ var documents = loadDocuments(input, options), index, length;
2246
+
2247
+ if (0 === documents.length) {
2248
+ return undefined;
2249
+ } else if (1 === documents.length) {
2250
+ return documents[0];
2251
+ } else {
2252
+ throw new YAMLException('expected a single document in the stream, but found more');
2253
+ }
2254
+ }
2255
+
2256
+
2257
+ function safeLoadAll(input, output, options) {
2258
+ loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
2259
+ }
2260
+
2261
+
2262
+ function safeLoad(input, options) {
2263
+ return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
2264
+ }
2265
+
2266
+
2267
+ module.exports.loadAll = loadAll;
2268
+ module.exports.load = load;
2269
+ module.exports.safeLoadAll = safeLoadAll;
2270
+ module.exports.safeLoad = safeLoad;
2271
+
2272
+ },{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(require,module,exports){
2273
+ 'use strict';
2274
+
2275
+
2276
+ var common = require('./common');
2277
+
2278
+
2279
+ function Mark(name, buffer, position, line, column) {
2280
+ this.name = name;
2281
+ this.buffer = buffer;
2282
+ this.position = position;
2283
+ this.line = line;
2284
+ this.column = column;
2285
+ }
2286
+
2287
+
2288
+ Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
2289
+ var head, start, tail, end, snippet;
2290
+
2291
+ if (!this.buffer) {
2292
+ return null;
2293
+ }
2294
+
2295
+ indent = indent || 4;
2296
+ maxLength = maxLength || 75;
2297
+
2298
+ head = '';
2299
+ start = this.position;
2300
+
2301
+ while (start > 0 && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1))) {
2302
+ start -= 1;
2303
+ if (this.position - start > (maxLength / 2 - 1)) {
2304
+ head = ' ... ';
2305
+ start += 5;
2306
+ break;
2307
+ }
2308
+ }
2309
+
2310
+ tail = '';
2311
+ end = this.position;
2312
+
2313
+ while (end < this.buffer.length && -1 === '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end))) {
2314
+ end += 1;
2315
+ if (end - this.position > (maxLength / 2 - 1)) {
2316
+ tail = ' ... ';
2317
+ end -= 5;
2318
+ break;
2319
+ }
2320
+ }
2321
+
2322
+ snippet = this.buffer.slice(start, end);
2323
+
2324
+ return common.repeat(' ', indent) + head + snippet + tail + '\n' +
2325
+ common.repeat(' ', indent + this.position - start + head.length) + '^';
2326
+ };
2327
+
2328
+
2329
+ Mark.prototype.toString = function toString(compact) {
2330
+ var snippet, where = '';
2331
+
2332
+ if (this.name) {
2333
+ where += 'in "' + this.name + '" ';
2334
+ }
2335
+
2336
+ where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
2337
+
2338
+ if (!compact) {
2339
+ snippet = this.getSnippet();
2340
+
2341
+ if (snippet) {
2342
+ where += ':\n' + snippet;
2343
+ }
2344
+ }
2345
+
2346
+ return where;
2347
+ };
2348
+
2349
+
2350
+ module.exports = Mark;
2351
+
2352
+ },{"./common":2}],7:[function(require,module,exports){
2353
+ 'use strict';
2354
+
2355
+
2356
+ var common = require('./common');
2357
+ var YAMLException = require('./exception');
2358
+ var Type = require('./type');
2359
+
2360
+
2361
+ function compileList(schema, name, result) {
2362
+ var exclude = [];
2363
+
2364
+ schema.include.forEach(function (includedSchema) {
2365
+ result = compileList(includedSchema, name, result);
2366
+ });
2367
+
2368
+ schema[name].forEach(function (currentType) {
2369
+ result.forEach(function (previousType, previousIndex) {
2370
+ if (previousType.tag === currentType.tag) {
2371
+ exclude.push(previousIndex);
2372
+ }
2373
+ });
2374
+
2375
+ result.push(currentType);
2376
+ });
2377
+
2378
+ return result.filter(function (type, index) {
2379
+ return -1 === exclude.indexOf(index);
2380
+ });
2381
+ }
2382
+
2383
+
2384
+ function compileMap(/* lists... */) {
2385
+ var result = {}, index, length;
2386
+
2387
+ function collectType(type) {
2388
+ result[type.tag] = type;
2389
+ }
2390
+
2391
+ for (index = 0, length = arguments.length; index < length; index += 1) {
2392
+ arguments[index].forEach(collectType);
2393
+ }
2394
+
2395
+ return result;
2396
+ }
2397
+
2398
+
2399
+ function Schema(definition) {
2400
+ this.include = definition.include || [];
2401
+ this.implicit = definition.implicit || [];
2402
+ this.explicit = definition.explicit || [];
2403
+
2404
+ this.implicit.forEach(function (type) {
2405
+ if (type.loadKind && 'scalar' !== type.loadKind) {
2406
+ 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
+ }
2408
+ });
2409
+
2410
+ this.compiledImplicit = compileList(this, 'implicit', []);
2411
+ this.compiledExplicit = compileList(this, 'explicit', []);
2412
+ this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
2413
+ }
2414
+
2415
+
2416
+ Schema.DEFAULT = null;
2417
+
2418
+
2419
+ Schema.create = function createSchema() {
2420
+ var schemas, types;
2421
+
2422
+ switch (arguments.length) {
2423
+ case 1:
2424
+ schemas = Schema.DEFAULT;
2425
+ types = arguments[0];
2426
+ break;
2427
+
2428
+ case 2:
2429
+ schemas = arguments[0];
2430
+ types = arguments[1];
2431
+ break;
2432
+
2433
+ default:
2434
+ throw new YAMLException('Wrong number of arguments for Schema.create function');
2435
+ }
2436
+
2437
+ schemas = common.toArray(schemas);
2438
+ types = common.toArray(types);
2439
+
2440
+ if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
2441
+ throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
2442
+ }
2443
+
2444
+ if (!types.every(function (type) { return type instanceof Type; })) {
2445
+ throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
2446
+ }
2447
+
2448
+ return new Schema({
2449
+ include: schemas,
2450
+ explicit: types
2451
+ });
2452
+ };
2453
+
2454
+
2455
+ module.exports = Schema;
2456
+
2457
+ },{"./common":2,"./exception":4,"./type":13}],8:[function(require,module,exports){
2458
+ // Standard YAML's Core schema.
2459
+ // http://www.yaml.org/spec/1.2/spec.html#id2804923
2460
+ //
2461
+ // NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
2462
+ // So, Core schema has no distinctions from JSON schema is JS-YAML.
2463
+
2464
+
2465
+ 'use strict';
2466
+
2467
+
2468
+ var Schema = require('../schema');
2469
+
2470
+
2471
+ module.exports = new Schema({
2472
+ include: [
2473
+ require('./json')
2474
+ ]
2475
+ });
2476
+
2477
+ },{"../schema":7,"./json":12}],9:[function(require,module,exports){
2478
+ // JS-YAML's default schema for `load` function.
2479
+ // It is not described in the YAML specification.
2480
+ //
2481
+ // This schema is based on JS-YAML's default safe schema and includes
2482
+ // JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
2483
+ //
2484
+ // Also this schema is used as default base schema at `Schema.create` function.
2485
+
2486
+
2487
+ 'use strict';
2488
+
2489
+
2490
+ var Schema = require('../schema');
2491
+
2492
+
2493
+ module.exports = Schema.DEFAULT = new Schema({
2494
+ include: [
2495
+ require('./default_safe')
2496
+ ],
2497
+ explicit: [
2498
+ require('../type/js/undefined'),
2499
+ require('../type/js/regexp'),
2500
+ require('../type/js/function')
2501
+ ]
2502
+ });
2503
+
2504
+ },{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(require,module,exports){
2505
+ // JS-YAML's default schema for `safeLoad` function.
2506
+ // It is not described in the YAML specification.
2507
+ //
2508
+ // This schema is based on standard YAML's Core schema and includes most of
2509
+ // extra types described at YAML tag repository. (http://yaml.org/type/)
2510
+
2511
+
2512
+ 'use strict';
2513
+
2514
+
2515
+ var Schema = require('../schema');
2516
+
2517
+
2518
+ module.exports = new Schema({
2519
+ include: [
2520
+ require('./core')
2521
+ ],
2522
+ implicit: [
2523
+ require('../type/timestamp'),
2524
+ require('../type/merge')
2525
+ ],
2526
+ explicit: [
2527
+ require('../type/binary'),
2528
+ require('../type/omap'),
2529
+ require('../type/pairs'),
2530
+ require('../type/set')
2531
+ ]
2532
+ });
2533
+
2534
+ },{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(require,module,exports){
2535
+ // Standard YAML's Failsafe schema.
2536
+ // http://www.yaml.org/spec/1.2/spec.html#id2802346
2537
+
2538
+
2539
+ 'use strict';
2540
+
2541
+
2542
+ var Schema = require('../schema');
2543
+
2544
+
2545
+ module.exports = new Schema({
2546
+ explicit: [
2547
+ require('../type/str'),
2548
+ require('../type/seq'),
2549
+ require('../type/map')
2550
+ ]
2551
+ });
2552
+
2553
+ },{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(require,module,exports){
2554
+ // Standard YAML's JSON schema.
2555
+ // http://www.yaml.org/spec/1.2/spec.html#id2803231
2556
+ //
2557
+ // NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
2558
+ // So, this schema is not such strict as defined in the YAML specification.
2559
+ // It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
2560
+
2561
+
2562
+ 'use strict';
2563
+
2564
+
2565
+ var Schema = require('../schema');
2566
+
2567
+
2568
+ module.exports = new Schema({
2569
+ include: [
2570
+ require('./failsafe')
2571
+ ],
2572
+ implicit: [
2573
+ require('../type/null'),
2574
+ require('../type/bool'),
2575
+ require('../type/int'),
2576
+ require('../type/float')
2577
+ ]
2578
+ });
2579
+
2580
+ },{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(require,module,exports){
2581
+ 'use strict';
2582
+
2583
+ var YAMLException = require('./exception');
2584
+
2585
+ var TYPE_CONSTRUCTOR_OPTIONS = [
2586
+ 'kind',
2587
+ 'resolve',
2588
+ 'construct',
2589
+ 'instanceOf',
2590
+ 'predicate',
2591
+ 'represent',
2592
+ 'defaultStyle',
2593
+ 'styleAliases'
2594
+ ];
2595
+
2596
+ var YAML_NODE_KINDS = [
2597
+ 'scalar',
2598
+ 'sequence',
2599
+ 'mapping'
2600
+ ];
2601
+
2602
+ function compileStyleAliases(map) {
2603
+ var result = {};
2604
+
2605
+ if (null !== map) {
2606
+ Object.keys(map).forEach(function (style) {
2607
+ map[style].forEach(function (alias) {
2608
+ result[String(alias)] = style;
2609
+ });
2610
+ });
2611
+ }
2612
+
2613
+ return result;
2614
+ }
2615
+
2616
+ function Type(tag, options) {
2617
+ options = options || {};
2618
+
2619
+ Object.keys(options).forEach(function (name) {
2620
+ if (-1 === TYPE_CONSTRUCTOR_OPTIONS.indexOf(name)) {
2621
+ throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
2622
+ }
2623
+ });
2624
+
2625
+ // TODO: Add tag format check.
2626
+ this.tag = tag;
2627
+ this.kind = options['kind'] || null;
2628
+ this.resolve = options['resolve'] || function () { return true; };
2629
+ this.construct = options['construct'] || function (data) { return data; };
2630
+ this.instanceOf = options['instanceOf'] || null;
2631
+ this.predicate = options['predicate'] || null;
2632
+ this.represent = options['represent'] || null;
2633
+ this.defaultStyle = options['defaultStyle'] || null;
2634
+ this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
2635
+
2636
+ if (-1 === YAML_NODE_KINDS.indexOf(this.kind)) {
2637
+ throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
2638
+ }
2639
+ }
2640
+
2641
+ module.exports = Type;
2642
+
2643
+ },{"./exception":4}],14:[function(require,module,exports){
2644
+ 'use strict';
2645
+
2646
+
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
+ var Type = require('../type');
2651
+
2652
+
2653
+ // [ 64, 65, 66 ] -> [ padding, CR, LF ]
2654
+ var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
2655
+
2656
+
2657
+ function resolveYamlBinary(data) {
2658
+ if (null === data) {
2659
+ return false;
2660
+ }
2661
+
2662
+ var code, idx, bitlen = 0, len = 0, max = data.length, map = BASE64_MAP;
2663
+
2664
+ // Convert one by one.
2665
+ for (idx = 0; idx < max; idx ++) {
2666
+ code = map.indexOf(data.charAt(idx));
2667
+
2668
+ // Skip CR/LF
2669
+ if (code > 64) { continue; }
2670
+
2671
+ // Fail on illegal characters
2672
+ if (code < 0) { return false; }
2673
+
2674
+ bitlen += 6;
2675
+ }
2676
+
2677
+ // If there are any bits left, source was corrupted
2678
+ return (bitlen % 8) === 0;
2679
+ }
2680
+
2681
+ function constructYamlBinary(data) {
2682
+ var code, idx, tailbits,
2683
+ input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
2684
+ max = input.length,
2685
+ map = BASE64_MAP,
2686
+ bits = 0,
2687
+ result = [];
2688
+
2689
+ // Collect by 6*4 bits (3 bytes)
2690
+
2691
+ for (idx = 0; idx < max; idx++) {
2692
+ if ((idx % 4 === 0) && idx) {
2693
+ result.push((bits >> 16) & 0xFF);
2694
+ result.push((bits >> 8) & 0xFF);
2695
+ result.push(bits & 0xFF);
2696
+ }
2697
+
2698
+ bits = (bits << 6) | map.indexOf(input.charAt(idx));
2699
+ }
2700
+
2701
+ // Dump tail
2702
+
2703
+ tailbits = (max % 4)*6;
2704
+
2705
+ if (tailbits === 0) {
2706
+ result.push((bits >> 16) & 0xFF);
2707
+ result.push((bits >> 8) & 0xFF);
2708
+ result.push(bits & 0xFF);
2709
+ } else if (tailbits === 18) {
2710
+ result.push((bits >> 10) & 0xFF);
2711
+ result.push((bits >> 2) & 0xFF);
2712
+ } else if (tailbits === 12) {
2713
+ result.push((bits >> 4) & 0xFF);
2714
+ }
2715
+
2716
+ // Wrap into Buffer for NodeJS and leave Array for browser
2717
+ if (NodeBuffer) {
2718
+ return new NodeBuffer(result);
2719
+ }
2720
+
2721
+ return result;
2722
+ }
2723
+
2724
+ function representYamlBinary(object /*, style*/) {
2725
+ var result = '', bits = 0, idx, tail,
2726
+ max = object.length,
2727
+ map = BASE64_MAP;
2728
+
2729
+ // Convert every three bytes to 4 ASCII characters.
2730
+
2731
+ for (idx = 0; idx < max; idx++) {
2732
+ if ((idx % 3 === 0) && idx) {
2733
+ result += map[(bits >> 18) & 0x3F];
2734
+ result += map[(bits >> 12) & 0x3F];
2735
+ result += map[(bits >> 6) & 0x3F];
2736
+ result += map[bits & 0x3F];
2737
+ }
2738
+
2739
+ bits = (bits << 8) + object[idx];
2740
+ }
2741
+
2742
+ // Dump tail
2743
+
2744
+ tail = max % 3;
2745
+
2746
+ if (tail === 0) {
2747
+ result += map[(bits >> 18) & 0x3F];
2748
+ result += map[(bits >> 12) & 0x3F];
2749
+ result += map[(bits >> 6) & 0x3F];
2750
+ result += map[bits & 0x3F];
2751
+ } else if (tail === 2) {
2752
+ result += map[(bits >> 10) & 0x3F];
2753
+ result += map[(bits >> 4) & 0x3F];
2754
+ result += map[(bits << 2) & 0x3F];
2755
+ result += map[64];
2756
+ } else if (tail === 1) {
2757
+ result += map[(bits >> 2) & 0x3F];
2758
+ result += map[(bits << 4) & 0x3F];
2759
+ result += map[64];
2760
+ result += map[64];
2761
+ }
2762
+
2763
+ return result;
2764
+ }
2765
+
2766
+ function isBinary(object) {
2767
+ return NodeBuffer && NodeBuffer.isBuffer(object);
2768
+ }
2769
+
2770
+ module.exports = new Type('tag:yaml.org,2002:binary', {
2771
+ kind: 'scalar',
2772
+ resolve: resolveYamlBinary,
2773
+ construct: constructYamlBinary,
2774
+ predicate: isBinary,
2775
+ represent: representYamlBinary
2776
+ });
2777
+
2778
+ },{"../type":13,"buffer":30}],15:[function(require,module,exports){
2779
+ 'use strict';
2780
+
2781
+ var Type = require('../type');
2782
+
2783
+ function resolveYamlBoolean(data) {
2784
+ if (null === data) {
2785
+ return false;
2786
+ }
2787
+
2788
+ var max = data.length;
2789
+
2790
+ return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
2791
+ (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
2792
+ }
2793
+
2794
+ function constructYamlBoolean(data) {
2795
+ return data === 'true' ||
2796
+ data === 'True' ||
2797
+ data === 'TRUE';
2798
+ }
2799
+
2800
+ function isBoolean(object) {
2801
+ return '[object Boolean]' === Object.prototype.toString.call(object);
2802
+ }
2803
+
2804
+ module.exports = new Type('tag:yaml.org,2002:bool', {
2805
+ kind: 'scalar',
2806
+ resolve: resolveYamlBoolean,
2807
+ construct: constructYamlBoolean,
2808
+ predicate: isBoolean,
2809
+ represent: {
2810
+ lowercase: function (object) { return object ? 'true' : 'false'; },
2811
+ uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
2812
+ camelcase: function (object) { return object ? 'True' : 'False'; }
2813
+ },
2814
+ defaultStyle: 'lowercase'
2815
+ });
2816
+
2817
+ },{"../type":13}],16:[function(require,module,exports){
2818
+ 'use strict';
2819
+
2820
+ var common = require('../common');
2821
+ var Type = require('../type');
2822
+
2823
+ var YAML_FLOAT_PATTERN = new RegExp(
2824
+ '^(?:[-+]?(?:[0-9][0-9_]*)\\.[0-9_]*(?:[eE][-+][0-9]+)?' +
2825
+ '|\\.[0-9_]+(?:[eE][-+][0-9]+)?' +
2826
+ '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
2827
+ '|[-+]?\\.(?:inf|Inf|INF)' +
2828
+ '|\\.(?:nan|NaN|NAN))$');
2829
+
2830
+ function resolveYamlFloat(data) {
2831
+ if (null === data) {
2832
+ return false;
2833
+ }
2834
+
2835
+ var value, sign, base, digits;
2836
+
2837
+ if (!YAML_FLOAT_PATTERN.test(data)) {
2838
+ return false;
2839
+ }
2840
+ return true;
2841
+ }
2842
+
2843
+ function constructYamlFloat(data) {
2844
+ var value, sign, base, digits;
2845
+
2846
+ value = data.replace(/_/g, '').toLowerCase();
2847
+ sign = '-' === value[0] ? -1 : 1;
2848
+ digits = [];
2849
+
2850
+ if (0 <= '+-'.indexOf(value[0])) {
2851
+ value = value.slice(1);
2852
+ }
2853
+
2854
+ if ('.inf' === value) {
2855
+ return (1 === sign) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
2856
+
2857
+ } else if ('.nan' === value) {
2858
+ return NaN;
2859
+
2860
+ } else if (0 <= value.indexOf(':')) {
2861
+ value.split(':').forEach(function (v) {
2862
+ digits.unshift(parseFloat(v, 10));
2863
+ });
2864
+
2865
+ value = 0.0;
2866
+ base = 1;
2867
+
2868
+ digits.forEach(function (d) {
2869
+ value += d * base;
2870
+ base *= 60;
2871
+ });
2872
+
2873
+ return sign * value;
2874
+
2875
+ } else {
2876
+ return sign * parseFloat(value, 10);
2877
+ }
2878
+ }
2879
+
2880
+ function representYamlFloat(object, style) {
2881
+ if (isNaN(object)) {
2882
+ switch (style) {
2883
+ case 'lowercase':
2884
+ return '.nan';
2885
+ case 'uppercase':
2886
+ return '.NAN';
2887
+ case 'camelcase':
2888
+ return '.NaN';
2889
+ }
2890
+ } else if (Number.POSITIVE_INFINITY === object) {
2891
+ switch (style) {
2892
+ case 'lowercase':
2893
+ return '.inf';
2894
+ case 'uppercase':
2895
+ return '.INF';
2896
+ case 'camelcase':
2897
+ return '.Inf';
2898
+ }
2899
+ } else if (Number.NEGATIVE_INFINITY === object) {
2900
+ switch (style) {
2901
+ case 'lowercase':
2902
+ return '-.inf';
2903
+ case 'uppercase':
2904
+ return '-.INF';
2905
+ case 'camelcase':
2906
+ return '-.Inf';
2907
+ }
2908
+ } else if (common.isNegativeZero(object)) {
2909
+ return '-0.0';
2910
+ } else {
2911
+ return object.toString(10);
2912
+ }
2913
+ }
2914
+
2915
+ function isFloat(object) {
2916
+ return ('[object Number]' === Object.prototype.toString.call(object)) &&
2917
+ (0 !== object % 1 || common.isNegativeZero(object));
2918
+ }
2919
+
2920
+ module.exports = new Type('tag:yaml.org,2002:float', {
2921
+ kind: 'scalar',
2922
+ resolve: resolveYamlFloat,
2923
+ construct: constructYamlFloat,
2924
+ predicate: isFloat,
2925
+ represent: representYamlFloat,
2926
+ defaultStyle: 'lowercase'
2927
+ });
2928
+
2929
+ },{"../common":2,"../type":13}],17:[function(require,module,exports){
2930
+ 'use strict';
2931
+
2932
+ var common = require('../common');
2933
+ var Type = require('../type');
2934
+
2935
+ function isHexCode(c) {
2936
+ return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
2937
+ ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
2938
+ ((0x61/* a */ <= c) && (c <= 0x66/* f */));
2939
+ }
2940
+
2941
+ function isOctCode(c) {
2942
+ return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
2943
+ }
2944
+
2945
+ function isDecCode(c) {
2946
+ return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
2947
+ }
2948
+
2949
+ function resolveYamlInteger(data) {
2950
+ if (null === data) {
2951
+ return false;
2952
+ }
2953
+
2954
+ var max = data.length,
2955
+ index = 0,
2956
+ hasDigits = false,
2957
+ ch;
2958
+
2959
+ if (!max) { return false; }
2960
+
2961
+ ch = data[index];
2962
+
2963
+ // sign
2964
+ if (ch === '-' || ch === '+') {
2965
+ ch = data[++index];
2966
+ }
2967
+
2968
+ if (ch === '0') {
2969
+ // 0
2970
+ if (index+1 === max) { return true; }
2971
+ ch = data[++index];
2972
+
2973
+ // base 2, base 8, base 16
2974
+
2975
+ if (ch === 'b') {
2976
+ // base 2
2977
+ index++;
2978
+
2979
+ for (; index < max; index++) {
2980
+ ch = data[index];
2981
+ if (ch === '_') { continue; }
2982
+ if (ch !== '0' && ch !== '1') {
2983
+ return false;
2984
+ }
2985
+ hasDigits = true;
2986
+ }
2987
+ return hasDigits;
2988
+ }
2989
+
2990
+
2991
+ if (ch === 'x') {
2992
+ // base 16
2993
+ index++;
2994
+
2995
+ for (; index < max; index++) {
2996
+ ch = data[index];
2997
+ if (ch === '_') { continue; }
2998
+ if (!isHexCode(data.charCodeAt(index))) {
2999
+ return false;
3000
+ }
3001
+ hasDigits = true;
3002
+ }
3003
+ return hasDigits;
3004
+ }
3005
+
3006
+ // base 8
3007
+ for (; index < max; index++) {
3008
+ ch = data[index];
3009
+ if (ch === '_') { continue; }
3010
+ if (!isOctCode(data.charCodeAt(index))) {
3011
+ return false;
3012
+ }
3013
+ hasDigits = true;
3014
+ }
3015
+ return hasDigits;
3016
+ }
3017
+
3018
+ // base 10 (except 0) or base 60
3019
+
3020
+ for (; index < max; index++) {
3021
+ ch = data[index];
3022
+ if (ch === '_') { continue; }
3023
+ if (ch === ':') { break; }
3024
+ if (!isDecCode(data.charCodeAt(index))) {
3025
+ return false;
3026
+ }
3027
+ hasDigits = true;
3028
+ }
3029
+
3030
+ if (!hasDigits) { return false; }
3031
+
3032
+ // if !base60 - done;
3033
+ if (ch !== ':') { return true; }
3034
+
3035
+ // base60 almost not used, no needs to optimize
3036
+ return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
3037
+ }
3038
+
3039
+ function constructYamlInteger(data) {
3040
+ var value = data, sign = 1, ch, base, digits = [];
3041
+
3042
+ if (value.indexOf('_') !== -1) {
3043
+ value = value.replace(/_/g, '');
3044
+ }
3045
+
3046
+ ch = value[0];
3047
+
3048
+ if (ch === '-' || ch === '+') {
3049
+ if (ch === '-') { sign = -1; }
3050
+ value = value.slice(1);
3051
+ ch = value[0];
3052
+ }
3053
+
3054
+ if ('0' === value) {
3055
+ return 0;
3056
+ }
3057
+
3058
+ if (ch === '0') {
3059
+ if (value[1] === 'b') {
3060
+ return sign * parseInt(value.slice(2), 2);
3061
+ }
3062
+ if (value[1] === 'x') {
3063
+ return sign * parseInt(value, 16);
3064
+ }
3065
+ return sign * parseInt(value, 8);
3066
+
3067
+ }
3068
+
3069
+ if (value.indexOf(':') !== -1) {
3070
+ value.split(':').forEach(function (v) {
3071
+ digits.unshift(parseInt(v, 10));
3072
+ });
3073
+
3074
+ value = 0;
3075
+ base = 1;
3076
+
3077
+ digits.forEach(function (d) {
3078
+ value += (d * base);
3079
+ base *= 60;
3080
+ });
3081
+
3082
+ return sign * value;
3083
+
3084
+ }
3085
+
3086
+ return sign * parseInt(value, 10);
3087
+ }
3088
+
3089
+ function isInteger(object) {
3090
+ return ('[object Number]' === Object.prototype.toString.call(object)) &&
3091
+ (0 === object % 1 && !common.isNegativeZero(object));
3092
+ }
3093
+
3094
+ module.exports = new Type('tag:yaml.org,2002:int', {
3095
+ kind: 'scalar',
3096
+ resolve: resolveYamlInteger,
3097
+ construct: constructYamlInteger,
3098
+ predicate: isInteger,
3099
+ represent: {
3100
+ binary: function (object) { return '0b' + object.toString(2); },
3101
+ octal: function (object) { return '0' + object.toString(8); },
3102
+ decimal: function (object) { return object.toString(10); },
3103
+ hexadecimal: function (object) { return '0x' + object.toString(16).toUpperCase(); }
3104
+ },
3105
+ defaultStyle: 'decimal',
3106
+ styleAliases: {
3107
+ binary: [ 2, 'bin' ],
3108
+ octal: [ 8, 'oct' ],
3109
+ decimal: [ 10, 'dec' ],
3110
+ hexadecimal: [ 16, 'hex' ]
3111
+ }
3112
+ });
3113
+
3114
+ },{"../common":2,"../type":13}],18:[function(require,module,exports){
3115
+ 'use strict';
3116
+
3117
+ var esprima;
3118
+
3119
+ // Browserified version does not have esprima
3120
+ //
3121
+ // 1. For node.js just require module as deps
3122
+ // 2. For browser try to require mudule via external AMD system.
3123
+ // If not found - try to fallback to window.esprima. If not
3124
+ // found too - then fail to parse.
3125
+ //
3126
+ try {
3127
+ esprima = require('esprima');
3128
+ } catch (_) {
3129
+ /*global window */
3130
+ if (typeof window !== 'undefined') { esprima = window.esprima; }
3131
+ }
3132
+
3133
+ var Type = require('../../type');
3134
+
3135
+ function resolveJavascriptFunction(data) {
3136
+ if (null === data) {
3137
+ return false;
3138
+ }
3139
+
3140
+ try {
3141
+ var source = '(' + data + ')',
3142
+ ast = esprima.parse(source, { range: true }),
3143
+ params = [],
3144
+ body;
3145
+
3146
+ if ('Program' !== ast.type ||
3147
+ 1 !== ast.body.length ||
3148
+ 'ExpressionStatement' !== ast.body[0].type ||
3149
+ 'FunctionExpression' !== ast.body[0].expression.type) {
3150
+ return false;
3151
+ }
3152
+
3153
+ return true;
3154
+ } catch (err) {
3155
+ return false;
3156
+ }
3157
+ }
3158
+
3159
+ function constructJavascriptFunction(data) {
3160
+ /*jslint evil:true*/
3161
+
3162
+ var source = '(' + data + ')',
3163
+ ast = esprima.parse(source, { range: true }),
3164
+ params = [],
3165
+ body;
3166
+
3167
+ if ('Program' !== ast.type ||
3168
+ 1 !== ast.body.length ||
3169
+ 'ExpressionStatement' !== ast.body[0].type ||
3170
+ 'FunctionExpression' !== ast.body[0].expression.type) {
3171
+ throw new Error('Failed to resolve function');
3172
+ }
3173
+
3174
+ ast.body[0].expression.params.forEach(function (param) {
3175
+ params.push(param.name);
3176
+ });
3177
+
3178
+ body = ast.body[0].expression.body.range;
3179
+
3180
+ // Esprima's ranges include the first '{' and the last '}' characters on
3181
+ // function expressions. So cut them out.
3182
+ return new Function(params, source.slice(body[0]+1, body[1]-1));
3183
+ }
3184
+
3185
+ function representJavascriptFunction(object /*, style*/) {
3186
+ return object.toString();
3187
+ }
3188
+
3189
+ function isFunction(object) {
3190
+ return '[object Function]' === Object.prototype.toString.call(object);
3191
+ }
3192
+
3193
+ module.exports = new Type('tag:yaml.org,2002:js/function', {
3194
+ kind: 'scalar',
3195
+ resolve: resolveJavascriptFunction,
3196
+ construct: constructJavascriptFunction,
3197
+ predicate: isFunction,
3198
+ represent: representJavascriptFunction
3199
+ });
3200
+
3201
+ },{"../../type":13,"esprima":"esprima"}],19:[function(require,module,exports){
3202
+ 'use strict';
3203
+
3204
+ var Type = require('../../type');
3205
+
3206
+ function resolveJavascriptRegExp(data) {
3207
+ if (null === data) {
3208
+ return false;
3209
+ }
3210
+
3211
+ if (0 === data.length) {
3212
+ return false;
3213
+ }
3214
+
3215
+ var regexp = data,
3216
+ tail = /\/([gim]*)$/.exec(data),
3217
+ modifiers = '';
3218
+
3219
+ // if regexp starts with '/' it can have modifiers and must be properly closed
3220
+ // `/foo/gim` - modifiers tail can be maximum 3 chars
3221
+ if ('/' === regexp[0]) {
3222
+ if (tail) {
3223
+ modifiers = tail[1];
3224
+ }
3225
+
3226
+ if (modifiers.length > 3) { return false; }
3227
+ // if expression starts with /, is should be properly terminated
3228
+ if (regexp[regexp.length - modifiers.length - 1] !== '/') { return false; }
3229
+
3230
+ regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
3231
+ }
3232
+
3233
+ try {
3234
+ var dummy = new RegExp(regexp, modifiers);
3235
+ return true;
3236
+ } catch (error) {
3237
+ return false;
3238
+ }
3239
+ }
3240
+
3241
+ function constructJavascriptRegExp(data) {
3242
+ var regexp = data,
3243
+ tail = /\/([gim]*)$/.exec(data),
3244
+ modifiers = '';
3245
+
3246
+ // `/foo/gim` - tail can be maximum 4 chars
3247
+ if ('/' === regexp[0]) {
3248
+ if (tail) {
3249
+ modifiers = tail[1];
3250
+ }
3251
+ regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
3252
+ }
3253
+
3254
+ return new RegExp(regexp, modifiers);
3255
+ }
3256
+
3257
+ function representJavascriptRegExp(object /*, style*/) {
3258
+ var result = '/' + object.source + '/';
3259
+
3260
+ if (object.global) {
3261
+ result += 'g';
3262
+ }
3263
+
3264
+ if (object.multiline) {
3265
+ result += 'm';
3266
+ }
3267
+
3268
+ if (object.ignoreCase) {
3269
+ result += 'i';
3270
+ }
3271
+
3272
+ return result;
3273
+ }
3274
+
3275
+ function isRegExp(object) {
3276
+ return '[object RegExp]' === Object.prototype.toString.call(object);
3277
+ }
3278
+
3279
+ module.exports = new Type('tag:yaml.org,2002:js/regexp', {
3280
+ kind: 'scalar',
3281
+ resolve: resolveJavascriptRegExp,
3282
+ construct: constructJavascriptRegExp,
3283
+ predicate: isRegExp,
3284
+ represent: representJavascriptRegExp
3285
+ });
3286
+
3287
+ },{"../../type":13}],20:[function(require,module,exports){
3288
+ 'use strict';
3289
+
3290
+ var Type = require('../../type');
3291
+
3292
+ function resolveJavascriptUndefined() {
3293
+ return true;
3294
+ }
3295
+
3296
+ function constructJavascriptUndefined() {
3297
+ return undefined;
3298
+ }
3299
+
3300
+ function representJavascriptUndefined() {
3301
+ return '';
3302
+ }
3303
+
3304
+ function isUndefined(object) {
3305
+ return 'undefined' === typeof object;
3306
+ }
3307
+
3308
+ module.exports = new Type('tag:yaml.org,2002:js/undefined', {
3309
+ kind: 'scalar',
3310
+ resolve: resolveJavascriptUndefined,
3311
+ construct: constructJavascriptUndefined,
3312
+ predicate: isUndefined,
3313
+ represent: representJavascriptUndefined
3314
+ });
3315
+
3316
+ },{"../../type":13}],21:[function(require,module,exports){
3317
+ 'use strict';
3318
+
3319
+ var Type = require('../type');
3320
+
3321
+ module.exports = new Type('tag:yaml.org,2002:map', {
3322
+ kind: 'mapping',
3323
+ construct: function (data) { return null !== data ? data : {}; }
3324
+ });
3325
+
3326
+ },{"../type":13}],22:[function(require,module,exports){
3327
+ 'use strict';
3328
+
3329
+ var Type = require('../type');
3330
+
3331
+ function resolveYamlMerge(data) {
3332
+ return '<<' === data || null === data;
3333
+ }
3334
+
3335
+ module.exports = new Type('tag:yaml.org,2002:merge', {
3336
+ kind: 'scalar',
3337
+ resolve: resolveYamlMerge
3338
+ });
3339
+
3340
+ },{"../type":13}],23:[function(require,module,exports){
3341
+ 'use strict';
3342
+
3343
+ var Type = require('../type');
3344
+
3345
+ function resolveYamlNull(data) {
3346
+ if (null === data) {
3347
+ return true;
3348
+ }
3349
+
3350
+ var max = data.length;
3351
+
3352
+ return (max === 1 && data === '~') ||
3353
+ (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
3354
+ }
3355
+
3356
+ function constructYamlNull() {
3357
+ return null;
3358
+ }
3359
+
3360
+ function isNull(object) {
3361
+ return null === object;
3362
+ }
3363
+
3364
+ module.exports = new Type('tag:yaml.org,2002:null', {
3365
+ kind: 'scalar',
3366
+ resolve: resolveYamlNull,
3367
+ construct: constructYamlNull,
3368
+ predicate: isNull,
3369
+ represent: {
3370
+ canonical: function () { return '~'; },
3371
+ lowercase: function () { return 'null'; },
3372
+ uppercase: function () { return 'NULL'; },
3373
+ camelcase: function () { return 'Null'; }
3374
+ },
3375
+ defaultStyle: 'lowercase'
3376
+ });
3377
+
3378
+ },{"../type":13}],24:[function(require,module,exports){
3379
+ 'use strict';
3380
+
3381
+ var Type = require('../type');
3382
+
3383
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
3384
+ var _toString = Object.prototype.toString;
3385
+
3386
+ function resolveYamlOmap(data) {
3387
+ if (null === data) {
3388
+ return true;
3389
+ }
3390
+
3391
+ var objectKeys = [], index, length, pair, pairKey, pairHasKey,
3392
+ object = data;
3393
+
3394
+ for (index = 0, length = object.length; index < length; index += 1) {
3395
+ pair = object[index];
3396
+ pairHasKey = false;
3397
+
3398
+ if ('[object Object]' !== _toString.call(pair)) {
3399
+ return false;
3400
+ }
3401
+
3402
+ for (pairKey in pair) {
3403
+ if (_hasOwnProperty.call(pair, pairKey)) {
3404
+ if (!pairHasKey) {
3405
+ pairHasKey = true;
3406
+ } else {
3407
+ return false;
3408
+ }
3409
+ }
3410
+ }
3411
+
3412
+ if (!pairHasKey) {
3413
+ return false;
3414
+ }
3415
+
3416
+ if (-1 === objectKeys.indexOf(pairKey)) {
3417
+ objectKeys.push(pairKey);
3418
+ } else {
3419
+ return false;
3420
+ }
3421
+ }
3422
+
3423
+ return true;
3424
+ }
3425
+
3426
+ function constructYamlOmap(data) {
3427
+ return null !== data ? data : [];
3428
+ }
3429
+
3430
+ module.exports = new Type('tag:yaml.org,2002:omap', {
3431
+ kind: 'sequence',
3432
+ resolve: resolveYamlOmap,
3433
+ construct: constructYamlOmap
3434
+ });
3435
+
3436
+ },{"../type":13}],25:[function(require,module,exports){
3437
+ 'use strict';
3438
+
3439
+ var Type = require('../type');
3440
+
3441
+ var _toString = Object.prototype.toString;
3442
+
3443
+ function resolveYamlPairs(data) {
3444
+ if (null === data) {
3445
+ return true;
3446
+ }
3447
+
3448
+ var index, length, pair, keys, result,
3449
+ object = data;
3450
+
3451
+ result = new Array(object.length);
3452
+
3453
+ for (index = 0, length = object.length; index < length; index += 1) {
3454
+ pair = object[index];
3455
+
3456
+ if ('[object Object]' !== _toString.call(pair)) {
3457
+ return false;
3458
+ }
3459
+
3460
+ keys = Object.keys(pair);
3461
+
3462
+ if (1 !== keys.length) {
3463
+ return false;
3464
+ }
3465
+
3466
+ result[index] = [ keys[0], pair[keys[0]] ];
3467
+ }
3468
+
3469
+ return true;
3470
+ }
3471
+
3472
+ function constructYamlPairs(data) {
3473
+ if (null === data) {
3474
+ return [];
3475
+ }
3476
+
3477
+ var index, length, pair, keys, result,
3478
+ object = data;
3479
+
3480
+ result = new Array(object.length);
3481
+
3482
+ for (index = 0, length = object.length; index < length; index += 1) {
3483
+ pair = object[index];
3484
+
3485
+ keys = Object.keys(pair);
3486
+
3487
+ result[index] = [ keys[0], pair[keys[0]] ];
3488
+ }
3489
+
3490
+ return result;
3491
+ }
3492
+
3493
+ module.exports = new Type('tag:yaml.org,2002:pairs', {
3494
+ kind: 'sequence',
3495
+ resolve: resolveYamlPairs,
3496
+ construct: constructYamlPairs
3497
+ });
3498
+
3499
+ },{"../type":13}],26:[function(require,module,exports){
3500
+ 'use strict';
3501
+
3502
+ var Type = require('../type');
3503
+
3504
+ module.exports = new Type('tag:yaml.org,2002:seq', {
3505
+ kind: 'sequence',
3506
+ construct: function (data) { return null !== data ? data : []; }
3507
+ });
3508
+
3509
+ },{"../type":13}],27:[function(require,module,exports){
3510
+ 'use strict';
3511
+
3512
+ var Type = require('../type');
3513
+
3514
+ var _hasOwnProperty = Object.prototype.hasOwnProperty;
3515
+
3516
+ function resolveYamlSet(data) {
3517
+ if (null === data) {
3518
+ return true;
3519
+ }
3520
+
3521
+ var key, object = data;
3522
+
3523
+ for (key in object) {
3524
+ if (_hasOwnProperty.call(object, key)) {
3525
+ if (null !== object[key]) {
3526
+ return false;
3527
+ }
3528
+ }
3529
+ }
3530
+
3531
+ return true;
3532
+ }
3533
+
3534
+ function constructYamlSet(data) {
3535
+ return null !== data ? data : {};
3536
+ }
3537
+
3538
+ module.exports = new Type('tag:yaml.org,2002:set', {
3539
+ kind: 'mapping',
3540
+ resolve: resolveYamlSet,
3541
+ construct: constructYamlSet
3542
+ });
3543
+
3544
+ },{"../type":13}],28:[function(require,module,exports){
3545
+ 'use strict';
3546
+
3547
+ var Type = require('../type');
3548
+
3549
+ module.exports = new Type('tag:yaml.org,2002:str', {
3550
+ kind: 'scalar',
3551
+ construct: function (data) { return null !== data ? data : ''; }
3552
+ });
3553
+
3554
+ },{"../type":13}],29:[function(require,module,exports){
3555
+ 'use strict';
3556
+
3557
+ var Type = require('../type');
3558
+
3559
+ var YAML_TIMESTAMP_REGEXP = new RegExp(
3560
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
3561
+ '-([0-9][0-9]?)' + // [2] month
3562
+ '-([0-9][0-9]?)' + // [3] day
3563
+ '(?:(?:[Tt]|[ \\t]+)' + // ...
3564
+ '([0-9][0-9]?)' + // [4] hour
3565
+ ':([0-9][0-9])' + // [5] minute
3566
+ ':([0-9][0-9])' + // [6] second
3567
+ '(?:\\.([0-9]*))?' + // [7] fraction
3568
+ '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
3569
+ '(?::([0-9][0-9]))?))?)?$'); // [11] tz_minute
3570
+
3571
+ function resolveYamlTimestamp(data) {
3572
+ if (null === data) {
3573
+ return false;
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;
3586
+ }
3587
+
3588
+ function constructYamlTimestamp(data) {
3589
+ var match, year, month, day, hour, minute, second, fraction = 0,
3590
+ delta = null, tz_hour, tz_minute, date;
3591
+
3592
+ match = YAML_TIMESTAMP_REGEXP.exec(data);
3593
+
3594
+ if (null === match) {
3595
+ throw new Error('Date resolve error');
3596
+ }
3597
+
3598
+ // match: [1] year [2] month [3] day
3599
+
3600
+ year = +(match[1]);
3601
+ month = +(match[2]) - 1; // JS month starts with 0
3602
+ day = +(match[3]);
3603
+
3604
+ if (!match[4]) { // no hour
3605
+ return new Date(Date.UTC(year, month, day));
3606
+ }
3607
+
3608
+ // match: [4] hour [5] minute [6] second [7] fraction
3609
+
3610
+ hour = +(match[4]);
3611
+ minute = +(match[5]);
3612
+ second = +(match[6]);
3613
+
3614
+ if (match[7]) {
3615
+ fraction = match[7].slice(0, 3);
3616
+ while (fraction.length < 3) { // milli-seconds
3617
+ fraction += '0';
3618
+ }
3619
+ fraction = +fraction;
3620
+ }
3621
+
3622
+ // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
3623
+
3624
+ if (match[9]) {
3625
+ tz_hour = +(match[10]);
3626
+ tz_minute = +(match[11] || 0);
3627
+ delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
3628
+ if ('-' === match[9]) {
3629
+ delta = -delta;
3630
+ }
3631
+ }
3632
+
3633
+ date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
3634
+
3635
+ if (delta) {
3636
+ date.setTime(date.getTime() - delta);
3637
+ }
3638
+
3639
+ return date;
3640
+ }
3641
+
3642
+ function representYamlTimestamp(object /*, style*/) {
3643
+ return object.toISOString();
3644
+ }
3645
+
3646
+ module.exports = new Type('tag:yaml.org,2002:timestamp', {
3647
+ kind: 'scalar',
3648
+ resolve: resolveYamlTimestamp,
3649
+ construct: constructYamlTimestamp,
3650
+ instanceOf: Date,
3651
+ represent: representYamlTimestamp
3652
+ });
3653
+
3654
+ },{"../type":13}],30:[function(require,module,exports){
3655
+
3656
+ },{}],"/":[function(require,module,exports){
3657
+ 'use strict';
3658
+
3659
+
3660
+ var yaml = require('./lib/js-yaml.js');
3661
+
3662
+
3663
+ module.exports = yaml;
3664
+
3665
+ },{"./lib/js-yaml.js":1}]},{},[])("/")
3666
+ });